[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed Mar 21 09:44:43 PDT 2007
Changes in directory llvm/lib/Target/PowerPC:
PPCRegisterInfo.cpp updated: 1.117 -> 1.118
---
Log message:
Protect R31's frame offset from being used by callee-saved registers, when R31
is the frame pointer.
---
Diffs of the changes: (+20 -0)
PPCRegisterInfo.cpp | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+)
Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.117 llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.118
--- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.117 Tue Mar 20 03:08:30 2007
+++ llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Wed Mar 21 11:44:14 2007
@@ -891,6 +891,26 @@
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 {
More information about the llvm-commits
mailing list