diff mc-code-ia32.c @ 127:eb4d8975926c

Intel float fix
author kono
date Tue, 01 Apr 2003 10:31:40 +0900
parents 1d1612fe705a
children d497c39add36
line wrap: on
line diff
--- a/mc-code-ia32.c	Wed Mar 26 16:50:12 2003 +0900
+++ b/mc-code-ia32.c	Tue Apr 01 10:31:40 2003 +0900
@@ -934,8 +934,8 @@
 int
 function(int e1)
 {
-    int e2,e3,e4,e5,nargs,t,ret_type;
-    NMTBL *n;
+    int e2,e3,e4,nargs,t,ret_type;
+    NMTBL *n=0;
     int save,saved;
     ret_type = cadddr(e1);
 #ifdef SAVE_STACKS
@@ -954,7 +954,7 @@
     nargs = 0;
     for (e3 = caddr(e1); e3; e3 = cadr(e3)) {	
 	t=caddr(e3);
-	n=(NMTBL *)(e5=(cadr(e4 = car(e3))));
+	e4 = car(e3);
 	if(scalar(t)) {
 	    g_expr(e4);
 	    printf("\tpushl %s\n",register_name(creg,0));
@@ -1052,7 +1052,7 @@
     printf("\t%s (%s)\n",fload(car(e1)==DRINDIRECT),register_name(creg,0));
     t=DOUBLE;
     break;
-    case CRINDIRECT: case RINDIRECT:
+    case CRINDIRECT: case RINDIRECT: default:
     op = ((byte = (car(e1) == CRINDIRECT)) ? "movsbl" : "movl");
     printf("\t%s (%s),%s\n",op,register_name(creg,0),register_name(creg,0));
     t=byte?CHAR:INT;
@@ -1175,9 +1175,9 @@
 	edx_setup();
 	orn = register_name(oreg,0);
 	if (op==DIV)
-	    printf("\tcltd\n\tdivl %s\n",orn);
+	    printf("\tcltd\n\tidivl %s\n",orn);
 	else 
-	    printf("\txor %%edx,%%edx\n\tidivl %s\n",orn);
+	    printf("\txor %%edx,%%edx\n\tdivl %s\n",orn);
 	edx_cleanup();
 	break;
     case MOD:
@@ -1186,9 +1186,9 @@
 	edx_setup();
 	orn = register_name(oreg,0);
 	if (op==DIV)
-	    printf("\tcltd\n\tdivl %s\n",orn);
+	    printf("\tcltd\n\tidivl %s\n",orn);
 	else 
-	    printf("\txor %%edx,%%edx\n\tidivl %s\n",orn);
+	    printf("\txor %%edx,%%edx\n\tdivl %s\n",orn);
         dx = virtual(REG_EDX);	
 	if (dx!=creg) {
 	    rname[dx]=rname[creg];
@@ -1685,8 +1685,8 @@
     printf("\tmovl    (%%esp), %s\n",register_name(creg,0));
     printf("\tmovb    $12, 1(%%esp)\n");
     printf("\tfldcw   (%%esp)\n");
-    printf("\tmovl    %s, (%%ebp)\n",register_name(creg,0));
     printf("\tfistpl  %d(%%esp)\n",size_of_int);
+    printf("\tmovl    %s, (%%esp)\n",register_name(creg,0));
     printf("\tfldcw   (%%esp)\n");
     printf("\tpopl    %s\n",register_name(creg,0));
     printf("\tpopl    %s\n",register_name(creg,0));
@@ -1706,7 +1706,7 @@
     printf("\tmovl    (%%esp), %s\n",register_name(creg,0));
     printf("\tmovb    $12, 1(%%esp)\n");
     printf("\tfldcw   (%%esp)\n");
-    printf("\tmovl    %s, (%%ebp)\n",register_name(creg,0));
+    printf("\tmovl    %s, (%%esp)\n",register_name(creg,0));
     printf("\tfistpll %d(%%esp)\n",size_of_int);
     printf("\tfldcw   (%%esp)\n");
     printf("\tmovl    %d(%%esp),%s\n",size_of_int,register_name(creg,0));
@@ -1891,7 +1891,8 @@
 void
 code_save_fstacks()
 {
-    int xreg,sp;
+    int xreg,sp,uses;
+    uses = use; use = 0;
     sp=freg_sp;
     while(sp-->0) {
 	if ((xreg=freg_stack[sp])==-1) {
@@ -1900,6 +1901,7 @@
 	    freg_stack[sp]= freg_stack[sp]-REG_LVAR_OFFSET;
 	}
     }
+    use = uses;
 }
 
 /* end */