diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2020-03-17 18:27:59 +0100 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2020-03-18 09:02:48 +0100 |
commit | c3df69faa03404ad912f4f613edc19c067ab91f6 (patch) | |
tree | b652710cd72550acc0c84f5a3e83a557dd5cd0b1 /llvm/lib/CodeGen/MachineFrameInfo.cpp | |
parent | 974d649f8eaf3026ccb9d1b77bdec55da25366e5 (diff) | |
download | llvm-c3df69faa03404ad912f4f613edc19c067ab91f6.zip llvm-c3df69faa03404ad912f4f613edc19c067ab91f6.tar.gz llvm-c3df69faa03404ad912f4f613edc19c067ab91f6.tar.bz2 |
[Alignment][NFC] Deprecate getTransientStackAlignment
Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: jholewinski, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76301
Diffstat (limited to 'llvm/lib/CodeGen/MachineFrameInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineFrameInfo.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/MachineFrameInfo.cpp b/llvm/lib/CodeGen/MachineFrameInfo.cpp index e5f35ae..7690505 100644 --- a/llvm/lib/CodeGen/MachineFrameInfo.cpp +++ b/llvm/lib/CodeGen/MachineFrameInfo.cpp @@ -136,7 +136,7 @@ BitVector MachineFrameInfo::getPristineRegs(const MachineFunction &MF) const { uint64_t MachineFrameInfo::estimateStackSize(const MachineFunction &MF) const { const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering(); const TargetRegisterInfo *RegInfo = MF.getSubtarget().getRegisterInfo(); - unsigned MaxAlign = getMaxAlignment(); + Align MaxAlign = getMaxAlign(); int64_t Offset = 0; // This code is very, very similar to PEI::calculateFrameObjectOffsets(). @@ -155,11 +155,11 @@ uint64_t MachineFrameInfo::estimateStackSize(const MachineFunction &MF) const { if (isDeadObjectIndex(i) || getStackID(i) != TargetStackID::Default) continue; Offset += getObjectSize(i); - unsigned Align = getObjectAlignment(i); + Align Alignment = getObjectAlign(i); // Adjust to alignment boundary - Offset = (Offset+Align-1)/Align*Align; + Offset = alignTo(Offset, Alignment); - MaxAlign = std::max(Align, MaxAlign); + MaxAlign = std::max(Alignment, MaxAlign); } if (adjustsStack() && TFI->hasReservedCallFrame(MF)) @@ -170,20 +170,17 @@ uint64_t MachineFrameInfo::estimateStackSize(const MachineFunction &MF) const { // 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 (adjustsStack() || hasVarSizedObjects() || (RegInfo->needsStackRealignment(MF) && 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. StackAlign = std::max(StackAlign, MaxAlign); - unsigned AlignMask = StackAlign - 1; - Offset = (Offset + AlignMask) & ~uint64_t(AlignMask); - - return (uint64_t)Offset; + return alignTo(Offset, StackAlign); } void MachineFrameInfo::computeMaxCallFrameSize(const MachineFunction &MF) { |