more
[libfirm] / ir / ir / iredges.h
1
2 /**
3  * Public header for the automatically updating outs.
4  * @author Sebastian Hack
5  * @date 3.2.2005
6  */
7
8 #ifndef _FIRM_EDGES_H
9 #define _FIRM_EDGES_H
10
11 #include "irnode.h"
12
13 /**
14  * Get the first edge pointing to some node.
15  * @note There is no order on out edges. First in this context only
16  * means, that you get some starting point into the list of edges.
17  * @param irn The node.
18  * @return The first out edge that points to this node.
19  */
20 const struct _ir_edge_t *(get_irn_out_edge_first)(const ir_node *irn);
21
22 /**
23  * Get the next edge in the out list of some node.
24  * @param irn The node.
25  * @param last The last out edge you have seen.
26  * @return The next out edge in @p irn 's out list after @p last.
27  */
28 const struct _ir_edge_t *(get_irn_out_edge_next)(const ir_node *irn,
29                 const struct _ir_edge_t *last);
30
31 /**
32  * A convenience iteration macro over all out edges of a node.
33  * @param irn The node.
34  * @param edge An @c ir_edge_t pointer which shall be set to the current
35  * edge.
36  */
37 #define foreach_out_edge(irn,edge) \
38         for(edge = get_irn_out_edge_first(irn); edge; edge = get_irn_out_edge_next(irn, edge))
39
40 /*
41  * Get the source node of an edge.
42  * @param edge The edge.
43  * @return The source node of that edge.
44  */
45 ir_node *(get_edge_src_irn)(const struct _ir_edge_t *edge);
46
47 /**
48  * Get the position of an edge.
49  * @param edge.
50  * @return The position in the in array of that edges source.
51  */
52 extern int (get_edge_src_pos)(const struct _ir_edge_t *edge);
53
54 extern int (edges_activated)(const ir_graph *irg);
55
56 extern void (edges_activate)(ir_graph *irg);
57
58 extern void (edges_deactivate)(ir_graph *irg);
59
60
61 #endif /* _FIRM_EDGES_H */