diff options
author | Devang Patel <dpatel@apple.com> | 2011-08-19 23:28:12 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2011-08-19 23:28:12 +0000 |
commit | 59e27c5f12eeb00710710351cbc90e5943fb47c1 (patch) | |
tree | ac5390c6611fc3159e3c41e9340f4b954e1c3723 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | 2de80d601a522a1f07ee193ce1a43999fe701b78 (diff) | |
download | bcm5719-llvm-59e27c5f12eeb00710710351cbc90e5943fb47c1.tar.gz bcm5719-llvm-59e27c5f12eeb00710710351cbc90e5943fb47c1.zip |
Do not use named md nodes to track variables that are completely optimized. This does not scale while doing LTO with debug info. New approach is to include list of variables in the subprogram info directly.
llvm-svn: 138145
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 0a284fefaa7..ad16ac1004c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -667,31 +667,24 @@ void DwarfDebug::endModule() { if (ProcessedSPNodes.count(SP) != 0) continue; if (!SP.Verify()) continue; if (!SP.isDefinition()) continue; - StringRef FName = SP.getLinkageName(); - if (FName.empty()) - FName = SP.getName(); - NamedMDNode *NMD = getFnSpecificMDNode(*(MMI->getModule()), FName); - if (!NMD) continue; - unsigned E = NMD->getNumOperands(); - if (!E) continue; + DIArray Variables = SP.getVariables(); + if (Variables.getNumElements() == 0) continue; + LexicalScope *Scope = new LexicalScope(NULL, DIDescriptor(SP), NULL, false); DeadFnScopeMap[SP] = Scope; // Construct subprogram DIE and add variables DIEs. - SmallVector<DbgVariable, 8> Variables; - for (unsigned I = 0; I != E; ++I) { - DIVariable DV(NMD->getOperand(I)); - if (!DV.Verify()) continue; - Variables.push_back(DbgVariable(DV, NULL)); - } CompileUnit *SPCU = CUMap.lookup(TheCU); assert (SPCU && "Unable to find Compile Unit!"); constructSubprogramDIE(SPCU, SP); DIE *ScopeDIE = SPCU->getDIE(SP); - for (unsigned i = 0, N = Variables.size(); i < N; ++i) { + for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) { + DIVariable DV(Variables.getElement(vi)); + if (!DV.Verify()) continue; + DbgVariable *NewVar = new DbgVariable(DV, NULL); if (DIE *VariableDIE = - SPCU->constructVariableDIE(&Variables[i], Scope->isAbstractScope())) + SPCU->constructVariableDIE(NewVar, Scope->isAbstractScope())) ScopeDIE->addChild(VariableDIE); } } @@ -977,15 +970,14 @@ DwarfDebug::collectVariableInfo(const MachineFunction *MF, } // Collect info for variables that were optimized out. - const Function *F = MF->getFunction(); - if (NamedMDNode *NMD = getFnSpecificMDNode(*(F->getParent()), F->getName())) { - for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { - DIVariable DV(cast<MDNode>(NMD->getOperand(i))); - if (!DV || !Processed.insert(DV)) - continue; - if (LexicalScope *Scope = LScopes.findLexicalScope(DV.getContext())) - addScopeVariable(Scope, new DbgVariable(DV, NULL)); - } + LexicalScope *FnScope = LScopes.getCurrentFunctionScope(); + DIArray Variables = DISubprogram(FnScope->getScopeNode()).getVariables(); + for (unsigned i = 0, e = Variables.getNumElements(); i != e; ++i) { + DIVariable DV(Variables.getElement(i)); + if (!DV || !DV.Verify() || !Processed.insert(DV)) + continue; + if (LexicalScope *Scope = LScopes.findLexicalScope(DV.getContext())) + addScopeVariable(Scope, new DbgVariable(DV, NULL)); } } @@ -1320,18 +1312,13 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { DISubprogram SP(AScope->getScopeNode()); if (SP.Verify()) { // Collect info for variables that were optimized out. - StringRef FName = SP.getLinkageName(); - if (FName.empty()) - FName = SP.getName(); - if (NamedMDNode *NMD = - getFnSpecificMDNode(*(MF->getFunction()->getParent()), FName)) { - for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { - DIVariable DV(cast<MDNode>(NMD->getOperand(i))); - if (!DV || !ProcessedVars.insert(DV)) - continue; - if (LexicalScope *Scope = LScopes.findAbstractScope(DV.getContext())) - addScopeVariable(Scope, new DbgVariable(DV, NULL)); - } + DIArray Variables = SP.getVariables(); + for (unsigned i = 0, e = Variables.getNumElements(); i != e; ++i) { + DIVariable DV(Variables.getElement(i)); + if (!DV || !DV.Verify() || !ProcessedVars.insert(DV)) + continue; + if (LexicalScope *Scope = LScopes.findAbstractScope(DV.getContext())) + addScopeVariable(Scope, new DbgVariable(DV, NULL)); } } if (ProcessedSPNodes.count(AScope->getScopeNode()) == 0) |