[llvm] r345224 - DebugInfo: Reuse common addresses for rnglist base address selections
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 24 16:36:29 PDT 2018
Author: dblaikie
Date: Wed Oct 24 16:36:29 2018
New Revision: 345224
URL: http://llvm.org/viewvc/llvm-project?rev=345224&view=rev
Log:
DebugInfo: Reuse common addresses for rnglist base address selections
This makes the offsets larger (since they are further from the base
address) but those are in the .dwo - and allows removing addresses and
relocations from the .o file.
This could be built into the AddressPool more fundamentally, perhaps -
when you ask for an AddressPool entry you could say "or give me some
other entry and an offset I need to use" - though what to do about
situations where the first use of an address in a section is not the
earliest address in that section... is tricky.
At least with range addresses we can be fairly sure we've seen the
earliest address first because we see the start address for the
function.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/trunk/test/DebugInfo/X86/split-dwarf-v5-ranges.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=345224&r1=345223&r2=345224&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed Oct 24 16:36:29 2018
@@ -277,6 +277,7 @@ void DwarfCompileUnit::addRange(RangeSpa
(&CURanges.back().getEnd()->getSection() !=
&Range.getEnd()->getSection())) {
CURanges.push_back(Range);
+ DD->addSectionLabel(Range.getStart());
return;
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=345224&r1=345223&r2=345224&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Oct 24 16:36:29 2018
@@ -2171,6 +2171,7 @@ static void emitRangeList(DwarfDebug &DD
// the lowest address/range in this object.
Base = P.second.front()->getStart();
if (DwarfVersion >= 5) {
+ Base = DD.getSectionLabel(&Base->getSection());
Asm->OutStreamer->AddComment("DW_RLE_base_addressx");
Asm->OutStreamer->EmitIntValue(dwarf::DW_RLE_base_addressx, 1);
Asm->OutStreamer->AddComment(" base address index");
@@ -2623,3 +2624,11 @@ void DwarfDebug::addAccelType(const DICo
uint16_t DwarfDebug::getDwarfVersion() const {
return Asm->OutStreamer->getContext().getDwarfVersion();
}
+
+void DwarfDebug::addSectionLabel(const MCSymbol *Sym) {
+ SectionLabels.insert(std::make_pair(&Sym->getSection(), Sym));
+}
+
+const MCSymbol *DwarfDebug::getSectionLabel(const MCSection *S) {
+ return SectionLabels.find(S)->second;
+}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=345224&r1=345223&r2=345224&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Oct 24 16:36:29 2018
@@ -327,6 +327,8 @@ class DwarfDebug : public DebugHandlerBa
/// used to keep track of which types we have emitted type units for.
DenseMap<const MDNode *, uint64_t> TypeSignatures;
+ DenseMap<const MCSection *, const MCSymbol *> SectionLabels;
+
SmallVector<
std::pair<std::unique_ptr<DwarfTypeUnit>, const DICompositeType *>, 1>
TypeUnitsUnderConstruction;
@@ -721,6 +723,9 @@ public:
bool tuneForLLDB() const { return DebuggerTuning == DebuggerKind::LLDB; }
bool tuneForSCE() const { return DebuggerTuning == DebuggerKind::SCE; }
/// @}
+
+ void addSectionLabel(const MCSymbol *Sym);
+ const MCSymbol *getSectionLabel(const MCSection *S);
};
} // end namespace llvm
Modified: llvm/trunk/test/DebugInfo/X86/split-dwarf-v5-ranges.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/split-dwarf-v5-ranges.ll?rev=345224&r1=345223&r2=345224&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/split-dwarf-v5-ranges.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/split-dwarf-v5-ranges.ll Wed Oct 24 16:36:29 2018
@@ -13,9 +13,9 @@
; CHECK: 0x00000004 => 0x00000010
; CHECK: ]
; CHECK: ranges:
-; CHECK: 0x00000010: [DW_RLE_base_addressx]: 0x0000000000000002
-; CHECK: 0x00000012: [DW_RLE_offset_pair ]: 0x0000000000000000, 0x000000000000000b => [0x0000000000000001, 0x000000000000000c)
-; CHECK: 0x00000015: [DW_RLE_offset_pair ]: 0x000000000000000d, 0x0000000000000012 => [0x000000000000000e, 0x0000000000000013)
+; CHECK: 0x00000010: [DW_RLE_base_addressx]: 0x0000000000000000
+; CHECK: 0x00000012: [DW_RLE_offset_pair ]: 0x0000000000000001, 0x000000000000000c => [0x0000000000000001, 0x000000000000000c)
+; CHECK: 0x00000015: [DW_RLE_offset_pair ]: 0x000000000000000e, 0x0000000000000013 => [0x000000000000000e, 0x0000000000000013)
; CHECK: 0x00000018: [DW_RLE_end_of_list ]
; Function Attrs: noinline optnone uwtable
More information about the llvm-commits
mailing list