changeset 663:92a401bef729

*** empty log message ***
author kono
date Sun, 04 Mar 2007 18:24:10 +0900
parents c9df4e08da9b
children ec1bac997e50
files .gdbinit mc-code-powerpc.c mc-code-spu.c
diffstat 3 files changed, 90 insertions(+), 175 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Thu Feb 22 15:05:42 2007 +0900
+++ b/.gdbinit	Sun Mar 04 18:24:10 2007 +0900
@@ -45,9 +45,9 @@
 # run -s test/code-gen-inline.c
 # run -s -DINLINE=inline test/basic.c
 # run -s test/too-long-argument.c
-run -s -DINLINE=inline test/strinit.c
+# run -s -DINLINE=inline test/strinit.c
 # run -DINLINE=inline test/scope.c
-# run -DINLINE=inline test/code-gen-all.c
+run -s test/code-gen-all.c
 # run -DINLINE=inline test/bitfield1.c
 # run -s test/linux_kernel.c.--- 
 # run -s test/stralign.c
--- a/mc-code-powerpc.c	Thu Feb 22 15:05:42 2007 +0900
+++ b/mc-code-powerpc.c	Sun Mar 04 18:24:10 2007 +0900
@@ -31,7 +31,7 @@
 
 #include "mc-include.c"
 
-
+#undef __APPLE__
 
 static
 char *init_src0 = "\
@@ -278,10 +278,17 @@
 
 
 #if FLOAT_CODE
+#ifdef __APPLE__
 static
 NMTBL float_zero = {"_float_zero",0,STATIC,FLOAT,0};
 static
 NMTBL float_one = {"_float_one",0,STATIC,FLOAT,0};
+#else
+static
+NMTBL float_zero = {"__float_zero",0,STATIC,FLOAT,0};
+static
+NMTBL float_one = {"__float_one",0,STATIC,FLOAT,0};
+#endif
 
 
 static char * fload(int d);
@@ -3209,6 +3216,52 @@
 	printf("\tblr\n");
 }
 
+#ifndef __APPLE__
+static int saveFP_used=0;
+static char *saveFP_lib[] = {
+".saveFP:    stfd    14,-144(1)",
+" stfd    15,-136(1)",
+" stfd    16,-128(1)",
+" stfd    17,-120(1)",
+" stfd    18,-112(1)",
+" stfd    19,-104(1)",
+" stfd    20,-96(1)",
+" stfd    21,-88(1)",
+" stfd    22,-80(1)",
+" stfd    23,-72(1)",
+" stfd    24,-64(1)",
+" stfd    25,-56(1)",
+" stfd    26,-48(1)",
+" stfd    27,-40(1)",
+" stfd    28,-32(1)",
+" stfd    29,-24(1)",
+" stfd    30,-16(1)",
+" stfd    31,-8(1)",
+" stw     0,8(1)",
+" blr",
+".restFP:    lfd     14,-144(1)",
+" lfd     15,-136(1)",
+" lfd     16,-128(1)",
+" lfd     17,-120(1)",
+" lfd     18,-112(1)",
+" lfd     19,-104(1)",
+" lfd     20,-96(1)",
+" lfd     21,-88(1)",
+" lfd     22,-80(1)",
+" lfd     23,-72(1)",
+" lfd     24,-64(1)",
+" lfd     25,-56(1)",
+" lfd     26,-48(1)",
+" lfd     27,-40(1)",
+" lfd     28,-32(1)",
+" lfd     29,-24(1)",
+" lwz     0,8(1)",
+" lfd     30,-16(1)",
+" mtlr    0",
+0
+};
+#endif
+
 void
 leave(int control, char *name)
 {
@@ -3269,15 +3322,18 @@
 #endif
 #endif
     if (max_freg_var>=0) {
+#ifdef __APPLE__
 	printf("\tlmw r%d,%d(%s)\n",
 			REG_VAR_BASE-max_reg_var,reg_save,register_name(1));
 	freg_save = 72-(REAL_MAX_FREGISTER-(FREG_VAR_BASE-max_freg_var))*4;
-#ifdef __APPLE__
 	printf("\tb restFP+%d ; restore f%d-f31\n",
 			freg_save,
 			FREG_VAR_BASE-max_freg_var);
 #else
-	printf("\tb restFP+%d ; restore f%d-f31\n",
+	printf("\tlmw %d,%d(%s)\n",
+			REG_VAR_BASE-max_reg_var,reg_save,register_name(1));
+	freg_save = 72-(REAL_MAX_FREGISTER-(FREG_VAR_BASE-max_freg_var))*4;
+	printf("\tb .restFP+%d # restore f%d-f31\n",
 			freg_save,
 			FREG_VAR_BASE-max_freg_var);
 #endif
@@ -3301,17 +3357,18 @@
     printf("\tstmw %s,%d(%s)\n",
 		    register_name(REG_VAR_BASE-max_reg_var),reg_save,register_name(1));
     printf("\tstw %s,8(%s)\n",register_name(0),register_name(1));
-    if (max_freg_var>=0)
+    if (max_freg_var>=0) {
 #ifdef __APPLE
 	printf("\tb saveFP+%d ; save f%d-f31\n",
 			freg_save,
 			FREG_VAR_BASE-max_freg_var);
 #else
-	printf("\tb saveFP+%d ; save f%d-f31\n",
+	saveFP_used = 1;
+	printf("\tb .saveFP+%d # save f%d-f31\n",
 			freg_save,
 			FREG_VAR_BASE-max_freg_var);
 #endif
-    else {
+    } else {
 	printf("\tblr\n");
     }
 
@@ -3907,7 +3964,7 @@
     use_reg(r); // to clear ptr cache
     printf(" \t.data\n\t.align 3\n");
     lb=fwdlabel();
-    printf("L_%d:\n",lb);
+    printf("%s%d:\n",lpfx,lb);
     if (d) {
 #if ENDIAN_D==0
 	printf("\t.long\t0x%x,0x%x\n",code_d1(value),code_d2(value));
@@ -4032,51 +4089,6 @@
     printf("\tlwz %s,",crn); lvar(e2+SIZE_OF_DOUBLE-SIZE_OF_INT);
 }
 
-#ifndef __APPLE__
-static int saveFP_used=0;
-static char *saveFP_lib[] = {
-"saveFP:    stfd    14,-144(1)",
-" stfd    15,-136(1)",
-" stfd    16,-128(1)",
-" stfd    17,-120(1)",
-" stfd    18,-112(1)",
-" stfd    19,-104(1)",
-" stfd    20,-96(1)",
-" stfd    21,-88(1)",
-" stfd    22,-80(1)",
-" stfd    23,-72(1)",
-" stfd    24,-64(1)",
-" stfd    25,-56(1)",
-" stfd    26,-48(1)",
-" stfd    27,-40(1)",
-" stfd    28,-32(1)",
-" stfd    29,-24(1)",
-" stfd    30,-16(1)",
-" stfd    31,-8(1)",
-" stw     0,8(1)",
-" blr",
-"restFP:    lfd     14,-144(1)",
-" lfd     15,-136(1)",
-" lfd     16,-128(1)",
-" lfd     17,-120(1)",
-" lfd     18,-112(1)",
-" lfd     19,-104(1)",
-" lfd     20,-96(1)",
-" lfd     21,-88(1)",
-" lfd     22,-80(1)",
-" lfd     23,-72(1)",
-" lfd     24,-64(1)",
-" lfd     25,-56(1)",
-" lfd     26,-48(1)",
-" lfd     27,-40(1)",
-" lfd     28,-32(1)",
-" lfd     29,-24(1)",
-" lwz     0,8(1)",
-" lfd     30,-16(1)",
-" mtlr    0",
-};
-#endif
-
 static int i2d_lib_used=0;
 #ifdef __APPLE__
 static char *i2d_lib[] = {
@@ -4110,7 +4122,7 @@
 ".data",
 /* ".literal8", */
 "        .align 3",
-"i2dLC0:",
+"__i2dLC0:",
 "        .long   1127219200",
 "        .long   -2147483648",
 ".text",
@@ -4118,7 +4130,7 @@
 "i2d_:",
 "        mflr 0",
 "        bcl 20,31,__i2dL1$pb",
-"i2dL1$pb:",
+"__i2dL1$pb:",
 "        mflr 10",
 "        mtlr 0",
 "        xoris 3,3,0x8000",
@@ -4126,8 +4138,8 @@
 "        lis 0,0x4330",
 "        stw 0,-32(1)",
 "        lfd 0,-32(1)",
-"        addis 9,10,i2dLC0-i2dL1$pb@ha",
-"        lfd 1,i2dLC0-i2dL1$pb@l(9)",
+"        addis 9,10,__i2dLC0-__i2dL1$pb@ha",
+"        lfd 1,__i2dLC0-__i2dL1$pb@l(9)",
 "        fsub 1,0,1",
 "        blr",
 0
@@ -4191,28 +4203,28 @@
 ".text",
 "        .align 2",
 "d2u_:",
-"        mflr r0",
+"        mflr 0",
 "        bcl 20,31,__d2uL1$pb",
 "__d2uL1$pb:",
-"        mflr r10",
-"        mtlr r0",
-"        addis r9,r10,ha16(__d2uLC0-__d2uL1$pb)",
-"        lfd f0,lo16(__d2uLC0-__d2uL1$pb)(r9)",
-"        fcmpu cr0,f1,f0",
+"        mflr 10",
+"        mtlr 0",
+"        addis 9,10,__d2uLC0-__d2uL1$pb@ha",
+"        lfd 0,__d2uLC0-__d2uL1$pb@l(9)",
+"        fcmpu 0,1,0",
 "        cror 2,1,2",
-"        beq- cr0,__d2uL2",
-"        fctiwz f0,f1",
-"        stfd f0,-32(r1)",
-"        lwz r3,-28(r1)",
+"        beq- 0,__d2uL2",
+"        fctiwz 0,1",
+"        stfd 0,-32(1)",
+"        lwz 3,-28(1)",
 "        blr",
 "__d2uL2:",
-"        addis r9,r10,ha16(__d2uLC0-__d2uL1$pb)",
-"        lfd f0,lo16(__d2uLC0-__d2uL1$pb)(r9)",
-"        fsub f0,f1,f0",
-"        fctiwz f0,f0",
-"        stfd f0,-24(r1)",
-"        lwz r3,-20(r1)",
-"        xoris r3,r3,0x8000",
+"        addis 9,10,__d2uLC0-__d2uL1$pb@ha",
+"        lfd 0,__d2uLC0-__d2uL1$pb@l(9)",
+"        fsub 0,1,0",
+"        fctiwz 0,0",
+"        stfd 0,-24(1)",
+"        lwz 3,-20(1)",
+"        xoris 3,3,0x8000",
 "        blr",
 0
 };
@@ -4267,18 +4279,6 @@
 ".text",
 "        .align 2",
 "u2d_:",
-"        mflr r0",
-"        bcl 20,31,__u2dL2$pb",
-"__u2dL2$pb:",
-"        mflr r10",
-"        mtlr r0",
-"        stw r3,-28(r1)",
-"        lis r0,0x4330",
-"        stw r0,-32(r1)",
-"        lfd f0,-32(r1)",
-"        addis r9,r10,ha16(__u2dLC1-__u2dL2$pb)",
-"        lfd f1,lo16(__u2dLC1-__u2dL2$pb)(r9)",
-"        fsub f1,f0,f1",
 "        blr",
 0
 };
@@ -4978,29 +4978,6 @@
 ".text",
 "        .align 2",
 "lsrd__:",
-"       mr.     r5,r5",
-"       beqlr",
-"       subfic  r2,r5,32",
-"      stw     r3,-32(r1)",
-"      stw     r4,-28(r1)",
-"      cmpwi   cr7,r2,0",
-"      bgt+    cr7,L__lsrd1",
-"      neg     r0,r2",
-"      lwz     r2,-32(r1)",
-"      li      r9,0",
-"      srw     r2,r2,r0",
-"      stw     r9,-48(r1)",
-"      b       L__lsrd2",
-"L__lsrd1:      lwz     r0,-32(r1)",
-"      slw     r9,r0,r2",
-"      lwz     r2,-28(r1)",
-"      srw     r0,r0,r5",
-"      srw     r2,r2,r5",
-"      stw     r0,-48(r1)",
-"      or      r2,r2,r9",
-"L__lsrd2:      stw     r2,-44(r1)",
-"      lwz     r3,-48(r1)",
-"      lwz     r4,-44(r1)",
 "      blr",
 #endif
 0
@@ -5040,29 +5017,6 @@
 ".text",
 "        .align 2",
 "asld__:",
-"       mr.     r5,r5",
-"       beqlr",
-"       subfic  r2,r5,32",
-"      stw     r3,-32(r1)",
-"      stw     r4,-28(r1)",
-"      cmpwi   cr7,r2,0",
-"      bgt+    cr7,L__asld1",
-"      neg     r0,r2",
-"      lwz     r2,-28(r1)",
-"      li      r9,0",
-"      slw     r2,r2,r0",
-"      stw     r9,-44(r1)",
-"      b       L__asld2",
-"L__asld1:      lwz     r0,-28(r1)",
-"      srw     r9,r0,r2",
-"      lwz     r2,-32(r1)",
-"      slw     r0,r0,r5",
-"      slw     r2,r2,r5",
-"      stw     r0,-44(r1)",
-"      or      r2,r2,r9",
-"L__asld2:      stw     r2,-48(r1)",
-"      lwz     r3,-48(r1)",
-"      lwz     r4,-44(r1)",
 "      blr",
 #endif
 0
@@ -5101,29 +5055,6 @@
 ".text",
 "        .align 2",
 "asrd__:",
-"       mr.     r5,r5",
-"       beqlr",
-"       subfic  r2,r5,32",
-"      stw     r3,-32(r1)",
-"      stw     r4,-28(r1)",
-"      cmpwi   cr7,r2,0",
-"      bgt+    cr7,L__asrd1",
-"      lwz     r0,-32(r1)",
-"      neg     r2,r2",
-"      sraw    r2,r0,r2",
-"      srawi   r0,r0,31",
-"      b       L__asrd2",
-"L__asrd1:      lwz     r0,-32(r1)",
-"      slw     r9,r0,r2",
-"      lwz     r2,-28(r1)",
-"      sraw    r0,r0,r5",
-"      srw     r2,r2,r5",
-"      or      r2,r2,r9",
-"L__asrd2:      stw     r0,-48(r1)",
-"      stw     r2,-44(r1)",
-"      lwz     r3,-48(r1)",
-"      lwz     r4,-44(r1)",
-"      blr",
 #endif
 0
 };
@@ -5228,11 +5159,7 @@
     set_lreg_operand(reg,1);
     set_lreg(RET_LREGISTER,0);
     set_lreg_operand1(oreg,1);
-#ifdef __APPLE__
     extern_conv("__divdi3");
-#else
-    extern_conv("_divdi3");
-#endif
 }
 
 static void
@@ -5243,11 +5170,7 @@
     set_lreg_operand(reg,1);
     set_lreg(RET_LREGISTER,0);
     set_lreg_operand1(oreg,1);
-#ifdef __APPLE__
     extern_conv("__udivdi3");
-#else
-    extern_conv("_udivdi3");
-#endif
 }
 
 static void
@@ -5258,11 +5181,7 @@
     set_lreg_operand(reg,1);
     set_lreg(RET_LREGISTER,0);
     set_lreg_operand1(oreg,1);
-#ifdef __APPLE__
     extern_conv("__moddi3");
-#else
-    extern_conv("_moddi3");
-#endif
 }
 
 static void
@@ -5273,11 +5192,7 @@
     set_lreg(RET_LREGISTER,0);
     set_lreg_operand(reg,1);
     set_lreg_operand1(oreg,1);
-#ifdef __APPLE__
     extern_conv("__umoddi3");
-#else
-    extern_conv("_umoddi3");
-#endif
 }
 
 #define check_lreg(reg) if (reg!=lreg) { lmove(reg,lreg); /* reg<=lreg */ }
--- a/mc-code-spu.c	Thu Feb 22 15:05:42 2007 +0900
+++ b/mc-code-spu.c	Sun Mar 04 18:24:10 2007 +0900
@@ -142,8 +142,8 @@
 #define MIN_TMP_FREG 3
 #define MAX_TMP_FREG 127
 
-int MAX_REGISTER=127;             /* ARMのレジスタを10個まで使う*/
-#define  REAL_MAX_REGISTER 127    /* ARMのレジスタが32ということ*/
+int MAX_REGISTER=128;             /* ARMのレジスタを10個まで使う*/
+#define  REAL_MAX_REGISTER 128    /* ARMのレジスタが32ということ*/
 
 #define FREG_OFFSET 3
 #define LREG_OFFSET 3
@@ -567,7 +567,7 @@
 
 void
 code_gexpr(int e){
-     if (is_int_reg(creg) && creg!=ireg) error(-1);
+     // if (is_int_reg(creg) && creg!=ireg) error(-1);
 //  register_usage("code_gexpr");
 }