summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-09-20 16:59:57 +0000
committerBill Wendling <isanbard@gmail.com>2012-09-20 16:59:57 +0000
commit4aa189909a194b4b858aefa0c186fa6504845bfd (patch)
treeb90e4e6e867110dbb787064518af32b70aa5c1d7 /include
parentf2e89e00b4c4ecfa5a092a479ccab1ed8677eede (diff)
downloadllvm-4aa189909a194b4b858aefa0c186fa6504845bfd.tar.gz
llvm-4aa189909a194b4b858aefa0c186fa6504845bfd.tar.bz2
llvm-4aa189909a194b4b858aefa0c186fa6504845bfd.tar.xz
Revert r164308 to fix buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Attributes.h40
1 files changed, 19 insertions, 21 deletions
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h
index 2a7e0dea4f..01b3be8cb6 100644
--- a/include/llvm/Attributes.h
+++ b/include/llvm/Attributes.h
@@ -205,24 +205,6 @@ public:
return Bits & Attribute::StackAlignment_i;
}
- /// This returns the alignment field of an attribute as a byte alignment
- /// value.
- unsigned getAlignment() const {
- if (!hasAlignmentAttr())
- return 0;
-
- return 1U << ((getRawAlignment() >> 16) - 1);
- }
-
- /// This returns the stack alignment field of an attribute as a byte alignment
- /// value.
- unsigned getStackAlignment() const {
- if (!hasStackAlignmentAttr())
- return 0;
-
- return 1U << ((getRawStackAlignment() >> 26) - 1);
- }
-
// This is a "safe bool() operator".
operator const void *() const { return Bits ? this : 0; }
bool isEmptyOrSingleton() const { return (Bits & (Bits - 1)) == 0; }
@@ -230,9 +212,8 @@ public:
return Bits == Attrs.Bits;
}
bool operator != (const Attributes &Attrs) const {
- return !(this == Attrs);
+ return Bits != Attrs.Bits;
}
-
Attributes operator | (const Attributes &Attrs) const {
return Attributes(Bits | Attrs.Bits);
}
@@ -313,6 +294,14 @@ inline Attributes constructAlignmentFromInt(unsigned i) {
return Attributes((Log2_32(i)+1) << 16);
}
+/// This returns the alignment field of an attribute as a byte alignment value.
+inline unsigned getAlignmentFromAttrs(Attributes A) {
+ if (!A.hasAlignmentAttr())
+ return 0;
+
+ return 1U << ((A.getRawAlignment() >> 16) - 1);
+}
+
/// This turns an int stack alignment (which must be a power of 2) into
/// the form used internally in Attributes.
inline Attributes constructStackAlignmentFromInt(unsigned i) {
@@ -325,6 +314,15 @@ inline Attributes constructStackAlignmentFromInt(unsigned i) {
return Attributes((Log2_32(i)+1) << 26);
}
+/// This returns the stack alignment field of an attribute as a byte alignment
+/// value.
+inline unsigned getStackAlignmentFromAttrs(Attributes A) {
+ if (!A.hasStackAlignmentAttr())
+ return 0;
+
+ return 1U << ((A.getRawStackAlignment() >> 26) - 1);
+}
+
/// This returns an integer containing an encoding of all the
/// LLVM attributes found in the given attribute bitset. Any
/// change to this encoding is a breaking change to bitcode
@@ -452,7 +450,7 @@ public:
/// getParamAlignment - Return the alignment for the specified function
/// parameter.
unsigned getParamAlignment(unsigned Idx) const {
- return getAttributes(Idx).getAlignment();
+ return Attribute::getAlignmentFromAttrs(getAttributes(Idx));
}
/// hasAttrSomewhere - Return true if the specified attribute is set for at