+ /* try to color the conflicting node cn with the color of the irn itself */
+ DBG((dbgphi, LEVEL_3, "\t\t\t%n \t~~> %n := %d: Subcheck\n", trigger, irn, col));
+ sub_res = _pu_color_irn(pu, cn, irn_col, irn, changed_nodes);
+ if (sub_res != CHANGE_SAVE) {
+ res = sub_res;
+ goto ret_confl;
+ }
+ }
+ /* if we arrive here all sub changes can be applied, so it's save to change this irn */
+
+ret_save:
+ DBG((dbgphi, LEVEL_2, "\t\t\t%n \t~~> %n := %d: Save\n", trigger, irn, col));
+ obstack_free(&confl_ob, NULL);
+ pu_set_new_color(pu, irn, col);
+ obstack_ptr_grow(changed_nodes, irn);
+ return CHANGE_SAVE;
+
+ret_confl:
+ DBG((dbgphi, LEVEL_2, "\t\t\t%n \t~~> %n := %d: Conflict\n", trigger, irn, col));
+ obstack_free(&confl_ob, NULL);
+ return res;
+}
+
+#define pu_color_irn(pu,irn,col,ob) _pu_color_irn(pu, irn, col, irn, ob)
+
+/**
+ * Tries to set as much members of a phi unit as possible to color @p col.
+ * All changes taken together are guaranteed to be conflict free.
+ */
+static int pu_try_color(phi_unit_t *pu, int col, int b_size) {
+ struct obstack ob_mis, ob_undo;
+ int i, redo, mis_size;
+ ir_node **mis;
+
+ /* first init pessimistically. Just return if we can't get a better result */
+ mis_size = 0;
+
+ obstack_init(&ob_mis);
+ obstack_init(&ob_undo);
+ redo = 1;
+ while (redo) {
+ redo = 0;
+ /* get a max independent set regarding current conflicts */
+ mis_size = pu_get_max_ind_set(pu, &ob_mis);
+ mis = obstack_finish(&ob_mis);
+
+ /* shortcut: if mis size is worse than best, then mis won't be better. */
+ if (mis_size < b_size)
+ goto ret;
+
+ /* check if its possible to set the color for all members of the maximum set*/
+ for (i = 0; i < mis_size; ++i) {
+ ir_node *test_node, *confl_node;
+
+ test_node = mis[i];
+ DBG((dbgphi, 1, "\t\t Testing %n\n", test_node));
+ confl_node = pu_color_irn(pu, test_node, col, &ob_undo);
+
+ if (confl_node == CHANGE_SAVE) {
+ if (!pset_find_ptr(free_nodes, test_node))
+ pu_pin_node(pu, test_node);
+ obstack_free(&ob_undo, obstack_finish(&ob_undo));
+ continue;