Skip to content

Commit 7f3bf71

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.5-bogner
2 parents 6197205 + 8785865 commit 7f3bf71

File tree

4 files changed

+55
-2
lines changed

4 files changed

+55
-2
lines changed

llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,6 +1784,10 @@ void AArch64InstPrinter::printAlignedLabel(const MCInst *MI, uint64_t Address,
17841784
unsigned OpNum,
17851785
const MCSubtargetInfo &STI,
17861786
raw_ostream &O) {
1787+
// Do not print the numberic target address when symbolizing.
1788+
if (SymbolizeOperands)
1789+
return;
1790+
17871791
const MCOperand &Op = MI->getOperand(OpNum);
17881792

17891793
// If the label has already been resolved to an immediate offset (say, when
@@ -1813,6 +1817,12 @@ void AArch64InstPrinter::printAdrAdrpLabel(const MCInst *MI, uint64_t Address,
18131817
unsigned OpNum,
18141818
const MCSubtargetInfo &STI,
18151819
raw_ostream &O) {
1820+
// Do not print the numberic target address when symbolizing.
1821+
// However, do print for ADRP, as this is typically used together with an ADD
1822+
// or an immediate-offset ldr/str and the label is likely at the wrong point.
1823+
if (SymbolizeOperands && MI->getOpcode() != AArch64::ADRP)
1824+
return;
1825+
18161826
const MCOperand &Op = MI->getOperand(OpNum);
18171827

18181828
// If the label has already been resolved to an immediate offset (say, when
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# RUN: yaml2obj %s -o %t
2+
# RUN: llvm-objdump %t -d --symbolize-operands --no-show-raw-insn --no-leading-addr | \
3+
# RUN: FileCheck %s --match-full-lines
4+
# RUN: llvm-objdump %t -d --symbolize-operands --no-show-raw-insn --no-leading-addr --adjust-vma=0x2000 | \
5+
# RUN: FileCheck %s --match-full-lines
6+
7+
## Expect to find the branch labels and global variable name.
8+
# CHECK: <_start>:
9+
# CHECK-NEXT: ldr x0, <symbol>
10+
# CHECK-NEXT: <L0>:
11+
# CHECK-NEXT: adrp x1, 0x{{[68]}}000 <symbol+0xff4>
12+
# CHECK-NEXT: adr x2, <symbol>
13+
# CHECK-NEXT: cmp x1, x2
14+
# CHECK-NEXT: b.eq <L1>
15+
# CHECK-NEXT: b <L0>
16+
# CHECK-NEXT: <L1>:
17+
# CHECK-NEXT: cbz x2, <L0>
18+
# CHECK-NEXT: ret
19+
20+
--- !ELF
21+
FileHeader:
22+
Class: ELFCLASS64
23+
Data: ELFDATA2LSB
24+
Type: ET_EXEC
25+
Machine: EM_AARCH64
26+
Sections:
27+
- Name: .text
28+
Type: SHT_PROGBITS
29+
Address: 0x4000
30+
Flags: [SHF_ALLOC, SHF_EXECINSTR]
31+
Content: '60800058010000d0228000103f0002eb40000054fcffff1762ffffb4c0035fd6'
32+
- Name: .data
33+
Type: SHT_PROGBITS
34+
Flags: [SHF_ALLOC, SHF_WRITE]
35+
Address: 0x5000
36+
Symbols:
37+
- Name: _start
38+
Section: .text
39+
Value: 0x4000
40+
- Name: symbol
41+
Section: .data
42+
Value: 0x500c

llvm/tools/llvm-objdump/llvm-objdump.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,8 +1495,9 @@ collectLocalBranchTargets(ArrayRef<uint8_t> Bytes, MCInstrAnalysis *MIA,
14951495
// Supported by certain targets.
14961496
const bool isPPC = STI->getTargetTriple().isPPC();
14971497
const bool isX86 = STI->getTargetTriple().isX86();
1498+
const bool isAArch64 = STI->getTargetTriple().isAArch64();
14981499
const bool isBPF = STI->getTargetTriple().isBPF();
1499-
if (!isPPC && !isX86 && !isBPF)
1500+
if (!isPPC && !isX86 && !isAArch64 && !isBPF)
15001501
return;
15011502

15021503
if (MIA)

mlir/include/mlir/Dialect/Arith/IR/ArithOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ def Arith_ScalingExtFOp
12711271
// TruncIOp
12721272
//===----------------------------------------------------------------------===//
12731273

1274-
def Arith_TruncIOp : Op<Arith_Dialect, "trunci",
1274+
def Arith_TruncIOp : Arith_Op<"trunci",
12751275
[Pure, SameOperandsAndResultShape, SameInputOutputTensorDims,
12761276
DeclareOpInterfaceMethods<CastOpInterface>,
12771277
DeclareOpInterfaceMethods<InferIntRangeInterface, ["inferResultRanges"]>,

0 commit comments

Comments
 (0)