Mercurial > hg > CbC > old > device
changeset 867:33d00c6b2a7e
In ARG_ORDER==NORMAL, max_freg computation is wrong in i64
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 01 Apr 2014 01:57:36 +0900 |
parents | 043b9bd024a1 |
children | c55337499f96 |
files | mc-code-i64.c mc-code-ia32.c |
diffstat | 2 files changed, 23 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-code-i64.c Mon Mar 31 21:11:16 2014 +0900 +++ b/mc-code-i64.c Tue Apr 01 01:57:36 2014 +0900 @@ -2491,6 +2491,7 @@ // emit_copy/push_struct must preserve argument stack, i.e. // no library call is allowed. + int max_freg = 0; if (stargs) { #if (ARG_ORDER!=1) if (complex_) { @@ -2513,13 +2514,17 @@ } else { // last complex argument can use input register if (complex_) { - arg = get_input_arg(caddr(complex_),AS_ARG,pnargs,preg_arg,pfreg_arg) -; + arg = get_input_arg(caddr(complex_),AS_ARG,pnargs,preg_arg,pfreg_arg) ; reg_arg_list = compute_complex_arg(complex_,reg_arg_list,arg); - car(complex_) = 0; // done. - - + if (car(arg)==LREGISTER) { + set_ireg(cadr(arg),0); + use_input_reg(cadr(arg),1); + } else if (car(arg)==DREGISTER||car(arg)==FREGISTER) { + max_freg ++; + set_freg(cadr(arg),0); + use_input_reg(cadr(arg),1); /* protect from input register free */ + } } #endif } @@ -2537,7 +2542,6 @@ car(e3)=0; // done } nargs = reg_arg = freg_arg = 0; - int max_freg = 0; for (e3 = e1; e3; increment_function_arg(e3,&nargs,®_arg,&freg_arg), e3 = cadr(e3)) {
--- a/mc-code-ia32.c Mon Mar 31 21:11:16 2014 +0900 +++ b/mc-code-ia32.c Tue Apr 01 01:57:36 2014 +0900 @@ -250,7 +250,19 @@ #define ENDIAN_L 0 #define ENDIAN_D 0 -int eval_order = REVERSE; +/* + 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. + */ +#ifdef __llvm__ +#define ARG_ORDER NORMAL +#else +#define ARG_ORDER REVERSE +#endif +int eval_order = ARG_ORDER; #define TEXT_EMIT_MODE 0 #define DATA_EMIT_MODE 1 @@ -1702,14 +1714,6 @@ #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) static int delayed_arg;