summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-09 07:45:08 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-09 07:45:08 +0000
commit6765834754cbb3cb0f15b4b15e98c5e73fa50066 (patch)
treed2d827f8d5acfde264a1b8f883884e8297879c5f /lib/VMCore
parent50cf36351cefbc64bca9b82b4a3897394feecac7 (diff)
downloadllvm-6765834754cbb3cb0f15b4b15e98c5e73fa50066.tar.gz
llvm-6765834754cbb3cb0f15b4b15e98c5e73fa50066.tar.bz2
llvm-6765834754cbb3cb0f15b4b15e98c5e73fa50066.tar.xz
Create enums for the different attributes.
We use the enums to query whether an Attributes object has that attribute. The opaque layer is responsible for knowing where that specific attribute is stored. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Attributes.cpp180
-rw-r--r--lib/VMCore/Function.cpp15
-rw-r--r--lib/VMCore/Instructions.cpp122
-rw-r--r--lib/VMCore/Verifier.cpp4
4 files changed, 143 insertions, 178 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index 6f5eefae0d..4024410b42 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -68,91 +68,14 @@ Attributes Attributes::get(LLVMContext &Context, Attributes::Builder &B) {
bool Attributes::hasAttributes(const Attributes &A) const {
return Attrs.hasAttributes(A);
}
-bool Attributes::hasAddressSafetyAttr() const {
- return Attrs.hasAttribute(Attribute::AddressSafety_i);
-}
-bool Attributes::hasAlignmentAttr() const {
- return Attrs.hasAttribute(Attribute::Alignment_i);
-}
-bool Attributes::hasAlwaysInlineAttr() const {
- return Attrs.hasAttribute(Attribute::AlwaysInline_i);
-}
-bool Attributes::hasByValAttr() const {
- return Attrs.hasAttribute(Attribute::ByVal_i);
-}
-bool Attributes::hasInlineHintAttr() const {
- return Attrs.hasAttribute(Attribute::InlineHint_i);
-}
-bool Attributes::hasInRegAttr() const {
- return Attrs.hasAttribute(Attribute::InReg_i);
-}
-bool Attributes::hasNakedAttr() const {
- return Attrs.hasAttribute(Attribute::Naked_i);
-}
-bool Attributes::hasNestAttr() const {
- return Attrs.hasAttribute(Attribute::Nest_i);
-}
-bool Attributes::hasNoAliasAttr() const {
- return Attrs.hasAttribute(Attribute::NoAlias_i);
-}
-bool Attributes::hasNoCaptureAttr() const {
- return Attrs.hasAttribute(Attribute::NoCapture_i);
-}
-bool Attributes::hasNoImplicitFloatAttr() const {
- return Attrs.hasAttribute(Attribute::NoImplicitFloat_i);
-}
-bool Attributes::hasNoInlineAttr() const {
- return Attrs.hasAttribute(Attribute::NoInline_i);
-}
-bool Attributes::hasNonLazyBindAttr() const {
- return Attrs.hasAttribute(Attribute::NonLazyBind_i);
-}
-bool Attributes::hasNoRedZoneAttr() const {
- return Attrs.hasAttribute(Attribute::NoRedZone_i);
-}
-bool Attributes::hasNoReturnAttr() const {
- return Attrs.hasAttribute(Attribute::NoReturn_i);
-}
-bool Attributes::hasNoUnwindAttr() const {
- return Attrs.hasAttribute(Attribute::NoUnwind_i);
-}
-bool Attributes::hasOptimizeForSizeAttr() const {
- return Attrs.hasAttribute(Attribute::OptimizeForSize_i);
-}
-bool Attributes::hasReadNoneAttr() const {
- return Attrs.hasAttribute(Attribute::ReadNone_i);
-}
-bool Attributes::hasReadOnlyAttr() const {
- return Attrs.hasAttribute(Attribute::ReadOnly_i);
-}
-bool Attributes::hasReturnsTwiceAttr() const {
- return Attrs.hasAttribute(Attribute::ReturnsTwice_i);
-}
-bool Attributes::hasSExtAttr() const {
- return Attrs.hasAttribute(Attribute::SExt_i);
-}
-bool Attributes::hasStackAlignmentAttr() const {
- return Attrs.hasAttribute(Attribute::StackAlignment_i);
-}
-bool Attributes::hasStackProtectAttr() const {
- return Attrs.hasAttribute(Attribute::StackProtect_i);
-}
-bool Attributes::hasStackProtectReqAttr() const {
- return Attrs.hasAttribute(Attribute::StackProtectReq_i);
-}
-bool Attributes::hasStructRetAttr() const {
- return Attrs.hasAttribute(Attribute::StructRet_i);
-}
-bool Attributes::hasUWTableAttr() const {
- return Attrs.hasAttribute(Attribute::UWTable_i);
-}
-bool Attributes::hasZExtAttr() const {
- return Attrs.hasAttribute(Attribute::ZExt_i);
+
+bool Attributes::hasAttribute(AttrVal Val) const {
+ return Attrs.hasAttribute(Val);
}
/// This returns the alignment field of an attribute as a byte alignment value.
unsigned Attributes::getAlignment() const {
- if (!hasAlignmentAttr())
+ if (!hasAttribute(Attributes::Alignment))
return 0;
return 1U << ((Attrs.getAlignment() >> 16) - 1);
}
@@ -160,7 +83,7 @@ unsigned Attributes::getAlignment() const {
/// This returns the stack alignment field of an attribute as a byte alignment
/// value.
unsigned Attributes::getStackAlignment() const {
- if (!hasStackAlignmentAttr())
+ if (!hasAttribute(Attributes::StackAlignment))
return 0;
return 1U << ((Attrs.getStackAlignment() >> 26) - 1);
}
@@ -217,62 +140,62 @@ Attributes Attributes::typeIncompatible(Type *Ty) {
std::string Attributes::getAsString() const {
std::string Result;
- if (hasZExtAttr())
+ if (hasAttribute(Attributes::ZExt))
Result += "zeroext ";
- if (hasSExtAttr())
+ if (hasAttribute(Attributes::SExt))
Result += "signext ";
- if (hasNoReturnAttr())
+ if (hasAttribute(Attributes::NoReturn))
Result += "noreturn ";
- if (hasNoUnwindAttr())
+ if (hasAttribute(Attributes::NoUnwind))
Result += "nounwind ";
- if (hasUWTableAttr())
+ if (hasAttribute(Attributes::UWTable))
Result += "uwtable ";
- if (hasReturnsTwiceAttr())
+ if (hasAttribute(Attributes::ReturnsTwice))
Result += "returns_twice ";
- if (hasInRegAttr())
+ if (hasAttribute(Attributes::InReg))
Result += "inreg ";
- if (hasNoAliasAttr())
+ if (hasAttribute(Attributes::NoAlias))
Result += "noalias ";
- if (hasNoCaptureAttr())
+ if (hasAttribute(Attributes::NoCapture))
Result += "nocapture ";
- if (hasStructRetAttr())
+ if (hasAttribute(Attributes::StructRet))
Result += "sret ";
- if (hasByValAttr())
+ if (hasAttribute(Attributes::ByVal))
Result += "byval ";
- if (hasNestAttr())
+ if (hasAttribute(Attributes::Nest))
Result += "nest ";
- if (hasReadNoneAttr())
+ if (hasAttribute(Attributes::ReadNone))
Result += "readnone ";
- if (hasReadOnlyAttr())
+ if (hasAttribute(Attributes::ReadOnly))
Result += "readonly ";
- if (hasOptimizeForSizeAttr())
+ if (hasAttribute(Attributes::OptimizeForSize))
Result += "optsize ";
- if (hasNoInlineAttr())
+ if (hasAttribute(Attributes::NoInline))
Result += "noinline ";
- if (hasInlineHintAttr())
+ if (hasAttribute(Attributes::InlineHint))
Result += "inlinehint ";
- if (hasAlwaysInlineAttr())
+ if (hasAttribute(Attributes::AlwaysInline))
Result += "alwaysinline ";
- if (hasStackProtectAttr())
+ if (hasAttribute(Attributes::StackProtect))
Result += "ssp ";
- if (hasStackProtectReqAttr())
+ if (hasAttribute(Attributes::StackProtectReq))
Result += "sspreq ";
- if (hasNoRedZoneAttr())
+ if (hasAttribute(Attributes::NoRedZone))
Result += "noredzone ";
- if (hasNoImplicitFloatAttr())
+ if (hasAttribute(Attributes::NoImplicitFloat))
Result += "noimplicitfloat ";
- if (hasNakedAttr())
+ if (hasAttribute(Attributes::Naked))
Result += "naked ";
- if (hasNonLazyBindAttr())
+ if (hasAttribute(Attributes::NonLazyBind))
Result += "nonlazybind ";
- if (hasAddressSafetyAttr())
+ if (hasAttribute(Attributes::AddressSafety))
Result += "address_safety ";
- if (hasStackAlignmentAttr()) {
+ if (hasAttribute(Attributes::StackAlignment)) {
Result += "alignstack(";
Result += utostr(getStackAlignment());
Result += ") ";
}
- if (hasAlignmentAttr()) {
+ if (hasAttribute(Attributes::Alignment)) {
Result += "align ";
Result += utostr(getAlignment());
Result += " ";
@@ -484,8 +407,42 @@ uint64_t Attributes::Builder::getAlignment() const {
// AttributeImpl Definition
//===----------------------------------------------------------------------===//
+uint64_t AttributesImpl::getAttrMask(uint64_t Val) const {
+ switch (Val) {
+ case Attributes::None: return 0;
+ case Attributes::ZExt: return 1 << 0;
+ case Attributes::SExt: return 1 << 1;
+ case Attributes::NoReturn: return 1 << 2;
+ case Attributes::InReg: return 1 << 3;
+ case Attributes::StructRet: return 1 << 4;
+ case Attributes::NoUnwind: return 1 << 5;
+ case Attributes::NoAlias: return 1 << 6;
+ case Attributes::ByVal: return 1 << 7;
+ case Attributes::Nest: return 1 << 8;
+ case Attributes::ReadNone: return 1 << 9;
+ case Attributes::ReadOnly: return 1 << 10;
+ case Attributes::NoInline: return 1 << 11;
+ case Attributes::AlwaysInline: return 1 << 12;
+ case Attributes::OptimizeForSize: return 1 << 13;
+ case Attributes::StackProtect: return 1 << 14;
+ case Attributes::StackProtectReq: return 1 << 15;
+ case Attributes::Alignment: return 31 << 16;
+ case Attributes::NoCapture: return 1 << 21;
+ case Attributes::NoRedZone: return 1 << 22;
+ case Attributes::NoImplicitFloat: return 1 << 23;
+ case Attributes::Naked: return 1 << 24;
+ case Attributes::InlineHint: return 1 << 25;
+ case Attributes::StackAlignment: return 7 << 26;
+ case Attributes::ReturnsTwice: return 1 << 29;
+ case Attributes::UWTable: return 1 << 30;
+ case Attributes::NonLazyBind: return 1U << 31;
+ case Attributes::AddressSafety: return 1ULL << 32;
+ }
+ llvm_unreachable("Unsupported attribute type");
+}
+
bool AttributesImpl::hasAttribute(uint64_t A) const {
- return (Bits & A) != 0;
+ return (Bits & getAttrMask(A)) != 0;
}
bool AttributesImpl::hasAttributes() const {
@@ -724,7 +681,8 @@ AttrListPtr AttrListPtr::removeAttr(unsigned Idx, Attributes Attrs) const {
#ifndef NDEBUG
// FIXME it is not obvious how this should work for alignment.
// For now, say we can't pass in alignment, which no current use does.
- assert(!Attrs.hasAlignmentAttr() && "Attempt to exclude alignment!");
+ assert(!Attrs.hasAttribute(Attributes::Alignment) &&
+ "Attempt to exclude alignment!");
#endif
if (AttrList == 0) return AttrListPtr();
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index 012d27603a..5c2a03ce09 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -78,7 +78,8 @@ unsigned Argument::getArgNo() const {
/// in its containing function.
bool Argument::hasByValAttr() const {
if (!getType()->isPointerTy()) return false;
- return getParent()->getParamAttributes(getArgNo()+1).hasByValAttr();
+ return getParent()->getParamAttributes(getArgNo()+1).
+ hasAttribute(Attributes::ByVal);
}
unsigned Argument::getParamAlignment() const {
@@ -91,21 +92,24 @@ unsigned Argument::getParamAlignment() const {
/// it in its containing function.
bool Argument::hasNestAttr() const {
if (!getType()->isPointerTy()) return false;
- return getParent()->getParamAttributes(getArgNo()+1).hasNestAttr();
+ return getParent()->getParamAttributes(getArgNo()+1).
+ hasAttribute(Attributes::Nest);
}
/// hasNoAliasAttr - Return true if this argument has the noalias attribute on
/// it in its containing function.
bool Argument::hasNoAliasAttr() const {
if (!getType()->isPointerTy()) return false;
- return getParent()->getParamAttributes(getArgNo()+1).hasNoAliasAttr();
+ return getParent()->getParamAttributes(getArgNo()+1).
+ hasAttribute(Attributes::NoAlias);
}
/// hasNoCaptureAttr - Return true if this argument has the nocapture attribute
/// on it in its containing function.
bool Argument::hasNoCaptureAttr() const {
if (!getType()->isPointerTy()) return false;
- return getParent()->getParamAttributes(getArgNo()+1).hasNoCaptureAttr();
+ return getParent()->getParamAttributes(getArgNo()+1).
+ hasAttribute(Attributes::NoCapture);
}
/// hasSRetAttr - Return true if this argument has the sret attribute on
@@ -114,7 +118,8 @@ bool Argument::hasStructRetAttr() const {
if (!getType()->isPointerTy()) return false;
if (this != getParent()->arg_begin())
return false; // StructRet param must be first param
- return getParent()->getParamAttributes(1).hasStructRetAttr();
+ return getParent()->getParamAttributes(1).
+ hasAttribute(Attributes::StructRet);
}
/// addAttr - Add a Attribute to an argument
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 8c3013b0bb..f7bb4b264e 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -343,116 +343,117 @@ void CallInst::removeAttribute(unsigned i, Attributes attr) {
}
bool CallInst::fnHasNoAliasAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasNoAliasAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoAlias))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasNoAliasAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::NoAlias);
return false;
}
bool CallInst::fnHasNoInlineAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasNoInlineAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoInline))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasNoInlineAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::NoInline);
return false;
}
bool CallInst::fnHasNoReturnAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasNoReturnAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoReturn))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasNoReturnAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::NoReturn);
return false;
}
bool CallInst::fnHasNoUnwindAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasNoUnwindAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasNoUnwindAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind);
return false;
}
bool CallInst::fnHasReadNoneAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasReadNoneAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadNone))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasReadNoneAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadNone);
return false;
}
bool CallInst::fnHasReadOnlyAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasReadOnlyAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasReadOnlyAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly);
return false;
}
bool CallInst::fnHasReturnsTwiceAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasReturnsTwiceAttr())
+ if (AttributeList.getParamAttributes(~0U).
+ hasAttribute(Attributes::ReturnsTwice))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasReturnsTwiceAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::ReturnsTwice);
return false;
}
bool CallInst::paramHasSExtAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasSExtAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::SExt))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasSExtAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::SExt);
return false;
}
bool CallInst::paramHasZExtAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasZExtAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ZExt))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasZExtAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::ZExt);
return false;
}
bool CallInst::paramHasInRegAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasInRegAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::InReg))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasInRegAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::InReg);
return false;
}
bool CallInst::paramHasStructRetAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasStructRetAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::StructRet))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasStructRetAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::StructRet);
return false;
}
bool CallInst::paramHasNestAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasNestAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::Nest))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasNestAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::Nest);
return false;
}
bool CallInst::paramHasByValAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasByValAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ByVal))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasByValAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::ByVal);
return false;
}
bool CallInst::paramHasNoAliasAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasNoAliasAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoAlias))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasNoAliasAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::NoAlias);
return false;
}
bool CallInst::paramHasNoCaptureAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasNoCaptureAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoCapture))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasNoCaptureAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::NoCapture);
return false;
}
@@ -669,116 +670,117 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
}
bool InvokeInst::fnHasNoAliasAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasNoAliasAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoAlias))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasNoAliasAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::NoAlias);
return false;
}
bool InvokeInst::fnHasNoInlineAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasNoInlineAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoInline))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasNoInlineAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::NoInline);
return false;
}
bool InvokeInst::fnHasNoReturnAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasNoReturnAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoReturn))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasNoReturnAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::NoReturn);
return false;
}
bool InvokeInst::fnHasNoUnwindAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasNoUnwindAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasNoUnwindAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind);
return false;
}
bool InvokeInst::fnHasReadNoneAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasReadNoneAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadNone))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasReadNoneAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadNone);
return false;
}
bool InvokeInst::fnHasReadOnlyAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasReadOnlyAttr())
+ if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasReadOnlyAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly);
return false;
}
bool InvokeInst::fnHasReturnsTwiceAttr() const {
- if (AttributeList.getParamAttributes(~0U).hasReturnsTwiceAttr())
+ if (AttributeList.getParamAttributes(~0U).
+ hasAttribute(Attributes::ReturnsTwice))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(~0U).hasReturnsTwiceAttr();
+ return F->getParamAttributes(~0U).hasAttribute(Attributes::ReturnsTwice);
return false;
}
bool InvokeInst::paramHasSExtAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasSExtAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::SExt))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasSExtAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::SExt);
return false;
}
bool InvokeInst::paramHasZExtAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasZExtAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ZExt))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasZExtAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::ZExt);
return false;
}
bool InvokeInst::paramHasInRegAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasInRegAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::InReg))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasInRegAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::InReg);
return false;
}
bool InvokeInst::paramHasStructRetAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasStructRetAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::StructRet))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasStructRetAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::StructRet);
return false;
}
bool InvokeInst::paramHasNestAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasNestAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::Nest))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasNestAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::Nest);
return false;
}
bool InvokeInst::paramHasByValAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasByValAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ByVal))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasByValAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::ByVal);
return false;
}
bool InvokeInst::paramHasNoAliasAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasNoAliasAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoAlias))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasNoAliasAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::NoAlias);
return false;
}
bool InvokeInst::paramHasNoCaptureAttr(unsigned i) const {
- if (AttributeList.getParamAttributes(i).hasNoCaptureAttr())
+ if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoCapture))
return true;
if (const Function *F = getCalledFunction())
- return F->getParamAttributes(i).hasNoCaptureAttr();
+ return F->getParamAttributes(i).hasAttribute(Attributes::NoCapture);
return false;
}
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 650125a08c..b459f7b956 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -585,12 +585,12 @@ void Verifier::VerifyFunctionAttrs(FunctionType *FT,
VerifyParameterAttrs(Attr.Attrs, Ty, Attr.Index == 0, V);
- if (Attr.Attrs.hasNestAttr()) {
+ if (Attr.Attrs.hasAttribute(Attributes::Nest)) {
Assert1(!SawNest, "More than one parameter has attribute nest!", V);
SawNest = true;
}
- if (Attr.Attrs.hasStructRetAttr())
+ if (Attr.Attrs.hasAttribute(Attributes::StructRet))
Assert1(Attr.Index == 1, "Attribute sret not on first parameter!", V);
}