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"
34 /** Type of argument functions for type walkers.
36 * @param tore points to the visited type or entity
37 * @param env free environment pointer
39 typedef void type_walk_func(type_or_ent *tore, void *env);
41 /** The class walk function
43 * @param clss points to the visited class
44 * @param env free environment pointer
46 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 * Does not touch frame types or types for value params ... */
52 void type_walk(type_walk_func *pre, type_walk_func *post, void *env);
54 /** Walks over all type information reachable from an ir graph.
56 * Walks over all type information reachable from irg, i.e., starts a
57 * type walk at the irgs entity, the irgs frame type and all types and
58 * entities that are attributes to firm nodes. */
59 void type_walk_irg(ir_graph *irg,
65 Touches every class in specified order:
66 - first the super class
67 - second the class itself
68 - third the sub classes. If new classes are created
69 during the traversal these will be visited, too.
71 @todo should be named class-walk
73 @deprecated will be removed?
75 void type_walk_super2sub(type_walk_func *pre,
80 Touches every class in specified order:
81 - first the super class
82 - second the class itself
83 If new classes are created during the traversal these
84 will be visited, too. */
85 void type_walk_super(type_walk_func *pre,
89 /** Same as type_walk_super2sub, but visits only class types.
90 Executes pre for a class if all superclasses have been visited.
91 Then iterates to subclasses. Executes post after return from
93 Does not visit global type, frame types.
95 @bug ?? something is wrong with this.
97 void class_walk_super2sub(class_walk_func *pre,
98 class_walk_func *post,
102 * the entity walk function
104 * @param ent points to the visited entity
105 * @param env free environment pointer
107 typedef void entity_walk_func(entity *ent, void *env);
110 * Walks over all entities in the type.
113 * @param doit the entity walker function
114 * @param env environment, wil be passed to the walker function
116 void walk_types_entities(type *tp,
117 entity_walk_func *doit,
119 #endif /* _TYPEWALK_H_ */