diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-09 00:28:54 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-09 00:28:54 +0000 |
commit | 375eb1f9807e89289d4668471cedddf72eb6dd7b (patch) | |
tree | e5e913af05340ea259f00bf8dbd64d69520556d5 /llvm/lib | |
parent | 70f3917b0e7bcf50225194ff1a51de84b701bc1e (diff) | |
download | bcm5719-llvm-375eb1f9807e89289d4668471cedddf72eb6dd7b.tar.gz bcm5719-llvm-375eb1f9807e89289d4668471cedddf72eb6dd7b.zip |
Remove more uses of the attribute enums by supplying appropriate query methods for them.
No functionality change intended.
llvm-svn: 165466
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/MemoryBuiltins.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 100 |
2 files changed, 101 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp index a781b277cad..7ca670c286d 100644 --- a/llvm/lib/Analysis/MemoryBuiltins.cpp +++ b/llvm/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/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index e3cbf220d4a..1d732687236 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/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; |