more tests
[tinycc.git] / il-opcodes.h
blobd53ffb2c57f259e9c5068d7e622abb0f85e02bad
1 /*
2 * CIL opcode definition
3 *
4 * Copyright (c) 2002 Fabrice Bellard
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 OP(NOP, "nop", 0x00)
21 OP(BREAK, "break", 0x01)
22 OP(LDARG_0, "ldarg.0", 0x02)
23 OP(LDARG_1, "ldarg.1", 0x03)
24 OP(LDARG_2, "ldarg.2", 0x04)
25 OP(LDARG_3, "ldarg.3", 0x05)
26 OP(LDLOC_0, "ldloc.0", 0x06)
27 OP(LDLOC_1, "ldloc.1", 0x07)
28 OP(LDLOC_2, "ldloc.2", 0x08)
29 OP(LDLOC_3, "ldloc.3", 0x09)
30 OP(STLOC_0, "stloc.0", 0x0a)
31 OP(STLOC_1, "stloc.1", 0x0b)
32 OP(STLOC_2, "stloc.2", 0x0c)
33 OP(STLOC_3, "stloc.3", 0x0d)
34 OP(LDARG_S, "ldarg.s", 0x0e)
35 OP(LDARGA_S, "ldarga.s", 0x0f)
36 OP(STARG_S, "starg.s", 0x10)
37 OP(LDLOC_S, "ldloc.s", 0x11)
38 OP(LDLOCA_S, "ldloca.s", 0x12)
39 OP(STLOC_S, "stloc.s", 0x13)
40 OP(LDNULL, "ldnull", 0x14)
41 OP(LDC_I4_M1, "ldc.i4.m1", 0x15)
42 OP(LDC_I4_0, "ldc.i4.0", 0x16)
43 OP(LDC_I4_1, "ldc.i4.1", 0x17)
44 OP(LDC_I4_2, "ldc.i4.2", 0x18)
45 OP(LDC_I4_3, "ldc.i4.3", 0x19)
46 OP(LDC_I4_4, "ldc.i4.4", 0x1a)
47 OP(LDC_I4_5, "ldc.i4.5", 0x1b)
48 OP(LDC_I4_6, "ldc.i4.6", 0x1c)
49 OP(LDC_I4_7, "ldc.i4.7", 0x1d)
50 OP(LDC_I4_8, "ldc.i4.8", 0x1e)
51 OP(LDC_I4_S, "ldc.i4.s", 0x1f)
52 OP(LDC_I4, "ldc.i4", 0x20)
53 OP(LDC_I8, "ldc.i8", 0x21)
54 OP(LDC_R4, "ldc.r4", 0x22)
55 OP(LDC_R8, "ldc.r8", 0x23)
56 OP(LDPTR, "ldptr", 0x24)
57 OP(DUP, "dup", 0x25)
58 OP(POP, "pop", 0x26)
59 OP(JMP, "jmp", 0x27)
60 OP(CALL, "call", 0x28)
61 OP(CALLI, "calli", 0x29)
62 OP(RET, "ret", 0x2a)
63 OP(BR_S, "br.s", 0x2b)
64 OP(BRFALSE_S, "brfalse.s", 0x2c)
65 OP(BRTRUE_S, "brtrue.s", 0x2d)
66 OP(BEQ_S, "beq.s", 0x2e)
67 OP(BGE_S, "bge.s", 0x2f)
68 OP(BGT_S, "bgt.s", 0x30)
69 OP(BLE_S, "ble.s", 0x31)
70 OP(BLT_S, "blt.s", 0x32)
71 OP(BNE_UN_S, "bne.un.s", 0x33)
72 OP(BGE_UN_S, "bge.un.s", 0x34)
73 OP(BGT_UN_S, "bgt.un.s", 0x35)
74 OP(BLE_UN_S, "ble.un.s", 0x36)
75 OP(BLT_UN_S, "blt.un.s", 0x37)
76 OP(BR, "br", 0x38)
77 OP(BRFALSE, "brfalse", 0x39)
78 OP(BRTRUE, "brtrue", 0x3a)
79 OP(BEQ, "beq", 0x3b)
80 OP(BGE, "bge", 0x3c)
81 OP(BGT, "bgt", 0x3d)
82 OP(BLE, "ble", 0x3e)
83 OP(BLT, "blt", 0x3f)
84 OP(BNE_UN, "bne.un", 0x40)
85 OP(BGE_UN, "bge.un", 0x41)
86 OP(BGT_UN, "bgt.un", 0x42)
87 OP(BLE_UN, "ble.un", 0x43)
88 OP(BLT_UN, "blt.un", 0x44)
89 OP(SWITCH, "switch", 0x45)
90 OP(LDIND_I1, "ldind.i1", 0x46)
91 OP(LDIND_U1, "ldind.u1", 0x47)
92 OP(LDIND_I2, "ldind.i2", 0x48)
93 OP(LDIND_U2, "ldind.u2", 0x49)
94 OP(LDIND_I4, "ldind.i4", 0x4a)
95 OP(LDIND_U4, "ldind.u4", 0x4b)
96 OP(LDIND_I8, "ldind.i8", 0x4c)
97 OP(LDIND_I, "ldind.i", 0x4d)
98 OP(LDIND_R4, "ldind.r4", 0x4e)
99 OP(LDIND_R8, "ldind.r8", 0x4f)
100 OP(LDIND_REF, "ldind.ref", 0x50)
101 OP(STIND_REF, "stind.ref", 0x51)
102 OP(STIND_I1, "stind.i1", 0x52)
103 OP(STIND_I2, "stind.i2", 0x53)
104 OP(STIND_I4, "stind.i4", 0x54)
105 OP(STIND_I8, "stind.i8", 0x55)
106 OP(STIND_R4, "stind.r4", 0x56)
107 OP(STIND_R8, "stind.r8", 0x57)
108 OP(ADD, "add", 0x58)
109 OP(SUB, "sub", 0x59)
110 OP(MUL, "mul", 0x5a)
111 OP(DIV, "div", 0x5b)
112 OP(DIV_UN, "div.un", 0x5c)
113 OP(REM, "rem", 0x5d)
114 OP(REM_UN, "rem.un", 0x5e)
115 OP(AND, "and", 0x5f)
116 OP(OR, "or", 0x60)
117 OP(XOR, "xor", 0x61)
118 OP(SHL, "shl", 0x62)
119 OP(SHR, "shr", 0x63)
120 OP(SHR_UN, "shr.un", 0x64)
121 OP(NEG, "neg", 0x65)
122 OP(NOT, "not", 0x66)
123 OP(CONV_I1, "conv.i1", 0x67)
124 OP(CONV_I2, "conv.i2", 0x68)
125 OP(CONV_I4, "conv.i4", 0x69)
126 OP(CONV_I8, "conv.i8", 0x6a)
127 OP(CONV_R4, "conv.r4", 0x6b)
128 OP(CONV_R8, "conv.r8", 0x6c)
129 OP(CONV_U4, "conv.u4", 0x6d)
130 OP(CONV_U8, "conv.u8", 0x6e)
131 OP(CALLVIRT, "callvirt", 0x6f)
132 OP(CPOBJ, "cpobj", 0x70)
133 OP(LDOBJ, "ldobj", 0x71)
134 OP(LDSTR, "ldstr", 0x72)
135 OP(NEWOBJ, "newobj", 0x73)
136 OP(CASTCLASS, "castclass", 0x74)
137 OP(ISINST, "isinst", 0x75)
138 OP(CONV_R_UN, "conv.r.un", 0x76)
139 OP(ANN_DATA_S, "ann.data.s", 0x77)
140 OP(UNBOX, "unbox", 0x79)
141 OP(THROW, "throw", 0x7a)
142 OP(LDFLD, "ldfld", 0x7b)
143 OP(LDFLDA, "ldflda", 0x7c)
144 OP(STFLD, "stfld", 0x7d)
145 OP(LDSFLD, "ldsfld", 0x7e)
146 OP(LDSFLDA, "ldsflda", 0x7f)
147 OP(STSFLD, "stsfld", 0x80)
148 OP(STOBJ, "stobj", 0x81)
149 OP(CONV_OVF_I1_UN, "conv.ovf.i1.un", 0x82)
150 OP(CONV_OVF_I2_UN, "conv.ovf.i2.un", 0x83)
151 OP(CONV_OVF_I4_UN, "conv.ovf.i4.un", 0x84)
152 OP(CONV_OVF_I8_UN, "conv.ovf.i8.un", 0x85)
153 OP(CONV_OVF_U1_UN, "conv.ovf.u1.un", 0x86)
154 OP(CONV_OVF_U2_UN, "conv.ovf.u2.un", 0x87)
155 OP(CONV_OVF_U4_UN, "conv.ovf.u4.un", 0x88)
156 OP(CONV_OVF_U8_UN, "conv.ovf.u8.un", 0x89)
157 OP(CONV_OVF_I_UN, "conv.ovf.i.un", 0x8a)
158 OP(CONV_OVF_U_UN, "conv.ovf.u.un", 0x8b)
159 OP(BOX, "box", 0x8c)
160 OP(NEWARR, "newarr", 0x8d)
161 OP(LDLEN, "ldlen", 0x8e)
162 OP(LDELEMA, "ldelema", 0x8f)
163 OP(LDELEM_I1, "ldelem.i1", 0x90)
164 OP(LDELEM_U1, "ldelem.u1", 0x91)
165 OP(LDELEM_I2, "ldelem.i2", 0x92)
166 OP(LDELEM_U2, "ldelem.u2", 0x93)
167 OP(LDELEM_I4, "ldelem.i4", 0x94)
168 OP(LDELEM_U4, "ldelem.u4", 0x95)
169 OP(LDELEM_I8, "ldelem.i8", 0x96)
170 OP(LDELEM_I, "ldelem.i", 0x97)
171 OP(LDELEM_R4, "ldelem.r4", 0x98)
172 OP(LDELEM_R8, "ldelem.r8", 0x99)
173 OP(LDELEM_REF, "ldelem.ref", 0x9a)
174 OP(STELEM_I, "stelem.i", 0x9b)
175 OP(STELEM_I1, "stelem.i1", 0x9c)
176 OP(STELEM_I2, "stelem.i2", 0x9d)
177 OP(STELEM_I4, "stelem.i4", 0x9e)
178 OP(STELEM_I8, "stelem.i8", 0x9f)
179 OP(STELEM_R4, "stelem.r4", 0xa0)
180 OP(STELEM_R8, "stelem.r8", 0xa1)
181 OP(STELEM_REF, "stelem.ref", 0xa2)
182 OP(CONV_OVF_I1, "conv.ovf.i1", 0xb3)
183 OP(CONV_OVF_U1, "conv.ovf.u1", 0xb4)
184 OP(CONV_OVF_I2, "conv.ovf.i2", 0xb5)
185 OP(CONV_OVF_U2, "conv.ovf.u2", 0xb6)
186 OP(CONV_OVF_I4, "conv.ovf.i4", 0xb7)
187 OP(CONV_OVF_U4, "conv.ovf.u4", 0xb8)
188 OP(CONV_OVF_I8, "conv.ovf.i8", 0xb9)
189 OP(CONV_OVF_U8, "conv.ovf.u8", 0xba)
190 OP(REFANYVAL, "refanyval", 0xc2)
191 OP(CKFINITE, "ckfinite", 0xc3)
192 OP(MKREFANY, "mkrefany", 0xc6)
193 OP(ANN_CALL, "ann.call", 0xc7)
194 OP(ANN_CATCH, "ann.catch", 0xc8)
195 OP(ANN_DEAD, "ann.dead", 0xc9)
196 OP(ANN_HOISTED, "ann.hoisted", 0xca)
197 OP(ANN_HOISTED_CALL, "ann.hoisted.call", 0xcb)
198 OP(ANN_LAB, "ann.lab", 0xcc)
199 OP(ANN_DEF, "ann.def", 0xcd)
200 OP(ANN_REF_S, "ann.ref.s", 0xce)
201 OP(ANN_PHI, "ann.phi", 0xcf)
202 OP(LDTOKEN, "ldtoken", 0xd0)
203 OP(CONV_U2, "conv.u2", 0xd1)
204 OP(CONV_U1, "conv.u1", 0xd2)
205 OP(CONV_I, "conv.i", 0xd3)
206 OP(CONV_OVF_I, "conv.ovf.i", 0xd4)
207 OP(CONV_OVF_U, "conv.ovf.u", 0xd5)
208 OP(ADD_OVF, "add.ovf", 0xd6)
209 OP(ADD_OVF_UN, "add.ovf.un", 0xd7)
210 OP(MUL_OVF, "mul.ovf", 0xd8)
211 OP(MUL_OVF_UN, "mul.ovf.un", 0xd9)
212 OP(SUB_OVF, "sub.ovf", 0xda)
213 OP(SUB_OVF_UN, "sub.ovf.un", 0xdb)
214 OP(ENDFINALLY, "endfinally", 0xdc)
215 OP(LEAVE, "leave", 0xdd)
216 OP(LEAVE_S, "leave.s", 0xde)
217 OP(STIND_I, "stind.i", 0xdf)
218 OP(CONV_U, "conv.u", 0xe0)
220 /* prefix instructions. we use an opcode >= 256 to ease coding */
222 OP(ARGLIST, "arglist", 0x100)
223 OP(CEQ, "ceq", 0x101)
224 OP(CGT, "cgt", 0x102)
225 OP(CGT_UN, "cgt.un", 0x103)
226 OP(CLT, "clt", 0x104)
227 OP(CLT_UN, "clt.un", 0x105)
228 OP(LDFTN, "ldftn", 0x106)
229 OP(LDVIRTFTN, "ldvirtftn", 0x107)
230 OP(JMPI, "jmpi", 0x108)
231 OP(LDARG, "ldarg", 0x109)
232 OP(LDARGA, "ldarga", 0x10a)
233 OP(STARG, "starg", 0x10b)
234 OP(LDLOC, "ldloc", 0x10c)
235 OP(LDLOCA, "ldloca", 0x10d)
236 OP(STLOC, "stloc", 0x10e)
237 OP(LOCALLOC, "localloc", 0x10f)
238 OP(ENDFILTER, "endfilter", 0x111)
239 OP(UNALIGNED, "unaligned", 0x112)
240 OP(VOLATILE, "volatile", 0x113)
241 OP(TAIL, "tail", 0x114)
242 OP(INITOBJ, "initobj", 0x115)
243 OP(ANN_LIVE, "ann.live", 0x116)
244 OP(CPBLK, "cpblk", 0x117)
245 OP(INITBLK, "initblk", 0x118)
246 OP(ANN_REF, "ann.ref", 0x119)
247 OP(RETHROW, "rethrow", 0x11a)
248 OP(SIZEOF, "sizeof", 0x11c)
249 OP(REFANYTYPE, "refanytype", 0x11d)
250 OP(ANN_DATA, "ann.data", 0x122)
251 OP(ANN_ARG, "ann.arg", 0x123)