3 * File name: ir/ir/irtools.h
4 * Purpose: Some often needed tool-functions
9 * Copyright: (c) 1999-2005 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
15 #include "firm_config.h"
16 #include "firm_types.h"
19 #include <libcore/lc_opts.h>
20 lc_opt_entry_t *firm_opt_get_root(void);
25 #define MAX(x, y) ((x) > (y) ? (x) : (y))
26 #define MIN(x, y) ((x) < (y) ? (x) : (y))
29 * convert an integer into pointer
31 #define INT_TO_PTR(v) ((void *)((char *)0 + (v)))
34 * convert a pointer into an integer
36 #define PTR_TO_INT(v) ((int)((char *)(v) - (char *)0))
39 * The famous clear_link() walker-function.
40 * Do not implement it by yourself, use this one
42 void firm_clear_link(ir_node *n, void *env);
45 * Copies a node to a new irg. The Ins of the new node point to
46 * the predecessors on the old irg. n->link points to the new node.
48 * @param n The node to be copied
49 * @param irg the new irg
51 * Does NOT copy standard nodes like Start, End etc that are fixed
52 * in an irg. Instead, the corresponding nodes of the new irg are returned.
53 * Note further, that the new nodes have no block.
55 void copy_irn_to_irg(ir_node *n, ir_graph *irg);
57 #endif /* _IRTOOLS_H_ */