-/**
- * Copies the node to the new obstack. The Ins of the new node point to
- * the predecessors on the old obstack. For block/phi nodes not all
- * predecessors might be copied. n->link points to the new node.
- * For Phi and Block nodes the function allocates in-arrays with an arity
- * only for useful predecessors. The arity is determined by counting
- * the non-bad predecessors of the block.
- *
- * @param n The node to be copied
- * @param env if non-NULL, the node number attribute will be copied to the new node
- */
-void
-copy_irn (ir_node *n, void *env)
-{
- ir_graph *irg;
- ir_node *nn;
- int new_arity;
- irg = env;
- ir_op *op = get_irn_op(n);
- int copy_node_nr = 0;
-
- if(irg == NULL)
- irg = current_ir_graph;
-
- /* The end node looses it's flexible in array. This doesn't matter,
- as dead node elimination builds End by hand, inlineing doesn't use
- the End node. */
- /* assert(op == op_End || ((_ARR_DESCR(n->in))->cookie != ARR_F_MAGIC)); */
-
- if (op == op_Bad)
- /* node copied already */
- return;
-
- new_arity = get_irn_arity(n);
-
- nn = new_ir_node(get_irn_dbg_info(n),
- irg,
- NULL, /* no block yet, will be set later */
- op,
- get_irn_mode(n),
- new_arity,
- get_irn_in(n));
-
-
- /* Copy the attributes. These might point to additional data. If this
- was allocated on the old obstack the pointers now are dangling. This
- frees e.g. the memory of the graph_arr allocated in new_immBlock. */
- copy_node_attr(n, nn);
- new_backedge_info(nn);
- set_new_node(n, nn);
-
-#if DEBUG_libfirm
- if (copy_node_nr) {
- /* for easier debugging, we want to copy the node numbers too */
- nn->node_nr = n->node_nr;
- }
-#endif
-
-}