doxygen comments added
[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  * the type walk function
25  *
26  * @param tore    points to the visited type or entity
27  * @param env     free environment pointer
28  */
29 typedef void type_walk_func(type_or_ent *tore, void *env);
30
31 /**
32  * the class walk function
33  *
34  * @param clss    points to the visited class
35  * @param env     free environment pointer
36  */
37 typedef void class_walk_func(type *clss, void *env);
38
39 /**
40     Touches every type and entity in unspecified order.  If new
41     types/entities are created during the traversal these will
42     be visited, too. */
43 void type_walk(type_walk_func *pre,
44                type_walk_func *post,
45                void *env);
46
47 /** walks over all type information reachable from irg */
48 void type_walk_irg(ir_graph *irg,
49                    type_walk_func *pre,
50                    type_walk_func *post,
51                    void *env);
52
53 /**
54     Touches every class in specified order:
55     - first the super class
56     - second the class itself
57     - third the sub classes.  If new classes are created
58     during the traversal these will be visited, too.
59
60     @todo should be named class-walk
61
62     @deprecated will be removed?
63 */
64 void type_walk_super2sub(type_walk_func *pre,
65                          type_walk_func *post,
66                          void *env);
67
68 /**
69     Touches every class in specified order:
70     - first the super class
71     - second the class itself
72     If new classes are created during the traversal these
73     will be visited, too. */
74 void type_walk_super(type_walk_func *pre,
75                      type_walk_func *post,
76                      void *env);
77
78 /** Same as type_walk_super2sub, but visits only class types.
79    Executes pre for a class if all superclasses have been visited.
80    Then iterates to subclasses.  Executes post after return from
81    subclass.
82    Does not visit global type, frame types.
83
84    @bug ?? something is wrong with this.
85 */
86 void class_walk_super2sub(class_walk_func *pre,
87                           class_walk_func *post,
88                           void *env);
89
90 /**
91  * the entity walk function
92  *
93  * @param ent     points to the visited entity
94  * @param env     free environment pointer
95  */
96 typedef void entity_walk_func(entity *ent, void *env);
97
98 /**
99  * Walks over all entities in the type.
100  *
101  * @param tp    the type
102  * @param doit  the entity walker function
103  * @param env   environment, wil be passed to the walker function
104  */
105 void walk_types_entities(type *tp,
106                          entity_walk_func *doit,
107                          void *env);
108 #endif /* _TYPEWALK_H_ */