mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-09 10:31:14 +00:00
Protect R31's frame offset from being used by callee-saved registers, when R31
is the frame pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35233 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6dbe233959
commit
82d4264c1f
@ -891,6 +891,26 @@ void PPCRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||
unsigned LR = getRARegister();
|
||||
FI->setUsesLR(MF.isPhysRegUsed(LR));
|
||||
MF.changePhyRegUsed(LR, false);
|
||||
|
||||
|
||||
// Save R31 if necessary
|
||||
int FPSI = FI->getFramePointerSaveIndex();
|
||||
bool IsPPC64 = Subtarget.isPPC64();
|
||||
bool IsELF_ABI = Subtarget.isELF_ABI();
|
||||
const MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
|
||||
// If the frame pointer save index hasn't been defined yet.
|
||||
if (!FPSI && (NoFramePointerElim || MFI->hasVarSizedObjects())
|
||||
&& IsELF_ABI) {
|
||||
// Find out what the fix offset of the frame pointer save area.
|
||||
int FPOffset = PPCFrameInfo::getFramePointerSaveOffset(IsPPC64,
|
||||
!IsELF_ABI);
|
||||
// Allocate the frame index for frame pointer save area.
|
||||
FPSI = MF.getFrameInfo()->CreateFixedObject(IsPPC64? 8 : 4, FPOffset);
|
||||
// Save the result.
|
||||
FI->setFramePointerSaveIndex(FPSI);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
|
Loading…
Reference in New Issue
Block a user