[llvm] r221051 - Sink DwarfDebug::AbstractSPDies down into DwarfFile

David Blaikie dblaikie at gmail.com
Sat Nov 1 10:21:26 PDT 2014


Author: dblaikie
Date: Sat Nov  1 12:21:26 2014
New Revision: 221051

URL: http://llvm.org/viewvc/llvm-project?rev=221051&view=rev
Log:
Sink DwarfDebug::AbstractSPDies down into DwarfFile

This is the first big step to allowing gmlt-like inline scope
information in the skeleton CU. While this commit doesn't change the
functionality, it's only a small step to call
"constructAbstractSubprogramDIE" on both the InfoHolder and the
SkeletonHolder (when in use) and that will at least create the abstract
SP dies in that case, though still not creating the other subprograms.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
    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=221051&r1=221050&r2=221051&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Sat Nov  1 12:21:26 2014
@@ -416,7 +416,7 @@ DwarfCompileUnit::constructInlinedScopeD
   DISubprogram InlinedSP = getDISubprogram(DS);
   // Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram
   // was inlined from another compile unit.
-  DIE *OriginDIE = DD->getAbstractSPDies()[InlinedSP];
+  DIE *OriginDIE = DU->getAbstractSPDies()[InlinedSP];
   assert(OriginDIE && "Unable to find original DIE for an inlined subprogram.");
 
   auto ScopeDIE = make_unique<DIE>(dwarf::DW_TAG_inlined_subroutine);
@@ -588,7 +588,7 @@ DIE *DwarfCompileUnit::createAndAddScope
 
 void
 DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
-  DIE *&AbsDef = DD->getAbstractSPDies()[Scope->getScopeNode()];
+  DIE *&AbsDef = DU->getAbstractSPDies()[Scope->getScopeNode()];
   if (AbsDef)
     return;
 
@@ -648,7 +648,7 @@ DwarfCompileUnit::constructImportedEntit
 
 void DwarfCompileUnit::finishSubprogramDefinition(DISubprogram SP) {
   DIE *D = getDIE(SP);
-  if (DIE *AbsSPDIE = DD->getAbstractSPDies().lookup(SP)) {
+  if (DIE *AbsSPDIE = DU->getAbstractSPDies().lookup(SP)) {
     if (D)
       // If this subprogram has an abstract definition, reference that
       addDIEEntry(*D, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
@@ -671,7 +671,7 @@ void DwarfCompileUnit::collectDeadVariab
   if (Variables.getNumElements() == 0)
     return;
 
-  DIE *SPDIE = DD->getAbstractSPDies().lookup(SP);
+  DIE *SPDIE = DU->getAbstractSPDies().lookup(SP);
   if (!SPDIE)
     SPDIE = getDIE(SP);
   assert(SPDIE);

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=221051&r1=221050&r2=221051&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Sat Nov  1 12:21:26 2014
@@ -190,9 +190,6 @@ class DwarfDebug : public AsmPrinterHand
 
   LexicalScopes LScopes;
 
-  // Collection of abstract subprogram DIEs.
-  DenseMap<const MDNode *, DIE *> AbstractSPDies;
-
   // Collection of abstract variables.
   DenseMap<const MDNode *, std::unique_ptr<DbgVariable>> AbstractVariables;
   SmallVector<std::unique_ptr<DbgVariable>, 64> ConcreteVariables;
@@ -650,10 +647,6 @@ public:
 
   // FIXME: Sink these functions down into DwarfFile/Dwarf*Unit.
 
-  DenseMap<const MDNode *, DIE *> &getAbstractSPDies() {
-    return AbstractSPDies;
-  }
-
   SmallPtrSet<const MDNode *, 16> &getProcessedSPNodes() {
     return ProcessedSPNodes;
   }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h?rev=221051&r1=221050&r2=221051&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.h Sat Nov  1 12:21:26 2014
@@ -54,6 +54,9 @@ class DwarfFile {
   // Collection of dbg variables of a scope.
   DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8>> ScopeVariables;
 
+  // Collection of abstract subprogram DIEs.
+  DenseMap<const MDNode *, DIE *> AbstractSPDies;
+
 public:
   DwarfFile(AsmPrinter *AP, DwarfDebug &DD, StringRef Pref,
             BumpPtrAllocator &DA);
@@ -93,6 +96,10 @@ public:
   DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8>> &getScopeVariables() {
     return ScopeVariables;
   }
+
+  DenseMap<const MDNode *, DIE *> &getAbstractSPDies() {
+    return AbstractSPDies;
+  }
 };
 }
 #endif





More information about the llvm-commits mailing list