inlinening of functions
[libfirm] / ir / tr / typewalk.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/tr/typewalk.h
4  * Purpose:     Traverse the type information.
5  * Author:      Goetz Lindenmaier
6  * Modified by:
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1999-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 /**
14  * @file typewalk.h
15  *
16  * Traverse the type information.
17  *
18  * @author Goetz Lindenmaier
19  *
20  * The walker walks the whole ir graph
21  * to find the distinct type trees in the type graph forest.
22  * - execute the pre() function before recursion
23  * - execute the post() function after recursion
24  */
25
26 #ifndef _TYPEWALK_H_
27 #define _TYPEWALK_H_
28
29 #include "type.h"
30 #include "type_or_entity.h"
31
32 #include "irgraph.h"
33
34 /**
35  * the type walk function
36  *
37  * @param tore    points to the visited type or entity
38  * @param env     free environment pointer
39  */
40 typedef void type_walk_func(type_or_ent *tore, void *env);
41
42 /**
43  * the class walk function
44  *
45  * @param clss    points to the visited class
46  * @param env     free environment pointer
47  */
48 typedef void class_walk_func(type *clss, void *env);
49
50 /**
51     Touches every type and entity in unspecified order.  If new
52     types/entities are created during the traversal these will
53     be visited, too. */
54 void type_walk(type_walk_func *pre,
55                type_walk_func *post,
56                void *env);
57
58 /** Walks over all type information reachable from an ir graph.
59  *
60  *  Walks over all type information reachable from irg, i.e., starts a
61  *  type walk at the irgs entity, the irgs frame type and all types and
62  *  entities that are attributes to firm nodes. */
63 void type_walk_irg(ir_graph *irg,
64                    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     - third the sub classes.  If new classes are created
73     during the traversal these will be visited, too.
74
75     @todo should be named class-walk
76
77     @deprecated will be removed?
78 */
79 void type_walk_super2sub(type_walk_func *pre,
80                          type_walk_func *post,
81                          void *env);
82
83 /**
84     Touches every class in specified order:
85     - first the super class
86     - second the class itself
87     If new classes are created during the traversal these
88     will be visited, too. */
89 void type_walk_super(type_walk_func *pre,
90                      type_walk_func *post,
91                      void *env);
92
93 /** Same as type_walk_super2sub, but visits only class types.
94    Executes pre for a class if all superclasses have been visited.
95    Then iterates to subclasses.  Executes post after return from
96    subclass.
97    Does not visit global type, frame types.
98
99    @bug ?? something is wrong with this.
100 */
101 void class_walk_super2sub(class_walk_func *pre,
102                           class_walk_func *post,
103                           void *env);
104
105 /**
106  * the entity walk function
107  *
108  * @param ent     points to the visited entity
109  * @param env     free environment pointer
110  */
111 typedef void entity_walk_func(entity *ent, void *env);
112
113 /**
114  * Walks over all entities in the type.
115  *
116  * @param tp    the type
117  * @param doit  the entity walker function
118  * @param env   environment, wil be passed to the walker function
119  */
120 void walk_types_entities(type *tp,
121                          entity_walk_func *doit,
122                          void *env);
123 #endif /* _TYPEWALK_H_ */