Code review to compile with -ansi
[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 /* Methods to iterate through the control flow graph. Iterate from 0 to
35    i < get_Block_cfg_outs(block). No order of successors guaranteed. */
36 int             get_Block_n_cfg_outs (ir_node *node);
37 /* Access predecessor n. */
38 INLINE ir_node *get_Block_cfg_out  (ir_node *node, int pos);
39
40
41 /* Walks over the graph starting at node.  Walks also if graph is in state
42    "outs_inconsistent".  Assumes current_ir_graph is set properly. */
43 void irg_out_walk(ir_node *node,
44                   void (pre)(ir_node*, void*), void (post)(ir_node*, void*),
45                   void *env);
46
47 /* Walks only over Block nodes in the graph.  Has it's own visited
48    flag, so that it can be interleaved with the other walker.
49    node must be either op_Block or mode_X.  */
50 void irg_out_block_walk(ir_node *node,
51                         void (pre)(ir_node*, void*), void (post)(ir_node*, void*),
52                         void *env);
53
54 /**********************************************************************/
55 /* Building and Removing the out datasturcture                       **/
56 /**********************************************************************/
57
58 /* Computes the out edges.  Sets a flag in irg to "outs_consistent".  If the
59    graph is changed this flag must be set to "outs_inconsistent".  Computes
60    out edges from block to floating nodes even if graph is in state
61    "floats".   Optimizes Tuple nodes. */
62 void compute_outs(ir_graph *irg);
63 /* Frees the out datastructures.  Sets the flag in irg to "no_outs". */
64 void free_outs(ir_graph *irg);
65
66 #endif /* _IROUTS_H_ */