changeset 250:7637295c4fb8

*** empty log message ***
author kono
date Tue, 11 May 2004 17:37:29 +0900
parents 8313c965c0e2
children fb6efe8ff816
files mc-code-mips.c mc-codegen.c mc.h
diffstat 3 files changed, 40 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mc-code-mips.c	Tue May 11 16:50:05 2004 +0900
+++ b/mc-code-mips.c	Tue May 11 17:37:29 2004 +0900
@@ -1427,7 +1427,7 @@
 	printf("\tmove $5,%s\n",frn);
 	printf("\tmove $4,%s\n",trn);
         /* overrap must be allowed */
-	printf("\tjal L_%s$stub\n",memmove);
+	printf("\tjal L_%s\n",memmove);
 	extern_define(memmove,0,FUNCTION,1);
         fix=0;
 	set_ireg(RET_REGISTER,0);
@@ -1901,7 +1901,7 @@
     }
     clear_ptr_cache();
     if (car(e2) == FNAME) {	
-	printf("\tjal\tL_%s$stub\n",fn->nm);
+	printf("\tjal\tL_%s\n",fn->nm);
     } else {
         jrn = register_name(cadr(jmp));
         printf("\tj %s\n",jrn);
@@ -3198,9 +3198,10 @@
     case FMUL: opc="mul.s"; break;
     case DMUL: opn="dpmul"; break;
     case FCMP: opn="c.lt.s"; cmp=1; break;
-    case DCMP:  opc="dpcmp"; cmp=1; break;
-    case FCMPGE: opn="c.le.s"; break;
-    case FCMPEQ: opn="c.eq.s"; break;
+    case DCMPGE:
+    case DCMP:  opc="dpcmp"; break;
+    case FCMPGE: opn="c.le.s"; cmp=1; break;
+    case FCMPEQ: opn="c.eq.s"; cmp=1; break;
     default:
 	error(-1); return;
     }
@@ -3476,6 +3477,9 @@
 int emit_dpop(int d)
 { 
     int xreg,reg;
+    if (d) {
+	return emit_lpop(); 
+    }
     xreg=pop_fregister();
     if (xreg<= -REG_LVAR_OFFSET) {
 	reg = get_dregister(d);
@@ -3486,10 +3490,15 @@
     return xreg;
 }
 
+static int emit_lpop_regvar();
+
 static
 int emit_dpop_regvar(int d)
 { 
     int xreg,reg;
+    if (d) {
+	return emit_lpop_regvar();
+    }
     xreg=pop_fregister();
     reg = cadr(get_dregister_var(0,d));
     if (xreg<= -REG_LVAR_OFFSET) {
@@ -3512,9 +3521,12 @@
 emit_dpush(int d)
 { 
     int new_reg;
+    if (d) {
+	emit_lpush(); return;
+    }
     if (!is_float_reg(creg)) error(-1);
     if (freg_sp>MAX_MAX) error(-1);
-    new_reg = get_dregister(1);       /* 絶対に取れる */
+    new_reg = get_dregister(d);       /* 絶対に取れる */
     freg_stack[freg_sp++] = freg;     /* push するかわりにレジスタを使う */
     creg = freg = new_reg;
 }
@@ -3622,6 +3634,22 @@
     emit_lpop_free(e3);
 }
 
+static
+int emit_lpop_regvar()
+{ 
+    int xreg,reg;
+    xreg=lreg_stack[--lreg_sp];
+    reg = cadr(get_lregister_var(0));
+    if (xreg<= -REG_LVAR_OFFSET) {
+        code_lrlvar(REG_LVAR_OFFSET+xreg,reg);
+        free_lvar(REG_LVAR_OFFSET+xreg);
+        xreg = reg;
+    } else {
+        code_lassign_lregister(reg,xreg);
+    }
+    return xreg;
+}
+
 int
 emit_lpop()
 {
--- a/mc-codegen.c	Tue May 11 16:50:05 2004 +0900
+++ b/mc-codegen.c	Tue May 11 17:37:29 2004 +0900
@@ -346,12 +346,12 @@
 #if FLOAT_CODE
     case DMUL: case DDIV:
     case DADD: case DSUB:
-    case DCMP: case DCMPGE:
+    case DCMP: case DCMPGE: case DCMPEQ: case DCMPNEQ:
 	dmachinop(e1,1);
 	return DOUBLE;
     case FMUL: case FDIV:
     case FADD: case FSUB:
-    case FCMP: case FCMPGE:
+    case FCMP: case FCMPGE: case FCMPEQ: case FCMPNEQ:
 	dmachinop(e1,0);
 	return FLOAT;
 #endif
--- a/mc.h	Tue May 11 16:50:05 2004 +0900
+++ b/mc.h	Tue May 11 17:37:29 2004 +0900
@@ -251,6 +251,7 @@
 #define DASS	(DOP+ASS)
 #define DCMPGE	(DOP+CMPGE)
 #define DCMPEQ	(DOP+CMPEQ)
+#define DCMPNEQ	(DOP+CMPNEQ)
 #define DASSOP	(DOP+ASSOP)
 #define DCMP	(DOP+CMP)
 #define DMINUS	(DOP+MINUS)
@@ -262,6 +263,7 @@
 #define FASS	(FOP+ASS)
 #define FCMPGE	(FOP+CMPGE)
 #define FCMPEQ	(FOP+CMPEQ)
+#define FCMPNEQ	(FOP+CMPNEQ)
 #define FASSOP	(FOP+ASSOP)
 #define FCMP	(FOP+CMP)
 #define FMINUS	(FOP+MINUS)
@@ -272,6 +274,8 @@
 
 #define LASS	(LOP+CASS)
 #define LCMPGE	(LOP+CMPGE)
+#define LCMPEQ	(LOP+CMPEQ)
+#define LCMPNEQ	(LOP+CMPNEQ)
 #define LASSOP  (LOP+CASSOP)
 #define LUASSOP (LOP+CUASSOP)
 #define LCMP	(LOP+CMP)