Mercurial > hg > CbC > old > device
changeset 233:2208a18f3799 longlong-done-except-float-rexp
*** empty log message ***
author | kono |
---|---|
date | Thu, 29 Apr 2004 13:30:04 +0900 |
parents | 8a23c20ac92d |
children | eccea7c904ee |
files | mc-code-powerpc.c mc-codegen.c mc-parse.c test/long.c |
diffstat | 4 files changed, 57 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-code-powerpc.c Thu Apr 29 03:47:07 2004 +0900 +++ b/mc-code-powerpc.c Thu Apr 29 13:30:04 2004 +0900 @@ -136,7 +136,7 @@ static int use_int0() { int i = creg; - if (!is_int_reg(i)) { + if (!i||!ireg||!is_int_reg(i)) { if (lreg) { free_register(lreg); lreg = 0; } if (!ireg) ireg = get_register(); // else if (ireg!=i) free_register(i); @@ -1637,6 +1637,43 @@ return ARG_LVAR_OFFSET+arg*size_of_int; } +void +use_input_reg(int reg,int mode) +{ + if (is_int_reg(reg)) { + if (ireg&® == ireg) { + if (creg==ireg) creg = 0; + ireg = 0; + } + if (lreg) { + if (regv_l(lreg)==reg) { + regs[lreg]=0; + if (regv_h(lreg)>reg&®s[regv_h(lreg)]==USING_REG) { + free_register(regv_h(lreg)); + } + if (creg==lreg) creg = 0; + lreg = 0; + } else if (regv_h(lreg)==reg) { + regs[lreg]=0; + if (regv_h(lreg)>reg&®s[regv_l(lreg)]==USING_REG) { + free_register(regv_l(lreg)); + } + if (creg==lreg) creg = 0; + lreg = 0; + } + } + } else if (is_longlong_reg(reg)) { + use_input_reg(regv_h(reg),0); + use_input_reg(regv_l(reg),0); + } else if (is_float_reg(reg)) { + if (freg&® == freg) { + if (creg==freg) creg = 0; + freg = 0; + } + } + if (mode) use_reg(reg); +} + int function(int e1) { @@ -1697,9 +1734,10 @@ } else { arg = get_input_register_var(reg_arg,0,0); } - if (car(arg)==REGISTER) use_reg(cadr(arg)); - /* protect from input register free */ reg_arg_list = list2(arg,reg_arg_list); + /* protect from input register free */ + if (car(arg)==REGISTER) + use_input_reg(cadr(arg),1); g_expr_u(assign_expr0(arg,e4,t,t)); nargs ++ ; reg_arg++; continue; @@ -1714,17 +1752,17 @@ assign_expr0(r0=get_input_register_var(reg_arg,0,0), arg,INT,INT), arg_assign); - use_reg(cadr(r0)); + use_input_reg(cadr(r0),1); } else if (!simple_args(e3) && cadr(e3)) { arg = get_lregister_var(0); arg_assign = list2( assign_expr0(r0=get_input_lregister_var(reg_arg,0,0), arg,t,t), arg_assign); - use_reg(cadr(r0)); + use_input_reg(cadr(r0),1); } else { arg = get_input_lregister_var(reg_arg,0,0); - use_reg(cadr(arg)); + use_input_reg(cadr(arg),1); } reg_arg_list = list2(arg,reg_arg_list); g_expr_u(assign_expr0(arg,e4,t,t)); @@ -1754,8 +1792,8 @@ clear_ptr_cache_reg(list2(REGISTER,r1)); /* else if (regs[r1]) error(-1); */ r1=get_input_register_var_1(reg_arg+1,0,0); - use_reg(cadr(r0)); /* protect from input register free */ - use_reg(cadr(r1)); /* protect from input register free */ + use_input_reg(cadr(r0),1); /* protect from input register free */ + use_input_reg(cadr(r1),1); /* protect from input register free */ reg_arg_list = list2(r0,reg_arg_list); reg_arg_list = list2(r1,reg_arg_list); arg_assign = list2( assign_expr0(r0,e5,INT,INT), arg_assign); @@ -1786,9 +1824,9 @@ } else { arg = get_input_dregister_var(freg_arg,0,0,1); } + reg_arg_list = list2(arg,reg_arg_list); if (car(arg)==DREGISTER) - use_reg(cadr(arg)); /* protect from input register free */ - reg_arg_list = list2(arg,reg_arg_list); + use_input_reg(cadr(arg),1); /* protect from input register free */ g_expr_u(assign_expr0(arg,e4,t,t)); /* XXX */ freg_arg++; nargs += size(t)/size_of_int; @@ -1991,8 +2029,10 @@ void code_assign(int e2,int byte,int creg) { - char *drn=register_name(e2); + char *drn; char *crn; + use_int(e2); + drn=register_name(e2); use_int(creg); crn=register_name(creg);
--- a/mc-codegen.c Thu Apr 29 03:47:07 2004 +0900 +++ b/mc-codegen.c Thu Apr 29 13:30:04 2004 +0900 @@ -1168,7 +1168,7 @@ case REGISTER: code_assign_register(cadr(e2),byte,reg); return; } g_expr(e2); - code_assign(reg,byte,USE_CREG); + code_assign(USE_CREG,byte,reg); return; } /* e2 is register now */
--- a/mc-parse.c Thu Apr 29 03:47:07 2004 +0900 +++ b/mc-parse.c Thu Apr 29 13:30:04 2004 +0900 @@ -603,10 +603,13 @@ if(sym==LONG) { getsym(0); t=LONGLONG; + if (sym==INT) getsym(0); + else if (sym==UNSIGNED) { t=ULONGLONG; getsym(0); break; } } else if(sym==DOUBLE) { getsym(0); t=DOUBLE; - } else if(sym==INT) getsym(0); + } else if(sym==INT) { getsym(0); + } else if(sym==UNSIGNED) { t=UNSIGNED; getsym(0); } break; default: if(sym==IDENT) {