mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-14 15:28:20 +00:00
Refactor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135633 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1573,44 +1573,54 @@ void DwarfDebug::endInstruction(const MachineInstr *MI) {
|
|||||||
I->second = PrevLabel;
|
I->second = PrevLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// getOrCreateRegularScope - Create regular DbgScope.
|
||||||
|
DbgScope *DwarfDebug::getOrCreateRegularScope(MDNode *Scope) {
|
||||||
|
DbgScope *WScope = DbgScopeMap.lookup(Scope);
|
||||||
|
if (WScope)
|
||||||
|
return WScope;
|
||||||
|
WScope = new DbgScope(NULL, DIDescriptor(Scope), NULL);
|
||||||
|
DbgScopeMap.insert(std::make_pair(Scope, WScope));
|
||||||
|
if (DIDescriptor(Scope).isLexicalBlock()) {
|
||||||
|
DbgScope *Parent =
|
||||||
|
getOrCreateDbgScope(DebugLoc::getFromDILexicalBlock(Scope));
|
||||||
|
WScope->setParent(Parent);
|
||||||
|
Parent->addScope(WScope);
|
||||||
|
} else if (DIDescriptor(Scope).isSubprogram()
|
||||||
|
&& DISubprogram(Scope).describes(Asm->MF->getFunction()))
|
||||||
|
CurrentFnDbgScope = WScope;
|
||||||
|
|
||||||
|
return WScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// getOrCreateInlinedScope - Create inlined scope.
|
||||||
|
DbgScope *DwarfDebug::getOrCreateInlinedScope(MDNode *Scope, MDNode *InlinedAt){
|
||||||
|
DbgScope *InlinedScope = DbgScopeMap.lookup(InlinedAt);
|
||||||
|
if (InlinedScope)
|
||||||
|
return InlinedScope;
|
||||||
|
|
||||||
|
InlinedScope = new DbgScope(NULL, DIDescriptor(Scope), InlinedAt);
|
||||||
|
DebugLoc InlinedLoc = DebugLoc::getFromDILocation(InlinedAt);
|
||||||
|
InlinedDbgScopeMap[InlinedLoc] = InlinedScope;
|
||||||
|
DbgScopeMap[InlinedAt] = InlinedScope;
|
||||||
|
DbgScope *Parent = getOrCreateDbgScope(InlinedLoc);
|
||||||
|
InlinedScope->setParent(Parent);
|
||||||
|
Parent->addScope(InlinedScope);
|
||||||
|
return InlinedScope;
|
||||||
|
}
|
||||||
|
|
||||||
/// getOrCreateDbgScope - Create DbgScope for the scope.
|
/// getOrCreateDbgScope - Create DbgScope for the scope.
|
||||||
DbgScope *DwarfDebug::getOrCreateDbgScope(DebugLoc DL) {
|
DbgScope *DwarfDebug::getOrCreateDbgScope(DebugLoc DL) {
|
||||||
LLVMContext &Ctx = Asm->MF->getFunction()->getContext();
|
LLVMContext &Ctx = Asm->MF->getFunction()->getContext();
|
||||||
MDNode *Scope = NULL;
|
MDNode *Scope = NULL;
|
||||||
MDNode *InlinedAt = NULL;
|
MDNode *InlinedAt = NULL;
|
||||||
DL.getScopeAndInlinedAt(Scope, InlinedAt, Ctx);
|
DL.getScopeAndInlinedAt(Scope, InlinedAt, Ctx);
|
||||||
|
if (!InlinedAt)
|
||||||
|
return getOrCreateRegularScope(Scope);
|
||||||
|
|
||||||
if (!InlinedAt) {
|
// Create an abstract scope for inlined function.
|
||||||
DbgScope *WScope = DbgScopeMap.lookup(Scope);
|
|
||||||
if (WScope)
|
|
||||||
return WScope;
|
|
||||||
WScope = new DbgScope(NULL, DIDescriptor(Scope), NULL);
|
|
||||||
DbgScopeMap.insert(std::make_pair(Scope, WScope));
|
|
||||||
if (DIDescriptor(Scope).isLexicalBlock()) {
|
|
||||||
DbgScope *Parent =
|
|
||||||
getOrCreateDbgScope(DebugLoc::getFromDILexicalBlock(Scope));
|
|
||||||
WScope->setParent(Parent);
|
|
||||||
Parent->addScope(WScope);
|
|
||||||
} else if (DIDescriptor(Scope).isSubprogram()
|
|
||||||
&& DISubprogram(Scope).describes(Asm->MF->getFunction()))
|
|
||||||
CurrentFnDbgScope = WScope;
|
|
||||||
|
|
||||||
return WScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
getOrCreateAbstractScope(Scope);
|
getOrCreateAbstractScope(Scope);
|
||||||
DbgScope *WScope = DbgScopeMap.lookup(InlinedAt);
|
// Create an inlined scope for inlined function.
|
||||||
if (WScope)
|
return getOrCreateInlinedScope(Scope, InlinedAt);
|
||||||
return WScope;
|
|
||||||
|
|
||||||
WScope = new DbgScope(NULL, DIDescriptor(Scope), InlinedAt);
|
|
||||||
DbgScopeMap.insert(std::make_pair(InlinedAt, WScope));
|
|
||||||
InlinedDbgScopeMap[DebugLoc::getFromDILocation(InlinedAt)] = WScope;
|
|
||||||
DbgScope *Parent =
|
|
||||||
getOrCreateDbgScope(DebugLoc::getFromDILocation(InlinedAt));
|
|
||||||
WScope->setParent(Parent);
|
|
||||||
Parent->addScope(WScope);
|
|
||||||
return WScope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// calculateDominanceGraph - Calculate dominance graph for DbgScope
|
/// calculateDominanceGraph - Calculate dominance graph for DbgScope
|
||||||
|
@@ -318,7 +318,8 @@ private:
|
|||||||
|
|
||||||
/// getOrCreateDbgScope - Create DbgScope for the scope.
|
/// getOrCreateDbgScope - Create DbgScope for the scope.
|
||||||
DbgScope *getOrCreateDbgScope(DebugLoc DL);
|
DbgScope *getOrCreateDbgScope(DebugLoc DL);
|
||||||
|
DbgScope *getOrCreateRegularScope(MDNode *Scope);
|
||||||
|
DbgScope *getOrCreateInlinedScope(MDNode *Scope, MDNode *InlinedAt);
|
||||||
DbgScope *getOrCreateAbstractScope(const MDNode *N);
|
DbgScope *getOrCreateAbstractScope(const MDNode *N);
|
||||||
|
|
||||||
/// findAbstractVariable - Find abstract variable associated with Var.
|
/// findAbstractVariable - Find abstract variable associated with Var.
|
||||||
|
Reference in New Issue
Block a user