copy_irn_to_irg() added
[libfirm] / ir / common / irtools.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ir/irtools.h
4  * Purpose:     Some often needed tool-functions
5  * Author:      Michael Beck
6  * Modified by:
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1999-2005 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12 #ifndef _IRTOOLS_H_
13 #define _IRTOOLS_H_
14
15 #include "firm_config.h"
16 #include "firm_types.h"
17
18 #ifdef WITH_LIBCORE
19 #include <libcore/lc_opts.h>
20 lc_opt_entry_t *firm_opt_get_root(void);
21 #endif
22
23 /**
24  * convert an integer into pointer
25  */
26 #define INT_TO_PTR(v)   ((void *)((char *)0 + (v)))
27
28 /**
29  * convert a pointer into an integer
30  */
31 #define PTR_TO_INT(v)   ((int)((char *)(v) - (char *)0))
32
33 /**
34  * The famous clear_link() walker-function.
35  * Do not implement it by yourself, use this one
36  */
37 void firm_clear_link(ir_node *n, void *env);
38
39 /**
40  * Copies a node to a new irg. The Ins of the new node point to
41  * the predecessors on the old irg.  n->link points to the new node.
42  *
43  * @param n    The node to be copied
44  * @param irg  the new irg
45  *
46  * Does NOT copy standard nodes like Start, End etc that are fixed
47  * in an irg. Instead, the corresponding nodes of the new irg are returned.
48  * Note further, that the new nodes have no block.
49  */
50 void copy_irn_to_irg(ir_node *n, ir_graph *irg);
51
52 #endif /* _IRTOOLS_H_ */