[PATCH] D95767: [obj2yaml, yaml2obj] Use Hex64 for BBAddressMap fields.
Rahman Lavaee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 31 15:31:29 PST 2021
rahmanl created this revision.
rahmanl added reviewers: jhenderson, grimar.
Herald added a subscriber: emaste.
rahmanl published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch let the yaml encoding use Hex64 values for NumBlocks, BB AddressOffset, BB Size, and BB Metadata.
Additionally, it changes the decoded values in elf2yaml to uint64_t to match DataExtractor::getULEB128 return type.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95767
Files:
llvm/include/llvm/ObjectYAML/ELFYAML.h
llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
llvm/tools/obj2yaml/elf2yaml.cpp
Index: llvm/tools/obj2yaml/elf2yaml.cpp
===================================================================
--- llvm/tools/obj2yaml/elf2yaml.cpp
+++ llvm/tools/obj2yaml/elf2yaml.cpp
@@ -852,13 +852,13 @@
DataExtractor::Cursor Cur(0);
while (Cur && Cur.tell() < Content.size()) {
uint64_t Address = Data.getAddress(Cur);
- uint32_t NumBlocks = Data.getULEB128(Cur);
+ uint64_t NumBlocks = Data.getULEB128(Cur);
std::vector<ELFYAML::BBAddrMapEntry::BBEntry> BBEntries;
// Read the specified number of BB entries, or until decoding fails.
- for (uint32_t BlockID = 0; Cur && BlockID < NumBlocks; ++BlockID) {
- uint32_t Offset = Data.getULEB128(Cur);
- uint32_t Size = Data.getULEB128(Cur);
- uint32_t Metadata = Data.getULEB128(Cur);
+ for (uint64_t BlockID = 0; Cur && BlockID < NumBlocks; ++BlockID) {
+ uint64_t Offset = Data.getULEB128(Cur);
+ uint64_t Size = Data.getULEB128(Cur);
+ uint64_t Metadata = Data.getULEB128(Cur);
BBEntries.push_back({Offset, Size, Metadata});
}
Entries.push_back({Address, BBEntries});
Index: llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
===================================================================
--- llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
+++ llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
@@ -22,10 +22,10 @@
# VALID-NEXT: - AddressOffset: 0x4
# VALID-NEXT: Size: 0x5
# VALID-NEXT: Metadata: 0x6
-# VALID-NEXT: - AddressOffset: 0x7
-# VALID-NEXT: Size: 0x8
-# VALID-NEXT: Metadata: 0x9
-# VALID-NEXT: - Address: 0x20
+# VALID-NEXT: - AddressOffset: 0xFFFFFFFFFFFFFFF7
+# VALID-NEXT: Size: 0xFFFFFFFFFFFFFFF8
+# VALID-NEXT: Metadata: 0xFFFFFFFFFFFFFFF9
+# VALID-NEXT: - Address: 0xFFFFFFFFFFFFFF20
# VALID-NEXT: BBEntries:
# VALID-NEXT: - AddressOffset: 0xA
# VALID-NEXT: Size: 0xB
@@ -48,10 +48,10 @@
- AddressOffset: 0x4
Size: 0x5
Metadata: 0x6
- - AddressOffset: 0x7
- Size: 0x8
- Metadata: 0x9
- - Address: 0x20
+ - AddressOffset: 0xFFFFFFFFFFFFFFF7
+ Size: 0xFFFFFFFFFFFFFFF8
+ Metadata: 0xFFFFFFFFFFFFFFF9
+ - Address: 0xFFFFFFFFFFFFFF20
BBEntries:
- AddressOffset: 0xA
Size: 0xB
Index: llvm/include/llvm/ObjectYAML/ELFYAML.h
===================================================================
--- llvm/include/llvm/ObjectYAML/ELFYAML.h
+++ llvm/include/llvm/ObjectYAML/ELFYAML.h
@@ -155,9 +155,9 @@
struct BBAddrMapEntry {
struct BBEntry {
- llvm::yaml::Hex32 AddressOffset;
- llvm::yaml::Hex32 Size;
- llvm::yaml::Hex32 Metadata;
+ llvm::yaml::Hex64 AddressOffset;
+ llvm::yaml::Hex64 Size;
+ llvm::yaml::Hex64 Metadata;
};
llvm::yaml::Hex64 Address;
Optional<std::vector<BBEntry>> BBEntries;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95767.320381.patch
Type: text/x-patch
Size: 3131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210131/3ac581ea/attachment.bin>
More information about the llvm-commits
mailing list