X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firgmod.c;h=6a4039aad3d09ff6e69db6482bac5096e382f0e9;hb=8f355cb9b3d20c10f71d1b1e17cbf59a51ced83b;hp=882dfc1a4e79aa374cdc4e0947ea0b744cc98d76;hpb=fe18a7bd4cf2597dff6ca1a60a14a694b4d89615;p=libfirm diff --git a/ir/ir/irgmod.c b/ir/ir/irgmod.c index 882dfc1a4..6a4039aad 100644 --- a/ir/ir/irgmod.c +++ b/ir/ir/irgmod.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -52,13 +52,15 @@ void turn_into_tuple(ir_node *node, int arity) { if (get_irn_arity(node) == arity) { /* keep old array */ } else { - ir_node *block = get_nodes_block(node); - /* Allocate new array, don't free old in_array, it's on the obstack. */ + /* don't use get_nodes_block here, we allow turn_into_tuple for unpinned nodes */ + ir_node *block = get_irn_n(node, -1); edges_node_deleted(node, current_ir_graph); + /* Allocate new array, don't free old in_array, it's on the obstack. */ node->in = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity+1); /* clear the new in array, else edge_notify tries to delete garbage */ memset(node->in, 0, (arity+1) * sizeof(node->in[0])); - set_nodes_block(node, block); + /* set the block back */ + set_irn_n(node, -1, block); } } @@ -155,11 +157,20 @@ void collect_phiprojs(ir_graph *irg) { */ static void move(ir_node *node, ir_node *from_bl, ir_node *to_bl) { int i, arity; - ir_node *pred; - - /* move this node: Projs are moved automagically */ - if (! is_Proj(node)) - set_nodes_block(node, to_bl); + ir_node *proj, *pred; + + /* move this node */ + set_nodes_block(node, to_bl); + + /* move its projs */ + if (get_irn_mode(node) == mode_T) { + proj = get_irn_link(node); + while (proj) { + if (get_nodes_block(proj) == from_bl) + set_nodes_block(proj, to_bl); + proj = get_irn_link(proj); + } + } /* recursion ... */ if (get_irn_op(node) == op_Phi) return;