changeset 797:e2f7680a574a

emit_int fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 23 Nov 2010 20:34:17 +0900
parents 80a59598df5f
children df9861be349f
files Changes mc-code-i64.c mc-codegen.c mc-parse.c
diffstat 4 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Tue Nov 23 17:45:40 2010 +0900
+++ b/Changes	Tue Nov 23 20:34:17 2010 +0900
@@ -9905,3 +9905,12 @@
 
 穴があったら、そこにゼロをいれる見たいなコードにする?
 
+Tue Nov 23 17:45:50 JST 2010
+
+stdarg は、コード生成と va_arg を statment expression で乗り切りました。疲れた。
+
+
+
+
+
+
--- a/mc-code-i64.c	Tue Nov 23 17:45:40 2010 +0900
+++ b/mc-code-i64.c	Tue Nov 23 20:34:17 2010 +0900
@@ -1478,6 +1478,7 @@
 #ifdef __APPLE__
     clear_ptr_cache();
 #endif
+    // printf("\t.align 4\n");
     printf("_%d:\n",labelno);
 }
 
@@ -2992,6 +2993,7 @@
       this is not allowed because of ? operator
     use_register(creg,REG_EAX,0);
      */
+    printf("\t.align 4\n");
 }
 
 void
@@ -3581,7 +3583,9 @@
         } else if ((n->sc==STATIC) && n->dsp != -1) {
             /* n->dsp = -1 means initialized global */
             if (is_code(n)||is_function(n)) {
+#if 0
 		printf("\t.set L_%s$stub,_%s\n",n->nm,n->nm);
+#endif
 		continue;
 	    }
             if (init==0) {
--- a/mc-codegen.c	Tue Nov 23 17:45:40 2010 +0900
+++ b/mc-codegen.c	Tue Nov 23 20:34:17 2010 +0900
@@ -3681,7 +3681,10 @@
 {
 	switch(car(e)) {
 	case CONST:
-	    emit_int(cadr(e));
+	    if (lp64) emit_longlong(cadr(e)); else emit_int(cadr(e));
+	    return 1;
+	case LCONST:
+	    if (lp64) emit_longlong(lcadr(e)); else emit_int(lcadr(e));
 	    return 1;
 	case ADDRESS:
 	    if (car(cadr(e))==GVAR)
--- a/mc-parse.c	Tue Nov 23 17:45:40 2010 +0900
+++ b/mc-parse.c	Tue Nov 23 20:34:17 2010 +0900
@@ -4889,7 +4889,7 @@
 	// too long string is stored in glist3
 	strings = glist3s(i,strings,name);
 	nptr = get_nptr();
-	nptr->dsp = reverse0(strings);
+	nptr->dsp = strings = reverse0(strings);
 	int j;
 	for(j = strings, i = 0; j ; j = car(j)) {
 	    i += car(j);