mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 17:24:48 +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:
@ -663,5 +663,26 @@ void DwarfCompileUnit::finishSubprogramDefinition(DISubprogram SP) {
|
|||||||
applySubprogramAttributesToDefinition(SP, *D);
|
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
|
} // end llvm namespace
|
||||||
|
@ -128,6 +128,8 @@ public:
|
|||||||
constructImportedEntityDIE(const DIImportedEntity &Module);
|
constructImportedEntityDIE(const DIImportedEntity &Module);
|
||||||
|
|
||||||
void finishSubprogramDefinition(DISubprogram SP);
|
void finishSubprogramDefinition(DISubprogram SP);
|
||||||
|
|
||||||
|
void collectDeadVariables(DISubprogram SP);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end llvm namespace
|
} // end llvm namespace
|
||||||
|
@ -525,26 +525,7 @@ void DwarfDebug::collectDeadVariables() {
|
|||||||
DISubprogram SP(Subprograms.getElement(i));
|
DISubprogram SP(Subprograms.getElement(i));
|
||||||
if (ProcessedSPNodes.count(SP) != 0)
|
if (ProcessedSPNodes.count(SP) != 0)
|
||||||
continue;
|
continue;
|
||||||
assert(SP.isSubprogram() &&
|
SPCU->collectDeadVariables(SP);
|
||||||
"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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ class DwarfUnit;
|
|||||||
class DIEAbbrev;
|
class DIEAbbrev;
|
||||||
class MCSymbol;
|
class MCSymbol;
|
||||||
class DIE;
|
class DIE;
|
||||||
|
class DISubprogram;
|
||||||
class LexicalScope;
|
class LexicalScope;
|
||||||
class StringRef;
|
class StringRef;
|
||||||
class DwarfDebug;
|
class DwarfDebug;
|
||||||
|
Reference in New Issue
Block a user