[llvm-commits] [llvm] r160009 - in /llvm/trunk: include/llvm/CodeGen/MachineFrameInfo.h lib/Target/X86/X86FrameLowering.cpp lib/Target/X86/X86MachineFunctionInfo.h

Chad Rosier mcrosier at apple.com
Tue Jul 10 11:27:16 PDT 2012


Author: mcrosier
Date: Tue Jul 10 13:27:15 2012
New Revision: 160009

URL: http://llvm.org/viewvc/llvm-project?rev=160009&view=rev
Log:
Move [get|set]BasePtrStackAdjustment() from MachineFrameInfo to
X86MachineFunctionInfo as this is currently only used by X86. If this ever
becomes an issue on another arch (e.g., ARM) then we can hoist it back out.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
    llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
    llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h

Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=160009&r1=160008&r2=160009&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Tue Jul 10 13:27:15 2012
@@ -215,10 +215,6 @@
   /// just allocate them normally.
   bool UseLocalStackAllocationBlock;
 
-  /// After the stack pointer has been restore from the base pointer we
-  /// use a cached adjusment.  Currently only used for x86.
-  int64_t BPAdj;
-
 public:
     explicit MachineFrameInfo(const TargetFrameLowering &tfi) : TFI(tfi) {
     StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
@@ -234,7 +230,6 @@
     LocalFrameSize = 0;
     LocalFrameMaxAlign = 0;
     UseLocalStackAllocationBlock = false;
-    BPAdj = 0;
   }
 
   /// hasStackObjects - Return true if there are any stack objects in this
@@ -543,16 +538,6 @@
 
   void setCalleeSavedInfoValid(bool v) { CSIValid = v; }
 
-  /// setBasePtrStackAdjustment - If we're restoring the stack pointer from the
-  /// base pointer, due to dynamic stack realignment + VLAs, we cache the
-  /// number of bytes initially allocated for the stack frame.  In obscure
-  /// cases (e.g., tail calls with byval argument and no stack protector), the
-  /// stack gets adjusted outside of the prolog, but these shouldn't be 
-  /// considered when restoring from the base pointer.  Currently, this is only
-  /// needed for x86.
-  void setBasePtrStackAdjustment(int64_t adj) { BPAdj = adj; }
-  int64_t getBasePtrStackAdjustment() const { return BPAdj; }
-
   /// getPristineRegs - Return a set of physical registers that are pristine on
   /// entry to the MBB.
   ///

Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=160009&r1=160008&r2=160009&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Tue Jul 10 13:27:15 2012
@@ -925,7 +925,7 @@
       .addReg(StackPtr)
       .setMIFlag(MachineInstr::FrameSetup);
 
-    MFI->setBasePtrStackAdjustment(NumBytes);
+    X86FI->setBasePtrStackAdjustment(NumBytes);
   }
 
   if (( (!HasFP && NumBytes) || PushedRegs) && needsFrameMoves) {
@@ -1051,7 +1051,7 @@
             StackPtr).addReg(BasePtr);
 
     // When restoring from the BP we must use a cached SP adjustment.
-    NumBytes = MFI->getBasePtrStackAdjustment();
+    NumBytes = X86FI->getBasePtrStackAdjustment();
   }
 
   // If dynamic alloca is used, then reset esp to point to the last callee-saved

Modified: llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h?rev=160009&r1=160008&r2=160009&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86MachineFunctionInfo.h Tue Jul 10 13:27:15 2012
@@ -69,6 +69,10 @@
   /// NumLocalDynamics - Number of local-dynamic TLS accesses.
   unsigned NumLocalDynamics;
 
+  /// After the stack pointer has been restore from the base pointer we
+  /// use a cached adjusment.
+  int64_t BPAdj;
+
 public:
   X86MachineFunctionInfo() : ForceFramePointer(false),
                              CalleeSavedFrameSize(0),
@@ -97,8 +101,9 @@
       VarArgsGPOffset(0),
       VarArgsFPOffset(0),
       ArgumentStackSize(0),
-      NumLocalDynamics(0) {}
-  
+      NumLocalDynamics(0),
+      BPAdj(0) {}
+
   bool getForceFramePointer() const { return ForceFramePointer;} 
   void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
 
@@ -137,6 +142,16 @@
 
   unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }
   void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }
+
+  /// setBasePtrStackAdjustment - If we're restoring the stack pointer from the
+  /// base pointer, due to dynamic stack realignment + VLAs, we cache the
+  /// number of bytes initially allocated for the stack frame.  In obscure
+  /// cases (e.g., tail calls with byval argument and no stack protector), the
+  /// stack gets adjusted outside of the prolog, but these shouldn't be 
+  /// considered when restoring from the base pointer.  Currently, this is only
+  /// needed for x86.
+  void setBasePtrStackAdjustment(int64_t adj) { BPAdj = adj; }
+  int64_t getBasePtrStackAdjustment() const { return BPAdj; }
 };
 
 } // End llvm namespace





More information about the llvm-commits mailing list