[llvm] bf98aaa - [llvm-objdump] Use BBEntry::BBID to represent basic block numbers.
Rahman Lavaee via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 21 11:46:00 PDT 2023
Author: Rahman Lavaee
Date: 2023-07-21T11:45:31-07:00
New Revision: bf98aaae00465c1e52376f8e138e4c51eb526d12
URL: https://github.com/llvm/llvm-project/commit/bf98aaae00465c1e52376f8e138e4c51eb526d12
DIFF: https://github.com/llvm/llvm-project/commit/bf98aaae00465c1e52376f8e138e4c51eb526d12.diff
LOG: [llvm-objdump] Use BBEntry::BBID to represent basic block numbers.
Reviewed By: aidengrossman, mtrofin, JestrTulip
Differential Revision: https://reviews.llvm.org/D155464
Added:
Modified:
llvm/test/tools/llvm-objdump/X86/elf-bbaddrmap-disassemble-symbolize-operands.yaml
llvm/tools/llvm-objdump/llvm-objdump.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-objdump/X86/elf-bbaddrmap-disassemble-symbolize-operands.yaml b/llvm/test/tools/llvm-objdump/X86/elf-bbaddrmap-disassemble-symbolize-operands.yaml
index cf4ac77b3d154c..2e9eb9af35615a 100644
--- a/llvm/test/tools/llvm-objdump/X86/elf-bbaddrmap-disassemble-symbolize-operands.yaml
+++ b/llvm/test/tools/llvm-objdump/X86/elf-bbaddrmap-disassemble-symbolize-operands.yaml
@@ -20,15 +20,15 @@
## Expect to find the branch and basic block labels and global variable name.
# ATT: <foo>:
-# ATT-NEXT: <BB0>:
+# ATT-NEXT: <BB3>:
# ATT-NEXT: pushq %rax
# ATT-NEXT: <BB1>:
# ATT-NEXT: cmpl , %eax <[[SYM]]>
# ATT-NEXT: nop
# ATT-NEXT: <BB2>:
-# ATT-NEXT: jge <BB3>
+# ATT-NEXT: jge <BB5>
# ATT-NEXT: jmp <BB1>
-# ATT-NEXT: <BB3>:
+# ATT-NEXT: <BB5>:
# ATT-NEXT: retq
# ATT: <bar>:
# ATT-NEXT: <BB0>:
@@ -42,15 +42,15 @@
# ATT-NEXT: retq
# INTEL: <foo>:
-# INTEL-NEXT: <BB0>:
+# INTEL-NEXT: <BB3>:
# INTEL-NEXT: push rax
# INTEL-NEXT: <BB1>:
# INTEL-NEXT: cmp eax, dword ptr <[[SYM]]>
# INTEL-NEXT: nop
# INTEL-NEXT: <BB2>:
-# INTEL-NEXT: jge <BB3>
+# INTEL-NEXT: jge <BB5>
# INTEL-NEXT: jmp <BB1>
-# INTEL-NEXT: <BB3>:
+# INTEL-NEXT: <BB5>:
# INTEL-NEXT: ret
# INTEL: <bar>:
# INTEL-NEXT: <BB0>:
@@ -92,19 +92,23 @@ Sections:
Type: SHT_LLVM_BB_ADDR_MAP
Link: .text.foo
Entries:
- - Version: 1
+ - Version: 2
Address: [[FOO_ADDR]]
BBEntries:
- - AddressOffset: 0x0
+ - ID: 3
+ AddressOffset: 0x0
Size: 0x1
Metadata: 0x1
- - AddressOffset: 0x0
+ - ID: 1
+ AddressOffset: 0x0
Size: 0x6
Metadata: 0x0
- - AddressOffset: 0x1
+ - ID: 2
+ AddressOffset: 0x1
Size: 0x4
Metadata: 0x0
- - AddressOffset: 0x0
+ - ID: 5
+ AddressOffset: 0x0
Size: 0x1
Metadata: 0x2
- Name: .llvm_bb_addr_map.bar
@@ -162,19 +166,23 @@ Sections:
Type: SHT_LLVM_BB_ADDR_MAP
Link: .text.foo
Entries:
- - Version: 1
+ - Version: 2
Address: 0x4000
BBEntries:
- - AddressOffset: 0x0
+ - ID: 3
+ AddressOffset: 0x0
Size: 0x1
Metadata: 0x1
- - AddressOffset: 0x0
+ - ID: 1
+ AddressOffset: 0x0
Size: 0x6
Metadata: 0x0
- - AddressOffset: 0x1
+ - ID: 2
+ AddressOffset: 0x1
Size: 0x4
Metadata: 0x0
- - AddressOffset: 0x0
+ - ID: 5
+ AddressOffset: 0x0
Size: 0x1
Metadata: 0x2
- Version: 1
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 0ed614c8bf2aba..bd45ed199767f9 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1156,11 +1156,11 @@ collectBBAddrMapLabels(const std::unordered_map<uint64_t, BBAddrMap> &AddrToBBAd
auto Iter = AddrToBBAddrMap.find(StartAddress);
if (Iter == AddrToBBAddrMap.end())
return;
- for (unsigned I = 0, Size = Iter->second.BBEntries.size(); I < Size; ++I) {
- uint64_t BBAddress = Iter->second.BBEntries[I].Offset + Iter->second.Addr;
+ for (const BBAddrMap::BBEntry &BBEntry : Iter->second.BBEntries) {
+ uint64_t BBAddress = BBEntry.Offset + Iter->second.Addr;
if (BBAddress >= EndAddress)
continue;
- Labels[BBAddress].push_back(("BB" + Twine(I)).str());
+ Labels[BBAddress].push_back(("BB" + Twine(BBEntry.ID)).str());
}
}
More information about the llvm-commits
mailing list