libFirm
Loading...
Searching...
No Matches
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
18#include "begin.h"
19
35 ir_edge_kind_t kind);
36
44FIRM_API const ir_edge_t *get_irn_out_edge_first(const ir_node *irn);
45
53FIRM_API const ir_edge_t *get_block_succ_first(const ir_node *block);
54
62FIRM_API const ir_edge_t *get_irn_out_edge_next(const ir_node *irn,
63 const ir_edge_t *last,
64 ir_edge_kind_t kind);
65
73#define foreach_out_edge_kind(irn, edge, kind) \
74 for (ir_edge_t const *edge = get_irn_out_edge_first_kind(irn, kind); edge; edge = get_irn_out_edge_next(irn, edge, kind))
75
84#define foreach_out_edge_kind_safe(irn, edge, kind) \
85 for (ir_edge_t const *edge = get_irn_out_edge_first_kind((irn), (kind)), *edge##__next; edge; edge = edge##__next) \
86 if (edge##__next = get_irn_out_edge_next((irn), edge, (kind)), 0) {} else
87
91#define foreach_out_edge(irn, edge) foreach_out_edge_kind(irn, edge, EDGE_KIND_NORMAL)
92
96#define foreach_out_edge_safe(irn, edge) foreach_out_edge_kind_safe(irn, edge, EDGE_KIND_NORMAL)
97
101#define foreach_block_succ(bl, edge) foreach_out_edge_kind(bl, edge, EDGE_KIND_BLOCK)
102
106#define foreach_block_succ_safe(bl, edge) foreach_out_edge_kind_safe(bl, edge, EDGE_KIND_BLOCK)
107
113FIRM_API ir_node *get_edge_src_irn(const ir_edge_t *edge);
114
120FIRM_API int get_edge_src_pos(const ir_edge_t *edge);
121
127FIRM_API int get_irn_n_edges_kind(const ir_node *irn, ir_edge_kind_t kind);
128
133FIRM_API int get_irn_n_edges(const ir_node *irn);
134
143FIRM_API int edges_activated_kind(const ir_graph *irg, ir_edge_kind_t kind);
144
150FIRM_API int edges_activated(const ir_graph *irg);
151
159
167
175FIRM_API void edges_reroute_kind(ir_node *old, ir_node *nw, ir_edge_kind_t kind);
176
183FIRM_API void edges_reroute(ir_node *old, ir_node *nw);
184
189FIRM_API void edges_reroute_except(ir_node *old, ir_node *nw,
190 ir_node *exception);
191
196FIRM_API int edges_verify(ir_graph *irg);
197
203
207FIRM_API void edges_init_dbg(int do_dbg);
208
216FIRM_API void edges_activate(ir_graph *irg);
217
224FIRM_API void edges_deactivate(ir_graph *irg);
225
231FIRM_API void assure_edges(ir_graph *irg);
232
239FIRM_API void assure_edges_kind(ir_graph *irg, ir_edge_kind_t kind);
240
250FIRM_API void irg_block_edges_walk(ir_node *block, irg_walk_func *pre,
251 irg_walk_func *post, void *env);
252
254FIRM_API void irg_walk_edges(ir_node *start, irg_walk_func *pre,
255 irg_walk_func *post, void *env);
256
259#include "end.h"
260
261#endif
int edges_activated_kind(const ir_graph *irg, ir_edge_kind_t kind)
Checks if the out edges are activated.
int get_edge_src_pos(const ir_edge_t *edge)
Returns the position of an edge.
void edges_deactivate_kind(ir_graph *irg, ir_edge_kind_t kind)
Deactivates the edges for an irg.
struct ir_edge_t ir_edge_t
Dynamic Reverse Edge.
Definition firm_types.h:62
void edges_reroute(ir_node *old, ir_node *nw)
Reroutes edges of EDGE_KIND_NORMAL from an old node to a new one.
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 assure_edges(ir_graph *irg)
Ensures that edges are activated.
int edges_activated(const ir_graph *irg)
Checks if out edges with EDG_KIND_NORMAL and EDGE_KIND_BLOCK are activated.
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...
void edges_deactivate(ir_graph *irg)
Deactivates data and block edges for an irg.
const ir_edge_t * get_block_succ_first(const ir_node *block)
Returns the first edge pointing to a successor block.
int edges_verify(ir_graph *irg)
Verifies the out edges of graph irg.
void assure_edges_kind(ir_graph *irg, ir_edge_kind_t kind)
Ensures that edges of a given kind are activated.
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:22
void irg_walk_edges(ir_node *start, irg_walk_func *pre, irg_walk_func *post, void *env)
Graph walker following EDGE_KIND_NORMAL edges.
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.
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.
ir_node * get_edge_src_irn(const ir_edge_t *edge)
Returns the source node of an edge.
void edges_init_dbg(int do_dbg)
Sets edge verification flag.
void edges_activate_kind(ir_graph *irg, ir_edge_kind_t kind)
Activates the edges for an irg.
const ir_edge_t * get_irn_out_edge_first(const ir_node *irn)
Returns the first edge pointing to some node.
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.
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.
int edges_verify_kind(ir_graph *irg, ir_edge_kind_t kind)
Verifies a certrain kind of out edges of graph irg.
void edges_activate(ir_graph *irg)
Activates data and block edges for an irg.
struct ir_graph ir_graph
Procedure Graph.
Definition firm_types.h:74
void irg_walk_func(ir_node *, void *)
type for graph-walk callbacks
Definition firm_types.h:97
struct ir_node ir_node
Procedure Graph Node.
Definition firm_types.h:53