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 range attribute to the attribute set at the return value index.
751 /// Returns a new list because attribute lists are immutable.
753 const ConstantRange &CR) const;
754
755 /// Add the allocsize attribute to the attribute set at the given arg index.
756 /// Returns a new list because attribute lists are immutable.
757 [[nodiscard]] AttributeList
758 addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg,
759 const std::optional<unsigned> &NumElemsArg);
760
761 //===--------------------------------------------------------------------===//
762 // AttributeList Accessors
763 //===--------------------------------------------------------------------===//
764
765 /// The attributes for the specified index are returned.
766 AttributeSet getAttributes(unsigned Index) const;
767
768 /// The attributes for the argument or parameter at the given index are
769 /// returned.
770 AttributeSet getParamAttrs(unsigned ArgNo) const;
771
772 /// The attributes for the ret value are returned.
774
775 /// The function attributes are returned.
776 AttributeSet getFnAttrs() const;
777
778 /// Return true if the attribute exists at the given index.
779 bool hasAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const;
780
781 /// Return true if the attribute exists at the given index.
782 bool hasAttributeAtIndex(unsigned Index, StringRef Kind) const;
783
784 /// Return true if attribute exists at the given index.
785 bool hasAttributesAtIndex(unsigned Index) const;
786
787 /// Return true if the attribute exists for the given argument
788 bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
789 return hasAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
790 }
791
792 /// Return true if the attribute exists for the given argument
793 bool hasParamAttr(unsigned ArgNo, StringRef Kind) const {
794 return hasAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
795 }
796
797 /// Return true if attributes exists for the given argument
798 bool hasParamAttrs(unsigned ArgNo) const {
799 return hasAttributesAtIndex(ArgNo + FirstArgIndex);
800 }
801
802 /// Return true if the attribute exists for the return value.
804 return hasAttributeAtIndex(ReturnIndex, Kind);
805 }
806
807 /// Return true if the attribute exists for the return value.
808 bool hasRetAttr(StringRef Kind) const {
809 return hasAttributeAtIndex(ReturnIndex, Kind);
810 }
811
812 /// Return true if attributes exist for the return value.
814
815 /// Return true if the attribute exists for the function.
816 bool hasFnAttr(Attribute::AttrKind Kind) const;
817
818 /// Return true if the attribute exists for the function.
819 bool hasFnAttr(StringRef Kind) const;
820
821 /// Return true the attributes exist for the function.
823
824 /// Return true if the specified attribute is set for at least one
825 /// parameter or for the return value. If Index is not nullptr, the index
826 /// of a parameter with the specified attribute is provided.
828 unsigned *Index = nullptr) const;
829
830 /// Return the attribute object that exists at the given index.
832
833 /// Return the attribute object that exists at the given index.
834 Attribute getAttributeAtIndex(unsigned Index, StringRef Kind) const;
835
836 /// Return the attribute object that exists at the arg index.
837 Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
838 return getAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
839 }
840
841 /// Return the attribute object that exists at the given index.
842 Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const {
843 return getAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
844 }
845
846 /// Return the attribute object that exists for the function.
849 }
850
851 /// Return the attribute object that exists for the function.
854 }
855
856 /// Return the attribute for the given attribute kind for the return value.
858 return getAttributeAtIndex(ReturnIndex, Kind);
859 }
860
861 /// Return the alignment of the return value.
863
864 /// Return the alignment for the specified function parameter.
865 MaybeAlign getParamAlignment(unsigned ArgNo) const;
866
867 /// Return the stack alignment for the specified function parameter.
868 MaybeAlign getParamStackAlignment(unsigned ArgNo) const;
869
870 /// Return the byval type for the specified function parameter.
871 Type *getParamByValType(unsigned ArgNo) const;
872
873 /// Return the sret type for the specified function parameter.
874 Type *getParamStructRetType(unsigned ArgNo) const;
875
876 /// Return the byref type for the specified function parameter.
877 Type *getParamByRefType(unsigned ArgNo) const;
878
879 /// Return the preallocated type for the specified function parameter.
880 Type *getParamPreallocatedType(unsigned ArgNo) const;
881
882 /// Return the inalloca type for the specified function parameter.
883 Type *getParamInAllocaType(unsigned ArgNo) const;
884
885 /// Return the elementtype type for the specified function parameter.
886 Type *getParamElementType(unsigned ArgNo) const;
887
888 /// Get the stack alignment of the function.
890
891 /// Get the stack alignment of the return value.
893
894 /// Get the number of dereferenceable bytes (or zero if unknown) of the return
895 /// value.
897
898 /// Get the number of dereferenceable bytes (or zero if unknown) of an arg.
900
901 /// Get the number of dereferenceable_or_null bytes (or zero if unknown) of
902 /// the return value.
904
905 /// Get the number of dereferenceable_or_null bytes (or zero if unknown) of an
906 /// arg.
907 uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const;
908
909 /// Get the disallowed floating-point classes of the return value.
911
912 /// Get the disallowed floating-point classes of the argument value.
913 FPClassTest getParamNoFPClass(unsigned ArgNo) const;
914
915 /// Get the unwind table kind requested for the function.
917
919
920 /// Returns memory effects of the function.
922
923 /// Return the attributes at the index as a string.
924 std::string getAsString(unsigned Index, bool InAttrGrp = false) const;
925
926 /// Return true if this attribute list belongs to the LLVMContext.
927 bool hasParentContext(LLVMContext &C) const;
928
929 //===--------------------------------------------------------------------===//
930 // AttributeList Introspection
931 //===--------------------------------------------------------------------===//
932
933 using iterator = const AttributeSet *;
934
935 iterator begin() const;
936 iterator end() const;
937
938 unsigned getNumAttrSets() const;
939
940 // Implementation of indexes(). Produces iterators that wrap an index. Mostly
941 // to hide the awkwardness of unsigned wrapping when iterating over valid
942 // indexes.
944 unsigned NumAttrSets;
946 struct int_wrapper {
947 int_wrapper(unsigned i) : i(i) {}
948 unsigned i;
949 unsigned operator*() { return i; }
950 bool operator!=(const int_wrapper &Other) { return i != Other.i; }
952 // This is expected to undergo unsigned wrapping since FunctionIndex is
953 // ~0 and that's where we start.
954 ++i;
955 return *this;
956 }
957 };
958
960
962 };
963
964 /// Use this to iterate over the valid attribute indexes.
966
967 /// operator==/!= - Provide equality predicates.
968 bool operator==(const AttributeList &RHS) const { return pImpl == RHS.pImpl; }
969 bool operator!=(const AttributeList &RHS) const { return pImpl != RHS.pImpl; }
970
971 /// Return a raw pointer that uniquely identifies this attribute list.
972 void *getRawPointer() const {
973 return pImpl;
974 }
975
976 /// Return true if there are no attributes.
977 bool isEmpty() const { return pImpl == nullptr; }
978
979 void print(raw_ostream &O) const;
980
981 void dump() const;
982};
983
984//===----------------------------------------------------------------------===//
985/// \class
986/// Provide DenseMapInfo for AttributeList.
987template <> struct DenseMapInfo<AttributeList, void> {
989 auto Val = static_cast<uintptr_t>(-1);
990 Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
991 return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
992 }
993
995 auto Val = static_cast<uintptr_t>(-2);
996 Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
997 return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
998 }
999
1000 static unsigned getHashValue(AttributeList AS) {
1001 return (unsigned((uintptr_t)AS.pImpl) >> 4) ^
1002 (unsigned((uintptr_t)AS.pImpl) >> 9);
1003 }
1004
1006 return LHS == RHS;
1007 }
1008};
1009
1010//===----------------------------------------------------------------------===//
1011/// \class
1012/// This class is used in conjunction with the Attribute::get method to
1013/// create an Attribute object. The object itself is uniquified. The Builder's
1014/// value, however, is not. So this can be used as a quick way to test for
1015/// equality, presence of attributes, etc.
1017 LLVMContext &Ctx;
1019
1020public:
1021 AttrBuilder(LLVMContext &Ctx) : Ctx(Ctx) {}
1022 AttrBuilder(const AttrBuilder &) = delete;
1024
1025 AttrBuilder(LLVMContext &Ctx, const Attribute &A) : Ctx(Ctx) {
1026 addAttribute(A);
1027 }
1028
1030
1031 void clear();
1032
1033 /// Add an attribute to the builder.
1035
1036 /// Add the Attribute object to the builder.
1038
1039 /// Add the target-dependent attribute to the builder.
1041
1042 /// Remove an attribute from the builder.
1044
1045 /// Remove the target-dependent attribute from the builder.
1047
1048 /// Remove the target-dependent attribute from the builder.
1050 if (A.isStringAttribute())
1051 return removeAttribute(A.getKindAsString());
1052 else
1053 return removeAttribute(A.getKindAsEnum());
1054 }
1055
1056 /// Add the attributes from the builder. Attributes in the passed builder
1057 /// overwrite attributes in this builder if they have the same key.
1058 AttrBuilder &merge(const AttrBuilder &B);
1059
1060 /// Remove the attributes from the builder.
1061 AttrBuilder &remove(const AttributeMask &AM);
1062
1063 /// Return true if the builder has any attribute that's in the
1064 /// specified builder.
1065 bool overlaps(const AttributeMask &AM) const;
1066
1067 /// Return true if the builder has the specified attribute.
1068 bool contains(Attribute::AttrKind A) const;
1069
1070 /// Return true if the builder has the specified target-dependent
1071 /// attribute.
1072 bool contains(StringRef A) const;
1073
1074 /// Return true if the builder has IR-level attributes.
1075 bool hasAttributes() const { return !Attrs.empty(); }
1076
1077 /// Return Attribute with the given Kind. The returned attribute will be
1078 /// invalid if the Kind is not present in the builder.
1080
1081 /// Return Attribute with the given Kind. The returned attribute will be
1082 /// invalid if the Kind is not present in the builder.
1083 Attribute getAttribute(StringRef Kind) const;
1084
1085 /// Return raw (possibly packed/encoded) value of integer attribute or
1086 /// std::nullopt if not set.
1087 std::optional<uint64_t> getRawIntAttr(Attribute::AttrKind Kind) const;
1088
1089 /// Retrieve the alignment attribute, if it exists.
1091 return MaybeAlign(getRawIntAttr(Attribute::Alignment).value_or(0));
1092 }
1093
1094 /// Retrieve the stack alignment attribute, if it exists.
1096 return MaybeAlign(getRawIntAttr(Attribute::StackAlignment).value_or(0));
1097 }
1098
1099 /// Retrieve the number of dereferenceable bytes, if the
1100 /// dereferenceable attribute exists (zero is returned otherwise).
1102 return getRawIntAttr(Attribute::Dereferenceable).value_or(0);
1103 }
1104
1105 /// Retrieve the number of dereferenceable_or_null bytes, if the
1106 /// dereferenceable_or_null attribute exists (zero is returned otherwise).
1108 return getRawIntAttr(Attribute::DereferenceableOrNull).value_or(0);
1109 }
1110
1111 /// Retrieve type for the given type attribute.
1113
1114 /// Retrieve the byval type.
1115 Type *getByValType() const { return getTypeAttr(Attribute::ByVal); }
1116
1117 /// Retrieve the sret type.
1118 Type *getStructRetType() const { return getTypeAttr(Attribute::StructRet); }
1119
1120 /// Retrieve the byref type.
1121 Type *getByRefType() const { return getTypeAttr(Attribute::ByRef); }
1122
1123 /// Retrieve the preallocated type.
1125 return getTypeAttr(Attribute::Preallocated);
1126 }
1127
1128 /// Retrieve the inalloca type.
1129 Type *getInAllocaType() const { return getTypeAttr(Attribute::InAlloca); }
1130
1131 /// Retrieve the allocsize args, or std::nullopt if the attribute does not
1132 /// exist.
1133 std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
1134 const;
1135
1136 /// Add integer attribute with raw value (packed/encoded if necessary).
1138
1139 /// This turns an alignment into the form used internally in Attribute.
1140 /// This call has no effect if Align is not set.
1142
1143 /// This turns an int alignment (which must be a power of 2) into the
1144 /// form used internally in Attribute.
1145 /// This call has no effect if Align is 0.
1146 /// Deprecated, use the version using a MaybeAlign.
1149 }
1150
1151 /// This turns a stack alignment into the form used internally in Attribute.
1152 /// This call has no effect if Align is not set.
1154
1155 /// This turns an int stack alignment (which must be a power of 2) into
1156 /// the form used internally in Attribute.
1157 /// This call has no effect if Align is 0.
1158 /// Deprecated, use the version using a MaybeAlign.
1161 }
1162
1163 /// This turns the number of dereferenceable bytes into the form used
1164 /// internally in Attribute.
1166
1167 /// This turns the number of dereferenceable_or_null bytes into the
1168 /// form used internally in Attribute.
1170
1171 /// This turns one (or two) ints into the form used internally in Attribute.
1172 AttrBuilder &addAllocSizeAttr(unsigned ElemSizeArg,
1173 const std::optional<unsigned> &NumElemsArg);
1174
1175 /// This turns two ints into the form used internally in Attribute.
1176 AttrBuilder &addVScaleRangeAttr(unsigned MinValue,
1177 std::optional<unsigned> MaxValue);
1178
1179 /// Add a type attribute with the given type.
1181
1182 /// This turns a byval type into the form used internally in Attribute.
1184
1185 /// This turns a sret type into the form used internally in Attribute.
1187
1188 /// This turns a byref type into the form used internally in Attribute.
1190
1191 /// This turns a preallocated type into the form used internally in Attribute.
1193
1194 /// This turns an inalloca type into the form used internally in Attribute.
1196
1197 /// Add an allocsize attribute, using the representation returned by
1198 /// Attribute.getIntValue().
1200
1201 /// Add a vscale_range attribute, using the representation returned by
1202 /// Attribute.getIntValue().
1204
1205 /// This turns the unwind table kind into the form used internally in
1206 /// Attribute.
1208
1209 // This turns the allocator kind into the form used internally in Attribute.
1211
1212 /// Add memory effect attribute.
1214
1215 // Add nofpclass attribute
1217
1218 /// Add a ConstantRange attribute with the given range.
1220 const ConstantRange &CR);
1221
1222 /// Add range attribute.
1224
1225 ArrayRef<Attribute> attrs() const { return Attrs; }
1226
1227 bool operator==(const AttrBuilder &B) const;
1228 bool operator!=(const AttrBuilder &B) const { return !(*this == B); }
1229};
1230
1231namespace AttributeFuncs {
1232
1233enum AttributeSafetyKind : uint8_t {
1237};
1238
1239/// Returns true if this is a type legal for the 'nofpclass' attribute. This
1240/// follows the same type rules as FPMathOperator.
1242
1243/// Which attributes cannot be applied to a type. The argument \p ASK indicates,
1244/// if only attributes that are known to be safely droppable are contained in
1245/// the mask; only attributes that might be unsafe to drop (e.g., ABI-related
1246/// attributes) are in the mask; or both.
1248
1249/// Get param/return attributes which imply immediate undefined behavior if an
1250/// invalid value is passed. For example, this includes noundef (where undef
1251/// implies UB), but not nonnull (where null implies poison). It also does not
1252/// include attributes like nocapture, which constrain the function
1253/// implementation rather than the passed value.
1255
1256/// \returns Return true if the two functions have compatible target-independent
1257/// attributes for inlining purposes.
1258bool areInlineCompatible(const Function &Caller, const Function &Callee);
1259
1260
1261/// Checks if there are any incompatible function attributes between
1262/// \p A and \p B.
1263///
1264/// \param [in] A - The first function to be compared with.
1265/// \param [in] B - The second function to be compared with.
1266/// \returns true if the functions have compatible attributes.
1267bool areOutlineCompatible(const Function &A, const Function &B);
1268
1269/// Merge caller's and callee's attributes.
1270void mergeAttributesForInlining(Function &Caller, const Function &Callee);
1271
1272/// Merges the functions attributes from \p ToMerge into function \p Base.
1273///
1274/// \param [in,out] Base - The function being merged into.
1275/// \param [in] ToMerge - The function to merge attributes from.
1276void mergeAttributesForOutlining(Function &Base, const Function &ToMerge);
1277
1278/// Update min-legal-vector-width if it is in Attribute and less than Width.
1280
1281} // end namespace AttributeFuncs
1282
1283} // end namespace llvm
1284
1285#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:1115
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:1159
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:1095
Type * getByRefType() const
Retrieve the byref type.
Definition: Attributes.h:1121
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:1021
uint64_t getDereferenceableBytes() const
Retrieve the number of dereferenceable bytes, if the dereferenceable attribute exists (zero is return...
Definition: Attributes.h:1101
bool hasAttributes() const
Return true if the builder has IR-level attributes.
Definition: Attributes.h:1075
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:1090
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:1124
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:1129
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:1049
uint64_t getDereferenceableOrNullBytes() const
Retrieve the number of dereferenceable_or_null bytes, if the dereferenceable_or_null attribute exists...
Definition: Attributes.h:1107
ArrayRef< Attribute > attrs() const
Definition: Attributes.h:1225
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:1147
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:1228
Type * getStructRetType() const
Retrieve the sret type.
Definition: Attributes.h:1118
AttrBuilder & addRangeAttr(const ConstantRange &CR)
Add range attribute.
AttrBuilder(LLVMContext &Ctx, const Attribute &A)
Definition: Attributes.h:1025
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:852
bool operator==(const AttributeList &RHS) const
operator==/!= - Provide equality predicates.
Definition: Attributes.h:968
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
AttributeList addRangeRetAttr(LLVMContext &C, const ConstantRange &CR) const
Add the range attribute to the attribute set at the return value index.
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:808
AttributeSet getFnAttrs() const
The function attributes are returned.
index_iterator indexes() const
Use this to iterate over the valid attribute indexes.
Definition: Attributes.h:965
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:798
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:837
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:972
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:977
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:793
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:969
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:847
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:788
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:857
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:842
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:813
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:822
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:803
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:950
static unsigned getHashValue(AttributeList AS)
Definition: Attributes.h:1000
static AttributeList getTombstoneKey()
Definition: Attributes.h:994
static bool isEqual(AttributeList LHS, AttributeList RHS)
Definition: Attributes.h:1005
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