1/// Attribute base class.
2class Attr<string S> {
3  // String representation of this attribute in the IR.
4  string AttrString = S;
5}
6
7/// Enum attribute.
8class EnumAttr<string S> : Attr<S>;
9
10/// StringBool attribute.
11class StrBoolAttr<string S> : Attr<S>;
12
13/// Target-independent enum attributes.
14
15/// Alignment of parameter (5 bits) stored as log2 of alignment with +1 bias.
16/// 0 means unaligned (different from align(1)).
17def Alignment : EnumAttr<"align">;
18
19/// inline=always.
20def AlwaysInline : EnumAttr<"alwaysinline">;
21
22/// Function can access memory only using pointers based on its arguments.
23def ArgMemOnly : EnumAttr<"argmemonly">;
24
25/// Callee is recognized as a builtin, despite nobuiltin attribute on its
26/// declaration.
27def Builtin : EnumAttr<"builtin">;
28
29/// Pass structure by value.
30def ByVal : EnumAttr<"byval">;
31
32/// Marks function as being in a cold path.
33def Cold : EnumAttr<"cold">;
34
35/// Can only be moved to control-equivalent blocks.
36def Convergent : EnumAttr<"convergent">;
37
38/// Pointer is known to be dereferenceable.
39def Dereferenceable : EnumAttr<"dereferenceable">;
40
41/// Pointer is either null or dereferenceable.
42def DereferenceableOrNull : EnumAttr<"dereferenceable_or_null">;
43
44/// Function may only access memory that is inaccessible from IR.
45def InaccessibleMemOnly : EnumAttr<"inaccessiblememonly">;
46
47/// Function may only access memory that is either inaccessible from the IR,
48/// or pointed to by its pointer arguments.
49def InaccessibleMemOrArgMemOnly : EnumAttr<"inaccessiblemem_or_argmemonly">;
50
51/// Pass structure in an alloca.
52def InAlloca : EnumAttr<"inalloca">;
53
54/// Source said inlining was desirable.
55def InlineHint : EnumAttr<"inlinehint">;
56
57/// Force argument to be passed in register.
58def InReg : EnumAttr<"inreg">;
59
60/// Build jump-instruction tables and replace refs.
61def JumpTable : EnumAttr<"jumptable">;
62
63/// Function must be optimized for size first.
64def MinSize : EnumAttr<"minsize">;
65
66/// Naked function.
67def Naked : EnumAttr<"naked">;
68
69/// Nested function static chain.
70def Nest : EnumAttr<"nest">;
71
72/// Considered to not alias after call.
73def NoAlias : EnumAttr<"noalias">;
74
75/// Callee isn't recognized as a builtin.
76def NoBuiltin : EnumAttr<"nobuiltin">;
77
78/// Function creates no aliases of pointer.
79def NoCapture : EnumAttr<"nocapture">;
80
81/// Call cannot be duplicated.
82def NoDuplicate : EnumAttr<"noduplicate">;
83
84/// Disable implicit floating point insts.
85def NoImplicitFloat : EnumAttr<"noimplicitfloat">;
86
87/// inline=never.
88def NoInline : EnumAttr<"noinline">;
89
90/// Function is called early and/or often, so lazy binding isn't worthwhile.
91def NonLazyBind : EnumAttr<"nonlazybind">;
92
93/// Pointer is known to be not null.
94def NonNull : EnumAttr<"nonnull">;
95
96/// The function does not recurse.
97def NoRecurse : EnumAttr<"norecurse">;
98
99/// Disable redzone.
100def NoRedZone : EnumAttr<"noredzone">;
101
102/// Mark the function as not returning.
103def NoReturn : EnumAttr<"noreturn">;
104
105/// Function doesn't unwind stack.
106def NoUnwind : EnumAttr<"nounwind">;
107
108/// opt_size.
109def OptimizeForSize : EnumAttr<"optsize">;
110
111/// Function must not be optimized.
112def OptimizeNone : EnumAttr<"optnone">;
113
114/// Function does not access memory.
115def ReadNone : EnumAttr<"readnone">;
116
117/// Function only reads from memory.
118def ReadOnly : EnumAttr<"readonly">;
119
120/// Return value is always equal to this argument.
121def Returned : EnumAttr<"returned">;
122
123/// Function can return twice.
124def ReturnsTwice : EnumAttr<"returns_twice">;
125
126/// Safe Stack protection.
127def SafeStack : EnumAttr<"safestack">;
128
129/// Sign extended before/after call.
130def SExt : EnumAttr<"signext">;
131
132/// Alignment of stack for function (3 bits)  stored as log2 of alignment with
133/// +1 bias 0 means unaligned (different from alignstack=(1)).
134def StackAlignment : EnumAttr<"alignstack">;
135
136/// Stack protection.
137def StackProtect : EnumAttr<"ssp">;
138
139/// Stack protection required.
140def StackProtectReq : EnumAttr<"sspreq">;
141
142/// Strong Stack protection.
143def StackProtectStrong : EnumAttr<"sspstrong">;
144
145/// Hidden pointer to structure to return.
146def StructRet : EnumAttr<"sret">;
147
148/// AddressSanitizer is on.
149def SanitizeAddress : EnumAttr<"sanitize_address">;
150
151/// ThreadSanitizer is on.
152def SanitizeThread : EnumAttr<"sanitize_thread">;
153
154/// MemorySanitizer is on.
155def SanitizeMemory : EnumAttr<"sanitize_memory">;
156
157/// Function must be in a unwind table.
158def UWTable : EnumAttr<"uwtable">;
159
160/// Zero extended before/after call.
161def ZExt : EnumAttr<"zeroext">;
162
163/// Target-independent string attributes.
164def LessPreciseFPMAD : StrBoolAttr<"less-precise-fpmad">;
165def NoInfsFPMath : StrBoolAttr<"no-infs-fp-math">;
166def NoNansFPMath : StrBoolAttr<"no-nans-fp-math">;
167def UnsafeFPMath : StrBoolAttr<"unsafe-fp-math">;
168