mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 02:25:47 +00:00
Simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104338 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2183,59 +2183,34 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
|
|||||||
void DwarfDebug::beginScope(const MachineInstr *MI) {
|
void DwarfDebug::beginScope(const MachineInstr *MI) {
|
||||||
// Check location.
|
// Check location.
|
||||||
DebugLoc DL = MI->getDebugLoc();
|
DebugLoc DL = MI->getDebugLoc();
|
||||||
if (DL.isUnknown()) {
|
if (DL.isUnknown() && !UnknownLocations)
|
||||||
if (UnknownLocations) {
|
|
||||||
// This instruction has no debug location. If the preceding instruction
|
|
||||||
// did, emit debug location information to indicate that the debug
|
|
||||||
// location is now unknown.
|
|
||||||
MCSymbol *Label = NULL;
|
|
||||||
if (DL == PrevInstLoc)
|
|
||||||
Label = PrevLabel;
|
|
||||||
else {
|
|
||||||
Label = recordSourceLine(DL.getLine(), DL.getCol(), 0);
|
|
||||||
PrevInstLoc = DL;
|
|
||||||
PrevLabel = Label;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this instruction begins a scope then note down corresponding label
|
|
||||||
// even if previous label is reused.
|
|
||||||
if (InsnsBeginScopeSet.count(MI) != 0)
|
|
||||||
LabelsBeforeInsn[MI] = Label;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
DbgVariable *LocalVar = NULL;
|
||||||
const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext());
|
|
||||||
|
|
||||||
// FIXME: Should only verify each scope once!
|
|
||||||
if (!DIScope(Scope).Verify())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// DBG_VALUE instruction establishes new value.
|
|
||||||
if (MI->isDebugValue()) {
|
if (MI->isDebugValue()) {
|
||||||
DenseMap<const MachineInstr *, DbgVariable *>::iterator DI
|
DenseMap<const MachineInstr *, DbgVariable *>::iterator DI
|
||||||
= DbgValueStartMap.find(MI);
|
= DbgValueStartMap.find(MI);
|
||||||
if (DI != DbgValueStartMap.end()) {
|
if (DI != DbgValueStartMap.end())
|
||||||
MCSymbol *Label = NULL;
|
LocalVar = DI->second;
|
||||||
if (DL == PrevInstLoc)
|
|
||||||
Label = PrevLabel;
|
|
||||||
else {
|
|
||||||
Label = recordSourceLine(DL.getLine(), DL.getCol(), Scope);
|
|
||||||
PrevInstLoc = DL;
|
|
||||||
PrevLabel = Label;
|
|
||||||
}
|
|
||||||
DbgVariableLabelsMap[DI->second] = Label;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit a label to indicate location change. This is used for line
|
|
||||||
// table even if this instruction does not start a new scope.
|
|
||||||
MCSymbol *Label = NULL;
|
MCSymbol *Label = NULL;
|
||||||
if (DL == PrevInstLoc)
|
if (DL == PrevInstLoc)
|
||||||
Label = PrevLabel;
|
Label = PrevLabel;
|
||||||
else {
|
// Do not emit line number entry for arguments.
|
||||||
|
else if (!MI->isDebugValue() || LocalVar) {
|
||||||
|
const MDNode *Scope = 0;
|
||||||
|
if (DL.isUnknown() == false) {
|
||||||
|
Scope = DL.getScope(Asm->MF->getFunction()->getContext());
|
||||||
|
// FIXME: Should only verify each scope once!
|
||||||
|
if (!DIScope(Scope).Verify())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// else ...
|
||||||
|
// This instruction has no debug location. If the preceding instruction
|
||||||
|
// did, emit debug location information to indicate that the debug
|
||||||
|
// location is now unknown.
|
||||||
|
|
||||||
Label = recordSourceLine(DL.getLine(), DL.getCol(), Scope);
|
Label = recordSourceLine(DL.getLine(), DL.getCol(), Scope);
|
||||||
PrevInstLoc = DL;
|
PrevInstLoc = DL;
|
||||||
PrevLabel = Label;
|
PrevLabel = Label;
|
||||||
@@ -2245,6 +2220,10 @@ void DwarfDebug::beginScope(const MachineInstr *MI) {
|
|||||||
// even if previous label is reused.
|
// even if previous label is reused.
|
||||||
if (InsnsBeginScopeSet.count(MI) != 0)
|
if (InsnsBeginScopeSet.count(MI) != 0)
|
||||||
LabelsBeforeInsn[MI] = Label;
|
LabelsBeforeInsn[MI] = Label;
|
||||||
|
|
||||||
|
// If this is a DBG_VALUE instruction then record label to identify variable.
|
||||||
|
if (LocalVar)
|
||||||
|
DbgVariableLabelsMap[LocalVar] = Label;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// endScope - Process end of a scope.
|
/// endScope - Process end of a scope.
|
||||||
|
Reference in New Issue
Block a user