diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Attributes.h | 3 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/PruneEH.cpp | 3 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ObjCARC.cpp | 25 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Attributes.cpp | 11 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Core.cpp | 8 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Function.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 4 | 
8 files changed, 36 insertions, 26 deletions
diff --git a/llvm/include/llvm/Attributes.h b/llvm/include/llvm/Attributes.h index 268fc5a8e1c..08cfb86898c 100644 --- a/llvm/include/llvm/Attributes.h +++ b/llvm/include/llvm/Attributes.h @@ -236,7 +236,6 @@ public:    }    Attributes operator & (const Attributes &A) const; -  Attributes &operator |= (const Attributes &A);    Attributes &operator &= (const Attributes &A);    uint64_t Raw() const; @@ -351,7 +350,7 @@ public:    /// addAttr - Add the specified attribute at the specified index to this    /// attribute list.  Since attribute lists are immutable, this    /// returns the new list. -  AttrListPtr addAttr(unsigned Idx, Attributes Attrs) const; +  AttrListPtr addAttr(LLVMContext &C, unsigned Idx, Attributes Attrs) const;    /// removeAttr - Remove the specified attribute at the specified index from    /// this attribute list.  Since attribute lists are immutable, this diff --git a/llvm/lib/Transforms/IPO/PruneEH.cpp b/llvm/lib/Transforms/IPO/PruneEH.cpp index 3e598abfcf6..17cecbf834a 100644 --- a/llvm/lib/Transforms/IPO/PruneEH.cpp +++ b/llvm/lib/Transforms/IPO/PruneEH.cpp @@ -146,7 +146,8 @@ bool PruneEH::runOnSCC(CallGraphSCC &SCC) {        Function *F = (*I)->getFunction();        const AttrListPtr &PAL = F->getAttributes(); -      const AttrListPtr &NPAL = PAL.addAttr(~0, Attributes::get(NewAttributes)); +      const AttrListPtr &NPAL = PAL.addAttr(F->getContext(), ~0, +                                            Attributes::get(NewAttributes));        if (PAL != NPAL) {          MadeChange = true;          F->setAttributes(NPAL); diff --git a/llvm/lib/Transforms/Scalar/ObjCARC.cpp b/llvm/lib/Transforms/Scalar/ObjCARC.cpp index 629f9d2ff57..ffeee75df71 100644 --- a/llvm/lib/Transforms/Scalar/ObjCARC.cpp +++ b/llvm/lib/Transforms/Scalar/ObjCARC.cpp @@ -1790,7 +1790,8 @@ Constant *ObjCARCOpt::getRetainRVCallee(Module *M) {      FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);      Attributes::Builder B;      B.addAttribute(Attributes::NoUnwind); -    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B)); +    AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u, +                                                   Attributes::get(B));      RetainRVCallee =        M->getOrInsertFunction("objc_retainAutoreleasedReturnValue", FTy,                               Attributes); @@ -1806,7 +1807,8 @@ Constant *ObjCARCOpt::getAutoreleaseRVCallee(Module *M) {      FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);      Attributes::Builder B;      B.addAttribute(Attributes::NoUnwind); -    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B)); +    AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u, +                                                   Attributes::get(B));      AutoreleaseRVCallee =        M->getOrInsertFunction("objc_autoreleaseReturnValue", FTy,                               Attributes); @@ -1820,7 +1822,8 @@ Constant *ObjCARCOpt::getReleaseCallee(Module *M) {      Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };      Attributes::Builder B;      B.addAttribute(Attributes::NoUnwind); -    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B)); +    AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u, +                                                   Attributes::get(B));      ReleaseCallee =        M->getOrInsertFunction(          "objc_release", @@ -1836,7 +1839,8 @@ Constant *ObjCARCOpt::getRetainCallee(Module *M) {      Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };      Attributes::Builder B;      B.addAttribute(Attributes::NoUnwind); -    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B)); +    AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u, +                                                   Attributes::get(B));      RetainCallee =        M->getOrInsertFunction(          "objc_retain", @@ -1867,7 +1871,8 @@ Constant *ObjCARCOpt::getAutoreleaseCallee(Module *M) {      Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };      Attributes::Builder B;      B.addAttribute(Attributes::NoUnwind); -    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B)); +    AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u, +                                                   Attributes::get(B));      AutoreleaseCallee =        M->getOrInsertFunction(          "objc_autorelease", @@ -3845,8 +3850,8 @@ Constant *ObjCARCContract::getStoreStrongCallee(Module *M) {      Attributes::Builder BNoCapture;      BNoCapture.addAttribute(Attributes::NoCapture);      AttrListPtr Attributes = AttrListPtr() -      .addAttr(~0u, Attributes::get(BNoUnwind)) -      .addAttr(1, Attributes::get(BNoCapture)); +      .addAttr(M->getContext(), ~0u, Attributes::get(BNoUnwind)) +      .addAttr(M->getContext(), 1, Attributes::get(BNoCapture));      StoreStrongCallee =        M->getOrInsertFunction( @@ -3865,7 +3870,8 @@ Constant *ObjCARCContract::getRetainAutoreleaseCallee(Module *M) {      FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);      Attributes::Builder B;      B.addAttribute(Attributes::NoUnwind); -    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B)); +    AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u, +                                                   Attributes::get(B));      RetainAutoreleaseCallee =        M->getOrInsertFunction("objc_retainAutorelease", FTy, Attributes);    } @@ -3880,7 +3886,8 @@ Constant *ObjCARCContract::getRetainAutoreleaseRVCallee(Module *M) {      FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);      Attributes::Builder B;      B.addAttribute(Attributes::NoUnwind); -    AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B)); +    AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u, +                                                   Attributes::get(B));      RetainAutoreleaseRVCallee =        M->getOrInsertFunction("objc_retainAutoreleaseReturnValue", FTy,                               Attributes); diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index e2932501f31..831f94afb46 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -98,10 +98,12 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,          Anew->addAttr( OldFunc->getAttributes()                         .getParamAttributes(I->getArgNo() + 1));      NewFunc->setAttributes(NewFunc->getAttributes() -                           .addAttr(0, OldFunc->getAttributes() +                           .addAttr(NewFunc->getContext(), 0, +                                    OldFunc->getAttributes()                                       .getRetAttributes()));      NewFunc->setAttributes(NewFunc->getAttributes() -                           .addAttr(~0, OldFunc->getAttributes() +                           .addAttr(NewFunc->getContext(), ~0, +                                    OldFunc->getAttributes()                                       .getFnAttributes()));    } diff --git a/llvm/lib/VMCore/Attributes.cpp b/llvm/lib/VMCore/Attributes.cpp index 0f24f97f836..635ad1409ff 100644 --- a/llvm/lib/VMCore/Attributes.cpp +++ b/llvm/lib/VMCore/Attributes.cpp @@ -96,10 +96,6 @@ bool Attributes::isEmptyOrSingleton() const {  Attributes Attributes::operator & (const Attributes &A) const {    return Attributes(Raw() & A.Raw());  } -Attributes &Attributes::operator |= (const Attributes &A) { -  Attrs.Bits |= A.Raw(); -  return *this; -}  Attributes &Attributes::operator &= (const Attributes &A) {    Attrs.Bits &= A.Raw();    return *this; @@ -504,7 +500,8 @@ Attributes &AttrListPtr::getAttributesAtIndex(unsigned i) const {    return AttrList->Attrs[i].Attrs;  } -AttrListPtr AttrListPtr::addAttr(unsigned Idx, Attributes Attrs) const { +AttrListPtr AttrListPtr::addAttr(LLVMContext &C, unsigned Idx, +                                 Attributes Attrs) const {    Attributes OldAttrs = getAttributes(Idx);  #ifndef NDEBUG    // FIXME it is not obvious how this should work for alignment. @@ -532,7 +529,9 @@ AttrListPtr AttrListPtr::addAttr(unsigned Idx, Attributes Attrs) const {      // If there are attributes already at this index, merge them in.      if (i != e && OldAttrList[i].Index == Idx) { -      Attrs |= OldAttrList[i].Attrs; +      Attrs = +        Attributes::get(C, Attributes::Builder(Attrs). +                        addAttributes(OldAttrList[i].Attrs));        ++i;      } diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp index bafdfa30798..c6da24be937 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/lib/VMCore/Core.cpp @@ -1381,7 +1381,8 @@ void LLVMSetGC(LLVMValueRef Fn, const char *GC) {  void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {    Function *Func = unwrap<Function>(Fn);    const AttrListPtr PAL = Func->getAttributes(); -  const AttrListPtr PALnew = PAL.addAttr(~0U, Attributes(PA)); +  const AttrListPtr PALnew = PAL.addAttr(Func->getContext(), ~0U, +                                         Attributes(PA));    Func->setAttributes(PALnew);  } @@ -1667,7 +1668,7 @@ void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index,                             LLVMAttribute PA) {    CallSite Call = CallSite(unwrap<Instruction>(Instr));    Call.setAttributes( -    Call.getAttributes().addAttr(index, Attributes(PA))); +    Call.getAttributes().addAttr(Call->getContext(), index, Attributes(PA)));  }  void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,  @@ -1682,7 +1683,8 @@ void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,    CallSite Call = CallSite(unwrap<Instruction>(Instr));    Attributes::Builder B;    B.addAlignmentAttr(align); -  Call.setAttributes(Call.getAttributes().addAttr(index, Attributes::get(B))); +  Call.setAttributes(Call.getAttributes().addAttr(Call->getContext(), index, +                                                  Attributes::get(B)));  }  /*--.. Operations on call instructions (only) ..............................--*/ diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index 15e9f7cfdcd..cbf1037f178 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -249,7 +249,7 @@ void Function::dropAllReferences() {  void Function::addAttribute(unsigned i, Attributes attr) {    AttrListPtr PAL = getAttributes(); -  PAL = PAL.addAttr(i, attr); +  PAL = PAL.addAttr(getContext(), i, attr);    setAttributes(PAL);  } diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index 15bc3ae1bc2..e807edc5126 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -332,7 +332,7 @@ 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);  } @@ -588,7 +588,7 @@ bool InvokeInst::paramHasAttr(unsigned i, Attributes::AttrVal A) const {  void InvokeInst::addAttribute(unsigned i, Attributes attr) {    AttrListPtr PAL = getAttributes(); -  PAL = PAL.addAttr(i, attr); +  PAL = PAL.addAttr(getContext(), i, attr);    setAttributes(PAL);  }  | 

