Changed file names.
[libfirm] / ir / ir / irgwalk.h
1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
3 **
4 ** Author: Boris Boesler
5 **
6 ** traverse an ir graph
7 ** - execute the pre function before recursion
8 ** - execute the post function after recursion
9 **
10 ** Uses current_ir_graph (from irgraph.h)!!! Set it to the proper
11 ** graph before starting the walker.
12 */
13
14 /* $Id$ */
15
16 # ifndef _IRGWALK_H_
17 # define _IRGWALK_H_
18
19 # include "irnode.h"
20
21 /* Walks over the ir graph, starting at the node given as first argument.
22    Executes pre before visiting the predecessor of a node, post after.
23    irg_walk uses the visited flag in irg and the nodes to determine visited
24    nodes.  It executes inc_irg_visited(current_ir_graph) to generate a new
25    flag.  It marks the node as visited before executing pre.
26    The void* env can be used to pass status information between the
27    pre and post functions.  */
28 void irg_walk(ir_node *node,
29               void (pre)(ir_node*, void*), void (post)(ir_node*, void*),
30               void *env);
31
32 /* Executes irg_walk(end, pre, post, env) for all irgraphs in irprog.
33    Sets current_ir_graph properly for each walk.  Conserves current
34    current_ir_graph. */
35 void all_irg_walk(void (pre)(ir_node*, void*), void (post)(ir_node*, void*),
36                   void *env);
37
38
39 /* Walks only over Block nodes in the graph.  Has it's own visited
40    flag, so that it can be interleaved with the other walker.
41    If a none block is passed, starts at the block this node belongs to.
42    If end is passed also visites kept alive blocks. */
43 void irg_block_walk(ir_node *node,
44                     void (pre)(ir_node*, void*), void (post)(ir_node*, void*),
45                     void *env);
46
47
48 # endif /* _IRGWALK_H_ */