diff options
author | Devang Patel <dpatel@apple.com> | 2011-08-15 23:36:40 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2011-08-15 23:36:40 +0000 |
commit | 3655a21b15e135927826eeb1917b42299ac95d67 (patch) | |
tree | 4bf3c48f690e3c7d07016456a575c5d2abffff41 /lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | e17a14e2debc9f900f8507e32496a77d55253753 (diff) | |
download | external_llvm-3655a21b15e135927826eeb1917b42299ac95d67.zip external_llvm-3655a21b15e135927826eeb1917b42299ac95d67.tar.gz external_llvm-3655a21b15e135927826eeb1917b42299ac95d67.tar.bz2 |
Continue to hoist uses of getCompileUnit() up. The goal is to get rid of uses of getCompileUnit().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137683 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 874064c..f4344eb 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -539,28 +539,22 @@ CompileUnit *DwarfDebug::getCompileUnit(const MDNode *N) const { } /// constructGlobalVariableDIE - Construct global variable DIE. -void DwarfDebug::constructGlobalVariableDIE(const MDNode *N) { +void DwarfDebug::constructGlobalVariableDIE(CompileUnit *TheCU, + const MDNode *N) { DIGlobalVariable GV(N); // If debug information is malformed then ignore it. if (GV.Verify() == false) return; - // Check for pre-existence. - CompileUnit *TheCU = getCompileUnit(N); TheCU->createGlobalVariableDIE(N); return; } /// construct SubprogramDIE - Construct subprogram DIE. -void DwarfDebug::constructSubprogramDIE(const MDNode *N) { +void DwarfDebug::constructSubprogramDIE(CompileUnit *TheCU, + const MDNode *N) { DISubprogram SP(N); - - // Check for pre-existence. - CompileUnit *TheCU = getCompileUnit(N); - if (TheCU->getDIE(N)) - return; - if (!SP.isDefinition()) // This is a method declaration which will be handled while constructing // class type. @@ -603,12 +597,16 @@ void DwarfDebug::beginModule(Module *M) { constructCompileUnit(CU_Nodes->getOperand(i)); if (GV_Nodes) - for (unsigned i = 0, e = GV_Nodes->getNumOperands(); i != e; ++i) - constructGlobalVariableDIE(GV_Nodes->getOperand(i)); + for (unsigned i = 0, e = GV_Nodes->getNumOperands(); i != e; ++i) { + const MDNode *N = GV_Nodes->getOperand(i); + constructGlobalVariableDIE(getCompileUnit(N), N); + } if (SP_Nodes) - for (unsigned i = 0, e = SP_Nodes->getNumOperands(); i != e; ++i) - constructSubprogramDIE(SP_Nodes->getOperand(i)); + for (unsigned i = 0, e = SP_Nodes->getNumOperands(); i != e; ++i) { + const MDNode *N = SP_Nodes->getOperand(i); + constructSubprogramDIE(getCompileUnit(N), N); + } } else { @@ -634,13 +632,18 @@ void DwarfDebug::beginModule(Module *M) { // Create DIEs for each global variable. for (DebugInfoFinder::iterator I = DbgFinder.global_variable_begin(), - E = DbgFinder.global_variable_end(); I != E; ++I) - constructGlobalVariableDIE(*I); + E = DbgFinder.global_variable_end(); I != E; ++I) { + const MDNode *N = *I; + if (DIGlobalVariable(N).getVersion() <= LLVMDebugVersion9) + constructGlobalVariableDIE(getCompileUnit(N), N); + } // Create DIEs for each subprogram. for (DebugInfoFinder::iterator I = DbgFinder.subprogram_begin(), - E = DbgFinder.subprogram_end(); I != E; ++I) - constructSubprogramDIE(*I); + E = DbgFinder.subprogram_end(); I != E; ++I) { + const MDNode *N = *I; + constructSubprogramDIE(getCompileUnit(N), N); + } } // Tell MMI that we have debug info. @@ -698,8 +701,8 @@ void DwarfDebug::endModule() { } // Construct subprogram DIE and add variables DIEs. - constructSubprogramDIE(SP); CompileUnit *SPCU = getCompileUnit(SP); + constructSubprogramDIE(SPCU, SP); DIE *ScopeDIE = SPCU->getDIE(SP); for (unsigned i = 0, N = Variables.size(); i < N; ++i) { if (DIE *VariableDIE = |