changeset 406:8528af42e7f7

switch fix.
author kono
date Mon, 18 Oct 2004 00:17:09 +0900
parents 5b76a2bc1177
children dafb9110d70b
files .gdbinit Changes mc-code-arm.c
diffstat 3 files changed, 23 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Sun Oct 17 22:33:19 2004 +0900
+++ b/.gdbinit	Mon Oct 18 00:17:09 2004 +0900
@@ -1,13 +1,13 @@
 tb main
 # run  -s test/arg.c
-# run  -s mc-parse.c
+run  -s mc-parse.c
 # run  -s mc-codegen.c
 # run  -s nkf203/nkf.c
 # run  -s -ob01.s mc-switch.c
 # run  -s l.c
 # run  -s test/const.c
 # run  -s test/basic.c
-run -s test/code-gen-all.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
 printf "r10=%08x r11=%08x r12=%08x r13=%08x r14=%08x r15=%08x\n",$r10,$r11,$r12,$r13,$r14,$r15
--- a/Changes	Sun Oct 17 22:33:19 2004 +0900
+++ b/Changes	Mon Oct 18 00:17:09 2004 +0900
@@ -6108,3 +6108,9 @@
 
 signed char に関しては、ldrsb ってのがあるみたいね。なんで、
 arm-linux-gcc ではでないんだろう?
+
+Mon Oct 18 00:15:05 JST 2004
+
+self compile が通らない。他のテストを優先するべきか。
+
+
--- a/mc-code-arm.c	Sun Oct 17 22:33:19 2004 +0900
+++ b/mc-code-arm.c	Mon Oct 18 00:17:09 2004 +0900
@@ -1467,8 +1467,8 @@
     if ((s=make_const(offset,&p1,&p2,&p3,0))) {
 	add = s>0?"add":"sub";
 	printf("\t%s\t%s, %s, #%d\n",add,crn,rrn,p1);
-	if (p2) printf("\t%s\t%s, %s, #%d\n",add,crn,rrn,p2);
-	if (p3) printf("\t%s\t%s, %s, #%d\n",add,crn,rrn,p3);
+	if (p2) printf("\t%s\t%s, %s, #%d\n",add,crn,crn,p2);
+	if (p3) printf("\t%s\t%s, %s, #%d\n",add,crn,crn,p3);
     } else {
 	disp = search_const(CONST,offset,&label);
 	drn = register_name(dreg = get_register());
@@ -2527,6 +2527,7 @@
 	if (complex_) {
 	    arg = get_input_arg(caddr(complex_),AS_ARG,pnargs,preg_arg,pfreg_arg);
 	    reg_arg_list = compute_complex_arg(complex_,reg_arg_list,arg);
+	    if (car(arg)!=LVAR) use_input_reg(cadr(arg),1);
 	    car(complex_) = 0; // done.
 	}
     }
@@ -3060,6 +3061,7 @@
 	printf("\t%s\t%s, #%d\n",sign?"cmp":"cmn",crn,e);
     }
     switch(cond) {
+    case -1: break;
     case 1:
 	printf("\tbne\t.L%d\n",label); break;
     case 0:
@@ -5595,26 +5597,31 @@
 void
 code_table_jump(int l,int csvalue,int delta,int max,int min,int dlabel)
 {
-    int t;
-
-    char *trn = register_name(t=get_register());
+    int t,regsv;
+    char *trn;
+
+    regsv = regs[csvalue]; regs[csvalue] = 1;
+    trn = register_name(t=get_register());
+    regs[csvalue] = regsv;
 
     code_add(t,-min,csvalue);
-    code_cmpdimm(max-min+1,t,dlabel,GT);
     switch(delta) {
-    case 1: printf("\tldrls\tpc, [pc, %s, asl #2]\n",trn);
+    case 1: 
+	code_cmpdimm(max-min,t,dlabel,-1);
+	printf("\tldrls\tpc, [pc, %s, asl #2]\n",trn);
 	inc_inst(1);
 	break;
     case 2:
 	printf("\ttst\t%s, #1\n",trn);
 	printf("\tbne\t.L%d\n",dlabel);
+	code_cmpdimm(max-min,t,dlabel,-1);
 	printf("\tldrls\tpc, [pc, %s, asl #1]\n",trn); break;
 	inc_inst(3);
 	break;
     case 4:
 	printf("\ttst\t%s, #3\n",trn);
 	printf("\tbne\t.L%d\n",dlabel);
-	printf("\tbne\t.L%d\n",dlabel);
+	code_cmpdimm(max-min,t,dlabel,-1);
 	printf("\tldrls\tpc, [pc, %s]\n",trn); break;
 	inc_inst(4);
 	break;