1#===- enumerations.py - Python LLVM Enumerations -------------*- python -*--===#
2#
3#                     The LLVM Compiler Infrastructure
4#
5# This file is distributed under the University of Illinois Open Source
6# License. See LICENSE.TXT for details.
7#
8#===------------------------------------------------------------------------===#
9
10r"""
11LLVM Enumerations
12=================
13
14This file defines enumerations from LLVM.
15
16Each enumeration is exposed as a list of 2-tuples. These lists are consumed by
17dedicated types elsewhere in the package. The enumerations are centrally
18defined in this file so they are easier to locate and maintain.
19"""
20
21__all__ = [
22    'Attributes',
23    'OpCodes',
24    'TypeKinds',
25    'Linkages',
26    'Visibility',
27    'CallConv',
28    'IntPredicate',
29    'RealPredicate',
30    'LandingPadClauseTy',
31]
32
33Attributes = [
34    ('ZExt', 1 << 0),
35    ('MSExt', 1 << 1),
36    ('NoReturn', 1 << 2),
37    ('InReg', 1 << 3),
38    ('StructRet', 1 << 4),
39    ('NoUnwind', 1 << 5),
40    ('NoAlias', 1 << 6),
41    ('ByVal', 1 << 7),
42    ('Nest', 1 << 8),
43    ('ReadNone', 1 << 9),
44    ('ReadOnly', 1 << 10),
45    ('NoInline', 1 << 11),
46    ('AlwaysInline', 1 << 12),
47    ('OptimizeForSize', 1 << 13),
48    ('StackProtect', 1 << 14),
49    ('StackProtectReq', 1 << 15),
50    ('Alignment', 31 << 16),
51    ('NoCapture', 1 << 21),
52    ('NoRedZone', 1 << 22),
53    ('ImplicitFloat', 1 << 23),
54    ('Naked', 1 << 24),
55    ('InlineHint', 1 << 25),
56    ('StackAlignment', 7 << 26),
57    ('ReturnsTwice', 1 << 29),
58    ('UWTable', 1 << 30),
59    ('NonLazyBind', 1 << 31),
60]
61
62OpCodes = [
63    ('Ret', 1),
64    ('Br', 2),
65    ('Switch', 3),
66    ('IndirectBr', 4),
67    ('Invoke', 5),
68    ('Unreachable', 7),
69    ('Add', 8),
70    ('FAdd', 9),
71    ('Sub', 10),
72    ('FSub', 11),
73    ('Mul', 12),
74    ('FMul', 13),
75    ('UDiv', 14),
76    ('SDiv', 15),
77    ('FDiv', 16),
78    ('URem', 17),
79    ('SRem', 18),
80    ('FRem', 19),
81    ('Shl', 20),
82    ('LShr', 21),
83    ('AShr', 22),
84    ('And', 23),
85    ('Or', 24),
86    ('Xor', 25),
87    ('Alloca', 26),
88    ('Load', 27),
89    ('Store', 28),
90    ('GetElementPtr', 29),
91    ('Trunc', 30),
92    ('ZExt', 31),
93    ('SExt', 32),
94    ('FPToUI', 33),
95    ('FPToSI', 34),
96    ('UIToFP', 35),
97    ('SIToFP', 36),
98    ('FPTrunc', 37),
99    ('FPExt', 38),
100    ('PtrToInt', 39),
101    ('IntToPtr', 40),
102    ('BitCast', 41),
103    ('ICmp', 42),
104    ('FCmpl', 43),
105    ('PHI', 44),
106    ('Call', 45),
107    ('Select', 46),
108    ('UserOp1', 47),
109    ('UserOp2', 48),
110    ('AArg', 49),
111    ('ExtractElement', 50),
112    ('InsertElement', 51),
113    ('ShuffleVector', 52),
114    ('ExtractValue', 53),
115    ('InsertValue', 54),
116    ('Fence', 55),
117    ('AtomicCmpXchg', 56),
118    ('AtomicRMW', 57),
119    ('Resume', 58),
120    ('LandingPad', 59),
121]
122
123TypeKinds = [
124    ('Void', 0),
125    ('Half', 1),
126    ('Float', 2),
127    ('Double', 3),
128    ('X86_FP80', 4),
129    ('FP128', 5),
130    ('PPC_FP128', 6),
131    ('Label', 7),
132    ('Integer', 8),
133    ('Function', 9),
134    ('Struct', 10),
135    ('Array', 11),
136    ('Pointer', 12),
137    ('Vector', 13),
138    ('Metadata', 14),
139    ('X86_MMX', 15),
140]
141
142Linkages = [
143    ('External', 0),
144    ('AvailableExternally', 1),
145    ('LinkOnceAny', 2),
146    ('LinkOnceODR', 3),
147    ('WeakAny', 4),
148    ('WeakODR', 5),
149    ('Appending', 6),
150    ('Internal', 7),
151    ('Private', 8),
152    ('DLLImport', 9),
153    ('DLLExport', 10),
154    ('ExternalWeak', 11),
155    ('Ghost', 12),
156    ('Common', 13),
157    ('LinkerPrivate', 14),
158    ('LinkerPrivateWeak', 15),
159    ('LinkerPrivateWeakDefAuto', 16),
160]
161
162Visibility = [
163    ('Default', 0),
164    ('Hidden', 1),
165    ('Protected', 2),
166]
167
168CallConv = [
169    ('CCall', 0),
170    ('FastCall', 8),
171    ('ColdCall', 9),
172    ('X86StdcallCall', 64),
173    ('X86FastcallCall', 65),
174]
175
176IntPredicate = [
177    ('EQ', 32),
178    ('NE', 33),
179    ('UGT', 34),
180    ('UGE', 35),
181    ('ULT', 36),
182    ('ULE', 37),
183    ('SGT', 38),
184    ('SGE', 39),
185    ('SLT', 40),
186    ('SLE', 41),
187]
188
189RealPredicate = [
190    ('PredicateFalse', 0),
191    ('OEQ', 1),
192    ('OGT', 2),
193    ('OGE', 3),
194    ('OLT', 4),
195    ('OLE', 5),
196    ('ONE', 6),
197    ('ORD', 7),
198    ('UNO', 8),
199    ('UEQ', 9),
200    ('UGT', 10),
201    ('UGE', 11),
202    ('ULT', 12),
203    ('ULE', 13),
204    ('UNE', 14),
205    ('PredicateTrue', 15),
206]
207
208LandingPadClauseTy = [
209    ('Catch', 0),
210    ('Filter', 1),
211]
212