[llvm] r219058 - Sink DwarfDebug::attachLowHighPC into DwarfCompileUnit

David Blaikie dblaikie at gmail.com
Sat Oct 4 08:58:47 PDT 2014


Author: dblaikie
Date: Sat Oct  4 10:58:47 2014
New Revision: 219058

URL: http://llvm.org/viewvc/llvm-project?rev=219058&view=rev
Log:
Sink DwarfDebug::attachLowHighPC into DwarfCompileUnit

One of many things to sink down into DwarfCompileUnit to allow handling
of subprograms in both the skeleton and dwo CU under Fission.

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

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=219058&r1=219057&r2=219058&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Sat Oct  4 10:58:47 2014
@@ -274,4 +274,18 @@ void DwarfCompileUnit::applyStmtList(DIE
              UnitDie.getValues()[stmtListIndex]);
 }
 
+void DwarfCompileUnit::attachLowHighPC(DIE &D, const MCSymbol *Begin,
+                                       const MCSymbol *End) {
+  assert(Begin && "Begin label should not be null!");
+  assert(End && "End label should not be null!");
+  assert(Begin->isDefined() && "Invalid starting label");
+  assert(End->isDefined() && "Invalid end label");
+
+  addLabelAddress(D, dwarf::DW_AT_low_pc, Begin);
+  if (DD->getDwarfVersion() < 4)
+    addLabelAddress(D, dwarf::DW_AT_high_pc, End);
+  else
+    addLabelDelta(D, dwarf::DW_AT_high_pc, End, Begin);
+}
+
 } // end llvm namespace

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=219058&r1=219057&r2=219058&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Sat Oct  4 10:58:47 2014
@@ -60,6 +60,8 @@ public:
 
   /// addRange - Add an address range to the list of ranges for this unit.
   void addRange(RangeSpan Range);
+
+  void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End);
 };
 
 } // end llvm namespace

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=219058&r1=219057&r2=219058&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sat Oct  4 10:58:47 2014
@@ -318,7 +318,7 @@ DIE &DwarfDebug::updateSubprogramScopeDI
                                           DISubprogram SP) {
   DIE *SPDie = SPCU.getOrCreateSubprogramDIE(SP);
 
-  attachLowHighPC(SPCU, *SPDie, FunctionBeginSym, FunctionEndSym);
+  SPCU.attachLowHighPC(*SPDie, FunctionBeginSym, FunctionEndSym);
   if (!CurFn->getTarget().Options.DisableFramePointerElim(*CurFn))
     SPCU.addFlag(*SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr);
 
@@ -394,8 +394,8 @@ void DwarfDebug::attachRangesOrLowHighPC
                                     const SmallVectorImpl<InsnRange> &Ranges) {
   assert(!Ranges.empty());
   if (Ranges.size() == 1)
-    attachLowHighPC(TheCU, Die, getLabelBeforeInsn(Ranges.front().first),
-                    getLabelAfterInsn(Ranges.front().second));
+    TheCU.attachLowHighPC(Die, getLabelBeforeInsn(Ranges.front().first),
+                          getLabelAfterInsn(Ranges.front().second));
   else
     addScopeRangeList(TheCU, Die, Ranges);
 }
@@ -977,7 +977,7 @@ void DwarfDebug::finalizeModuleInfo() {
                     0);
         } else {
           RangeSpan &Range = TheU->getRanges().back();
-          attachLowHighPC(U, U.getUnitDie(), Range.getStart(), Range.getEnd());
+          U.attachLowHighPC(U.getUnitDie(), Range.getStart(), Range.getEnd());
         }
       }
     }
@@ -2636,20 +2636,6 @@ void DwarfDebug::addDwarfTypeUnitType(Dw
   CU.addDIETypeSignature(RefDie, NewTU);
 }
 
-void DwarfDebug::attachLowHighPC(DwarfCompileUnit &Unit, DIE &D,
-                                 const MCSymbol *Begin, const MCSymbol *End) {
-  assert(Begin && "Begin label should not be null!");
-  assert(End && "End label should not be null!");
-  assert(Begin->isDefined() && "Invalid starting label");
-  assert(End->isDefined() && "Invalid end label");
-
-  Unit.addLabelAddress(D, dwarf::DW_AT_low_pc, Begin);
-  if (DwarfVersion < 4)
-    Unit.addLabelAddress(D, dwarf::DW_AT_high_pc, End);
-  else
-    Unit.addLabelDelta(D, dwarf::DW_AT_high_pc, End, Begin);
-}
-
 // Accelerator table mutators - add each name along with its companion
 // DIE to the proper table while ensuring that the name that we're going
 // to reference is in the string table. We do this since the names we

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=219058&r1=219057&r2=219058&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Sat Oct  4 10:58:47 2014
@@ -567,8 +567,6 @@ class DwarfDebug : public AsmPrinterHand
 
   void attachRangesOrLowHighPC(DwarfCompileUnit &Unit, DIE &D,
                                const SmallVectorImpl<InsnRange> &Ranges);
-  void attachLowHighPC(DwarfCompileUnit &Unit, DIE &D, const MCSymbol *Begin,
-                       const MCSymbol *End);
 
 public:
   //===--------------------------------------------------------------------===//





More information about the llvm-commits mailing list