llvm_support/
attribute.rs

1//! Support code for LLVM attributes.
2
3use num_enum::TryFromPrimitive;
4
5/// Represents the different kinds of attributes.
6#[derive(Debug, PartialEq, TryFromPrimitive)]
7#[repr(u64)]
8pub enum AttributeKind {
9    /// A well-known enum attribute.
10    Enum = 0,
11    /// A well-known integral attribute with an integer value.
12    IntKeyValue = 1,
13    /// A string attribute.
14    StrKey = 3,
15    /// A string attribute with a string value.
16    StrKeyValue = 4,
17    // TODO(ww): 5 and 6 are attribute kinds in the LLVM codebase, but aren't documented.
18}
19
20/// Represents the IDs of different specific attributes.
21#[non_exhaustive]
22#[derive(Copy, Clone, Debug, PartialEq, TryFromPrimitive)]
23#[repr(u64)]
24pub enum AttributeId {
25    /// `align(<n>)`
26    Alignment = 1,
27    /// `alwaysinline`
28    AlwaysInline = 2,
29    /// `byval`
30    ByVal = 3,
31    /// `inlinehint`
32    InlineHint = 4,
33    /// `inreg`
34    InReg = 5,
35    /// `minsize`
36    MinSize = 6,
37    /// `naked`
38    Naked = 7,
39    /// `nest`
40    Nest = 8,
41    /// `noalias`
42    NoAlias = 9,
43    /// `nobuiltin`
44    NoBuiltin = 10,
45    /// `nocapture`
46    NoCapture = 11,
47    /// `noduplicate`
48    NoDuplicate = 12,
49    /// `noimplicitfloat`
50    NoImplicitFloat = 13,
51    /// `noinline`
52    NoInline = 14,
53    /// `nonlazybind`
54    NonLazyBind = 15,
55    /// `noredzone`
56    NoRedZone = 16,
57    /// `noreturn`
58    NoReturn = 17,
59    /// `nounwind`
60    NoUnwind = 18,
61    /// `optsize`
62    OptimizeForSize = 19,
63    /// `readnone`
64    ReadNone = 20,
65    /// `readonly`
66    ReadOnly = 21,
67    /// `returned`
68    Returned = 22,
69    /// `returns_twice`
70    ReturnsTwice = 23,
71    /// `signext`
72    SExt = 24,
73    /// `alignstack(<n>)`
74    StackAlignment = 25,
75    /// `ssp`
76    StackProtect = 26,
77    /// `sspreq`
78    StackProtectReq = 27,
79    /// `sspstrong`
80    StackProtectStrong = 28,
81    /// `sret`
82    StructRet = 29,
83    /// `sanitize_address`
84    SanitizeAddress = 30,
85    /// `sanitize_thread`
86    SanitizeThread = 31,
87    /// `sanitize_memory`
88    SanitizeMemory = 32,
89    /// `uwtable`
90    UwTable = 33,
91    /// `zeroext`
92    ZExt = 34,
93    /// `builtin`
94    Builtin = 35,
95    /// `cold`
96    Cold = 36,
97    /// `optnone`
98    OptimizeNone = 37,
99    /// `inalloca`
100    InAlloca = 38,
101    /// `nonnull`
102    NonNull = 39,
103    /// `jumptable`
104    JumpTable = 40,
105    /// `dereferenceable(<n>)`
106    Dereferenceable = 41,
107    /// `dereferenceable_or_null(<n>)`
108    DereferenceableOrNull = 42,
109    /// `convergent`
110    Convergent = 43,
111    /// `safestack`
112    SafeStack = 44,
113    /// `argmemonly`
114    ArgMemOnly = 45,
115    /// `swiftself`
116    SwiftSelf = 46,
117    /// `swifterror`
118    SwiftError = 47,
119    /// `norecurse`
120    NoRecurse = 48,
121    /// `inaccessiblememonly`
122    InaccessiblememOnly = 49,
123    /// `inaccessiblememonly_or_argmemonly`
124    InaccessiblememOrArgmemonly = 50,
125    /// `allocsize(<EltSizeParam>[, <NumEltsParam>])`
126    AllocSize = 51,
127    /// `writeonly`
128    WriteOnly = 52,
129    /// `speculatable`
130    Speculatable = 53,
131    /// `strictfp`
132    StrictFp = 54,
133    /// `sanitize_hwaddress`
134    SanitizeHwAddress = 55,
135    /// `nocf_check`
136    NoCfCheck = 56,
137    /// `optforfuzzing`
138    OptForFuzzing = 57,
139    /// `shadowcallstack`
140    Shadowcallstack = 58,
141    /// `speculative_load_hardening`
142    SpeculativeLoadHardening = 59,
143    /// `immarg`
144    ImmArg = 60,
145    /// `willreturn`
146    WillReturn = 61,
147    /// `nofree`
148    NoFree = 62,
149    /// `nosync`
150    NoSync = 63,
151    /// `sanitize_memtag`
152    SanitizeMemtag = 64,
153    /// `preallocated`
154    Preallocated = 65,
155    /// `no_merge`
156    NoMerge = 66,
157    /// `null_pointer_is_valid`
158    NullPointerIsValid = 67,
159    /// `noundef`
160    NoUndef = 68,
161    /// `byref`
162    ByRef = 69,
163    /// `mustprogress`
164    MustProgress = 70,
165    /// `no_callback`
166    NoCallback = 71,
167    /// `hot`
168    Hot = 72,
169    /// `no_profile`
170    NoProfile = 73,
171    /// `vscale_range(<Min>[, <Max>])`
172    VScaleRange = 74,
173    /// `swift_async`
174    SwiftAsync = 75,
175    /// `nosanitize_coverage`
176    NoSanitizeCoverage = 76,
177    /// `elementtype`
178    ElementType = 77,
179    /// `disable_sanitizer_instrumentation`
180    DisableSanitizerInstrumentation = 78,
181}