mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-20 12:31:40 +00:00
If a variable is spilled by code generator then use DW_OP_fbreg to describe its location on stack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110234 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b57e6558c7
commit
b2cf5816f9
@ -2307,7 +2307,12 @@ DwarfDebug::collectVariableInfo(const MachineFunction *MF,
|
|||||||
}
|
}
|
||||||
End = *MVI;
|
End = *MVI;
|
||||||
MachineLocation MLoc;
|
MachineLocation MLoc;
|
||||||
MLoc.set(Begin->getOperand(0).getReg(), 0);
|
if (Begin->getNumOperands() == 3) {
|
||||||
|
if (Begin->getOperand(0).isReg() && Begin->getOperand(1).isImm())
|
||||||
|
MLoc.set(Begin->getOperand(0).getReg(), Begin->getOperand(1).getImm());
|
||||||
|
} else
|
||||||
|
MLoc = Asm->getDebugValueLocation(Begin);
|
||||||
|
|
||||||
const MCSymbol *FLabel = getLabelBeforeInsn(Begin);
|
const MCSymbol *FLabel = getLabelBeforeInsn(Begin);
|
||||||
const MCSymbol *SLabel = getLabelBeforeInsn(End);
|
const MCSymbol *SLabel = getLabelBeforeInsn(End);
|
||||||
DotDebugLocEntries.push_back(DotDebugLocEntry(FLabel, SLabel, MLoc));
|
DotDebugLocEntries.push_back(DotDebugLocEntry(FLabel, SLabel, MLoc));
|
||||||
@ -2315,9 +2320,14 @@ DwarfDebug::collectVariableInfo(const MachineFunction *MF,
|
|||||||
if (MVI + 1 == MVE) {
|
if (MVI + 1 == MVE) {
|
||||||
// If End is the last instruction then its value is valid
|
// If End is the last instruction then its value is valid
|
||||||
// until the end of the funtion.
|
// until the end of the funtion.
|
||||||
MLoc.set(End->getOperand(0).getReg(), 0);
|
MachineLocation EMLoc;
|
||||||
|
if (End->getNumOperands() == 3) {
|
||||||
|
if (End->getOperand(0).isReg() && Begin->getOperand(1).isImm())
|
||||||
|
EMLoc.set(Begin->getOperand(0).getReg(), Begin->getOperand(1).getImm());
|
||||||
|
} else
|
||||||
|
EMLoc = Asm->getDebugValueLocation(End);
|
||||||
DotDebugLocEntries.
|
DotDebugLocEntries.
|
||||||
push_back(DotDebugLocEntry(SLabel, FunctionEndSym, MLoc));
|
push_back(DotDebugLocEntry(SLabel, FunctionEndSym, EMLoc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DotDebugLocEntries.push_back(DotDebugLocEntry());
|
DotDebugLocEntries.push_back(DotDebugLocEntry());
|
||||||
@ -3637,15 +3647,30 @@ void DwarfDebug::emitDebugLoc() {
|
|||||||
Asm->OutStreamer.EmitSymbolValue(Entry.End, Size, 0);
|
Asm->OutStreamer.EmitSymbolValue(Entry.End, Size, 0);
|
||||||
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
|
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
|
||||||
unsigned Reg = RI->getDwarfRegNum(Entry.Loc.getReg(), false);
|
unsigned Reg = RI->getDwarfRegNum(Entry.Loc.getReg(), false);
|
||||||
if (Reg < 32) {
|
if (int Offset = Entry.Loc.getOffset()) {
|
||||||
|
// If the value is at a certain offset from frame register then
|
||||||
|
// use DW_OP_fbreg.
|
||||||
|
unsigned OffsetSize = Offset ? MCAsmInfo::getSLEB128Size(Offset) : 1;
|
||||||
Asm->OutStreamer.AddComment("Loc expr size");
|
Asm->OutStreamer.AddComment("Loc expr size");
|
||||||
Asm->EmitInt16(1);
|
Asm->EmitInt16(1 + OffsetSize);
|
||||||
Asm->EmitInt8(dwarf::DW_OP_reg0 + Reg);
|
Asm->OutStreamer.AddComment(
|
||||||
|
dwarf::OperationEncodingString(dwarf::DW_OP_fbreg));
|
||||||
|
Asm->EmitInt8(dwarf::DW_OP_fbreg);
|
||||||
|
Asm->OutStreamer.AddComment("Offset");
|
||||||
|
Asm->EmitSLEB128(Offset);
|
||||||
} else {
|
} else {
|
||||||
Asm->OutStreamer.AddComment("Loc expr size");
|
if (Reg < 32) {
|
||||||
Asm->EmitInt16(1+MCAsmInfo::getULEB128Size(Reg));
|
Asm->OutStreamer.AddComment("Loc expr size");
|
||||||
Asm->EmitInt8(dwarf::DW_OP_regx);
|
Asm->EmitInt16(1);
|
||||||
Asm->EmitULEB128(Reg);
|
Asm->OutStreamer.AddComment(
|
||||||
|
dwarf::OperationEncodingString(dwarf::DW_OP_breg0 + Reg));
|
||||||
|
Asm->EmitInt8(dwarf::DW_OP_reg0 + Reg);
|
||||||
|
} else {
|
||||||
|
Asm->OutStreamer.AddComment("Loc expr size");
|
||||||
|
Asm->EmitInt16(1 + MCAsmInfo::getULEB128Size(Reg));
|
||||||
|
Asm->EmitInt8(dwarf::DW_OP_regx);
|
||||||
|
Asm->EmitULEB128(Reg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user