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

Evan Cheng evan.cheng at apple.com
Wed Jan 31 14:25:49 PST 2007



Changes in directory llvm/lib/Target/ARM:

ARMRegisterInfo.cpp updated: 1.49 -> 1.50
---
Log message:

Darwin ABI requires FP to point to stack slot of prev FP.

---
Diffs of the changes:  (+14 -3)

 ARMRegisterInfo.cpp |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp
diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.49 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.50
--- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.49	Wed Jan 31 16:06:44 2007
+++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp	Wed Jan 31 16:25:33 2007
@@ -900,6 +900,13 @@
       ForceLRSpill = false;
     }
 
+    // Darwin ABI requires FP to point to the stack slot that contains the
+    // previous FP.
+    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.
@@ -1029,8 +1036,9 @@
   } else if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tPUSH)
     ++MBBI;
 
-  // Point FP to the stack slot that contains the previous FP.
-  if (hasFP(MF))
+  // Darwin ABI requires FP to point to the stack slot that contains the
+  // previous FP.
+  if (STI.isTargetDarwin() || hasFP(MF))
     BuildMI(MBB, MBBI, TII.get(isThumb ? ARM::tADDrSPi : ARM::ADDri), FramePtr)
       .addFrameIndex(FramePtrSpillFI).addImm(0);
 
@@ -1116,7 +1124,9 @@
   if (isThumb)
     emitSPUpdate(MBB, MBBI, NumBytes, isThumb, TII);
   else {
-    if (hasFP(MF)){
+    // Darwin ABI requires FP to point to the stack slot that contains the
+    // previous FP.
+    if (STI.isTargetDarwin() || hasFP(MF)) {
       NumBytes = AFI->getFramePtrSpillOffset() - NumBytes;
       // Reset SP based on frame pointer only if the stack frame extends beyond
       // frame pointer stack slot.
@@ -1131,6 +1141,7 @@
     } 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);






More information about the llvm-commits mailing list