diff options
| author | Dale Johannesen <dalej@apple.com> | 2008-02-22 17:49:45 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2008-02-22 17:49:45 +0000 |
| commit | eabc5f39af854fc78674f4851b23a3e5225a1de4 (patch) | |
| tree | 9cd1637966e0cc33aad0e5b42f575e7d7b51d344 /llvm/include | |
| parent | eac159c1f0890fc9ab014fec1531bf7d78e510a6 (diff) | |
| download | bcm5719-llvm-eabc5f39af854fc78674f4851b23a3e5225a1de4.tar.gz bcm5719-llvm-eabc5f39af854fc78674f4851b23a3e5225a1de4.zip | |
Pass alignment on ByVal parameters, from FE, all
the way through. It is now used for codegen.
llvm-svn: 47484
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/Function.h | 3 | ||||
| -rw-r--r-- | llvm/include/llvm/Instructions.h | 6 | ||||
| -rw-r--r-- | llvm/include/llvm/ParameterAttributes.h | 13 | ||||
| -rw-r--r-- | llvm/include/llvm/Support/CallSite.h | 3 | ||||
| -rw-r--r-- | llvm/include/llvm/Target/TargetLowering.h | 3 |
5 files changed, 27 insertions, 1 deletions
diff --git a/llvm/include/llvm/Function.h b/llvm/include/llvm/Function.h index e2b41fe25da..40b9c46de23 100644 --- a/llvm/include/llvm/Function.h +++ b/llvm/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/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h index b6d5de0f525..8321d6ff556 100644 --- a/llvm/include/llvm/Instructions.h +++ b/llvm/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/llvm/include/llvm/ParameterAttributes.h b/llvm/include/llvm/ParameterAttributes.h index c3a52fbac32..33cc95c95d5 100644 --- a/llvm/include/llvm/ParameterAttributes.h +++ b/llvm/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/llvm/include/llvm/Support/CallSite.h b/llvm/include/llvm/Support/CallSite.h index 401e5588db1..3bd4ef256c5 100644 --- a/llvm/include/llvm/Support/CallSite.h +++ b/llvm/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/llvm/include/llvm/Target/TargetLowering.h b/llvm/include/llvm/Target/TargetLowering.h index 4515b90b2ba..783c0f82d5c 100644 --- a/llvm/include/llvm/Target/TargetLowering.h +++ b/llvm/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> |

