Author: zoltan
Date: 2006-01-18 17:22:59 -0500 (Wed, 18 Jan 2006)
New Revision: 55759

Modified:
   branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c
   branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
Log:
Ongoing work

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-01-18 21:19:57 UTC (rev 55758)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c        
2006-01-18 22:22:59 UTC (rev 55759)
@@ -9201,6 +9201,7 @@
  * - use sreg2 for destbasereg since it is not really a dreg
  * - cleanup creation of branches+bblocks in opcode decomposition
  * - get rid of the empty bblocks created by MONO_EMIT_NEW_BRACH_BLOCK2
+ * - get rid of CEE_ opcodes.
  * - Things to backport to the old JIT:
  *   - op_atomic_exchange fix for amd64
  *   - localloc fix for amd64

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini.c        2006-01-18 
21:19:57 UTC (rev 55758)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.c        2006-01-18 
22:22:59 UTC (rev 55759)
@@ -9355,7 +9355,10 @@
                                                ins->sreg1 = vreg;
                                        else
                                                ins->sreg2 = vreg;
-                                       break;
+
+                                       /* Allow further iterations */
+                                       srcindex = -1;
+                                       continue;
                                }
                                else if (def->opcode == OP_ICONST) {
                                        guint32 opcode2 = op_to_op_imm 
(ins->opcode);
@@ -9369,21 +9372,48 @@
                                                        ins->sreg1 = -1;
                                                else
                                                        ins->sreg2 = -1;
+
+                                               /* Allow further iterations */
+                                               srcindex = -1;
+                                               continue;
                                        }
                                }
                        }
                }
-       
+                       
+               if (spec [MONO_INST_DEST] == 'i') {
+                       MonoInst *def = defs [ins->dreg];
+
+                       if (def && (def->opcode == OP_ADD_IMM) && (def->sreg1 
== cfg->frame_reg)) {
+                               /* ADD_IMM is created by spill_global_vars */
+                               /* FIXME: Generalize this */
+                               switch (ins->opcode) {
+                               case OP_STORE_MEMBASE_REG:
+                               case OP_STOREI1_MEMBASE_REG: 
+                               case OP_STOREI2_MEMBASE_REG: 
+                               case OP_STOREI4_MEMBASE_REG: 
+                               case OP_STOREI8_MEMBASE_REG:
+                               case OP_STORER4_MEMBASE_REG: 
+                               case OP_STORER8_MEMBASE_REG:
+                               case OP_STORE_MEMBASE_IMM:
+                               case OP_STOREI1_MEMBASE_IMM: 
+                               case OP_STOREI2_MEMBASE_IMM: 
+                               case OP_STOREI4_MEMBASE_IMM: 
+                               case OP_STOREI8_MEMBASE_IMM: 
+                                       ins->inst_destbasereg = def->sreg1;
+                                       ins->inst_offset += def->inst_imm;
+                                       break;
+                               }
+                       }
+               }
+                       
                if ((ins->dreg != -1) && (spec [MONO_INST_DEST] == 'i')) {
                        defs [ins->dreg] = ins;
                        def_index [ins->dreg] = ins_index;
                }
-       }
 
-       /* 
-        * FIXME: Get rid of dead code created by this pass early so
-        * the spill pass doesn't create loads/stores for it.
-        */
+               ins_index ++;
+       }       
 
        g_free (defs);
        g_free (def_index);
@@ -9467,7 +9497,7 @@
                                continue;
 
                        if ((spec [MONO_INST_DEST] == 'i') && (ins->dreg >= 
MONO_MAX_IREGS) && !used [ins->dreg] && !get_vreg_to_inst (cfg, 'i', 
ins->dreg)) {
-                               if ((ins->opcode == OP_MOVE) || (ins->opcode == 
OP_ICONST)) {
+                               if ((ins->opcode == OP_MOVE) || (ins->opcode == 
OP_ICONST) || (ins->opcode == OP_ADD_IMM)) {
                                        //printf ("DEADCE: "); mono_print_ins 
(ins);
                                        ins->opcode = CEE_NOP;
                                }
@@ -9892,6 +9922,10 @@
 
                mono_spill_global_vars (cfg);
 
+               /* To optimize code created by spill_global_vars */
+               mono_local_cprop2 (cfg);
+               mono_local_deadce (cfg);
+
                /* Add branches between non-consecutive bblocks */
                for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
                        if (bb->last_ins && MONO_IS_COND_BRANCH_OP 
(bb->last_ins) &&

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

Reply via email to