Chris Lattner wrote: > > Why can't you just mark the frame address callee save? Why isn't it > getting saved automatically for you? >
Because R31 is not used as a callee saved register when llvm::NoFramePointerElim is set to 1. The algorithm that calculates the callee saved registers' addresses does not save R31's offset when used as a frame pointer. And with the ELF Abi, R31's offset is in the callee saved registers area. Therefore I have to force its allocation (at the -4 offset). > Index: PPCRegisterInfo.cpp > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp,v > retrieving revision 1.114 > diff -t -d -u -p -5 -r1.114 PPCRegisterInfo.cpp > --- PPCRegisterInfo.cpp 27 Feb 2007 11:55:45 -0000 1.114 > +++ PPCRegisterInfo.cpp 27 Feb 2007 17:29:51 -0000 > @@ -879,10 +879,30 @@ void PPCRegisterInfo::processFunctionBef > // Save and clear the LR state. > PPCFunctionInfo *FI = MF.getInfo<PPCFunctionInfo>(); > 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 IsMachoABI = Subtarget.isMachoABI(); > + const MachineFrameInfo *MFI = MF.getFrameInfo(); > + + // If the frame pointer save index hasn't been defined yet. > + if (!FPSI && (NoFramePointerElim || MFI->hasVarSizedObjects()) > + && !IsMachoABI) { > + // Find out what the fix offset of the frame pointer save area. > + int FPOffset = PPCFrameInfo::getFramePointerSaveOffset(IsPPC64, > + > IsMachoABI); > + // 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 { > MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB > MachineBasicBlock::iterator MBBI = MBB.begin(); > _______________________________________________ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu <mailto:llvm-commits@cs.uiuc.edu> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits