LLVM 19.0.0git
Attributes.h
Go to the documentation of this file.
1//===- llvm/Attributes.h - Container for Attributes -------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9/// \file
10/// This file contains the simple types necessary to represent the
11/// attributes associated with functions and their calls.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_IR_ATTRIBUTES_H
16#define LLVM_IR_ATTRIBUTES_H
17
18#include "llvm-c/Types.h"
19#include "llvm/ADT/ArrayRef.h"
21#include "llvm/ADT/StringRef.h"
22#include "llvm/Config/llvm-config.h"
25#include "llvm/Support/ModRef.h"
27#include <cassert>
28#include <cstdint>
29#include <optional>
30#include <string>
31#include <utility>
32
33namespace llvm {
34
35class AttrBuilder;
36class AttributeMask;
37class AttributeImpl;
38class AttributeListImpl;
39class AttributeSetNode;
40class ConstantRange;
41class FoldingSetNodeID;
42class Function;
43class LLVMContext;
44class Type;
45class raw_ostream;
47
48enum class AllocFnKind : uint64_t {
49 Unknown = 0,
50 Alloc = 1 << 0, // Allocator function returns a new allocation
51 Realloc = 1 << 1, // Allocator function resizes the `allocptr` argument
52 Free = 1 << 2, // Allocator function frees the `allocptr` argument
53 Uninitialized = 1 << 3, // Allocator function returns uninitialized memory
54 Zeroed = 1 << 4, // Allocator function returns zeroed memory
55 Aligned = 1 << 5, // Allocator function aligns allocations per the
56 // `allocalign` argument
57 LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ Aligned)
58};
59
60//===----------------------------------------------------------------------===//
61/// \class
62/// Functions, function parameters, and return types can have attributes
63/// to indicate how they should be treated by optimizations and code
64/// generation. This class represents one of those attributes. It's light-weight
65/// and should be passed around by-value.
66class Attribute {
67public:
68 /// This enumeration lists the attributes that can be associated with
69 /// parameters, function results, or the function itself.
70 ///
71 /// Note: The `uwtable' attribute is about the ABI or the user mandating an
72 /// entry in the unwind table. The `nounwind' attribute is about an exception
73 /// passing by the function.
74 ///
75 /// In a theoretical system that uses tables for profiling and SjLj for
76 /// exceptions, they would be fully independent. In a normal system that uses
77 /// tables for both, the semantics are:
78 ///
79 /// nil = Needs an entry because an exception might pass by.
80 /// nounwind = No need for an entry
81 /// uwtable = Needs an entry because the ABI says so and because
82 /// an exception might pass by.
83 /// uwtable + nounwind = Needs an entry because the ABI says so.
84
85 enum AttrKind {
86 // IR-Level Attributes
87 None, ///< No attributes have been set
88 #define GET_ATTR_ENUM
89 #include "llvm/IR/Attributes.inc"
90 EndAttrKinds, ///< Sentinel value useful for loops
91 EmptyKey, ///< Use as Empty key for DenseMap of AttrKind
92 TombstoneKey, ///< Use as Tombstone key for DenseMap of AttrKind
93 };
94
95 static const unsigned NumIntAttrKinds = LastIntAttr - FirstIntAttr + 1;
96 static const unsigned NumTypeAttrKinds = LastTypeAttr - FirstTypeAttr + 1;
97
98 static bool isEnumAttrKind(AttrKind Kind) {
99 return Kind >= FirstEnumAttr && Kind <= LastEnumAttr;
100 }
101 static bool isIntAttrKind(AttrKind Kind) {
102 return Kind >= FirstIntAttr && Kind <= LastIntAttr;
103 }
104 static bool isTypeAttrKind(AttrKind Kind) {
105 return Kind >= FirstTypeAttr && Kind <= LastTypeAttr;
106 }
108 return Kind >= FirstConstantRangeAttr && Kind <= LastConstantRangeAttr;
109 }
110
111 static bool canUseAsFnAttr(AttrKind Kind);
112 static bool canUseAsParamAttr(AttrKind Kind);
113 static bool canUseAsRetAttr(AttrKind Kind);
114
115private:
116 AttributeImpl *pImpl = nullptr;
117
118 Attribute(AttributeImpl *A) : pImpl(A) {}
119
120public:
121 Attribute() = default;
122
123 //===--------------------------------------------------------------------===//
124 // Attribute Construction
125 //===--------------------------------------------------------------------===//
126
127 /// Return a uniquified Attribute object.
128 static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0);
129 static Attribute get(LLVMContext &Context, StringRef Kind,
130 StringRef Val = StringRef());
131 static Attribute get(LLVMContext &Context, AttrKind Kind, Type *Ty);
132 static Attribute get(LLVMContext &Context, AttrKind Kind,
133 const ConstantRange &CR);
134
135 /// Return a uniquified Attribute object that has the specific
136 /// alignment set.
137 static Attribute getWithAlignment(LLVMContext &Context, Align Alignment);
138 static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment);
140 uint64_t Bytes);
142 uint64_t Bytes);
144 LLVMContext &Context, unsigned ElemSizeArg,
145 const std::optional<unsigned> &NumElemsArg);
147 unsigned MinValue, unsigned MaxValue);
148 static Attribute getWithByValType(LLVMContext &Context, Type *Ty);
149 static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty);
150 static Attribute getWithByRefType(LLVMContext &Context, Type *Ty);
152 static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty);
155 static Attribute getWithNoFPClass(LLVMContext &Context, FPClassTest Mask);
156
157 /// For a typed attribute, return the equivalent attribute with the type
158 /// changed to \p ReplacementTy.
159 Attribute getWithNewType(LLVMContext &Context, Type *ReplacementTy) {
160 assert(isTypeAttribute() && "this requires a typed attribute");
161 return get(Context, getKindAsEnum(), ReplacementTy);
162 }
163
165
167
168 /// Return true if the provided string matches the IR name of an attribute.
169 /// example: "noalias" return true but not "NoAlias"
171
172 //===--------------------------------------------------------------------===//
173 // Attribute Accessors
174 //===--------------------------------------------------------------------===//
175
176 /// Return true if the attribute is an Attribute::AttrKind type.
177 bool isEnumAttribute() const;
178
179 /// Return true if the attribute is an integer attribute.
180 bool isIntAttribute() const;
181
182 /// Return true if the attribute is a string (target-dependent)
183 /// attribute.
184 bool isStringAttribute() const;
185
186 /// Return true if the attribute is a type attribute.
187 bool isTypeAttribute() const;
188
189 /// Return true if the attribute is a ConstantRange attribute.
190 bool isConstantRangeAttribute() const;
191
192 /// Return true if the attribute is any kind of attribute.
193 bool isValid() const { return pImpl; }
194
195 /// Return true if the attribute is present.
196 bool hasAttribute(AttrKind Val) const;
197
198 /// Return true if the target-dependent attribute is present.
199 bool hasAttribute(StringRef Val) const;
200
201 /// Return the attribute's kind as an enum (Attribute::AttrKind). This
202 /// requires the attribute to be an enum, integer, or type attribute.
204
205 /// Return the attribute's value as an integer. This requires that the
206 /// attribute be an integer attribute.
207 uint64_t getValueAsInt() const;
208
209 /// Return the attribute's value as a boolean. This requires that the
210 /// attribute be a string attribute.
211 bool getValueAsBool() const;
212
213 /// Return the attribute's kind as a string. This requires the
214 /// attribute to be a string attribute.
216
217 /// Return the attribute's value as a string. This requires the
218 /// attribute to be a string attribute.
220
221 /// Return the attribute's value as a Type. This requires the attribute to be
222 /// a type attribute.
223 Type *getValueAsType() const;
224
225 /// Return the attribute's value as a ConstantRange. This requires the
226 /// attribute to be a ConstantRange attribute.
228
229 /// Returns the alignment field of an attribute as a byte alignment
230 /// value.
231 MaybeAlign getAlignment() const;
232
233 /// Returns the stack alignment field of an attribute as a byte
234 /// alignment value.
236
237 /// Returns the number of dereferenceable bytes from the
238 /// dereferenceable attribute.
240
241 /// Returns the number of dereferenceable_or_null bytes from the
242 /// dereferenceable_or_null attribute.
244
245 /// Returns the argument numbers for the allocsize attribute.
246 std::pair<unsigned, std::optional<unsigned>> getAllocSizeArgs() const;
247
248 /// Returns the minimum value for the vscale_range attribute.
249 unsigned getVScaleRangeMin() const;
250
251 /// Returns the maximum value for the vscale_range attribute or std::nullopt
252 /// when unknown.
253 std::optional<unsigned> getVScaleRangeMax() const;
254
255 // Returns the unwind table kind.
257
258 // Returns the allocator function kind.
260
261 /// Returns memory effects.
263
264 /// Return the FPClassTest for nofpclass
266
267 /// Returns the value of the range attribute.
268 ConstantRange getRange() const;
269
270 /// The Attribute is converted to a string of equivalent mnemonic. This
271 /// is, presumably, for writing out the mnemonics for the assembly writer.
272 std::string getAsString(bool InAttrGrp = false) const;
273
274 /// Return true if this attribute belongs to the LLVMContext.
275 bool hasParentContext(LLVMContext &C) const;
276
277 /// Equality and non-equality operators.
278 bool operator==(Attribute A) const { return pImpl == A.pImpl; }
279 bool operator!=(Attribute A) const { return pImpl != A.pImpl; }
280
281 /// Less-than operator. Useful for sorting the attributes list.
282 bool operator<(Attribute A) const;
283
284 void Profile(FoldingSetNodeID &ID) const;
285
286 /// Return a raw pointer that uniquely identifies this attribute.
287 void *getRawPointer() const {
288 return pImpl;
289 }
290
291 /// Get an attribute from a raw pointer created by getRawPointer.
292 static Attribute fromRawPointer(void *RawPtr) {
293 return Attribute(reinterpret_cast<AttributeImpl*>(RawPtr));
294 }
295};
296
297// Specialized opaque value conversions.
299 return reinterpret_cast<LLVMAttributeRef>(Attr.getRawPointer());
300}
301
302// Specialized opaque value conversions.
304 return Attribute::fromRawPointer(Attr);
305}
306
307//===----------------------------------------------------------------------===//
308/// \class
309/// This class holds the attributes for a particular argument, parameter,
310/// function, or return value. It is an immutable value type that is cheap to
311/// copy. Adding and removing enum attributes is intended to be fast, but adding
312/// and removing string or integer attributes involves a FoldingSet lookup.
314 friend AttributeListImpl;
315 template <typename Ty, typename Enable> friend struct DenseMapInfo;
316
317 // TODO: Extract AvailableAttrs from AttributeSetNode and store them here.
318 // This will allow an efficient implementation of addAttribute and
319 // removeAttribute for enum attrs.
320
321 /// Private implementation pointer.
322 AttributeSetNode *SetNode = nullptr;
323
324private:
325 explicit AttributeSet(AttributeSetNode *ASN) : SetNode(ASN) {}
326
327public:
328 /// AttributeSet is a trivially copyable value type.
329 AttributeSet() = default;
330 AttributeSet(const AttributeSet &) = default;
331 ~AttributeSet() = default;
332
333 static AttributeSet get(LLVMContext &C, const AttrBuilder &B);
335
336 bool operator==(const AttributeSet &O) const { return SetNode == O.SetNode; }
337 bool operator!=(const AttributeSet &O) const { return !(*this == O); }
338
339 /// Add an argument attribute. Returns a new set because attribute sets are
340 /// immutable.
341 [[nodiscard]] AttributeSet addAttribute(LLVMContext &C,
342 Attribute::AttrKind Kind) const;
343
344 /// Add a target-dependent attribute. Returns a new set because attribute sets
345 /// are immutable.
346 [[nodiscard]] AttributeSet addAttribute(LLVMContext &C, StringRef Kind,
347 StringRef Value = StringRef()) const;
348
349 /// Add attributes to the attribute set. Returns a new set because attribute
350 /// sets are immutable.
352 AttributeSet AS) const;
353
354 /// Remove the specified attribute from this set. Returns a new set because
355 /// attribute sets are immutable.
357 Attribute::AttrKind Kind) const;
358
359 /// Remove the specified attribute from this set. Returns a new set because
360 /// attribute sets are immutable.
362 StringRef Kind) const;
363
364 /// Remove the specified attributes from this set. Returns a new set because
365 /// attribute sets are immutable.
366 [[nodiscard]] AttributeSet
367 removeAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const;
368
369 /// Return the number of attributes in this set.
370 unsigned getNumAttributes() const;
371
372 /// Return true if attributes exists in this set.
373 bool hasAttributes() const { return SetNode != nullptr; }
374
375 /// Return true if the attribute exists in this set.
376 bool hasAttribute(Attribute::AttrKind Kind) const;
377
378 /// Return true if the attribute exists in this set.
379 bool hasAttribute(StringRef Kind) const;
380
381 /// Return the attribute object.
383
384 /// Return the target-dependent attribute object.
385 Attribute getAttribute(StringRef Kind) const;
386
387 MaybeAlign getAlignment() const;
391 Type *getByValType() const;
392 Type *getStructRetType() const;
393 Type *getByRefType() const;
394 Type *getPreallocatedType() const;
395 Type *getInAllocaType() const;
396 Type *getElementType() const;
397 std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
398 const;
399 unsigned getVScaleRangeMin() const;
400 std::optional<unsigned> getVScaleRangeMax() const;
405 std::string getAsString(bool InAttrGrp = false) const;
406
407 /// Return true if this attribute set belongs to the LLVMContext.
408 bool hasParentContext(LLVMContext &C) const;
409
410 using iterator = const Attribute *;
411
412 iterator begin() const;
413 iterator end() const;
414#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
415 void dump() const;
416#endif
417};
418
419//===----------------------------------------------------------------------===//
420/// \class
421/// Provide DenseMapInfo for AttributeSet.
422template <> struct DenseMapInfo<AttributeSet, void> {
424 auto Val = static_cast<uintptr_t>(-1);
425 Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;
426 return AttributeSet(reinterpret_cast<AttributeSetNode *>(Val));
427 }
428
430 auto Val = static_cast<uintptr_t>(-2);
431 Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;
432 return AttributeSet(reinterpret_cast<AttributeSetNode *>(Val));
433 }
434
435 static unsigned getHashValue(AttributeSet AS) {
436 return (unsigned((uintptr_t)AS.SetNode) >> 4) ^
437 (unsigned((uintptr_t)AS.SetNode) >> 9);
438 }
439
440 static bool isEqual(AttributeSet LHS, AttributeSet RHS) { return LHS == RHS; }
441};
442
443//===----------------------------------------------------------------------===//
444/// \class
445/// This class holds the attributes for a function, its return value, and
446/// its parameters. You access the attributes for each of them via an index into
447/// the AttributeList object. The function attributes are at index
448/// `AttributeList::FunctionIndex', the return value is at index
449/// `AttributeList::ReturnIndex', and the attributes for the parameters start at
450/// index `AttributeList::FirstArgIndex'.
452public:
453 enum AttrIndex : unsigned {
457 };
458
459private:
460 friend class AttrBuilder;
461 friend class AttributeListImpl;
462 friend class AttributeSet;
463 friend class AttributeSetNode;
464 template <typename Ty, typename Enable> friend struct DenseMapInfo;
465
466 /// The attributes that we are managing. This can be null to represent
467 /// the empty attributes list.
468 AttributeListImpl *pImpl = nullptr;
469
470public:
471 /// Create an AttributeList with the specified parameters in it.
473 ArrayRef<std::pair<unsigned, Attribute>> Attrs);
475 ArrayRef<std::pair<unsigned, AttributeSet>> Attrs);
476
477 /// Create an AttributeList from attribute sets for a function, its
478 /// return value, and all of its arguments.
479 static AttributeList get(LLVMContext &C, AttributeSet FnAttrs,
480 AttributeSet RetAttrs,
481 ArrayRef<AttributeSet> ArgAttrs);
482
483private:
484 explicit AttributeList(AttributeListImpl *LI) : pImpl(LI) {}
485
486 static AttributeList getImpl(LLVMContext &C, ArrayRef<AttributeSet> AttrSets);
487
488 AttributeList setAttributesAtIndex(LLVMContext &C, unsigned Index,
489 AttributeSet Attrs) const;
490
491public:
492 AttributeList() = default;
493
494 //===--------------------------------------------------------------------===//
495 // AttributeList Construction and Mutation
496 //===--------------------------------------------------------------------===//
497
498 /// Return an AttributeList with the specified parameters in it.
500 static AttributeList get(LLVMContext &C, unsigned Index,
502 static AttributeList get(LLVMContext &C, unsigned Index,
504 ArrayRef<uint64_t> Values);
505 static AttributeList get(LLVMContext &C, unsigned Index,
507 static AttributeList get(LLVMContext &C, unsigned Index,
508 AttributeSet Attrs);
509 static AttributeList get(LLVMContext &C, unsigned Index,
510 const AttrBuilder &B);
511
512 // TODO: remove non-AtIndex versions of these methods.
513 /// Add an attribute to the attribute set at the given index.
514 /// Returns a new list because attribute lists are immutable.
515 [[nodiscard]] AttributeList
517 Attribute::AttrKind Kind) const;
518
519 /// Add an attribute to the attribute set at the given index.
520 /// Returns a new list because attribute lists are immutable.
521 [[nodiscard]] AttributeList
523 StringRef Value = StringRef()) const;
524
525 /// Add an attribute to the attribute set at the given index.
526 /// Returns a new list because attribute lists are immutable.
527 [[nodiscard]] AttributeList
529
530 /// Add attributes to the attribute set at the given index.
531 /// Returns a new list because attribute lists are immutable.
533 unsigned Index,
534 const AttrBuilder &B) const;
535
536 /// Add a function attribute to the list. Returns a new list because
537 /// attribute lists are immutable.
539 Attribute::AttrKind Kind) const {
540 return addAttributeAtIndex(C, FunctionIndex, Kind);
541 }
542
543 /// Add a function attribute to the list. Returns a new list because
544 /// attribute lists are immutable.
546 Attribute Attr) const {
547 return addAttributeAtIndex(C, FunctionIndex, Attr);
548 }
549
550 /// Add a function attribute to the list. Returns a new list because
551 /// attribute lists are immutable.
552 [[nodiscard]] AttributeList
554 StringRef Value = StringRef()) const {
556 }
557
558 /// Add function attribute to the list. Returns a new list because
559 /// attribute lists are immutable.
561 const AttrBuilder &B) const {
563 }
564
565 /// Add a return value attribute to the list. Returns a new list because
566 /// attribute lists are immutable.
568 Attribute::AttrKind Kind) const {
569 return addAttributeAtIndex(C, ReturnIndex, Kind);
570 }
571
572 /// Add a return value attribute to the list. Returns a new list because
573 /// attribute lists are immutable.
575 Attribute Attr) const {
576 return addAttributeAtIndex(C, ReturnIndex, Attr);
577 }
578
579 /// Add a return value attribute to the list. Returns a new list because
580 /// attribute lists are immutable.
582 const AttrBuilder &B) const {
584 }
585
586 /// Add an argument attribute to the list. Returns a new list because
587 /// attribute lists are immutable.
588 [[nodiscard]] AttributeList
590 Attribute::AttrKind Kind) const {
591 return addAttributeAtIndex(C, ArgNo + FirstArgIndex, Kind);
592 }
593
594 /// Add an argument attribute to the list. Returns a new list because
595 /// attribute lists are immutable.
596 [[nodiscard]] AttributeList
597 addParamAttribute(LLVMContext &C, unsigned ArgNo, StringRef Kind,
598 StringRef Value = StringRef()) const {
599 return addAttributeAtIndex(C, ArgNo + FirstArgIndex, Kind, Value);
600 }
601
602 /// Add an attribute to the attribute list at the given arg indices. Returns a
603 /// new list because attribute lists are immutable.
605 ArrayRef<unsigned> ArgNos,
606 Attribute A) const;
607
608 /// Add an argument attribute to the list. Returns a new list because
609 /// attribute lists are immutable.
610 [[nodiscard]] AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo,
611 const AttrBuilder &B) const {
612 return addAttributesAtIndex(C, ArgNo + FirstArgIndex, B);
613 }
614
615 /// Remove the specified attribute at the specified index from this
616 /// attribute list. Returns a new list because attribute lists are immutable.
617 [[nodiscard]] AttributeList
619 Attribute::AttrKind Kind) const;
620
621 /// Remove the specified attribute at the specified index from this
622 /// attribute list. Returns a new list because attribute lists are immutable.
623 [[nodiscard]] AttributeList
624 removeAttributeAtIndex(LLVMContext &C, unsigned Index, StringRef Kind) const;
626 StringRef Kind) const {
627 return removeAttributeAtIndex(C, Index, Kind);
628 }
629
630 /// Remove the specified attributes at the specified index from this
631 /// attribute list. Returns a new list because attribute lists are immutable.
632 [[nodiscard]] AttributeList
634 const AttributeMask &AttrsToRemove) const;
635
636 /// Remove all attributes at the specified index from this
637 /// attribute list. Returns a new list because attribute lists are immutable.
639 unsigned Index) const;
640
641 /// Remove the specified attribute at the function index from this
642 /// attribute list. Returns a new list because attribute lists are immutable.
643 [[nodiscard]] AttributeList
646 }
647
648 /// Remove the specified attribute at the function index from this
649 /// attribute list. Returns a new list because attribute lists are immutable.
651 StringRef Kind) const {
653 }
654
655 /// Remove the specified attribute at the function index from this
656 /// attribute list. Returns a new list because attribute lists are immutable.
657 [[nodiscard]] AttributeList
658 removeFnAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const {
659 return removeAttributesAtIndex(C, FunctionIndex, AttrsToRemove);
660 }
661
662 /// Remove the attributes at the function index from this
663 /// attribute list. Returns a new list because attribute lists are immutable.
666 }
667
668 /// Remove the specified attribute at the return value index from this
669 /// attribute list. Returns a new list because attribute lists are immutable.
670 [[nodiscard]] AttributeList
672 return removeAttributeAtIndex(C, ReturnIndex, Kind);
673 }
674
675 /// Remove the specified attribute at the return value index from this
676 /// attribute list. Returns a new list because attribute lists are immutable.
678 StringRef Kind) const {
679 return removeAttributeAtIndex(C, ReturnIndex, Kind);
680 }
681
682 /// Remove the specified attribute at the return value index from this
683 /// attribute list. Returns a new list because attribute lists are immutable.
684 [[nodiscard]] AttributeList
686 const AttributeMask &AttrsToRemove) const {
687 return removeAttributesAtIndex(C, ReturnIndex, AttrsToRemove);
688 }
689
690 /// Remove the specified attribute at the specified arg index from this
691 /// attribute list. Returns a new list because attribute lists are immutable.
692 [[nodiscard]] AttributeList
694 Attribute::AttrKind Kind) const {
695 return removeAttributeAtIndex(C, ArgNo + FirstArgIndex, Kind);
696 }
697
698 /// Remove the specified attribute at the specified arg index from this
699 /// attribute list. Returns a new list because attribute lists are immutable.
700 [[nodiscard]] AttributeList
701 removeParamAttribute(LLVMContext &C, unsigned ArgNo, StringRef Kind) const {
702 return removeAttributeAtIndex(C, ArgNo + FirstArgIndex, Kind);
703 }
704
705 /// Remove the specified attribute at the specified arg index from this
706 /// attribute list. Returns a new list because attribute lists are immutable.
707 [[nodiscard]] AttributeList
709 const AttributeMask &AttrsToRemove) const {
710 return removeAttributesAtIndex(C, ArgNo + FirstArgIndex, AttrsToRemove);
711 }
712
713 /// Remove all attributes at the specified arg index from this
714 /// attribute list. Returns a new list because attribute lists are immutable.
716 unsigned ArgNo) const {
717 return removeAttributesAtIndex(C, ArgNo + FirstArgIndex);
718 }
719
720 /// Replace the type contained by attribute \p AttrKind at index \p ArgNo wih
721 /// \p ReplacementTy, preserving all other attributes.
722 [[nodiscard]] AttributeList
725 Type *ReplacementTy) const {
726 Attribute Attr = getAttributeAtIndex(ArgNo, Kind);
727 auto Attrs = removeAttributeAtIndex(C, ArgNo, Kind);
728 return Attrs.addAttributeAtIndex(C, ArgNo,
729 Attr.getWithNewType(C, ReplacementTy));
730 }
731
732 /// \brief Add the dereferenceable attribute to the attribute set at the given
733 /// index. Returns a new list because attribute lists are immutable.
735 uint64_t Bytes) const;
736
737 /// \brief Add the dereferenceable attribute to the attribute set at the given
738 /// arg index. Returns a new list because attribute lists are immutable.
740 unsigned ArgNo,
741 uint64_t Bytes) const;
742
743 /// Add the dereferenceable_or_null attribute to the attribute set at
744 /// the given arg index. Returns a new list because attribute lists are
745 /// immutable.
746 [[nodiscard]] AttributeList
748 uint64_t Bytes) const;
749
750 /// Add the allocsize attribute to the attribute set at the given arg index.
751 /// Returns a new list because attribute lists are immutable.
752 [[nodiscard]] AttributeList
753 addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg,
754 const std::optional<unsigned> &NumElemsArg);
755
756 //===--------------------------------------------------------------------===//
757 // AttributeList Accessors
758 //===--------------------------------------------------------------------===//
759
760 /// The attributes for the specified index are returned.
761 AttributeSet getAttributes(unsigned Index) const;
762
763 /// The attributes for the argument or parameter at the given index are
764 /// returned.
765 AttributeSet getParamAttrs(unsigned ArgNo) const;
766
767 /// The attributes for the ret value are returned.
769
770 /// The function attributes are returned.
771 AttributeSet getFnAttrs() const;
772
773 /// Return true if the attribute exists at the given index.
774 bool hasAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const;
775
776 /// Return true if the attribute exists at the given index.
777 bool hasAttributeAtIndex(unsigned Index, StringRef Kind) const;
778
779 /// Return true if attribute exists at the given index.
780 bool hasAttributesAtIndex(unsigned Index) const;
781
782 /// Return true if the attribute exists for the given argument
783 bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
784 return hasAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
785 }
786
787 /// Return true if the attribute exists for the given argument
788 bool hasParamAttr(unsigned ArgNo, StringRef Kind) const {
789 return hasAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
790 }
791
792 /// Return true if attributes exists for the given argument
793 bool hasParamAttrs(unsigned ArgNo) const {
794 return hasAttributesAtIndex(ArgNo + FirstArgIndex);
795 }
796
797 /// Return true if the attribute exists for the return value.
799 return hasAttributeAtIndex(ReturnIndex, Kind);
800 }
801
802 /// Return true if the attribute exists for the return value.
803 bool hasRetAttr(StringRef Kind) const {
804 return hasAttributeAtIndex(ReturnIndex, Kind);
805 }
806
807 /// Return true if attributes exist for the return value.
809
810 /// Return true if the attribute exists for the function.
811 bool hasFnAttr(Attribute::AttrKind Kind) const;
812
813 /// Return true if the attribute exists for the function.
814 bool hasFnAttr(StringRef Kind) const;
815
816 /// Return true the attributes exist for the function.
818
819 /// Return true if the specified attribute is set for at least one
820 /// parameter or for the return value. If Index is not nullptr, the index
821 /// of a parameter with the specified attribute is provided.
823 unsigned *Index = nullptr) const;
824
825 /// Return the attribute object that exists at the given index.
827
828 /// Return the attribute object that exists at the given index.
829 Attribute getAttributeAtIndex(unsigned Index, StringRef Kind) const;
830
831 /// Return the attribute object that exists at the arg index.
832 Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
833 return getAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
834 }
835
836 /// Return the attribute object that exists at the given index.
837 Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const {
838 return getAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
839 }
840
841 /// Return the attribute object that exists for the function.
844 }
845
846 /// Return the attribute object that exists for the function.
849 }
850
851 /// Return the attribute for the given attribute kind for the return value.
853 return getAttributeAtIndex(ReturnIndex, Kind);
854 }
855
856 /// Return the alignment of the return value.
858
859 /// Return the alignment for the specified function parameter.
860 MaybeAlign getParamAlignment(unsigned ArgNo) const;
861
862 /// Return the stack alignment for the specified function parameter.
863 MaybeAlign getParamStackAlignment(unsigned ArgNo) const;
864
865 /// Return the byval type for the specified function parameter.
866 Type *getParamByValType(unsigned ArgNo) const;
867
868 /// Return the sret type for the specified function parameter.
869 Type *getParamStructRetType(unsigned ArgNo) const;
870
871 /// Return the byref type for the specified function parameter.
872 Type *getParamByRefType(unsigned ArgNo) const;
873
874 /// Return the preallocated type for the specified function parameter.
875 Type *getParamPreallocatedType(unsigned ArgNo) const;
876
877 /// Return the inalloca type for the specified function parameter.
878 Type *getParamInAllocaType(unsigned ArgNo) const;
879
880 /// Return the elementtype type for the specified function parameter.
881 Type *getParamElementType(unsigned ArgNo) const;
882
883 /// Get the stack alignment of the function.
885
886 /// Get the stack alignment of the return value.
888
889 /// Get the number of dereferenceable bytes (or zero if unknown) of the return
890 /// value.
892
893 /// Get the number of dereferenceable bytes (or zero if unknown) of an arg.
895
896 /// Get the number of dereferenceable_or_null bytes (or zero if unknown) of
897 /// the return value.
899
900 /// Get the number of dereferenceable_or_null bytes (or zero if unknown) of an
901 /// arg.
902 uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const;
903
904 /// Get the disallowed floating-point classes of the return value.
906
907 /// Get the disallowed floating-point classes of the argument value.
908 FPClassTest getParamNoFPClass(unsigned ArgNo) const;
909
910 /// Get the unwind table kind requested for the function.
912
914
915 /// Returns memory effects of the function.
917
918 /// Return the attributes at the index as a string.
919 std::string getAsString(unsigned Index, bool InAttrGrp = false) const;
920
921 /// Return true if this attribute list belongs to the LLVMContext.
922 bool hasParentContext(LLVMContext &C) const;
923
924 //===--------------------------------------------------------------------===//
925 // AttributeList Introspection
926 //===--------------------------------------------------------------------===//
927
928 using iterator = const AttributeSet *;
929
930 iterator begin() const;
931 iterator end() const;
932
933 unsigned getNumAttrSets() const;
934
935 // Implementation of indexes(). Produces iterators that wrap an index. Mostly
936 // to hide the awkwardness of unsigned wrapping when iterating over valid
937 // indexes.
939 unsigned NumAttrSets;
941 struct int_wrapper {
942 int_wrapper(unsigned i) : i(i) {}
943 unsigned i;
944 unsigned operator*() { return i; }
945 bool operator!=(const int_wrapper &Other) { return i != Other.i; }
947 // This is expected to undergo unsigned wrapping since FunctionIndex is
948 // ~0 and that's where we start.
949 ++i;
950 return *this;
951 }
952 };
953
955
957 };
958
959 /// Use this to iterate over the valid attribute indexes.
961
962 /// operator==/!= - Provide equality predicates.
963 bool operator==(const AttributeList &RHS) const { return pImpl == RHS.pImpl; }
964 bool operator!=(const AttributeList &RHS) const { return pImpl != RHS.pImpl; }
965
966 /// Return a raw pointer that uniquely identifies this attribute list.
967 void *getRawPointer() const {
968 return pImpl;
969 }
970
971 /// Return true if there are no attributes.
972 bool isEmpty() const { return pImpl == nullptr; }
973
974 void print(raw_ostream &O) const;
975
976 void dump() const;
977};
978
979//===----------------------------------------------------------------------===//
980/// \class
981/// Provide DenseMapInfo for AttributeList.
982template <> struct DenseMapInfo<AttributeList, void> {
984 auto Val = static_cast<uintptr_t>(-1);
985 Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
986 return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
987 }
988
990 auto Val = static_cast<uintptr_t>(-2);
991 Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
992 return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
993 }
994
995 static unsigned getHashValue(AttributeList AS) {
996 return (unsigned((uintptr_t)AS.pImpl) >> 4) ^
997 (unsigned((uintptr_t)AS.pImpl) >> 9);
998 }
999
1001 return LHS == RHS;
1002 }
1003};
1004
1005//===----------------------------------------------------------------------===//
1006/// \class
1007/// This class is used in conjunction with the Attribute::get method to
1008/// create an Attribute object. The object itself is uniquified. The Builder's
1009/// value, however, is not. So this can be used as a quick way to test for
1010/// equality, presence of attributes, etc.
1012 LLVMContext &Ctx;
1014
1015public:
1016 AttrBuilder(LLVMContext &Ctx) : Ctx(Ctx) {}
1017 AttrBuilder(const AttrBuilder &) = delete;
1019
1020 AttrBuilder(LLVMContext &Ctx, const Attribute &A) : Ctx(Ctx) {
1021 addAttribute(A);
1022 }
1023
1025
1026 void clear();
1027
1028 /// Add an attribute to the builder.
1030
1031 /// Add the Attribute object to the builder.
1033
1034 /// Add the target-dependent attribute to the builder.
1036
1037 /// Remove an attribute from the builder.
1039
1040 /// Remove the target-dependent attribute from the builder.
1042
1043 /// Remove the target-dependent attribute from the builder.
1045 if (A.isStringAttribute())
1046 return removeAttribute(A.getKindAsString());
1047 else
1048 return removeAttribute(A.getKindAsEnum());
1049 }
1050
1051 /// Add the attributes from the builder. Attributes in the passed builder
1052 /// overwrite attributes in this builder if they have the same key.
1053 AttrBuilder &merge(const AttrBuilder &B);
1054
1055 /// Remove the attributes from the builder.
1056 AttrBuilder &remove(const AttributeMask &AM);
1057
1058 /// Return true if the builder has any attribute that's in the
1059 /// specified builder.
1060 bool overlaps(const AttributeMask &AM) const;
1061
1062 /// Return true if the builder has the specified attribute.
1063 bool contains(Attribute::AttrKind A) const;
1064
1065 /// Return true if the builder has the specified target-dependent
1066 /// attribute.
1067 bool contains(StringRef A) const;
1068
1069 /// Return true if the builder has IR-level attributes.
1070 bool hasAttributes() const { return !Attrs.empty(); }
1071
1072 /// Return Attribute with the given Kind. The returned attribute will be
1073 /// invalid if the Kind is not present in the builder.
1075
1076 /// Return Attribute with the given Kind. The returned attribute will be
1077 /// invalid if the Kind is not present in the builder.
1078 Attribute getAttribute(StringRef Kind) const;
1079
1080 /// Return raw (possibly packed/encoded) value of integer attribute or
1081 /// std::nullopt if not set.
1082 std::optional<uint64_t> getRawIntAttr(Attribute::AttrKind Kind) const;
1083
1084 /// Retrieve the alignment attribute, if it exists.
1086 return MaybeAlign(getRawIntAttr(Attribute::Alignment).value_or(0));
1087 }
1088
1089 /// Retrieve the stack alignment attribute, if it exists.
1091 return MaybeAlign(getRawIntAttr(Attribute::StackAlignment).value_or(0));
1092 }
1093
1094 /// Retrieve the number of dereferenceable bytes, if the
1095 /// dereferenceable attribute exists (zero is returned otherwise).
1097 return getRawIntAttr(Attribute::Dereferenceable).value_or(0);
1098 }
1099
1100 /// Retrieve the number of dereferenceable_or_null bytes, if the
1101 /// dereferenceable_or_null attribute exists (zero is returned otherwise).
1103 return getRawIntAttr(Attribute::DereferenceableOrNull).value_or(0);
1104 }
1105
1106 /// Retrieve type for the given type attribute.
1108
1109 /// Retrieve the byval type.
1110 Type *getByValType() const { return getTypeAttr(Attribute::ByVal); }
1111
1112 /// Retrieve the sret type.
1113 Type *getStructRetType() const { return getTypeAttr(Attribute::StructRet); }
1114
1115 /// Retrieve the byref type.
1116 Type *getByRefType() const { return getTypeAttr(Attribute::ByRef); }
1117
1118 /// Retrieve the preallocated type.
1120 return getTypeAttr(Attribute::Preallocated);
1121 }
1122
1123 /// Retrieve the inalloca type.
1124 Type *getInAllocaType() const { return getTypeAttr(Attribute::InAlloca); }
1125
1126 /// Retrieve the allocsize args, or std::nullopt if the attribute does not
1127 /// exist.
1128 std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
1129 const;
1130
1131 /// Add integer attribute with raw value (packed/encoded if necessary).
1133
1134 /// This turns an alignment into the form used internally in Attribute.
1135 /// This call has no effect if Align is not set.
1137
1138 /// This turns an int alignment (which must be a power of 2) into the
1139 /// form used internally in Attribute.
1140 /// This call has no effect if Align is 0.
1141 /// Deprecated, use the version using a MaybeAlign.
1144 }
1145
1146 /// This turns a stack alignment into the form used internally in Attribute.
1147 /// This call has no effect if Align is not set.
1149
1150 /// This turns an int stack alignment (which must be a power of 2) into
1151 /// the form used internally in Attribute.
1152 /// This call has no effect if Align is 0.
1153 /// Deprecated, use the version using a MaybeAlign.
1156 }
1157
1158 /// This turns the number of dereferenceable bytes into the form used
1159 /// internally in Attribute.
1161
1162 /// This turns the number of dereferenceable_or_null bytes into the
1163 /// form used internally in Attribute.
1165
1166 /// This turns one (or two) ints into the form used internally in Attribute.
1167 AttrBuilder &addAllocSizeAttr(unsigned ElemSizeArg,
1168 const std::optional<unsigned> &NumElemsArg);
1169
1170 /// This turns two ints into the form used internally in Attribute.
1171 AttrBuilder &addVScaleRangeAttr(unsigned MinValue,
1172 std::optional<unsigned> MaxValue);
1173
1174 /// Add a type attribute with the given type.
1176
1177 /// This turns a byval type into the form used internally in Attribute.
1179
1180 /// This turns a sret type into the form used internally in Attribute.
1182
1183 /// This turns a byref type into the form used internally in Attribute.
1185
1186 /// This turns a preallocated type into the form used internally in Attribute.
1188
1189 /// This turns an inalloca type into the form used internally in Attribute.
1191
1192 /// Add an allocsize attribute, using the representation returned by
1193 /// Attribute.getIntValue().
1195
1196 /// Add a vscale_range attribute, using the representation returned by
1197 /// Attribute.getIntValue().
1199
1200 /// This turns the unwind table kind into the form used internally in
1201 /// Attribute.
1203
1204 // This turns the allocator kind into the form used internally in Attribute.
1206
1207 /// Add memory effect attribute.
1209
1210 // Add nofpclass attribute
1212
1213 /// Add a ConstantRange attribute with the given range.
1215 const ConstantRange &CR);
1216
1217 /// Add range attribute.
1219
1220 ArrayRef<Attribute> attrs() const { return Attrs; }
1221
1222 bool operator==(const AttrBuilder &B) const;
1223 bool operator!=(const AttrBuilder &B) const { return !(*this == B); }
1224};
1225
1226namespace AttributeFuncs {
1227
1228enum AttributeSafetyKind : uint8_t {
1232};
1233
1234/// Returns true if this is a type legal for the 'nofpclass' attribute. This
1235/// follows the same type rules as FPMathOperator.
1237
1238/// Which attributes cannot be applied to a type. The argument \p ASK indicates,
1239/// if only attributes that are known to be safely droppable are contained in
1240/// the mask; only attributes that might be unsafe to drop (e.g., ABI-related
1241/// attributes) are in the mask; or both.
1243
1244/// Get param/return attributes which imply immediate undefined behavior if an
1245/// invalid value is passed. For example, this includes noundef (where undef
1246/// implies UB), but not nonnull (where null implies poison). It also does not
1247/// include attributes like nocapture, which constrain the function
1248/// implementation rather than the passed value.
1250
1251/// \returns Return true if the two functions have compatible target-independent
1252/// attributes for inlining purposes.
1253bool areInlineCompatible(const Function &Caller, const Function &Callee);
1254
1255
1256/// Checks if there are any incompatible function attributes between
1257/// \p A and \p B.
1258///
1259/// \param [in] A - The first function to be compared with.
1260/// \param [in] B - The second function to be compared with.
1261/// \returns true if the functions have compatible attributes.
1262bool areOutlineCompatible(const Function &A, const Function &B);
1263
1264/// Merge caller's and callee's attributes.
1265void mergeAttributesForInlining(Function &Caller, const Function &Callee);
1266
1267/// Merges the functions attributes from \p ToMerge into function \p Base.
1268///
1269/// \param [in,out] Base - The function being merged into.
1270/// \param [in] ToMerge - The function to merge attributes from.
1271void mergeAttributesForOutlining(Function &Base, const Function &ToMerge);
1272
1273/// Update min-legal-vector-width if it is in Attribute and less than Width.
1275
1276} // end namespace AttributeFuncs
1277
1278} // end namespace llvm
1279
1280#endif // LLVM_IR_ATTRIBUTES_H
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
RelocType Type
Definition: COFFYAML.cpp:391
std::string Name
Load MIR Sample Profile
LLVMContext & Context
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Value * RHS
Value * LHS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
AttrBuilder & addStructRetAttr(Type *Ty)
This turns a sret type into the form used internally in Attribute.
AttrBuilder & addAlignmentAttr(MaybeAlign Align)
This turns an alignment into the form used internally in Attribute.
Type * getByValType() const
Retrieve the byval type.
Definition: Attributes.h:1110
AttrBuilder(AttrBuilder &&)=default
AttrBuilder & addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr)
Add a vscale_range attribute, using the representation returned by Attribute.getIntValue().
AttrBuilder(const AttrBuilder &)=delete
std::optional< uint64_t > getRawIntAttr(Attribute::AttrKind Kind) const
Return raw (possibly packed/encoded) value of integer attribute or std::nullopt if not set.
AttrBuilder & addStackAlignmentAttr(unsigned Align)
This turns an int stack alignment (which must be a power of 2) into the form used internally in Attri...
Definition: Attributes.h:1154
AttrBuilder & addAllocKindAttr(AllocFnKind Kind)
Attribute getAttribute(Attribute::AttrKind Kind) const
Return Attribute with the given Kind.
AttrBuilder & addByRefAttr(Type *Ty)
This turns a byref type into the form used internally in Attribute.
AttrBuilder & addNoFPClassAttr(FPClassTest NoFPClassMask)
bool overlaps(const AttributeMask &AM) const
Return true if the builder has any attribute that's in the specified builder.
AttrBuilder & merge(const AttrBuilder &B)
Add the attributes from the builder.
MaybeAlign getStackAlignment() const
Retrieve the stack alignment attribute, if it exists.
Definition: Attributes.h:1090
Type * getByRefType() const
Retrieve the byref type.
Definition: Attributes.h:1116
AttrBuilder & addVScaleRangeAttr(unsigned MinValue, std::optional< unsigned > MaxValue)
This turns two ints into the form used internally in Attribute.
AttrBuilder(LLVMContext &Ctx)
Definition: Attributes.h:1016
uint64_t getDereferenceableBytes() const
Retrieve the number of dereferenceable bytes, if the dereferenceable attribute exists (zero is return...
Definition: Attributes.h:1096
bool hasAttributes() const
Return true if the builder has IR-level attributes.
Definition: Attributes.h:1070
AttrBuilder & addRawIntAttr(Attribute::AttrKind Kind, uint64_t Value)
Add integer attribute with raw value (packed/encoded if necessary).
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
MaybeAlign getAlignment() const
Retrieve the alignment attribute, if it exists.
Definition: Attributes.h:1085
AttrBuilder & addByValAttr(Type *Ty)
This turns a byval type into the form used internally in Attribute.
AttrBuilder & addDereferenceableAttr(uint64_t Bytes)
This turns the number of dereferenceable bytes into the form used internally in Attribute.
Type * getPreallocatedType() const
Retrieve the preallocated type.
Definition: Attributes.h:1119
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
AttrBuilder & addMemoryAttr(MemoryEffects ME)
Add memory effect attribute.
AttrBuilder & addConstantRangeAttr(Attribute::AttrKind Kind, const ConstantRange &CR)
Add a ConstantRange attribute with the given range.
AttrBuilder & addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr)
Add an allocsize attribute, using the representation returned by Attribute.getIntValue().
AttrBuilder & addPreallocatedAttr(Type *Ty)
This turns a preallocated type into the form used internally in Attribute.
Type * getInAllocaType() const
Retrieve the inalloca type.
Definition: Attributes.h:1124
AttrBuilder & addStackAlignmentAttr(MaybeAlign Align)
This turns a stack alignment into the form used internally in Attribute.
AttrBuilder & removeAttribute(Attribute A)
Remove the target-dependent attribute from the builder.
Definition: Attributes.h:1044
uint64_t getDereferenceableOrNullBytes() const
Retrieve the number of dereferenceable_or_null bytes, if the dereferenceable_or_null attribute exists...
Definition: Attributes.h:1102
ArrayRef< Attribute > attrs() const
Definition: Attributes.h:1220
AttrBuilder & addInAllocaAttr(Type *Ty)
This turns an inalloca type into the form used internally in Attribute.
AttrBuilder & removeAttribute(Attribute::AttrKind Val)
Remove an attribute from the builder.
bool operator==(const AttrBuilder &B) const
Type * getTypeAttr(Attribute::AttrKind Kind) const
Retrieve type for the given type attribute.
AttrBuilder & remove(const AttributeMask &AM)
Remove the attributes from the builder.
AttrBuilder & addDereferenceableOrNullAttr(uint64_t Bytes)
This turns the number of dereferenceable_or_null bytes into the form used internally in Attribute.
AttrBuilder & addAlignmentAttr(unsigned Align)
This turns an int alignment (which must be a power of 2) into the form used internally in Attribute.
Definition: Attributes.h:1142
AttrBuilder & addTypeAttr(Attribute::AttrKind Kind, Type *Ty)
Add a type attribute with the given type.
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
Retrieve the allocsize args, or std::nullopt if the attribute does not exist.
AttrBuilder & addAllocSizeAttr(unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
This turns one (or two) ints into the form used internally in Attribute.
bool operator!=(const AttrBuilder &B) const
Definition: Attributes.h:1223
Type * getStructRetType() const
Retrieve the sret type.
Definition: Attributes.h:1113
AttrBuilder & addRangeAttr(const ConstantRange &CR)
Add range attribute.
AttrBuilder(LLVMContext &Ctx, const Attribute &A)
Definition: Attributes.h:1020
AttrBuilder & addUWTableAttr(UWTableKind Kind)
This turns the unwind table kind into the form used internally in Attribute.
Attribute getFnAttr(StringRef Kind) const
Return the attribute object that exists for the function.
Definition: Attributes.h:847
bool operator==(const AttributeList &RHS) const
operator==/!= - Provide equality predicates.
Definition: Attributes.h:963
bool hasAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
Type * getParamStructRetType(unsigned ArgNo) const
Return the sret type for the specified function parameter.
AttributeList addDereferenceableParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given arg index.
AttributeList removeAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo) const
Remove all attributes at the specified arg index from this attribute list.
Definition: Attributes.h:715
AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the specified arg index from this attribute list.
Definition: Attributes.h:708
bool hasAttributesAtIndex(unsigned Index) const
Return true if attribute exists at the given index.
AttributeList removeRetAttribute(LLVMContext &C, StringRef Kind) const
Remove the specified attribute at the return value index from this attribute list.
Definition: Attributes.h:677
bool hasRetAttr(StringRef Kind) const
Return true if the attribute exists for the return value.
Definition: Attributes.h:803
AttributeSet getFnAttrs() const
The function attributes are returned.
index_iterator indexes() const
Use this to iterate over the valid attribute indexes.
Definition: Attributes.h:960
AttributeList removeAttributesAtIndex(LLVMContext &C, unsigned Index, const AttributeMask &AttrsToRemove) const
Remove the specified attributes at the specified index from this attribute list.
AttributeList()=default
AttributeList addRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a return value attribute to the list.
Definition: Attributes.h:567
AttributeList addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
Add the allocsize attribute to the attribute set at the given arg index.
iterator begin() const
bool hasParamAttrs(unsigned ArgNo) const
Return true if attributes exists for the given argument.
Definition: Attributes.h:793
MaybeAlign getRetStackAlignment() const
Get the stack alignment of the return value.
AttributeList addRetAttributes(LLVMContext &C, const AttrBuilder &B) const
Add a return value attribute to the list.
Definition: Attributes.h:581
void print(raw_ostream &O) const
AttributeList addDereferenceableRetAttr(LLVMContext &C, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
AttributeList removeRetAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the return value index from this attribute list.
Definition: Attributes.h:685
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute > > Attrs)
Create an AttributeList with the specified parameters in it.
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return the attribute object that exists at the arg index.
Definition: Attributes.h:832
AttributeList removeAttribute(LLVMContext &C, unsigned Index, StringRef Kind) const
Definition: Attributes.h:625
void * getRawPointer() const
Return a raw pointer that uniquely identifies this attribute list.
Definition: Attributes.h:967
AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, StringRef Kind) const
Remove the specified attribute at the specified arg index from this attribute list.
Definition: Attributes.h:701
AllocFnKind getAllocKind() const
bool isEmpty() const
Return true if there are no attributes.
Definition: Attributes.h:972
AttributeList addFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a function attribute to the list.
Definition: Attributes.h:538
AttributeSet getRetAttrs() const
The attributes for the ret value are returned.
AttributeList addFnAttributes(LLVMContext &C, const AttrBuilder &B) const
Add function attribute to the list.
Definition: Attributes.h:560
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the function.
uint64_t getParamDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown) of an arg.
MaybeAlign getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
bool hasParamAttr(unsigned ArgNo, StringRef Kind) const
Return true if the attribute exists for the given argument.
Definition: Attributes.h:788
AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, StringRef Kind, StringRef Value=StringRef()) const
Add an argument attribute to the list.
Definition: Attributes.h:597
bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const
Return true if the specified attribute is set for at least one parameter or for the return value.
iterator end() const
Type * getParamInAllocaType(unsigned ArgNo) const
Return the inalloca type for the specified function parameter.
unsigned getNumAttrSets() const
bool operator!=(const AttributeList &RHS) const
Definition: Attributes.h:964
FPClassTest getRetNoFPClass() const
Get the disallowed floating-point classes of the return value.
Attribute getFnAttr(Attribute::AttrKind Kind) const
Return the attribute object that exists for the function.
Definition: Attributes.h:842
std::string getAsString(unsigned Index, bool InAttrGrp=false) const
Return the attributes at the index as a string.
UWTableKind getUWTableKind() const
Get the unwind table kind requested for the function.
MaybeAlign getRetAlignment() const
Return the alignment of the return value.
Type * getParamElementType(unsigned ArgNo) const
Return the elementtype type for the specified function parameter.
Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
Type * getParamPreallocatedType(unsigned ArgNo) const
Return the preallocated type for the specified function parameter.
bool hasParentContext(LLVMContext &C) const
Return true if this attribute list belongs to the LLVMContext.
AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified arg index from this attribute list.
Definition: Attributes.h:693
AttributeList addFnAttribute(LLVMContext &C, StringRef Kind, StringRef Value=StringRef()) const
Add a function attribute to the list.
Definition: Attributes.h:553
bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return true if the attribute exists for the given argument.
Definition: Attributes.h:783
MaybeAlign getFnStackAlignment() const
Get the stack alignment of the function.
AttributeList addAttributesAtIndex(LLVMContext &C, unsigned Index, const AttrBuilder &B) const
Add attributes to the attribute set at the given index.
Type * getParamByValType(unsigned ArgNo) const
Return the byval type for the specified function parameter.
AttributeList removeFnAttributes(LLVMContext &C) const
Remove the attributes at the function index from this attribute list.
Definition: Attributes.h:664
Attribute getRetAttr(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind for the return value.
Definition: Attributes.h:852
MaybeAlign getParamStackAlignment(unsigned ArgNo) const
Return the stack alignment for the specified function parameter.
uint64_t getRetDereferenceableBytes() const
Get the number of dereferenceable bytes (or zero if unknown) of the return value.
Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const
Return the attribute object that exists at the given index.
Definition: Attributes.h:837
AttributeList removeFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute at the function index from this attribute list.
Definition: Attributes.h:644
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg.
bool hasRetAttrs() const
Return true if attributes exist for the return value.
Definition: Attributes.h:808
AttributeList addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given arg index.
AttributeSet getAttributes(unsigned Index) const
The attributes for the specified index are returned.
AttributeList addRetAttribute(LLVMContext &C, Attribute Attr) const
Add a return value attribute to the list.
Definition: Attributes.h:574
FPClassTest getParamNoFPClass(unsigned ArgNo) const
Get the disallowed floating-point classes of the argument value.
AttributeList removeFnAttribute(LLVMContext &C, StringRef Kind) const
Remove the specified attribute at the function index from this attribute list.
Definition: Attributes.h:650
AttributeList removeFnAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the function index from this attribute list.
Definition: Attributes.h:658
bool hasFnAttrs() const
Return true the attributes exist for the function.
Definition: Attributes.h:817
Type * getParamByRefType(unsigned ArgNo) const
Return the byref type for the specified function parameter.
AttributeList addAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
AttributeSet getParamAttrs(unsigned ArgNo) const
The attributes for the argument or parameter at the given index are returned.
AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &B) const
Add an argument attribute to the list.
Definition: Attributes.h:610
uint64_t getRetDereferenceableOrNullBytes() const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of the return value.
AttributeList removeRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute at the return value index from this attribute list.
Definition: Attributes.h:671
AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
Definition: Attributes.h:589
AttributeList replaceAttributeTypeAtIndex(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind, Type *ReplacementTy) const
Replace the type contained by attribute AttrKind at index ArgNo wih ReplacementTy,...
Definition: Attributes.h:723
AttributeList addFnAttribute(LLVMContext &C, Attribute Attr) const
Add a function attribute to the list.
Definition: Attributes.h:545
MemoryEffects getMemoryEffects() const
Returns memory effects of the function.
bool hasRetAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the return value.
Definition: Attributes.h:798
AllocFnKind getAllocKind() const
Definition: Attributes.cpp:916
bool hasAttributes() const
Return true if attributes exists in this set.
Definition: Attributes.h:373
AttributeSet removeAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute from this set.
Definition: Attributes.cpp:810
Type * getInAllocaType() const
Definition: Attributes.cpp:889
Type * getByValType() const
Definition: Attributes.cpp:877
bool operator!=(const AttributeSet &O) const
Definition: Attributes.h:337
AttributeSet addAttributes(LLVMContext &C, AttributeSet AS) const
Add attributes to the attribute set.
Definition: Attributes.cpp:797
MemoryEffects getMemoryEffects() const
Definition: Attributes.cpp:920
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
Definition: Attributes.cpp:841
bool operator==(const AttributeSet &O) const
Definition: Attributes.h:336
Type * getStructRetType() const
Definition: Attributes.cpp:881
std::string getAsString(bool InAttrGrp=false) const
Definition: Attributes.cpp:928
~AttributeSet()=default
unsigned getVScaleRangeMin() const
Definition: Attributes.cpp:904
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
Definition: Attributes.cpp:898
UWTableKind getUWTableKind() const
Definition: Attributes.cpp:912
bool hasParentContext(LLVMContext &C) const
Return true if this attribute set belongs to the LLVMContext.
Definition: Attributes.cpp:932
iterator begin() const
Definition: Attributes.cpp:940
iterator end() const
Definition: Attributes.cpp:944
AttributeSet removeAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attributes from this set.
Definition: Attributes.cpp:826
std::optional< unsigned > getVScaleRangeMax() const
Definition: Attributes.cpp:908
MaybeAlign getStackAlignment() const
Definition: Attributes.cpp:861
Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
Definition: Attributes.cpp:849
Type * getPreallocatedType() const
Definition: Attributes.cpp:885
uint64_t getDereferenceableBytes() const
Definition: Attributes.cpp:865
MaybeAlign getAlignment() const
Definition: Attributes.cpp:857
FPClassTest getNoFPClass() const
Definition: Attributes.cpp:924
AttributeSet(const AttributeSet &)=default
Type * getElementType() const
Definition: Attributes.cpp:893
Type * getByRefType() const
Definition: Attributes.cpp:873
AttributeSet()=default
AttributeSet is a trivially copyable value type.
static AttributeSet get(LLVMContext &C, const AttrBuilder &B)
Definition: Attributes.cpp:774
uint64_t getDereferenceableOrNullBytes() const
Definition: Attributes.cpp:869
unsigned getNumAttributes() const
Return the number of attributes in this set.
Definition: Attributes.cpp:837
AttributeSet addAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add an argument attribute.
Definition: Attributes.cpp:782
void dump() const
Definition: Attributes.cpp:949
static const unsigned NumTypeAttrKinds
Definition: Attributes.h:96
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
Definition: Attributes.cpp:308
static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:220
bool operator==(Attribute A) const
Equality and non-equality operators.
Definition: Attributes.h:278
static Attribute::AttrKind getAttrKindFromName(StringRef AttrName)
Definition: Attributes.cpp:265
bool isEnumAttribute() const
Return true if the attribute is an Attribute::AttrKind type.
Definition: Attributes.cpp:300
static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment)
Definition: Attributes.cpp:199
bool isIntAttribute() const
Return true if the attribute is an integer attribute.
Definition: Attributes.cpp:304
static Attribute getWithByRefType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:224
std::optional< unsigned > getVScaleRangeMax() const
Returns the maximum value for the vscale_range attribute or std::nullopt when unknown.
Definition: Attributes.cpp:417
uint64_t getValueAsInt() const
Return the attribute's value as an integer.
Definition: Attributes.cpp:328
unsigned getVScaleRangeMin() const
Returns the minimum value for the vscale_range attribute.
Definition: Attributes.cpp:411
AllocFnKind getAllocKind() const
Definition: Attributes.cpp:429
bool isConstantRangeAttribute() const
Return true if the attribute is a ConstantRange attribute.
Definition: Attributes.cpp:316
ConstantRange getValueAsConstantRange() const
Return the attribute's value as a ConstantRange.
Definition: Attributes.cpp:363
StringRef getKindAsString() const
Return the attribute's kind as a string.
Definition: Attributes.cpp:342
static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:228
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
Definition: Attributes.cpp:93
static bool canUseAsRetAttr(AttrKind Kind)
Definition: Attributes.cpp:689
static bool isTypeAttrKind(AttrKind Kind)
Definition: Attributes.h:104
std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
Definition: Attributes.cpp:467
uint64_t getDereferenceableOrNullBytes() const
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.
Definition: Attributes.cpp:397
static Attribute getWithDereferenceableBytes(LLVMContext &Context, uint64_t Bytes)
Definition: Attributes.cpp:204
std::pair< unsigned, std::optional< unsigned > > getAllocSizeArgs() const
Returns the argument numbers for the allocsize attribute.
Definition: Attributes.cpp:405
static Attribute getWithUWTableKind(LLVMContext &Context, UWTableKind Kind)
Definition: Attributes.cpp:236
bool operator!=(Attribute A) const
Definition: Attributes.h:279
FPClassTest getNoFPClass() const
Return the FPClassTest for nofpclass.
Definition: Attributes.cpp:441
static Attribute getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
Definition: Attributes.cpp:252
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
Definition: Attributes.cpp:320
Attribute()=default
bool getValueAsBool() const
Return the attribute's value as a boolean.
Definition: Attributes.cpp:335
uint64_t getDereferenceableBytes() const
Returns the number of dereferenceable bytes from the dereferenceable attribute.
Definition: Attributes.cpp:390
static Attribute getWithVScaleRangeArgs(LLVMContext &Context, unsigned MinValue, unsigned MaxValue)
Definition: Attributes.cpp:259
MemoryEffects getMemoryEffects() const
Returns memory effects.
Definition: Attributes.cpp:435
UWTableKind getUWTableKind() const
Definition: Attributes.cpp:423
static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context, uint64_t Bytes)
Definition: Attributes.cpp:210
StringRef getValueAsString() const
Return the attribute's value as a string.
Definition: Attributes.cpp:349
static bool isExistingAttribute(StringRef Name)
Return true if the provided string matches the IR name of an attribute.
Definition: Attributes.cpp:288
static StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind)
Definition: Attributes.cpp:274
static bool canUseAsFnAttr(AttrKind Kind)
Definition: Attributes.cpp:681
static Attribute getWithNoFPClass(LLVMContext &Context, FPClassTest Mask)
Definition: Attributes.cpp:246
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition: Attributes.h:85
@ TombstoneKey
Use as Tombstone key for DenseMap of AttrKind.
Definition: Attributes.h:92
@ None
No attributes have been set.
Definition: Attributes.h:87
@ EmptyKey
Use as Empty key for DenseMap of AttrKind.
Definition: Attributes.h:91
@ EndAttrKinds
Sentinel value useful for loops.
Definition: Attributes.h:90
static bool isConstantRangeAttrKind(AttrKind Kind)
Definition: Attributes.h:107
void * getRawPointer() const
Return a raw pointer that uniquely identifies this attribute.
Definition: Attributes.h:287
bool hasParentContext(LLVMContext &C) const
Return true if this attribute belongs to the LLVMContext.
Definition: Attributes.cpp:646
bool isTypeAttribute() const
Return true if the attribute is a type attribute.
Definition: Attributes.cpp:312
static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:232
static bool isIntAttrKind(AttrKind Kind)
Definition: Attributes.h:101
ConstantRange getRange() const
Returns the value of the range attribute.
Definition: Attributes.cpp:447
static Attribute getWithByValType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:216
Attribute getWithNewType(LLVMContext &Context, Type *ReplacementTy)
For a typed attribute, return the equivalent attribute with the type changed to ReplacementTy.
Definition: Attributes.h:159
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
Definition: Attributes.cpp:369
static bool isEnumAttrKind(AttrKind Kind)
Definition: Attributes.h:98
static Attribute getWithMemoryEffects(LLVMContext &Context, MemoryEffects ME)
Definition: Attributes.cpp:241
static bool canUseAsParamAttr(AttrKind Kind)
Definition: Attributes.cpp:685
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition: Attributes.h:193
MaybeAlign getStackAlignment() const
Returns the stack alignment field of an attribute as a byte alignment value.
Definition: Attributes.cpp:384
static Attribute fromRawPointer(void *RawPtr)
Get an attribute from a raw pointer created by getRawPointer.
Definition: Attributes.h:292
static const unsigned NumIntAttrKinds
Definition: Attributes.h:95
MaybeAlign getAlignment() const
Returns the alignment field of an attribute as a byte alignment value.
Definition: Attributes.cpp:378
bool operator<(Attribute A) const
Less-than operator. Useful for sorting the attributes list.
Definition: Attributes.cpp:654
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
Definition: Attributes.cpp:194
Type * getValueAsType() const
Return the attribute's value as a Type.
Definition: Attributes.cpp:356
This class represents a range of values.
Definition: ConstantRange.h:47
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:320
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:74
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
struct LLVMOpaqueAttributeRef * LLVMAttributeRef
Used to represent an attributes.
Definition: Types.h:145
bool areInlineCompatible(const Function &Caller, const Function &Callee)
AttributeMask getUBImplyingAttributes()
Get param/return attributes which imply immediate undefined behavior if an invalid value is passed.
bool isNoFPClassCompatibleType(Type *Ty)
Returns true if this is a type legal for the 'nofpclass' attribute.
bool areOutlineCompatible(const Function &A, const Function &B)
Checks if there are any incompatible function attributes between A and B.
void updateMinLegalVectorWidthAttr(Function &Fn, uint64_t Width)
Update min-legal-vector-width if it is in Attribute and less than Width.
void mergeAttributesForOutlining(Function &Base, const Function &ToMerge)
Merges the functions attributes from ToMerge into function Base.
void mergeAttributesForInlining(Function &Caller, const Function &Callee)
Merge caller's and callee's attributes.
AttributeMask typeIncompatible(Type *Ty, AttributeSafetyKind ASK=ASK_ALL)
Which attributes cannot be applied to a type.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Uninitialized
Definition: Threading.h:61
AllocFnKind
Definition: Attributes.h:48
UWTableKind
Definition: CodeGen.h:120
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
@ Other
Any other memory.
Attribute unwrap(LLVMAttributeRef Attr)
Definition: Attributes.h:303
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:298
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
bool operator!=(const int_wrapper &Other)
Definition: Attributes.h:945
static unsigned getHashValue(AttributeList AS)
Definition: Attributes.h:995
static AttributeList getTombstoneKey()
Definition: Attributes.h:989
static bool isEqual(AttributeList LHS, AttributeList RHS)
Definition: Attributes.h:1000
static AttributeSet getTombstoneKey()
Definition: Attributes.h:429
static bool isEqual(AttributeSet LHS, AttributeSet RHS)
Definition: Attributes.h:440
static unsigned getHashValue(AttributeSet AS)
Definition: Attributes.h:435
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition: DenseMapInfo.h:50
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117