Skip to content

[XCOFF] Use RLDs to print branches even without -r #74342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Dec 21, 2023
Merged
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/PowerPC/aix-return55.ll
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ entry:
;CHECKOBJ-NEXT: 1c: 67 8a bc de oris 10, 28, 48350{{[[:space:]] *}}
;CHECKOBJ32-NEXT: 00000020 <d>:
;CHECKOBJ64-NEXT: 0000000000000020 <d>:
;CHECKOBJ-NEXT: 20: 40 14 00 00 bdnzf 20, 0x20
;CHECKOBJ-NEXT: 20: 40 14 00 00 bdnzf 20, 0x20 <d>
;CHECKOBJ-NEXT: 24: 00 00 00 00 <unknown>{{[[:space:]] *}}
;CHECKOBJ32-NEXT: 00000028 <foo>:
;CHECKOBJ32-NEXT: 28: 00 00 00 00 <unknown>
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/CodeGen/PowerPC/aix-xcoff-funcsect.ll
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ entry:
; DIS32-NEXT: 40: 7c 08 02 a6 mflr 0
; DIS32-NEXT: 44: 94 21 ff c0 stwu 1, -64(1)
; DIS32-NEXT: 48: 90 01 00 48 stw 0, 72(1)
; DIS32-NEXT: 4c: 4b ff ff b5 bl 0x0 <.alias_foo>
; DIS32-NEXT: 4c: 4b ff ff b5 bl 0x0 <.foo>
; DIS32-NEXT: 0000004c: R_RBR (idx: 7) .foo[PR]
; DIS32-NEXT: 50: 60 00 00 00 nop
; DIS32-NEXT: 54: 48 00 00 6d bl 0xc0 <.static_overalign_foo>
Expand All @@ -198,7 +198,7 @@ entry:
; DIS32-NEXT: 5c: 4b ff ff a5 bl 0x0 <.alias_foo>
; DIS32-NEXT: 0000005c: R_RBR (idx: 9) .alias_foo
; DIS32-NEXT: 60: 60 00 00 00 nop
; DIS32-NEXT: 64: 4b ff ff 9d bl 0x0 <.alias_foo>
; DIS32-NEXT: 64: 4b ff ff 9d bl 0x0 <.extern_foo>
; DIS32-NEXT: 00000064: R_RBR (idx: 1) .extern_foo[PR]
; DIS32-NEXT: 68: 60 00 00 00 nop
; DIS32-NEXT: 6c: 4b ff ff b5 bl 0x20 <.hidden_foo>
Expand All @@ -212,7 +212,7 @@ entry:
; DIS64-NEXT: 40: 7c 08 02 a6 mflr 0
; DIS64-NEXT: 44: f8 21 ff 91 stdu 1, -112(1)
; DIS64-NEXT: 48: f8 01 00 80 std 0, 128(1)
; DIS64-NEXT: 4c: 4b ff ff b5 bl 0x0 <.alias_foo>
; DIS64-NEXT: 4c: 4b ff ff b5 bl 0x0 <.foo>
; DIS64-NEXT: 000000000000004c: R_RBR (idx: 7) .foo[PR]
; DIS64-NEXT: 50: 60 00 00 00 nop
; DIS64-NEXT: 54: 48 00 00 6d bl 0xc0 <.static_overalign_foo>
Expand All @@ -221,7 +221,7 @@ entry:
; DIS64-NEXT: 5c: 4b ff ff a5 bl 0x0 <.alias_foo>
; DIS64-NEXT: 000000000000005c: R_RBR (idx: 9) .alias_foo
; DIS64-NEXT: 60: 60 00 00 00 nop
; DIS64-NEXT: 64: 4b ff ff 9d bl 0x0 <.alias_foo>
; DIS64-NEXT: 64: 4b ff ff 9d bl 0x0 <.extern_foo>
; DIS64-NEXT: 0000000000000064: R_RBR (idx: 1) .extern_foo[PR]
; DIS64-NEXT: 68: 60 00 00 00 nop
; DIS64-NEXT: 6c: 4b ff ff b5 bl 0x20 <.hidden_foo>
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ declare i32 @bar(i32)
; SYM-NEXT: ]


; DIS: {{.*}}aix-xcoff-reloc.ll.tmp.o: file format aixcoff-rs6000
; DIS: : file format aixcoff-rs6000
Copy link
Contributor

@diggerlin diggerlin Dec 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change content of the line checking on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the temporary object file name is encoded in the FileCheck patterns, you're prevented from running commands by hand during development. For example, I frequently create an object file first, then run

llvm-objdump ... | FileCheck ...

to see if the test passes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can change to DIS: {{.*}} : file format aixcoff-rs6000.

; DIS: Disassembly of section .text:
; DIS: 00000000 <.foo>:
; DIS-NEXT: 0: 7c 08 02 a6 mflr 0
Expand Down Expand Up @@ -495,7 +495,7 @@ declare i32 @bar(i32)
; DIS: 00000084 <globalB>:
; DIS-NEXT: 84: 00 00 00 44 <unknown>

; DIS_REL: {{.*}}aix-xcoff-reloc.ll.tmp.o: file format aixcoff-rs6000
; DIS_REL: : file format aixcoff-rs6000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

; DIS_REL: RELOCATION RECORDS FOR [.text]:
; DIS_REL-NEXT: OFFSET TYPE VALUE
; DIS_REL-NEXT: 00000010 R_RBR .bar
Expand All @@ -515,7 +515,7 @@ declare i32 @bar(i32)
; DIS64-NEXT: 4: f8 21 ff 91 stdu 1, -112(1)
; DIS64-NEXT: 8: 38 60 00 01 li 3, 1
; DIS64-NEXT: c: f8 01 00 80 std 0, 128(1)
; DIS64-NEXT: 10: 4b ff ff f1 bl 0x0 <.foo>
; DIS64-NEXT: 10: 4b ff ff f1 bl 0x0 <.bar>
; DIS64-NEXT: 14: 60 00 00 00 nop
; DIS64-NEXT: 18: e8 82 00 00 ld 4, 0(2)
; DIS64-NEXT: 1c: e8 a2 00 08 ld 5, 8(2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
; CHECK-NEXT: 68: cmplwi 3, 11
; CHECK-NEXT: 6c: bt 0, 0x60 <L2>
; CHECK-NEXT: 70: mr 31, 3
; CHECK-NEXT: 74: bl 0x0 <.internal>
; CHECK-NEXT: 74: bl 0x0 <.extern>
; CHECK-NEXT: 78: nop
; CHECK-NEXT: 7c: mr 3, 31
; CHECK-NEXT: 80: b 0x60 <L2>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
; RUN: llc -mtriple=powerpc-ibm-aix-xcoff %s -filetype=obj -o %t
; RUN: llvm-objdump %t -r -d --symbolize-operands --no-show-raw-insn \
; RUN: | FileCheck %s

; CHECK-LABEL: <.a>:
;; No <L0> should appear
; CHECK-NEXT: 0: mflr 0
; CHECK-NEXT: 4: stwu 1, -64(1)
; CHECK-NEXT: 8: lwz 3, 0(2)
; CHECK-NEXT:0000000a: R_TOC var
; CHECK-NEXT: c: stw 0, 72(1)
; CHECK-NEXT: 10: lwz 3, 0(3)
; CHECK-NEXT: 14: bl 0x4c <.b>
; CHECK-NEXT: 18: nop
; CHECK-NEXT: 1c: li 3, 1
; CHECK-NEXT: 20: bl 0x0 <.c>
; CHECK-NEXT:00000020: R_RBR .c

; CHECK-LABEL: <.b>:
; CHECK-NEXT: 4c: mflr 0
; CHECK-NEXT: 50: stwu 1, -64(1)
; CHECK-NEXT: 54: cmplwi 3, 1
; CHECK-NEXT: 58: stw 0, 72(1)
; CHECK-NEXT: 5c: stw 3, 60(1)
; CHECK-NEXT: 60: bf 2, 0x6c <L0>
; CHECK-NEXT: 64: bl 0x0 <.a>
; CHECK-NEXT: 68: nop
; CHECK-NEXT:<L0>:
; CHECK-NEXT: 6c: li 3, 2
; CHECK-NEXT: 70: bl 0x0 <.c>
; CHECK-NEXT:00000070: R_RBR .c

target triple = "powerpc-ibm-aix7.2.0.0"

@var = external global i32, align 4

; Function Attrs: noinline nounwind optnone
define i32 @a() {
entry:
%0 = load i32, ptr @var, align 4
%call = call i32 @b(i32 noundef %0)
%call1 = call i32 @c(i32 noundef 1)
ret i32 %call1
}

; Function Attrs: noinline nounwind optnone
define i32 @b(i32 noundef %x) {
entry:
%x.addr = alloca i32, align 4
store i32 %x, ptr %x.addr, align 4
%0 = load i32, ptr %x.addr, align 4
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.end

if.then: ; preds = %entry
%call = call i32 @a()
br label %if.end

if.end: ; preds = %if.then, %entry
%call1 = call i32 @c(i32 noundef 2)
ret i32 %call1
}

declare i32 @c(i32 noundef)

1 change: 1 addition & 0 deletions llvm/tools/llvm-objdump/XCOFFDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ objdump::createXCOFFDumper(const object::XCOFFObjectFile &Obj) {

Error objdump::getXCOFFRelocationValueString(const XCOFFObjectFile &Obj,
const RelocationRef &Rel,
bool SymbolDescription,
SmallVectorImpl<char> &Result) {
symbol_iterator SymI = Rel.getSymbol();
if (SymI == Obj.symbol_end())
Expand Down
1 change: 1 addition & 0 deletions llvm/tools/llvm-objdump/XCOFFDump.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ std::string getXCOFFSymbolDescription(const SymbolInfoTy &SymbolInfo,

Error getXCOFFRelocationValueString(const object::XCOFFObjectFile &Obj,
const object::RelocationRef &RelRef,
bool SymbolDescription,
llvm::SmallVectorImpl<char> &Result);

void dumpTracebackTable(ArrayRef<uint8_t> Bytes, uint64_t Address,
Expand Down
Loading