fixed doxygen comments, removed initialization for description entities
[libfirm] / ir / ana / irouts.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ana/irouts.h
4  * Purpose:     Compute and access out edges.
5  * Author:      Goetz Lindenmaier
6  * Modified by:
7  * Created:     1.2002
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2002-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 /**
14 * @file irouts.h
15 *
16 * Implements Def-Use edges, also called outedges.
17 *
18 * @author Goetz Lindenmaier
19 *
20 * @todo eventually add reverse conrtol flow graph. (If needed.)
21 */
22
23 /* $Id$ */
24
25 # ifndef _IROUTS_H_
26 # define _IROUTS_H_
27
28 # include "irgraph.h"
29 # include "irnode.h"
30
31 /*------------------------------------------------------------------*/
32 /* Accessing the out datastructures.                                */
33 /* These routines only work properly if the ir_graph is in state    */
34 /* outs_consistent or outs_inconsistent.                            */
35 /*------------------------------------------------------------------*/
36
37 /** To iterate through the successors iterate from 0 to i < get_irn_outs(). No
38    order of successors guaranteed.  Will return edges from block to floating
39    nodes even if irgraph is in state "op_pin_state_floats". */
40 /* returns the number of successors of the node: */
41 int             get_irn_n_outs (ir_node *node);
42
43 /** Get predecessor n */
44 ir_node *get_irn_out  (ir_node *node, int pos);
45
46 /** Set predecessor n */
47 void     set_irn_out  (ir_node *node, int pos, ir_node *out);
48
49 /* Methods to iterate through the control flow graph. Iterate from 0 to
50    i < get_Block_cfg_outs(block). No order of successors guaranteed. */
51 int             get_Block_n_cfg_outs (ir_node *node);
52
53 /** Access predecessor n. */
54 ir_node *get_Block_cfg_out  (ir_node *node, int pos);
55
56 #ifndef _IRG_WALK_FUNC_TYPEDEF_
57 #define _IRG_WALK_FUNC_TYPEDEF_
58 /** The type of the walk function */
59 typedef void irg_walk_func(ir_node *, void *);
60 #endif
61
62 /** Walks over the graph starting at node.  Walks also if graph is in state
63    "outs_inconsistent".  Assumes current_ir_graph is set properly. */
64 void irg_out_walk(ir_node *node,
65                   irg_walk_func *pre, irg_walk_func *post,
66                   void *env);
67
68 /** Walks only over Block nodes in the graph.  Has it's own visited
69    flag, so that it can be interleaved with the other walker.
70    node must be either op_Block or mode_X.  */
71 void irg_out_block_walk(ir_node *node,
72                         irg_walk_func *pre, irg_walk_func *post,
73                         void *env);
74
75 /*------------------------------------------------------------------*/
76 /* Building and Removing the out datastructure                      */
77 /*------------------------------------------------------------------*/
78
79 /** Computes the out edges.  Sets a flag in irg to "outs_consistent".  If the
80    graph is changed this flag must be set to "outs_inconsistent".  Computes
81    out edges from block to floating nodes even if graph is in state
82    "op_pin_state_floats".   Optimizes Tuple nodes. */
83 void compute_outs(ir_graph *irg);
84 /** Computes the out edges in interprocedural view */
85 void compute_ip_outs(void);
86 /** Frees the out datastructures.  Sets the flag in irg to "outs_none". */
87 void free_ip_outs(void);
88 void free_outs(ir_graph *irg);
89
90 #endif /* _IROUTS_H_ */