changeset 393:fe5aceeb6e89

*** empty log message ***
author kono
date Sun, 12 Sep 2004 17:24:04 +0900
parents 28c60758dac9
children b96b46baa20f
files .gdbinit Changes mc-code-arm.c mc-code-mips.c
diffstat 4 files changed, 37 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Wed Sep 08 18:31:57 2004 +0900
+++ b/.gdbinit	Sun Sep 12 17:24:04 2004 +0900
@@ -5,8 +5,8 @@
 # run  -s nkf203/nkf.c
 # run  -s -ob01.s mc-switch.c
 # run  -s l.c
-# run  -s test/bitfield.c
-run  -s test/basic.c
+run  -s test/bitfield.c
+# run  -s test/basic.c
 # run -s test/code-gen-all.c
 define regs 
 printf "pc =%08x lr =%08x r0 =%08x r1 =%08x r3= %08x r4= %08x\n",$pc,$lr,$r0,$r1,$r3,$r4
--- a/Changes	Wed Sep 08 18:31:57 2004 +0900
+++ b/Changes	Sun Sep 12 17:24:04 2004 +0900
@@ -5965,3 +5965,13 @@
 局所変数を負のオフセットでアクセスし、関数呼び出しをsp オフセット
 で積むなら、いらないはず。
 
+Sat Sep 11 15:13:33 JST 2004
+
+やっぱり、CSE ぐらいやるべきじゃない? マクロで生成されるとねぇ。
+   if (o==H1||o==H2|o==H3)
+みたいなものね。まぁねぇ。
+
+でも、そうすると、asm がなぁ。でも、そうすると elimination 
+もやりたいよね。
+
+それよりは、inline が先か。
--- a/mc-code-arm.c	Wed Sep 08 18:31:57 2004 +0900
+++ b/mc-code-arm.c	Sun Sep 12 17:24:04 2004 +0900
@@ -1521,8 +1521,8 @@
     int r;
     use_int(reg);
     r = get_ptr_cache(n);
-    inc_inst(2);
     if(r!=reg) {
+	inc_inst(2);
 	printf("\tmov\t%s, %s\n",register_name(reg),register_name(r));
     }
     return;
@@ -1630,6 +1630,7 @@
     crn = register_name(creg);
 
     disp = search_const(LABEL,retcont,&label);
+    inc_inst(1);
     printf("\tldr\t%s, .L%d+%d\n",crn,label,disp);
 }
 
@@ -1659,6 +1660,7 @@
     if (lrexpr_bool(e1, reg)) return;
     b_expr(e1,1,e2=fwdlabel(),1);  /* including > < ... */
     if (use) {
+	inc_inst(2);
         use_int(reg);
         xrn = register_name(reg);
         printf("\tmov\t%s, #0\n",xrn);
@@ -1967,6 +1969,15 @@
 static void
 set_dreg(int reg,int mode)
 {
+    if ((arch_mode&UseFPP)) {
+	if (reg==RET_DREGISTER) {
+	    reg = RET_FREGISTER;
+	}
+	if (is_float_reg(reg)) {
+	    set_freg(reg,mode);
+	    return;
+	}
+    }
     if (reg==RET_DREGISTER) {
 	regv_l(reg) = RET_DREGISTER_L;
 	regv_h(reg) = RET_DREGISTER_H;
@@ -2785,7 +2796,7 @@
     case CMP:
 	return is_stage1_const(v,CMP);
     case EOR: case BOR: case BAND:
-	return is_stage1_const(v,0);
+	return (is_stage1_const(v,0)>0);
     default:
 	return 0;
     }
@@ -2933,12 +2944,12 @@
 
     if (mode==COND_BRANCH) {
 	printf("\tb%s\t.L%d\n",cc,l1);
-	inc_inst(1);
+	inc_inst(2);
     } else if (mode==COND_VALUE) {
 	rn0 =		register_name(r0);
 	printf("\tmov%s\t%s, #0\n",ncc,rn0);
 	printf("\tmov%s\t%s, #1\n",cc,rn0);
-	inc_inst(2);
+	inc_inst(3);
     } else error(-1);
 }
 
@@ -2992,8 +3003,8 @@
 {       
     control=0;
     if (chk) return;
+    printf("\tb\t.L%d\n",l);
     inc_inst(1);
-    printf("\tb\t.L%d\n",l);
 }
 
 void
@@ -4956,8 +4967,8 @@
     case LSUB:
     case LBOR:
     case LEOR: case LBAND:
-	return is_stage1_const(v,0)
-	    && is_stage1_const(v>>32,0);
+	return (is_stage1_const(v,0)>0)
+	    && (is_stage1_const(v>>32,0)>0);
     default:
 	return 0;
     }
@@ -5591,6 +5602,7 @@
 	    rstr = reg[val];
 	    emit_asm_operand(rstr);
 	} else {
+	    if (c=='\n') inc_inst(1);
 	    printf("%c",c);
 	}
     }
@@ -5781,8 +5793,8 @@
 // printf("# mask 0x%08x ~0x%08x\n",mask,~mask);
     if ((m=(~mask|c))!=-1) {
 	inc_inst(1);
-	if (is_stage1_const(m,0)) {
-	    printf("\tand\t%s, %s, #%d\n",crn,trn,m);
+	if (is_stage1_const(m,0)>0) {
+	    printf("\tand\t%s, %s, #%d\n",crn,crn,m);
 	} else {
 	    trn = register_name(tmp=get_register());
 	    code_const((~mask|c),tmp);
@@ -5790,13 +5802,14 @@
 	    printf("\tand\t%s, %s, %s\n",crn,trn,crn);
 	}
     }
+    if (tmp!=-1) { free_register(tmp); tmp=-1; }
     /* make or-mask  */
     c = mask&c;
     if (c!=0) {
 	inc_inst(1);
 	/* do disjunction  */
-	if (is_stage1_const(c,0)) {
-	    printf("\torr\t%s, %s, #%d\n",crn,trn,m);
+	if (is_stage1_const(c,0)>0) {
+	    printf("\torr\t%s, %s, #%d\n",crn,crn,c);
 	} else {
 	    trn = register_name(tmp=get_register());
 	    code_const(c,tmp);
--- a/mc-code-mips.c	Wed Sep 08 18:31:57 2004 +0900
+++ b/mc-code-mips.c	Sun Sep 12 17:24:04 2004 +0900
@@ -5604,6 +5604,7 @@
 	/* do conjunction  */
 	printf("\tand %s,%s,%s\n",crn,trn,crn);
     }
+    if (tmp!=-1) { free_register(tmp); tmp=-1; }
     /* make or-mask  */
     c = mask&c;
     if (c!=0) {