3 * File name: ir/tr/typewalk.h
4 * Purpose: Traverse the type information.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 1999-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 * Traverse the type information.
18 * @author Goetz Lindenmaier
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
30 #include "type_or_entity.h"
35 * the type walk function
37 * @param tore points to the visited type or entity
38 * @param env free environment pointer
40 typedef void type_walk_func(type_or_ent *tore, void *env);
43 * the class walk function
45 * @param clss points to the visited class
46 * @param env free environment pointer
48 typedef void class_walk_func(type *clss, void *env);
51 Touches every type and entity in unspecified order. If new
52 types/entities are created during the traversal these will
54 void type_walk(type_walk_func *pre,
58 /** Walks over all type information reachable from an ir graph.
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,
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.
75 @todo should be named class-walk
77 @deprecated will be removed?
79 void type_walk_super2sub(type_walk_func *pre,
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,
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
97 Does not visit global type, frame types.
99 @bug ?? something is wrong with this.
101 void class_walk_super2sub(class_walk_func *pre,
102 class_walk_func *post,
106 * the entity walk function
108 * @param ent points to the visited entity
109 * @param env free environment pointer
111 typedef void entity_walk_func(entity *ent, void *env);
114 * Walks over all entities in the type.
117 * @param doit the entity walker function
118 * @param env environment, wil be passed to the walker function
120 void walk_types_entities(type *tp,
121 entity_walk_func *doit,
123 #endif /* _TYPEWALK_H_ */