Author: zoltan
Date: 2008-01-24 10:59:58 -0500 (Thu, 24 Jan 2008)
New Revision: 93808
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/abcremoval.c
trunk/mono/mono/mini/aliasing.c
trunk/mono/mono/mini/cfold.c
trunk/mono/mono/mini/graph.c
trunk/mono/mono/mini/liveness.c
trunk/mono/mono/mini/local-propagation.c
trunk/mono/mono/mini/mini-alpha.c
trunk/mono/mono/mini/mini-amd64.c
trunk/mono/mono/mini/mini-arm.c
trunk/mono/mono/mini/mini-codegen.c
trunk/mono/mono/mini/mini-hppa.c
trunk/mono/mono/mini/mini-ia64.c
trunk/mono/mono/mini/mini-mips.c
trunk/mono/mono/mini/mini-ppc.c
trunk/mono/mono/mini/mini-s390.c
trunk/mono/mono/mini/mini-s390x.c
trunk/mono/mono/mini/mini-sparc.c
trunk/mono/mono/mini/mini-x86.c
trunk/mono/mono/mini/mini.c
trunk/mono/mono/mini/mini.h
trunk/mono/mono/mini/ssa.c
trunk/mono/mono/mini/ssapre.c
Log:
2008-01-24 Zoltan Varga <[EMAIL PROTECTED]>
* mini.h (MONO_IS_COND_BRANCH_OP): Move these macros here from mini.c.
Fix
some typos.
(NOT_IMPLEMENTED): New helper macro.
(MONO_BB_FOR_EACH_INS): New helper macro to iterate through the
instructions
of a bb.
* *.c: Use the new helper macro.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/ChangeLog 2008-01-24 15:59:58 UTC (rev 93808)
@@ -1,3 +1,13 @@
+2008-01-24 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * mini.h (MONO_IS_COND_BRANCH_OP): Move these macros here from mini.c.
Fix
+ some typos.
+ (NOT_IMPLEMENTED): New helper macro.
+ (MONO_BB_FOR_EACH_INS): New helper macro to iterate through the
instructions
+ of a bb.
+
+ * *.c: Use the new helper macro.
+
2008-01-21 Zoltan Varga <[EMAIL PROTECTED]>
* mini-x86.h (MONO_ARCH_AOT_SUPPORTED): Disable AOT for apple x86.
Modified: trunk/mono/mono/mini/abcremoval.c
===================================================================
--- trunk/mono/mono/mini/abcremoval.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/abcremoval.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -1268,7 +1268,7 @@
apply_change_to_evaluation_area (area,
&(additional_relations.relation2));
inst_index = 0;
- MONO_INST_LIST_FOR_EACH_ENTRY (current_inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, current_inst) {
if (TRACE_ABC_REMOVAL) {
printf ("Processing instruction %d\n", inst_index);
inst_index++;
Modified: trunk/mono/mono/mini/aliasing.c
===================================================================
--- trunk/mono/mono/mini/aliasing.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/aliasing.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -315,7 +315,7 @@
printf ("CODE FOR BB %d\n", bb_info->bb->block_num);
mono_aliasing_initialize_code_traversal (info, bb_info->bb);
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb_info->bb->ins_list,
node) {
+ MONO_BB_FOR_EACH_INS (bb_info->bb, inst) {
print_tree_with_aliasing_information (info, inst);
printf ("\n");
}
@@ -734,7 +734,7 @@
bb_info->potential_alias_uses = NULL;
info->next_interesting_inst = NULL;
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
if (FOLLOW_ALIAS_ANALYSIS) {
printf ("TRAVERSING INST: ");
mono_print_tree_nl (inst);
@@ -1006,7 +1006,7 @@
printf ("Working on BB %d\n", bb->block_num);
}
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
mono_aliasing_deadce_on_inst (info,
possibly_dead_assignments, inst);
if (inst->opcode == OP_JMP) {
/* Keep arguments live! */
Modified: trunk/mono/mono/mini/cfold.c
===================================================================
--- trunk/mono/mono/mini/cfold.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/cfold.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -249,7 +249,7 @@
for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
MonoInst *ins;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (bb, ins)
mono_inst_foreach (ins, mono_constant_fold_inst, NULL);
}
}
Modified: trunk/mono/mono/mini/graph.c
===================================================================
--- trunk/mono/mono/mini/graph.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/graph.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -290,7 +290,7 @@
fprintf (fp, "BB%d [%sshape=record,labeljust=l,label=\"{BB%d|",
bb->block_num, color, bb->block_num);
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
mono_print_label (fp, inst);
fprintf (fp, "\\n");
}
Modified: trunk/mono/mono/mini/liveness.c
===================================================================
--- trunk/mono/mono/mini/liveness.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/liveness.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -198,7 +198,7 @@
mono_aliasing_initialize_code_traversal (cfg->aliasing_info,
bb);
tree_num = 0;
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
update_volatile (cfg, bb, inst, tree_num);
tree_num++;
}
@@ -294,7 +294,7 @@
mono_aliasing_initialize_code_traversal
(cfg->aliasing_info, bb);
tree_num = 0;
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
#ifdef DEBUG_LIVENESS
mono_print_tree (inst); printf ("\n");
#endif
@@ -531,10 +531,10 @@
mono_bitset_clear_all (used);
initlocals_bb = cfg->bb_entry->next_bb;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &initlocals_bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (initlocals_bb, ins)
update_used (cfg, ins, used);
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &initlocals_bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (initlocals_bb, ins) {
if (ins->ssa_op == MONO_SSA_STORE) {
int idx = ins->inst_i0->inst_c0;
MonoInst *var = cfg->varinfo [idx];
Modified: trunk/mono/mono/mini/local-propagation.c
===================================================================
--- trunk/mono/mono/mini/local-propagation.c 2008-01-24 15:49:06 UTC (rev
93807)
+++ trunk/mono/mono/mini/local-propagation.c 2008-01-24 15:59:58 UTC (rev
93808)
@@ -814,7 +814,7 @@
printf ("Running tree mover on BB%d\n", bb->block_num);
}
}
- MONO_INST_LIST_FOR_EACH_ENTRY (tree, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, tree) {
if (tree_mover != NULL) {
if (MONO_DEBUG_TREE_MOVER) {
printf ("Running tree mover on tree ");
Modified: trunk/mono/mono/mini/mini-alpha.c
===================================================================
--- trunk/mono/mono/mini/mini-alpha.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-alpha.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -2210,7 +2210,7 @@
mono_debug_open_block (cfg, bb, offset);
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
offset = ((char *)code) - ((char *)cfg->native_code);
max_len = ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
Modified: trunk/mono/mono/mini/mini-amd64.c
===================================================================
--- trunk/mono/mono/mini/mini-amd64.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-amd64.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -2551,7 +2551,7 @@
mono_debug_open_block (cfg, bb, offset);
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
offset = code - cfg->native_code;
max_len = ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
@@ -4507,7 +4507,7 @@
if ((cfg->opt & MONO_OPT_LOOP) && bb_is_loop_start (bb))
max_offset += LOOP_ALIGNMENT;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list,
node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
if (ins->opcode == OP_LABEL)
ins->inst_c1 = max_offset;
Modified: trunk/mono/mono/mini/mini-arm.c
===================================================================
--- trunk/mono/mono/mini/mini-arm.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-arm.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -1527,7 +1527,7 @@
if (bb->max_vreg > cfg->rs->next_vreg)
cfg->rs->next_vreg = bb->max_vreg;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
MonoInst *last_ins;
loop_start:
@@ -2037,7 +2037,7 @@
//x86_inc_mem (code, &cov->data [bb->dfn].count);
}
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
offset = code - cfg->native_code;
max_len = ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
@@ -3241,7 +3241,7 @@
if (cfg->prof_options & MONO_PROFILE_COVERAGE)
max_offset += 6;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (bb, ins) {
max_offset += ((guint8 *)ins_get_spec
(ins->opcode))[MONO_INST_LEN];
}
Modified: trunk/mono/mono/mini/mini-codegen.c
===================================================================
--- trunk/mono/mono/mini/mini-codegen.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-codegen.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -777,7 +777,7 @@
fpcount = 0;
DEBUG (printf ("\nLOCAL REGALLOC: BASIC BLOCK: %d\n", bb->block_num));
/* forward pass on the instructions to collect register liveness info */
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
spec = ins_get_spec (ins->opcode);
if (G_UNLIKELY (spec == MONO_ARCH_CPU_SPEC)) {
Modified: trunk/mono/mono/mini/mini-hppa.c
===================================================================
--- trunk/mono/mono/mini/mini-hppa.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-hppa.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -859,7 +859,7 @@
if (bb->max_vreg > cfg->rs->next_vreg)
cfg->rs->next_vreg = bb->max_vreg;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
loop_start:
switch (ins->opcode) {
case OP_ADD_IMM:
@@ -1244,7 +1244,7 @@
NOT_IMPLEMENTED;
}
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
guint8* code_start;
offset = (guint8*)code - cfg->native_code;
@@ -2303,7 +2303,7 @@
if (cfg->prof_options & MONO_PROFILE_COVERAGE)
max_offset += 6;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (bb, ins) {
max_offset += ((guint8 *)ins_get_spec
(ins->opcode))[MONO_INST_LEN];
}
Modified: trunk/mono/mono/mini/mini-ia64.c
===================================================================
--- trunk/mono/mono/mini/mini-ia64.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-ia64.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -2101,7 +2101,7 @@
break_count ();
#endif
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
offset = code.buf - cfg->native_code;
max_len = ((int)(((guint8 *)ins_get_spec
(ins->opcode))[MONO_INST_LEN])) + 128;
Modified: trunk/mono/mono/mini/mini-mips.c
===================================================================
--- trunk/mono/mono/mini/mini-mips.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-mips.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -1491,7 +1491,7 @@
if (bb->max_vreg > cfg->rs->next_vreg)
cfg->rs->next_vreg = bb->max_vreg;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
loop_start:
switch (ins->opcode) {
case OP_ADD_IMM:
@@ -1715,7 +1715,7 @@
mips_sw (code, mips_temp, mips_at, 0);
}
#endif
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
offset = code - cfg->native_code;
max_len = ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
Modified: trunk/mono/mono/mini/mini-ppc.c
===================================================================
--- trunk/mono/mono/mini/mini-ppc.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-ppc.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -1693,7 +1693,7 @@
if (bb->max_vreg > cfg->rs->next_vreg)
cfg->rs->next_vreg = bb->max_vreg;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
loop_start:
switch (ins->opcode) {
case OP_ADD_IMM:
@@ -2131,7 +2131,7 @@
//x86_inc_mem (code, &cov->data [bb->dfn].count);
}
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
offset = code - cfg->native_code;
max_len = ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
@@ -3246,7 +3246,7 @@
if (cfg->prof_options & MONO_PROFILE_COVERAGE)
max_offset += 6;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (bb, ins) {
max_offset += ((guint8 *)ins_get_spec
(ins->opcode))[MONO_INST_LEN];
}
Modified: trunk/mono/mono/mini/mini-s390.c
===================================================================
--- trunk/mono/mono/mini/mini-s390.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-s390.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -2432,7 +2432,7 @@
//x86_inc_mem (code, &cov->data [bb->dfn].count);
}
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
offset = code - cfg->native_code;
max_len = ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
@@ -4311,7 +4311,7 @@
if (cfg->prof_options & MONO_PROFILE_COVERAGE)
max_offset += 6;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (bb, ins) {
max_offset += ((guint8 *)ins_get_spec
(ins->opcode))[MONO_INST_LEN];
}
Modified: trunk/mono/mono/mini/mini-s390x.c
===================================================================
--- trunk/mono/mono/mini/mini-s390x.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-s390x.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -2443,7 +2443,7 @@
//x86_inc_mem (code, &cov->data [bb->dfn].count);
}
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
offset = code - cfg->native_code;
max_len = ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
@@ -4481,7 +4481,7 @@
if (cfg->prof_options & MONO_PROFILE_COVERAGE)
max_offset += 6;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (bb, ins) {
max_offset += ((guint8 *)ins_get_spec
(ins->opcode))[MONO_INST_LEN];
}
Modified: trunk/mono/mono/mini/mini-sparc.c
===================================================================
--- trunk/mono/mono/mini/mini-sparc.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-sparc.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -2374,7 +2374,7 @@
NOT_IMPLEMENTED;
}
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
guint8* code_start;
offset = (guint8*)code - cfg->native_code;
Modified: trunk/mono/mono/mini/mini-x86.c
===================================================================
--- trunk/mono/mono/mini/mini-x86.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini-x86.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -2129,7 +2129,7 @@
mono_debug_open_block (cfg, bb, offset);
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
offset = code - cfg->native_code;
max_len = ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
@@ -3814,7 +3814,7 @@
if ((cfg->opt & MONO_OPT_LOOP) && bb_is_loop_start (bb))
max_offset += LOOP_ALIGNMENT;
- MONO_INST_LIST_FOR_EACH_ENTRY (ins, &bb->ins_list,
node) {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
if (ins->opcode == OP_LABEL)
ins->inst_c1 = max_offset;
Modified: trunk/mono/mono/mini/mini.c
===================================================================
--- trunk/mono/mono/mini/mini.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -116,15 +116,6 @@
} \
} while (0)
-/*
- * this is used to determine when some branch optimizations are possible: we
exclude FP compares
- * because they have weird semantics with NaNs.
- */
-#define MONO_IS_COND_BRANCH_OP(ins) (((ins)->opcode >= CEE_BEQ &&
(ins)->opcode <= CEE_BLT_UN) || ((ins)->opcode >= OP_LBEQ && (ins)->opcode <=
OP_LBLT_UN) || ((ins)->opcode >= OP_FBEQ && (ins)->opcode <= OP_FBLT_UN) ||
((ins)->opcode >= OP_IBEQ && (ins)->opcode <= OP_IBLT_UN))
-#define MONO_IS_COND_BRANCH_NOFP(ins) (MONO_IS_COND_BRANCH_OP(ins) &&
(ins)->inst_left->inst_left->type != STACK_R8)
-
-#define MONO_IS_BRANCH_OP(ins) (MONO_IS_COND_BRANCH_OP(ins) || ((ins)->opcode
== OP_BR) || ((ins)->opcode == OP_BR_REG) || ((ins)->opcode == OP_SWITCH))
-
#define MONO_CHECK_THIS(ins) (mono_method_signature (cfg->method)->hasthis &&
(ins)->ssa_op == MONO_SSA_LOAD && (ins)->inst_left->inst_c0 == 0)
static void setup_stat_profiler (void);
@@ -1111,7 +1102,7 @@
link_bblock (cfg, first, second);
/*g_print ("start search at %p for %p\n", first->cil_code,
second->cil_code);*/
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &first->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (first, inst) {
MonoInst *inst_next;
/*char *code = mono_disasm_code_one (NULL, cfg->method,
inst->next->cil_code, NULL);
@@ -9387,7 +9378,7 @@
{
MonoInst *c;
- MONO_INST_LIST_FOR_EACH_ENTRY (c, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, c) {
mono_print_tree (c);
g_print ("\n");
}
@@ -9420,7 +9411,7 @@
} else*/
code = g_strdup ("\n");
g_print ("\nBB%d DFN%d (len: %d): %s", bb->block_num, i,
bb->cil_length, code);
- MONO_INST_LIST_FOR_EACH_ENTRY (c, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, c) {
mono_print_tree (c);
g_print ("\n");
}
@@ -10025,7 +10016,7 @@
MonoInst *tree;
cfg->cbb = bb;
cfg->prev_ins = NULL;
- MONO_INST_LIST_FOR_EACH_ENTRY (tree, &cfg->cbb->ins_list, node){
+ MONO_BB_FOR_EACH_INS (cfg->cbb, tree) {
dec_foreach (tree, cfg);
cfg->prev_ins = tree;
}
@@ -10088,7 +10079,7 @@
replace_out_block_in_code (MonoBasicBlock *bb, MonoBasicBlock *orig,
MonoBasicBlock *repl) {
MonoInst *inst;
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
if (inst->opcode == OP_CALL_HANDLER) {
if (inst->inst_target_bb == orig)
inst->inst_target_bb = repl;
@@ -10166,7 +10157,7 @@
return FALSE;
}
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
switch (inst->opcode) {
case OP_NOP:
break;
@@ -10706,7 +10697,7 @@
g_print ("CODE BLOCK %d (nesting %d):\n",
bb->block_num, bb->nesting);
- MONO_INST_LIST_FOR_EACH_ENTRY (tree, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, tree) {
mono_print_tree (tree);
g_print ("\n");
}
@@ -10820,7 +10811,7 @@
MonoInst *tree;
g_print ("DUMP BLOCK %d:\n", bb->block_num);
- MONO_INST_LIST_FOR_EACH_ENTRY (tree, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, tree) {
mono_print_tree (tree);
g_print ("\n");
}
Modified: trunk/mono/mono/mini/mini.h
===================================================================
--- trunk/mono/mono/mini/mini.h 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/mini.h 2008-01-24 15:59:58 UTC (rev 93808)
@@ -35,6 +35,8 @@
#define MINI_DEBUG(level,limit,code) do {if (G_UNLIKELY ((level) >= (limit)))
code} while (0)
#endif
+#define NOT_IMPLEMENTED do { g_assert_not_reached (); } while (0)
+
#ifndef DISABLE_AOT
#define MONO_USE_AOT_COMPILER
#endif
@@ -109,6 +111,15 @@
(ins)->ssa_op = MONO_SSA_NOP; \
} while (0)
+/*
+ * this is used to determine when some branch optimizations are possible: we
exclude FP compares
+ * because they have weird semantics with NaNs.
+ */
+#define MONO_IS_COND_BRANCH_OP(ins) (((ins)->opcode >= CEE_BEQ &&
(ins)->opcode <= CEE_BLT_UN) || ((ins)->opcode >= OP_LBEQ && (ins)->opcode <=
OP_LBLT_UN) || ((ins)->opcode >= OP_FBEQ && (ins)->opcode <= OP_FBLT_UN) ||
((ins)->opcode >= OP_IBEQ && (ins)->opcode <= OP_IBLT_UN))
+#define MONO_IS_COND_BRANCH_NOFP(ins) (MONO_IS_COND_BRANCH_OP(ins) &&
(ins)->inst_left->inst_left->type != STACK_R8)
+
+#define MONO_IS_BRANCH_OP(ins) (MONO_IS_COND_BRANCH_OP(ins) || ((ins)->opcode
== OP_BR) || ((ins)->opcode == OP_BR_REG) || ((ins)->opcode == OP_SWITCH))
+
typedef struct MonoInstList MonoInstList;
typedef struct MonoInst MonoInst;
typedef struct MonoCallInst MonoCallInst;
@@ -268,6 +279,10 @@
&pos->member != (head); \
pos = n, n = MONO_INST_LIST_ENTRY (n->member.next, MonoInst,
member))
+#define MONO_BB_FOR_EACH_INS(bb, ins) MONO_INST_LIST_FOR_EACH_ENTRY ((ins),
&((bb)->ins_list), node)
+
+#define MONO_BB_FOR_EACH_INS_REVERSE(bb, ins)
MONO_INST_LIST_FOR_EACH_ENTRY_REVERSE ((ins), &((bb)->ins_list), node)
+
struct MonoEdge {
MonoEdge *next;
MonoBasicBlock *bb;
@@ -366,12 +381,12 @@
MonoInst **in_stack;
MonoStackSlot *stack_state; /* Verification stack state on enter to
bblock */
- /* we use that to prevent merging of bblock covered by different
clauses*/
+ /* we use that to prevent merging of bblocks covered by different
clauses*/
guint real_offset;
/*
* The region encodes whether the basic block is inside
- * a finally, catch, filter or none of thoese.
+ * a finally, catch, filter or none of these.
*
* If the value is -1, then it is neither finally, catch nor filter
*
Modified: trunk/mono/mono/mini/ssa.c
===================================================================
--- trunk/mono/mono/mini/ssa.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/ssa.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -204,7 +204,7 @@
printf ("RENAME VARS BB%d %s\n", bb->block_num, mono_method_full_name
(cfg->method, TRUE));
#endif
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
if (inst->opcode != OP_PHI)
replace_usage (cfg, bb, inst, stack);
@@ -239,7 +239,7 @@
if (n->in_bb [j] == bb)
break;
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &n->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (n, inst) {
if (inst->ssa_op == MONO_SSA_STORE &&
inst->inst_i1->opcode == OP_PHI) {
idx = inst->inst_i1->inst_c0;
if (stack [idx])
@@ -296,7 +296,7 @@
mono_bitset_set (vinfo [i].def_in, 0);
}
for (i = 0; i < cfg->num_bblocks; ++i) {
- MONO_INST_LIST_FOR_EACH_ENTRY (inst,
&cfg->bblocks[i]->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (cfg->bblocks [i], inst) {
if (inst->ssa_op == MONO_SSA_STORE) {
idx = inst->inst_i0->inst_c0;
g_assert (idx < cfg->num_varinfo);
@@ -466,7 +466,7 @@
for (i = 0; i < cfg->num_bblocks; ++i) {
MonoBasicBlock *bb = cfg->bblocks [i];
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
if (inst->ssa_op == MONO_SSA_STORE &&
inst->inst_i1->opcode == OP_PHI) {
phi = inst->inst_i1;
@@ -553,7 +553,7 @@
for (i = 0; i < cfg->num_bblocks; ++i) {
MonoBasicBlock *bb = cfg->bblocks [i];
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (bb, inst)
mono_ssa_replace_copies (cfg, bb, inst, is_live);
}
@@ -676,7 +676,7 @@
g_assert ((cfg->comp_done & MONO_COMP_SSA_DEF_USE));
for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
if (inst->ssa_op == MONO_SSA_STORE &&
inst->inst_i0->opcode == OP_LOCAL &&
!IS_CALL (inst->inst_i1->opcode) &&
inst->inst_i1->opcode != OP_PHI && !inst->flags) {
i1 = cfg->vars [inst->inst_i0->inst_c0];
@@ -732,7 +732,7 @@
for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
MonoInst *inst;
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, inst) {
gboolean has_side_effects = analyze_dev_use (cfg, bb,
inst, inst);
if (has_side_effects && (inst->ssa_op ==
MONO_SSA_STORE) &&
(inst->inst_i0->opcode == OP_LOCAL ||
inst->inst_i0->opcode == OP_ARG)) {
@@ -1138,7 +1138,7 @@
}
}
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (bb, inst)
visit_inst (cfg, bb, inst, &cvars, &bblock_list,
carray);
while (cvars) {
@@ -1156,7 +1156,7 @@
for (bb = cfg->bb_entry->next_bb; bb; bb = bb->next_bb) {
MonoInst *inst;
- MONO_INST_LIST_FOR_EACH_ENTRY (inst, &bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (bb, inst)
fold_tree (cfg, bb, inst, carray);
}
Modified: trunk/mono/mono/mini/ssapre.c
===================================================================
--- trunk/mono/mono/mini/ssapre.c 2008-01-24 15:49:06 UTC (rev 93807)
+++ trunk/mono/mono/mini/ssapre.c 2008-01-24 15:59:58 UTC (rev 93808)
@@ -273,7 +273,7 @@
MonoInst *current_inst;
print_bb_info (current_bb, TRUE);
- MONO_INST_LIST_FOR_EACH_ENTRY (current_inst,
¤t_bb->bb->ins_list, node)
+ MONO_BB_FOR_EACH_INS (current_bb->bb, current_inst)
mono_print_tree_nl (current_inst);
}
}
@@ -827,7 +827,7 @@
bb_info->phi_insertion_point = NULL;
previous_inst = NULL;
- MONO_INST_LIST_FOR_EACH_ENTRY (current_inst, &bb->ins_list, node) {
+ MONO_BB_FOR_EACH_INS (bb, current_inst) {
/* Ugly hack to fix missing variable definitions */
/* (the SSA construction code should have done it already!) */
switch (current_inst->opcode) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches