Author: zoltan
Date: 2006-01-19 13:46:34 -0500 (Thu, 19 Jan 2006)
New Revision: 55797
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-ops.h
branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
branches/vargaz/mini-linear-il/mono/mono/mini/mini.h
Log:
Ongoing work
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-19
18:29:12 UTC (rev 55796)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/linear-scan.c 2006-01-19
18:46:34 UTC (rev 55797)
@@ -210,15 +210,20 @@
/*
* This variables is only used in a single
basic block so
* convert it into a virtual register.
- * FIXME: This increases register pressure in
the local
- * allocator, leading to the well known
'branches inside
- * basic blocks screw up the allocator' problem.
*/
-#if 0
- //#ifdef MONO_ARCH_HAS_XP_LOCAL_REGALLOC
- cfg->varinfo [vmv->idx]->opcode = OP_REGVAR;
- cfg->varinfo [vmv->idx]->dreg =
mono_regstate_next_int (cfg->rs);
-#endif
+ if (cfg->new_ir) {
+ MonoInst *var = cfg->varinfo [vmv->idx];
+
+ /* FIXME: Do this more elegantly */
+ switch (var->type) {
+ case STACK_I4:
+ case STACK_OBJ:
+ case STACK_PTR:
+ case STACK_MP:
+ cfg->vreg_to_inst
['i'][var->dreg] = NULL;
+ break;
+ }
+ }
}
else {
if (cfg->verbose_level > 2)
Modified: branches/vargaz/mini-linear-il/mono/mono/mini/liveness.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/liveness.c 2006-01-19
18:29:12 UTC (rev 55796)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/liveness.c 2006-01-19
18:46:34 UTC (rev 55797)
@@ -76,33 +76,12 @@
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:
+ if (MONO_IS_STORE_MEMBASE (ins))
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:
+ else if (MONO_IS_STORE_MEMINDEX (ins))
g_assert_not_reached ();
- default:
+ else
store = FALSE;
- }
/* SREGS */
/* These must come first, so MOVE r <- r is handled correctly */
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-19 18:29:12 UTC (rev 55796)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c
2006-01-19 18:46:34 UTC (rev 55797)
@@ -8719,6 +8719,11 @@
case OP_LSHR_UN:
return OP_LSHR_UN_IMM;
+ case OP_COMPARE:
+ return OP_COMPARE_IMM;
+ case OP_ICOMPARE:
+ return OP_ICOMPARE_IMM;
+
case OP_STORE_MEMBASE_REG:
return OP_STORE_MEMBASE_IMM;
case OP_STOREI1_MEMBASE_REG:
@@ -9030,20 +9035,7 @@
* src register.
* FIXME:
*/
- 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:
+ if (MONO_IS_STORE_MEMBASE (ins)) {
tmp_reg = ins->dreg;
ins->dreg = ins->sreg2;
ins->sreg2 = tmp_reg;
@@ -9053,18 +9045,10 @@
spec2 [MONO_INST_SRC1] = spec [MONO_INST_SRC1];
spec2 [MONO_INST_SRC2] = spec [MONO_INST_DEST];
spec = spec2;
- 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:
+ } else if (MONO_IS_STORE_MEMINDEX (ins))
NOT_IMPLEMENTED;
- default:
+ else
store = FALSE;
- }
if (cfg->verbose_level > 0)
printf ("\t %s %d %d %d\n", spec, ins->dreg,
ins->sreg1, ins->sreg2);
@@ -9139,7 +9123,7 @@
load_opcode =
mono_type_to_load_membase (var->inst_vtype);
/* FIXME: Generalize this */
- if ((ins->opcode ==
OP_X86_PUSH) && ((load_opcode == OP_LOADI4_MEMBASE) || (load_opcode ==
OP_LOADU4_MEMBASE))) {
+ if ((ins->opcode ==
OP_X86_PUSH) && ((load_opcode == OP_LOADI4_MEMBASE) || (load_opcode ==
OP_LOADU4_MEMBASE) || (load_opcode == OP_LOAD_MEMBASE))) {
ins->opcode =
OP_X86_PUSH_MEMBASE;
ins->inst_basereg =
var->inst_basereg;
ins->inst_offset =
var->inst_offset;
Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h 2006-01-19
18:29:12 UTC (rev 55796)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h 2006-01-19
18:46:34 UTC (rev 55797)
@@ -73,6 +73,7 @@
MINI_OP(OP_REFANYTYPE, "refanytype", NONE, NONE, NONE)
MINI_OP(OP_NEWOBJ, "op_newobj", NONE, NONE, NONE)
+/* MONO_IS_STORE_MEMBASE depends on the order here */
MINI_OP(OP_STORE_MEMBASE_REG,"store_membase_reg", IREG, IREG, NONE)
MINI_OP(OP_STOREI1_MEMBASE_REG, "storei1_membase_reg", IREG, IREG, NONE)
MINI_OP(OP_STOREI2_MEMBASE_REG, "storei2_membase_reg", IREG, IREG, NONE)
@@ -87,6 +88,7 @@
MINI_OP(OP_STOREI4_MEMBASE_IMM, "storei4_membase_imm", IREG, NONE, NONE)
MINI_OP(OP_STOREI8_MEMBASE_IMM, "storei8_membase_imm", IREG, NONE, NONE)
+/* MONO_IS_LOAD_MEMBASE depends on the order here */
MINI_OP(OP_LOAD_MEMBASE, "load_membase", IREG, IREG, NONE)
MINI_OP(OP_LOADI1_MEMBASE,"loadi1_membase", IREG, IREG, NONE)
MINI_OP(OP_LOADU1_MEMBASE,"loadu1_membase", IREG, IREG, NONE)
@@ -109,6 +111,7 @@
MINI_OP(OP_LOADR4_MEMINDEX,"loadr4_memindex", NONE, NONE, NONE)
MINI_OP(OP_LOADR8_MEMINDEX,"loadr8_memindex", NONE, NONE, NONE)
/* indexed stores: store sreg1 at (destbasereg + sreg2) */
+/* MONO_IS_STORE_MEMINDEX depends on the order here */
MINI_OP(OP_STORE_MEMINDEX,"store_memindex", NONE, NONE, NONE)
MINI_OP(OP_STOREI1_MEMINDEX,"storei1_memindex", NONE, NONE, NONE)
MINI_OP(OP_STOREI2_MEMINDEX,"storei2_memindex", NONE, NONE, NONE)
Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini.c 2006-01-19
18:29:12 UTC (rev 55796)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.c 2006-01-19
18:46:34 UTC (rev 55797)
@@ -9386,6 +9386,11 @@
srcindex = -1;
continue;
}
+ } else if ((def->opcode == OP_ADD_IMM) &&
(def->sreg1 == cfg->frame_reg) && MONO_IS_LOAD_MEMBASE (ins)) {
+ /* ADD_IM is created by
spill_global_vars */
+ /* cfg->frame_reg is assumed to remain
constant */
+ ins->inst_basereg = def->sreg1;
+ ins->inst_offset += def->inst_imm;
}
}
}
@@ -9393,26 +9398,12 @@
if (spec [MONO_INST_DEST] == 'i') {
MonoInst *def = defs [ins->dreg];
- if (def && (def->opcode == OP_ADD_IMM) && (def->sreg1
== cfg->frame_reg)) {
+ /* FIXME: Generalize this */
+ if (def && (def->opcode == OP_ADD_IMM) && (def->sreg1
== cfg->frame_reg) && (MONO_IS_STORE_MEMBASE (ins))) {
/* ADD_IMM is created by spill_global_vars */
- /* FIXME: Generalize this */
- switch (ins->opcode) {
- case OP_STORE_MEMBASE_REG:
- case OP_STOREI1_MEMBASE_REG:
- case OP_STOREI2_MEMBASE_REG:
- case OP_STOREI4_MEMBASE_REG:
- case OP_STOREI8_MEMBASE_REG:
- case OP_STORER4_MEMBASE_REG:
- case OP_STORER8_MEMBASE_REG:
- case OP_STORE_MEMBASE_IMM:
- case OP_STOREI1_MEMBASE_IMM:
- case OP_STOREI2_MEMBASE_IMM:
- case OP_STOREI4_MEMBASE_IMM:
- case OP_STOREI8_MEMBASE_IMM:
- ins->inst_destbasereg = def->sreg1;
- ins->inst_offset += def->inst_imm;
- break;
- }
+ /* cfg->frame_reg is assumed to remain constant
*/
+ ins->inst_destbasereg = def->sreg1;
+ ins->inst_offset += def->inst_imm;
}
}
@@ -9472,7 +9463,6 @@
return;
}
- /* FIXME: Store opcodes */
for (srcindex = 0; srcindex < 2; ++srcindex) {
regtype = spec [(srcindex == 0) ?
MONO_INST_SRC1 : MONO_INST_SRC2];
sreg = srcindex == 0 ? ins->sreg1 : ins->sreg2;
@@ -9480,22 +9470,8 @@
if (regtype == 'i')
used [sreg] = TRUE;
- 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:
+ if (MONO_IS_STORE_MEMBASE (ins))
used [ins->dreg] = TRUE;
- }
}
}
@@ -9886,7 +9862,7 @@
if (cfg->new_ir) {
/* This must be done _before_ global reg alloc and _after_
decompose */
mono_handle_global_vregs (cfg);
- //mono_local_deadce (cfg);
+ mono_local_deadce (cfg);
}
if (cfg->opt & MONO_OPT_LINEARS) {
Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.h
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini.h 2006-01-19
18:29:12 UTC (rev 55796)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.h 2006-01-19
18:46:34 UTC (rev 55797)
@@ -100,6 +100,10 @@
} \
} while (0)
+#define MONO_IS_LOAD_MEMBASE(ins) (((ins)->opcode >= OP_LOAD_MEMBASE) &&
((ins)->opcode <= OP_LOADR8_MEMBASE))
+#define MONO_IS_STORE_MEMBASE(ins) (((ins)->opcode >= OP_STORE_MEMBASE_REG) &&
((ins)->opcode <= OP_STOREI8_MEMBASE_IMM))
+#define MONO_IS_STORE_MEMINDEX(ins) (((ins)->opcode >= OP_STORE_MEMINDEX) &&
((ins)->opcode <= OP_STORER8_MEMINDEX))
+
typedef struct MonoInst MonoInst;
typedef struct MonoCallInst MonoCallInst;
typedef struct MonoCallArgParm MonoCallArgParm;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches