summaryrefslogtreecommitdiff
path: root/lib/VMCore/Attributes.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-09 20:56:48 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-09 20:56:48 +0000
commit9ef99c96da5882f18daa67132f511a32cc26f2d8 (patch)
tree5e9adcc007cb9b6e05eb2dfcc202fe1fb742047b /lib/VMCore/Attributes.cpp
parentf8db977b68aabb0f1818badb68914b29cc66d460 (diff)
downloadllvm-9ef99c96da5882f18daa67132f511a32cc26f2d8.tar.gz
llvm-9ef99c96da5882f18daa67132f511a32cc26f2d8.tar.bz2
llvm-9ef99c96da5882f18daa67132f511a32cc26f2d8.tar.xz
Revert r165547 to fix build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165548 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Attributes.cpp')
-rw-r--r--lib/VMCore/Attributes.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index c176fed584..88f20e94a5 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -75,13 +75,17 @@ bool Attributes::hasAttributes(const Attributes &A) const {
/// This returns the alignment field of an attribute as a byte alignment value.
unsigned Attributes::getAlignment() const {
- return Attrs.getAlignment();
+ if (!hasAttribute(Attributes::Alignment))
+ return 0;
+ return 1U << ((Attrs.getAlignment() >> 16) - 1);
}
/// This returns the stack alignment field of an attribute as a byte alignment
/// value.
unsigned Attributes::getStackAlignment() const {
- return Attrs.getStackAlignment();
+ if (!hasAttribute(Attributes::StackAlignment))
+ return 0;
+ return 1U << ((Attrs.getStackAlignment() >> 26) - 1);
}
bool Attributes::isEmptyOrSingleton() const {
@@ -245,6 +249,8 @@ bool Attributes::Builder::hasAlignmentAttr() const {
}
uint64_t Attributes::Builder::getAlignment() const {
+ if (!hasAlignmentAttr())
+ return 0;
return 1U <<
(((Bits & AttributesImpl::getAttrMask(Attributes::Alignment)) >> 16) - 1);
}
@@ -300,11 +306,11 @@ bool AttributesImpl::hasAttributes(const Attributes &A) const {
}
uint64_t AttributesImpl::getAlignment() const {
- return 1U << (((Bits & getAttrMask(Attributes::Alignment)) >> 16) - 1);
+ return Bits & getAttrMask(Attributes::Alignment);
}
uint64_t AttributesImpl::getStackAlignment() const {
- return 1U << (((Bits & getAttrMask(Attributes::StackAlignment)) >> 26) - 1);
+ return Bits & getAttrMask(Attributes::StackAlignment);
}
bool AttributesImpl::isEmptyOrSingleton() const {