Author: zoltan
Date: 2006-02-19 13:12:49 -0500 (Sun, 19 Feb 2006)
New Revision: 57054

Modified:
   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-codegen.c
   branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c
   branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
   branches/vargaz/mini-linear-il/mono/mono/mini/mini.h
   branches/vargaz/mini-linear-il/mono/mono/mini/ssa.c
Log:
Get rid of the aliasing between the two vregs used to implement longs on 32 bit 
machines, and the original long vreg. Simplify vreg_to_inst () as a result

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/liveness.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/liveness.c    2006-02-19 
18:12:00 UTC (rev 57053)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/liveness.c    2006-02-19 
18:12:49 UTC (rev 57054)
@@ -219,8 +219,8 @@
                        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 = get_vreg_to_inst (cfg, regtype, 
ins->dreg);
+                       if ((ins->dreg != -1) && get_vreg_to_inst (cfg, 
ins->dreg)) {
+                               MonoInst *var = get_vreg_to_inst (cfg, 
ins->dreg);
                                int idx = var->inst_c0;
                                MonoMethodVar *vi = MONO_VARINFO (cfg, idx);
 
@@ -233,8 +233,8 @@
                                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 = get_vreg_to_inst (cfg, 
regtype, sreg);
+                               if ((sreg != -1) && get_vreg_to_inst (cfg, 
sreg)) {
+                                       MonoInst *var = get_vreg_to_inst (cfg, 
sreg);
                                        int idx = var->inst_c0;
                                        MonoMethodVar *vi = MONO_VARINFO (cfg, 
idx);
 
@@ -317,8 +317,8 @@
                        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 = get_vreg_to_inst (cfg, regtype, 
sreg);
+                       if ((sreg != -1) && get_vreg_to_inst (cfg, sreg)) {
+                               MonoInst *var = get_vreg_to_inst (cfg, sreg);
                                int idx = var->inst_c0;
                                MonoMethodVar *vi = MONO_VARINFO (cfg, idx);
 
@@ -336,8 +336,8 @@
                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 = get_vreg_to_inst (cfg, regtype, 
ins->dreg);
+               if ((ins->dreg != -1) && get_vreg_to_inst (cfg, ins->dreg)) {
+                       MonoInst *var = get_vreg_to_inst (cfg, ins->dreg);
                        int idx = var->inst_c0;
                        MonoMethodVar *vi = MONO_VARINFO (cfg, idx);
 

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-02-19 18:12:00 UTC (rev 57053)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c        
2006-02-19 18:12:49 UTC (rev 57054)
@@ -163,7 +163,7 @@
        /* Use a pair of consecutive vregs */
        guint32 res = cfg->next_vireg;
 
-       cfg->next_vireg += 2;
+       cfg->next_vireg += 3;
 
        return res;
 #endif
@@ -4386,22 +4386,22 @@
                for (; tree; tree = tree->next) {
                        switch (tree->opcode) {
                        case OP_I8CONST:
-                               MONO_EMIT_NEW_ICONST (cfg, tree->dreg, 
tree->inst_ls_word);
-                               MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 1, 
tree->inst_ms_word);
+                               MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 1, 
tree->inst_ls_word);
+                               MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 2, 
tree->inst_ms_word);
                                break;
                        case OP_LMOVE:
                        case OP_LCONV_TO_U8:
                        case OP_LCONV_TO_I8:
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
                                MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
1, tree->sreg1 + 1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
2, tree->sreg1 + 2);
                                break;
                        case OP_STOREI8_MEMBASE_REG:
-                               MONO_EMIT_NEW_STORE_MEMBASE (cfg, 
OP_STOREI4_MEMBASE_REG, tree->inst_destbasereg, tree->inst_offset + 
MINI_MS_WORD_OFFSET, tree->sreg1 + 1);
-                               MONO_EMIT_NEW_STORE_MEMBASE (cfg, 
OP_STOREI4_MEMBASE_REG, tree->inst_destbasereg, tree->inst_offset + 
MINI_LS_WORD_OFFSET, tree->sreg1);
+                               MONO_EMIT_NEW_STORE_MEMBASE (cfg, 
OP_STOREI4_MEMBASE_REG, tree->inst_destbasereg, tree->inst_offset + 
MINI_MS_WORD_OFFSET, tree->sreg1 + 2);
+                               MONO_EMIT_NEW_STORE_MEMBASE (cfg, 
OP_STOREI4_MEMBASE_REG, tree->inst_destbasereg, tree->inst_offset + 
MINI_LS_WORD_OFFSET, tree->sreg1 + 1);
                                break;
                        case OP_LOADI8_MEMBASE:
-                               MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, 
OP_LOADI4_MEMBASE, tree->dreg + 1, tree->inst_basereg, tree->inst_offset + 
MINI_MS_WORD_OFFSET);
-                               MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, 
OP_LOADI4_MEMBASE, tree->dreg, tree->inst_basereg, tree->inst_offset + 
MINI_LS_WORD_OFFSET);
+                               MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, 
OP_LOADI4_MEMBASE, tree->dreg + 2, tree->inst_basereg, tree->inst_offset + 
MINI_MS_WORD_OFFSET);
+                               MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, 
OP_LOADI4_MEMBASE, tree->dreg + 1, tree->inst_basereg, tree->inst_offset + 
MINI_LS_WORD_OFFSET);
                                break;
 
                        case OP_ICONV_TO_I8: {
@@ -4412,56 +4412,56 @@
                                 * tmp = low > -1 ? 1: 0;
                                 * high = tmp - 1; if low is zero or pos high 
becomes 0, else -1
                                 */
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ICOMPARE_IMM, 
-1, tree->dreg, -1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
1, tree->sreg1);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ICOMPARE_IMM, 
-1, tree->dreg + 1, -1);
                                MONO_EMIT_NEW_BIALU (cfg, OP_ICGT, tmpreg, -1, 
-1);
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISUB_IMM, 
tree->dreg + 1, tmpreg, 1);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISUB_IMM, 
tree->dreg + 2, tmpreg, 1);
                                break;
                        }
                        case OP_ICONV_TO_U8:
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
-                               MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 1, 0);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
1, tree->sreg1);
+                               MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 2, 0);
                                break;
                        case OP_ICONV_TO_OVF_I8:
                                /* a signed 32 bit num always fits in a signed 
64 bit one */
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SHR_IMM, 
tree->dreg + 1, tree->sreg1, 31);
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SHR_IMM, 
tree->dreg + 2, tree->sreg1, 31);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
1, tree->sreg1);
                                break;
                        case OP_ICONV_TO_OVF_U8:
                                MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, LT, 
"OverflowException");
-                               MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 1, 0);
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
+                               MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 2, 0);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
1, tree->sreg1);
                                break;
                        case OP_ICONV_TO_OVF_U8_UN:
-                               MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 1, 0);
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
+                               MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 2, 0);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
1, tree->sreg1);
                                break;
                        case OP_LCONV_TO_I1:
-                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I1, 
tree->dreg, tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I1, 
tree->dreg, tree->sreg1 + 1);
                                break;
                        case OP_LCONV_TO_U1:
-                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_U1, 
tree->dreg, tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_U1, 
tree->dreg, tree->sreg1 + 1);
                                break;
                        case OP_LCONV_TO_I2:
-                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I2, 
tree->dreg, tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I2, 
tree->dreg, tree->sreg1 + 1);
                                break;
                        case OP_LCONV_TO_U2:
-                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_U2, 
tree->dreg, tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_U2, 
tree->dreg, tree->sreg1 + 1);
                                break;
                        case OP_LCONV_TO_I4:
                        case OP_LCONV_TO_U4:
                        case OP_LCONV_TO_I:
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1 + 1);
                                break;
                        case OP_LCONV_TO_R8:
-                               MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_R8_2, 
tree->dreg, tree->sreg1, tree->sreg1 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_R8_2, 
tree->dreg, tree->sreg1 + 1, tree->sreg1 + 2);
                                break;
                        case OP_LCONV_TO_R4:
-                               MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_R4_2, 
tree->dreg, tree->sreg1, tree->sreg1 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_R4_2, 
tree->dreg, tree->sreg1 + 1, tree->sreg1 + 2);
                                break;
                        case OP_LCONV_TO_R_UN:
-                               MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_R_UN_2, 
tree->dreg, tree->sreg1, tree->sreg1 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_R_UN_2, 
tree->dreg, tree->sreg1 + 1, tree->sreg1 + 2);
                                break;
                        case OP_LCONV_TO_OVF_I1: {
                                MonoBasicBlock *is_negative, *end_label;
@@ -4469,48 +4469,48 @@
                                NEW_BBLOCK (cfg, is_negative);
                                NEW_BBLOCK (cfg, end_label);
 
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, GT, 
"OverflowException");
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, -1);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, -1);
                                MONO_EMIT_NEW_COND_EXC (cfg, LT, 
"OverflowException");
 
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBLT, 
is_negative);
 
                                /* Positive */
-                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 
127);
+                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1 + 
1, 127);
                                MONO_EMIT_NEW_COND_EXC (cfg, GT_UN, 
"OverflowException");
                                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, 
end_label);
 
                                /* Negative */
                                MONO_START_BB (cfg, is_negative);
-                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 
-128);
+                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1 + 
1, -128);
                                MONO_EMIT_NEW_COND_EXC (cfg, LT_UN, 
"OverflowException");
 
                                MONO_START_BB (cfg, end_label);
 
-                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I1, 
tree->dreg, tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I1, 
tree->dreg, tree->sreg1 + 1);
                                break;
                        }
                        case OP_LCONV_TO_OVF_I1_UN:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, NE_UN, 
"OverflowException");
 
-                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 
127);
+                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1 + 
1, 127);
                                MONO_EMIT_NEW_COND_EXC (cfg, GT, 
"OverflowException");
-                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 
-128);
+                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1 + 
1, -128);
                                MONO_EMIT_NEW_COND_EXC (cfg, LT, 
"OverflowException");
-                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I1, 
tree->dreg, tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I1, 
tree->dreg, tree->sreg1 + 1);
                                break;
                        case OP_LCONV_TO_OVF_U1:
                        case OP_LCONV_TO_OVF_U1_UN:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, NE_UN, 
"OverflowException");
 
                                /* probe value to be within 0 to 255 */
-                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 
255);
+                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1 + 
1, 255);
                                MONO_EMIT_NEW_COND_EXC (cfg, GT_UN, 
"OverflowException");
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, 
tree->dreg, tree->sreg1, 0xff);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, 
tree->dreg, tree->sreg1 + 1, 0xff);
                                break;
                        case OP_LCONV_TO_OVF_I2: {
                                MonoBasicBlock *is_negative, *end_label;
@@ -4518,129 +4518,129 @@
                                NEW_BBLOCK (cfg, is_negative);
                                NEW_BBLOCK (cfg, end_label);
 
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, GT, 
"OverflowException");
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, -1);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, -1);
                                MONO_EMIT_NEW_COND_EXC (cfg, LT, 
"OverflowException");
 
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBLT, 
is_negative);
 
                                /* Positive */
-                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 
32767);
+                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1 + 
1, 32767);
                                MONO_EMIT_NEW_COND_EXC (cfg, GT_UN, 
"OverflowException");
                                MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, 
end_label);
 
                                /* Negative */
                                MONO_START_BB (cfg, is_negative);
-                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 
-32768);
+                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1 + 
1, -32768);
                                MONO_EMIT_NEW_COND_EXC (cfg, LT_UN, 
"OverflowException");
                                MONO_START_BB (cfg, end_label);
 
-                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I2, 
tree->dreg, tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I2, 
tree->dreg, tree->sreg1 + 1);
                                break;
                        }
                        case OP_LCONV_TO_OVF_I2_UN:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, NE_UN, 
"OverflowException");
 
                                /* Probe value to be within -32768 and 32767 */
-                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 
32767);
+                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1 + 
1, 32767);
                                MONO_EMIT_NEW_COND_EXC (cfg, GT, 
"OverflowException");
-                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 
-32768);
+                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1 + 
1, -32768);
                                MONO_EMIT_NEW_COND_EXC (cfg, LT, 
"OverflowException");
-                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I2, 
tree->dreg, tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_ICONV_TO_I2, 
tree->dreg, tree->sreg1 + 1);
                                break;
                        case OP_LCONV_TO_OVF_U2:
                        case OP_LCONV_TO_OVF_U2_UN:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, NE_UN, 
"OverflowException");
 
                                /* Probe value to be within 0 and 65535 */
-                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1, 
0xffff);
+                               MONO_EMIT_NEW_COMPARE_IMM (cfg, tree->sreg1 + 
1, 0xffff);
                                MONO_EMIT_NEW_COND_EXC (cfg, GT_UN, 
"OverflowException");
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, 
tree->dreg, tree->sreg1, 0xffff);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, 
tree->dreg, tree->sreg1 + 1, 0xffff);
                                break;
                        case OP_LCONV_TO_OVF_I4:
                        case OP_LCONV_TO_OVF_I:
-                               MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_OVF_I4_2, 
tree->dreg, tree->sreg1, tree->sreg1 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_OVF_I4_2, 
tree->dreg, tree->sreg1 + 1, tree->sreg1 + 2);
                                break;
                        case OP_LCONV_TO_OVF_U4:
                        case OP_LCONV_TO_OVF_U4_UN:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, NE_UN, 
"OverflowException");
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1 + 1);
                                break;
                        case OP_LCONV_TO_OVF_I_UN:
                        case OP_LCONV_TO_OVF_I4_UN:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, NE_UN, 
"OverflowException");
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, LT, 
"OverflowException");
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1 + 1);
                                break;
                        case OP_LCONV_TO_OVF_U8:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, LT, 
"OverflowException");
 
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
                                MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
1, tree->sreg1 + 1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
2, tree->sreg1 + 2);
                                break;
                        case OP_LCONV_TO_OVF_I8_UN:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 1, 0);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, 
-1, tree->sreg1 + 2, 0);
                                MONO_EMIT_NEW_COND_EXC (cfg, LT, 
"OverflowException");
 
-                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg, 
tree->sreg1);
                                MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
1, tree->sreg1 + 1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, tree->dreg + 
2, tree->sreg1 + 2);
                                break;
 
                        case OP_LADD:
-                               MONO_EMIT_NEW_BIALU (cfg, OP_IADDCC, 
tree->dreg, tree->sreg1, tree->sreg2);
-                               MONO_EMIT_NEW_BIALU (cfg, OP_IADC, tree->dreg + 
1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_IADDCC, tree->dreg 
+ 1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_IADC, tree->dreg + 
2, tree->sreg1 + 2, tree->sreg2 + 2);
                                break;
                        case OP_LSUB:
-                               MONO_EMIT_NEW_BIALU (cfg, OP_ISUBCC, 
tree->dreg, tree->sreg1, tree->sreg2);
-                               MONO_EMIT_NEW_BIALU (cfg, OP_ISBB, tree->dreg + 
1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_ISUBCC, tree->dreg 
+ 1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_ISBB, tree->dreg + 
2, tree->sreg1 + 2, tree->sreg2 + 2);
                                break;
                        case OP_LADD_OVF:
                                /* ADC sets the condition code */
-                               MONO_EMIT_NEW_BIALU (cfg, OP_IADDCC, 
tree->dreg, tree->sreg1, tree->sreg2);
-                               MONO_EMIT_NEW_BIALU (cfg, OP_IADC, tree->dreg + 
1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_IADDCC, tree->dreg 
+ 1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_IADC, tree->dreg + 
2, tree->sreg1 + 2, tree->sreg2 + 2);
                                MONO_EMIT_NEW_COND_EXC (cfg, OV, 
"OverflowException");
                                break;
                        case OP_LADD_OVF_UN:
                                /* ADC sets the condition code */
-                               MONO_EMIT_NEW_BIALU (cfg, OP_IADDCC, 
tree->dreg, tree->sreg1, tree->sreg2);
-                               MONO_EMIT_NEW_BIALU (cfg, OP_IADC, tree->dreg + 
1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_IADDCC, tree->dreg 
+ 1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_IADC, tree->dreg + 
2, tree->sreg1 + 2, tree->sreg2 + 2);
                                MONO_EMIT_NEW_COND_EXC (cfg, C, 
"OverflowException");
                                break;
                        case OP_LSUB_OVF:
                                /* SBB sets the condition code */
-                               MONO_EMIT_NEW_BIALU (cfg, OP_ISUBCC, 
tree->dreg, tree->sreg1, tree->sreg2);
-                               MONO_EMIT_NEW_BIALU (cfg, OP_ISBB, tree->dreg + 
1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_ISUBCC, tree->dreg 
+ 1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_ISBB, tree->dreg + 
2, tree->sreg1 + 2, tree->sreg2 + 2);
                                MONO_EMIT_NEW_COND_EXC (cfg, OV, 
"OverflowException");
                                break;
                        case OP_LSUB_OVF_UN:
                                /* SBB sets the condition code */
-                               MONO_EMIT_NEW_BIALU (cfg, OP_ISUBCC, 
tree->dreg, tree->sreg1, tree->sreg2);
-                               MONO_EMIT_NEW_BIALU (cfg, OP_ISBB, tree->dreg + 
1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_ISUBCC, tree->dreg 
+ 1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_ISBB, tree->dreg + 
2, tree->sreg1 + 2, tree->sreg2 + 2);
                                MONO_EMIT_NEW_COND_EXC (cfg, C, 
"OverflowException");
                                break;
                        case OP_LAND:
-                               MONO_EMIT_NEW_BIALU (cfg, OP_IAND, tree->dreg, 
tree->sreg1, tree->sreg2);
                                MONO_EMIT_NEW_BIALU (cfg, OP_IAND, tree->dreg + 
1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_IAND, tree->dreg + 
2, tree->sreg1 + 2, tree->sreg2 + 2);
                                break;
                        case OP_LOR:
-                               MONO_EMIT_NEW_BIALU (cfg, OP_IOR, tree->dreg, 
tree->sreg1, tree->sreg2);
                                MONO_EMIT_NEW_BIALU (cfg, OP_IOR, tree->dreg + 
1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_IOR, tree->dreg + 
2, tree->sreg1 + 2, tree->sreg2 + 2);
                                break;
                        case OP_LXOR:
-                               MONO_EMIT_NEW_BIALU (cfg, OP_IXOR, tree->dreg, 
tree->sreg1, tree->sreg2);
                                MONO_EMIT_NEW_BIALU (cfg, OP_IXOR, tree->dreg + 
1, tree->sreg1 + 1, tree->sreg2 + 1);
+                               MONO_EMIT_NEW_BIALU (cfg, OP_IXOR, tree->dreg + 
2, tree->sreg1 + 2, tree->sreg2 + 2);
                                break;
                        case OP_LNOT:
-                               MONO_EMIT_NEW_UNALU (cfg, OP_INOT, tree->dreg, 
tree->sreg1);
                                MONO_EMIT_NEW_UNALU (cfg, OP_INOT, tree->dreg + 
1, tree->sreg1 + 1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_INOT, tree->dreg + 
2, tree->sreg1 + 2);
                                break;
                        case OP_LNEG:
                                /* 
@@ -4650,9 +4650,9 @@
 #ifndef __i386__
                                NOT_IMPLEMENTED;
 #endif
-                               MONO_EMIT_NEW_UNALU (cfg, OP_INEG, tree->dreg, 
tree->sreg1);
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADC_IMM, 
tree->dreg + 1, tree->sreg1 + 1, 0);
-                               MONO_EMIT_NEW_UNALU (cfg, OP_INEG, tree->dreg + 
1, tree->dreg + 1);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_INEG, tree->dreg + 
1, tree->sreg1 + 1);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADC_IMM, 
tree->dreg + 2, tree->sreg1 + 2, 0);
+                               MONO_EMIT_NEW_UNALU (cfg, OP_INEG, tree->dreg + 
2, tree->dreg + 2);
                                break;
                        case OP_LMUL:
                                /* Emulated */
@@ -4660,24 +4660,24 @@
                                break;
 
                        case OP_LADD_IMM:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADDCC_IMM, 
tree->dreg, tree->sreg1, tree->inst_ls_word);
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADC_IMM, 
tree->dreg + 1, tree->sreg1 + 1, tree->inst_ms_word);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADDCC_IMM, 
tree->dreg + 1, tree->sreg1 + 1, tree->inst_ls_word);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADC_IMM, 
tree->dreg + 2, tree->sreg1 + 2, tree->inst_ms_word);
                                break;
                        case OP_LSUB_IMM:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SUBCC_IMM, 
tree->dreg, tree->sreg1, tree->inst_ls_word);
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SBB_IMM, 
tree->dreg + 1, tree->sreg1 + 1, tree->inst_ms_word);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SUBCC_IMM, 
tree->dreg + 1, tree->sreg1 + 1, tree->inst_ls_word);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SBB_IMM, 
tree->dreg + 2, tree->sreg1 + 2, tree->inst_ms_word);
                                break;
                        case OP_LAND_IMM:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, 
tree->dreg, tree->sreg1, tree->inst_ls_word);
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, 
tree->dreg + 1, tree->sreg1 + 1, tree->inst_ms_word);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, 
tree->dreg + 1, tree->sreg1 + 1, tree->inst_ls_word);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, 
tree->dreg + 2, tree->sreg1 + 2, tree->inst_ms_word);
                                break;
                        case OP_LOR_IMM:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_OR_IMM, 
tree->dreg, tree->sreg1, tree->inst_ls_word);
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_OR_IMM, 
tree->dreg + 1, tree->sreg1 + 1, tree->inst_ms_word);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_OR_IMM, 
tree->dreg + 1, tree->sreg1 + 1, tree->inst_ls_word);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_OR_IMM, 
tree->dreg + 2, tree->sreg1 + 2, tree->inst_ms_word);
                                break;
                        case OP_LXOR_IMM:
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_XOR_IMM, 
tree->dreg, tree->sreg1, tree->inst_ls_word);
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_XOR_IMM, 
tree->dreg + 1, tree->sreg1 + 1, tree->inst_ms_word);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_XOR_IMM, 
tree->dreg + 1, tree->sreg1 + 1, tree->inst_ls_word);
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_XOR_IMM, 
tree->dreg + 2, tree->sreg1 + 2, tree->inst_ms_word);
                                break;
                        case OP_LSHR_UN_IMM:
                                if (tree->inst_c1 == 32) {
@@ -4689,15 +4689,15 @@
                                         */
                                        /* FIXME: Move this to the strenght 
reduction pass */
                                        /* just move the upper half to the 
lower and zero the high word */
-                                       MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, 
tree->dreg, tree->sreg1 + 1);
-                                       MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 
1, 0);
+                                       MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, 
tree->dreg + 1, tree->sreg1 + 2);
+                                       MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 
2, 0);
                                }
                                break;
                        case OP_LSHL_IMM:
                                if (tree->inst_c1 == 32) {
                                        /* just move the lower half to the 
upper and zero the lower word */
-                                       MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, 
tree->dreg + 1, tree->sreg1);
-                                       MONO_EMIT_NEW_ICONST (cfg, tree->dreg, 
0);
+                                       MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, 
tree->dreg + 2, tree->sreg1 + 1);
+                                       MONO_EMIT_NEW_ICONST (cfg, tree->dreg + 
1, 0);
                                }
                                break;
 
@@ -4708,80 +4708,80 @@
 
                                switch (next->opcode) {
                                case OP_LBEQ:
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
-                                       MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_false_bb);
                                        MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_false_bb);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK2 (cfg, 
OP_IBEQ, next->inst_true_bb, next->inst_false_bb);
                                        next->opcode = OP_NOP;
                                        break;
                                case OP_LBNE_UN:
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
-                                       MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_true_bb);
                                        MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_true_bb);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK2 (cfg, 
OP_IBNE_UN, next->inst_true_bb, next->inst_false_bb);
                                        next->opcode = OP_NOP;
                                        break;
                                case OP_LBLT:
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBLT, next->inst_true_bb);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_false_bb);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK2 (cfg, 
OP_IBLT_UN, next->inst_true_bb, next->inst_false_bb);
                                        next->opcode = OP_NOP;
                                        break;
                                case OP_LBGT:
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGT, next->inst_true_bb);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_false_bb);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK2 (cfg, 
OP_IBGT_UN, next->inst_true_bb, next->inst_false_bb);
                                        next->opcode = OP_NOP;
                                        break;
                                case OP_LBGE:
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGT, next->inst_true_bb);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_false_bb);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK2 (cfg, 
OP_IBGE_UN, next->inst_true_bb, next->inst_false_bb);
                                        next->opcode = OP_NOP;
                                        break;
                                case OP_LBLE:
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBLT, next->inst_true_bb);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_false_bb);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK2 (cfg, 
OP_IBLE_UN, next->inst_true_bb, next->inst_false_bb);
                                        next->opcode = OP_NOP;
                                        break;
                                case OP_LBLT_UN:
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBLT_UN, next->inst_true_bb);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_false_bb);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK2 (cfg, 
OP_IBLT_UN, next->inst_true_bb, next->inst_false_bb);
                                        next->opcode = OP_NOP;
                                        break;
                                case OP_LBGT_UN:
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGT_UN, next->inst_true_bb);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_false_bb);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK2 (cfg, 
OP_IBGT_UN, next->inst_true_bb, next->inst_false_bb);
                                        next->opcode = OP_NOP;
                                        break;
                                case OP_LBGE_UN:
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGT_UN, next->inst_true_bb);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_false_bb);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK2 (cfg, 
OP_IBGE_UN, next->inst_true_bb, next->inst_false_bb);
                                        next->opcode = OP_NOP;
                                        break;
                                case OP_LBLE_UN:
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBLT_UN, next->inst_true_bb);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, next->inst_false_bb);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK2 (cfg, 
OP_IBLE_UN, next->inst_true_bb, next->inst_false_bb);
                                        next->opcode = OP_NOP;
                                        break;
@@ -4791,10 +4791,10 @@
                                        NEW_BBLOCK (cfg, word_differs);
 
                                        MONO_EMIT_NEW_ICONST (cfg, next->dreg, 
0);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
+                                       MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, word_differs);
                                        MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, word_differs);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
-                                       MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, word_differs);
                                        MONO_EMIT_NEW_ICONST (cfg, next->dreg, 
1);
                                        MONO_START_BB (cfg, word_differs);
                                        next->opcode = OP_NOP;
@@ -4807,10 +4807,10 @@
                                        NEW_BBLOCK (cfg, set_to_1);
 
                                        MONO_EMIT_NEW_ICONST (cfg, next->dreg, 
0);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGT, set_to_0);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, set_to_1);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGE_UN, set_to_0);
                                        MONO_START_BB (cfg, set_to_1);
                                        MONO_EMIT_NEW_ICONST (cfg, next->dreg, 
1);
@@ -4825,10 +4825,10 @@
                                        NEW_BBLOCK (cfg, set_to_1);
 
                                        MONO_EMIT_NEW_ICONST (cfg, next->dreg, 
0);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 2, tree->sreg2 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGT_UN, set_to_0);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, set_to_1);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1, tree->sreg2);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg1 + 1, tree->sreg2 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGE_UN, set_to_0);
                                        MONO_START_BB (cfg, set_to_1);
                                        MONO_EMIT_NEW_ICONST (cfg, next->dreg, 
1);
@@ -4843,10 +4843,10 @@
                                        NEW_BBLOCK (cfg, set_to_1);
 
                                        MONO_EMIT_NEW_ICONST (cfg, next->dreg, 
0);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg2 + 1, tree->sreg1 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg2 + 2, tree->sreg1 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGT, set_to_0);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, set_to_1);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg2, tree->sreg1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg2 + 1, tree->sreg1 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGE_UN, set_to_0);
                                        MONO_START_BB (cfg, set_to_1);
                                        MONO_EMIT_NEW_ICONST (cfg, next->dreg, 
1);
@@ -4861,10 +4861,10 @@
                                        NEW_BBLOCK (cfg, set_to_1);
 
                                        MONO_EMIT_NEW_ICONST (cfg, next->dreg, 
0);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg2 + 1, tree->sreg1 + 1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg2 + 2, tree->sreg1 + 2);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGT_UN, set_to_0);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBNE_UN, set_to_1);
-                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg2, tree->sreg1);
+                                       MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, 
-1, tree->sreg2 + 1, tree->sreg1 + 1);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, 
OP_IBGE_UN, set_to_0);
                                        MONO_START_BB (cfg, set_to_1);
                                        MONO_EMIT_NEW_ICONST (cfg, next->dreg, 
1);
@@ -8840,7 +8840,7 @@
                                         * and some references the two 
component vregs, it is quite hard
                                         * to determine when it needs to be 
global. So be conservative.
                                         */
-                                       if (!get_vreg_to_inst (cfg, 'l', vreg)) 
{
+                                       if (!get_vreg_to_inst (cfg, vreg)) {
                                                
mono_compile_create_var_for_vreg (cfg, &mono_defaults.int64_class->byval_arg, 
OP_LOCAL, 'l', vreg);
 
                                                if (cfg->verbose_level > 1)
@@ -8852,7 +8852,7 @@
                                        if (vreg_to_bb [regtype][vreg] == NULL) 
{
                                                vreg_to_bb [regtype][vreg] = bb;
                                        } else if (vreg_to_bb [regtype][vreg] 
!= bb) {
-                                               if (!get_vreg_to_inst (cfg, 
regtype, vreg)) {
+                                               if (!get_vreg_to_inst (cfg, 
vreg)) {
                                                        if (cfg->verbose_level 
> 1)
                                                                printf ("VREG 
R%d used in BB%d and BB%d made global.\n", vreg, vreg_to_bb 
[regtype][vreg]->block_num, bb->block_num);
 
@@ -8964,13 +8964,13 @@
 
                                g_assert (ins->opcode == OP_REGOFFSET);
 
-                               tree = cfg->vreg_to_inst [ins->dreg];
+                               tree = get_vreg_to_inst (cfg, ins->dreg + 1);
                                g_assert (tree);
                                tree->opcode = OP_REGOFFSET;
                                tree->inst_basereg = ins->inst_basereg;
                                tree->inst_offset = ins->inst_offset;
 
-                               tree = cfg->vreg_to_inst [ins->dreg + 1];
+                               tree = get_vreg_to_inst (cfg, ins->dreg + 2);
                                g_assert (tree);
                                tree->opcode = OP_REGOFFSET;
                                tree->inst_basereg = ins->inst_basereg;
@@ -9056,8 +9056,8 @@
                        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 = get_vreg_to_inst (cfg, regtype, 
ins->dreg);
+                       if ((ins->dreg != -1) && get_vreg_to_inst (cfg, 
ins->dreg)) {
+                               MonoInst *var = get_vreg_to_inst (cfg, 
ins->dreg);
                                MonoInst *store_ins;
                                int store_opcode;
 
@@ -9079,9 +9079,9 @@
                                        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);
+                                               NEW_STORE_MEMBASE (cfg, 
store_ins, OP_STOREI4_MEMBASE_REG, var->inst_basereg, var->inst_offset + 
MINI_LS_WORD_OFFSET, ins->dreg + 1);
                                                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);
+                                               NEW_STORE_MEMBASE (cfg, 
store_ins, OP_STOREI4_MEMBASE_REG, var->inst_basereg, var->inst_offset + 
MINI_MS_WORD_OFFSET, ins->dreg + 2);
                                                insert_after_ins (bb, ins, 
store_ins);
                                        }
                                        else {
@@ -9115,8 +9115,8 @@
                                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 = get_vreg_to_inst (cfg, 
regtype, sreg);
+                               if ((sreg != -1) && get_vreg_to_inst (cfg, 
sreg)) {
+                                       MonoInst *var = get_vreg_to_inst (cfg, 
sreg);
                                        MonoInst *load_ins;
                                        guint32 load_opcode;
 
@@ -9154,9 +9154,9 @@
                                                                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);
+                                                               
NEW_LOAD_MEMBASE (cfg, load_ins, OP_LOADI4_MEMBASE, sreg + 2, 
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);
+                                                               
NEW_LOAD_MEMBASE (cfg, load_ins, OP_LOADI4_MEMBASE, sreg + 1, 
var->inst_basereg, var->inst_offset + MINI_LS_WORD_OFFSET);
                                                                
insert_before_ins (bb, ins, load_ins, &prev);
                                                        }
                                                        else {
@@ -9192,12 +9192,11 @@
  * - unify to_regstore/to_regload as to_regmove
  * - unify iregs/fregs
  *   -> partly done, the missing parts are:
- *   - long vregs on 32 bit platforms, this is hard to fix since the vlreg 
aliases
- *     the first vreg of the regpair, and lots of code depends on that.
  *   - a more complete unification would involve unifying the hregs as well, so
  *     code wouldn't need if (fp) all over the place. but that would mean the 
hregs
  *     would no longer map to the machine hregs, so the code generators would 
need to
- *     be modified.
+ *     be modified. Also, on ia64 for example, niregs + nfregs > 256 -> 
bitmasks
+ *     wouldn't work any more.
  * - use sext/zext opcodes instead of shifts
  * - make mono_print_ins use the arch-independent opcode metadata
  * - simplify the emitting of calls

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c        
2006-02-19 18:12:00 UTC (rev 57053)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c        
2006-02-19 18:12:49 UTC (rev 57054)
@@ -955,11 +955,6 @@
        if (use_fpstack)
                rs->ffree_mask = 0xff & ~(regmask (MONO_ARCH_FPSTACK_SIZE));
 
-       /* 
-        * For large methods, next_vireg can be very large, so g_malloc0 time 
can
-        * be prohibitive. So we manually init the reginfo entries used by the 
-        * bblock.
-        */
        max = rs->next_vireg;
        ins_count = 0;
 
@@ -981,26 +976,51 @@
                memset (cfg->reginfo, 0, cfg->reginfo_len * sizeof (RegTrack));
        }
 
+       /* 
+        * For large methods, next_vireg can be very large, so g_malloc0 time 
can
+        * be prohibitive. So we manually init the reginfo entries used by the 
+        * bblock.
+        */
        for (ins = bb->code; ins; ins = ins->next) {
                spec = ins_spec [ins->opcode];
 
                ins_count ++;
 
-               if ((ins->dreg != -1) && (ins->dreg < max))
+               if ((ins->dreg != -1) && (ins->dreg < max)) {
                        memset (&reginfo [ins->dreg], 0, sizeof (RegTrack));
-               if ((ins->sreg1 != -1) && (ins->sreg1 < max))
+#if SIZEOF_VOID_P == 4
+                       if (MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_DEST])) {
+                               /**
+                                * In the new IR, the two vregs of the regpair 
do not alias the
+                                * original long vreg. shift the vreg here so 
the rest of the 
+                                * allocator doesn't have to care about it.
+                                */
+                               if (cfg->new_ir)
+                                       ins->dreg ++;
+                               memset (&reginfo [ins->dreg + 1], 0, sizeof 
(RegTrack));
+                       }
+#endif
+               }
+               if ((ins->sreg1 != -1) && (ins->sreg1 < max)) {
                        memset (&reginfo [ins->sreg1], 0, sizeof (RegTrack));
-               if ((ins->sreg2 != -1) && (ins->sreg2 < max))
+#if SIZEOF_VOID_P == 4
+                       if (MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_SRC1])) {
+                               if (cfg->new_ir)
+                                       ins->sreg1 ++;
+                               memset (&reginfo [ins->sreg1 + 1], 0, sizeof 
(RegTrack));
+                       }
+#endif
+               }
+               if ((ins->sreg2 != -1) && (ins->sreg2 < max)) {
                        memset (&reginfo [ins->sreg2], 0, sizeof (RegTrack));
 #if SIZEOF_VOID_P == 4
-               /* Regpairs */
-               if ((MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_DEST])) && 
(ins->dreg != -1) && (ins->dreg + 1 < max))
-                       memset (&reginfo [ins->dreg + 1], 0, sizeof (RegTrack));
-               if ((MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_SRC1])) && 
(ins->sreg1 != -1) && (ins->sreg1 + 1 < max))
-                       memset (&reginfo [ins->sreg1 + 1], 0, sizeof 
(RegTrack));
-               if ((MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_SRC2])) && 
(ins->sreg2 != -1) && (ins->sreg2 + 1 < max))
-                       memset (&reginfo [ins->sreg2 + 1], 0, sizeof 
(RegTrack));
+                       if (MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_SRC2])) {
+                               if (cfg->new_ir)
+                                       ins->sreg2 ++;
+                               memset (&reginfo [ins->sreg2 + 1], 0, sizeof 
(RegTrack));
+                       }
 #endif
+               }
        }
 
        /* Initialized on demand */

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c    2006-02-19 
18:12:00 UTC (rev 57053)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c    2006-02-19 
18:12:49 UTC (rev 57054)
@@ -1033,7 +1033,7 @@
                        t = &mono_defaults.int_class->byval_arg;
                t = mono_type_get_underlying_type (t);
 
-               MONO_INST_NEW (cfg, arg, OP_OUTARG);
+               MONO_INST_NEW (cfg, arg, OP_X86_PUSH);
 
                in = call->args [i];
                arg->cil_code = in->cil_code;
@@ -1093,7 +1093,8 @@
                                                arg->inst_destbasereg = X86_ESP;
                                                arg->inst_offset = 0;
                                        } else if (t->type == MONO_TYPE_I8 || 
t->type == MONO_TYPE_U8) {
-                                               MONO_EMIT_NEW_UNALU (cfg, 
OP_X86_PUSH, -1, in->dreg + 1);
+                                               arg->sreg1 ++;
+                                               MONO_EMIT_NEW_UNALU (cfg, 
OP_X86_PUSH, -1, in->dreg + 2);
                                        }
                                }
                                break;
@@ -1206,8 +1207,9 @@
                        /* Nothing to do */
                        return;
                } else if (ret->type == MONO_TYPE_I8 || ret->type == 
MONO_TYPE_U8) {
-                       MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, X86_EAX, val->dreg);
-                       MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, X86_EDX, val->dreg + 
1);
+                       MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, X86_EAX, val->dreg + 
1);
+                       MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, X86_EDX, val->dreg + 
2);
+                       return;
                }
        }
                        

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini.c        2006-02-19 
18:12:00 UTC (rev 57053)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.c        2006-02-19 
18:12:49 UTC (rev 57054)
@@ -1667,32 +1667,19 @@
 }
 
 static void
-set_vreg_to_inst (MonoCompile *cfg, int regtype, int vreg, MonoInst *inst)
+set_vreg_to_inst (MonoCompile *cfg, int vreg, MonoInst *inst)
 {
-       if (regtype == 'l') {
-               MonoInst **tmp = cfg->vreg_to_inst_l;
-               int size = cfg->vreg_to_inst_l_len;
-               
-               while (vreg >= cfg->vreg_to_inst_l_len) {
-                       cfg->vreg_to_inst_l_len = cfg->vreg_to_inst_l_len ? 
cfg->vreg_to_inst_l_len * 2 : 16;
-                       cfg->vreg_to_inst_l = g_malloc0 (sizeof (MonoInst*) * 
cfg->vreg_to_inst_l_len);
-                       if (size)
-                               memcpy (cfg->vreg_to_inst_l, tmp, size * sizeof 
(MonoInst*));
-               }
-               cfg->vreg_to_inst_l [vreg] = inst;
-       } else {
-               if (vreg >= cfg->vreg_to_inst_len) {
-                       MonoInst **tmp = cfg->vreg_to_inst;
-                       int size = cfg->vreg_to_inst_len;
+       if (vreg >= cfg->vreg_to_inst_len) {
+               MonoInst **tmp = cfg->vreg_to_inst;
+               int size = cfg->vreg_to_inst_len;
 
-                       while (vreg >= cfg->vreg_to_inst_len)
-                               cfg->vreg_to_inst_len = cfg->vreg_to_inst_len ? 
cfg->vreg_to_inst_len * 2 : 16;
-                       cfg->vreg_to_inst = g_malloc0 (sizeof (MonoInst*) * 
cfg->vreg_to_inst_len);
-                       if (size)
-                               memcpy (cfg->vreg_to_inst, tmp, size * sizeof 
(MonoInst*));
-               }
-               cfg->vreg_to_inst [vreg] = inst;
+               while (vreg >= cfg->vreg_to_inst_len)
+                       cfg->vreg_to_inst_len = cfg->vreg_to_inst_len ? 
cfg->vreg_to_inst_len * 2 : 16;
+               cfg->vreg_to_inst = g_malloc0 (sizeof (MonoInst*) * 
cfg->vreg_to_inst_len);
+               if (size)
+                       memcpy (cfg->vreg_to_inst, tmp, size * sizeof 
(MonoInst*));
        }
+       cfg->vreg_to_inst [vreg] = inst;
 }
 
 static inline int
@@ -1747,7 +1734,7 @@
        MONO_INIT_VARINFO (cfg->vars [num], num);
 
        if (vreg != -1)
-               set_vreg_to_inst (cfg, regtype, vreg, inst);
+               set_vreg_to_inst (cfg, vreg, inst);
 
        if (regtype == 'l') {
                MonoInst *tree;
@@ -1760,23 +1747,23 @@
 
                /* Allocate a dummy MonoInst for the first vreg */
                MONO_INST_NEW (cfg, tree, OP_LOCAL);
-               tree->dreg = inst->dreg;
+               tree->dreg = inst->dreg + 1;
                tree->inst_c0 = num;
                tree->type = STACK_I4;
                tree->inst_vtype = &mono_defaults.int32_class->byval_arg;
                tree->klass = mono_class_from_mono_type (tree->inst_vtype);
 
-               set_vreg_to_inst (cfg, 'i', inst->dreg, tree);
+               set_vreg_to_inst (cfg, inst->dreg + 1, tree);
 
                /* Allocate a dummy MonoInst for the second vreg */
                MONO_INST_NEW (cfg, tree, OP_LOCAL);
-               tree->dreg = inst->dreg + 1;
+               tree->dreg = inst->dreg + 2;
                tree->inst_c0 = num;
                tree->type = STACK_I4;
                tree->inst_vtype = &mono_defaults.int32_class->byval_arg;
                tree->klass = mono_class_from_mono_type (tree->inst_vtype);
 
-               set_vreg_to_inst (cfg, 'i', inst->dreg + 1, tree);
+               set_vreg_to_inst (cfg, inst->dreg + 2, tree);
        }
 
        cfg->num_varinfo++;
@@ -9835,7 +9822,7 @@
                for (ins = bb->code; ins; ins = ins->next) {
                        const char *spec = ins_info [ins->opcode - OP_START - 
1];
 
-                       if ((spec [MONO_INST_DEST] == 'i') && (ins->dreg >= 
MONO_MAX_IREGS) && !mono_bitset_test_fast (used, ins->dreg) && 
!get_vreg_to_inst (cfg, 'i', ins->dreg)) {
+                       if ((spec [MONO_INST_DEST] == 'i') && (ins->dreg >= 
MONO_MAX_IREGS) && !mono_bitset_test_fast (used, ins->dreg) && 
!get_vreg_to_inst (cfg, ins->dreg)) {
                                /* FIXME: Add more instructions */
                                /* OP_ADD_IMM is generated by spill_global_vars 
*/
                                if ((ins->opcode == OP_MOVE) || (ins->opcode == 
OP_ICONST) || (ins->opcode == OP_I8CONST) || (ins->opcode == OP_ADD_IMM)) {
@@ -9936,7 +9923,7 @@
                                        return;
                        }
 
-                       if ((ins->opcode == OP_MOVE) && get_vreg_to_inst (cfg, 
'i', ins->dreg)) {
+                       if ((ins->opcode == OP_MOVE) && get_vreg_to_inst (cfg, 
ins->dreg)) {
                                if (ins_index + 1 < nins) {
                                        MonoInst *def = reverse [ins_index + 1];
                                        const char *spec2 = ins_info 
[ins->opcode - OP_START - 1];
@@ -9945,7 +9932,7 @@
                                         * Perform a limited kind of reverse 
copy propagation, i.e.
                                         * transform B <- FOO; A <- B into A <- 
FOO
                                         */
-                                       if (!get_vreg_to_inst (cfg, 'i', 
ins->sreg1) && (spec2 [MONO_INST_DEST] == 'i') && (def->dreg == ins->sreg1) && 
!mono_bitset_test_fast (used, ins->sreg1) && !MONO_IS_STORE_MEMBASE (def)) {
+                                       if (!get_vreg_to_inst (cfg, ins->sreg1) 
&& (spec2 [MONO_INST_DEST] == 'i') && (def->dreg == ins->sreg1) && 
!mono_bitset_test_fast (used, ins->sreg1) && !MONO_IS_STORE_MEMBASE (def)) {
                                                if (cfg->verbose_level > 2) {
                                                        printf ("\tReverse 
copyprop in BB%d on ", bb->block_num);
                                                        mono_print_ins (ins);
@@ -9960,7 +9947,7 @@
                        }
 
                        if ((spec [MONO_INST_DEST] == 'i') && (ins->dreg >= 
MONO_MAX_IREGS)) {
-                               if (!mono_bitset_test_fast (used, ins->dreg) && 
!get_vreg_to_inst (cfg, 'i', ins->dreg)) {
+                               if (!mono_bitset_test_fast (used, ins->dreg) && 
!get_vreg_to_inst (cfg, ins->dreg)) {
                                        /* FIXME: Add more instructions */
                                        /* OP_ADD_IMM is generated by 
spill_global_vars */
                                        if ((ins->opcode == OP_MOVE) || 
(ins->opcode == OP_ICONST) || (ins->opcode == OP_I8CONST) || (ins->opcode == 
OP_ADD_IMM)) {

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.h
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini.h        2006-02-19 
18:12:00 UTC (rev 57053)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.h        2006-02-19 
18:12:49 UTC (rev 57054)
@@ -536,19 +536,8 @@
 
 #define MONO_BBLOCK_IS_IN_REGION(bblock, regtype) (((bblock)->region & (0xf << 
4)) == (regtype))
 
-#define get_vreg_to_inst_i(cfg, vreg) ((vreg) < (cfg)->vreg_to_inst_len ? 
(cfg)->vreg_to_inst [vreg] : NULL)
-#define get_vreg_to_inst_l(cfg, vreg) ((vreg) < (cfg)->vreg_to_inst_l_len ? 
(cfg)->vreg_to_inst_l [vreg] : NULL)
+#define get_vreg_to_inst(cfg, vreg) ((vreg) < (cfg)->vreg_to_inst_len ? 
(cfg)->vreg_to_inst [vreg] : NULL)
 
-#if SIZEOF_VOID_P == 8
-#define get_vreg_to_inst(cfg, regtype, vreg) get_vreg_to_inst_i ((cfg), (vreg))
-#else
-/* 
- * We would like to handle lvregs uniformly as well, but can't since they are 
aliased
- * with ivreg pairs.
- */
-#define get_vreg_to_inst(cfg, regtype, vreg) (((regtype) != 'l') ? 
get_vreg_to_inst_i (cfg, vreg) : get_vreg_to_inst_l (cfg, vreg))
-#endif
-
 /*
  * Control Flow Graph and compilation unit information
  */
@@ -647,11 +636,9 @@
        /* Maps vregs to their associated MonoInst's */
        /* vregs with an associated MonoInst are 'global' while others are 
'local' */
        MonoInst **vreg_to_inst;
-       MonoInst **vreg_to_inst_l;
 
        /* Size of above array */
        guint32 vreg_to_inst_len;
-       guint32 vreg_to_inst_l_len;
 } MonoCompile;
 
 typedef enum {

Modified: branches/vargaz/mini-linear-il/mono/mono/mini/ssa.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/ssa.c 2006-02-19 18:12:00 UTC 
(rev 57053)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/ssa.c 2006-02-19 18:12:49 UTC 
(rev 57054)
@@ -217,7 +217,7 @@
                if (ins->opcode != OP_PHI) {
                        /* SREG1 */
                        if (spec [MONO_INST_SRC1] == 'i') {
-                               MonoInst *var = get_vreg_to_inst (cfg, 'i', 
ins->sreg1);
+                               MonoInst *var = get_vreg_to_inst (cfg, 
ins->sreg1);
                                if (var) {
                                        int idx = var->inst_c0;
                                        if (stack [idx]) {
@@ -230,7 +230,7 @@
 
                        /* SREG2 */
                        if (spec [MONO_INST_SRC2] == 'i') {
-                               MonoInst *var = get_vreg_to_inst (cfg, 'i', 
ins->sreg2);
+                               MonoInst *var = get_vreg_to_inst (cfg, 
ins->sreg2);
                                if (var) {
                                        int idx = var->inst_c0;
                                        if (stack [idx]) {
@@ -244,8 +244,8 @@
                }
 
                /* DREG */
-               if ((spec [MONO_INST_DEST] == 'i') && get_vreg_to_inst (cfg, 
'i', ins->dreg)) {
-                       MonoInst *var = get_vreg_to_inst (cfg, 'i', ins->dreg);
+               if ((spec [MONO_INST_DEST] == 'i') && get_vreg_to_inst (cfg, 
ins->dreg)) {
+                       MonoInst *var = get_vreg_to_inst (cfg, ins->dreg);
                        idx = var->inst_c0;
                        g_assert (idx < max_vars);
 
@@ -410,8 +410,8 @@
 
                                /* FIXME: Handle OP_LDADDR */
                                /* FIXME: Handle non-ints as well */
-                               if ((spec [MONO_INST_DEST] == 'i') && 
get_vreg_to_inst (cfg, 'i', ins->dreg)) {
-                                       mono_bitset_set (vinfo 
[get_vreg_to_inst (cfg, 'i', ins->dreg)->inst_c0].def_in, i);
+                               if ((spec [MONO_INST_DEST] == 'i') && 
get_vreg_to_inst (cfg, ins->dreg)) {
+                                       mono_bitset_set (vinfo 
[get_vreg_to_inst (cfg, ins->dreg)->inst_c0].def_in, i);
                                }
                        }
                }

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

Reply via email to