flag for strength reduction verbosity
[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 /** Type of argument functions for type walkers.
35  *
36  * @param tore    points to the visited type or entity
37  * @param env     free environment pointer
38  */
39 typedef void type_walk_func(type_or_ent *tore, void *env);
40
41 /**  The class walk function
42  *
43  * @param clss    points to the visited class
44  * @param env     free environment pointer
45  */
46 typedef void class_walk_func(type *clss, void *env);
47
48 /** Touches every type and entity in unspecified order.  If new
49  *  types/entities are created during the traversal these will
50  *  be visited, too.
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);
53
54 /** Walks over all type information reachable from an ir graph.
55  *
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,
60                    type_walk_func *pre,
61                    type_walk_func *post,
62                    void *env);
63
64 /**
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.
70
71     @todo should be named class-walk
72
73     @deprecated will be removed?
74 */
75 void type_walk_super2sub(type_walk_func *pre,
76                          type_walk_func *post,
77                          void *env);
78
79 /**
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,
86                      type_walk_func *post,
87                      void *env);
88
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
92    subclass.
93    Does not visit global type, frame types.
94
95    @bug ?? something is wrong with this.
96 */
97 void class_walk_super2sub(class_walk_func *pre,
98                           class_walk_func *post,
99                           void *env);
100
101 /**
102  * the entity walk function
103  *
104  * @param ent     points to the visited entity
105  * @param env     free environment pointer
106  */
107 typedef void entity_walk_func(entity *ent, void *env);
108
109 /**
110  * Walks over all entities in the type.
111  *
112  * @param tp    the type
113  * @param doit  the entity walker function
114  * @param env   environment, wil be passed to the walker function
115  */
116 void walk_types_entities(type *tp,
117                          entity_walk_func *doit,
118                          void *env);
119 #endif /* _TYPEWALK_H_ */