diff options
author | Jim Grosbach <grosbach@apple.com> | 2009-12-02 19:30:24 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2009-12-02 19:30:24 +0000 |
commit | e27d205d5d4d53cceabcd6325533fbdf9c0cee42 (patch) | |
tree | 6f77d51524cdef8f6680c61252b6b8abaadef51e /include/llvm/CodeGen/MachineFrameInfo.h | |
parent | f1e01dcc94fde6b1e184dc799df7145aed34a18b (diff) |
Factor the stack alignment calculations out into a target independent pass.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90336 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineFrameInfo.h')
-rw-r--r-- | include/llvm/CodeGen/MachineFrameInfo.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h index bed82af81c..968e4eae3a 100644 --- a/include/llvm/CodeGen/MachineFrameInfo.h +++ b/include/llvm/CodeGen/MachineFrameInfo.h @@ -327,7 +327,20 @@ public: /// setMaxAlignment - Set the preferred alignment. /// void setMaxAlignment(unsigned Align) { MaxAlignment = Align; } - + + /// calculateMaxStackAlignment() - If there is a local object which requires + /// greater alignment than the current max alignment, adjust accordingly. + void calculateMaxStackAlignment() { + for (int i = getObjectIndexBegin(), + e = getObjectIndexEnd(); i != e; ++i) { + if (isDeadObjectIndex(i)) + continue; + + unsigned Align = getObjectAlignment(i); + MaxAlignment = std::max(MaxAlignment, Align); + } + } + /// hasCalls - Return true if the current function has no function calls. /// This is only valid during or after prolog/epilog code emission. /// |