diff options
author | David Blaikie <dblaikie@gmail.com> | 2018-10-24 23:36:29 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2018-10-24 23:36:29 +0000 |
commit | 60fddac907a8759b02ff1ff2a60d426c1a0a9a8c (patch) | |
tree | 6e01fabcc18051b20cecf8140dfe6b318c276783 /llvm/lib | |
parent | ac764aa88ea8c23d0f14a1296667394deff07fc4 (diff) | |
download | bcm5719-llvm-60fddac907a8759b02ff1ff2a60d426c1a0a9a8c.tar.gz bcm5719-llvm-60fddac907a8759b02ff1ff2a60d426c1a0a9a8c.zip |
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.
llvm-svn: 345224
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 5 |
3 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 1d9c1d38a24..a32cd8bc904 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -277,6 +277,7 @@ void DwarfCompileUnit::addRange(RangeSpan Range) { (&CURanges.back().getEnd()->getSection() != &Range.getEnd()->getSection())) { CURanges.push_back(Range); + DD->addSectionLabel(Range.getStart()); return; } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 5f91674d9f0..7f9ef3eba90 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2171,6 +2171,7 @@ static void emitRangeList(DwarfDebug &DD, AsmPrinter *Asm, // 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 DICompileUnit &CU, StringRef Name, 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; +} diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index b98d9267455..c73d442af2f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -327,6 +327,8 @@ class DwarfDebug : public DebugHandlerBase { /// 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 |