- int n_regs = env->co->cls->n_regs;
- col_cost_pair_t *cols = alloca(n_regs * sizeof(cols[0]));
- int best_costs = cloud_costs(env, cloud);
- int best_col = 0;
-
- struct list_head changed;
- co2_irn_t *ci;
- int i;
-
-
- i = 0;
- DB((env->dbg, LEVEL_2, "processing cloud with costs %d and master %+F containing:\n", cloud->costs, cloud->master->irn));
- list_for_each_entry(co2_irn_t, ci, &cloud->members_head, cloud_list) {
- DB((env->dbg, LEVEL_2, "\t%+F %d\n", ci->irn, ci->costs));
- }
-
- determine_color_costs(env, cloud->master, cols);
- qsort(cols, n_regs, sizeof(cols[0]), col_cost_pair_lt);
-
- best_col = cols[0].col;
- for(i = 0; i < n_regs; ++i) {
- col_t col = cols[i].col;
- int reject = 1;
- int costs;
-
- INIT_LIST_HEAD(&changed);
- DBG((env->dbg, LEVEL_2, "\n\ttrying color %d. current costs: %d\n", col, best_costs));
-
- /* try to recolor all the cloud members. */
- try_color(env, cloud->master, col, &changed);
-
- /* recoloring of all nodes did succeed. measure the costs and decide if the coloring shall be kept. */
- costs = cloud_costs(env, cloud);
-
- /* materialize the new coloring. */
- if(costs < best_costs) {
- materialize_coloring(&changed);
- best_costs = costs;
- best_col = col;
- reject = 0;
+ co2_t *env = ci->cloud->env;
+ co2_irn_t *ir = &ci->inh;
+ int n_regs = env->n_regs;
+ be_ifg_t *ifg = env->co->cenv->ifg;
+ bitset_t *bs = bitset_alloca(n_regs);
+
+ size_t elm;
+ const ir_node *irn;
+ neighbours_iter_t it;
+
+ admissible_colors(env, &ci->inh, bs);
+ bitset_flip_all(bs);
+ bitset_foreach(bs, elm)
+ badness[elm] = ci->costs;
+
+ /* Use constrained/fixed interfering neighbors to influence the color badness */
+ be_ifg_foreach_neighbour(ifg, &it, ir->irn, irn) {
+ co2_irn_t *ni = get_co2_irn(env, irn);
+
+ admissible_colors(env, ni, bs);
+ if (bitset_popcount(bs) == 1) {
+ size_t c = bitset_next_set(bs, 0);
+ badness[c] += ci->costs;