mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
[Stackmaps] Move the target-independent frame index elimination for stackmaps and patchpoints into target-specific code.
The lowering of the frame index for stackmaps and patchpoints requires some target-specific magic and should therefore be handled in the target-specific eliminateFrameIndex method. This is related to <rdar://problem/16106219> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201904 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
84ace05e8c
commit
94f20bfe6e
@ -779,18 +779,15 @@ void PEI::replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &Fn,
|
|||||||
// Frame indicies in debug values are encoded in a target independent
|
// Frame indicies in debug values are encoded in a target independent
|
||||||
// way with simply the frame index and offset rather than any
|
// way with simply the frame index and offset rather than any
|
||||||
// target-specific addressing mode.
|
// target-specific addressing mode.
|
||||||
if (MI->isDebugValue() ||
|
if (MI->isDebugValue()) {
|
||||||
MI->getOpcode() == TargetOpcode::STACKMAP ||
|
assert(i == 0 && "Frame indicies can only appear as the first "
|
||||||
MI->getOpcode() == TargetOpcode::PATCHPOINT) {
|
"operand of a DBG_VALUE machine instruction");
|
||||||
assert((!MI->isDebugValue() || i == 0) &&
|
|
||||||
"Frame indicies can only appear as the first operand of a "
|
|
||||||
"DBG_VALUE machine instruction");
|
|
||||||
unsigned Reg;
|
unsigned Reg;
|
||||||
MachineOperand &Offset = MI->getOperand(i + 1);
|
MachineOperand &Offset = MI->getOperand(1);
|
||||||
Offset.setImm(Offset.getImm() +
|
Offset.setImm(Offset.getImm() +
|
||||||
TFI->getFrameIndexReference(
|
TFI->getFrameIndexReference(
|
||||||
Fn, MI->getOperand(i).getIndex(), Reg));
|
Fn, MI->getOperand(0).getIndex(), Reg));
|
||||||
MI->getOperand(i).ChangeToRegister(Reg, false /*isDef*/);
|
MI->getOperand(0).ChangeToRegister(Reg, false /*isDef*/);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,6 +516,15 @@ X86RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
|||||||
} else
|
} else
|
||||||
FIOffset = TFI->getFrameIndexOffset(MF, FrameIndex);
|
FIOffset = TFI->getFrameIndexOffset(MF, FrameIndex);
|
||||||
|
|
||||||
|
// The frame index format for stackmaps and patchpoints is different from the
|
||||||
|
// X86 format. It only has a FI and an offset.
|
||||||
|
if (Opc == TargetOpcode::STACKMAP || Opc == TargetOpcode::PATCHPOINT) {
|
||||||
|
assert(BasePtr == FramePtr && "Expected the FP as base register");
|
||||||
|
int64_t Offset = MI.getOperand(FIOperandNum + 1).getImm() + FIOffset;
|
||||||
|
MI.getOperand(FIOperandNum + 1).ChangeToImmediate(Offset);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (MI.getOperand(FIOperandNum+3).isImm()) {
|
if (MI.getOperand(FIOperandNum+3).isImm()) {
|
||||||
// Offset is a 32-bit integer.
|
// Offset is a 32-bit integer.
|
||||||
int Imm = (int)(MI.getOperand(FIOperandNum + 3).getImm());
|
int Imm = (int)(MI.getOperand(FIOperandNum + 3).getImm());
|
||||||
|
Loading…
Reference in New Issue
Block a user