changeset 659:2a3b1cddd45f

*** empty log message ***
author kono
date Wed, 24 Jan 2007 14:31:50 +0900 (2007-01-24)
parents cb3809f4ec97
children 3e1dba5758d8
files Changes mc-codegen.c
diffstat 2 files changed, 33 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Wed Jan 24 13:48:28 2007 +0900
+++ b/Changes	Wed Jan 24 14:31:50 2007 +0900
@@ -9203,3 +9203,7 @@
 ���Ƥ��ޤ��ȡ�����Ͻ���ʤ���deleyed �ߤ����ʰ����򤹤�Ф���?
 �ºݤ˻Ȥ���Ȥ�����emit_init_vars() ����ߤ�����?
 
+
+Wed Jan 24 14:12:20 JST 2007
+
+get_register_var ��Ȥä��塢free ���Ƥʤ��㤬¿���ߤ�����
--- a/mc-codegen.c	Wed Jan 24 13:48:28 2007 +0900
+++ b/mc-codegen.c	Wed Jan 24 14:31:50 2007 +0900
@@ -1076,7 +1076,8 @@
 static void
 save_target(int t,int s,int *target,int *use,int sz,int ty)
 {
-    int e1;
+    int e1 = 0;
+    // �Ȥä��� free ����٤������? code goto �λ��ʤ鳲�Ϥʤ���...
     /*�������쥸����(or �����å�)���������*/
     if (scalar(ty) && sz==size_of_int && (e1=get_register_var(0))!=-1) {
 	// e1=list3(REGISTER,e1,0);
@@ -2464,7 +2465,7 @@
 iassop(int e1)
 {
     int e2,e3,byte,op,sign,size;
-    int n,t;
+    int t;
 
     /*   e2 op= e3 */
     switch(car(e1)) {
@@ -2494,18 +2495,24 @@
 	/*  e2 = e2 op e3; */
 	t = sign?INT:UNSIGNED;
 	// oprtc expected
-	if (car(e2)==LVAR||car(e2)==GVAR) {
+	if (car(e2)==LVAR||car(e2)==GVAR||
+                 (car(e2)==INDIRECT&&car(cadr(e2))==REGISTER)) {
 	    g_expr(assign_expr0(e2,list3(op,rvalue_t(e2,t),e3),t,t));
 	    return;
 	}
+#if 0
 	/*  new = &e2 */
 	/*  *new = *new op e3 */
-	n = list3(LVAR,new_lvar(size_of_int),0);
+	// e2 ��ʣ���ʼ��Ǥʤ��ȵѤäƤ���ʤ��Ȥ⤢��
+	// register ������о��ͭ����?
+	// ���֤�i386 �λ��ˤ�ͭ�����ä���������ʤ���
+	int n = list3(LVAR,new_lvar(size_of_int),0); // get register var?
 	g_expr_u(assign_expr0(n,list2(ADDRESS,e2),INT,INT));
 	g_expr(assign_expr0(rvalue_t(n,INT),
 	    list3(op,rvalue_t(list2(INDIRECT,rvalue_t(n,INT)),t),e3),t,t));
 	free_lvar(cadr(n));
 	return;
+#endif
     }
     g_expr(e3);
     emit_push();
@@ -2528,14 +2535,25 @@
     e3 = caddr(e1);
     op = cadddr(e1);
 
-    g_expr(e3);
     if (car(e2)==DREGISTER||car(e2)==FREGISTER) {
+	g_expr(e3);
         emit_dpush(d);
 	code_register_dassop(cadr(e2),op,d);
         if (use)
             code_dregister(cadr(e2),USE_CREG,d);
         return;
     }
+    if (car(e3)==DCONST||car(e3)==FCONST) {
+	/*  e2 = e2 op e3; */
+	int t = d?DOUBLE:FLOAT;
+	// oprtc expected
+	if (car(e2)==LVAR||car(e2)==GVAR||
+                 (car(e2)==INDIRECT&&car(cadr(e2))==REGISTER)) {
+	    g_expr(assign_expr0(e2,list3(op,rvalue_t(e2,t),e3),t,t));
+	    return;
+	}
+    }
+    g_expr(e3);
     emit_dpush(d);
     g_expr(e2);
     code_dassop(op,USE_CREG,d);
@@ -2556,7 +2574,7 @@
 lassop(int e1)
 {
     int e2,e3,op;
-    int n,t;
+    int t;
 
     /*   e2 op= e3 */
     e2 = cadr(e1);
@@ -2585,18 +2603,21 @@
     if (!code_lassop_p||car(e3)==LCONST) {
 	/*  e2 = e2 op e3; */
 	t = long_sign(op);
-	if (car(e2)==LREGISTER||car(e2)==LVAR||car(e2)==GVAR) {
+	if (car(e2)==LREGISTER||car(e2)==LVAR||car(e2)==GVAR||
+                 (car(e2)==INDIRECT&&car(cadr(e2))==REGISTER)) {
 	    g_expr(assign_expr0(e2,list3(op,rvalue_t(e2,t),e3),t,t));
 	    return;
 	}
+#if 0
 	/*  new = &e2 */
 	/*  *new = *new op e3 */
-	n = list3(LVAR,new_lvar(size_of_int),0);
+	int n = list3(LVAR,new_lvar(size_of_int),0);
 	g_expr_u(assign_expr0(n,list2(ADDRESS,e2),INT,INT));
         g_expr(assign_expr0(rvalue_t(n,INT),
             list3(op,rvalue_t(list2(INDIRECT,rvalue_t(n,INT)),t),e3),t,t));
         free_lvar(cadr(n));
 	return;
+#endif
     }
 
     g_expr(e3);