libFirm
iredges.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19 
26 #ifndef FIRM_IR_IREDGES_H
27 #define FIRM_IR_IREDGES_H
28 
29 #include "firm_types.h"
30 #include "iredgekinds.h"
31 #include "begin.h"
32 
48  ir_edge_kind_t kind);
49 
57  const ir_edge_t *last);
58 
66 #define foreach_out_edge_kind(irn, edge, kind) \
67  for (ir_edge_t const *edge = get_irn_out_edge_first_kind(irn, kind); edge; edge = get_irn_out_edge_next(irn, edge))
68 
77 #define foreach_out_edge_kind_safe(irn, edge, kind) \
78  for (ir_edge_t const *edge = get_irn_out_edge_first_kind((irn), (kind)), *edge##__next; \
79  edge ? edge##__next = get_irn_out_edge_next((irn), edge), 1 : (edge##__next = NULL, 0); \
80  edge = edge##__next)
81 
85 #define foreach_out_edge(irn, edge) foreach_out_edge_kind(irn, edge, EDGE_KIND_NORMAL)
86 
90 #define foreach_out_edge_safe(irn, edge) foreach_out_edge_kind_safe(irn, edge, EDGE_KIND_NORMAL)
91 
95 #define foreach_block_succ(bl, edge) foreach_out_edge_kind(bl, edge, EDGE_KIND_BLOCK)
96 
103 
109 FIRM_API int get_edge_src_pos(const ir_edge_t *edge);
110 
117 
127 
135 
143 
152 
158  ir_node *exception);
159 
164 FIRM_API int edges_verify(ir_graph *irg);
165 
171 
175 FIRM_API void edges_init_dbg(int do_dbg);
176 
186  unsigned assert_on_problem);
187 
189 #define edges_reroute(old, nw) edges_reroute_kind(old, nw, EDGE_KIND_NORMAL)
190 
191 #define edges_activated(irg) (edges_activated_kind(irg, EDGE_KIND_NORMAL) && edges_activated_kind(irg, EDGE_KIND_BLOCK))
192 
193 #ifndef get_irn_n_edges
194 
195 #define get_irn_n_edges(irn) get_irn_n_edges_kind(irn, EDGE_KIND_NORMAL)
196 #endif
197 
198 #ifndef get_irn_out_edge_first
199 
200 #define get_irn_out_edge_first(irn) get_irn_out_edge_first_kind(irn, EDGE_KIND_NORMAL)
201 #endif
202 
203 #ifndef get_block_succ_first
204 
205 #define get_block_succ_first(irn) get_irn_out_edge_first_kind(irn, EDGE_KIND_BLOCK)
206 #endif
207 
208 #ifndef get_block_succ_next
209 
210 #define get_block_succ_next(irn, last) get_irn_out_edge_next(irn, last)
211 #endif
212 
220 FIRM_API void edges_activate(ir_graph *irg);
221 
229 
235 FIRM_API void assure_edges(ir_graph *irg);
236 
244 
255  irg_walk_func *post, void *env);
256 
258 FIRM_API void irg_walk_edges(ir_node *start, irg_walk_func *pre,
259  irg_walk_func *post, void *env);
260 
270 FIRM_API void edges_reset_private_data(ir_graph *irg, int offset,
271  unsigned size);
272 
275 #include "end.h"
276 
277 #endif