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

fix cpmd register
author kono
date Sat, 23 Oct 2004 23:26:33 +0900
parents 32c1914308db
children c73f013d07d7
line wrap: on
line diff
--- a/mc-code-mips.c	Fri Oct 22 22:52:01 2004 +0900
+++ b/mc-code-mips.c	Sat Oct 23 23:26:33 2004 +0900
@@ -1062,7 +1062,6 @@
     max_reg_var=0; max_freg_var=0;
     reg_sp = 0;
     freg_sp = 0;
-    text_mode(3);
 }
 
 #define reg_var_num(i) (REG_VAR_BASE-i)
@@ -2694,13 +2693,15 @@
 code_cmpdimm(int e, int csreg,int label,int cond)
 {
     /* used in dosiwtch() */
-    int reg=-1;
+    int reg=-1,regsv;
     char *rn,*crn;
     if(chk) return;
     crn = register_name(csreg);
 
     if (e<-32767||32766<e) {
+	regsv=regs[csreg]; use_reg(csreg);
 	rn = register_name(reg= get_register());
+	regs[csreg]=regsv;
 	code_const(e,reg);
 	switch(cond) {
 	case 1:
@@ -2708,7 +2709,6 @@
 	case 0:
 	    printf("\tbeq\t%s,%s,$L_%d\n",crn,rn,label); break;
 	case LT:
-	    use_reg(csreg);
 	    printf("\tslt\t%s,%s,%s\n",rn,crn,rn);
 	    printf("\tbne\t%s,$0,$L_%d\n",rn,label); break;
 	default: error(-1);
@@ -2721,8 +2721,9 @@
     case 0:
 	printf("\tbeq\t%s,%d,$L_%d\n",crn,e,label); break;
     case LT:
-	use_reg(csreg);
+	regsv=regs[csreg]; use_reg(csreg);
 	rn = register_name(reg= get_register());
+	regs[csreg]=regsv;
 	printf("\tslt\t%s,%s,%d\n",rn,crn,e);
 	printf("\tbne\t%s,$0,$L_%d\n",rn,label); break;
     default: error(-1);
@@ -3208,13 +3209,17 @@
 }
 
 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;
     }
 }