summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2018-10-20 06:02:15 +0000
committerDavid Blaikie <dblaikie@gmail.com>2018-10-20 06:02:15 +0000
commit161dd3c186e480a4fd4ef8af395f5b0845ec9d5f (patch)
treea0a65f4cebe797cd411357e2c16995cc5f53db0d /llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
parent32e0a584f8ee86bca6714693dfdbb007d667119f (diff)
downloadbcm5719-llvm-161dd3c186e480a4fd4ef8af395f5b0845ec9d5f.tar.gz
bcm5719-llvm-161dd3c186e480a4fd4ef8af395f5b0845ec9d5f.zip
DebugInfo: Use debug_addr for non-dwo addresses in DWARF 5
Putting addresses in the address pool, even with non-fission, can reduce relocations - reusing the addresses from debug_info and debug_rnglists (the latter coming soon) llvm-svn: 344834
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
index 27895da8058..ed510a0e4cd 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -308,6 +308,7 @@ bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data,
break;
case DW_FORM_GNU_addr_index:
case DW_FORM_GNU_str_index:
+ case DW_FORM_addrx:
case DW_FORM_strx:
Value.uval = Data.getULEB128(OffsetPtr);
break;
@@ -340,13 +341,17 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const {
case DW_FORM_addr:
AddrOS << format("0x%016" PRIx64, UValue);
break;
+ case DW_FORM_addrx:
+ case DW_FORM_addrx1:
+ case DW_FORM_addrx2:
+ case DW_FORM_addrx3:
+ case DW_FORM_addrx4:
case DW_FORM_GNU_addr_index: {
AddrOS << format(" indexed (%8.8x) address = ", (uint32_t)UValue);
- uint64_t Address;
if (U == nullptr)
OS << "<invalid dwarf unit>";
- else if (U->getAddrOffsetSectionItem(UValue, Address))
- AddrOS << format("0x%016" PRIx64, Address);
+ else if (Optional<SectionedAddress> A = U->getAddrOffsetSectionItem(UValue))
+ AddrOS << format("0x%016" PRIx64, A->Address);
else
OS << "<no .debug_addr section>";
break;
@@ -555,16 +560,23 @@ Optional<const char *> DWARFFormValue::getAsCString() const {
}
Optional<uint64_t> DWARFFormValue::getAsAddress() const {
+ if (auto SA = getAsSectionedAddress())
+ return SA->Address;
+ return None;
+}
+Optional<SectionedAddress> DWARFFormValue::getAsSectionedAddress() const {
if (!isFormClass(FC_Address))
return None;
- if (Form == DW_FORM_GNU_addr_index) {
+ if (Form == DW_FORM_GNU_addr_index || Form == DW_FORM_addrx) {
uint32_t Index = Value.uval;
- uint64_t Result;
- if (!U || !U->getAddrOffsetSectionItem(Index, Result))
+ if (!U)
+ return None;
+ Optional<SectionedAddress> SA = U->getAddrOffsetSectionItem(Index);
+ if (!SA)
return None;
- return Result;
+ return SA;
}
- return Value.uval;
+ return {{Value.uval, Value.SectionIndex}};
}
Optional<uint64_t> DWARFFormValue::getAsReference() const {
OpenPOWER on IntegriCloud