Fix null pointer constants
[tinycc.git] / i386-tok.h
blob3145aa63f737de2c24e8d9e1783e436d3a0b20ea
1 /* ------------------------------------------------------------------ */
2 /* WARNING: relative order of tokens is important. */
4 #define DEF_BWL(x) \
5 DEF(TOK_ASM_ ## x ## b, #x "b") \
6 DEF(TOK_ASM_ ## x ## w, #x "w") \
7 DEF(TOK_ASM_ ## x ## l, #x "l") \
8 DEF(TOK_ASM_ ## x, #x)
9 #define DEF_WL(x) \
10 DEF(TOK_ASM_ ## x ## w, #x "w") \
11 DEF(TOK_ASM_ ## x ## l, #x "l") \
12 DEF(TOK_ASM_ ## x, #x)
13 #ifdef TCC_TARGET_X86_64
14 # define DEF_BWLQ(x) \
15 DEF(TOK_ASM_ ## x ## b, #x "b") \
16 DEF(TOK_ASM_ ## x ## w, #x "w") \
17 DEF(TOK_ASM_ ## x ## l, #x "l") \
18 DEF(TOK_ASM_ ## x ## q, #x "q") \
19 DEF(TOK_ASM_ ## x, #x)
20 # define DEF_WLQ(x) \
21 DEF(TOK_ASM_ ## x ## w, #x "w") \
22 DEF(TOK_ASM_ ## x ## l, #x "l") \
23 DEF(TOK_ASM_ ## x ## q, #x "q") \
24 DEF(TOK_ASM_ ## x, #x)
25 # define DEF_BWLX DEF_BWLQ
26 # define DEF_WLX DEF_WLQ
27 /* number of sizes + 1 */
28 # define NBWLX 5
29 #else
30 # define DEF_BWLX DEF_BWL
31 # define DEF_WLX DEF_WL
32 /* number of sizes + 1 */
33 # define NBWLX 4
34 #endif
36 #define DEF_FP1(x) \
37 DEF(TOK_ASM_ ## f ## x ## s, "f" #x "s") \
38 DEF(TOK_ASM_ ## fi ## x ## l, "fi" #x "l") \
39 DEF(TOK_ASM_ ## f ## x ## l, "f" #x "l") \
40 DEF(TOK_ASM_ ## fi ## x ## s, "fi" #x "s")
42 #define DEF_FP(x) \
43 DEF(TOK_ASM_ ## f ## x, "f" #x ) \
44 DEF(TOK_ASM_ ## f ## x ## p, "f" #x "p") \
45 DEF_FP1(x)
47 #define DEF_ASMTEST(x,suffix) \
48 DEF_ASM(x ## o ## suffix) \
49 DEF_ASM(x ## no ## suffix) \
50 DEF_ASM(x ## b ## suffix) \
51 DEF_ASM(x ## c ## suffix) \
52 DEF_ASM(x ## nae ## suffix) \
53 DEF_ASM(x ## nb ## suffix) \
54 DEF_ASM(x ## nc ## suffix) \
55 DEF_ASM(x ## ae ## suffix) \
56 DEF_ASM(x ## e ## suffix) \
57 DEF_ASM(x ## z ## suffix) \
58 DEF_ASM(x ## ne ## suffix) \
59 DEF_ASM(x ## nz ## suffix) \
60 DEF_ASM(x ## be ## suffix) \
61 DEF_ASM(x ## na ## suffix) \
62 DEF_ASM(x ## nbe ## suffix) \
63 DEF_ASM(x ## a ## suffix) \
64 DEF_ASM(x ## s ## suffix) \
65 DEF_ASM(x ## ns ## suffix) \
66 DEF_ASM(x ## p ## suffix) \
67 DEF_ASM(x ## pe ## suffix) \
68 DEF_ASM(x ## np ## suffix) \
69 DEF_ASM(x ## po ## suffix) \
70 DEF_ASM(x ## l ## suffix) \
71 DEF_ASM(x ## nge ## suffix) \
72 DEF_ASM(x ## nl ## suffix) \
73 DEF_ASM(x ## ge ## suffix) \
74 DEF_ASM(x ## le ## suffix) \
75 DEF_ASM(x ## ng ## suffix) \
76 DEF_ASM(x ## nle ## suffix) \
77 DEF_ASM(x ## g ## suffix)
79 /* ------------------------------------------------------------------ */
80 /* register */
81 DEF_ASM(al)
82 DEF_ASM(cl)
83 DEF_ASM(dl)
84 DEF_ASM(bl)
85 DEF_ASM(ah)
86 DEF_ASM(ch)
87 DEF_ASM(dh)
88 DEF_ASM(bh)
89 DEF_ASM(ax)
90 DEF_ASM(cx)
91 DEF_ASM(dx)
92 DEF_ASM(bx)
93 DEF_ASM(sp)
94 DEF_ASM(bp)
95 DEF_ASM(si)
96 DEF_ASM(di)
97 DEF_ASM(eax)
98 DEF_ASM(ecx)
99 DEF_ASM(edx)
100 DEF_ASM(ebx)
101 DEF_ASM(esp)
102 DEF_ASM(ebp)
103 DEF_ASM(esi)
104 DEF_ASM(edi)
105 #ifdef TCC_TARGET_X86_64
106 DEF_ASM(rax)
107 DEF_ASM(rcx)
108 DEF_ASM(rdx)
109 DEF_ASM(rbx)
110 DEF_ASM(rsp)
111 DEF_ASM(rbp)
112 DEF_ASM(rsi)
113 DEF_ASM(rdi)
114 #endif
115 DEF_ASM(mm0)
116 DEF_ASM(mm1)
117 DEF_ASM(mm2)
118 DEF_ASM(mm3)
119 DEF_ASM(mm4)
120 DEF_ASM(mm5)
121 DEF_ASM(mm6)
122 DEF_ASM(mm7)
123 DEF_ASM(xmm0)
124 DEF_ASM(xmm1)
125 DEF_ASM(xmm2)
126 DEF_ASM(xmm3)
127 DEF_ASM(xmm4)
128 DEF_ASM(xmm5)
129 DEF_ASM(xmm6)
130 DEF_ASM(xmm7)
131 DEF_ASM(cr0)
132 DEF_ASM(cr1)
133 DEF_ASM(cr2)
134 DEF_ASM(cr3)
135 DEF_ASM(cr4)
136 DEF_ASM(cr5)
137 DEF_ASM(cr6)
138 DEF_ASM(cr7)
139 DEF_ASM(tr0)
140 DEF_ASM(tr1)
141 DEF_ASM(tr2)
142 DEF_ASM(tr3)
143 DEF_ASM(tr4)
144 DEF_ASM(tr5)
145 DEF_ASM(tr6)
146 DEF_ASM(tr7)
147 DEF_ASM(db0)
148 DEF_ASM(db1)
149 DEF_ASM(db2)
150 DEF_ASM(db3)
151 DEF_ASM(db4)
152 DEF_ASM(db5)
153 DEF_ASM(db6)
154 DEF_ASM(db7)
155 DEF_ASM(dr0)
156 DEF_ASM(dr1)
157 DEF_ASM(dr2)
158 DEF_ASM(dr3)
159 DEF_ASM(dr4)
160 DEF_ASM(dr5)
161 DEF_ASM(dr6)
162 DEF_ASM(dr7)
163 DEF_ASM(es)
164 DEF_ASM(cs)
165 DEF_ASM(ss)
166 DEF_ASM(ds)
167 DEF_ASM(fs)
168 DEF_ASM(gs)
169 DEF_ASM(st)
170 DEF_ASM(rip)
172 #ifdef TCC_TARGET_X86_64
173 /* The four low parts of sp/bp/si/di that exist only on
174 x86-64 (encoding aliased to ah,ch,dh,dh when not using REX). */
175 DEF_ASM(spl)
176 DEF_ASM(bpl)
177 DEF_ASM(sil)
178 DEF_ASM(dil)
179 #endif
180 /* generic two operands */
181 DEF_BWLX(mov)
183 DEF_BWLX(add)
184 DEF_BWLX(or)
185 DEF_BWLX(adc)
186 DEF_BWLX(sbb)
187 DEF_BWLX(and)
188 DEF_BWLX(sub)
189 DEF_BWLX(xor)
190 DEF_BWLX(cmp)
192 /* unary ops */
193 DEF_BWLX(inc)
194 DEF_BWLX(dec)
195 DEF_BWLX(not)
196 DEF_BWLX(neg)
197 DEF_BWLX(mul)
198 DEF_BWLX(imul)
199 DEF_BWLX(div)
200 DEF_BWLX(idiv)
202 DEF_BWLX(xchg)
203 DEF_BWLX(test)
205 /* shifts */
206 DEF_BWLX(rol)
207 DEF_BWLX(ror)
208 DEF_BWLX(rcl)
209 DEF_BWLX(rcr)
210 DEF_BWLX(shl)
211 DEF_BWLX(shr)
212 DEF_BWLX(sar)
214 DEF_WLX(shld)
215 DEF_WLX(shrd)
217 DEF_ASM(pushw)
218 DEF_ASM(pushl)
219 #ifdef TCC_TARGET_X86_64
220 DEF_ASM(pushq)
221 #endif
222 DEF_ASM(push)
224 DEF_ASM(popw)
225 DEF_ASM(popl)
226 #ifdef TCC_TARGET_X86_64
227 DEF_ASM(popq)
228 #endif
229 DEF_ASM(pop)
231 DEF_BWL(in)
232 DEF_BWL(out)
234 DEF_WLX(movzb)
235 DEF_ASM(movzwl)
236 DEF_ASM(movsbw)
237 DEF_ASM(movsbl)
238 DEF_ASM(movswl)
239 #ifdef TCC_TARGET_X86_64
240 DEF_ASM(movsbq)
241 DEF_ASM(movswq)
242 DEF_ASM(movzwq)
243 DEF_ASM(movslq)
244 #endif
246 DEF_WLX(lea)
248 DEF_ASM(les)
249 DEF_ASM(lds)
250 DEF_ASM(lss)
251 DEF_ASM(lfs)
252 DEF_ASM(lgs)
254 DEF_ASM(call)
255 DEF_ASM(jmp)
256 DEF_ASM(lcall)
257 DEF_ASM(ljmp)
259 DEF_ASMTEST(j,)
261 DEF_ASMTEST(set,)
262 DEF_ASMTEST(set,b)
263 DEF_ASMTEST(cmov,)
265 DEF_WLX(bsf)
266 DEF_WLX(bsr)
267 DEF_WLX(bt)
268 DEF_WLX(bts)
269 DEF_WLX(btr)
270 DEF_WLX(btc)
271 DEF_WLX(popcnt)
273 DEF_WLX(lar)
274 DEF_WLX(lsl)
276 /* generic FP ops */
277 DEF_FP(add)
278 DEF_FP(mul)
280 DEF_ASM(fcom)
281 DEF_ASM(fcom_1) /* non existent op, just to have a regular table */
282 DEF_FP1(com)
284 DEF_FP(comp)
285 DEF_FP(sub)
286 DEF_FP(subr)
287 DEF_FP(div)
288 DEF_FP(divr)
290 DEF_BWLX(xadd)
291 DEF_BWLX(cmpxchg)
293 /* string ops */
294 DEF_BWLX(cmps)
295 DEF_BWLX(scmp)
296 DEF_BWL(ins)
297 DEF_BWL(outs)
298 DEF_BWLX(lods)
299 DEF_BWLX(slod)
300 DEF_BWLX(movs)
301 DEF_BWLX(smov)
302 DEF_BWLX(scas)
303 DEF_BWLX(ssca)
304 DEF_BWLX(stos)
305 DEF_BWLX(ssto)
307 /* generic asm ops */
308 #define ALT(x)
309 #define DEF_ASM_OP0(name, opcode) DEF_ASM(name)
310 #define DEF_ASM_OP0L(name, opcode, group, instr_type)
311 #define DEF_ASM_OP1(name, opcode, group, instr_type, op0)
312 #define DEF_ASM_OP2(name, opcode, group, instr_type, op0, op1)
313 #define DEF_ASM_OP3(name, opcode, group, instr_type, op0, op1, op2)
314 #ifdef TCC_TARGET_X86_64
315 # include "x86_64-asm.h"
316 #else
317 # include "i386-asm.h"
318 #endif
320 #define ALT(x)
321 #define DEF_ASM_OP0(name, opcode)
322 #define DEF_ASM_OP0L(name, opcode, group, instr_type) DEF_ASM(name)
323 #define DEF_ASM_OP1(name, opcode, group, instr_type, op0) DEF_ASM(name)
324 #define DEF_ASM_OP2(name, opcode, group, instr_type, op0, op1) DEF_ASM(name)
325 #define DEF_ASM_OP3(name, opcode, group, instr_type, op0, op1, op2) DEF_ASM(name)
326 #ifdef TCC_TARGET_X86_64
327 # include "x86_64-asm.h"
328 #else
329 # include "i386-asm.h"
330 #endif