mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Eliminate redundant LLVMContext argument.
Improve DbgScope->dump() output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135207 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
af29322bb3
commit
4f455d6f25
@ -229,6 +229,7 @@ public:
|
|||||||
void DbgScope::dump() const {
|
void DbgScope::dump() const {
|
||||||
raw_ostream &err = dbgs();
|
raw_ostream &err = dbgs();
|
||||||
err.indent(IndentLevel);
|
err.indent(IndentLevel);
|
||||||
|
err << "DFSIn: " << DFSIn << " DFSOut: " << DFSOut << "\n";
|
||||||
const MDNode *N = Desc;
|
const MDNode *N = Desc;
|
||||||
N->dump();
|
N->dump();
|
||||||
if (AbstractScope)
|
if (AbstractScope)
|
||||||
@ -1566,7 +1567,8 @@ void DwarfDebug::endInstruction(const MachineInstr *MI) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// getOrCreateDbgScope - Create DbgScope for the scope.
|
/// getOrCreateDbgScope - Create DbgScope for the scope.
|
||||||
DbgScope *DwarfDebug::getOrCreateDbgScope(DebugLoc DL, LLVMContext &Ctx) {
|
DbgScope *DwarfDebug::getOrCreateDbgScope(DebugLoc DL) {
|
||||||
|
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);
|
||||||
@ -1579,7 +1581,7 @@ DbgScope *DwarfDebug::getOrCreateDbgScope(DebugLoc DL, LLVMContext &Ctx) {
|
|||||||
DbgScopeMap.insert(std::make_pair(Scope, WScope));
|
DbgScopeMap.insert(std::make_pair(Scope, WScope));
|
||||||
if (DIDescriptor(Scope).isLexicalBlock()) {
|
if (DIDescriptor(Scope).isLexicalBlock()) {
|
||||||
DbgScope *Parent =
|
DbgScope *Parent =
|
||||||
getOrCreateDbgScope(DebugLoc::getFromDILexicalBlock(Scope), Ctx);
|
getOrCreateDbgScope(DebugLoc::getFromDILexicalBlock(Scope));
|
||||||
WScope->setParent(Parent);
|
WScope->setParent(Parent);
|
||||||
Parent->addScope(WScope);
|
Parent->addScope(WScope);
|
||||||
} else if (DIDescriptor(Scope).isSubprogram()
|
} else if (DIDescriptor(Scope).isSubprogram()
|
||||||
@ -1597,7 +1599,7 @@ DbgScope *DwarfDebug::getOrCreateDbgScope(DebugLoc DL, LLVMContext &Ctx) {
|
|||||||
WScope = new DbgScope(NULL, DIDescriptor(Scope), InlinedAt);
|
WScope = new DbgScope(NULL, DIDescriptor(Scope), InlinedAt);
|
||||||
DbgScopeMap.insert(std::make_pair(InlinedAt, WScope));
|
DbgScopeMap.insert(std::make_pair(InlinedAt, WScope));
|
||||||
DbgScope *Parent =
|
DbgScope *Parent =
|
||||||
getOrCreateDbgScope(DebugLoc::getFromDILocation(InlinedAt), Ctx);
|
getOrCreateDbgScope(DebugLoc::getFromDILocation(InlinedAt));
|
||||||
WScope->setParent(Parent);
|
WScope->setParent(Parent);
|
||||||
Parent->addScope(WScope);
|
Parent->addScope(WScope);
|
||||||
|
|
||||||
@ -1636,10 +1638,11 @@ static void calculateDominanceGraph(DbgScope *Scope) {
|
|||||||
|
|
||||||
/// printDbgScopeInfo - Print DbgScope info for each machine instruction.
|
/// printDbgScopeInfo - Print DbgScope info for each machine instruction.
|
||||||
static
|
static
|
||||||
void printDbgScopeInfo(LLVMContext &Ctx, const MachineFunction *MF,
|
void printDbgScopeInfo(const MachineFunction *MF,
|
||||||
DenseMap<const MachineInstr *, DbgScope *> &MI2ScopeMap)
|
DenseMap<const MachineInstr *, DbgScope *> &MI2ScopeMap)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
LLVMContext &Ctx = MF->getFunction()->getContext();
|
||||||
unsigned PrevDFSIn = 0;
|
unsigned PrevDFSIn = 0;
|
||||||
for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
|
for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
@ -1682,7 +1685,6 @@ bool DwarfDebug::extractScopeInformation() {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Scan each instruction and create scopes. First build working set of scopes.
|
// Scan each instruction and create scopes. First build working set of scopes.
|
||||||
LLVMContext &Ctx = Asm->MF->getFunction()->getContext();
|
|
||||||
SmallVector<DbgRange, 4> MIRanges;
|
SmallVector<DbgRange, 4> MIRanges;
|
||||||
DenseMap<const MachineInstr *, DbgScope *> MI2ScopeMap;
|
DenseMap<const MachineInstr *, DbgScope *> MI2ScopeMap;
|
||||||
DebugLoc PrevDL;
|
DebugLoc PrevDL;
|
||||||
@ -1721,7 +1723,7 @@ bool DwarfDebug::extractScopeInformation() {
|
|||||||
DEBUG(dbgs() << "Next Range starting at " << *MInsn);
|
DEBUG(dbgs() << "Next Range starting at " << *MInsn);
|
||||||
DEBUG(dbgs() << "------------------------\n");
|
DEBUG(dbgs() << "------------------------\n");
|
||||||
DbgRange R(RangeBeginMI, PrevMI);
|
DbgRange R(RangeBeginMI, PrevMI);
|
||||||
MI2ScopeMap[RangeBeginMI] = getOrCreateDbgScope(PrevDL, Ctx);
|
MI2ScopeMap[RangeBeginMI] = getOrCreateDbgScope(PrevDL);
|
||||||
MIRanges.push_back(R);
|
MIRanges.push_back(R);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1738,7 +1740,7 @@ bool DwarfDebug::extractScopeInformation() {
|
|||||||
if (RangeBeginMI && PrevMI && !PrevDL.isUnknown()) {
|
if (RangeBeginMI && PrevMI && !PrevDL.isUnknown()) {
|
||||||
DbgRange R(RangeBeginMI, PrevMI);
|
DbgRange R(RangeBeginMI, PrevMI);
|
||||||
MIRanges.push_back(R);
|
MIRanges.push_back(R);
|
||||||
MI2ScopeMap[RangeBeginMI] = getOrCreateDbgScope(PrevDL, Ctx);
|
MI2ScopeMap[RangeBeginMI] = getOrCreateDbgScope(PrevDL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CurrentFnDbgScope)
|
if (!CurrentFnDbgScope)
|
||||||
@ -1746,7 +1748,7 @@ bool DwarfDebug::extractScopeInformation() {
|
|||||||
|
|
||||||
calculateDominanceGraph(CurrentFnDbgScope);
|
calculateDominanceGraph(CurrentFnDbgScope);
|
||||||
if (PrintDbgScope)
|
if (PrintDbgScope)
|
||||||
printDbgScopeInfo(Ctx, Asm->MF, MI2ScopeMap);
|
printDbgScopeInfo(Asm->MF, MI2ScopeMap);
|
||||||
|
|
||||||
// Find ranges of instructions covered by each DbgScope;
|
// Find ranges of instructions covered by each DbgScope;
|
||||||
DbgScope *PrevDbgScope = NULL;
|
DbgScope *PrevDbgScope = NULL;
|
||||||
|
@ -319,7 +319,7 @@ private:
|
|||||||
void assignAbbrevNumber(DIEAbbrev &Abbrev);
|
void assignAbbrevNumber(DIEAbbrev &Abbrev);
|
||||||
|
|
||||||
/// getOrCreateDbgScope - Create DbgScope for the scope.
|
/// getOrCreateDbgScope - Create DbgScope for the scope.
|
||||||
DbgScope *getOrCreateDbgScope(DebugLoc DL, LLVMContext &Ctx);
|
DbgScope *getOrCreateDbgScope(DebugLoc DL);
|
||||||
|
|
||||||
DbgScope *getOrCreateAbstractScope(const MDNode *N);
|
DbgScope *getOrCreateAbstractScope(const MDNode *N);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user