Sink DwarfDebug::AbstractSPDies down into DwarfFile
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 1 Nov 2014 17:21:26 +0000 (17:21 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 1 Nov 2014 17:21:26 +0000 (17:21 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221051 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h
lib/CodeGen/AsmPrinter/DwarfFile.h

index bd63279f2fc9779c77944777d45f6e7a4ef0b2c3..6571b54cfcf70af066e3885bbc2a4cf13b3b7019 100644 (file)
@@ -416,7 +416,7 @@ DwarfCompileUnit::constructInlinedScopeDIE(LexicalScope *Scope) {
   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::createAndAddScopeChildren(LexicalScope *Scope,
 
 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::constructImportedEntityDIE(const DIImportedEntity &Module) {
 
 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::collectDeadVariables(DISubprogram SP) {
   if (Variables.getNumElements() == 0)
     return;
 
-  DIE *SPDIE = DD->getAbstractSPDies().lookup(SP);
+  DIE *SPDIE = DU->getAbstractSPDies().lookup(SP);
   if (!SPDIE)
     SPDIE = getDIE(SP);
   assert(SPDIE);
index c1215c046f7fe6e799bd5ea904f1845ea31c224d..849580af7aa1011e96409886871ac317ebab186e 100644 (file)
@@ -190,9 +190,6 @@ class DwarfDebug : public AsmPrinterHandler {
 
   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;
   }
index e4dc674bb698ad2ce6a52a98b8a66733f82b758f..40454cec3f42a27395041af30b5920ad51fe7659 100644 (file)
@@ -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