+ DBG((env->dbg, LEVEL_3, "mst:\n"));
+ for(i = 0; i < cloud->n_memb; ++i) {
+ DEBUG_ONLY(co2_cloud_irn_t *ci = cloud->seq[i]);
+ DBG((env->dbg, LEVEL_3, "\t%+F -> %+F\n", ci->inh.irn, ci->mst_parent->inh.irn));
+ }
+
+ for(i = 0; i < cloud->n_memb; ++i) {
+ co2_cloud_irn_t *ci = cloud->seq[i];
+ int n_childs = ci->mst_n_childs;
+ int j;
+
+ ci->col_costs = obstack_alloc(&cloud->obst, n_regs * sizeof(ci->col_costs[0]));
+ ci->tmp_coloring = obstack_alloc(&cloud->obst, n_regs * sizeof(ci->tmp_coloring[0]));
+ ci->fronts = obstack_alloc(&cloud->obst, n_regs * n_childs * sizeof(ci->fronts[0]));
+ ci->color_badness = obstack_alloc(&cloud->obst, n_regs * sizeof(ci->fronts[0]));
+ memset(ci->color_badness, 0, n_regs * sizeof(ci->color_badness[0]));
+ memset(ci->col_costs, 0, n_regs * sizeof(ci->col_costs[0]));
+ memset(ci->tmp_coloring, 0, n_regs * sizeof(ci->tmp_coloring[0]));
+ memset(ci->fronts, 0, n_regs * n_childs * sizeof(ci->fronts[0]));
+
+ for(j = 0; j < env->n_regs; j++)
+ ci->col_costs[j] = INT_MAX;
+
+ }
+
+ determine_color_badness(cloud->mst_root, 0);
+ best_col = coalesce_top_down(cloud->mst_root, -1, 0);
+ unfix_subtree(cloud->mst_root);
+ apply_coloring(cloud->mst_root, best_col, 0);
+
+ /* The coloring should represent the one with the best costs. */
+ //materialize_coloring(&changed);
+ DBG((env->dbg, LEVEL_2, "\tbest coloring for root %+F was %d costing %d\n",
+ cloud->mst_root->inh.irn, best_col, examine_subtree_coloring(cloud->mst_root, best_col)));
+
+ /* Fix all nodes in the cloud. */
+ for(i = 0; i < cloud->n_memb; ++i)
+ cloud->seq[i]->inh.fixed = 1;
+
+ /* Free all space used while optimizing this cloud. */
+ obstack_free(&cloud->obst, NULL);
+}
+
+static int cloud_costs(co2_cloud_t *cloud)
+{
+ int i, costs = 0;
+ neighb_t *n;
+
+ for(i = 0; i < cloud->n_memb; ++i) {
+ co2_irn_t *ci = (co2_irn_t *) cloud->seq[i];
+ col_t col = get_col(cloud->env, ci->irn);
+ co_gs_foreach_neighb(ci->aff, n) {
+ col_t n_col = get_col(cloud->env, n->irn);
+ costs += col != n_col ? n->costs : 0;