libFirm 1.20
|
00001 /* 00002 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. 00003 * 00004 * This file is part of libFirm. 00005 * 00006 * This file may be distributed and/or modified under the terms of the 00007 * GNU General Public License version 2 as published by the Free Software 00008 * Foundation and appearing in the file LICENSE.GPL included in the 00009 * packaging of this file. 00010 * 00011 * Licensees holding valid libFirm Professional Edition licenses may use 00012 * this file in accordance with the libFirm Commercial License. 00013 * Agreement provided with the Software. 00014 * 00015 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00017 * PURPOSE. 00018 */ 00019 00026 #ifndef FIRM_IR_IREDGES_H 00027 #define FIRM_IR_IREDGES_H 00028 00029 #include "firm_types.h" 00030 #include "iredgekinds.h" 00031 #include "begin.h" 00032 00047 FIRM_API const ir_edge_t *get_irn_out_edge_first_kind(const ir_node *irn, 00048 ir_edge_kind_t kind); 00049 00056 FIRM_API const ir_edge_t *get_irn_out_edge_next(const ir_node *irn, 00057 const ir_edge_t *last); 00058 00066 #define foreach_out_edge_kind(irn, edge, kind) \ 00067 for(edge = get_irn_out_edge_first_kind(irn, kind); edge; edge = get_irn_out_edge_next(irn, edge)) 00068 00078 #define foreach_out_edge_kind_safe(irn, edge, ne, kind) \ 00079 for((edge) = (get_irn_out_edge_first_kind(irn, kind)), (ne) = ((edge) ? (get_irn_out_edge_next(irn, edge)) : NULL); \ 00080 edge; (edge) = (ne), (ne) = ((edge) ? (get_irn_out_edge_next(irn, edge)) : NULL)) 00081 00085 #define foreach_out_edge(irn, edge) foreach_out_edge_kind(irn, edge, EDGE_KIND_NORMAL) 00086 00090 #define foreach_out_edge_safe(irn, edge, tmp) foreach_out_edge_kind_safe(irn, edge, tmp, EDGE_KIND_NORMAL) 00091 00095 #define foreach_block_succ(bl, edge) foreach_out_edge_kind(bl, edge, EDGE_KIND_BLOCK) 00096 00102 FIRM_API ir_node *get_edge_src_irn(const ir_edge_t *edge); 00103 00109 FIRM_API int get_edge_src_pos(const ir_edge_t *edge); 00110 00119 FIRM_API const ir_edge_t *get_irn_edge_kind(const ir_node *irn, 00120 int pos, ir_edge_kind_t kind); 00121 00127 FIRM_API int get_irn_n_edges_kind(const ir_node *irn, ir_edge_kind_t kind); 00128 00137 FIRM_API int edges_activated_kind(const ir_graph *irg, ir_edge_kind_t kind); 00138 00145 FIRM_API void edges_activate_kind(ir_graph *irg, ir_edge_kind_t kind); 00146 00153 FIRM_API void edges_deactivate_kind(ir_graph *irg, ir_edge_kind_t kind); 00154 00162 FIRM_API void edges_reroute_kind(ir_node *old, ir_node *nw, ir_edge_kind_t kind); 00163 00168 FIRM_API int edges_verify(ir_graph *irg); 00169 00174 FIRM_API int edges_verify_kind(ir_graph *irg, ir_edge_kind_t kind); 00175 00179 FIRM_API void edges_init_dbg(int do_dbg); 00180 00189 FIRM_API ir_graph_pass_t *irg_verify_edges_pass(const char *name, 00190 unsigned assert_on_problem); 00191 00193 #define edges_reroute(old, nw) edges_reroute_kind(old, nw, EDGE_KIND_NORMAL) 00194 00195 #define edges_activated(irg) (edges_activated_kind(irg, EDGE_KIND_NORMAL) && edges_activated_kind(irg, EDGE_KIND_BLOCK)) 00196 00197 #ifndef get_irn_n_edges 00198 00199 #define get_irn_n_edges(irn) get_irn_n_edges_kind(irn, EDGE_KIND_NORMAL) 00200 #endif 00201 00202 #ifndef get_irn_out_edge_first 00203 00204 #define get_irn_out_edge_first(irn) get_irn_out_edge_first_kind(irn, EDGE_KIND_NORMAL) 00205 #endif 00206 00207 #ifndef get_block_succ_first 00208 00209 #define get_block_succ_first(irn) get_irn_out_edge_first_kind(irn, EDGE_KIND_BLOCK) 00210 #endif 00211 00212 #ifndef get_block_succ_next 00213 00214 #define get_block_succ_next(irn, last) get_irn_out_edge_next(irn, last) 00215 #endif 00216 00224 FIRM_API void edges_activate(ir_graph *irg); 00225 00232 FIRM_API void edges_deactivate(ir_graph *irg); 00233 00241 FIRM_API int edges_assure(ir_graph *irg); 00242 00251 FIRM_API int edges_assure_kind(ir_graph *irg, ir_edge_kind_t kind); 00252 00262 FIRM_API void irg_block_edges_walk(ir_node *block, irg_walk_func *pre, 00263 irg_walk_func *post, void *env); 00264 00266 FIRM_API void irg_walk_edges(ir_node *start, irg_walk_func *pre, 00267 irg_walk_func *post, void *env); 00268 00278 FIRM_API void edges_reset_private_data(ir_graph *irg, int offset, 00279 unsigned size); 00280 00283 #include "end.h" 00284 00285 #endif