summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-03 17:54:26 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-03 17:54:26 +0000
commit847d165459a8d4c30b57c896c7a7e2722f800f82 (patch)
treea29777fe7db5cc87e93294a8c885722c2c0be44b /lib/VMCore
parent565ebde5fea42789c7df8a49ce1e270d49d525a1 (diff)
downloadllvm-847d165459a8d4c30b57c896c7a7e2722f800f82.tar.gz
llvm-847d165459a8d4c30b57c896c7a7e2722f800f82.tar.bz2
llvm-847d165459a8d4c30b57c896c7a7e2722f800f82.tar.xz
Add methods which query for the specific attribute instead of using the
enums. This allows for better encapsulation of the Attributes class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Instructions.cpp96
1 files changed, 96 insertions, 0 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index d5b756dac0..b3acbc4241 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -342,6 +342,54 @@ void CallInst::removeAttribute(unsigned i, Attributes attr) {
setAttributes(PAL);
}
+bool CallInst::paramHasSExtAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasSExtAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasSExtAttr();
+ return false;
+}
+
+bool CallInst::paramHasZExtAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasZExtAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasZExtAttr();
+ return false;
+}
+
+bool CallInst::paramHasInRegAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasInRegAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasInRegAttr();
+ return false;
+}
+
+bool CallInst::paramHasStructRetAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasStructRetAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasStructRetAttr();
+ return false;
+}
+
+bool CallInst::paramHasNestAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasNestAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasNestAttr();
+ return false;
+}
+
+bool CallInst::paramHasByValAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasByValAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasByValAttr();
+ return false;
+}
+
bool CallInst::paramHasAttr(unsigned i, Attributes attr) const {
if (AttributeList.paramHasAttr(i, attr))
return true;
@@ -562,6 +610,54 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
return setSuccessor(idx, B);
}
+bool InvokeInst::paramHasSExtAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasSExtAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasSExtAttr();
+ return false;
+}
+
+bool InvokeInst::paramHasZExtAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasZExtAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasZExtAttr();
+ return false;
+}
+
+bool InvokeInst::paramHasInRegAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasInRegAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasInRegAttr();
+ return false;
+}
+
+bool InvokeInst::paramHasStructRetAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasStructRetAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasStructRetAttr();
+ return false;
+}
+
+bool InvokeInst::paramHasNestAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasNestAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasNestAttr();
+ return false;
+}
+
+bool InvokeInst::paramHasByValAttr(unsigned i) const {
+ if (AttributeList.getParamAttributes(i).hasByValAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(i).hasByValAttr();
+ return false;
+}
+
bool InvokeInst::paramHasAttr(unsigned i, Attributes attr) const {
if (AttributeList.paramHasAttr(i, attr))
return true;