#include "bechordal_t.h"
-#define BIGM 100000.0
-
-#define DUMP_SOLUTION
-#define DUMP_ILP
+//#define DUMP_SOLUTION
+//#define DUMP_ILP
//#define KEEPALIVE /* keep alive all inserted remats and dump graph with remats */
#define COLLECT_REMATS /* enable rematerialization */
#define COLLECT_INVERSE_REMATS /* enable placement of inverse remats */
+//#define ONLY_BRIGGS_REMATS /* only remats without parameters (or only with ignored params) */
#define REMAT_WHILE_LIVE /* only remat values that are live */
//#define NO_ENLARGE_L1V3N355 /* do not remat after the death of some operand */
//#define EXECFREQ_LOOPDEPH /* compute execution frequency from loop depth only */
}
}
+#ifdef NO_SINGLE_USE_REMATS
static int
get_irn_n_nonremat_edges(const spill_ilp_t * si, const ir_node * irn)
{
return i;
}
+#endif
+
+#ifdef ONLY_BRIGGS_REMATS
+static int
+get_irn_n_nonignore_args(const spill_ilp_t * si, const ir_node * irn)
+{
+ int n;
+ unsigned int ret = 0;
+
+ for(n=get_irn_arity(irn)-1; n>=0; --n) {
+ if(has_reg_class(si, irn)) ++ret;
+ }
+
+ return ret;
+}
+#endif
static INLINE void
get_remats_from_op(spill_ilp_t * si, const ir_node * op)
int n;
remat_t *remat;
+ if( has_reg_class(si, op)
#ifdef NO_SINGLE_USE_REMATS
- if(has_reg_class(si, op) && (get_irn_n_nonremat_edges(si, op) > 1)) {
-#else
- if(has_reg_class(si, op)) {
+ && (get_irn_n_nonremat_edges(si, op) > 1)
#endif
+#ifdef ONLY_BRIGGS_REMATS
+ && (get_irn_n_nonignore_args(si, op) == 0)
+#endif
+ ) {
remat = get_remat_from_op(si, op, op);
if(remat) {
add_remat(si, remat);
}
}
-#ifdef COLLECT_INVERSE_REMATS
+#if defined(COLLECT_INVERSE_REMATS) && !defined(ONLY_BRIGGS_REMATS)
/* repeat the whole stuff for each remat retrieved by get_remat_from_op(op, arg)
for each arg */
for (n = get_irn_arity(op)-1; n>=0; --n) {
}
/** insert a spill at an arbitrary position */
-ir_node *be_spill2(const arch_env_t *arch_env, ir_node *irn, ir_node *insert, ir_node *ctx)
+ir_node *be_spill2(const arch_env_t *arch_env, ir_node *irn, ir_node *insert)
{
ir_node *bl = is_Block(insert)?insert:get_nodes_block(insert);
ir_graph *irg = get_irn_irg(bl);
const arch_register_class_t *cls = arch_get_irn_reg_class(arch_env, irn, -1);
const arch_register_class_t *cls_frame = arch_get_irn_reg_class(arch_env, frame, -1);
- spill = be_new_Spill(cls, cls_frame, irg, bl, frame, irn, ctx);
+ spill = be_new_Spill(cls, cls_frame, irg, bl, frame, irn);
/*
* search the right insertion point. a spill of a phi cannot be put
DBG((si->dbg, LEVEL_3, "\t inserting spill for value %+F after %+F\n", irn, before));
- spill = be_spill2(arch_env, irn, before, irn);
+ spill = be_spill2(arch_env, irn, before);
defs = set_insert_def(si->values, value);
assert(defs);
DBG((si->dbg, LEVEL_2, "\t inserting mem copy for value %+F after %+F\n", value, insert_pos));
- spill = be_spill2(arch_env, is_Block(insert_pos)?value:insert_pos, insert_pos, value);
+ spill = be_spill2(arch_env, is_Block(insert_pos)?value:insert_pos, insert_pos);
return spill;
}
lc_bitset_free(kh.used);
}
-static void
+void
print_irn_pset(pset * p)
{
ir_node *irn;
}
}
-static void
+void
dump_phi_class(spill_ilp_t * si, pset * phiclass, const char * file)
{
FILE *f = fopen(file, "w");
/* set spill context to phi class if it has one ;) */
+#if 0
+ // Matze: not needed anymore
cls = get_phi_class(irn);
if(cls)
be_set_Spill_context(irn, cls);
else
be_set_Spill_context(irn, irn);
+#endif
}
#endif
#ifdef SOLVE
- DBG((si.dbg, LEVEL_1, "\tSolving %F\n", chordal_env->irg));
+ DBG((si.dbg, LEVEL_1, "\tSolving %s (%d variables, %d constraints)\n", problem_name, si.lpp->var_next, si.lpp->cst_next));
#ifdef ILP_TIMEOUT
lpp_set_time_limit(si.lpp, ILP_TIMEOUT);
#endif