Sink most of DwarfDebug::constructAbstractSubprogramScopeDIE into DwarfCompileUnit
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 31 Oct 2014 21:57:02 +0000 (21:57 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 31 Oct 2014 21:57:02 +0000 (21:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221005 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 6b648df28a11c5a7c74cc3eadb0e2b3e70563ce3..ceb2a12bf7a63a2fcd5f34a43eae33c840ead52d 100644 (file)
@@ -586,8 +586,12 @@ DIE *DwarfCompileUnit::createAndAddScopeChildren(LexicalScope *Scope,
   return ObjectPointer;
 }
 
-DIE &
+void
 DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
+  DIE *&AbsDef = DD->getAbstractSPDies()[Scope->getScopeNode()];
+  if (AbsDef)
+    return;
+
   DISubprogram SP(Scope->getScopeNode());
 
   DIE *ContextDIE;
@@ -604,15 +608,14 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
 
   // Passing null as the associated DIDescriptor because the abstract definition
   // shouldn't be found by lookup.
-  DIE &AbsDef =
-      createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, DIDescriptor());
-  applySubprogramAttributesToDefinition(SP, AbsDef);
+  AbsDef =
+      &createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, DIDescriptor());
+  applySubprogramAttributesToDefinition(SP, *AbsDef);
 
   if (getCUNode().getEmissionKind() != DIBuilder::LineTablesOnly)
-    addUInt(AbsDef, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
-  if (DIE *ObjectPointer = createAndAddScopeChildren(Scope, AbsDef))
-    addDIEEntry(AbsDef, dwarf::DW_AT_object_pointer, *ObjectPointer);
-  return AbsDef;
+    addUInt(*AbsDef, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
+  if (DIE *ObjectPointer = createAndAddScopeChildren(Scope, *AbsDef))
+    addDIEEntry(*AbsDef, dwarf::DW_AT_object_pointer, *ObjectPointer);
 }
 
 std::unique_ptr<DIE>
index 855ca39031e346f112379cd5714f2f2b9fc002e5..f6b69ce2aa8f9b55e02ef500892296c76c3719cd 100644 (file)
@@ -121,7 +121,7 @@ public:
 
   DIE *createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE);
 
-  DIE &constructAbstractSubprogramScopeDIE(LexicalScope *Scope);
+  void constructAbstractSubprogramScopeDIE(LexicalScope *Scope);
 
   /// \brief Construct import_module DIE.
   std::unique_ptr<DIE>
index f9ef6d09ff56e5b117ecc0eb995a55c5437a97b6..0a03505311930715a38d5f379670898e0d86cfff 100644 (file)
@@ -337,15 +337,11 @@ void DwarfDebug::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
 
   const MDNode *SP = Scope->getScopeNode();
 
-  DIE *&AbsDef = AbstractSPDies[SP];
-  if (AbsDef)
-    return;
-
   ProcessedSPNodes.insert(SP);
 
   // Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram
   // was inlined from another compile unit.
-  AbsDef = &SPMap[SP]->constructAbstractSubprogramScopeDIE(Scope);
+  SPMap[SP]->constructAbstractSubprogramScopeDIE(Scope);
 }
 
 void DwarfDebug::addGnuPubAttributes(DwarfUnit &U, DIE &D) const {