changeset 502:bc66e49e25a2

inline continue...
author kono
date Fri, 23 Dec 2005 17:30:00 +0900
parents a63eb2319d11
children 3c95c69aa80e
files Changes mc-inline.c
diffstat 2 files changed, 28 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Fri Dec 23 16:21:25 2005 +0900
+++ b/Changes	Fri Dec 23 17:30:00 2005 +0900
@@ -7473,3 +7473,5 @@
 
 parital evaluator では、pexpr を再帰呼出ししないといけないわけね。
 
+recursive inline の検出はやらないといけないわけね。
+
--- a/mc-inline.c	Fri Dec 23 16:21:25 2005 +0900
+++ b/mc-inline.c	Fri Dec 23 17:30:00 2005 +0900
@@ -409,8 +409,8 @@
     int sz = is_memory(e1);
     int d = cadr(e1);
     int d1;
-    if ((d1=(heap[pdisp+e1]))) return d1;
-    return (heap[pdisp+d]=new_lvar(sz));
+    if ((d1=(heap[pdisp+d]))) return d1;
+    return (heap[pdisp+d]=list3(LVAR,new_lvar(sz),0));
 }
 
 static int
@@ -455,6 +455,12 @@
 }
 
 static int
+prexpr(int op,int e1,int e2)
+{
+    return list3(op,pexpr(e1),pexpr(e2));
+}
+
+static int
 psassign(int e)
 {
     return list4(car(e),pexpr(cadr(e)),pexpr(caddr(e)),cadddr(e));
@@ -616,31 +622,31 @@
 static int
 p_break(int e)
 {
-    return list2(ST_BREAK,expr(cadr(e)));
+    return list2(ST_BREAK,pexpr(cadr(e)));
 }
 
 static int
 p_continue(int e)
 {
-    return list2(ST_CONTINUE,expr(cadr(e)));
+    return list2(ST_CONTINUE,pexpr(cadr(e)));
 }
 
 static int
 p_case(int e)
 {
-    return list3(ST_CASE,expr(cadr(e)),caddr(e));
+    return list3(ST_CASE,pexpr(cadr(e)),caddr(e));
 }
 
 static int
 p_default(int e)
 {
-    return list2(ST_DEFAULT,expr(cadr(e)));
+    return list2(ST_DEFAULT,pexpr(cadr(e)));
 }
 
 static int
 p_return(int e)
 {
-    return list3(ST_RETURN,expr(cadr(e)),expr(caddr(e)));
+    return list3(ST_RETURN,pexpr(cadr(e)),pexpr(caddr(e)));
 }
 
 static int
@@ -654,7 +660,7 @@
 	case FLABEL: break;
 	}
     }
-    return list3(ST_GOTO,expr(cadr(e)),e1);
+    return list3(ST_GOTO,pexpr(cadr(e)),e1);
 }
 
 static int
@@ -678,7 +684,7 @@
 static int
 p_label(int e)
 {
-    return list3(ST_GOTO,expr(cadr(e)),caddr(e));
+    return list3(ST_GOTO,pexpr(cadr(e)),caddr(e));
 }
 
 static int
@@ -700,6 +706,7 @@
     int e2,e3;
 
     // if (inmode) error(-1);
+    if (e1==0) return 0;
     e2 = cadr(e1);
     switch (car(e1)){
     case GVAR: case RGVAR: case CRGVAR: case CURGVAR: case SRGVAR:
@@ -753,7 +760,7 @@
 #endif
 	return prindirect(e1);
     case ADDRESS:
-	return paddress(e2);
+	return paddress(e1);
     case MINUS:
 	if ((e3 = pexpr(e2))==e2) return e1;
 	if (car(e3)==CONST) return list2(CONST,-cadr(e3));
@@ -883,6 +890,14 @@
     case ENVIRONMENT:
     case LCALL:
 	return e1;
+// relational operator
+    case GT: case UGT: case GE: case UGE: case LT:
+    case ULT: case LE: case ULE:
+    case DOP+GT: case DOP+GE: case DOP+LT: case DOP+LE:
+    case FOP+GT: case FOP+GE: case FOP+LT: case FOP+LE:
+    case FOP+EQ: case FOP+NEQ:
+    case EQ: case NEQ: case DOP+EQ: case DOP+NEQ:
+	return prexpr(car(e1),cadr(e1),caddr(e1));
 #if BIT_FIELD_CODE
     case RBIT_FIELD:
 	return prbit_field(e1);
@@ -944,7 +959,7 @@
 	if (is_const(e4) /* ||(is_memory(e3)&&is_readonly(e3)) */ ) {
 	    heap[pdisp+narg]=e4;
 	} else {
-	    arg = heap[pdisp+narg]=new_lvar(size(t));
+	    arg = heap[pdisp+narg]=list3(LVAR,new_lvar(size(t)),cadddr(e3));
 	    g_expr_u(assign_expr0(arg,e4,t,t));
 	}
 	narg ++;