2008-06-01 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Sun, 1 Jun 2008 16:13:24 +0000 (16:13 -0000)
committerZoltan Varga <vargaz@gmail.com>
Sun, 1 Jun 2008 16:13:24 +0000 (16:13 -0000)
* mini-arm.c (mono_arch_output_basic_block): Merge some small fixes from
the linear IL branch.

* driver.c: Print out more information for --version on arm.

svn path=/trunk/mono/; revision=104627

mono/mini/ChangeLog
mono/mini/driver.c
mono/mini/mini-arm.c

index d9085b94e454399b99ea32ba52019f9947d1868d..2cd5e18c63039699e6ffb70e5b8d2d06164d57eb 100644 (file)
@@ -1,3 +1,10 @@
+2008-06-01  Zoltan Varga  <vargaz@gmail.com>
+
+       * mini-arm.c (mono_arch_output_basic_block): Merge some small fixes from
+       the linear IL branch.
+
+       * driver.c: Print out more information for --version on arm.
+
 2008-05-30  Zoltan Varga  <vargaz@gmail.com>
 
        * mini-amd64.c (mono_arch_emit_prolog): Increase max_offset when processing
index 238ae8bdbbd1cc86a11753a75b048e64eb6e96c4..e58c43282c0b8f8ef8f9f03ef7237736f478c95c 100644 (file)
@@ -1031,6 +1031,15 @@ mini_debug_usage (void)
                 "                         process with the debugger.\n");
 }
 
+#if defined(__arm__) && defined(__ARM_EABI__)
+/* Redefine ARCHITECTURE to include more information */
+#undef ARCHITECTURE
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define ARCHITECTURE "armel"
+#else
+#define ARCHITECTURE "armeb"
+#endif
+#endif
 
 static const char info[] =
 #ifdef HAVE_KW_THREAD
index f4a6a3197139b881204f4ff76d67e23070e664b9..8a09b519aebff68122f41904d62216e0986d0dd9 100644 (file)
@@ -43,7 +43,7 @@ static int mono_arm_is_rotated_imm8 (guint32 val, gint *rot_amount);
  * 2) softfloat: the compiler emulates all the fp ops. Usually uses the
  *    ugly swapped double format (I guess a softfloat-vfp exists, too, though).
  * 3) VFP: the new and actually sensible and useful FP support. Implemented
- *    in HW or kernel-emulated, requires new tools. I think this ios what symbian uses.
+ *    in HW or kernel-emulated, requires new tools. I think this is what symbian uses.
  *
  * The plan is to write the FPA support first. softfloat can be tested in a chroot.
  */
@@ -62,7 +62,8 @@ int mono_exc_esp_offset = 0;
 #define DEBUG_IMT 0
 
 const char*
-mono_arch_regname (int reg) {
+mono_arch_regname (int reg)
+{
        static const char * rnames[] = {
                "arm_r0", "arm_r1", "arm_r2", "arm_r3", "arm_v1",
                "arm_v2", "arm_v3", "arm_v4", "arm_v5", "arm_v6",
@@ -75,7 +76,8 @@ mono_arch_regname (int reg) {
 }
 
 const char*
-mono_arch_fregname (int reg) {
+mono_arch_fregname (int reg)
+{
        static const char * rnames[] = {
                "arm_f0", "arm_f1", "arm_f2", "arm_f3", "arm_f4",
                "arm_f5", "arm_f6", "arm_f7", "arm_f8", "arm_f9",
@@ -177,6 +179,23 @@ emit_call_seq (MonoCompile *cfg, guint8 *code)
        return code;
 }
 
+static guint8*
+emit_move_return_value (MonoCompile *cfg, MonoInst *ins, guint8 *code)
+{
+       switch (ins->opcode) {
+       case OP_FCALL:
+       case OP_FCALL_REG:
+       case OP_FCALL_MEMBASE:
+#ifdef ARM_FPU_FPA
+               if (ins->dreg != ARM_FPA_F0)
+                       ARM_MVFD (code, ins->dreg, ARM_FPA_F0);
+#endif
+               break;
+       }
+
+       return code;
+}
+
 /*
  * mono_arch_get_argument_info:
  * @csig:  a method signature
@@ -2336,10 +2355,17 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        ARM_CMP_REG_IMM (code, ins->sreg1, imm8, rot_amount);
                        break;
                case OP_BREAK:
-                       *(int*)code = 0xe7f001f0;
-                       *(int*)code = 0xef9f0001;
-                       code += 4;
+                       /*
+                        * gdb does not like encountering the hw breakpoint ins in the debugged code. 
+                        * So instead of emitting a trap, we emit a call a C function and place a 
+                        * breakpoint there.
+                        */
+                       //*(int*)code = 0xef9f0001;
+                       //code += 4;
                        //ARM_DBRK (code);
+                       mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD, 
+                                                                (gpointer)"mono_break");
+                       code = emit_call_seq (cfg, code);
                        break;
                case OP_ADDCC:
                        ARM_ADDS_REG_REG (code, ins->dreg, ins->sreg1, ins->sreg2);
@@ -2469,6 +2495,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                case OP_SHL_IMM:
                        if (ins->inst_imm)
                                ARM_SHL_IMM (code, ins->dreg, ins->sreg1, (ins->inst_imm & 0x1f));
+                       else if (ins->dreg != ins->sreg1)
+                               ARM_MOV_REG_REG (code, ins->dreg, ins->sreg1);
                        break;
                case OP_ISHR:
                        ARM_SAR_REG (code, ins->dreg, ins->sreg1, ins->sreg2);
@@ -2476,10 +2504,14 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                case OP_SHR_IMM:
                        if (ins->inst_imm)
                                ARM_SAR_IMM (code, ins->dreg, ins->sreg1, (ins->inst_imm & 0x1f));
+                       else if (ins->dreg != ins->sreg1)
+                               ARM_MOV_REG_REG (code, ins->dreg, ins->sreg1);
                        break;
                case OP_SHR_UN_IMM:
                        if (ins->inst_imm)
                                ARM_SHR_IMM (code, ins->dreg, ins->sreg1, (ins->inst_imm & 0x1f));
+                       else if (ins->dreg != ins->sreg1)
+                               ARM_MOV_REG_REG (code, ins->dreg, ins->sreg1);
                        break;
                case OP_ISHR_UN:
                        ARM_SHR_REG (code, ins->dreg, ins->sreg1, ins->sreg2);
@@ -2593,6 +2625,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        else
                                mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_ABS, call->fptr);
                        code = emit_call_seq (cfg, code);
+                       code = emit_move_return_value (cfg, ins, code);
                        break;
                case OP_FCALL_REG:
                case OP_LCALL_REG:
@@ -2600,6 +2633,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                case OP_VOIDCALL_REG:
                case OP_CALL_REG:
                        code = emit_call_reg (code, ins->sreg1);
+                       code = emit_move_return_value (cfg, ins, code);
                        break;
                case OP_FCALL_MEMBASE:
                case OP_LCALL_MEMBASE:
@@ -2628,6 +2662,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                                ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_PC);
                                ARM_LDR_IMM (code, ARMREG_PC, ins->sreg1, ins->inst_offset);
                        }
+                       code = emit_move_return_value (cfg, ins, code);
                        break;
                case OP_OUTARG:
                        g_assert_not_reached ();
@@ -2838,12 +2873,22 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        }
                        break;
                case OP_STORER8_MEMBASE_REG:
-                       g_assert (arm_is_fpimm8 (ins->inst_offset));
-                       ARM_STFD (code, ins->sreg1, ins->inst_destbasereg, ins->inst_offset);
+                       /* This is generated by the local regalloc pass which runs after the lowering pass */
+                       if (!arm_is_fpimm8 (ins->inst_offset)) {
+                               code = mono_arm_emit_load_imm (code, ARMREG_LR, ins->inst_offset);
+                               ARM_STFD (code, ins->sreg1, ARMREG_LR, 0);
+                       } else {
+                               ARM_STFD (code, ins->sreg1, ins->inst_destbasereg, ins->inst_offset);
+                       }
                        break;
                case OP_LOADR8_MEMBASE:
-                       g_assert (arm_is_fpimm8 (ins->inst_offset));
-                       ARM_LDFD (code, ins->dreg, ins->inst_basereg, ins->inst_offset);
+                       /* This is generated by the local regalloc pass which runs after the lowering pass */
+                       if (!arm_is_fpimm8 (ins->inst_offset)) {
+                               code = mono_arm_emit_load_imm (code, ARMREG_LR, ins->inst_offset);
+                               ARM_LDFD (code, ins->dreg, ARMREG_LR, 0);
+                       } else {
+                               ARM_LDFD (code, ins->dreg, ins->inst_basereg, ins->inst_offset);
+                       }
                        break;
                case OP_STORER4_MEMBASE_REG:
                        g_assert (arm_is_fpimm8 (ins->inst_offset));