mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Read/write the offset value for stack-relative loads via correct instr operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14722 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ce22e76996
commit
c1ef127ae2
@ -153,21 +153,19 @@ PowerPCRegisterInfo::eliminateFrameIndex(MachineFunction &MF,
|
||||
|
||||
int FrameIndex = MI.getOperand(i).getFrameIndex();
|
||||
|
||||
// This must be part of a four operand memory reference. Replace the
|
||||
// FrameIndex with base register with GPR1.
|
||||
// Replace the FrameIndex with base register with GPR1.
|
||||
MI.SetMachineOperandReg(i, PPC32::R1);
|
||||
|
||||
// Take into account whether its an add or mem instruction
|
||||
if (i == 2) i--;
|
||||
|
||||
// Take into account whether it's an add or mem instruction
|
||||
unsigned OffIdx = (i == 2) ? 1 : 2;
|
||||
// Now add the frame object offset to the offset from r1.
|
||||
int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex) +
|
||||
MI.getOperand(i).getImmedValue()+4;
|
||||
MI.getOperand(OffIdx).getImmedValue()+4;
|
||||
|
||||
if (!hasFP(MF))
|
||||
Offset += MF.getFrameInfo()->getStackSize();
|
||||
|
||||
MI.SetMachineOperandConst(i, MachineOperand::MO_SignExtendedImmed, Offset);
|
||||
MI.SetMachineOperandConst(OffIdx, MachineOperand::MO_SignExtendedImmed, Offset);
|
||||
DEBUG(std::cerr << "offset = " << Offset << std::endl);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user