Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
c9d6913e
Commit
c9d6913e
authored
May 16, 2006
by
Michael Beck
Browse files
exact_copy() added
[r7742]
parent
d2dc2564
Changes
2
Hide whitespace changes
Inline
Side-by-side
ir/common/irtools.c
View file @
c9d6913e
...
...
@@ -23,13 +23,10 @@ void firm_clear_link(ir_node *n, void *env) {
set_irn_link
(
n
,
NULL
);
}
/*
*
/*
* Copies a node to a new irg. The Ins of the new node point to
* the predecessors on the old irg. n->link points to the new node.
*
* @param n The node to be copied
* @param irg the new irg
*
* Does NOT copy standard nodes like Start, End etc that are fixed
* in an irg. Instead, the corresponding nodes of the new irg are returned.
* Note further, that the new nodes have no block.
...
...
@@ -96,3 +93,31 @@ copy_irn_to_irg(ir_node *n, ir_graph *irg)
if
(
is_Block
(
nn
))
nn
->
attr
.
block
.
irg
=
irg
;
}
/*
* Creates an exact copy of a node.
* The copy resists on the sane graph in the same block.
*/
ir_node
*
exact_copy
(
ir_node
*
n
)
{
ir_graph
*
irg
=
get_irn_irg
(
n
);
ir_node
*
res
,
*
block
=
NULL
;
if
(
is_no_Block
(
n
))
block
=
get_irn_n
(
n
,
-
1
);
res
=
new_ir_node
(
get_irn_dbg_info
(
n
),
irg
,
block
,
get_irn_op
(
n
),
get_irn_mode
(
n
),
get_irn_arity
(
n
),
get_irn_in
(
n
)
+
1
);
/* 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
,
res
);
new_backedge_info
(
res
);
return
res
;
}
ir/common/irtools.h
View file @
c9d6913e
...
...
@@ -63,4 +63,15 @@ void firm_clear_link(ir_node *n, void *env);
*/
void
copy_irn_to_irg
(
ir_node
*
n
,
ir_graph
*
irg
);
/**
* Creates an exact copy of a node.
* The copy resists on the sane graph in the same block.
*
* @param n the node to copy
*
* @note If the copy is not changed, the next CSE operation will
* replace it by the original, so beware.
*/
ir_node
*
exact_copy
(
ir_node
*
n
);
#endif
/* _IRTOOLS_H_ */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment