libFirm
Dynamic Reverse Edges

Macros

#define foreach_out_edge_kind(irn, edge, kind)   for (ir_edge_t const *edge = get_irn_out_edge_first_kind(irn, kind); edge; edge = get_irn_out_edge_next(irn, edge, kind))
 A convenience iteration macro over all out edges of a node. More...
 
#define foreach_out_edge_kind_safe(irn, edge, kind)
 A convenience iteration macro over all out edges of a node, which is safe against alteration of the current edge. More...
 
#define foreach_out_edge(irn, edge)   foreach_out_edge_kind(irn, edge, EDGE_KIND_NORMAL)
 Convenience macro for normal out edges. More...
 
#define foreach_out_edge_safe(irn, edge)   foreach_out_edge_kind_safe(irn, edge, EDGE_KIND_NORMAL)
 Convenience macro for normal out edges. More...
 
#define foreach_block_succ(bl, edge)   foreach_out_edge_kind(bl, edge, EDGE_KIND_BLOCK)
 A convenience iteration macro for all control flow edges. More...
 
#define foreach_block_succ_safe(bl, edge)   foreach_out_edge_kind_safe(bl, edge, EDGE_KIND_BLOCK)
 A convenience iteration macro for all control flow edges. More...
 

Typedefs

typedef struct ir_edge_t ir_edge_t
 Dynamic Reverse Edge. More...
 

Enumerations

enum  ir_edge_kind_t { EDGE_KIND_NORMAL, EDGE_KIND_FIRST = EDGE_KIND_NORMAL, EDGE_KIND_BLOCK, EDGE_KIND_LAST = EDGE_KIND_BLOCK }
 Supported Edge kinds. More...
 

Functions

const ir_edge_tget_irn_out_edge_first_kind (const ir_node *irn, ir_edge_kind_t kind)
 Returns the first edge pointing to some node. More...
 
const ir_edge_tget_irn_out_edge_first (const ir_node *irn)
 Returns the first edge pointing to some node. More...
 
const ir_edge_tget_block_succ_first (const ir_node *block)
 Returns the first edge pointing to a successor block. More...
 
const ir_edge_tget_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. More...
 
ir_nodeget_edge_src_irn (const ir_edge_t *edge)
 Returns the source node of an edge. More...
 
int get_edge_src_pos (const ir_edge_t *edge)
 Returns the position of an edge. More...
 
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. More...
 
int get_irn_n_edges (const ir_node *irn)
 Returns the number of registered out edges with EDGE_KIND_NORMAL. More...
 
int edges_activated_kind (const ir_graph *irg, ir_edge_kind_t kind)
 Checks if the out edges are activated. More...
 
int edges_activated (const ir_graph *irg)
 Checks if out edges with EDG_KIND_NORMAL and EDGE_KIND_BLOCK are activated. More...
 
void edges_activate_kind (ir_graph *irg, ir_edge_kind_t kind)
 Activates the edges for an irg. More...
 
void edges_deactivate_kind (ir_graph *irg, ir_edge_kind_t kind)
 Deactivates the edges for an irg. More...
 
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. More...
 
void edges_reroute (ir_node *old, ir_node *nw)
 Reroutes edges of EDGE_KIND_NORMAL from an old node to a new one. More...
 
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 input even if it is old. More...
 
int edges_verify (ir_graph *irg)
 Verifies the out edges of graph irg. More...
 
int edges_verify_kind (ir_graph *irg, ir_edge_kind_t kind)
 Verifies a certrain kind of out edges of graph irg. More...
 
void edges_init_dbg (int do_dbg)
 Sets edge verification flag. More...
 
void edges_activate (ir_graph *irg)
 Activates data and block edges for an irg. More...
 
void edges_deactivate (ir_graph *irg)
 Deactivates data and block edges for an irg. More...
 
void assure_edges (ir_graph *irg)
 Ensures that edges are activated. More...
 
void assure_edges_kind (ir_graph *irg, ir_edge_kind_t kind)
 Ensures that edges of a given kind are activated. More...
 
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. More...
 
void irg_walk_edges (ir_node *start, irg_walk_func *pre, irg_walk_func *post, void *env)
 Graph walker following EDGE_KIND_NORMAL edges. More...
 

Detailed Description

Macro Definition Documentation

◆ foreach_block_succ

#define foreach_block_succ (   bl,
  edge 
)    foreach_out_edge_kind(bl, edge, EDGE_KIND_BLOCK)

A convenience iteration macro for all control flow edges.

Definition at line 101 of file iredges.h.

◆ foreach_block_succ_safe

#define foreach_block_succ_safe (   bl,
  edge 
)    foreach_out_edge_kind_safe(bl, edge, EDGE_KIND_BLOCK)

A convenience iteration macro for all control flow edges.

Definition at line 106 of file iredges.h.

◆ foreach_out_edge

#define foreach_out_edge (   irn,
  edge 
)    foreach_out_edge_kind(irn, edge, EDGE_KIND_NORMAL)

Convenience macro for normal out edges.

Definition at line 91 of file iredges.h.

◆ foreach_out_edge_kind

#define foreach_out_edge_kind (   irn,
  edge,
  kind 
)    for (ir_edge_t const *edge = get_irn_out_edge_first_kind(irn, kind); edge; edge = get_irn_out_edge_next(irn, edge, kind))

A convenience iteration macro over all out edges of a node.

Parameters
irnThe node.
kindThe edge's kind.
edgeAn ir_edge_t pointer which shall be set to the current edge.

Definition at line 73 of file iredges.h.

◆ foreach_out_edge_kind_safe

#define foreach_out_edge_kind_safe (   irn,
  edge,
  kind 
)
Value:
for (ir_edge_t const *edge = get_irn_out_edge_first_kind((irn), (kind)), *edge##__next; edge; edge = edge##__next) \
if (edge##__next = get_irn_out_edge_next((irn), edge, (kind)), 0) {} else
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.
struct ir_edge_t ir_edge_t
Dynamic Reverse Edge.
Definition: firm_types.h:62
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.

A convenience iteration macro over all out edges of a node, which is safe against alteration of the current edge.

Parameters
irnThe node.
edgeAn ir_edge_t pointer which shall be set to the current edge.
kindThe kind of the edge.

Definition at line 84 of file iredges.h.

◆ foreach_out_edge_safe

#define foreach_out_edge_safe (   irn,
  edge 
)    foreach_out_edge_kind_safe(irn, edge, EDGE_KIND_NORMAL)

Convenience macro for normal out edges.

Definition at line 96 of file iredges.h.

Typedef Documentation

◆ ir_edge_t

typedef struct ir_edge_t ir_edge_t

Dynamic Reverse Edge.

Definition at line 62 of file firm_types.h.

Enumeration Type Documentation

◆ ir_edge_kind_t

Supported Edge kinds.

Enumerator
EDGE_KIND_NORMAL 

Normal data flow edges.

EDGE_KIND_FIRST 
EDGE_KIND_BLOCK 

Block to Block control flow edges.

EDGE_KIND_LAST 

Definition at line 22 of file iredgekinds.h.

Function Documentation

◆ assure_edges()

void assure_edges ( ir_graph irg)

Ensures that edges are activated.

Parameters
irgthe IR graph

◆ assure_edges_kind()

void assure_edges_kind ( ir_graph irg,
ir_edge_kind_t  kind 
)

Ensures that edges of a given kind are activated.

Parameters
irgthe IR graph
kindthe edge kind

◆ edges_activate()

void edges_activate ( ir_graph irg)

Activates data and block edges for an irg.

If the irg phase is phase_backend, Dependence edges are additionally activated.

Parameters
irgThe graph to activate the edges for.

◆ edges_activate_kind()

void edges_activate_kind ( ir_graph irg,
ir_edge_kind_t  kind 
)

Activates the edges for an irg.

Parameters
irgThe graph to activate the edges for.
kindThe edge kind.

◆ edges_activated()

int edges_activated ( const ir_graph irg)

Checks if out edges with EDG_KIND_NORMAL and EDGE_KIND_BLOCK are activated.

Parameters
irgThe graph.
Returns
1, if the edges are present for the given irg, 0 if not.

◆ edges_activated_kind()

int edges_activated_kind ( const ir_graph irg,
ir_edge_kind_t  kind 
)

Checks if the out edges are activated.

Parameters
irgThe graph.
kindThe edge kind.
Returns
1, if the edges are present for the given irg, 0 if not.

◆ edges_deactivate()

void edges_deactivate ( ir_graph irg)

Deactivates data and block edges for an irg.

If the irg phase is phase_backend, Dependence edges are additionally deactivated.

Parameters
irgThe graph.

◆ edges_deactivate_kind()

void edges_deactivate_kind ( ir_graph irg,
ir_edge_kind_t  kind 
)

Deactivates the edges for an irg.

Parameters
irgThe graph.
kindThe edge kind.

◆ edges_init_dbg()

void edges_init_dbg ( int  do_dbg)

Sets edge verification flag.

◆ edges_reroute()

void edges_reroute ( ir_node old,
ir_node nw 
)

Reroutes edges of EDGE_KIND_NORMAL from an old node to a new one.

Parameters
oldthe old node
nwthe new node

◆ edges_reroute_except()

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 input even if it is old.

◆ edges_reroute_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.

Parameters
oldthe old node
nwthe new node
kindthe edge kind

◆ edges_verify()

int edges_verify ( ir_graph irg)

Verifies the out edges of graph irg.

Returns
0 if a problem was found

◆ edges_verify_kind()

int edges_verify_kind ( ir_graph irg,
ir_edge_kind_t  kind 
)

Verifies a certrain kind of out edges of graph irg.

Returns
0 if a problem was found

◆ get_block_succ_first()

const ir_edge_t* get_block_succ_first ( const ir_node block)

Returns the first edge pointing to a successor block.

You can navigate the list with the usual get_irn_out_edge_next().

Parameters
blockthe Block
Returns
first block successor edge

◆ get_edge_src_irn()

ir_node* get_edge_src_irn ( const ir_edge_t edge)

Returns the source node of an edge.

Parameters
edgeThe edge.
Returns
The source node of that edge.

◆ get_edge_src_pos()

int get_edge_src_pos ( const ir_edge_t edge)

Returns the position of an edge.

Parameters
edgeThe edge.
Returns
The position in the in array of that edges source.

◆ get_irn_n_edges()

int get_irn_n_edges ( const ir_node irn)

Returns the number of registered out edges with EDGE_KIND_NORMAL.

Parameters
irnThe node.

◆ get_irn_n_edges_kind()

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.

Parameters
irnThe node.
kindThe kind.

◆ get_irn_out_edge_first()

const ir_edge_t* get_irn_out_edge_first ( const ir_node irn)

Returns the first edge pointing to some node.

Note
There is no order on out edges. First in this context only means, that you get some starting point into the list of edges.
Parameters
irnThe node.
Returns
The first out edge that points to this node.

◆ get_irn_out_edge_first_kind()

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.

Note
There is no order on out edges. First in this context only means, that you get some starting point into the list of edges.
Parameters
irnThe node.
kindThe kind of the edge.
Returns
The first out edge that points to this node.

◆ get_irn_out_edge_next()

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.

Parameters
irnThe node.
lastThe last out edge you have seen.
kindthe kind of edge that are iterated
Returns
The next out edge in irn 's out list after last.

◆ irg_block_edges_walk()

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.

Uses the block visited flag, so that it can be interleaved with another walker.

Parameters
blockthe start block
prethe pre visit function
postthe post visit function
envthe environment for the walker

◆ irg_walk_edges()

void irg_walk_edges ( ir_node start,
irg_walk_func pre,
irg_walk_func post,
void *  env 
)

Graph walker following EDGE_KIND_NORMAL edges.