X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fir%2Firgmod.c;h=be77a7ab7095781e23002adf50ea0a4e2edc474b;hb=bd019d8cd785c1a433c19dee44bf3f9e82397286;hp=51391c78c0ba4413137967d6618da3fda249de2a;hpb=6f068af98daa4725d60e5d23a8f98ec2841cfa44;p=libfirm diff --git a/ir/ir/irgmod.c b/ir/ir/irgmod.c index 51391c78c..be77a7ab7 100644 --- a/ir/ir/irgmod.c +++ b/ir/ir/irgmod.c @@ -21,7 +21,6 @@ * @file * @brief Support for ir graph modification. * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier - * @version $Id$ */ #include "config.h" @@ -112,6 +111,10 @@ void exchange(ir_node *old, ir_node *nw) old->in[0] = block; old->in[1] = nw; } + + /* update irg flags */ + clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS + | IR_GRAPH_STATE_CONSISTENT_LOOPINFO); } /*--------------------------------------------------------------------*/ @@ -185,6 +188,22 @@ static void move(ir_node *node, ir_node *from_bl, ir_node *to_bl) } } +static void move_projs(const ir_node *node, ir_node *to_bl) +{ + const ir_edge_t *edge; + + if (get_irn_mode(node) != mode_T) + return; + + foreach_out_edge(node, edge) { + ir_node *proj = get_edge_src_irn(edge); + if (!is_Proj(proj)) + continue; + set_nodes_block(proj, to_bl); + move_projs(proj, to_bl); + } +} + /** * Moves node and all predecessors of node from from_bl to to_bl. * Does not move predecessors of Phi nodes (or block nodes). @@ -197,13 +216,7 @@ static void move_edges(ir_node *node, ir_node *from_bl, ir_node *to_bl) set_nodes_block(node, to_bl); /* move its Projs */ - if (get_irn_mode(node) == mode_T) { - const ir_edge_t *edge; - foreach_out_edge(node, edge) { - ir_node *proj = get_edge_src_irn(edge); - set_nodes_block(proj, to_bl); - } - } + move_projs(node, to_bl); /* We must not move predecessors of Phi nodes, even if they are in * from_bl. (because these are values from an earlier loop iteration