diff mc-code-mips.c @ 267:e7ab23c992e5

static double define fix
author kono
date Mon, 17 May 2004 11:41:51 +0900
parents 86e315702d9e
children 3a368fc37559
line wrap: on
line diff
--- a/mc-code-mips.c	Mon May 17 04:18:12 2004 +0900
+++ b/mc-code-mips.c	Mon May 17 11:41:51 2004 +0900
@@ -2909,7 +2909,7 @@
 	} else if(car(e)==STRING) {       
 	    if (car(n->ty)!=ARRAY || cadr(n->ty)!=CHAR) {
 		l = fwdlabel();
-		printf("\t.long L_%d\n",l);
+		printf("\t.long $L_%d\n",l);
 		// printf(".cstring\n\t.align 2\n");
 		printf("$L_%d:\n",l);
 		output_mode = RODATA_EMIT_MODE;
@@ -2936,6 +2936,14 @@
     }
 }
 
+static void
+comm(NMTBL *n)
+{
+    printf(".comm %s,%d,%d\n",n->nm,size(n->ty),
+	(n->ty==DOUBLE||n->ty==LONGLONG||n->ty==ULONGLONG)?8:4
+    );
+}
+
 void
 global_table(void)
 {
@@ -2949,7 +2957,7 @@
 		data_mode(0);
 		init=1;
 	    }
-	    printf(".comm %s,%d\n",n->nm,size(n->ty));
+	    comm(n);
 	} else if ((n->sc==STATIC) && n->dsp != -1) {
 	    /* n->dsp = -1 means initialized global */
 	    if (init==0) {
@@ -2957,7 +2965,7 @@
 		init=1;
 	    }
 	    printf(".local %s\n",n->nm);
-	    printf(".comm %s,%d\n",n->nm,size(n->ty));
+	    comm(n);
 	}
     }
 }
@@ -2971,16 +2979,16 @@
     /* static local variables */
     for(n=ntable+GSYMS;n < &ntable[GSYMS+LSYMS];n++) {
 	if (n->sc == GVAR) {
-	    if (init==0) {
-		data_mode(0);
-		init=1;
-	    }
 	    if (n->dsp != -1) { /* initialized static */
-		printf(".local %s\n",n->nm);
-		printf(".comm %s,%d\n",n->nm,size(n->ty));
+		if (init==0) {
+		    data_mode(0);
+		    init=1;
+		}
+		comm(n);
 	    }
 	}
     }
+    text_mode(2);
 }
 
 void