diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-09 21:38:14 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-09 21:38:14 +0000 |
commit | 3e2d76c946ba753c2b11af192a52e25b6f9b46ff (patch) | |
tree | 5486e6c9eeb14e5a5ac48625df20fb18182ba5eb /lib/VMCore/Instructions.cpp | |
parent | 9ef99c96da5882f18daa67132f511a32cc26f2d8 (diff) |
Use the attribute enums to query if a parameter has an attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r-- | lib/VMCore/Instructions.cpp | 124 |
1 files changed, 6 insertions, 118 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index f7bb4b264e..0a097b8be2 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -393,67 +393,11 @@ bool CallInst::fnHasReturnsTwiceAttr() const { return false; } -bool CallInst::paramHasSExtAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::SExt)) +bool CallInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const { + if (AttributeList.getParamAttributes(i).hasAttribute(A)) return true; if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::SExt); - return false; -} - -bool CallInst::paramHasZExtAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ZExt)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::ZExt); - return false; -} - -bool CallInst::paramHasInRegAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::InReg)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::InReg); - return false; -} - -bool CallInst::paramHasStructRetAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::StructRet)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::StructRet); - return false; -} - -bool CallInst::paramHasNestAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::Nest)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::Nest); - return false; -} - -bool CallInst::paramHasByValAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ByVal)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::ByVal); - return false; -} - -bool CallInst::paramHasNoAliasAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoAlias)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::NoAlias); - return false; -} - -bool CallInst::paramHasNoCaptureAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoCapture)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::NoCapture); + return F->getParamAttributes(i).hasAttribute(A); return false; } @@ -720,67 +664,11 @@ bool InvokeInst::fnHasReturnsTwiceAttr() const { return false; } -bool InvokeInst::paramHasSExtAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::SExt)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::SExt); - return false; -} - -bool InvokeInst::paramHasZExtAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ZExt)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::ZExt); - return false; -} - -bool InvokeInst::paramHasInRegAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::InReg)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::InReg); - return false; -} - -bool InvokeInst::paramHasStructRetAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::StructRet)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::StructRet); - return false; -} - -bool InvokeInst::paramHasNestAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::Nest)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::Nest); - return false; -} - -bool InvokeInst::paramHasByValAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::ByVal)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::ByVal); - return false; -} - -bool InvokeInst::paramHasNoAliasAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoAlias)) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::NoAlias); - return false; -} - -bool InvokeInst::paramHasNoCaptureAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasAttribute(Attributes::NoCapture)) +bool InvokeInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const { + if (AttributeList.getParamAttributes(i).hasAttribute(A)) return true; if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasAttribute(Attributes::NoCapture); + return F->getParamAttributes(i).hasAttribute(A); return false; } |