3 * Public header for the automatically updating outs.
4 * @author Sebastian Hack
13 #ifndef _IR_EDGE_TYPEDEF_
14 #define _IR_EDGE_TYPEDEF_
15 typedef struct _ir_edge_t ir_edge_t;
18 #ifndef _IR_BLOCK_EDGE_TYPEDEF_
19 #define _IR_BLOCK_EDGE_TYPEDEF_
20 typedef struct _ir_block_edge_t ir_block_edge_t;
24 * Get the first edge pointing to some node.
25 * @note There is no order on out edges. First in this context only
26 * means, that you get some starting point into the list of edges.
27 * @param irn The node.
28 * @return The first out edge that points to this node.
30 const ir_edge_t *get_irn_out_edge_first(const ir_node *irn);
33 * Get the next edge in the out list of some node.
34 * @param irn The node.
35 * @param last The last out edge you have seen.
36 * @return The next out edge in @p irn 's out list after @p last.
38 const ir_edge_t *get_irn_out_edge_next(const ir_node *irn,
39 const ir_edge_t *last);
42 * A convenience iteration macro over all out edges of a node.
43 * @param irn The node.
44 * @param edge An @c ir_edge_t pointer which shall be set to the current
47 #define foreach_out_edge(irn,edge) \
48 for(edge = get_irn_out_edge_first(irn); edge; edge = get_irn_out_edge_next(irn, edge))
51 * A convenience iteration macro over all out edges of a node, which is safe
52 * against alteration of the current edge.
53 * @param irn The node.
54 * @param edge An @c ir_edge_t pointer which shall be set to the current
56 * @param ne The next edge, enables alteration safe erge processing.
58 #define foreach_out_edge_safe(irn,edge,ne) \
60 (edge) = (get_irn_out_edge_first(irn)), \
61 (ne) = ((edge) ? (get_irn_out_edge_next(irn, edge)) : NULL); \
63 (edge) = (ne), (ne) = ((edge) ? (get_irn_out_edge_next(irn, edge)) : NULL) \
68 * A convenience iteration macro for all control flow edges
69 * leaving a block, and thus are cf successor edges.
70 * @param bl The block.
71 * @param edge An @c ir_edge_t pointer which is set to the current edge.
73 #define foreach_block_succ(bl,edge) \
74 for(edge = get_block_succ_first(bl); edge; edge = get_block_succ_next(bl, edge))
77 * Get the source node of an edge.
78 * @param edge The edge.
79 * @return The source node of that edge.
81 ir_node *get_edge_src_irn(const ir_edge_t *edge);
84 * Get the number of edges pointing to a node.
85 * @param irn The node.
86 * @return The number of edges pointing to this node.
88 int get_irn_n_edges(const ir_node *irn);
91 * Get the position of an edge.
92 * @param edge The edge.
93 * @return The position in the in array of that edges source.
95 extern int get_edge_src_pos(const ir_edge_t *edge);
98 * Get the edge object of an outgoing edge at a node.
99 * @param irg The graph, the node is in.
100 * @param irn The node at which the edge originates.
101 * @param pos The position of the edge.
102 * @return The corresponding edge object or NULL,
103 * if no such edge exists.
105 const ir_edge_t *get_irn_edge(ir_graph *irg, const ir_node *irn, int pos);
108 * Check, if the out edges are activated.
109 * @param irg The graph.
110 * @return 1, if the edges are present for the given irg, 0 if not.
112 extern int edges_activated(const ir_graph *irg);
115 * Activate the edges for an irg.
116 * @param irg The graph to activate the edges for.
118 extern void edges_activate(ir_graph *irg);
121 * Deactivate the edges for an irg.
122 * @param irg The graph.
124 extern void edges_deactivate(ir_graph *irg);
126 #endif /* _FIRM_EDGES_H */