libFirm
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
iredges.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5 
12 #ifndef FIRM_IR_IREDGES_H
13 #define FIRM_IR_IREDGES_H
14 
15 #include "firm_types.h"
16 #include "iredgekinds.h"
17 #include "begin.h"
18 
33 FIRM_API const ir_edge_t *get_irn_out_edge_first_kind(const ir_node *irn,
34  ir_edge_kind_t kind);
35 
43 FIRM_API const ir_edge_t *get_irn_out_edge_first(const ir_node *irn);
44 
52 FIRM_API const ir_edge_t *get_block_succ_first(const ir_node *block);
53 
61 FIRM_API const ir_edge_t *get_irn_out_edge_next(const ir_node *irn,
62  const ir_edge_t *last,
63  ir_edge_kind_t kind);
64 
72 #define foreach_out_edge_kind(irn, edge, kind) \
73  for (ir_edge_t const *edge = get_irn_out_edge_first_kind(irn, kind); edge; edge = get_irn_out_edge_next(irn, edge, kind))
74 
83 #define foreach_out_edge_kind_safe(irn, edge, kind) \
84  for (ir_edge_t const *edge = get_irn_out_edge_first_kind((irn), (kind)), *edge##__next; edge; edge = edge##__next) \
85  if (edge##__next = get_irn_out_edge_next((irn), edge, (kind)), 0) {} else
86 
90 #define foreach_out_edge(irn, edge) foreach_out_edge_kind(irn, edge, EDGE_KIND_NORMAL)
91 
95 #define foreach_out_edge_safe(irn, edge) foreach_out_edge_kind_safe(irn, edge, EDGE_KIND_NORMAL)
96 
100 #define foreach_block_succ(bl, edge) foreach_out_edge_kind(bl, edge, EDGE_KIND_BLOCK)
101 
107 FIRM_API ir_node *get_edge_src_irn(const ir_edge_t *edge);
108 
114 FIRM_API int get_edge_src_pos(const ir_edge_t *edge);
115 
121 FIRM_API int get_irn_n_edges_kind(const ir_node *irn, ir_edge_kind_t kind);
122 
127 FIRM_API int get_irn_n_edges(const ir_node *irn);
128 
137 FIRM_API int edges_activated_kind(const ir_graph *irg, ir_edge_kind_t kind);
138 
144 FIRM_API int edges_activated(const ir_graph *irg);
145 
152 FIRM_API void edges_activate_kind(ir_graph *irg, ir_edge_kind_t kind);
153 
160 FIRM_API void edges_deactivate_kind(ir_graph *irg, ir_edge_kind_t kind);
161 
169 FIRM_API void edges_reroute_kind(ir_node *old, ir_node *nw, ir_edge_kind_t kind);
170 
177 FIRM_API void edges_reroute(ir_node *old, ir_node *nw);
178 
183 FIRM_API void edges_reroute_except(ir_node *old, ir_node *nw,
184  ir_node *exception);
185 
190 FIRM_API int edges_verify(ir_graph *irg);
191 
196 FIRM_API int edges_verify_kind(ir_graph *irg, ir_edge_kind_t kind);
197 
201 FIRM_API void edges_init_dbg(int do_dbg);
202 
210 FIRM_API void edges_activate(ir_graph *irg);
211 
218 FIRM_API void edges_deactivate(ir_graph *irg);
219 
225 FIRM_API void assure_edges(ir_graph *irg);
226 
233 FIRM_API void assure_edges_kind(ir_graph *irg, ir_edge_kind_t kind);
234 
244 FIRM_API void irg_block_edges_walk(ir_node *block, irg_walk_func *pre,
245  irg_walk_func *post, void *env);
246 
248 FIRM_API void irg_walk_edges(ir_node *start, irg_walk_func *pre,
249  irg_walk_func *post, void *env);
250 
253 #include "end.h"
254 
255 #endif
void edges_activate_kind(ir_graph *irg, ir_edge_kind_t kind)
Activates the edges for an irg.
void edges_reroute(ir_node *old, ir_node *nw)
Reroutes edges of EDGE_KIND_NORMAL from an old node to a new one.
void edges_deactivate(ir_graph *irg)
Deactivates data and block edges for an irg.
ir_node * get_edge_src_irn(const ir_edge_t *edge)
Returns the source node of an edge.
void edges_reroute_kind(ir_node *old, ir_node *nw, ir_edge_kind_t kind)
Reroutes edges of a specified kind from an old node to a new one.
const ir_edge_t * get_irn_out_edge_next(const ir_node *irn, const ir_edge_t *last, ir_edge_kind_t kind)
Returns the next edge in the out list of some node.
struct ir_graph ir_graph
Procedure Graph.
Definition: firm_types.h:74
int get_irn_n_edges(const ir_node *irn)
Returns the number of registered out edges with EDGE_KIND_NORMAL.
ir_edge_kind_t
Supported Edge kinds.
Definition: iredgekinds.h:20
void edges_activate(ir_graph *irg)
Activates data and block edges for an irg.
int get_edge_src_pos(const ir_edge_t *edge)
Returns the position of an edge.
struct ir_edge_t ir_edge_t
Dynamic Reverse Edge.
Definition: firm_types.h:62
int edges_verify_kind(ir_graph *irg, ir_edge_kind_t kind)
Verifies a certrain kind of out edges of graph irg.
const ir_edge_t * get_block_succ_first(const ir_node *block)
Returns the first edge pointing to a successor block.
void edges_reroute_except(ir_node *old, ir_node *nw, ir_node *exception)
reroutes (normal) edges from an old node to a new node, except for the exception node which keeps its...
int edges_activated_kind(const ir_graph *irg, ir_edge_kind_t kind)
Checks if the out edges are activated.
void edges_deactivate_kind(ir_graph *irg, ir_edge_kind_t kind)
Deactivates the edges for an irg.
void assure_edges_kind(ir_graph *irg, ir_edge_kind_t kind)
Ensures that edges of a given kind are activated.
const ir_edge_t * get_irn_out_edge_first_kind(const ir_node *irn, ir_edge_kind_t kind)
Returns the first edge pointing to some node.
const ir_edge_t * get_irn_out_edge_first(const ir_node *irn)
Returns the first edge pointing to some node.
void irg_walk_edges(ir_node *start, irg_walk_func *pre, irg_walk_func *post, void *env)
Graph walker following EDGE_KIND_NORMAL edges.
void assure_edges(ir_graph *irg)
Ensures that edges are activated.
int edges_verify(ir_graph *irg)
Verifies the out edges of graph irg.
void irg_block_edges_walk(ir_node *block, irg_walk_func *pre, irg_walk_func *post, void *env)
Walks only over Block nodes in the graph.
void irg_walk_func(ir_node *, void *)
type for graph-walk callbacks
Definition: firm_types.h:94
void edges_init_dbg(int do_dbg)
Sets edge verification flag.
struct ir_node ir_node
Procedure Graph Node.
Definition: firm_types.h:53
int get_irn_n_edges_kind(const ir_node *irn, ir_edge_kind_t kind)
Returns the number of registered out edges for a specific kind.
int edges_activated(const ir_graph *irg)
Checks if out edges with EDG_KIND_NORMAL and EDGE_KIND_BLOCK are activated.