diff options
author | Manman Ren <mren@apple.com> | 2013-01-10 01:10:10 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2013-01-10 01:10:10 +0000 |
commit | 86441169da23959c81d8648c3dfdc7a0bb8d2225 (patch) | |
tree | 83dec40a840a61665f75b6052878d06e66bb8709 /include/llvm/CodeGen/MachineFrameInfo.h | |
parent | 7932c41884f182ae44a3feacc8a6a462e9097ca1 (diff) |
Stack Alignment: throw error if we can't satisfy the minimal alignment
requirement when creating stack objects in MachineFrameInfo.
Add CreateStackObjectWithMinAlign to throw error when the minimal alignment
can't be achieved and to clamp the alignment when the preferred alignment
can't be achieved. Same is true for CreateVariableSizedObject.
Will not emit error in CreateSpillStackObject or CreateStackObject.
As long as callers of CreateStackObject do not assume the object will be
aligned at the requested alignment, we should not have miscompile since
later optimizations which look at the object's alignment will have the correct
information.
rdar://12713765
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineFrameInfo.h')
-rw-r--r-- | include/llvm/CodeGen/MachineFrameInfo.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h index 93d77287d7..0748b9ab24 100644 --- a/include/llvm/CodeGen/MachineFrameInfo.h +++ b/include/llvm/CodeGen/MachineFrameInfo.h @@ -493,11 +493,23 @@ public: return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL; } + /// CreateStackObjectWithMinAlign - Create a new statically sized stack + /// object, returning a nonnegative identifier to represent it. This function + /// takes a preferred alignment and a minimal alignment. + /// + int CreateStackObjectWithMinAlign(uint64_t Size, unsigned PrefAlignment, + unsigned MinAlignment, bool isSS, + bool MayNeedSP = false, const AllocaInst *Alloca = 0); + /// CreateStackObject - Create a new statically sized stack object, returning - /// a nonnegative identifier to represent it. + /// a nonnegative identifier to represent it. Will not emit an error when + /// Alignment can't be satisfied. /// int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS, - bool MayNeedSP = false, const AllocaInst *Alloca = 0); + bool MayNeedSP = false, const AllocaInst *Alloca = 0) { + return CreateStackObjectWithMinAlign(Size, Alignment, 0, isSS, + MayNeedSP, Alloca); + } /// CreateSpillStackObject - Create a new statically sized stack object that /// represents a spill slot, returning a nonnegative identifier to represent @@ -517,7 +529,8 @@ public: /// variable sized object is created, whether or not the index returned is /// actually used. /// - int CreateVariableSizedObject(unsigned Alignment); + int CreateVariableSizedObject(unsigned PrefAlignment, unsigned MinAlignment, + const AllocaInst *Alloca = 0); /// getCalleeSavedInfo - Returns a reference to call saved info vector for the /// current function. |