Mercurial > hg > CbC > old > device
changeset 208:70b1da1864f6
*** empty log message ***
author | kono |
---|---|
date | Wed, 21 Apr 2004 16:39:15 +0900 |
parents | 8a3516f6eb66 |
children | 7bfc1435cdc6 |
files | .gdbinit Changes mc-code-powerpc.c |
diffstat | 3 files changed, 68 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/.gdbinit Wed Apr 21 14:26:47 2004 +0900 +++ b/.gdbinit Wed Apr 21 16:39:15 2004 +0900 @@ -1,5 +1,6 @@ tb main -run -s -ob00.s mc-parse.c +run -s -ob00.s test/int.c +# run -s -ob00.s mc-parse.c # run -s -Itest/ test/code-gen-all.c define regs printf "pc =%08x lr =%08x r0 =%08x r1 =%08x r3= %08x r4= %08x\n",$pc,$lr,$r0,$r1,$r3,$r4
--- a/Changes Wed Apr 21 14:26:47 2004 +0900 +++ b/Changes Wed Apr 21 16:39:15 2004 +0900 @@ -3935,3 +3935,5 @@ long long register で、regsと regv をそろえる 必要はない。regs は普通に用意して、regv ではなくて、 lreg_hとlreg_lみたいな感じにする。 + +うーん、register full かぁ。何おかしくしちゃったかなぁ。
--- a/mc-code-powerpc.c Wed Apr 21 14:26:47 2004 +0900 +++ b/mc-code-powerpc.c Wed Apr 21 16:39:15 2004 +0900 @@ -130,6 +130,7 @@ if (!is_int_reg(i)) { if (lreg) { free_register(lreg); lreg = 0; } if (!ireg) ireg = get_register(); + else if (ireg!=i) free_register(i); i = ireg; } if (!regs[i]) regs[i]=USING_REG; @@ -140,6 +141,7 @@ if (!is_float_reg(i)) { if (lreg) { free_register(lreg); lreg = 0; } if (!freg) freg = get_dregister(0); + else if (freg!=i) free_register(i); i = freg; } if (!regs[i]) regs[i]=USING_REG; @@ -150,6 +152,7 @@ if (!is_float_reg(i)) { if (lreg) { free_register(lreg); lreg = 0; } if (!freg) freg = get_dregister(1); + else if (freg!=i) free_register(i); i = freg; } if (!regs[i]) regs[i]=USING_REG; @@ -159,6 +162,7 @@ int use_longlong(int i) { if (!is_longlong_reg(i)) { if (!lreg) lreg = get_lregister(); + else if (lreg!=i) free_register(i); i = lreg; } if (!regs[i]) regs[i]=USING_REG; @@ -441,8 +445,9 @@ code_save_input_registers(); } + int -get_register(void) +get_register0(void) { /* 使われていないレジスタを調べる */ int i,reg; for(i=MAX_TMP_REG;i>MIN_TMP_REG;i--) { @@ -492,6 +497,14 @@ error(HPERR); return creg; } +int +get_register(void) +{ + int i = get_register0(); + printf("# get_register %d\n",i); + return i; +} + int pop_register(void) { /* レジスタから値を取り出す */ @@ -500,7 +513,7 @@ #if FLOAT_CODE int -get_dregister(int d) +get_dregister0(int d) { /* 使われていないレジスタを調べる */ int i,reg; for(i=MAX_TMP_FREG+FREG_OFFSET;i>MIN_TMP_FREG+FREG_OFFSET;i--) { @@ -529,6 +542,15 @@ error(REG_ERR); return freg; } + +int +get_dregister(int d) +{ + int i = get_dregister0(d); +printf("# get_dregister %d\n",i); + return i; +} + int pop_fregister(void) { /* レジスタから値を取り出す */ @@ -542,6 +564,7 @@ int i; for(i=LREG_OFFSET+1;i<REAL_MAX_LREGISTER+LREG_OFFSET;i++) { if (regs[i]==0) { +printf("# get_lregister %d\n",i); return i; } } @@ -612,6 +635,7 @@ void free_register(int i) { /* いらなくなったレジスタを開放 */ +printf("# free_register %d\n",i); regs[i]=0; if (is_longlong_reg(i)) { regs[regv_l(i)]=0; @@ -712,6 +736,9 @@ free_all_register(void) { int i; +#if 1 + printf("# free_all register\n"); +#endif #if LONGLONG_CODE for(i=0;i<REAL_MAX_LREGISTER;i++) { regs[i+LREG_OFFSET]=0; } lreg = 0; @@ -1364,11 +1391,14 @@ if (!is_int_reg(reg)) error(-1); if (reg!=creg) { clear_ptr_cache_reg(reg); - if (ireg && reg!=ireg && mode) { - printf("\tmr %s,%s\n",register_name(reg),register_name(ireg)); + if (ireg && reg!=ireg ) { + free_register(ireg); + if (mode) { + printf("\tmr %s,%s\n",register_name(reg),register_name(ireg)); + } } free_register(creg); - regs[creg]=USING_REG; + regs[reg]=USING_REG; } creg = ireg = reg; } @@ -1378,11 +1408,14 @@ { if (!is_float_reg(reg)) error(-1); if (reg!=creg) { - if (reg!=freg && mode) { - printf("\tfmr %s,%s\n",fregister_name(reg),fregister_name(freg)); + if (reg!=freg) { + free_register(freg); + if (mode) { + printf("\tfmr %s,%s\n",fregister_name(reg),fregister_name(freg)); + } } if (creg!=ireg) free_register(creg); - regs[freg]=USING_REG; + regs[reg]=USING_REG; } creg = freg = reg; } @@ -1392,23 +1425,30 @@ { if (!is_longlong_reg(reg)) error(-1); if (reg!=creg) { - if (reg!=lreg && mode) { - printf("\tmr %s,%s\n", - lregister_name_low(reg),lregister_name_low(lreg)); - printf("\tmr %s,%s\n", - lregister_name_high(reg),lregister_name_high(lreg)); + if (reg!=lreg) { + free_register(lreg); + if (mode) { + printf("\tmr %s,%s\n", + lregister_name_low(reg),lregister_name_low(lreg)); + printf("\tmr %s,%s\n", + lregister_name_high(reg),lregister_name_high(lreg)); + } } regs[reg]=USING_REG; regs[regv_l(reg)]=USING_REG; regs[regv_h(reg)]=USING_REG; if (creg!=ireg) free_register(creg); + free_register(creg); } - creg = lreg = reg; + creg = freg = reg; } void use_reg(int arg) { +printf("# use reg %d\n",arg); + if (arg<0||arg> REAL_MAX_REGISTER+REAL_MAX_FREGISTER+ REAL_MAX_LREGISTER) + error(-1); regs[arg]=USING_REG; if (is_longlong_reg(arg)) { regs[regv_l(arg)]=USING_REG; @@ -1542,7 +1582,8 @@ } else { arg = get_input_register_var(reg_arg,0,0); } - use_reg(arg); /* protect from input register free */ + if (car(arg)==REGISTER) use_reg(cadr(arg)); + /* protect from input register free */ reg_arg_list = list2(arg,reg_arg_list); g_expr_u(assign_expr0(arg,e4,t,t)); nargs ++ ; reg_arg++; @@ -1559,7 +1600,7 @@ } else { arg = get_input_lregister_var(reg_arg,0,0); } - use_reg(arg); /* protect from input register free */ + if (car(arg)==LREGISTER) use_reg(cadr(arg)); reg_arg_list = list2(arg,reg_arg_list); g_expr_u(assign_expr0(arg,e4,t,t)); nargs ++ ; reg_arg++; @@ -1588,9 +1629,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(r0); /* protect from input register free */ - use_reg(r1); /* protect from input register free */ + use_reg(cadr(r0)); /* protect from input register free */ + use_reg(cadr(r1)); /* 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); @@ -1621,7 +1661,8 @@ } else { arg = get_input_dregister_var(freg_arg,0,0,1); } - use_reg(arg); /* protect from input register free */ + if (car(arg)==DREGISTER) + use_reg(cadr(arg)); /* protect from input register free */ reg_arg_list = list2(arg,reg_arg_list); g_expr_u(assign_expr0(arg,e4,t,t)); /* XXX */ freg_arg++; @@ -2108,7 +2149,7 @@ printf(".set L_%d,%d\n",code_disp_label,-r1_offsetv); local_table(); - free_all_register(); + // free_all_register(); } void @@ -2141,7 +2182,7 @@ enter1() { text_mode(); - set_lreg(LREG_LREGISTER,0); + // set_lreg(LREG_LREGISTER,0); set_ireg(CREG_REGISTER,0); set_freg(FREG_FREGISTER,0); } @@ -2225,7 +2266,7 @@ code_offset_set(); local_table(); labelno++; - free_all_register(); + // free_all_register(); }