1 /* Copyright (C) 2002 by Universitaet Karlsruhe
8 * Implements Def-Use edges, also called outedges.
10 * @author Goetz Lindenmaier
12 * @todo eventually add reverse conrtol flow graph. (If needed.)
23 /*------------------------------------------------------------------*/
24 /* Accessing the out datastructures. */
25 /* These routines only work properly if the ir_graph is in state */
26 /* outs_consistent or outs_inconsistent. */
27 /*------------------------------------------------------------------*/
29 /** To iterate through the successors iterate from 0 to i < get_irn_outs(). No
30 order of successors guaranteed. Will return edges from block to floating
31 nodes even if irgraph is in state "floats". */
32 /* returns the number of successors of the node: */
33 int get_irn_n_outs (ir_node *node);
35 /** Get predecessor n */
36 INLINE ir_node *get_irn_out (ir_node *node, int pos);
38 /** Set predecessor n */
39 INLINE void set_irn_out (ir_node *node, int pos, ir_node *out);
41 /* Methods to iterate through the control flow graph. Iterate from 0 to
42 i < get_Block_cfg_outs(block). No order of successors guaranteed. */
43 int get_Block_n_cfg_outs (ir_node *node);
45 /** Access predecessor n. */
46 INLINE ir_node *get_Block_cfg_out (ir_node *node, int pos);
48 #ifndef _IRG_WALK_FUNC_TYPEDEF_
49 #define _IRG_WALK_FUNC_TYPEDEF_
50 /** The type of the walk function */
51 typedef void irg_walk_func(ir_node *, void *);
54 /** Walks over the graph starting at node. Walks also if graph is in state
55 "outs_inconsistent". Assumes current_ir_graph is set properly. */
56 void irg_out_walk(ir_node *node,
57 irg_walk_func *pre, irg_walk_func *post,
60 /** Walks only over Block nodes in the graph. Has it's own visited
61 flag, so that it can be interleaved with the other walker.
62 node must be either op_Block or mode_X. */
63 void irg_out_block_walk(ir_node *node,
64 irg_walk_func *pre, irg_walk_func *post,
67 /*------------------------------------------------------------------*/
68 /* Building and Removing the out datastructure */
69 /*------------------------------------------------------------------*/
71 /** Computes the out edges. Sets a flag in irg to "outs_consistent". If the
72 graph is changed this flag must be set to "outs_inconsistent". Computes
73 out edges from block to floating nodes even if graph is in state
74 "floats". Optimizes Tuple nodes. */
75 void compute_outs(ir_graph *irg);
76 /** Frees the out datastructures. Sets the flag in irg to "no_outs". */
77 void free_outs(ir_graph *irg);
79 #endif /* _IROUTS_H_ */