diff options
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Function.h | 3 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 6 | ||||
-rw-r--r-- | include/llvm/ParameterAttributes.h | 13 | ||||
-rw-r--r-- | include/llvm/Support/CallSite.h | 3 | ||||
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 3 |
5 files changed, 27 insertions, 1 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h index e2b41fe..40b9c46 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -166,6 +166,9 @@ public: /// @brief Determine whether the function has the given attribute. bool paramHasAttr(uint16_t i, ParameterAttributes attr) const; + /// @brief Extract the alignment for a call or parameter (0=unknown). + uint16_t getParamAlignment(uint16_t i) const; + /// @brief Determine if the function cannot return. bool doesNotReturn() const; diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index b6d5de0..8321d6f 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -941,6 +941,9 @@ public: /// @brief Determine whether the call or the callee has the given attribute. bool paramHasAttr(uint16_t i, unsigned attr) const; + /// @brief Extract the alignment for a call or parameter (0=unknown). + uint16_t getParamAlignment(uint16_t i) const; + /// @brief Determine if the call does not access memory. bool doesNotAccessMemory() const; @@ -1738,6 +1741,9 @@ public: /// @brief Determine whether the call or the callee has the given attribute. bool paramHasAttr(uint16_t i, ParameterAttributes attr) const; + /// @brief Extract the alignment for a call or parameter (0=unknown). + uint16_t getParamAlignment(uint16_t i) const; + /// @brief Determine if the call does not access memory. bool doesNotAccessMemory() const; diff --git a/include/llvm/ParameterAttributes.h b/include/llvm/ParameterAttributes.h index c3a52fb..33cc95c 100644 --- a/include/llvm/ParameterAttributes.h +++ b/include/llvm/ParameterAttributes.h @@ -69,6 +69,12 @@ const Attributes MutuallyIncompatible[3] = { /// @brief Which attributes cannot be applied to a type. Attributes typeIncompatible (const Type *Ty); +/// This turns an int alignment (a power of 2, normally) into the +/// form used internally in ParameterAttributes. +ParamAttr::Attributes inline constructAlignmentFromInt(uint32_t i) { + return (i << 16); +} + } // end namespace ParamAttr /// @brief A more friendly way to reference the attributes. @@ -176,6 +182,13 @@ class ParamAttrsList : public FoldingSetNode { bool paramHasAttr(uint16_t i, ParameterAttributes attr) const { return getParamAttrs(i) & attr; } + + /// This extracts the alignment for the \p ith function parameter. + /// @returns 0 if unknown, else the alignment in bytes + /// @brief Extract the Alignment + uint16_t getParamAlignment(uint16_t i) const { + return (getParamAttrs(i) & ParamAttr::Alignment) >> 16; + } /// This returns whether the given attribute is set for at least one /// parameter or for the return value. diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h index 401e558..3bd4ef2 100644 --- a/include/llvm/Support/CallSite.h +++ b/include/llvm/Support/CallSite.h @@ -68,6 +68,9 @@ public: /// paramHasAttr - whether the call or the callee has the given attribute. bool paramHasAttr(uint16_t i, ParameterAttributes attr) const; + /// @brief Extract the alignment for a call or parameter (0=unknown). + uint16_t getParamAlignment(uint16_t i) const; + /// @brief Determine if the call does not access memory. bool doesNotAccessMemory() const; diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 4515b90..783c0f82 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -918,9 +918,10 @@ public: bool isSRet; bool isNest; bool isByVal; + uint16_t Alignment; ArgListEntry() : isSExt(false), isZExt(false), isInReg(false), - isSRet(false), isNest(false), isByVal(false) { } + isSRet(false), isNest(false), isByVal(false), Alignment(0) { } }; typedef std::vector<ArgListEntry> ArgListTy; virtual std::pair<SDOperand, SDOperand> |