LLVM  14.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"
20 #include "llvm/ADT/Optional.h"
21 #include "llvm/ADT/SmallString.h"
22 #include "llvm/ADT/StringRef.h"
24 #include "llvm/Config/llvm-config.h"
25 #include "llvm/Support/Alignment.h"
27 #include <bitset>
28 #include <cassert>
29 #include <cstdint>
30 #include <map>
31 #include <string>
32 #include <utility>
33 
34 namespace llvm {
35 
36 class AttrBuilder;
37 class AttributeImpl;
38 class AttributeListImpl;
39 class AttributeSetNode;
40 template<typename T> struct DenseMapInfo;
41 class FoldingSetNodeID;
42 class Function;
43 class LLVMContext;
44 class Type;
45 
46 //===----------------------------------------------------------------------===//
47 /// \class
48 /// Functions, function parameters, and return types can have attributes
49 /// to indicate how they should be treated by optimizations and code
50 /// generation. This class represents one of those attributes. It's light-weight
51 /// and should be passed around by-value.
52 class Attribute {
53 public:
54  /// This enumeration lists the attributes that can be associated with
55  /// parameters, function results, or the function itself.
56  ///
57  /// Note: The `uwtable' attribute is about the ABI or the user mandating an
58  /// entry in the unwind table. The `nounwind' attribute is about an exception
59  /// passing by the function.
60  ///
61  /// In a theoretical system that uses tables for profiling and SjLj for
62  /// exceptions, they would be fully independent. In a normal system that uses
63  /// tables for both, the semantics are:
64  ///
65  /// nil = Needs an entry because an exception might pass by.
66  /// nounwind = No need for an entry
67  /// uwtable = Needs an entry because the ABI says so and because
68  /// an exception might pass by.
69  /// uwtable + nounwind = Needs an entry because the ABI says so.
70 
71  enum AttrKind {
72  // IR-Level Attributes
73  None, ///< No attributes have been set
74  #define GET_ATTR_ENUM
75  #include "llvm/IR/Attributes.inc"
76  EndAttrKinds, ///< Sentinal value useful for loops
77  EmptyKey, ///< Use as Empty key for DenseMap of AttrKind
78  TombstoneKey, ///< Use as Tombstone key for DenseMap of AttrKind
79  };
80 
81  static const unsigned NumTypeAttrKinds = LastTypeAttr - FirstTypeAttr + 1;
82 
83  static bool isEnumAttrKind(AttrKind Kind) {
84  return Kind >= FirstEnumAttr && Kind <= LastEnumAttr;
85  }
86  static bool isIntAttrKind(AttrKind Kind) {
87  return Kind >= FirstIntAttr && Kind <= LastIntAttr;
88  }
89  static bool isTypeAttrKind(AttrKind Kind) {
90  return Kind >= FirstTypeAttr && Kind <= LastTypeAttr;
91  }
92 
93  static bool canUseAsFnAttr(AttrKind Kind);
94  static bool canUseAsParamAttr(AttrKind Kind);
95  static bool canUseAsRetAttr(AttrKind Kind);
96 
97 private:
98  AttributeImpl *pImpl = nullptr;
99 
100  Attribute(AttributeImpl *A) : pImpl(A) {}
101 
102 public:
103  Attribute() = default;
104 
105  //===--------------------------------------------------------------------===//
106  // Attribute Construction
107  //===--------------------------------------------------------------------===//
108 
109  /// Return a uniquified Attribute object.
110  static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0);
111  static Attribute get(LLVMContext &Context, StringRef Kind,
112  StringRef Val = StringRef());
113  static Attribute get(LLVMContext &Context, AttrKind Kind, Type *Ty);
114 
115  /// Return a uniquified Attribute object that has the specific
116  /// alignment set.
117  static Attribute getWithAlignment(LLVMContext &Context, Align Alignment);
118  static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment);
119  static Attribute getWithDereferenceableBytes(LLVMContext &Context,
120  uint64_t Bytes);
122  uint64_t Bytes);
123  static Attribute getWithAllocSizeArgs(LLVMContext &Context,
124  unsigned ElemSizeArg,
125  const Optional<unsigned> &NumElemsArg);
126  static Attribute getWithVScaleRangeArgs(LLVMContext &Context,
127  unsigned MinValue, unsigned MaxValue);
128  static Attribute getWithByValType(LLVMContext &Context, Type *Ty);
129  static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty);
130  static Attribute getWithByRefType(LLVMContext &Context, Type *Ty);
131  static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty);
132  static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty);
133 
134  /// For a typed attribute, return the equivalent attribute with the type
135  /// changed to \p ReplacementTy.
137  assert(isTypeAttribute() && "this requires a typed attribute");
138  return get(Context, getKindAsEnum(), ReplacementTy);
139  }
140 
142 
144 
145  /// Return true if the provided string matches the IR name of an attribute.
146  /// example: "noalias" return true but not "NoAlias"
147  static bool isExistingAttribute(StringRef Name);
148 
149  //===--------------------------------------------------------------------===//
150  // Attribute Accessors
151  //===--------------------------------------------------------------------===//
152 
153  /// Return true if the attribute is an Attribute::AttrKind type.
154  bool isEnumAttribute() const;
155 
156  /// Return true if the attribute is an integer attribute.
157  bool isIntAttribute() const;
158 
159  /// Return true if the attribute is a string (target-dependent)
160  /// attribute.
161  bool isStringAttribute() const;
162 
163  /// Return true if the attribute is a type attribute.
164  bool isTypeAttribute() const;
165 
166  /// Return true if the attribute is any kind of attribute.
167  bool isValid() const { return pImpl; }
168 
169  /// Return true if the attribute is present.
170  bool hasAttribute(AttrKind Val) const;
171 
172  /// Return true if the target-dependent attribute is present.
173  bool hasAttribute(StringRef Val) const;
174 
175  /// Return the attribute's kind as an enum (Attribute::AttrKind). This
176  /// requires the attribute to be an enum, integer, or type attribute.
178 
179  /// Return the attribute's value as an integer. This requires that the
180  /// attribute be an integer attribute.
181  uint64_t getValueAsInt() const;
182 
183  /// Return the attribute's value as a boolean. This requires that the
184  /// attribute be a string attribute.
185  bool getValueAsBool() const;
186 
187  /// Return the attribute's kind as a string. This requires the
188  /// attribute to be a string attribute.
189  StringRef getKindAsString() const;
190 
191  /// Return the attribute's value as a string. This requires the
192  /// attribute to be a string attribute.
193  StringRef getValueAsString() const;
194 
195  /// Return the attribute's value as a Type. This requires the attribute to be
196  /// a type attribute.
197  Type *getValueAsType() const;
198 
199  /// Returns the alignment field of an attribute as a byte alignment
200  /// value.
201  MaybeAlign getAlignment() const;
202 
203  /// Returns the stack alignment field of an attribute as a byte
204  /// alignment value.
206 
207  /// Returns the number of dereferenceable bytes from the
208  /// dereferenceable attribute.
209  uint64_t getDereferenceableBytes() const;
210 
211  /// Returns the number of dereferenceable_or_null bytes from the
212  /// dereferenceable_or_null attribute.
213  uint64_t getDereferenceableOrNullBytes() const;
214 
215  /// Returns the argument numbers for the allocsize attribute (or pair(0, 0)
216  /// if not known).
217  std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const;
218 
219  /// Returns the argument numbers for the vscale_range attribute (or pair(0, 0)
220  /// if not known).
221  std::pair<unsigned, unsigned> getVScaleRangeArgs() const;
222 
223  /// The Attribute is converted to a string of equivalent mnemonic. This
224  /// is, presumably, for writing out the mnemonics for the assembly writer.
225  std::string getAsString(bool InAttrGrp = false) const;
226 
227  /// Return true if this attribute belongs to the LLVMContext.
228  bool hasParentContext(LLVMContext &C) const;
229 
230  /// Equality and non-equality operators.
231  bool operator==(Attribute A) const { return pImpl == A.pImpl; }
232  bool operator!=(Attribute A) const { return pImpl != A.pImpl; }
233 
234  /// Less-than operator. Useful for sorting the attributes list.
235  bool operator<(Attribute A) const;
236 
237  void Profile(FoldingSetNodeID &ID) const;
238 
239  /// Return a raw pointer that uniquely identifies this attribute.
240  void *getRawPointer() const {
241  return pImpl;
242  }
243 
244  /// Get an attribute from a raw pointer created by getRawPointer.
245  static Attribute fromRawPointer(void *RawPtr) {
246  return Attribute(reinterpret_cast<AttributeImpl*>(RawPtr));
247  }
248 };
249 
250 // Specialized opaque value conversions.
252  return reinterpret_cast<LLVMAttributeRef>(Attr.getRawPointer());
253 }
254 
255 // Specialized opaque value conversions.
257  return Attribute::fromRawPointer(Attr);
258 }
259 
260 //===----------------------------------------------------------------------===//
261 /// \class
262 /// This class holds the attributes for a particular argument, parameter,
263 /// function, or return value. It is an immutable value type that is cheap to
264 /// copy. Adding and removing enum attributes is intended to be fast, but adding
265 /// and removing string or integer attributes involves a FoldingSet lookup.
267  friend AttributeListImpl;
268  template <typename Ty> friend struct DenseMapInfo;
269 
270  // TODO: Extract AvailableAttrs from AttributeSetNode and store them here.
271  // This will allow an efficient implementation of addAttribute and
272  // removeAttribute for enum attrs.
273 
274  /// Private implementation pointer.
275  AttributeSetNode *SetNode = nullptr;
276 
277 private:
278  explicit AttributeSet(AttributeSetNode *ASN) : SetNode(ASN) {}
279 
280 public:
281  /// AttributeSet is a trivially copyable value type.
282  AttributeSet() = default;
283  AttributeSet(const AttributeSet &) = default;
284  ~AttributeSet() = default;
285 
286  static AttributeSet get(LLVMContext &C, const AttrBuilder &B);
288 
289  bool operator==(const AttributeSet &O) const { return SetNode == O.SetNode; }
290  bool operator!=(const AttributeSet &O) const { return !(*this == O); }
291 
292  /// Add an argument attribute. Returns a new set because attribute sets are
293  /// immutable.
295  Attribute::AttrKind Kind) const;
296 
297  /// Add a target-dependent attribute. Returns a new set because attribute sets
298  /// are immutable.
300  StringRef Value = StringRef()) const;
301 
302  /// Add attributes to the attribute set. Returns a new set because attribute
303  /// sets are immutable.
305  AttributeSet AS) const;
306 
307  /// Remove the specified attribute from this set. Returns a new set because
308  /// attribute sets are immutable.
310  Attribute::AttrKind Kind) const;
311 
312  /// Remove the specified attribute from this set. Returns a new set because
313  /// attribute sets are immutable.
315  StringRef Kind) const;
316 
317  /// Remove the specified attributes from this set. Returns a new set because
318  /// attribute sets are immutable.
320  removeAttributes(LLVMContext &C, const AttrBuilder &AttrsToRemove) const;
321 
322  /// Return the number of attributes in this set.
323  unsigned getNumAttributes() const;
324 
325  /// Return true if attributes exists in this set.
326  bool hasAttributes() const { return SetNode != nullptr; }
327 
328  /// Return true if the attribute exists in this set.
330 
331  /// Return true if the attribute exists in this set.
332  bool hasAttribute(StringRef Kind) const;
333 
334  /// Return the attribute object.
336 
337  /// Return the target-dependent attribute object.
339 
340  MaybeAlign getAlignment() const;
342  uint64_t getDereferenceableBytes() const;
343  uint64_t getDereferenceableOrNullBytes() const;
344  Type *getByValType() const;
345  Type *getStructRetType() const;
346  Type *getByRefType() const;
347  Type *getPreallocatedType() const;
348  Type *getInAllocaType() const;
349  Type *getElementType() const;
350  std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const;
351  std::pair<unsigned, unsigned> getVScaleRangeArgs() const;
352  std::string getAsString(bool InAttrGrp = false) const;
353 
354  /// Return true if this attribute set belongs to the LLVMContext.
355  bool hasParentContext(LLVMContext &C) const;
356 
357  using iterator = const Attribute *;
358 
359  iterator begin() const;
360  iterator end() const;
361 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
362  void dump() const;
363 #endif
364 };
365 
366 //===----------------------------------------------------------------------===//
367 /// \class
368 /// Provide DenseMapInfo for AttributeSet.
369 template <> struct DenseMapInfo<AttributeSet> {
371  auto Val = static_cast<uintptr_t>(-1);
372  Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;
373  return AttributeSet(reinterpret_cast<AttributeSetNode *>(Val));
374  }
375 
377  auto Val = static_cast<uintptr_t>(-2);
378  Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;
379  return AttributeSet(reinterpret_cast<AttributeSetNode *>(Val));
380  }
381 
382  static unsigned getHashValue(AttributeSet AS) {
383  return (unsigned((uintptr_t)AS.SetNode) >> 4) ^
384  (unsigned((uintptr_t)AS.SetNode) >> 9);
385  }
386 
387  static bool isEqual(AttributeSet LHS, AttributeSet RHS) { return LHS == RHS; }
388 };
389 
390 //===----------------------------------------------------------------------===//
391 /// \class
392 /// This class holds the attributes for a function, its return value, and
393 /// its parameters. You access the attributes for each of them via an index into
394 /// the AttributeList object. The function attributes are at index
395 /// `AttributeList::FunctionIndex', the return value is at index
396 /// `AttributeList::ReturnIndex', and the attributes for the parameters start at
397 /// index `AttributeList::FirstArgIndex'.
399 public:
400  enum AttrIndex : unsigned {
404  };
405 
406 private:
407  friend class AttrBuilder;
408  friend class AttributeListImpl;
409  friend class AttributeSet;
410  friend class AttributeSetNode;
411  template <typename Ty> friend struct DenseMapInfo;
412 
413  /// The attributes that we are managing. This can be null to represent
414  /// the empty attributes list.
415  AttributeListImpl *pImpl = nullptr;
416 
417 public:
418  /// Create an AttributeList with the specified parameters in it.
419  static AttributeList get(LLVMContext &C,
420  ArrayRef<std::pair<unsigned, Attribute>> Attrs);
421  static AttributeList get(LLVMContext &C,
422  ArrayRef<std::pair<unsigned, AttributeSet>> Attrs);
423 
424  /// Create an AttributeList from attribute sets for a function, its
425  /// return value, and all of its arguments.
426  static AttributeList get(LLVMContext &C, AttributeSet FnAttrs,
427  AttributeSet RetAttrs,
428  ArrayRef<AttributeSet> ArgAttrs);
429 
430 private:
431  explicit AttributeList(AttributeListImpl *LI) : pImpl(LI) {}
432 
434 
435  AttributeList setAttributes(LLVMContext &C, unsigned Index,
436  AttributeSet Attrs) const;
437 
438 public:
439  AttributeList() = default;
440 
441  //===--------------------------------------------------------------------===//
442  // AttributeList Construction and Mutation
443  //===--------------------------------------------------------------------===//
444 
445  /// Return an AttributeList with the specified parameters in it.
447  static AttributeList get(LLVMContext &C, unsigned Index,
449  static AttributeList get(LLVMContext &C, unsigned Index,
451  ArrayRef<uint64_t> Values);
452  static AttributeList get(LLVMContext &C, unsigned Index,
454  static AttributeList get(LLVMContext &C, unsigned Index,
455  const AttrBuilder &B);
456 
457  /// Add an attribute to the attribute set at the given index.
458  /// Returns a new list because attribute lists are immutable.
460  Attribute::AttrKind Kind) const;
461 
462  /// Add an attribute to the attribute set at the given index.
463  /// Returns a new list because attribute lists are immutable.
466  StringRef Value = StringRef()) const;
467 
468  /// Add an attribute to the attribute set at the given index.
469  /// Returns a new list because attribute lists are immutable.
471  Attribute A) const;
472 
473  /// Add attributes to the attribute set at the given index.
474  /// Returns a new list because attribute lists are immutable.
476  const AttrBuilder &B) const;
477 
478  /// Add an argument attribute to the list. Returns a new list because
479  /// attribute lists are immutable.
481  LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const {
482  return addAttribute(C, ArgNo + FirstArgIndex, Kind);
483  }
484 
485  /// Add an argument attribute to the list. Returns a new list because
486  /// attribute lists are immutable.
489  StringRef Value = StringRef()) const {
490  return addAttribute(C, ArgNo + FirstArgIndex, Kind, Value);
491  }
492 
493  /// Add an attribute to the attribute list at the given arg indices. Returns a
494  /// new list because attribute lists are immutable.
496  ArrayRef<unsigned> ArgNos,
497  Attribute A) const;
498 
499  /// Add an argument attribute to the list. Returns a new list because
500  /// attribute lists are immutable.
502  unsigned ArgNo,
503  const AttrBuilder &B) const {
504  return addAttributes(C, ArgNo + FirstArgIndex, B);
505  }
506 
507  /// Remove the specified attribute at the specified index from this
508  /// attribute list. Returns a new list because attribute lists are immutable.
510  Attribute::AttrKind Kind) const;
511 
512  /// Remove the specified attribute at the specified index from this
513  /// attribute list. Returns a new list because attribute lists are immutable.
515  StringRef Kind) const;
516 
517  /// Remove the specified attributes at the specified index from this
518  /// attribute list. Returns a new list because attribute lists are immutable.
520  LLVMContext &C, unsigned Index, const AttrBuilder &AttrsToRemove) const;
521 
522  /// Remove all attributes at the specified index from this
523  /// attribute list. Returns a new list because attribute lists are immutable.
525  unsigned Index) const;
526 
527  /// Remove the specified attribute at the specified arg index from this
528  /// attribute list. Returns a new list because attribute lists are immutable.
530  LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const {
531  return removeAttribute(C, ArgNo + FirstArgIndex, Kind);
532  }
533 
534  /// Remove the specified attribute at the specified arg index from this
535  /// attribute list. Returns a new list because attribute lists are immutable.
537  unsigned ArgNo,
538  StringRef Kind) const {
539  return removeAttribute(C, ArgNo + FirstArgIndex, Kind);
540  }
541 
542  /// Remove the specified attribute at the specified arg index from this
543  /// attribute list. Returns a new list because attribute lists are immutable.
545  LLVMContext &C, unsigned ArgNo, const AttrBuilder &AttrsToRemove) const {
546  return removeAttributes(C, ArgNo + FirstArgIndex, AttrsToRemove);
547  }
548 
549  /// Remove all attributes at the specified arg index from this
550  /// attribute list. Returns a new list because attribute lists are immutable.
552  unsigned ArgNo) const {
553  return removeAttributes(C, ArgNo + FirstArgIndex);
554  }
555 
556  /// Replace the type contained by attribute \p AttrKind at index \p ArgNo wih
557  /// \p ReplacementTy, preserving all other attributes.
559  unsigned ArgNo,
561  Type *ReplacementTy) const {
562  Attribute Attr = getAttribute(ArgNo, Kind);
563  auto Attrs = removeAttribute(C, ArgNo, Kind);
564  return Attrs.addAttribute(C, ArgNo, Attr.getWithNewType(C, ReplacementTy));
565  }
566 
567  /// \brief Add the dereferenceable attribute to the attribute set at the given
568  /// index. Returns a new list because attribute lists are immutable.
570  unsigned Index,
571  uint64_t Bytes) const;
572 
573  /// \brief Add the dereferenceable attribute to the attribute set at the given
574  /// arg index. Returns a new list because attribute lists are immutable.
576  LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const {
577  return addDereferenceableAttr(C, ArgNo + FirstArgIndex, Bytes);
578  }
579 
580  /// Add the dereferenceable_or_null attribute to the attribute set at
581  /// the given index. Returns a new list because attribute lists are immutable.
583  LLVMContext &C, unsigned Index, uint64_t Bytes) const;
584 
585  /// Add the dereferenceable_or_null attribute to the attribute set at
586  /// the given arg index. Returns a new list because attribute lists are
587  /// immutable.
589  LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const {
590  return addDereferenceableOrNullAttr(C, ArgNo + FirstArgIndex, Bytes);
591  }
592 
593  /// Add the allocsize attribute to the attribute set at the given index.
594  /// Returns a new list because attribute lists are immutable.
596  addAllocSizeAttr(LLVMContext &C, unsigned Index, unsigned ElemSizeArg,
597  const Optional<unsigned> &NumElemsArg);
598 
599  /// Add the allocsize attribute to the attribute set at the given arg index.
600  /// Returns a new list because attribute lists are immutable.
602  addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg,
603  const Optional<unsigned> &NumElemsArg) {
604  return addAllocSizeAttr(C, ArgNo + FirstArgIndex, ElemSizeArg, NumElemsArg);
605  }
606 
607  /// Add the vscale_range attribute to the attribute set at the given index.
608  /// Returns a new list because attribute lists are immutable.
610  unsigned Index,
611  unsigned MinValue,
612  unsigned MaxValue);
613 
614  //===--------------------------------------------------------------------===//
615  // AttributeList Accessors
616  //===--------------------------------------------------------------------===//
617 
618  /// The attributes for the specified index are returned.
619  AttributeSet getAttributes(unsigned Index) const;
620 
621  /// The attributes for the argument or parameter at the given index are
622  /// returned.
623  AttributeSet getParamAttributes(unsigned ArgNo) const;
624 
625  /// The attributes for the ret value are returned.
627 
628  /// The function attributes are returned.
630 
631  /// Return true if the attribute exists at the given index.
632  bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const;
633 
634  /// Return true if the attribute exists at the given index.
635  bool hasAttribute(unsigned Index, StringRef Kind) const;
636 
637  /// Return true if attribute exists at the given index.
638  bool hasAttributes(unsigned Index) const;
639 
640  /// Return true if the attribute exists for the given argument
641  bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
642  return hasAttribute(ArgNo + FirstArgIndex, Kind);
643  }
644 
645  /// Return true if the attribute exists for the given argument
646  bool hasParamAttr(unsigned ArgNo, StringRef Kind) const {
647  return hasAttribute(ArgNo + FirstArgIndex, Kind);
648  }
649 
650  /// Return true if attributes exists for the given argument
651  bool hasParamAttrs(unsigned ArgNo) const {
652  return hasAttributes(ArgNo + FirstArgIndex);
653  }
654 
655  /// Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but
656  /// may be faster.
658 
659  /// Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but
660  /// may be faster.
661  bool hasFnAttribute(StringRef Kind) const;
662 
663  /// Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).
664  bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const;
665 
666  /// Return true if the specified attribute is set for at least one
667  /// parameter or for the return value. If Index is not nullptr, the index
668  /// of a parameter with the specified attribute is provided.
670  unsigned *Index = nullptr) const;
671 
672  /// Return the attribute object that exists at the given index.
674 
675  /// Return the attribute object that exists at the given index.
676  Attribute getAttribute(unsigned Index, StringRef Kind) const;
677 
678  /// Return the attribute object that exists at the arg index.
680  return getAttribute(ArgNo + FirstArgIndex, Kind);
681  }
682 
683  /// Return the attribute object that exists at the given index.
684  Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const {
685  return getAttribute(ArgNo + FirstArgIndex, Kind);
686  }
687 
688  /// Return the alignment of the return value.
689  MaybeAlign getRetAlignment() const;
690 
691  /// Return the alignment for the specified function parameter.
692  MaybeAlign getParamAlignment(unsigned ArgNo) const;
693 
694  /// Return the stack alignment for the specified function parameter.
695  MaybeAlign getParamStackAlignment(unsigned ArgNo) const;
696 
697  /// Return the byval type for the specified function parameter.
698  Type *getParamByValType(unsigned ArgNo) const;
699 
700  /// Return the sret type for the specified function parameter.
701  Type *getParamStructRetType(unsigned ArgNo) const;
702 
703  /// Return the byref type for the specified function parameter.
704  Type *getParamByRefType(unsigned ArgNo) const;
705 
706  /// Return the preallocated type for the specified function parameter.
707  Type *getParamPreallocatedType(unsigned ArgNo) const;
708 
709  /// Return the inalloca type for the specified function parameter.
710  Type *getParamInAllocaType(unsigned ArgNo) const;
711 
712  /// Return the elementtype type for the specified function parameter.
713  Type *getParamElementType(unsigned ArgNo) const;
714 
715  /// Get the stack alignment.
716  MaybeAlign getStackAlignment(unsigned Index) const;
717 
718  /// Get the number of dereferenceable bytes (or zero if unknown).
719  uint64_t getDereferenceableBytes(unsigned Index) const;
720 
721  /// Get the number of dereferenceable bytes (or zero if unknown) of an
722  /// arg.
723  uint64_t getParamDereferenceableBytes(unsigned ArgNo) const {
724  return getDereferenceableBytes(ArgNo + FirstArgIndex);
725  }
726 
727  /// Get the number of dereferenceable_or_null bytes (or zero if
728  /// unknown).
729  uint64_t getDereferenceableOrNullBytes(unsigned Index) const;
730 
731  /// Get the number of dereferenceable_or_null bytes (or zero if
732  /// unknown) of an arg.
733  uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const {
735  }
736 
737  /// Get the allocsize argument numbers (or pair(0, 0) if unknown).
738  std::pair<unsigned, Optional<unsigned>>
739  getAllocSizeArgs(unsigned Index) const;
740 
741  /// Get the vscale_range argument numbers (or pair(0, 0) if unknown).
742  std::pair<unsigned, unsigned> getVScaleRangeArgs(unsigned Index) const;
743 
744  /// Return the attributes at the index as a string.
745  std::string getAsString(unsigned Index, bool InAttrGrp = false) const;
746 
747  /// Return true if this attribute list belongs to the LLVMContext.
748  bool hasParentContext(LLVMContext &C) const;
749 
750  //===--------------------------------------------------------------------===//
751  // AttributeList Introspection
752  //===--------------------------------------------------------------------===//
753 
754  using iterator = const AttributeSet *;
755 
756  iterator begin() const;
757  iterator end() const;
758 
759  unsigned getNumAttrSets() const;
760 
761  /// Use these to iterate over the valid attribute indices.
762  unsigned index_begin() const { return AttributeList::FunctionIndex; }
763  unsigned index_end() const { return getNumAttrSets() - 1; }
764 
765  /// operator==/!= - Provide equality predicates.
766  bool operator==(const AttributeList &RHS) const { return pImpl == RHS.pImpl; }
767  bool operator!=(const AttributeList &RHS) const { return pImpl != RHS.pImpl; }
768 
769  /// Return a raw pointer that uniquely identifies this attribute list.
770  void *getRawPointer() const {
771  return pImpl;
772  }
773 
774  /// Return true if there are no attributes.
775  bool isEmpty() const { return pImpl == nullptr; }
776 
777  void print(raw_ostream &O) const;
778 
779  void dump() const;
780 };
781 
782 //===----------------------------------------------------------------------===//
783 /// \class
784 /// Provide DenseMapInfo for AttributeList.
785 template <> struct DenseMapInfo<AttributeList> {
787  auto Val = static_cast<uintptr_t>(-1);
788  Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
789  return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
790  }
791 
793  auto Val = static_cast<uintptr_t>(-2);
794  Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
795  return AttributeList(reinterpret_cast<AttributeListImpl *>(Val));
796  }
797 
798  static unsigned getHashValue(AttributeList AS) {
799  return (unsigned((uintptr_t)AS.pImpl) >> 4) ^
800  (unsigned((uintptr_t)AS.pImpl) >> 9);
801  }
802 
803  static bool isEqual(AttributeList LHS, AttributeList RHS) {
804  return LHS == RHS;
805  }
806 };
807 
808 //===----------------------------------------------------------------------===//
809 /// \class
810 /// This class is used in conjunction with the Attribute::get method to
811 /// create an Attribute object. The object itself is uniquified. The Builder's
812 /// value, however, is not. So this can be used as a quick way to test for
813 /// equality, presence of attributes, etc.
814 class AttrBuilder {
815  std::bitset<Attribute::EndAttrKinds> Attrs;
816  std::map<SmallString<32>, SmallString<32>, std::less<>> TargetDepAttrs;
817  MaybeAlign Alignment;
818  MaybeAlign StackAlignment;
819  uint64_t DerefBytes = 0;
820  uint64_t DerefOrNullBytes = 0;
821  uint64_t AllocSizeArgs = 0;
822  uint64_t VScaleRangeArgs = 0;
823  std::array<Type *, Attribute::NumTypeAttrKinds> TypeAttrs = {};
824 
825  Optional<unsigned> kindToTypeIndex(Attribute::AttrKind Kind) const;
826 
827 public:
828  AttrBuilder() = default;
829 
830  AttrBuilder(const Attribute &A) {
831  addAttribute(A);
832  }
833 
834  AttrBuilder(AttributeList AS, unsigned Idx);
836 
837  void clear();
838 
839  /// Add an attribute to the builder.
841  assert((unsigned)Val < Attribute::EndAttrKinds &&
842  "Attribute out of range!");
844  "Adding integer/type attribute without an argument!");
845  Attrs[Val] = true;
846  return *this;
847  }
848 
849  /// Add the Attribute object to the builder.
851 
852  /// Add the target-dependent attribute to the builder.
854 
855  /// Remove an attribute from the builder.
857 
858  /// Remove the attributes from the builder.
859  AttrBuilder &removeAttributes(AttributeList A, uint64_t WithoutIndex);
860 
861  /// Remove the target-dependent attribute to the builder.
863 
864  /// Add the attributes from the builder.
865  AttrBuilder &merge(const AttrBuilder &B);
866 
867  /// Remove the attributes from the builder.
868  AttrBuilder &remove(const AttrBuilder &B);
869 
870  /// Return true if the builder has any attribute that's in the
871  /// specified builder.
872  bool overlaps(const AttrBuilder &B) const;
873 
874  /// Return true if the builder has the specified attribute.
876  assert((unsigned)A < Attribute::EndAttrKinds && "Attribute out of range!");
877  return Attrs[A];
878  }
879 
880  /// Return true if the builder has the specified target-dependent
881  /// attribute.
882  bool contains(StringRef A) const;
883 
884  /// Return true if the builder has IR-level attributes.
885  bool hasAttributes() const;
886 
887  /// Return true if the builder has any attribute that's in the
888  /// specified attribute.
889  bool hasAttributes(AttributeList A, uint64_t Index) const;
890 
891  /// Return true if the builder has an alignment attribute.
892  bool hasAlignmentAttr() const;
893 
894  /// Retrieve the alignment attribute, if it exists.
895  MaybeAlign getAlignment() const { return Alignment; }
896 
897  /// Retrieve the stack alignment attribute, if it exists.
898  MaybeAlign getStackAlignment() const { return StackAlignment; }
899 
900  /// Retrieve the number of dereferenceable bytes, if the
901  /// dereferenceable attribute exists (zero is returned otherwise).
902  uint64_t getDereferenceableBytes() const { return DerefBytes; }
903 
904  /// Retrieve the number of dereferenceable_or_null bytes, if the
905  /// dereferenceable_or_null attribute exists (zero is returned otherwise).
906  uint64_t getDereferenceableOrNullBytes() const { return DerefOrNullBytes; }
907 
908  /// Retrieve type for the given type attribute.
910 
911  /// Retrieve the byval type.
912  Type *getByValType() const { return getTypeAttr(Attribute::ByVal); }
913 
914  /// Retrieve the sret type.
915  Type *getStructRetType() const { return getTypeAttr(Attribute::StructRet); }
916 
917  /// Retrieve the byref type.
918  Type *getByRefType() const { return getTypeAttr(Attribute::ByRef); }
919 
920  /// Retrieve the preallocated type.
922  return getTypeAttr(Attribute::Preallocated);
923  }
924 
925  /// Retrieve the inalloca type.
926  Type *getInAllocaType() const { return getTypeAttr(Attribute::InAlloca); }
927 
928  /// Retrieve the allocsize args, if the allocsize attribute exists. If it
929  /// doesn't exist, pair(0, 0) is returned.
930  std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const;
931 
932  /// Retrieve the vscale_range args, if the vscale_range attribute exists. If
933  /// it doesn't exist, pair(0, 0) is returned.
934  std::pair<unsigned, unsigned> getVScaleRangeArgs() const;
935 
936  /// This turns an alignment into the form used internally in Attribute.
937  /// This call has no effect if Align is not set.
939 
940  /// This turns an int alignment (which must be a power of 2) into the
941  /// form used internally in Attribute.
942  /// This call has no effect if Align is 0.
943  /// Deprecated, use the version using a MaybeAlign.
944  inline AttrBuilder &addAlignmentAttr(unsigned Align) {
946  }
947 
948  /// This turns a stack alignment into the form used internally in Attribute.
949  /// This call has no effect if Align is not set.
951 
952  /// This turns an int stack alignment (which must be a power of 2) into
953  /// the form used internally in Attribute.
954  /// This call has no effect if Align is 0.
955  /// Deprecated, use the version using a MaybeAlign.
958  }
959 
960  /// This turns the number of dereferenceable bytes into the form used
961  /// internally in Attribute.
962  AttrBuilder &addDereferenceableAttr(uint64_t Bytes);
963 
964  /// This turns the number of dereferenceable_or_null bytes into the
965  /// form used internally in Attribute.
966  AttrBuilder &addDereferenceableOrNullAttr(uint64_t Bytes);
967 
968  /// This turns one (or two) ints into the form used internally in Attribute.
969  AttrBuilder &addAllocSizeAttr(unsigned ElemSizeArg,
970  const Optional<unsigned> &NumElemsArg);
971 
972  /// This turns two ints into the form used internally in Attribute.
973  AttrBuilder &addVScaleRangeAttr(unsigned MinValue, unsigned MaxValue);
974 
975  /// Add a type attribute with the given type.
977 
978  /// This turns a byval type into the form used internally in Attribute.
980 
981  /// This turns a sret type into the form used internally in Attribute.
983 
984  /// This turns a byref type into the form used internally in Attribute.
986 
987  /// This turns a preallocated type into the form used internally in Attribute.
989 
990  /// This turns an inalloca type into the form used internally in Attribute.
992 
993  /// Add an allocsize attribute, using the representation returned by
994  /// Attribute.getIntValue().
995  AttrBuilder &addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr);
996 
997  /// Add a vscale_range attribute, using the representation returned by
998  /// Attribute.getIntValue().
999  AttrBuilder &addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr);
1000 
1001  /// Return true if the builder contains no target-independent
1002  /// attributes.
1003  bool empty() const { return Attrs.none(); }
1004 
1005  // Iterators for target-dependent attributes.
1006  using td_type = decltype(TargetDepAttrs)::value_type;
1007  using td_iterator = decltype(TargetDepAttrs)::iterator;
1008  using td_const_iterator = decltype(TargetDepAttrs)::const_iterator;
1011 
1012  td_iterator td_begin() { return TargetDepAttrs.begin(); }
1013  td_iterator td_end() { return TargetDepAttrs.end(); }
1014 
1015  td_const_iterator td_begin() const { return TargetDepAttrs.begin(); }
1016  td_const_iterator td_end() const { return TargetDepAttrs.end(); }
1017 
1019 
1021  return td_const_range(td_begin(), td_end());
1022  }
1023 
1024  bool td_empty() const { return TargetDepAttrs.empty(); }
1025 
1026  bool operator==(const AttrBuilder &B) const;
1027  bool operator!=(const AttrBuilder &B) const { return !(*this == B); }
1028 };
1029 
1030 namespace AttributeFuncs {
1031 
1032 /// Which attributes cannot be applied to a type.
1034 
1035 /// Get param/return attributes which imply immediate undefined behavior if an
1036 /// invalid value is passed. For example, this includes noundef (where undef
1037 /// implies UB), but not nonnull (where null implies poison). It also does not
1038 /// include attributes like nocapture, which constrain the function
1039 /// implementation rather than the passed value.
1041 
1042 /// \returns Return true if the two functions have compatible target-independent
1043 /// attributes for inlining purposes.
1044 bool areInlineCompatible(const Function &Caller, const Function &Callee);
1045 
1046 
1047 /// Checks if there are any incompatible function attributes between
1048 /// \p A and \p B.
1049 ///
1050 /// \param [in] A - The first function to be compared with.
1051 /// \param [in] B - The second function to be compared with.
1052 /// \returns true if the functions have compatible attributes.
1053 bool areOutlineCompatible(const Function &A, const Function &B);
1054 
1055 /// Merge caller's and callee's attributes.
1056 void mergeAttributesForInlining(Function &Caller, const Function &Callee);
1057 
1058 /// Merges the functions attributes from \p ToMerge into function \p Base.
1059 ///
1060 /// \param [in,out] Base - The function being merged into.
1061 /// \param [in] ToMerge - The function to merge attributes from.
1062 void mergeAttributesForOutlining(Function &Base, const Function &ToMerge);
1063 
1064 } // end namespace AttributeFuncs
1065 
1066 } // end namespace llvm
1067 
1068 #endif // LLVM_IR_ATTRIBUTES_H
llvm::AttributeList::removeParamAttributes
LLVM_NODISCARD AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo) const
Remove all attributes at the specified arg index from this attribute list.
Definition: Attributes.h:551
llvm::AttrBuilder::addDereferenceableOrNullAttr
AttrBuilder & addDereferenceableOrNullAttr(uint64_t Bytes)
This turns the number of dereferenceable_or_null bytes into the form used internally in Attribute.
Definition: Attributes.cpp:1686
llvm::AttributeList::getParamInAllocaType
Type * getParamInAllocaType(unsigned ArgNo) const
Return the inalloca type for the specified function parameter.
Definition: Attributes.cpp:1455
llvm::AttributeList::print
void print(raw_ostream &O) const
Definition: Attributes.cpp:1520
llvm::Attribute::getWithPreallocatedType
static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:200
llvm::Attribute::EndAttrKinds
@ EndAttrKinds
Sentinal value useful for loops.
Definition: Attributes.h:76
llvm::AttributeList::replaceAttributeType
LLVM_NODISCARD AttributeList replaceAttributeType(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:558
llvm::AttributeImpl
Definition: AttributeImpl.h:39
llvm::AttributeSet::AttributeSet
AttributeSet()=default
AttributeSet is a trivially copyable value type.
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
llvm::AttributeFuncs::mergeAttributesForOutlining
void mergeAttributesForOutlining(Function &Base, const Function &ToMerge)
Merges the functions attributes from ToMerge into function Base.
Definition: Attributes.cpp:2108
llvm::AttrBuilder::getStackAlignment
MaybeAlign getStackAlignment() const
Retrieve the stack alignment attribute, if it exists.
Definition: Attributes.h:898
llvm::AttributeFuncs::getUBImplyingAttributes
AttrBuilder getUBImplyingAttributes()
Get param/return attributes which imply immediate undefined behavior if an invalid value is passed.
Definition: Attributes.cpp:1919
llvm::AttrBuilder::getByValType
Type * getByValType() const
Retrieve the byval type.
Definition: Attributes.h:912
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::Attribute::isEnumAttribute
bool isEnumAttribute() const
Return true if the attribute is an Attribute::AttrKind type.
Definition: Attributes.cpp:257
llvm::Attribute::isValid
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition: Attributes.h:167
llvm::AttributeSet::hasAttributes
bool hasAttributes() const
Return true if attributes exists in this set.
Definition: Attributes.h:326
Optional.h
llvm::AttributeList::hasFnAttribute
bool hasFnAttribute(Attribute::AttrKind Kind) const
Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but may be faster.
Definition: Attributes.cpp:1400
llvm::AttrBuilder::hasAlignmentAttr
bool hasAlignmentAttr() const
Return true if the builder has an alignment attribute.
Definition: Attributes.cpp:1863
llvm::Attribute::getStackAlignment
MaybeAlign getStackAlignment() const
Returns the stack alignment field of an attribute as a byte alignment value.
Definition: Attributes.cpp:331
llvm::AttrBuilder::overlaps
bool overlaps(const AttrBuilder &B) const
Return true if the builder has any attribute that's in the specified builder.
Definition: Attributes.cpp:1826
llvm::Attribute::getWithAllocSizeArgs
static Attribute getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
Definition: Attributes.cpp:209
llvm::AttributeList::hasAttrSomewhere
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.
Definition: Attributes.cpp:1413
llvm::AttrBuilder::addTypeAttr
AttrBuilder & addTypeAttr(Attribute::AttrKind Kind, Type *Ty)
Add a type attribute with the given type.
Definition: Attributes.cpp:1734
llvm::AttributeSet::getDereferenceableOrNullBytes
uint64_t getDereferenceableOrNullBytes() const
Definition: Attributes.cpp:687
llvm::Attribute::hasAttribute
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
Definition: Attributes.cpp:316
llvm::AttributeList::addDereferenceableOrNullAttr
LLVM_NODISCARD AttributeList addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
Definition: Attributes.cpp:1347
llvm::AttributeList::AttributeList
AttributeList()=default
llvm::Function
Definition: Function.h:61
llvm::AttrBuilder::getDereferenceableBytes
uint64_t getDereferenceableBytes() const
Retrieve the number of dereferenceable bytes, if the dereferenceable attribute exists (zero is return...
Definition: Attributes.h:902
llvm::AttrBuilder::removeAttributes
AttrBuilder & removeAttributes(AttributeList A, uint64_t WithoutIndex)
Remove the attributes from the builder.
Definition: Attributes.cpp:1635
llvm::Attribute
Definition: Attributes.h:52
StringRef.h
llvm::AttrBuilder::hasAttributes
bool hasAttributes() const
Return true if the builder has IR-level attributes.
Definition: Attributes.cpp:1843
llvm::AttributeSet::removeAttributes
LLVM_NODISCARD AttributeSet removeAttributes(LLVMContext &C, const AttrBuilder &AttrsToRemove) const
Remove the specified attributes from this set.
Definition: Attributes.cpp:644
llvm::AttributeList::getParamPreallocatedType
Type * getParamPreallocatedType(unsigned ArgNo) const
Return the preallocated type for the specified function parameter.
Definition: Attributes.cpp:1451
llvm::Attribute::TombstoneKey
@ TombstoneKey
Use as Tombstone key for DenseMap of AttrKind.
Definition: Attributes.h:78
llvm::Attribute::getAttrKindFromName
static Attribute::AttrKind getAttrKindFromName(StringRef AttrName)
Definition: Attributes.cpp:222
llvm::Attribute::get
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
Definition: Attributes.cpp:92
llvm::Attribute::isTypeAttribute
bool isTypeAttribute() const
Return true if the attribute is a type attribute.
Definition: Attributes.cpp:269
llvm::Attribute::isIntAttrKind
static bool isIntAttrKind(AttrKind Kind)
Definition: Attributes.h:86
Types.h
getImpl
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const Module *M)
This lazily constructs the LazyValueInfoImpl.
Definition: LazyValueInfo.cpp:1507
llvm::AttributeList::addParamAttribute
LLVM_NODISCARD AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
Definition: Attributes.h:480
llvm::AttributeSet::addAttributes
LLVM_NODISCARD AttributeSet addAttributes(LLVMContext &C, AttributeSet AS) const
Add attributes to the attribute set.
Definition: Attributes.cpp:613
llvm::AttributeList::addAttribute
LLVM_NODISCARD AttributeList addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
Definition: Attributes.cpp:1212
llvm::AttrBuilder::td_iterator
decltype(TargetDepAttrs)::iterator td_iterator
Definition: Attributes.h:1007
llvm::AttrBuilder::td_end
td_iterator td_end()
Definition: Attributes.h:1013
llvm::AttributeList::end
iterator end() const
Definition: Attributes.cpp:1508
llvm::AttributeList::get
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute >> Attrs)
Create an AttributeList with the specified parameters in it.
Definition: Attributes.cpp:1040
llvm::Attribute::EmptyKey
@ EmptyKey
Use as Empty key for DenseMap of AttrKind.
Definition: Attributes.h:77
llvm::Attribute::getWithStackAlignment
static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment)
Definition: Attributes.cpp:171
llvm::AttrBuilder::getAlignment
MaybeAlign getAlignment() const
Retrieve the alignment attribute, if it exists.
Definition: Attributes.h:895
llvm::AttributeFuncs::typeIncompatible
AttrBuilder typeIncompatible(Type *Ty)
Which attributes cannot be applied to a type.
Definition: Attributes.cpp:1885
llvm::AttributeList::getParamByValType
Type * getParamByValType(unsigned ArgNo) const
Return the byval type for the specified function parameter.
Definition: Attributes.cpp:1439
llvm::AttributeList::addDereferenceableAttr
LLVM_NODISCARD AttributeList addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
Definition: Attributes.cpp:1338
llvm::DenseMapInfo< AttributeSet >::getHashValue
static unsigned getHashValue(AttributeSet AS)
Definition: Attributes.h:382
llvm::AttrBuilder::addAllocSizeAttr
AttrBuilder & addAllocSizeAttr(unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
This turns one (or two) ints into the form used internally in Attribute.
Definition: Attributes.cpp:1695
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::Attribute::getWithVScaleRangeArgs
static Attribute getWithVScaleRangeArgs(LLVMContext &Context, unsigned MinValue, unsigned MaxValue)
Definition: Attributes.cpp:216
llvm::AttributeList
Definition: Attributes.h:398
llvm::DenseMapInfo< AttributeList >::isEqual
static bool isEqual(AttributeList LHS, AttributeList RHS)
Definition: Attributes.h:803
llvm::Attribute::isTypeAttrKind
static bool isTypeAttrKind(AttrKind Kind)
Definition: Attributes.h:89
llvm::Attribute::operator==
bool operator==(Attribute A) const
Equality and non-equality operators.
Definition: Attributes.h:231
llvm::Optional< unsigned >
llvm::AttrBuilder::addPreallocatedAttr
AttrBuilder & addPreallocatedAttr(Type *Ty)
This turns a preallocated type into the form used internally in Attribute.
Definition: Attributes.cpp:1754
llvm::AttributeSet::operator==
bool operator==(const AttributeSet &O) const
Definition: Attributes.h:289
llvm::AttributeList::getRawPointer
void * getRawPointer() const
Return a raw pointer that uniquely identifies this attribute list.
Definition: Attributes.h:770
llvm::DenseMapInfo< AttributeList >::getEmptyKey
static AttributeList getEmptyKey()
Definition: Attributes.h:786
llvm::Attribute::getAlignment
MaybeAlign getAlignment() const
Returns the alignment field of an attribute as a byte alignment value.
Definition: Attributes.cpp:325
llvm::AttrBuilder::addAlignmentAttr
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:944
llvm::AttrBuilder::AttrBuilder
AttrBuilder()=default
llvm::AttrBuilder::merge
AttrBuilder & merge(const AttrBuilder &B)
Add the attributes from the builder.
Definition: Attributes.cpp:1762
llvm::AttributeList::addAllocSizeAttr
LLVM_NODISCARD AttributeList addAllocSizeAttr(LLVMContext &C, unsigned Index, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
Add the allocsize attribute to the attribute set at the given index.
Definition: Attributes.cpp:1355
llvm::AttributeList::removeParamAttribute
LLVM_NODISCARD 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:536
llvm::Attribute::getValueAsBool
bool getValueAsBool() const
Return the attribute's value as a boolean.
Definition: Attributes.cpp:287
llvm::AttributeList::index_end
unsigned index_end() const
Definition: Attributes.h:763
llvm::AttrBuilder::removeAttribute
AttrBuilder & removeAttribute(Attribute::AttrKind Val)
Remove an attribute from the builder.
Definition: Attributes.cpp:1613
llvm::AttributeList::hasAttribute
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
Definition: Attributes.cpp:1387
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::AttrBuilder::getVScaleRangeArgs
std::pair< unsigned, unsigned > getVScaleRangeArgs() const
Retrieve the vscale_range args, if the vscale_range attribute exists.
Definition: Attributes.cpp:1651
llvm::AttributeList::getParamStackAlignment
MaybeAlign getParamStackAlignment(unsigned ArgNo) const
Return the stack alignment for the specified function parameter.
Definition: Attributes.cpp:1435
llvm::Attribute::getValueAsInt
uint64_t getValueAsInt() const
Return the attribute's value as an integer.
Definition: Attributes.cpp:280
llvm::AttributeSet::addAttribute
LLVM_NODISCARD AttributeSet addAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add an argument attribute.
Definition: Attributes.cpp:598
llvm::DenseMapInfo
Definition: APInt.h:34
llvm::Attribute::getWithInAllocaType
static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:204
llvm::AttributeSet::operator!=
bool operator!=(const AttributeSet &O) const
Definition: Attributes.h:290
llvm::AttrBuilder::getTypeAttr
Type * getTypeAttr(Attribute::AttrKind Kind) const
Retrieve type for the given type attribute.
Definition: Attributes.cpp:1728
llvm::AttributeList::hasParentContext
bool hasParentContext(LLVMContext &C) const
Return true if this attribute list belongs to the LLVMContext.
Definition: Attributes.cpp:1496
llvm::AttributeListImpl
Definition: AttributeImpl.h:279
llvm::AttrBuilder::addByValAttr
AttrBuilder & addByValAttr(Type *Ty)
This turns a byval type into the form used internally in Attribute.
Definition: Attributes.cpp:1742
SmallString.h
llvm::AttributeSet::getAsString
std::string getAsString(bool InAttrGrp=false) const
Definition: Attributes.cpp:725
llvm::AttributeList::begin
iterator begin() const
Definition: Attributes.cpp:1504
llvm::AttributeList::removeAttributes
LLVM_NODISCARD AttributeList removeAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &AttrsToRemove) const
Remove the specified attributes at the specified index from this attribute list.
Definition: Attributes.cpp:1316
llvm::AttributeList::removeParamAttributes
LLVM_NODISCARD AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &AttrsToRemove) const
Remove the specified attribute at the specified arg index from this attribute list.
Definition: Attributes.h:544
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::AttributeList::index_begin
unsigned index_begin() const
Use these to iterate over the valid attribute indices.
Definition: Attributes.h:762
llvm::AttributeSet::hasAttribute
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
Definition: Attributes.cpp:659
llvm::AttrBuilder::operator==
bool operator==(const AttrBuilder &B) const
Definition: Attributes.cpp:1867
llvm::AttributeList::getFnAttributes
AttributeSet getFnAttributes() const
The function attributes are returned.
Definition: Attributes.cpp:1383
llvm::AttrBuilder::td_const_iterator
decltype(TargetDepAttrs)::const_iterator td_const_iterator
Definition: Attributes.h:1008
llvm::AttributeSet::getDereferenceableBytes
uint64_t getDereferenceableBytes() const
Definition: Attributes.cpp:683
llvm::AttributeFuncs::areOutlineCompatible
bool areOutlineCompatible(const Function &A, const Function &B)
Checks if there are any incompatible function attributes between A and B.
Definition: Attributes.cpp:2098
llvm::AttributeList::getParamAttributes
AttributeSet getParamAttributes(unsigned ArgNo) const
The attributes for the argument or parameter at the given index are returned.
Definition: Attributes.cpp:1375
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:109
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::AttrBuilder::empty
bool empty() const
Return true if the builder contains no target-independent attributes.
Definition: Attributes.h:1003
llvm::Attribute::getVScaleRangeArgs
std::pair< unsigned, unsigned > getVScaleRangeArgs() const
Returns the argument numbers for the vscale_range attribute (or pair(0, 0) if not known).
Definition: Attributes.cpp:357
llvm::AttributeSet::getVScaleRangeArgs
std::pair< unsigned, unsigned > getVScaleRangeArgs() const
Definition: Attributes.cpp:720
llvm::AttributeList::getAttributes
AttributeSet getAttributes(unsigned Index) const
The attributes for the specified index are returned.
Definition: Attributes.cpp:1489
llvm::unwrap
Attribute unwrap(LLVMAttributeRef Attr)
Definition: Attributes.h:256
llvm::AttributeList::getRetAlignment
MaybeAlign getRetAlignment() const
Return the alignment of the return value.
Definition: Attributes.cpp:1427
llvm::AttrBuilder::td_end
td_const_iterator td_end() const
Definition: Attributes.h:1016
PointerLikeTypeTraits.h
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::AttributeSet::getInAllocaType
Type * getInAllocaType() const
Definition: Attributes.cpp:707
llvm::AttributeList::getStackAlignment
MaybeAlign getStackAlignment(unsigned Index) const
Get the stack alignment.
Definition: Attributes.cpp:1463
llvm::Attribute::getKindAsString
StringRef getKindAsString() const
Return the attribute's kind as a string.
Definition: Attributes.cpp:294
llvm::Attribute::isStringAttribute
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
Definition: Attributes.cpp:265
llvm::AttributeList::getParamElementType
Type * getParamElementType(unsigned ArgNo) const
Return the elementtype type for the specified function parameter.
Definition: Attributes.cpp:1459
llvm::AttributeList::removeParamAttribute
LLVM_NODISCARD 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:529
llvm::AttributeList::hasParamAttribute
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).
Definition: Attributes.cpp:1408
Align
uint64_t Align
Definition: ELFObjHandler.cpp:83
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::Attribute::getWithStructRetType
static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:192
llvm::AttrBuilder::getByRefType
Type * getByRefType() const
Retrieve the byref type.
Definition: Attributes.h:918
llvm::AttrBuilder::clear
void clear()
Definition: Attributes.cpp:1563
llvm::Attribute::isEnumAttrKind
static bool isEnumAttrKind(AttrKind Kind)
Definition: Attributes.h:83
llvm::AttrBuilder::contains
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
Definition: Attributes.h:875
llvm::Attribute::getValueAsString
StringRef getValueAsString() const
Return the attribute's value as a string.
Definition: Attributes.cpp:301
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::AttrBuilder::addAlignmentAttr
AttrBuilder & addAlignmentAttr(MaybeAlign Align)
This turns an alignment into the form used internally in Attribute.
Definition: Attributes.cpp:1655
llvm::AttrBuilder::getStructRetType
Type * getStructRetType() const
Retrieve the sret type.
Definition: Attributes.h:915
llvm::SmallString< 32 >
llvm::AttrBuilder::td_type
decltype(TargetDepAttrs)::value_type td_type
Definition: Attributes.h:1006
llvm::AttributeSet::end
iterator end() const
Definition: Attributes.cpp:741
llvm::AttributeList::getAllocSizeArgs
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs(unsigned Index) const
Get the allocsize argument numbers (or pair(0, 0) if unknown).
Definition: Attributes.cpp:1476
llvm::AttributeList::addAttributes
LLVM_NODISCARD AttributeList addAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &B) const
Add attributes to the attribute set at the given index.
Definition: Attributes.cpp:1247
llvm::AttributeList::ReturnIndex
@ ReturnIndex
Definition: Attributes.h:401
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:179
llvm::AttrBuilder::addStackAlignmentAttr
AttrBuilder & addStackAlignmentAttr(MaybeAlign Align)
This turns a stack alignment into the form used internally in Attribute.
Definition: Attributes.cpp:1666
llvm::Attribute::canUseAsFnAttr
static bool canUseAsFnAttr(AttrKind Kind)
Definition: Attributes.cpp:505
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::Attribute::operator!=
bool operator!=(Attribute A) const
Definition: Attributes.h:232
llvm::Attribute::getRawPointer
void * getRawPointer() const
Return a raw pointer that uniquely identifies this attribute.
Definition: Attributes.h:240
llvm::Attribute::None
@ None
No attributes have been set.
Definition: Attributes.h:73
llvm::AttributeList::getDereferenceableBytes
uint64_t getDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown).
Definition: Attributes.cpp:1467
llvm::AttrBuilder::addVScaleRangeAttrFromRawRepr
AttrBuilder & addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr)
Add a vscale_range attribute, using the representation returned by Attribute.getIntValue().
Definition: Attributes.cpp:1716
llvm::Attribute::getWithNewType
Attribute getWithNewType(LLVMContext &Context, Type *ReplacementTy)
For a typed attribute, return the equivalent attribute with the type changed to ReplacementTy.
Definition: Attributes.h:136
llvm::AttrBuilder::td_const_range
iterator_range< td_const_iterator > td_const_range
Definition: Attributes.h:1010
llvm::AttributeList::addParamAttributes
LLVM_NODISCARD AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &B) const
Add an argument attribute to the list.
Definition: Attributes.h:501
llvm::AttributeSet::get
static AttributeSet get(LLVMContext &C, const AttrBuilder &B)
Definition: Attributes.cpp:590
llvm::AttrBuilder::addInAllocaAttr
AttrBuilder & addInAllocaAttr(Type *Ty)
This turns an inalloca type into the form used internally in Attribute.
Definition: Attributes.cpp:1758
llvm::AttributeList::addAllocSizeParamAttr
LLVM_NODISCARD AttributeList addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
Add the allocsize attribute to the attribute set at the given arg index.
Definition: Attributes.h:602
llvm::AttrBuilder::getDereferenceableOrNullBytes
uint64_t getDereferenceableOrNullBytes() const
Retrieve the number of dereferenceable_or_null bytes, if the dereferenceable_or_null attribute exists...
Definition: Attributes.h:906
llvm::AttrBuilder::td_range
iterator_range< td_iterator > td_range
Definition: Attributes.h:1009
llvm::DenseMapInfo< AttributeSet >::isEqual
static bool isEqual(AttributeSet LHS, AttributeSet RHS)
Definition: Attributes.h:387
llvm::AttrBuilder::operator!=
bool operator!=(const AttrBuilder &B) const
Definition: Attributes.h:1027
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::AttributeList::getAsString
std::string getAsString(unsigned Index, bool InAttrGrp=false) const
Return the attributes at the index as a string.
Definition: Attributes.cpp:1485
llvm::AttributeList::dump
void dump() const
Definition: Attributes.cpp:1544
llvm::Attribute::getKindAsEnum
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
Definition: Attributes.cpp:273
llvm::AttrBuilder
Definition: Attributes.h:814
llvm::Attribute::AttrKind
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition: Attributes.h:71
llvm::Attribute::getWithDereferenceableBytes
static Attribute getWithDereferenceableBytes(LLVMContext &Context, uint64_t Bytes)
Definition: Attributes.cpp:176
llvm::AttributeList::getParamAlignment
MaybeAlign getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
Definition: Attributes.cpp:1431
ArrayRef.h
TemplateParamKind::Type
@ Type
llvm::Attribute::canUseAsParamAttr
static bool canUseAsParamAttr(AttrKind Kind)
Definition: Attributes.cpp:509
llvm::AttributeSet::hasParentContext
bool hasParentContext(LLVMContext &C) const
Return true if this attribute set belongs to the LLVMContext.
Definition: Attributes.cpp:729
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::AttrBuilder::addByRefAttr
AttrBuilder & addByRefAttr(Type *Ty)
This turns a byref type into the form used internally in Attribute.
Definition: Attributes.cpp:1750
llvm::AttributeList::addParamAttribute
LLVM_NODISCARD AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, StringRef Kind, StringRef Value=StringRef()) const
Add an argument attribute to the list.
Definition: Attributes.h:488
llvm::Attribute::getAsString
std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
Definition: Attributes.cpp:363
iterator_range.h
llvm::AttrBuilder::AttrBuilder
AttrBuilder(const Attribute &A)
Definition: Attributes.h:830
llvm::AttributeSet::removeAttribute
LLVM_NODISCARD AttributeSet removeAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute from this set.
Definition: Attributes.cpp:628
llvm::AttrBuilder::getPreallocatedType
Type * getPreallocatedType() const
Retrieve the preallocated type.
Definition: Attributes.h:921
llvm::AttrBuilder::td_empty
bool td_empty() const
Definition: Attributes.h:1024
llvm::DenseMapInfo< AttributeSet >::getEmptyKey
static AttributeSet getEmptyKey()
Definition: Attributes.h:370
llvm::AttributeSet::getNumAttributes
unsigned getNumAttributes() const
Return the number of attributes in this set.
Definition: Attributes.cpp:655
llvm::AttributeList::getVScaleRangeArgs
std::pair< unsigned, unsigned > getVScaleRangeArgs(unsigned Index) const
Get the vscale_range argument numbers (or pair(0, 0) if unknown).
Definition: Attributes.cpp:1481
llvm::AttributeList::operator==
bool operator==(const AttributeList &RHS) const
operator==/!= - Provide equality predicates.
Definition: Attributes.h:766
llvm::AttributeList::AttrIndex
AttrIndex
Definition: Attributes.h:400
llvm::wrap
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:251
llvm::AttrBuilder::addStackAlignmentAttr
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:956
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::AttributeSet::~AttributeSet
~AttributeSet()=default
const_iterator
llvm::AttributeSet::dump
void dump() const
Definition: Attributes.cpp:746
A
* A
Definition: README_ALTIVEC.txt:89
llvm::Attribute::getDereferenceableOrNullBytes
uint64_t getDereferenceableOrNullBytes() const
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.
Definition: Attributes.cpp:344
llvm::AttributeList::getParamByRefType
Type * getParamByRefType(unsigned ArgNo) const
Return the byref type for the specified function parameter.
Definition: Attributes.cpp:1447
llvm::FoldingSetNodeID
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:313
llvm::AttributeList::addVScaleRangeAttr
LLVM_NODISCARD AttributeList addVScaleRangeAttr(LLVMContext &C, unsigned Index, unsigned MinValue, unsigned MaxValue)
Add the vscale_range attribute to the attribute set at the given index.
Definition: Attributes.cpp:1363
llvm::AttributeSetNode
Definition: AttributeImpl.h:212
llvm::AttrBuilder::addAllocSizeAttrFromRawRepr
AttrBuilder & addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr)
Add an allocsize attribute, using the representation returned by Attribute.getIntValue().
Definition: Attributes.cpp:1700
llvm::AttributeSet::getAllocSizeArgs
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
Definition: Attributes.cpp:715
llvm::Attribute::getWithDereferenceableOrNullBytes
static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context, uint64_t Bytes)
Definition: Attributes.cpp:182
LLVMAttributeRef
struct LLVMOpaqueAttributeRef * LLVMAttributeRef
Used to represent an attributes.
Definition: Types.h:143
llvm::AttrBuilder::addStructRetAttr
AttrBuilder & addStructRetAttr(Type *Ty)
This turns a sret type into the form used internally in Attribute.
Definition: Attributes.cpp:1746
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:206
llvm::AttributeList::getParamDereferenceableOrNullBytes
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg.
Definition: Attributes.h:733
llvm::Attribute::getWithAlignment
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
Definition: Attributes.cpp:166
llvm::Attribute::getDereferenceableBytes
uint64_t getDereferenceableBytes() const
Returns the number of dereferenceable bytes from the dereferenceable attribute.
Definition: Attributes.cpp:337
llvm::Attribute::hasParentContext
bool hasParentContext(LLVMContext &C) const
Return true if this attribute belongs to the LLVMContext.
Definition: Attributes.cpp:469
Alignment.h
llvm::AttributeSet::getPreallocatedType
Type * getPreallocatedType() const
Definition: Attributes.cpp:703
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::AttrBuilder::remove
AttrBuilder & remove(const AttrBuilder &B)
Remove the attributes from the builder.
Definition: Attributes.cpp:1794
llvm::AttributeSet::getByRefType
Type * getByRefType() const
Definition: Attributes.cpp:691
llvm::Attribute::isExistingAttribute
static bool isExistingAttribute(StringRef Name)
Return true if the provided string matches the IR name of an attribute.
Definition: Attributes.cpp:245
llvm::Attribute::Attribute
Attribute()=default
llvm::AttributeSet::getByValType
Type * getByValType() const
Definition: Attributes.cpp:695
llvm::AttributeList::hasParamAttr
bool hasParamAttr(unsigned ArgNo, StringRef Kind) const
Return true if the attribute exists for the given argument.
Definition: Attributes.h:646
llvm::AttributeList::getAttribute
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
Definition: Attributes.cpp:1418
llvm::AttributeList::getParamStructRetType
Type * getParamStructRetType(unsigned ArgNo) const
Return the sret type for the specified function parameter.
Definition: Attributes.cpp:1443
llvm::AttrBuilder::td_attrs
td_const_range td_attrs() const
Definition: Attributes.h:1020
llvm::Attribute::getValueAsType
Type * getValueAsType() const
Return the attribute's value as a Type.
Definition: Attributes.cpp:308
llvm::AttributeList::removeAttribute
LLVM_NODISCARD AttributeList removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
Definition: Attributes.cpp:1289
LLVM_NODISCARD
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
Definition: Compiler.h:161
llvm::AttributeList::getNumAttrSets
unsigned getNumAttrSets() const
Definition: Attributes.cpp:1516
llvm::AttributeSet::begin
iterator begin() const
Definition: Attributes.cpp:737
llvm::AttributeSet::getElementType
Type * getElementType() const
Definition: Attributes.cpp:711
llvm::AttrBuilder::td_begin
td_const_iterator td_begin() const
Definition: Attributes.h:1015
llvm::Attribute::NumTypeAttrKinds
static const unsigned NumTypeAttrKinds
Definition: Attributes.h:81
llvm::AttrBuilder::addDereferenceableAttr
AttrBuilder & addDereferenceableAttr(uint64_t Bytes)
This turns the number of dereferenceable bytes into the form used internally in Attribute.
Definition: Attributes.cpp:1678
llvm::AttributeList::getDereferenceableOrNullBytes
uint64_t getDereferenceableOrNullBytes(unsigned Index) const
Get the number of dereferenceable_or_null bytes (or zero if unknown).
Definition: Attributes.cpp:1471
llvm::Attribute::getWithByRefType
static Attribute getWithByRefType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:196
llvm::AttributeList::FunctionIndex
@ FunctionIndex
Definition: Attributes.h:402
llvm::Attribute::getNameFromAttrKind
static StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind)
Definition: Attributes.cpp:231
llvm::AttrBuilder::addAttribute
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
Definition: Attributes.h:840
llvm::AttributeList::getRetAttributes
AttributeSet getRetAttributes() const
The attributes for the ret value are returned.
Definition: Attributes.cpp:1379
llvm::AttributeFuncs::areInlineCompatible
bool areInlineCompatible(const Function &Caller, const Function &Callee)
Definition: Attributes.cpp:2093
llvm::AttributeSet
Definition: Attributes.h:266
llvm::AttributeSet::getAttribute
Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
Definition: Attributes.cpp:667
llvm::AttributeList::operator!=
bool operator!=(const AttributeList &RHS) const
Definition: Attributes.h:767
llvm::AttributeList::addDereferenceableOrNullParamAttr
LLVM_NODISCARD 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.
Definition: Attributes.h:588
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::AttributeList::hasParamAttrs
bool hasParamAttrs(unsigned ArgNo) const
Return true if attributes exists for the given argument.
Definition: Attributes.h:651
llvm::Attribute::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Attributes.cpp:484
llvm::AttributeSet::getStackAlignment
MaybeAlign getStackAlignment() const
Definition: Attributes.cpp:679
llvm::Attribute::isIntAttribute
bool isIntAttribute() const
Return true if the attribute is an integer attribute.
Definition: Attributes.cpp:261
llvm::AttributeSet::getStructRetType
Type * getStructRetType() const
Definition: Attributes.cpp:699
llvm::AttrBuilder::addVScaleRangeAttr
AttrBuilder & addVScaleRangeAttr(unsigned MinValue, unsigned MaxValue)
This turns two ints into the form used internally in Attribute.
Definition: Attributes.cpp:1711
llvm::AttributeFuncs::mergeAttributesForInlining
void mergeAttributesForInlining(Function &Caller, const Function &Callee)
Merge caller's and callee's attributes.
Definition: Attributes.cpp:2103
llvm::AttributeSet::getAlignment
MaybeAlign getAlignment() const
Definition: Attributes.cpp:675
llvm::AttributeList::hasParamAttr
bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return true if the attribute exists for the given argument.
Definition: Attributes.h:641
llvm::Attribute::getWithByValType
static Attribute getWithByValType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:188
llvm::AttrBuilder::getInAllocaType
Type * getInAllocaType() const
Retrieve the inalloca type.
Definition: Attributes.h:926
llvm::AttributeList::addDereferenceableParamAttr
LLVM_NODISCARD AttributeList addDereferenceableParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given arg index.
Definition: Attributes.h:575
llvm::AttrBuilder::getAllocSizeArgs
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
Retrieve the allocsize args, if the allocsize attribute exists.
Definition: Attributes.cpp:1647
llvm::AttributeList::hasAttributes
bool hasAttributes(unsigned Index) const
Return true if attribute exists at the given index.
Definition: Attributes.cpp:1396
llvm::AttributeList::getParamDereferenceableBytes
uint64_t getParamDereferenceableBytes(unsigned ArgNo) const
Get the number of dereferenceable bytes (or zero if unknown) of an arg.
Definition: Attributes.h:723
llvm::DenseMapInfo< AttributeSet >::getTombstoneKey
static AttributeSet getTombstoneKey()
Definition: Attributes.h:376
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::AttrBuilder::td_begin
td_iterator td_begin()
Definition: Attributes.h:1012
llvm::AttributeList::FirstArgIndex
@ FirstArgIndex
Definition: Attributes.h:403
llvm::AttributeList::getParamAttr
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return the attribute object that exists at the arg index.
Definition: Attributes.h:679
llvm::Attribute::operator<
bool operator<(Attribute A) const
Less-than operator. Useful for sorting the attributes list.
Definition: Attributes.cpp:477
llvm::AttributeList::isEmpty
bool isEmpty() const
Return true if there are no attributes.
Definition: Attributes.h:775
llvm::AttributeList::getParamAttr
Attribute getParamAttr(unsigned ArgNo, StringRef Kind) const
Return the attribute object that exists at the given index.
Definition: Attributes.h:684
llvm::Attribute::fromRawPointer
static Attribute fromRawPointer(void *RawPtr)
Get an attribute from a raw pointer created by getRawPointer.
Definition: Attributes.h:245
llvm::codeview::PublicSymFlags::Function
@ Function
llvm::Attribute::canUseAsRetAttr
static bool canUseAsRetAttr(AttrKind Kind)
Definition: Attributes.cpp:513
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
llvm::Attribute::getAllocSizeArgs
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
Returns the argument numbers for the allocsize attribute (or pair(0, 0) if not known).
Definition: Attributes.cpp:351
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38
llvm::DenseMapInfo< AttributeList >::getHashValue
static unsigned getHashValue(AttributeList AS)
Definition: Attributes.h:798
llvm::AttrBuilder::td_attrs
td_range td_attrs()
Definition: Attributes.h:1018
llvm::DenseMapInfo< AttributeList >::getTombstoneKey
static AttributeList getTombstoneKey()
Definition: Attributes.h:792