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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160009 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86MachineFunctionInfo.h b/lib/Target/X86/X86MachineFunctionInfo.h
index 2bc308d..cdf907b 100644
--- a/lib/Target/X86/X86MachineFunctionInfo.h
+++ b/lib/Target/X86/X86MachineFunctionInfo.h
@@ -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