diff options
author | Eric Christopher <echristo@gmail.com> | 2013-10-04 17:08:38 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-10-04 17:08:38 +0000 |
commit | 3f045005bf96b6521b2769fc824283589bfa133a (patch) | |
tree | ff7cfcaa2f946c47f54230e140ed50ea4e75e70e /lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | 0bb5a66b0388d2c52a887eaafe3749aaceb6a754 (diff) | |
download | external_llvm-3f045005bf96b6521b2769fc824283589bfa133a.zip external_llvm-3f045005bf96b6521b2769fc824283589bfa133a.tar.gz external_llvm-3f045005bf96b6521b2769fc824283589bfa133a.tar.bz2 |
Temporarily revert r191792 as it is causing some LTO debug failures
on platforms with relocations in debug info and also temporarily
revert r191800 due to conflicts with the revert of r191792.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191967 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 60 |
1 files changed, 13 insertions, 47 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index c90d84b..3406d79 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -149,13 +149,13 @@ DIType DbgVariable::getType() const { uint16_t tag = Ty.getTag(); if (tag == dwarf::DW_TAG_pointer_type) - subType = DD->resolve(DIDerivedType(Ty).getTypeDerivedFrom()); + subType = DIDerivedType(Ty).getTypeDerivedFrom(); DIArray Elements = DICompositeType(subType).getTypeArray(); for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) { DIDerivedType DT = DIDerivedType(Elements.getElement(i)); if (getName() == DT.getName()) - return (DD->resolve(DT.getTypeDerivedFrom())); + return (DT.getTypeDerivedFrom()); } } return Ty; @@ -364,7 +364,7 @@ bool DwarfDebug::isSubprogramContext(const MDNode *Context) { // scope then create and insert DIEs for these variables. DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU, const MDNode *SPNode) { - DIE *SPDie = getSPDIE(SPNode); + DIE *SPDie = SPCU->getDIE(SPNode); assert(SPDie && "Unable to find subprogram DIE!"); DISubprogram SP(SPNode); @@ -518,7 +518,7 @@ DIE *DwarfDebug::constructInlinedScopeDIE(CompileUnit *TheCU, return NULL; DIScope DS(Scope->getScopeNode()); DISubprogram InlinedSP = getDISubprogram(DS); - DIE *OriginDIE = getSPDIE(InlinedSP); + DIE *OriginDIE = TheCU->getDIE(InlinedSP); if (!OriginDIE) { DEBUG(dbgs() << "Unable to find original DIE for an inlined subprogram."); return NULL; @@ -623,7 +623,7 @@ DIE *DwarfDebug::constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope) { else if (DS.isSubprogram()) { ProcessedSPNodes.insert(DS); if (Scope->isAbstractScope()) { - ScopeDIE = getSPDIE(DS); + ScopeDIE = TheCU->getDIE(DS); // Note down abstract DIE. if (ScopeDIE) AbstractSPDies.insert(std::make_pair(DS, ScopeDIE)); @@ -993,11 +993,11 @@ void DwarfDebug::collectDeadVariables() { CompileUnit *SPCU = CUMap.lookup(TheCU); assert(SPCU && "Unable to find Compile Unit!"); constructSubprogramDIE(SPCU, SP); - DIE *ScopeDIE = getSPDIE(SP); + DIE *ScopeDIE = SPCU->getDIE(SP); for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) { DIVariable DV(Variables.getElement(vi)); if (!DV.isVariable()) continue; - DbgVariable NewVar(DV, NULL, this); + DbgVariable NewVar(DV, NULL); if (DIE *VariableDIE = SPCU->constructVariableDIE(&NewVar, Scope->isAbstractScope())) ScopeDIE->addChild(VariableDIE); @@ -1066,15 +1066,6 @@ void DwarfDebug::finalizeModuleInfo() { Hash.computeDIEODRSignature(Die)); } - // Process the worklist to add attributes with the correct form (ref_addr or - // ref4). - for (unsigned I = 0, E = DIEEntryWorklist.size(); I < E; I++) { - addDIEEntry(DIEEntryWorklist[I].Die, DIEEntryWorklist[I].Attribute, - dwarf::DW_FORM_ref4, DIEEntryWorklist[I].Entry); - assert(E == DIEEntryWorklist.size() && - "We should not add to the worklist during finalization."); - } - // Handle anything that needs to be done on a per-cu basis. for (DenseMap<const MDNode *, CompileUnit *>::iterator CUI = CUMap.begin(), CUE = CUMap.end(); @@ -1265,7 +1256,7 @@ DbgVariable *DwarfDebug::findAbstractVariable(DIVariable &DV, if (!Scope) return NULL; - AbsDbgVariable = new DbgVariable(Var, NULL, this); + AbsDbgVariable = new DbgVariable(Var, NULL); addScopeVariable(Scope, AbsDbgVariable); AbstractVariables[Var] = AbsDbgVariable; return AbsDbgVariable; @@ -1314,7 +1305,7 @@ DwarfDebug::collectVariableInfoFromMMITable(const MachineFunction *MF, continue; DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VP.second); - DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable, this); + DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable); RegVar->setFrameIndex(VP.first); if (!addCurrentFnArgument(MF, RegVar, Scope)) addScopeVariable(Scope, RegVar); @@ -1399,7 +1390,7 @@ DwarfDebug::collectVariableInfo(const MachineFunction *MF, Processed.insert(DV); assert(MInsn->isDebugValue() && "History must begin with debug value"); DbgVariable *AbsVar = findAbstractVariable(DV, MInsn->getDebugLoc()); - DbgVariable *RegVar = new DbgVariable(DV, AbsVar, this); + DbgVariable *RegVar = new DbgVariable(DV, AbsVar); if (!addCurrentFnArgument(MF, RegVar, Scope)) addScopeVariable(Scope, RegVar); if (AbsVar) @@ -1462,7 +1453,7 @@ DwarfDebug::collectVariableInfo(const MachineFunction *MF, if (!DV || !DV.isVariable() || !Processed.insert(DV)) continue; if (LexicalScope *Scope = LScopes.findLexicalScope(DV.getContext())) - addScopeVariable(Scope, new DbgVariable(DV, NULL, this)); + addScopeVariable(Scope, new DbgVariable(DV, NULL)); } } @@ -1858,7 +1849,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) { if (AbstractVariables.lookup(CleanDV)) continue; if (LexicalScope *Scope = LScopes.findAbstractScope(DV.getContext())) - addScopeVariable(Scope, new DbgVariable(DV, NULL, this)); + addScopeVariable(Scope, new DbgVariable(DV, NULL)); } } if (ProcessedSPNodes.count(AScope->getScopeNode()) == 0) @@ -2064,11 +2055,7 @@ void DwarfDebug::emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs) { Asm->OutStreamer.AddComment(dwarf::AttributeString(Attr)); switch (Attr) { - case dwarf::DW_AT_abstract_origin: - case dwarf::DW_AT_type: - case dwarf::DW_AT_friend: - case dwarf::DW_AT_specification: - case dwarf::DW_AT_containing_type: { + case dwarf::DW_AT_abstract_origin: { DIEEntry *E = cast<DIEEntry>(Values[i]); DIE *Origin = E->getEntry(); unsigned Addr = Origin->getOffset(); @@ -3048,24 +3035,3 @@ void DwarfDebug::emitDebugStrDWO() { InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(), OffSec, StrSym); } - -/// When we don't know whether the correct form is ref4 or ref_addr, we create -/// a worklist item and insert it to DIEEntryWorklist. -void DwarfDebug::addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form, - DIEEntry *Entry) { - /// Early exit when we only have a single CU. - if (GlobalCUIndexCount == 1 || Form != dwarf::DW_FORM_ref4) { - Die->addValue(Attribute, Form, Entry); - return; - } - DIE *DieCU = Die->checkCompileUnit(); - DIE *EntryCU = Entry->getEntry()->checkCompileUnit(); - if (!DieCU || !EntryCU) { - // Die or Entry is not added to an owner yet. - insertDIEEntryWorklist(Die, Attribute, Entry); - return; - } - Die->addValue(Attribute, - EntryCU == DieCU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr, - Entry); -} |