[llvm] r196793 - DwarfDebug/Unit: Remove another case of label recreation by storing the gnu_ranges label in the unit.

David Blaikie dblaikie at gmail.com
Mon Dec 9 09:51:30 PST 2013


Author: dblaikie
Date: Mon Dec  9 11:51:30 2013
New Revision: 196793

URL: http://llvm.org/viewvc/llvm-project?rev=196793&view=rev
Log:
DwarfDebug/Unit: Remove another case of label recreation by storing the gnu_ranges label in the unit.

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

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=196793&r1=196792&r2=196793&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Dec  9 11:51:30 2013
@@ -2901,10 +2901,9 @@ void DwarfDebug::emitDebugRanges() {
                                                          E = CUMap.end();
        I != E; ++I) {
     CompileUnit *TheCU = I->second;
-    unsigned ID = TheCU->getUniqueID();
 
     // Emit a symbol so we can find the beginning of our ranges.
-    Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("gnu_ranges", ID));
+    Asm->OutStreamer.EmitLabel(TheCU->getLabelRange());
 
     // Iterate over the misc ranges for the compile units in the module.
     const SmallVectorImpl<RangeSpanList> &RangeLists = TheCU->getRangeLists();
@@ -2958,6 +2957,8 @@ CompileUnit *DwarfDebug::constructSkelet
   DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);
   CompileUnit *NewCU = new CompileUnit(CU->getUniqueID(), Die, CU->getNode(),
                                        Asm, this, &SkeletonHolder);
+  NewCU->initSection(Asm->getObjFileLowering().getDwarfInfoSection(),
+                     DwarfInfoSectionSym);
 
   NewCU->addLocalString(Die, dwarf::DW_AT_GNU_dwo_name,
                         CU->getNode().getSplitDebugFilename());
@@ -2992,11 +2993,8 @@ CompileUnit *DwarfDebug::constructSkelet
   // unit.
   if (!CU->getRangeLists().empty())
     addSectionLabel(Asm, NewCU, Die, dwarf::DW_AT_GNU_ranges_base,
-                    Asm->GetTempSymbol("gnu_ranges", NewCU->getUniqueID()),
-                    DwarfDebugRangeSectionSym);
+                    NewCU->getLabelRange(), DwarfDebugRangeSectionSym);
 
-  NewCU->initSection(Asm->getObjFileLowering().getDwarfInfoSection(),
-                     DwarfInfoSectionSym);
   SkeletonHolder.addUnit(NewCU);
 
   return NewCU;

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=196793&r1=196792&r2=196793&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Mon Dec  9 11:51:30 2013
@@ -140,6 +140,9 @@ protected:
   /// The end of the unit within its section.
   MCSymbol *LabelEnd;
 
+  /// The label for the start of the range sets for the elements of this unit.
+  MCSymbol *LabelRange;
+
   Unit(unsigned UID, DIE *D, DICompileUnit CU, AsmPrinter *A, DwarfDebug *DW,
        DwarfFile *DWU);
 
@@ -157,7 +160,9 @@ public:
         Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
     this->LabelEnd =
         Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
+    this->LabelRange = Asm->GetTempSymbol("gnu_ranges", getUniqueID());
   }
+
   const MCSection *getSection() const {
     assert(Section);
     return Section;
@@ -178,6 +183,11 @@ public:
     return LabelEnd;
   }
 
+  MCSymbol *getLabelRange() const {
+    assert(Section);
+    return LabelRange;
+  }
+
   // Accessors.
   unsigned getUniqueID() const { return UniqueID; }
   virtual uint16_t getLanguage() const = 0;





More information about the llvm-commits mailing list