[llvm-commits] CVS: llvm/lib/Target/ARM/ARMRegisterInfo.cpp

Evan Cheng evan.cheng at apple.com
Wed Jan 31 14:26:42 PST 2007


Hi Lauro,

FYI. Darwin ABI requires FP to point to the stack slot where previous  
FP is spilled. I've fixed this.

Evan

On Jan 31, 2007, at 5:13 AM, Lauro Ramos Venancio wrote:

>
>
> Changes in directory llvm/lib/Target/ARM:
>
> ARMRegisterInfo.cpp updated: 1.47 -> 1.48
> ---
> Log message:
>
> ARM fix: Miscompilation when frame pointer can't be eliminated.  
> Uninitialized frame pointer register is used.
>
>
> ---
> Diffs of the changes:  (+9 -10)
>
>  ARMRegisterInfo.cpp |   19 +++++++++----------
>  1 files changed, 9 insertions(+), 10 deletions(-)
>
>
> Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp
> diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.47 llvm/lib/ 
> Target/ARM/ARMRegisterInfo.cpp:1.48
> --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.47	Tue Jan 30  
> 17:01:46 2007
> +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp	Wed Jan 31 07:12:46 2007
> @@ -573,8 +573,7 @@
>      // There is alloca()'s in this function, must reference off  
> the frame
>      // pointer instead.
>      FrameReg = getFrameRegister(MF);
> -    if (STI.isTargetDarwin())
> -      Offset -= AFI->getFramePtrSpillOffset();
> +    Offset -= AFI->getFramePtrSpillOffset();
>    }
>
>    unsigned Opcode = MI.getOpcode();
> @@ -882,6 +881,12 @@
>      }
>    }
>
> +  if (hasFP(MF)) {
> +    MF.changePhyRegUsed(FramePtr, true);
> +    NumGPRSpills++;
> +    CanEliminateFrame = false;
> +  }
> +
>    if (!CanEliminateFrame) {
>      AFI->setHasStackFrame(true);
>
> @@ -895,11 +900,6 @@
>        ForceLRSpill = false;
>      }
>
> -    if (STI.isTargetDarwin()) {
> -      MF.changePhyRegUsed(FramePtr, true);
> -      NumGPRSpills++;
> -    }
> -
>      // If stack and double are 8-byte aligned and we are spilling  
> an odd number
>      // of GPRs. Spill one extra callee save GPR so we won't have  
> to pad between
>      // the integer and double callee save areas.
> @@ -1030,7 +1030,7 @@
>      ++MBBI;
>
>    // Point FP to the stack slot that contains the previous FP.
> -  if (STI.isTargetDarwin())
> +  if (hasFP(MF))
>      BuildMI(MBB, MBBI, TII.get(isThumb ? ARM::tADDrSPi :  
> ARM::ADDri), FramePtr)
>        .addFrameIndex(FramePtrSpillFI).addImm(0);
>
> @@ -1116,7 +1116,7 @@
>    if (isThumb)
>      emitSPUpdate(MBB, MBBI, NumBytes, isThumb, TII);
>    else {
> -    if (STI.isTargetDarwin()) {
> +    if (hasFP(MF)){
>        NumBytes = AFI->getFramePtrSpillOffset() - NumBytes;
>        // Reset SP based on frame pointer only if the stack frame  
> extends beyond
>        // frame pointer stack slot.
> @@ -1131,7 +1131,6 @@
>      } else if (NumBytes) {
>        emitSPUpdate(MBB, MBBI, NumBytes, false, TII);
>      }
> -
>      // Move SP to start of integer callee save spill area 2.
>      movePastCSLoadStoreOps(MBB, MBBI, ARM::FLDD, 3, STI);
>      emitSPUpdate(MBB, MBBI, AFI->getDPRCalleeSavedAreaSize(),  
> false, TII);
>
>
>
> _______________________________________________
> 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