diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-09 07:45:08 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-09 07:45:08 +0000 |
commit | 6765834754cbb3cb0f15b4b15e98c5e73fa50066 (patch) | |
tree | d2d827f8d5acfde264a1b8f883884e8297879c5f /lib/VMCore/Instructions.cpp | |
parent | 50cf36351cefbc64bca9b82b4a3897394feecac7 (diff) | |
download | external_llvm-6765834754cbb3cb0f15b4b15e98c5e73fa50066.tar.gz external_llvm-6765834754cbb3cb0f15b4b15e98c5e73fa50066.tar.bz2 external_llvm-6765834754cbb3cb0f15b4b15e98c5e73fa50066.zip |
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/Instructions.cpp')
-rw-r--r-- | lib/VMCore/Instructions.cpp | 122 |
1 files changed, 62 insertions, 60 deletions
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; } |