summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-03-21 16:57:19 +0000
committerReid Kleckner <rnk@google.com>2017-03-21 16:57:19 +0000
commitb518054b87c40afc4c301dfb26eaa11ee8902208 (patch)
treeb1696798e0788018bf6ec60ef17d314968b895f9
parent3b25c91a9e7769e3254c27979c833fb7185a9fd0 (diff)
downloadbcm5719-llvm-b518054b87c40afc4c301dfb26eaa11ee8902208.tar.gz
bcm5719-llvm-b518054b87c40afc4c301dfb26eaa11ee8902208.zip
Rename AttributeSet to AttributeList
Summary: This class is a list of AttributeSetNodes corresponding the function prototype of a call or function declaration. This class used to be called ParamAttrListPtr, then AttrListPtr, then AttributeSet. It is typically accessed by parameter and return value index, so "AttributeList" seems like a more intuitive name. Rename AttributeSetImpl to AttributeListImpl to follow suit. It's useful to rename this class so that we can rename AttributeSetNode to AttributeSet later. AttributeSet is the set of attributes that apply to a single function, argument, or return value. Reviewers: sanjoy, javed.absar, chandlerc, pete Reviewed By: pete Subscribers: pete, jholewinski, arsenm, dschuff, mehdi_amini, jfb, nhaehnle, sbc100, void, llvm-commits Differential Revision: https://reviews.llvm.org/D31102 llvm-svn: 298393
-rw-r--r--llvm/docs/HowToUseAttributes.rst33
-rw-r--r--llvm/include/llvm/CodeGen/CommandFlags.h20
-rw-r--r--llvm/include/llvm/IR/Argument.h8
-rw-r--r--llvm/include/llvm/IR/Attributes.h146
-rw-r--r--llvm/include/llvm/IR/CallSite.h4
-rw-r--r--llvm/include/llvm/IR/Function.h26
-rw-r--r--llvm/include/llvm/IR/Instructions.h84
-rw-r--r--llvm/include/llvm/IR/Intrinsics.h4
-rw-r--r--llvm/include/llvm/IR/Module.h5
-rw-r--r--llvm/include/llvm/IR/Statepoint.h2
-rw-r--r--llvm/include/llvm/Target/TargetLowering.h6
-rw-r--r--llvm/include/llvm/Transforms/Utils/BuildLibCalls.h4
-rw-r--r--llvm/include/llvm/Transforms/Utils/FunctionComparator.h2
-rw-r--r--llvm/lib/Analysis/MemoryBuiltins.cpp2
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp98
-rw-r--r--llvm/lib/AsmParser/LLParser.h12
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp22
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp14
-rw-r--r--llvm/lib/Bitcode/Writer/ValueEnumerator.cpp4
-rw-r--r--llvm/lib/Bitcode/Writer/ValueEnumerator.h22
-rw-r--r--llvm/lib/CodeGen/Analysis.cpp5
-rw-r--r--llvm/lib/CodeGen/AtomicExpandPass.cpp4
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp10
-rw-r--r--llvm/lib/CodeGen/GlobalISel/CallLowering.cpp4
-rw-r--r--llvm/lib/CodeGen/MachinePipeliner.cpp2
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp6
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp8
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp18
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp13
-rw-r--r--llvm/lib/CodeGen/TargetLoweringBase.cpp12
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp2
-rw-r--r--llvm/lib/IR/AsmWriter.cpp81
-rw-r--r--llvm/lib/IR/AttributeImpl.h24
-rw-r--r--llvm/lib/IR/AttributeSetNode.h9
-rw-r--r--llvm/lib/IR/Attributes.cpp313
-rw-r--r--llvm/lib/IR/Core.cpp15
-rw-r--r--llvm/lib/IR/Function.cpp38
-rw-r--r--llvm/lib/IR/Instructions.cpp36
-rw-r--r--llvm/lib/IR/LLVMContextImpl.cpp7
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h2
-rw-r--r--llvm/lib/IR/Module.cpp16
-rw-r--r--llvm/lib/IR/Statepoint.cpp7
-rw-r--r--llvm/lib/IR/Value.cpp2
-rw-r--r--llvm/lib/IR/Verifier.cpp93
-rw-r--r--llvm/lib/Target/AArch64/AArch64CallLowering.cpp2
-rw-r--r--llvm/lib/Target/AArch64/AArch64FrameLowering.cpp2
-rw-r--r--llvm/lib/Target/AArch64/AArch64ISelLowering.cpp6
-rw-r--r--llvm/lib/Target/AArch64/AArch64ISelLowering.h2
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUIntrinsicInfo.cpp4
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp6
-rw-r--r--llvm/lib/Target/ARM/ARMCallLowering.cpp2
-rw-r--r--llvm/lib/Target/AVR/AVRISelLowering.cpp2
-rw-r--r--llvm/lib/Target/Hexagon/HexagonBitTracker.cpp2
-rw-r--r--llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp6
-rw-r--r--llvm/lib/Target/Mips/Mips16HardFloat.cpp16
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp2
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp2
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp4
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp3
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h2
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp19
-rw-r--r--llvm/lib/Target/X86/X86CallLowering.cpp2
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp8
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.h2
-rw-r--r--llvm/lib/Target/XCore/XCoreFrameLowering.cpp2
-rw-r--r--llvm/lib/Transforms/Coroutines/CoroSplit.cpp6
-rw-r--r--llvm/lib/Transforms/Coroutines/Coroutines.cpp6
-rw-r--r--llvm/lib/Transforms/IPO/ArgumentPromotion.cpp36
-rw-r--r--llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp71
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp31
-rw-r--r--llvm/lib/Transforms/IPO/GlobalOpt.cpp2
-rw-r--r--llvm/lib/Transforms/IPO/MergeFunctions.cpp4
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp70
-rw-r--r--llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp56
-rw-r--r--llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp14
-rw-r--r--llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp5
-rw-r--r--llvm/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h14
-rw-r--r--llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp2
-rw-r--r--llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp2
-rw-r--r--llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp33
-rw-r--r--llvm/lib/Transforms/Utils/BuildLibCalls.cpp22
-rw-r--r--llvm/lib/Transforms/Utils/CloneFunction.cpp15
-rw-r--r--llvm/lib/Transforms/Utils/CodeExtractor.cpp4
-rw-r--r--llvm/lib/Transforms/Utils/FunctionComparator.cpp8
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp2
-rw-r--r--llvm/lib/Transforms/Utils/ModuleUtils.cpp4
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp4
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp16
-rw-r--r--llvm/unittests/IR/AttributesTest.cpp20
-rw-r--r--llvm/unittests/IR/InstructionsTest.cpp8
-rw-r--r--llvm/unittests/IR/LegacyPassManagerTest.cpp17
-rw-r--r--llvm/unittests/IR/VerifierTest.cpp6
-rw-r--r--llvm/unittests/Transforms/Utils/Cloning.cpp2
-rw-r--r--llvm/utils/TableGen/IntrinsicEmitter.cpp20
94 files changed, 921 insertions, 920 deletions
diff --git a/llvm/docs/HowToUseAttributes.rst b/llvm/docs/HowToUseAttributes.rst
index 66c44c01f63..bb7f63f43a3 100644
--- a/llvm/docs/HowToUseAttributes.rst
+++ b/llvm/docs/HowToUseAttributes.rst
@@ -38,36 +38,35 @@ Because attributes are no longer represented as a bit mask, you will need to
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.
+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 ``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``.
+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.
diff --git a/llvm/include/llvm/CodeGen/CommandFlags.h b/llvm/include/llvm/CodeGen/CommandFlags.h
index 405388d2b31..317a5d3f54c 100644
--- a/llvm/include/llvm/CodeGen/CommandFlags.h
+++ b/llvm/include/llvm/CodeGen/CommandFlags.h
@@ -346,28 +346,28 @@ static inline void setFunctionAttributes(StringRef CPU, StringRef Features,
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 @@ static inline void setFunctionAttributes(StringRef CPU, StringRef Features,
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);
}
}
diff --git a/llvm/include/llvm/IR/Argument.h b/llvm/include/llvm/IR/Argument.h
index 12b485a2426..6fc1dd2f285 100644
--- a/llvm/include/llvm/IR/Argument.h
+++ b/llvm/include/llvm/IR/Argument.h
@@ -108,17 +108,17 @@ public:
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.
diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index c1a37778756..dd2a94559bc 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -34,7 +34,7 @@ namespace llvm {
class AttrBuilder;
class AttributeImpl;
-class AttributeSetImpl;
+class AttributeListImpl;
class AttributeSetNode;
template<typename T> struct DenseMapInfo;
class Function;
@@ -199,11 +199,11 @@ inline Attribute unwrap(LLVMAttributeRef Attr) {
/// \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 @@ public:
private:
friend class AttrBuilder;
- friend class AttributeSetImpl;
+ friend class AttributeListImpl;
friend class AttributeSetNode;
template <typename Ty> 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<std::pair<unsigned, Attribute>> Attrs);
- static AttributeSet get(LLVMContext &C,
- ArrayRef<std::pair<unsigned,
- AttributeSetNode*>> Attrs);
+ /// \brief Create an AttributeList with the specified parameters in it.
+ static AttributeList get(LLVMContext &C,
+ ArrayRef<std::pair<unsigned, Attribute>> Attrs);
+ static AttributeList
+ get(LLVMContext &C, ArrayRef<std::pair<unsigned, AttributeSetNode *>> Attrs);
- static AttributeSet getImpl(LLVMContext &C,
- ArrayRef<std::pair<unsigned,
- AttributeSetNode*>> Attrs);
+ static AttributeList
+ getImpl(LLVMContext &C,
+ ArrayRef<std::pair<unsigned, AttributeSetNode *>> 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<AttributeSet> Attrs);
- static AttributeSet get(LLVMContext &C, unsigned Index,
- ArrayRef<Attribute::AttrKind> Kinds);
- static AttributeSet get(LLVMContext &C, unsigned Index,
- ArrayRef<StringRef> 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<AttributeList> Attrs);
+ static AttributeList get(LLVMContext &C, unsigned Index,
+ ArrayRef<Attribute::AttrKind> Kinds);
+ static AttributeList get(LLVMContext &C, unsigned Index,
+ ArrayRef<StringRef> 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<unsigned> Indices,
- Attribute A) const;
+ AttributeList addAttribute(LLVMContext &C, ArrayRef<unsigned> 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<unsigned> &NumElemsArg);
+ AttributeList addAllocSizeAttr(LLVMContext &C, unsigned Index,
+ unsigned ElemSizeArg,
+ const Optional<unsigned> &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 @@ public:
/// \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 @@ public:
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 @@ public:
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<AttributeSet> {
- static inline AttributeSet getEmptyKey() {
+/// \brief Provide DenseMapInfo for AttributeList.
+template <> struct DenseMapInfo<AttributeList> {
+ static inline AttributeList getEmptyKey() {
uintptr_t Val = static_cast<uintptr_t>(-1);
Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
- return AttributeSet(reinterpret_cast<AttributeSetImpl*>(Val));
+ return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
}
- static inline AttributeSet getTombstoneKey() {
+ static inline AttributeList getTombstoneKey() {
uintptr_t Val = static_cast<uintptr_t>(-2);
Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
- return AttributeSet(reinterpret_cast<AttributeSetImpl*>(Val));
+ return AttributeList(reinterpret_cast<AttributeListImpl *>(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 @@ public:
AttrBuilder(const Attribute &A) {
addAttribute(A);
}
- AttrBuilder(AttributeSet AS, unsigned Idx);
+ AttrBuilder(AttributeList AS, unsigned Idx);
void clear();
@@ -480,7 +478,7 @@ public:
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 @@ public:
/// \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;
diff --git a/llvm/include/llvm/IR/CallSite.h b/llvm/include/llvm/IR/CallSite.h
index e08c7198a76..6a465709cc5 100644
--- a/llvm/include/llvm/IR/CallSite.h
+++ b/llvm/include/llvm/IR/CallSite.h
@@ -323,11 +323,11 @@ public:
}
/// 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));
}
diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h
index 2a23f05cf20..787361ffca0 100644
--- a/llvm/include/llvm/IR/Function.h
+++ b/llvm/include/llvm/IR/Function.h
@@ -64,7 +64,7 @@ private:
size_t NumArgs;
std::unique_ptr<ValueSymbolTable>
SymTab; ///< Symbol table of args/instructions
- AttributeSet AttributeSets; ///< Parameter attributes
+ AttributeList AttributeSets; ///< Parameter attributes
/*
* Value::SubclassData
@@ -184,35 +184,35 @@ public:
}
/// @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 @@ public:
/// @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 @@ public:
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 @@ public:
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 {
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index cc20f14b2da..6ab9b51cb8f 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -1362,7 +1362,7 @@ class CallInst : public Instruction,
public OperandBundleUser<CallInst, User::op_iterator> {
friend class OperandBundleUser<CallInst, User::op_iterator>;
- AttributeSet AttributeList; ///< parameter attributes for call
+ AttributeList Attrs; ///< parameter attributes for call
FunctionType *FTy;
CallInst(const CallInst &CI);
@@ -1641,11 +1641,11 @@ public:
/// 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 @@ public:
/// 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 @@ public:
/// 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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
/// 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 @@ public:
private:
template <typename AttrKind> 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 @@ private:
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 @@ class InvokeInst : public TerminatorInst,
public OperandBundleUser<InvokeInst, User::op_iterator> {
friend class OperandBundleUser<InvokeInst, User::op_iterator>;
- AttributeSet AttributeList;
+ AttributeList Attrs;
FunctionType *FTy;
InvokeInst(const InvokeInst &BI);
@@ -3677,11 +3678,11 @@ public:
/// 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 @@ public:
/// 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 @@ public:
/// 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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
/// 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 @@ private:
void setSuccessorV(unsigned idx, BasicBlock *B) override;
template <typename AttrKind> 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 @@ private:
return false;
if (const Function *F = getCalledFunction())
- return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, Kind);
+ return F->getAttributes().hasAttribute(AttributeList::FunctionIndex,
+ Kind);
return false;
}
diff --git a/llvm/include/llvm/IR/Intrinsics.h b/llvm/include/llvm/IR/Intrinsics.h
index d07358445da..2f6bdf8ecf1 100644
--- a/llvm/include/llvm/IR/Intrinsics.h
+++ b/llvm/include/llvm/IR/Intrinsics.h
@@ -28,7 +28,7 @@ class FunctionType;
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 @@ namespace Intrinsic {
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.
diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h
index 4017f990c17..e13b8f36aa1 100644
--- a/llvm/include/llvm/IR/Module.h
+++ b/llvm/include/llvm/IR/Module.h
@@ -311,7 +311,7 @@ public:
/// 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 @@ public:
/// 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.
diff --git a/llvm/include/llvm/IR/Statepoint.h b/llvm/include/llvm/IR/Statepoint.h
index 916faa4b327..03151cd7c8f 100644
--- a/llvm/include/llvm/IR/Statepoint.h
+++ b/llvm/include/llvm/IR/Statepoint.h
@@ -454,7 +454,7 @@ struct StatepointDirectives {
/// 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.
diff --git a/llvm/include/llvm/Target/TargetLowering.h b/llvm/include/llvm/Target/TargetLowering.h
index fdbbb7bf1ff..59a2275d6a3 100644
--- a/llvm/include/llvm/Target/TargetLowering.h
+++ b/llvm/include/llvm/Target/TargetLowering.h
@@ -284,9 +284,7 @@ public:
/// 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 @@ private:
/// 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<ISD::OutputArg> &Outs,
const TargetLowering &TLI, const DataLayout &DL);
diff --git a/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h b/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
index 2d2a85905d0..a067a685b83 100644
--- a/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
+++ b/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
@@ -84,14 +84,14 @@ namespace llvm {
/// 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);
diff --git a/llvm/include/llvm/Transforms/Utils/FunctionComparator.h b/llvm/include/llvm/Transforms/Utils/FunctionComparator.h
index a613fc31a5e..ee58d1d138f 100644
--- a/llvm/include/llvm/Transforms/Utils/FunctionComparator.h
+++ b/llvm/include/llvm/Transforms/Utils/FunctionComparator.h
@@ -314,7 +314,7 @@ protected:
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;
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index e9d27b5e367..4b7e0490e31 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -183,7 +183,7 @@ static Optional<AllocFnsTy> getAllocationSize(const Value *V,
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);
}
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index b9415a26590..ab315dd2c7f 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -130,9 +130,9 @@ bool LLParser::ValidateEndOfModule() {
B.merge(NumberedAttrBuilders[Attr]);
if (Function *Fn = dyn_cast<Function>(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 @@ bool LLParser::ValidateEndOfModule() {
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<CallInst>(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<InvokeInst>(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 @@ bool LLParser::ParseParameterList(SmallVectorImpl<ParamInfo> &ArgList,
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 @@ bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList,
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 @@ bool LLParser::ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList,
ArgList.emplace_back(
TypeLoc, ArgTy,
- AttributeSet::get(ArgTy->getContext(), AttrIndex++, Attrs),
+ AttributeList::get(ArgTy->getContext(), AttrIndex++, Attrs),
std::move(Name));
}
}
@@ -4741,27 +4737,25 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
// Okay, if we got here, the function is syntactically valid. Convert types
// and do semantic checks.
std::vector<Type*> ParamTypeList;
- SmallVector<AttributeSet, 8> Attrs;
+ SmallVector<AttributeList, 8> 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 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
return true;
// Set up the Attribute for the function.
- SmallVector<AttributeSet, 8> Attrs;
+ SmallVector<AttributeList, 8> 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<Value*, 8> Args;
@@ -5397,7 +5390,7 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
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 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
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 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
return true;
// Set up the Attribute for the function.
- SmallVector<AttributeSet, 8> Attrs;
+ SmallVector<AttributeList, 8> 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<Value*, 8> Args;
@@ -6001,7 +5992,7 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
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 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
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);
diff --git a/llvm/lib/AsmParser/LLParser.h b/llvm/lib/AsmParser/LLParser.h
index 16d4e8b5baa..7dae33480ed 100644
--- a/llvm/lib/AsmParser/LLParser.h
+++ b/llvm/lib/AsmParser/LLParser.h
@@ -391,9 +391,9 @@ namespace llvm {
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<ParamInfo> &ArgList,
PerFunctionState &PFS,
@@ -444,10 +444,10 @@ namespace llvm {
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<ArgInfo> &ArgList, bool &isVarArg);
bool ParseFunctionHeader(Function *&Fn, bool isDefine);
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 9e87f1aa96d..4bb0e9fb472 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -419,10 +419,10 @@ class BitcodeReader : public BitcodeReaderBase, public GVMaterializer {
/// 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<AttributeSet> MAttributes;
+ std::vector<AttributeList> MAttributes;
/// The set of attribute groups.
- std::map<unsigned, AttributeSet> MAttributeGroups;
+ std::map<unsigned, AttributeList> MAttributeGroups;
/// While parsing a function body, this is a list of the basic blocks for the
/// function.
@@ -520,10 +520,10 @@ private:
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 @@ Error BitcodeReader::parseAttributeBlock() {
SmallVector<uint64_t, 64> Record;
- SmallVector<AttributeSet, 8> Attrs;
+ SmallVector<AttributeList, 8> Attrs;
// Read all the records.
while (true) {
@@ -1162,10 +1162,10 @@ Error BitcodeReader::parseAttributeBlock() {
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 @@ Error BitcodeReader::parseAttributeBlock() {
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 @@ Error BitcodeReader::parseAttributeGroupBlock() {
}
}
- MAttributeGroups[GrpID] = AttributeSet::get(Context, Idx, B);
+ MAttributeGroups[GrpID] = AttributeList::get(Context, Idx, B);
break;
}
}
@@ -3840,7 +3840,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
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 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
return error("Invalid record");
unsigned OpNum = 0;
- AttributeSet PAL = getAttributes(Record[OpNum++]);
+ AttributeList PAL = getAttributes(Record[OpNum++]);
unsigned CCInfo = Record[OpNum++];
FastMathFlags FMF;
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index db8079ee22d..10024ed9083 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -709,22 +709,22 @@ static uint64_t getAttrKindEncoding(Attribute::AttrKind Kind) {
}
void ModuleBitcodeWriter::writeAttributeGroupTable() {
- const std::vector<AttributeSet> &AttrGrps = VE.getAttributeGroups();
+ const std::vector<AttributeList> &AttrGrps = VE.getAttributeGroups();
if (AttrGrps.empty()) return;
Stream.EnterSubblock(bitc::PARAMATTR_GROUP_BLOCK_ID, 3);
SmallVector<uint64_t, 64> 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::writeAttributeGroupTable() {
}
void ModuleBitcodeWriter::writeAttributeTable() {
- const std::vector<AttributeSet> &Attrs = VE.getAttributes();
+ const std::vector<AttributeList> &Attrs = VE.getAttributes();
if (Attrs.empty()) return;
Stream.EnterSubblock(bitc::PARAMATTR_BLOCK_ID, 3);
SmallVector<uint64_t, 64> 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)));
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index dc10094969d..3800d9abd42 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -887,7 +887,7 @@ void ValueEnumerator::EnumerateOperandType(const Value *V) {
}
}
-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 @@ void ValueEnumerator::EnumerateAttributes(AttributeSet PAL) {
// 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);
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.h b/llvm/lib/Bitcode/Writer/ValueEnumerator.h
index a8d6cf965a4..8a82aab2983 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.h
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.h
@@ -36,7 +36,7 @@ class LocalAsMetadata;
class MDNode;
class MDOperand;
class NamedMDNode;
-class AttributeSet;
+class AttributeList;
class ValueSymbolTable;
class MDSymbolTable;
class raw_ostream;
@@ -102,13 +102,13 @@ private:
bool ShouldPreserveUseListOrder;
- typedef DenseMap<AttributeSet, unsigned> AttributeGroupMapType;
+ typedef DenseMap<AttributeList, unsigned> AttributeGroupMapType;
AttributeGroupMapType AttributeGroupMap;
- std::vector<AttributeSet> AttributeGroups;
+ std::vector<AttributeList> AttributeGroups;
- typedef DenseMap<AttributeSet, unsigned> AttributeMapType;
+ typedef DenseMap<AttributeList, unsigned> AttributeMapType;
AttributeMapType AttributeMap;
- std::vector<AttributeSet> Attribute;
+ std::vector<AttributeList> Attribute;
/// GlobalBasicBlockIDs - This map memoizes the basic block ID's referenced by
/// the "getGlobalBasicBlockID" method.
@@ -166,14 +166,14 @@ public:
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 @@ public:
const std::vector<const BasicBlock*> &getBasicBlocks() const {
return BasicBlocks;
}
- const std::vector<AttributeSet> &getAttributes() const {
- return Attribute;
- }
- const std::vector<AttributeSet> &getAttributeGroups() const {
+ const std::vector<AttributeList> &getAttributes() const { return Attribute; }
+ const std::vector<AttributeList> &getAttributeGroups() const {
return AttributeGroups;
}
@@ -283,7 +281,7 @@ private:
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);
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp
index 79ecc4308fe..afbb854b918 100644
--- a/llvm/lib/CodeGen/Analysis.cpp
+++ b/llvm/lib/CodeGen/Analysis.cpp
@@ -516,10 +516,9 @@ bool llvm::attributesPermitTailCall(const Function *F, const Instruction *I,
bool &ADS = AllowDifferingSizes ? *AllowDifferingSizes : DummyADS;
ADS = true;
- AttrBuilder CallerAttrs(F->getAttributes(),
- AttributeSet::ReturnIndex);
+ AttrBuilder CallerAttrs(F->getAttributes(), AttributeList::ReturnIndex);
AttrBuilder CalleeAttrs(cast<CallInst>(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.
diff --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp
index bf5cf105a8f..9c19a4fd3c3 100644
--- a/llvm/lib/CodeGen/AtomicExpandPass.cpp
+++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp
@@ -1532,7 +1532,7 @@ bool AtomicExpand::expandAtomicOpToLibcall(
Type *ResultTy;
SmallVector<Value *, 6> Args;
- AttributeSet Attr;
+ AttributeList Attr;
// 'size' argument.
if (!UseSizedLibcall) {
@@ -1593,7 +1593,7 @@ bool AtomicExpand::expandAtomicOpToLibcall(
// 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
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 470fa3f5ccc..93d1b7a1243 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -2400,11 +2400,11 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB) {
// 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
diff --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index b0fdf3bbcc6..035a2ac78ed 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -50,7 +50,7 @@ bool CallLowering::lowerCall(
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 @@ template <typename FuncInfoTy>
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))
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 7ffec53e854..77ba5627023 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -733,7 +733,7 @@ bool MachinePipeliner::runOnMachineFunction(MachineFunction &mf) {
return false;
if (mf.getFunction()->getAttributes().hasAttribute(
- AttributeSet::FunctionIndex, Attribute::OptimizeForSize) &&
+ AttributeList::FunctionIndex, Attribute::OptimizeForSize) &&
!EnableSWPOptSize.getPosition())
return false;
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index bc051f07bb2..dd0abd15daf 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -2617,7 +2617,7 @@ SDValue DAGCombiner::visitSDIV(SDNode *N) {
// 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 @@ SDValue DAGCombiner::visitUDIV(SDNode *N) {
}
// 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 @@ SDValue DAGCombiner::visitREM(SDNode *N) {
}
}
- 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.
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index ac15c1d699c..4f6290b751b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -863,9 +863,9 @@ bool FastISel::selectPatchpoint(const CallInst *I) {
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<Attribute::AttrKind, 2> Attrs;
if (CLI.RetSExt)
Attrs.push_back(Attribute::SExt);
@@ -874,8 +874,8 @@ static AttributeSet getReturnAttrs(FastISel::CallLoweringInfo &CLI) {
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,
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 42510c6a86c..76b80794af8 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1373,16 +1373,16 @@ void SelectionDAGBuilder::visitRet(const ReturnInst &I) {
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 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
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 @@ void SelectionDAGBuilder::visitPatchpoint(ImmutableCallSite CS,
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<Attribute::AttrKind, 2> Attrs;
if (CLI.RetSExt)
Attrs.push_back(Attribute::SExt);
@@ -7614,8 +7614,8 @@ static AttributeSet getReturnAttrs(TargetLowering::CallLoweringInfo &CLI) {
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
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 7d1a57d349d..d2496a68dfb 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -55,14 +55,15 @@ bool TargetLowering::isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
// 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 @@ static SDValue BuildExactSDIV(const TargetLowering &TLI, SDValue Op1, APInt d,
SDValue TargetLowering::BuildSDIVPow2(SDNode *N, const APInt &Divisor,
SelectionDAG &DAG,
std::vector<SDNode *> *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
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 7a2d50e63c5..fc147633966 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1589,7 +1589,7 @@ unsigned TargetLoweringBase::getVectorTypeBreakdown(LLVMContext &Context, EVT VT
/// 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<ISD::OutputArg> &Outs,
const TargetLowering &TLI, const DataLayout &DL) {
SmallVector<EVT, 4> ValueVTs;
@@ -1601,9 +1601,9 @@ void llvm::GetReturnInfo(Type *ReturnType, AttributeSet attr,
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 @@ void llvm::GetReturnInfo(Type *ReturnType, AttributeSet attr,
// '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)
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp b/llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp
index 1d7c6e714ed..e956dbebaff 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp
@@ -188,7 +188,7 @@ LLVMBool LLVMCreateMCJITCompilerForModule(
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);
}
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 61573292b95..ca00b1703cb 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -604,7 +604,7 @@ private:
unsigned mdnNext;
/// asMap - The slot map for attribute sets.
- DenseMap<AttributeSet, unsigned> asMap;
+ DenseMap<AttributeList, unsigned> asMap;
unsigned asNext;
public:
/// Construct from a module.
@@ -627,7 +627,7 @@ public:
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 @@ public:
unsigned mdn_size() const { return mdnMap.size(); }
bool mdn_empty() const { return mdnMap.empty(); }
- /// AttributeSet map iterators.
- typedef DenseMap<AttributeSet, unsigned>::iterator as_iterator;
+ /// AttributeList map iterators.
+ typedef DenseMap<AttributeList, unsigned>::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 @@ private:
/// 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 @@ void SlotTracker::processModule() {
// 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 @@ void SlotTracker::processFunction() {
// target may not be linked into the optimizer.
if (const CallInst *CI = dyn_cast<CallInst>(&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<InvokeInst>(&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 @@ int SlotTracker::getLocalSlot(const Value *V) {
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 @@ void SlotTracker::CreateMetadataSlot(const MDNode *N) {
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 @@ public:
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 @@ public:
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::writeAtomicCmpXchg(AtomicOrdering SuccessOrdering,
}
void AssemblyWriter::writeParamOperand(const Value *Operand,
- AttributeSet Attrs, unsigned Idx) {
+ AttributeList Attrs, unsigned Idx) {
if (!Operand) {
Out << "<null operand!>";
return;
@@ -2601,18 +2602,18 @@ void AssemblyWriter::printFunction(const Function *F) {
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 @@ void AssemblyWriter::printFunction(const Function *F) {
}
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 @@ void AssemblyWriter::printFunction(const Function *F) {
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 @@ void AssemblyWriter::printFunction(const Function *F) {
/// 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 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
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 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
Out << ", ...";
Out << ')';
- if (PAL.hasAttributes(AttributeSet::FunctionIndex))
+ if (PAL.hasAttributes(AttributeList::FunctionIndex))
Out << " #" << Machine.getAttributeGroupSlot(PAL.getFnAttributes());
writeOperandBundles(CI);
@@ -3057,7 +3058,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
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 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
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 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
}
Out << ')';
- if (PAL.hasAttributes(AttributeSet::FunctionIndex))
+ if (PAL.hasAttributes(AttributeList::FunctionIndex))
Out << " #" << Machine.getAttributeGroupSlot(PAL.getFnAttributes());
writeOperandBundles(II);
@@ -3247,7 +3248,7 @@ void AssemblyWriter::printMDNodeBody(const MDNode *Node) {
}
void AssemblyWriter::writeAllAttributeGroups() {
- std::vector<std::pair<AttributeSet, unsigned> > asVec;
+ std::vector<std::pair<AttributeList, unsigned>> asVec;
asVec.resize(Machine.as_size());
for (SlotTracker::as_iterator I = Machine.as_begin(), E = Machine.as_end();
@@ -3256,7 +3257,7 @@ void AssemblyWriter::writeAllAttributeGroups() {
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) {
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h
index d0d27101aa8..01140b70bfc 100644
--- a/llvm/lib/IR/AttributeImpl.h
+++ b/llvm/lib/IR/AttributeImpl.h
@@ -150,10 +150,10 @@ typedef std::pair<unsigned, AttributeSetNode *> IndexAttrPair;
/// \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<AttributeSetImpl, IndexAttrPair> {
- friend class AttributeSet;
+ private TrailingObjects<AttributeListImpl, IndexAttrPair> {
+ friend class AttributeList;
friend TrailingObjects;
private:
@@ -171,8 +171,8 @@ private:
}
public:
- AttributeSetImpl(LLVMContext &C,
- ArrayRef<std::pair<unsigned, AttributeSetNode *>> Slots)
+ AttributeListImpl(LLVMContext &C,
+ ArrayRef<std::pair<unsigned, AttributeSetNode *>> Slots)
: Context(C), NumSlots(Slots.size()), AvailableFunctionAttrs(0) {
static_assert(Attribute::EndAttrKinds <=
sizeof(AvailableFunctionAttrs) * CHAR_BIT,
@@ -192,10 +192,10 @@ public:
// 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<unsigned, AttributeSetNode *> &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 @@ public:
}
// 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 @@ public:
/// \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
diff --git a/llvm/lib/IR/AttributeSetNode.h b/llvm/lib/IR/AttributeSetNode.h
index 23ce3713c20..481cf47918c 100644
--- a/llvm/lib/IR/AttributeSetNode.h
+++ b/llvm/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 @@ public:
static AttributeSetNode *get(LLVMContext &C, ArrayRef<Attribute> 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 {
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 3d4245983d0..c2759849b60 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/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 @@ AttributeSetNode *AttributeSetNode::get(LLVMContext &C,
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 @@ std::string AttributeSetNode::getAsString(bool InAttrGrp) const {
}
//===----------------------------------------------------------------------===//
-// AttributeSetImpl Definition
+// AttributeListImpl Definition
//===----------------------------------------------------------------------===//
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void AttributeSetImpl::dump() const {
- AttributeSet(const_cast<AttributeSetImpl *>(this)).dump();
+LLVM_DUMP_METHOD void AttributeListImpl::dump() const {
+ AttributeList(const_cast<AttributeListImpl *>(this)).dump();
}
#endif
//===----------------------------------------------------------------------===//
-// AttributeSet Construction and Mutation Methods
+// AttributeList Construction and Mutation Methods
//===----------------------------------------------------------------------===//
-AttributeSet
-AttributeSet::getImpl(LLVMContext &C,
- ArrayRef<std::pair<unsigned, AttributeSetNode*>> Attrs) {
+AttributeList AttributeList::getImpl(
+ LLVMContext &C, ArrayRef<std::pair<unsigned, AttributeSetNode *>> 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<IndexAttrPair>(Attrs.size()));
- PA = new (Mem) AttributeSetImpl(C, Attrs);
+ AttributeListImpl::totalSizeToAlloc<IndexAttrPair>(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<std::pair<unsigned, Attribute>> Attrs) {
+AttributeList
+AttributeList::get(LLVMContext &C,
+ ArrayRef<std::pair<unsigned, Attribute>> 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<unsigned, Attribute> &LHS,
@@ -669,20 +670,20 @@ AttributeSet AttributeSet::get(LLVMContext &C,
return getImpl(C, AttrPairVec);
}
-AttributeSet AttributeSet::get(LLVMContext &C,
- ArrayRef<std::pair<unsigned,
- AttributeSetNode*>> Attrs) {
+AttributeList
+AttributeList::get(LLVMContext &C,
+ ArrayRef<std::pair<unsigned, AttributeSetNode *>> 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<std::pair<unsigned, Attribute>, 8> Attrs;
@@ -725,28 +726,30 @@ AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index,
return get(C, Attrs);
}
-AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index,
- ArrayRef<Attribute::AttrKind> Kinds) {
+AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
+ ArrayRef<Attribute::AttrKind> Kinds) {
SmallVector<std::pair<unsigned, Attribute>, 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<StringRef> Kinds) {
+AttributeList AttributeList::get(LLVMContext &C, unsigned Index,
+ ArrayRef<StringRef> Kinds) {
SmallVector<std::pair<unsigned, Attribute>, 8> Attrs;
for (StringRef K : Kinds)
Attrs.emplace_back(Index, Attribute::get(C, K));
return get(C, Attrs);
}
-AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<AttributeSet> Attrs) {
- if (Attrs.empty()) return AttributeSet();
+AttributeList AttributeList::get(LLVMContext &C,
+ ArrayRef<AttributeList> Attrs) {
+ if (Attrs.empty())
+ return AttributeList();
if (Attrs.size() == 1) return Attrs[0];
SmallVector<std::pair<unsigned, AttributeSetNode*>, 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 @@ AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<AttributeSet> Attrs) {
// 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<std::pair<unsigned, AttributeSetNode *>, 8>::iterator
ANVI = AttrNodeVec.begin(), ANVE;
@@ -771,35 +774,36 @@ AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<AttributeSet> Attrs) {
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<unsigned> Indices,
- Attribute A) const {
+AttributeList AttributeList::addAttribute(LLVMContext &C,
+ ArrayRef<unsigned> Indices,
+ Attribute A) const {
unsigned I = 0, E = pImpl ? pImpl->getNumSlots() : 0;
auto IdxI = Indices.begin(), IdxE = Indices.end();
- SmallVector<AttributeSet, 4> AttrSet;
+ SmallVector<AttributeList, 4> 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 @@ AttributeSet AttributeSet::addAttribute(LLVMContext &C,
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 @@ AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Index,
#endif
// Add the attribute slots before the one we're trying to add.
- SmallVector<AttributeSet, 4> AttrSet;
+ SmallVector<AttributeList, 4> 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 @@ AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Index,
}
// 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 @@ AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Index,
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 @@ AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,
"Attempt to change alignment!");
// Add the attribute slots before the one we're trying to add.
- SmallVector<AttributeSet, 4> AttrSet;
+ SmallVector<AttributeList, 4> 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 @@ AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,
}
// 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 @@ AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,
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 @@ AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,
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<AttributeSet, 4> AttrSet;
+ SmallVector<AttributeList, 4> 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 @@ AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,
}
// 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 @@ AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,
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<unsigned> &NumElemsArg) {
+AttributeList
+AttributeList::addAllocSizeAttr(LLVMContext &C, unsigned Index,
+ unsigned ElemSizeArg,
+ const Optional<unsigned> &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::pair<unsigned, AttributeSetNode*>>(
- std::make_pair(Index, getAttributes(Index)))) :
- AttributeSet();
+AttributeList AttributeList::getParamAttributes(unsigned Index) const {
+ return pImpl && hasAttributes(Index)
+ ? AttributeList::get(
+ pImpl->getContext(),
+ ArrayRef<std::pair<unsigned, AttributeSetNode *>>(
+ std::make_pair(Index, getAttributes(Index))))
+ : AttributeList();
}
-AttributeSet AttributeSet::getRetAttributes() const {
- return pImpl && hasAttributes(ReturnIndex) ?
- AttributeSet::get(pImpl->getContext(),
- ArrayRef<std::pair<unsigned, AttributeSetNode*>>(
- std::make_pair(ReturnIndex,
- getAttributes(ReturnIndex)))) :
- AttributeSet();
+AttributeList AttributeList::getRetAttributes() const {
+ return pImpl && hasAttributes(ReturnIndex)
+ ? AttributeList::get(
+ pImpl->getContext(),
+ ArrayRef<std::pair<unsigned, AttributeSetNode *>>(
+ std::make_pair(ReturnIndex, getAttributes(ReturnIndex))))
+ : AttributeList();
}
-AttributeSet AttributeSet::getFnAttributes() const {
- return pImpl && hasAttributes(FunctionIndex) ?
- AttributeSet::get(pImpl->getContext(),
- ArrayRef<std::pair<unsigned, AttributeSetNode*>>(
- std::make_pair(FunctionIndex,
- getAttributes(FunctionIndex)))) :
- AttributeSet();
+AttributeList AttributeList::getFnAttributes() const {
+ return pImpl && hasAttributes(FunctionIndex)
+ ? AttributeList::get(
+ pImpl->getContext(),
+ ArrayRef<std::pair<unsigned, AttributeSetNode *>>(
+ 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 @@ bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr,
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<unsigned, Optional<unsigned>>
-AttributeSet::getAllocSizeArgs(unsigned Index) const {
+AttributeList::getAllocSizeArgs(unsigned Index) const {
AttributeSetNode *ASN = getAttributes(Index);
return ASN ? ASN->getAllocSizeArgs() : std::make_pair(0u, Optional<unsigned>(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 @@ AttributeSetNode *AttributeSet::getAttributes(unsigned Index) const {
return nullptr;
}
-AttributeSet::iterator AttributeSet::begin(unsigned Slot) const {
+AttributeList::iterator AttributeList::begin(unsigned Slot) const {
if (!pImpl)
return ArrayRef<Attribute>().begin();
return pImpl->begin(Slot);
}
-AttributeSet::iterator AttributeSet::end(unsigned Slot) const {
+AttributeList::iterator AttributeList::end(unsigned Slot) const {
if (!pImpl)
return ArrayRef<Attribute>().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 @@ LLVM_DUMP_METHOD void AttributeSet::dump() const {
// 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 @@ AttrBuilder &AttrBuilder::removeAttribute(Attribute::AttrKind Val) {
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 @@ AttrBuilder &AttrBuilder::removeAttributes(AttributeSet A, uint64_t Index) {
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 @@ bool AttrBuilder::hasAttributes() const {
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 @@ bool AttrBuilder::hasAttributes(AttributeSet A, uint64_t Index) const {
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 @@ static void adjustCallerSSPLevel(Function &Caller, const Function &Callee) {
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) &&
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 49f2e77ec40..c5b3d18764d 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -1888,12 +1888,12 @@ void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx,
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A,
const char *V) {
Function *Func = unwrap<Function>(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 @@ void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align) {
Argument *A = unwrap<Argument>(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 @@ void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
CallSite Call = CallSite(unwrap<Instruction>(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,
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index c384ec994aa..3953a6e1352 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -80,7 +80,7 @@ bool Argument::hasInAllocaAttr() const {
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 @@ bool Argument::onlyReadsMemory() const {
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::dropAllReferences() {
}
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);
}
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index b6792694342..f3a1022a2a6 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -307,7 +307,7 @@ CallInst::CallInst(const CallInst &CI)
: Instruction(CI.getType(), Instruction::Call,
OperandTraits<CallInst>::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 @@ CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB,
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 @@ Value *CallInst::getReturnedArgOperand() const {
}
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 @@ void CallInst::addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes) {
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 @@ InvokeInst::InvokeInst(const InvokeInst &II)
OperandTraits<InvokeInst>::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 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
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 @@ Value *InvokeInst::getReturnedArgOperand() const {
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 @@ bool InvokeInst::dataOperandHasImpliedAttr(unsigned i,
}
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);
}
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index c43356c5382..343722463e5 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -114,9 +114,10 @@ LLVMContextImpl::~LLVMContextImpl() {
}
// Destroy attribute lists.
- for (FoldingSetIterator<AttributeSetImpl> I = AttrsLists.begin(),
- E = AttrsLists.end(); I != E; ) {
- FoldingSetIterator<AttributeSetImpl> Elem = I++;
+ for (FoldingSetIterator<AttributeListImpl> I = AttrsLists.begin(),
+ E = AttrsLists.end();
+ I != E;) {
+ FoldingSetIterator<AttributeListImpl> Elem = I++;
delete &*Elem;
}
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 600fa360c63..0ee0b9c0da2 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -1119,7 +1119,7 @@ public:
FPMapTy FPConstants;
FoldingSet<AttributeImpl> AttrsSet;
- FoldingSet<AttributeSetImpl> AttrsLists;
+ FoldingSet<AttributeListImpl> AttrsLists;
FoldingSet<AttributeSetNode> AttrsSetNodes;
StringMap<MDString, BumpPtrAllocator> MDStringCache;
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index 09dd2aa7b42..9297e5b4393 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -120,9 +120,8 @@ void Module::getOperandBundleTags(SmallVectorImpl<StringRef> &Result) const {
// 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,
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 @@ Constant *Module::getOrInsertFunction(StringRef Name,
// 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 @@ Constant *Module::getOrInsertFunction(StringRef Name,
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.
diff --git a/llvm/lib/IR/Statepoint.cpp b/llvm/lib/IR/Statepoint.cpp
index 63be1e780d8..8c3f0f208cc 100644
--- a/llvm/lib/IR/Statepoint.cpp
+++ b/llvm/lib/IR/Statepoint.cpp
@@ -53,18 +53,19 @@ bool llvm::isStatepointDirectiveAttr(Attribute Attr) {
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))
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index d86d7fc1164..8ca9f878518 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -633,7 +633,7 @@ unsigned Value::getPointerAlignment(const DataLayout &DL) const {
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<LoadInst>(this))
if (MDNode *MD = LI->getMetadata(LLVMContext::MD_align)) {
ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index dd0e9fdc151..4efb7a693b3 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -489,12 +489,12 @@ private:
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<std::pair<unsigned, MDNode *>> MDs);
@@ -1331,7 +1331,7 @@ Verifier::visitModuleFlag(const MDNode *Op,
}
}
-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 @@ void Verifier::verifyAttributeTypes(AttributeSet Attrs, unsigned Idx,
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 @@ void Verifier::verifyAttributeTypes(AttributeSet Attrs, unsigned Idx,
// 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 @@ void Verifier::verifyParameterAttrs(AttributeSet Attrs, unsigned Idx, Type *Ty,
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 @@ void Verifier::verifyParameterAttrs(AttributeSet Attrs, unsigned Idx, Type *Ty,
// 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 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeSet Attrs,
}
}
- 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<GlobalValue>(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<unsigned, Optional<unsigned>> Args =
- Attrs.getAllocSizeArgs(AttributeSet::FunctionIndex);
+ Attrs.getAllocSizeArgs(AttributeList::FunctionIndex);
auto CheckParam = [&](StringRef Name, unsigned ParamNo) {
if (ParamNo >= FT->getNumParams()) {
@@ -1744,15 +1747,15 @@ void Verifier::visitConstantExpr(const ConstantExpr *CE) {
}
}
-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 @@ void Verifier::visitFunction(const Function &F) {
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 @@ void Verifier::visitFunction(const Function &F) {
// 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 @@ void Verifier::verifyCallSite(CallSite CS) {
"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 @@ static bool isTypeCongruent(Type *L, Type *R) {
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 @@ void Verifier::verifyMustTailCall(CallInst &CI) {
// - 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);
diff --git a/llvm/lib/Target/AArch64/AArch64CallLowering.cpp b/llvm/lib/Target/AArch64/AArch64CallLowering.cpp
index f781ecb8997..b2f55a7e1e0 100644
--- a/llvm/lib/Target/AArch64/AArch64CallLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64CallLowering.cpp
@@ -219,7 +219,7 @@ bool AArch64CallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
auto &DL = F.getParent()->getDataLayout();
ArgInfo OrigArg{VReg, Val->getType()};
- setArgFlags(OrigArg, AttributeSet::ReturnIndex, DL, F);
+ setArgFlags(OrigArg, AttributeList::ReturnIndex, DL, F);
SmallVector<ArgInfo, 8> SplitArgs;
splitToValueTypes(OrigArg, SplitArgs, DL, MRI,
diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
index 5cce8f92db3..8c0cdc12c8f 100644
--- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -883,7 +883,7 @@ static unsigned getPrologueDeath(MachineFunction &MF, unsigned Reg) {
static bool produceCompactUnwindFrame(MachineFunction &MF) {
const AArch64Subtarget &Subtarget = MF.getSubtarget<AArch64Subtarget>();
- AttributeSet Attrs = MF.getFunction()->getAttributes();
+ AttributeList Attrs = MF.getFunction()->getAttributes();
return Subtarget.isTargetMachO() &&
!(Subtarget.getTargetLowering()->supportSwiftError() &&
Attrs.hasAttrSomewhere(Attribute::SwiftError));
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 4ad23caa2c9..b16e8d33dc3 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -7762,7 +7762,7 @@ SDValue
AArch64TargetLowering::BuildSDIVPow2(SDNode *N, const APInt &Divisor,
SelectionDAG &DAG,
std::vector<SDNode *> *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 @@ void AArch64TargetLowering::insertCopiesSplitCSR(
}
}
-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 @@ bool AArch64TargetLowering::isIntDivCheap(EVT VT, AttributeSet Attr) const {
// 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();
}
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.h b/llvm/lib/Target/AArch64/AArch64ISelLowering.h
index 2cdc754205b..b8bef0d30d7 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.h
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.h
@@ -402,7 +402,7 @@ public:
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;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUIntrinsicInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUIntrinsicInfo.cpp
index 1317c08662f..86dc9bd9ea7 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUIntrinsicInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUIntrinsicInfo.cpp
@@ -90,8 +90,8 @@ Function *AMDGPUIntrinsicInfo::getDeclaration(Module *M, unsigned IntrID,
Function *F
= cast<Function>(M->getOrInsertFunction(getName(IntrID, Tys), FTy));
- AttributeSet AS = getAttributes(M->getContext(),
- static_cast<AMDGPUIntrinsic::ID>(IntrID));
+ AttributeList AS =
+ getAttributes(M->getContext(), static_cast<AMDGPUIntrinsic::ID>(IntrID));
F->setAttributes(AS);
return F;
}
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
index ca25634afdb..c89c676857f 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
@@ -309,11 +309,11 @@ AMDGPUPromoteAlloca::getLocalSizeYZ(IRBuilder<> &Builder) {
= 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(
diff --git a/llvm/lib/Target/ARM/ARMCallLowering.cpp b/llvm/lib/Target/ARM/ARMCallLowering.cpp
index 7485aaff49c..10e144f8900 100644
--- a/llvm/lib/Target/ARM/ARMCallLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMCallLowering.cpp
@@ -185,7 +185,7 @@ bool ARMCallLowering::lowerReturnVal(MachineIRBuilder &MIRBuilder,
SmallVector<ArgInfo, 4> 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 =
diff --git a/llvm/lib/Target/AVR/AVRISelLowering.cpp b/llvm/lib/Target/AVR/AVRISelLowering.cpp
index 03c5826e8e2..172b9fba7f9 100644
--- a/llvm/lib/Target/AVR/AVRISelLowering.cpp
+++ b/llvm/lib/Target/AVR/AVRISelLowering.cpp
@@ -1381,7 +1381,7 @@ AVRTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
// 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;
}
diff --git a/llvm/lib/Target/Hexagon/HexagonBitTracker.cpp b/llvm/lib/Target/Hexagon/HexagonBitTracker.cpp
index adcea1ea1a0..90ccecb6629 100644
--- a/llvm/lib/Target/Hexagon/HexagonBitTracker.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonBitTracker.cpp
@@ -74,7 +74,7 @@ HexagonEvaluator::HexagonEvaluator(const HexagonRegisterInfo &tri,
// 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);
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
index 8b29461554b..06fc9195fa6 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
@@ -176,11 +176,11 @@ HexagonTargetMachine::HexagonTargetMachine(const Target &T, const Triple &TT,
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()
diff --git a/llvm/lib/Target/Mips/Mips16HardFloat.cpp b/llvm/lib/Target/Mips/Mips16HardFloat.cpp
index 191006d6463..53a5d2f0ac1 100644
--- a/llvm/lib/Target/Mips/Mips16HardFloat.cpp
+++ b/llvm/lib/Target/Mips/Mips16HardFloat.cpp
@@ -405,7 +405,7 @@ static bool fixupFPReturnAndCall(Function &F, Module *M,
"__mips16_ret_dc"
};
const char *Name = Helper[RV];
- AttributeSet A;
+ AttributeList A;
Value *Params[] = {RVal};
Modified = true;
//
@@ -414,11 +414,11 @@ static bool fixupFPReturnAndCall(Function &F, Module *M,
// 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 @@ static void createFPFnStub(Function *F, Module *M, FPParamVariant PV,
// 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);
}
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index e5942997c20..307ca6b99ff 100644
--- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1493,7 +1493,7 @@ void NVPTXAsmPrinter::printParamName(Function::const_arg_iterator I,
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;
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index 8b3e49abc82..69a210f1a91 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -2315,7 +2315,7 @@ SDValue NVPTXTargetLowering::LowerFormalArguments(
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();
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
index f48b7f3af83..e7fd4ef33e1 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
@@ -596,7 +596,7 @@ bool WebAssemblyFastISel::fastLowerArguments() {
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 @@ bool WebAssemblyFastISel::selectCall(const Instruction *I) {
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) ||
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index 9c8de79866f..31a5ca1f4cc 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -258,7 +258,8 @@ bool WebAssemblyTargetLowering::allowsMisalignedMemoryAccesses(
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;
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h
index 5bc723028e6..99d3d0d558f 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h
@@ -58,7 +58,7 @@ class WebAssemblyTargetLowering final : public TargetLowering {
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<SDValue> &InVals) const override;
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
index 279b4bdfabe..16e7ffa58c0 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -412,7 +412,7 @@ Value *WebAssemblyLowerEmscriptenEHSjLj::wrapInvoke(CallOrInvoke *CI) {
if (CI->doesNotReturn()) {
if (auto *F = dyn_cast<Function>(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 @@ Value *WebAssemblyLowerEmscriptenEHSjLj::wrapInvoke(CallOrInvoke *CI) {
// Because we added the pointer to the callee as first argument, all
// argument attribute indices have to be incremented by one.
- SmallVector<AttributeSet, 8> AttributesVec;
- const AttributeSet &InvokePAL = CI->getAttributes();
+ SmallVector<AttributeList, 8> 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);
diff --git a/llvm/lib/Target/X86/X86CallLowering.cpp b/llvm/lib/Target/X86/X86CallLowering.cpp
index 85ebf25c3a8..ce905c9d804 100644
--- a/llvm/lib/Target/X86/X86CallLowering.cpp
+++ b/llvm/lib/Target/X86/X86CallLowering.cpp
@@ -107,7 +107,7 @@ bool X86CallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
const Function &F = *MF.getFunction();
ArgInfo OrigArg{VReg, Val->getType()};
- setArgFlags(OrigArg, AttributeSet::ReturnIndex, DL, F);
+ setArgFlags(OrigArg, AttributeList::ReturnIndex, DL, F);
SmallVector<ArgInfo, 8> SplitArgs;
splitToValueTypes(OrigArg, SplitArgs, DL, MRI,
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 6a7c6d59db9..88b90884715 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -20781,7 +20781,7 @@ SDValue X86TargetLowering::LowerINIT_TRAMPOLINE(SDValue Op,
// 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 @@ int X86TargetLowering::getScalingFactorCost(const DataLayout &DL,
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 @@ bool X86TargetLowering::isIntDivCheap(EVT VT, AttributeSet Attr) const {
// 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();
}
diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h
index 60dfe6bcdec..ff6c1275c0e 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.h
+++ b/llvm/lib/Target/X86/X86ISelLowering.h
@@ -1046,7 +1046,7 @@ namespace llvm {
/// \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;
diff --git a/llvm/lib/Target/XCore/XCoreFrameLowering.cpp b/llvm/lib/Target/XCore/XCoreFrameLowering.cpp
index e0e2e031996..a752357400b 100644
--- a/llvm/lib/Target/XCore/XCoreFrameLowering.cpp
+++ b/llvm/lib/Target/XCore/XCoreFrameLowering.cpp
@@ -238,7 +238,7 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF,
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().
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index d1a645ae61d..952a0e5554c 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -244,9 +244,9 @@ static Function *createClone(Function &F, Twine Suffix, coro::Shape &Shape,
// 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.
diff --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
index 877ec34b4d3..ea48043f938 100644
--- a/llvm/lib/Transforms/Coroutines/Coroutines.cpp
+++ b/llvm/lib/Transforms/Coroutines/Coroutines.cpp
@@ -245,9 +245,9 @@ void coro::Shape::buildFrom(Function &F) {
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;
}
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index c1f2c866549..cc525ce6e36 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -102,13 +102,13 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
// 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<AttributeSet, 8> AttributesVec;
- const AttributeSet &PAL = F->getAttributes();
+ SmallVector<AttributeList, 8> 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 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
} 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 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
}
// 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 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
// 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 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
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 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
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 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
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<OperandBundleDef, 1> OpBundles;
CS.getOperandBundlesAsDefs(OpBundles);
@@ -322,12 +322,12 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
Args, OpBundles, "", Call);
cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
cast<InvokeInst>(New)->setAttributes(
- AttributeSet::get(II->getContext(), AttributesVec));
+ AttributeList::get(II->getContext(), AttributesVec));
} else {
New = CallInst::Create(NF, Args, OpBundles, "", Call);
cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
cast<CallInst>(New)->setAttributes(
- AttributeSet::get(New->getContext(), AttributesVec));
+ AttributeList::get(New->getContext(), AttributesVec));
cast<CallInst>(New)->setTailCallKind(
cast<CallInst>(Call)->getTailCallKind());
}
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 1a5ed469221..1f2216d37a1 100644
--- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -166,15 +166,15 @@ bool DeadArgumentEliminationPass::DeleteDeadVarargs(Function &Fn) {
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<AttributeSet, 8> AttributesVec;
+ SmallVector<AttributeList, 8> 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<OperandBundleDef, 1> OpBundles;
@@ -681,8 +681,8 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
bool HasLiveReturnedArg = false;
// Set up to build a new list of parameter attributes.
- SmallVector<AttributeSet, 8> AttributesVec;
- const AttributeSet &PAL = F->getAttributes();
+ SmallVector<AttributeList, 8> AttributesVec;
+ const AttributeList &PAL = F->getAttributes();
// Remember which arguments are still alive.
SmallVector<bool, 10> ArgAlive(FTy->getNumParams(), false);
@@ -703,8 +703,8 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
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 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
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 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
// 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 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
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 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
// 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 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
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<OperandBundleDef, 1> OpBundles;
CS.getOperandBundlesAsDefs(OpBundles);
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index d79a1b3f6b6..80fea977f40 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -225,11 +225,11 @@ static bool addReadAttrs(const SCCNodeSet &SCCNodes, AARGetterT &&AARGetter) {
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 @@ static bool addArgumentReturnedAttrs(const SCCNodeSet &SCCNodes) {
if (Value *RetArg = FindRetArg()) {
auto *A = cast<Argument>(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 @@ static bool addArgumentAttrs(const SCCNodeSet &SCCNodes) {
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 @@ static bool addArgumentAttrs(const SCCNodeSet &SCCNodes) {
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 @@ static bool addArgumentAttrs(const SCCNodeSet &SCCNodes) {
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 @@ static bool addArgumentAttrs(const SCCNodeSet &SCCNodes) {
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 @@ static bool addArgumentAttrs(const SCCNodeSet &SCCNodes) {
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 @@ static bool addArgumentAttrs(const SCCNodeSet &SCCNodes) {
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 @@ static bool addNonNullAttrs(const SCCNodeSet &SCCNodes) {
// 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 @@ static bool addNonNullAttrs(const SCCNodeSet &SCCNodes) {
// 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 @@ static bool addNonNullAttrs(const SCCNodeSet &SCCNodes) {
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;
}
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index 484fdbed0cb..8197efb083c 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -1977,7 +1977,7 @@ static void ChangeCalleesToFastCall(Function *F) {
}
}
-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))
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index d530393c9a4..dc7390232c5 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -436,10 +436,10 @@ void MergeFunctions::replaceDirectCallers(Function *Old, Function *New) {
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);
}
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index d7141931dd1..c259e7e9a93 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -3592,7 +3592,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
// 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 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
}
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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
// inserting cast instructions as necessary.
std::vector<Value*> Args;
Args.reserve(NumActualArgs);
- SmallVector<AttributeSet, 8> attrVec;
+ SmallVector<AttributeList, 8> 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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
// 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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
// 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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
// 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<OperandBundleDef, 1> OpBundles;
CS.getOperandBundlesAsDefs(OpBundles);
@@ -4180,7 +4180,7 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
Value *Callee = CS.getCalledValue();
PointerType *PTy = cast<PointerType>(Callee->getType());
FunctionType *FTy = cast<FunctionType>(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 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
Function *NestF =cast<Function>(Tramp->getArgOperand(1)->stripPointerCasts());
FunctionType *NestFTy = cast<FunctionType>(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 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
std::vector<Value*> NewArgs;
NewArgs.reserve(CS.arg_size() + 1);
- SmallVector<AttributeSet, 8> NewAttrs;
+ SmallVector<AttributeList, 8> 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 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
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 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
// 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 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
}
// 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 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
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<OperandBundleDef, 1> OpBundles;
CS.getOperandBundlesAsDefs(OpBundles);
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index 2dc479cd419..15ca5a0c603 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -254,7 +254,7 @@ class DataFlowSanitizer : public ModulePass {
MDNode *ColdCallWeights;
DFSanABIList ABIList;
DenseMap<Value *, Function *> UnwrappedFnMap;
- AttributeSet ReadOnlyNoneAttrs;
+ AttributeList ReadOnlyNoneAttrs;
bool DFSanRuntimeShadowMask;
Value *getShadowAddress(Value *Addr, Instruction *Pos);
@@ -539,16 +539,17 @@ DataFlowSanitizer::buildWrapperFunction(Function *F, StringRef NewFName,
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 @@ bool DataFlowSanitizer::runOnModule(Module &M) {
DFSanUnionFn = Mod->getOrInsertFunction("__dfsan_union", DFSanUnionFnTy);
if (Function *F = dyn_cast<Function>(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<Function>(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<Function>(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 @@ bool DataFlowSanitizer::runOnModule(Module &M) {
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 @@ bool DataFlowSanitizer::runOnModule(Module &M) {
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 @@ bool DataFlowSanitizer::runOnModule(Module &M) {
&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 @@ Value *DFSanFunction::combineShadows(Value *V1, Value *V2, Instruction *Pos) {
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 @@ Value *DFSanFunction::combineShadows(Value *V1, Value *V2, Instruction *Pos) {
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 @@ Value *DFSanFunction::loadShadow(Value *Addr, uint64_t Size, uint64_t Align,
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 @@ Value *DFSanFunction::loadShadow(Value *Addr, uint64_t Size, uint64_t Align,
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 @@ void DFSanVisitor::visitCallSite(CallSite CS) {
// 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 @@ void DFSanVisitor::visitCallSite(CallSite CS) {
}
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) {
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index b028285a06a..ed228556bdc 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2607,10 +2607,10 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
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 @@ bool MemorySanitizer::runOnFunction(Function &F) {
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();
}
diff --git a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
index 52035c79a4a..b68fea0e494 100644
--- a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
@@ -155,8 +155,9 @@ FunctionPass *llvm::createThreadSanitizerPass() {
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));
diff --git a/llvm/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h b/llvm/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h
index c7482721036..c541fa4c8be 100644
--- a/llvm/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h
+++ b/llvm/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h
@@ -127,9 +127,8 @@ private:
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 @@ private:
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 @@ private:
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,
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index d4d5ef4b158..43a78cdde61 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -322,7 +322,7 @@ static bool processCallSite(CallSite CS, LazyValueInfo *LVI) {
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);
diff --git a/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp b/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
index 5494356a60b..1bfecea2f61 100644
--- a/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
+++ b/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
@@ -66,7 +66,7 @@ static bool optimizeSQRT(CallInst *Call, Function *CalledFunc,
// 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);
diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
index 1b326816d11..95e598a17b1 100644
--- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -1128,14 +1128,14 @@ normalizeForInvokeSafepoint(BasicBlock *BB, BasicBlock *InvokeParent,
// 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 @@ static AttributeSet legalizeCallAttributes(AttributeSet AS) {
Ret = Ret.addAttributes(
AS.getContext(), Index,
- AttributeSet::get(AS.getContext(), Index, AttrBuilder(Attr)));
+ AttributeList::get(AS.getContext(), Index, AttrBuilder(Attr)));
}
}
@@ -1304,12 +1304,11 @@ static StringRef getDeoptLowering(CallSite CS) {
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 @@ makeStatepointExplicitImpl(const CallSite CS, /* to replace */
// Create the statepoint given all the arguments
Instruction *Token = nullptr;
- AttributeSet ReturnAttrs;
+ AttributeList ReturnAttrs;
if (CS.isCall()) {
CallInst *ToReplace = cast<CallInst>(CS.getInstruction());
CallInst *Call = Builder.CreateGCStatepointCall(
@@ -1405,7 +1404,7 @@ makeStatepointExplicitImpl(const CallSite CS, /* to replace */
// 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 @@ makeStatepointExplicitImpl(const CallSite CS, /* to replace */
// 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 @@ static void RemoveNonValidAttrAtIndex(LLVMContext &Ctx, AttrHolder &AH,
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 @@ RewriteStatepointsForGC::stripNonValidAttributesFromPrototype(Function &F) {
RemoveNonValidAttrAtIndex(Ctx, F, A.getArgNo() + 1);
if (isa<PointerType>(F.getReturnType()))
- RemoveNonValidAttrAtIndex(Ctx, F, AttributeSet::ReturnIndex);
+ RemoveNonValidAttrAtIndex(Ctx, F, AttributeList::ReturnIndex);
}
void RewriteStatepointsForGC::stripNonValidAttributesFromBody(Function &F) {
@@ -2356,7 +2355,7 @@ void RewriteStatepointsForGC::stripNonValidAttributesFromBody(Function &F) {
if (isa<PointerType>(CS.getArgument(i)->getType()))
RemoveNonValidAttrAtIndex(Ctx, CS, i + 1);
if (isa<PointerType>(CS.getType()))
- RemoveNonValidAttrAtIndex(Ctx, CS, AttributeSet::ReturnIndex);
+ RemoveNonValidAttrAtIndex(Ctx, CS, AttributeList::ReturnIndex);
}
}
}
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
index 240fb70f6b5..aac604531da 100644
--- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -96,9 +96,9 @@ static bool setDoesNotAlias(Function &F, unsigned n) {
}
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 @@ bool llvm::inferLibFuncAttributes(Function &F, const TargetLibraryInfo &TLI) {
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 @@ Value *llvm::emitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize,
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 @@ static void appendTypeSuffix(Value *Op, StringRef &Name,
}
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::emitUnaryFloatFnCall(Value *Op, StringRef Name, IRBuilder<> &B,
}
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);
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index b3c062f37cc..60b988e880b 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -90,9 +90,9 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
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 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
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<Argument>(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<std::pair<unsigned, MDNode *>, 1> MDs;
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
index 176d80d608f..755427cace2 100644
--- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -362,8 +362,8 @@ Function *CodeExtractor::constructFunction(const ValueSet &inputs,
// "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);
diff --git a/llvm/lib/Transforms/Utils/FunctionComparator.cpp b/llvm/lib/Transforms/Utils/FunctionComparator.cpp
index 81a7c4ceffa..73a0b2737e9 100644
--- a/llvm/lib/Transforms/Utils/FunctionComparator.cpp
+++ b/llvm/lib/Transforms/Utils/FunctionComparator.cpp
@@ -74,14 +74,14 @@ int FunctionComparator::cmpMem(StringRef L, StringRef R) const {
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;
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 3b1e501bd73..b1f3e43f772 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2123,5 +2123,5 @@ void llvm::maybeMarkSanitizerLibraryCallNoBuiltin(
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);
}
diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
index a53da85f79f..617c8f7175d 100644
--- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -153,14 +153,14 @@ std::pair<Function *, Function *> llvm::createSanitizerCtorAndInitFunctions(
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);
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index ec336798199..fa0ef1729cf 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -809,7 +809,7 @@ Value *LibCallSimplifier::optimizeMemMove(CallInst *CI, IRBuilder<> &B) {
// 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 @@ Value *LibCallSimplifier::optimizeErrorReporting(CallInst *CI, IRBuilder<> &B,
// 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;
diff --git a/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp
index ac847039d9f..48c9f7e6094 100644
--- a/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp
@@ -20,17 +20,17 @@ TEST(IndirectionUtilsTest, MakeStub) {
LLVMContext Context;
ModuleBuilder MB(Context, "x86_64-apple-macosx10.10", "");
Function *F = MB.createFunctionDecl<void(DummyStruct, DummyStruct)>("");
- SmallVector<AttributeSet, 4> Attrs;
+ SmallVector<AttributeList, 4> 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);
diff --git a/llvm/unittests/IR/AttributesTest.cpp b/llvm/unittests/IR/AttributesTest.cpp
index 9f8013ff181..b5b221c63a1 100644
--- a/llvm/unittests/IR/AttributesTest.cpp
+++ b/llvm/unittests/IR/AttributesTest.cpp
@@ -21,13 +21,11 @@ TEST(Attributes, Uniquing) {
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 @@ TEST(Attributes, Ordering) {
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);
}
diff --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp
index 82862601f9b..2adc70d82f3 100644
--- a/llvm/unittests/IR/InstructionsTest.cpp
+++ b/llvm/unittests/IR/InstructionsTest.cpp
@@ -517,7 +517,8 @@ TEST(InstructionsTest, CloneCall) {
{
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<CallInst> Clone(cast<CallInst>(Call->clone()));
EXPECT_TRUE(Clone->onlyReadsMemory());
}
@@ -535,7 +536,7 @@ TEST(InstructionsTest, AlterCallBundles) {
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 @@ TEST(InstructionsTest, AlterInvokeBundles) {
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));
diff --git a/llvm/unittests/IR/LegacyPassManagerTest.cpp b/llvm/unittests/IR/LegacyPassManagerTest.cpp
index 9dceb976c93..0f67d3fb5ac 100644
--- a/llvm/unittests/IR/LegacyPassManagerTest.cpp
+++ b/llvm/unittests/IR/LegacyPassManagerTest.cpp
@@ -429,7 +429,7 @@ namespace llvm {
/*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 @@ namespace llvm {
/*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 @@ namespace llvm {
/*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 @@ namespace llvm {
/*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 @@ namespace llvm {
// 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 @@ namespace llvm {
// 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 @@ namespace llvm {
// 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);
diff --git a/llvm/unittests/IR/VerifierTest.cpp b/llvm/unittests/IR/VerifierTest.cpp
index ad6940afd05..188509aadf7 100644
--- a/llvm/unittests/IR/VerifierTest.cpp
+++ b/llvm/unittests/IR/VerifierTest.cpp
@@ -52,9 +52,9 @@ TEST(VerifierTest, InvalidRetAttribute) {
Module M("M", C);
FunctionType *FTy = FunctionType::get(Type::getInt32Ty(C), /*isVarArg=*/false);
Function *F = cast<Function>(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);
diff --git a/llvm/unittests/Transforms/Utils/Cloning.cpp b/llvm/unittests/Transforms/Utils/Cloning.cpp
index a216959751f..403c9c06c18 100644
--- a/llvm/unittests/Transforms/Utils/Cloning.cpp
+++ b/llvm/unittests/Transforms/Utils/Cloning.cpp
@@ -163,7 +163,7 @@ TEST_F(CloneInstruction, Attributes) {
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);
diff --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp
index eb30ddcb280..e9dd2fa0aca 100644
--- a/llvm/utils/TableGen/IntrinsicEmitter.cpp
+++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp
@@ -497,10 +497,10 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
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<const CodeGenIntrinsic*, unsigned,
@@ -518,7 +518,7 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
N = ++AttrNum;
}
- // Emit an array of AttributeSet. Most intrinsics will have at least one
+ // Emit an array of AttributeList. Most intrinsics will have at least one
// entry, for the function itself (index ~1), which is usually nounwind.
OS << " static const uint8_t IntrinsicsToAttributesMap[] = {\n";
@@ -530,7 +530,7 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
}
OS << " };\n\n";
- OS << " AttributeSet AS[" << maxArgAttrs+1 << "];\n";
+ OS << " AttributeList AS[" << maxArgAttrs + 1 << "];\n";
OS << " unsigned NumAttrs = 0;\n";
OS << " if (id != 0) {\n";
OS << " switch(IntrinsicsToAttributesMap[id - ";
@@ -595,8 +595,8 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
++ai;
} while (ai != ae && intrinsic.ArgumentAttributes[ai].first == argNo);
OS << "};\n";
- OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, "
- << argNo+1 << ", AttrParam" << argNo +1 << ");\n";
+ OS << " AS[" << numAttrs++ << "] = AttributeList::get(C, "
+ << argNo + 1 << ", AttrParam" << argNo + 1 << ");\n";
}
}
@@ -699,8 +699,8 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
break;
}
OS << "};\n";
- OS << " AS[" << numAttrs++ << "] = AttributeSet::get(C, "
- << "AttributeSet::FunctionIndex, Atts);\n";
+ OS << " AS[" << numAttrs++ << "] = AttributeList::get(C, "
+ << "AttributeList::FunctionIndex, Atts);\n";
}
if (numAttrs) {
@@ -708,14 +708,14 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
OS << " break;\n";
OS << " }\n";
} else {
- OS << " return AttributeSet();\n";
+ OS << " return AttributeList();\n";
OS << " }\n";
}
}
OS << " }\n";
OS << " }\n";
- OS << " return AttributeSet::get(C, makeArrayRef(AS, NumAttrs));\n";
+ OS << " return AttributeList::get(C, makeArrayRef(AS, NumAttrs));\n";
OS << "}\n";
OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n";
}
OpenPOWER on IntegriCloud