changeset 812:639064060223

fix redundant RBIT_FIELD
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 25 Nov 2010 12:15:56 +0900
parents 4c13e6784414
children a1dff13fefbf
files Changes mc-codegen.c
diffstat 2 files changed, 2 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Thu Nov 25 04:36:27 2010 +0900
+++ b/Changes	Thu Nov 25 12:15:56 2010 +0900
@@ -9931,8 +9931,4 @@
 variadic の最初の引数のアドレスを固定した名前(その関数に局所的な)で覚えておけば、
 stdarg の実装に便利なんじゃないか?
 
-
-
-
-
-
+bitfield に cast すると、良くないらしい。rvalue が二重にかかる。
--- a/mc-codegen.c	Thu Nov 25 04:36:27 2010 +0900
+++ b/mc-codegen.c	Thu Nov 25 12:15:56 2010 +0900
@@ -134,8 +134,6 @@
     int t;
     int suse = use; use=0;
     t=g_expr0(e1);
-    //code_gexpr(e1);
-
     use=suse;
     return t;
 }
@@ -148,8 +146,6 @@
     int t;
     int suse = use; use=1;
     t=g_expr0(e1);
-    //code_gexpr(e1);
-
     use=suse;
     return t;
 }
@@ -703,7 +699,6 @@
     int op = car(e1);
     conv->expr_(e1);
     if (chk) return l1;
-    // gexpr_init();
 
     // is this switch really useful?
     switch(op) {
@@ -900,7 +895,6 @@
 	    e = cadr(e);
 	    return (car(e)==GVAR||car(e)==FNAME||car(e)==LVAR);
 	case STRINGS: case STRING: case GVAR: 
-	// case FUNCTION: case CODE: 
 	case EXTRN: case EXTRN1: case FNAME:
 	case CONST: case LCONST: case FCONST: case DCONST:
 	return 1;
@@ -1122,13 +1116,11 @@
 	*target = append5(*target,t,ty,e1,list3(e1,0,sz));
 #if FLOAT_CODE
     } else if (ty==DOUBLE && sz==size_of_double && (e1=get_dregister_var(0,1))!=-1) {
-	// e1=list3(DREGISTER,e1,0);
 	if (code_register_overlap(s,e1)) goto use_lvar;
 	*use=list3(t,*use,e1);
 	g_expr_u(assign_expr0(e1,s,ty,ty));
 	*target = append5(*target,t,ty,e1,list3(e1,0,sz));
     } else if (ty==FLOAT && sz==size_of_float && (e1=get_dregister_var(0,0))!=-1) {
-	// e1=list3(FREGISTER,e1,0);
 	if (code_register_overlap(s,e1)) goto use_lvar;
 	*use=list3(t,*use,e1);
 	g_expr_u(assign_expr0(e1,s,ty,ty));
@@ -1136,7 +1128,6 @@
 #endif
 #if LONGLONG_CODE
     } else if ((ty==LONGLONG||ty==ULONGLONG)&&(e1=get_lregister_var(0))!=-1) {
-	// e1=list3(LREGISTER,e1,0);
 	if (code_register_overlap(s,e1)) goto use_lvar;
 	*use=list3(t,*use,e1);
 	g_expr_u(assign_expr0(e1,s,ty,ty));
@@ -2205,8 +2196,6 @@
 static int
 double_value(int e2)
 {
-    int t = type_value(type);
-    if (t>0&&car(t)==BIT_FIELD) e2=rvalue(e2);
     switch(car(e2)) {
     case LCONST:
 #if LONGLONG_CODE
@@ -2235,8 +2224,6 @@
 static int
 float_value(int e2)
 {
-    int t = type_value(type);
-    if (t>0&&car(t)==BIT_FIELD) e2=rvalue(e2);
     if (0) ;
 #if LONGLONG_CODE
     else if (car(e2)==LCONST)  e2 =  dlist2(FCONST,(double)lcadr(e2));
@@ -2264,8 +2251,6 @@
 static int
 longlong_value(int e2)
 {
-    int t = type_value(type);
-    if (t>0&&car(t)==BIT_FIELD) e2=rvalue(e2);
     if (0) ;
     else if (car(e2)==CONST)  e2 = llist2(LCONST,(long long)cadr(e2));
     else if (car(e2)==LCONST) ;
@@ -2293,11 +2278,8 @@
 static int
 ulonglong_value(int e2)
 {
-    int t = type_value(type);
-    if (t>0&&car(t)==BIT_FIELD) e2=rvalue(e2);
     if (0);
     else if (car(e2)==CONST)  {
-	// if (cadr(e2)<0) e2 = llist2(LCONST,0);
 	e2 = llist2(LCONST,(unsigned long long)cadr(e2));
     }
     else if (car(e2)==LCONST)  ;
@@ -2330,7 +2312,6 @@
 int_value(int e2)
 {
     int t = type_value(type);
-    if (t>0&&car(t)==BIT_FIELD) { e2=rvalue(e2); t=type_value(type); }
     if (0);
     else if(t>0&&car(t)==ARRAY) return e2;
     else if(scalar(t)) { type = set_type_with_attr(INT,type); return e2; }
@@ -2380,8 +2361,7 @@
 unsigned_value(int e2)
 {
     int t = type_value(type);
-    if (t>0&&car(t)==BIT_FIELD) { e2=rvalue(e2); t=type_value(type); }
-    else if(t>0&&car(t)==ARRAY) return e2;
+    if(t>0&&car(t)==ARRAY) return e2;
     if (0);
     else if(scalar(t)) { type = set_type_with_attr(UNSIGNED,type); return e2; }
 #if FLOAT_CODE
@@ -3296,7 +3276,6 @@
     int assign = 0;
     char *p;
 
-//    if (lsrc)printf("## asm\n");
     e = reverse0(e);
 
     for(i=out;i;i=cadr(i)) {