Mercurial > hg > CbC > old > device
diff mc-code-ia32.c @ 689:baa67e2e54d2
*** empty log message ***
author | kono |
---|---|
date | Sun, 07 Oct 2007 17:46:00 +0900 |
parents | 7e0c5c1f1e97 |
children | e5a498eab0f4 |
line wrap: on
line diff
--- a/mc-code-ia32.c Sat Oct 06 15:49:04 2007 +0900 +++ b/mc-code-ia32.c Sun Oct 07 17:46:00 2007 +0900 @@ -1530,6 +1530,9 @@ #define MAX_COPY_LEN 20 +/* ARG_ORDER==1 case do not allow library call in emit_copy +*/ + void emit_copy(int from,int to,int length,int offset,int value,int det) { @@ -1663,6 +1666,13 @@ #define caller_arg_offset_v(arg) (ARG_LVAR_OFFSET+(arg)*SIZE_OF_INT) +/* + Eary implementation uses pushl arg for function call. gcc + use the same arguement evaluation order. Of course, the + order is unspecified in C language, but it is better to + use same argument evaluation order. Especially for test + program. + */ #define ARG_ORDER 1 #if (ARG_ORDER==1) @@ -1784,7 +1794,10 @@ int half_register = 0; #if (ARG_ORDER==1) int save_delayed_arg = delayed_arg; + int as_save = AS_ARG; // 1st pushed argment will evaluate at the last delayed_arg = 0; +#else + const int as_save = AS_SAVE; #endif special_lvar = -1; @@ -1820,8 +1833,11 @@ } if ((e5= !simple_arg(car(e3)))) { if (complex_) { - arg = get_input_arg(caddr(complex_),AS_SAVE, + arg = get_input_arg(caddr(complex_),as_save, pnargs,preg_arg,pfreg_arg); +#if ARG_ORDER==1 + as_save = AS_SAVE; +#endif reg_arg_list = compute_complex_arg(complex_,reg_arg_list,arg); } // memorise last complex arg parameter @@ -1857,7 +1873,7 @@ } #if (ARG_ORDER==1) if (complex_) { - arg = get_input_arg(caddr(complex_),AS_SAVE, + arg = get_input_arg(caddr(complex_),as_save, pnargs,preg_arg,pfreg_arg); reg_arg_list = compute_complex_arg(complex_,reg_arg_list,arg); } @@ -1879,6 +1895,10 @@ // override by other complex arguments. But before this we have to check // complex_. + // ARG_ORDER==1 case put the last value on the top of stack. + // emit_copy/push_struct must preserve argument stack, i.e. + // no library call is allowed. + if (stargs) { #if (ARG_ORDER!=1) if (complex_) {