mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-26 23:29:22 +00:00
change DbgScope to keep track of the start/end label as MCSymbol*
now that the dependence on ID is removed from MMI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98034 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cbac7f1630
commit
b7db733482
@ -16,9 +16,10 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||||
|
#include "llvm/MC/MCAsmInfo.h"
|
||||||
#include "llvm/MC/MCSection.h"
|
#include "llvm/MC/MCSection.h"
|
||||||
#include "llvm/MC/MCStreamer.h"
|
#include "llvm/MC/MCStreamer.h"
|
||||||
#include "llvm/MC/MCAsmInfo.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
#include "llvm/Target/Mangler.h"
|
#include "llvm/Target/Mangler.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetFrameInfo.h"
|
#include "llvm/Target/TargetFrameInfo.h"
|
||||||
@ -171,8 +172,8 @@ class DbgScope {
|
|||||||
// Location at which this scope is inlined.
|
// Location at which this scope is inlined.
|
||||||
AssertingVH<MDNode> InlinedAtLocation;
|
AssertingVH<MDNode> InlinedAtLocation;
|
||||||
bool AbstractScope; // Abstract Scope
|
bool AbstractScope; // Abstract Scope
|
||||||
unsigned StartLabelID; // Label ID of the beginning of scope.
|
MCSymbol *StartLabel; // Label ID of the beginning of scope.
|
||||||
unsigned EndLabelID; // Label ID of the end of scope.
|
MCSymbol *EndLabel; // Label ID of the end of scope.
|
||||||
const MachineInstr *LastInsn; // Last instruction of this scope.
|
const MachineInstr *LastInsn; // Last instruction of this scope.
|
||||||
const MachineInstr *FirstInsn; // First instruction of this scope.
|
const MachineInstr *FirstInsn; // First instruction of this scope.
|
||||||
SmallVector<DbgScope *, 4> Scopes; // Scopes defined in scope.
|
SmallVector<DbgScope *, 4> Scopes; // Scopes defined in scope.
|
||||||
@ -183,7 +184,7 @@ class DbgScope {
|
|||||||
public:
|
public:
|
||||||
DbgScope(DbgScope *P, DIDescriptor D, MDNode *I = 0)
|
DbgScope(DbgScope *P, DIDescriptor D, MDNode *I = 0)
|
||||||
: Parent(P), Desc(D), InlinedAtLocation(I), AbstractScope(false),
|
: Parent(P), Desc(D), InlinedAtLocation(I), AbstractScope(false),
|
||||||
StartLabelID(0), EndLabelID(0),
|
StartLabel(0), EndLabel(0),
|
||||||
LastInsn(0), FirstInsn(0), IndentLevel(0) {}
|
LastInsn(0), FirstInsn(0), IndentLevel(0) {}
|
||||||
virtual ~DbgScope();
|
virtual ~DbgScope();
|
||||||
|
|
||||||
@ -195,12 +196,12 @@ public:
|
|||||||
return InlinedAtLocation;
|
return InlinedAtLocation;
|
||||||
}
|
}
|
||||||
MDNode *getScopeNode() const { return Desc.getNode(); }
|
MDNode *getScopeNode() const { return Desc.getNode(); }
|
||||||
unsigned getStartLabelID() const { return StartLabelID; }
|
MCSymbol *getStartLabel() const { return StartLabel; }
|
||||||
unsigned getEndLabelID() const { return EndLabelID; }
|
MCSymbol *getEndLabel() const { return EndLabel; }
|
||||||
SmallVector<DbgScope *, 4> &getScopes() { return Scopes; }
|
SmallVector<DbgScope *, 4> &getScopes() { return Scopes; }
|
||||||
SmallVector<DbgVariable *, 8> &getVariables() { return Variables; }
|
SmallVector<DbgVariable *, 8> &getVariables() { return Variables; }
|
||||||
void setStartLabelID(unsigned S) { StartLabelID = S; }
|
void setStartLabel(MCSymbol *S) { StartLabel = S; }
|
||||||
void setEndLabelID(unsigned E) { EndLabelID = E; }
|
void setEndLabel(MCSymbol *E) { EndLabel = E; }
|
||||||
void setLastInsn(const MachineInstr *MI) { LastInsn = MI; }
|
void setLastInsn(const MachineInstr *MI) { LastInsn = MI; }
|
||||||
const MachineInstr *getLastInsn() { return LastInsn; }
|
const MachineInstr *getLastInsn() { return LastInsn; }
|
||||||
void setFirstInsn(const MachineInstr *MI) { FirstInsn = MI; }
|
void setFirstInsn(const MachineInstr *MI) { FirstInsn = MI; }
|
||||||
@ -264,7 +265,7 @@ void DbgScope::dump() const {
|
|||||||
err.indent(IndentLevel);
|
err.indent(IndentLevel);
|
||||||
MDNode *N = Desc.getNode();
|
MDNode *N = Desc.getNode();
|
||||||
N->dump();
|
N->dump();
|
||||||
err << " [" << StartLabelID << ", " << EndLabelID << "]\n";
|
err << " [" << StartLabel << ", " << EndLabel << "]\n";
|
||||||
if (AbstractScope)
|
if (AbstractScope)
|
||||||
err << "Abstract Scope\n";
|
err << "Abstract Scope\n";
|
||||||
|
|
||||||
@ -1362,24 +1363,20 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(MDNode *SPNode) {
|
|||||||
/// constructLexicalScope - Construct new DW_TAG_lexical_block
|
/// constructLexicalScope - Construct new DW_TAG_lexical_block
|
||||||
/// for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.
|
/// for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.
|
||||||
DIE *DwarfDebug::constructLexicalScopeDIE(DbgScope *Scope) {
|
DIE *DwarfDebug::constructLexicalScopeDIE(DbgScope *Scope) {
|
||||||
unsigned StartID = Scope->getStartLabelID();
|
MCSymbol *Start = Scope->getStartLabel();
|
||||||
unsigned EndID = Scope->getEndLabelID();
|
MCSymbol *End = Scope->getEndLabel();
|
||||||
|
|
||||||
assert(!MMI->isLabelDeleted(StartID) &&
|
assert(Start->isDefined() && "Invalid starting label for an inlined scope!");
|
||||||
"Invalid starting label for an inlined scope!");
|
assert(End->isDefined() && "Invalid end label for an inlined scope!");
|
||||||
assert(!MMI->isLabelDeleted(EndID) &&
|
|
||||||
"Invalid end label for an inlined scope!");
|
|
||||||
|
|
||||||
DIE *ScopeDIE = new DIE(dwarf::DW_TAG_lexical_block);
|
DIE *ScopeDIE = new DIE(dwarf::DW_TAG_lexical_block);
|
||||||
if (Scope->isAbstractScope())
|
if (Scope->isAbstractScope())
|
||||||
return ScopeDIE;
|
return ScopeDIE;
|
||||||
|
|
||||||
addLabel(ScopeDIE, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
addLabel(ScopeDIE, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
||||||
StartID ? getDWLabel("label", StartID)
|
Start ? Start : getDWLabel("func_begin", SubprogramCount));
|
||||||
: getDWLabel("func_begin", SubprogramCount));
|
|
||||||
addLabel(ScopeDIE, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
|
addLabel(ScopeDIE, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
|
||||||
EndID ? getDWLabel("label", EndID)
|
End ? End : getDWLabel("func_end", SubprogramCount));
|
||||||
: getDWLabel("func_end", SubprogramCount));
|
|
||||||
|
|
||||||
return ScopeDIE;
|
return ScopeDIE;
|
||||||
}
|
}
|
||||||
@ -1388,11 +1385,11 @@ DIE *DwarfDebug::constructLexicalScopeDIE(DbgScope *Scope) {
|
|||||||
/// a function. Construct DIE to represent this concrete inlined copy
|
/// a function. Construct DIE to represent this concrete inlined copy
|
||||||
/// of the function.
|
/// of the function.
|
||||||
DIE *DwarfDebug::constructInlinedScopeDIE(DbgScope *Scope) {
|
DIE *DwarfDebug::constructInlinedScopeDIE(DbgScope *Scope) {
|
||||||
unsigned StartID = Scope->getStartLabelID();
|
MCSymbol *StartLabel = Scope->getStartLabel();
|
||||||
unsigned EndID = Scope->getEndLabelID();
|
MCSymbol *EndLabel = Scope->getEndLabel();
|
||||||
assert(!MMI->isLabelDeleted(StartID) &&
|
assert(StartLabel->isDefined() &&
|
||||||
"Invalid starting label for an inlined scope!");
|
"Invalid starting label for an inlined scope!");
|
||||||
assert(!MMI->isLabelDeleted(EndID) &&
|
assert(EndLabel->isDefined() &&
|
||||||
"Invalid end label for an inlined scope!");
|
"Invalid end label for an inlined scope!");
|
||||||
if (!Scope->getScopeNode())
|
if (!Scope->getScopeNode())
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1405,11 +1402,8 @@ DIE *DwarfDebug::constructInlinedScopeDIE(DbgScope *Scope) {
|
|||||||
addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin,
|
addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin,
|
||||||
dwarf::DW_FORM_ref4, OriginDIE);
|
dwarf::DW_FORM_ref4, OriginDIE);
|
||||||
|
|
||||||
MCSymbol *StartLabel = getDWLabel("label", StartID);
|
|
||||||
|
|
||||||
addLabel(ScopeDIE, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, StartLabel);
|
addLabel(ScopeDIE, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, StartLabel);
|
||||||
addLabel(ScopeDIE, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
|
addLabel(ScopeDIE, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, EndLabel);
|
||||||
getDWLabel("label", EndID));
|
|
||||||
|
|
||||||
InlinedSubprogramDIEs.insert(OriginDIE);
|
InlinedSubprogramDIEs.insert(OriginDIE);
|
||||||
|
|
||||||
@ -1961,7 +1955,7 @@ void DwarfDebug::beginScope(const MachineInstr *MI, unsigned Label) {
|
|||||||
ScopeVector &SD = I->second;
|
ScopeVector &SD = I->second;
|
||||||
for (ScopeVector::iterator SDI = SD.begin(), SDE = SD.end();
|
for (ScopeVector::iterator SDI = SD.begin(), SDE = SD.end();
|
||||||
SDI != SDE; ++SDI)
|
SDI != SDE; ++SDI)
|
||||||
(*SDI)->setStartLabelID(Label);
|
(*SDI)->setStartLabel(getDWLabel("label", Label));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// endScope - Process end of a scope.
|
/// endScope - Process end of a scope.
|
||||||
@ -1970,13 +1964,13 @@ void DwarfDebug::endScope(const MachineInstr *MI) {
|
|||||||
if (I == DbgScopeEndMap.end())
|
if (I == DbgScopeEndMap.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned Label = MMI->NextLabelID();
|
MCSymbol *Label = getDWLabel("label", MMI->NextLabelID());
|
||||||
Asm->printLabel(Label);
|
Asm->OutStreamer.EmitLabel(Label);
|
||||||
|
|
||||||
SmallVector<DbgScope *, 2> &SD = I->second;
|
SmallVector<DbgScope*, 2> &SD = I->second;
|
||||||
for (SmallVector<DbgScope *, 2>::iterator SDI = SD.begin(), SDE = SD.end();
|
for (SmallVector<DbgScope *, 2>::iterator SDI = SD.begin(), SDE = SD.end();
|
||||||
SDI != SDE; ++SDI)
|
SDI != SDE; ++SDI)
|
||||||
(*SDI)->setEndLabelID(Label);
|
(*SDI)->setEndLabel(Label);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2120,16 +2114,17 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
|||||||
DebugLoc FDL = MF->getDefaultDebugLoc();
|
DebugLoc FDL = MF->getDefaultDebugLoc();
|
||||||
if (!FDL.isUnknown()) {
|
if (!FDL.isUnknown()) {
|
||||||
DILocation DLT = MF->getDILocation(FDL);
|
DILocation DLT = MF->getDILocation(FDL);
|
||||||
unsigned LabelID = 0;
|
|
||||||
DISubprogram SP = getDISubprogram(DLT.getScope().getNode());
|
DISubprogram SP = getDISubprogram(DLT.getScope().getNode());
|
||||||
if (SP.Verify())
|
unsigned Line, Col;
|
||||||
LabelID = recordSourceLine(SP.getLineNumber(), 0,
|
if (SP.Verify()) {
|
||||||
DLT.getScope().getNode());
|
Line = SP.getLineNumber();
|
||||||
else
|
Col = 0;
|
||||||
LabelID = recordSourceLine(DLT.getLineNumber(),
|
} else {
|
||||||
DLT.getColumnNumber(),
|
Line = DLT.getLineNumber();
|
||||||
DLT.getScope().getNode());
|
Col = DLT.getColumnNumber();
|
||||||
Asm->printLabel(LabelID);
|
}
|
||||||
|
|
||||||
|
Asm->printLabel(recordSourceLine(Line, Col, DLT.getScope().getNode()));
|
||||||
}
|
}
|
||||||
if (TimePassesIsEnabled)
|
if (TimePassesIsEnabled)
|
||||||
DebugTimer->stopTimer();
|
DebugTimer->stopTimer();
|
||||||
|
Loading…
Reference in New Issue
Block a user