Commit c89e74c6 authored by Matthias Braun's avatar Matthias Braun
Browse files

iredges: introduce new reroute_edges_except

I expect this to be a common pattern
parent 8c9aa24a
......@@ -161,6 +161,13 @@ FIRM_API void edges_deactivate_kind(ir_graph *irg, ir_edge_kind_t kind);
*/
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
......
......@@ -657,6 +657,18 @@ void edges_reroute_kind(ir_node *from, ir_node *to, ir_edge_kind_t kind)
}
}
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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment