changeset 651:c9a489ac3fc7

*** empty log message ***
author kono
date Sun, 26 Nov 2006 11:23:03 +0900
parents fe0a971a6666
children f9d86da34600
files Makefile conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c conv/cbc2c.h conv/null.c conv/null.h conv_func.tbl mc-codegen.c mc-codegen.h mc.h
diffstat 13 files changed, 41 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Tue Nov 21 05:52:02 2006 +0900
+++ b/Makefile	Sun Nov 26 11:23:03 2006 +0900
@@ -25,7 +25,9 @@
 #
 TARGET=test/simp
 
-all: mc-include.c mc mc-ia32 mc-powerpc mc-mips mc-arm
+all: mc-include.c mc
+
+allall: mc-include.c mc mc-ia32 mc-powerpc mc-mips mc-arm
 
 mc:  mc-$(ARCH)
 	cp mc-$(ARCH) mc
--- a/conv/c.c	Tue Nov 21 05:52:02 2006 +0900
+++ b/conv/c.c	Sun Nov 26 11:23:03 2006 +0900
@@ -42,6 +42,11 @@
 }
 
 static void
+bool_(int c)
+{
+}
+
+static void
 comment_(int c)
 {
     fprintf(vout,"%c",c);
--- a/conv/c.h	Tue Nov 21 05:52:02 2006 +0900
+++ b/conv/c.h	Sun Nov 26 11:23:03 2006 +0900
@@ -6,6 +6,7 @@
 
 Converter c_converter = {
     &expr_,
+    &bool_,
     &conv_,
     &noconv_,
     &comment_,
--- a/conv/c2cbc.c	Tue Nov 21 05:52:02 2006 +0900
+++ b/conv/c2cbc.c	Sun Nov 26 11:23:03 2006 +0900
@@ -43,6 +43,11 @@
 }
 
 static void
+bool_(int c)
+{
+}
+
+static void
 comment_(int c)
 {
     fprintf(vout,"%c",c);
--- a/conv/c2cbc.h	Tue Nov 21 05:52:02 2006 +0900
+++ b/conv/c2cbc.h	Sun Nov 26 11:23:03 2006 +0900
@@ -6,6 +6,7 @@
 
 Converter c2cbc_converter = {
     &expr_,
+    &bool_,
     &conv_,
     &noconv_,
     &comment_,
--- a/conv/cbc2c.c	Tue Nov 21 05:52:02 2006 +0900
+++ b/conv/cbc2c.c	Sun Nov 26 11:23:03 2006 +0900
@@ -43,6 +43,11 @@
 }
 
 static void
+bool_(int c)
+{
+}
+
+static void
 comment_(int c)
 {
     fprintf(vout,"%c",c);
--- a/conv/cbc2c.h	Tue Nov 21 05:52:02 2006 +0900
+++ b/conv/cbc2c.h	Sun Nov 26 11:23:03 2006 +0900
@@ -6,6 +6,7 @@
 
 Converter cbc2c_converter = {
     &expr_,
+    &bool_,
     &conv_,
     &noconv_,
     &comment_,
--- a/conv/null.c	Tue Nov 21 05:52:02 2006 +0900
+++ b/conv/null.c	Sun Nov 26 11:23:03 2006 +0900
@@ -11,6 +11,10 @@
 { }
 
 static void
+bool_(int e)
+{ }
+
+static void
 conv_()
 { }
 
--- a/conv/null.h	Tue Nov 21 05:52:02 2006 +0900
+++ b/conv/null.h	Sun Nov 26 11:23:03 2006 +0900
@@ -6,6 +6,7 @@
 
 Converter null_converter = {
     &expr_,
+    &bool_,
     &conv_,
     &noconv_,
     &comment_,
--- a/conv_func.tbl	Tue Nov 21 05:52:02 2006 +0900
+++ b/conv_func.tbl	Sun Nov 26 11:23:03 2006 +0900
@@ -1,4 +1,5 @@
 void expr_(int e) ;
+void bool_(int e);
 void conv_() ;
 void noconv_(int f) ;
 void comment_(int f) ;
--- a/mc-codegen.c	Tue Nov 21 05:52:02 2006 +0900
+++ b/mc-codegen.c	Sun Nov 26 11:23:03 2006 +0900
@@ -668,13 +668,15 @@
 /*   l1 ... label for branch */
 /*   return 0 if l1 is not used, otherwise return l1 */
 
-extern int
+static int
 bexpr_u(int e1, char cond, int l1)
 {
     int op = car(e1);
     conv->expr_(e1);
     if (chk) return l1;
     // gexpr_init();
+
+    // is this switch really useful?
     switch(op) {
 	case GT: case UGT: case GE: case UGE: case LT: 
 	case ULT: case LE: case ULE:  
@@ -762,21 +764,27 @@
 	if(!cond) fwddef(l2);
 	return l1;
     case CRGVAR: case CURGVAR:
+	conv->bool_(e1);
 	code_cmp_crgvar(e1,USE_CREG,1,l1,cond);
 	return l1;
     case SRGVAR: case SURGVAR:
+	conv->bool_(e1);
 	code_cmp_crgvar(e1,USE_CREG,size_of_short,l1,cond);
 	return l1;
     case CRLVAR: case CURLVAR:
+	conv->bool_(e1);
 	code_cmp_crlvar(e2,USE_CREG,1,l1,cond);
 	return l1;
     case SRLVAR: case SURLVAR:
+	conv->bool_(e1);
 	code_cmp_crlvar(e2,USE_CREG,size_of_short,l1,cond);
 	return l1;
     case RGVAR:
+	conv->bool_(e1);
 	code_cmp_rgvar(e1,USE_CREG,l1,cond);
 	return l1;
     case RLVAR:
+	conv->bool_(e1);
 	code_cmp_rlvar(e2,USE_CREG,l1,cond);
 	return l1;
 #if 0 && FLOAT_CODE
@@ -820,6 +828,7 @@
 	} else return 0;
 #endif
     case REGISTER:
+	conv->bool_(e1);
 	code_cmp_register(e2,l1,cond);
 	return l1;
     case CONST:
@@ -831,7 +840,8 @@
 	    error(-1); return l1; /* recursive g_expr/b_expr */
 	}
 	t=g_expr(e1);
-	if (!use) return l1;
+	if (!use) return l1;  // Is this really happen?
+	conv->bool_(e1);
 	if (0) ;
 #if FLOAT_CODE
 	else if(t==FLOAT)
@@ -3182,6 +3192,7 @@
 		// align have to be 2^n
 		align = caddr(align);
                 disp = ((disp+(align-1))&~(align-1));
+if (lsrc && hoge!=disp)
 printf("# field %s %d->%d (align %d)\n",n->nm,hoge,disp,align);
 
 	    }
--- a/mc-codegen.h	Tue Nov 21 05:52:02 2006 +0900
+++ b/mc-codegen.h	Sun Nov 26 11:23:03 2006 +0900
@@ -66,7 +66,6 @@
 extern int strop(int e,int ind);
 extern void arg_register(NMTBL *fnptr);
 extern int bexpr(int e1, char cond, int l1);
-extern int bexpr_u(int e1, char cond, int l1);
 extern void checkret(void);     // check delayed jump, delayed last exp
 extern void closing();
 extern void cmpdimm(int e, int csreg,int label,int cond);
--- a/mc.h	Tue Nov 21 05:52:02 2006 +0900
+++ b/mc.h	Sun Nov 26 11:23:03 2006 +0900
@@ -372,7 +372,7 @@
 #define STASS  	93
 
 
-#define BINARY_ARGS(i) ((MUL<=(i%SOP)&&(i%SOP)<=STASS))
+#define BINARY_ARGS(i) ((MUL<=(i%SOP)&&(i%SOP)<=STASS)||i==ARRAY)
 
 /* ternary  argments */