New directory: ana for analyses. Adapted configure/makefiles
[libfirm] / ir / ana / irouts.h
1 /* Copyright (C) 2002 by Universitaet Karlsruhe
2 ** All rights reserved.
3 **
4 ** Authors: Goetz Lindenmaier
5 **
6 **  irouts.h:  Implements Def-Use edges, also called outedges.
7 **  @@@ eventually add reverse conrtol flow graph. (If needed.)
8 */
9
10 /* $ID$ */
11
12 # ifndef _IROUTS_H_
13 # define _IROUTS_H_
14
15 # include "irgraph.h"
16 # include "irnode.h"
17
18
19 /**********************************************************************/
20 /** Accessing the out datastructures.                                **/
21 /** These routines only work properly if the ir_graph is in state    **/
22 /** outs_consistent or outs_inconsistent.                            **/
23 /**********************************************************************/
24
25 /* To iterate through the successors iterate from 0 to i < get_irn_outs(). No
26    order of successors guaranteed.  Will return edges from block to floating
27    nodes even if irgraph is in state "floats". */
28 /* returns the number of successors of the node: */
29 int             get_irn_n_outs (ir_node *node);
30 /* Access predecessor n */
31 inline ir_node *get_irn_out  (ir_node *node, int pos);
32 inline void     set_irn_out  (ir_node *node, int pos, ir_node *out);
33
34
35 /* Walks over the graph starting at node.  Walks also if graph is in state
36    "outs_inconsistent".  Assumes current_ir_graph is set properly. */
37 void irg_out_walk(ir_node *node,
38                   void (pre)(ir_node*, void*), void (post)(ir_node*, void*),
39                   void *env);
40
41 /* Walks only over Block nodes in the graph.  Has it's own visited
42    flag, so that it can be interleaved with the other walker.
43    @@@ not yet implemented!! */
44 void irg_out_block_walk(ir_node *node,
45                         void (pre)(ir_node*, void*), void (post)(ir_node*, void*),
46                         void *env);
47
48 /**********************************************************************/
49 /* Building and Removing the out datasturcture                       **/
50 /**********************************************************************/
51
52 /* Computes the out edges.  Sets a flag in irg to "outs_consistent".  If the
53    graph is changed this flag must be set to "outs_inconsistent".  Computes
54    out edges from block to floating nodes even if graph is in state
55    "floats". */
56 void compute_outs(ir_graph *irg);
57 /* Frees the out datastructures.  Sets the flag in irg to "no_outs". */
58 void free_outs(ir_graph *irg);
59
60 #endif /* _IROUTS_H_ */