Skip to content

Commit b518054

Browse files
committed
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
1 parent 3b25c91 commit b518054

File tree

94 files changed

+921
-920
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+921
-920
lines changed

llvm/docs/HowToUseAttributes.rst

+16-17
Original file line numberDiff line numberDiff line change
@@ -38,36 +38,35 @@ Because attributes are no longer represented as a bit mask, you will need to
3838
convert any code which does treat them as a bit mask to use the new query
3939
methods on the Attribute class.
4040

41-
``AttributeSet``
41+
``AttributeList``
4242
================
4343

44-
The ``AttributeSet`` class replaces the old ``AttributeList`` class. The
45-
``AttributeSet`` stores a collection of Attribute objects for each kind of
46-
object that may have an attribute associated with it: the function as a
47-
whole, the return type, or the function's parameters. A function's attributes
48-
are at index ``AttributeSet::FunctionIndex``; the return type's attributes are
49-
at index ``AttributeSet::ReturnIndex``; and the function's parameters'
50-
attributes are at indices 1, ..., n (where 'n' is the number of parameters).
51-
Most methods on the ``AttributeSet`` class take an index parameter.
44+
The ``AttributeList`` stores a collection of Attribute objects for each kind of
45+
object that may have an attribute associated with it: the function as a whole,
46+
the return type, or the function's parameters. A function's attributes are at
47+
index ``AttributeList::FunctionIndex``; the return type's attributes are at
48+
index ``AttributeList::ReturnIndex``; and the function's parameters' attributes
49+
are at indices 1, ..., n (where 'n' is the number of parameters). Most methods
50+
on the ``AttributeList`` class take an index parameter.
5251

53-
An ``AttributeSet`` is also a uniqued and immutable object. You create an
54-
``AttributeSet`` through the ``AttributeSet::get`` methods. You can add and
55-
remove attributes, which result in the creation of a new ``AttributeSet``.
52+
An ``AttributeList`` is also a uniqued and immutable object. You create an
53+
``AttributeList`` through the ``AttributeList::get`` methods. You can add and
54+
remove attributes, which result in the creation of a new ``AttributeList``.
5655

57-
An ``AttributeSet`` object is designed to be passed around by value.
56+
An ``AttributeList`` object is designed to be passed around by value.
5857

59-
Note: It is advised that you do *not* use the ``AttributeSet`` "introspection"
58+
Note: It is advised that you do *not* use the ``AttributeList`` "introspection"
6059
methods (e.g. ``Raw``, ``getRawPointer``, etc.). These methods break
6160
encapsulation, and may be removed in a future release (i.e. LLVM 4.0).
6261

6362
``AttrBuilder``
6463
===============
6564

66-
Lastly, we have a "builder" class to help create the ``AttributeSet`` object
65+
Lastly, we have a "builder" class to help create the ``AttributeList`` object
6766
without having to create several different intermediate uniqued
68-
``AttributeSet`` objects. The ``AttrBuilder`` class allows you to add and
67+
``AttributeList`` objects. The ``AttrBuilder`` class allows you to add and
6968
remove attributes at will. The attributes won't be uniqued until you call the
70-
appropriate ``AttributeSet::get`` method.
69+
appropriate ``AttributeList::get`` method.
7170

7271
An ``AttrBuilder`` object is *not* designed to be passed around by value. It
7372
should be passed by reference.

llvm/include/llvm/CodeGen/CommandFlags.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -346,28 +346,28 @@ static inline void setFunctionAttributes(StringRef CPU, StringRef Features,
346346
Module &M) {
347347
for (auto &F : M) {
348348
auto &Ctx = F.getContext();
349-
AttributeSet Attrs = F.getAttributes(), NewAttrs;
349+
AttributeList Attrs = F.getAttributes(), NewAttrs;
350350

351351
if (!CPU.empty())
352-
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex,
352+
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex,
353353
"target-cpu", CPU);
354354

355355
if (!Features.empty())
356-
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex,
356+
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex,
357357
"target-features", Features);
358358

359359
if (DisableFPElim.getNumOccurrences() > 0)
360-
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex,
360+
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex,
361361
"no-frame-pointer-elim",
362362
DisableFPElim ? "true" : "false");
363363

364364
if (DisableTailCalls.getNumOccurrences() > 0)
365-
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex,
365+
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex,
366366
"disable-tail-calls",
367367
toStringRef(DisableTailCalls));
368368

369369
if (StackRealign)
370-
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex,
370+
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex,
371371
"stackrealign");
372372

373373
if (TrapFuncName.getNumOccurrences() > 0)
@@ -377,12 +377,12 @@ static inline void setFunctionAttributes(StringRef CPU, StringRef Features,
377377
if (const auto *F = Call->getCalledFunction())
378378
if (F->getIntrinsicID() == Intrinsic::debugtrap ||
379379
F->getIntrinsicID() == Intrinsic::trap)
380-
Call->addAttribute(llvm::AttributeSet::FunctionIndex,
381-
Attribute::get(Ctx, "trap-func-name",
382-
TrapFuncName));
380+
Call->addAttribute(
381+
llvm::AttributeList::FunctionIndex,
382+
Attribute::get(Ctx, "trap-func-name", TrapFuncName));
383383

384384
// Let NewAttrs override Attrs.
385-
NewAttrs = Attrs.addAttributes(Ctx, AttributeSet::FunctionIndex, NewAttrs);
385+
NewAttrs = Attrs.addAttributes(Ctx, AttributeList::FunctionIndex, NewAttrs);
386386
F.setAttributes(NewAttrs);
387387
}
388388
}

llvm/include/llvm/IR/Argument.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,17 @@ class Argument : public Value {
108108
bool hasSExtAttr() const;
109109

110110
/// Add attributes to an argument.
111-
void addAttr(AttributeSet AS);
111+
void addAttr(AttributeList AS);
112112

113113
void addAttr(Attribute::AttrKind Kind) {
114-
addAttr(AttributeSet::get(getContext(), getArgNo() + 1, Kind));
114+
addAttr(AttributeList::get(getContext(), getArgNo() + 1, Kind));
115115
}
116116

117117
/// Remove attributes from an argument.
118-
void removeAttr(AttributeSet AS);
118+
void removeAttr(AttributeList AS);
119119

120120
void removeAttr(Attribute::AttrKind Kind) {
121-
removeAttr(AttributeSet::get(getContext(), getArgNo() + 1, Kind));
121+
removeAttr(AttributeList::get(getContext(), getArgNo() + 1, Kind));
122122
}
123123

124124
/// Check if an argument has a given attribute.

0 commit comments

Comments
 (0)