changeset 24:1df0bf7eb5da

add esi/edi register. fix virtual register bug.
author kono
date Tue, 04 Feb 2003 14:39:01 +0900
parents e605560e6146
children b7a94557bf92
files Idea mc-nop-386.c
diffstat 2 files changed, 24 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/Idea	Tue Feb 04 12:17:26 2003 +0900
+++ b/Idea	Tue Feb 04 14:39:01 2003 +0900
@@ -1265,3 +1265,6 @@
 Tue Feb  4 12:17:07 JST 2003
 
 ようやっと直したよ...
+
+use_pointer って、なにもしなくていいんだよね? eax,ebx を避ける
+ってことらしいけど。
--- a/mc-nop-386.c	Tue Feb 04 12:17:26 2003 +0900
+++ b/mc-nop-386.c	Tue Feb 04 14:39:01 2003 +0900
@@ -4,8 +4,6 @@
 #define EXTERN extern
 #include "mc.h"
 
-#define REGISTERS6   0
-
 extern int  get_register_var(void);
 extern void bexpr(int e1, char cond, int l1);
 extern void closing(void);
@@ -145,25 +143,14 @@
 void
 code_init(void)
 {
-    if (REGISTERS6) {
-	arg_offset = 8;
-	func_disp_offset = -20;
-	disp_offset = -20;
-	size_of_int = 4;
-	endian = 0;
-	MAX_REGISTER=6;
-	MAX_DATA_REG=4;    
-	MAX_POINTER=3;    
-    } else {
-	arg_offset = 8;
-	func_disp_offset = -12;
-	disp_offset = -12;
-	size_of_int = 4;
-	endian = 0;
-	MAX_REGISTER=4;
-	MAX_DATA_REG=4;    
-	MAX_POINTER=1;    
-    }
+    arg_offset = 8;
+    func_disp_offset = -12;
+    disp_offset = -12;
+    size_of_int = 4;
+    endian = 0;
+    MAX_REGISTER=6;
+    MAX_DATA_REG=4;    
+    MAX_POINTER=3;    
     MAX_REGISTER_VAR=2;    
 
     reg_name[REG_EAX] = "%eax";
@@ -188,10 +175,10 @@
 char *
 register_name(int i,int byte)
 {
-    if (byte && i <= REG_EDX) {
+    if (byte && rname[i] <= REG_EDX) {
 	return reg_name_l[rname[i]];
     } else {
-	return reg_name[rname[i]];
+	return reg_name[rname[i]]; /* should be error */
     }
 }
 
@@ -394,6 +381,13 @@
 gexpr(int e1)
 {
     gexpr_init();
+#if 0
+    if(lineno==688) {
+        g_expr(e1); /*break here*/
+        csvalue = rname[creg]; /* for siwtch value */
+        return;
+    } 
+#endif
     g_expr(e1);
     csvalue = rname[creg]; /* for siwtch value */
 }
@@ -1496,12 +1490,8 @@
     printf("\tpushl %%ebp\n");
     printf("\tmovl %%esp,%%ebp\n");
     printf("\tpushl %%ebx\n");
-    printf("\tpushl %%ecx\n");  /* we don't need this now */
-    printf("\tpushl %%edx\n");  /* we don't need this now */
-    if (REGISTERS6) {
-	printf("\tpushl %%edi\n");
-	printf("\tpushl %%esi\n");
-    }
+    printf("\tpushl %%esi\n");
+    printf("\tpushl %%edi\n");
 }
 
 void
@@ -1525,14 +1515,10 @@
     }
     fwddef(retlabel);
     use_register(creg,REG_EAX,0);
-    if (REGISTERS6) {
-	printf("\tpopl %%esi\n");
-	printf("\tpopl %%edi\n");
-    }
     /* if(disp) printf("\taddl $%d,%%esp\n",-disp);  */
     printf("\tlea %d(%%ebp),%%esp\n",disp_offset);
-    printf("\tpopl %%edx\n");
-    printf("\tpopl %%ecx\n");
+    printf("\tpopl %%edi\n");
+    printf("\tpopl %%esi\n");
     printf("\tpopl %%ebx\n");
     printf("\tleave\n");
     printf("\tret\n");