[llvm-branch-commits] [llvm-branch] r75185 - /llvm/branches/Apple/Bender/lib/Target/X86/X86RegisterInfo.cpp

Bill Wendling isanbard at gmail.com
Thu Jul 9 15:32:53 PDT 2009


Author: void
Date: Thu Jul  9 17:32:53 2009
New Revision: 75185

URL: http://llvm.org/viewvc/llvm-project?rev=75185&view=rev
Log:
--- Merging r75183 into '.':
U    lib/Target/X86/X86RegisterInfo.cpp

If -fomit-frame-pointer is used, we still need to record when the %esp register
is modified. Otherwise, the unwinder will get confused. The old code (before I
started my hacking) did this. It dropped on the floor, because I wasn't aware of
this requirement.

On the plus side, if we use "alloca" in a function, we create frame pointers
even with -fomit-frame-pointer is enabled!

This is a Good Thing(tm)!!!

Modified:
    llvm/branches/Apple/Bender/lib/Target/X86/X86RegisterInfo.cpp

Modified: llvm/branches/Apple/Bender/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Bender/lib/Target/X86/X86RegisterInfo.cpp?rev=75185&r1=75184&r2=75185&view=diff

==============================================================================
--- llvm/branches/Apple/Bender/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/branches/Apple/Bender/lib/Target/X86/X86RegisterInfo.cpp Thu Jul  9 17:32:53 2009
@@ -865,7 +865,7 @@
     BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addImm(LabelId);
 
     // Emit DWARF info specifying the offsets of the callee-saved registers.
-    emitCalleeSavedFrameMoves(MF, LabelId, FramePtr);
+    emitCalleeSavedFrameMoves(MF, LabelId, HasFP ? FramePtr : StackPtr);
   }
 
   if (MBBI != MBB.end())
@@ -921,6 +921,25 @@
         emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit, TII);
     }
   }
+
+  if (!HasFP && needsFrameMoves && NumBytes) {
+    // Mark end of stack pointer adjustment.
+    unsigned LabelId = MMI->NextLabelID();
+    BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addImm(LabelId);
+
+    // Define the current CFA rule to use the provided offset.
+    if (StackSize) {
+      MachineLocation SPDst(MachineLocation::VirtualFP);
+      MachineLocation SPSrc(MachineLocation::VirtualFP,
+                            -StackSize + stackGrowth);
+      Moves.push_back(MachineMove(LabelId, SPDst, SPSrc));
+    } else {
+      // FIXME: Verify & implement for FP
+      MachineLocation SPDst(StackPtr);
+      MachineLocation SPSrc(StackPtr, stackGrowth);
+      Moves.push_back(MachineMove(LabelId, SPDst, SPSrc));
+    }
+  }
 }
 
 void X86RegisterInfo::emitEpilogue(MachineFunction &MF,





More information about the llvm-branch-commits mailing list