summaryrefslogtreecommitdiffhomepage
path: root/ir/ir
diff options
context:
space:
mode:
authorAndreas Fried <andreas.fried@kit.edu>2019-01-16 17:00:50 +0100
committerAndreas Fried <andreas.fried@kit.edu>2019-01-16 17:00:50 +0100
commit3f5234329d260277bdfb3f83ff92196bdc87470f (patch)
tree3dd668d1893605f37d17d6049aec5ea5f811557c /ir/ir
parentbb6b635fd5ce53dedf5a574df72e258077841ac7 (diff)
Move irn_copy_into_irg and exact_copy into the public interface.
Diffstat (limited to 'ir/ir')
-rw-r--r--ir/ir/irnode.c21
-rw-r--r--ir/ir/irtools.c21
-rw-r--r--ir/ir/irtools.h16
3 files changed, 21 insertions, 37 deletions
diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c
index 28185c3..585436c 100644
--- a/ir/ir/irnode.c
+++ b/ir/ir/irnode.c
@@ -134,6 +134,27 @@ ir_node *new_similar_node(ir_node *const old, ir_node *const block, ir_node **co
return n;
}
+ir_node *irn_copy_into_irg(const ir_node *node, ir_graph *irg)
+{
+ ir_op *op = get_irn_op(node);
+ ir_node *block = op != op_Block ? get_nodes_block(node) : NULL;
+ dbg_info *dbgi = get_irn_dbg_info(node);
+ ir_mode *mode = get_irn_mode(node);
+ ir_node **ins = get_irn_in(node);
+ int arity = get_irn_arity(node);
+ ir_node *res = new_ir_node(dbgi, irg, block, op, mode, arity, ins);
+
+ /* copy the attributes */
+ copy_node_attr(irg, node, res);
+
+ return res;
+}
+
+ir_node *exact_copy(const ir_node *node)
+{
+ return irn_copy_into_irg(node, get_irn_irg(node));
+}
+
int (get_irn_arity)(const ir_node *node)
{
return get_irn_arity_(node);
diff --git a/ir/ir/irtools.c b/ir/ir/irtools.c
index c307e74..2e201cf 100644
--- a/ir/ir/irtools.c
+++ b/ir/ir/irtools.c
@@ -49,27 +49,6 @@ void firm_collect_block_phis(ir_node *node, void *env)
add_Block_phi(get_nodes_block(node), node);
}
-ir_node *irn_copy_into_irg(const ir_node *node, ir_graph *irg)
-{
- ir_op *op = get_irn_op(node);
- ir_node *block = op != op_Block ? get_nodes_block(node) : NULL;
- dbg_info *dbgi = get_irn_dbg_info(node);
- ir_mode *mode = get_irn_mode(node);
- ir_node **ins = get_irn_in(node);
- int arity = get_irn_arity(node);
- ir_node *res = new_ir_node(dbgi, irg, block, op, mode, arity, ins);
-
- /* copy the attributes */
- copy_node_attr(irg, node, res);
-
- return res;
-}
-
-ir_node *exact_copy(const ir_node *node)
-{
- return irn_copy_into_irg(node, get_irn_irg(node));
-}
-
static ir_node *get_new_node(const ir_node *old_node)
{
return (ir_node*) get_irn_link(old_node);
diff --git a/ir/ir/irtools.h b/ir/ir/irtools.h
index b4db9b2..a148488 100644
--- a/ir/ir/irtools.h
+++ b/ir/ir/irtools.h
@@ -49,22 +49,6 @@ void firm_clear_block_phis(ir_node *node, void *env);
void firm_collect_block_phis(ir_node *node, void *env);
/**
- * Creates an exact copy of a node with same inputs and attributes in the
- * same block. The copied node will not be optimized (so no CSE is performed).
- *
- * @param node the node to copy
- */
-ir_node *exact_copy(const ir_node *node);
-
-/**
- * Create an exact copy of a node with same inputs and attributes in the same
- * block but puts the node on a graph which might be different than the graph
- * of the original node.
- * Note: You have to fixup the inputs/block later
- */
-ir_node *irn_copy_into_irg(const ir_node *node, ir_graph *irg);
-
-/**
* This is a helper function used by some routines copying irg graphs
* This assumes that we have "old" nodes which have been copied to "new"
* nodes; The inputs of the new nodes still point to old nodes.