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
29 # include "type_or_entity.h"
32 * the type walk function
34 * @param tore points to the visited type or entity
35 * @param env free environment pointer
37 typedef void type_walk_func(type_or_ent *tore, void *env);
40 * the class walk function
42 * @param clss points to the visited class
43 * @param env free environment pointer
45 typedef void class_walk_func(type *clss, void *env);
48 Touches every type and entity in unspecified order. If new
49 types/entities are created during the traversal these will
51 void type_walk(type_walk_func *pre,
55 /** Walks over all type information reachable from an ir graph.
57 * Walks over all type information reachable from irg, i.e., starts a
58 * type walk at the irgs entity, the irgs frame type and all types and
59 * entities that are attributes to firm nodes. */
60 void type_walk_irg(ir_graph *irg,
66 Touches every class in specified order:
67 - first the super class
68 - second the class itself
69 - third the sub classes. If new classes are created
70 during the traversal these will be visited, too.
72 @todo should be named class-walk
74 @deprecated will be removed?
76 void type_walk_super2sub(type_walk_func *pre,
81 Touches every class in specified order:
82 - first the super class
83 - second the class itself
84 If new classes are created during the traversal these
85 will be visited, too. */
86 void type_walk_super(type_walk_func *pre,
90 /** Same as type_walk_super2sub, but visits only class types.
91 Executes pre for a class if all superclasses have been visited.
92 Then iterates to subclasses. Executes post after return from
94 Does not visit global type, frame types.
96 @bug ?? something is wrong with this.
98 void class_walk_super2sub(class_walk_func *pre,
99 class_walk_func *post,
103 * the entity walk function
105 * @param ent points to the visited entity
106 * @param env free environment pointer
108 typedef void entity_walk_func(entity *ent, void *env);
111 * Walks over all entities in the type.
114 * @param doit the entity walker function
115 * @param env environment, wil be passed to the walker function
117 void walk_types_entities(type *tp,
118 entity_walk_func *doit,
120 #endif /* _TYPEWALK_H_ */