1 #define PUSH_POP_OPT TRUE
3 /******************************************************************************/
5 /* Group 1 : load instructions */
7 /******************************************************************************/
11 C_lol ==> "push $1(ebp)".
13 C_loe.. ==> "push ($1+$2)".
15 C_lil ==> "mov eax, $1(ebp)";
21 C_lal ==> "lea eax, $1(ebp)";
24 C_lae.. ==> "push $1+$2".
27 $1 == 0 ==> "push ebp".
29 $1 == 1 ==> "push 8(ebp)".
31 default ==> "mov ecx, $1-1";
38 $1 == 0 ==> "lea eax, 8(ebp)";
41 $1 == 1 ==> "mov eax, 8(ebp)";
45 default ==> "mov ecx, $1-1";
53 $1 == 1 ==> "pop ecx";
57 $1 == 2 ==> "pop ecx";
61 $1 == 4 ==> "pop eax";
64 default ==> "pop ebx";
69 $1 == 4 ==> "pop ecx";
73 default ==> arg_error( "C_los", $1).
75 C_los_narg ==> "pop eax";
82 C_ldl ==> "push $1+4(ebp)";
85 C_lde.. ==> "push ($1+$2+4)";
94 /******************************************************************************/
96 /* Group 2 : store instructions */
98 /******************************************************************************/
100 C_stl ==> "pop $1(ebp)".
102 C_ste.. ==> "pop ($1+$2)".
104 C_sil ==> "mov eax, $1(ebp)";
111 $1 == 1 ==> "pop ecx";
115 $1 == 2 ==> "pop eax";
119 $1 == 4 ==> "pop eax";
122 default ==> "pop ebx";
127 $1 == 4 ==> "pop ecx";
131 default ==> arg_error( "C_sts", $1).
133 C_sts_narg ==> "pop eax";
140 C_sdl ==> "pop $1(ebp)";
143 C_sde.. ==> "pop ($1+$2)";
150 /******************************************************************************/
152 /* Group 3 : integer arithmetic */
154 /******************************************************************************/
157 $1 == 4 ==> "pop eax";
162 default ==> arg_error("C_adi", $1).
164 C_adi_narg ==> "pop ecx";
170 $1 == 4 ==> "pop ecx";
175 default ==> arg_error("C_sbi", $1).
177 C_sbi_narg ==> "pop ecx";
183 $1 == 4 ==> "pop eax";
188 default ==> arg_error( "C_mli", $1).
190 C_mli_narg ==> "pop eax";
194 $1 == 4 ==> "pop ecx";
200 default ==> arg_error( "C_dvi", $1).
202 C_dvi_narg ==> "pop eax";
206 $1 == 4 ==> "pop ebx";
212 default ==> arg_error( "C_rmi", $1).
214 C_rmi_narg ==> "pop eax";
218 $1 == 4 ==> "pop eax";
222 default ==> "mov eax, $1";
225 C_ngi_narg ==> "pop eax";
229 $1 == 4 ==> "pop ecx";
234 default ==> "mov eax, $1";
237 C_sli_narg ==> "pop eax";
241 $1 == 4 ==> "pop ecx";
246 default ==> "mov eax, $1";
249 C_sri_narg ==> "pop eax";
252 /******************************************************************************/
254 /* Group 4 : Unsigned arithmetic */
256 /******************************************************************************/
258 C_adu ==> C_adi( $1).
260 C_adu_narg ==> C_adi_narg().
262 C_sbu ==> C_sbi( $1).
264 C_sbu_narg ==> C_sbi_narg().
266 C_mlu ==> C_mli( $1).
268 C_mlu_narg ==> C_mli_narg().
271 $1 == 4 ==> "pop ebx";
277 default ==> "mov eax, $1";
280 C_dvu_narg ==> "pop eax";
284 $1 == 4 ==> "pop ebx";
290 default ==> "mov eax, $1";
293 C_rmu_narg ==> "pop eax";
296 C_slu ==> C_sli( $1).
298 C_slu_narg ==> C_sli_narg().
301 $1 == 4 ==> "pop ecx";
306 default ==> arg_error( "C_sru", $1).
308 /******************************************************************************/
310 /* Group 5 : Floating point arithmetic */
312 /******************************************************************************/
315 $1 == 4 ==> "call .adf4";
317 $1 == 8 ==> "call .adf8";
319 default ==> arg_error("C_adf", $1).
322 $1 == 4 ==> "call .sbf4";
324 $1 == 8 ==> "call .sbf8";
326 default ==> arg_error("C_sbf", $1).
329 $1 == 4 ==> "call .mlf4";
331 $1 == 8 ==> "call .mlf8";
333 default ==> arg_error("C_mlf", $1).
336 $1 == 4 ==> "call .dvf4";
338 $1 == 8 ==> "call .dvf8";
340 default ==> arg_error("C_dvf", $1).
343 $1 == 4 ==> "call .ngf4".
344 $1 == 8 ==> "call .ngf8".
345 default ==> arg_error("C_ngf", $1).
348 $1 == 4 ==> C_lor((arith)1);
351 $1 == 8 ==> C_lor((arith)1);
354 default ==> arg_error("C_fif", $1).
357 $1 == 4 ==> "mov eax,esp";
361 $1 == 8 ==> "mov eax,esp";
365 default ==> arg_error("C_fef", $1).
367 /******************************************************************************/
369 /* Group 6 : Pointer arithmetic */
371 /******************************************************************************/
377 $1 == 1 ==> "pop eax";
381 $1 == -1 ==> "pop eax";
385 default ==> "pop eax";
390 $1 == 4 ==> "pop eax";
395 default ==> arg_error( "C_ads", $1).
397 C_ads_narg ==> "pop eax";
406 $1 == 4 ==> "pop ebx";
411 default ==> arg_error( "C_sbs", $1).
413 C_sbs_narg ==> "pop eax";
421 /******************************************************************************/
423 /* Group 7 : Increment/decrement/zero */
425 /******************************************************************************/
431 C_inl ==> "inc $1(ebp)".
433 C_ine.. ==> "inc ($1+$2)".
439 C_del ==> "dec $1(ebp)".
441 C_dee.. ==> "dec ($1+$2)".
443 C_zrl ==> "mov $1(ebp), 0".
445 C_zre.. ==> "mov ($1+$2), 0".
448 $1 == 4 ==> "xor eax, eax";
451 $1 == 8 ==> "xor eax, eax";
455 $1 % 4 == 0 ==> "mov ecx, $1/4";
460 default ==> arg_error( "C_zer", $1).
464 C_zer_narg ==> "pop ecx";
470 /******************************************************************************/
472 /* Group 8 : Convert */
474 /******************************************************************************/
507 C_cfi ==> "call .cfi";
515 C_cfu ==> "call .cfu";
539 /******************************************************************************/
541 /* Group 9 : Logical */
543 /******************************************************************************/
546 $1 == 4 ==> "pop eax";
551 default ==> "mov ecx, $1";
554 C_and_narg ==> "pop ecx";
558 $1 == 4 ==> "pop eax";
563 default ==> "mov ecx, $1";
566 C_ior_narg ==> "pop ecx";
570 $1 == 4 ==> "pop eax";
575 default ==> "mov ecx, $1";
578 C_xor_narg ==> "pop ecx";
582 $1 == 4 ==> "pop eax";
586 default ==> "mov ecx, $1";
589 C_com_narg ==> "pop ecx";
593 $1 == 4 ==> "pop ecx";
598 default ==> "mov ecx, $1";
601 C_rol_narg ==> "pop ecx";
605 $1 == 4 ==> "pop ecx";
610 default ==> "mov ecx, $1";
613 C_ror_narg ==> "pop ecx";
616 /******************************************************************************/
618 /* Group 10 : Sets */
620 /******************************************************************************/
623 $1 == 4 ==> "pop ecx";
629 default ==> "pop eax";
634 C_inn_narg ==> "pop ecx";
640 $1 == 4 ==> "pop ecx";
645 default ==> "pop eax";
649 C_set_narg ==> "pop ecx";
653 /******************************************************************************/
655 /* Group 11 : Array */
657 /******************************************************************************/
660 $1 == 4 ==> "pop ebx";
664 default ==> arg_error( "C_lar", $1).
666 C_lar_narg ==> "call .ilar".
669 $1 == 4 ==> "pop ebx";
673 default ==> arg_error( "C_sar", $1).
675 C_sar_narg ==> "call .isar".
678 $1 == 4 ==> "pop ebx";
686 default ==> arg_error( "C_aar", $1).
688 C_aar_narg ==> "call .iaar";
691 /******************************************************************************/
693 /* Group 12 : Compare */
695 /******************************************************************************/
698 $1 == 4 ==> "pop ebx";
709 default ==> arg_error( "C_cmi", $1).
714 default ==> arg_error( "C_cmu", $1).
717 $1 == 4 ==> C_sbi( (arith) 4).
719 default ==> "mov ecx, $1";
723 C_cms_narg ==> "pop ecx";
739 $1 == 4 ==> "call .cmf4";
743 $1 == 8 ==> "call .cmf8";
746 default ==> arg_error("C_cmf", $1).
790 /******************************************************************************/
792 /* Group 13 : Branch */
794 /******************************************************************************/
852 /******************************************************************************/
854 /* Group 14 : Procedure call instructions */
856 /******************************************************************************/
864 $1 == 4 ==> "push eax".
866 $1 == 8 ==> "push edx";
869 default ==> arg_error( "C_lfr", $1).
875 $1 == 4 ==> "pop eax";
879 $1 == 8 ==> "pop eax";
884 default ==> arg_error( "C_ret", $1).
886 /******************************************************************************/
888 /* Group 15 : Miscellaneous instructions */
890 /******************************************************************************/
893 $1 == 4 ==> "pop ebx".
895 $1 == 8 ==> "pop ebx";
898 $1 == -4 ==> "push eax".
900 $1 == -8 ==> "push eax";
903 default ==> "add esp, $1".
906 $1 == 4 ==> "pop eax";
909 default ==> arg_error( "C_ass", $1).
911 C_ass_narg ==> "pop eax";
918 $1 % 4 == 0 ==> "mov ecx, $1/4";
921 default ==> arg_error( "C_blm", $1).
924 $1 == 4 ==> "pop ecx";
928 default ==> arg_error( "C_bls", $1).
930 C_bls_narg ==> "pop eax";
938 $1 == 4 ==> "pop ebx";
942 default ==> arg_error( "C_csa", $1).
944 C_csa_narg ==> "pop eax";
952 $1 == 4 ==> "pop ebx";
956 default ==> arg_error( "C_csb", $1).
958 C_csb_narg ==> "pop eax";
965 C_dch ==> "mov ebp, (ebp)".
968 $1 == 4 ==> "pop eax";
972 $1 == 8 ==> "pop eax";
979 default ==> "mov ecx, $1";
983 $1 == 4 ==> "pop ecx";
986 default ==> arg_error( "C_dus", $1).
988 C_dus_narg ==> "pop eax";
994 C_exg ==> "mov ecx, $1";
997 C_exg_narg ==> "pop ecx";
1000 C_fil.. ==> "mov (hol0+4), $1+$2".
1002 C_gto.. ==> "mov ebx, $1+$2";
1005 C_lim ==> "push (.ignmask)".
1007 C_lin ==> "mov (hol0), $1".
1009 C_lni ==> "inc (hol0)".
1012 $1 == 0 ==> "push ebp".
1014 $1 == 1 ==> "mov eax, esp";
1017 $1 == 2 ==> "push (.reghp)".
1019 default ==> arg_error( "C_lor", $1).
1021 C_lpb ==> "pop eax";
1025 C_mon ==> "pop eax";
1031 $1 == 4 ==> "pop ebx";
1036 default ==> arg_error( "C_rck", $1).
1038 C_rck_narg ==> "pop eax";
1047 C_rtt ==> C_ret( (arith) 0).
1049 C_sig ==> "pop eax";
1050 "xchg (.trppc), eax";
1053 C_sim ==> "pop (.ignmask)".
1056 $1 == 0 ==> "pop ebp".
1058 $1 == 1 ==> "pop esp".
1060 $1 == 2 ==> "pop (.reghp)".
1062 default ==> arg_error( "C_str", $1).
1064 C_trp ==> "pop eax";
1067 /******************************************************************************/
1069 /* Storage-routines */
1071 /******************************************************************************/
1075 $2 == 1 ==> gen1( (ONE_BYTE) atoi( $1)).
1076 $2 == 2 ==> gen2( (TWO_BYTES) atoi( $1)).
1077 $2 == 4 ==> gen4( (FOUR_BYTES) atol( $1)).
1078 default ==> arg_error( "..icon", $1).
1081 $2 == 1 ==> gen1( (ONE_BYTE) atoi( $1)).
1082 $2 == 2 ==> gen2( (TWO_BYTES) atoi( $1)).
1083 $2 == 4 ==> gen4( (FOUR_BYTES) atol( $1)).
1084 default ==> arg_error( "..ucon", $1).
1086 ..fcon ==> con_float($1, $2).
1088 /******************************************************************************/
1090 /* Extra-routines */
1092 /******************************************************************************/
1096 C_df_ilb ==> clean_push_buf();
1097 symbol_definition( $1);
1098 set_local_visible( $1).
1101 C_jump ==> "jmp $1".
1110 C_db_sline ==> "call ___u_LiB".