DebugInfo: Sink DwarfDebug::ScopeVariables down into DwarfFile
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 24 Oct 2014 17:57:34 +0000 (17:57 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 24 Oct 2014 17:57:34 +0000 (17:57 +0000)
(part of refactoring to allow subprogram emission in both the skeleton
and main units to enable -gmlt-like data to be included in the skeleton
for live inlined backtracing purposes)

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

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

index f1ee52da8d480d3bc748ef585cd3c0ca70cfad0a..6fff9ecf29061d06ba3da08bf2ca527c437babb7 100644 (file)
@@ -530,7 +530,7 @@ DIE *DwarfCompileUnit::createScopeChildrenDIE(
     unsigned *ChildScopeCount) {
   DIE *ObjectPointer = nullptr;
 
-  for (DbgVariable *DV : DD->getScopeVariables().lookup(Scope))
+  for (DbgVariable *DV : DU->getScopeVariables().lookup(Scope))
     Children.push_back(constructVariableDIE(*DV, *Scope, ObjectPointer));
 
   unsigned ChildCountWithoutScopes = Children.size();
index 19c8c3932939155146f3b9fdcb2a38163189a60e..68f10275dc618b30b7ba2b5f8174143c12f25982 100644 (file)
@@ -1284,7 +1284,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
   // subroutines inside it.
   if (TheCU.getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly &&
       LScopes.getAbstractScopesList().empty() && !IsDarwin) {
-    assert(ScopeVariables.empty());
+    assert(InfoHolder.getScopeVariables().empty());
     assert(DbgValues.empty());
     // FIXME: This wouldn't be true in LTO with a -g (with inlining) CU followed
     // by a -gmlt CU. Add a test and remove this assertion.
@@ -1323,7 +1323,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
   // Ownership of DbgVariables is a bit subtle - ScopeVariables owns all the
   // DbgVariables except those that are also in AbstractVariables (since they
   // can be used cross-function)
-  ScopeVariables.clear();
+  InfoHolder.getScopeVariables().clear();
   DbgValues.clear();
   LabelsBeforeInsn.clear();
   LabelsAfterInsn.clear();
index 2c7955dd087e24f7a7d2a1140e806a93be228a6e..c1215c046f7fe6e799bd5ea904f1845ea31c224d 100644 (file)
@@ -193,11 +193,6 @@ class DwarfDebug : public AsmPrinterHandler {
   // Collection of abstract subprogram DIEs.
   DenseMap<const MDNode *, DIE *> AbstractSPDies;
 
-  // Collection of dbg variables of a scope.
-  typedef DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8> >
-  ScopeVariablesMap;
-  ScopeVariablesMap ScopeVariables;
-
   // Collection of abstract variables.
   DenseMap<const MDNode *, std::unique_ptr<DbgVariable>> AbstractVariables;
   SmallVector<std::unique_ptr<DbgVariable>, 64> ConcreteVariables;
@@ -659,8 +654,6 @@ public:
     return AbstractSPDies;
   }
 
-  ScopeVariablesMap &getScopeVariables() { return ScopeVariables; }
-
   SmallPtrSet<const MDNode *, 16> &getProcessedSPNodes() {
     return ProcessedSPNodes;
   }
index e9df3854e780b0663d617716f38e5987bfe2ed85..3d49db3db7e7bc69264367a950dfccab1f72ca98 100644 (file)
@@ -156,7 +156,7 @@ void DwarfFile::emitStrings(const MCSection *StrSection,
 }
 
 void DwarfFile::addScopeVariable(LexicalScope *LS, DbgVariable *Var) {
-  SmallVectorImpl<DbgVariable *> &Vars = DD.getScopeVariables()[LS];
+  SmallVectorImpl<DbgVariable *> &Vars = ScopeVariables[LS];
   DIVariable DV = Var->getVariable();
   // Variables with positive arg numbers are parameters.
   if (unsigned ArgNum = DV.getArgNumber()) {
index 7183cd647cbc5d5102f2198d412864842be4d8dc..cfca3666f0f84f86f8d990eacdca55ce3acbd868 100644 (file)
@@ -50,6 +50,9 @@ class DwarfFile {
 
   DwarfStringPool StrPool;
 
+  // Collection of dbg variables of a scope.
+  DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8>> ScopeVariables;
+
 public:
   DwarfFile(AsmPrinter *AP, DwarfDebug &DD, StringRef Pref,
             BumpPtrAllocator &DA);
@@ -85,6 +88,10 @@ public:
   DwarfStringPool &getStringPool() { return StrPool; }
 
   void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
+
+  DenseMap<LexicalScope *, SmallVector<DbgVariable *, 8>> &getScopeVariables() {
+    return ScopeVariables;
+  }
 };
 }
 #endif