summaryrefslogtreecommitdiff
path: root/lib/VMCore/Attributes.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-10 07:36:45 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-10 07:36:45 +0000
commit7d2f2496c1d263eecdc104fd72e847a31d8695b9 (patch)
tree0856e94cc2c0479da200b426cf81c14abf96e650 /lib/VMCore/Attributes.cpp
parent8a8cf9617cdc735f0425e828bb7a6f401c0cf0f6 (diff)
downloadllvm-7d2f2496c1d263eecdc104fd72e847a31d8695b9.tar.gz
llvm-7d2f2496c1d263eecdc104fd72e847a31d8695b9.tar.bz2
llvm-7d2f2496c1d263eecdc104fd72e847a31d8695b9.tar.xz
Remove the final bits of Attributes being declared in the Attribute
namespace. Use the attribute's enum value instead. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165610 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Attributes.cpp')
-rw-r--r--lib/VMCore/Attributes.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index 88f20e94a5..90a7c7ea6a 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -238,6 +238,10 @@ void Attributes::Builder::removeAttributes(const Attributes &A) {
Bits &= ~A.Raw();
}
+bool Attributes::Builder::hasAttribute(Attributes::AttrVal A) const {
+ return Bits & AttributesImpl::getAttrMask(A);
+}
+
bool Attributes::Builder::hasAttributes() const {
return Bits != 0;
}
@@ -255,6 +259,13 @@ uint64_t Attributes::Builder::getAlignment() const {
(((Bits & AttributesImpl::getAttrMask(Attributes::Alignment)) >> 16) - 1);
}
+uint64_t Attributes::Builder::getStackAlignment() const {
+ if (!hasAlignmentAttr())
+ return 0;
+ return 1U <<
+ (((Bits & AttributesImpl::getAttrMask(Attributes::StackAlignment))>>26)-1);
+}
+
//===----------------------------------------------------------------------===//
// AttributeImpl Definition
//===----------------------------------------------------------------------===//
@@ -468,12 +479,12 @@ Attributes AttrListPtr::getAttributes(unsigned Idx) const {
/// hasAttrSomewhere - Return true if the specified attribute is set for at
/// least one parameter or for the return value.
-bool AttrListPtr::hasAttrSomewhere(Attributes Attr) const {
+bool AttrListPtr::hasAttrSomewhere(Attributes::AttrVal Attr) const {
if (AttrList == 0) return false;
-
+
const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs;
for (unsigned i = 0, e = Attrs.size(); i != e; ++i)
- if (Attrs[i].Attrs.hasAttributes(Attr))
+ if (Attrs[i].Attrs.hasAttribute(Attr))
return true;
return false;
}