diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-09 21:49:51 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-09 21:49:51 +0000 |
commit | 2fa8af224ea026f9432e833fd6f42a216423a010 (patch) | |
tree | aa3b613bc1dae40772ada954b482dc88c3f5067b /lib/VMCore/Instructions.cpp | |
parent | 3e2d76c946ba753c2b11af192a52e25b6f9b46ff (diff) | |
download | llvm-2fa8af224ea026f9432e833fd6f42a216423a010.tar.gz llvm-2fa8af224ea026f9432e833fd6f42a216423a010.tar.bz2 llvm-2fa8af224ea026f9432e833fd6f42a216423a010.tar.xz |
Use the attribute enums to query if a function has an attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165551 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r-- | lib/VMCore/Instructions.cpp | 98 |
1 files changed, 6 insertions, 92 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 0a097b8be2..74c0c6e1d9 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -342,54 +342,11 @@ void CallInst::removeAttribute(unsigned i, Attributes attr) { setAttributes(PAL); } -bool CallInst::fnHasNoAliasAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoAlias)) +bool CallInst::hasFnAttr(Attributes::AttrVal A) const { + if (AttributeList.getParamAttributes(~0U).hasAttribute(A)) return true; if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::NoAlias); - return false; -} -bool CallInst::fnHasNoInlineAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoInline)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::NoInline); - return false; -} -bool CallInst::fnHasNoReturnAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoReturn)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::NoReturn); - return false; -} -bool CallInst::fnHasNoUnwindAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind); - return false; -} -bool CallInst::fnHasReadNoneAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadNone)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadNone); - return false; -} -bool CallInst::fnHasReadOnlyAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly); - return false; -} -bool CallInst::fnHasReturnsTwiceAttr() const { - if (AttributeList.getParamAttributes(~0U). - hasAttribute(Attributes::ReturnsTwice)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::ReturnsTwice); + return F->getParamAttributes(~0U).hasAttribute(A); return false; } @@ -613,54 +570,11 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) { return setSuccessor(idx, B); } -bool InvokeInst::fnHasNoAliasAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoAlias)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::NoAlias); - return false; -} -bool InvokeInst::fnHasNoInlineAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoInline)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::NoInline); - return false; -} -bool InvokeInst::fnHasNoReturnAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoReturn)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::NoReturn); - return false; -} -bool InvokeInst::fnHasNoUnwindAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::NoUnwind); - return false; -} -bool InvokeInst::fnHasReadNoneAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadNone)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadNone); - return false; -} -bool InvokeInst::fnHasReadOnlyAttr() const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::ReadOnly); - return false; -} -bool InvokeInst::fnHasReturnsTwiceAttr() const { - if (AttributeList.getParamAttributes(~0U). - hasAttribute(Attributes::ReturnsTwice)) +bool InvokeInst::hasFnAttr(Attributes::AttrVal A) const { + if (AttributeList.getParamAttributes(~0U).hasAttribute(A)) return true; if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(Attributes::ReturnsTwice); + return F->getParamAttributes(~0U).hasAttribute(A); return false; } |