diff mc-code-powerpc.c @ 415:bdf900926f32

fix cpmd register
author kono
date Sat, 23 Oct 2004 23:26:33 +0900
parents 32c1914308db
children a6ed0575d731
line wrap: on
line diff
--- a/mc-code-powerpc.c	Fri Oct 22 22:52:01 2004 +0900
+++ b/mc-code-powerpc.c	Sat Oct 23 23:26:33 2004 +0900
@@ -1023,7 +1023,6 @@
     max_reg_var=-1; max_freg_var=-1;
     reg_sp = 0;
     freg_sp = 0;
-    text_mode();
 }
 
 
@@ -2639,7 +2638,7 @@
 void
 code_cmpdimm(int e, int csreg,int label,int cond)
 {
-    int reg;
+    int reg,regsv;
     /* used in dosiwtch() */
     if(chk) return;
     inc_cmpflag();
@@ -2647,7 +2646,9 @@
 	printf("\tcmpwi cr%d,%s,%d\n",cmpflag,register_name(csreg),e);
 	jcond(label,cond);
     } else {
+	regsv = regs[csreg]; regs[csreg]=USING_REG;
 	reg = get_register();
+	regs[csreg]= regsv;
 	code_const(e,reg);
 	printf("\tcmpw cr%d,%s,%s\n",cmpflag,register_name(csreg),register_name(reg));
 	jcond(label,cond);
@@ -2984,13 +2985,18 @@
     return lb;
 }
 
-extern void
+void
 align(int t)
 {
-    if (t!=CHAR) {
-	if (data_alignment & 1)
-	    printf("\t.align 2\n");
-	data_alignment = 0;
+    int d;
+    switch(t) {
+    case CHAR: case UCHAR: return;
+    case SHORT: case USHORT: d = data_alignment & 1; break;
+    default: d = data_alignment & 3;
+    }
+    if (d) {
+        printf("\t.align 2\n");
+        data_alignment = 0;
     }
 }