Index: llvm/trunk/docs/HowToUseAttributes.rst =================================================================== --- llvm/trunk/docs/HowToUseAttributes.rst +++ llvm/trunk/docs/HowToUseAttributes.rst @@ -38,36 +38,35 @@ convert any code which does treat them as a bit mask to use the new query methods on the Attribute class. -``AttributeSet`` +``AttributeList`` ================ -The ``AttributeSet`` class replaces the old ``AttributeList`` class. The -``AttributeSet`` stores a collection of Attribute objects for each kind of -object that may have an attribute associated with it: the function as a -whole, the return type, or the function's parameters. A function's attributes -are at index ``AttributeSet::FunctionIndex``; the return type's attributes are -at index ``AttributeSet::ReturnIndex``; and the function's parameters' -attributes are at indices 1, ..., n (where 'n' is the number of parameters). -Most methods on the ``AttributeSet`` class take an index parameter. - -An ``AttributeSet`` is also a uniqued and immutable object. You create an -``AttributeSet`` through the ``AttributeSet::get`` methods. You can add and -remove attributes, which result in the creation of a new ``AttributeSet``. +The ``AttributeList`` stores a collection of Attribute objects for each kind of +object that may have an attribute associated with it: the function as a whole, +the return type, or the function's parameters. A function's attributes are at +index ``AttributeList::FunctionIndex``; the return type's attributes are at +index ``AttributeList::ReturnIndex``; and the function's parameters' attributes +are at indices 1, ..., n (where 'n' is the number of parameters). Most methods +on the ``AttributeList`` class take an index parameter. + +An ``AttributeList`` is also a uniqued and immutable object. You create an +``AttributeList`` through the ``AttributeList::get`` methods. You can add and +remove attributes, which result in the creation of a new ``AttributeList``. -An ``AttributeSet`` object is designed to be passed around by value. +An ``AttributeList`` object is designed to be passed around by value. -Note: It is advised that you do *not* use the ``AttributeSet`` "introspection" +Note: It is advised that you do *not* use the ``AttributeList`` "introspection" methods (e.g. ``Raw``, ``getRawPointer``, etc.). These methods break encapsulation, and may be removed in a future release (i.e. LLVM 4.0). ``AttrBuilder`` =============== -Lastly, we have a "builder" class to help create the ``AttributeSet`` object +Lastly, we have a "builder" class to help create the ``AttributeList`` object without having to create several different intermediate uniqued -``AttributeSet`` objects. The ``AttrBuilder`` class allows you to add and +``AttributeList`` objects. The ``AttrBuilder`` class allows you to add and remove attributes at will. The attributes won't be uniqued until you call the -appropriate ``AttributeSet::get`` method. +appropriate ``AttributeList::get`` method. An ``AttrBuilder`` object is *not* designed to be passed around by value. It should be passed by reference. Index: llvm/trunk/include/llvm/CodeGen/CommandFlags.h =================================================================== --- llvm/trunk/include/llvm/CodeGen/CommandFlags.h +++ llvm/trunk/include/llvm/CodeGen/CommandFlags.h @@ -346,28 +346,28 @@ Module &M) { for (auto &F : M) { auto &Ctx = F.getContext(); - AttributeSet Attrs = F.getAttributes(), NewAttrs; + AttributeList Attrs = F.getAttributes(), NewAttrs; if (!CPU.empty()) - NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex, + NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex, "target-cpu", CPU); if (!Features.empty()) - NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex, + NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex, "target-features", Features); if (DisableFPElim.getNumOccurrences() > 0) - NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex, + NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex, "no-frame-pointer-elim", DisableFPElim ? "true" : "false"); if (DisableTailCalls.getNumOccurrences() > 0) - NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex, + NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex, "disable-tail-calls", toStringRef(DisableTailCalls)); if (StackRealign) - NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex, + NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex, "stackrealign"); if (TrapFuncName.getNumOccurrences() > 0) @@ -377,12 +377,12 @@ if (const auto *F = Call->getCalledFunction()) if (F->getIntrinsicID() == Intrinsic::debugtrap || F->getIntrinsicID() == Intrinsic::trap) - Call->addAttribute(llvm::AttributeSet::FunctionIndex, - Attribute::get(Ctx, "trap-func-name", - TrapFuncName)); + Call->addAttribute( + llvm::AttributeList::FunctionIndex, + Attribute::get(Ctx, "trap-func-name", TrapFuncName)); // Let NewAttrs override Attrs. - NewAttrs = Attrs.addAttributes(Ctx, AttributeSet::FunctionIndex, NewAttrs); + NewAttrs = Attrs.addAttributes(Ctx, AttributeList::FunctionIndex, NewAttrs); F.setAttributes(NewAttrs); } } Index: llvm/trunk/include/llvm/IR/Argument.h =================================================================== --- llvm/trunk/include/llvm/IR/Argument.h +++ llvm/trunk/include/llvm/IR/Argument.h @@ -108,17 +108,17 @@ bool hasSExtAttr() const; /// Add attributes to an argument. - void addAttr(AttributeSet AS); + void addAttr(AttributeList AS); void addAttr(Attribute::AttrKind Kind) { - addAttr(AttributeSet::get(getContext(), getArgNo() + 1, Kind)); + addAttr(AttributeList::get(getContext(), getArgNo() + 1, Kind)); } /// Remove attributes from an argument. - void removeAttr(AttributeSet AS); + void removeAttr(AttributeList AS); void removeAttr(Attribute::AttrKind Kind) { - removeAttr(AttributeSet::get(getContext(), getArgNo() + 1, Kind)); + removeAttr(AttributeList::get(getContext(), getArgNo() + 1, Kind)); } /// Check if an argument has a given attribute. Index: llvm/trunk/include/llvm/IR/Attributes.h =================================================================== --- llvm/trunk/include/llvm/IR/Attributes.h +++ llvm/trunk/include/llvm/IR/Attributes.h @@ -34,7 +34,7 @@ class AttrBuilder; class AttributeImpl; -class AttributeSetImpl; +class AttributeListImpl; class AttributeSetNode; template struct DenseMapInfo; class Function; @@ -199,11 +199,11 @@ /// \class /// \brief This class holds the attributes for a function, its return value, and /// its parameters. You access the attributes for each of them via an index into -/// the AttributeSet object. The function attributes are at index -/// `AttributeSet::FunctionIndex', the return value is at index -/// `AttributeSet::ReturnIndex', and the attributes for the parameters start at +/// the AttributeList object. The function attributes are at index +/// `AttributeList::FunctionIndex', the return value is at index +/// `AttributeList::ReturnIndex', and the attributes for the parameters start at /// index `1'. -class AttributeSet { +class AttributeList { public: enum AttrIndex : unsigned { ReturnIndex = 0U, @@ -212,122 +212,122 @@ private: friend class AttrBuilder; - friend class AttributeSetImpl; + friend class AttributeListImpl; friend class AttributeSetNode; template friend struct DenseMapInfo; /// \brief The attributes that we are managing. This can be null to represent /// the empty attributes list. - AttributeSetImpl *pImpl = nullptr; + AttributeListImpl *pImpl = nullptr; /// \brief The attributes for the specified index are returned. AttributeSetNode *getAttributes(unsigned Index) const; - /// \brief Create an AttributeSet with the specified parameters in it. - static AttributeSet get(LLVMContext &C, - ArrayRef> Attrs); - static AttributeSet get(LLVMContext &C, - ArrayRef> Attrs); - - static AttributeSet getImpl(LLVMContext &C, - ArrayRef> Attrs); + /// \brief Create an AttributeList with the specified parameters in it. + static AttributeList get(LLVMContext &C, + ArrayRef> Attrs); + static AttributeList + get(LLVMContext &C, ArrayRef> Attrs); + + static AttributeList + getImpl(LLVMContext &C, + ArrayRef> Attrs); - explicit AttributeSet(AttributeSetImpl *LI) : pImpl(LI) {} + explicit AttributeList(AttributeListImpl *LI) : pImpl(LI) {} public: - AttributeSet() = default; + AttributeList() = default; //===--------------------------------------------------------------------===// - // AttributeSet Construction and Mutation + // AttributeList Construction and Mutation //===--------------------------------------------------------------------===// - /// \brief Return an AttributeSet with the specified parameters in it. - static AttributeSet get(LLVMContext &C, ArrayRef Attrs); - static AttributeSet get(LLVMContext &C, unsigned Index, - ArrayRef Kinds); - static AttributeSet get(LLVMContext &C, unsigned Index, - ArrayRef Kind); - static AttributeSet get(LLVMContext &C, unsigned Index, const AttrBuilder &B); + /// \brief Return an AttributeList with the specified parameters in it. + static AttributeList get(LLVMContext &C, ArrayRef Attrs); + static AttributeList get(LLVMContext &C, unsigned Index, + ArrayRef Kinds); + static AttributeList get(LLVMContext &C, unsigned Index, + ArrayRef Kind); + static AttributeList get(LLVMContext &C, unsigned Index, + const AttrBuilder &B); /// \brief Add an attribute to the attribute set at the given index. Because /// attribute sets are immutable, this returns a new set. - AttributeSet addAttribute(LLVMContext &C, unsigned Index, - Attribute::AttrKind Kind) const; + AttributeList addAttribute(LLVMContext &C, unsigned Index, + Attribute::AttrKind Kind) const; /// \brief Add an attribute to the attribute set at the given index. Because /// attribute sets are immutable, this returns a new set. - AttributeSet addAttribute(LLVMContext &C, unsigned Index, StringRef Kind, - StringRef Value = StringRef()) const; + AttributeList addAttribute(LLVMContext &C, unsigned Index, StringRef Kind, + StringRef Value = StringRef()) const; /// Add an attribute to the attribute set at the given indices. Because /// attribute sets are immutable, this returns a new set. - AttributeSet addAttribute(LLVMContext &C, ArrayRef Indices, - Attribute A) const; + AttributeList addAttribute(LLVMContext &C, ArrayRef Indices, + Attribute A) const; /// \brief Add attributes to the attribute set at the given index. Because /// attribute sets are immutable, this returns a new set. - AttributeSet addAttributes(LLVMContext &C, unsigned Index, - AttributeSet Attrs) const; + AttributeList addAttributes(LLVMContext &C, unsigned Index, + AttributeList Attrs) const; /// \brief Remove the specified attribute at the specified index from this /// attribute list. Because attribute lists are immutable, this returns the /// new list. - AttributeSet removeAttribute(LLVMContext &C, unsigned Index, - Attribute::AttrKind Kind) const; + AttributeList removeAttribute(LLVMContext &C, unsigned Index, + Attribute::AttrKind Kind) const; /// \brief Remove the specified attribute at the specified index from this /// attribute list. Because attribute lists are immutable, this returns the /// new list. - AttributeSet removeAttribute(LLVMContext &C, unsigned Index, - StringRef Kind) const; + AttributeList removeAttribute(LLVMContext &C, unsigned Index, + StringRef Kind) const; /// \brief Remove the specified attributes at the specified index from this /// attribute list. Because attribute lists are immutable, this returns the /// new list. - AttributeSet removeAttributes(LLVMContext &C, unsigned Index, - AttributeSet Attrs) const; + AttributeList removeAttributes(LLVMContext &C, unsigned Index, + AttributeList Attrs) const; /// \brief Remove the specified attributes at the specified index from this /// attribute list. Because attribute lists are immutable, this returns the /// new list. - AttributeSet removeAttributes(LLVMContext &C, unsigned Index, - const AttrBuilder &Attrs) const; + AttributeList removeAttributes(LLVMContext &C, unsigned Index, + const AttrBuilder &Attrs) const; /// \brief Add the dereferenceable attribute to the attribute set at the given /// index. Because attribute sets are immutable, this returns a new set. - AttributeSet addDereferenceableAttr(LLVMContext &C, unsigned Index, - uint64_t Bytes) const; + AttributeList addDereferenceableAttr(LLVMContext &C, unsigned Index, + uint64_t Bytes) const; /// \brief Add the dereferenceable_or_null attribute to the attribute set at /// the given index. Because attribute sets are immutable, this returns a new /// set. - AttributeSet addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, - uint64_t Bytes) const; + AttributeList addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, + uint64_t Bytes) const; /// Add the allocsize attribute to the attribute set at the given index. /// Because attribute sets are immutable, this returns a new set. - AttributeSet addAllocSizeAttr(LLVMContext &C, unsigned Index, - unsigned ElemSizeArg, - const Optional &NumElemsArg); + AttributeList addAllocSizeAttr(LLVMContext &C, unsigned Index, + unsigned ElemSizeArg, + const Optional &NumElemsArg); //===--------------------------------------------------------------------===// - // AttributeSet Accessors + // AttributeList Accessors //===--------------------------------------------------------------------===// /// \brief Retrieve the LLVM context. LLVMContext &getContext() const; /// \brief The attributes for the specified index are returned. - AttributeSet getParamAttributes(unsigned Index) const; + AttributeList getParamAttributes(unsigned Index) const; /// \brief The attributes for the ret value are returned. - AttributeSet getRetAttributes() const; + AttributeList getRetAttributes() const; /// \brief The function attributes are returned. - AttributeSet getFnAttributes() const; + AttributeList getFnAttributes() const; /// \brief Return true if the attribute exists at the given index. bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const; @@ -338,11 +338,11 @@ /// \brief Return true if attribute exists at the given index. bool hasAttributes(unsigned Index) const; - /// \brief Equivalent to hasAttribute(AttributeSet::FunctionIndex, Kind) but + /// \brief Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but /// may be faster. bool hasFnAttribute(Attribute::AttrKind Kind) const; - /// \brief Equivalent to hasAttribute(AttributeSet::FunctionIndex, Kind) but + /// \brief Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but /// may be faster. bool hasFnAttribute(StringRef Kind) const; @@ -384,15 +384,11 @@ iterator end(unsigned Slot) const; /// operator==/!= - Provide equality predicates. - bool operator==(const AttributeSet &RHS) const { - return pImpl == RHS.pImpl; - } - bool operator!=(const AttributeSet &RHS) const { - return pImpl != RHS.pImpl; - } + bool operator==(const AttributeList &RHS) const { return pImpl == RHS.pImpl; } + bool operator!=(const AttributeList &RHS) const { return pImpl != RHS.pImpl; } //===--------------------------------------------------------------------===// - // AttributeSet Introspection + // AttributeList Introspection //===--------------------------------------------------------------------===// /// \brief Return a raw pointer that uniquely identifies this attribute list. @@ -414,33 +410,35 @@ unsigned getSlotIndex(unsigned Slot) const; /// \brief Return the attributes at the given slot. - AttributeSet getSlotAttributes(unsigned Slot) const; + AttributeList getSlotAttributes(unsigned Slot) const; void dump() const; }; //===----------------------------------------------------------------------===// /// \class -/// \brief Provide DenseMapInfo for AttributeSet. -template<> struct DenseMapInfo { - static inline AttributeSet getEmptyKey() { +/// \brief Provide DenseMapInfo for AttributeList. +template <> struct DenseMapInfo { + static inline AttributeList getEmptyKey() { uintptr_t Val = static_cast(-1); Val <<= PointerLikeTypeTraits::NumLowBitsAvailable; - return AttributeSet(reinterpret_cast(Val)); + return AttributeList(reinterpret_cast(Val)); } - static inline AttributeSet getTombstoneKey() { + static inline AttributeList getTombstoneKey() { uintptr_t Val = static_cast(-2); Val <<= PointerLikeTypeTraits::NumLowBitsAvailable; - return AttributeSet(reinterpret_cast(Val)); + return AttributeList(reinterpret_cast(Val)); } - static unsigned getHashValue(AttributeSet AS) { + static unsigned getHashValue(AttributeList AS) { return (unsigned((uintptr_t)AS.pImpl) >> 4) ^ (unsigned((uintptr_t)AS.pImpl) >> 9); } - static bool isEqual(AttributeSet LHS, AttributeSet RHS) { return LHS == RHS; } + static bool isEqual(AttributeList LHS, AttributeList RHS) { + return LHS == RHS; + } }; //===----------------------------------------------------------------------===// @@ -463,7 +461,7 @@ AttrBuilder(const Attribute &A) { addAttribute(A); } - AttrBuilder(AttributeSet AS, unsigned Idx); + AttrBuilder(AttributeList AS, unsigned Idx); void clear(); @@ -480,7 +478,7 @@ AttrBuilder &removeAttribute(Attribute::AttrKind Val); /// \brief Remove the attributes from the builder. - AttrBuilder &removeAttributes(AttributeSet A, uint64_t Index); + AttrBuilder &removeAttributes(AttributeList A, uint64_t Index); /// \brief Remove the target-dependent attribute to the builder. AttrBuilder &removeAttribute(StringRef A); @@ -510,7 +508,7 @@ /// \brief Return true if the builder has any attribute that's in the /// specified attribute. - bool hasAttributes(AttributeSet A, uint64_t Index) const; + bool hasAttributes(AttributeList A, uint64_t Index) const; /// \brief Return true if the builder has an alignment attribute. bool hasAlignmentAttr() const; Index: llvm/trunk/include/llvm/IR/CallSite.h =================================================================== --- llvm/trunk/include/llvm/IR/CallSite.h +++ llvm/trunk/include/llvm/IR/CallSite.h @@ -323,11 +323,11 @@ } /// Get the parameter attributes of the call. - AttributeSet getAttributes() const { + AttributeList getAttributes() const { CALLSITE_DELEGATE_GETTER(getAttributes()); } /// Set the parameter attributes of the call. - void setAttributes(AttributeSet PAL) { + void setAttributes(AttributeList PAL) { CALLSITE_DELEGATE_SETTER(setAttributes(PAL)); } Index: llvm/trunk/include/llvm/IR/Function.h =================================================================== --- llvm/trunk/include/llvm/IR/Function.h +++ llvm/trunk/include/llvm/IR/Function.h @@ -64,7 +64,7 @@ size_t NumArgs; std::unique_ptr SymTab; ///< Symbol table of args/instructions - AttributeSet AttributeSets; ///< Parameter attributes + AttributeList AttributeSets; ///< Parameter attributes /* * Value::SubclassData @@ -184,35 +184,35 @@ } /// @brief Return the attribute list for this Function. - AttributeSet getAttributes() const { return AttributeSets; } + AttributeList getAttributes() const { return AttributeSets; } /// @brief Set the attribute list for this Function. - void setAttributes(AttributeSet Attrs) { AttributeSets = Attrs; } + void setAttributes(AttributeList Attrs) { AttributeSets = Attrs; } /// @brief Add function attributes to this function. void addFnAttr(Attribute::AttrKind Kind) { - addAttribute(AttributeSet::FunctionIndex, Kind); + addAttribute(AttributeList::FunctionIndex, Kind); } /// @brief Add function attributes to this function. void addFnAttr(StringRef Kind, StringRef Val = StringRef()) { - addAttribute(AttributeSet::FunctionIndex, + addAttribute(AttributeList::FunctionIndex, Attribute::get(getContext(), Kind, Val)); } void addFnAttr(Attribute Attr) { - addAttribute(AttributeSet::FunctionIndex, Attr); + addAttribute(AttributeList::FunctionIndex, Attr); } /// @brief Remove function attributes from this function. void removeFnAttr(Attribute::AttrKind Kind) { - removeAttribute(AttributeSet::FunctionIndex, Kind); + removeAttribute(AttributeList::FunctionIndex, Kind); } /// @brief Remove function attribute from this function. void removeFnAttr(StringRef Kind) { setAttributes(AttributeSets.removeAttribute( - getContext(), AttributeSet::FunctionIndex, Kind)); + getContext(), AttributeList::FunctionIndex, Kind)); } /// \brief Set the entry count for this function. @@ -250,17 +250,17 @@ /// @brief Return the attribute for the given attribute kind. Attribute getFnAttribute(Attribute::AttrKind Kind) const { - return getAttribute(AttributeSet::FunctionIndex, Kind); + return getAttribute(AttributeList::FunctionIndex, Kind); } Attribute getFnAttribute(StringRef Kind) const { - return getAttribute(AttributeSet::FunctionIndex, Kind); + return getAttribute(AttributeList::FunctionIndex, Kind); } /// \brief Return the stack alignment for the function. unsigned getFnStackAlignment() const { if (!hasFnAttribute(Attribute::StackAlignment)) return 0; - return AttributeSets.getStackAlignment(AttributeSet::FunctionIndex); + return AttributeSets.getStackAlignment(AttributeList::FunctionIndex); } /// hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm @@ -279,7 +279,7 @@ void addAttribute(unsigned i, Attribute Attr); /// @brief adds the attributes to the list of attributes. - void addAttributes(unsigned i, AttributeSet Attrs); + void addAttributes(unsigned i, AttributeList Attrs); /// @brief removes the attribute from the list of attributes. void removeAttribute(unsigned i, Attribute::AttrKind Kind); @@ -288,7 +288,7 @@ void removeAttribute(unsigned i, StringRef Kind); /// @brief removes the attributes from the list of attributes. - void removeAttributes(unsigned i, AttributeSet Attrs); + void removeAttributes(unsigned i, AttributeList Attrs); /// @brief check if an attributes is in the list of attributes. bool hasAttribute(unsigned i, Attribute::AttrKind Kind) const { Index: llvm/trunk/include/llvm/IR/Instructions.h =================================================================== --- llvm/trunk/include/llvm/IR/Instructions.h +++ llvm/trunk/include/llvm/IR/Instructions.h @@ -1362,7 +1362,7 @@ public OperandBundleUser { friend class OperandBundleUser; - AttributeSet AttributeList; ///< parameter attributes for call + AttributeList Attrs; ///< parameter attributes for call FunctionType *FTy; CallInst(const CallInst &CI); @@ -1641,11 +1641,11 @@ /// Return the parameter attributes for this call. /// - AttributeSet getAttributes() const { return AttributeList; } + AttributeList getAttributes() const { return Attrs; } /// Set the parameter attributes for this call. /// - void setAttributes(AttributeSet Attrs) { AttributeList = Attrs; } + void setAttributes(AttributeList A) { Attrs = A; } /// adds the attribute to the list of attributes. void addAttribute(unsigned i, Attribute::AttrKind Kind); @@ -1708,26 +1708,26 @@ /// Extract the alignment for a call or parameter (0=unknown). unsigned getParamAlignment(unsigned i) const { - return AttributeList.getParamAlignment(i); + return Attrs.getParamAlignment(i); } /// Extract the number of dereferenceable bytes for a call or /// parameter (0=unknown). uint64_t getDereferenceableBytes(unsigned i) const { - return AttributeList.getDereferenceableBytes(i); + return Attrs.getDereferenceableBytes(i); } /// Extract the number of dereferenceable_or_null bytes for a call or /// parameter (0=unknown). uint64_t getDereferenceableOrNullBytes(unsigned i) const { - return AttributeList.getDereferenceableOrNullBytes(i); + return Attrs.getDereferenceableOrNullBytes(i); } /// @brief Determine if the parameter or return value is marked with NoAlias /// attribute. /// @param n The parameter to check. 1 is the first parameter, 0 is the return bool doesNotAlias(unsigned n) const { - return AttributeList.hasAttribute(n, Attribute::NoAlias); + return Attrs.hasAttribute(n, Attribute::NoAlias); } /// Return true if the call should not be treated as a call to a @@ -1740,7 +1740,7 @@ /// Return true if the call should not be inlined. bool isNoInline() const { return hasFnAttr(Attribute::NoInline); } void setIsNoInline() { - addAttribute(AttributeSet::FunctionIndex, Attribute::NoInline); + addAttribute(AttributeList::FunctionIndex, Attribute::NoInline); } /// Return true if the call can return twice @@ -1748,7 +1748,7 @@ return hasFnAttr(Attribute::ReturnsTwice); } void setCanReturnTwice() { - addAttribute(AttributeSet::FunctionIndex, Attribute::ReturnsTwice); + addAttribute(AttributeList::FunctionIndex, Attribute::ReturnsTwice); } /// Determine if the call does not access memory. @@ -1756,7 +1756,7 @@ return hasFnAttr(Attribute::ReadNone); } void setDoesNotAccessMemory() { - addAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone); + addAttribute(AttributeList::FunctionIndex, Attribute::ReadNone); } /// Determine if the call does not access or only reads memory. @@ -1764,7 +1764,7 @@ return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly); } void setOnlyReadsMemory() { - addAttribute(AttributeSet::FunctionIndex, Attribute::ReadOnly); + addAttribute(AttributeList::FunctionIndex, Attribute::ReadOnly); } /// Determine if the call does not access or only writes memory. @@ -1772,7 +1772,7 @@ return doesNotAccessMemory() || hasFnAttr(Attribute::WriteOnly); } void setDoesNotReadMemory() { - addAttribute(AttributeSet::FunctionIndex, Attribute::WriteOnly); + addAttribute(AttributeList::FunctionIndex, Attribute::WriteOnly); } /// @brief Determine if the call can access memmory only using pointers based @@ -1781,34 +1781,34 @@ return hasFnAttr(Attribute::ArgMemOnly); } void setOnlyAccessesArgMemory() { - addAttribute(AttributeSet::FunctionIndex, Attribute::ArgMemOnly); + addAttribute(AttributeList::FunctionIndex, Attribute::ArgMemOnly); } /// Determine if the call cannot return. bool doesNotReturn() const { return hasFnAttr(Attribute::NoReturn); } void setDoesNotReturn() { - addAttribute(AttributeSet::FunctionIndex, Attribute::NoReturn); + addAttribute(AttributeList::FunctionIndex, Attribute::NoReturn); } /// Determine if the call cannot unwind. bool doesNotThrow() const { return hasFnAttr(Attribute::NoUnwind); } void setDoesNotThrow() { - addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind); + addAttribute(AttributeList::FunctionIndex, Attribute::NoUnwind); } /// Determine if the call cannot be duplicated. bool cannotDuplicate() const {return hasFnAttr(Attribute::NoDuplicate); } void setCannotDuplicate() { - addAttribute(AttributeSet::FunctionIndex, Attribute::NoDuplicate); + addAttribute(AttributeList::FunctionIndex, Attribute::NoDuplicate); } /// Determine if the call is convergent bool isConvergent() const { return hasFnAttr(Attribute::Convergent); } void setConvergent() { - addAttribute(AttributeSet::FunctionIndex, Attribute::Convergent); + addAttribute(AttributeList::FunctionIndex, Attribute::Convergent); } void setNotConvergent() { - removeAttribute(AttributeSet::FunctionIndex, Attribute::Convergent); + removeAttribute(AttributeList::FunctionIndex, Attribute::Convergent); } /// Determine if the call returns a structure through first @@ -1823,7 +1823,7 @@ /// Determine if any call argument is an aggregate passed by value. bool hasByValArgument() const { - return AttributeList.hasAttrSomewhere(Attribute::ByVal); + return Attrs.hasAttrSomewhere(Attribute::ByVal); } /// Return the function called, or null if this is an @@ -1866,7 +1866,7 @@ private: template bool hasFnAttrImpl(AttrKind Kind) const { - if (AttributeList.hasAttribute(AttributeSet::FunctionIndex, Kind)) + if (Attrs.hasAttribute(AttributeList::FunctionIndex, Kind)) return true; // Operand bundles override attributes on the called function, but don't @@ -1875,7 +1875,8 @@ return false; if (const Function *F = getCalledFunction()) - return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, Kind); + return F->getAttributes().hasAttribute(AttributeList::FunctionIndex, + Kind); return false; } @@ -3473,7 +3474,7 @@ public OperandBundleUser { friend class OperandBundleUser; - AttributeSet AttributeList; + AttributeList Attrs; FunctionType *FTy; InvokeInst(const InvokeInst &BI); @@ -3677,11 +3678,11 @@ /// Return the parameter attributes for this invoke. /// - AttributeSet getAttributes() const { return AttributeList; } + AttributeList getAttributes() const { return Attrs; } /// Set the parameter attributes for this invoke. /// - void setAttributes(AttributeSet Attrs) { AttributeList = Attrs; } + void setAttributes(AttributeList A) { Attrs = A; } /// adds the attribute to the list of attributes. void addAttribute(unsigned i, Attribute::AttrKind Kind); @@ -3745,26 +3746,26 @@ /// Extract the alignment for a call or parameter (0=unknown). unsigned getParamAlignment(unsigned i) const { - return AttributeList.getParamAlignment(i); + return Attrs.getParamAlignment(i); } /// Extract the number of dereferenceable bytes for a call or /// parameter (0=unknown). uint64_t getDereferenceableBytes(unsigned i) const { - return AttributeList.getDereferenceableBytes(i); + return Attrs.getDereferenceableBytes(i); } /// Extract the number of dereferenceable_or_null bytes for a call or /// parameter (0=unknown). uint64_t getDereferenceableOrNullBytes(unsigned i) const { - return AttributeList.getDereferenceableOrNullBytes(i); + return Attrs.getDereferenceableOrNullBytes(i); } /// @brief Determine if the parameter or return value is marked with NoAlias /// attribute. /// @param n The parameter to check. 1 is the first parameter, 0 is the return bool doesNotAlias(unsigned n) const { - return AttributeList.hasAttribute(n, Attribute::NoAlias); + return Attrs.hasAttribute(n, Attribute::NoAlias); } /// Return true if the call should not be treated as a call to a @@ -3779,7 +3780,7 @@ /// Return true if the call should not be inlined. bool isNoInline() const { return hasFnAttr(Attribute::NoInline); } void setIsNoInline() { - addAttribute(AttributeSet::FunctionIndex, Attribute::NoInline); + addAttribute(AttributeList::FunctionIndex, Attribute::NoInline); } /// Determine if the call does not access memory. @@ -3787,7 +3788,7 @@ return hasFnAttr(Attribute::ReadNone); } void setDoesNotAccessMemory() { - addAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone); + addAttribute(AttributeList::FunctionIndex, Attribute::ReadNone); } /// Determine if the call does not access or only reads memory. @@ -3795,7 +3796,7 @@ return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly); } void setOnlyReadsMemory() { - addAttribute(AttributeSet::FunctionIndex, Attribute::ReadOnly); + addAttribute(AttributeList::FunctionIndex, Attribute::ReadOnly); } /// Determine if the call does not access or only writes memory. @@ -3803,7 +3804,7 @@ return doesNotAccessMemory() || hasFnAttr(Attribute::WriteOnly); } void setDoesNotReadMemory() { - addAttribute(AttributeSet::FunctionIndex, Attribute::WriteOnly); + addAttribute(AttributeList::FunctionIndex, Attribute::WriteOnly); } /// @brief Determine if the call access memmory only using it's pointer @@ -3812,34 +3813,34 @@ return hasFnAttr(Attribute::ArgMemOnly); } void setOnlyAccessesArgMemory() { - addAttribute(AttributeSet::FunctionIndex, Attribute::ArgMemOnly); + addAttribute(AttributeList::FunctionIndex, Attribute::ArgMemOnly); } /// Determine if the call cannot return. bool doesNotReturn() const { return hasFnAttr(Attribute::NoReturn); } void setDoesNotReturn() { - addAttribute(AttributeSet::FunctionIndex, Attribute::NoReturn); + addAttribute(AttributeList::FunctionIndex, Attribute::NoReturn); } /// Determine if the call cannot unwind. bool doesNotThrow() const { return hasFnAttr(Attribute::NoUnwind); } void setDoesNotThrow() { - addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind); + addAttribute(AttributeList::FunctionIndex, Attribute::NoUnwind); } /// Determine if the invoke cannot be duplicated. bool cannotDuplicate() const {return hasFnAttr(Attribute::NoDuplicate); } void setCannotDuplicate() { - addAttribute(AttributeSet::FunctionIndex, Attribute::NoDuplicate); + addAttribute(AttributeList::FunctionIndex, Attribute::NoDuplicate); } /// Determine if the invoke is convergent bool isConvergent() const { return hasFnAttr(Attribute::Convergent); } void setConvergent() { - addAttribute(AttributeSet::FunctionIndex, Attribute::Convergent); + addAttribute(AttributeList::FunctionIndex, Attribute::Convergent); } void setNotConvergent() { - removeAttribute(AttributeSet::FunctionIndex, Attribute::Convergent); + removeAttribute(AttributeList::FunctionIndex, Attribute::Convergent); } /// Determine if the call returns a structure through first @@ -3854,7 +3855,7 @@ /// Determine if any call argument is an aggregate passed by value. bool hasByValArgument() const { - return AttributeList.hasAttrSomewhere(Attribute::ByVal); + return Attrs.hasAttrSomewhere(Attribute::ByVal); } /// Return the function called, or null if this is an @@ -3926,7 +3927,7 @@ void setSuccessorV(unsigned idx, BasicBlock *B) override; template bool hasFnAttrImpl(AttrKind Kind) const { - if (AttributeList.hasAttribute(AttributeSet::FunctionIndex, Kind)) + if (Attrs.hasAttribute(AttributeList::FunctionIndex, Kind)) return true; // Operand bundles override attributes on the called function, but don't @@ -3935,7 +3936,8 @@ return false; if (const Function *F = getCalledFunction()) - return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, Kind); + return F->getAttributes().hasAttribute(AttributeList::FunctionIndex, + Kind); return false; } Index: llvm/trunk/include/llvm/IR/Intrinsics.h =================================================================== --- llvm/trunk/include/llvm/IR/Intrinsics.h +++ llvm/trunk/include/llvm/IR/Intrinsics.h @@ -28,7 +28,7 @@ class Function; class LLVMContext; class Module; -class AttributeSet; +class AttributeList; /// This namespace contains an enum with a value for every intrinsic/builtin /// function known by LLVM. The enum values are returned by @@ -69,7 +69,7 @@ bool isLeaf(ID id); /// Return the attributes for an intrinsic. - AttributeSet getAttributes(LLVMContext &C, ID id); + AttributeList getAttributes(LLVMContext &C, ID id); /// Create or insert an LLVM Function declaration for an intrinsic, and return /// it. Index: llvm/trunk/include/llvm/IR/Module.h =================================================================== --- llvm/trunk/include/llvm/IR/Module.h +++ llvm/trunk/include/llvm/IR/Module.h @@ -311,7 +311,7 @@ /// 4. Finally, the function exists but has the wrong prototype: return the /// function with a constantexpr cast to the right prototype. Constant *getOrInsertFunction(StringRef Name, FunctionType *T, - AttributeSet AttributeList); + AttributeList AttributeList); Constant *getOrInsertFunction(StringRef Name, FunctionType *T); @@ -321,8 +321,7 @@ /// or a ConstantExpr BitCast of that type if the named function has a /// different type. This version of the method takes a null terminated list of /// function arguments, which makes it easier for clients to use. - Constant *getOrInsertFunction(StringRef Name, - AttributeSet AttributeList, + Constant *getOrInsertFunction(StringRef Name, AttributeList AttributeList, Type *RetTy, ...) LLVM_END_WITH_NULL; /// Same as above, but without the attributes. Index: llvm/trunk/include/llvm/IR/Statepoint.h =================================================================== --- llvm/trunk/include/llvm/IR/Statepoint.h +++ llvm/trunk/include/llvm/IR/Statepoint.h @@ -454,7 +454,7 @@ /// Parse out statepoint directives from the function attributes present in \p /// AS. -StatepointDirectives parseStatepointDirectivesFromAttrs(AttributeSet AS); +StatepointDirectives parseStatepointDirectivesFromAttrs(AttributeList AS); /// Return \c true if the the \p Attr is an attribute that is a statepoint /// directive. Index: llvm/trunk/include/llvm/Target/TargetLowering.h =================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h +++ llvm/trunk/include/llvm/Target/TargetLowering.h @@ -284,9 +284,7 @@ /// several shifts, adds, and multiplies for this target. /// The definition of "cheaper" may depend on whether we're optimizing /// for speed or for size. - virtual bool isIntDivCheap(EVT VT, AttributeSet Attr) const { - return false; - } + virtual bool isIntDivCheap(EVT VT, AttributeList Attr) const { return false; } /// Return true if the target can handle a standalone remainder operation. virtual bool hasStandaloneRem(EVT VT) const { @@ -3217,7 +3215,7 @@ /// Given an LLVM IR type and return type attributes, compute the return value /// EVTs and flags, and optionally also the offsets, if the return value is /// being lowered to memory. -void GetReturnInfo(Type *ReturnType, AttributeSet attr, +void GetReturnInfo(Type *ReturnType, AttributeList attr, SmallVectorImpl &Outs, const TargetLowering &TLI, const DataLayout &DL); Index: llvm/trunk/include/llvm/Transforms/Utils/BuildLibCalls.h =================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/BuildLibCalls.h +++ llvm/trunk/include/llvm/Transforms/Utils/BuildLibCalls.h @@ -84,14 +84,14 @@ /// value with the same type. If 'Op' is a long double, 'l' is added as the /// suffix of name, if 'Op' is a float, we add a 'f' suffix. Value *emitUnaryFloatFnCall(Value *Op, StringRef Name, IRBuilder<> &B, - const AttributeSet &Attrs); + const AttributeList &Attrs); /// Emit a call to the binary function named 'Name' (e.g. 'fmin'). This /// function is known to take type matching 'Op1' and 'Op2' and return one /// value with the same type. If 'Op1/Op2' are long double, 'l' is added as /// the suffix of name, if 'Op1/Op2' are float, we add a 'f' suffix. Value *emitBinaryFloatFnCall(Value *Op1, Value *Op2, StringRef Name, - IRBuilder<> &B, const AttributeSet &Attrs); + IRBuilder<> &B, const AttributeList &Attrs); /// Emit a call to the putchar function. This assumes that Char is an integer. Value *emitPutChar(Value *Char, IRBuilder<> &B, const TargetLibraryInfo *TLI); Index: llvm/trunk/include/llvm/Transforms/Utils/FunctionComparator.h =================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/FunctionComparator.h +++ llvm/trunk/include/llvm/Transforms/Utils/FunctionComparator.h @@ -314,7 +314,7 @@ private: int cmpOrderings(AtomicOrdering L, AtomicOrdering R) const; int cmpInlineAsm(const InlineAsm *L, const InlineAsm *R) const; - int cmpAttrs(const AttributeSet L, const AttributeSet R) const; + int cmpAttrs(const AttributeList L, const AttributeList R) const; int cmpRangeMetadata(const MDNode *L, const MDNode *R) const; int cmpOperandBundlesSchema(const Instruction *L, const Instruction *R) const; Index: llvm/trunk/lib/Analysis/MemoryBuiltins.cpp =================================================================== --- llvm/trunk/lib/Analysis/MemoryBuiltins.cpp +++ llvm/trunk/lib/Analysis/MemoryBuiltins.cpp @@ -183,7 +183,7 @@ static bool hasNoAliasAttr(const Value *V, bool LookThroughBitCast) { ImmutableCallSite CS(LookThroughBitCast ? V->stripPointerCasts() : V); - return CS && CS.paramHasAttr(AttributeSet::ReturnIndex, Attribute::NoAlias); + return CS && CS.paramHasAttr(AttributeList::ReturnIndex, Attribute::NoAlias); } Index: llvm/trunk/lib/AsmParser/LLParser.h =================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h +++ llvm/trunk/lib/AsmParser/LLParser.h @@ -391,9 +391,9 @@ struct ParamInfo { LocTy Loc; Value *V; - AttributeSet Attrs; - ParamInfo(LocTy loc, Value *v, AttributeSet attrs) - : Loc(loc), V(v), Attrs(attrs) {} + AttributeList Attrs; + ParamInfo(LocTy loc, Value *v, AttributeList attrs) + : Loc(loc), V(v), Attrs(attrs) {} }; bool ParseParameterList(SmallVectorImpl &ArgList, PerFunctionState &PFS, @@ -444,10 +444,10 @@ struct ArgInfo { LocTy Loc; Type *Ty; - AttributeSet Attrs; + AttributeList Attrs; std::string Name; - ArgInfo(LocTy L, Type *ty, AttributeSet Attr, const std::string &N) - : Loc(L), Ty(ty), Attrs(Attr), Name(N) {} + ArgInfo(LocTy L, Type *ty, AttributeList Attr, const std::string &N) + : Loc(L), Ty(ty), Attrs(Attr), Name(N) {} }; bool ParseArgumentList(SmallVectorImpl &ArgList, bool &isVarArg); bool ParseFunctionHeader(Function *&Fn, bool isDefine); Index: llvm/trunk/lib/AsmParser/LLParser.cpp =================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp +++ llvm/trunk/lib/AsmParser/LLParser.cpp @@ -130,9 +130,9 @@ B.merge(NumberedAttrBuilders[Attr]); if (Function *Fn = dyn_cast(V)) { - AttributeSet AS = Fn->getAttributes(); - AttrBuilder FnAttrs(AS.getFnAttributes(), AttributeSet::FunctionIndex); - AS = AS.removeAttributes(Context, AttributeSet::FunctionIndex, + AttributeList AS = Fn->getAttributes(); + AttrBuilder FnAttrs(AS.getFnAttributes(), AttributeList::FunctionIndex); + AS = AS.removeAttributes(Context, AttributeList::FunctionIndex, AS.getFnAttributes()); FnAttrs.merge(B); @@ -144,32 +144,29 @@ FnAttrs.removeAttribute(Attribute::Alignment); } - AS = AS.addAttributes(Context, AttributeSet::FunctionIndex, - AttributeSet::get(Context, - AttributeSet::FunctionIndex, - FnAttrs)); + AS = AS.addAttributes( + Context, AttributeList::FunctionIndex, + AttributeList::get(Context, AttributeList::FunctionIndex, FnAttrs)); Fn->setAttributes(AS); } else if (CallInst *CI = dyn_cast(V)) { - AttributeSet AS = CI->getAttributes(); - AttrBuilder FnAttrs(AS.getFnAttributes(), AttributeSet::FunctionIndex); - AS = AS.removeAttributes(Context, AttributeSet::FunctionIndex, + AttributeList AS = CI->getAttributes(); + AttrBuilder FnAttrs(AS.getFnAttributes(), AttributeList::FunctionIndex); + AS = AS.removeAttributes(Context, AttributeList::FunctionIndex, AS.getFnAttributes()); FnAttrs.merge(B); - AS = AS.addAttributes(Context, AttributeSet::FunctionIndex, - AttributeSet::get(Context, - AttributeSet::FunctionIndex, - FnAttrs)); + AS = AS.addAttributes( + Context, AttributeList::FunctionIndex, + AttributeList::get(Context, AttributeList::FunctionIndex, FnAttrs)); CI->setAttributes(AS); } else if (InvokeInst *II = dyn_cast(V)) { - AttributeSet AS = II->getAttributes(); - AttrBuilder FnAttrs(AS.getFnAttributes(), AttributeSet::FunctionIndex); - AS = AS.removeAttributes(Context, AttributeSet::FunctionIndex, + AttributeList AS = II->getAttributes(); + AttrBuilder FnAttrs(AS.getFnAttributes(), AttributeList::FunctionIndex); + AS = AS.removeAttributes(Context, AttributeList::FunctionIndex, AS.getFnAttributes()); FnAttrs.merge(B); - AS = AS.addAttributes(Context, AttributeSet::FunctionIndex, - AttributeSet::get(Context, - AttributeSet::FunctionIndex, - FnAttrs)); + AS = AS.addAttributes( + Context, AttributeList::FunctionIndex, + AttributeList::get(Context, AttributeList::FunctionIndex, FnAttrs)); II->setAttributes(AS); } else { llvm_unreachable("invalid object with forward attribute group reference"); @@ -2132,9 +2129,8 @@ if (ParseOptionalParamAttrs(ArgAttrs) || ParseValue(ArgTy, V, PFS)) return true; } - ArgList.push_back(ParamInfo(ArgLoc, V, AttributeSet::get(V->getContext(), - AttrIndex++, - ArgAttrs))); + ArgList.push_back(ParamInfo( + ArgLoc, V, AttributeList::get(V->getContext(), AttrIndex++, ArgAttrs))); } if (IsMustTailCall && InVarArgsFunc) @@ -2240,8 +2236,8 @@ return Error(TypeLoc, "invalid type for function argument"); unsigned AttrIndex = 1; - ArgList.emplace_back(TypeLoc, ArgTy, AttributeSet::get(ArgTy->getContext(), - AttrIndex++, Attrs), + ArgList.emplace_back(TypeLoc, ArgTy, AttributeList::get(ArgTy->getContext(), + AttrIndex++, Attrs), std::move(Name)); while (EatIfPresent(lltok::comma)) { @@ -2270,7 +2266,7 @@ ArgList.emplace_back( TypeLoc, ArgTy, - AttributeSet::get(ArgTy->getContext(), AttrIndex++, Attrs), + AttributeList::get(ArgTy->getContext(), AttrIndex++, Attrs), std::move(Name)); } } @@ -4741,27 +4737,25 @@ // Okay, if we got here, the function is syntactically valid. Convert types // and do semantic checks. std::vector ParamTypeList; - SmallVector Attrs; + SmallVector Attrs; if (RetAttrs.hasAttributes()) - Attrs.push_back(AttributeSet::get(RetType->getContext(), - AttributeSet::ReturnIndex, - RetAttrs)); + Attrs.push_back(AttributeList::get(RetType->getContext(), + AttributeList::ReturnIndex, RetAttrs)); for (unsigned i = 0, e = ArgList.size(); i != e; ++i) { ParamTypeList.push_back(ArgList[i].Ty); if (ArgList[i].Attrs.hasAttributes(i + 1)) { AttrBuilder B(ArgList[i].Attrs, i + 1); - Attrs.push_back(AttributeSet::get(RetType->getContext(), i + 1, B)); + Attrs.push_back(AttributeList::get(RetType->getContext(), i + 1, B)); } } if (FuncAttrs.hasAttributes()) - Attrs.push_back(AttributeSet::get(RetType->getContext(), - AttributeSet::FunctionIndex, - FuncAttrs)); + Attrs.push_back(AttributeList::get( + RetType->getContext(), AttributeList::FunctionIndex, FuncAttrs)); - AttributeSet PAL = AttributeSet::get(Context, Attrs); + AttributeList PAL = AttributeList::get(Context, Attrs); if (PAL.hasAttribute(1, Attribute::StructRet) && !RetType->isVoidTy()) return Error(RetTypeLoc, "functions with 'sret' argument must return void"); @@ -5371,11 +5365,10 @@ return true; // Set up the Attribute for the function. - SmallVector Attrs; + SmallVector Attrs; if (RetAttrs.hasAttributes()) - Attrs.push_back(AttributeSet::get(RetType->getContext(), - AttributeSet::ReturnIndex, - RetAttrs)); + Attrs.push_back(AttributeList::get(RetType->getContext(), + AttributeList::ReturnIndex, RetAttrs)); SmallVector Args; @@ -5397,7 +5390,7 @@ Args.push_back(ArgList[i].V); if (ArgList[i].Attrs.hasAttributes(i + 1)) { AttrBuilder B(ArgList[i].Attrs, i + 1); - Attrs.push_back(AttributeSet::get(RetType->getContext(), i + 1, B)); + Attrs.push_back(AttributeList::get(RetType->getContext(), i + 1, B)); } } @@ -5408,13 +5401,12 @@ if (FnAttrs.hasAlignmentAttr()) return Error(CallLoc, "invoke instructions may not have an alignment"); - Attrs.push_back(AttributeSet::get(RetType->getContext(), - AttributeSet::FunctionIndex, - FnAttrs)); + Attrs.push_back(AttributeList::get(RetType->getContext(), + AttributeList::FunctionIndex, FnAttrs)); } // Finish off the Attribute and check them - AttributeSet PAL = AttributeSet::get(Context, Attrs); + AttributeList PAL = AttributeList::get(Context, Attrs); InvokeInst *II = InvokeInst::Create(Ty, Callee, NormalBB, UnwindBB, Args, BundleList); @@ -5975,11 +5967,10 @@ return true; // Set up the Attribute for the function. - SmallVector Attrs; + SmallVector Attrs; if (RetAttrs.hasAttributes()) - Attrs.push_back(AttributeSet::get(RetType->getContext(), - AttributeSet::ReturnIndex, - RetAttrs)); + Attrs.push_back(AttributeList::get(RetType->getContext(), + AttributeList::ReturnIndex, RetAttrs)); SmallVector Args; @@ -6001,7 +5992,7 @@ Args.push_back(ArgList[i].V); if (ArgList[i].Attrs.hasAttributes(i + 1)) { AttrBuilder B(ArgList[i].Attrs, i + 1); - Attrs.push_back(AttributeSet::get(RetType->getContext(), i + 1, B)); + Attrs.push_back(AttributeList::get(RetType->getContext(), i + 1, B)); } } @@ -6012,13 +6003,12 @@ if (FnAttrs.hasAlignmentAttr()) return Error(CallLoc, "call instructions may not have an alignment"); - Attrs.push_back(AttributeSet::get(RetType->getContext(), - AttributeSet::FunctionIndex, - FnAttrs)); + Attrs.push_back(AttributeList::get(RetType->getContext(), + AttributeList::FunctionIndex, FnAttrs)); } // Finish off the Attribute and check them - AttributeSet PAL = AttributeSet::get(Context, Attrs); + AttributeList PAL = AttributeList::get(Context, Attrs); CallInst *CI = CallInst::Create(Ty, Callee, Args, BundleList); CI->setTailCallKind(TCK); Index: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp =================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp @@ -419,10 +419,10 @@ /// The set of attributes by index. Index zero in the file is for null, and /// is thus not represented here. As such all indices are off by one. - std::vector MAttributes; + std::vector MAttributes; /// The set of attribute groups. - std::map MAttributeGroups; + std::map MAttributeGroups; /// While parsing a function body, this is a list of the basic blocks for the /// function. @@ -520,10 +520,10 @@ return FunctionBBs[ID]; } - AttributeSet getAttributes(unsigned i) const { + AttributeList getAttributes(unsigned i) const { if (i-1 < MAttributes.size()) return MAttributes[i-1]; - return AttributeSet(); + return AttributeList(); } /// Read a value/type pair out of the specified record from slot 'Slot'. @@ -1132,7 +1132,7 @@ SmallVector Record; - SmallVector Attrs; + SmallVector Attrs; // Read all the records. while (true) { @@ -1162,10 +1162,10 @@ for (unsigned i = 0, e = Record.size(); i != e; i += 2) { AttrBuilder B; decodeLLVMAttributesForBitcode(B, Record[i+1]); - Attrs.push_back(AttributeSet::get(Context, Record[i], B)); + Attrs.push_back(AttributeList::get(Context, Record[i], B)); } - MAttributes.push_back(AttributeSet::get(Context, Attrs)); + MAttributes.push_back(AttributeList::get(Context, Attrs)); Attrs.clear(); break; } @@ -1173,7 +1173,7 @@ for (unsigned i = 0, e = Record.size(); i != e; ++i) Attrs.push_back(MAttributeGroups[Record[i]]); - MAttributes.push_back(AttributeSet::get(Context, Attrs)); + MAttributes.push_back(AttributeList::get(Context, Attrs)); Attrs.clear(); break; } @@ -1391,7 +1391,7 @@ } } - MAttributeGroups[GrpID] = AttributeSet::get(Context, Idx, B); + MAttributeGroups[GrpID] = AttributeList::get(Context, Idx, B); break; } } @@ -3840,7 +3840,7 @@ if (Record.size() < 4) return error("Invalid record"); unsigned OpNum = 0; - AttributeSet PAL = getAttributes(Record[OpNum++]); + AttributeList PAL = getAttributes(Record[OpNum++]); unsigned CCInfo = Record[OpNum++]; BasicBlock *NormalBB = getBasicBlock(Record[OpNum++]); BasicBlock *UnwindBB = getBasicBlock(Record[OpNum++]); @@ -4225,7 +4225,7 @@ return error("Invalid record"); unsigned OpNum = 0; - AttributeSet PAL = getAttributes(Record[OpNum++]); + AttributeList PAL = getAttributes(Record[OpNum++]); unsigned CCInfo = Record[OpNum++]; FastMathFlags FMF; Index: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp =================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -709,22 +709,22 @@ } void ModuleBitcodeWriter::writeAttributeGroupTable() { - const std::vector &AttrGrps = VE.getAttributeGroups(); + const std::vector &AttrGrps = VE.getAttributeGroups(); if (AttrGrps.empty()) return; Stream.EnterSubblock(bitc::PARAMATTR_GROUP_BLOCK_ID, 3); SmallVector Record; for (unsigned i = 0, e = AttrGrps.size(); i != e; ++i) { - AttributeSet AS = AttrGrps[i]; + AttributeList AS = AttrGrps[i]; for (unsigned i = 0, e = AS.getNumSlots(); i != e; ++i) { - AttributeSet A = AS.getSlotAttributes(i); + AttributeList A = AS.getSlotAttributes(i); Record.push_back(VE.getAttributeGroupID(A)); Record.push_back(AS.getSlotIndex(i)); - for (AttributeSet::iterator I = AS.begin(0), E = AS.end(0); - I != E; ++I) { + for (AttributeList::iterator I = AS.begin(0), E = AS.end(0); I != E; + ++I) { Attribute Attr = *I; if (Attr.isEnumAttribute()) { Record.push_back(0); @@ -756,14 +756,14 @@ } void ModuleBitcodeWriter::writeAttributeTable() { - const std::vector &Attrs = VE.getAttributes(); + const std::vector &Attrs = VE.getAttributes(); if (Attrs.empty()) return; Stream.EnterSubblock(bitc::PARAMATTR_BLOCK_ID, 3); SmallVector Record; for (unsigned i = 0, e = Attrs.size(); i != e; ++i) { - const AttributeSet &A = Attrs[i]; + const AttributeList &A = Attrs[i]; for (unsigned i = 0, e = A.getNumSlots(); i != e; ++i) Record.push_back(VE.getAttributeGroupID(A.getSlotAttributes(i))); Index: llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h =================================================================== --- llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h +++ llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h @@ -36,7 +36,7 @@ class MDNode; class MDOperand; class NamedMDNode; -class AttributeSet; +class AttributeList; class ValueSymbolTable; class MDSymbolTable; class raw_ostream; @@ -102,13 +102,13 @@ bool ShouldPreserveUseListOrder; - typedef DenseMap AttributeGroupMapType; + typedef DenseMap AttributeGroupMapType; AttributeGroupMapType AttributeGroupMap; - std::vector AttributeGroups; + std::vector AttributeGroups; - typedef DenseMap AttributeMapType; + typedef DenseMap AttributeMapType; AttributeMapType AttributeMap; - std::vector Attribute; + std::vector Attribute; /// GlobalBasicBlockIDs - This map memoizes the basic block ID's referenced by /// the "getGlobalBasicBlockID" method. @@ -166,14 +166,14 @@ unsigned getInstructionID(const Instruction *I) const; void setInstructionID(const Instruction *I); - unsigned getAttributeID(AttributeSet PAL) const { + unsigned getAttributeID(AttributeList PAL) const { if (PAL.isEmpty()) return 0; // Null maps to zero. AttributeMapType::const_iterator I = AttributeMap.find(PAL); assert(I != AttributeMap.end() && "Attribute not in ValueEnumerator!"); return I->second; } - unsigned getAttributeGroupID(AttributeSet PAL) const { + unsigned getAttributeGroupID(AttributeList PAL) const { if (PAL.isEmpty()) return 0; // Null maps to zero. AttributeGroupMapType::const_iterator I = AttributeGroupMap.find(PAL); assert(I != AttributeGroupMap.end() && "Attribute not in ValueEnumerator!"); @@ -206,10 +206,8 @@ const std::vector &getBasicBlocks() const { return BasicBlocks; } - const std::vector &getAttributes() const { - return Attribute; - } - const std::vector &getAttributeGroups() const { + const std::vector &getAttributes() const { return Attribute; } + const std::vector &getAttributeGroups() const { return AttributeGroups; } @@ -283,7 +281,7 @@ void EnumerateValue(const Value *V); void EnumerateType(Type *T); void EnumerateOperandType(const Value *V); - void EnumerateAttributes(AttributeSet PAL); + void EnumerateAttributes(AttributeList PAL); void EnumerateValueSymbolTable(const ValueSymbolTable &ST); void EnumerateNamedMetadata(const Module &M); Index: llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp =================================================================== --- llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp +++ llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -887,7 +887,7 @@ } } -void ValueEnumerator::EnumerateAttributes(AttributeSet PAL) { +void ValueEnumerator::EnumerateAttributes(AttributeList PAL) { if (PAL.isEmpty()) return; // null is always 0. // Do a lookup. @@ -900,7 +900,7 @@ // Do lookups for all attribute groups. for (unsigned i = 0, e = PAL.getNumSlots(); i != e; ++i) { - AttributeSet AS = PAL.getSlotAttributes(i); + AttributeList AS = PAL.getSlotAttributes(i); unsigned &Entry = AttributeGroupMap[AS]; if (Entry == 0) { AttributeGroups.push_back(AS); Index: llvm/trunk/lib/CodeGen/Analysis.cpp =================================================================== --- llvm/trunk/lib/CodeGen/Analysis.cpp +++ llvm/trunk/lib/CodeGen/Analysis.cpp @@ -516,10 +516,9 @@ bool &ADS = AllowDifferingSizes ? *AllowDifferingSizes : DummyADS; ADS = true; - AttrBuilder CallerAttrs(F->getAttributes(), - AttributeSet::ReturnIndex); + AttrBuilder CallerAttrs(F->getAttributes(), AttributeList::ReturnIndex); AttrBuilder CalleeAttrs(cast(I)->getAttributes(), - AttributeSet::ReturnIndex); + AttributeList::ReturnIndex); // Noalias is completely benign as far as calling convention goes, it // shouldn't affect whether the call is a tail call. Index: llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp =================================================================== --- llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp +++ llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp @@ -1532,7 +1532,7 @@ Type *ResultTy; SmallVector Args; - AttributeSet Attr; + AttributeList Attr; // 'size' argument. if (!UseSizedLibcall) { @@ -1593,7 +1593,7 @@ // Now, the return type. if (CASExpected) { ResultTy = Type::getInt1Ty(Ctx); - Attr = Attr.addAttribute(Ctx, AttributeSet::ReturnIndex, Attribute::ZExt); + Attr = Attr.addAttribute(Ctx, AttributeList::ReturnIndex, Attribute::ZExt); } else if (HasResult && UseSizedLibcall) ResultTy = SizedIntTy; else Index: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp =================================================================== --- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp +++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp @@ -2400,11 +2400,11 @@ // Conservatively require the attributes of the call to match those of the // return. Ignore noalias because it doesn't affect the call sequence. - AttributeSet CalleeAttrs = CS.getAttributes(); - if (AttrBuilder(CalleeAttrs, AttributeSet::ReturnIndex). - removeAttribute(Attribute::NoAlias) != - AttrBuilder(CalleeAttrs, AttributeSet::ReturnIndex). - removeAttribute(Attribute::NoAlias)) + AttributeList CalleeAttrs = CS.getAttributes(); + if (AttrBuilder(CalleeAttrs, AttributeList::ReturnIndex) + .removeAttribute(Attribute::NoAlias) != + AttrBuilder(CalleeAttrs, AttributeList::ReturnIndex) + .removeAttribute(Attribute::NoAlias)) continue; // Make sure the call instruction is followed by an unconditional branch to Index: llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp =================================================================== --- llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp +++ llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp @@ -50,7 +50,7 @@ ArgInfo OrigRet{ResReg, CS.getType(), ISD::ArgFlagsTy{}}; if (!OrigRet.Ty->isVoidTy()) - setArgFlags(OrigRet, AttributeSet::ReturnIndex, DL, CS); + setArgFlags(OrigRet, AttributeList::ReturnIndex, DL, CS); return lowerCall(MIRBuilder, CS.getCallingConv(), Callee, OrigRet, OrigArgs); } @@ -59,7 +59,7 @@ void CallLowering::setArgFlags(CallLowering::ArgInfo &Arg, unsigned OpIdx, const DataLayout &DL, const FuncInfoTy &FuncInfo) const { - const AttributeSet &Attrs = FuncInfo.getAttributes(); + const AttributeList &Attrs = FuncInfo.getAttributes(); if (Attrs.hasAttribute(OpIdx, Attribute::ZExt)) Arg.Flags.setZExt(); if (Attrs.hasAttribute(OpIdx, Attribute::SExt)) Index: llvm/trunk/lib/CodeGen/MachinePipeliner.cpp =================================================================== --- llvm/trunk/lib/CodeGen/MachinePipeliner.cpp +++ llvm/trunk/lib/CodeGen/MachinePipeliner.cpp @@ -733,7 +733,7 @@ return false; if (mf.getFunction()->getAttributes().hasAttribute( - AttributeSet::FunctionIndex, Attribute::OptimizeForSize) && + AttributeList::FunctionIndex, Attribute::OptimizeForSize) && !EnableSWPOptSize.getPosition()) return false; Index: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp =================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2617,7 +2617,7 @@ // If integer divide is expensive and we satisfy the requirements, emit an // alternate sequence. Targets may check function attributes for size/speed // trade-offs. - AttributeSet Attr = DAG.getMachineFunction().getFunction()->getAttributes(); + AttributeList Attr = DAG.getMachineFunction().getFunction()->getAttributes(); if (N1C && !TLI.isIntDivCheap(N->getValueType(0), Attr)) if (SDValue Op = BuildSDIV(N)) return Op; @@ -2688,7 +2688,7 @@ } // fold (udiv x, c) -> alternate - AttributeSet Attr = DAG.getMachineFunction().getFunction()->getAttributes(); + AttributeList Attr = DAG.getMachineFunction().getFunction()->getAttributes(); if (N1C && !TLI.isIntDivCheap(N->getValueType(0), Attr)) if (SDValue Op = BuildUDIV(N)) return Op; @@ -2747,7 +2747,7 @@ } } - AttributeSet Attr = DAG.getMachineFunction().getFunction()->getAttributes(); + AttributeList Attr = DAG.getMachineFunction().getFunction()->getAttributes(); // If X/C can be simplified by the division-by-constant logic, lower // X%C to the equivalent of X-X/C*C. Index: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp =================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -863,9 +863,9 @@ return true; } -/// Returns an AttributeSet representing the attributes applied to the return +/// Returns an AttributeList representing the attributes applied to the return /// value of the given call. -static AttributeSet getReturnAttrs(FastISel::CallLoweringInfo &CLI) { +static AttributeList getReturnAttrs(FastISel::CallLoweringInfo &CLI) { SmallVector Attrs; if (CLI.RetSExt) Attrs.push_back(Attribute::SExt); @@ -874,8 +874,8 @@ if (CLI.IsInReg) Attrs.push_back(Attribute::InReg); - return AttributeSet::get(CLI.RetTy->getContext(), AttributeSet::ReturnIndex, - Attrs); + return AttributeList::get(CLI.RetTy->getContext(), AttributeList::ReturnIndex, + Attrs); } bool FastISel::lowerCallTo(const CallInst *CI, const char *SymName, Index: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp =================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -1373,16 +1373,16 @@ const Function *F = I.getParent()->getParent(); ISD::NodeType ExtendKind = ISD::ANY_EXTEND; - if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex, + if (F->getAttributes().hasAttribute(AttributeList::ReturnIndex, Attribute::SExt)) ExtendKind = ISD::SIGN_EXTEND; - else if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex, + else if (F->getAttributes().hasAttribute(AttributeList::ReturnIndex, Attribute::ZExt)) ExtendKind = ISD::ZERO_EXTEND; LLVMContext &Context = F->getContext(); - bool RetInReg = F->getAttributes().hasAttribute(AttributeSet::ReturnIndex, - Attribute::InReg); + bool RetInReg = F->getAttributes().hasAttribute( + AttributeList::ReturnIndex, Attribute::InReg); for (unsigned j = 0; j != NumValues; ++j) { EVT VT = ValueVTs[j]; @@ -5525,7 +5525,7 @@ case Intrinsic::trap: { StringRef TrapFuncName = I.getAttributes() - .getAttribute(AttributeSet::FunctionIndex, "trap-func-name") + .getAttribute(AttributeList::FunctionIndex, "trap-func-name") .getValueAsString(); if (TrapFuncName.empty()) { ISD::NodeType Op = (Intrinsic == Intrinsic::trap) ? @@ -7603,9 +7603,9 @@ FuncInfo.MF->getFrameInfo().setHasPatchPoint(); } -/// Returns an AttributeSet representing the attributes applied to the return +/// Returns an AttributeList representing the attributes applied to the return /// value of the given call. -static AttributeSet getReturnAttrs(TargetLowering::CallLoweringInfo &CLI) { +static AttributeList getReturnAttrs(TargetLowering::CallLoweringInfo &CLI) { SmallVector Attrs; if (CLI.RetSExt) Attrs.push_back(Attribute::SExt); @@ -7614,8 +7614,8 @@ if (CLI.IsInReg) Attrs.push_back(Attribute::InReg); - return AttributeSet::get(CLI.RetTy->getContext(), AttributeSet::ReturnIndex, - Attrs); + return AttributeList::get(CLI.RetTy->getContext(), AttributeList::ReturnIndex, + Attrs); } /// TargetLowering::LowerCallTo - This is the default LowerCallTo Index: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp =================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -55,14 +55,15 @@ // Conservatively require the attributes of the call to match those of // the return. Ignore noalias because it doesn't affect the call sequence. - AttributeSet CallerAttrs = F->getAttributes(); - if (AttrBuilder(CallerAttrs, AttributeSet::ReturnIndex) - .removeAttribute(Attribute::NoAlias).hasAttributes()) + AttributeList CallerAttrs = F->getAttributes(); + if (AttrBuilder(CallerAttrs, AttributeList::ReturnIndex) + .removeAttribute(Attribute::NoAlias) + .hasAttributes()) return false; // It's not safe to eliminate the sign / zero extension of the return value. - if (CallerAttrs.hasAttribute(AttributeSet::ReturnIndex, Attribute::ZExt) || - CallerAttrs.hasAttribute(AttributeSet::ReturnIndex, Attribute::SExt)) + if (CallerAttrs.hasAttribute(AttributeList::ReturnIndex, Attribute::ZExt) || + CallerAttrs.hasAttribute(AttributeList::ReturnIndex, Attribute::SExt)) return false; // Check if the only use is a function return node. @@ -2981,7 +2982,7 @@ SDValue TargetLowering::BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG, std::vector *Created) const { - AttributeSet Attr = DAG.getMachineFunction().getFunction()->getAttributes(); + AttributeList Attr = DAG.getMachineFunction().getFunction()->getAttributes(); const TargetLowering &TLI = DAG.getTargetLoweringInfo(); if (TLI.isIntDivCheap(N->getValueType(0), Attr)) return SDValue(N,0); // Lower SDIV as SDIV Index: llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp =================================================================== --- llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp +++ llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp @@ -1589,7 +1589,7 @@ /// type of the given function. This does not require a DAG or a return value, /// and is suitable for use before any DAGs for the function are constructed. /// TODO: Move this out of TargetLowering.cpp. -void llvm::GetReturnInfo(Type *ReturnType, AttributeSet attr, +void llvm::GetReturnInfo(Type *ReturnType, AttributeList attr, SmallVectorImpl &Outs, const TargetLowering &TLI, const DataLayout &DL) { SmallVector ValueVTs; @@ -1601,9 +1601,9 @@ EVT VT = ValueVTs[j]; ISD::NodeType ExtendKind = ISD::ANY_EXTEND; - if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::SExt)) + if (attr.hasAttribute(AttributeList::ReturnIndex, Attribute::SExt)) ExtendKind = ISD::SIGN_EXTEND; - else if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::ZExt)) + else if (attr.hasAttribute(AttributeList::ReturnIndex, Attribute::ZExt)) ExtendKind = ISD::ZERO_EXTEND; // FIXME: C calling convention requires the return type to be promoted to @@ -1621,13 +1621,13 @@ // 'inreg' on function refers to return value ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy(); - if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::InReg)) + if (attr.hasAttribute(AttributeList::ReturnIndex, Attribute::InReg)) Flags.setInReg(); // Propagate extension type if any - if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::SExt)) + if (attr.hasAttribute(AttributeList::ReturnIndex, Attribute::SExt)) Flags.setSExt(); - else if (attr.hasAttribute(AttributeSet::ReturnIndex, Attribute::ZExt)) + else if (attr.hasAttribute(AttributeList::ReturnIndex, Attribute::ZExt)) Flags.setZExt(); for (unsigned i = 0; i < NumParts; ++i) Index: llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp =================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp @@ -188,7 +188,7 @@ for (auto &F : *Mod) { auto Attrs = F.getAttributes(); StringRef Value(options.NoFramePointerElim ? "true" : "false"); - Attrs = Attrs.addAttribute(F.getContext(), AttributeSet::FunctionIndex, + Attrs = Attrs.addAttribute(F.getContext(), AttributeList::FunctionIndex, "no-frame-pointer-elim", Value); F.setAttributes(Attrs); } Index: llvm/trunk/lib/IR/AsmWriter.cpp =================================================================== --- llvm/trunk/lib/IR/AsmWriter.cpp +++ llvm/trunk/lib/IR/AsmWriter.cpp @@ -604,7 +604,7 @@ unsigned mdnNext; /// asMap - The slot map for attribute sets. - DenseMap asMap; + DenseMap asMap; unsigned asNext; public: /// Construct from a module. @@ -627,7 +627,7 @@ int getLocalSlot(const Value *V); int getGlobalSlot(const GlobalValue *V); int getMetadataSlot(const MDNode *N); - int getAttributeGroupSlot(AttributeSet AS); + int getAttributeGroupSlot(AttributeList AS); /// If you'd like to deal with a function instead of just a module, use /// this method to get its data into the SlotTracker. @@ -650,8 +650,8 @@ unsigned mdn_size() const { return mdnMap.size(); } bool mdn_empty() const { return mdnMap.empty(); } - /// AttributeSet map iterators. - typedef DenseMap::iterator as_iterator; + /// AttributeList map iterators. + typedef DenseMap::iterator as_iterator; as_iterator as_begin() { return asMap.begin(); } as_iterator as_end() { return asMap.end(); } unsigned as_size() const { return asMap.size(); } @@ -671,8 +671,8 @@ /// CreateFunctionSlot - Insert the specified Value* into the slot table. void CreateFunctionSlot(const Value *V); - /// \brief Insert the specified AttributeSet into the slot table. - void CreateAttributeSetSlot(AttributeSet AS); + /// \brief Insert the specified AttributeList into the slot table. + void CreateAttributeSetSlot(AttributeList AS); /// Add all of the module level global variables (and their initializers) /// and function declarations, but not the contents of those functions. @@ -831,8 +831,8 @@ // Add all the function attributes to the table. // FIXME: Add attributes of other objects? - AttributeSet FnAttrs = F.getAttributes().getFnAttributes(); - if (FnAttrs.hasAttributes(AttributeSet::FunctionIndex)) + AttributeList FnAttrs = F.getAttributes().getFnAttributes(); + if (FnAttrs.hasAttributes(AttributeList::FunctionIndex)) CreateAttributeSetSlot(FnAttrs); } @@ -869,13 +869,13 @@ // target may not be linked into the optimizer. if (const CallInst *CI = dyn_cast(&I)) { // Add all the call attributes to the table. - AttributeSet Attrs = CI->getAttributes().getFnAttributes(); - if (Attrs.hasAttributes(AttributeSet::FunctionIndex)) + AttributeList Attrs = CI->getAttributes().getFnAttributes(); + if (Attrs.hasAttributes(AttributeList::FunctionIndex)) CreateAttributeSetSlot(Attrs); } else if (const InvokeInst *II = dyn_cast(&I)) { // Add all the call attributes to the table. - AttributeSet Attrs = II->getAttributes().getFnAttributes(); - if (Attrs.hasAttributes(AttributeSet::FunctionIndex)) + AttributeList Attrs = II->getAttributes().getFnAttributes(); + if (Attrs.hasAttributes(AttributeList::FunctionIndex)) CreateAttributeSetSlot(Attrs); } } @@ -961,11 +961,11 @@ return FI == fMap.end() ? -1 : (int)FI->second; } -int SlotTracker::getAttributeGroupSlot(AttributeSet AS) { +int SlotTracker::getAttributeGroupSlot(AttributeList AS) { // Check for uninitialized state and do lazy initialization. initialize(); - // Find the AttributeSet in the module map. + // Find the AttributeList in the module map. as_iterator AI = asMap.find(AS); return AI == asMap.end() ? -1 : (int)AI->second; } @@ -1015,8 +1015,8 @@ CreateMetadataSlot(Op); } -void SlotTracker::CreateAttributeSetSlot(AttributeSet AS) { - assert(AS.hasAttributes(AttributeSet::FunctionIndex) && +void SlotTracker::CreateAttributeSetSlot(AttributeList AS) { + assert(AS.hasAttributes(AttributeList::FunctionIndex) && "Doesn't need a slot!"); as_iterator I = asMap.find(AS); @@ -2088,7 +2088,8 @@ void printModule(const Module *M); void writeOperand(const Value *Op, bool PrintType); - void writeParamOperand(const Value *Operand, AttributeSet Attrs,unsigned Idx); + void writeParamOperand(const Value *Operand, AttributeList Attrs, + unsigned Idx); void writeOperandBundles(ImmutableCallSite CS); void writeAtomic(AtomicOrdering Ordering, SynchronizationScope SynchScope); void writeAtomicCmpXchg(AtomicOrdering SuccessOrdering, @@ -2104,7 +2105,7 @@ void printIndirectSymbol(const GlobalIndirectSymbol *GIS); void printComdat(const Comdat *C); void printFunction(const Function *F); - void printArgument(const Argument *FA, AttributeSet Attrs, unsigned Idx); + void printArgument(const Argument *FA, AttributeList Attrs, unsigned Idx); void printBasicBlock(const BasicBlock *BB); void printInstructionLine(const Instruction &I); void printInstruction(const Instruction &I); @@ -2183,7 +2184,7 @@ } void AssemblyWriter::writeParamOperand(const Value *Operand, - AttributeSet Attrs, unsigned Idx) { + AttributeList Attrs, unsigned Idx) { if (!Operand) { Out << ""; return; @@ -2601,18 +2602,18 @@ if (F->isMaterializable()) Out << "; Materializable\n"; - const AttributeSet &Attrs = F->getAttributes(); - if (Attrs.hasAttributes(AttributeSet::FunctionIndex)) { - AttributeSet AS = Attrs.getFnAttributes(); + const AttributeList &Attrs = F->getAttributes(); + if (Attrs.hasAttributes(AttributeList::FunctionIndex)) { + AttributeList AS = Attrs.getFnAttributes(); std::string AttrStr; unsigned Idx = 0; for (unsigned E = AS.getNumSlots(); Idx != E; ++Idx) - if (AS.getSlotIndex(Idx) == AttributeSet::FunctionIndex) + if (AS.getSlotIndex(Idx) == AttributeList::FunctionIndex) break; - for (AttributeSet::iterator I = AS.begin(Idx), E = AS.end(Idx); - I != E; ++I) { + for (AttributeList::iterator I = AS.begin(Idx), E = AS.end(Idx); I != E; + ++I) { Attribute Attr = *I; if (!Attr.isStringAttribute()) { if (!AttrStr.empty()) AttrStr += ' '; @@ -2646,8 +2647,8 @@ } FunctionType *FT = F->getFunctionType(); - if (Attrs.hasAttributes(AttributeSet::ReturnIndex)) - Out << Attrs.getAsString(AttributeSet::ReturnIndex) << ' '; + if (Attrs.hasAttributes(AttributeList::ReturnIndex)) + Out << Attrs.getAsString(AttributeList::ReturnIndex) << ' '; TypePrinter.print(F->getReturnType(), Out); Out << ' '; WriteAsOperandInternal(Out, F, &TypePrinter, &Machine, F->getParent()); @@ -2686,7 +2687,7 @@ StringRef UA = getUnnamedAddrEncoding(F->getUnnamedAddr()); if (!UA.empty()) Out << ' ' << UA; - if (Attrs.hasAttributes(AttributeSet::FunctionIndex)) + if (Attrs.hasAttributes(AttributeList::FunctionIndex)) Out << " #" << Machine.getAttributeGroupSlot(Attrs.getFnAttributes()); if (F->hasSection()) { Out << " section \""; @@ -2735,8 +2736,8 @@ /// printArgument - This member is called for every argument that is passed into /// the function. Simply print it out /// -void AssemblyWriter::printArgument(const Argument *Arg, - AttributeSet Attrs, unsigned Idx) { +void AssemblyWriter::printArgument(const Argument *Arg, AttributeList Attrs, + unsigned Idx) { // Output type... TypePrinter.print(Arg->getType(), Out); @@ -3020,10 +3021,10 @@ Operand = CI->getCalledValue(); FunctionType *FTy = CI->getFunctionType(); Type *RetTy = FTy->getReturnType(); - const AttributeSet &PAL = CI->getAttributes(); + const AttributeList &PAL = CI->getAttributes(); - if (PAL.hasAttributes(AttributeSet::ReturnIndex)) - Out << ' ' << PAL.getAsString(AttributeSet::ReturnIndex); + if (PAL.hasAttributes(AttributeList::ReturnIndex)) + Out << ' ' << PAL.getAsString(AttributeList::ReturnIndex); // If possible, print out the short form of the call instruction. We can // only do this if the first argument is a pointer to a nonvararg function, @@ -3048,7 +3049,7 @@ Out << ", ..."; Out << ')'; - if (PAL.hasAttributes(AttributeSet::FunctionIndex)) + if (PAL.hasAttributes(AttributeList::FunctionIndex)) Out << " #" << Machine.getAttributeGroupSlot(PAL.getFnAttributes()); writeOperandBundles(CI); @@ -3057,7 +3058,7 @@ Operand = II->getCalledValue(); FunctionType *FTy = II->getFunctionType(); Type *RetTy = FTy->getReturnType(); - const AttributeSet &PAL = II->getAttributes(); + const AttributeList &PAL = II->getAttributes(); // Print the calling convention being used. if (II->getCallingConv() != CallingConv::C) { @@ -3065,8 +3066,8 @@ PrintCallingConv(II->getCallingConv(), Out); } - if (PAL.hasAttributes(AttributeSet::ReturnIndex)) - Out << ' ' << PAL.getAsString(AttributeSet::ReturnIndex); + if (PAL.hasAttributes(AttributeList::ReturnIndex)) + Out << ' ' << PAL.getAsString(AttributeList::ReturnIndex); // If possible, print out the short form of the invoke instruction. We can // only do this if the first argument is a pointer to a nonvararg function, @@ -3084,7 +3085,7 @@ } Out << ')'; - if (PAL.hasAttributes(AttributeSet::FunctionIndex)) + if (PAL.hasAttributes(AttributeList::FunctionIndex)) Out << " #" << Machine.getAttributeGroupSlot(PAL.getFnAttributes()); writeOperandBundles(II); @@ -3247,7 +3248,7 @@ } void AssemblyWriter::writeAllAttributeGroups() { - std::vector > asVec; + std::vector> asVec; asVec.resize(Machine.as_size()); for (SlotTracker::as_iterator I = Machine.as_begin(), E = Machine.as_end(); @@ -3256,7 +3257,7 @@ for (const auto &I : asVec) Out << "attributes #" << I.second << " = { " - << I.first.getAsString(AttributeSet::FunctionIndex, true) << " }\n"; + << I.first.getAsString(AttributeList::FunctionIndex, true) << " }\n"; } void AssemblyWriter::printUseListOrder(const UseListOrder &Order) { Index: llvm/trunk/lib/IR/AttributeImpl.h =================================================================== --- llvm/trunk/lib/IR/AttributeImpl.h +++ llvm/trunk/lib/IR/AttributeImpl.h @@ -150,10 +150,10 @@ /// \class /// \brief This class represents a set of attributes that apply to the function, /// return type, and parameters. -class AttributeSetImpl final +class AttributeListImpl final : public FoldingSetNode, - private TrailingObjects { - friend class AttributeSet; + private TrailingObjects { + friend class AttributeList; friend TrailingObjects; private: @@ -171,8 +171,8 @@ } public: - AttributeSetImpl(LLVMContext &C, - ArrayRef> Slots) + AttributeListImpl(LLVMContext &C, + ArrayRef> Slots) : Context(C), NumSlots(Slots.size()), AvailableFunctionAttrs(0) { static_assert(Attribute::EndAttrKinds <= sizeof(AvailableFunctionAttrs) * CHAR_BIT, @@ -192,10 +192,10 @@ // Initialize AvailableFunctionAttrs summary bitset. if (NumSlots > 0) { - static_assert(AttributeSet::FunctionIndex == ~0u, + static_assert(AttributeList::FunctionIndex == ~0u, "FunctionIndex should be biggest possible index"); const std::pair &Last = Slots.back(); - if (Last.first == AttributeSet::FunctionIndex) { + if (Last.first == AttributeList::FunctionIndex) { const AttributeSetNode *Node = Last.second; for (Attribute I : *Node) { if (!I.isStringAttribute()) @@ -206,12 +206,12 @@ } // AttributesSetImpt is uniqued, these should not be available. - AttributeSetImpl(const AttributeSetImpl &) = delete; - AttributeSetImpl &operator=(const AttributeSetImpl &) = delete; + AttributeListImpl(const AttributeListImpl &) = delete; + AttributeListImpl &operator=(const AttributeListImpl &) = delete; void operator delete(void *p) { ::operator delete(p); } - /// \brief Get the context that created this AttributeSetImpl. + /// \brief Get the context that created this AttributeListImpl. LLVMContext &getContext() { return Context; } /// \brief Return the number of slots used in this attribute list. This is @@ -230,8 +230,8 @@ /// \brief Retrieve the attributes for the given "slot" in the AttrNode list. /// \p Slot is an index into the AttrNodes list, not the index of the return / /// parameter/ function which the attributes apply to. - AttributeSet getSlotAttributes(unsigned Slot) const { - return AttributeSet::get(Context, *getNode(Slot)); + AttributeList getSlotAttributes(unsigned Slot) const { + return AttributeList::get(Context, *getNode(Slot)); } /// \brief Retrieve the attribute set node for the given "slot" in the Index: llvm/trunk/lib/IR/AttributeSetNode.h =================================================================== --- llvm/trunk/lib/IR/AttributeSetNode.h +++ llvm/trunk/lib/IR/AttributeSetNode.h @@ -1,4 +1,5 @@ -//===-- AttributeSetNode.h - AttributeSet Internal Node ---------*- C++ -*-===// +//===-- AttributeSetNode.h - AttributeList Internal Node ---------*- C++ +//-*-===// // // The LLVM Compiler Infrastructure // @@ -8,7 +9,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file defines the node class used internally by AttributeSet. +/// \brief This file defines the node class used internally by AttributeList. /// //===----------------------------------------------------------------------===// @@ -65,11 +66,11 @@ static AttributeSetNode *get(LLVMContext &C, ArrayRef Attrs); - static AttributeSetNode *get(AttributeSet AS, unsigned Index) { + static AttributeSetNode *get(AttributeList AS, unsigned Index) { return AS.getAttributes(Index); } - /// \brief Return the number of attributes this AttributeSet contains. + /// \brief Return the number of attributes this AttributeList contains. unsigned getNumAttributes() const { return NumAttrs; } bool hasAttribute(Attribute::AttrKind Kind) const { Index: llvm/trunk/lib/IR/Attributes.cpp =================================================================== --- llvm/trunk/lib/IR/Attributes.cpp +++ llvm/trunk/lib/IR/Attributes.cpp @@ -9,7 +9,7 @@ // // \file // \brief This file implements the Attribute, AttributeImpl, AttrBuilder, -// AttributeSetImpl, and AttributeSet classes. +// AttributeListImpl, and AttributeList classes. // //===----------------------------------------------------------------------===// @@ -523,7 +523,7 @@ pImpl->AttrsSetNodes.InsertNode(PA, InsertPoint); } - // Return the AttributesListNode that we found or created. + // Return the AttributeSetNode that we found or created. return PA; } @@ -597,48 +597,49 @@ } //===----------------------------------------------------------------------===// -// AttributeSetImpl Definition +// AttributeListImpl Definition //===----------------------------------------------------------------------===// #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -LLVM_DUMP_METHOD void AttributeSetImpl::dump() const { - AttributeSet(const_cast(this)).dump(); +LLVM_DUMP_METHOD void AttributeListImpl::dump() const { + AttributeList(const_cast(this)).dump(); } #endif //===----------------------------------------------------------------------===// -// AttributeSet Construction and Mutation Methods +// AttributeList Construction and Mutation Methods //===----------------------------------------------------------------------===// -AttributeSet -AttributeSet::getImpl(LLVMContext &C, - ArrayRef> Attrs) { +AttributeList AttributeList::getImpl( + LLVMContext &C, ArrayRef> Attrs) { LLVMContextImpl *pImpl = C.pImpl; FoldingSetNodeID ID; - AttributeSetImpl::Profile(ID, Attrs); + AttributeListImpl::Profile(ID, Attrs); void *InsertPoint; - AttributeSetImpl *PA = pImpl->AttrsLists.FindNodeOrInsertPos(ID, InsertPoint); + AttributeListImpl *PA = + pImpl->AttrsLists.FindNodeOrInsertPos(ID, InsertPoint); // If we didn't find any existing attributes of the same shape then // create a new one and insert it. if (!PA) { - // Coallocate entries after the AttributeSetImpl itself. + // Coallocate entries after the AttributeListImpl itself. void *Mem = ::operator new( - AttributeSetImpl::totalSizeToAlloc(Attrs.size())); - PA = new (Mem) AttributeSetImpl(C, Attrs); + AttributeListImpl::totalSizeToAlloc(Attrs.size())); + PA = new (Mem) AttributeListImpl(C, Attrs); pImpl->AttrsLists.InsertNode(PA, InsertPoint); } // Return the AttributesList that we found or created. - return AttributeSet(PA); + return AttributeList(PA); } -AttributeSet AttributeSet::get(LLVMContext &C, - ArrayRef> Attrs) { +AttributeList +AttributeList::get(LLVMContext &C, + ArrayRef> Attrs) { // If there are no attributes then return a null AttributesList pointer. if (Attrs.empty()) - return AttributeSet(); + return AttributeList(); assert(std::is_sorted(Attrs.begin(), Attrs.end(), [](const std::pair &LHS, @@ -669,20 +670,20 @@ return getImpl(C, AttrPairVec); } -AttributeSet AttributeSet::get(LLVMContext &C, - ArrayRef> Attrs) { +AttributeList +AttributeList::get(LLVMContext &C, + ArrayRef> Attrs) { // If there are no attributes then return a null AttributesList pointer. if (Attrs.empty()) - return AttributeSet(); + return AttributeList(); return getImpl(C, Attrs); } -AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index, - const AttrBuilder &B) { +AttributeList AttributeList::get(LLVMContext &C, unsigned Index, + const AttrBuilder &B) { if (!B.hasAttributes()) - return AttributeSet(); + return AttributeList(); // Add target-independent attributes. SmallVector, 8> Attrs; @@ -725,28 +726,30 @@ return get(C, Attrs); } -AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index, - ArrayRef Kinds) { +AttributeList AttributeList::get(LLVMContext &C, unsigned Index, + ArrayRef Kinds) { SmallVector, 8> Attrs; for (Attribute::AttrKind K : Kinds) Attrs.emplace_back(Index, Attribute::get(C, K)); return get(C, Attrs); } -AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index, - ArrayRef Kinds) { +AttributeList AttributeList::get(LLVMContext &C, unsigned Index, + ArrayRef Kinds) { SmallVector, 8> Attrs; for (StringRef K : Kinds) Attrs.emplace_back(Index, Attribute::get(C, K)); return get(C, Attrs); } -AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef Attrs) { - if (Attrs.empty()) return AttributeSet(); +AttributeList AttributeList::get(LLVMContext &C, + ArrayRef Attrs) { + if (Attrs.empty()) + return AttributeList(); if (Attrs.size() == 1) return Attrs[0]; SmallVector, 8> AttrNodeVec; - AttributeSetImpl *A0 = Attrs[0].pImpl; + AttributeListImpl *A0 = Attrs[0].pImpl; if (A0) AttrNodeVec.append(A0->getNode(0), A0->getNode(A0->getNumSlots())); // Copy all attributes from Attrs into AttrNodeVec while keeping AttrNodeVec @@ -754,7 +757,7 @@ // index we only need to merge each successive list in rather than doing a // full sort. for (unsigned I = 1, E = Attrs.size(); I != E; ++I) { - AttributeSetImpl *AS = Attrs[I].pImpl; + AttributeListImpl *AS = Attrs[I].pImpl; if (!AS) continue; SmallVector, 8>::iterator ANVI = AttrNodeVec.begin(), ANVE; @@ -771,35 +774,36 @@ return getImpl(C, AttrNodeVec); } -AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index, - Attribute::AttrKind Kind) const { +AttributeList AttributeList::addAttribute(LLVMContext &C, unsigned Index, + Attribute::AttrKind Kind) const { if (hasAttribute(Index, Kind)) return *this; - return addAttributes(C, Index, AttributeSet::get(C, Index, Kind)); + return addAttributes(C, Index, AttributeList::get(C, Index, Kind)); } -AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index, - StringRef Kind, StringRef Value) const { +AttributeList AttributeList::addAttribute(LLVMContext &C, unsigned Index, + StringRef Kind, + StringRef Value) const { AttrBuilder B; B.addAttribute(Kind, Value); - return addAttributes(C, Index, AttributeSet::get(C, Index, B)); + return addAttributes(C, Index, AttributeList::get(C, Index, B)); } -AttributeSet AttributeSet::addAttribute(LLVMContext &C, - ArrayRef Indices, - Attribute A) const { +AttributeList AttributeList::addAttribute(LLVMContext &C, + ArrayRef Indices, + Attribute A) const { unsigned I = 0, E = pImpl ? pImpl->getNumSlots() : 0; auto IdxI = Indices.begin(), IdxE = Indices.end(); - SmallVector AttrSet; + SmallVector AttrSet; while (I != E && IdxI != IdxE) { if (getSlotIndex(I) < *IdxI) AttrSet.emplace_back(getSlotAttributes(I++)); else if (getSlotIndex(I) > *IdxI) - AttrSet.emplace_back(AttributeSet::get(C, std::make_pair(*IdxI++, A))); + AttrSet.emplace_back(AttributeList::get(C, std::make_pair(*IdxI++, A))); else { AttrBuilder B(getSlotAttributes(I), *IdxI); B.addAttribute(A); - AttrSet.emplace_back(AttributeSet::get(C, *IdxI, B)); + AttrSet.emplace_back(AttributeList::get(C, *IdxI, B)); ++I; ++IdxI; } @@ -809,13 +813,13 @@ AttrSet.emplace_back(getSlotAttributes(I++)); while (IdxI != IdxE) - AttrSet.emplace_back(AttributeSet::get(C, std::make_pair(*IdxI++, A))); + AttrSet.emplace_back(AttributeList::get(C, std::make_pair(*IdxI++, A))); return get(C, AttrSet); } -AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Index, - AttributeSet Attrs) const { +AttributeList AttributeList::addAttributes(LLVMContext &C, unsigned Index, + AttributeList Attrs) const { if (!pImpl) return Attrs; if (!Attrs.pImpl) return *this; @@ -829,9 +833,9 @@ #endif // Add the attribute slots before the one we're trying to add. - SmallVector AttrSet; + SmallVector AttrSet; uint64_t NumAttrs = pImpl->getNumSlots(); - AttributeSet AS; + AttributeList AS; uint64_t LastIndex = 0; for (unsigned I = 0, E = NumAttrs; I != E; ++I) { if (getSlotIndex(I) >= Index) { @@ -843,18 +847,19 @@ } // Now add the attribute into the correct slot. There may already be an - // AttributeSet there. + // AttributeList there. AttrBuilder B(AS, Index); for (unsigned I = 0, E = Attrs.pImpl->getNumSlots(); I != E; ++I) if (Attrs.getSlotIndex(I) == Index) { - for (AttributeSetImpl::iterator II = Attrs.pImpl->begin(I), - IE = Attrs.pImpl->end(I); II != IE; ++II) + for (AttributeListImpl::iterator II = Attrs.pImpl->begin(I), + IE = Attrs.pImpl->end(I); + II != IE; ++II) B.addAttribute(*II); break; } - AttrSet.push_back(AttributeSet::get(C, Index, B)); + AttrSet.push_back(AttributeList::get(C, Index, B)); // Add the remaining attribute slots. for (unsigned I = LastIndex, E = NumAttrs; I < E; ++I) @@ -863,21 +868,22 @@ return get(C, AttrSet); } -AttributeSet AttributeSet::removeAttribute(LLVMContext &C, unsigned Index, - Attribute::AttrKind Kind) const { +AttributeList AttributeList::removeAttribute(LLVMContext &C, unsigned Index, + Attribute::AttrKind Kind) const { if (!hasAttribute(Index, Kind)) return *this; - return removeAttributes(C, Index, AttributeSet::get(C, Index, Kind)); + return removeAttributes(C, Index, AttributeList::get(C, Index, Kind)); } -AttributeSet AttributeSet::removeAttribute(LLVMContext &C, unsigned Index, - StringRef Kind) const { +AttributeList AttributeList::removeAttribute(LLVMContext &C, unsigned Index, + StringRef Kind) const { if (!hasAttribute(Index, Kind)) return *this; - return removeAttributes(C, Index, AttributeSet::get(C, Index, Kind)); + return removeAttributes(C, Index, AttributeList::get(C, Index, Kind)); } -AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index, - AttributeSet Attrs) const { - if (!pImpl) return AttributeSet(); +AttributeList AttributeList::removeAttributes(LLVMContext &C, unsigned Index, + AttributeList Attrs) const { + if (!pImpl) + return AttributeList(); if (!Attrs.pImpl) return *this; // FIXME it is not obvious how this should work for alignment. @@ -886,9 +892,9 @@ "Attempt to change alignment!"); // Add the attribute slots before the one we're trying to add. - SmallVector AttrSet; + SmallVector AttrSet; uint64_t NumAttrs = pImpl->getNumSlots(); - AttributeSet AS; + AttributeList AS; uint64_t LastIndex = 0; for (unsigned I = 0, E = NumAttrs; I != E; ++I) { if (getSlotIndex(I) >= Index) { @@ -900,7 +906,7 @@ } // Now remove the attribute from the correct slot. There may already be an - // AttributeSet there. + // AttributeList there. AttrBuilder B(AS, Index); for (unsigned I = 0, E = Attrs.pImpl->getNumSlots(); I != E; ++I) @@ -909,7 +915,7 @@ break; } - AttrSet.push_back(AttributeSet::get(C, Index, B)); + AttrSet.push_back(AttributeList::get(C, Index, B)); // Add the remaining attribute slots. for (unsigned I = LastIndex, E = NumAttrs; I < E; ++I) @@ -918,18 +924,19 @@ return get(C, AttrSet); } -AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index, - const AttrBuilder &Attrs) const { - if (!pImpl) return AttributeSet(); +AttributeList AttributeList::removeAttributes(LLVMContext &C, unsigned Index, + const AttrBuilder &Attrs) const { + if (!pImpl) + return AttributeList(); // FIXME it is not obvious how this should work for alignment. // For now, say we can't pass in alignment, which no current use does. assert(!Attrs.hasAlignmentAttr() && "Attempt to change alignment!"); // Add the attribute slots before the one we're trying to add. - SmallVector AttrSet; + SmallVector AttrSet; uint64_t NumAttrs = pImpl->getNumSlots(); - AttributeSet AS; + AttributeList AS; uint64_t LastIndex = 0; for (unsigned I = 0, E = NumAttrs; I != E; ++I) { if (getSlotIndex(I) >= Index) { @@ -941,11 +948,11 @@ } // Now remove the attribute from the correct slot. There may already be an - // AttributeSet there. + // AttributeList there. AttrBuilder B(AS, Index); B.remove(Attrs); - AttrSet.push_back(AttributeSet::get(C, Index, B)); + AttrSet.push_back(AttributeList::get(C, Index, B)); // Add the remaining attribute slots. for (unsigned I = LastIndex, E = NumAttrs; I < E; ++I) @@ -954,94 +961,96 @@ return get(C, AttrSet); } -AttributeSet AttributeSet::addDereferenceableAttr(LLVMContext &C, unsigned Index, - uint64_t Bytes) const { +AttributeList AttributeList::addDereferenceableAttr(LLVMContext &C, + unsigned Index, + uint64_t Bytes) const { AttrBuilder B; B.addDereferenceableAttr(Bytes); - return addAttributes(C, Index, AttributeSet::get(C, Index, B)); + return addAttributes(C, Index, AttributeList::get(C, Index, B)); } -AttributeSet AttributeSet::addDereferenceableOrNullAttr(LLVMContext &C, - unsigned Index, - uint64_t Bytes) const { +AttributeList +AttributeList::addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, + uint64_t Bytes) const { AttrBuilder B; B.addDereferenceableOrNullAttr(Bytes); - return addAttributes(C, Index, AttributeSet::get(C, Index, B)); + return addAttributes(C, Index, AttributeList::get(C, Index, B)); } -AttributeSet -AttributeSet::addAllocSizeAttr(LLVMContext &C, unsigned Index, - unsigned ElemSizeArg, - const Optional &NumElemsArg) { +AttributeList +AttributeList::addAllocSizeAttr(LLVMContext &C, unsigned Index, + unsigned ElemSizeArg, + const Optional &NumElemsArg) { AttrBuilder B; B.addAllocSizeAttr(ElemSizeArg, NumElemsArg); - return addAttributes(C, Index, AttributeSet::get(C, Index, B)); + return addAttributes(C, Index, AttributeList::get(C, Index, B)); } //===----------------------------------------------------------------------===// -// AttributeSet Accessor Methods +// AttributeList Accessor Methods //===----------------------------------------------------------------------===// -LLVMContext &AttributeSet::getContext() const { - return pImpl->getContext(); -} +LLVMContext &AttributeList::getContext() const { return pImpl->getContext(); } -AttributeSet AttributeSet::getParamAttributes(unsigned Index) const { - return pImpl && hasAttributes(Index) ? - AttributeSet::get(pImpl->getContext(), - ArrayRef>( - std::make_pair(Index, getAttributes(Index)))) : - AttributeSet(); +AttributeList AttributeList::getParamAttributes(unsigned Index) const { + return pImpl && hasAttributes(Index) + ? AttributeList::get( + pImpl->getContext(), + ArrayRef>( + std::make_pair(Index, getAttributes(Index)))) + : AttributeList(); } -AttributeSet AttributeSet::getRetAttributes() const { - return pImpl && hasAttributes(ReturnIndex) ? - AttributeSet::get(pImpl->getContext(), - ArrayRef>( - std::make_pair(ReturnIndex, - getAttributes(ReturnIndex)))) : - AttributeSet(); +AttributeList AttributeList::getRetAttributes() const { + return pImpl && hasAttributes(ReturnIndex) + ? AttributeList::get( + pImpl->getContext(), + ArrayRef>( + std::make_pair(ReturnIndex, getAttributes(ReturnIndex)))) + : AttributeList(); } -AttributeSet AttributeSet::getFnAttributes() const { - return pImpl && hasAttributes(FunctionIndex) ? - AttributeSet::get(pImpl->getContext(), - ArrayRef>( - std::make_pair(FunctionIndex, - getAttributes(FunctionIndex)))) : - AttributeSet(); +AttributeList AttributeList::getFnAttributes() const { + return pImpl && hasAttributes(FunctionIndex) + ? AttributeList::get( + pImpl->getContext(), + ArrayRef>( + std::make_pair(FunctionIndex, + getAttributes(FunctionIndex)))) + : AttributeList(); } -bool AttributeSet::hasAttribute(unsigned Index, Attribute::AttrKind Kind) const{ +bool AttributeList::hasAttribute(unsigned Index, + Attribute::AttrKind Kind) const { AttributeSetNode *ASN = getAttributes(Index); return ASN && ASN->hasAttribute(Kind); } -bool AttributeSet::hasAttribute(unsigned Index, StringRef Kind) const { +bool AttributeList::hasAttribute(unsigned Index, StringRef Kind) const { AttributeSetNode *ASN = getAttributes(Index); return ASN && ASN->hasAttribute(Kind); } -bool AttributeSet::hasAttributes(unsigned Index) const { +bool AttributeList::hasAttributes(unsigned Index) const { AttributeSetNode *ASN = getAttributes(Index); return ASN && ASN->hasAttributes(); } -bool AttributeSet::hasFnAttribute(Attribute::AttrKind Kind) const { +bool AttributeList::hasFnAttribute(Attribute::AttrKind Kind) const { return pImpl && pImpl->hasFnAttribute(Kind); } -bool AttributeSet::hasFnAttribute(StringRef Kind) const { - return hasAttribute(AttributeSet::FunctionIndex, Kind); +bool AttributeList::hasFnAttribute(StringRef Kind) const { + return hasAttribute(AttributeList::FunctionIndex, Kind); } -bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr, - unsigned *Index) const { +bool AttributeList::hasAttrSomewhere(Attribute::AttrKind Attr, + unsigned *Index) const { if (!pImpl) return false; for (unsigned I = 0, E = pImpl->getNumSlots(); I != E; ++I) - for (AttributeSetImpl::iterator II = pImpl->begin(I), - IE = pImpl->end(I); II != IE; ++II) + for (AttributeListImpl::iterator II = pImpl->begin(I), IE = pImpl->end(I); + II != IE; ++II) if (II->hasAttribute(Attr)) { if (Index) *Index = pImpl->getSlotIndex(I); return true; @@ -1050,50 +1059,49 @@ return false; } -Attribute AttributeSet::getAttribute(unsigned Index, - Attribute::AttrKind Kind) const { +Attribute AttributeList::getAttribute(unsigned Index, + Attribute::AttrKind Kind) const { AttributeSetNode *ASN = getAttributes(Index); return ASN ? ASN->getAttribute(Kind) : Attribute(); } -Attribute AttributeSet::getAttribute(unsigned Index, - StringRef Kind) const { +Attribute AttributeList::getAttribute(unsigned Index, StringRef Kind) const { AttributeSetNode *ASN = getAttributes(Index); return ASN ? ASN->getAttribute(Kind) : Attribute(); } -unsigned AttributeSet::getParamAlignment(unsigned Index) const { +unsigned AttributeList::getParamAlignment(unsigned Index) const { AttributeSetNode *ASN = getAttributes(Index); return ASN ? ASN->getAlignment() : 0; } -unsigned AttributeSet::getStackAlignment(unsigned Index) const { +unsigned AttributeList::getStackAlignment(unsigned Index) const { AttributeSetNode *ASN = getAttributes(Index); return ASN ? ASN->getStackAlignment() : 0; } -uint64_t AttributeSet::getDereferenceableBytes(unsigned Index) const { +uint64_t AttributeList::getDereferenceableBytes(unsigned Index) const { AttributeSetNode *ASN = getAttributes(Index); return ASN ? ASN->getDereferenceableBytes() : 0; } -uint64_t AttributeSet::getDereferenceableOrNullBytes(unsigned Index) const { +uint64_t AttributeList::getDereferenceableOrNullBytes(unsigned Index) const { AttributeSetNode *ASN = getAttributes(Index); return ASN ? ASN->getDereferenceableOrNullBytes() : 0; } std::pair> -AttributeSet::getAllocSizeArgs(unsigned Index) const { +AttributeList::getAllocSizeArgs(unsigned Index) const { AttributeSetNode *ASN = getAttributes(Index); return ASN ? ASN->getAllocSizeArgs() : std::make_pair(0u, Optional(0u)); } -std::string AttributeSet::getAsString(unsigned Index, bool InAttrGrp) const { +std::string AttributeList::getAsString(unsigned Index, bool InAttrGrp) const { AttributeSetNode *ASN = getAttributes(Index); return ASN ? ASN->getAsString(InAttrGrp) : std::string(""); } -AttributeSetNode *AttributeSet::getAttributes(unsigned Index) const { +AttributeSetNode *AttributeList::getAttributes(unsigned Index) const { if (!pImpl) return nullptr; // Loop through to find the attribute node we want. @@ -1104,40 +1112,40 @@ return nullptr; } -AttributeSet::iterator AttributeSet::begin(unsigned Slot) const { +AttributeList::iterator AttributeList::begin(unsigned Slot) const { if (!pImpl) return ArrayRef().begin(); return pImpl->begin(Slot); } -AttributeSet::iterator AttributeSet::end(unsigned Slot) const { +AttributeList::iterator AttributeList::end(unsigned Slot) const { if (!pImpl) return ArrayRef().end(); return pImpl->end(Slot); } //===----------------------------------------------------------------------===// -// AttributeSet Introspection Methods +// AttributeList Introspection Methods //===----------------------------------------------------------------------===// -unsigned AttributeSet::getNumSlots() const { +unsigned AttributeList::getNumSlots() const { return pImpl ? pImpl->getNumSlots() : 0; } -unsigned AttributeSet::getSlotIndex(unsigned Slot) const { +unsigned AttributeList::getSlotIndex(unsigned Slot) const { assert(pImpl && Slot < pImpl->getNumSlots() && "Slot # out of range!"); return pImpl->getSlotIndex(Slot); } -AttributeSet AttributeSet::getSlotAttributes(unsigned Slot) const { +AttributeList AttributeList::getSlotAttributes(unsigned Slot) const { assert(pImpl && Slot < pImpl->getNumSlots() && "Slot # out of range!"); return pImpl->getSlotAttributes(Slot); } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -LLVM_DUMP_METHOD void AttributeSet::dump() const { +LLVM_DUMP_METHOD void AttributeList::dump() const { dbgs() << "PAL[\n"; for (unsigned i = 0, e = getNumSlots(); i < e; ++i) { @@ -1158,15 +1166,15 @@ // AttrBuilder Method Implementations //===----------------------------------------------------------------------===// -AttrBuilder::AttrBuilder(AttributeSet AS, unsigned Index) { - AttributeSetImpl *pImpl = AS.pImpl; +AttrBuilder::AttrBuilder(AttributeList AS, unsigned Index) { + AttributeListImpl *pImpl = AS.pImpl; if (!pImpl) return; for (unsigned I = 0, E = pImpl->getNumSlots(); I != E; ++I) { if (pImpl->getSlotIndex(I) != Index) continue; - for (AttributeSetImpl::iterator II = pImpl->begin(I), - IE = pImpl->end(I); II != IE; ++II) + for (AttributeListImpl::iterator II = pImpl->begin(I), IE = pImpl->end(I); + II != IE; ++II) addAttribute(*II); break; @@ -1234,7 +1242,7 @@ return *this; } -AttrBuilder &AttrBuilder::removeAttributes(AttributeSet A, uint64_t Index) { +AttrBuilder &AttrBuilder::removeAttributes(AttributeList A, uint64_t Index) { unsigned Slot = ~0U; for (unsigned I = 0, E = A.getNumSlots(); I != E; ++I) if (A.getSlotIndex(I) == Index) { @@ -1242,9 +1250,10 @@ break; } - assert(Slot != ~0U && "Couldn't find index in AttributeSet!"); + assert(Slot != ~0U && "Couldn't find index in AttributeList!"); - for (AttributeSet::iterator I = A.begin(Slot), E = A.end(Slot); I != E; ++I) { + for (AttributeList::iterator I = A.begin(Slot), E = A.end(Slot); I != E; + ++I) { Attribute Attr = *I; if (Attr.isEnumAttribute() || Attr.isIntAttribute()) { removeAttribute(Attr.getKindAsEnum()); @@ -1395,7 +1404,7 @@ return !Attrs.none() || !TargetDepAttrs.empty(); } -bool AttrBuilder::hasAttributes(AttributeSet A, uint64_t Index) const { +bool AttrBuilder::hasAttributes(AttributeList A, uint64_t Index) const { unsigned Slot = ~0U; for (unsigned I = 0, E = A.getNumSlots(); I != E; ++I) if (A.getSlotIndex(I) == Index) { @@ -1405,7 +1414,8 @@ assert(Slot != ~0U && "Couldn't find the index!"); - for (AttributeSet::iterator I = A.begin(Slot), E = A.end(Slot); I != E; ++I) { + for (AttributeList::iterator I = A.begin(Slot), E = A.end(Slot); I != E; + ++I) { Attribute Attr = *I; if (Attr.isEnumAttribute() || Attr.isIntAttribute()) { if (Attrs[I->getKindAsEnum()]) @@ -1506,16 +1516,15 @@ B.addAttribute(Attribute::StackProtect) .addAttribute(Attribute::StackProtectStrong) .addAttribute(Attribute::StackProtectReq); - AttributeSet OldSSPAttr = AttributeSet::get(Caller.getContext(), - AttributeSet::FunctionIndex, - B); + AttributeList OldSSPAttr = + AttributeList::get(Caller.getContext(), AttributeList::FunctionIndex, B); if (Callee.hasFnAttribute(Attribute::StackProtectReq)) { - Caller.removeAttributes(AttributeSet::FunctionIndex, OldSSPAttr); + Caller.removeAttributes(AttributeList::FunctionIndex, OldSSPAttr); Caller.addFnAttr(Attribute::StackProtectReq); } else if (Callee.hasFnAttribute(Attribute::StackProtectStrong) && !Caller.hasFnAttribute(Attribute::StackProtectReq)) { - Caller.removeAttributes(AttributeSet::FunctionIndex, OldSSPAttr); + Caller.removeAttributes(AttributeList::FunctionIndex, OldSSPAttr); Caller.addFnAttr(Attribute::StackProtectStrong); } else if (Callee.hasFnAttribute(Attribute::StackProtect) && !Caller.hasFnAttribute(Attribute::StackProtectReq) && Index: llvm/trunk/lib/IR/Core.cpp =================================================================== --- llvm/trunk/lib/IR/Core.cpp +++ llvm/trunk/lib/IR/Core.cpp @@ -1888,12 +1888,12 @@ void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A, const char *V) { Function *Func = unwrap(Fn); - AttributeSet::AttrIndex Idx = - AttributeSet::AttrIndex(AttributeSet::FunctionIndex); + AttributeList::AttrIndex Idx = + AttributeList::AttrIndex(AttributeList::FunctionIndex); AttrBuilder B; B.addAttribute(A, V); - AttributeSet Set = AttributeSet::get(Func->getContext(), Idx, B); + AttributeList Set = AttributeList::get(Func->getContext(), Idx, B); Func->addAttributes(Idx, Set); } @@ -1956,7 +1956,7 @@ Argument *A = unwrap(Arg); AttrBuilder B; B.addAlignmentAttr(align); - A->addAttr(AttributeSet::get(A->getContext(),A->getArgNo() + 1, B)); + A->addAttr(AttributeList::get(A->getContext(), A->getArgNo() + 1, B)); } /*--.. Operations on basic blocks ..........................................--*/ @@ -2165,10 +2165,9 @@ CallSite Call = CallSite(unwrap(Instr)); AttrBuilder B; B.addAlignmentAttr(align); - Call.setAttributes(Call.getAttributes() - .addAttributes(Call->getContext(), index, - AttributeSet::get(Call->getContext(), - index, B))); + Call.setAttributes(Call.getAttributes().addAttributes( + Call->getContext(), index, + AttributeList::get(Call->getContext(), index, B))); } void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, Index: llvm/trunk/lib/IR/Function.cpp =================================================================== --- llvm/trunk/lib/IR/Function.cpp +++ llvm/trunk/lib/IR/Function.cpp @@ -80,7 +80,7 @@ bool Argument::hasByValOrInAllocaAttr() const { if (!getType()->isPointerTy()) return false; - AttributeSet Attrs = getParent()->getAttributes(); + AttributeList Attrs = getParent()->getAttributes(); return Attrs.hasAttribute(getArgNo() + 1, Attribute::ByVal) || Attrs.hasAttribute(getArgNo() + 1, Attribute::InAlloca); } @@ -142,22 +142,22 @@ hasAttribute(getArgNo()+1, Attribute::ReadNone); } -void Argument::addAttr(AttributeSet AS) { +void Argument::addAttr(AttributeList AS) { assert(AS.getNumSlots() <= 1 && "Trying to add more than one attribute set to an argument!"); AttrBuilder B(AS, AS.getSlotIndex(0)); - getParent()->addAttributes(getArgNo() + 1, - AttributeSet::get(Parent->getContext(), - getArgNo() + 1, B)); + getParent()->addAttributes( + getArgNo() + 1, + AttributeList::get(Parent->getContext(), getArgNo() + 1, B)); } -void Argument::removeAttr(AttributeSet AS) { +void Argument::removeAttr(AttributeList AS) { assert(AS.getNumSlots() <= 1 && "Trying to remove more than one attribute set from an argument!"); AttrBuilder B(AS, AS.getSlotIndex(0)); - getParent()->removeAttributes(getArgNo() + 1, - AttributeSet::get(Parent->getContext(), - getArgNo() + 1, B)); + getParent()->removeAttributes( + getArgNo() + 1, + AttributeList::get(Parent->getContext(), getArgNo() + 1, B)); } bool Argument::hasAttribute(Attribute::AttrKind Kind) const { @@ -322,49 +322,49 @@ } void Function::addAttribute(unsigned i, Attribute::AttrKind Kind) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addAttribute(getContext(), i, Kind); setAttributes(PAL); } void Function::addAttribute(unsigned i, Attribute Attr) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addAttribute(getContext(), i, Attr); setAttributes(PAL); } -void Function::addAttributes(unsigned i, AttributeSet Attrs) { - AttributeSet PAL = getAttributes(); +void Function::addAttributes(unsigned i, AttributeList Attrs) { + AttributeList PAL = getAttributes(); PAL = PAL.addAttributes(getContext(), i, Attrs); setAttributes(PAL); } void Function::removeAttribute(unsigned i, Attribute::AttrKind Kind) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.removeAttribute(getContext(), i, Kind); setAttributes(PAL); } void Function::removeAttribute(unsigned i, StringRef Kind) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.removeAttribute(getContext(), i, Kind); setAttributes(PAL); } -void Function::removeAttributes(unsigned i, AttributeSet Attrs) { - AttributeSet PAL = getAttributes(); +void Function::removeAttributes(unsigned i, AttributeList Attrs) { + AttributeList PAL = getAttributes(); PAL = PAL.removeAttributes(getContext(), i, Attrs); setAttributes(PAL); } void Function::addDereferenceableAttr(unsigned i, uint64_t Bytes) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addDereferenceableAttr(getContext(), i, Bytes); setAttributes(PAL); } void Function::addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addDereferenceableOrNullAttr(getContext(), i, Bytes); setAttributes(PAL); } Index: llvm/trunk/lib/IR/Instructions.cpp =================================================================== --- llvm/trunk/lib/IR/Instructions.cpp +++ llvm/trunk/lib/IR/Instructions.cpp @@ -307,7 +307,7 @@ : Instruction(CI.getType(), Instruction::Call, OperandTraits::op_end(this) - CI.getNumOperands(), CI.getNumOperands()), - AttributeList(CI.AttributeList), FTy(CI.FTy) { + Attrs(CI.Attrs), FTy(CI.FTy) { setTailCallKind(CI.getTailCallKind()); setCallingConv(CI.getCallingConv()); @@ -334,7 +334,7 @@ Value *CallInst::getReturnedArgOperand() const { unsigned Index; - if (AttributeList.hasAttrSomewhere(Attribute::Returned, &Index) && Index) + if (Attrs.hasAttrSomewhere(Attribute::Returned, &Index) && Index) return getArgOperand(Index-1); if (const Function *F = getCalledFunction()) if (F->getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) && @@ -345,37 +345,37 @@ } void CallInst::addAttribute(unsigned i, Attribute::AttrKind Kind) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addAttribute(getContext(), i, Kind); setAttributes(PAL); } void CallInst::addAttribute(unsigned i, Attribute Attr) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addAttribute(getContext(), i, Attr); setAttributes(PAL); } void CallInst::removeAttribute(unsigned i, Attribute::AttrKind Kind) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.removeAttribute(getContext(), i, Kind); setAttributes(PAL); } void CallInst::removeAttribute(unsigned i, StringRef Kind) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.removeAttribute(getContext(), i, Kind); setAttributes(PAL); } void CallInst::addDereferenceableAttr(unsigned i, uint64_t Bytes) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addDereferenceableAttr(getContext(), i, Bytes); setAttributes(PAL); } void CallInst::addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addDereferenceableOrNullAttr(getContext(), i, Bytes); setAttributes(PAL); } @@ -383,7 +383,7 @@ bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind Kind) const { assert(i < (getNumArgOperands() + 1) && "Param index out of bounds!"); - if (AttributeList.hasAttribute(i, Kind)) + if (Attrs.hasAttribute(i, Kind)) return true; if (const Function *F = getCalledFunction()) return F->getAttributes().hasAttribute(i, Kind); @@ -646,7 +646,7 @@ OperandTraits::op_end(this) - II.getNumOperands(), II.getNumOperands()), - AttributeList(II.AttributeList), FTy(II.FTy) { + Attrs(II.Attrs), FTy(II.FTy) { setCallingConv(II.getCallingConv()); std::copy(II.op_begin(), II.op_end(), op_begin()); std::copy(II.bundle_op_info_begin(), II.bundle_op_info_end(), @@ -681,7 +681,7 @@ Value *InvokeInst::getReturnedArgOperand() const { unsigned Index; - if (AttributeList.hasAttrSomewhere(Attribute::Returned, &Index) && Index) + if (Attrs.hasAttrSomewhere(Attribute::Returned, &Index) && Index) return getArgOperand(Index-1); if (const Function *F = getCalledFunction()) if (F->getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) && @@ -694,7 +694,7 @@ bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrKind Kind) const { assert(i < (getNumArgOperands() + 1) && "Param index out of bounds!"); - if (AttributeList.hasAttribute(i, Kind)) + if (Attrs.hasAttribute(i, Kind)) return true; if (const Function *F = getCalledFunction()) return F->getAttributes().hasAttribute(i, Kind); @@ -720,37 +720,37 @@ } void InvokeInst::addAttribute(unsigned i, Attribute::AttrKind Kind) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addAttribute(getContext(), i, Kind); setAttributes(PAL); } void InvokeInst::addAttribute(unsigned i, Attribute Attr) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addAttribute(getContext(), i, Attr); setAttributes(PAL); } void InvokeInst::removeAttribute(unsigned i, Attribute::AttrKind Kind) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.removeAttribute(getContext(), i, Kind); setAttributes(PAL); } void InvokeInst::removeAttribute(unsigned i, StringRef Kind) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.removeAttribute(getContext(), i, Kind); setAttributes(PAL); } void InvokeInst::addDereferenceableAttr(unsigned i, uint64_t Bytes) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addDereferenceableAttr(getContext(), i, Bytes); setAttributes(PAL); } void InvokeInst::addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes) { - AttributeSet PAL = getAttributes(); + AttributeList PAL = getAttributes(); PAL = PAL.addDereferenceableOrNullAttr(getContext(), i, Bytes); setAttributes(PAL); } Index: llvm/trunk/lib/IR/LLVMContextImpl.h =================================================================== --- llvm/trunk/lib/IR/LLVMContextImpl.h +++ llvm/trunk/lib/IR/LLVMContextImpl.h @@ -1119,7 +1119,7 @@ FPMapTy FPConstants; FoldingSet AttrsSet; - FoldingSet AttrsLists; + FoldingSet AttrsLists; FoldingSet AttrsSetNodes; StringMap MDStringCache; Index: llvm/trunk/lib/IR/LLVMContextImpl.cpp =================================================================== --- llvm/trunk/lib/IR/LLVMContextImpl.cpp +++ llvm/trunk/lib/IR/LLVMContextImpl.cpp @@ -114,9 +114,10 @@ } // Destroy attribute lists. - for (FoldingSetIterator I = AttrsLists.begin(), - E = AttrsLists.end(); I != E; ) { - FoldingSetIterator Elem = I++; + for (FoldingSetIterator I = AttrsLists.begin(), + E = AttrsLists.end(); + I != E;) { + FoldingSetIterator Elem = I++; delete &*Elem; } Index: llvm/trunk/lib/IR/Module.cpp =================================================================== --- llvm/trunk/lib/IR/Module.cpp +++ llvm/trunk/lib/IR/Module.cpp @@ -120,9 +120,8 @@ // it. This is nice because it allows most passes to get away with not handling // the symbol table directly for this common task. // -Constant *Module::getOrInsertFunction(StringRef Name, - FunctionType *Ty, - AttributeSet AttributeList) { +Constant *Module::getOrInsertFunction(StringRef Name, FunctionType *Ty, + AttributeList AttributeList) { // See if we have a definition for the specified function already. GlobalValue *F = getNamedValue(Name); if (!F) { @@ -145,7 +144,7 @@ Constant *Module::getOrInsertFunction(StringRef Name, FunctionType *Ty) { - return getOrInsertFunction(Name, Ty, AttributeSet()); + return getOrInsertFunction(Name, Ty, AttributeList()); } // getOrInsertFunction - Look up the specified function in the module symbol @@ -154,8 +153,8 @@ // arguments, which makes it easier for clients to use. // Constant *Module::getOrInsertFunction(StringRef Name, - AttributeSet AttributeList, - Type *RetTy, ...) { + AttributeList AttributeList, Type *RetTy, + ...) { va_list Args; va_start(Args, RetTy); @@ -185,9 +184,8 @@ va_end(Args); // Build the function type and chain to the other getOrInsertFunction... - return getOrInsertFunction(Name, - FunctionType::get(RetTy, ArgTys, false), - AttributeSet()); + return getOrInsertFunction(Name, FunctionType::get(RetTy, ArgTys, false), + AttributeList()); } // getFunction - Look up the specified function in the module symbol table. Index: llvm/trunk/lib/IR/Statepoint.cpp =================================================================== --- llvm/trunk/lib/IR/Statepoint.cpp +++ llvm/trunk/lib/IR/Statepoint.cpp @@ -53,18 +53,19 @@ Attr.hasAttribute("statepoint-num-patch-bytes"); } -StatepointDirectives llvm::parseStatepointDirectivesFromAttrs(AttributeSet AS) { +StatepointDirectives +llvm::parseStatepointDirectivesFromAttrs(AttributeList AS) { StatepointDirectives Result; Attribute AttrID = - AS.getAttribute(AttributeSet::FunctionIndex, "statepoint-id"); + AS.getAttribute(AttributeList::FunctionIndex, "statepoint-id"); uint64_t StatepointID; if (AttrID.isStringAttribute()) if (!AttrID.getValueAsString().getAsInteger(10, StatepointID)) Result.StatepointID = StatepointID; uint32_t NumPatchBytes; - Attribute AttrNumPatchBytes = AS.getAttribute(AttributeSet::FunctionIndex, + Attribute AttrNumPatchBytes = AS.getAttribute(AttributeList::FunctionIndex, "statepoint-num-patch-bytes"); if (AttrNumPatchBytes.isStringAttribute()) if (!AttrNumPatchBytes.getValueAsString().getAsInteger(10, NumPatchBytes)) Index: llvm/trunk/lib/IR/Value.cpp =================================================================== --- llvm/trunk/lib/IR/Value.cpp +++ llvm/trunk/lib/IR/Value.cpp @@ -633,7 +633,7 @@ Align = DL.getPrefTypeAlignment(AllocatedType); } } else if (auto CS = ImmutableCallSite(this)) - Align = CS.getAttributes().getParamAlignment(AttributeSet::ReturnIndex); + Align = CS.getAttributes().getParamAlignment(AttributeList::ReturnIndex); else if (const LoadInst *LI = dyn_cast(this)) if (MDNode *MD = LI->getMetadata(LLVMContext::MD_align)) { ConstantInt *CI = mdconst::extract(MD->getOperand(0)); Index: llvm/trunk/lib/IR/Verifier.cpp =================================================================== --- llvm/trunk/lib/IR/Verifier.cpp +++ llvm/trunk/lib/IR/Verifier.cpp @@ -489,12 +489,12 @@ void verifyMustTailCall(CallInst &CI); bool performTypeCheck(Intrinsic::ID ID, Function *F, Type *Ty, int VT, unsigned ArgNo, std::string &Suffix); - bool verifyAttributeCount(AttributeSet Attrs, unsigned Params); - void verifyAttributeTypes(AttributeSet Attrs, unsigned Idx, bool isFunction, + bool verifyAttributeCount(AttributeList Attrs, unsigned Params); + void verifyAttributeTypes(AttributeList Attrs, unsigned Idx, bool isFunction, const Value *V); - void verifyParameterAttrs(AttributeSet Attrs, unsigned Idx, Type *Ty, + void verifyParameterAttrs(AttributeList Attrs, unsigned Idx, Type *Ty, bool isReturnValue, const Value *V); - void verifyFunctionAttrs(FunctionType *FT, AttributeSet Attrs, + void verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs, const Value *V); void verifyFunctionMetadata(ArrayRef> MDs); @@ -1331,7 +1331,7 @@ } } -void Verifier::verifyAttributeTypes(AttributeSet Attrs, unsigned Idx, +void Verifier::verifyAttributeTypes(AttributeList Attrs, unsigned Idx, bool isFunction, const Value *V) { unsigned Slot = ~0U; for (unsigned I = 0, E = Attrs.getNumSlots(); I != E; ++I) @@ -1342,8 +1342,8 @@ assert(Slot != ~0U && "Attribute set inconsistency!"); - for (AttributeSet::iterator I = Attrs.begin(Slot), E = Attrs.end(Slot); - I != E; ++I) { + for (AttributeList::iterator I = Attrs.begin(Slot), E = Attrs.end(Slot); + I != E; ++I) { if (I->isStringAttribute()) continue; @@ -1403,7 +1403,7 @@ // VerifyParameterAttrs - Check the given attributes for an argument or return // value of the specified type. The value V is printed in error messages. -void Verifier::verifyParameterAttrs(AttributeSet Attrs, unsigned Idx, Type *Ty, +void Verifier::verifyParameterAttrs(AttributeList Attrs, unsigned Idx, Type *Ty, bool isReturnValue, const Value *V) { if (!Attrs.hasAttributes(Idx)) return; @@ -1481,7 +1481,7 @@ Assert( !AttrBuilder(Attrs, Idx).overlaps(AttributeFuncs::typeIncompatible(Ty)), "Wrong types for attribute: " + - AttributeSet::get(Context, Idx, AttributeFuncs::typeIncompatible(Ty)) + AttributeList::get(Context, Idx, AttributeFuncs::typeIncompatible(Ty)) .getAsString(Idx), V); @@ -1511,7 +1511,7 @@ // Check parameter attributes against a function type. // The value V is printed in error messages. -void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeSet Attrs, +void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs, const Value *V) { if (Attrs.isEmpty()) return; @@ -1577,67 +1577,70 @@ } } - if (!Attrs.hasAttributes(AttributeSet::FunctionIndex)) + if (!Attrs.hasAttributes(AttributeList::FunctionIndex)) return; - verifyAttributeTypes(Attrs, AttributeSet::FunctionIndex, true, V); + verifyAttributeTypes(Attrs, AttributeList::FunctionIndex, true, V); Assert( - !(Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone) && - Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::ReadOnly)), + !(Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::ReadNone) && + Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::ReadOnly)), "Attributes 'readnone and readonly' are incompatible!", V); Assert( - !(Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone) && - Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::WriteOnly)), + !(Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::ReadNone) && + Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::WriteOnly)), "Attributes 'readnone and writeonly' are incompatible!", V); Assert( - !(Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::ReadOnly) && - Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::WriteOnly)), + !(Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::ReadOnly) && + Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::WriteOnly)), "Attributes 'readonly and writeonly' are incompatible!", V); Assert( - !(Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone) && - Attrs.hasAttribute(AttributeSet::FunctionIndex, + !(Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::ReadNone) && + Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::InaccessibleMemOrArgMemOnly)), - "Attributes 'readnone and inaccessiblemem_or_argmemonly' are incompatible!", V); + "Attributes 'readnone and inaccessiblemem_or_argmemonly' are " + "incompatible!", + V); Assert( - !(Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone) && - Attrs.hasAttribute(AttributeSet::FunctionIndex, + !(Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::ReadNone) && + Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::InaccessibleMemOnly)), "Attributes 'readnone and inaccessiblememonly' are incompatible!", V); Assert( - !(Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::NoInline) && - Attrs.hasAttribute(AttributeSet::FunctionIndex, + !(Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::NoInline) && + Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::AlwaysInline)), "Attributes 'noinline and alwaysinline' are incompatible!", V); - if (Attrs.hasAttribute(AttributeSet::FunctionIndex, + if (Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::OptimizeNone)) { - Assert(Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::NoInline), - "Attribute 'optnone' requires 'noinline'!", V); + Assert( + Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::NoInline), + "Attribute 'optnone' requires 'noinline'!", V); - Assert(!Attrs.hasAttribute(AttributeSet::FunctionIndex, + Assert(!Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::OptimizeForSize), "Attributes 'optsize and optnone' are incompatible!", V); - Assert(!Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::MinSize), - "Attributes 'minsize and optnone' are incompatible!", V); + Assert( + !Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::MinSize), + "Attributes 'minsize and optnone' are incompatible!", V); } - if (Attrs.hasAttribute(AttributeSet::FunctionIndex, - Attribute::JumpTable)) { + if (Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::JumpTable)) { const GlobalValue *GV = cast(V); Assert(GV->hasGlobalUnnamedAddr(), "Attribute 'jumptable' requires 'unnamed_addr'", V); } - if (Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::AllocSize)) { + if (Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::AllocSize)) { std::pair> Args = - Attrs.getAllocSizeArgs(AttributeSet::FunctionIndex); + Attrs.getAllocSizeArgs(AttributeList::FunctionIndex); auto CheckParam = [&](StringRef Name, unsigned ParamNo) { if (ParamNo >= FT->getNumParams()) { @@ -1744,15 +1747,15 @@ } } -bool Verifier::verifyAttributeCount(AttributeSet Attrs, unsigned Params) { +bool Verifier::verifyAttributeCount(AttributeList Attrs, unsigned Params) { if (Attrs.getNumSlots() == 0) return true; unsigned LastSlot = Attrs.getNumSlots() - 1; unsigned LastIndex = Attrs.getSlotIndex(LastSlot); - if (LastIndex <= Params - || (LastIndex == AttributeSet::FunctionIndex - && (LastSlot == 0 || Attrs.getSlotIndex(LastSlot - 1) <= Params))) + if (LastIndex <= Params || + (LastIndex == AttributeList::FunctionIndex && + (LastSlot == 0 || Attrs.getSlotIndex(LastSlot - 1) <= Params))) return true; return false; @@ -1982,7 +1985,7 @@ Assert(!F.hasStructRetAttr() || F.getReturnType()->isVoidTy(), "Invalid struct return type!", &F); - AttributeSet Attrs = F.getAttributes(); + AttributeList Attrs = F.getAttributes(); Assert(verifyAttributeCount(Attrs, FT->getNumParams()), "Attribute after last parameter!", &F); @@ -1993,7 +1996,7 @@ // On function declarations/definitions, we do not support the builtin // attribute. We do not check this in VerifyFunctionAttrs since that is // checking for Attributes that can/can not ever be on functions. - Assert(!Attrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::Builtin), + Assert(!Attrs.hasAttribute(AttributeList::FunctionIndex, Attribute::Builtin), "Attribute 'builtin' can only be applied to a callsite.", &F); // Check that this function meets the restrictions on this calling convention. @@ -2619,7 +2622,7 @@ "Call parameter type does not match function signature!", CS.getArgument(i), FTy->getParamType(i), I); - AttributeSet Attrs = CS.getAttributes(); + AttributeList Attrs = CS.getAttributes(); Assert(verifyAttributeCount(Attrs, CS.arg_size()), "Attribute after last parameter!", I); @@ -2763,7 +2766,7 @@ return PL->getAddressSpace() == PR->getAddressSpace(); } -static AttrBuilder getParameterABIAttributes(int I, AttributeSet Attrs) { +static AttrBuilder getParameterABIAttributes(int I, AttributeList Attrs) { static const Attribute::AttrKind ABIAttrs[] = { Attribute::StructRet, Attribute::ByVal, Attribute::InAlloca, Attribute::InReg, Attribute::Returned, Attribute::SwiftSelf, @@ -2805,8 +2808,8 @@ // - All ABI-impacting function attributes, such as sret, byval, inreg, // returned, and inalloca, must match. - AttributeSet CallerAttrs = F->getAttributes(); - AttributeSet CalleeAttrs = CI.getAttributes(); + AttributeList CallerAttrs = F->getAttributes(); + AttributeList CalleeAttrs = CI.getAttributes(); for (int I = 0, E = CallerTy->getNumParams(); I != E; ++I) { AttrBuilder CallerABIAttrs = getParameterABIAttributes(I, CallerAttrs); AttrBuilder CalleeABIAttrs = getParameterABIAttributes(I, CalleeAttrs); Index: llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp +++ llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp @@ -219,7 +219,7 @@ auto &DL = F.getParent()->getDataLayout(); ArgInfo OrigArg{VReg, Val->getType()}; - setArgFlags(OrigArg, AttributeSet::ReturnIndex, DL, F); + setArgFlags(OrigArg, AttributeList::ReturnIndex, DL, F); SmallVector SplitArgs; splitToValueTypes(OrigArg, SplitArgs, DL, MRI, Index: llvm/trunk/lib/Target/AArch64/AArch64FrameLowering.cpp =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64FrameLowering.cpp +++ llvm/trunk/lib/Target/AArch64/AArch64FrameLowering.cpp @@ -883,7 +883,7 @@ static bool produceCompactUnwindFrame(MachineFunction &MF) { const AArch64Subtarget &Subtarget = MF.getSubtarget(); - AttributeSet Attrs = MF.getFunction()->getAttributes(); + AttributeList Attrs = MF.getFunction()->getAttributes(); return Subtarget.isTargetMachO() && !(Subtarget.getTargetLowering()->supportSwiftError() && Attrs.hasAttrSomewhere(Attribute::SwiftError)); Index: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.h =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.h +++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.h @@ -402,7 +402,7 @@ return AArch64::X1; } - bool isIntDivCheap(EVT VT, AttributeSet Attr) const override; + bool isIntDivCheap(EVT VT, AttributeList Attr) const override; bool isCheapToSpeculateCttz() const override { return true; Index: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp +++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -7762,7 +7762,7 @@ AArch64TargetLowering::BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG, std::vector *Created) const { - AttributeSet Attr = DAG.getMachineFunction().getFunction()->getAttributes(); + AttributeList Attr = DAG.getMachineFunction().getFunction()->getAttributes(); if (isIntDivCheap(N->getValueType(0), Attr)) return SDValue(N,0); // Lower SDIV as SDIV @@ -10794,7 +10794,7 @@ } } -bool AArch64TargetLowering::isIntDivCheap(EVT VT, AttributeSet Attr) const { +bool AArch64TargetLowering::isIntDivCheap(EVT VT, AttributeList Attr) const { // Integer division on AArch64 is expensive. However, when aggressively // optimizing for code size, we prefer to use a div instruction, as it is // usually smaller than the alternative sequence. @@ -10803,7 +10803,7 @@ // size, because it will have to be scalarized, while the alternative code // sequence can be performed in vector form. bool OptSize = - Attr.hasAttribute(AttributeSet::FunctionIndex, Attribute::MinSize); + Attr.hasAttribute(AttributeList::FunctionIndex, Attribute::MinSize); return OptSize && !VT.isVector(); } Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUIntrinsicInfo.cpp =================================================================== --- llvm/trunk/lib/Target/AMDGPU/AMDGPUIntrinsicInfo.cpp +++ llvm/trunk/lib/Target/AMDGPU/AMDGPUIntrinsicInfo.cpp @@ -90,8 +90,8 @@ Function *F = cast(M->getOrInsertFunction(getName(IntrID, Tys), FTy)); - AttributeSet AS = getAttributes(M->getContext(), - static_cast(IntrID)); + AttributeList AS = + getAttributes(M->getContext(), static_cast(IntrID)); F->setAttributes(AS); return F; } Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp =================================================================== --- llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp +++ llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp @@ -309,11 +309,11 @@ = Intrinsic::getDeclaration(Mod, Intrinsic::amdgcn_dispatch_ptr); CallInst *DispatchPtr = Builder.CreateCall(DispatchPtrFn, {}); - DispatchPtr->addAttribute(AttributeSet::ReturnIndex, Attribute::NoAlias); - DispatchPtr->addAttribute(AttributeSet::ReturnIndex, Attribute::NonNull); + DispatchPtr->addAttribute(AttributeList::ReturnIndex, Attribute::NoAlias); + DispatchPtr->addAttribute(AttributeList::ReturnIndex, Attribute::NonNull); // Size of the dispatch packet struct. - DispatchPtr->addDereferenceableAttr(AttributeSet::ReturnIndex, 64); + DispatchPtr->addDereferenceableAttr(AttributeList::ReturnIndex, 64); Type *I32Ty = Type::getInt32Ty(Mod->getContext()); Value *CastDispatchPtr = Builder.CreateBitCast( Index: llvm/trunk/lib/Target/ARM/ARMCallLowering.cpp =================================================================== --- llvm/trunk/lib/Target/ARM/ARMCallLowering.cpp +++ llvm/trunk/lib/Target/ARM/ARMCallLowering.cpp @@ -185,7 +185,7 @@ SmallVector SplitVTs; ArgInfo RetInfo(VReg, Val->getType()); - setArgFlags(RetInfo, AttributeSet::ReturnIndex, DL, F); + setArgFlags(RetInfo, AttributeList::ReturnIndex, DL, F); splitToValueTypes(RetInfo, SplitVTs, DL, MF.getRegInfo()); CCAssignFn *AssignFn = Index: llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp =================================================================== --- llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp +++ llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp @@ -1381,7 +1381,7 @@ // Don't emit the ret/reti instruction when the naked attribute is present in // the function being compiled. if (MF.getFunction()->getAttributes().hasAttribute( - AttributeSet::FunctionIndex, Attribute::Naked)) { + AttributeList::FunctionIndex, Attribute::Naked)) { return Chain; } Index: llvm/trunk/lib/Target/Hexagon/HexagonBitTracker.cpp =================================================================== --- llvm/trunk/lib/Target/Hexagon/HexagonBitTracker.cpp +++ llvm/trunk/lib/Target/Hexagon/HexagonBitTracker.cpp @@ -74,7 +74,7 @@ // Module::AnyPointerSize. if (Width == 0 || Width > 64) break; - AttributeSet Attrs = F.getAttributes(); + AttributeList Attrs = F.getAttributes(); if (Attrs.hasAttribute(AttrIdx, Attribute::ByVal)) continue; InPhysReg = getNextPhysReg(InPhysReg, Width); Index: llvm/trunk/lib/Target/Hexagon/HexagonTargetMachine.cpp =================================================================== --- llvm/trunk/lib/Target/Hexagon/HexagonTargetMachine.cpp +++ llvm/trunk/lib/Target/Hexagon/HexagonTargetMachine.cpp @@ -176,11 +176,11 @@ const HexagonSubtarget * HexagonTargetMachine::getSubtargetImpl(const Function &F) const { - AttributeSet FnAttrs = F.getAttributes(); + AttributeList FnAttrs = F.getAttributes(); Attribute CPUAttr = - FnAttrs.getAttribute(AttributeSet::FunctionIndex, "target-cpu"); + FnAttrs.getAttribute(AttributeList::FunctionIndex, "target-cpu"); Attribute FSAttr = - FnAttrs.getAttribute(AttributeSet::FunctionIndex, "target-features"); + FnAttrs.getAttribute(AttributeList::FunctionIndex, "target-features"); std::string CPU = !CPUAttr.hasAttribute(Attribute::None) ? CPUAttr.getValueAsString().str() Index: llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp =================================================================== --- llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp +++ llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp @@ -405,7 +405,7 @@ "__mips16_ret_dc" }; const char *Name = Helper[RV]; - AttributeSet A; + AttributeList A; Value *Params[] = {RVal}; Modified = true; // @@ -414,11 +414,11 @@ // during call setup, the proper call lowering to the helper // functions will take place. // - A = A.addAttribute(C, AttributeSet::FunctionIndex, + A = A.addAttribute(C, AttributeList::FunctionIndex, "__Mips16RetHelper"); - A = A.addAttribute(C, AttributeSet::FunctionIndex, + A = A.addAttribute(C, AttributeList::FunctionIndex, Attribute::ReadNone); - A = A.addAttribute(C, AttributeSet::FunctionIndex, + A = A.addAttribute(C, AttributeList::FunctionIndex, Attribute::NoInline); Value *F = (M->getOrInsertFunction(Name, A, MyVoid, T, nullptr)); CallInst::Create(F, Params, "", &I); @@ -490,15 +490,15 @@ // remove the use-soft-float attribute // static void removeUseSoftFloat(Function &F) { - AttributeSet A; + AttributeList A; DEBUG(errs() << "removing -use-soft-float\n"); - A = A.addAttribute(F.getContext(), AttributeSet::FunctionIndex, + A = A.addAttribute(F.getContext(), AttributeList::FunctionIndex, "use-soft-float", "false"); - F.removeAttributes(AttributeSet::FunctionIndex, A); + F.removeAttributes(AttributeList::FunctionIndex, A); if (F.hasFnAttribute("use-soft-float")) { DEBUG(errs() << "still has -use-soft-float\n"); } - F.addAttributes(AttributeSet::FunctionIndex, A); + F.addAttributes(AttributeList::FunctionIndex, A); } Index: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp =================================================================== --- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -1493,7 +1493,7 @@ void NVPTXAsmPrinter::emitFunctionParamList(const Function *F, raw_ostream &O) { const DataLayout &DL = getDataLayout(); - const AttributeSet &PAL = F->getAttributes(); + const AttributeList &PAL = F->getAttributes(); const TargetLowering *TLI = nvptxSubtarget->getTargetLowering(); Function::const_arg_iterator I, E; unsigned paramIndex = 0; Index: llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp =================================================================== --- llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp +++ llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp @@ -2315,7 +2315,7 @@ auto PtrVT = getPointerTy(DAG.getDataLayout()); const Function *F = MF.getFunction(); - const AttributeSet &PAL = F->getAttributes(); + const AttributeList &PAL = F->getAttributes(); const TargetLowering *TLI = STI.getTargetLowering(); SDValue Root = DAG.getRoot(); Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyFastISel.cpp =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyFastISel.cpp +++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyFastISel.cpp @@ -596,7 +596,7 @@ unsigned i = 0; for (auto const &Arg : F->args()) { - const AttributeSet &Attrs = F->getAttributes(); + const AttributeList &Attrs = F->getAttributes(); if (Attrs.hasAttribute(i+1, Attribute::ByVal) || Attrs.hasAttribute(i+1, Attribute::SwiftSelf) || Attrs.hasAttribute(i+1, Attribute::SwiftError) || @@ -746,7 +746,7 @@ if (ArgTy == MVT::INVALID_SIMPLE_VALUE_TYPE) return false; - const AttributeSet &Attrs = Call->getAttributes(); + const AttributeList &Attrs = Call->getAttributes(); if (Attrs.hasAttribute(i+1, Attribute::ByVal) || Attrs.hasAttribute(i+1, Attribute::SwiftSelf) || Attrs.hasAttribute(i+1, Attribute::SwiftError) || Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.h =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.h +++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.h @@ -58,7 +58,7 @@ unsigned AS) const override; bool allowsMisalignedMemoryAccesses(EVT, unsigned AddrSpace, unsigned Align, bool *Fast) const override; - bool isIntDivCheap(EVT VT, AttributeSet Attr) const override; + bool isIntDivCheap(EVT VT, AttributeList Attr) const override; SDValue LowerCall(CallLoweringInfo &CLI, SmallVectorImpl &InVals) const override; Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -258,7 +258,8 @@ return true; } -bool WebAssemblyTargetLowering::isIntDivCheap(EVT VT, AttributeSet Attr) const { +bool WebAssemblyTargetLowering::isIntDivCheap(EVT VT, + AttributeList Attr) const { // The current thinking is that wasm engines will perform this optimization, // so we can save on code size. return true; Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp +++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp @@ -412,7 +412,7 @@ if (CI->doesNotReturn()) { if (auto *F = dyn_cast(CI->getCalledValue())) F->removeFnAttr(Attribute::NoReturn); - CI->removeAttribute(AttributeSet::FunctionIndex, Attribute::NoReturn); + CI->removeAttribute(AttributeList::FunctionIndex, Attribute::NoReturn); } IRBuilder<> IRB(C); @@ -435,24 +435,25 @@ // Because we added the pointer to the callee as first argument, all // argument attribute indices have to be incremented by one. - SmallVector AttributesVec; - const AttributeSet &InvokePAL = CI->getAttributes(); + SmallVector AttributesVec; + const AttributeList &InvokePAL = CI->getAttributes(); CallSite::arg_iterator AI = CI->arg_begin(); unsigned i = 1; // Argument attribute index starts from 1 for (unsigned e = CI->getNumArgOperands(); i <= e; ++AI, ++i) { if (InvokePAL.hasAttributes(i)) { AttrBuilder B(InvokePAL, i); - AttributesVec.push_back(AttributeSet::get(C, i + 1, B)); + AttributesVec.push_back(AttributeList::get(C, i + 1, B)); } } // Add any return attributes. - if (InvokePAL.hasAttributes(AttributeSet::ReturnIndex)) - AttributesVec.push_back(AttributeSet::get(C, InvokePAL.getRetAttributes())); + if (InvokePAL.hasAttributes(AttributeList::ReturnIndex)) + AttributesVec.push_back( + AttributeList::get(C, InvokePAL.getRetAttributes())); // Add any function attributes. - if (InvokePAL.hasAttributes(AttributeSet::FunctionIndex)) - AttributesVec.push_back(AttributeSet::get(C, InvokePAL.getFnAttributes())); + if (InvokePAL.hasAttributes(AttributeList::FunctionIndex)) + AttributesVec.push_back(AttributeList::get(C, InvokePAL.getFnAttributes())); // Reconstruct the AttributesList based on the vector we constructed. - AttributeSet NewCallPAL = AttributeSet::get(C, AttributesVec); + AttributeList NewCallPAL = AttributeList::get(C, AttributesVec); NewCall->setAttributes(NewCallPAL); CI->replaceAllUsesWith(NewCall); Index: llvm/trunk/lib/Target/X86/X86CallLowering.cpp =================================================================== --- llvm/trunk/lib/Target/X86/X86CallLowering.cpp +++ llvm/trunk/lib/Target/X86/X86CallLowering.cpp @@ -107,7 +107,7 @@ const Function &F = *MF.getFunction(); ArgInfo OrigArg{VReg, Val->getType()}; - setArgFlags(OrigArg, AttributeSet::ReturnIndex, DL, F); + setArgFlags(OrigArg, AttributeList::ReturnIndex, DL, F); SmallVector SplitArgs; splitToValueTypes(OrigArg, SplitArgs, DL, MRI, Index: llvm/trunk/lib/Target/X86/X86ISelLowering.h =================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h @@ -1046,7 +1046,7 @@ /// \brief Customize the preferred legalization strategy for certain types. LegalizeTypeAction getPreferredVectorAction(EVT VT) const override; - bool isIntDivCheap(EVT VT, AttributeSet Attr) const override; + bool isIntDivCheap(EVT VT, AttributeList Attr) const override; bool supportSwiftError() const override; Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp =================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp @@ -20781,7 +20781,7 @@ // Check that ECX wasn't needed by an 'inreg' parameter. FunctionType *FTy = Func->getFunctionType(); - const AttributeSet &Attrs = Func->getAttributes(); + const AttributeList &Attrs = Func->getAttributes(); if (!Attrs.isEmpty() && !Func->isVarArg()) { unsigned InRegCount = 0; @@ -35801,7 +35801,7 @@ return -1; } -bool X86TargetLowering::isIntDivCheap(EVT VT, AttributeSet Attr) const { +bool X86TargetLowering::isIntDivCheap(EVT VT, AttributeList Attr) const { // Integer division on x86 is expensive. However, when aggressively optimizing // for code size, we prefer to use a div instruction, as it is usually smaller // than the alternative sequence. @@ -35809,8 +35809,8 @@ // integer division, leaving the division as-is is a loss even in terms of // size, because it will have to be scalarized, while the alternative code // sequence can be performed in vector form. - bool OptSize = Attr.hasAttribute(AttributeSet::FunctionIndex, - Attribute::MinSize); + bool OptSize = + Attr.hasAttribute(AttributeList::FunctionIndex, Attribute::MinSize); return OptSize && !VT.isVector(); } Index: llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp =================================================================== --- llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp +++ llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp @@ -238,7 +238,7 @@ report_fatal_error("emitPrologue unsupported alignment: " + Twine(MFI.getMaxAlignment())); - const AttributeSet &PAL = MF.getFunction()->getAttributes(); + const AttributeList &PAL = MF.getFunction()->getAttributes(); if (PAL.hasAttrSomewhere(Attribute::Nest)) BuildMI(MBB, MBBI, dl, TII.get(XCore::LDWSP_ru6), XCore::R11).addImm(0); // FIX: Needs addMemOperand() but can't use getFixedStack() or getStack(). Index: llvm/trunk/lib/Transforms/Coroutines/CoroSplit.cpp =================================================================== --- llvm/trunk/lib/Transforms/Coroutines/CoroSplit.cpp +++ llvm/trunk/lib/Transforms/Coroutines/CoroSplit.cpp @@ -244,9 +244,9 @@ // Remove old return attributes. NewF->removeAttributes( - AttributeSet::ReturnIndex, - AttributeSet::get( - NewF->getContext(), AttributeSet::ReturnIndex, + AttributeList::ReturnIndex, + AttributeList::get( + NewF->getContext(), AttributeList::ReturnIndex, AttributeFuncs::typeIncompatible(NewF->getReturnType()))); // Make AllocaSpillBlock the new entry block. Index: llvm/trunk/lib/Transforms/Coroutines/Coroutines.cpp =================================================================== --- llvm/trunk/lib/Transforms/Coroutines/Coroutines.cpp +++ llvm/trunk/lib/Transforms/Coroutines/Coroutines.cpp @@ -245,9 +245,9 @@ if (CoroBegin) report_fatal_error( "coroutine should have exactly one defining @llvm.coro.begin"); - CB->addAttribute(AttributeSet::ReturnIndex, Attribute::NonNull); - CB->addAttribute(AttributeSet::ReturnIndex, Attribute::NoAlias); - CB->removeAttribute(AttributeSet::FunctionIndex, + CB->addAttribute(AttributeList::ReturnIndex, Attribute::NonNull); + CB->addAttribute(AttributeList::ReturnIndex, Attribute::NoAlias); + CB->removeAttribute(AttributeList::FunctionIndex, Attribute::NoDuplicate); CoroBegin = CB; } Index: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -102,13 +102,13 @@ // Attribute - Keep track of the parameter attributes for the arguments // that we are *not* promoting. For the ones that we do promote, the parameter // attributes are lost - SmallVector AttributesVec; - const AttributeSet &PAL = F->getAttributes(); + SmallVector AttributesVec; + const AttributeList &PAL = F->getAttributes(); // Add any return attributes. - if (PAL.hasAttributes(AttributeSet::ReturnIndex)) + if (PAL.hasAttributes(AttributeList::ReturnIndex)) AttributesVec.push_back( - AttributeSet::get(F->getContext(), PAL.getRetAttributes())); + AttributeList::get(F->getContext(), PAL.getRetAttributes())); // First, determine the new argument list unsigned ArgIndex = 1; @@ -123,11 +123,11 @@ } else if (!ArgsToPromote.count(&*I)) { // Unchanged argument Params.push_back(I->getType()); - AttributeSet attrs = PAL.getParamAttributes(ArgIndex); + AttributeList attrs = PAL.getParamAttributes(ArgIndex); if (attrs.hasAttributes(ArgIndex)) { AttrBuilder B(attrs, ArgIndex); AttributesVec.push_back( - AttributeSet::get(F->getContext(), Params.size(), B)); + AttributeList::get(F->getContext(), Params.size(), B)); } } else if (I->use_empty()) { // Dead argument (which are always marked as promotable) @@ -184,9 +184,9 @@ } // Add any function attributes. - if (PAL.hasAttributes(AttributeSet::FunctionIndex)) + if (PAL.hasAttributes(AttributeList::FunctionIndex)) AttributesVec.push_back( - AttributeSet::get(FTy->getContext(), PAL.getFnAttributes())); + AttributeList::get(FTy->getContext(), PAL.getFnAttributes())); Type *RetTy = FTy->getReturnType(); @@ -206,7 +206,7 @@ // Recompute the parameter attributes list based on the new arguments for // the function. - NF->setAttributes(AttributeSet::get(F->getContext(), AttributesVec)); + NF->setAttributes(AttributeList::get(F->getContext(), AttributesVec)); AttributesVec.clear(); F->getParent()->getFunctionList().insert(F->getIterator(), NF); @@ -220,12 +220,12 @@ CallSite CS(F->user_back()); assert(CS.getCalledFunction() == F); Instruction *Call = CS.getInstruction(); - const AttributeSet &CallPAL = CS.getAttributes(); + const AttributeList &CallPAL = CS.getAttributes(); // Add any return attributes. - if (CallPAL.hasAttributes(AttributeSet::ReturnIndex)) + if (CallPAL.hasAttributes(AttributeList::ReturnIndex)) AttributesVec.push_back( - AttributeSet::get(F->getContext(), CallPAL.getRetAttributes())); + AttributeList::get(F->getContext(), CallPAL.getRetAttributes())); // Loop over the operands, inserting GEP and loads in the caller as // appropriate. @@ -239,7 +239,7 @@ if (CallPAL.hasAttributes(ArgIndex)) { AttrBuilder B(CallPAL, ArgIndex); AttributesVec.push_back( - AttributeSet::get(F->getContext(), Args.size(), B)); + AttributeList::get(F->getContext(), Args.size(), B)); } } else if (ByValArgsToTransform.count(&*I)) { // Emit a GEP and load for each element of the struct. @@ -304,14 +304,14 @@ if (CallPAL.hasAttributes(ArgIndex)) { AttrBuilder B(CallPAL, ArgIndex); AttributesVec.push_back( - AttributeSet::get(F->getContext(), Args.size(), B)); + AttributeList::get(F->getContext(), Args.size(), B)); } } // Add any function attributes. - if (CallPAL.hasAttributes(AttributeSet::FunctionIndex)) + if (CallPAL.hasAttributes(AttributeList::FunctionIndex)) AttributesVec.push_back( - AttributeSet::get(Call->getContext(), CallPAL.getFnAttributes())); + AttributeList::get(Call->getContext(), CallPAL.getFnAttributes())); SmallVector OpBundles; CS.getOperandBundlesAsDefs(OpBundles); @@ -322,12 +322,12 @@ Args, OpBundles, "", Call); cast(New)->setCallingConv(CS.getCallingConv()); cast(New)->setAttributes( - AttributeSet::get(II->getContext(), AttributesVec)); + AttributeList::get(II->getContext(), AttributesVec)); } else { New = CallInst::Create(NF, Args, OpBundles, "", Call); cast(New)->setCallingConv(CS.getCallingConv()); cast(New)->setAttributes( - AttributeSet::get(New->getContext(), AttributesVec)); + AttributeList::get(New->getContext(), AttributesVec)); cast(New)->setTailCallKind( cast(Call)->getTailCallKind()); } Index: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -166,15 +166,15 @@ Args.assign(CS.arg_begin(), CS.arg_begin() + NumArgs); // Drop any attributes that were on the vararg arguments. - AttributeSet PAL = CS.getAttributes(); + AttributeList PAL = CS.getAttributes(); if (!PAL.isEmpty() && PAL.getSlotIndex(PAL.getNumSlots() - 1) > NumArgs) { - SmallVector AttributesVec; + SmallVector AttributesVec; for (unsigned i = 0; PAL.getSlotIndex(i) <= NumArgs; ++i) AttributesVec.push_back(PAL.getSlotAttributes(i)); - if (PAL.hasAttributes(AttributeSet::FunctionIndex)) - AttributesVec.push_back(AttributeSet::get(Fn.getContext(), - PAL.getFnAttributes())); - PAL = AttributeSet::get(Fn.getContext(), AttributesVec); + if (PAL.hasAttributes(AttributeList::FunctionIndex)) + AttributesVec.push_back( + AttributeList::get(Fn.getContext(), PAL.getFnAttributes())); + PAL = AttributeList::get(Fn.getContext(), AttributesVec); } SmallVector OpBundles; @@ -681,8 +681,8 @@ bool HasLiveReturnedArg = false; // Set up to build a new list of parameter attributes. - SmallVector AttributesVec; - const AttributeSet &PAL = F->getAttributes(); + SmallVector AttributesVec; + const AttributeList &PAL = F->getAttributes(); // Remember which arguments are still alive. SmallVector ArgAlive(FTy->getNumParams(), false); @@ -703,8 +703,8 @@ AttrBuilder B(PAL, i + 1); if (B.contains(Attribute::Returned)) HasLiveReturnedArg = true; - AttributesVec. - push_back(AttributeSet::get(F->getContext(), Params.size(), B)); + AttributesVec.push_back( + AttributeList::get(F->getContext(), Params.size(), B)); } } else { ++NumArgumentsEliminated; @@ -779,7 +779,7 @@ assert(NRetTy && "No new return type found?"); // The existing function return attributes. - AttributeSet RAttrs = PAL.getRetAttributes(); + AttributeList RAttrs = PAL.getRetAttributes(); // Remove any incompatible attributes, but only if we removed all return // values. Otherwise, ensure that we don't have any conflicting attributes @@ -787,22 +787,22 @@ // required when new return value attributes are added. if (NRetTy->isVoidTy()) RAttrs = RAttrs.removeAttributes(NRetTy->getContext(), - AttributeSet::ReturnIndex, + AttributeList::ReturnIndex, AttributeFuncs::typeIncompatible(NRetTy)); else - assert(!AttrBuilder(RAttrs, AttributeSet::ReturnIndex). - overlaps(AttributeFuncs::typeIncompatible(NRetTy)) && + assert(!AttrBuilder(RAttrs, AttributeList::ReturnIndex) + .overlaps(AttributeFuncs::typeIncompatible(NRetTy)) && "Return attributes no longer compatible?"); - if (RAttrs.hasAttributes(AttributeSet::ReturnIndex)) - AttributesVec.push_back(AttributeSet::get(NRetTy->getContext(), RAttrs)); + if (RAttrs.hasAttributes(AttributeList::ReturnIndex)) + AttributesVec.push_back(AttributeList::get(NRetTy->getContext(), RAttrs)); - if (PAL.hasAttributes(AttributeSet::FunctionIndex)) - AttributesVec.push_back(AttributeSet::get(F->getContext(), - PAL.getFnAttributes())); + if (PAL.hasAttributes(AttributeList::FunctionIndex)) + AttributesVec.push_back( + AttributeList::get(F->getContext(), PAL.getFnAttributes())); // Reconstruct the AttributesList based on the vector we constructed. - AttributeSet NewPAL = AttributeSet::get(F->getContext(), AttributesVec); + AttributeList NewPAL = AttributeList::get(F->getContext(), AttributesVec); // Create the new function type based on the recomputed parameters. FunctionType *NFTy = FunctionType::get(NRetTy, Params, FTy->isVarArg()); @@ -830,17 +830,17 @@ Instruction *Call = CS.getInstruction(); AttributesVec.clear(); - const AttributeSet &CallPAL = CS.getAttributes(); + const AttributeList &CallPAL = CS.getAttributes(); // The call return attributes. - AttributeSet RAttrs = CallPAL.getRetAttributes(); + AttributeList RAttrs = CallPAL.getRetAttributes(); // Adjust in case the function was changed to return void. - RAttrs = RAttrs.removeAttributes(NRetTy->getContext(), - AttributeSet::ReturnIndex, - AttributeFuncs::typeIncompatible(NF->getReturnType())); - if (RAttrs.hasAttributes(AttributeSet::ReturnIndex)) - AttributesVec.push_back(AttributeSet::get(NF->getContext(), RAttrs)); + RAttrs = RAttrs.removeAttributes( + NRetTy->getContext(), AttributeList::ReturnIndex, + AttributeFuncs::typeIncompatible(NF->getReturnType())); + if (RAttrs.hasAttributes(AttributeList::ReturnIndex)) + AttributesVec.push_back(AttributeList::get(NF->getContext(), RAttrs)); // Declare these outside of the loops, so we can reuse them for the second // loop, which loops the varargs. @@ -861,8 +861,8 @@ // and this is not an expected case anyway if (NRetTy != RetTy && B.contains(Attribute::Returned)) B.removeAttribute(Attribute::Returned); - AttributesVec. - push_back(AttributeSet::get(F->getContext(), Args.size(), B)); + AttributesVec.push_back( + AttributeList::get(F->getContext(), Args.size(), B)); } } @@ -871,17 +871,18 @@ Args.push_back(*I); if (CallPAL.hasAttributes(i + 1)) { AttrBuilder B(CallPAL, i + 1); - AttributesVec. - push_back(AttributeSet::get(F->getContext(), Args.size(), B)); + AttributesVec.push_back( + AttributeList::get(F->getContext(), Args.size(), B)); } } - if (CallPAL.hasAttributes(AttributeSet::FunctionIndex)) - AttributesVec.push_back(AttributeSet::get(Call->getContext(), - CallPAL.getFnAttributes())); + if (CallPAL.hasAttributes(AttributeList::FunctionIndex)) + AttributesVec.push_back( + AttributeList::get(Call->getContext(), CallPAL.getFnAttributes())); // Reconstruct the AttributesList based on the vector we constructed. - AttributeSet NewCallPAL = AttributeSet::get(F->getContext(), AttributesVec); + AttributeList NewCallPAL = + AttributeList::get(F->getContext(), AttributesVec); SmallVector OpBundles; CS.getOperandBundlesAsDefs(OpBundles); Index: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp +++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp @@ -225,11 +225,11 @@ AttrBuilder B; B.addAttribute(Attribute::ReadOnly).addAttribute(Attribute::ReadNone); F->removeAttributes( - AttributeSet::FunctionIndex, - AttributeSet::get(F->getContext(), AttributeSet::FunctionIndex, B)); + AttributeList::FunctionIndex, + AttributeList::get(F->getContext(), AttributeList::FunctionIndex, B)); // Add in the new attribute. - F->addAttribute(AttributeSet::FunctionIndex, + F->addAttribute(AttributeList::FunctionIndex, ReadsMemory ? Attribute::ReadOnly : Attribute::ReadNone); if (ReadsMemory) @@ -535,7 +535,7 @@ if (Value *RetArg = FindRetArg()) { auto *A = cast(RetArg); - A->addAttr(AttributeSet::get(F->getContext(), A->getArgNo() + 1, B)); + A->addAttr(AttributeList::get(F->getContext(), A->getArgNo() + 1, B)); ++NumReturned; Changed = true; } @@ -614,7 +614,7 @@ for (Function::arg_iterator A = F->arg_begin(), E = F->arg_end(); A != E; ++A) { if (A->getType()->isPointerTy() && !A->hasNoCaptureAttr()) { - A->addAttr(AttributeSet::get(F->getContext(), A->getArgNo() + 1, B)); + A->addAttr(AttributeList::get(F->getContext(), A->getArgNo() + 1, B)); ++NumNoCapture; Changed = true; } @@ -634,7 +634,7 @@ if (Tracker.Uses.empty()) { // If it's trivially not captured, mark it nocapture now. A->addAttr( - AttributeSet::get(F->getContext(), A->getArgNo() + 1, B)); + AttributeList::get(F->getContext(), A->getArgNo() + 1, B)); ++NumNoCapture; Changed = true; } else { @@ -662,7 +662,7 @@ if (R != Attribute::None) { AttrBuilder B; B.addAttribute(R); - A->addAttr(AttributeSet::get(A->getContext(), A->getArgNo() + 1, B)); + A->addAttr(AttributeList::get(A->getContext(), A->getArgNo() + 1, B)); Changed = true; R == Attribute::ReadOnly ? ++NumReadOnlyArg : ++NumReadNoneArg; } @@ -687,7 +687,7 @@ if (ArgumentSCC[0]->Uses.size() == 1 && ArgumentSCC[0]->Uses[0] == ArgumentSCC[0]) { Argument *A = ArgumentSCC[0]->Definition; - A->addAttr(AttributeSet::get(A->getContext(), A->getArgNo() + 1, B)); + A->addAttr(AttributeList::get(A->getContext(), A->getArgNo() + 1, B)); ++NumNoCapture; Changed = true; } @@ -729,7 +729,7 @@ for (unsigned i = 0, e = ArgumentSCC.size(); i != e; ++i) { Argument *A = ArgumentSCC[i]->Definition; - A->addAttr(AttributeSet::get(A->getContext(), A->getArgNo() + 1, B)); + A->addAttr(AttributeList::get(A->getContext(), A->getArgNo() + 1, B)); ++NumNoCapture; Changed = true; } @@ -766,8 +766,9 @@ for (unsigned i = 0, e = ArgumentSCC.size(); i != e; ++i) { Argument *A = ArgumentSCC[i]->Definition; // Clear out existing readonly/readnone attributes - A->removeAttr(AttributeSet::get(A->getContext(), A->getArgNo() + 1, R)); - A->addAttr(AttributeSet::get(A->getContext(), A->getArgNo() + 1, B)); + A->removeAttr( + AttributeList::get(A->getContext(), A->getArgNo() + 1, R)); + A->addAttr(AttributeList::get(A->getContext(), A->getArgNo() + 1, B)); ReadAttr == Attribute::ReadOnly ? ++NumReadOnlyArg : ++NumReadNoneArg; Changed = true; } @@ -963,7 +964,7 @@ // pointers. for (Function *F : SCCNodes) { // Already nonnull. - if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex, + if (F->getAttributes().hasAttribute(AttributeList::ReturnIndex, Attribute::NonNull)) continue; @@ -984,7 +985,7 @@ // Mark the function eagerly since we may discover a function // which prevents us from speculating about the entire SCC DEBUG(dbgs() << "Eagerly marking " << F->getName() << " as nonnull\n"); - F->addAttribute(AttributeSet::ReturnIndex, Attribute::NonNull); + F->addAttribute(AttributeList::ReturnIndex, Attribute::NonNull); ++NumNonNullReturn; MadeChange = true; } @@ -997,13 +998,13 @@ if (SCCReturnsNonNull) { for (Function *F : SCCNodes) { - if (F->getAttributes().hasAttribute(AttributeSet::ReturnIndex, + if (F->getAttributes().hasAttribute(AttributeList::ReturnIndex, Attribute::NonNull) || !F->getReturnType()->isPointerTy()) continue; DEBUG(dbgs() << "SCC marking " << F->getName() << " as nonnull\n"); - F->addAttribute(AttributeSet::ReturnIndex, Attribute::NonNull); + F->addAttribute(AttributeList::ReturnIndex, Attribute::NonNull); ++NumNonNullReturn; MadeChange = true; } Index: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp @@ -1977,7 +1977,7 @@ } } -static AttributeSet StripNest(LLVMContext &C, const AttributeSet &Attrs) { +static AttributeList StripNest(LLVMContext &C, const AttributeList &Attrs) { for (unsigned i = 0, e = Attrs.getNumSlots(); i != e; ++i) { unsigned Index = Attrs.getSlotIndex(i); if (!Attrs.getSlotAttributes(i).hasAttribute(Index, Attribute::Nest)) Index: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp @@ -436,10 +436,10 @@ auto CallSiteAttrs = CS.getAttributes(); CallSiteAttrs = CallSiteAttrs.addAttributes( - Context, AttributeSet::ReturnIndex, NewFuncAttrs.getRetAttributes()); + Context, AttributeList::ReturnIndex, NewFuncAttrs.getRetAttributes()); for (unsigned argIdx = 0; argIdx < CS.arg_size(); argIdx++) { - AttributeSet Attrs = NewFuncAttrs.getParamAttributes(argIdx); + AttributeList Attrs = NewFuncAttrs.getParamAttributes(argIdx); if (Attrs.getNumSlots()) CallSiteAttrs = CallSiteAttrs.addAttributes(Context, argIdx, Attrs); } Index: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp =================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -3592,7 +3592,7 @@ // isKnownNonNull -> nonnull attribute if (isKnownNonNullAt(DerivedPtr, II, &DT)) - II->addAttribute(AttributeSet::ReturnIndex, Attribute::NonNull); + II->addAttribute(AttributeList::ReturnIndex, Attribute::NonNull); } // TODO: bitcast(relocate(p)) -> relocate(bitcast(p)) @@ -3788,7 +3788,7 @@ assert(ArgNo == CS.arg_size() && "sanity check"); if (!Indices.empty()) { - AttributeSet AS = CS.getAttributes(); + AttributeList AS = CS.getAttributes(); LLVMContext &Ctx = CS.getInstruction()->getContext(); AS = AS.addAttribute(Ctx, Indices, Attribute::get(Ctx, Attribute::NonNull)); @@ -3910,7 +3910,7 @@ return false; Instruction *Caller = CS.getInstruction(); - const AttributeSet &CallerPAL = CS.getAttributes(); + const AttributeList &CallerPAL = CS.getAttributes(); // Okay, this is a cast from a function to a different type. Unless doing so // would cause a type conversion of one of our arguments, change this call to @@ -3937,7 +3937,7 @@ } if (!CallerPAL.isEmpty() && !Caller->use_empty()) { - AttrBuilder RAttrs(CallerPAL, AttributeSet::ReturnIndex); + AttrBuilder RAttrs(CallerPAL, AttributeList::ReturnIndex); if (RAttrs.overlaps(AttributeFuncs::typeIncompatible(NewRetTy))) return false; // Attribute not compatible with transformed value. } @@ -4034,7 +4034,7 @@ break; // Check if it has an attribute that's incompatible with varargs. - AttributeSet PAttrs = CallerPAL.getSlotAttributes(i - 1); + AttributeList PAttrs = CallerPAL.getSlotAttributes(i - 1); if (PAttrs.hasAttribute(Index, Attribute::StructRet)) return false; } @@ -4044,11 +4044,11 @@ // inserting cast instructions as necessary. std::vector Args; Args.reserve(NumActualArgs); - SmallVector attrVec; + SmallVector attrVec; attrVec.reserve(NumCommonArgs); // Get any return attributes. - AttrBuilder RAttrs(CallerPAL, AttributeSet::ReturnIndex); + AttrBuilder RAttrs(CallerPAL, AttributeList::ReturnIndex); // If the return value is not being used, the type may not be compatible // with the existing attributes. Wipe out any problematic attributes. @@ -4056,8 +4056,8 @@ // Add the new return attributes. if (RAttrs.hasAttributes()) - attrVec.push_back(AttributeSet::get(Caller->getContext(), - AttributeSet::ReturnIndex, RAttrs)); + attrVec.push_back(AttributeList::get(Caller->getContext(), + AttributeList::ReturnIndex, RAttrs)); AI = CS.arg_begin(); for (unsigned i = 0; i != NumCommonArgs; ++i, ++AI) { @@ -4072,8 +4072,8 @@ // Add any parameter attributes. AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1); if (PAttrs.hasAttributes()) - attrVec.push_back(AttributeSet::get(Caller->getContext(), i + 1, - PAttrs)); + attrVec.push_back( + AttributeList::get(Caller->getContext(), i + 1, PAttrs)); } // If the function takes more arguments than the call was taking, add them @@ -4100,21 +4100,21 @@ // Add any parameter attributes. AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1); if (PAttrs.hasAttributes()) - attrVec.push_back(AttributeSet::get(FT->getContext(), i + 1, - PAttrs)); + attrVec.push_back( + AttributeList::get(FT->getContext(), i + 1, PAttrs)); } } } - AttributeSet FnAttrs = CallerPAL.getFnAttributes(); - if (CallerPAL.hasAttributes(AttributeSet::FunctionIndex)) - attrVec.push_back(AttributeSet::get(Callee->getContext(), FnAttrs)); + AttributeList FnAttrs = CallerPAL.getFnAttributes(); + if (CallerPAL.hasAttributes(AttributeList::FunctionIndex)) + attrVec.push_back(AttributeList::get(Callee->getContext(), FnAttrs)); if (NewRetTy->isVoidTy()) Caller->setName(""); // Void type should not have a name. - const AttributeSet &NewCallerPAL = AttributeSet::get(Callee->getContext(), - attrVec); + const AttributeList &NewCallerPAL = + AttributeList::get(Callee->getContext(), attrVec); SmallVector OpBundles; CS.getOperandBundlesAsDefs(OpBundles); @@ -4180,7 +4180,7 @@ Value *Callee = CS.getCalledValue(); PointerType *PTy = cast(Callee->getType()); FunctionType *FTy = cast(PTy->getElementType()); - const AttributeSet &Attrs = CS.getAttributes(); + const AttributeList &Attrs = CS.getAttributes(); // If the call already has the 'nest' attribute somewhere then give up - // otherwise 'nest' would occur twice after splicing in the chain. @@ -4193,11 +4193,11 @@ Function *NestF =cast(Tramp->getArgOperand(1)->stripPointerCasts()); FunctionType *NestFTy = cast(NestF->getValueType()); - const AttributeSet &NestAttrs = NestF->getAttributes(); + const AttributeList &NestAttrs = NestF->getAttributes(); if (!NestAttrs.isEmpty()) { unsigned NestIdx = 1; Type *NestTy = nullptr; - AttributeSet NestAttr; + AttributeList NestAttr; // Look for a parameter marked with the 'nest' attribute. for (FunctionType::param_iterator I = NestFTy->param_begin(), @@ -4214,16 +4214,16 @@ std::vector NewArgs; NewArgs.reserve(CS.arg_size() + 1); - SmallVector NewAttrs; + SmallVector NewAttrs; NewAttrs.reserve(Attrs.getNumSlots() + 1); // Insert the nest argument into the call argument list, which may // mean appending it. Likewise for attributes. // Add any result attributes. - if (Attrs.hasAttributes(AttributeSet::ReturnIndex)) - NewAttrs.push_back(AttributeSet::get(Caller->getContext(), - Attrs.getRetAttributes())); + if (Attrs.hasAttributes(AttributeList::ReturnIndex)) + NewAttrs.push_back( + AttributeList::get(Caller->getContext(), Attrs.getRetAttributes())); { unsigned Idx = 1; @@ -4235,8 +4235,8 @@ if (NestVal->getType() != NestTy) NestVal = Builder->CreateBitCast(NestVal, NestTy, "nest"); NewArgs.push_back(NestVal); - NewAttrs.push_back(AttributeSet::get(Caller->getContext(), - NestAttr)); + NewAttrs.push_back( + AttributeList::get(Caller->getContext(), NestAttr)); } if (I == E) @@ -4244,11 +4244,11 @@ // Add the original argument and attributes. NewArgs.push_back(*I); - AttributeSet Attr = Attrs.getParamAttributes(Idx); + AttributeList Attr = Attrs.getParamAttributes(Idx); if (Attr.hasAttributes(Idx)) { AttrBuilder B(Attr, Idx); - NewAttrs.push_back(AttributeSet::get(Caller->getContext(), - Idx + (Idx >= NestIdx), B)); + NewAttrs.push_back(AttributeList::get(Caller->getContext(), + Idx + (Idx >= NestIdx), B)); } ++Idx; @@ -4257,9 +4257,9 @@ } // Add any function attributes. - if (Attrs.hasAttributes(AttributeSet::FunctionIndex)) - NewAttrs.push_back(AttributeSet::get(FTy->getContext(), - Attrs.getFnAttributes())); + if (Attrs.hasAttributes(AttributeList::FunctionIndex)) + NewAttrs.push_back( + AttributeList::get(FTy->getContext(), Attrs.getFnAttributes())); // The trampoline may have been bitcast to a bogus type (FTy). // Handle this by synthesizing a new function type, equal to FTy @@ -4299,8 +4299,8 @@ NestF->getType() == PointerType::getUnqual(NewFTy) ? NestF : ConstantExpr::getBitCast(NestF, PointerType::getUnqual(NewFTy)); - const AttributeSet &NewPAL = - AttributeSet::get(FTy->getContext(), NewAttrs); + const AttributeList &NewPAL = + AttributeList::get(FTy->getContext(), NewAttrs); SmallVector OpBundles; CS.getOperandBundlesAsDefs(OpBundles); Index: llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp =================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -254,7 +254,7 @@ MDNode *ColdCallWeights; DFSanABIList ABIList; DenseMap UnwrappedFnMap; - AttributeSet ReadOnlyNoneAttrs; + AttributeList ReadOnlyNoneAttrs; bool DFSanRuntimeShadowMask; Value *getShadowAddress(Value *Addr, Instruction *Pos); @@ -539,16 +539,17 @@ F->getParent()); NewF->copyAttributesFrom(F); NewF->removeAttributes( - AttributeSet::ReturnIndex, - AttributeSet::get(F->getContext(), AttributeSet::ReturnIndex, - AttributeFuncs::typeIncompatible(NewFT->getReturnType()))); + AttributeList::ReturnIndex, + AttributeList::get( + F->getContext(), AttributeList::ReturnIndex, + AttributeFuncs::typeIncompatible(NewFT->getReturnType()))); BasicBlock *BB = BasicBlock::Create(*Ctx, "entry", NewF); if (F->isVarArg()) { NewF->removeAttributes( - AttributeSet::FunctionIndex, - AttributeSet().addAttribute(*Ctx, AttributeSet::FunctionIndex, - "split-stack")); + AttributeList::FunctionIndex, + AttributeList().addAttribute(*Ctx, AttributeList::FunctionIndex, + "split-stack")); CallInst::Create(DFSanVarargWrapperFn, IRBuilder<>(BB).CreateGlobalStringPtr(F->getName()), "", BB); @@ -621,26 +622,26 @@ DFSanUnionFn = Mod->getOrInsertFunction("__dfsan_union", DFSanUnionFnTy); if (Function *F = dyn_cast(DFSanUnionFn)) { - F->addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind); - F->addAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone); - F->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt); + F->addAttribute(AttributeList::FunctionIndex, Attribute::NoUnwind); + F->addAttribute(AttributeList::FunctionIndex, Attribute::ReadNone); + F->addAttribute(AttributeList::ReturnIndex, Attribute::ZExt); F->addAttribute(1, Attribute::ZExt); F->addAttribute(2, Attribute::ZExt); } DFSanCheckedUnionFn = Mod->getOrInsertFunction("dfsan_union", DFSanUnionFnTy); if (Function *F = dyn_cast(DFSanCheckedUnionFn)) { - F->addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind); - F->addAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone); - F->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt); + F->addAttribute(AttributeList::FunctionIndex, Attribute::NoUnwind); + F->addAttribute(AttributeList::FunctionIndex, Attribute::ReadNone); + F->addAttribute(AttributeList::ReturnIndex, Attribute::ZExt); F->addAttribute(1, Attribute::ZExt); F->addAttribute(2, Attribute::ZExt); } DFSanUnionLoadFn = Mod->getOrInsertFunction("__dfsan_union_load", DFSanUnionLoadFnTy); if (Function *F = dyn_cast(DFSanUnionLoadFn)) { - F->addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind); - F->addAttribute(AttributeSet::FunctionIndex, Attribute::ReadOnly); - F->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt); + F->addAttribute(AttributeList::FunctionIndex, Attribute::NoUnwind); + F->addAttribute(AttributeList::FunctionIndex, Attribute::ReadOnly); + F->addAttribute(AttributeList::ReturnIndex, Attribute::ZExt); } DFSanUnimplementedFn = Mod->getOrInsertFunction("__dfsan_unimplemented", DFSanUnimplementedFnTy); @@ -695,7 +696,7 @@ AttrBuilder B; B.addAttribute(Attribute::ReadOnly).addAttribute(Attribute::ReadNone); - ReadOnlyNoneAttrs = AttributeSet::get(*Ctx, AttributeSet::FunctionIndex, B); + ReadOnlyNoneAttrs = AttributeList::get(*Ctx, AttributeList::FunctionIndex, B); // First, change the ABI of every function in the module. ABI-listed // functions keep their original ABI and get a wrapper function. @@ -716,9 +717,10 @@ Function *NewF = Function::Create(NewFT, F.getLinkage(), "", &M); NewF->copyAttributesFrom(&F); NewF->removeAttributes( - AttributeSet::ReturnIndex, - AttributeSet::get(NewF->getContext(), AttributeSet::ReturnIndex, - AttributeFuncs::typeIncompatible(NewFT->getReturnType()))); + AttributeList::ReturnIndex, + AttributeList::get( + NewF->getContext(), AttributeList::ReturnIndex, + AttributeFuncs::typeIncompatible(NewFT->getReturnType()))); for (Function::arg_iterator FArg = F.arg_begin(), NewFArg = NewF->arg_begin(), FArgEnd = F.arg_end(); @@ -757,7 +759,7 @@ &F, std::string("dfsw$") + std::string(F.getName()), GlobalValue::LinkOnceODRLinkage, NewFT); if (getInstrumentedABI() == IA_TLS) - NewF->removeAttributes(AttributeSet::FunctionIndex, ReadOnlyNoneAttrs); + NewF->removeAttributes(AttributeList::FunctionIndex, ReadOnlyNoneAttrs); Value *WrappedFnCst = ConstantExpr::getBitCast(NewF, PointerType::getUnqual(FT)); @@ -982,7 +984,7 @@ IRBuilder<> IRB(Pos); if (AvoidNewBlocks) { CallInst *Call = IRB.CreateCall(DFS.DFSanCheckedUnionFn, {V1, V2}); - Call->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt); + Call->addAttribute(AttributeList::ReturnIndex, Attribute::ZExt); Call->addAttribute(1, Attribute::ZExt); Call->addAttribute(2, Attribute::ZExt); @@ -995,7 +997,7 @@ Ne, Pos, /*Unreachable=*/false, DFS.ColdCallWeights, &DT)); IRBuilder<> ThenIRB(BI); CallInst *Call = ThenIRB.CreateCall(DFS.DFSanUnionFn, {V1, V2}); - Call->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt); + Call->addAttribute(AttributeList::ReturnIndex, Attribute::ZExt); Call->addAttribute(1, Attribute::ZExt); Call->addAttribute(2, Attribute::ZExt); @@ -1098,7 +1100,7 @@ CallInst *FallbackCall = FallbackIRB.CreateCall( DFS.DFSanUnionLoadFn, {ShadowAddr, ConstantInt::get(DFS.IntptrTy, Size)}); - FallbackCall->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt); + FallbackCall->addAttribute(AttributeList::ReturnIndex, Attribute::ZExt); // Compare each of the shadows stored in the loaded 64 bits to each other, // by computing (WideShadow rotl ShadowWidth) == WideShadow. @@ -1155,7 +1157,7 @@ IRBuilder<> IRB(Pos); CallInst *FallbackCall = IRB.CreateCall( DFS.DFSanUnionLoadFn, {ShadowAddr, ConstantInt::get(DFS.IntptrTy, Size)}); - FallbackCall->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt); + FallbackCall->addAttribute(AttributeList::ReturnIndex, Attribute::ZExt); return FallbackCall; } @@ -1445,7 +1447,7 @@ // Custom functions returning non-void will write to the return label. if (!FT->getReturnType()->isVoidTy()) { - CustomFn->removeAttributes(AttributeSet::FunctionIndex, + CustomFn->removeAttributes(AttributeList::FunctionIndex, DFSF.DFS.ReadOnlyNoneAttrs); } } @@ -1592,7 +1594,7 @@ } NewCS.setCallingConv(CS.getCallingConv()); NewCS.setAttributes(CS.getAttributes().removeAttributes( - *DFSF.DFS.Ctx, AttributeSet::ReturnIndex, + *DFSF.DFS.Ctx, AttributeList::ReturnIndex, AttributeFuncs::typeIncompatible(NewCS.getInstruction()->getType()))); if (Next) { Index: llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp =================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -2607,10 +2607,10 @@ AttrBuilder B; B.addAttribute(Attribute::ReadOnly) .addAttribute(Attribute::ReadNone); - Func->removeAttributes(AttributeSet::FunctionIndex, - AttributeSet::get(Func->getContext(), - AttributeSet::FunctionIndex, - B)); + Func->removeAttributes(AttributeList::FunctionIndex, + AttributeList::get(Func->getContext(), + AttributeList::FunctionIndex, + B)); } maybeMarkSanitizerLibraryCallNoBuiltin(Call, TLI); @@ -3659,9 +3659,9 @@ AttrBuilder B; B.addAttribute(Attribute::ReadOnly) .addAttribute(Attribute::ReadNone); - F.removeAttributes(AttributeSet::FunctionIndex, - AttributeSet::get(F.getContext(), - AttributeSet::FunctionIndex, B)); + F.removeAttributes( + AttributeList::FunctionIndex, + AttributeList::get(F.getContext(), AttributeList::FunctionIndex, B)); return Visitor.runOnFunction(); } Index: llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp =================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp +++ llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp @@ -155,8 +155,9 @@ void ThreadSanitizer::initializeCallbacks(Module &M) { IRBuilder<> IRB(M.getContext()); - AttributeSet Attr; - Attr = Attr.addAttribute(M.getContext(), AttributeSet::FunctionIndex, Attribute::NoUnwind); + AttributeList Attr; + Attr = Attr.addAttribute(M.getContext(), AttributeList::FunctionIndex, + Attribute::NoUnwind); // Initialize the callbacks. TsanFuncEntry = checkSanitizerInterfaceFunction(M.getOrInsertFunction( "__tsan_func_entry", Attr, IRB.getVoidTy(), IRB.getInt8PtrTy(), nullptr)); Index: llvm/trunk/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h =================================================================== --- llvm/trunk/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h +++ llvm/trunk/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h @@ -127,9 +127,8 @@ LLVMContext &C = TheModule->getContext(); Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) }; - AttributeSet Attr = - AttributeSet().addAttribute(C, AttributeSet::FunctionIndex, - Attribute::NoUnwind); + AttributeList Attr = AttributeList().addAttribute( + C, AttributeList::FunctionIndex, Attribute::NoUnwind); FunctionType *Fty = FunctionType::get(Type::getVoidTy(C), Params, /*isVarArg=*/false); return Decl = TheModule->getOrInsertFunction(Name, Fty, Attr); @@ -144,10 +143,10 @@ Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C)); Type *Params[] = { I8X }; FunctionType *Fty = FunctionType::get(I8X, Params, /*isVarArg=*/false); - AttributeSet Attr = AttributeSet(); + AttributeList Attr = AttributeList(); if (NoUnwind) - Attr = Attr.addAttribute(C, AttributeSet::FunctionIndex, + Attr = Attr.addAttribute(C, AttributeList::FunctionIndex, Attribute::NoUnwind); return Decl = TheModule->getOrInsertFunction(Name, Fty, Attr); @@ -162,9 +161,8 @@ Type *I8XX = PointerType::getUnqual(I8X); Type *Params[] = { I8XX, I8X }; - AttributeSet Attr = - AttributeSet().addAttribute(C, AttributeSet::FunctionIndex, - Attribute::NoUnwind); + AttributeList Attr = AttributeList().addAttribute( + C, AttributeList::FunctionIndex, Attribute::NoUnwind); Attr = Attr.addAttribute(C, 1, Attribute::NoCapture); FunctionType *Fty = FunctionType::get(Type::getVoidTy(C), Params, Index: llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp =================================================================== --- llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp +++ llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp @@ -322,7 +322,7 @@ if (Indices.empty()) return false; - AttributeSet AS = CS.getAttributes(); + AttributeList AS = CS.getAttributes(); LLVMContext &Ctx = CS.getInstruction()->getContext(); AS = AS.addAttribute(Ctx, Indices, Attribute::get(Ctx, Attribute::NonNull)); CS.setAttributes(AS); Index: llvm/trunk/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp =================================================================== --- llvm/trunk/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp +++ llvm/trunk/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp @@ -66,7 +66,7 @@ // Add attribute "readnone" so that backend can use a native sqrt instruction // for this call. Insert a FP compare instruction and a conditional branch // at the end of CurrBB. - Call->addAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone); + Call->addAttribute(AttributeList::FunctionIndex, Attribute::ReadNone); CurrBB.getTerminator()->eraseFromParent(); Builder.SetInsertPoint(&CurrBB); Value *FCmp = Builder.CreateFCmpOEQ(Call, Call); Index: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp =================================================================== --- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -1128,14 +1128,14 @@ // Create new attribute set containing only attributes which can be transferred // from original call to the safepoint. -static AttributeSet legalizeCallAttributes(AttributeSet AS) { - AttributeSet Ret; +static AttributeList legalizeCallAttributes(AttributeList AS) { + AttributeList Ret; for (unsigned Slot = 0; Slot < AS.getNumSlots(); Slot++) { unsigned Index = AS.getSlotIndex(Slot); - if (Index == AttributeSet::ReturnIndex || - Index == AttributeSet::FunctionIndex) { + if (Index == AttributeList::ReturnIndex || + Index == AttributeList::FunctionIndex) { for (Attribute Attr : make_range(AS.begin(Slot), AS.end(Slot))) { @@ -1153,7 +1153,7 @@ Ret = Ret.addAttributes( AS.getContext(), Index, - AttributeSet::get(AS.getContext(), Index, AttrBuilder(Attr))); + AttributeList::get(AS.getContext(), Index, AttrBuilder(Attr))); } } @@ -1304,12 +1304,11 @@ const char *DeoptLowering = "deopt-lowering"; if (CS.hasFnAttr(DeoptLowering)) { // FIXME: CallSite has a *really* confusing interface around attributes - // with values. - const AttributeSet &CSAS = CS.getAttributes(); - if (CSAS.hasAttribute(AttributeSet::FunctionIndex, - DeoptLowering)) - return CSAS.getAttribute(AttributeSet::FunctionIndex, - DeoptLowering).getValueAsString(); + // with values. + const AttributeList &CSAS = CS.getAttributes(); + if (CSAS.hasAttribute(AttributeList::FunctionIndex, DeoptLowering)) + return CSAS.getAttribute(AttributeList::FunctionIndex, DeoptLowering) + .getValueAsString(); Function *F = CS.getCalledFunction(); assert(F && F->hasFnAttribute(DeoptLowering)); return F->getFnAttribute(DeoptLowering).getValueAsString(); @@ -1393,7 +1392,7 @@ // Create the statepoint given all the arguments Instruction *Token = nullptr; - AttributeSet ReturnAttrs; + AttributeList ReturnAttrs; if (CS.isCall()) { CallInst *ToReplace = cast(CS.getInstruction()); CallInst *Call = Builder.CreateGCStatepointCall( @@ -1405,7 +1404,7 @@ // Currently we will fail on parameter attributes and on certain // function attributes. - AttributeSet NewAttrs = legalizeCallAttributes(ToReplace->getAttributes()); + AttributeList NewAttrs = legalizeCallAttributes(ToReplace->getAttributes()); // In case if we can handle this set of attributes - set up function attrs // directly on statepoint and return attrs later for gc_result intrinsic. Call->setAttributes(NewAttrs.getFnAttributes()); @@ -1433,7 +1432,7 @@ // Currently we will fail on parameter attributes and on certain // function attributes. - AttributeSet NewAttrs = legalizeCallAttributes(ToReplace->getAttributes()); + AttributeList NewAttrs = legalizeCallAttributes(ToReplace->getAttributes()); // In case if we can handle this set of attributes - set up function attrs // directly on statepoint and return attrs later for gc_result intrinsic. Invoke->setAttributes(NewAttrs.getFnAttributes()); @@ -2309,7 +2308,7 @@ if (!R.empty()) AH.setAttributes(AH.getAttributes().removeAttributes( - Ctx, Index, AttributeSet::get(Ctx, Index, R))); + Ctx, Index, AttributeList::get(Ctx, Index, R))); } void @@ -2321,7 +2320,7 @@ RemoveNonValidAttrAtIndex(Ctx, F, A.getArgNo() + 1); if (isa(F.getReturnType())) - RemoveNonValidAttrAtIndex(Ctx, F, AttributeSet::ReturnIndex); + RemoveNonValidAttrAtIndex(Ctx, F, AttributeList::ReturnIndex); } void RewriteStatepointsForGC::stripNonValidAttributesFromBody(Function &F) { @@ -2356,7 +2355,7 @@ if (isa(CS.getArgument(i)->getType())) RemoveNonValidAttrAtIndex(Ctx, CS, i + 1); if (isa(CS.getType())) - RemoveNonValidAttrAtIndex(Ctx, CS, AttributeSet::ReturnIndex); + RemoveNonValidAttrAtIndex(Ctx, CS, AttributeList::ReturnIndex); } } } Index: llvm/trunk/lib/Transforms/Utils/BuildLibCalls.cpp =================================================================== --- llvm/trunk/lib/Transforms/Utils/BuildLibCalls.cpp +++ llvm/trunk/lib/Transforms/Utils/BuildLibCalls.cpp @@ -96,9 +96,9 @@ } static bool setNonNull(Function &F, unsigned n) { - assert((n != AttributeSet::ReturnIndex || - F.getReturnType()->isPointerTy()) && - "nonnull applies only to pointers"); + assert( + (n != AttributeList::ReturnIndex || F.getReturnType()->isPointerTy()) && + "nonnull applies only to pointers"); if (F.getAttributes().hasAttribute(n, Attribute::NonNull)) return false; F.addAttribute(n, Attribute::NonNull); @@ -683,8 +683,8 @@ case LibFunc_msvc_new_array_int: // new[](unsigned int) case LibFunc_msvc_new_array_longlong: // new[](unsigned long long) // Operator new always returns a nonnull noalias pointer - Changed |= setNonNull(F, AttributeSet::ReturnIndex); - Changed |= setDoesNotAlias(F, AttributeSet::ReturnIndex); + Changed |= setNonNull(F, AttributeList::ReturnIndex); + Changed |= setDoesNotAlias(F, AttributeList::ReturnIndex); return Changed; //TODO: add LibFunc entries for: //case LibFunc_memset_pattern4: @@ -810,12 +810,12 @@ return nullptr; Module *M = B.GetInsertBlock()->getModule(); - AttributeSet AS; - AS = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, - Attribute::NoUnwind); + AttributeList AS; + AS = AttributeList::get(M->getContext(), AttributeList::FunctionIndex, + Attribute::NoUnwind); LLVMContext &Context = B.GetInsertBlock()->getContext(); Value *MemCpy = M->getOrInsertFunction( - "__memcpy_chk", AttributeSet::get(M->getContext(), AS), B.getInt8PtrTy(), + "__memcpy_chk", AttributeList::get(M->getContext(), AS), B.getInt8PtrTy(), B.getInt8PtrTy(), B.getInt8PtrTy(), DL.getIntPtrType(Context), DL.getIntPtrType(Context), nullptr); Dst = castToCStr(Dst, B); @@ -881,7 +881,7 @@ } Value *llvm::emitUnaryFloatFnCall(Value *Op, StringRef Name, IRBuilder<> &B, - const AttributeSet &Attrs) { + const AttributeList &Attrs) { SmallString<20> NameBuffer; appendTypeSuffix(Op, Name, NameBuffer); @@ -897,7 +897,7 @@ } Value *llvm::emitBinaryFloatFnCall(Value *Op1, Value *Op2, StringRef Name, - IRBuilder<> &B, const AttributeSet &Attrs) { + IRBuilder<> &B, const AttributeList &Attrs) { SmallString<20> NameBuffer; appendTypeSuffix(Op1, Name, NameBuffer); Index: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp =================================================================== --- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp +++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp @@ -90,9 +90,9 @@ assert(VMap.count(&I) && "No mapping from source argument specified!"); #endif - // Copy all attributes other than those stored in the AttributeSet. We need - // to remap the parameter indices of the AttributeSet. - AttributeSet NewAttrs = NewFunc->getAttributes(); + // Copy all attributes other than those stored in the AttributeList. We need + // to remap the parameter indices of the AttributeList. + AttributeList NewAttrs = NewFunc->getAttributes(); NewFunc->copyAttributesFrom(OldFunc); NewFunc->setAttributes(NewAttrs); @@ -103,21 +103,20 @@ ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges, TypeMapper, Materializer)); - AttributeSet OldAttrs = OldFunc->getAttributes(); + AttributeList OldAttrs = OldFunc->getAttributes(); // Clone any argument attributes that are present in the VMap. for (const Argument &OldArg : OldFunc->args()) if (Argument *NewArg = dyn_cast(VMap[&OldArg])) { - AttributeSet attrs = - OldAttrs.getParamAttributes(OldArg.getArgNo() + 1); + AttributeList attrs = OldAttrs.getParamAttributes(OldArg.getArgNo() + 1); if (attrs.getNumSlots() > 0) NewArg->addAttr(attrs); } NewFunc->setAttributes( NewFunc->getAttributes() - .addAttributes(NewFunc->getContext(), AttributeSet::ReturnIndex, + .addAttributes(NewFunc->getContext(), AttributeList::ReturnIndex, OldAttrs.getRetAttributes()) - .addAttributes(NewFunc->getContext(), AttributeSet::FunctionIndex, + .addAttributes(NewFunc->getContext(), AttributeList::FunctionIndex, OldAttrs.getFnAttributes())); SmallVector, 1> MDs; Index: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp =================================================================== --- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp +++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp @@ -362,8 +362,8 @@ // "target-features" attribute allowing it to be lowered. // FIXME: This should be changed to check to see if a specific // attribute can not be inherited. - AttributeSet OldFnAttrs = oldFunction->getAttributes().getFnAttributes(); - AttrBuilder AB(OldFnAttrs, AttributeSet::FunctionIndex); + AttributeList OldFnAttrs = oldFunction->getAttributes().getFnAttributes(); + AttrBuilder AB(OldFnAttrs, AttributeList::FunctionIndex); for (const auto &Attr : AB.td_attrs()) newFunction->addFnAttr(Attr.first, Attr.second); Index: llvm/trunk/lib/Transforms/Utils/FunctionComparator.cpp =================================================================== --- llvm/trunk/lib/Transforms/Utils/FunctionComparator.cpp +++ llvm/trunk/lib/Transforms/Utils/FunctionComparator.cpp @@ -74,14 +74,14 @@ return L.compare(R); } -int FunctionComparator::cmpAttrs(const AttributeSet L, - const AttributeSet R) const { +int FunctionComparator::cmpAttrs(const AttributeList L, + const AttributeList R) const { if (int Res = cmpNumbers(L.getNumSlots(), R.getNumSlots())) return Res; for (unsigned i = 0, e = L.getNumSlots(); i != e; ++i) { - AttributeSet::iterator LI = L.begin(i), LE = L.end(i), RI = R.begin(i), - RE = R.end(i); + AttributeList::iterator LI = L.begin(i), LE = L.end(i), RI = R.begin(i), + RE = R.end(i); for (; LI != LE && RI != RE; ++LI, ++RI) { Attribute LA = *LI; Attribute RA = *RI; Index: llvm/trunk/lib/Transforms/Utils/Local.cpp =================================================================== --- llvm/trunk/lib/Transforms/Utils/Local.cpp +++ llvm/trunk/lib/Transforms/Utils/Local.cpp @@ -2123,5 +2123,5 @@ if (F && !F->hasLocalLinkage() && F->hasName() && TLI->getLibFunc(F->getName(), Func) && TLI->hasOptimizedCodeGen(Func) && !F->doesNotAccessMemory()) - CI->addAttribute(AttributeSet::FunctionIndex, Attribute::NoBuiltin); + CI->addAttribute(AttributeList::FunctionIndex, Attribute::NoBuiltin); } Index: llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp =================================================================== --- llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp +++ llvm/trunk/lib/Transforms/Utils/ModuleUtils.cpp @@ -153,14 +153,14 @@ Function *InitFunction = checkSanitizerInterfaceFunction(M.getOrInsertFunction( InitName, FunctionType::get(IRB.getVoidTy(), InitArgTypes, false), - AttributeSet())); + AttributeList())); InitFunction->setLinkage(Function::ExternalLinkage); IRB.CreateCall(InitFunction, InitArgs); if (!VersionCheckName.empty()) { Function *VersionCheckFunction = checkSanitizerInterfaceFunction(M.getOrInsertFunction( VersionCheckName, FunctionType::get(IRB.getVoidTy(), {}, false), - AttributeSet())); + AttributeList())); IRB.CreateCall(VersionCheckFunction, {}); } return std::make_pair(Ctor, InitFunction); Index: llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp =================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -809,7 +809,7 @@ // TODO: Does this belong in BuildLibCalls or should all of those similar // functions be moved here? -static Value *emitCalloc(Value *Num, Value *Size, const AttributeSet &Attrs, +static Value *emitCalloc(Value *Num, Value *Size, const AttributeList &Attrs, IRBuilder<> &B, const TargetLibraryInfo &TLI) { LibFunc Func; if (!TLI.getLibFunc("calloc", Func) || !TLI.has(Func)) @@ -1625,7 +1625,7 @@ // Proceedings of PACT'98, Oct. 1998, IEEE if (!CI->hasFnAttr(Attribute::Cold) && isReportingError(Callee, CI, StreamArg)) { - CI->addAttribute(AttributeSet::FunctionIndex, Attribute::Cold); + CI->addAttribute(AttributeList::FunctionIndex, Attribute::Cold); } return nullptr; Index: llvm/trunk/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp =================================================================== --- llvm/trunk/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp +++ llvm/trunk/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp @@ -20,17 +20,17 @@ LLVMContext Context; ModuleBuilder MB(Context, "x86_64-apple-macosx10.10", ""); Function *F = MB.createFunctionDecl(""); - SmallVector Attrs; + SmallVector Attrs; Attrs.push_back( - AttributeSet::get(MB.getModule()->getContext(), 1U, - AttrBuilder().addAttribute(Attribute::StructRet))); + AttributeList::get(MB.getModule()->getContext(), 1U, + AttrBuilder().addAttribute(Attribute::StructRet))); Attrs.push_back( - AttributeSet::get(MB.getModule()->getContext(), 2U, - AttrBuilder().addAttribute(Attribute::ByVal))); + AttributeList::get(MB.getModule()->getContext(), 2U, + AttrBuilder().addAttribute(Attribute::ByVal))); Attrs.push_back( - AttributeSet::get(MB.getModule()->getContext(), ~0U, - AttrBuilder().addAttribute(Attribute::NoUnwind))); - F->setAttributes(AttributeSet::get(MB.getModule()->getContext(), Attrs)); + AttributeList::get(MB.getModule()->getContext(), ~0U, + AttrBuilder().addAttribute(Attribute::NoUnwind))); + F->setAttributes(AttributeList::get(MB.getModule()->getContext(), Attrs)); auto ImplPtr = orc::createImplPointer(*F->getType(), *MB.getModule(), "", nullptr); orc::makeStub(*F, *ImplPtr); Index: llvm/trunk/unittests/IR/AttributesTest.cpp =================================================================== --- llvm/trunk/unittests/IR/AttributesTest.cpp +++ llvm/trunk/unittests/IR/AttributesTest.cpp @@ -21,13 +21,11 @@ Attribute AttrB = Attribute::get(C, Attribute::AlwaysInline); EXPECT_EQ(AttrA, AttrB); - AttributeSet ASs[] = { - AttributeSet::get(C, 1, Attribute::ZExt), - AttributeSet::get(C, 2, Attribute::SExt) - }; + AttributeList ASs[] = {AttributeList::get(C, 1, Attribute::ZExt), + AttributeList::get(C, 2, Attribute::SExt)}; - AttributeSet SetA = AttributeSet::get(C, ASs); - AttributeSet SetB = AttributeSet::get(C, ASs); + AttributeList SetA = AttributeList::get(C, ASs); + AttributeList SetB = AttributeList::get(C, ASs); EXPECT_EQ(SetA, SetB); } @@ -43,13 +41,11 @@ EXPECT_TRUE(Align4 < Deref5); EXPECT_TRUE(Align5 < Deref4); - AttributeSet ASs[] = { - AttributeSet::get(C, 2, Attribute::ZExt), - AttributeSet::get(C, 1, Attribute::SExt) - }; + AttributeList ASs[] = {AttributeList::get(C, 2, Attribute::ZExt), + AttributeList::get(C, 1, Attribute::SExt)}; - AttributeSet SetA = AttributeSet::get(C, ASs); - AttributeSet SetB = SetA.removeAttributes(C, 1, ASs[1]); + AttributeList SetA = AttributeList::get(C, ASs); + AttributeList SetB = SetA.removeAttributes(C, 1, ASs[1]); EXPECT_NE(SetA, SetB); } Index: llvm/trunk/unittests/IR/InstructionsTest.cpp =================================================================== --- llvm/trunk/unittests/IR/InstructionsTest.cpp +++ llvm/trunk/unittests/IR/InstructionsTest.cpp @@ -517,7 +517,8 @@ { AttrBuilder AB; AB.addAttribute(Attribute::ReadOnly); - Call->setAttributes(AttributeSet::get(C, AttributeSet::FunctionIndex, AB)); + Call->setAttributes( + AttributeList::get(C, AttributeList::FunctionIndex, AB)); std::unique_ptr Clone(cast(Call->clone())); EXPECT_TRUE(Clone->onlyReadsMemory()); } @@ -535,7 +536,7 @@ Call->setTailCallKind(CallInst::TailCallKind::TCK_NoTail); AttrBuilder AB; AB.addAttribute(Attribute::Cold); - Call->setAttributes(AttributeSet::get(C, AttributeSet::FunctionIndex, AB)); + Call->setAttributes(AttributeList::get(C, AttributeList::FunctionIndex, AB)); Call->setDebugLoc(DebugLoc(MDNode::get(C, None))); OperandBundleDef NewBundle("after", ConstantInt::get(Int32Ty, 7)); @@ -563,7 +564,8 @@ Callee, NormalDest.get(), UnwindDest.get(), Args, OldBundle, "result")); AttrBuilder AB; AB.addAttribute(Attribute::Cold); - Invoke->setAttributes(AttributeSet::get(C, AttributeSet::FunctionIndex, AB)); + Invoke->setAttributes( + AttributeList::get(C, AttributeList::FunctionIndex, AB)); Invoke->setDebugLoc(DebugLoc(MDNode::get(C, None))); OperandBundleDef NewBundle("after", ConstantInt::get(Int32Ty, 7)); Index: llvm/trunk/unittests/IR/LegacyPassManagerTest.cpp =================================================================== --- llvm/trunk/unittests/IR/LegacyPassManagerTest.cpp +++ llvm/trunk/unittests/IR/LegacyPassManagerTest.cpp @@ -429,7 +429,7 @@ /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"test1", mod); func_test1->setCallingConv(CallingConv::C); - AttributeSet func_test1_PAL; + AttributeList func_test1_PAL; func_test1->setAttributes(func_test1_PAL); Function* func_test2 = Function::Create( @@ -437,7 +437,7 @@ /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"test2", mod); func_test2->setCallingConv(CallingConv::C); - AttributeSet func_test2_PAL; + AttributeList func_test2_PAL; func_test2->setAttributes(func_test2_PAL); Function* func_test3 = Function::Create( @@ -445,7 +445,7 @@ /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"test3", mod); func_test3->setCallingConv(CallingConv::C); - AttributeSet func_test3_PAL; + AttributeList func_test3_PAL; func_test3->setAttributes(func_test3_PAL); Function* func_test4 = Function::Create( @@ -453,7 +453,7 @@ /*Linkage=*/GlobalValue::ExternalLinkage, /*Name=*/"test4", mod); func_test4->setCallingConv(CallingConv::C); - AttributeSet func_test4_PAL; + AttributeList func_test4_PAL; func_test4->setAttributes(func_test4_PAL); // Global Variable Declarations @@ -474,7 +474,8 @@ // Block entry (label_entry) CallInst* int32_3 = CallInst::Create(func_test2, "", label_entry); int32_3->setCallingConv(CallingConv::C); - int32_3->setTailCall(false);AttributeSet int32_3_PAL; + int32_3->setTailCall(false); + AttributeList int32_3_PAL; int32_3->setAttributes(int32_3_PAL); ReturnInst::Create(Context, int32_3, label_entry); @@ -489,7 +490,8 @@ // Block entry (label_entry_5) CallInst* int32_6 = CallInst::Create(func_test3, "", label_entry_5); int32_6->setCallingConv(CallingConv::C); - int32_6->setTailCall(false);AttributeSet int32_6_PAL; + int32_6->setTailCall(false); + AttributeList int32_6_PAL; int32_6->setAttributes(int32_6_PAL); ReturnInst::Create(Context, int32_6, label_entry_5); @@ -504,7 +506,8 @@ // Block entry (label_entry_8) CallInst* int32_9 = CallInst::Create(func_test1, "", label_entry_8); int32_9->setCallingConv(CallingConv::C); - int32_9->setTailCall(false);AttributeSet int32_9_PAL; + int32_9->setTailCall(false); + AttributeList int32_9_PAL; int32_9->setAttributes(int32_9_PAL); ReturnInst::Create(Context, int32_9, label_entry_8); Index: llvm/trunk/unittests/IR/VerifierTest.cpp =================================================================== --- llvm/trunk/unittests/IR/VerifierTest.cpp +++ llvm/trunk/unittests/IR/VerifierTest.cpp @@ -52,9 +52,9 @@ Module M("M", C); FunctionType *FTy = FunctionType::get(Type::getInt32Ty(C), /*isVarArg=*/false); Function *F = cast(M.getOrInsertFunction("foo", FTy)); - AttributeSet AS = F->getAttributes(); - F->setAttributes(AS.addAttribute(C, AttributeSet::ReturnIndex, - Attribute::UWTable)); + AttributeList AS = F->getAttributes(); + F->setAttributes( + AS.addAttribute(C, AttributeList::ReturnIndex, Attribute::UWTable)); std::string Error; raw_string_ostream ErrorOS(Error); Index: llvm/trunk/unittests/Transforms/Utils/Cloning.cpp =================================================================== --- llvm/trunk/unittests/Transforms/Utils/Cloning.cpp +++ llvm/trunk/unittests/Transforms/Utils/Cloning.cpp @@ -163,7 +163,7 @@ Function *F2 = Function::Create(FT1, Function::ExternalLinkage); Attribute::AttrKind AK[] = { Attribute::NoCapture }; - AttributeSet AS = AttributeSet::get(context, 0, AK); + AttributeList AS = AttributeList::get(context, 0, AK); Argument *A = &*F1->arg_begin(); A->addAttr(AS); Index: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp =================================================================== --- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp +++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp @@ -497,10 +497,10 @@ OS << "// Add parameter attributes that are not common to all intrinsics.\n"; OS << "#ifdef GET_INTRINSIC_ATTRIBUTES\n"; if (TargetOnly) - OS << "static AttributeSet getAttributes(LLVMContext &C, " << TargetPrefix + OS << "static AttributeList getAttributes(LLVMContext &C, " << TargetPrefix << "Intrinsic::ID id) {\n"; else - OS << "AttributeSet Intrinsic::getAttributes(LLVMContext &C, ID id) {\n"; + OS << "AttributeList Intrinsic::getAttributes(LLVMContext &C, ID id) {\n"; // Compute the maximum number of attribute arguments and the map typedef std::map