From 7f6ba1758b0f00b19da9dac0a439e18bb4631107 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 24 Oct 2014 17:57:34 +0000 Subject: [PATCH] DebugInfo: Sink DwarfDebug::ScopeVariables down into DwarfFile (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 | 2 +- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 4 ++-- lib/CodeGen/AsmPrinter/DwarfDebug.h | 7 ------- lib/CodeGen/AsmPrinter/DwarfFile.cpp | 2 +- lib/CodeGen/AsmPrinter/DwarfFile.h | 7 +++++++ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index f1ee52da8d4..6fff9ecf290 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -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(); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 19c8c393293..68f10275dc6 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -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(); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index 2c7955dd087..c1215c046f7 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -193,11 +193,6 @@ class DwarfDebug : public AsmPrinterHandler { // Collection of abstract subprogram DIEs. DenseMap AbstractSPDies; - // Collection of dbg variables of a scope. - typedef DenseMap > - ScopeVariablesMap; - ScopeVariablesMap ScopeVariables; - // Collection of abstract variables. DenseMap> AbstractVariables; SmallVector, 64> ConcreteVariables; @@ -659,8 +654,6 @@ public: return AbstractSPDies; } - ScopeVariablesMap &getScopeVariables() { return ScopeVariables; } - SmallPtrSet &getProcessedSPNodes() { return ProcessedSPNodes; } diff --git a/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/lib/CodeGen/AsmPrinter/DwarfFile.cpp index e9df3854e78..3d49db3db7e 100644 --- a/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfFile.cpp @@ -156,7 +156,7 @@ void DwarfFile::emitStrings(const MCSection *StrSection, } void DwarfFile::addScopeVariable(LexicalScope *LS, DbgVariable *Var) { - SmallVectorImpl &Vars = DD.getScopeVariables()[LS]; + SmallVectorImpl &Vars = ScopeVariables[LS]; DIVariable DV = Var->getVariable(); // Variables with positive arg numbers are parameters. if (unsigned ArgNum = DV.getArgNumber()) { diff --git a/lib/CodeGen/AsmPrinter/DwarfFile.h b/lib/CodeGen/AsmPrinter/DwarfFile.h index 7183cd647cb..cfca3666f0f 100644 --- a/lib/CodeGen/AsmPrinter/DwarfFile.h +++ b/lib/CodeGen/AsmPrinter/DwarfFile.h @@ -50,6 +50,9 @@ class DwarfFile { DwarfStringPool StrPool; + // Collection of dbg variables of a scope. + DenseMap> 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> &getScopeVariables() { + return ScopeVariables; + } }; } #endif -- 2.34.1