typedef unsigned col_t;
-typedef struct _co2_irn_t co2_irn_t;
-typedef struct _co2_cloud_t co2_cloud_t;
-typedef struct _co2_cloud_irn_t co2_cloud_irn_t;
+typedef struct co2_irn_t co2_irn_t;
+typedef struct co2_cloud_t co2_cloud_t;
+typedef struct co2_cloud_irn_t co2_cloud_irn_t;
typedef struct {
col_t col;
DEBUG_ONLY(firm_dbg_module_t *dbg;)
} co2_t;
-struct _co2_irn_t {
+struct co2_irn_t {
const ir_node *irn;
affinity_node_t *aff;
co2_irn_t *touched_next;
struct list_head changed_list;
};
-struct _co2_cloud_irn_t {
- struct _co2_irn_t inh;
+struct co2_cloud_irn_t {
+ struct co2_irn_t inh;
co2_cloud_t *cloud;
int visited;
int index;
struct list_head mst_list;
};
-struct _co2_cloud_t {
+struct co2_cloud_t {
co2_t *env;
struct obstack obst;
int costs;
#define get_co2_irn(co2, irn) ((co2_irn_t *) phase_get_or_set_irn_data(&co2->ph, irn))
#define get_co2_cloud_irn(co2, irn) ((co2_cloud_irn_t *) phase_get_or_set_irn_data(&co2->ph, irn))
-static void *co2_irn_init(ir_phase *ph, const ir_node *irn, void *data)
+static void *co2_irn_init(ir_phase *ph, const ir_node *irn)
{
co2_t *env = (co2_t *) ph;
affinity_node_t *a = get_affinity_info(env->co, irn);
size_t size = a ? sizeof(co2_cloud_irn_t) : sizeof(co2_irn_t);
- co2_irn_t *ci = data ? data : phase_alloc(ph, size);
+ co2_irn_t *ci = phase_alloc(ph, size);
memset(ci, 0, size);
INIT_LIST_HEAD(&ci->changed_list);
unsigned elm;
const ir_node *pos;
- void *it;
+ neighbours_iter_t it;
int i;
/* Put all forbidden colors into the aux bitset. */
}
}
- it = be_ifg_neighbours_iter_alloca(ifg);
- be_ifg_foreach_neighbour(ifg, it, irn, pos) {
+ be_ifg_foreach_neighbour(ifg, &it, irn, pos) {
col_t col = get_col(env, pos);
if (color_is_fix(env, pos)) {
col_costs[col].costs = INT_MAX;
col_costs[col].costs = add_saturated(col_costs[col].costs, 8 * be_ifg_degree(ifg, pos));
}
}
- be_ifg_neighbours_break(ifg, it);
+ be_ifg_neighbours_break(&it);
/* Set the costs to infinity for each color which is not allowed at this node. */
bitset_foreach(forb, elm) {
struct list_head changed;
const ir_node *n;
- void *it;
+ neighbours_iter_t it;
DBG((env->dbg, LEVEL_3, "\t\t%2{firm:indent}trying color %d(%d) on %+F\n", depth, tgt_col, costs, irn));
INIT_LIST_HEAD(&changed);
list_add(&ci->changed_list, &changed);
- it = be_ifg_neighbours_iter_alloca(ifg);
- be_ifg_foreach_neighbour(ifg, it, irn, n) {
+ be_ifg_foreach_neighbour(ifg, &it, irn, n) {
/* try to re-color the neighbor if it has the target color. */
if (get_col(env, n) == tgt_col) {
break;
}
}
- be_ifg_neighbours_break(ifg, it);
+ be_ifg_neighbours_break(&it);
/*
We managed to assign the target color to all neighbors, so from the perspective
unsigned elm;
const ir_node *irn;
- void *it;
+ neighbours_iter_t it;
admissible_colors(env, &ci->inh, bs);
bitset_flip_all(bs);
badness[elm] = ci->costs;
/* Use constrained/fixed interfering neighbors to influence the color badness */
- it = be_ifg_neighbours_iter_alloca(ifg);
- be_ifg_foreach_neighbour(ifg, it, ir->irn, irn) {
+ be_ifg_foreach_neighbour(ifg, &it, ir->irn, irn) {
co2_irn_t *ni = get_co2_irn(env, irn);
admissible_colors(env, ni, bs);
badness[c] += ci->costs;
}
}
- be_ifg_neighbours_break(ifg, it);
+ be_ifg_neighbours_break(&it);
}
/**
// assert(ok && "Color changing may not fail while committing the coloring");
materialize_coloring(&changed);
- for (i = 0; i < ci->mst_n_childs; ++i) {
+ for (i = 0; i < ci->mst_n_childs; ++i) {
apply_coloring(ci->mst_childs[i], front[i], depth + 1);
}
}
co2_t env;
FILE *f;
- phase_init(&env.ph, co->cenv->birg->irg, co2_irn_init);
+ phase_init(&env.ph, co->cenv->irg, co2_irn_init);
env.touched = NULL;
env.visited = 0;
env.co = co;
env.n_regs = co->cls->n_regs;
env.ignore_regs = bitset_alloca(co->cls->n_regs);
- be_put_ignore_regs(co->cenv->birg, co->cls, env.ignore_regs);
+ be_put_ignore_regs(co->cenv->irg, co->cls, env.ignore_regs);
FIRM_DBG_REGISTER(env.dbg, "firm.be.co2");
INIT_LIST_HEAD(&env.cloud_head);