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