X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FVMCore%2FInstructions.cpp;h=e807edc5126a83a23409b3131c4a9bca56e35751;hb=fd8d62c0b449b9070dc18355ac243c7fa78d40d6;hp=1d732687236c1c4ceb7d64148ec625cd95be4bea;hpb=060f20a0fa73d04b871e273fbf7b3e49a3e78b73;p=oota-llvm.git diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 1d732687236..e807edc5126 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -332,135 +332,29 @@ CallInst::CallInst(const CallInst &CI) void CallInst::addAttribute(unsigned i, Attributes attr) { AttrListPtr PAL = getAttributes(); - PAL = PAL.addAttr(i, attr); + PAL = PAL.addAttr(getContext(), i, attr); setAttributes(PAL); } void CallInst::removeAttribute(unsigned i, Attributes attr) { AttrListPtr PAL = getAttributes(); - PAL = PAL.removeAttr(i, attr); + PAL = PAL.removeAttr(getContext(), i, attr); setAttributes(PAL); } -bool CallInst::fnHasNoAliasAttr() const { - if (AttributeList.getParamAttributes(~0U).hasNoAliasAttr()) +bool CallInst::hasFnAttr(Attributes::AttrVal A) const { + if (AttributeList.getParamAttributes(~0U).hasAttribute(A)) 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; - 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::paramHasNoAliasAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasNoAliasAttr()) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasNoAliasAttr(); - return false; -} - -bool CallInst::paramHasNoCaptureAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasNoCaptureAttr()) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasNoCaptureAttr(); + return F->getParamAttributes(~0U).hasAttribute(A); return false; } -bool CallInst::paramHasAttr(unsigned i, Attributes attr) const { - if (AttributeList.paramHasAttr(i, attr)) +bool CallInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const { + if (AttributeList.getParamAttributes(i).hasAttribute(A)) return true; if (const Function *F = getCalledFunction()) - return F->paramHasAttr(i, attr); + return F->getParamAttributes(i).hasAttribute(A); return false; } @@ -676,137 +570,31 @@ 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; - 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::paramHasNoAliasAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasNoAliasAttr()) - return true; - if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasNoAliasAttr(); - return false; -} - -bool InvokeInst::paramHasNoCaptureAttr(unsigned i) const { - if (AttributeList.getParamAttributes(i).hasNoCaptureAttr()) +bool InvokeInst::hasFnAttr(Attributes::AttrVal A) const { + if (AttributeList.getParamAttributes(~0U).hasAttribute(A)) return true; if (const Function *F = getCalledFunction()) - return F->getParamAttributes(i).hasNoCaptureAttr(); + return F->getParamAttributes(~0U).hasAttribute(A); return false; } -bool InvokeInst::paramHasAttr(unsigned i, Attributes attr) const { - if (AttributeList.paramHasAttr(i, attr)) +bool InvokeInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const { + if (AttributeList.getParamAttributes(i).hasAttribute(A)) return true; if (const Function *F = getCalledFunction()) - return F->paramHasAttr(i, attr); + return F->getParamAttributes(i).hasAttribute(A); return false; } void InvokeInst::addAttribute(unsigned i, Attributes attr) { AttrListPtr PAL = getAttributes(); - PAL = PAL.addAttr(i, attr); + PAL = PAL.addAttr(getContext(), i, attr); setAttributes(PAL); } void InvokeInst::removeAttribute(unsigned i, Attributes attr) { AttrListPtr PAL = getAttributes(); - PAL = PAL.removeAttr(i, attr); + PAL = PAL.removeAttr(getContext(), i, attr); setAttributes(PAL); }