summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-01-17 23:58:17 +0000
committerReid Kleckner <reid@kleckner.net>2014-01-17 23:58:17 +0000
commit3cbfa1617f0d935d68bf519afb5720df066849c2 (patch)
treebbd9321083451c055f56f050fe08c56d5a35d9f6 /include
parent01d9f5972a0d7b0d88f815e6f7424f5f7b5bdb04 (diff)
downloadllvm-3cbfa1617f0d935d68bf519afb5720df066849c2.tar.gz
llvm-3cbfa1617f0d935d68bf519afb5720df066849c2.tar.bz2
llvm-3cbfa1617f0d935d68bf519afb5720df066849c2.tar.xz
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
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/Argument.h5
-rw-r--r--include/llvm/IR/Instructions.h16
2 files changed, 20 insertions, 1 deletions
diff --git a/include/llvm/IR/Argument.h b/include/llvm/IR/Argument.h
index 9ba51bc213..7c1ebf6dff 100644
--- a/include/llvm/IR/Argument.h
+++ b/include/llvm/IR/Argument.h
@@ -59,6 +59,11 @@ public:
/// containing function.
bool hasByValAttr() const;
+ /// \brief Return true if this argument has the byval attribute or inalloca
+ /// attribute on it in its containing function. These attributes both
+ /// represent arguments being passed by value.
+ bool hasByValOrInAllocaAttr() const;
+
/// \brief If this is a byval or inalloca argument, return its alignment.
unsigned getParamAlignment() const;
diff --git a/include/llvm/IR/Instructions.h b/include/llvm/IR/Instructions.h
index 0843d8fca3..eeea9945e8 100644
--- a/include/llvm/IR/Instructions.h
+++ b/include/llvm/IR/Instructions.h
@@ -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);