mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Move more PEI-related hooks to TFI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120229 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -870,3 +870,44 @@ bool X86FrameInfo::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
X86FrameInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||
RegScavenger *RS) const {
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
const X86RegisterInfo *RegInfo = TM.getRegisterInfo();
|
||||
unsigned SlotSize = RegInfo->getSlotSize();
|
||||
|
||||
X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
|
||||
int32_t TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta();
|
||||
|
||||
if (TailCallReturnAddrDelta < 0) {
|
||||
// create RETURNADDR area
|
||||
// arg
|
||||
// arg
|
||||
// RETADDR
|
||||
// { ...
|
||||
// RETADDR area
|
||||
// ...
|
||||
// }
|
||||
// [EBP]
|
||||
MFI->CreateFixedObject(-TailCallReturnAddrDelta,
|
||||
(-1U*SlotSize)+TailCallReturnAddrDelta, true);
|
||||
}
|
||||
|
||||
if (hasFP(MF)) {
|
||||
assert((TailCallReturnAddrDelta <= 0) &&
|
||||
"The Delta should always be zero or negative");
|
||||
const TargetFrameInfo &TFI = *MF.getTarget().getFrameInfo();
|
||||
|
||||
// Create a frame entry for the EBP register that must be saved.
|
||||
int FrameIdx = MFI->CreateFixedObject(SlotSize,
|
||||
-(int)SlotSize +
|
||||
TFI.getOffsetOfLocalArea() +
|
||||
TailCallReturnAddrDelta,
|
||||
true);
|
||||
assert(FrameIdx == MFI->getObjectIndexBegin() &&
|
||||
"Slot for EBP register must be last in order to be found!");
|
||||
FrameIdx = 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user