changeset 652:f9d86da34600

*** empty log message ***
author kono
date Sun, 26 Nov 2006 13:16:50 +0900
parents c9a489ac3fc7
children d66e5a137d73
files Changes mc-codegen.c mc-parse.c mc-switch.c
diffstat 4 files changed, 49 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Sun Nov 26 11:23:03 2006 +0900
+++ b/Changes	Sun Nov 26 13:16:50 2006 +0900
@@ -9150,13 +9150,8 @@
 
 ってことは、set_attr は要らないってこと? (かもね...)
 
-
-
-
-
-
-
-
-
-
-
+Sun Nov 26 13:15:39 JST 2006
+
+code segment のvariable interface を許すためには、Intel の
+stack code を直した方が良い。
+
--- a/mc-codegen.c	Sun Nov 26 11:23:03 2006 +0900
+++ b/mc-codegen.c	Sun Nov 26 13:16:50 2006 +0900
@@ -1041,9 +1041,9 @@
 		if (is_same_type(s,t)) {
 		    s1=s0+caddr(source);
 #if DEBUG_PARALLEL_ASSIGN>1 
-printf("## overlap source %d t0 %d t1 %d\n",car(car(t)),t0,t1);
-printf("## overlap target %d s0 %d s1 %d\n",car(car(source)),s0,s1);
-printf("## overlap   equal = %d\n",((t0<=s0&&s0<t1)||(t0<s1&&s1<=t1)));
+if (lsrc) printf("## overlap source %d t0 %d t1 %d\n",car(car(t)),t0,t1);
+if (lsrc) printf("## overlap target %d s0 %d s1 %d\n",car(car(source)),s0,s1);
+if (lsrc) printf("## overlap   equal = %d\n",((t0<=s0&&s0<t1)||(t0<s1&&s1<=t1)));
 #endif
 		    if((t0<=s0&&s0<t1)||(t0<s1&&s1<=t1))
 			result = list2(target,result);
@@ -1108,7 +1108,7 @@
 	if (0) {
 use_lvar:;
 #if DEBUG_PARALLEL_ASSIGN>1
-printf("## register overrap in save_target\n");
+if (lsrc) printf("## register overrap in save_target\n");
 #endif
 	}
 	g_expr_u(assign_expr0((e1=list3(LVAR,new_lvar(sz),0)),s,ty,ty));
@@ -1128,7 +1128,7 @@
 	for(h=history;h;h=cadr(h)) {
 	    if (t1==car(h)) {
 #if DEBUG_PARALLEL_ASSIGN
-printf("## circular dependency %d ty %d\n",car(t1),cadr(t1));
+if (lsrc) printf("## circular dependency %d ty %d\n",car(t1),cadr(t1));
 #endif
 		return t1;
 	    }
@@ -1167,7 +1167,7 @@
 	    if(car(t)==car(s) && cadr(t)==cadr(s)) {
 		/*書き込み先が自分自身*/
 #if DEBUG_PARALLEL_ASSIGN
-printf("## remove same %d ty %d+%d sz %d\n",car(t),ty,cadr(t),sz);
+if (lsrc) printf("## remove same %d ty %d+%d sz %d\n",car(t),ty,cadr(t),sz);
 #endif
 		remove_target(target,t,use);
 		progress = 1;
@@ -1175,11 +1175,11 @@
 		    (cadr(s1)==0 && car(car(s1))==t)) {
 		/* 重なってないので安心して書き込める */
 #if DEBUG_PARALLEL_ASSIGN
-if (s1 && cadr(s1)==0)
-printf("## singleton %d ty %d+%d sz %d\n",car(t),ty,cadr(t),sz);
+if (s1 && cadr(s1)==0) {
+if (lsrc) printf("## singleton %d ty %d+%d sz %d\n",car(t),ty,cadr(t),sz);
     // this means singleton struct should be copied safely.
-else
-printf("## normal assign %d ty %d+%d sz %d\n",car(t),ty,cadr(t),sz);
+} else
+if (lsrc) printf("## normal assign %d ty %d+%d sz %d\n",car(t),ty,cadr(t),sz);
 #endif
 		g_expr_u(assign_expr0(t,s,ty,ty));
 		remove_target(target,t,use);
@@ -1190,7 +1190,7 @@
 		save_target(car(t),cadddr(t),target,use,sz,ty);
 		progress = 1;
 #if DEBUG_PARALLEL_ASSIGN
-    printf("## saving %d ty %d+%d sz %d\n",car(car(t)),ty,cadr(car(t)),sz);
+if (lsrc)    printf("## saving %d ty %d+%d sz %d\n",car(car(t)),ty,cadr(car(t)),sz);
 #endif
 		break;
 	    }
@@ -1202,7 +1202,7 @@
 	    t=car(target0); s=cadddr(target0);
 	    sz=size(ty=caddr(target0)); 
 #if DEBUG_PARALLEL_ASSIGN
-printf("## can't progress save any %d ty %d+%d sz %d\n",car(s),ty,cadr(t),sz);
+if (lsrc)printf("## can't progress save any %d ty %d+%d sz %d\n",car(s),ty,cadr(t),sz);
 #endif
 	    remove_target(target,t,use);
 	    save_target(t,s,target,use,sz,ty);
@@ -1485,7 +1485,7 @@
         /* keep arg space for register variables */
         arg_size += sz;
 #if DEBUG_PARALLEL_ASSIGN
-printf("## target %d ty %d+%d sz %d\n",car(car(target)),ty,cadr(car(target)),sz);
+if (lsrc)printf("## target %d ty %d+%d sz %d\n",car(car(target)),ty,cadr(car(target)),sz);
 #endif
     }
     if (env) {
@@ -1540,14 +1540,14 @@
 		/* large struct generate large save/restore */
 		/* divide it to avoid large copy */
 #if DEBUG_PARALLEL_ASSIGN
-printf("## division sz %d\n",sz);
+if (lsrc)printf("## division sz %d\n",sz);
 #endif
 		caddr(e2) = UNSIGNED;
 		caddddr(e2) = list3(
 			cadddr(e2)=list3(LVAR,cadr(s0),0),
 				0, size_of_int);
 #if DEBUG_PARALLEL_ASSIGN
-printf("## div 0 source %d ty %d+%d sz %d\n",car(s0),ty,cadr(s0),size_of_int);
+if (lsrc)printf("## div 0 source %d ty %d+%d sz %d\n",car(s0),ty,cadr(s0),size_of_int);
 #endif
 		for(e4=size_of_int;e4<sz;) {
 		    cadr(e2) = list5(car(e2),cadr(e2),
@@ -1564,7 +1564,7 @@
 			cadddr(e2) = list3(LVAR,cadr(s0)+e4,0),0, r);
 		    e4 += r;
 #if DEBUG_PARALLEL_ASSIGN
-printf("## div 1 source %d ty %d+%d sz %d\n",car(s0),ty,cadr(s0),r);
+if (lsrc)printf("## div 1 source %d ty %d+%d sz %d\n",car(s0),ty,cadr(s0),r);
 #endif
 		}
 		e2 = e3;
@@ -1572,7 +1572,7 @@
 	    }
 	    caddddr(e2)=list3(s0,0,sz);
 #if DEBUG_PARALLEL_ASSIGN
-printf("## source %d ty %d+%d sz %d\n",car(s0),ty,cadr(s0),sz);
+if (lsrc)printf("## source %d ty %d+%d sz %d\n",car(s0),ty,cadr(s0),sz);
 #endif
 	} else {
 	    /* check used sources in rather complex source */
@@ -2777,7 +2777,7 @@
 	} else if (IS_STATEMENT(car(e))) {
 	    return 1;  // may contain anything
 	} else {
-	    // fprintf(stderr,"Unknown Tree ID %d\n",car(e));
+	    // if (lsrc)fprintf(stderr,"Unknown Tree ID %d\n",car(e));
 	    error(-1);
 	    return 0;
 	}
@@ -2825,7 +2825,7 @@
 	} else if (IS_STATEMENT(car(e))) {
 	    return 1;  // may contain anything
 	} else {
-	    // fprintf(stderr,"Unknown Tree ID %d\n",car(e));
+	    // if (lsrc)fprintf(stderr,"Unknown Tree ID %d\n",car(e));
 	    error(-1);
 	    return 0;
 	}
@@ -2875,7 +2875,7 @@
 	} else if (IS_STATEMENT(car(e))) {
 	    return arg;
 	} else {
-	    // fprintf(stderr,"Unknown Tree ID %d\n",car(e));
+	    // if (lsrc)fprintf(stderr,"Unknown Tree ID %d\n",car(e));
 	    // error(-1);
 	    return arg;
 	}
@@ -2929,7 +2929,7 @@
 	} else if (IS_STATEMENT(car(e))) {
 	    return arg;
 	} else {
-	    // fprintf(stderr,"Unknown Tree ID %d\n",car(e));
+	    // if (lsrc)fprintf(stderr,"Unknown Tree ID %d\n",car(e));
 	    // error(-1);
 	    return arg;
 	}
@@ -3041,7 +3041,7 @@
 	    // already in global heap
 	    return e;  // may contain anything
 	} else {
-	    // fprintf(stderr,"Unknown Tree ID %d\n",car(e));
+	    // if (lsrc)fprintf(stderr,"Unknown Tree ID %d\n",car(e));
 	    error(-1);
 	    return 0;
 	}
@@ -3081,7 +3081,7 @@
     int assign = 0;
     char *p;
 
-//    printf("## asm\n");
+//    if (lsrc)printf("## asm\n");
     e = reverse0(e);
 
     for(i=out;i;i=cadr(i)) {
@@ -3494,7 +3494,7 @@
 	    emit_string(((NMTBL *)cadr(e))->nm,n->ty);
 	    return;
 	}
-    // fprintf(stderr,"## type= %d\n",t);
+    // if (lsrc)fprintf(stderr,"## type= %d\n",t);
     }
     error(INERR);
 }
@@ -3551,7 +3551,7 @@
 	if (!is_const(e)) error(INERR);
 	else emit_data(e,t,n);
     } else if(mode==SFDINIT) {
-// printf("## %d sfdinit c0(e)=%d type=%d t=%d offset=%d\n",lineno,car(e),type,t,offset);
+// if (lsrc)printf("## %d sfdinit c0(e)=%d type=%d t=%d offset=%d\n",lineno,car(e),type,t,offset);
 	decl_str_init=insert_ascend(decl_str_init,
 		list4(offset,0,e,list2(t,type)),str_init_eq);
     } else {
@@ -3598,7 +3598,7 @@
             assign_data(list2(CONST,offset-offset0),EMPTY,n,offset0);
         }
         type=cadr(cadddr(decl_str_init));
-// printf("## %d flush   c0(e)=%d type=%d t=%d offset=%d\n",lineno,car(e),type,t,offset);
+// if (lsrc)printf("## %d flush   c0(e)=%d type=%d t=%d offset=%d\n",lineno,car(e),type,t,offset);
         offset0 = assign_data(e,t,n,offset);
         decl_str_init = cadr(decl_str_init);
     }
@@ -3639,12 +3639,12 @@
 
     /* f(a,b,c)  int c; short a; char* b; { } case */
 #if ARG_REORDER_DEBUG
- fprintf(stderr,"arg_reorder old:\n");
+ if (lsrc)fprintf(stderr,"arg_reorder old:\n");
     for(j=new_arg;j;j=cadr(j)) {
 	    n=(NMTBL *)caddr(j);
- fprintf(stderr,"dsp %d %s sz %d type %d\n",n->dsp,n->nm,cadddr(j),car(j));
+ if (lsrc)fprintf(stderr,"dsp %d %s sz %d type %d\n",n->dsp,n->nm,cadddr(j),car(j));
     }
- fprintf(stderr,"arg_reorder new:\n");
+ if (lsrc)fprintf(stderr,"arg_reorder new:\n");
 #endif
     for(j=arg;j;j=cadr(j)) {
 	n=(NMTBL *)caddr(j);
@@ -3654,7 +3654,7 @@
 	    // if (n1==n) break;
 	}
 #if ARG_REORDER_DEBUG
- fprintf(stderr,"dsp %d %s %s sz %d type %d\n",dsp,n->nm,n1->nm,cadddr(i),car(i));
+ if (lsrc)fprintf(stderr,"dsp %d %s %s sz %d type %d\n",dsp,n->nm,n1->nm,cadddr(i),car(i));
 #endif
 	if (!i) {
 	    /* f(a,b,c) int c; { } case (what?!) */
@@ -3676,7 +3676,7 @@
 	arg_types = glist2(n->ty, arg_types);
     }
 #if ARG_REORDER_DEBUG
- fprintf(stderr,"arg_reorder end:\n");
+ if (lsrc)fprintf(stderr,"arg_reorder end:\n");
 #endif
     caddr(fnptr->ty) = reverse0(arg_types);
     return arg;
@@ -4715,7 +4715,7 @@
 {
     int reg;
 if (car(e1)==BIT_FIELD) {
-//    printf("## bit_field_bug\n");
+//    if (lsrc)printf("## bit_field_bug\n");
     e1 = cadr(e1);
 }
     g_expr(e1);
--- a/mc-parse.c	Sun Nov 26 11:23:03 2006 +0900
+++ b/mc-parse.c	Sun Nov 26 13:16:50 2006 +0900
@@ -774,6 +774,9 @@
     if (macroeq("c2cbc")) conv=&c2cbc_converter;
     else if (macroeq("cbc2c")) conv=&cbc2c_converter;
     else if (macroeq("c")) conv=&c_converter;
+#if UDPCL
+    else if (macroeq("udpcl")) conv=&udpcl_converter;
+#endif
     else conv=&null_converter;
 }
 
--- a/mc-switch.c	Sun Nov 26 11:23:03 2006 +0900
+++ b/mc-switch.c	Sun Nov 26 13:16:50 2006 +0900
@@ -147,7 +147,7 @@
     *delta = g;
 #if 0
     if (count1*128>(range*128*CASE_MERGE_RATE/100)) {
-	printf("## min %d, max %d, count %d, delta %d, rate %g t=%d\n",
+	if (lsrc) printf("## min %d, max %d, count %d, delta %d, rate %g t=%d\n",
 	    min,max,count1,g,
 		 ((double)count1)*100.0/range,
 	       count1*128>(range*128*CASE_MERGE_RATE/100)
@@ -212,7 +212,7 @@
     for(;count-->0;cslist=cadr(cslist)) {
 	list = car(cslist);
 #ifdef DEBUG_MERGE
-	printf("## cascade cases delta=%d count=%d min=%d max=%d\n",
+	if (lsrc) printf("## cascade cases delta=%d count=%d min=%d max=%d\n",
 		caddr(cslist),car(cadddr(cslist)),
 				cadr(cadddr(cslist)),caddr(cadddr(cslist))
 		);
@@ -245,7 +245,7 @@
 	max=caddr(cadddr(list));
     }
 
-    printf("## table count %d delta %d max %d min %d\n",
+    if (lsrc) printf("## table count %d delta %d max %d min %d\n",
 	    count,delta,max,min);
 
     l = fwdlabel();
@@ -291,7 +291,7 @@
 switch_make_index_leaf(int count,int index,int level)
 {
     control=1;
-    printf("## index leaf count=%d level=%d\n",count,level);
+    if (lsrc) printf("## index leaf count=%d level=%d\n",count,level);
     for(;count-- !=0 && cadr(index);index=cadr(index)) {
 	switch_index_jmp( cadr(index), index_label(index) );
     }
@@ -352,7 +352,7 @@
     control=1;
     for(;count-- !=0 && merge;merge=cadr(merge)) {
 #ifdef DEBUG_MERGE
-	printf("## merge count %d delta %d c_count %d\n",
+	if (lsrc) printf("## merge count %d delta %d c_count %d\n",
 		car(merge),caddr(merge),cadddr(merge));
 #endif
 	if (cadddr(merge)>CASE_TABLE_COUNT) {
@@ -421,7 +421,7 @@
     int i;
     int j;
     for(i=cslist;i;i=cadr(i)) {
-	printf("## case %d L_%d\n",car(i),caddr(i));
+	if (lsrc) printf("## case %d L_%d\n",car(i),caddr(i));
     }
 #endif
     control=1;
@@ -438,13 +438,13 @@
     merge = merge_chunk(chunks);
 #if 0
     //  chunks: list3(widest,next,delta);
-    printf("## chunks %d = sum ",j);
+    if (lsrc) printf("## chunks %d = sum ",j);
     j = 0;
     for(i=merge;i;i=cadr(i)) {
-	printf(" %d/%d",car(i),caddr(i));
+	if (lsrc) printf(" %d/%d",car(i),caddr(i));
 	j+=car(i);
     }
-    printf(" sum = %d\n",j);
+    if (lsrc) printf(" sum = %d\n",j);
 #endif
     /* make index branch or table jump */
     gmax = chunk_max(chunks);