# HG changeset patch # User kono # Date 1044997809 -32400 # Node ID 886ca1f2cf15219fab69bcaab8fcfe6500805359 # Parent 060d1e549fec8ffa500ab4dbf9e9e77500d4c9c6 *** empty log message *** diff -r 060d1e549fec -r 886ca1f2cf15 mc-nop-386.c --- a/mc-nop-386.c Wed Feb 12 04:45:53 2003 +0900 +++ b/mc-nop-386.c Wed Feb 12 06:10:09 2003 +0900 @@ -303,9 +303,15 @@ return; real_v = virtual(real); move_op = regs[real_v]?"\txchg %s,%s\n":"\tmovl %s,%s\n"; - if (move || regs[real_v]) { +#ifdef REGFLOW + if (move || (regv[real_v])) { printf(move_op,reg_name[rname[virt]],reg_name[real]); } +#else + if (move || (regs[real_v])) { + printf(move_op,reg_name[rname[virt]],reg_name[real]); + } +#endif rname[real_v] = rname[virt]; rname[virt] = real; } @@ -356,6 +362,7 @@ free_register(i); lreg = i; regs[i]=0; + regv[i]=1; return lreg; } } @@ -377,6 +384,7 @@ reg_stack[reg_sp++] = creg; /* push するかわりにレジスタを使う */ creg = new_reg; } + regv[creg]=0; } int @@ -393,6 +401,7 @@ } else { xreg = lreg; } + regv[xreg]=1; return xreg; } @@ -403,6 +412,7 @@ for(i=REG_ESI;inm); @@ -919,6 +935,8 @@ } else { free_register(save); } + regv[save]=0; + regv[creg]=1; } int @@ -1161,6 +1179,7 @@ g_expr(e2); xreg = emit_pop(0); emit_copy(xreg,creg,sz,0); + regv[xreg]=0; return; } @@ -1199,6 +1218,7 @@ if (byte) use_data_reg(creg,1); e2 = emit_pop(0); printf("\t%s %s,(%s)\n",op,register_name(creg,byte),register_name(e2,0)); + regv[e2]=0; return; } @@ -1238,10 +1258,12 @@ } else { reg_stack[reg_sp++] = xreg; /* push するかわりにレジスタを使う */ } + regv[xreg]=0; tosop(op); if(new_reg>=0) free_register(new_reg); printf("\tpopl %s # assop \n",register_name(dreg,0)); printf("\t%s %s,(%s)\n",byte ? "movb" : "movl",register_name(creg,byte),register_name(dreg,0)); + regv[dreg]=0; return; } @@ -1269,30 +1291,31 @@ if(oreg==-1) { printf("\tpopl %s\n",register_name(dreg,0)); oreg = dreg; + regv[oreg]=1; } orn = register_name(oreg,0); crn = register_name(creg,0); switch(op) { case ADD: printf("\taddl %s,%s\n",orn,crn); - return; + break; case SUB: printf("\tsubl %s,%s\n",orn,crn); - return; + break; case BAND: printf("\tandl %s,%s\n",orn,crn); - return; + break; case EOR: printf("\txorl %s,%s\n",orn,crn); - return; + break; case BOR: printf("\torl %s,%s\n",orn,crn); - return; + break; case MUL: case UMUL: /* use_register(dreg,REG_EDX,0); */ printf("\t%s %s,%s\n","imull",orn,crn); - return; + break; case DIV: case UDIV: orn = div_setup(oreg); @@ -1301,7 +1324,7 @@ else printf("\txor %%edx,%%edx\n\tidivl %s\n",orn); div_cleanup(orn); - return; + break; case MOD: case UMOD: orn = div_setup(oreg); @@ -1312,8 +1335,10 @@ rname[creg]=REG_EDX; rname[dreg]=REG_EAX; div_cleanup(orn); - return; + break; } + if (oreg>=0) regv[oreg]=0; + regv[dreg]=0; } static char *dvi_push = "(%esp)";