I expect this to be a common pattern
*/
FIRM_API void edges_reroute_kind(ir_node *old, ir_node *nw, ir_edge_kind_t kind);
+/**
+ * reroutes (normal) edges from an old node to a new node, except for the
+ * @p exception which keeps its input even if it is old.
+ */
+FIRM_API void edges_reroute_except(ir_node *old, ir_node *nw,
+ ir_node *exception);
+
/**
* Verifies the out edges of graph @p irg.
* @return 1 if a problem was found, 0 otherwise
}
}
+void edges_reroute_except(ir_node *from, ir_node *to, ir_node *exception)
+{
+ const ir_edge_t *edge;
+ const ir_edge_t *next;
+ foreach_out_edge_safe(from, edge, next) {
+ ir_node *src = get_edge_src_irn(edge);
+ if (src == exception)
+ continue;
+ set_irn_n(src, edge->pos, to);
+ }
+}
+
static void verify_set_presence(ir_node *irn, void *data)
{
build_walker *w = (build_walker*)data;