1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Author: Boris Boesler
6 ** traverse an ir graph
7 ** - execute the pre function before recursion
8 ** - execute the post function after recursion
10 ** Uses current_ir_graph (from irgraph.h)!!! Set it to the proper
11 ** graph before starting the walker.
21 /* type of callback function for ir_graph walk */
22 typedef void (* irg_walk_func)(ir_node *, void *);
24 /* Walks over the ir graph, starting at the node given as first argument.
25 Executes pre before visiting the predecessor of a node, post after.
26 irg_walk uses the visited flag in irg and the nodes to determine visited
27 nodes. It executes inc_irg_visited(current_ir_graph) to generate a new
28 flag. It marks the node as visited before executing pre.
29 The void* env can be used to pass status information between the
30 pre and post functions. */
31 void irg_walk(ir_node *node, irg_walk_func pre, irg_walk_func post, void *env);
33 /* Like "irg_walk", but walks over all reachable nodes in the ir
34 * graph, starting at the end operation. During the walk current_ir_graph
36 void irg_walk_graph(ir_graph *irg, irg_walk_func pre, irg_walk_func post, void *env);
38 /* Executes irg_walk(end, pre, post, env) for all irgraphs in irprog.
39 Sets current_ir_graph properly for each walk. Conserves current
40 current_ir_graph. In interprocedural view nodes can be visited several
42 void all_irg_walk(irg_walk_func pre, irg_walk_func post, void *env);
44 /* Walks all irgs in interprocedural view. Visits each node only once.
45 Sets current_ir_graph properly. */
46 void cg_walk(irg_walk_func pre, irg_walk_func post, void *env);
48 /* Walks only over Block nodes in the graph. Has it's own visited
49 flag, so that it can be interleaved with the other walker.
50 If a none block is passed, starts at the block this node belongs to.
51 If end is passed also visites kept alive blocks. */
52 void irg_block_walk(ir_node *node, irg_walk_func pre, irg_walk_func post, void *env);
54 /* Like "irg_block_walk", but walks over all reachable blocks in the
55 * ir graph, starting at the end block. */
56 void irg_block_walk_graph(ir_graph *irg, irg_walk_func pre, irg_walk_func post, void *env);
58 /* Walks over all code in const_code_irg.
59 Uses visited flag in const_code_irg. */
60 void walk_const_code(irg_walk_func pre, irg_walk_func post, void *env);
63 # endif /* _IRGWALK_H_ */