diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/IR/Argument.h | 5 | ||||
-rw-r--r-- | include/llvm/IR/Instructions.h | 16 |
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); |