aboutsummaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-02-22 17:49:45 +0000
committerDale Johannesen <dalej@apple.com>2008-02-22 17:49:45 +0000
commit08e78b18b8ef2c939ee95469662c98e23846d860 (patch)
treeef1a7297738a17ceda59046eaf2b1a9f15222760 /include/llvm
parent3edd6dcf82c45d1b2644c6dac7deb3d9844ece6b (diff)
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')
-rw-r--r--include/llvm/Function.h3
-rw-r--r--include/llvm/Instructions.h6
-rw-r--r--include/llvm/ParameterAttributes.h13
-rw-r--r--include/llvm/Support/CallSite.h3
-rw-r--r--include/llvm/Target/TargetLowering.h3
5 files changed, 27 insertions, 1 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index e2b41fe25d..40b9c46de2 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 b6d5de0f52..8321d6ff55 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 c3a52fbac3..33cc95c95d 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 401e5588db..3bd4ef256c 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 4515b90b2b..783c0f82d5 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>