llvm.org GIT mirror llvm / 2b02688
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 Chad Rosier 8 years ago
3 changed file(s) with 19 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
214214 /// just allocate them normally.
215215 bool UseLocalStackAllocationBlock;
216216
217 /// After the stack pointer has been restore from the base pointer we
218 /// use a cached adjusment. Currently only used for x86.
219 int64_t BPAdj;
220
221217 public:
222218 explicit MachineFrameInfo(const TargetFrameLowering &tfi) : TFI(tfi) {
223219 StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
233229 LocalFrameSize = 0;
234230 LocalFrameMaxAlign = 0;
235231 UseLocalStackAllocationBlock = false;
236 BPAdj = 0;
237232 }
238233
239234 /// hasStackObjects - Return true if there are any stack objects in this
542537
543538 void setCalleeSavedInfoValid(bool v) { CSIValid = v; }
544539
545 /// setBasePtrStackAdjustment - If we're restoring the stack pointer from the
546 /// base pointer, due to dynamic stack realignment + VLAs, we cache the
547 /// number of bytes initially allocated for the stack frame. In obscure
548 /// cases (e.g., tail calls with byval argument and no stack protector), the
549 /// stack gets adjusted outside of the prolog, but these shouldn't be
550 /// considered when restoring from the base pointer. Currently, this is only
551 /// needed for x86.
552 void setBasePtrStackAdjustment(int64_t adj) { BPAdj = adj; }
553 int64_t getBasePtrStackAdjustment() const { return BPAdj; }
554
555540 /// getPristineRegs - Return a set of physical registers that are pristine on
556541 /// entry to the MBB.
557542 ///
924924 .addReg(StackPtr)
925925 .setMIFlag(MachineInstr::FrameSetup);
926926
927 MFI->setBasePtrStackAdjustment(NumBytes);
927 X86FI->setBasePtrStackAdjustment(NumBytes);
928928 }
929929
930930 if (( (!HasFP && NumBytes) || PushedRegs) && needsFrameMoves) {
10501050 StackPtr).addReg(BasePtr);
10511051
10521052 // When restoring from the BP we must use a cached SP adjustment.
1053 NumBytes = MFI->getBasePtrStackAdjustment();
1053 NumBytes = X86FI->getBasePtrStackAdjustment();
10541054 }
10551055
10561056 // If dynamic alloca is used, then reset esp to point to the last callee-saved
6868 /// NumLocalDynamics - Number of local-dynamic TLS accesses.
6969 unsigned NumLocalDynamics;
7070
71 /// After the stack pointer has been restore from the base pointer we
72 /// use a cached adjusment.
73 int64_t BPAdj;
74
7175 public:
7276 X86MachineFunctionInfo() : ForceFramePointer(false),
7377 CalleeSavedFrameSize(0),
96100 VarArgsGPOffset(0),
97101 VarArgsFPOffset(0),
98102 ArgumentStackSize(0),
99 NumLocalDynamics(0) {}
100
103 NumLocalDynamics(0),
104 BPAdj(0) {}
105
101106 bool getForceFramePointer() const { return ForceFramePointer;}
102107 void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; }
103108
136141
137142 unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }
138143 void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }
144
145 /// setBasePtrStackAdjustment - If we're restoring the stack pointer from the
146 /// base pointer, due to dynamic stack realignment + VLAs, we cache the
147 /// number of bytes initially allocated for the stack frame. In obscure
148 /// cases (e.g., tail calls with byval argument and no stack protector), the
149 /// stack gets adjusted outside of the prolog, but these shouldn't be
150 /// considered when restoring from the base pointer. Currently, this is only
151 /// needed for x86.
152 void setBasePtrStackAdjustment(int64_t adj) { BPAdj = adj; }
153 int64_t getBasePtrStackAdjustment() const { return BPAdj; }
139154 };
140155
141156 } // End llvm namespace