summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-09 00:28:54 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-09 00:28:54 +0000
commit060f20a0fa73d04b871e273fbf7b3e49a3e78b73 (patch)
treee4ea3df24e8abc86fd9a8ce802ea83951fb1356e /lib
parent8831c0605bbc0c82ce56c2fb85bd681d1c013925 (diff)
downloadllvm-060f20a0fa73d04b871e273fbf7b3e49a3e78b73.tar.gz
llvm-060f20a0fa73d04b871e273fbf7b3e49a3e78b73.tar.bz2
llvm-060f20a0fa73d04b871e273fbf7b3e49a3e78b73.tar.xz
Remove more uses of the attribute enums by supplying appropriate query methods for them.
No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165466 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/MemoryBuiltins.cpp2
-rw-r--r--lib/VMCore/Instructions.cpp100
2 files changed, 101 insertions, 1 deletions
diff --git a/lib/Analysis/MemoryBuiltins.cpp b/lib/Analysis/MemoryBuiltins.cpp
index a781b277ca..7ca670c286 100644
--- a/lib/Analysis/MemoryBuiltins.cpp
+++ b/lib/Analysis/MemoryBuiltins.cpp
@@ -132,7 +132,7 @@ static const AllocFnsTy *getAllocationData(const Value *V, AllocType AllocTy,
static bool hasNoAliasAttr(const Value *V, bool LookThroughBitCast) {
ImmutableCallSite CS(LookThroughBitCast ? V->stripPointerCasts() : V);
- return CS && CS.hasFnAttr(Attribute::NoAlias);
+ return CS && CS.fnHasNoAliasAttr();
}
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index e3cbf220d4..1d73268723 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -342,6 +342,56 @@ void CallInst::removeAttribute(unsigned i, Attributes attr) {
setAttributes(PAL);
}
+bool CallInst::fnHasNoAliasAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasNoAliasAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasNoAliasAttr();
+ return false;
+}
+bool CallInst::fnHasNoInlineAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasNoInlineAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasNoInlineAttr();
+ return false;
+}
+bool CallInst::fnHasNoReturnAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasNoReturnAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasNoReturnAttr();
+ return false;
+}
+bool CallInst::fnHasNoUnwindAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasNoUnwindAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasNoUnwindAttr();
+ return false;
+}
+bool CallInst::fnHasReadNoneAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasReadNoneAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasReadNoneAttr();
+ return false;
+}
+bool CallInst::fnHasReadOnlyAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasReadOnlyAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasReadOnlyAttr();
+ return false;
+}
+bool CallInst::fnHasReturnsTwiceAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasReturnsTwiceAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasReturnsTwiceAttr();
+ return false;
+}
+
bool CallInst::paramHasSExtAttr(unsigned i) const {
if (AttributeList.getParamAttributes(i).hasSExtAttr())
return true;
@@ -626,6 +676,56 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
return setSuccessor(idx, B);
}
+bool InvokeInst::fnHasNoAliasAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasNoAliasAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasNoAliasAttr();
+ return false;
+}
+bool InvokeInst::fnHasNoInlineAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasNoInlineAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasNoInlineAttr();
+ return false;
+}
+bool InvokeInst::fnHasNoReturnAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasNoReturnAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasNoReturnAttr();
+ return false;
+}
+bool InvokeInst::fnHasNoUnwindAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasNoUnwindAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasNoUnwindAttr();
+ return false;
+}
+bool InvokeInst::fnHasReadNoneAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasReadNoneAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasReadNoneAttr();
+ return false;
+}
+bool InvokeInst::fnHasReadOnlyAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasReadOnlyAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasReadOnlyAttr();
+ return false;
+}
+bool InvokeInst::fnHasReturnsTwiceAttr() const {
+ if (AttributeList.getParamAttributes(~0U).hasReturnsTwiceAttr())
+ return true;
+ if (const Function *F = getCalledFunction())
+ return F->getParamAttributes(~0U).hasReturnsTwiceAttr();
+ return false;
+}
+
bool InvokeInst::paramHasSExtAttr(unsigned i) const {
if (AttributeList.getParamAttributes(i).hasSExtAttr())
return true;