changeset 159:b80e9737c3ce

regs[creg]==0 in ia32
author kono
date Thu, 14 Aug 2003 02:40:39 +0900
parents 7bc02f0800a9
children 1f440a2790fb
files Changes mc-code-ia32.c
diffstat 2 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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
+
--- 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;