Author: zoltan
Date: 2006-03-20 12:21:56 -0500 (Mon, 20 Mar 2006)
New Revision: 58191

Modified:
   branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c
   branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h
   branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
Log:
Beginnings of vtype optimizations.


Modified: branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c        
2006-03-20 16:52:22 UTC (rev 58190)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c        
2006-03-20 17:21:56 UTC (rev 58191)
@@ -5857,6 +5857,29 @@
                        CHECK_OPSIZE (2);
                        CHECK_STACK_OVF (1);
                        CHECK_LOCAL (ip [1]);
+
+                       /*
+                        * ldloca inhibits many optimizations so try to get rid 
of it in common
+                        * cases.
+                        * FIXME: do this in LDLOCA as well.
+                        */
+                       /* FIXME: Finish this */
+#if 0
+                       /* FIXME: Check for out of range ip */
+                       if ((ip [2] == CEE_PREFIX1) && (ip [3] == CEE_INITOBJ) 
&& ip_in_bb (cfg, bblock, ip + 3)) {
+                               MonoClass *klass = cfg->locals [ip [1]]->klass;
+                               if (MONO_TYPE_IS_REFERENCE (&klass->byval_arg)) 
{
+                                       /* FIXME: */
+                                       g_assert_not_reached ();
+                               } else {
+                                       MONO_EMIT_NEW_VZERO (cfg, cfg->locals 
[ip [1]]->dreg, klass);
+                               }
+                               ip += 2 + 6;
+                               inline_costs += 1;
+                               break;
+                       }
+#endif
+
                        EMIT_NEW_LOCLOADA (cfg, ins, ip [1]);
                        ins->cil_code = ip;
                        *sp++ = ins;
@@ -9437,6 +9460,16 @@
                                ins->sreg1 = var->inst_basereg;
                                ins->inst_imm = var->inst_offset;
 
+#if defined(__i386__)
+                               if ((ins->sreg1 == X86_EBP) && (ins->dreg != 
X86_EBP)) {
+                                       /* LEA is ADD but without the 
sreg1==dreg restriction */
+                                       /* FIXME: amd64 and generalize this */
+                                       /* FIXME: Why does this lead to code 
growth in mcs ? */
+                                       ins->opcode = OP_X86_LEA_MEMBASE;
+                                       ins->inst_basereg = ins->sreg1;
+                               }
+#endif
+
                                spec = ins_info [ins->opcode - OP_START - 1];
                        }
 

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h    2006-03-20 
16:52:22 UTC (rev 58190)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h    2006-03-20 
17:21:56 UTC (rev 58191)
@@ -608,7 +608,7 @@
 MINI_OP(OP_X86_PUSH_OBJ,           "x86_push_obj", NONE, IREG, NONE)
 MINI_OP(OP_X86_PUSH_GOT_ENTRY,     "x86_push_got_entry", NONE, IREG, NONE)
 MINI_OP(OP_X86_LEA,                "x86_lea", IREG, IREG, IREG)
-MINI_OP(OP_X86_LEA_MEMBASE,        "x86_lea_membase", NONE, NONE, NONE)
+MINI_OP(OP_X86_LEA_MEMBASE,        "x86_lea_membase", IREG, IREG, NONE)
 MINI_OP(OP_X86_XCHG,               "x86_xchg", NONE, NONE, NONE)
 MINI_OP(OP_X86_FPOP,               "x86_fpop", NONE, FREG, NONE)
 MINI_OP(OP_X86_FP_LOAD_I8,         "x86_fp_load_i8", NONE, NONE, NONE)

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini.c        2006-03-20 
16:52:22 UTC (rev 58190)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.c        2006-03-20 
17:21:56 UTC (rev 58191)
@@ -10759,13 +10759,9 @@
        if (cfg->new_ir) {
                mono_decompose_long_opts (cfg);
 
-               /* FIXME: Do this later */
-               mono_decompose_vtype_opts (cfg);
-       }
-
-       if (cfg->new_ir)
                /* Should be done before branch opts */
                mono_local_cprop2 (cfg);
+       }
 
        if (cfg->opt & MONO_OPT_BRANCH)
                optimize_branches (cfg);
@@ -10815,9 +10811,11 @@
                /* This must be done _before_ global reg alloc and _after_ 
decompose */
                mono_handle_global_vregs (cfg);
                mono_local_deadce_alt (cfg);
+
+               // FIXME: Do this after SSA
+               mono_decompose_vtype_opts (cfg);
        }
 
-
        /* after method_to_ir */
        if (parts == 1)
                return cfg;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to