mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
ARM: remove unnecessary state-tracking during frame lowering.
ResolveFrameIndex had what appeared to be a very nasty hack for when the frame-index referred to a callee-saved register. In this case it "adjusted" the offset so that the address was correct if (and only if) the MachineInstr immediately followed the respective push. This "worked" for all forms of GPR & DPR but was only ever used to set the frame pointer itself, and once this was put in a more sensible location the entire state-tracking machinery it relied on became redundant. So I stripped it. The only wrinkle is that "add r7, sp, #0" might theoretically be slower (need an actual ALU slot) compared to "mov r7, sp" so I added a micro-optimisation that also makes emitARMRegUpdate and emitT2RegUpdate also work when NumBytes == 0. No test changes since there shouldn't be any functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194025 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -127,7 +127,6 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
case ARM::LR:
|
||||
if (Reg == FramePtr)
|
||||
FramePtrSpillFI = FI;
|
||||
AFI->addGPRCalleeSavedArea1Frame(FI);
|
||||
GPRCS1Size += 4;
|
||||
break;
|
||||
case ARM::R8:
|
||||
@@ -136,16 +135,12 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
case ARM::R11:
|
||||
if (Reg == FramePtr)
|
||||
FramePtrSpillFI = FI;
|
||||
if (STI.isTargetIOS()) {
|
||||
AFI->addGPRCalleeSavedArea2Frame(FI);
|
||||
if (STI.isTargetIOS())
|
||||
GPRCS2Size += 4;
|
||||
} else {
|
||||
AFI->addGPRCalleeSavedArea1Frame(FI);
|
||||
else
|
||||
GPRCS1Size += 4;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AFI->addDPRCalleeSavedAreaFrame(FI);
|
||||
DPRCSSize += 8;
|
||||
}
|
||||
}
|
||||
@@ -171,8 +166,9 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
|
||||
// Adjust FP so it point to the stack slot that contains the previous FP.
|
||||
if (HasFP) {
|
||||
int FramePtrOffset = MFI->getObjectOffset(FramePtrSpillFI) + GPRCS1Size;
|
||||
AddDefaultPred(BuildMI(MBB, MBBI, dl, TII.get(ARM::tADDrSPi), FramePtr)
|
||||
.addFrameIndex(FramePtrSpillFI).addImm(0)
|
||||
.addReg(ARM::SP).addImm(FramePtrOffset / 4)
|
||||
.setMIFlags(MachineInstr::FrameSetup));
|
||||
if (NumBytes > 508)
|
||||
// If offset is > 508 then sp cannot be adjusted in a single instruction,
|
||||
|
Reference in New Issue
Block a user