mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
Some refactoring suggested by Anton Korobeynikov.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129600 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -277,37 +277,42 @@ void AsmPrinter::EmitFrameMoves(const std::vector<MachineMove> &Moves,
|
||||
}
|
||||
}
|
||||
|
||||
/// EmitFrameMoves - Emit a frame instruction.
|
||||
void AsmPrinter::EmitCFIFrameMove(const MachineMove &Move) const {
|
||||
const TargetRegisterInfo *RI = TM.getRegisterInfo();
|
||||
|
||||
const MachineLocation &Dst = Move.getDestination();
|
||||
const MachineLocation &Src = Move.getSource();
|
||||
|
||||
// If advancing cfa.
|
||||
if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
|
||||
assert(!Src.isReg() && "Machine move not supported yet.");
|
||||
|
||||
if (Src.getReg() == MachineLocation::VirtualFP) {
|
||||
OutStreamer.EmitCFIDefCfaOffset(-Src.getOffset());
|
||||
} else {
|
||||
assert("Machine move not supported yet");
|
||||
// Reg + Offset
|
||||
}
|
||||
} else if (Src.isReg() && Src.getReg() == MachineLocation::VirtualFP) {
|
||||
assert(Dst.isReg() && "Machine move not supported yet.");
|
||||
OutStreamer.EmitCFIDefCfaRegister(RI->getDwarfRegNum(Dst.getReg(), true));
|
||||
} else {
|
||||
assert(!Dst.isReg() && "Machine move not supported yet.");
|
||||
OutStreamer.EmitCFIOffset(RI->getDwarfRegNum(Src.getReg(), true),
|
||||
-Dst.getOffset());
|
||||
}
|
||||
}
|
||||
|
||||
/// EmitFrameMoves - Emit frame instructions to describe the layout of the
|
||||
/// frame.
|
||||
void AsmPrinter::EmitCFIFrameMoves(const std::vector<MachineMove> &Moves) const {
|
||||
const TargetRegisterInfo *RI = TM.getRegisterInfo();
|
||||
|
||||
for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
|
||||
const MachineMove &Move = Moves[i];
|
||||
MCSymbol *Label = Move.getLabel();
|
||||
// Throw out move if the label is invalid.
|
||||
if (Label && !Label->isDefined()) continue; // Not emitted, in dead code.
|
||||
|
||||
const MachineLocation &Dst = Move.getDestination();
|
||||
const MachineLocation &Src = Move.getSource();
|
||||
|
||||
// If advancing cfa.
|
||||
if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
|
||||
assert(!Src.isReg() && "Machine move not supported yet.");
|
||||
|
||||
if (Src.getReg() == MachineLocation::VirtualFP) {
|
||||
OutStreamer.EmitCFIDefCfaOffset(-Src.getOffset());
|
||||
} else {
|
||||
assert("Machine move not supported yet");
|
||||
// Reg + Offset
|
||||
}
|
||||
} else if (Src.isReg() && Src.getReg() == MachineLocation::VirtualFP) {
|
||||
assert(Dst.isReg() && "Machine move not supported yet.");
|
||||
OutStreamer.EmitCFIDefCfaRegister(RI->getDwarfRegNum(Dst.getReg(), true));
|
||||
} else {
|
||||
assert(!Dst.isReg() && "Machine move not supported yet.");
|
||||
OutStreamer.EmitCFIOffset(RI->getDwarfRegNum(Src.getReg(), true),
|
||||
Dst.getOffset());
|
||||
}
|
||||
EmitCFIFrameMove(Move);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user