10 #include "gen_amd64_emitter.h"
11 #include "amd64_new_nodes.h"
12 #include "amd64_emitter.h"
14 static void emit_amd64_add(
ir_node const *
const node)
16 amd64_emitf(node,
"add%M %AM");
19 static void emit_amd64_adds(
ir_node const *
const node)
21 amd64_emitf(node,
"adds%MX %AM");
24 static void emit_amd64_and(
ir_node const *
const node)
26 amd64_emitf(node,
"and%M %AM");
29 static void emit_amd64_bsf(
ir_node const *
const node)
31 amd64_emitf(node,
"bsf%M %AM, %D0");
34 static void emit_amd64_bsr(
ir_node const *
const node)
36 amd64_emitf(node,
"bsr%M %AM, %D0");
39 static void emit_amd64_call(
ir_node const *
const node)
41 amd64_emitf(node,
"call %*AM");
44 static void emit_amd64_cmp(
ir_node const *
const node)
46 amd64_emitf(node,
"cmp%M %AM");
49 static void emit_amd64_cmpxchg(
ir_node const *
const node)
51 amd64_emitf(node,
"lock cmpxchg%M %AM");
54 static void emit_amd64_cvtsd2ss(
ir_node const *
const node)
56 amd64_emitf(node,
"cvtsd2ss %AM, %^D0");
59 static void emit_amd64_cvtsi2sd(
ir_node const *
const node)
61 amd64_emitf(node,
"cvtsi2sd %AM, %^D0");
64 static void emit_amd64_cvtsi2ss(
ir_node const *
const node)
66 amd64_emitf(node,
"cvtsi2ss %AM, %^D0");
69 static void emit_amd64_cvtss2sd(
ir_node const *
const node)
71 amd64_emitf(node,
"cvtss2sd %AM, %^D0");
74 static void emit_amd64_cvttsd2si(
ir_node const *
const node)
76 amd64_emitf(node,
"cvttsd2si %AM, %D0");
79 static void emit_amd64_cvttss2si(
ir_node const *
const node)
81 amd64_emitf(node,
"cvttss2si %AM, %D0");
84 static void emit_amd64_div(
ir_node const *
const node)
86 amd64_emitf(node,
"div%M %AM");
89 static void emit_amd64_divs(
ir_node const *
const node)
91 amd64_emitf(node,
"divs%MX %AM");
94 static void emit_amd64_fadd(
ir_node const *
const node)
96 amd64_emitf(node,
"fadd%FP %AF");
99 static void emit_amd64_fchs(
ir_node const *
const node)
101 amd64_emitf(node,
"fchs");
104 static void emit_amd64_fdiv(
ir_node const *
const node)
106 amd64_emitf(node,
"fdiv%FR%FP %AF");
109 static void emit_amd64_fdup(
ir_node const *
const node)
111 amd64_emitf(node,
"fld %F0");
114 static void emit_amd64_fld(
ir_node const *
const node)
116 amd64_emitf(node,
"fld%FM %AM");
119 static void emit_amd64_fld1(
ir_node const *
const node)
121 amd64_emitf(node,
"fld1");
124 static void emit_amd64_fldz(
ir_node const *
const node)
126 amd64_emitf(node,
"fldz");
129 static void emit_amd64_fmul(
ir_node const *
const node)
131 amd64_emitf(node,
"fmul%FP %AF");
134 static void emit_amd64_fpop(
ir_node const *
const node)
136 amd64_emitf(node,
"fstp %F0");
139 static void emit_amd64_fst(
ir_node const *
const node)
141 amd64_emitf(node,
"fst%FP%FM %AM");
144 static void emit_amd64_fstp(
ir_node const *
const node)
146 amd64_emitf(node,
"fstp%FM %AM");
149 static void emit_amd64_fsub(
ir_node const *
const node)
151 amd64_emitf(node,
"fsub%FR%FP %AF");
154 static void emit_amd64_fucomi(
ir_node const *
const node)
156 amd64_emitf(node,
"fucom%FPi %F0");
159 static void emit_amd64_fxch(
ir_node const *
const node)
161 amd64_emitf(node,
"fxch %F0");
164 static void emit_amd64_haddpd(
ir_node const *
const node)
166 amd64_emitf(node,
"haddpd %AM");
169 static void emit_amd64_idiv(
ir_node const *
const node)
171 amd64_emitf(node,
"idiv%M %AM");
174 static void emit_amd64_ijmp(
ir_node const *
const node)
176 amd64_emitf(node,
"jmp %*AM");
179 static void emit_amd64_imul(
ir_node const *
const node)
181 amd64_emitf(node,
"imul%M %AM");
184 static void emit_amd64_imul_1op(
ir_node const *
const node)
186 amd64_emitf(node,
"imul%M %AM");
189 static void emit_amd64_lea(
ir_node const *
const node)
191 amd64_emitf(node,
"lea%M %A, %D0");
194 static void emit_amd64_leave(
ir_node const *
const node)
196 amd64_emitf(node,
"leave");
199 static void emit_amd64_mov_imm(
ir_node const *
const node)
201 amd64_emitf(node,
"mov%MM $%C, %D0");
204 static void emit_amd64_mov_store(
ir_node const *
const node)
206 amd64_emitf(node,
"mov%M %AM");
209 static void emit_amd64_movd_gp_xmm(
ir_node const *
const node)
211 amd64_emitf(node,
"movd %S0, %D0");
214 static void emit_amd64_movd_xmm_gp(
ir_node const *
const node)
216 amd64_emitf(node,
"movd %S0, %D0");
219 static void emit_amd64_movdqa(
ir_node const *
const node)
221 amd64_emitf(node,
"movdqa %AM, %D0");
224 static void emit_amd64_movdqu(
ir_node const *
const node)
226 amd64_emitf(node,
"movdqu %AM, %D0");
229 static void emit_amd64_movdqu_store(
ir_node const *
const node)
231 amd64_emitf(node,
"movdqu %^S0, %A");
234 static void emit_amd64_movq(
ir_node const *
const node)
236 amd64_emitf(node,
"movq %AM, %D0");
239 static void emit_amd64_movs(
ir_node const *
const node)
241 amd64_emitf(node,
"movs%Mq %AM, %^D0");
244 static void emit_amd64_movs_store_xmm(
ir_node const *
const node)
246 amd64_emitf(node,
"movs%MX %^S0, %A");
249 static void emit_amd64_movs_xmm(
ir_node const *
const node)
251 amd64_emitf(node,
"movs%MX %AM, %D0");
254 static void emit_amd64_mul(
ir_node const *
const node)
256 amd64_emitf(node,
"mul%M %AM");
259 static void emit_amd64_muls(
ir_node const *
const node)
261 amd64_emitf(node,
"muls%MX %AM");
264 static void emit_amd64_neg(
ir_node const *
const node)
266 amd64_emitf(node,
"neg%M %AM");
269 static void emit_amd64_not(
ir_node const *
const node)
271 amd64_emitf(node,
"not%M %AM");
274 static void emit_amd64_or(
ir_node const *
const node)
276 amd64_emitf(node,
"or%M %AM");
279 static void emit_amd64_pop_am(
ir_node const *
const node)
281 amd64_emitf(node,
"pop%M %A");
284 static void emit_amd64_punpckldq(
ir_node const *
const node)
286 amd64_emitf(node,
"punpckldq %AM");
289 static void emit_amd64_push_am(
ir_node const *
const node)
291 amd64_emitf(node,
"push%M %A");
294 static void emit_amd64_push_reg(
ir_node const *
const node)
296 amd64_emitf(node,
"pushq %^S2");
299 static void emit_amd64_ret(
ir_node const *
const node)
301 amd64_emitf(node,
"ret");
304 static void emit_amd64_sar(
ir_node const *
const node)
306 amd64_emitf(node,
"sar%MS %SO");
309 static void emit_amd64_sbb(
ir_node const *
const node)
311 amd64_emitf(node,
"sbb%M %AM");
314 static void emit_amd64_setcc(
ir_node const *
const node)
316 amd64_emitf(node,
"set%P0 %D0");
319 static void emit_amd64_shl(
ir_node const *
const node)
321 amd64_emitf(node,
"shl%MS %SO");
324 static void emit_amd64_shr(
ir_node const *
const node)
326 amd64_emitf(node,
"shr%MS %SO");
329 static void emit_amd64_sub(
ir_node const *
const node)
331 amd64_emitf(node,
"sub%M %AM");
334 static void emit_amd64_sub_sp(
ir_node const *
const node)
336 amd64_emitf(node,
"subq %AM");
337 amd64_emitf(node,
"movq %%rsp, %D1");
340 static void emit_amd64_subpd(
ir_node const *
const node)
342 amd64_emitf(node,
"subpd %AM");
345 static void emit_amd64_subs(
ir_node const *
const node)
347 amd64_emitf(node,
"subs%MX %AM");
350 static void emit_amd64_ucomis(
ir_node const *
const node)
352 amd64_emitf(node,
"ucomis%MX %AM");
355 static void emit_amd64_xor(
ir_node const *
const node)
357 amd64_emitf(node,
"xor%M %AM");
360 static void emit_amd64_xor_0(
ir_node const *
const node)
362 amd64_emitf(node,
"xorl %3D0, %3D0");
365 static void emit_amd64_xorp(
ir_node const *
const node)
367 amd64_emitf(node,
"xorp%MX %AM");
370 static void emit_amd64_xorpd_0(
ir_node const *
const node)
372 amd64_emitf(node,
"xorpd %^D0, %^D0");
381 void amd64_register_spec_emitters(
void)
383 be_set_emitter(op_amd64_add, emit_amd64_add);
384 be_set_emitter(op_amd64_adds, emit_amd64_adds);
385 be_set_emitter(op_amd64_and, emit_amd64_and);
386 be_set_emitter(op_amd64_bsf, emit_amd64_bsf);
387 be_set_emitter(op_amd64_bsr, emit_amd64_bsr);
388 be_set_emitter(op_amd64_call, emit_amd64_call);
389 be_set_emitter(op_amd64_cmp, emit_amd64_cmp);
390 be_set_emitter(op_amd64_cmpxchg, emit_amd64_cmpxchg);
391 be_set_emitter(op_amd64_cvtsd2ss, emit_amd64_cvtsd2ss);
392 be_set_emitter(op_amd64_cvtsi2sd, emit_amd64_cvtsi2sd);
393 be_set_emitter(op_amd64_cvtsi2ss, emit_amd64_cvtsi2ss);
394 be_set_emitter(op_amd64_cvtss2sd, emit_amd64_cvtss2sd);
395 be_set_emitter(op_amd64_cvttsd2si, emit_amd64_cvttsd2si);
396 be_set_emitter(op_amd64_cvttss2si, emit_amd64_cvttss2si);
397 be_set_emitter(op_amd64_div, emit_amd64_div);
398 be_set_emitter(op_amd64_divs, emit_amd64_divs);
399 be_set_emitter(op_amd64_fadd, emit_amd64_fadd);
400 be_set_emitter(op_amd64_fchs, emit_amd64_fchs);
401 be_set_emitter(op_amd64_fdiv, emit_amd64_fdiv);
402 be_set_emitter(op_amd64_fdup, emit_amd64_fdup);
403 be_set_emitter(op_amd64_fld, emit_amd64_fld);
404 be_set_emitter(op_amd64_fld1, emit_amd64_fld1);
405 be_set_emitter(op_amd64_fldz, emit_amd64_fldz);
406 be_set_emitter(op_amd64_fmul, emit_amd64_fmul);
407 be_set_emitter(op_amd64_fpop, emit_amd64_fpop);
408 be_set_emitter(op_amd64_fst, emit_amd64_fst);
409 be_set_emitter(op_amd64_fstp, emit_amd64_fstp);
410 be_set_emitter(op_amd64_fsub, emit_amd64_fsub);
411 be_set_emitter(op_amd64_fucomi, emit_amd64_fucomi);
412 be_set_emitter(op_amd64_fxch, emit_amd64_fxch);
413 be_set_emitter(op_amd64_haddpd, emit_amd64_haddpd);
414 be_set_emitter(op_amd64_idiv, emit_amd64_idiv);
415 be_set_emitter(op_amd64_ijmp, emit_amd64_ijmp);
416 be_set_emitter(op_amd64_imul, emit_amd64_imul);
417 be_set_emitter(op_amd64_imul_1op, emit_amd64_imul_1op);
418 be_set_emitter(op_amd64_lea, emit_amd64_lea);
419 be_set_emitter(op_amd64_leave, emit_amd64_leave);
420 be_set_emitter(op_amd64_mov_imm, emit_amd64_mov_imm);
421 be_set_emitter(op_amd64_mov_store, emit_amd64_mov_store);
422 be_set_emitter(op_amd64_movd_gp_xmm, emit_amd64_movd_gp_xmm);
423 be_set_emitter(op_amd64_movd_xmm_gp, emit_amd64_movd_xmm_gp);
424 be_set_emitter(op_amd64_movdqa, emit_amd64_movdqa);
425 be_set_emitter(op_amd64_movdqu, emit_amd64_movdqu);
426 be_set_emitter(op_amd64_movdqu_store, emit_amd64_movdqu_store);
427 be_set_emitter(op_amd64_movq, emit_amd64_movq);
428 be_set_emitter(op_amd64_movs, emit_amd64_movs);
429 be_set_emitter(op_amd64_movs_store_xmm, emit_amd64_movs_store_xmm);
430 be_set_emitter(op_amd64_movs_xmm, emit_amd64_movs_xmm);
431 be_set_emitter(op_amd64_mul, emit_amd64_mul);
432 be_set_emitter(op_amd64_muls, emit_amd64_muls);
433 be_set_emitter(op_amd64_neg, emit_amd64_neg);
434 be_set_emitter(op_amd64_not, emit_amd64_not);
435 be_set_emitter(op_amd64_or, emit_amd64_or);
436 be_set_emitter(op_amd64_pop_am, emit_amd64_pop_am);
437 be_set_emitter(op_amd64_punpckldq, emit_amd64_punpckldq);
438 be_set_emitter(op_amd64_push_am, emit_amd64_push_am);
439 be_set_emitter(op_amd64_push_reg, emit_amd64_push_reg);
440 be_set_emitter(op_amd64_ret, emit_amd64_ret);
441 be_set_emitter(op_amd64_sar, emit_amd64_sar);
442 be_set_emitter(op_amd64_sbb, emit_amd64_sbb);
443 be_set_emitter(op_amd64_setcc, emit_amd64_setcc);
444 be_set_emitter(op_amd64_shl, emit_amd64_shl);
445 be_set_emitter(op_amd64_shr, emit_amd64_shr);
446 be_set_emitter(op_amd64_sub, emit_amd64_sub);
447 be_set_emitter(op_amd64_sub_sp, emit_amd64_sub_sp);
448 be_set_emitter(op_amd64_subpd, emit_amd64_subpd);
449 be_set_emitter(op_amd64_subs, emit_amd64_subs);
450 be_set_emitter(op_amd64_ucomis, emit_amd64_ucomis);
451 be_set_emitter(op_amd64_xor, emit_amd64_xor);
452 be_set_emitter(op_amd64_xor_0, emit_amd64_xor_0);
453 be_set_emitter(op_amd64_xorp, emit_amd64_xorp);
454 be_set_emitter(op_amd64_xorpd_0, emit_amd64_xorpd_0);
struct ir_node ir_node
Procedure Graph Node.