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

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Mar 1 00:33:22 PST 2007


If there is no objection, I'm committing this in.

Nicolas

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?
> ------------------------------------------------------------------------
>
> 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
>   




More information about the llvm-commits mailing list