- struct obstack q;
- int in, out;
- ir_node *irn_bl;
-
- irn_bl = get_nodes_block(irn);
-
- /* first check for a conflicting node which is 'living in' the irns block */
- {
- ir_node *n;
- pset *live_ins = put_live_in(irn_bl, pset_new_ptr_default());
- for (n = pset_first(live_ins); n; n = pset_next(live_ins))
- if (arch_irn_has_reg_class(arch_env, n, arch_pos_make_out(0), cls)
- && n != trigger && qnode_get_new_color(qn, n) == col
- && nodes_interfere(chordal_env, irn, n)) {
-
- DBG((dbg, LEVEL_4, "\t %n\ttroubles\n", n));
- obstack_ptr_grow(&confl_ob, n);
- pset_break(live_ins);
- break;
- }
- del_pset(live_ins);
- }
-
- /* setup the queue of blocks. */
- obstack_init(&q);
- obstack_ptr_grow(&q, irn_bl);
- in = 1;
- out = 0;
-
- /* process the queue. The code below checks for every block dominated
- * by the irns one, and in which the irn is live, if there are
- * conflicting nodes */
- while (out < in) {
- ir_node *curr_bl, *sub_bl;
- int i, max;
-
- curr_bl = ((ir_node **)obstack_base(&q))[out++];
-
- /* Add to the result all nodes in the block, which have
- * the target color and interfere with the irn */
- for (i = 0, max = get_irn_n_outs(curr_bl); i < max; ++i) {
- ir_node *n = get_irn_out(curr_bl, i);
- if (arch_irn_has_reg_class(arch_env, n, arch_pos_make_out(0), cls)
- && n != trigger && qnode_get_new_color(qn, n) == col
- && nodes_interfere(chordal_env, irn, n)) {
-
- DBG((dbg, LEVEL_4, "\t %n\ttroubles\n", n));
- obstack_ptr_grow(&confl_ob, n);
+ be_ifg_t *ifg = chordal_env->ifg;
+ void *iter = be_ifg_neighbours_iter_alloca(ifg);
+ ir_node *sub_res, *curr;
+
+ /*
+ * Try to color all conflicting nodes 'curr'
+ * with the color of the irn itself.
+ */
+ be_ifg_foreach_neighbour(ifg, iter, irn, curr) {
+ DBG((dbg, LEVEL_3, "\t Confl %+F(%d)\n", curr, qnode_get_new_color(qn, curr)));
+ if (qnode_get_new_color(qn, curr) == col && curr != trigger) {
+ sub_res = qnode_color_irn(qn, curr, irn_col, irn);
+ if (sub_res != CHANGE_SAVE) {
+ be_ifg_neighbours_break(ifg, iter);
+ return sub_res;