diff options
author | Devang Patel <dpatel@apple.com> | 2011-08-15 19:01:20 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2011-08-15 19:01:20 +0000 |
commit | 5a1a67cd3f35b82bcae5dc5dce6ffd9b9549a5c0 (patch) | |
tree | 161170c9906cf97552c6f94f14b2fa7c56663f1e /lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | 305e046e539a2713190be6de5ffb3f57708ef45f (diff) | |
download | external_llvm-5a1a67cd3f35b82bcae5dc5dce6ffd9b9549a5c0.zip external_llvm-5a1a67cd3f35b82bcae5dc5dce6ffd9b9549a5c0.tar.gz external_llvm-5a1a67cd3f35b82bcae5dc5dce6ffd9b9549a5c0.tar.bz2 |
Simplify mapping to variable from its abstract variable info.
When a variable is inlined multiple places, abstract variable keeps name, location, type etc.. info and all other concreate instances of the variable directly refers to abstract variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137637 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 1679a30..ab52251 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -383,21 +383,15 @@ DIE *DwarfDebug::constructVariableDIE(DbgVariable *DV, LexicalScope *Scope) { // Define variable debug information entry. DIE *VariableDie = new DIE(Tag); CompileUnit *VariableCU = getCompileUnit(DV->getVariable()); - DIE *AbsDIE = NULL; - DenseMap<const DbgVariable *, const DbgVariable *>::iterator - V2AVI = VarToAbstractVarMap.find(DV); - if (V2AVI != VarToAbstractVarMap.end()) - AbsDIE = V2AVI->second->getDIE(); - + DbgVariable *AbsVar = DV->getAbstractVariable(); + DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : NULL; if (AbsDIE) VariableCU->addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin, - dwarf::DW_FORM_ref4, AbsDIE); + dwarf::DW_FORM_ref4, AbsDIE); else { - VariableCU->addString(VariableDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, - Name); + VariableCU->addString(VariableDie, dwarf::DW_AT_name, + dwarf::DW_FORM_string, Name); VariableCU->addSourceLine(VariableDie, DV->getVariable()); - - // Add variable type. VariableCU->addType(VariableDie, DV->getType()); } @@ -812,7 +806,7 @@ void DwarfDebug::endModule() { for (unsigned I = 0; I != E; ++I) { DIVariable DV(NMD->getOperand(I)); if (!DV.Verify()) continue; - Variables.push_back(DbgVariable(DV)); + Variables.push_back(DbgVariable(DV, NULL)); } // Construct subprogram DIE and add variables DIEs. @@ -907,7 +901,7 @@ DbgVariable *DwarfDebug::findAbstractVariable(DIVariable &DV, if (!Scope) return NULL; - AbsDbgVariable = new DbgVariable(Var); + AbsDbgVariable = new DbgVariable(Var, NULL); addScopeVariable(Scope, AbsDbgVariable); AbstractVariables[Var] = AbsDbgVariable; return AbsDbgVariable; @@ -958,14 +952,12 @@ DwarfDebug::collectVariableInfoFromMMITable(const MachineFunction *MF, continue; DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VP.second); - DbgVariable *RegVar = new DbgVariable(DV); + DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable); recordVariableFrameIndex(RegVar, VP.first); if (!addCurrentFnArgument(MF, RegVar, Scope)) addScopeVariable(Scope, RegVar); - if (AbsDbgVariable) { + if (AbsDbgVariable) recordVariableFrameIndex(AbsDbgVariable, VP.first); - VarToAbstractVarMap[RegVar] = AbsDbgVariable; - } } } @@ -1049,13 +1041,12 @@ DwarfDebug::collectVariableInfo(const MachineFunction *MF, Processed.insert(DV); assert(MInsn->isDebugValue() && "History must begin with debug value"); - DbgVariable *RegVar = new DbgVariable(DV); + DbgVariable *AbsVar = findAbstractVariable(DV, MInsn->getDebugLoc()); + DbgVariable *RegVar = new DbgVariable(DV, AbsVar); if (!addCurrentFnArgument(MF, RegVar, Scope)) addScopeVariable(Scope, RegVar); - if (DbgVariable *AbsVar = findAbstractVariable(DV, MInsn->getDebugLoc())) { + if (AbsVar) DbgVariableToDbgInstMap[AbsVar] = MInsn; - VarToAbstractVarMap[RegVar] = AbsVar; - } // Simple ranges that are fully coalesced. if (History.size() <= 1 || (History.size() == 2 && @@ -1113,7 +1104,7 @@ DwarfDebug::collectVariableInfo(const MachineFunction *MF, if (!DV || !Processed.insert(DV)) continue; if (LexicalScope *Scope = LScopes.findLexicalScope(DV.getContext())) - addScopeVariable(Scope, new DbgVariable(DV)); + addScopeVariable(Scope, new DbgVariable(DV, NULL)); } } } @@ -1455,7 +1446,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { if (!DV || !ProcessedVars.insert(DV)) continue; if (LexicalScope *Scope = LScopes.findAbstractScope(DV.getContext())) - addScopeVariable(Scope, new DbgVariable(DV)); + addScopeVariable(Scope, new DbgVariable(DV, NULL)); } } } @@ -1481,7 +1472,6 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { ScopeVariables.clear(); DeleteContainerPointers(CurrentFnArguments); DbgVariableToFrameIndexMap.clear(); - VarToAbstractVarMap.clear(); DbgVariableToDbgInstMap.clear(); UserVariables.clear(); DbgValues.clear(); |