changeset 437:49d4483d5110

LRULVAR in lassign
author kono
date Sun, 14 Nov 2004 23:50:11 +0900
parents d92786033042
children 626d705471d5
files Changes mc-codegen.c
diffstat 2 files changed, 39 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Sun Nov 14 15:41:05 2004 +0900
+++ b/Changes	Sun Nov 14 23:50:11 2004 +0900
@@ -6613,3 +6613,32 @@
 
 なんでかね。
 
+Sun Nov 14 15:59:33 JST 2004
+
+よし、inline やるか。
+
+   inline function (or parsed tree)
+       list4(INLINE,name,type)
+   declaration (argument, local, static)
+       list4(DECL,next,type,name)        done by def (?)
+   statement
+       list3(IF,next,list3(cond,then,else))
+       list3(DO,next,list2(cond,while))
+       list3(FOR,next,list4(A,B,C,body))
+       list4(SWITCH,next,expr,body)
+       list3(COMP,next,body)
+       list2(BREAK,next)
+       list2(CONTINUE,next)
+       list3(CASE,next,label)
+       list3(RETURN,next,expr)
+       list3(GOTO,next,expr,env)
+       list3(ASM,next,list4(A,B,C,D))
+       list3(LABEL,next,label)
+       list3(COMMENT,next,comment)  (?)
+
+ (1) make inline tree
+ (2) evaluate inline function (copy and partial evaluation)
+
+
+
+    
--- a/mc-codegen.c	Sun Nov 14 15:41:05 2004 +0900
+++ b/mc-codegen.c	Sun Nov 14 23:50:11 2004 +0900
@@ -1392,12 +1392,12 @@
     case CURGVAR:  code_crgvar(e4,reg,e5==CRGVAR,1); return;
     case SRGVAR:  
     case SURGVAR:  code_crgvar(e4,reg,e5==SRGVAR,size_of_short); return;
-    case RGVAR:    code_rgvar(e4,reg);  return;
+    case RGVAR: case URGVAR:   code_rgvar(e4,reg);  return;
     case CRLVAR:  
     case CURLVAR:  code_crlvar(cadr(e4),reg,e5==CRLVAR,1); return;
     case SRLVAR:  
     case SURLVAR:  code_crlvar(cadr(e4),reg,e5==SRLVAR,size_of_short); return;
-    case RLVAR:    code_rlvar(cadr(e4),reg);  return;
+    case RLVAR: case URLVAR:   code_rlvar(cadr(e4),reg);  return;
     case GVAR:     code_gvar(e4,reg);   return;
     case LVAR:     code_lvar(cadr(e4),reg);   return;
     case CONST:    code_const(cadr(e4),reg); return;
@@ -1434,6 +1434,7 @@
 		if (!((car(cadr(e4))==STRING) || car(cadr(e4))==GVAR)) 
 		    break; 
 	    case  CRGVAR  : case  CRLVAR  : case  RGVAR  : case  RLVAR :
+	    case  URGVAR  : case  URLVAR :
 	    case  CURGVAR  : case  CURLVAR  :
 	    case  SURGVAR  : case  SURLVAR  :
 	    case  GVAR  : case  LVAR :
@@ -1587,8 +1588,8 @@
     if (car(e2)!=LREGISTER) error(-1);
     reg = cadr(e2);
     switch(e5) {
-    case LRGVAR: code_lrgvar(e4,reg); return;
-    case LRLVAR: code_lrlvar(cadr(e4),reg); return;
+    case LRGVAR: case LURGVAR: code_lrgvar(e4,reg); return;
+    case LRLVAR: case LURLVAR: code_lrlvar(cadr(e4),reg); return;
     case LCONST: code_lconst(e4,reg); return;
     default:
 	    error(-1);
@@ -1609,8 +1610,9 @@
 	return;
     }
     if (!use && (
-	    (e5==LREGISTER) ||
-	    (car(e2)==LREGISTER&&(e5==LRGVAR||e5==LRLVAR||e5==LCONST))
+	(e5==LREGISTER &&(car(e2)==GVAR||car(e2)==LVAR||car(e2)==LREGISTER)) ||
+	    (car(e2)==LREGISTER&&
+		(e5==LRGVAR||e5==LRLVAR||e5==LURLVAR||e5==LURGVAR||e5==LCONST))
 	)) {
 	lassign_opt(e5,e2,e4);
 	return;
@@ -1625,9 +1627,9 @@
 	    code_lassign_lvar(cadr(e2),USE_CREG);
             return;
     case LREGISTER:
-            g_expr(e4);
+	    g_expr(e4);
 	    code_lassign_lregister(cadr(e2),USE_CREG);
-            return;
+	    return;
     }
     g_expr(e2);
     emit_push();