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 | c9b22d735a921e335bc02aea0bd4695c5a3e52a9 (patch) | |
| tree | dbe50cfd0e6565cc868b4210a199c95a9fee5fb7 /llvm/lib/VMCore/Instructions.cpp | |
| parent | 3b95e4da76df2084315368dca15a31a99fd3150e (diff) | |
| download | bcm5719-llvm-c9b22d735a921e335bc02aea0bd4695c5a3e52a9.tar.gz bcm5719-llvm-c9b22d735a921e335bc02aea0bd4695c5a3e52a9.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.
llvm-svn: 165488
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
| -rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 122 |
1 files changed, 62 insertions, 60 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index 8c3013b0bbc..f7bb4b264ed 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/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; } |

