- /* now take the candidates cand and determine a max independent set
- * with respect to edges representing live range interference */
- /* TODO: make this 'un-greedy' */
- DBG((dbgphi, 1, "\t\t Max indep set\n"));
- for (i = 0; i < cand_size; ++i) {
- int intf_det = 0;
- for (o = 0; o < mis_size; ++o) {
- mis = (ir_node**) obstack_base(&ob);
- if (phi_ops_interfere(cand[i], mis[o])) {
- intf_det = 1;
- break;
+ 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;
+ } else {
+ int i;
+ ir_node *undo_node, **undo_nodes;
+
+ obstack_ptr_grow(&ob_undo, NULL);
+ undo_nodes = obstack_finish(&ob_undo);
+ for (i = 0, undo_node = undo_nodes[0]; undo_node; undo_node = undo_nodes[++i]) {
+ node_stat_t *ns = pu_find_node(pu, undo_node);
+ ns->color = ns->undo_color;
+ }
+ obstack_free(&ob_undo, undo_nodes);
+
+ if (is_conflicting_node(confl_node)) {
+ if (pu_is_node_pinned(pu, confl_node))
+ pu_add_conflict(pu, confl_node, test_node);
+ if (pset_find_ptr(pinned_global, confl_node))
+ pu_remove_node(pu, test_node);
+ }