3 * File name: ir/ana/irouts.h
4 * Purpose: Compute and access out edges.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 2002-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 * Implements Def-Use edges, also called outedges.
18 * @author Goetz Lindenmaier
20 * @todo eventually add reverse conrtol flow graph. (If needed.)
26 # include "firm_types.h"
30 /*------------------------------------------------------------------*/
31 /* Accessing the out datastructures. */
32 /* These routines only work properly if the ir_graph is in state */
33 /* outs_consistent or outs_inconsistent. */
34 /*------------------------------------------------------------------*/
36 /** To iterate through the successors iterate from 0 to i < get_irn_outs(). No
37 order of successors guaranteed. Will return edges from block to floating
38 nodes even if irgraph is in state "op_pin_state_floats". */
39 /* returns the number of successors of the node: */
40 int get_irn_n_outs (ir_node *node);
42 /** Get predecessor n */
43 ir_node *get_irn_out (ir_node *node, int pos);
45 /** Set predecessor n */
46 void set_irn_out (ir_node *node, int pos, ir_node *out);
48 /* Methods to iterate through the control flow graph. Iterate from 0 to
49 i < get_Block_cfg_outs(block). No order of successors guaranteed. */
51 /** Return the number of control flow successors, ignore keep-alives. */
52 int get_Block_n_cfg_outs (ir_node *node);
54 /** Return the number of control flow successors, honor keep-alives. */
55 int get_Block_n_cfg_outs_ka (ir_node *node);
57 /** Access predecessor n, ignore keep-alives. */
58 ir_node *get_Block_cfg_out (ir_node *node, int pos);
60 /** Access predecessor n, honor keep-alives. */
61 ir_node *get_Block_cfg_out_ka (ir_node *node, int pos);
63 /** Walks over the graph starting at node. Walks also if graph is in state
64 "outs_inconsistent". Assumes current_ir_graph is set properly. */
65 void irg_out_walk(ir_node *node,
66 irg_walk_func *pre, irg_walk_func *post,
69 /** Walks only over Block nodes in the graph. Has it's own visited
70 flag, so that it can be interleaved with the other walker.
71 node must be either op_Block or mode_X. */
72 void irg_out_block_walk(ir_node *node,
73 irg_walk_func *pre, irg_walk_func *post,
76 /*------------------------------------------------------------------*/
77 /* Building and Removing the out datastructure */
78 /*------------------------------------------------------------------*/
80 /** Computes the out edges. Sets a flag in irg to "outs_consistent". If the
81 graph is changed this flag must be set to "outs_inconsistent". Computes
82 out edges from block to floating nodes even if graph is in state
83 "op_pin_state_floats". Optimizes Tuple nodes. */
84 void compute_irg_outs(ir_graph *irg);
85 void compute_irp_outs(void);
86 /** Computes the out edges in interprocedural view */
87 void compute_ip_outs(void);
88 /** Frees the out datastructures. Sets the flag in irg to "outs_none". */
89 void free_ip_outs(void);
90 void free_irg_outs(ir_graph *irg);
91 void free_irp_outs(void);
93 #endif /* _IROUTS_H_ */