15#ifndef LLVM_IR_ATTRIBUTES_H 
   16#define LLVM_IR_ATTRIBUTES_H 
   22#include "llvm/Config/llvm-config.h" 
   92    #include "llvm/IR/Attributes.inc" 
 
  102    return Kind >= FirstEnumAttr && Kind <= LastEnumAttr;
 
 
  105    return Kind >= FirstIntAttr && Kind <= LastIntAttr;
 
 
  108    return Kind >= FirstTypeAttr && Kind <= LastTypeAttr;
 
 
  111    return Kind >= FirstConstantRangeAttr && Kind <= LastConstantRangeAttr;
 
 
  114    return Kind >= FirstConstantRangeListAttr &&
 
  115           Kind <= LastConstantRangeListAttr;
 
 
  162                       const std::optional<unsigned> &NumElemsArg);
 
  284  LLVM_ABI std::pair<unsigned, std::optional<unsigned>>
 
 
  362  friend AttributeListImpl;
 
  384  bool operator==(
const AttributeSet &O)
 const { 
return SetNode == O.SetNode; }
 
  385  bool operator!=(
const AttributeSet &O)
 const { 
return !(*
this == O); }
 
  424  [[nodiscard]] 
LLVM_ABI std::optional<AttributeSet>
 
  455  LLVM_ABI std::optional<std::pair<unsigned, std::optional<unsigned>>>
 
  473#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 
 
  483    auto Val = 
static_cast<uintptr_t
>(-1);
 
  484    Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;
 
 
  489    auto Val = 
static_cast<uintptr_t
>(-2);
 
  490    Val <<= PointerLikeTypeTraits<void *>::NumLowBitsAvailable;
 
 
  495    return (
unsigned((uintptr_t)AS.SetNode) >> 4) ^
 
  496           (
unsigned((uintptr_t)AS.SetNode) >> 9);
 
 
 
  512  enum AttrIndex : 
unsigned {
 
  519  friend class AttrBuilder;
 
  520  friend class AttributeListImpl;
 
  521  friend class AttributeSet;
 
  522  friend class AttributeSetNode;
 
  523  template <
typename Ty, 
typename Enable> 
friend struct DenseMapInfo;
 
  527  AttributeListImpl *pImpl = 
nullptr;
 
  532  get(LLVMContext &
C, ArrayRef<std::pair<unsigned, Attribute>> Attrs);
 
  534  get(LLVMContext &
C, ArrayRef<std::pair<unsigned, AttributeSet>> Attrs);
 
  538  LLVM_ABI static AttributeList 
get(LLVMContext &
C, AttributeSet FnAttrs,
 
  539                                    AttributeSet RetAttrs,
 
  540                                    ArrayRef<AttributeSet> ArgAttrs);
 
  543  explicit AttributeList(AttributeListImpl *LI) : pImpl(LI) {}
 
  545  static AttributeList getImpl(LLVMContext &
C, ArrayRef<AttributeSet> AttrSets);
 
  547  AttributeList setAttributesAtIndex(LLVMContext &
C, 
unsigned Index,
 
  548                                     AttributeSet Attrs) 
const;
 
  551  AttributeList() = 
default;
 
  559                                    ArrayRef<AttributeList> Attrs);
 
  560  LLVM_ABI static AttributeList 
get(LLVMContext &
C, 
unsigned Index,
 
  561                                    ArrayRef<Attribute::AttrKind> Kinds);
 
  562  LLVM_ABI static AttributeList 
get(LLVMContext &
C, 
unsigned Index,
 
  563                                    ArrayRef<Attribute::AttrKind> Kinds,
 
  564                                    ArrayRef<uint64_t> Values);
 
  565  LLVM_ABI static AttributeList 
get(LLVMContext &
C, 
unsigned Index,
 
  566                                    ArrayRef<StringRef> Kind);
 
  567  LLVM_ABI static AttributeList 
get(LLVMContext &
C, 
unsigned Index,
 
  569  LLVM_ABI static AttributeList 
get(LLVMContext &
C, 
unsigned Index,
 
  570                                    const AttrBuilder &
B);
 
  575  [[nodiscard]] 
LLVM_ABI AttributeList addAttributeAtIndex(
 
  576      LLVMContext &
C, 
unsigned Index, Attribute::AttrKind Kind) 
const;
 
  580  [[nodiscard]] 
LLVM_ABI AttributeList
 
  581  addAttributeAtIndex(LLVMContext &
C, 
unsigned Index, StringRef Kind,
 
  582                      StringRef 
Value = StringRef()) 
const;
 
  586  [[nodiscard]] 
LLVM_ABI AttributeList addAttributeAtIndex(LLVMContext &
C,
 
  592  [[nodiscard]] 
LLVM_ABI AttributeList addAttributesAtIndex(
 
  593      LLVMContext &
C, 
unsigned Index, 
const AttrBuilder &
B) 
const;
 
  597  [[nodiscard]] AttributeList addFnAttribute(LLVMContext &
C,
 
  598                                             Attribute::AttrKind Kind)
 const {
 
  599    return addAttributeAtIndex(
C, FunctionIndex, Kind);
 
  604  [[nodiscard]] AttributeList addFnAttribute(LLVMContext &
C,
 
  605                                             Attribute Attr)
 const {
 
  606    return addAttributeAtIndex(
C, FunctionIndex, Attr);
 
  611  [[nodiscard]] AttributeList
 
  612  addFnAttribute(LLVMContext &
C, StringRef Kind,
 
  613                 StringRef 
Value = StringRef())
 const {
 
  614    return addAttributeAtIndex(
C, FunctionIndex, Kind, 
Value);
 
  619  [[nodiscard]] AttributeList addFnAttributes(LLVMContext &
C,
 
  620                                              const AttrBuilder &
B)
 const {
 
  621    return addAttributesAtIndex(
C, FunctionIndex, 
B);
 
  626  [[nodiscard]] AttributeList addRetAttribute(LLVMContext &
C,
 
  627                                              Attribute::AttrKind Kind)
 const {
 
  628    return addAttributeAtIndex(
C, ReturnIndex, Kind);
 
  633  [[nodiscard]] AttributeList addRetAttribute(LLVMContext &
C,
 
  634                                              Attribute Attr)
 const {
 
  635    return addAttributeAtIndex(
C, ReturnIndex, Attr);
 
  640  [[nodiscard]] AttributeList addRetAttributes(LLVMContext &
C,
 
  641                                               const AttrBuilder &
B)
 const {
 
  642    return addAttributesAtIndex(
C, ReturnIndex, 
B);
 
  647  [[nodiscard]] AttributeList
 
  648  addParamAttribute(LLVMContext &
C, 
unsigned ArgNo,
 
  649                    Attribute::AttrKind Kind)
 const {
 
  650    return addAttributeAtIndex(
C, ArgNo + FirstArgIndex, Kind);
 
  655  [[nodiscard]] AttributeList
 
  656  addParamAttribute(LLVMContext &
C, 
unsigned ArgNo, StringRef Kind,
 
  657                    StringRef 
Value = StringRef())
 const {
 
  658    return addAttributeAtIndex(
C, ArgNo + FirstArgIndex, Kind, 
Value);
 
  663  [[nodiscard]] 
LLVM_ABI AttributeList addParamAttribute(
 
  664      LLVMContext &
C, ArrayRef<unsigned> ArgNos, Attribute 
A) 
const;
 
  668  [[nodiscard]] AttributeList addParamAttributes(LLVMContext &
C, 
unsigned ArgNo,
 
  669                                                 const AttrBuilder &
B)
 const {
 
  670    return addAttributesAtIndex(
C, ArgNo + FirstArgIndex, 
B);
 
  675  [[nodiscard]] 
LLVM_ABI AttributeList removeAttributeAtIndex(
 
  676      LLVMContext &
C, 
unsigned Index, Attribute::AttrKind Kind) 
const;
 
  680  [[nodiscard]] 
LLVM_ABI AttributeList
 
  681  removeAttributeAtIndex(LLVMContext &
C, 
unsigned Index, StringRef Kind) 
const;
 
  682  [[nodiscard]] AttributeList removeAttribute(LLVMContext &
C, 
unsigned Index,
 
  683                                              StringRef Kind)
 const {
 
  684    return removeAttributeAtIndex(
C, Index, Kind);
 
  689  [[nodiscard]] 
LLVM_ABI AttributeList removeAttributesAtIndex(
 
  690      LLVMContext &
C, 
unsigned Index, 
const AttributeMask &AttrsToRemove) 
const;
 
  694  [[nodiscard]] 
LLVM_ABI AttributeList
 
  695  removeAttributesAtIndex(LLVMContext &
C, 
unsigned Index) 
const;
 
  699  [[nodiscard]] AttributeList
 
  700  removeFnAttribute(LLVMContext &
C, Attribute::AttrKind Kind)
 const {
 
  701    return removeAttributeAtIndex(
C, FunctionIndex, Kind);
 
  706  [[nodiscard]] AttributeList removeFnAttribute(LLVMContext &
C,
 
  707                                                StringRef Kind)
 const {
 
  708    return removeAttributeAtIndex(
C, FunctionIndex, Kind);
 
  713  [[nodiscard]] AttributeList
 
  714  removeFnAttributes(LLVMContext &
C, 
const AttributeMask &AttrsToRemove)
 const {
 
  715    return removeAttributesAtIndex(
C, FunctionIndex, AttrsToRemove);
 
  720  [[nodiscard]] AttributeList removeFnAttributes(LLVMContext &
C)
 const {
 
  721    return removeAttributesAtIndex(
C, FunctionIndex);
 
  726  [[nodiscard]] AttributeList
 
  727  removeRetAttribute(LLVMContext &
C, Attribute::AttrKind Kind)
 const {
 
  728    return removeAttributeAtIndex(
C, ReturnIndex, Kind);
 
  733  [[nodiscard]] AttributeList removeRetAttribute(LLVMContext &
C,
 
  734                                                 StringRef Kind)
 const {
 
  735    return removeAttributeAtIndex(
C, ReturnIndex, Kind);
 
  740  [[nodiscard]] AttributeList
 
  741  removeRetAttributes(LLVMContext &
C,
 
  742                      const AttributeMask &AttrsToRemove)
 const {
 
  743    return removeAttributesAtIndex(
C, ReturnIndex, AttrsToRemove);
 
  748  [[nodiscard]] AttributeList
 
  749  removeParamAttribute(LLVMContext &
C, 
unsigned ArgNo,
 
  750                       Attribute::AttrKind Kind)
 const {
 
  751    return removeAttributeAtIndex(
C, ArgNo + FirstArgIndex, Kind);
 
  756  [[nodiscard]] AttributeList
 
  757  removeParamAttribute(LLVMContext &
C, 
unsigned ArgNo, StringRef Kind)
 const {
 
  758    return removeAttributeAtIndex(
C, ArgNo + FirstArgIndex, Kind);
 
  763  [[nodiscard]] AttributeList
 
  764  removeParamAttributes(LLVMContext &
C, 
unsigned ArgNo,
 
  765                        const AttributeMask &AttrsToRemove)
 const {
 
  766    return removeAttributesAtIndex(
C, ArgNo + FirstArgIndex, AttrsToRemove);
 
  771  [[nodiscard]] AttributeList removeParamAttributes(LLVMContext &
C,
 
  772                                                    unsigned ArgNo)
 const {
 
  773    return removeAttributesAtIndex(
C, ArgNo + FirstArgIndex);
 
  778  [[nodiscard]] AttributeList
 
  779  replaceAttributeTypeAtIndex(LLVMContext &
C, 
unsigned ArgNo,
 
  780                              Attribute::AttrKind Kind,
 
  781                              Type *ReplacementTy)
 const {
 
  782    Attribute Attr = getAttributeAtIndex(ArgNo, Kind);
 
  783    auto Attrs = removeAttributeAtIndex(
C, ArgNo, Kind);
 
  784    return Attrs.addAttributeAtIndex(
C, ArgNo,
 
  785                                     Attr.getWithNewType(
C, ReplacementTy));
 
  790  [[nodiscard]] 
LLVM_ABI AttributeList
 
  791  addDereferenceableRetAttr(LLVMContext &
C, uint64_t Bytes) 
const;
 
  795  [[nodiscard]] 
LLVM_ABI AttributeList addDereferenceableParamAttr(
 
  796      LLVMContext &
C, 
unsigned ArgNo, uint64_t Bytes) 
const;
 
  801  [[nodiscard]] 
LLVM_ABI AttributeList addDereferenceableOrNullParamAttr(
 
  802      LLVMContext &
C, 
unsigned ArgNo, uint64_t Bytes) 
const;
 
  806  [[nodiscard]] 
LLVM_ABI AttributeList
 
  811  [[nodiscard]] 
LLVM_ABI AttributeList
 
  812  addAllocSizeParamAttr(LLVMContext &
C, 
unsigned ArgNo, 
unsigned ElemSizeArg,
 
  813                        const std::optional<unsigned> &NumElemsArg) 
const;
 
  818  [[nodiscard]] 
LLVM_ABI std::optional<AttributeList>
 
  819  intersectWith(LLVMContext &
C, AttributeList Other) 
const;
 
  830  LLVM_ABI AttributeSet getParamAttrs(
unsigned ArgNo) 
const;
 
  833  LLVM_ABI AttributeSet getRetAttrs() 
const;
 
  836  LLVM_ABI AttributeSet getFnAttrs() 
const;
 
  839  LLVM_ABI bool hasAttributeAtIndex(
unsigned Index,
 
  840                                    Attribute::AttrKind Kind) 
const;
 
  843  LLVM_ABI bool hasAttributeAtIndex(
unsigned Index, StringRef Kind) 
const;
 
  846  LLVM_ABI bool hasAttributesAtIndex(
unsigned Index) 
const;
 
  849  bool hasParamAttr(
unsigned ArgNo, Attribute::AttrKind Kind)
 const {
 
  850    return hasAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
 
  854  bool hasParamAttr(
unsigned ArgNo, StringRef Kind)
 const {
 
  855    return hasAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
 
  859  bool hasParamAttrs(
unsigned ArgNo)
 const {
 
  860    return hasAttributesAtIndex(ArgNo + FirstArgIndex);
 
  864  bool hasRetAttr(Attribute::AttrKind Kind)
 const {
 
  865    return hasAttributeAtIndex(ReturnIndex, Kind);
 
  869  bool hasRetAttr(StringRef Kind)
 const {
 
  870    return hasAttributeAtIndex(ReturnIndex, Kind);
 
  874  bool hasRetAttrs()
 const { 
return hasAttributesAtIndex(ReturnIndex); }
 
  877  LLVM_ABI bool hasFnAttr(Attribute::AttrKind Kind) 
const;
 
  880  LLVM_ABI bool hasFnAttr(StringRef Kind) 
const;
 
  883  bool hasFnAttrs()
 const { 
return hasAttributesAtIndex(FunctionIndex); }
 
  888  LLVM_ABI bool hasAttrSomewhere(Attribute::AttrKind Kind,
 
  889                                 unsigned *Index = 
nullptr) 
const;
 
  893                                         Attribute::AttrKind Kind) 
const;
 
  899  Attribute getParamAttr(
unsigned ArgNo, Attribute::AttrKind Kind)
 const {
 
  900    return getAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
 
  904  Attribute getParamAttr(
unsigned ArgNo, StringRef Kind)
 const {
 
  905    return getAttributeAtIndex(ArgNo + FirstArgIndex, Kind);
 
  909  Attribute getFnAttr(Attribute::AttrKind Kind)
 const {
 
  910    return getAttributeAtIndex(FunctionIndex, Kind);
 
  914  Attribute getFnAttr(StringRef Kind)
 const {
 
  915    return getAttributeAtIndex(FunctionIndex, Kind);
 
  919  Attribute getRetAttr(Attribute::AttrKind Kind)
 const {
 
  920    return getAttributeAtIndex(ReturnIndex, Kind);
 
  924  LLVM_ABI MaybeAlign getRetAlignment() 
const;
 
  927  LLVM_ABI MaybeAlign getParamAlignment(
unsigned ArgNo) 
const;
 
  930  LLVM_ABI MaybeAlign getParamStackAlignment(
unsigned ArgNo) 
const;
 
  936  LLVM_ABI Type *getParamStructRetType(
unsigned ArgNo) 
const;
 
  942  LLVM_ABI Type *getParamPreallocatedType(
unsigned ArgNo) 
const;
 
  945  LLVM_ABI Type *getParamInAllocaType(
unsigned ArgNo) 
const;
 
  948  LLVM_ABI Type *getParamElementType(
unsigned ArgNo) 
const;
 
  954  LLVM_ABI MaybeAlign getRetStackAlignment() 
const;
 
  958  LLVM_ABI uint64_t getRetDereferenceableBytes() 
const;
 
  961  LLVM_ABI uint64_t getParamDereferenceableBytes(
unsigned Index) 
const;
 
  965  LLVM_ABI uint64_t getRetDereferenceableOrNullBytes() 
const;
 
  969  LLVM_ABI uint64_t getParamDereferenceableOrNullBytes(
unsigned ArgNo) 
const;
 
  972  LLVM_ABI std::optional<ConstantRange> getParamRange(
unsigned ArgNo) 
const;
 
  989  LLVM_ABI std::string getAsString(
unsigned Index,
 
  990                                   bool InAttrGrp = 
false) 
const;
 
  993  LLVM_ABI bool hasParentContext(LLVMContext &
C) 
const;
 
  999  using iterator = 
const AttributeSet *;
 
 1004  LLVM_ABI unsigned getNumAttrSets() 
const;
 
 1009  struct index_iterator {
 
 1010    unsigned NumAttrSets;
 
 1011    index_iterator(
int NumAttrSets) : NumAttrSets(NumAttrSets) {}
 
 1012    struct int_wrapper {
 
 1013      int_wrapper(
unsigned i) : i(i) {}
 
 1017      int_wrapper &operator++() {
 
 1025    int_wrapper 
begin() { 
return int_wrapper(AttributeList::FunctionIndex); }
 
 1027    int_wrapper 
end() { 
return int_wrapper(NumAttrSets - 1); }
 
 1031  index_iterator indexes()
 const { 
return index_iterator(getNumAttrSets()); }
 
 1034  bool operator==(
const AttributeList &
RHS)
 const { 
return pImpl == 
RHS.pImpl; }
 
 1035  bool operator!=(
const AttributeList &
RHS)
 const { 
return pImpl != 
RHS.pImpl; }
 
 1038  void *getRawPointer()
 const {
 
 1043  bool isEmpty()
 const { 
return pImpl == 
nullptr; }
 
 1054  static AttributeList getEmptyKey() {
 
 1055    auto Val = 
static_cast<uintptr_t
>(-1);
 
 1056    Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
 
 1057    return AttributeList(
reinterpret_cast<AttributeListImpl *
>(Val));
 
 1060  static AttributeList getTombstoneKey() {
 
 1061    auto Val = 
static_cast<uintptr_t
>(-2);
 
 1062    Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
 
 1063    return AttributeList(
reinterpret_cast<AttributeListImpl *
>(Val));
 
 1066  static unsigned getHashValue(AttributeList AS) {
 
 1067    return (
unsigned((uintptr_t)AS.pImpl) >> 4) ^
 
 1068           (unsigned((uintptr_t)AS.pImpl) >> 9);
 
 1084  SmallVector<Attribute, 8> 
Attrs;
 
 1087  AttrBuilder(LLVMContext &Ctx) : Ctx(Ctx) {}
 
 1088  AttrBuilder(
const AttrBuilder &) = 
delete;
 
 1089  AttrBuilder(AttrBuilder &&) = 
default;
 
 1091  AttrBuilder(LLVMContext &Ctx, 
const Attribute &
A) : Ctx(Ctx) {
 
 1095  LLVM_ABI AttrBuilder(LLVMContext &Ctx, AttributeSet AS);
 
 1100  LLVM_ABI AttrBuilder &addAttribute(Attribute::AttrKind Val);
 
 1103  LLVM_ABI AttrBuilder &addAttribute(Attribute 
A);
 
 1106  LLVM_ABI AttrBuilder &addAttribute(StringRef 
A, StringRef V = StringRef());
 
 1109  LLVM_ABI AttrBuilder &removeAttribute(Attribute::AttrKind Val);
 
 1112  LLVM_ABI AttrBuilder &removeAttribute(StringRef 
A);
 
 1115  AttrBuilder &removeAttribute(Attribute 
A) {
 
 1116    if (
A.isStringAttribute())
 
 1117      return removeAttribute(
A.getKindAsString());
 
 1119      return removeAttribute(
A.getKindAsEnum());
 
 1131  LLVM_ABI bool overlaps(
const AttributeMask &AM) 
const;
 
 1141  bool hasAttributes()
 const { 
return !
Attrs.empty(); }
 
 1158  getRawIntAttr(Attribute::AttrKind Kind) 
const;
 
 1162    return MaybeAlign(getRawIntAttr(Attribute::Alignment).value_or(0));
 
 1166  MaybeAlign getStackAlignment()
 const {
 
 1167    return MaybeAlign(getRawIntAttr(Attribute::StackAlignment).value_or(0));
 
 1172  uint64_t getDereferenceableBytes()
 const {
 
 1173    return getRawIntAttr(Attribute::Dereferenceable).value_or(0);
 
 1178  uint64_t getDereferenceableOrNullBytes()
 const {
 
 1179    return getRawIntAttr(Attribute::DereferenceableOrNull).value_or(0);
 
 1185    std::optional<uint64_t> Raw = getRawIntAttr(Attribute::NoFPClass);
 
 1190  LLVM_ABI Type *getTypeAttr(Attribute::AttrKind Kind) 
const;
 
 1193  Type *getByValType()
 const { 
return getTypeAttr(Attribute::ByVal); }
 
 1196  Type *getStructRetType()
 const { 
return getTypeAttr(Attribute::StructRet); }
 
 1199  Type *getByRefType()
 const { 
return getTypeAttr(Attribute::ByRef); }
 
 1202  Type *getPreallocatedType()
 const {
 
 1203    return getTypeAttr(Attribute::Preallocated);
 
 1207  Type *getInAllocaType()
 const { 
return getTypeAttr(Attribute::InAlloca); }
 
 1211  LLVM_ABI std::optional<std::pair<unsigned, std::optional<unsigned>>>
 
 1212  getAllocSizeArgs() 
const;
 
 1215  LLVM_ABI AttrBuilder &addRawIntAttr(Attribute::AttrKind Kind, uint64_t 
Value);
 
 1219  LLVM_ABI AttrBuilder &addAlignmentAttr(MaybeAlign Align);
 
 1225  inline AttrBuilder &addAlignmentAttr(
unsigned Align) {
 
 1226    return addAlignmentAttr(MaybeAlign(Align));
 
 1231  LLVM_ABI AttrBuilder &addStackAlignmentAttr(MaybeAlign Align);
 
 1237  inline AttrBuilder &addStackAlignmentAttr(
unsigned Align) {
 
 1238    return addStackAlignmentAttr(MaybeAlign(Align));
 
 1243  LLVM_ABI AttrBuilder &addDereferenceableAttr(uint64_t Bytes);
 
 1247  LLVM_ABI AttrBuilder &addDereferenceableOrNullAttr(uint64_t Bytes);
 
 1251  addAllocSizeAttr(
unsigned ElemSizeArg,
 
 1252                   const std::optional<unsigned> &NumElemsArg);
 
 1255  LLVM_ABI AttrBuilder &addVScaleRangeAttr(
unsigned MinValue,
 
 1256                                           std::optional<unsigned> MaxValue);
 
 1259  LLVM_ABI AttrBuilder &addTypeAttr(Attribute::AttrKind Kind, 
Type *Ty);
 
 1278  LLVM_ABI AttrBuilder &addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr);
 
 1283  addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr);
 
 1287  LLVM_ABI AttrBuilder &addUWTableAttr(UWTableKind Kind);
 
 1290  LLVM_ABI AttrBuilder &addAllocKindAttr(AllocFnKind Kind);
 
 1293  LLVM_ABI AttrBuilder &addMemoryAttr(MemoryEffects ME);
 
 1296  LLVM_ABI AttrBuilder &addCapturesAttr(CaptureInfo CI);
 
 1299  LLVM_ABI AttrBuilder &addNoFPClassAttr(FPClassTest NoFPClassMask);
 
 1302  LLVM_ABI AttrBuilder &addConstantRangeAttr(Attribute::AttrKind Kind,
 
 1303                                             const ConstantRange &CR);
 
 1306  LLVM_ABI AttrBuilder &addRangeAttr(
const ConstantRange &CR);
 
 1309  LLVM_ABI AttrBuilder &addConstantRangeListAttr(Attribute::AttrKind Kind,
 
 1310                                                 ArrayRef<ConstantRange> Val);
 
 1313  LLVM_ABI AttrBuilder &addInitializesAttr(
const ConstantRangeList &CRL);
 
 1318  LLVM_ABI AttrBuilder &addFromEquivalentMetadata(
const Instruction &
I);
 
 1320  ArrayRef<Attribute> attrs()
 const { 
return Attrs; }
 
 1323  bool operator!=(
const AttrBuilder &
B)
 const { 
return !(*
this == 
B); }
 
 1326namespace AttributeFuncs {
 
 1328enum AttributeSafetyKind : uint8_t {
 
 1329  ASK_SAFE_TO_DROP = 1,
 
 1330  ASK_UNSAFE_TO_DROP = 2,
 
 1331  ASK_ALL = ASK_SAFE_TO_DROP | ASK_UNSAFE_TO_DROP,
 
 1348                                        AttributeSafetyKind ASK = ASK_ALL);
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
 
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
 
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
 
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
 
static std::optional< ConstantRange > getRange(Value *V, const InstrInfoQuery &IIQ)
Helper method to get range from metadata or attribute.
 
static LoopDeletionResult merge(LoopDeletionResult A, LoopDeletionResult B)
 
static Align getFnStackAlignment(const TargetSubtargetInfo &STI, const Function &F)
 
bool operator==(const MergedFunctionsInfo &LHS, const MergedFunctionsInfo &RHS)
 
II addRangeRetAttr(Range)
 
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
 
static uint32_t getAlignment(const MCSectionCOFF &Sec)
 
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
 
This class represents a single, uniqued attribute.
 
This class represents a set of attributes that apply to the function, return type,...
 
This class stores enough information to efficiently remove some attributes from an existing AttrBuild...
 
This class represents a group of attributes that apply to one element: function, return type,...
 
This class holds the attributes for a particular argument, parameter, function, or return value.
 
LLVM_ABI AllocFnKind getAllocKind() const
 
bool hasAttributes() const
Return true if attributes exists in this set.
 
const Attribute * iterator
 
LLVM_ABI AttributeSet removeAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute from this set.
 
LLVM_ABI Type * getInAllocaType() const
 
LLVM_ABI Type * getByValType() const
 
bool operator!=(const AttributeSet &O) const
 
LLVM_ABI AttributeSet addAttributes(LLVMContext &C, AttributeSet AS) const
Add attributes to the attribute set.
 
LLVM_ABI MemoryEffects getMemoryEffects() const
 
LLVM_ABI bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
 
bool operator==(const AttributeSet &O) const
 
LLVM_ABI std::optional< AttributeSet > intersectWith(LLVMContext &C, AttributeSet Other) const
Try to intersect this AttributeSet with Other.
 
LLVM_ABI Type * getStructRetType() const
 
LLVM_ABI std::string getAsString(bool InAttrGrp=false) const
 
LLVM_ABI unsigned getVScaleRangeMin() const
 
LLVM_ABI std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
 
LLVM_ABI UWTableKind getUWTableKind() const
 
LLVM_ABI bool hasParentContext(LLVMContext &C) const
Return true if this attribute set belongs to the LLVMContext.
 
LLVM_ABI iterator begin() const
 
LLVM_ABI iterator end() const
 
LLVM_ABI AttributeSet removeAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attributes from this set.
 
LLVM_ABI std::optional< unsigned > getVScaleRangeMax() const
 
LLVM_ABI MaybeAlign getStackAlignment() const
 
LLVM_ABI Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
 
LLVM_ABI Type * getPreallocatedType() const
 
LLVM_ABI uint64_t getDereferenceableBytes() const
 
LLVM_ABI MaybeAlign getAlignment() const
 
LLVM_ABI FPClassTest getNoFPClass() const
 
friend struct DenseMapInfo
 
AttributeSet(const AttributeSet &)=default
 
LLVM_ABI Type * getElementType() const
 
LLVM_ABI Type * getByRefType() const
 
LLVM_ABI CaptureInfo getCaptureInfo() const
 
AttributeSet()=default
AttributeSet is a trivially copyable value type.
 
static LLVM_ABI AttributeSet get(LLVMContext &C, const AttrBuilder &B)
 
LLVM_ABI uint64_t getDereferenceableOrNullBytes() const
 
LLVM_ABI unsigned getNumAttributes() const
Return the number of attributes in this set.
 
LLVM_ABI AttributeSet addAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add an argument attribute.
 
Functions, function parameters, and return types can have attributes to indicate how they should be t...
 
static const unsigned NumTypeAttrKinds
 
LLVM_ABI bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
 
static LLVM_ABI Attribute getWithStructRetType(LLVMContext &Context, Type *Ty)
 
bool operator==(Attribute A) const
Equality and non-equality operators.
 
static LLVM_ABI Attribute::AttrKind getAttrKindFromName(StringRef AttrName)
 
LLVM_ABI bool isEnumAttribute() const
Return true if the attribute is an Attribute::AttrKind type.
 
static LLVM_ABI Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment)
 
LLVM_ABI const ConstantRange & getRange() const
Returns the value of the range attribute.
 
static LLVM_ABI bool intersectWithCustom(AttrKind Kind)
 
LLVM_ABI bool isIntAttribute() const
Return true if the attribute is an integer attribute.
 
static LLVM_ABI Attribute getWithByRefType(LLVMContext &Context, Type *Ty)
 
LLVM_ABI std::optional< unsigned > getVScaleRangeMax() const
Returns the maximum value for the vscale_range attribute or std::nullopt when unknown.
 
LLVM_ABI uint64_t getValueAsInt() const
Return the attribute's value as an integer.
 
LLVM_ABI unsigned getVScaleRangeMin() const
Returns the minimum value for the vscale_range attribute.
 
LLVM_ABI AllocFnKind getAllocKind() const
 
LLVM_ABI bool isConstantRangeAttribute() const
Return true if the attribute is a ConstantRange attribute.
 
static LLVM_ABI Attribute getWithAllocKind(LLVMContext &Context, AllocFnKind Kind)
 
LLVM_ABI StringRef getKindAsString() const
Return the attribute's kind as a string.
 
static LLVM_ABI Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty)
 
static LLVM_ABI bool intersectWithMin(AttrKind Kind)
 
static LLVM_ABI Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
 
static LLVM_ABI bool canUseAsRetAttr(AttrKind Kind)
 
static bool isTypeAttrKind(AttrKind Kind)
 
LLVM_ABI std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
 
LLVM_ABI uint64_t getDereferenceableOrNullBytes() const
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.
 
static LLVM_ABI Attribute getWithDereferenceableBytes(LLVMContext &Context, uint64_t Bytes)
 
LLVM_ABI std::pair< unsigned, std::optional< unsigned > > getAllocSizeArgs() const
Returns the argument numbers for the allocsize attribute.
 
static LLVM_ABI Attribute getWithUWTableKind(LLVMContext &Context, UWTableKind Kind)
 
bool operator!=(Attribute A) const
 
LLVM_ABI FPClassTest getNoFPClass() const
Return the FPClassTest for nofpclass.
 
static LLVM_ABI Attribute getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
 
LLVM_ABI Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
 
LLVM_ABI bool getValueAsBool() const
Return the attribute's value as a boolean.
 
LLVM_ABI ArrayRef< ConstantRange > getInitializes() const
Returns the value of the initializes attribute.
 
LLVM_ABI const ConstantRange & getValueAsConstantRange() const
Return the attribute's value as a ConstantRange.
 
LLVM_ABI uint64_t getDereferenceableBytes() const
Returns the number of dereferenceable bytes from the dereferenceable attribute.
 
static LLVM_ABI Attribute getWithVScaleRangeArgs(LLVMContext &Context, unsigned MinValue, unsigned MaxValue)
 
LLVM_ABI MemoryEffects getMemoryEffects() const
Returns memory effects.
 
LLVM_ABI UWTableKind getUWTableKind() const
 
static LLVM_ABI Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context, uint64_t Bytes)
 
LLVM_ABI ArrayRef< ConstantRange > getValueAsConstantRangeList() const
Return the attribute's value as a ConstantRange array.
 
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
 
static LLVM_ABI bool isExistingAttribute(StringRef Name)
Return true if the provided string matches the IR name of an attribute.
 
bool hasKindAsEnum() const
Returns true if the attribute's kind can be represented as an enum (Enum, Integer,...
 
static LLVM_ABI StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind)
 
static LLVM_ABI bool canUseAsFnAttr(AttrKind Kind)
 
static LLVM_ABI bool intersectWithAnd(AttrKind Kind)
 
static LLVM_ABI Attribute getWithNoFPClass(LLVMContext &Context, FPClassTest Mask)
 
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
 
@ TombstoneKey
Use as Tombstone key for DenseMap of AttrKind.
 
@ None
No attributes have been set.
 
@ EmptyKey
Use as Empty key for DenseMap of AttrKind.
 
@ EndAttrKinds
Sentinel value useful for loops.
 
static bool isConstantRangeAttrKind(AttrKind Kind)
 
void * getRawPointer() const
Return a raw pointer that uniquely identifies this attribute.
 
LLVM_ABI bool hasParentContext(LLVMContext &C) const
Return true if this attribute belongs to the LLVMContext.
 
LLVM_ABI bool isTypeAttribute() const
Return true if the attribute is a type attribute.
 
static LLVM_ABI Attribute getWithCaptureInfo(LLVMContext &Context, CaptureInfo CI)
 
static LLVM_ABI Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty)
 
static bool isIntAttrKind(AttrKind Kind)
 
static bool isConstantRangeListAttrKind(AttrKind Kind)
 
LLVM_ABI bool isConstantRangeListAttribute() const
Return true if the attribute is a ConstantRangeList attribute.
 
static LLVM_ABI Attribute getWithByValType(LLVMContext &Context, Type *Ty)
 
Attribute getWithNewType(LLVMContext &Context, Type *ReplacementTy)
For a typed attribute, return the equivalent attribute with the type changed to ReplacementTy.
 
LLVM_ABI bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
 
static bool isEnumAttrKind(AttrKind Kind)
 
static LLVM_ABI Attribute getWithMemoryEffects(LLVMContext &Context, MemoryEffects ME)
 
static LLVM_ABI bool canUseAsParamAttr(AttrKind Kind)
 
bool isValid() const
Return true if the attribute is any kind of attribute.
 
LLVM_ABI MaybeAlign getStackAlignment() const
Returns the stack alignment field of an attribute as a byte alignment value.
 
static Attribute fromRawPointer(void *RawPtr)
Get an attribute from a raw pointer created by getRawPointer.
 
static const unsigned NumIntAttrKinds
 
LLVM_ABI MaybeAlign getAlignment() const
Returns the alignment field of an attribute as a byte alignment value.
 
LLVM_ABI CaptureInfo getCaptureInfo() const
Returns information from captures attribute.
 
static LLVM_ABI bool intersectMustPreserve(AttrKind Kind)
 
LLVM_ABI int cmpKind(Attribute A) const
Used to sort attribute by kind.
 
LLVM_ABI bool operator<(Attribute A) const
Less-than operator. Useful for sorting the attributes list.
 
static LLVM_ABI Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
 
LLVM_ABI Type * getValueAsType() const
Return the attribute's value as a Type.
 
Represents which components of the pointer may be captured in which location.
 
This class represents a list of constant ranges.
 
This class represents a range of values.
 
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
 
This is an important class for using LLVM in a threaded context.
 
StringRef - Represent a constant reference to a string, i.e.
 
The instances of the Type class are immutable: once they are created, they are never changed.
 
LLVM Value Representation.
 
This class implements an extremely fast bulk output stream that can only output to a stream.
 
struct LLVMOpaqueAttributeRef * LLVMAttributeRef
Used to represent an attributes.
 
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
 
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
 
@ C
The default llvm calling convention, compatible with C.
 
LLVM_ABI AttributeList getAttributes(LLVMContext &C, ID id, FunctionType *FT)
Return the attributes for an intrinsic.
 
LLVM_ABI iterator begin() const
 
LLVM_ABI std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
 
This is an optimization pass for GlobalISel generic memory operations.
 
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
 
bool isEqual(const GCNRPTracker::LiveRegSet &S1, const GCNRPTracker::LiveRegSet &S2)
 
APInt operator*(APInt a, uint64_t RHS)
 
bool operator!=(uint64_t V1, const APInt &V2)
 
LLVM_ABI AttributeMask typeIncompatible(Type *Ty, AttributeSet AS, AttributeSafetyKind ASK=ASK_ALL)
This class holds the attributes for a function, its return value, and its parameters.
 
MemoryEffectsBase< IRMemLocation > MemoryEffects
Summary of how a function affects memory in the program.
 
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
 
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
 
@ LLVM_MARK_AS_BITMASK_ENUM
 
Attribute unwrap(LLVMAttributeRef Attr)
 
LLVM_ABI void mergeAttributesForOutlining(Function &Base, const Function &ToMerge)
Merges the functions attributes from ToMerge into function Base.
 
LLVMAttributeRef wrap(Attribute Attr)
 
LLVM_ABI bool areInlineCompatible(const Function &Caller, const Function &Callee)
 
LLVM_ABI void updateMinLegalVectorWidthAttr(Function &Fn, uint64_t Width)
Update min-legal-vector-width if it is in Attribute and less than Width.
 
LLVM_ABI void mergeAttributesForInlining(Function &Caller, const Function &Callee)
Merge caller's and callee's attributes.
 
LLVM_ABI bool areOutlineCompatible(const Function &A, const Function &B)
Checks if there are any incompatible function attributes between A and B.
 
LLVM_ABI AttributeMask getUBImplyingAttributes()
Get param/return attributes which imply immediate undefined behavior if an invalid value is passed.
 
This struct is a compact representation of a valid (non-zero power of two) alignment.
 
static AttributeSet getTombstoneKey()
 
static bool isEqual(AttributeSet LHS, AttributeSet RHS)
 
static AttributeSet getEmptyKey()
 
static unsigned getHashValue(AttributeSet AS)
 
An information struct used to provide DenseMap with the various necessary components for a given valu...
 
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.