[llvm-branch-commits] [llvm-branch] r79076 - in /llvm/branches/Apple/Leela/lib/Target/ARM: ARMBaseRegisterInfo.cpp ARMBaseRegisterInfo.h

Bill Wendling isanbard at gmail.com
Fri Aug 14 20:48:56 PDT 2009


Author: void
Date: Fri Aug 14 22:48:56 2009
New Revision: 79076

URL: http://llvm.org/viewvc/llvm-project?rev=79076&view=rev
Log:
$ svn merge -c 79067 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r79067 into '.':
U    lib/Target/ARM/ARMBaseRegisterInfo.h
U    lib/Target/ARM/ARMBaseRegisterInfo.cpp


Modified:
    llvm/branches/Apple/Leela/lib/Target/ARM/ARMBaseRegisterInfo.cpp
    llvm/branches/Apple/Leela/lib/Target/ARM/ARMBaseRegisterInfo.h

Modified: llvm/branches/Apple/Leela/lib/Target/ARM/ARMBaseRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=79076&r1=79075&r2=79076&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/ARM/ARMBaseRegisterInfo.cpp Fri Aug 14 22:48:56 2009
@@ -440,7 +440,7 @@
           MFI->isFrameAddressTaken());
 }
 
-bool ARMBaseRegisterInfo::hasStackFrame(const MachineFunction &MF) const {
+bool ARMBaseRegisterInfo::cannotEliminateFrame(const MachineFunction &MF) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
   if (NoFramePointerElim && MFI->hasCalls())
     return true;
@@ -596,7 +596,7 @@
   }
 
   bool ExtraCSSpill = false;
-  if (!CanEliminateFrame || hasStackFrame(MF)) {
+  if (!CanEliminateFrame || cannotEliminateFrame(MF)) {
     AFI->setHasStackFrame(true);
 
     // If LR is not spilled, but at least one of R4, R5, R6, and R7 is spilled.
@@ -1021,6 +1021,7 @@
   MachineInstr &MI = *II;
   MachineBasicBlock &MBB = *MI.getParent();
   MachineFunction &MF = *MBB.getParent();
+  const MachineFrameInfo *MFI = MF.getFrameInfo();
   ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
   assert(!AFI->isThumb1OnlyFunction() &&
          "This eliminateFrameIndex does not suppor Thumb1!");
@@ -1032,8 +1033,7 @@
 
   unsigned FrameReg = ARM::SP;
   int FrameIndex = MI.getOperand(i).getIndex();
-  int Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex) +
-               MF.getFrameInfo()->getStackSize() + SPAdj;
+  int Offset = MFI->getObjectOffset(FrameIndex) + MFI->getStackSize() + SPAdj;
 
   if (AFI->isGPRCalleeSavedArea1Frame(FrameIndex))
     Offset -= AFI->getGPRCalleeSavedArea1Offset();
@@ -1041,10 +1041,10 @@
     Offset -= AFI->getGPRCalleeSavedArea2Offset();
   else if (AFI->isDPRCalleeSavedAreaFrame(FrameIndex))
     Offset -= AFI->getDPRCalleeSavedAreaOffset();
-  else if (hasFP(MF)) {
-    assert(SPAdj == 0 && "Unexpected");
-    // There is alloca()'s in this function, must reference off the frame
-    // pointer instead.
+  else if (hasFP(MF) && AFI->hasStackFrame()) {
+    assert(SPAdj == 0 && "Unexpected stack offset!");
+    // Use frame pointer to reference fixed objects unless this is a
+    // frameless function,
     FrameReg = getFrameRegister(MF);
     Offset -= AFI->getFramePtrSpillOffset();
   }
@@ -1287,14 +1287,15 @@
 
     // Darwin ABI requires FP to point to the stack slot that contains the
     // previous FP.
-    if ((STI.isTargetDarwin() && NumBytes) || hasFP(MF)) {
+    bool HasFP = hasFP(MF);
+    if ((STI.isTargetDarwin() && NumBytes) || HasFP) {
       NumBytes = AFI->getFramePtrSpillOffset() - NumBytes;
       // Reset SP based on frame pointer only if the stack frame extends beyond
       // frame pointer stack slot or target is ELF and the function has FP.
-      if (AFI->getGPRCalleeSavedArea2Size() ||
+      if (HasFP ||
+          AFI->getGPRCalleeSavedArea2Size() ||
           AFI->getDPRCalleeSavedAreaSize()  ||
-          AFI->getDPRCalleeSavedAreaOffset()||
-          hasFP(MF)) {
+          AFI->getDPRCalleeSavedAreaOffset()) {
         if (NumBytes) {
           if (isARM)
             emitARMRegPlusImmediate(MBB, MBBI, dl, ARM::SP, FramePtr, -NumBytes,

Modified: llvm/branches/Apple/Leela/lib/Target/ARM/ARMBaseRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/ARM/ARMBaseRegisterInfo.h?rev=79076&r1=79075&r2=79076&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/ARM/ARMBaseRegisterInfo.h (original)
+++ llvm/branches/Apple/Leela/lib/Target/ARM/ARMBaseRegisterInfo.h Fri Aug 14 22:48:56 2009
@@ -89,7 +89,7 @@
 
   bool hasFP(const MachineFunction &MF) const;
 
-  bool hasStackFrame(const MachineFunction &MF) const;
+  bool cannotEliminateFrame(const MachineFunction &MF) const;
 
   void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
                                             RegScavenger *RS = NULL) const;





More information about the llvm-branch-commits mailing list