[llvm-commits] llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp

Chris Lattner clattner at apple.com
Thu Mar 1 09:42:38 PST 2007


On Feb 27, 2007, at 9:29 AM, Nicolas Geoffray wrote:
> Here's a patch that fixes linux/PPC FramePointer. It reserves the  
> offset of the frame pointer before
> calculating the offsets of callee saved registers.
> OK to commit?

Why can't you just mark the frame address callee save?  Why isn't it  
getting saved automatically for you?

-Chris

> 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 at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070301/0ca4cb5d/attachment.html>


More information about the llvm-commits mailing list