mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
DebugInfo: The rest of pushing DwarfDebug::constructScopeDIE down into DwarfCompileUnit
Funnily enough, I copied it, but didn't actually remove the original in r219345. Let's do that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219346 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -444,7 +444,7 @@ DIE *DwarfDebug::createScopeChildrenDIE(
|
|||||||
unsigned ChildCountWithoutScopes = Children.size();
|
unsigned ChildCountWithoutScopes = Children.size();
|
||||||
|
|
||||||
for (LexicalScope *LS : Scope->getChildren())
|
for (LexicalScope *LS : Scope->getChildren())
|
||||||
constructScopeDIE(TheCU, LS, Children);
|
TheCU.constructScopeDIE(LS, Children);
|
||||||
|
|
||||||
if (ChildScopeCount)
|
if (ChildScopeCount)
|
||||||
*ChildScopeCount = Children.size() - ChildCountWithoutScopes;
|
*ChildScopeCount = Children.size() - ChildCountWithoutScopes;
|
||||||
@ -548,73 +548,6 @@ void DwarfDebug::constructSubprogramScopeDIE(DwarfCompileUnit &TheCU,
|
|||||||
TheCU.addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
|
TheCU.addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct a DIE for this scope.
|
|
||||||
void DwarfDebug::constructScopeDIE(
|
|
||||||
DwarfCompileUnit &TheCU, LexicalScope *Scope,
|
|
||||||
SmallVectorImpl<std::unique_ptr<DIE>> &FinalChildren) {
|
|
||||||
if (!Scope || !Scope->getScopeNode())
|
|
||||||
return;
|
|
||||||
|
|
||||||
DIScope DS(Scope->getScopeNode());
|
|
||||||
|
|
||||||
assert((Scope->getInlinedAt() || !DS.isSubprogram()) &&
|
|
||||||
"Only handle inlined subprograms here, use "
|
|
||||||
"constructSubprogramScopeDIE for non-inlined "
|
|
||||||
"subprograms");
|
|
||||||
|
|
||||||
SmallVector<std::unique_ptr<DIE>, 8> Children;
|
|
||||||
|
|
||||||
// We try to create the scope DIE first, then the children DIEs. This will
|
|
||||||
// avoid creating un-used children then removing them later when we find out
|
|
||||||
// the scope DIE is null.
|
|
||||||
std::unique_ptr<DIE> ScopeDIE;
|
|
||||||
if (Scope->getParent() && DS.isSubprogram()) {
|
|
||||||
ScopeDIE = constructInlinedScopeDIE(TheCU, Scope);
|
|
||||||
if (!ScopeDIE)
|
|
||||||
return;
|
|
||||||
// We create children when the scope DIE is not null.
|
|
||||||
createScopeChildrenDIE(TheCU, Scope, Children);
|
|
||||||
} else {
|
|
||||||
// Early exit when we know the scope DIE is going to be null.
|
|
||||||
if (isLexicalScopeDIENull(Scope))
|
|
||||||
return;
|
|
||||||
|
|
||||||
unsigned ChildScopeCount;
|
|
||||||
|
|
||||||
// We create children here when we know the scope DIE is not going to be
|
|
||||||
// null and the children will be added to the scope DIE.
|
|
||||||
createScopeChildrenDIE(TheCU, Scope, Children, &ChildScopeCount);
|
|
||||||
|
|
||||||
// There is no need to emit empty lexical block DIE.
|
|
||||||
std::pair<ImportedEntityMap::const_iterator,
|
|
||||||
ImportedEntityMap::const_iterator> Range =
|
|
||||||
std::equal_range(ScopesWithImportedEntities.begin(),
|
|
||||||
ScopesWithImportedEntities.end(),
|
|
||||||
std::pair<const MDNode *, const MDNode *>(DS, nullptr),
|
|
||||||
less_first());
|
|
||||||
for (ImportedEntityMap::const_iterator i = Range.first; i != Range.second;
|
|
||||||
++i)
|
|
||||||
Children.push_back(
|
|
||||||
TheCU.constructImportedEntityDIE(DIImportedEntity(i->second)));
|
|
||||||
// If there are only other scopes as children, put them directly in the
|
|
||||||
// parent instead, as this scope would serve no purpose.
|
|
||||||
if (Children.size() == ChildScopeCount) {
|
|
||||||
FinalChildren.insert(FinalChildren.end(),
|
|
||||||
std::make_move_iterator(Children.begin()),
|
|
||||||
std::make_move_iterator(Children.end()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ScopeDIE = constructLexicalScopeDIE(TheCU, Scope);
|
|
||||||
assert(ScopeDIE && "Scope DIE should not be null.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add children
|
|
||||||
for (auto &I : Children)
|
|
||||||
ScopeDIE->addChild(std::move(I));
|
|
||||||
|
|
||||||
FinalChildren.push_back(std::move(ScopeDIE));
|
|
||||||
}
|
|
||||||
|
|
||||||
void DwarfDebug::addGnuPubAttributes(DwarfUnit &U, DIE &D) const {
|
void DwarfDebug::addGnuPubAttributes(DwarfUnit &U, DIE &D) const {
|
||||||
if (!GenerateGnuPubSections)
|
if (!GenerateGnuPubSections)
|
||||||
return;
|
return;
|
||||||
|
@ -354,9 +354,6 @@ class DwarfDebug : public AsmPrinterHandler {
|
|||||||
void addScopeRangeList(DwarfCompileUnit &TheCU, DIE &ScopeDIE,
|
void addScopeRangeList(DwarfCompileUnit &TheCU, DIE &ScopeDIE,
|
||||||
const SmallVectorImpl<InsnRange> &Range);
|
const SmallVectorImpl<InsnRange> &Range);
|
||||||
|
|
||||||
/// \brief Construct a DIE for this scope.
|
|
||||||
void constructScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope,
|
|
||||||
SmallVectorImpl<std::unique_ptr<DIE>> &FinalChildren);
|
|
||||||
DIE *createAndAddScopeChildren(DwarfCompileUnit &TheCU, LexicalScope *Scope,
|
DIE *createAndAddScopeChildren(DwarfCompileUnit &TheCU, LexicalScope *Scope,
|
||||||
DIE &ScopeDIE);
|
DIE &ScopeDIE);
|
||||||
/// \brief Construct a DIE for this abstract scope.
|
/// \brief Construct a DIE for this abstract scope.
|
||||||
|
Reference in New Issue
Block a user