diff options
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/PrologEpilogInserter.cpp | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index 889d026..d4c63bb 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -635,22 +635,21 @@ void PEI::spillCalleeSavedRegs(MachineFunction &MF) { } /// AdjustStackOffset - Helper function used to adjust the stack frame offset. -static inline void -AdjustStackOffset(MachineFrameInfo &MFI, int FrameIdx, - bool StackGrowsDown, int64_t &Offset, - unsigned &MaxAlign, unsigned Skew) { +static inline void AdjustStackOffset(MachineFrameInfo &MFI, int FrameIdx, + bool StackGrowsDown, int64_t &Offset, + Align &MaxAlign, unsigned Skew) { // If the stack grows down, add the object size to find the lowest address. if (StackGrowsDown) Offset += MFI.getObjectSize(FrameIdx); - unsigned Align = MFI.getObjectAlignment(FrameIdx); + Align Alignment = MFI.getObjectAlign(FrameIdx); // If the alignment of this object is greater than that of the stack, then // increase the stack alignment to match. - MaxAlign = std::max(MaxAlign, Align); + MaxAlign = std::max(MaxAlign, Alignment); // Adjust to alignment boundary. - Offset = alignTo(Offset, Align, Skew); + Offset = alignTo(Offset, Alignment, Skew); if (StackGrowsDown) { LLVM_DEBUG(dbgs() << "alloc FI(" << FrameIdx << ") at SP[" << -Offset @@ -710,7 +709,7 @@ computeFreeStackSlots(MachineFrameInfo &MFI, bool StackGrowsDown, /// Assign frame object to an unused portion of the stack in the fixed stack /// object range. Return true if the allocation was successful. static inline bool scavengeStackSlot(MachineFrameInfo &MFI, int FrameIdx, - bool StackGrowsDown, unsigned MaxAlign, + bool StackGrowsDown, Align MaxAlign, BitVector &StackBytesFree) { if (MFI.isVariableSizedObjectIndex(FrameIdx)) return false; @@ -722,7 +721,7 @@ static inline bool scavengeStackSlot(MachineFrameInfo &MFI, int FrameIdx, return false; } - unsigned ObjAlign = MFI.getObjectAlignment(FrameIdx); + Align ObjAlign = MFI.getObjectAlign(FrameIdx); if (ObjAlign > MaxAlign) return false; @@ -769,11 +768,11 @@ static inline bool scavengeStackSlot(MachineFrameInfo &MFI, int FrameIdx, /// AssignProtectedObjSet - Helper function to assign large stack objects (i.e., /// those required to be close to the Stack Protector) to stack offsets. -static void -AssignProtectedObjSet(const StackObjSet &UnassignedObjs, - SmallSet<int, 16> &ProtectedObjs, - MachineFrameInfo &MFI, bool StackGrowsDown, - int64_t &Offset, unsigned &MaxAlign, unsigned Skew) { +static void AssignProtectedObjSet(const StackObjSet &UnassignedObjs, + SmallSet<int, 16> &ProtectedObjs, + MachineFrameInfo &MFI, bool StackGrowsDown, + int64_t &Offset, Align &MaxAlign, + unsigned Skew) { for (StackObjSet::const_iterator I = UnassignedObjs.begin(), E = UnassignedObjs.end(); I != E; ++I) { @@ -850,9 +849,8 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &MF) { // address of the object. Offset += MFI.getObjectSize(i); - unsigned Align = MFI.getObjectAlignment(i); // Adjust to alignment boundary - Offset = alignTo(Offset, Align, Skew); + Offset = alignTo(Offset, MFI.getObjectAlign(i), Skew); LLVM_DEBUG(dbgs() << "alloc FI(" << i << ") at SP[" << -Offset << "]\n"); MFI.setObjectOffset(i, -Offset); // Set the computed offset @@ -867,9 +865,8 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &MF) { if (MFI.isDeadObjectIndex(i)) continue; - unsigned Align = MFI.getObjectAlignment(i); // Adjust to alignment boundary - Offset = alignTo(Offset, Align, Skew); + Offset = alignTo(Offset, MFI.getObjectAlign(i), Skew); LLVM_DEBUG(dbgs() << "alloc FI(" << i << ") at SP[" << Offset << "]\n"); MFI.setObjectOffset(i, Offset); @@ -880,7 +877,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &MF) { // FixedCSEnd is the stack offset to the end of the fixed and callee-save // stack area. int64_t FixedCSEnd = Offset; - unsigned MaxAlign = MFI.getMaxAlignment(); + Align MaxAlign = MFI.getMaxAlign(); // Make sure the special register scavenging spill slot is closest to the // incoming stack pointer if a frame pointer is required and is closer @@ -903,10 +900,10 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &MF) { // frame index registers. Functions which don't want/need this optimization // will continue to use the existing code path. if (MFI.getUseLocalStackAllocationBlock()) { - unsigned Align = MFI.getLocalFrameMaxAlign().value(); + Align Alignment = MFI.getLocalFrameMaxAlign(); // Adjust to alignment boundary. - Offset = alignTo(Offset, Align, Skew); + Offset = alignTo(Offset, Alignment, Skew); LLVM_DEBUG(dbgs() << "Local frame base offset: " << Offset << "\n"); @@ -921,7 +918,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &MF) { // Allocate the local block Offset += MFI.getLocalFrameSize(); - MaxAlign = std::max(Align, MaxAlign); + MaxAlign = std::max(Alignment, MaxAlign); } // Retrieve the Exception Handler registration node. @@ -1072,12 +1069,12 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &MF) { // ensure that the callee's frame or the alloca data is suitably aligned; // otherwise, for leaf functions, align to the TransientStackAlignment // value. - unsigned StackAlign; + Align StackAlign; if (MFI.adjustsStack() || MFI.hasVarSizedObjects() || (RegInfo->needsStackRealignment(MF) && MFI.getObjectIndexEnd() != 0)) - StackAlign = TFI.getStackAlignment(); + StackAlign = TFI.getStackAlign(); else - StackAlign = TFI.getTransientStackAlignment(); + StackAlign = TFI.getTransientStackAlign(); // If the frame pointer is eliminated, all frame offsets will be relative to // SP not FP. Align to MaxAlign so this works. |