Author: zoltan
Date: 2006-01-14 12:47:06 -0500 (Sat, 14 Jan 2006)
New Revision: 55576

Modified:
   branches/vargaz/mini-linear-il/mono/mono/mini/linear-scan.c
   branches/vargaz/mini-linear-il/mono/mono/mini/liveness.c
   branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c
   branches/vargaz/mini-linear-il/mono/mono/mini/mini-amd64.c
   branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
Log:
Implement liveness analysis

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/linear-scan.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/linear-scan.c 2006-01-14 
14:07:27 UTC (rev 55575)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/linear-scan.c 2006-01-14 
17:47:06 UTC (rev 55576)
@@ -190,10 +190,14 @@
                
                if (vmv->reg >= 0)  {
                        if ((gains [vmv->reg] > mono_arch_regalloc_cost (cfg, 
vmv)) && (cfg->varinfo [vmv->idx]->opcode != OP_REGVAR)) {
+                               if (cfg->verbose_level > 2) {
+                                       if (cfg->new_ir)
+                                               printf ("ALLOCATED R%d(%d) TO 
HREG %d COST %d\n", cfg->varinfo [vmv->idx]->dreg, vmv->idx, vmv->reg, 
vmv->spill_costs);
+                                       else
+                                               printf ("REGVAR %d C%d R%d\n", 
vmv->idx, vmv->spill_costs, vmv->reg);
+                               }
                                cfg->varinfo [vmv->idx]->opcode = OP_REGVAR;
                                cfg->varinfo [vmv->idx]->dreg = vmv->reg;
-                               if (cfg->verbose_level > 2)
-                                       printf ("REGVAR %d C%d R%d\n", 
vmv->idx, vmv->spill_costs, vmv->reg);
                        } else {
                                if (cfg->verbose_level > 2)
                                        printf ("COSTLY: %s R%d C%d C%d %s\n", 
mono_method_full_name (cfg->method, TRUE), vmv->idx, vmv->spill_costs, 
mono_arch_regalloc_cost (cfg, vmv), mono_arch_regname (vmv->reg));

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/liveness.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/liveness.c    2006-01-14 
14:07:27 UTC (rev 55575)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/liveness.c    2006-01-14 
17:47:06 UTC (rev 55576)
@@ -64,7 +64,93 @@
        int max_vars = cfg->num_varinfo;
 
        if (cfg->new_ir) {
-               g_assert_not_reached ();
+               MonoInst *ins = inst;
+               const char *spec = ins_info [ins->opcode - OP_START - 1];
+               int regtype, srcindex, sreg;
+               gboolean store;
+
+#ifdef DEBUG_LIVENESS
+                       printf ("\t"); mono_print_ins (ins);
+#endif
+
+               if (ins->opcode < MONO_CEE_LAST)
+                       return;
+
+               switch (ins->opcode) {
+               case OP_STORE:       
+               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: 
+                       store = TRUE;
+                       break;
+               case OP_STORE_MEMINDEX:
+               case OP_STOREI1_MEMINDEX:
+               case OP_STOREI2_MEMINDEX:
+               case OP_STOREI4_MEMINDEX:
+               case OP_STOREI8_MEMINDEX:
+               case OP_STORER4_MEMINDEX:
+               case OP_STORER8_MEMINDEX:
+                       g_assert_not_reached ();
+               default:
+                       store = FALSE;
+               }
+
+               /* SREGS */
+               /* These must come first, so MOVE r <- r is handled correctly */
+               for (srcindex = 0; srcindex < 2; ++srcindex) {
+                       regtype = spec [(srcindex == 0) ? MONO_INST_SRC1 : 
MONO_INST_SRC2];
+                       sreg = srcindex == 0 ? ins->sreg1 : ins->sreg2;
+
+                       g_assert (((sreg == -1) && (regtype == ' ')) || ((sreg 
!= -1) && (regtype != ' ')));
+                       if ((sreg != -1) && get_vreg_to_inst (cfg, regtype, 
sreg)) {
+                               MonoInst *var = cfg->vreg_to_inst 
[regtype][sreg];
+                               int idx = var->inst_c0;
+                               MonoMethodVar *vi = MONO_VARINFO (cfg, idx);
+
+#ifdef DEBUG_LIVENESS
+                               printf ("\tGEN: R%d(%d)\n", sreg, idx);
+#endif
+                               update_live_range (cfg, idx, bb->dfn, 
inst_num); 
+                               if (!mono_bitset_test (bb->kill_set, idx))
+                                       mono_bitset_set (bb->gen_set, idx);
+                               vi->spill_costs += 1 + (bb->nesting * 2);
+                       }
+               }
+
+               /* DREG */
+               regtype = spec [MONO_INST_DEST];
+               g_assert (((ins->dreg == -1) && (regtype == ' ')) || 
((ins->dreg != -1) && (regtype != ' ')));
+                               
+               if ((ins->dreg != -1) && get_vreg_to_inst (cfg, regtype, 
ins->dreg)) {
+                       MonoInst *var = cfg->vreg_to_inst [regtype][ins->dreg];
+                       int idx = var->inst_c0;
+                       MonoMethodVar *vi = MONO_VARINFO (cfg, idx);
+
+                       if (store) {
+                               update_live_range (cfg, idx, bb->dfn, 
inst_num); 
+                               if (!mono_bitset_test (bb->kill_set, idx))
+                                       mono_bitset_set (bb->gen_set, idx);
+                               vi->spill_costs += 1 + (bb->nesting * 2);
+                       } else {
+#ifdef DEBUG_LIVENESS
+                               printf ("\tKILL: R%d(%d)\n", ins->dreg, idx);
+#endif
+                               update_live_range (cfg, idx, bb->dfn, 
inst_num); 
+                               mono_bitset_set (bb->kill_set, idx);
+                               vi->spill_costs += 1 + (bb->nesting * 2);
+                       }
+               }
+
+               return;
        }
 
        if (arity)
@@ -146,16 +232,16 @@
 } 
 
 static void
-update_volatile (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *inst, int 
inst_num)
+update_volatile (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *inst)
 {
        int arity = mono_burg_arity [inst->opcode];
        int max_vars = cfg->num_varinfo;
 
        if (arity)
-               update_volatile (cfg, bb, inst->inst_i0, inst_num);
+               update_volatile (cfg, bb, inst->inst_i0);
 
        if (arity > 1)
-               update_volatile (cfg, bb, inst->inst_i1, inst_num);
+               update_volatile (cfg, bb, inst->inst_i1);
 
        if (inst->ssa_op & MONO_SSA_LOAD_STORE) {
                MonoLocalVariableList* affected_variables;
@@ -187,17 +273,57 @@
 static void
 visit_bb (MonoCompile *cfg, MonoBasicBlock *bb, GSList **visited)
 {
-       int i, tree_num;
-       MonoInst *inst;
+       int i;
+       MonoInst *ins;
 
        if (g_slist_find (*visited, bb))
                return;
 
+       if (cfg->new_ir) {
+               /* FIXME: Rewrite this using the aliasing framework */
+               for (ins = bb->code; ins; ins = ins->next) {
+                       const char *spec = ins_info [ins->opcode - OP_START - 
1];
+                       int regtype, srcindex, sreg;
+
+                       if (ins->opcode < MONO_CEE_LAST)
+                               return;
+
+                       /* DREG */
+                       regtype = spec [MONO_INST_DEST];
+                       g_assert (((ins->dreg == -1) && (regtype == ' ')) || 
((ins->dreg != -1) && (regtype != ' ')));
+                               
+                       if ((ins->dreg != -1) && get_vreg_to_inst (cfg, 
regtype, ins->dreg)) {
+                               MonoInst *var = cfg->vreg_to_inst 
[regtype][ins->dreg];
+                               int idx = var->inst_c0;
+                               MonoMethodVar *vi = MONO_VARINFO (cfg, idx);
+
+                               cfg->varinfo [vi->idx]->flags |= 
MONO_INST_VOLATILE;
+                       }
+                       
+                       /* SREGS */
+                       for (srcindex = 0; srcindex < 2; ++srcindex) {
+                               regtype = spec [(srcindex == 0) ? 
MONO_INST_SRC1 : MONO_INST_SRC2];
+                               sreg = srcindex == 0 ? ins->sreg1 : ins->sreg2;
+
+                               g_assert (((sreg == -1) && (regtype == ' ')) || 
((sreg != -1) && (regtype != ' ')));
+                               if ((sreg != -1) && get_vreg_to_inst (cfg, 
regtype, sreg)) {
+                                       MonoInst *var = cfg->vreg_to_inst 
[regtype][sreg];
+                                       int idx = var->inst_c0;
+                                       MonoMethodVar *vi = MONO_VARINFO (cfg, 
idx);
+
+                                       cfg->varinfo [vi->idx]->flags |= 
MONO_INST_VOLATILE;
+                               }
+                       }
+               }
+
+               return;
+       }
+
        if (cfg->aliasing_info != NULL)
                mono_aliasing_initialize_code_traversal (cfg->aliasing_info, 
bb);
-       
-       for (tree_num = 0, inst = bb->code; inst; inst = inst->next, 
tree_num++) {
-               update_volatile (cfg, bb, inst, tree_num);
+
+       for (ins = bb->code; ins; ins = ins->next) {
+               update_volatile (cfg, bb, ins);
        }
 
        *visited = g_slist_append (*visited, bb);

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-14 14:07:27 UTC (rev 55575)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c        
2006-01-14 17:47:06 UTC (rev 55576)
@@ -1931,11 +1931,13 @@
        return 0;
 }
 
+#if 0
 static void
 mini_emit_aotconst (MonoCompile *cfg, int dreg, MonoJumpInfoType patch_type, 
gpointer cons)
 {
        NOT_IMPLEMENTED;
 }
+#endif
 
 static void
 mini_emit_load_intf_reg (MonoCompile *cfg, int intf_reg, int ioffset_reg, 
MonoClass *klass)
@@ -3147,7 +3149,7 @@
        MonoBasicBlock *true_bb, *false_bb, *false2_bb, *end_bb, *no_proxy_bb, 
*interface_fail_bb;
        int obj_reg = src->dreg;
        int dreg = alloc_ireg (cfg);
-       int tmp_reg = alloc_preg (cfg);
+       int tmp_reg;
        int klass_reg = alloc_preg (cfg);
 
        NEW_BBLOCK (cfg, true_bb);
@@ -3162,6 +3164,7 @@
        if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
                NEW_BBLOCK (cfg, interface_fail_bb);
 
+               tmp_reg = alloc_preg (cfg);
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg, 
G_STRUCT_OFFSET (MonoObject, vtable));
                mini_emit_iface_cast (cfg, tmp_reg, klass, interface_fail_bb, 
true_bb);
                MONO_START_BB (cfg, interface_fail_bb);
@@ -3175,12 +3178,14 @@
                        MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, 
klass_reg, mono_defaults.transparent_proxy_class);
                }
                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, CEE_BNE_UN, false_bb);
-               
+
+               tmp_reg = alloc_preg (cfg);
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg, 
G_STRUCT_OFFSET (MonoTransparentProxy, custom_type_info));
                MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, tmp_reg, 0);
                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, CEE_BNE_UN, false2_bb);
                
        } else {
+               tmp_reg = alloc_preg (cfg);
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg, 
G_STRUCT_OFFSET (MonoObject, vtable));
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, klass_reg, tmp_reg, 
G_STRUCT_OFFSET (MonoVTable, klass));
                
@@ -3192,9 +3197,11 @@
                        MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, 
klass_reg, mono_defaults.transparent_proxy_class);
                }
                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, CEE_BNE_UN, no_proxy_bb);
+               tmp_reg = alloc_preg (cfg);
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg, 
G_STRUCT_OFFSET (MonoTransparentProxy, remote_class));
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, klass_reg, tmp_reg, 
G_STRUCT_OFFSET (MonoRemoteClass, proxy_class));
-               
+
+               tmp_reg = alloc_preg (cfg);             
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg, 
G_STRUCT_OFFSET (MonoTransparentProxy, custom_type_info));
                MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, tmp_reg, 0);
                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, CEE_BEQ, no_proxy_bb);
@@ -3269,10 +3276,12 @@
                }
                
                MONO_EMIT_NEW_COND_EXC (cfg, NE_UN, "InvalidCastException");
-               
+
+               tmp_reg = alloc_preg (cfg);
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg, 
G_STRUCT_OFFSET (MonoTransparentProxy, remote_class));
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, klass_reg, tmp_reg, 
G_STRUCT_OFFSET (MonoRemoteClass, proxy_class));
-               
+
+               tmp_reg = alloc_preg (cfg);             
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg, 
G_STRUCT_OFFSET (MonoTransparentProxy, custom_type_info));
                MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, tmp_reg, 0);
                MONO_EMIT_NEW_COND_EXC (cfg, EQ, "InvalidCastException");
@@ -3294,10 +3303,12 @@
                        MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, 
klass_reg, mono_defaults.transparent_proxy_class);
                }
                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, CEE_BNE_UN, no_proxy_bb);
-               
+
+               tmp_reg = alloc_preg (cfg);
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg, 
G_STRUCT_OFFSET (MonoTransparentProxy, remote_class));
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, klass_reg, tmp_reg, 
G_STRUCT_OFFSET (MonoRemoteClass, proxy_class));
-               
+
+               tmp_reg = alloc_preg (cfg);
                MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg, 
G_STRUCT_OFFSET (MonoTransparentProxy, custom_type_info));
                MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, tmp_reg, 0);
                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, CEE_BEQ, no_proxy_bb);
@@ -4096,7 +4107,6 @@
                ins->opcode = CEE_NOP;
                break;
        case OP_LCONV_TO_I8:
-       case OP_ICONV_TO_U8:
        case OP_LCONV_TO_I:
                ins->opcode = OP_MOVE;
                break;
@@ -9030,42 +9040,46 @@
                        regtype = spec [MONO_INST_DEST];
                        g_assert (((ins->dreg == -1) && (regtype == ' ')) || 
((ins->dreg != -1) && (regtype != ' ')));
                                
-                       if ((ins->dreg != -1) && (ins->dreg < 
cfg->vreg_to_inst_len [regtype]) && cfg->vreg_to_inst [regtype][ins->dreg]) {
+                       if ((ins->dreg != -1) && get_vreg_to_inst (cfg, 
regtype, ins->dreg)) {
                                MonoInst *var = cfg->vreg_to_inst 
[regtype][ins->dreg];
                                MonoInst *store_ins;
                                int store_opcode;
 
-                               g_assert (var->opcode == OP_REGOFFSET);
+                               if (var->opcode == OP_REGVAR) {
+                                       ins->dreg = var->dreg;
+                               } else {
+                                       g_assert (var->opcode == OP_REGOFFSET);
 
-                               ins->dreg = alloc_dreg (cfg, stacktypes 
[regtype]);
+                                       ins->dreg = alloc_dreg (cfg, stacktypes 
[regtype]);
 
-                               if (regtype == 'l') {
-                                       NEW_STORE_MEMBASE (cfg, store_ins, 
OP_STOREI4_MEMBASE_REG, var->inst_basereg, var->inst_offset + 
MINI_LS_WORD_OFFSET, ins->dreg);
-                                       insert_after_ins (bb, ins, store_ins);
-                                       NEW_STORE_MEMBASE (cfg, store_ins, 
OP_STOREI4_MEMBASE_REG, var->inst_basereg, var->inst_offset + 
MINI_MS_WORD_OFFSET, ins->dreg + 1);
-                                       insert_after_ins (bb, ins, store_ins);
-                               }
-                               else {
-                                       store_opcode = 
mono_type_to_store_membase (var->inst_vtype);
+                                       if (regtype == 'l') {
+                                               NEW_STORE_MEMBASE (cfg, 
store_ins, OP_STOREI4_MEMBASE_REG, var->inst_basereg, var->inst_offset + 
MINI_LS_WORD_OFFSET, ins->dreg);
+                                               insert_after_ins (bb, ins, 
store_ins);
+                                               NEW_STORE_MEMBASE (cfg, 
store_ins, OP_STOREI4_MEMBASE_REG, var->inst_basereg, var->inst_offset + 
MINI_MS_WORD_OFFSET, ins->dreg + 1);
+                                               insert_after_ins (bb, ins, 
store_ins);
+                                       }
+                                       else {
+                                               store_opcode = 
mono_type_to_store_membase (var->inst_vtype);
 
-                                       /* Try to fuse the store into the 
instruction itself */
-                                       /* FIXME: Add more instructions */
-                                       if (ins->opcode == OP_ICONST) {
-                                               ins->opcode = 
store_membase_reg_to_store_membase_imm (store_opcode);
-                                               ins->inst_imm = ins->inst_c0;
-                                               ins->inst_destbasereg = 
var->inst_basereg;
-                                               ins->inst_offset = 
var->inst_offset;
-                                       } else if ((ins->opcode == OP_MOVE) || 
(ins->opcode == OP_FMOVE) || (ins->opcode == OP_LMOVE)) {
-                                               ins->opcode = store_opcode;
-                                               ins->inst_destbasereg = 
var->inst_basereg;
-                                               ins->inst_offset = 
var->inst_offset;
-                                       } else {
-                                               /* printf ("INS: "); 
mono_print_ins (ins); */
-                                               /* Create a store instruction 
*/                                        
-                                               NEW_STORE_MEMBASE (cfg, 
store_ins, store_opcode, var->inst_basereg, var->inst_offset, ins->dreg);
+                                               /* Try to fuse the store into 
the instruction itself */
+                                               /* FIXME: Add more instructions 
*/
+                                               if (ins->opcode == OP_ICONST) {
+                                                       ins->opcode = 
store_membase_reg_to_store_membase_imm (store_opcode);
+                                                       ins->inst_imm = 
ins->inst_c0;
+                                                       ins->inst_destbasereg = 
var->inst_basereg;
+                                                       ins->inst_offset = 
var->inst_offset;
+                                               } else if ((ins->opcode == 
OP_MOVE) || (ins->opcode == OP_FMOVE) || (ins->opcode == OP_LMOVE)) {
+                                                       ins->opcode = 
store_opcode;
+                                                       ins->inst_destbasereg = 
var->inst_basereg;
+                                                       ins->inst_offset = 
var->inst_offset;
+                                               } else {
+                                                       /* printf ("INS: "); 
mono_print_ins (ins); */
+                                                       /* Create a store 
instruction */
+                                                       NEW_STORE_MEMBASE (cfg, 
store_ins, store_opcode, var->inst_basereg, var->inst_offset, ins->dreg);
 
-                                               /* Insert it after the 
instruction */
-                                               insert_after_ins (bb, ins, 
store_ins);
+                                                       /* Insert it after the 
instruction */
+                                                       insert_after_ins (bb, 
ins, store_ins);
+                                               }
                                        }
                                }
                        }
@@ -9076,29 +9090,36 @@
                                sreg = srcindex == 0 ? ins->sreg1 : ins->sreg2;
 
                                g_assert (((sreg == -1) && (regtype == ' ')) || 
((sreg != -1) && (regtype != ' ')));
-                               if ((sreg != -1) && (sreg < 
cfg->vreg_to_inst_len [regtype]) && (cfg->vreg_to_inst [regtype][sreg])) {
+                               if ((sreg != -1) && get_vreg_to_inst (cfg, 
regtype, sreg)) {
                                        MonoInst *var = cfg->vreg_to_inst 
[regtype][sreg];
                                        MonoInst *load_ins;
 
-                                       g_assert (var->opcode == OP_REGOFFSET);
+                                       if (var->opcode == OP_REGVAR) {
+                                               if (srcindex == 0)
+                                                       ins->sreg1 = var->dreg;
+                                               else
+                                                       ins->sreg2 = var->dreg;
+                                       } else {
+                                               g_assert (var->opcode == 
OP_REGOFFSET);
 
-                                       sreg = alloc_dreg (cfg, stacktypes 
[regtype]);
+                                               sreg = alloc_dreg (cfg, 
stacktypes [regtype]);
 
-                                       if (srcindex == 0)
-                                               ins->sreg1 = sreg;
-                                       else
-                                               ins->sreg2 = sreg;
+                                               if (srcindex == 0)
+                                                       ins->sreg1 = sreg;
+                                               else
+                                                       ins->sreg2 = sreg;
 
-                                       if (regtype == 'l') {
-                                               NEW_LOAD_MEMBASE (cfg, 
load_ins, OP_LOADI4_MEMBASE, sreg + 1, var->inst_basereg, var->inst_offset + 
MINI_MS_WORD_OFFSET);
-                                               insert_before_ins (bb, ins, 
load_ins, &prev);
-                                               NEW_LOAD_MEMBASE (cfg, 
load_ins, OP_LOADI4_MEMBASE, sreg, var->inst_basereg, var->inst_offset + 
MINI_LS_WORD_OFFSET);
-                                               insert_before_ins (bb, ins, 
load_ins, &prev);
+                                               if (regtype == 'l') {
+                                                       NEW_LOAD_MEMBASE (cfg, 
load_ins, OP_LOADI4_MEMBASE, sreg + 1, var->inst_basereg, var->inst_offset + 
MINI_MS_WORD_OFFSET);
+                                                       insert_before_ins (bb, 
ins, load_ins, &prev);
+                                                       NEW_LOAD_MEMBASE (cfg, 
load_ins, OP_LOADI4_MEMBASE, sreg, var->inst_basereg, var->inst_offset + 
MINI_LS_WORD_OFFSET);
+                                                       insert_before_ins (bb, 
ins, load_ins, &prev);
+                                               }
+                                               else {
+                                                       NEW_LOAD_MEMBASE (cfg, 
load_ins, mono_type_to_load_membase (var->inst_vtype), sreg, var->inst_basereg, 
var->inst_offset);
+                                                       insert_before_ins (bb, 
ins, load_ins, &prev);
+                                               }
                                        }
-                                       else {
-                                               NEW_LOAD_MEMBASE (cfg, 
load_ins, mono_type_to_load_membase (var->inst_vtype), sreg, var->inst_basereg, 
var->inst_offset);
-                                               insert_before_ins (bb, ins, 
load_ins, &prev);
-                                       }
                                }
                        }
 

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-amd64.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini-amd64.c  2006-01-14 
14:07:27 UTC (rev 55575)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-amd64.c  2006-01-14 
17:47:06 UTC (rev 55576)
@@ -2585,6 +2585,7 @@
                case CEE_CONV_U8:
                case CEE_CONV_U:
                case OP_ICONV_TO_U:
+               case OP_ICONV_TO_U8:
                        /* Clean out the upper word */
                        amd64_mov_reg_reg_size (code, ins->dreg, ins->sreg1, 4);
                        break;

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini.c        2006-01-14 
14:07:27 UTC (rev 55575)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.c        2006-01-14 
17:47:06 UTC (rev 55576)
@@ -9474,7 +9474,7 @@
        mono_compile_create_vars (cfg);
 
        if (cfg->new_ir) {
-               cfg->opt &= MONO_OPT_PEEPHOLE | MONO_OPT_INTRINS | 
MONO_OPT_LOOP | MONO_OPT_EXCEPTION | MONO_OPT_AOT | MONO_OPT_BRANCH;
+               cfg->opt &= MONO_OPT_PEEPHOLE | MONO_OPT_INTRINS | 
MONO_OPT_LOOP | MONO_OPT_EXCEPTION | MONO_OPT_AOT | MONO_OPT_BRANCH | 
MONO_OPT_LINEARS;
 
                i = mono_method_to_ir2 (cfg, method, NULL, NULL, 
cfg->locals_start, NULL, NULL, NULL, 0, FALSE);
        }
@@ -9635,6 +9635,11 @@
                g_list_free (regs);
        }
 
+       if (cfg->new_ir) {
+               /* This must be done _before_ global reg alloc and _after_ 
decompose */
+               mono_handle_global_vregs (cfg);
+       }
+
        if (cfg->opt & MONO_OPT_LINEARS) {
                GList *vars, *regs;
                
@@ -9669,11 +9674,6 @@
        //mono_print_code (cfg);
 
     //print_dfn (cfg);
-
-       if (cfg->new_ir) {
-               /* FIXME: Move this call elsewhere, _before_ global reg alloc 
and _after_ decompose */
-               mono_handle_global_vregs (cfg);
-       }
        
        /* variables are allocated after decompose, since decompose could 
create temps */
        mono_arch_allocate_vars (cfg);

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

Reply via email to