irverify: remove load/store from entity verification
[libfirm] / include / libfirm / irpass.h
1 /*
2  * Copyright (C) 1995-2009 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief     Manager for transformation passes.
23  * @author    Michael Beck
24  */
25 #ifndef FIRM_IR_PASS_H
26 #define FIRM_IR_PASS_H
27
28 #include "firm_types.h"
29 #include "begin.h"
30
31 /**
32  * Creates a new ir_graph pass manager.
33  *
34  * @param name        the name of the manager
35  * @param verify_all  if non-zero, all passes of this manager will be verified
36  * @param dump_all    if non-zero, all passes results will be dumped
37  *
38  * @return the newly created manager
39  */
40 FIRM_API ir_graph_pass_manager_t *new_graph_pass_mgr(const char *name,
41                                                      int verify_all,
42                                                      int dump_all);
43
44 /**
45  * Adds an ir_graph pass to a graph pass manager.
46  *
47  * @param mgr   the ir_graph pass manager
48  * @param pass  the pass to add
49  */
50 FIRM_API void ir_graph_pass_mgr_add(ir_graph_pass_manager_t *mgr,
51                                     ir_graph_pass_t *pass);
52
53 /**
54  * Runs all passes of an ir_graph pass manager.
55  *
56  * @param mgr   the manager
57  *
58  * @return 0 if all passes return 0, else 1
59  */
60 FIRM_API int ir_graph_pass_mgr_run(ir_graph_pass_manager_t *mgr);
61
62 /**
63  * Terminates an ir_graph pass manager and all owned passes.
64  *
65  * @param mgr   the manager
66  */
67 FIRM_API void term_graph_pass_mgr(ir_graph_pass_manager_t *mgr);
68
69 /**
70  * Creates a new ir_prog pass manager.
71  *
72  * @param name        the name of the manager
73  * @param verify_all  if non-zero, all passes of this manager will be verified
74  * @param dump_all    if non-zero, all passes results will be dumped
75  *
76  * @return  the newly created manager
77  */
78 FIRM_API ir_prog_pass_manager_t *new_prog_pass_mgr(const char *name,
79                                                    int verify_all,
80                                                    int dump_all);
81
82 /**
83  * Adds an ir_prog pass to an ir_prog pass manager.
84  *
85  * @param mgr   the ir_prog pass manager
86  * @param pass  the pass to add
87  */
88 FIRM_API void ir_prog_pass_mgr_add(ir_prog_pass_manager_t *mgr,
89                                    ir_prog_pass_t *pass);
90
91 /**
92  * Adds an ir_graph_pass_manager as a pass to an ir_prog pass manager.
93  *
94  * @param mgr        the ir_prog pass manager
95  * @param graph_mgr  the ir_graph pass manager to be added
96  */
97 FIRM_API void ir_prog_pass_mgr_add_graph_mgr(ir_prog_pass_manager_t *mgr,
98                                             ir_graph_pass_manager_t *graph_mgr);
99
100 /**
101  * Adds an ir_graph_pass as a pass to an ir_prog pass manager.
102  *
103  * @param mgr   the ir_prog pass manager
104  * @param pass  the ir_graph pass to be added
105  */
106 FIRM_API void ir_prog_pass_mgr_add_graph_pass(ir_prog_pass_manager_t *mgr,
107                                               ir_graph_pass_t *pass);
108
109 /**
110  * Runs all passes of an ir_prog pass manager.
111  *
112  * @param mgr   the manager
113  *
114  * @return 0 if all passes return 0, else 1
115  */
116 FIRM_API int ir_prog_pass_mgr_run(ir_prog_pass_manager_t *mgr);
117
118 /**
119  * Terminates an ir_prog pass manager and all owned passes.
120  *
121  * @param mgr   the manager
122  */
123 FIRM_API void term_prog_pass_mgr(ir_prog_pass_manager_t *mgr);
124
125 /**
126  * Sets the run index for an irgraph pass manager.
127  *
128  * @param mgr      the manager
129  * @param run_idx  the index for the first pass of this manager
130  */
131 FIRM_API void ir_graph_pass_mgr_set_run_idx(
132         ir_graph_pass_manager_t *mgr, unsigned run_idx);
133
134 /**
135  * Creates an ir_graph pass for running void function(ir_graph *irg).
136  * Uses the default verifier and dumper.
137  * The pass returns always 0.
138  *
139  * @param name      the name of this pass
140  * @param function  the function to run
141  *
142  * @return  the newly created ir_graph pass
143  */
144 FIRM_API ir_graph_pass_t *def_graph_pass(
145         const char *name, void (*function)(ir_graph *irg));
146
147 /**
148  * Creates an ir_graph pass for running int function(ir_graph *irg).
149  * Uses the default verifier and dumper.
150  * The pass returns the return value of function.
151  *
152  * @param name      the name of this pass
153  * @param function  the function to run
154  *
155  * @return  the newly created ir_graph pass
156  */
157 FIRM_API ir_graph_pass_t *def_graph_pass_ret(
158         const char *name, int (*function)(ir_graph *irg));
159
160 /**
161  * Creates an ir_graph pass for running int function(ir_graph *irg).
162  * Uses the default verifier and dumper.
163  * The pass returns the return value of function.
164  *
165  * @param memory    if non-NULL, an already allocated ir_graph_pass_t
166  * @param name      the name of this pass
167  * @param function  the function to run
168  *
169  * @return  the newly created ir_graph pass
170  */
171 FIRM_API ir_graph_pass_t *def_graph_pass_constructor(
172         ir_graph_pass_t *memory,
173         const char *name, int (*function)(ir_graph *irg, void *context));
174
175 /**
176  * Sets the run_parallel property of a graph pass.
177  * If the flag is set to non-zero, the pass can be executed
178  * parallel on all graphs of a ir_prog.
179  *
180  * @param pass  the pass
181  * @param flag  new flag setting
182  */
183 FIRM_API void ir_graph_pass_set_parallel(ir_graph_pass_t *pass, int flag);
184
185 /**
186  * Creates an ir_prog pass for running void function().
187  * Uses the default verifier and dumper.
188  * The pass returns always 0.
189  *
190  * @param name      the name of this pass
191  * @param function  the function to run
192  *
193  * @return  the newly created ir_graph pass
194  */
195 FIRM_API ir_prog_pass_t *def_prog_pass(
196         const char *name, void (*function)(void));
197
198 /**
199  * Creates an ir_prog pass for running void function().
200  * Uses the default verifier and dumper.
201  * The pass returns always 0.
202  *
203  * @param memory    if non-NULL, an already allocated ir_prog_pass_t
204  * @param name      the name of this pass
205  * @param function  the function to run
206  *
207  * @return  the newly created ir_prog pass
208  */
209 FIRM_API ir_prog_pass_t *def_prog_pass_constructor(
210         ir_prog_pass_t *memory,
211         const char *name, int (*function)(ir_prog *irp, void *context));
212
213 /**
214  * Creates a pass that calls some function.
215  * This pass calls the given function, but has no dump nor verify.
216  *
217  * @param name      the name of this pass
218  * @param function  the function to run
219  * @param context   context parameter
220  *
221  * @return  the newly created ir_prog pass
222  */
223 FIRM_API ir_prog_pass_t *call_function_pass(
224         const char *name, void (*function)(void *context), void *context);
225
226 /**
227  * Sets the run index for an irprog pass manager.
228  *
229  * @param mgr      the manager
230  * @param run_idx  the index for the first pass of this manager
231  */
232 FIRM_API void ir_prog_pass_mgr_set_run_idx(
233         ir_prog_pass_manager_t *mgr, unsigned run_idx);
234
235 #include "end.h"
236
237 #endif