mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-16 16:37:42 +00:00
Sink some of DwarfDebug::collectDeadVariables down into DwarfCompileUnit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221010 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cf19403e39
commit
54a86b37dd
@ -663,5 +663,26 @@ void DwarfCompileUnit::finishSubprogramDefinition(DISubprogram SP) {
|
||||
applySubprogramAttributesToDefinition(SP, *D);
|
||||
}
|
||||
}
|
||||
void DwarfCompileUnit::collectDeadVariables(DISubprogram SP) {
|
||||
assert(SP.isSubprogram() && "CU's subprogram list contains a non-subprogram");
|
||||
assert(SP.isDefinition() &&
|
||||
"CU's subprogram list contains a subprogram declaration");
|
||||
DIArray Variables = SP.getVariables();
|
||||
if (Variables.getNumElements() == 0)
|
||||
return;
|
||||
|
||||
DIE *SPDIE = DD->getAbstractSPDies().lookup(SP);
|
||||
if (!SPDIE)
|
||||
SPDIE = getDIE(SP);
|
||||
assert(SPDIE);
|
||||
for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) {
|
||||
DIVariable DV(Variables.getElement(vi));
|
||||
assert(DV.isVariable());
|
||||
DbgVariable NewVar(DV, DIExpression(nullptr), DD);
|
||||
auto VariableDie = constructVariableDIE(NewVar);
|
||||
applyVariableAttributes(NewVar, *VariableDie);
|
||||
SPDIE->addChild(std::move(VariableDie));
|
||||
}
|
||||
}
|
||||
|
||||
} // end llvm namespace
|
||||
|
@ -128,6 +128,8 @@ public:
|
||||
constructImportedEntityDIE(const DIImportedEntity &Module);
|
||||
|
||||
void finishSubprogramDefinition(DISubprogram SP);
|
||||
|
||||
void collectDeadVariables(DISubprogram SP);
|
||||
};
|
||||
|
||||
} // end llvm namespace
|
||||
|
@ -525,26 +525,7 @@ void DwarfDebug::collectDeadVariables() {
|
||||
DISubprogram SP(Subprograms.getElement(i));
|
||||
if (ProcessedSPNodes.count(SP) != 0)
|
||||
continue;
|
||||
assert(SP.isSubprogram() &&
|
||||
"CU's subprogram list contains a non-subprogram");
|
||||
assert(SP.isDefinition() &&
|
||||
"CU's subprogram list contains a subprogram declaration");
|
||||
DIArray Variables = SP.getVariables();
|
||||
if (Variables.getNumElements() == 0)
|
||||
continue;
|
||||
|
||||
DIE *SPDIE = AbstractSPDies.lookup(SP);
|
||||
if (!SPDIE)
|
||||
SPDIE = SPCU->getDIE(SP);
|
||||
assert(SPDIE);
|
||||
for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) {
|
||||
DIVariable DV(Variables.getElement(vi));
|
||||
assert(DV.isVariable());
|
||||
DbgVariable NewVar(DV, DIExpression(nullptr), this);
|
||||
auto VariableDie = SPCU->constructVariableDIE(NewVar);
|
||||
SPCU->applyVariableAttributes(NewVar, *VariableDie);
|
||||
SPDIE->addChild(std::move(VariableDie));
|
||||
}
|
||||
SPCU->collectDeadVariables(SP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ class DwarfUnit;
|
||||
class DIEAbbrev;
|
||||
class MCSymbol;
|
||||
class DIE;
|
||||
class DISubprogram;
|
||||
class LexicalScope;
|
||||
class StringRef;
|
||||
class DwarfDebug;
|
||||
|
Loading…
Reference in New Issue
Block a user