#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
#include "irprog.h"
static void co_append_unit(copy_opt_t *co, ir_node *root) {
int i, arity;
unit_t *unit;
- DBG((dbg, LEVEL_1, "\t Root: %n\n", root));
+ DBG((dbg, LEVEL_1, "\t Root: %n %N\n", root, root));
/* check if we encountered this root earlier */
if (pset_find_ptr(co->roots, root))
return;
assert(is_curr_reg_class(arg) && "Argument not in same register class.");
if (arg != root) {
if (!nodes_interfere(co->chordal_env, root, arg)) {
- DBG((dbg, LEVEL_1, "\t Member: %n\n", arg));
- if (is_optimizable(arg))
+ DBG((dbg, LEVEL_1, "\t Member: %n %N\n", arg, arg));
+ if (is_optimizable(co->chordal_env->arch_env, arg))
co_append_unit(co, arg);
unit->nodes[unit->node_count++] = arg;
} else
}
}
unit->nodes = xrealloc(unit->nodes, unit->node_count * sizeof(*unit->nodes));
- } else if (is_Copy(root)) {
+ } else if (is_Copy(co->chordal_env->arch_env, root)) {
assert(!nodes_interfere(co->chordal_env, root, get_Copy_src(root)));
unit->nodes[unit->node_count++] = get_Copy_src(root);
unit->nodes = xrealloc(unit->nodes, 2 * sizeof(*unit->nodes));
border_t *curr;
list_for_each_entry_reverse(border_t, curr, head, list)
- if (curr->is_def && curr->is_real && is_optimizable(curr->irn))
+ if (curr->is_def && curr->is_real && is_optimizable(co->chordal_env->arch_env, curr->irn))
co_append_unit(co, curr->irn);
}
s3 = chordal_env->cls->name;
len = strlen(s1) + strlen(s2) + strlen(s3) + 5;
co->name = xmalloc(len);
- if (!strcmp(co->name, DEBUG_IRG))
- firm_dbg_set_mask(dbg, -1);
snprintf(co->name, len, "%s__%s__%s", s1, s2, s3);
+ if (!strcmp(co->name, DEBUG_IRG))
+ firm_dbg_set_mask(dbg, DEBUG_LVL_CO);
+ else
+ firm_dbg_set_mask(dbg, DEBUG_LVL);
INIT_LIST_HEAD(&co->units);
co_collect_units(co);
int i, max;
for(i=0, max=get_irn_n_outs(irn); i<max; ++i) {
ir_node *n = get_irn_out(irn, i);
- if ((is_Phi(n) || is_Perm(n)) && (irn == n || !nodes_interfere(co->chordal_env, irn, n)))
+ if ((is_Phi(n) || is_Perm(co->chordal_env->arch_env, n)) && (irn == n || !nodes_interfere(co->chordal_env, irn, n)))
return 1;
}
return 0;
list_for_each_entry(unit_t, curr, &co->units, units) {
int root_col = get_irn_col(co, curr->nodes[0]);
res += curr->interf;
+ DBG((dbg, LEVEL_1, "%n %N has %d intf\n", curr->nodes[0], curr->nodes[0], curr->interf));
for (i=1; i<curr->node_count; ++i)
- if (root_col != get_irn_col(co, curr->nodes[i]))
+ if (root_col != get_irn_col(co, curr->nodes[i])) {
+ DBG((dbg, LEVEL_1, " %n %N\n", curr->nodes[i], curr->nodes[i]));
res++;
+ }
}
return res;
}