[llvm] r346380 - NFC: DebugInfo: Track the origin CU rather than just the base address for range lists

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 7 16:35:54 PST 2018


Author: dblaikie
Date: Wed Nov  7 16:35:54 2018
New Revision: 346380

URL: http://llvm.org/viewvc/llvm-project?rev=346380&view=rev
Log:
NFC: DebugInfo: Track the origin CU rather than just the base address for range lists

Turns out knowing more than just the base address might be useful -
specifically a future change to respect a DICompileUnit flag for the use
of base address specifiers in DWARF < 5.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=346380&r1=346379&r2=346380&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed Nov  7 16:35:54 2018
@@ -430,8 +430,7 @@ void DwarfCompileUnit::addScopeRangeList
   // Add the range list to the set of ranges to be emitted.
   auto IndexAndList =
       (DD->getDwarfVersion() < 5 && Skeleton ? Skeleton->DU : DU)
-          ->addRange((Skeleton ? Skeleton->BaseAddress : BaseAddress),
-                     std::move(Range));
+          ->addRange(*(Skeleton ? Skeleton : this), std::move(Range));
 
   uint32_t Index = IndexAndList.first;
   auto &List = *IndexAndList.second;

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=346380&r1=346379&r2=346380&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Nov  7 16:35:54 2018
@@ -2275,7 +2275,8 @@ static void emitRangeList(DwarfDebug &DD
   for (const RangeSpan &Range : List.getRanges())
     SectionRanges[&Range.getStart()->getSection()].push_back(&Range);
 
-  const MCSymbol *CUBase = List.getBaseAddress();
+  const DwarfCompileUnit &CU = List.getCU();
+  const MCSymbol *CUBase = CU.getBaseAddress();
   bool BaseIsSet = false;
   for (const auto &P : SectionRanges) {
     // Don't bother with a base address entry if there's only one range in

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=346380&r1=346379&r2=346380&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp Wed Nov  7 16:35:54 2018
@@ -111,9 +111,8 @@ void DwarfFile::addScopeLabel(LexicalSco
 }
 
 std::pair<uint32_t, RangeSpanList *>
-DwarfFile::addRange(const MCSymbol *&CUBaseAddress,
-                    SmallVector<RangeSpan, 2> R) {
-  CURangeLists.push_back(RangeSpanList(Asm->createTempSymbol("debug_ranges"),
-                                       CUBaseAddress, std::move(R)));
+DwarfFile::addRange(const DwarfCompileUnit &CU, SmallVector<RangeSpan, 2> R) {
+  CURangeLists.push_back(
+      RangeSpanList(Asm->createTempSymbol("debug_ranges"), CU, std::move(R)));
   return std::make_pair(CURangeLists.size() - 1, &CURangeLists.back());
 }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h?rev=346380&r1=346379&r2=346380&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h Wed Nov  7 16:35:54 2018
@@ -48,17 +48,16 @@ class RangeSpanList {
 private:
   // Index for locating within the debug_range section this particular span.
   MCSymbol *RangeSym;
-  const MCSymbol **CUBaseAddress;
+  const DwarfCompileUnit *CU;
   // List of ranges.
   SmallVector<RangeSpan, 2> Ranges;
 
 public:
-  RangeSpanList(MCSymbol *Sym, const MCSymbol *&CUBaseAddress,
+  RangeSpanList(MCSymbol *Sym, const DwarfCompileUnit &CU,
                 SmallVector<RangeSpan, 2> Ranges)
-      : RangeSym(Sym), CUBaseAddress(&CUBaseAddress),
-        Ranges(std::move(Ranges)) {}
+      : RangeSym(Sym), CU(&CU), Ranges(std::move(Ranges)) {}
   MCSymbol *getSym() const { return RangeSym; }
-  const MCSymbol *&getBaseAddress() const { return *CUBaseAddress; }
+  const DwarfCompileUnit &getCU() const { return *CU; }
   const SmallVectorImpl<RangeSpan> &getRanges() const { return Ranges; }
   void addRange(RangeSpan Range) { Ranges.push_back(Range); }
 };
@@ -123,7 +122,7 @@ public:
     return CUs;
   }
 
-  std::pair<uint32_t, RangeSpanList *> addRange(const MCSymbol *&CUBaseAddress,
+  std::pair<uint32_t, RangeSpanList *> addRange(const DwarfCompileUnit &CU,
                                                 SmallVector<RangeSpan, 2> R);
 
   /// getRangeLists - Get the vector of range lists.




More information about the llvm-commits mailing list