added doxygen comments
[libfirm] / ir / tr / typewalk.h
1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2
3 * All rights reserved.
4 *
5 * Author: Goetz Lindenmaier
6 *
7 * traverse the type information.  The walker walks the whole ir graph
8 * to find the distinct type trees in the type graph forest.
9 * - execute the pre function before recursion
10 * - execute the post function after recursion
11 */
12
13 /* $Id$ */
14
15
16 /* walk over all type information reachable from the ir graph. */
17
18 #ifndef _TYPEWALK_H_
19 #define _TYPEWALK_H_
20
21 # include "type_or_entity.h"
22
23
24 typedef void (type_walk_func)(type_or_ent *, void *);
25
26 /**
27     Touches every type and entity in unspecified order.  If new
28     types/entities are created during the traversal these will
29     be visited, too. **/
30 void type_walk(type_walk_func *pre,
31                type_walk_func *post,
32                void *env);
33
34 /** walks over all type information reachable from irg **/
35 void type_walk_irg(ir_graph *irg,
36                    type_walk_func *pre,
37                    type_walk_func *post,
38                    void *env);
39
40 /**
41     Touches every class in specified order:
42     - first the super class
43     - second the class itself
44     - third the sub classes.  If new classes are created
45     during the traversal these will be visited, too. **/
46 /** @@@ should be named class-walk **/
47 /*  @@@ will be removed? */
48 void type_walk_super2sub(type_walk_func *pre,
49                          type_walk_func *post,
50                          void *env);
51
52 /**
53     Touches every class in specified order:
54     - first the super class
55     - second the class itself
56     If new classes are created during the traversal these
57     will be visited, too. **/
58 void type_walk_super(type_walk_func *pre,
59                      type_walk_func *post,
60                      void *env);
61
62 /* Same as type_walk_super2sub, but visits only class types.
63    Executes pre for a class if all superclasses have been visited.
64    Then iterates to subclasses.  Executes post after return from
65    subclass.
66    Does not visit global type, frame types.
67 */
68 /* @@@ ?? something is wrong with this. */
69 void class_walk_super2sub(type_walk_func *pre,
70                           type_walk_func *post,
71                           void *env);
72
73
74 /* Walks over all entities in the type */
75 typedef void (entity_walk_func)(entity *, void *);
76 void walk_types_entities(type *tp,
77                          entity_walk_func *doit,
78                          void *env);
79 #endif /* _TYPEWALK_H_ */