diff options
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfFile.h | 13 |
4 files changed, 19 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 5707f962b4b..0f3d8c689fa 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -503,10 +503,10 @@ void DwarfCompileUnit::addScopeRangeList(DIE &ScopeDIE, const MCSymbol *RangeSectionSym = TLOF.getDwarfRangesSection()->getBeginSymbol(); if (isDwoUnit()) - addSectionDelta(ScopeDIE, dwarf::DW_AT_ranges, List.Label, + addSectionDelta(ScopeDIE, dwarf::DW_AT_ranges, List.getSym(), RangeSectionSym); else - addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges, List.Label, + addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges, List.getSym(), RangeSectionSym); } } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 62745f9bee7..aa33659cd06 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2331,7 +2331,7 @@ static MCSymbol *emitRnglistsTableHeader(AsmPrinter *Asm, Asm->OutStreamer->EmitLabel(Holder.getRnglistsTableBaseSym()); for (const RangeSpanList &List : Holder.getRangeLists()) - Asm->EmitLabelDifference(List.Label, Holder.getRnglistsTableBaseSym(), + Asm->EmitLabelDifference(List.getSym(), Holder.getRnglistsTableBaseSym(), 4); return TableEnd; @@ -2688,11 +2688,11 @@ void DwarfDebug::emitDebugARanges() { /// Emit a single range list. We handle both DWARF v5 and earlier. static void emitRangeList(DwarfDebug &DD, AsmPrinter *Asm, const RangeSpanList &List) { - emitRangeList(DD, Asm, List.Label, List.Ranges, *List.CU, + emitRangeList(DD, Asm, List.getSym(), List.getRanges(), List.getCU(), dwarf::DW_RLE_base_addressx, dwarf::DW_RLE_offset_pair, dwarf::DW_RLE_startx_length, dwarf::DW_RLE_end_of_list, llvm::dwarf::RangeListEncodingString, - List.CU->getCUNode()->getRangesBaseAddress() || + List.getCU().getCUNode()->getRangesBaseAddress() || DD.getDwarfVersion() >= 5, [](auto) {}); } @@ -2709,9 +2709,8 @@ void DwarfDebug::emitDebugRangesImpl(const DwarfFile &Holder, MCSection *Section Asm->OutStreamer->SwitchSection(Section); - MCSymbol *TableEnd = nullptr; - if (getDwarfVersion() < 5) - TableEnd = emitRnglistsTableHeader(Asm, Holder); + MCSymbol *TableEnd = + getDwarfVersion() < 5 ? nullptr : emitRnglistsTableHeader(Asm, Holder); for (const RangeSpanList &List : Holder.getRangeLists()) emitRangeList(*this, Asm, List); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp index e5c4db58f47..e3c9095d134 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp @@ -126,6 +126,6 @@ void DwarfFile::addScopeLabel(LexicalScope *LS, DbgLabel *Label) { std::pair<uint32_t, RangeSpanList *> DwarfFile::addRange(const DwarfCompileUnit &CU, SmallVector<RangeSpan, 2> R) { CURangeLists.push_back( - RangeSpanList{Asm->createTempSymbol("debug_ranges"), &CU, std::move(R)}); + RangeSpanList(Asm->createTempSymbol("debug_ranges"), CU, std::move(R))); return std::make_pair(CURangeLists.size() - 1, &CURangeLists.back()); } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h index cf293d7534d..35fa51fb24c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h @@ -37,12 +37,21 @@ struct RangeSpan { const MCSymbol *End; }; -struct RangeSpanList { +class RangeSpanList { +private: // Index for locating within the debug_range section this particular span. - MCSymbol *Label; + MCSymbol *RangeSym; const DwarfCompileUnit *CU; // List of ranges. SmallVector<RangeSpan, 2> Ranges; + +public: + RangeSpanList(MCSymbol *Sym, const DwarfCompileUnit &CU, + SmallVector<RangeSpan, 2> Ranges) + : RangeSym(Sym), CU(&CU), Ranges(std::move(Ranges)) {} + MCSymbol *getSym() const { return RangeSym; } + const DwarfCompileUnit &getCU() const { return *CU; } + const SmallVectorImpl<RangeSpan> &getRanges() const { return Ranges; } }; class DwarfFile { |