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 | 08e78b18b8ef2c939ee95469662c98e23846d860 (patch) | |
tree | ef1a7297738a17ceda59046eaf2b1a9f15222760 /include/llvm/ParameterAttributes.h | |
parent | 3edd6dcf82c45d1b2644c6dac7deb3d9844ece6b (diff) | |
download | external_llvm-08e78b18b8ef2c939ee95469662c98e23846d860.zip external_llvm-08e78b18b8ef2c939ee95469662c98e23846d860.tar.gz external_llvm-08e78b18b8ef2c939ee95469662c98e23846d860.tar.bz2 |
Pass alignment on ByVal parameters, from FE, all
the way through. It is now used for codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47484 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ParameterAttributes.h')
-rw-r--r-- | include/llvm/ParameterAttributes.h | 13 |
1 files changed, 13 insertions, 0 deletions
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. |