changeset 265:b47a106a9bce

*** empty log message ***
author kono
date Mon, 17 May 2004 03:21:32 +0900
parents 7de200d88747
children 86e315702d9e
files .gdbinit Changes mc-code-mips.c mc-parse.c
diffstat 4 files changed, 30 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Mon May 17 00:36:31 2004 +0900
+++ b/.gdbinit	Mon May 17 03:21:32 2004 +0900
@@ -1,7 +1,7 @@
 tb main
 # run  -s -ob00.s test/basic.c
-# run  -s -ob00.s mc-parse.c
-run -s test/code-gen-all.c
+run  -s -ob00.s mc-parse.c
+# run -s 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
 printf "r10=%08x r11=%08x r12=%08x r13=%08x r14=%08x r15=%08x\n",$r10,$r11,$r12,$r13,$r14,$r15
--- a/Changes	Mon May 17 00:36:31 2004 +0900
+++ b/Changes	Mon May 17 03:21:32 2004 +0900
@@ -4299,3 +4299,13 @@
 
 まぁ、前者の方が凝っているし、命令数的にも変わらないから、
 space factor 的に前者の方が速いんじゃないか?
+
+Mon May 17 01:09:02 JST 2004
+
+さて、アセンブルは通るようになりましたが...
+
+どうも、$0,$1が出てしまう場合があるみたい。これを検出する
+手段を作った方が良いね。
+
+あと、int の後のdouble/longlong は、$3 のあと、$5,$6 と
+来るみたいですね。
--- a/mc-code-mips.c	Mon May 17 00:36:31 2004 +0900
+++ b/mc-code-mips.c	Mon May 17 03:21:32 2004 +0900
@@ -1546,7 +1546,10 @@
 	    }
 	    free_register(lreg);
 	}
-	free_register(creg);
+	if (creg!=lreg) {
+	    free_register(creg);
+	    if (creg==ireg) ireg = 0;
+	}
 	regs[reg]=USING_REG;
 	clear_ptr_cache_reg(regv_l(reg));
 	regs[regv_l(reg)]=USING_REG;
@@ -1584,7 +1587,7 @@
 void
 set_lreg_operand(int reg,int mode)
 {
-    // save_stack,clear_ptr_cache is assmued    
+    // save_stack,clear_ptr_cache is assumed    
     if (!is_longlong_reg(reg)) { error(-1); return; }
     if (mode) {
 	if (regv_l(reg)!=6)
@@ -2445,18 +2448,22 @@
         fclose(asi);
         asi = 0;
     }
-    for (t=0,s=p;(*cheapp++ = *s++);) {
+    for (t=0,s=filename;(*cheapp++ = *s++);) {
         if (*s=='.') {
-	    t=s;
+	    t=cheapp;
         }
     }
     if (!t) {
-	s[-1]='i'; *cheapp++ = 0;
+	cheapp--;
+	*cheapp++ = '.';
+	*cheapp++ = 'i';
+	*cheapp++ = 0;
     } else {
 	t[1]='i'; 
-	if (t==s-1) *cheapp++ = 0;
+	t[2]=0; 
     }
     asi = fopen(p,"w");
+    cheapp = p;
     printf(".include \"%s\"\n",p);
     if (!asi) error(-1);
 }
@@ -2900,7 +2907,7 @@
 	    if (car(n->ty)!=ARRAY || cadr(n->ty)!=CHAR) {
 		l = fwdlabel();
 		printf("\t.long L_%d\n",l);
-		printf(".cstring\n\t.align 2\n");
+		// printf(".cstring\n\t.align 2\n");
 		printf("$L_%d:\n",l);
 		output_mode = RODATA_EMIT_MODE;
 	    }
@@ -3409,7 +3416,6 @@
 double_lib(char *opc,int reg,int e1)
 {
     longlong_lib(opc,reg,e1);
-    set_double(reg);
 }
 
 void
@@ -3434,7 +3440,7 @@
 	default:
 	    error(-1); return;
 	}
-      double_lib(opc,reg,e1);
+        double_lib(opc,reg,e1);
     } else {
 	switch(op) {
 	case FADD: opn="add.s"; break;
@@ -4177,6 +4183,7 @@
     printf("\t3:\n");
     printf("\tmove    %s,%s\n",cl,dl);
     printf("\tmove    %s,%s\n",ch,dh);
+    free_register(dreg);
 }
 
 static void
--- a/mc-parse.c	Mon May 17 00:36:31 2004 +0900
+++ b/mc-parse.c	Mon May 17 03:21:32 2004 +0900
@@ -3452,8 +3452,8 @@
 {
     int t1;
     /* e = rvalue(e); */
-    if (type==FLOAT && t==DOTS) { type=DOUBLE;}
-    if (type==CHAR  && t==DOTS) { type=INT;}
+    if (type==FLOAT && t==DOTS) { t=DOUBLE;}  // fall thru
+    if (type==CHAR  && t==DOTS) { t=INT;}     // fall thru
     if (t==DOTS) return e;
     if (t==UNSIGNED)                 e = unsigned_value(e,type);
     else if (integral(t))            e = int_value(e,type);