changeset 404:95956779df2e

ARM continue...
author kono
date Sun, 17 Oct 2004 13:13:43 +0900
parents 562d76edddee
children 5b76a2bc1177
files .gdbinit Changes mc-code-arm.c
diffstat 3 files changed, 34 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Sun Oct 17 11:23:10 2004 +0900
+++ b/.gdbinit	Sun Oct 17 13:13:43 2004 +0900
@@ -6,8 +6,8 @@
 # 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/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
 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 11:23:10 2004 +0900
+++ b/Changes	Sun Oct 17 13:13:43 2004 +0900
@@ -6102,3 +6102,6 @@
         sub     sp, sp, #96
 あ、こんなことやってるし〜
 
+Sun Oct 17 13:13:00 JST 2004
+
+なんか long long に関しては、gcc の方が結構、間違っているなぁ。
--- a/mc-code-arm.c	Sun Oct 17 11:23:10 2004 +0900
+++ b/mc-code-arm.c	Sun Oct 17 13:13:43 2004 +0900
@@ -1546,6 +1546,7 @@
 void
 code_register(int e2,int reg) {
     use_int(reg);
+    // reg = e2
     if (reg!=e2) {
 	inc_inst(1);
 	printf("\tmov\t%s, %s\n",register_name(reg),register_name(e2));
@@ -2032,10 +2033,7 @@
 	if (lreg && reg!=lreg) {
 	    if (mode) {
 		inc_inst(2);
-		printf("\tmov\t%s, %s\n",
-		    lregister_name_low(reg),lregister_name_low(lreg));
-		printf("\tmov\t%s, %s\n",
-		    lregister_name_high(reg),lregister_name_high(lreg));
+		lmove(reg,lreg);
 	    }
 	    free_register(lreg);
 	}
@@ -2258,7 +2256,7 @@
 	code_rlvar(cadr(e2),r);
 	break;
     default:
-        g_expr(e2);
+        g_expr(rvalue_t(e2,FLOAT));
     case FREGISTER:
 	tmp = new_lvar(SIZE_OF_INT);
 	code_dassign_lvar(tmp, (car(e2)==FREGISTER)?cadr(e2):freg,0);
@@ -2286,7 +2284,7 @@
 	code_lrlvar(cadr(e2),r);
 	break;
     default:
-        g_expr(e2);
+        g_expr(rvalue_t(e2,DOUBLE));
 	reg = freg;
     case DREGISTER:
 	if (car(e2)==DREGISTER) reg = cadr(e2);
@@ -2537,6 +2535,13 @@
 	g_expr_u(assign_expr0(arg,e4,t,t));
 	car(e3)=0;  // done
     }
+    if (half_register) {
+	//  half register case writes *(sp-1) but it will be Ok.
+	if (max_func_args<4) max_func_args=4;
+	g_expr_u(assign_expr0(list3(REGISTER,4,0),
+		list2(LVAR,caller_arg_offset_v(3)),INT,INT));
+	use_input_reg(3,1);
+    }
     nargs = reg_arg = freg_arg = 0;
     for (e3 = e1; e3; 
 		increment_function_arg(e3,&nargs,&reg_arg,&freg_arg),
@@ -2579,12 +2584,6 @@
     for(;arg_assign;arg_assign=cadr(arg_assign)) {
 	g_expr_u(car(arg_assign));
     }
-    if (half_register) {
-	//  half register case writes *(sp-1) but it will be Ok.
-	if (max_func_args<4) max_func_args=4;
-	g_expr_u(assign_expr0(list3(REGISTER,4,0),
-		list2(LVAR,caller_arg_offset_v(3)),INT,INT));
-    }
     clear_ptr_cache();
     code_call(e2,fn,jmp);
     for(;reg_arg_list;reg_arg_list=cadr(reg_arg_list)) {
@@ -3434,7 +3433,7 @@
 	    printf("%c",*s);
 	s++;
     }
-    printf("\\0%c\n\t.align 2\n",34);
+    printf("\\0%c\n",34);
 }
 
 extern int
@@ -3655,14 +3654,19 @@
 static void
 code_int_lib(char *lib,int reg,int oreg)
 {
+    int g;
     code_save_stacks();
     clear_ptr_cache();
-    if (reg!=REGISTER_OPERAND) code_register(REGISTER_OPERAND,reg);
-    if (oreg!=REGISTER_OPERAND_1) code_register(REGISTER_OPERAND_1,oreg);
-    extern_conv(lib);
+    g = list3(REGISTER_OPERAND,0,reg);
+    g = list3(REGISTER_OPERAND_1,g,oreg);
+    parallel_rassign(g);
+    extern_define(lib,0,FUNCTION,1);
+    inc_inst(1);
+    printf("\tbl\t%s\n",lib);
+    lib_args(16);
     set_ireg(RET_REGISTER,0);
-    if (oreg!=RET_REGISTER) {
-	code_register(oreg,RET_REGISTER);
+    if (reg!=RET_REGISTER) {
+	code_register(RET_REGISTER,reg);
     }
 }
 
@@ -3996,7 +4000,7 @@
 void
 code_u2d0(int reg,int d)
 { 
-    int tmp;
+    int tmp,freg1;
     char *crn,*frn,*lrn;
     if (!(arch_mode&UseFPP)) {
 	tmp=new_lvar(SIZE_OF_INT);
@@ -4037,14 +4041,15 @@
 	printf("\tfltd\t%s, %s\n",frn,crn);
 	printf("\tcmp\t%s, #0\n",crn);
         printf("\tbge\t1f\n");
-	emit_dpush(1);
-	code_dconst(dlist2(DCONST,2.147483648e9),USE_CREG,1);
-	lrn = register_name(lreg = emit_dpop(d));
+	freg1 = get_dregister(1);
+	code_dconst(dlist2(DCONST,2.147483648e9),freg1,1);
+	frn = register_name(creg);
+	lrn = register_name(freg1);
 	printf("\tadfd\t%s, %s, %s\n",frn,frn,lrn);
 	printf("1:\n");
 	if (!d)
 	    printf("\tmvfs\t%s, %s\n",frn,frn);
-	emit_dpop_free(lreg,d);
+	free_register(freg1);
     }
     return;
 }
@@ -4306,7 +4311,7 @@
     frn = fregister_name(reg);
     inc_inst(1);
     if (cmp) {
-      printf("\t%s\t%s, %s\n",opn,frn,grn);
+      printf("\t%s\t%s, %s\n",opn,grn,frn);
     } else {
       printf("\t%s\t%s, %s, %s\n",opn,frn,frn,grn);
     }