diff mc-codegen.c @ 221:ceae585186d9

*** empty log message ***
author kono
date Mon, 26 Apr 2004 05:35:33 +0900
parents 97246ddfe8ab
children 3d214303bae9
line wrap: on
line diff
--- a/mc-codegen.c	Sun Apr 25 19:03:04 2004 +0900
+++ b/mc-codegen.c	Mon Apr 26 05:35:33 2004 +0900
@@ -6,14 +6,8 @@
 #include "mc-codegen.h"
 #include "mc-code.h"
 
-int  creg;     /* current register */
-
 int use;       /* generated value will be used */
 
-/*
-    creg   currrent virtual register
- */
-
 static void remove0(int *parent,int e) ;
 /* static void remove0_all(int *parent,int e) ; */
 static int is_same_type(int e1,int e2);
@@ -102,136 +96,106 @@
     e2 = cadr(e1);
     switch (car(e1)){
     case GVAR:   
-	creg=use_int(creg);
-	code_gvar(e1,creg);
+	code_gvar(e1,USE_CREG);
 	return ADDRESS;
     case RGVAR:
-	creg=use_int(creg);
-	code_rgvar(e1,creg);
+	code_rgvar(e1,USE_CREG);
 	return INT;
     case CRGVAR:
-	creg=use_int(creg);
-	code_crgvar(e1,creg,1,1);
+	code_crgvar(e1,USE_CREG,1,1);
 	return CHAR;
     case CURGVAR:
-	creg=use_int(creg);
-	code_crgvar(e1,creg,0,1);
+	code_crgvar(e1,USE_CREG,0,1);
 	return UCHAR;
     case SRGVAR:
-	creg=use_int(creg);
-	code_crgvar(e1,creg,1,size_of_short);
+	code_crgvar(e1,USE_CREG,1,size_of_short);
 	return CHAR;
     case SURGVAR:
-	creg=use_int(creg);
-	code_crgvar(e1,creg,0,size_of_short);
+	code_crgvar(e1,USE_CREG,0,size_of_short);
 	return UCHAR;
     case LVAR:
-	creg=use_int(creg);
-	code_lvar(e2,creg);
+	code_lvar(e2,USE_CREG);
 	return ADDRESS;
     case REGISTER:
-	creg=use_int(creg);
-	code_register(e2,creg);
+	code_register(e2,USE_CREG);
 	return INT;
 #if FLOAT_CODE
     case DREGISTER:
-	creg=use_double(creg);
-	code_dregister(e2,creg,1);
+	code_dregister(e2,USE_CREG,1);
 	return DOUBLE;
     case FREGISTER:
-	creg=use_float(creg);
-	code_dregister(e2,creg,0);
+	code_dregister(e2,USE_CREG,0);
 	return FLOAT;
 #endif
 #if LONGLONG_CODE
     case LREGISTER:
-	creg=use_longlong(creg);
-	code_lregister(e2,creg);
+	code_lregister(e2,USE_CREG);
 	return LONGLONG;
 #endif
     case RLVAR:
-	creg=use_int(creg);
-	code_rlvar(e2,creg);
+	code_rlvar(e2,USE_CREG);
 	return INT;
     case CRLVAR:
-	creg=use_int(creg);
-	code_crlvar(e2,creg,1,1);
+	code_crlvar(e2,USE_CREG,1,1);
 	return CHAR;
     case CURLVAR:
-	creg=use_int(creg);
-	code_crlvar(e2,creg,0,1);
+	code_crlvar(e2,USE_CREG,0,1);
 	return UCHAR;
     case SRLVAR:
-	creg=use_int(creg);
-	code_crlvar(e2,creg,1,size_of_short);
+	code_crlvar(e2,USE_CREG,1,size_of_short);
 	return CHAR;
     case SURLVAR:
-	creg=use_int(creg);
-	code_crlvar(e2,creg,0,size_of_short);
+	code_crlvar(e2,USE_CREG,0,size_of_short);
 	return UCHAR;
 #if FLOAT_CODE
     case FRLVAR:
-	creg=use_float(creg);
-	code_drlvar(e2,0,creg);
+	code_drlvar(e2,0,USE_CREG);
 	return FLOAT;
     case FRGVAR:
-	creg=use_float(creg);
-	code_drgvar(e1,0,creg);
+	code_drgvar(e1,0,USE_CREG);
 	return FLOAT;
     case DRLVAR:
-	creg=use_double(creg);
-	code_drlvar(e2,1,creg);
+	code_drlvar(e2,1,USE_CREG);
 	return DOUBLE;
     case DRGVAR:
-	creg=use_double(creg);
-	code_drgvar(e1,1,creg);
+	code_drgvar(e1,1,USE_CREG);
 	return DOUBLE;
 #endif
 #if LONGLONG_CODE
     case LRLVAR:
-	creg=use_longlong(creg);
-	code_lrlvar(e2,creg);
+	code_lrlvar(e2,USE_CREG);
 	return LONGLONG;
     case LRGVAR:
-	creg=use_longlong(creg);
-	code_lrgvar(e1,creg);
+	code_lrgvar(e1,USE_CREG);
 	return LONGLONG;
     case LURLVAR:
-	creg=use_longlong(creg);
-	code_lrlvar(e2,creg);
+	code_lrlvar(e2,USE_CREG);
 	return ULONGLONG;
     case LURGVAR:
-	creg=use_longlong(creg);
-	code_lrgvar(e1,creg);
+	code_lrgvar(e1,USE_CREG);
 	return ULONGLONG;
 #endif
     case FNAME:
-	creg=use_int(creg);
-	code_fname((NMTBL *)(e2),creg);
+	code_fname((NMTBL *)(e2),USE_CREG);
 	return ADDRESS;
     case CONST:  /* 代入する値が0でも特別な処理はしない */
-	creg=use_int(creg);
-	code_const(e2,creg);
+	code_const(e2,USE_CREG);
 	return INT;
 #if FLOAT_CODE
     case DCONST:
-	creg=use_double(creg);
-	code_dconst(e1,creg,1);
+	code_dconst(e1,USE_CREG,1);
 	return DOUBLE;
     case FCONST:
-	creg=use_float(creg);
-	code_dconst(e1,creg,0);
+	code_dconst(e1,USE_CREG,0);
 	return FLOAT;
 #endif
 #if LONGLONG_CODE
     case LCONST:
-	creg=use_longlong(creg);
-	code_lconst(e1,creg);
+	code_lconst(e1,USE_CREG);
 	return LONGLONG;
 #endif
     case STRING:
-	creg=use_int(creg);
-	code_string(e1,creg);
+	code_string(e1,USE_CREG);
 	return ADDRESS;
     case FUNCTION:
 	t = function(e1);
@@ -242,28 +206,28 @@
     case INDIRECT:
 	return g_expr0(e2);
     case RINDIRECT:  
-	return code_rindirect(e2,caddr(e1),0);
+	return code_rindirect(e2,USE_CREG,caddr(e1),0);
     case URINDIRECT:  
-	return code_rindirect(e2,caddr(e1),1);
+	return code_rindirect(e2,USE_CREG,caddr(e1),1);
     case CRINDIRECT: 
-	return code_crindirect(e2,caddr(e1),0);
+	return code_crindirect(e2,USE_CREG,caddr(e1),0);
     case CURINDIRECT:
-	return code_crindirect(e2,caddr(e1),1);
+	return code_crindirect(e2,USE_CREG,caddr(e1),1);
     case SRINDIRECT: 
-	return code_srindirect(e2,caddr(e1),0);
+	return code_srindirect(e2,USE_CREG,caddr(e1),0);
     case SURINDIRECT:
-	return code_srindirect(e2,caddr(e1),1);
+	return code_srindirect(e2,USE_CREG,caddr(e1),1);
 #if FLOAT_CODE
     case FRINDIRECT:
-	return code_drindirect(e2,caddr(e1),0);
+	return code_drindirect(e2,USE_CREG,caddr(e1),0);
     case DRINDIRECT: 
-	return code_drindirect(e2,caddr(e1),1);
+	return code_drindirect(e2,USE_CREG,caddr(e1),1);
 #endif
 #if LONGLONG_CODE
     case LRINDIRECT: 
-	return code_lrindirect(e2,caddr(e1),0);
+	return code_lrindirect(e2,USE_CREG,caddr(e1),0);
     case LURINDIRECT:
-	return code_lrindirect(e2,caddr(e1),1);
+	return code_lrindirect(e2,USE_CREG,caddr(e1),1);
 #endif
     case ADDRESS:
 	if (car(e2)==REGISTER||car(e2)==DREGISTER||car(e2)==FREGISTER)
@@ -271,54 +235,54 @@
 	else
 	    return g_expr0(e2);
     case MINUS:  /* レジスタに対し、neglを実行すれば実現可能 */
-	g_expr0(e2); code_neg(creg);
+	g_expr0(e2); code_neg(USE_CREG);
 	return INT;
 #if LONGLONG_CODE
     case LMINUS: 
-	g_expr0(e2); code_lneg(creg);
+	g_expr0(e2); code_lneg(USE_CREG);
 	return LONGLONG;
 #endif
 #if FLOAT_CODE
     case DMINUS: 
-	g_expr0(e2); code_dneg(creg,1);
+	g_expr0(e2); code_dneg(USE_CREG,1);
 	return DOUBLE;
     case FMINUS: 
-	g_expr0(e2); code_dneg(creg,0);
+	g_expr0(e2); code_dneg(USE_CREG,0);
 	return FLOAT;
 #endif
     case CONV: 
 	g_expr0(e2); 
 	switch(caddr(e1)) {
 #if FLOAT_CODE
-	case I2D: code_i2d(creg); return DOUBLE;
-	case D2I: code_d2i(creg); return INT;
-	case U2D: code_u2d(creg); return DOUBLE;
-	case F2U: code_f2u(creg); return UNSIGNED;
-	case I2F: code_i2f(creg); return FLOAT;
-	case F2I: code_f2i(creg); return INT;
-	case U2F: code_u2f(creg); return FLOAT;
-	case D2U: code_d2u(creg); return UNSIGNED;
-	case D2F: code_d2f(creg); return FLOAT;
-	case F2D: code_f2d(creg); return DOUBLE;
+	case I2D: code_i2d(USE_CREG); return DOUBLE;
+	case D2I: code_d2i(USE_CREG); return INT;
+	case U2D: code_u2d(USE_CREG); return DOUBLE;
+	case F2U: code_f2u(USE_CREG); return UNSIGNED;
+	case I2F: code_i2f(USE_CREG); return FLOAT;
+	case F2I: code_f2i(USE_CREG); return INT;
+	case U2F: code_u2f(USE_CREG); return FLOAT;
+	case D2U: code_d2u(USE_CREG); return UNSIGNED;
+	case D2F: code_d2f(USE_CREG); return FLOAT;
+	case F2D: code_f2d(USE_CREG); return DOUBLE;
 #endif
 #if LONGLONG_CODE
-	case  I2LL: code_i2ll(creg); return LONGLONG;
-	case  I2ULL: code_i2ull(creg); return ULONGLONG;
-	case  U2LL: code_u2ll(creg); return LONGLONG;
-	case  U2ULL: code_u2ull(creg); return ULONGLONG;
-	case  LL2I: code_ll2i(creg); return INT;
-	case  LL2U: code_ll2u(creg); return UNSIGNED;
-	case  ULL2I: code_ull2i(creg); return INT;
-	case  ULL2U: code_ull2u(creg); return UNSIGNED;
+	case  I2LL: code_i2ll(USE_CREG); return LONGLONG;
+	case  I2ULL: code_i2ull(USE_CREG); return ULONGLONG;
+	case  U2LL: code_u2ll(USE_CREG); return LONGLONG;
+	case  U2ULL: code_u2ull(USE_CREG); return ULONGLONG;
+	case  LL2I: code_ll2i(USE_CREG); return INT;
+	case  LL2U: code_ll2u(USE_CREG); return UNSIGNED;
+	case  ULL2I: code_ull2i(USE_CREG); return INT;
+	case  ULL2U: code_ull2u(USE_CREG); return UNSIGNED;
 #if FLOAT_CODE
-	case  D2LL: code_d2ll(creg); return LONGLONG;
-	case  D2ULL: code_d2ull(creg); return ULONGLONG;
-	case  F2LL: code_f2ll(creg); return LONGLONG;
-	case  F2ULL: code_f2ull(creg); return ULONGLONG;
-	case  LL2D: code_ll2d(creg); return DOUBLE;
-	case  LL2F: code_ll2f(creg); return FLOAT;
-	case  ULL2D: code_ull2d(creg); return DOUBLE;
-	case  ULL2F: code_ull2f(creg); return FLOAT;
+	case  D2LL: code_d2ll(USE_CREG); return LONGLONG;
+	case  D2ULL: code_d2ull(USE_CREG); return ULONGLONG;
+	case  F2LL: code_f2ll(USE_CREG); return LONGLONG;
+	case  F2ULL: code_f2ull(USE_CREG); return ULONGLONG;
+	case  LL2D: code_ll2d(USE_CREG); return DOUBLE;
+	case  LL2F: code_ll2f(USE_CREG); return FLOAT;
+	case  ULL2D: code_ull2d(USE_CREG); return DOUBLE;
+	case  ULL2F: code_ull2f(USE_CREG); return FLOAT;
 #endif
 #endif
 
@@ -326,61 +290,49 @@
 	    error(-1); return INT;
 	}
     case BNOT:   /* ~ */
-	g_expr0(e2); code_not(creg);
+	g_expr0(e2); code_not(USE_CREG);
 	return INT;
     case LNOT:   /* !  */
-	g_expr0(e2); code_lnot(creg);
+	g_expr0(e2); code_lnot(USE_CREG);
 	return INT;
     case PREINC:
-	creg=use_int(creg);
-	code_preinc(e1,e2,caddr(e1),1,cadddr(e1),creg);
+	code_preinc(e1,e2,caddr(e1),1,cadddr(e1),USE_CREG);
 	return INT;
     case UPREINC:
-	creg=use_int(creg);
-	code_preinc(e1,e2,caddr(e1),0,cadddr(e1),creg);
+	code_preinc(e1,e2,caddr(e1),0,cadddr(e1),USE_CREG);
 	return INT;
     case POSTINC:
-	creg=use_int(creg);
-	code_postinc(e1,e2,caddr(e1),1,cadddr(e1),creg);
+	code_postinc(e1,e2,caddr(e1),1,cadddr(e1),USE_CREG);
 	return INT;
     case UPOSTINC:
-	creg=use_int(creg);
-	code_postinc(e1,e2,caddr(e1),0,cadddr(e1),creg);
+	code_postinc(e1,e2,caddr(e1),0,cadddr(e1),USE_CREG);
 	return INT;
 #if FLOAT_CODE
     case DPREINC:   /* ++d */
-	creg=use_double(creg);
-	code_dpreinc(e1,e2,1,creg);
+	code_dpreinc(e1,e2,1,USE_CREG);
 	return DOUBLE;
     case DPOSTINC:  /* d++ */
-	creg=use_double(creg);
-	code_dpostinc(e1,e2,1,creg);
+	code_dpostinc(e1,e2,1,USE_CREG);
 	return DOUBLE;
     case FPREINC:   /* ++f */
-	creg=use_float(creg);
-	code_dpreinc(e1,e2,0,creg);
+	code_dpreinc(e1,e2,0,USE_CREG);
 	return FLOAT;
     case FPOSTINC:  /* f++ */
-	creg=use_float(creg);
-	code_dpostinc(e1,e2,0,creg);
+	code_dpostinc(e1,e2,0,USE_CREG);
 	return FLOAT;
 #endif
 #if LONGLONG_CODE
     case LPREINC:   /* ++d */
-	creg=use_longlong(creg);
-	code_lpreinc(e1,e2,creg);
+	code_lpreinc(e1,e2,USE_CREG);
 	return LONGLONG;
     case LPOSTINC:  /* d++ */
-	creg=use_longlong(creg);
-	code_lpostinc(e1,e2,creg);
+	code_lpostinc(e1,e2,USE_CREG);
 	return LONGLONG;
     case LUPREINC:   /* ++d */
-	creg=use_longlong(creg);
-	code_lpreinc(e1,e2,creg);
+	code_lpreinc(e1,e2,USE_CREG);
 	return ULONGLONG;
     case LUPOSTINC:  /* d++ */
-	creg=use_longlong(creg);
-	code_lpostinc(e1,e2,creg);
+	code_lpostinc(e1,e2,USE_CREG);
 	return ULONGLONG;
 #endif
     case MUL: case UMUL:
@@ -388,20 +340,17 @@
     case MOD: case UMOD:
     case LSHIFT: case ULSHIFT: case RSHIFT: case URSHIFT:
     case ADD: case SUB: case BAND: case EOR: case BOR: case CMP:
-	creg=use_int(creg);
 	machinop(e1);
 	return INT;
 #if FLOAT_CODE
     case DMUL: case DDIV:
     case DADD: case DSUB:
     case DCMP: case DCMPGE:
-	creg=use_double(creg);
 	dmachinop(e1,1);
 	return DOUBLE;
     case FMUL: case FDIV:
     case FADD: case FSUB:
     case FCMP: case FCMPGE:
-	creg=use_float(creg);
 	dmachinop(e1,0);
 	return FLOAT;
     case DCOND:
@@ -413,7 +362,6 @@
     case LMOD: case LUMOD:
     case LLSHIFT: case LULSHIFT: case LRSHIFT: case LURSHIFT:
     case LADD: case LSUB: case LBAND: case LEOR: case LBOR: case LCMP:
-	creg=use_longlong(creg);
 	lmachinop(e1);
 	return INT;
 #endif
@@ -423,7 +371,7 @@
 	e2=fwdlabel();
 	b_expr(cadr(e1),0,e2,0);
         g_expr0(caddr(e1));
-	t = code_get_fixed_creg(creg,d);
+	t = code_get_fixed_creg(USE_CREG,d);
 	jmp(e3=fwdlabel());
 	fwddef(e2);
         t1=g_expr0(cadddr(e1));
@@ -462,18 +410,16 @@
 	g_expr_u(e2);
 	return g_expr0(caddr(e1));
     case RETURN:
-	creg = use_int(creg);
 	n = (NMTBL *)e2;
 	if (retcont==0)
 	    retcont=fwdlabel();
-	code_return(creg);
+	code_return(USE_CREG);
 	return VOID;
     case ENVIRONMENT:
-	creg = use_int(creg);
-	code_environment(creg);
+	code_environment(USE_CREG);
 	return ADDRESS;
     default:
-	code_bool(e1); /* type? */
+	code_bool(e1,USE_CREG); /* type? */
 	return INT;
     }
 }
@@ -631,63 +577,51 @@
 	if(!cond) fwddef(l2);
 	return;
     case CRGVAR: case CURGVAR:
-	creg=use_int(creg);
-	code_cmp_crgvar(e1,1);
+	code_cmp_crgvar(e1,USE_CREG,1);
 	jcond(l1,cond);
 	return;
     case SRGVAR: case SURGVAR:
-	creg=use_int(creg);
-	code_cmp_crgvar(e1,size_of_short);
+	code_cmp_crgvar(e1,USE_CREG,size_of_short);
 	jcond(l1,cond);
 	return;
     case CRLVAR: case CURLVAR:
-	creg=use_int(creg);
-	code_cmp_crlvar(e2,1);
+	code_cmp_crlvar(e2,USE_CREG,1);
 	jcond(l1,cond);
 	return;
     case SRLVAR: case SURLVAR:
-	creg=use_int(creg);
-	code_cmp_crlvar(e2,size_of_short);
+	code_cmp_crlvar(e2,USE_CREG,size_of_short);
 	jcond(l1,cond);
 	return;
     case RGVAR:
-	creg=use_int(creg);
-	code_cmp_rgvar(e1);
+	code_cmp_rgvar(e1,USE_CREG);
 	jcond(l1,cond);
 	return;
     case RLVAR:
-	creg=use_int(creg);
-	code_cmp_rlvar(e2);
+	code_cmp_rlvar(e2,USE_CREG);
 	jcond(l1,cond);
 	return;
 #if FLOATC_DOE
     case DRLVAR:
-	creg=use_double(creg);
-	code_cmp_drlvar(e2,1);
+	code_cmp_drlvar(e2,USE_CREG,1);
 	jcond(l1,cond);
 	return;
     case FRLVAR:
-	creg=use_float(creg);
-	code_cmp_drlvar(e2,0);
+	code_cmp_drlvar(e2,USE_CREG,0);
 	jcond(l1,cond);
 	return;
     case DRGVAR:
-	creg=use_double(creg);
-	code_cmp_drgvar(e2,1);
+	code_cmp_drgvar(e2,USE_CREG,1);
 	jcond(l1,cond);
 	return;
     case FRGVAR:
-	creg=use_float(creg);
-	code_cmp_drgvar(e2,0);
+	code_cmp_drgvar(e2,USE_CREG,0);
 	jcond(l1,cond);
 	return;
     case FREGISTER:
-	creg=use_float(creg);
 	code_cmp_dregister(e2,0);
 	jcond(l1,cond);
 	return;
     case DREGISTER:
-	creg=use_double(creg);
 	code_cmp_dregister(e2,1);
 	jcond(l1,cond);
 	return;
@@ -698,17 +632,14 @@
 #endif
 #if LONGLONG_DOE
     case LRLVAR:
-	creg=use_longlong(creg);
 	code_cmp_lrlvar(e2,1);
 	jcond(l1,cond);
 	return;
     case LRGVAR:
-	creg=use_longlong(creg);
 	code_cmp_lrgvar(e2,1);
 	jcond(l1,cond);
 	return;
     case LREGISTER:
-	creg=use_longlong(creg);
 	code_cmp_lregister(e2,1);
 	jcond(l1,cond);
 	return;
@@ -717,7 +648,6 @@
 	return;
 #endif
     case REGISTER:
-	creg=use_int(creg);
 	code_cmp_register(e2);
 	jcond(l1,cond);
 	return;
@@ -732,16 +662,16 @@
 	if (0) ;
 #if FLOAT_CODE
 	else if(t==FLOAT)
-	    code_cmp_dregister(creg,0);
+	    code_cmp_dregister(USE_CREG,0);
 	else if(t==DOUBLE)
-	    code_cmp_dregister(creg,1);
+	    code_cmp_dregister(USE_CREG,1);
 #endif
 #if LONGLONG_CODE
 	else if(t==LONGLONG||t==ULONGLONG)
-	    code_cmp_lregister(creg);
+	    code_cmp_lregister(USE_CREG);
 #endif
 	else
-	    code_cmp_register(creg);
+	    code_cmp_register(USE_CREG);
 	jcond(l1,cond);
 	return;
     }
@@ -1157,13 +1087,13 @@
     e3 = caddr(e1);
     if (car(e3)==CONST && code_const_op_p(op,v=cadr(e3))) {
 	g_expr(e2);
-	oprtc(op,v);
+	oprtc(op,USE_CREG,v);
 	return;
     }
     g_expr(e3);
     emit_push();
     g_expr(e2);
-    tosop(op,(e2=pop_register()));
+    tosop(op,USE_CREG,(e2=pop_register()));
     emit_pop_free(e2);
     return;
 }
@@ -1180,7 +1110,7 @@
     g_expr(e3);
     emit_dpush(d);
     g_expr(e2);
-    dtosop(car(e1),(e2=emit_dpop(d)));
+    dtosop(car(e1),USE_CREG,(e2=emit_dpop(d)));
     emit_dpop_free(e2,d);
     return;
 }
@@ -1197,13 +1127,13 @@
     e3 = caddr(e1);
     if (code_lconst_op_p(op,e3)) {
 	g_expr(e2);
-	loprtc(op,e3);
+	loprtc(op,USE_CREG,e3);
 	return;
     }
     g_expr(e3);
     emit_lpush();
     g_expr(e2);
-    ltosop(car(e1),(e2=emit_lpop()));
+    ltosop(car(e1),USE_CREG,(e2=emit_lpop()));
     emit_lpop_free(e2);
     return;
 }
@@ -1232,7 +1162,7 @@
     } else {
 	det = 0;
     }
-    emit_copy(xreg,creg,sz,0,1,det);
+    emit_copy(xreg,USE_CREG,sz,0,1,det);
     emit_pop_free(xreg);
     return;
 }
@@ -1250,7 +1180,7 @@
 	case REGISTER: code_assign_register(cadr(e2),byte,reg); return;
 	}
 	g_expr(e2);
-	code_assign(creg,byte,reg);
+	code_assign(reg,byte,USE_CREG);
 	return;
     }
     /* e2 is register now */
@@ -1299,30 +1229,28 @@
 		e5== CONST ||  e5== FNAME || e5== STRING ||
 		(e5==ADDRESS&&car(cadr(e4))==STRING) ||
 		(e5==ADDRESS&&car(cadr(e4))==GVAR) )))) {
-	creg = use_int(creg);
 	assign_opt(e5,e2,e4,byte);
 	return;
     }
     switch(car(e2)) {
     case GVAR:      /*   i=3 */
             g_expr(e4);
-	    code_assign_gvar(e2,creg,byte);
+	    code_assign_gvar(e2,USE_CREG,byte);
             return;
     case LVAR:
             g_expr(e4);
-	    code_assign_lvar(cadr(e2),creg,byte);
+	    code_assign_lvar(cadr(e2),USE_CREG,byte);
             return;
     case REGISTER:
             g_expr(e4);
-	    if (creg!=cadr(e2))
-		code_assign_register(cadr(e2),byte,creg);
+	    code_assign_register(cadr(e2),byte,USE_CREG);
             return;
     }
     g_expr(e2);
     emit_push();
     g_expr(e4);
     e2 = emit_pop(0);
-    code_assign(e2,byte,creg);
+    code_assign(e2,byte,USE_CREG);
     emit_pop_free(e2);
     return;
 }
@@ -1382,36 +1310,29 @@
 	    (car(e2)==DREGISTER&&(e5==DRGVAR||e5==DRLVAR||e5==DCONST))||
 	    (car(e2)==DREGISTER&&(e5==FRGVAR||e5==FRLVAR||e5==FCONST))
 	)) {
-	creg = d?use_double(creg):use_float(creg);
 	dassign_opt(e5,e2,e4,d);
 	return;
     }
     switch(car(e2)) {
     case GVAR:
             g_expr(e4);
-	    creg = d?use_double(creg):use_float(creg);
-	    code_dassign_gvar(e2,creg,d);
+	    code_dassign_gvar(e2,USE_CREG,d);
             return;
     case LVAR:
             g_expr(e4);
-	    creg = d?use_double(creg):use_float(creg);
-	    code_dassign_lvar(cadr(e2),creg,d);
+	    code_dassign_lvar(cadr(e2),USE_CREG,d);
             return;
     case DREGISTER:
     case FREGISTER:
-	    if (d) creg = use_double(creg); else creg = use_float(creg);
             g_expr(e4);
-	    if (creg!=cadr(e2)) {
-		code_dassign_dregister(cadr(e2),d,creg);
-	    }
+	    code_dassign_dregister(cadr(e2),d,USE_CREG);
             return;
     }
     g_expr(e2);
     emit_push();
-    if (d) creg = use_double(creg); else creg = use_float(creg);
     g_expr(e4);
     e2 = emit_pop(0);
-    code_dassign(e2,creg,d);
+    code_dassign(e2,USE_CREG,d);
     emit_pop_free(e2);
     return;
 }
@@ -1467,35 +1388,28 @@
 	    (e5==LREGISTER) ||
 	    (car(e2)==LREGISTER&&(e5==LRGVAR||e5==LRLVAR||e5==LCONST))
 	)) {
-	creg = use_longlong(creg);
 	lassign_opt(e5,e2,e4);
 	return;
     }
     switch(car(e2)) {
     case GVAR:
             g_expr(e4);
-	    creg = use_longlong(creg);
-	    code_lassign_gvar(e2,creg);
+	    code_lassign_gvar(e2,USE_CREG);
             return;
     case LVAR:
             g_expr(e4);
-	    creg = use_longlong(creg);
-	    code_lassign_lvar(cadr(e2),creg);
+	    code_lassign_lvar(cadr(e2),USE_CREG);
             return;
     case LREGISTER:
-	    creg = use_longlong(creg);
             g_expr(e4);
-	    if (creg!=cadr(e2)) {
-		code_lassign_lregister(cadr(e2),creg);
-	    }
+	    code_lassign_lregister(cadr(e2),USE_CREG);
             return;
     }
     g_expr(e2);
     emit_push();
-    creg = use_longlong(creg);
     g_expr(e4);
     e2 = emit_pop(0);
-    code_lassign(e2,creg);
+    code_lassign(e2,USE_CREG);
     emit_pop_free(e2);
     return;
 }
@@ -1524,15 +1438,16 @@
     e3 = caddr(e1);
     op = cadddr(e1);
 
-    creg = use_int(creg);
     g_expr(e3);
     if (car(e2)==REGISTER) {
-	code_register_assop(cadr(e2),op,byte);
+	code_register_assop(cadr(e2),USE_CREG,op,byte);
+	if (use)
+	    code_register(cadr(e2),USE_CREG);
 	return;
     }
     emit_push();
     g_expr(e2);
-    code_assop(op,byte,sign);
+    code_assop(op,USE_CREG,byte,sign);
     return;
 }
 
@@ -1550,15 +1465,16 @@
     e3 = caddr(e1);
     op = cadddr(e1);
 
-    creg = d?use_double(creg):use_float(creg);
     g_expr(e3);
     emit_dpush(d);
     g_expr(e2);
     if (car(e2)==DREGISTER||car(e2)==FREGISTER) {
 	code_register_dassop(cadr(e2),op,d);
+	if (use)
+	    code_dregister(cadr(e2),USE_CREG,d);
 	return;
     }
-    code_dassop(op,d);
+    code_dassop(op,USE_CREG,d);
     return;
 }
 
@@ -1577,15 +1493,16 @@
     e3 = caddr(e1);
     op = cadddr(e1);
 
-    creg = use_longlong(creg);
     g_expr(e3);
     emit_lpush();
     g_expr(e2);
     if (car(e2)==LREGISTER) {
 	code_register_lassop(cadr(e2),op);
+	if (use)
+	    code_lregister(cadr(e2),USE_CREG);
 	return;
     }
-    code_lassop(op);
+    code_lassop(op,USE_CREG);
     return;
 }