return 0;
}
-/*
- * TODO: Because this here uses a phi-walker and not the ou's,
- * it is possible, that the interfering args of a phi will cause a bug ??!!
- */
static void M_constr_walker(ir_node *block, void *env) {
problem_instance_t *pi = env;
int count, arity, row, col, other_row, *costs;
phi = sched_first(block);
for (row=0; row<count; ++row) {
phis[row] = phi;
- for (col=0; col<arity; ++col)
- phi_matrix[row*arity + col] = get_irn_n(phi, col);
+ for (col=0; col<arity; ++col) {
+ ir_node *arg = get_irn_n(phi, col);
+ /* Sort out all arguments interfering with its phi */
+ if (nodes_interfere(pi->co->chordal_env, phi, arg)) {
+ phi_matrix[row*arity + col] = NULL;
+ } else
+ phi_matrix[row*arity + col] = arg;
+ }
phi = sched_next(phi);
}
done = pset_new_ptr_default();
for (row=0; row<count; ++row) {
irn = phi_matrix[row*arity + col];
- /* has the irn already been processed in this col? */
- if (pset_find_ptr(done, irn))
+ /*
+ * is this an interfering arg (NULL)
+ * or has the irn already been processed in this col?
+ */
+ if (!irn || pset_find_ptr(done, irn))
continue;
else
pset_insert_ptr(done, irn);
/* compute the minimal costs (rhs) */
int phi_nr, sum=0, max=-1, minimal_costs;
bitset_foreach(candidates, phi_nr) {
- costs[phi_nr] = get_costs(pi, phis[phi_nr], irn); //TODO this failes for nodes not in the ou. the interfering ones.
+ costs[phi_nr] = get_costs(pi, phis[phi_nr], irn);
sum += costs[phi_nr];
max = MAX(max, costs[phi_nr]);
}
DBG((dbg, LEVEL_2, "Applying solution...\n"));
#ifdef DO_STAT
- curr_vals[I_ILP_ITER] += lpp_get_iter_cnt(pi->curr_lp);
- curr_vals[I_ILP_TIME] += lpp_get_sol_time(pi->curr_lp);
+ copystat_add_ilp_time(lpp_get_sol_time(pi->curr_lp));
+ copystat_add_ilp_iter(lpp_get_iter_cnt(pi->curr_lp));
#endif
sol = xmalloc((pi->last_x_var+1) * sizeof(*sol));