changeset 814:1dad60c0a073

minor fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 25 Nov 2010 13:13:42 +0900
parents a1dff13fefbf
children 609b769e015e
files mc-code-i64.c mc-codegen.c
diffstat 2 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mc-code-i64.c	Thu Nov 25 13:07:18 2010 +0900
+++ b/mc-code-i64.c	Thu Nov 25 13:13:42 2010 +0900
@@ -4801,7 +4801,7 @@
 emit_asm_operand(int rstr)
 {
     if (car(rstr)==REGISTER) {
-	printf("%s",register_name(cadr(rstr),0));
+	printf("%s",register_name(cadr(rstr),4));
     } else if (car(rstr)==LREGISTER) {
 	printf("%s",register_name(cadr(rstr),0));
     } else if (car(rstr)==CONST) {
@@ -4861,7 +4861,7 @@
     if (c=='r') {
 	if (mode==ASM_INPUT) {
 	    for(;repl0;repl0 = cadr(repl0)) {
-		if (car(car(repl0))==REGISTER && caddr(repl0)==0) {
+		if (car(car(repl0))==LREGISTER && caddr(repl0)==0) {
 		    r = cadr(car(repl0));
 		    caddr(repl0) = ASM_USED;
 		    break;
@@ -4871,7 +4871,7 @@
 	} else {
 	    r = get_register();
 	}
-	repl = list3(list2(REGISTER,r),repl,clobber);
+	repl = list3(list2(LREGISTER,r),repl,clobber);
     } else if (c=='m') {
 	repl = list3(list2(0,0),repl,clobber);
     } else if (c=='i') {
--- a/mc-codegen.c	Thu Nov 25 13:07:18 2010 +0900
+++ b/mc-codegen.c	Thu Nov 25 13:13:42 2010 +0900
@@ -3275,7 +3275,7 @@
     int repl0;
     int assign = 0;
     char *p;
-    int ty = lp64?LONGLONG:INT;
+    int ty;
 
     e = reverse0(e);
 
@@ -3283,8 +3283,15 @@
         p = (ncaddr(car(i)))->nm;
         e1 = car(e); e = cadr(e);
         repl = code_asm_operand(p,e1,ASM_OUTPUT,repl,0,0);
-        if (!chk && repl && car(car(repl))==REGISTER) {
-            assign = list2(assign_expr0(e1,car(repl),ty,ty),assign);
+        if (!chk && repl) {
+	    switch(car(car(repl))) {
+	    case REGISTER: ty = INT; break;
+	    case LREGISTER: ty = LONGLONG; break;
+	    case FREGISTER: ty = FLOAT; break;
+	    case DREGISTER: ty = DOUBLE; break;
+	    default: continue;
+            }
+	    assign = list2(assign_expr0(e1,car(repl),ty,ty),assign);
         }
     }
     repl0 = repl;
@@ -3293,7 +3300,14 @@
         p = (ncaddr(car(i)))->nm;
         e1 = car(e); e = cadr(e);
         repl = code_asm_operand(p,e1,ASM_INPUT,repl,n,repl0);
-        if (!chk && repl && car(car(repl))==REGISTER) {
+        if (!chk && repl) {
+	    switch(car(car(repl))) {
+	    case REGISTER: ty = INT; break;
+	    case LREGISTER: ty = LONGLONG; break;
+	    case FREGISTER: ty = FLOAT; break;
+	    case DREGISTER: ty = DOUBLE; break;
+	    default: continue;
+            }
             g_expr_u(assign_expr0(car(repl),e1,ty,ty));
         }
     }