diff options
author | Sander de Smalen <sander.desmalen@arm.com> | 2019-04-02 09:46:52 +0000 |
---|---|---|
committer | Sander de Smalen <sander.desmalen@arm.com> | 2019-04-02 09:46:52 +0000 |
commit | 7f23e0a62fc95791af72d591d39f71b28642cc41 (patch) | |
tree | 69f763dc284c43c863f99c9e0396bbeb94729de1 /llvm/lib/CodeGen/MachineFrameInfo.cpp | |
parent | c5cefa2caf79af2f40555754cbb6ff6756053b12 (diff) | |
download | llvm-7f23e0a62fc95791af72d591d39f71b28642cc41.zip llvm-7f23e0a62fc95791af72d591d39f71b28642cc41.tar.gz llvm-7f23e0a62fc95791af72d591d39f71b28642cc41.tar.bz2 |
Enforce StackID definition in PEI
There are various places in LLVM where the definition of StackID is not
properly honoured, for example in PEI where objects with a StackID > 0 are
allocated on the default stack (StackID0). This patch enforces that PEI
only considers allocating objects to StackID 0.
Reviewers: arsenm, thegameg, MatzeB
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D60062
llvm-svn: 357460
Diffstat (limited to 'llvm/lib/CodeGen/MachineFrameInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineFrameInfo.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineFrameInfo.cpp b/llvm/lib/CodeGen/MachineFrameInfo.cpp index d75ba83..e8a3dda8 100644 --- a/llvm/lib/CodeGen/MachineFrameInfo.cpp +++ b/llvm/lib/CodeGen/MachineFrameInfo.cpp @@ -56,7 +56,8 @@ int MachineFrameInfo::CreateStackObject(uint64_t Size, unsigned Alignment, !IsSpillSlot, StackID)); int Index = (int)Objects.size() - NumFixedObjects - 1; assert(Index >= 0 && "Bad frame index!"); - ensureMaxAlignment(Alignment); + if (StackID == 0) + ensureMaxAlignment(Alignment); return Index; } @@ -141,11 +142,15 @@ unsigned MachineFrameInfo::estimateStackSize(const MachineFunction &MF) const { // should keep in mind that there's tight coupling between the two. for (int i = getObjectIndexBegin(); i != 0; ++i) { + // Only estimate stack size of default stack. + if (getStackID(i)) + continue; int FixedOff = -getObjectOffset(i); if (FixedOff > Offset) Offset = FixedOff; } for (unsigned i = 0, e = getObjectIndexEnd(); i != e; ++i) { - if (isDeadObjectIndex(i)) + // Only estimate stack size of live objects on default stack. + if (isDeadObjectIndex(i) || getStackID(i)) continue; Offset += getObjectSize(i); unsigned Align = getObjectAlignment(i); |