1 /******************************************************************************/
3 /* Group 1 : Load instructions */
5 /******************************************************************************/
10 C_ldc ==> "movq ~$1, -(sp)".
13 $1 < 0 ==> "pushl $1(fp)".
14 default ==> "pushl $1+4(ap)".
16 C_loe.. ==> "pushl $1 + $2".
19 $1 < 0 ==> "movl $1(fp), r0";
21 default ==> "movl $1+4(ap), r0";
24 C_lof ==> "movl (sp)+, r0";
28 $1 < 0 ==> "pushal $1(fp)".
29 default ==> "pushal $1+4(ap)".
31 C_lae.. ==> "pushal $1 + $2".
34 $1 == 0 ==> "pushl fp".
35 $1 == 1 ==> "pushl 4(ap)".
36 default ==> "movl ~$1, r0";
41 $1 == 0 ==> "addl3 ~4, ap, -(sp)".
42 $1 == 1 ==> "movl 4(ap), r0";
45 default ==> "movl ~$1, r0";
50 $1 == 1 ==> "movl (sp)+, r0";
53 $1 == 2 ==> "movl (sp)+, r0";
56 $1 == 4 ==> "movl (sp)+, r0";
58 $1 == 8 ==> "movl (sp)+, r0";
60 $1 % 4 == 0 ==> "movl (sp)+, r0";
66 default ==> arg_error( "loi", $1).
69 C_los ==> "movl ~$1, r0";
73 C_los_narg ==> "movl (sp)+, r0";
77 $1 < 0 ==> "movq $1(fp), -(sp)".
78 default ==> "movq $1+4(ap), -(sp)".
80 C_lde.. ==> "movq $1 + $2, -(sp)".
82 C_ldf ==> "movl (sp)+, r0";
85 C_lpi ==> "pushal $1".
88 /******************************************************************************/
90 /* Group 2 : Store instructions */
92 /******************************************************************************/
95 $1 < 0 ==> "movl (sp)+, $1(fp)".
96 default ==> "movl (sp)+, $1+4(ap)".
98 C_ste.. ==> "movl (sp)+, $1 + $2".
101 $1 < 0 ==> "movl $1(fp) , r0";
103 default ==> "movl $1+4(ap), r0";
106 C_stf ==> "movl (sp)+, r0";
107 "movl (sp)+, $1(r0)".
111 $1 == 1 ==> "movl (sp)+, r0";
114 $1 == 2 ==> "movl (sp)+, r0";
117 $1 == 4 ==> "movl (sp)+, r0";
119 $1 == 8 ==> "movl (sp)+, r0";
121 $1 % 4 == 0 ==> "movl (sp)+, r0";
126 default ==> arg_error( "sti", (arith) $1).
129 C_sts ==> "movl ~$1, r0";
132 C_sts_narg ==> "movl (sp)+, r0";
136 $1 < 0 ==> "movq (sp)+, $1(fp)".
137 default ==> "movq (sp)+, $1+4(ap)".
139 C_sde.. ==> "movq (sp)+, $1 + $2".
141 C_sdf ==> "movl (sp)+, r0";
142 "movq (sp)+, $1(r0)".
144 /******************************************************************************/
146 /* Group 3 : Integer arithmetic */
148 /******************************************************************************/
151 $1 == 4 ==> "addl2 (sp)+, (sp)".
152 default ==> arg_error( "adi", $1).
155 $1 == 4 ==> "subl2 (sp)+, (sp)".
156 default ==> arg_error( "sbi", $1).
159 $1 == 4 ==> "mull2 (sp)+, (sp)".
160 default ==> arg_error( "mli", $1).
163 $1 == 4 ==> "divl2 (sp)+, (sp)".
164 default ==> arg_error( "dvi", $1).
167 $1 == 4 ==> "divl3 (sp), 4(sp), r0";
170 default ==> arg_error( "rmi", $1).
173 $1 == 4 ==> "mnegl (sp), (sp)".
174 default ==> arg_error( "ngi", $1).
178 $1 == 4 ==> "clrl r0";
180 "ashl r0, (sp), (sp)".
181 default ==> arg_error( "sli", $1).
184 $1 == 4 ==> "mnegl (sp)+, r0";
187 "ashl r1, (sp), (sp)".
188 default ==> arg_error( "sri", $1).
191 /******************************************************************************/
193 /* Group 4 : Unsigned arithmetic */
195 /******************************************************************************/
205 $1 == 4 ==> "jsb .dvu4";
207 default ==> arg_error( "dvu", $1).
210 $1 == 4 ==> "jsb .rmu4";
212 default ==> arg_error( "rmu", $1).
216 C_sru ==> "movl ~$1, r0";
219 /******************************************************************************/
221 /* Group 5 : Floating point arithmetic */
223 /******************************************************************************/
226 $1 == 4 ==> "addf2 (sp)+, (sp)".
227 $1 == 8 ==> "addd2 (sp)+, (sp)".
228 default ==> arg_error( "adf", $1).
231 $1 == 4 ==> "subf2 (sp)+, (sp)".
232 $1 == 8 ==> "subd2 (sp)+, (sp)".
233 default ==> arg_error( "sbf", $1).
236 $1 == 4 ==> "mulf2 (sp)+, (sp)".
237 $1 == 8 ==> "muld2 (sp)+, (sp)".
238 default ==> arg_error( "mlf", $1).
241 $1 == 4 ==> "divf2 (sp)+, (sp)".
242 $1 == 8 ==> "divd2 (sp)+, (sp)".
243 default ==> arg_error( "dvf", $1).
246 $1 == 4 ==> "mnegf (sp), (sp)".
247 $1 == 8 ==> "mnegd (sp), (sp)".
248 default ==> arg_error( "ngf", $1).
250 C_fif ==> "movl ~$1,r0";
253 C_fef ==> "movl ~$1,r0";
256 /******************************************************************************/
258 /* Group 6 : Pointer arithmetic */
260 /******************************************************************************/
262 C_adp ==> "addl2 ~$1, (sp)".
265 $1 == 4 ==> "addl2 (sp)+, (sp)".
266 default ==> arg_error( "ads", $1).
269 $1 == 4 ==> "subl2 (sp)+, (sp)".
270 default ==> arg_error( "sbs", $1).
272 /******************************************************************************/
274 /* Group 7 : Increment/decrement/zero */
276 /******************************************************************************/
278 C_inc ==> "incl (sp)".
281 $1 < 0 ==> "incl $1(fp)".
282 default ==> "incl $1+4(ap)".
284 C_ine.. ==> "incl $1 + $2".
286 C_dec ==> "decl (sp)".
289 $1 < 0 ==> "decl $1(fp)".
290 default ==> "decl $1+4(ap)".
292 C_dee.. ==> "decl $1 + $2".
295 $1 < 0 ==> "clrl $1(fp)".
296 default ==> "clrl $1+4(ap)".
298 C_zre.. ==> "clrl $1 + $2".
301 $1 == 4 ==> "clrl -(sp)".
302 $1 == 8 ==> "clrq -(sp)".
303 default ==> arg_error( "zrf", $1).
306 $1 == 4 ==> "clrl -(sp)".
307 $1 == 8 ==> "clrq -(sp)".
308 default ==> "movl ~$1/4, r0";
313 /******************************************************************************/
315 /* Group 8 : Convert */
317 /******************************************************************************/
319 C_cii ==> "jsb .cii".
323 C_cfi ==> "jsb .cfi".
325 C_cif ==> "jsb .cif".
327 C_cuf ==> "jsb .cuf".
329 C_cff ==> "jsb .cff".
333 C_cuu ==> "addl2 ~8,sp".
335 C_cfu ==> "jsb .cfu".
337 /******************************************************************************/
339 /* Group 9 : Logical */
341 /******************************************************************************/
344 $1 == 4 ==> "mcoml (sp), (sp)";
346 default ==> "movl ~$1/4, r0";
350 "bicl2 (sp)+, (r1)+";
354 $1 == 4 ==> "bisl2 (sp)+, (sp)".
355 default ==> "movl ~$1/4, r0";
358 "bisl2 (sp)+, (r1)+";
362 $1 == 4 ==> "xorl2 (sp)+, (sp)".
363 default ==> "movl ~$1/4, r0";
366 "xorl2 (sp)+, (r1)+";
370 $1 == 4 ==> "mcoml (sp), (sp)".
371 default ==> "movl ~$1, r0";
375 $1 == 4 ==> "clrl r0";
377 "rotl r0, (sp), (sp)".
378 default ==> arg_error( "rol", $1).
381 $1 == 4 ==> "mnegl (sp)+, r0";
384 "rotl r1, (sp), (sp)".
385 default ==> arg_error( "rol", $1).
387 /******************************************************************************/
389 /* Group 10 : Sets */
391 /******************************************************************************/
394 $1 == 4 ==> "mnegl (sp)+, r0";
397 "ashl r1, (sp), (sp)";
399 default ==> "movl ~$1, r0";
403 C_inn_narg ==> "movl (sp)+, r0";
408 $1 == 4 ==> "clrl r0";
410 "ashl r0, ~1, -(sp)".
411 default ==> "movl ~$1, r0";
414 C_set_narg ==> "movl (sp)+, r0";
417 /******************************************************************************/
419 /* Group 11 : Array */
421 /******************************************************************************/
424 $1 == 4 ==> "jsb .lar4".
425 default ==> "movl ~$1, r0";
428 C_lar_narg ==> "movl (sp)+, r0";
432 $1 == 4 ==> "jsb .sar4".
433 default ==> "movl ~$1, r0";
436 C_sar_narg ==> "movl (sp)+, r0";
440 $1 == 4 ==> "jsb .aar4";
442 default ==> "movl ~$1, r0";
446 C_aar_narg ==> "movl (sp)+, r0";
450 /******************************************************************************/
452 /* Group 12 : Compare */
454 /******************************************************************************/
457 $1 == 4 ==> /* bug : "subl2 (sp)+, (sp)". */
466 default ==> arg_error( "cmi", $1).
470 $1 == 4 ==> /* bug : "subl2 (sp)+, (sp)". */
479 default ==> "movl ~$1, r0";
483 C_cmu_narg ==> "movl (sp)+, r0";
487 C_cms ==> "movl ~$1, r0";
491 C_cms_narg ==> "movl (sp)+, r0";
495 C_cmp ==> /* bug : "subl2 (sp)+, (sp)". */
521 default ==> arg_error("cmf", $1).
523 C_tlt ==> "movl (sp)+, r0";
530 C_tle ==> "movl (sp)+, r0";
537 C_teq ==> "movl (sp)+, r0";
544 C_tne ==> "movl (sp)+, r0";
551 C_tge ==> "movl (sp)+, r0";
558 C_tgt ==> "movl (sp)+, r0";
565 /******************************************************************************/
567 /* Group 13 : Branch */
569 /******************************************************************************/
573 C_blt ==> "movl (sp)+, r0";
577 C_ble ==> "movl (sp)+, r0";
581 C_beq ==> "movl (sp)+, r0";
585 C_bne ==> "movl (sp)+, r0";
589 C_bge ==> "movl (sp)+, r0";
593 C_bgt ==> "movl (sp)+, r0";
597 C_zlt ==> "tstl (sp)+";
600 C_zle ==> "tstl (sp)+";
603 C_zeq ==> "tstl (sp)+";
606 C_zne ==> "tstl (sp)+";
609 C_zge ==> "tstl (sp)+";
612 C_zgt ==> "tstl (sp)+";
616 /******************************************************************************/
618 /* Group 14 : Procedure call instructions */
620 /******************************************************************************/
622 C_cai ==> "movl (sp)+, r0";
625 C_cal ==> "calls ~0, $1".
628 $1 == 4 ==> "pushl r0".
629 $1 == 8 ==> "movq r0, -(sp)".
630 default ==> arg_error( "lfr", $1).
634 $1 == 4 ==> "movl (sp)+, r0";
636 $1 == 8 ==> "movq (sp)+, r0";
638 default ==> arg_error( "ret", $1).
640 /******************************************************************************/
642 /* Group 15 : Miscellaneous instructions */
644 /******************************************************************************/
646 C_asp ==> "addl2 ~$1, sp".
649 $1 == 4 ==> "addl2 (sp)+, sp".
650 default ==> "movl ~$1, r2";
653 C_ass_narg ==> "movl (sp)+, r2";
657 $1 == 4 ==> "movl (sp)+, r0";
660 $1 == 8 ==> "movl (sp)+, r0";
663 default ==> "movl (sp)+, r0";
671 $1 == 4 ==> "movl ~4, r0";
673 default ==> arg_error( "bls", $1).
677 $1 == 4 ==> "jmp .csa4".
678 default ==> "movl ~$1, r0";
682 $1 == 4 ==> "jmp .csb4".
683 default ==> "movl ~$1, r0";
686 C_dch ==> "movl (sp)+, r0";
690 $1 == 4 ==> "pushl (sp)".
691 $1 == 8 ==> "movq (sp), -(sp)".
692 default ==> "movl ~$1/4, r0";
699 $1 == 4 ==> "movl (sp)+, r0";
705 default ==> arg_error( "dus", $1).
707 C_exg ==> "movl ~$1, r0";
710 C_fil.. ==> "moval $1 + $2, hol0 + 4".
712 C_gto.. ==> "pushal $1+$2";
715 C_lim ==> "pushl .trpim".
717 C_lin ==> "movl ~$1, hol0".
719 C_lni ==> "incl hol0".
722 $1 == 0 ==> "pushl fp".
723 $1 == 1 ==> "pushl sp".
724 $1 == 2 ==> "pushl .reghp".
725 default ==> arg_error( "lor", $1).
727 C_lpb ==> "movl (sp)+, r0";
731 C_mon ==> "jsb .mon".
736 $1 == 4 ==> "jsb .rck4".
737 default ==> "movl ~$1, r0";
740 C_rck_narg ==> "movl (sp)+, r0";
745 C_sig ==> "jsb .sig".
747 C_sim ==> "jsb .sim".
750 $1 == 0 ==> "movl (sp)+, fp".
751 $1 == 1 ==> "movl (sp)+, sp".
752 $1 == 2 ==> "jsb .strhp".
753 default ==> arg_error( "str", $1).
755 C_trp ==> "jsb .trp".
757 /*****************************************************************************/
759 ..icon $2 == 1 ==> gen1( (char) atoi( $1)).
760 $2 == 2 ==> gen2( (short) atoi( $1)).
761 $2 == 4 ==> gen4( (long) atol( $1)).
762 default ==> arg_error( "icon", $2).
763 ..ucon $2 == 1 ==> gen1( (char) atoi( $1)).
764 $2 == 2 ==> gen2( (short) atoi( $1)).
765 $2 == 4 ==> gen4( (long) atol( $1)).
766 default ==> arg_error( "icon", $2).
767 ..fcon ==> con_float($1, $2).
769 /*****************************************************************************/
771 C_prolog ==> text2( 0x0).
777 $1 == 4 ==> "clrq -(sp)".
778 $1 == 8 ==> "clrq -(sp)".
779 default ==> "subl2 ~$1, sp".
781 C_db_sline ==> "calls ~0, ___u_LiB".