Add an inalloca flag to allocas

Summary:
The only current use of this flag is to mark the alloca as dynamic, even
if its in the entry block.  The stack adjustment for the alloca can
never be folded into the prologue because the call may clear it and it
has to be allocated at the top of the stack.

Reviewers: majnemer

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2571

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199525 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Kleckner
2014-01-17 23:58:17 +00:00
parent 01d9f5972a
commit 3cbfa1617f
10 changed files with 99 additions and 29 deletions

View File

@@ -101,7 +101,7 @@ public:
/// by the instruction.
///
unsigned getAlignment() const {
return (1u << getSubclassDataFromInstruction()) >> 1;
return (1u << (getSubclassDataFromInstruction() & 31)) >> 1;
}
void setAlignment(unsigned Align);
@@ -110,6 +110,20 @@ public:
/// into the prolog/epilog code, so it is basically free.
bool isStaticAlloca() const;
/// \brief Return true if this alloca is used as an inalloca argument to a
/// call. Such allocas are never considered static even if they are in the
/// entry block.
bool isUsedWithInAlloca() const {
return getSubclassDataFromInstruction() & 32;
}
/// \brief Specify whether this alloca is used to represent a the arguments to
/// a call.
void setUsedWithInAlloca(bool V) {
setInstructionSubclassData((getSubclassDataFromInstruction() & ~32) |
(V ? 32 : 0));
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Instruction *I) {
return (I->getOpcode() == Instruction::Alloca);