# HG changeset patch # User kono # Date 1060796439 -32400 # Node ID b80e9737c3ce374e6d901d9f860b28fe77e648b9 # Parent 7bc02f0800a96324a3afe5493c2ca1e686ffc3bf regs[creg]==0 in ia32 diff -r 7bc02f0800a9 -r b80e9737c3ce Changes --- a/Changes Thu Aug 14 01:37:19 2003 +0900 +++ b/Changes Thu Aug 14 02:40:39 2003 +0900 @@ -3365,3 +3365,20 @@ Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.95.3/specs gcc version 2.95.3 20010315 (release) Intel Architecture だと、結構、良い線いっているみたい。 + +Thu Aug 14 02:39:29 JST 2003 + +done +[kono@pw001 ~/device]% time ./a.out 0 +720 +0.640u 0.000s 0:00.63 101.5% 0+0k 0+0io 88pf+0w +[kono@pw001 ~/device]% time ./a.out 1 +719 +0.720u 0.000s 0:00.71 101.4% 0+0k 0+0io 88pf+0w +[kono@pw001 ~/device]% time ./a.out 2 +470 +0.330u 0.000s 0:00.33 100.0% 0+0k 0+0io 88pf+0w +[kono@pw001 ~/device]% time ./a.out 3 +720 +0.370u 0.010s 0:00.37 102.7% 0+0k 0+0io 88pf+0w + diff -r 7bc02f0800a9 -r b80e9737c3ce mc-code-ia32.c --- a/mc-code-ia32.c Thu Aug 14 01:37:19 2003 +0900 +++ b/mc-code-ia32.c Thu Aug 14 02:40:39 2003 +0900 @@ -402,7 +402,7 @@ void emit_pop_free(int xreg) { - if (xreg==dreg) { + if (xreg==dreg||xreg==creg) { regv[dreg]=0; } else if (xreg>=0) { free_register(xreg); @@ -484,6 +484,7 @@ { int new_reg; new_reg = get_register(); + if (new_reg==creg) error(-1); if(new_reg<0) { /* もうレジスタがない */ if (reg_sp>=MAX_MAX) error(-1); reg_stack[reg_sp++] = -1; @@ -1146,7 +1147,7 @@ tosop(op,xreg); creg = xreg; printf("\tmovl %s,%s\n",register_name(reg,0),register_name(creg,0)); - regv[creg]=1; + regs[creg]=regv[creg]=1; } @@ -1250,7 +1251,7 @@ edx_cleanup(); break; } - if (oreg!=dreg&&oreg>=0) + if (oreg!=dreg&&oreg!=creg&&oreg>=0) free_register(oreg); else if (oreg==dreg) regv[dreg]=0; regv[creg]=1;