]>
Commit | Line | Data |
---|---|---|
f6db1481 RH |
1 | /* Top level of GCC compilers (cc1, cc1plus, etc.) |
2 | Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | |
8b57bfeb | 3 | 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, |
9f929ce6 | 4 | 2011, 2012 Free Software Foundation, Inc. |
f6db1481 RH |
5 | |
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify it under | |
9 | the terms of the GNU General Public License as published by the Free | |
9dcd6f09 | 10 | Software Foundation; either version 3, or (at your option) any later |
f6db1481 RH |
11 | version. |
12 | ||
13 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
19 | along with GCC; see the file COPYING3. If not see |
20 | <http://www.gnu.org/licenses/>. */ | |
f6db1481 RH |
21 | |
22 | /* This is the top level of cc1/c++. | |
23 | It parses command args, opens files, invokes the various passes | |
24 | in the proper order, and counts the time used by each. | |
25 | Error messages and low-level interface to malloc also handled here. */ | |
26 | ||
27 | #include "config.h" | |
f6db1481 RH |
28 | #include "system.h" |
29 | #include "coretypes.h" | |
30 | #include "tm.h" | |
f6db1481 RH |
31 | #include "line-map.h" |
32 | #include "input.h" | |
33 | #include "tree.h" | |
34 | #include "rtl.h" | |
35 | #include "tm_p.h" | |
36 | #include "flags.h" | |
37 | #include "insn-attr.h" | |
38 | #include "insn-config.h" | |
39 | #include "insn-flags.h" | |
40 | #include "hard-reg-set.h" | |
41 | #include "recog.h" | |
42 | #include "output.h" | |
43 | #include "except.h" | |
44 | #include "function.h" | |
45 | #include "toplev.h" | |
46 | #include "expr.h" | |
47 | #include "basic-block.h" | |
48 | #include "intl.h" | |
49 | #include "ggc.h" | |
50 | #include "graph.h" | |
f6db1481 | 51 | #include "regs.h" |
1da2ed5f | 52 | #include "diagnostic-core.h" |
f6db1481 RH |
53 | #include "params.h" |
54 | #include "reload.h" | |
f6db1481 RH |
55 | #include "debug.h" |
56 | #include "target.h" | |
57 | #include "langhooks.h" | |
f6db1481 RH |
58 | #include "cfgloop.h" |
59 | #include "hosthooks.h" | |
60 | #include "cgraph.h" | |
61 | #include "opts.h" | |
62 | #include "coverage.h" | |
63 | #include "value-prof.h" | |
ef330312 PB |
64 | #include "tree-inline.h" |
65 | #include "tree-flow.h" | |
2f8e398b | 66 | #include "tree-pass.h" |
9f8628ba | 67 | #include "tree-dump.h" |
6fb5fa3c | 68 | #include "df.h" |
45a80bb9 | 69 | #include "predict.h" |
d7f09764 | 70 | #include "lto-streamer.h" |
090fa0ab | 71 | #include "plugin.h" |
af8bca3c | 72 | #include "ipa-utils.h" |
6f4185d7 | 73 | #include "tree-pretty-print.h" /* for dump_function_header */ |
f6db1481 | 74 | |
6fb5fa3c | 75 | /* This is used for debugging. It allows the current pass to printed |
090fa0ab GF |
76 | from anywhere in compilation. |
77 | The variable current_pass is also used for statistics and plugins. */ | |
8ddbbcae | 78 | struct opt_pass *current_pass; |
6fb5fa3c | 79 | |
226c52aa XDL |
80 | static void register_pass_name (struct opt_pass *, const char *); |
81 | ||
6fb5fa3c DB |
82 | /* Call from anywhere to find out what pass this is. Useful for |
83 | printing out debugging information deep inside an service | |
84 | routine. */ | |
85 | void | |
86 | print_current_pass (FILE *file) | |
87 | { | |
88 | if (current_pass) | |
b8698a0f | 89 | fprintf (file, "current pass = %s (%d)\n", |
6fb5fa3c DB |
90 | current_pass->name, current_pass->static_pass_number); |
91 | else | |
92 | fprintf (file, "no current pass.\n"); | |
93 | } | |
94 | ||
95 | ||
96 | /* Call from the debugger to get the current pass name. */ | |
24e47c76 | 97 | DEBUG_FUNCTION void |
6fb5fa3c DB |
98 | debug_pass (void) |
99 | { | |
100 | print_current_pass (stderr); | |
b8698a0f | 101 | } |
6fb5fa3c DB |
102 | |
103 | ||
104 | ||
ef330312 PB |
105 | /* Global variables used to communicate with passes. */ |
106 | int dump_flags; | |
107 | bool in_gimple_form; | |
b02b9b53 | 108 | bool first_pass_instance; |
f6db1481 | 109 | |
f6db1481 RH |
110 | |
111 | /* This is called from various places for FUNCTION_DECL, VAR_DECL, | |
112 | and TYPE_DECL nodes. | |
113 | ||
114 | This does nothing for local (non-static) variables, unless the | |
0e6df31e GK |
115 | variable is a register variable with DECL_ASSEMBLER_NAME set. In |
116 | that case, or if the variable is not an automatic, it sets up the | |
117 | RTL and outputs any assembler code (label definition, storage | |
118 | allocation and initialization). | |
f6db1481 | 119 | |
0e6df31e | 120 | DECL is the declaration. TOP_LEVEL is nonzero |
f6db1481 RH |
121 | if this declaration is not within a function. */ |
122 | ||
123 | void | |
124 | rest_of_decl_compilation (tree decl, | |
f6db1481 RH |
125 | int top_level, |
126 | int at_end) | |
127 | { | |
128 | /* We deferred calling assemble_alias so that we could collect | |
129 | other attributes such as visibility. Emit the alias now. */ | |
6e701822 | 130 | if (!in_lto_p) |
f6db1481 RH |
131 | { |
132 | tree alias; | |
133 | alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl)); | |
134 | if (alias) | |
135 | { | |
136 | alias = TREE_VALUE (TREE_VALUE (alias)); | |
137 | alias = get_identifier (TREE_STRING_POINTER (alias)); | |
f7fb2880 RG |
138 | /* A quirk of the initial implementation of aliases required that the |
139 | user add "extern" to all of them. Which is silly, but now | |
140 | historical. Do note that the symbol is in fact locally defined. */ | |
141 | if (!lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))) | |
142 | DECL_EXTERNAL (decl) = 0; | |
f6db1481 RH |
143 | assemble_alias (decl, alias); |
144 | } | |
145 | } | |
146 | ||
0e6df31e GK |
147 | /* Can't defer this, because it needs to happen before any |
148 | later function definitions are processed. */ | |
820cc88f | 149 | if (DECL_ASSEMBLER_NAME_SET_P (decl) && DECL_REGISTER (decl)) |
0e6df31e GK |
150 | make_decl_rtl (decl); |
151 | ||
f6db1481 RH |
152 | /* Forward declarations for nested functions are not "external", |
153 | but we need to treat them as if they were. */ | |
154 | if (TREE_STATIC (decl) || DECL_EXTERNAL (decl) | |
155 | || TREE_CODE (decl) == FUNCTION_DECL) | |
156 | { | |
157 | timevar_push (TV_VARCONST); | |
158 | ||
f6db1481 RH |
159 | /* Don't output anything when a tentative file-scope definition |
160 | is seen. But at end of compilation, do output code for them. | |
161 | ||
7e8b322a | 162 | We do output all variables and rely on |
f6db1481 RH |
163 | callgraph code to defer them except for forward declarations |
164 | (see gcc.c-torture/compile/920624-1.c) */ | |
165 | if ((at_end | |
166 | || !DECL_DEFER_OUTPUT (decl) | |
cd9c7bd2 | 167 | || DECL_INITIAL (decl)) |
0d6bf48c | 168 | && (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl)) |
f6db1481 RH |
169 | && !DECL_EXTERNAL (decl)) |
170 | { | |
2942c502 JH |
171 | /* When reading LTO unit, we also read varpool, so do not |
172 | rebuild it. */ | |
173 | if (in_lto_p && !at_end) | |
174 | ; | |
175 | else if (TREE_CODE (decl) != FUNCTION_DECL) | |
8a4a83ed | 176 | varpool_finalize_decl (decl); |
f6db1481 RH |
177 | } |
178 | ||
179 | #ifdef ASM_FINISH_DECLARE_OBJECT | |
180 | if (decl == last_assemble_variable_decl) | |
181 | { | |
182 | ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl, | |
183 | top_level, at_end); | |
184 | } | |
185 | #endif | |
186 | ||
187 | timevar_pop (TV_VARCONST); | |
188 | } | |
ef11c839 SB |
189 | else if (TREE_CODE (decl) == TYPE_DECL |
190 | /* Like in rest_of_type_compilation, avoid confusing the debug | |
191 | information machinery when there are errors. */ | |
1da2ed5f | 192 | && !seen_error ()) |
f6db1481 RH |
193 | { |
194 | timevar_push (TV_SYMOUT); | |
195 | debug_hooks->type_decl (decl, !top_level); | |
196 | timevar_pop (TV_SYMOUT); | |
197 | } | |
e4d5432a | 198 | |
aabcd309 | 199 | /* Let cgraph know about the existence of variables. */ |
2942c502 JH |
200 | if (in_lto_p && !at_end) |
201 | ; | |
a482b1f5 JH |
202 | else if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl) |
203 | && TREE_STATIC (decl)) | |
8a4a83ed | 204 | varpool_node (decl); |
f6db1481 RH |
205 | } |
206 | ||
207 | /* Called after finishing a record, union or enumeral type. */ | |
208 | ||
209 | void | |
210 | rest_of_type_compilation (tree type, int toplev) | |
211 | { | |
212 | /* Avoid confusing the debug information machinery when there are | |
213 | errors. */ | |
1da2ed5f | 214 | if (seen_error ()) |
f6db1481 RH |
215 | return; |
216 | ||
217 | timevar_push (TV_SYMOUT); | |
218 | debug_hooks->type_decl (TYPE_STUB_DECL (type), !toplev); | |
219 | timevar_pop (TV_SYMOUT); | |
220 | } | |
221 | ||
ef330312 | 222 | \f |
f6db1481 | 223 | |
ef330312 PB |
224 | void |
225 | finish_optimization_passes (void) | |
f6db1481 | 226 | { |
09639a83 | 227 | int i; |
ef330312 PB |
228 | struct dump_file_info *dfi; |
229 | char *name; | |
f6db1481 | 230 | |
ef330312 PB |
231 | timevar_push (TV_DUMP); |
232 | if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) | |
f6db1481 | 233 | { |
78c60e3d | 234 | dump_start (pass_profile.pass.static_pass_number, NULL); |
ef330312 | 235 | end_branch_prob (); |
78c60e3d | 236 | dump_finish (pass_profile.pass.static_pass_number); |
f6db1481 | 237 | } |
f6db1481 | 238 | |
ef330312 | 239 | if (optimize > 0) |
f6db1481 | 240 | { |
78c60e3d SS |
241 | dump_start (pass_profile.pass.static_pass_number, NULL); |
242 | print_combine_total_stats (); | |
243 | dump_finish (pass_combine.pass.static_pass_number); | |
f6db1481 RH |
244 | } |
245 | ||
ef330312 PB |
246 | /* Do whatever is necessary to finish printing the graphs. */ |
247 | if (graph_dump_format != no_graph) | |
248 | for (i = TDI_end; (dfi = get_dump_file_info (i)) != NULL; ++i) | |
249 | if (dump_initialized_p (i) | |
78c60e3d | 250 | && (dfi->pflags & TDF_GRAPH) != 0 |
ef330312 | 251 | && (name = get_dump_file_name (i)) != NULL) |
5e34206b JJ |
252 | { |
253 | finish_graph_dump_file (name); | |
254 | free (name); | |
255 | } | |
f6db1481 | 256 | |
ef330312 | 257 | timevar_pop (TV_DUMP); |
f6db1481 | 258 | } |
f6db1481 | 259 | |
452aa9c5 RG |
260 | static unsigned int |
261 | execute_all_early_local_passes (void) | |
262 | { | |
263 | /* Once this pass (and its sub-passes) are complete, all functions | |
264 | will be in SSA form. Technically this state change is happening | |
265 | a tad early, since the sub-passes have not yet run, but since | |
266 | none of the sub-passes are IPA passes and do not create new | |
267 | functions, this is ok. We're setting this value for the benefit | |
268 | of IPA passes that follow. */ | |
269 | if (cgraph_state < CGRAPH_STATE_IPA_SSA) | |
270 | cgraph_state = CGRAPH_STATE_IPA_SSA; | |
271 | return 0; | |
272 | } | |
273 | ||
274 | /* Gate: execute, or not, all of the non-trivial optimizations. */ | |
275 | ||
276 | static bool | |
277 | gate_all_early_local_passes (void) | |
278 | { | |
279 | /* Don't bother doing anything if the program has errors. */ | |
280 | return (!seen_error () && !in_lto_p); | |
281 | } | |
282 | ||
283 | struct simple_ipa_opt_pass pass_early_local_passes = | |
284 | { | |
285 | { | |
286 | SIMPLE_IPA_PASS, | |
287 | "early_local_cleanups", /* name */ | |
288 | gate_all_early_local_passes, /* gate */ | |
289 | execute_all_early_local_passes, /* execute */ | |
290 | NULL, /* sub */ | |
291 | NULL, /* next */ | |
292 | 0, /* static_pass_number */ | |
293 | TV_EARLY_LOCAL, /* tv_id */ | |
294 | 0, /* properties_required */ | |
295 | 0, /* properties_provided */ | |
296 | 0, /* properties_destroyed */ | |
297 | 0, /* todo_flags_start */ | |
298 | TODO_remove_functions /* todo_flags_finish */ | |
299 | } | |
300 | }; | |
301 | ||
302 | /* Gate: execute, or not, all of the non-trivial optimizations. */ | |
303 | ||
304 | static bool | |
305 | gate_all_early_optimizations (void) | |
306 | { | |
307 | return (optimize >= 1 | |
308 | /* Don't bother doing anything if the program has errors. */ | |
309 | && !seen_error ()); | |
310 | } | |
311 | ||
6083578b | 312 | static struct gimple_opt_pass pass_all_early_optimizations = |
452aa9c5 RG |
313 | { |
314 | { | |
315 | GIMPLE_PASS, | |
316 | "early_optimizations", /* name */ | |
317 | gate_all_early_optimizations, /* gate */ | |
318 | NULL, /* execute */ | |
319 | NULL, /* sub */ | |
320 | NULL, /* next */ | |
321 | 0, /* static_pass_number */ | |
322 | TV_NONE, /* tv_id */ | |
323 | 0, /* properties_required */ | |
324 | 0, /* properties_provided */ | |
325 | 0, /* properties_destroyed */ | |
326 | 0, /* todo_flags_start */ | |
327 | 0 /* todo_flags_finish */ | |
328 | } | |
329 | }; | |
330 | ||
331 | /* Gate: execute, or not, all of the non-trivial optimizations. */ | |
332 | ||
333 | static bool | |
334 | gate_all_optimizations (void) | |
335 | { | |
bf7a7185 | 336 | return optimize >= 1 && !optimize_debug; |
452aa9c5 RG |
337 | } |
338 | ||
6083578b | 339 | static struct gimple_opt_pass pass_all_optimizations = |
452aa9c5 RG |
340 | { |
341 | { | |
342 | GIMPLE_PASS, | |
343 | "*all_optimizations", /* name */ | |
344 | gate_all_optimizations, /* gate */ | |
345 | NULL, /* execute */ | |
346 | NULL, /* sub */ | |
347 | NULL, /* next */ | |
348 | 0, /* static_pass_number */ | |
349 | TV_OPTIMIZE, /* tv_id */ | |
350 | 0, /* properties_required */ | |
351 | 0, /* properties_provided */ | |
352 | 0, /* properties_destroyed */ | |
353 | 0, /* todo_flags_start */ | |
354 | 0 /* todo_flags_finish */ | |
355 | } | |
356 | }; | |
357 | ||
bf7a7185 RG |
358 | /* Gate: execute, or not, all of the non-trivial optimizations. */ |
359 | ||
360 | static bool | |
361 | gate_all_optimizations_g (void) | |
362 | { | |
363 | return optimize >= 1 && optimize_debug; | |
364 | } | |
365 | ||
366 | static struct gimple_opt_pass pass_all_optimizations_g = | |
367 | { | |
368 | { | |
369 | GIMPLE_PASS, | |
370 | "*all_optimizations_g", /* name */ | |
371 | gate_all_optimizations_g, /* gate */ | |
372 | NULL, /* execute */ | |
373 | NULL, /* sub */ | |
374 | NULL, /* next */ | |
375 | 0, /* static_pass_number */ | |
376 | TV_OPTIMIZE, /* tv_id */ | |
377 | 0, /* properties_required */ | |
378 | 0, /* properties_provided */ | |
379 | 0, /* properties_destroyed */ | |
380 | 0, /* todo_flags_start */ | |
381 | 0 /* todo_flags_finish */ | |
382 | } | |
383 | }; | |
384 | ||
ef330312 PB |
385 | static bool |
386 | gate_rest_of_compilation (void) | |
f6db1481 | 387 | { |
ef330312 PB |
388 | /* Early return if there were errors. We can run afoul of our |
389 | consistency checks, and there's not really much point in fixing them. */ | |
1da2ed5f | 390 | return !(rtl_dump_and_exit || flag_syntax_only || seen_error ()); |
f6db1481 RH |
391 | } |
392 | ||
6083578b | 393 | static struct rtl_opt_pass pass_rest_of_compilation = |
f6db1481 | 394 | { |
8ddbbcae | 395 | { |
6083578b | 396 | RTL_PASS, |
cf400ddb | 397 | "*rest_of_compilation", /* name */ |
ef330312 PB |
398 | gate_rest_of_compilation, /* gate */ |
399 | NULL, /* execute */ | |
400 | NULL, /* sub */ | |
401 | NULL, /* next */ | |
402 | 0, /* static_pass_number */ | |
403 | TV_REST_OF_COMPILATION, /* tv_id */ | |
404 | PROP_rtl, /* properties_required */ | |
405 | 0, /* properties_provided */ | |
406 | 0, /* properties_destroyed */ | |
407 | 0, /* todo_flags_start */ | |
8ddbbcae JH |
408 | TODO_ggc_collect /* todo_flags_finish */ |
409 | } | |
ef330312 | 410 | }; |
f6db1481 | 411 | |
ef330312 PB |
412 | static bool |
413 | gate_postreload (void) | |
414 | { | |
415 | return reload_completed; | |
f6db1481 RH |
416 | } |
417 | ||
6083578b | 418 | static struct rtl_opt_pass pass_postreload = |
f6db1481 | 419 | { |
8ddbbcae JH |
420 | { |
421 | RTL_PASS, | |
e0a42b0f | 422 | "*all-postreload", /* name */ |
ef330312 PB |
423 | gate_postreload, /* gate */ |
424 | NULL, /* execute */ | |
425 | NULL, /* sub */ | |
426 | NULL, /* next */ | |
427 | 0, /* static_pass_number */ | |
a222c01a | 428 | TV_POSTRELOAD, /* tv_id */ |
ef330312 PB |
429 | PROP_rtl, /* properties_required */ |
430 | 0, /* properties_provided */ | |
431 | 0, /* properties_destroyed */ | |
432 | 0, /* todo_flags_start */ | |
8ddbbcae JH |
433 | TODO_ggc_collect | TODO_verify_rtl_sharing /* todo_flags_finish */ |
434 | } | |
ef330312 | 435 | }; |
f6db1481 | 436 | |
97b0ade3 | 437 | |
f6db1481 | 438 | |
ef330312 | 439 | /* The root of the compilation pass tree, once constructed. */ |
d7f09764 | 440 | struct opt_pass *all_passes, *all_small_ipa_passes, *all_lowering_passes, |
febb1302 | 441 | *all_regular_ipa_passes, *all_late_ipa_passes, *all_lto_gen_passes; |
f6db1481 | 442 | |
2a5e9d16 JR |
443 | /* This is used by plugins, and should also be used in register_pass. */ |
444 | #define DEF_PASS_LIST(LIST) &LIST, | |
445 | struct opt_pass **gcc_pass_lists[] = { GCC_PASS_LISTS NULL }; | |
446 | #undef DEF_PASS_LIST | |
447 | ||
9fe0cb7d RG |
448 | /* A map from static pass id to optimization pass. */ |
449 | struct opt_pass **passes_by_id; | |
450 | int passes_by_id_size; | |
451 | ||
452 | /* Set the static pass number of pass PASS to ID and record that | |
453 | in the mapping from static pass number to pass. */ | |
454 | ||
455 | static void | |
456 | set_pass_for_id (int id, struct opt_pass *pass) | |
457 | { | |
458 | pass->static_pass_number = id; | |
459 | if (passes_by_id_size <= id) | |
460 | { | |
d3bfe4de | 461 | passes_by_id = XRESIZEVEC (struct opt_pass *, passes_by_id, id + 1); |
9fe0cb7d RG |
462 | memset (passes_by_id + passes_by_id_size, 0, |
463 | (id + 1 - passes_by_id_size) * sizeof (void *)); | |
464 | passes_by_id_size = id + 1; | |
465 | } | |
466 | passes_by_id[id] = pass; | |
467 | } | |
468 | ||
469 | /* Return the pass with the static pass number ID. */ | |
470 | ||
471 | struct opt_pass * | |
472 | get_pass_for_id (int id) | |
473 | { | |
474 | if (id >= passes_by_id_size) | |
475 | return NULL; | |
476 | return passes_by_id[id]; | |
477 | } | |
478 | ||
ef330312 PB |
479 | /* Iterate over the pass tree allocating dump file numbers. We want |
480 | to do this depth first, and independent of whether the pass is | |
481 | enabled or not. */ | |
f6db1481 | 482 | |
68a607d8 | 483 | void |
9e016eba | 484 | register_one_dump_file (struct opt_pass *pass) |
ef330312 PB |
485 | { |
486 | char *dot_name, *flag_name, *glob_name; | |
226c52aa | 487 | const char *name, *full_name, *prefix; |
ef330312 | 488 | char num[10]; |
9fe0cb7d | 489 | int flags, id; |
f6db1481 | 490 | |
ef330312 PB |
491 | /* See below in next_pass_1. */ |
492 | num[0] = '\0'; | |
493 | if (pass->static_pass_number != -1) | |
494 | sprintf (num, "%d", ((int) pass->static_pass_number < 0 | |
495 | ? 1 : pass->static_pass_number)); | |
f6db1481 | 496 | |
e0a42b0f ZC |
497 | /* The name is both used to identify the pass for the purposes of plugins, |
498 | and to specify dump file name and option. | |
499 | The latter two might want something short which is not quite unique; for | |
500 | that reason, we may have a disambiguating prefix, followed by a space | |
501 | to mark the start of the following dump file name / option string. */ | |
502 | name = strchr (pass->name, ' '); | |
503 | name = name ? name + 1 : pass->name; | |
504 | dot_name = concat (".", name, num, NULL); | |
17653c00 | 505 | if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) |
bbbe4e7b | 506 | prefix = "ipa-", flags = TDF_IPA; |
9e016eba | 507 | else if (pass->type == GIMPLE_PASS) |
bbbe4e7b | 508 | prefix = "tree-", flags = TDF_TREE; |
f6db1481 | 509 | else |
bbbe4e7b PB |
510 | prefix = "rtl-", flags = TDF_RTL; |
511 | ||
e0a42b0f ZC |
512 | flag_name = concat (prefix, name, num, NULL); |
513 | glob_name = concat (prefix, name, NULL); | |
9fe0cb7d RG |
514 | id = dump_register (dot_name, flag_name, glob_name, flags); |
515 | set_pass_for_id (id, pass); | |
226c52aa XDL |
516 | full_name = concat (prefix, pass->name, num, NULL); |
517 | register_pass_name (pass, full_name); | |
9f929ce6 | 518 | free (CONST_CAST (char *, full_name)); |
97b0ade3 PB |
519 | } |
520 | ||
bbbe4e7b PB |
521 | /* Recursive worker function for register_dump_files. */ |
522 | ||
b8698a0f | 523 | static int |
9e016eba | 524 | register_dump_files_1 (struct opt_pass *pass, int properties) |
97b0ade3 | 525 | { |
ef330312 PB |
526 | do |
527 | { | |
bbbe4e7b PB |
528 | int new_properties = (properties | pass->properties_provided) |
529 | & ~pass->properties_destroyed; | |
f6db1481 | 530 | |
8e352cd3 | 531 | if (pass->name && pass->name[0] != '*') |
9e016eba | 532 | register_one_dump_file (pass); |
f6db1481 | 533 | |
ef330312 | 534 | if (pass->sub) |
9e016eba | 535 | new_properties = register_dump_files_1 (pass->sub, new_properties); |
f6db1481 | 536 | |
ef330312 PB |
537 | /* If we have a gate, combine the properties that we could have with |
538 | and without the pass being examined. */ | |
539 | if (pass->gate) | |
540 | properties &= new_properties; | |
541 | else | |
542 | properties = new_properties; | |
f6db1481 | 543 | |
ef330312 | 544 | pass = pass->next; |
f6db1481 | 545 | } |
ef330312 | 546 | while (pass); |
f6db1481 | 547 | |
ef330312 | 548 | return properties; |
f6db1481 | 549 | } |
f9957958 | 550 | |
b8698a0f | 551 | /* Register the dump files for the pipeline starting at PASS. |
9e016eba JH |
552 | PROPERTIES reflects the properties that are guaranteed to be available at |
553 | the beginning of the pipeline. */ | |
bbbe4e7b | 554 | |
b8698a0f | 555 | static void |
9e016eba | 556 | register_dump_files (struct opt_pass *pass,int properties) |
bbbe4e7b PB |
557 | { |
558 | pass->properties_required |= properties; | |
9e016eba | 559 | register_dump_files_1 (pass, properties); |
bbbe4e7b PB |
560 | } |
561 | ||
226c52aa XDL |
562 | struct pass_registry |
563 | { | |
564 | const char* unique_name; | |
565 | struct opt_pass *pass; | |
566 | }; | |
567 | ||
568 | /* Pass registry hash function. */ | |
569 | ||
570 | static hashval_t | |
571 | passr_hash (const void *p) | |
572 | { | |
573 | const struct pass_registry *const s = (const struct pass_registry *const) p; | |
574 | return htab_hash_string (s->unique_name); | |
575 | } | |
576 | ||
577 | /* Hash equal function */ | |
578 | ||
579 | static int | |
580 | passr_eq (const void *p1, const void *p2) | |
581 | { | |
582 | const struct pass_registry *const s1 = (const struct pass_registry *const) p1; | |
583 | const struct pass_registry *const s2 = (const struct pass_registry *const) p2; | |
584 | ||
585 | return !strcmp (s1->unique_name, s2->unique_name); | |
586 | } | |
587 | ||
deced1e2 | 588 | static htab_t name_to_pass_map = NULL; |
226c52aa XDL |
589 | |
590 | /* Register PASS with NAME. */ | |
591 | ||
592 | static void | |
593 | register_pass_name (struct opt_pass *pass, const char *name) | |
594 | { | |
595 | struct pass_registry **slot; | |
596 | struct pass_registry pr; | |
597 | ||
deced1e2 XDL |
598 | if (!name_to_pass_map) |
599 | name_to_pass_map = htab_create (256, passr_hash, passr_eq, NULL); | |
226c52aa XDL |
600 | |
601 | pr.unique_name = name; | |
deced1e2 | 602 | slot = (struct pass_registry **) htab_find_slot (name_to_pass_map, &pr, INSERT); |
226c52aa XDL |
603 | if (!*slot) |
604 | { | |
605 | struct pass_registry *new_pr; | |
606 | ||
607 | new_pr = XCNEW (struct pass_registry); | |
608 | new_pr->unique_name = xstrdup (name); | |
609 | new_pr->pass = pass; | |
610 | *slot = new_pr; | |
611 | } | |
612 | else | |
613 | return; /* Ignore plugin passes. */ | |
614 | } | |
615 | ||
deced1e2 XDL |
616 | /* Map from pass id to canonicalized pass name. */ |
617 | ||
618 | typedef const char *char_ptr; | |
619 | DEF_VEC_P(char_ptr); | |
620 | DEF_VEC_ALLOC_P(char_ptr, heap); | |
621 | static VEC(char_ptr, heap) *pass_tab = NULL; | |
622 | ||
623 | /* Callback function for traversing NAME_TO_PASS_MAP. */ | |
624 | ||
625 | static int | |
626 | pass_traverse (void **slot, void *data ATTRIBUTE_UNUSED) | |
627 | { | |
628 | struct pass_registry **p = (struct pass_registry **)slot; | |
629 | struct opt_pass *pass = (*p)->pass; | |
630 | ||
631 | gcc_assert (pass->static_pass_number > 0); | |
632 | gcc_assert (pass_tab); | |
633 | ||
634 | VEC_replace (char_ptr, pass_tab, pass->static_pass_number, | |
635 | (*p)->unique_name); | |
636 | ||
637 | return 1; | |
638 | } | |
639 | ||
640 | /* The function traverses NAME_TO_PASS_MAP and creates a pass info | |
641 | table for dumping purpose. */ | |
642 | ||
643 | static void | |
644 | create_pass_tab (void) | |
645 | { | |
646 | if (!flag_dump_passes) | |
647 | return; | |
648 | ||
649 | VEC_safe_grow_cleared (char_ptr, heap, | |
650 | pass_tab, passes_by_id_size + 1); | |
651 | htab_traverse (name_to_pass_map, pass_traverse, NULL); | |
652 | } | |
653 | ||
654 | static bool override_gate_status (struct opt_pass *, tree, bool); | |
655 | ||
656 | /* Dump the instantiated name for PASS. IS_ON indicates if PASS | |
657 | is turned on or not. */ | |
658 | ||
659 | static void | |
660 | dump_one_pass (struct opt_pass *pass, int pass_indent) | |
661 | { | |
662 | int indent = 3 * pass_indent; | |
663 | const char *pn; | |
664 | bool is_on, is_really_on; | |
665 | ||
666 | is_on = (pass->gate == NULL) ? true : pass->gate(); | |
667 | is_really_on = override_gate_status (pass, current_function_decl, is_on); | |
668 | ||
669 | if (pass->static_pass_number <= 0) | |
670 | pn = pass->name; | |
671 | else | |
672 | pn = VEC_index (char_ptr, pass_tab, pass->static_pass_number); | |
673 | ||
674 | fprintf (stderr, "%*s%-40s%*s:%s%s\n", indent, " ", pn, | |
675 | (15 - indent < 0 ? 0 : 15 - indent), " ", | |
676 | is_on ? " ON" : " OFF", | |
677 | ((!is_on) == (!is_really_on) ? "" | |
678 | : (is_really_on ? " (FORCED_ON)" : " (FORCED_OFF)"))); | |
679 | } | |
680 | ||
681 | /* Dump pass list PASS with indentation INDENT. */ | |
682 | ||
683 | static void | |
684 | dump_pass_list (struct opt_pass *pass, int indent) | |
685 | { | |
686 | do | |
687 | { | |
688 | dump_one_pass (pass, indent); | |
689 | if (pass->sub) | |
690 | dump_pass_list (pass->sub, indent + 1); | |
691 | pass = pass->next; | |
692 | } | |
693 | while (pass); | |
694 | } | |
695 | ||
696 | /* Dump all optimization passes. */ | |
697 | ||
698 | void | |
699 | dump_passes (void) | |
700 | { | |
701 | struct cgraph_node *n, *node = NULL; | |
deced1e2 XDL |
702 | |
703 | create_pass_tab(); | |
704 | ||
65c70e6b JH |
705 | FOR_EACH_DEFINED_FUNCTION (n) |
706 | if (DECL_STRUCT_FUNCTION (n->symbol.decl)) | |
707 | { | |
708 | node = n; | |
709 | break; | |
710 | } | |
deced1e2 XDL |
711 | |
712 | if (!node) | |
713 | return; | |
714 | ||
960bfb69 | 715 | push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); |
deced1e2 XDL |
716 | |
717 | dump_pass_list (all_lowering_passes, 1); | |
718 | dump_pass_list (all_small_ipa_passes, 1); | |
719 | dump_pass_list (all_regular_ipa_passes, 1); | |
720 | dump_pass_list (all_lto_gen_passes, 1); | |
febb1302 | 721 | dump_pass_list (all_late_ipa_passes, 1); |
deced1e2 XDL |
722 | dump_pass_list (all_passes, 1); |
723 | ||
724 | pop_cfun (); | |
deced1e2 XDL |
725 | } |
726 | ||
727 | ||
226c52aa XDL |
728 | /* Returns the pass with NAME. */ |
729 | ||
730 | static struct opt_pass * | |
731 | get_pass_by_name (const char *name) | |
732 | { | |
733 | struct pass_registry **slot, pr; | |
734 | ||
226c52aa | 735 | pr.unique_name = name; |
deced1e2 | 736 | slot = (struct pass_registry **) htab_find_slot (name_to_pass_map, |
226c52aa XDL |
737 | &pr, NO_INSERT); |
738 | ||
739 | if (!slot || !*slot) | |
740 | return NULL; | |
741 | ||
742 | return (*slot)->pass; | |
743 | } | |
744 | ||
745 | ||
746 | /* Range [start, last]. */ | |
747 | ||
748 | struct uid_range | |
749 | { | |
750 | unsigned int start; | |
751 | unsigned int last; | |
bb5b1f5e | 752 | const char *assem_name; |
226c52aa XDL |
753 | struct uid_range *next; |
754 | }; | |
755 | ||
756 | typedef struct uid_range *uid_range_p; | |
757 | ||
758 | DEF_VEC_P(uid_range_p); | |
759 | DEF_VEC_ALLOC_P(uid_range_p, heap); | |
760 | ||
761 | static VEC(uid_range_p, heap) *enabled_pass_uid_range_tab = NULL; | |
762 | static VEC(uid_range_p, heap) *disabled_pass_uid_range_tab = NULL; | |
763 | ||
bb5b1f5e | 764 | |
226c52aa XDL |
765 | /* Parse option string for -fdisable- and -fenable- |
766 | The syntax of the options: | |
767 | ||
768 | -fenable-<pass_name> | |
769 | -fdisable-<pass_name> | |
770 | ||
771 | -fenable-<pass_name>=s1:e1,s2:e2,... | |
772 | -fdisable-<pass_name>=s1:e1,s2:e2,... | |
773 | */ | |
774 | ||
775 | static void | |
776 | enable_disable_pass (const char *arg, bool is_enable) | |
777 | { | |
778 | struct opt_pass *pass; | |
779 | char *range_str, *phase_name; | |
780 | char *argstr = xstrdup (arg); | |
781 | VEC(uid_range_p, heap) **tab = 0; | |
782 | ||
783 | range_str = strchr (argstr,'='); | |
784 | if (range_str) | |
785 | { | |
786 | *range_str = '\0'; | |
787 | range_str++; | |
788 | } | |
789 | ||
790 | phase_name = argstr; | |
791 | if (!*phase_name) | |
792 | { | |
793 | if (is_enable) | |
794 | error ("unrecognized option -fenable"); | |
795 | else | |
796 | error ("unrecognized option -fdisable"); | |
797 | free (argstr); | |
798 | return; | |
799 | } | |
800 | pass = get_pass_by_name (phase_name); | |
801 | if (!pass || pass->static_pass_number == -1) | |
802 | { | |
803 | if (is_enable) | |
804 | error ("unknown pass %s specified in -fenable", phase_name); | |
805 | else | |
1eb3478f | 806 | error ("unknown pass %s specified in -fdisable", phase_name); |
226c52aa XDL |
807 | free (argstr); |
808 | return; | |
809 | } | |
810 | ||
811 | if (is_enable) | |
812 | tab = &enabled_pass_uid_range_tab; | |
813 | else | |
814 | tab = &disabled_pass_uid_range_tab; | |
815 | ||
816 | if ((unsigned) pass->static_pass_number >= VEC_length (uid_range_p, *tab)) | |
817 | VEC_safe_grow_cleared (uid_range_p, heap, | |
818 | *tab, pass->static_pass_number + 1); | |
819 | ||
820 | if (!range_str) | |
821 | { | |
822 | uid_range_p slot; | |
823 | uid_range_p new_range = XCNEW (struct uid_range); | |
824 | ||
825 | new_range->start = 0; | |
826 | new_range->last = (unsigned)-1; | |
827 | ||
828 | slot = VEC_index (uid_range_p, *tab, pass->static_pass_number); | |
829 | new_range->next = slot; | |
830 | VEC_replace (uid_range_p, *tab, pass->static_pass_number, | |
831 | new_range); | |
832 | if (is_enable) | |
833 | inform (UNKNOWN_LOCATION, "enable pass %s for functions in the range " | |
834 | "of [%u, %u]", phase_name, new_range->start, new_range->last); | |
835 | else | |
836 | inform (UNKNOWN_LOCATION, "disable pass %s for functions in the range " | |
837 | "of [%u, %u]", phase_name, new_range->start, new_range->last); | |
838 | } | |
839 | else | |
840 | { | |
841 | char *next_range = NULL; | |
842 | char *one_range = range_str; | |
843 | char *end_val = NULL; | |
844 | ||
845 | do | |
846 | { | |
847 | uid_range_p slot; | |
848 | uid_range_p new_range; | |
849 | char *invalid = NULL; | |
850 | long start; | |
bb5b1f5e | 851 | char *func_name = NULL; |
226c52aa XDL |
852 | |
853 | next_range = strchr (one_range, ','); | |
854 | if (next_range) | |
855 | { | |
856 | *next_range = '\0'; | |
857 | next_range++; | |
858 | } | |
859 | ||
860 | end_val = strchr (one_range, ':'); | |
861 | if (end_val) | |
862 | { | |
863 | *end_val = '\0'; | |
864 | end_val++; | |
865 | } | |
866 | start = strtol (one_range, &invalid, 10); | |
867 | if (*invalid || start < 0) | |
868 | { | |
bb5b1f5e XDL |
869 | if (end_val || (one_range[0] >= '0' |
870 | && one_range[0] <= '9')) | |
871 | { | |
872 | error ("Invalid range %s in option %s", | |
873 | one_range, | |
874 | is_enable ? "-fenable" : "-fdisable"); | |
875 | free (argstr); | |
876 | return; | |
877 | } | |
878 | func_name = one_range; | |
226c52aa XDL |
879 | } |
880 | if (!end_val) | |
881 | { | |
882 | new_range = XCNEW (struct uid_range); | |
bb5b1f5e XDL |
883 | if (!func_name) |
884 | { | |
885 | new_range->start = (unsigned) start; | |
886 | new_range->last = (unsigned) start; | |
887 | } | |
888 | else | |
889 | { | |
890 | new_range->start = (unsigned) -1; | |
891 | new_range->last = (unsigned) -1; | |
892 | new_range->assem_name = xstrdup (func_name); | |
893 | } | |
226c52aa XDL |
894 | } |
895 | else | |
896 | { | |
897 | long last = strtol (end_val, &invalid, 10); | |
898 | if (*invalid || last < start) | |
899 | { | |
900 | error ("Invalid range %s in option %s", | |
901 | end_val, | |
902 | is_enable ? "-fenable" : "-fdisable"); | |
903 | free (argstr); | |
904 | return; | |
905 | } | |
906 | new_range = XCNEW (struct uid_range); | |
907 | new_range->start = (unsigned) start; | |
908 | new_range->last = (unsigned) last; | |
909 | } | |
910 | ||
911 | slot = VEC_index (uid_range_p, *tab, pass->static_pass_number); | |
912 | new_range->next = slot; | |
913 | VEC_replace (uid_range_p, *tab, pass->static_pass_number, | |
914 | new_range); | |
226c52aa | 915 | if (is_enable) |
bb5b1f5e XDL |
916 | { |
917 | if (new_range->assem_name) | |
918 | inform (UNKNOWN_LOCATION, | |
919 | "enable pass %s for function %s", | |
920 | phase_name, new_range->assem_name); | |
921 | else | |
922 | inform (UNKNOWN_LOCATION, | |
923 | "enable pass %s for functions in the range of [%u, %u]", | |
924 | phase_name, new_range->start, new_range->last); | |
925 | } | |
226c52aa | 926 | else |
bb5b1f5e XDL |
927 | { |
928 | if (new_range->assem_name) | |
929 | inform (UNKNOWN_LOCATION, | |
930 | "disable pass %s for function %s", | |
931 | phase_name, new_range->assem_name); | |
932 | else | |
933 | inform (UNKNOWN_LOCATION, | |
934 | "disable pass %s for functions in the range of [%u, %u]", | |
935 | phase_name, new_range->start, new_range->last); | |
936 | } | |
226c52aa XDL |
937 | |
938 | one_range = next_range; | |
939 | } while (next_range); | |
940 | } | |
941 | ||
942 | free (argstr); | |
943 | } | |
944 | ||
945 | /* Enable pass specified by ARG. */ | |
946 | ||
947 | void | |
948 | enable_pass (const char *arg) | |
949 | { | |
950 | enable_disable_pass (arg, true); | |
951 | } | |
952 | ||
953 | /* Disable pass specified by ARG. */ | |
954 | ||
955 | void | |
956 | disable_pass (const char *arg) | |
957 | { | |
958 | enable_disable_pass (arg, false); | |
959 | } | |
960 | ||
961 | /* Returns true if PASS is explicitly enabled/disabled for FUNC. */ | |
962 | ||
963 | static bool | |
964 | is_pass_explicitly_enabled_or_disabled (struct opt_pass *pass, | |
965 | tree func, | |
966 | VEC(uid_range_p, heap) *tab) | |
967 | { | |
968 | uid_range_p slot, range; | |
969 | int cgraph_uid; | |
bb5b1f5e | 970 | const char *aname = NULL; |
226c52aa XDL |
971 | |
972 | if (!tab | |
973 | || (unsigned) pass->static_pass_number >= VEC_length (uid_range_p, tab) | |
974 | || pass->static_pass_number == -1) | |
975 | return false; | |
976 | ||
977 | slot = VEC_index (uid_range_p, tab, pass->static_pass_number); | |
978 | if (!slot) | |
979 | return false; | |
980 | ||
981 | cgraph_uid = func ? cgraph_get_node (func)->uid : 0; | |
bb5b1f5e XDL |
982 | if (func && DECL_ASSEMBLER_NAME_SET_P (func)) |
983 | aname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (func)); | |
226c52aa XDL |
984 | |
985 | range = slot; | |
986 | while (range) | |
987 | { | |
988 | if ((unsigned) cgraph_uid >= range->start | |
989 | && (unsigned) cgraph_uid <= range->last) | |
990 | return true; | |
bb5b1f5e XDL |
991 | if (range->assem_name && aname |
992 | && !strcmp (range->assem_name, aname)) | |
993 | return true; | |
226c52aa XDL |
994 | range = range->next; |
995 | } | |
996 | ||
997 | return false; | |
998 | } | |
999 | ||
b80b0fd9 ST |
1000 | /* Look at the static_pass_number and duplicate the pass |
1001 | if it is already added to a list. */ | |
f9957958 | 1002 | |
b80b0fd9 ST |
1003 | static struct opt_pass * |
1004 | make_pass_instance (struct opt_pass *pass, bool track_duplicates) | |
f6db1481 | 1005 | { |
ef330312 PB |
1006 | /* A nonzero static_pass_number indicates that the |
1007 | pass is already in the list. */ | |
1008 | if (pass->static_pass_number) | |
1009 | { | |
82d6e6fc | 1010 | struct opt_pass *new_pass; |
f6db1481 | 1011 | |
63a00e0d DS |
1012 | if (pass->type == GIMPLE_PASS |
1013 | || pass->type == RTL_PASS | |
1014 | || pass->type == SIMPLE_IPA_PASS) | |
1015 | { | |
1016 | new_pass = XNEW (struct opt_pass); | |
1017 | memcpy (new_pass, pass, sizeof (struct opt_pass)); | |
1018 | } | |
1019 | else if (pass->type == IPA_PASS) | |
1020 | { | |
1021 | new_pass = (struct opt_pass *)XNEW (struct ipa_opt_pass_d); | |
1022 | memcpy (new_pass, pass, sizeof (struct ipa_opt_pass_d)); | |
1023 | } | |
1024 | else | |
1025 | gcc_unreachable (); | |
1026 | ||
82d6e6fc | 1027 | new_pass->next = NULL; |
f6db1481 | 1028 | |
82d6e6fc | 1029 | new_pass->todo_flags_start &= ~TODO_mark_first_instance; |
b02b9b53 | 1030 | |
ef330312 PB |
1031 | /* Indicate to register_dump_files that this pass has duplicates, |
1032 | and so it should rename the dump file. The first instance will | |
1033 | be -1, and be number of duplicates = -static_pass_number - 1. | |
1034 | Subsequent instances will be > 0 and just the duplicate number. */ | |
e0a42b0f | 1035 | if ((pass->name && pass->name[0] != '*') || track_duplicates) |
ef330312 PB |
1036 | { |
1037 | pass->static_pass_number -= 1; | |
82d6e6fc | 1038 | new_pass->static_pass_number = -pass->static_pass_number; |
ef330312 | 1039 | } |
b80b0fd9 | 1040 | return new_pass; |
ef330312 PB |
1041 | } |
1042 | else | |
1043 | { | |
b02b9b53 | 1044 | pass->todo_flags_start |= TODO_mark_first_instance; |
ef330312 | 1045 | pass->static_pass_number = -1; |
090fa0ab GF |
1046 | |
1047 | invoke_plugin_callbacks (PLUGIN_NEW_PASS, pass); | |
b8698a0f L |
1048 | } |
1049 | return pass; | |
b80b0fd9 ST |
1050 | } |
1051 | ||
1052 | /* Add a pass to the pass list. Duplicate the pass if it's already | |
1053 | in the list. */ | |
1054 | ||
1055 | static struct opt_pass ** | |
1056 | next_pass_1 (struct opt_pass **list, struct opt_pass *pass) | |
1057 | { | |
e0a42b0f ZC |
1058 | /* Every pass should have a name so that plugins can refer to them. */ |
1059 | gcc_assert (pass->name != NULL); | |
1060 | ||
b80b0fd9 | 1061 | *list = make_pass_instance (pass, false); |
b8698a0f | 1062 | |
ef330312 | 1063 | return &(*list)->next; |
f6db1481 RH |
1064 | } |
1065 | ||
b80b0fd9 ST |
1066 | /* List node for an inserted pass instance. We need to keep track of all |
1067 | the newly-added pass instances (with 'added_pass_nodes' defined below) | |
1068 | so that we can register their dump files after pass-positioning is finished. | |
1069 | Registering dumping files needs to be post-processed or the | |
1070 | static_pass_number of the opt_pass object would be modified and mess up | |
1071 | the dump file names of future pass instances to be added. */ | |
1072 | ||
1073 | struct pass_list_node | |
1074 | { | |
1075 | struct opt_pass *pass; | |
1076 | struct pass_list_node *next; | |
1077 | }; | |
1078 | ||
1079 | static struct pass_list_node *added_pass_nodes = NULL; | |
1080 | static struct pass_list_node *prev_added_pass_node; | |
1081 | ||
b8698a0f | 1082 | /* Insert the pass at the proper position. Return true if the pass |
b80b0fd9 ST |
1083 | is successfully added. |
1084 | ||
1085 | NEW_PASS_INFO - new pass to be inserted | |
1086 | PASS_LIST - root of the pass list to insert the new pass to */ | |
1087 | ||
1088 | static bool | |
1089 | position_pass (struct register_pass_info *new_pass_info, | |
1090 | struct opt_pass **pass_list) | |
1091 | { | |
1092 | struct opt_pass *pass = *pass_list, *prev_pass = NULL; | |
1093 | bool success = false; | |
1094 | ||
1095 | for ( ; pass; prev_pass = pass, pass = pass->next) | |
1096 | { | |
1097 | /* Check if the current pass is of the same type as the new pass and | |
1098 | matches the name and the instance number of the reference pass. */ | |
1099 | if (pass->type == new_pass_info->pass->type | |
1100 | && pass->name | |
1101 | && !strcmp (pass->name, new_pass_info->reference_pass_name) | |
1102 | && ((new_pass_info->ref_pass_instance_number == 0) | |
1103 | || (new_pass_info->ref_pass_instance_number == | |
1104 | pass->static_pass_number) | |
1105 | || (new_pass_info->ref_pass_instance_number == 1 | |
1106 | && pass->todo_flags_start & TODO_mark_first_instance))) | |
1107 | { | |
1108 | struct opt_pass *new_pass; | |
1109 | struct pass_list_node *new_pass_node; | |
1110 | ||
1111 | new_pass = make_pass_instance (new_pass_info->pass, true); | |
b8698a0f | 1112 | |
b80b0fd9 ST |
1113 | /* Insert the new pass instance based on the positioning op. */ |
1114 | switch (new_pass_info->pos_op) | |
1115 | { | |
1116 | case PASS_POS_INSERT_AFTER: | |
1117 | new_pass->next = pass->next; | |
1118 | pass->next = new_pass; | |
1119 | ||
1120 | /* Skip newly inserted pass to avoid repeated | |
1121 | insertions in the case where the new pass and the | |
1122 | existing one have the same name. */ | |
b8698a0f | 1123 | pass = new_pass; |
b80b0fd9 ST |
1124 | break; |
1125 | case PASS_POS_INSERT_BEFORE: | |
1126 | new_pass->next = pass; | |
1127 | if (prev_pass) | |
1128 | prev_pass->next = new_pass; | |
1129 | else | |
1130 | *pass_list = new_pass; | |
1131 | break; | |
1132 | case PASS_POS_REPLACE: | |
1133 | new_pass->next = pass->next; | |
1134 | if (prev_pass) | |
1135 | prev_pass->next = new_pass; | |
1136 | else | |
1137 | *pass_list = new_pass; | |
1138 | new_pass->sub = pass->sub; | |
1139 | new_pass->tv_id = pass->tv_id; | |
1140 | pass = new_pass; | |
1141 | break; | |
1142 | default: | |
d8a07487 | 1143 | error ("invalid pass positioning operation"); |
b80b0fd9 ST |
1144 | return false; |
1145 | } | |
1146 | ||
1147 | /* Save the newly added pass (instance) in the added_pass_nodes | |
1148 | list so that we can register its dump file later. Note that | |
1149 | we cannot register the dump file now because doing so will modify | |
1150 | the static_pass_number of the opt_pass object and therefore | |
1151 | mess up the dump file name of future instances. */ | |
1152 | new_pass_node = XCNEW (struct pass_list_node); | |
1153 | new_pass_node->pass = new_pass; | |
1154 | if (!added_pass_nodes) | |
1155 | added_pass_nodes = new_pass_node; | |
1156 | else | |
1157 | prev_added_pass_node->next = new_pass_node; | |
1158 | prev_added_pass_node = new_pass_node; | |
1159 | ||
1160 | success = true; | |
1161 | } | |
1162 | ||
1163 | if (pass->sub && position_pass (new_pass_info, &pass->sub)) | |
1164 | success = true; | |
1165 | } | |
1166 | ||
1167 | return success; | |
1168 | } | |
1169 | ||
1170 | /* Hooks a new pass into the pass lists. | |
1171 | ||
1172 | PASS_INFO - pass information that specifies the opt_pass object, | |
1173 | reference pass, instance number, and how to position | |
1174 | the pass */ | |
1175 | ||
1176 | void | |
1177 | register_pass (struct register_pass_info *pass_info) | |
1178 | { | |
669887fc DS |
1179 | bool all_instances, success; |
1180 | ||
b9e467a2 BS |
1181 | /* The checks below could fail in buggy plugins. Existing GCC |
1182 | passes should never fail these checks, so we mention plugin in | |
1183 | the messages. */ | |
b80b0fd9 | 1184 | if (!pass_info->pass) |
b9e467a2 BS |
1185 | fatal_error ("plugin cannot register a missing pass"); |
1186 | ||
1187 | if (!pass_info->pass->name) | |
1188 | fatal_error ("plugin cannot register an unnamed pass"); | |
b80b0fd9 ST |
1189 | |
1190 | if (!pass_info->reference_pass_name) | |
b9e467a2 BS |
1191 | fatal_error |
1192 | ("plugin cannot register pass %qs without reference pass name", | |
1193 | pass_info->pass->name); | |
b80b0fd9 | 1194 | |
b9e467a2 | 1195 | /* Try to insert the new pass to the pass lists. We need to check |
669887fc | 1196 | all five lists as the reference pass could be in one (or all) of |
b9e467a2 | 1197 | them. */ |
669887fc DS |
1198 | all_instances = pass_info->ref_pass_instance_number == 0; |
1199 | success = position_pass (pass_info, &all_lowering_passes); | |
1200 | if (!success || all_instances) | |
1201 | success |= position_pass (pass_info, &all_small_ipa_passes); | |
1202 | if (!success || all_instances) | |
1203 | success |= position_pass (pass_info, &all_regular_ipa_passes); | |
1204 | if (!success || all_instances) | |
1205 | success |= position_pass (pass_info, &all_lto_gen_passes); | |
febb1302 JH |
1206 | if (!success || all_instances) |
1207 | success |= position_pass (pass_info, &all_late_ipa_passes); | |
669887fc DS |
1208 | if (!success || all_instances) |
1209 | success |= position_pass (pass_info, &all_passes); | |
1210 | if (!success) | |
b9e467a2 BS |
1211 | fatal_error |
1212 | ("pass %qs not found but is referenced by new pass %qs", | |
1213 | pass_info->reference_pass_name, pass_info->pass->name); | |
669887fc DS |
1214 | |
1215 | /* OK, we have successfully inserted the new pass. We need to register | |
1216 | the dump files for the newly added pass and its duplicates (if any). | |
1217 | Because the registration of plugin/backend passes happens after the | |
1218 | command-line options are parsed, the options that specify single | |
1219 | pass dumping (e.g. -fdump-tree-PASSNAME) cannot be used for new | |
1220 | passes. Therefore we currently can only enable dumping of | |
1221 | new passes when the 'dump-all' flags (e.g. -fdump-tree-all) | |
1222 | are specified. While doing so, we also delete the pass_list_node | |
1223 | objects created during pass positioning. */ | |
1224 | while (added_pass_nodes) | |
b80b0fd9 | 1225 | { |
669887fc DS |
1226 | struct pass_list_node *next_node = added_pass_nodes->next; |
1227 | enum tree_dump_index tdi; | |
1228 | register_one_dump_file (added_pass_nodes->pass); | |
1229 | if (added_pass_nodes->pass->type == SIMPLE_IPA_PASS | |
1230 | || added_pass_nodes->pass->type == IPA_PASS) | |
1231 | tdi = TDI_ipa_all; | |
1232 | else if (added_pass_nodes->pass->type == GIMPLE_PASS) | |
1233 | tdi = TDI_tree_all; | |
1234 | else | |
1235 | tdi = TDI_rtl_all; | |
1236 | /* Check if dump-all flag is specified. */ | |
78c60e3d | 1237 | if (get_dump_file_info (tdi)->pstate) |
669887fc | 1238 | get_dump_file_info (added_pass_nodes->pass->static_pass_number) |
78c60e3d | 1239 | ->pstate = get_dump_file_info (tdi)->pstate; |
669887fc DS |
1240 | XDELETE (added_pass_nodes); |
1241 | added_pass_nodes = next_node; | |
b80b0fd9 ST |
1242 | } |
1243 | } | |
6fb5fa3c | 1244 | |
dd97d271 DN |
1245 | /* Construct the pass tree. The sequencing of passes is driven by |
1246 | the cgraph routines: | |
1247 | ||
65d630d4 | 1248 | finalize_compilation_unit () |
dd97d271 DN |
1249 | for each node N in the cgraph |
1250 | cgraph_analyze_function (N) | |
1251 | cgraph_lower_function (N) -> all_lowering_passes | |
1252 | ||
65d630d4 | 1253 | If we are optimizing, compile is then invoked: |
dd97d271 | 1254 | |
65d630d4 | 1255 | compile () |
d7f09764 | 1256 | ipa_passes () -> all_small_ipa_passes |
65d630d4 JH |
1257 | -> Analysis of all_regular_ipa_passes |
1258 | * possible LTO streaming at copmilation time * | |
1259 | -> Execution of all_regular_ipa_passes | |
1260 | * possible LTO streaming at link time * | |
1261 | -> all_late_ipa_passes | |
1262 | expand_all_functions () | |
dd97d271 | 1263 | for each node N in the cgraph |
65d630d4 JH |
1264 | expand_function (N) -> Transformation of all_regular_ipa_passes |
1265 | -> all_passes | |
dd97d271 | 1266 | */ |
97b0ade3 | 1267 | |
ef330312 PB |
1268 | void |
1269 | init_optimization_passes (void) | |
1270 | { | |
8ddbbcae | 1271 | struct opt_pass **p; |
ef330312 | 1272 | |
8ddbbcae | 1273 | #define NEXT_PASS(PASS) (p = next_pass_1 (p, &((PASS).pass))) |
873aa8f5 | 1274 | |
f1bd2543 JH |
1275 | /* All passes needed to lower the function into shape optimizers can |
1276 | operate on. These passes are always run first on the function, but | |
1277 | backend might produce already lowered functions that are not processed | |
1278 | by these passes. */ | |
ef330312 | 1279 | p = &all_lowering_passes; |
a406865a RG |
1280 | NEXT_PASS (pass_warn_unused_result); |
1281 | NEXT_PASS (pass_diagnose_omp_blocks); | |
0a35513e | 1282 | NEXT_PASS (pass_diagnose_tm_blocks); |
ef330312 | 1283 | NEXT_PASS (pass_mudflap_1); |
953ff289 | 1284 | NEXT_PASS (pass_lower_omp); |
ef330312 | 1285 | NEXT_PASS (pass_lower_cf); |
0a35513e | 1286 | NEXT_PASS (pass_lower_tm); |
a24549d4 | 1287 | NEXT_PASS (pass_refactor_eh); |
ef330312 PB |
1288 | NEXT_PASS (pass_lower_eh); |
1289 | NEXT_PASS (pass_build_cfg); | |
ef330312 | 1290 | NEXT_PASS (pass_warn_function_return); |
2dee695b | 1291 | NEXT_PASS (pass_build_cgraph_edges); |
ef330312 PB |
1292 | *p = NULL; |
1293 | ||
7e8b322a | 1294 | /* Interprocedural optimization passes. */ |
d7f09764 | 1295 | p = &all_small_ipa_passes; |
b6050cb7 | 1296 | NEXT_PASS (pass_ipa_free_lang_data); |
f1bd2543 | 1297 | NEXT_PASS (pass_ipa_function_and_variable_visibility); |
f1bd2543 JH |
1298 | NEXT_PASS (pass_early_local_passes); |
1299 | { | |
8ddbbcae | 1300 | struct opt_pass **p = &pass_early_local_passes.pass.sub; |
6f1873a1 | 1301 | NEXT_PASS (pass_fixup_cfg); |
f1bd2543 JH |
1302 | NEXT_PASS (pass_init_datastructures); |
1303 | NEXT_PASS (pass_expand_omp); | |
c72321c9 | 1304 | |
c72321c9 | 1305 | NEXT_PASS (pass_build_ssa); |
47853c73 | 1306 | NEXT_PASS (pass_lower_vector); |
2dc74010 | 1307 | NEXT_PASS (pass_early_warn_uninitialized); |
d7f09764 | 1308 | NEXT_PASS (pass_rebuild_cgraph_edges); |
bb7e6d55 | 1309 | NEXT_PASS (pass_inline_parameters); |
d7f09764 | 1310 | NEXT_PASS (pass_early_inline); |
f1bd2543 JH |
1311 | NEXT_PASS (pass_all_early_optimizations); |
1312 | { | |
8ddbbcae | 1313 | struct opt_pass **p = &pass_all_early_optimizations.pass.sub; |
133f9369 | 1314 | NEXT_PASS (pass_remove_cgraph_callee_edges); |
f1bd2543 JH |
1315 | NEXT_PASS (pass_rename_ssa_copies); |
1316 | NEXT_PASS (pass_ccp); | |
edb32daf RG |
1317 | /* After CCP we rewrite no longer addressed locals into SSA |
1318 | form if possible. */ | |
f1bd2543 | 1319 | NEXT_PASS (pass_forwprop); |
6b8ed145 | 1320 | /* pass_build_ealias is a dummy pass that ensures that we |
edb32daf | 1321 | execute TODO_rebuild_alias at this point. */ |
6b8ed145 | 1322 | NEXT_PASS (pass_build_ealias); |
029f45bd | 1323 | NEXT_PASS (pass_sra_early); |
605896f5 | 1324 | NEXT_PASS (pass_fre); |
f1bd2543 JH |
1325 | NEXT_PASS (pass_copy_prop); |
1326 | NEXT_PASS (pass_merge_phi); | |
11b08ee9 | 1327 | NEXT_PASS (pass_cd_dce); |
07ffa034 | 1328 | NEXT_PASS (pass_early_ipa_sra); |
f1bd2543 | 1329 | NEXT_PASS (pass_tail_recursion); |
b6e99746 | 1330 | NEXT_PASS (pass_convert_switch); |
a8da523f | 1331 | NEXT_PASS (pass_cleanup_eh); |
45a80bb9 | 1332 | NEXT_PASS (pass_profile); |
33977f81 | 1333 | NEXT_PASS (pass_local_pure_const); |
3e485f62 JH |
1334 | /* Split functions creates parts that are not run through |
1335 | early optimizations again. It is thus good idea to do this | |
1336 | late. */ | |
1337 | NEXT_PASS (pass_split_functions); | |
f1bd2543 | 1338 | } |
c72321c9 | 1339 | NEXT_PASS (pass_release_ssa_names); |
f1bd2543 | 1340 | NEXT_PASS (pass_rebuild_cgraph_edges); |
b91bc349 | 1341 | NEXT_PASS (pass_inline_parameters); |
f1bd2543 | 1342 | } |
a8da72b8 | 1343 | NEXT_PASS (pass_ipa_free_inline_summary); |
4d3814a5 | 1344 | NEXT_PASS (pass_ipa_tree_profile); |
cf9712cc JH |
1345 | { |
1346 | struct opt_pass **p = &pass_ipa_tree_profile.pass.sub; | |
1347 | NEXT_PASS (pass_feedback_split_functions); | |
1348 | } | |
f1bd2543 | 1349 | NEXT_PASS (pass_ipa_increase_alignment); |
0a35513e | 1350 | NEXT_PASS (pass_ipa_tm); |
8b84c596 | 1351 | NEXT_PASS (pass_ipa_lower_emutls); |
d7f09764 DN |
1352 | *p = NULL; |
1353 | ||
1354 | p = &all_regular_ipa_passes; | |
b20996ff | 1355 | NEXT_PASS (pass_ipa_whole_program_visibility); |
e65bb9be | 1356 | NEXT_PASS (pass_ipa_profile); |
f1bd2543 | 1357 | NEXT_PASS (pass_ipa_cp); |
9e97ff61 | 1358 | NEXT_PASS (pass_ipa_cdtor_merge); |
f1bd2543 | 1359 | NEXT_PASS (pass_ipa_inline); |
b8698a0f | 1360 | NEXT_PASS (pass_ipa_pure_const); |
514f01ad | 1361 | NEXT_PASS (pass_ipa_reference); |
d7f09764 DN |
1362 | *p = NULL; |
1363 | ||
1364 | p = &all_lto_gen_passes; | |
1365 | NEXT_PASS (pass_ipa_lto_gimple_out); | |
d7f09764 | 1366 | NEXT_PASS (pass_ipa_lto_finish_out); /* This must be the last LTO pass. */ |
7a388ee4 JH |
1367 | *p = NULL; |
1368 | ||
febb1302 JH |
1369 | /* Simple IPA passes executed after the regular passes. In WHOPR mode the |
1370 | passes are executed after partitioning and thus see just parts of the | |
1371 | compiled unit. */ | |
1372 | p = &all_late_ipa_passes; | |
1373 | NEXT_PASS (pass_ipa_pta); | |
1374 | *p = NULL; | |
6083578b | 1375 | |
b3f7d793 DN |
1376 | /* These passes are run after IPA passes on every function that is being |
1377 | output to the assembler file. */ | |
ef330312 | 1378 | p = &all_passes; |
febb1302 | 1379 | NEXT_PASS (pass_fixup_cfg); |
1d65f45c | 1380 | NEXT_PASS (pass_lower_eh_dispatch); |
ef330312 | 1381 | NEXT_PASS (pass_all_optimizations); |
f1bd2543 | 1382 | { |
8ddbbcae | 1383 | struct opt_pass **p = &pass_all_optimizations.pass.sub; |
133f9369 | 1384 | NEXT_PASS (pass_remove_cgraph_callee_edges); |
11b08ee9 RG |
1385 | /* Initial scalar cleanups before alias computation. |
1386 | They ensure memory accesses are not indirect wherever possible. */ | |
7299cb99 | 1387 | NEXT_PASS (pass_strip_predict_hints); |
f1bd2543 | 1388 | NEXT_PASS (pass_rename_ssa_copies); |
d6e840ee | 1389 | NEXT_PASS (pass_complete_unrolli); |
f1bd2543 | 1390 | NEXT_PASS (pass_ccp); |
edb32daf RG |
1391 | /* After CCP we rewrite no longer addressed locals into SSA |
1392 | form if possible. */ | |
e2081a1d | 1393 | NEXT_PASS (pass_forwprop); |
11b08ee9 | 1394 | /* pass_build_alias is a dummy pass that ensures that we |
edb32daf | 1395 | execute TODO_rebuild_alias at this point. */ |
11b08ee9 RG |
1396 | NEXT_PASS (pass_build_alias); |
1397 | NEXT_PASS (pass_return_slot); | |
3b48ccbc | 1398 | NEXT_PASS (pass_phiprop); |
f1bd2543 | 1399 | NEXT_PASS (pass_fre); |
f1bd2543 JH |
1400 | NEXT_PASS (pass_copy_prop); |
1401 | NEXT_PASS (pass_merge_phi); | |
1402 | NEXT_PASS (pass_vrp); | |
1403 | NEXT_PASS (pass_dce); | |
ad14c7da | 1404 | NEXT_PASS (pass_call_cdce); |
a5828d1e | 1405 | NEXT_PASS (pass_cselim); |
18d08014 | 1406 | NEXT_PASS (pass_tree_ifcombine); |
f1bd2543 | 1407 | NEXT_PASS (pass_phiopt); |
f1bd2543 | 1408 | NEXT_PASS (pass_tail_recursion); |
f1bd2543 JH |
1409 | NEXT_PASS (pass_ch); |
1410 | NEXT_PASS (pass_stdarg); | |
1411 | NEXT_PASS (pass_lower_complex); | |
1412 | NEXT_PASS (pass_sra); | |
f1bd2543 | 1413 | NEXT_PASS (pass_rename_ssa_copies); |
44e10129 MM |
1414 | /* The dom pass will also resolve all __builtin_constant_p calls |
1415 | that are still there to 0. This has to be done after some | |
1416 | propagations have already run, but before some more dead code | |
1417 | is removed, and this place fits nicely. Remember this when | |
1418 | trying to move or duplicate pass_dominator somewhere earlier. */ | |
f1bd2543 | 1419 | NEXT_PASS (pass_dominator); |
f1bd2543 JH |
1420 | /* The only const/copy propagation opportunities left after |
1421 | DOM should be due to degenerate PHI nodes. So rather than | |
1422 | run the full propagators, run a specialized pass which | |
1423 | only examines PHIs to discover const/copy propagation | |
1424 | opportunities. */ | |
1425 | NEXT_PASS (pass_phi_only_cprop); | |
25c6036a | 1426 | NEXT_PASS (pass_dse); |
f1bd2543 JH |
1427 | NEXT_PASS (pass_reassoc); |
1428 | NEXT_PASS (pass_dce); | |
f1bd2543 JH |
1429 | NEXT_PASS (pass_forwprop); |
1430 | NEXT_PASS (pass_phiopt); | |
1431 | NEXT_PASS (pass_object_sizes); | |
8b57bfeb | 1432 | NEXT_PASS (pass_strlen); |
a4b8a65f | 1433 | NEXT_PASS (pass_ccp); |
edb32daf RG |
1434 | /* After CCP we rewrite no longer addressed locals into SSA |
1435 | form if possible. */ | |
324d2217 | 1436 | NEXT_PASS (pass_copy_prop); |
f1bd2543 | 1437 | NEXT_PASS (pass_cse_sincos); |
03bd2f1a | 1438 | NEXT_PASS (pass_optimize_bswap); |
f1bd2543 JH |
1439 | NEXT_PASS (pass_split_crit_edges); |
1440 | NEXT_PASS (pass_pre); | |
f1bd2543 JH |
1441 | NEXT_PASS (pass_sink_code); |
1442 | NEXT_PASS (pass_tree_loop); | |
1443 | { | |
8ddbbcae | 1444 | struct opt_pass **p = &pass_tree_loop.pass.sub; |
f1bd2543 | 1445 | NEXT_PASS (pass_tree_loop_init); |
c86a3947 | 1446 | NEXT_PASS (pass_lim); |
f1bd2543 | 1447 | NEXT_PASS (pass_copy_prop); |
bbc8a8dc | 1448 | NEXT_PASS (pass_dce_loop); |
f1bd2543 JH |
1449 | NEXT_PASS (pass_tree_unswitch); |
1450 | NEXT_PASS (pass_scev_cprop); | |
f1bd2543 | 1451 | NEXT_PASS (pass_record_bounds); |
3d8864c0 | 1452 | NEXT_PASS (pass_check_data_deps); |
dea61d92 | 1453 | NEXT_PASS (pass_loop_distribution); |
d4332d00 SP |
1454 | NEXT_PASS (pass_copy_prop); |
1455 | NEXT_PASS (pass_graphite); | |
204b560f | 1456 | { |
d4332d00 | 1457 | struct opt_pass **p = &pass_graphite.pass.sub; |
d4332d00 | 1458 | NEXT_PASS (pass_graphite_transforms); |
9dac82c4 | 1459 | NEXT_PASS (pass_lim); |
caaf41d0 | 1460 | NEXT_PASS (pass_copy_prop); |
204b560f | 1461 | NEXT_PASS (pass_dce_loop); |
204b560f | 1462 | } |
f1bd2543 JH |
1463 | NEXT_PASS (pass_iv_canon); |
1464 | NEXT_PASS (pass_if_conversion); | |
1465 | NEXT_PASS (pass_vectorize); | |
1466 | { | |
8ddbbcae | 1467 | struct opt_pass **p = &pass_vectorize.pass.sub; |
f1bd2543 JH |
1468 | NEXT_PASS (pass_dce_loop); |
1469 | } | |
6a753d5f | 1470 | NEXT_PASS (pass_predcom); |
f1bd2543 | 1471 | NEXT_PASS (pass_complete_unroll); |
a70d6342 | 1472 | NEXT_PASS (pass_slp_vectorize); |
5f40b3cb | 1473 | NEXT_PASS (pass_parallelize_loops); |
f1bd2543 JH |
1474 | NEXT_PASS (pass_loop_prefetch); |
1475 | NEXT_PASS (pass_iv_optimize); | |
d3b7e946 | 1476 | NEXT_PASS (pass_lim); |
f1bd2543 JH |
1477 | NEXT_PASS (pass_tree_loop_done); |
1478 | } | |
f90e8e2e | 1479 | NEXT_PASS (pass_lower_vector_ssa); |
f1bd2543 JH |
1480 | NEXT_PASS (pass_cse_reciprocals); |
1481 | NEXT_PASS (pass_reassoc); | |
1482 | NEXT_PASS (pass_vrp); | |
f9453c07 | 1483 | NEXT_PASS (pass_strength_reduction); |
f1bd2543 | 1484 | NEXT_PASS (pass_dominator); |
f1bd2543 JH |
1485 | /* The only const/copy propagation opportunities left after |
1486 | DOM should be due to degenerate PHI nodes. So rather than | |
1487 | run the full propagators, run a specialized pass which | |
1488 | only examines PHIs to discover const/copy propagation | |
1489 | opportunities. */ | |
1490 | NEXT_PASS (pass_phi_only_cprop); | |
f1bd2543 | 1491 | NEXT_PASS (pass_cd_dce); |
232abc3f | 1492 | NEXT_PASS (pass_tracer); |
f1bd2543 JH |
1493 | |
1494 | /* FIXME: If DCE is not run before checking for uninitialized uses, | |
1495 | we may get false warnings (e.g., testsuite/gcc.dg/uninit-5.c). | |
1496 | However, this also causes us to misdiagnose cases that should be | |
1497 | real warnings (e.g., testsuite/gcc.dg/pr18501.c). | |
b8698a0f | 1498 | |
f1bd2543 JH |
1499 | To fix the false positives in uninit-5.c, we would have to |
1500 | account for the predicates protecting the set and the use of each | |
1501 | variable. Using a representation like Gated Single Assignment | |
1502 | may help. */ | |
1503 | NEXT_PASS (pass_late_warn_uninitialized); | |
1504 | NEXT_PASS (pass_dse); | |
1505 | NEXT_PASS (pass_forwprop); | |
1506 | NEXT_PASS (pass_phiopt); | |
44e10129 | 1507 | NEXT_PASS (pass_fold_builtins); |
5b58b39b | 1508 | NEXT_PASS (pass_optimize_widening_mul); |
f1bd2543 JH |
1509 | NEXT_PASS (pass_tail_calls); |
1510 | NEXT_PASS (pass_rename_ssa_copies); | |
1511 | NEXT_PASS (pass_uncprop); | |
33977f81 | 1512 | NEXT_PASS (pass_local_pure_const); |
f1bd2543 | 1513 | } |
bf7a7185 RG |
1514 | NEXT_PASS (pass_all_optimizations_g); |
1515 | { | |
1516 | struct opt_pass **p = &pass_all_optimizations_g.pass.sub; | |
1517 | NEXT_PASS (pass_remove_cgraph_callee_edges); | |
1518 | NEXT_PASS (pass_strip_predict_hints); | |
1519 | /* Lower remaining pieces of GIMPLE. */ | |
1520 | NEXT_PASS (pass_lower_complex); | |
1521 | NEXT_PASS (pass_lower_vector_ssa); | |
1522 | /* Perform simple scalar cleanup which is constant/copy propagation. */ | |
1523 | NEXT_PASS (pass_ccp); | |
2d5fec4e RG |
1524 | NEXT_PASS (pass_object_sizes); |
1525 | /* Copy propagation also copy-propagates constants, this is necessary | |
1526 | to forward object-size results properly. */ | |
bf7a7185 RG |
1527 | NEXT_PASS (pass_copy_prop); |
1528 | NEXT_PASS (pass_rename_ssa_copies); | |
1529 | NEXT_PASS (pass_dce); | |
1530 | /* Fold remaining builtins. */ | |
bf7a7185 RG |
1531 | NEXT_PASS (pass_fold_builtins); |
1532 | /* ??? We do want some kind of loop invariant motion, but we possibly | |
1533 | need to adjust LIM to be more friendly towards preserving accurate | |
1534 | debug information here. */ | |
1535 | NEXT_PASS (pass_late_warn_uninitialized); | |
1536 | NEXT_PASS (pass_uncprop); | |
1537 | NEXT_PASS (pass_local_pure_const); | |
1538 | } | |
0a35513e AH |
1539 | NEXT_PASS (pass_tm_init); |
1540 | { | |
1541 | struct opt_pass **p = &pass_tm_init.pass.sub; | |
1542 | NEXT_PASS (pass_tm_mark); | |
1543 | NEXT_PASS (pass_tm_memopt); | |
1544 | NEXT_PASS (pass_tm_edges); | |
1545 | } | |
688a482d | 1546 | NEXT_PASS (pass_lower_complex_O0); |
6d07ad98 | 1547 | NEXT_PASS (pass_cleanup_eh); |
1d65f45c | 1548 | NEXT_PASS (pass_lower_resx); |
c72321c9 | 1549 | NEXT_PASS (pass_nrv); |
4e3825db | 1550 | NEXT_PASS (pass_mudflap_2); |
c72321c9 | 1551 | NEXT_PASS (pass_cleanup_cfg_post_optimizing); |
ef330312 | 1552 | NEXT_PASS (pass_warn_function_noreturn); |
726a989a | 1553 | |
ef330312 | 1554 | NEXT_PASS (pass_expand); |
4e3825db | 1555 | |
ef330312 | 1556 | NEXT_PASS (pass_rest_of_compilation); |
f1bd2543 | 1557 | { |
8ddbbcae | 1558 | struct opt_pass **p = &pass_rest_of_compilation.pass.sub; |
7114321e | 1559 | NEXT_PASS (pass_instantiate_virtual_regs); |
45dbce1b | 1560 | NEXT_PASS (pass_into_cfg_layout_mode); |
11a687e7 | 1561 | NEXT_PASS (pass_jump); |
f1bd2543 | 1562 | NEXT_PASS (pass_lower_subreg); |
6fb5fa3c | 1563 | NEXT_PASS (pass_df_initialize_opt); |
f1bd2543 JH |
1564 | NEXT_PASS (pass_cse); |
1565 | NEXT_PASS (pass_rtl_fwprop); | |
5f39ad47 SB |
1566 | NEXT_PASS (pass_rtl_cprop); |
1567 | NEXT_PASS (pass_rtl_pre); | |
1568 | NEXT_PASS (pass_rtl_hoist); | |
1569 | NEXT_PASS (pass_rtl_cprop); | |
1570 | NEXT_PASS (pass_rtl_store_motion); | |
1571 | NEXT_PASS (pass_cse_after_global_opts); | |
f1bd2543 | 1572 | NEXT_PASS (pass_rtl_ifcvt); |
1833192f | 1573 | NEXT_PASS (pass_reginfo_init); |
f1bd2543 JH |
1574 | /* Perform loop optimizations. It might be better to do them a bit |
1575 | sooner, but we want the profile feedback to work more | |
1576 | efficiently. */ | |
1577 | NEXT_PASS (pass_loop2); | |
1578 | { | |
8ddbbcae | 1579 | struct opt_pass **p = &pass_loop2.pass.sub; |
f1bd2543 JH |
1580 | NEXT_PASS (pass_rtl_loop_init); |
1581 | NEXT_PASS (pass_rtl_move_loop_invariants); | |
1582 | NEXT_PASS (pass_rtl_unswitch); | |
1583 | NEXT_PASS (pass_rtl_unroll_and_peel_loops); | |
1584 | NEXT_PASS (pass_rtl_doloop); | |
1585 | NEXT_PASS (pass_rtl_loop_done); | |
1586 | *p = NULL; | |
1587 | } | |
1588 | NEXT_PASS (pass_web); | |
5f39ad47 | 1589 | NEXT_PASS (pass_rtl_cprop); |
f1bd2543 | 1590 | NEXT_PASS (pass_cse2); |
6fb5fa3c | 1591 | NEXT_PASS (pass_rtl_dse1); |
f1bd2543 | 1592 | NEXT_PASS (pass_rtl_fwprop_addr); |
6fb5fa3c DB |
1593 | NEXT_PASS (pass_inc_dec); |
1594 | NEXT_PASS (pass_initialize_regs); | |
6fb5fa3c | 1595 | NEXT_PASS (pass_ud_rtl_dce); |
f1bd2543 JH |
1596 | NEXT_PASS (pass_combine); |
1597 | NEXT_PASS (pass_if_after_combine); | |
1598 | NEXT_PASS (pass_partition_blocks); | |
1599 | NEXT_PASS (pass_regmove); | |
d25aa7ab | 1600 | NEXT_PASS (pass_outof_cfg_layout_mode); |
f1bd2543 JH |
1601 | NEXT_PASS (pass_split_all_insns); |
1602 | NEXT_PASS (pass_lower_subreg2); | |
6fb5fa3c DB |
1603 | NEXT_PASS (pass_df_initialize_no_opt); |
1604 | NEXT_PASS (pass_stack_ptr_mod); | |
f1bd2543 | 1605 | NEXT_PASS (pass_mode_switching); |
d8d72314 | 1606 | NEXT_PASS (pass_match_asm_constraints); |
f1bd2543 | 1607 | NEXT_PASS (pass_sms); |
ce18efcb | 1608 | NEXT_PASS (pass_sched); |
058e97ec | 1609 | NEXT_PASS (pass_ira); |
ae2b9cb6 | 1610 | NEXT_PASS (pass_reload); |
f1bd2543 JH |
1611 | NEXT_PASS (pass_postreload); |
1612 | { | |
8ddbbcae | 1613 | struct opt_pass **p = &pass_postreload.pass.sub; |
f1bd2543 JH |
1614 | NEXT_PASS (pass_postreload_cse); |
1615 | NEXT_PASS (pass_gcse2); | |
6fb5fa3c | 1616 | NEXT_PASS (pass_split_after_reload); |
26cd9add | 1617 | NEXT_PASS (pass_ree); |
e692f276 | 1618 | NEXT_PASS (pass_compare_elim_after_reload); |
6fb5fa3c DB |
1619 | NEXT_PASS (pass_branch_target_load_optimize1); |
1620 | NEXT_PASS (pass_thread_prologue_and_epilogue); | |
1621 | NEXT_PASS (pass_rtl_dse2); | |
f1bd2543 | 1622 | NEXT_PASS (pass_stack_adjustments); |
11a687e7 | 1623 | NEXT_PASS (pass_jump2); |
f1bd2543 JH |
1624 | NEXT_PASS (pass_peephole2); |
1625 | NEXT_PASS (pass_if_after_reload); | |
1626 | NEXT_PASS (pass_regrename); | |
6fb5fa3c DB |
1627 | NEXT_PASS (pass_cprop_hardreg); |
1628 | NEXT_PASS (pass_fast_rtl_dce); | |
f1bd2543 | 1629 | NEXT_PASS (pass_reorder_blocks); |
6fb5fa3c | 1630 | NEXT_PASS (pass_branch_target_load_optimize2); |
f1bd2543 | 1631 | NEXT_PASS (pass_leaf_regs); |
6fb5fa3c | 1632 | NEXT_PASS (pass_split_before_sched2); |
f1bd2543 | 1633 | NEXT_PASS (pass_sched2); |
f1bd2543 | 1634 | NEXT_PASS (pass_stack_regs); |
6fb5fa3c | 1635 | { |
8ddbbcae | 1636 | struct opt_pass **p = &pass_stack_regs.pass.sub; |
6fb5fa3c DB |
1637 | NEXT_PASS (pass_split_before_regstack); |
1638 | NEXT_PASS (pass_stack_regs_run); | |
1639 | } | |
f1bd2543 JH |
1640 | NEXT_PASS (pass_compute_alignments); |
1641 | NEXT_PASS (pass_duplicate_computed_gotos); | |
1642 | NEXT_PASS (pass_variable_tracking); | |
1643 | NEXT_PASS (pass_free_cfg); | |
1644 | NEXT_PASS (pass_machine_reorg); | |
1645 | NEXT_PASS (pass_cleanup_barriers); | |
1646 | NEXT_PASS (pass_delay_slots); | |
1647 | NEXT_PASS (pass_split_for_shorten_branches); | |
1648 | NEXT_PASS (pass_convert_to_eh_region_ranges); | |
1649 | NEXT_PASS (pass_shorten_branches); | |
1650 | NEXT_PASS (pass_set_nothrow_function_flags); | |
7644b3c7 | 1651 | NEXT_PASS (pass_dwarf2_frame); |
f1bd2543 JH |
1652 | NEXT_PASS (pass_final); |
1653 | } | |
0b738568 | 1654 | NEXT_PASS (pass_df_finish); |
f1bd2543 | 1655 | } |
ef330312 PB |
1656 | NEXT_PASS (pass_clean_state); |
1657 | *p = NULL; | |
1658 | ||
ef330312 PB |
1659 | #undef NEXT_PASS |
1660 | ||
1661 | /* Register the passes with the tree dump code. */ | |
9e016eba | 1662 | register_dump_files (all_lowering_passes, PROP_gimple_any); |
b8698a0f | 1663 | register_dump_files (all_small_ipa_passes, |
d7f09764 DN |
1664 | PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh |
1665 | | PROP_cfg); | |
b8698a0f | 1666 | register_dump_files (all_regular_ipa_passes, |
d7f09764 DN |
1667 | PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh |
1668 | | PROP_cfg); | |
b8698a0f | 1669 | register_dump_files (all_lto_gen_passes, |
bbbe4e7b PB |
1670 | PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh |
1671 | | PROP_cfg); | |
febb1302 JH |
1672 | register_dump_files (all_late_ipa_passes, |
1673 | PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | |
1674 | | PROP_cfg); | |
b8698a0f | 1675 | register_dump_files (all_passes, |
bbbe4e7b PB |
1676 | PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh |
1677 | | PROP_cfg); | |
ef330312 PB |
1678 | } |
1679 | ||
a5093353 JH |
1680 | /* If we are in IPA mode (i.e., current_function_decl is NULL), call |
1681 | function CALLBACK for every function in the call graph. Otherwise, | |
b8698a0f | 1682 | call CALLBACK on the current function. */ |
bbbe4e7b | 1683 | |
ef330312 | 1684 | static void |
a5093353 | 1685 | do_per_function (void (*callback) (void *data), void *data) |
ef330312 | 1686 | { |
a5093353 JH |
1687 | if (current_function_decl) |
1688 | callback (data); | |
1689 | else | |
1690 | { | |
1691 | struct cgraph_node *node; | |
65c70e6b JH |
1692 | FOR_EACH_DEFINED_FUNCTION (node) |
1693 | if (gimple_has_body_p (node->symbol.decl) | |
960bfb69 | 1694 | && (!node->clone_of || node->symbol.decl != node->clone_of->symbol.decl)) |
a5093353 | 1695 | { |
960bfb69 | 1696 | push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); |
a5093353 | 1697 | callback (data); |
d7f09764 DN |
1698 | if (!flag_wpa) |
1699 | { | |
1700 | free_dominance_info (CDI_DOMINATORS); | |
1701 | free_dominance_info (CDI_POST_DOMINATORS); | |
1702 | } | |
a5093353 JH |
1703 | pop_cfun (); |
1704 | ggc_collect (); | |
1705 | } | |
1706 | } | |
1707 | } | |
1708 | ||
873aa8f5 JH |
1709 | /* Because inlining might remove no-longer reachable nodes, we need to |
1710 | keep the array visible to garbage collector to avoid reading collected | |
1711 | out nodes. */ | |
1712 | static int nnodes; | |
a9429e29 | 1713 | static GTY ((length ("nnodes"))) cgraph_node_ptr *order; |
873aa8f5 JH |
1714 | |
1715 | /* If we are in IPA mode (i.e., current_function_decl is NULL), call | |
1716 | function CALLBACK for every function in the call graph. Otherwise, | |
090fa0ab GF |
1717 | call CALLBACK on the current function. |
1718 | This function is global so that plugins can use it. */ | |
1719 | void | |
873aa8f5 JH |
1720 | do_per_function_toporder (void (*callback) (void *data), void *data) |
1721 | { | |
1722 | int i; | |
1723 | ||
1724 | if (current_function_decl) | |
1725 | callback (data); | |
1726 | else | |
1727 | { | |
1728 | gcc_assert (!order); | |
a9429e29 | 1729 | order = ggc_alloc_vec_cgraph_node_ptr (cgraph_n_nodes); |
af8bca3c | 1730 | nnodes = ipa_reverse_postorder (order); |
257eb6e3 JH |
1731 | for (i = nnodes - 1; i >= 0; i--) |
1732 | order[i]->process = 1; | |
873aa8f5 JH |
1733 | for (i = nnodes - 1; i >= 0; i--) |
1734 | { | |
1735 | struct cgraph_node *node = order[i]; | |
1736 | ||
1737 | /* Allow possibly removed nodes to be garbage collected. */ | |
1738 | order[i] = NULL; | |
257eb6e3 | 1739 | node->process = 0; |
c47d0034 | 1740 | if (cgraph_function_with_gimple_body_p (node)) |
873aa8f5 | 1741 | { |
960bfb69 | 1742 | push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); |
873aa8f5 JH |
1743 | callback (data); |
1744 | free_dominance_info (CDI_DOMINATORS); | |
1745 | free_dominance_info (CDI_POST_DOMINATORS); | |
873aa8f5 JH |
1746 | pop_cfun (); |
1747 | ggc_collect (); | |
1748 | } | |
1749 | } | |
1750 | } | |
1751 | ggc_free (order); | |
1752 | order = NULL; | |
1753 | nnodes = 0; | |
1754 | } | |
1755 | ||
22c5fa5f DL |
1756 | /* Helper function to perform function body dump. */ |
1757 | ||
1758 | static void | |
1759 | execute_function_dump (void *data ATTRIBUTE_UNUSED) | |
1760 | { | |
1761 | if (dump_file && current_function_decl) | |
1762 | { | |
1763 | if (cfun->curr_properties & PROP_trees) | |
1764 | dump_function_to_file (current_function_decl, dump_file, dump_flags); | |
1765 | else | |
1766 | { | |
c4669594 | 1767 | print_rtl_with_bb (dump_file, get_insns (), dump_flags); |
22c5fa5f DL |
1768 | |
1769 | if ((cfun->curr_properties & PROP_cfg) | |
1770 | && graph_dump_format != no_graph | |
1771 | && (dump_flags & TDF_GRAPH)) | |
1772 | print_rtl_graph_with_bb (dump_file_name, get_insns ()); | |
1773 | } | |
1774 | ||
1775 | /* Flush the file. If verification fails, we won't be able to | |
1776 | close the file before aborting. */ | |
1777 | fflush (dump_file); | |
1778 | } | |
1779 | } | |
1780 | ||
37e5402b JH |
1781 | /* Make statistic about profile consistency. */ |
1782 | ||
1783 | struct profile_record | |
1784 | { | |
1785 | int num_mismatched_freq_in[2]; | |
1786 | int num_mismatched_freq_out[2]; | |
1787 | int num_mismatched_count_in[2]; | |
1788 | int num_mismatched_count_out[2]; | |
1789 | bool run; | |
1790 | gcov_type time[2]; | |
1791 | int size[2]; | |
1792 | }; | |
1793 | ||
1794 | static struct profile_record *profile_record; | |
1795 | ||
1796 | static void | |
1797 | check_profile_consistency (int index, int subpass, bool run) | |
1798 | { | |
1799 | basic_block bb; | |
1800 | edge_iterator ei; | |
1801 | edge e; | |
1802 | int sum; | |
1803 | gcov_type lsum; | |
1804 | ||
1805 | if (index == -1) | |
1806 | return; | |
1807 | if (!profile_record) | |
1808 | profile_record = XCNEWVEC (struct profile_record, | |
1809 | passes_by_id_size); | |
1810 | gcc_assert (index < passes_by_id_size && index >= 0); | |
1811 | gcc_assert (subpass < 2); | |
1812 | profile_record[index].run |= run; | |
1813 | ||
1814 | FOR_ALL_BB (bb) | |
1815 | { | |
1816 | if (bb != EXIT_BLOCK_PTR_FOR_FUNCTION (cfun) | |
1817 | && profile_status != PROFILE_ABSENT) | |
1818 | { | |
1819 | sum = 0; | |
1820 | FOR_EACH_EDGE (e, ei, bb->succs) | |
1821 | sum += e->probability; | |
1822 | if (EDGE_COUNT (bb->succs) && abs (sum - REG_BR_PROB_BASE) > 100) | |
1823 | profile_record[index].num_mismatched_freq_out[subpass]++; | |
1824 | lsum = 0; | |
1825 | FOR_EACH_EDGE (e, ei, bb->succs) | |
1826 | lsum += e->count; | |
1827 | if (EDGE_COUNT (bb->succs) | |
1828 | && (lsum - bb->count > 100 || lsum - bb->count < -100)) | |
1829 | profile_record[index].num_mismatched_count_out[subpass]++; | |
1830 | } | |
1831 | if (bb != ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun) | |
1832 | && profile_status != PROFILE_ABSENT) | |
1833 | { | |
1834 | sum = 0; | |
1835 | FOR_EACH_EDGE (e, ei, bb->preds) | |
1836 | sum += EDGE_FREQUENCY (e); | |
1837 | if (abs (sum - bb->frequency) > 100 | |
1838 | || (MAX (sum, bb->frequency) > 10 | |
1839 | && abs ((sum - bb->frequency) * 100 / (MAX (sum, bb->frequency) + 1)) > 10)) | |
1840 | profile_record[index].num_mismatched_freq_in[subpass]++; | |
1841 | lsum = 0; | |
1842 | FOR_EACH_EDGE (e, ei, bb->preds) | |
1843 | lsum += e->count; | |
1844 | if (lsum - bb->count > 100 || lsum - bb->count < -100) | |
1845 | profile_record[index].num_mismatched_count_in[subpass]++; | |
1846 | } | |
1847 | if (bb == ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun) | |
1848 | || bb == EXIT_BLOCK_PTR_FOR_FUNCTION (cfun)) | |
1849 | continue; | |
1850 | if ((cfun && (cfun->curr_properties & PROP_trees))) | |
1851 | { | |
1852 | gimple_stmt_iterator i; | |
1853 | ||
1854 | for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i)) | |
1855 | { | |
1856 | profile_record[index].size[subpass] | |
1857 | += estimate_num_insns (gsi_stmt (i), &eni_size_weights); | |
1858 | if (profile_status == PROFILE_READ) | |
1859 | profile_record[index].time[subpass] | |
1860 | += estimate_num_insns (gsi_stmt (i), | |
1861 | &eni_time_weights) * bb->count; | |
1862 | else if (profile_status == PROFILE_GUESSED) | |
1863 | profile_record[index].time[subpass] | |
1864 | += estimate_num_insns (gsi_stmt (i), | |
1865 | &eni_time_weights) * bb->frequency; | |
1866 | } | |
1867 | } | |
1868 | else if (cfun && (cfun->curr_properties & PROP_rtl)) | |
1869 | { | |
1870 | rtx insn; | |
1871 | for (insn = NEXT_INSN (BB_HEAD (bb)); insn && insn != NEXT_INSN (BB_END (bb)); | |
1872 | insn = NEXT_INSN (insn)) | |
1873 | if (INSN_P (insn)) | |
1874 | { | |
1875 | profile_record[index].size[subpass] | |
1876 | += insn_rtx_cost (PATTERN (insn), false); | |
1877 | if (profile_status == PROFILE_READ) | |
1878 | profile_record[index].time[subpass] | |
1879 | += insn_rtx_cost (PATTERN (insn), true) * bb->count; | |
1880 | else if (profile_status == PROFILE_GUESSED) | |
1881 | profile_record[index].time[subpass] | |
1882 | += insn_rtx_cost (PATTERN (insn), true) * bb->frequency; | |
1883 | } | |
1884 | } | |
1885 | } | |
1886 | } | |
1887 | ||
1888 | /* Output profile consistency. */ | |
1889 | ||
1890 | void | |
1891 | dump_profile_report (void) | |
1892 | { | |
1893 | int i, j; | |
1894 | int last_freq_in = 0, last_count_in = 0, last_freq_out = 0, last_count_out = 0; | |
28d516bc | 1895 | gcov_type last_time = 0, last_size = 0; |
37e5402b | 1896 | double rel_time_change, rel_size_change; |
6ada5e7d | 1897 | int last_reported = 0; |
37e5402b JH |
1898 | |
1899 | if (!profile_record) | |
1900 | return; | |
1901 | fprintf (stderr, "\nProfile consistency report:\n\n"); | |
1902 | fprintf (stderr, "Pass name |mismatch in |mismated out|Overall\n"); | |
28d516bc | 1903 | fprintf (stderr, " |freq count |freq count |size time\n"); |
37e5402b JH |
1904 | |
1905 | for (i = 0; i < passes_by_id_size; i++) | |
1906 | for (j = 0 ; j < 2; j++) | |
1907 | if (profile_record[i].run) | |
1908 | { | |
1909 | if (last_time) | |
1910 | rel_time_change = (profile_record[i].time[j] | |
1911 | - (double)last_time) * 100 / (double)last_time; | |
1912 | else | |
1913 | rel_time_change = 0; | |
1914 | if (last_size) | |
1915 | rel_size_change = (profile_record[i].size[j] | |
1916 | - (double)last_size) * 100 / (double)last_size; | |
1917 | else | |
1918 | rel_size_change = 0; | |
1919 | ||
1920 | if (profile_record[i].num_mismatched_freq_in[j] != last_freq_in | |
1921 | || profile_record[i].num_mismatched_freq_out[j] != last_freq_out | |
1922 | || profile_record[i].num_mismatched_count_in[j] != last_count_in | |
1923 | || profile_record[i].num_mismatched_count_out[j] != last_count_out | |
1924 | || rel_time_change || rel_size_change) | |
1925 | { | |
1926 | last_reported = i; | |
1927 | fprintf (stderr, "%-20s %s", | |
1928 | passes_by_id [i]->name, | |
1929 | j ? "(after TODO)" : " "); | |
1930 | if (profile_record[i].num_mismatched_freq_in[j] != last_freq_in) | |
1931 | fprintf (stderr, "| %+5i", | |
1932 | profile_record[i].num_mismatched_freq_in[j] | |
1933 | - last_freq_in); | |
1934 | else | |
1935 | fprintf (stderr, "| "); | |
1936 | if (profile_record[i].num_mismatched_count_in[j] != last_count_in) | |
1937 | fprintf (stderr, " %+5i", | |
1938 | profile_record[i].num_mismatched_count_in[j] | |
1939 | - last_count_in); | |
1940 | else | |
1941 | fprintf (stderr, " "); | |
1942 | if (profile_record[i].num_mismatched_freq_out[j] != last_freq_out) | |
1943 | fprintf (stderr, "| %+5i", | |
1944 | profile_record[i].num_mismatched_freq_out[j] | |
1945 | - last_freq_out); | |
1946 | else | |
1947 | fprintf (stderr, "| "); | |
1948 | if (profile_record[i].num_mismatched_count_out[j] != last_count_out) | |
1949 | fprintf (stderr, " %+5i", | |
1950 | profile_record[i].num_mismatched_count_out[j] | |
1951 | - last_count_out); | |
1952 | else | |
1953 | fprintf (stderr, " "); | |
1954 | ||
1955 | /* Size/time units change across gimple and RTL. */ | |
1956 | if (i == pass_expand.pass.static_pass_number) | |
1957 | fprintf (stderr, "|----------"); | |
1958 | else | |
1959 | { | |
1960 | if (rel_size_change) | |
1961 | fprintf (stderr, "| %+8.4f%%", rel_size_change); | |
1962 | else | |
1963 | fprintf (stderr, "| "); | |
1964 | if (rel_time_change) | |
1965 | fprintf (stderr, " %+8.4f%%", rel_time_change); | |
1966 | } | |
1967 | fprintf (stderr, "\n"); | |
1968 | last_freq_in = profile_record[i].num_mismatched_freq_in[j]; | |
1969 | last_freq_out = profile_record[i].num_mismatched_freq_out[j]; | |
1970 | last_count_in = profile_record[i].num_mismatched_count_in[j]; | |
1971 | last_count_out = profile_record[i].num_mismatched_count_out[j]; | |
1972 | } | |
1973 | else if (j && last_reported != i) | |
1974 | { | |
1975 | last_reported = i; | |
1976 | fprintf (stderr, "%-20s ------------| | |\n", | |
1977 | passes_by_id [i]->name); | |
1978 | } | |
1979 | last_time = profile_record[i].time[j]; | |
1980 | last_size = profile_record[i].size[j]; | |
1981 | } | |
1982 | } | |
1983 | ||
a5093353 | 1984 | /* Perform all TODO actions that ought to be done on each function. */ |
ef330312 | 1985 | |
a5093353 JH |
1986 | static void |
1987 | execute_function_todo (void *data) | |
1988 | { | |
1989 | unsigned int flags = (size_t)data; | |
a5093353 | 1990 | flags &= ~cfun->last_verified; |
bbbe4e7b PB |
1991 | if (!flags) |
1992 | return; | |
9fe0cb7d | 1993 | |
1994bfea | 1994 | /* Always cleanup the CFG before trying to update SSA. */ |
ef330312 PB |
1995 | if (flags & TODO_cleanup_cfg) |
1996 | { | |
592c303d | 1997 | bool cleanup = cleanup_tree_cfg (); |
c4f548b8 | 1998 | |
1994bfea JH |
1999 | if (cleanup && (cfun->curr_properties & PROP_ssa)) |
2000 | flags |= TODO_remove_unused_locals; | |
b8698a0f | 2001 | |
c4f548b8 DN |
2002 | /* When cleanup_tree_cfg merges consecutive blocks, it may |
2003 | perform some simplistic propagation when removing single | |
2004 | valued PHI nodes. This propagation may, in turn, cause the | |
2005 | SSA form to become out-of-date (see PR 22037). So, even | |
2006 | if the parent pass had not scheduled an SSA update, we may | |
2007 | still need to do one. */ | |
5006671f | 2008 | if (!(flags & TODO_update_ssa_any) && need_ssa_update_p (cfun)) |
c4f548b8 | 2009 | flags |= TODO_update_ssa; |
ef330312 | 2010 | } |
f6db1481 | 2011 | |
563cb6be DN |
2012 | if (flags & TODO_update_ssa_any) |
2013 | { | |
2014 | unsigned update_flags = flags & TODO_update_ssa_any; | |
2015 | update_ssa (update_flags); | |
a5093353 | 2016 | cfun->last_verified &= ~TODO_verify_ssa; |
563cb6be | 2017 | } |
b8698a0f | 2018 | |
edb32daf RG |
2019 | if (flag_tree_pta && (flags & TODO_rebuild_alias)) |
2020 | compute_may_aliases (); | |
2021 | ||
2022 | if (optimize && (flags & TODO_update_address_taken)) | |
f61c8291 | 2023 | execute_update_addresses_taken (); |
b8698a0f | 2024 | |
3f519b35 RG |
2025 | if (flags & TODO_remove_unused_locals) |
2026 | remove_unused_locals (); | |
2027 | ||
45a80bb9 | 2028 | if (flags & TODO_rebuild_frequencies) |
b35366ce | 2029 | rebuild_frequencies (); |
45a80bb9 | 2030 | |
cf9712cc JH |
2031 | if (flags & TODO_rebuild_cgraph_edges) |
2032 | rebuild_cgraph_edges (); | |
2033 | ||
c9d6130e RG |
2034 | /* If we've seen errors do not bother running any verifiers. */ |
2035 | if (seen_error ()) | |
2036 | return; | |
2037 | ||
a5093353 | 2038 | #if defined ENABLE_CHECKING |
a3b9e73c SP |
2039 | if (flags & TODO_verify_ssa |
2040 | || (current_loops && loops_state_satisfies_p (LOOP_CLOSED_SSA))) | |
6ae4eccd RG |
2041 | { |
2042 | verify_gimple_in_cfg (cfun); | |
2043 | verify_ssa (true); | |
2044 | } | |
2045 | else if (flags & TODO_verify_stmts) | |
2046 | verify_gimple_in_cfg (cfun); | |
a5093353 JH |
2047 | if (flags & TODO_verify_flow) |
2048 | verify_flow_info (); | |
98b6e9dd | 2049 | if (current_loops && loops_state_satisfies_p (LOOP_CLOSED_SSA)) |
a3b9e73c | 2050 | verify_loop_closed_ssa (false); |
a36b8a1e JH |
2051 | if (flags & TODO_verify_rtl_sharing) |
2052 | verify_rtl_sharing (); | |
a5093353 JH |
2053 | #endif |
2054 | ||
2055 | cfun->last_verified = flags & TODO_verify_all; | |
2056 | } | |
2057 | ||
2058 | /* Perform all TODO actions. */ | |
2059 | static void | |
2060 | execute_todo (unsigned int flags) | |
2061 | { | |
2062 | #if defined ENABLE_CHECKING | |
5006671f RG |
2063 | if (cfun |
2064 | && need_ssa_update_p (cfun)) | |
a5093353 JH |
2065 | gcc_assert (flags & TODO_update_ssa_any); |
2066 | #endif | |
2067 | ||
a222c01a MM |
2068 | timevar_push (TV_TODO); |
2069 | ||
b02b9b53 ZD |
2070 | /* Inform the pass whether it is the first time it is run. */ |
2071 | first_pass_instance = (flags & TODO_mark_first_instance) != 0; | |
2072 | ||
0d6a035d JH |
2073 | statistics_fini_pass (); |
2074 | ||
a5093353 JH |
2075 | do_per_function (execute_function_todo, (void *)(size_t) flags); |
2076 | ||
f4b3ca72 JH |
2077 | /* Always remove functions just as before inlining: IPA passes might be |
2078 | interested to see bodies of extern inline functions that are not inlined | |
2079 | to analyze side effects. The full removal is done just at the end | |
2080 | of IPA pass queue. */ | |
2081 | if (flags & TODO_remove_functions) | |
a12f79f5 JH |
2082 | { |
2083 | gcc_assert (!cfun); | |
04142cc3 | 2084 | symtab_remove_unreachable_nodes (true, dump_file); |
a12f79f5 | 2085 | } |
f4b3ca72 | 2086 | |
8f940ee6 | 2087 | if ((flags & TODO_dump_symtab) && dump_file && !current_function_decl) |
ef330312 | 2088 | { |
a12f79f5 | 2089 | gcc_assert (!cfun); |
ead84f73 | 2090 | dump_symtab (dump_file); |
ef330312 PB |
2091 | /* Flush the file. If verification fails, we won't be able to |
2092 | close the file before aborting. */ | |
2093 | fflush (dump_file); | |
2094 | } | |
f6db1481 | 2095 | |
ef330312 | 2096 | if (flags & TODO_ggc_collect) |
726a989a | 2097 | ggc_collect (); |
6fb5fa3c | 2098 | |
b8698a0f | 2099 | /* Now that the dumping has been done, we can get rid of the optional |
6fb5fa3c DB |
2100 | df problems. */ |
2101 | if (flags & TODO_df_finish) | |
0d475361 | 2102 | df_finish_pass ((flags & TODO_df_verify) != 0); |
a222c01a MM |
2103 | |
2104 | timevar_pop (TV_TODO); | |
a5093353 | 2105 | } |
97b0ade3 | 2106 | |
6ac01510 ILT |
2107 | /* Verify invariants that should hold between passes. This is a place |
2108 | to put simple sanity checks. */ | |
2109 | ||
2110 | static void | |
2111 | verify_interpass_invariants (void) | |
2112 | { | |
77a74ed7 | 2113 | gcc_checking_assert (!fold_deferring_overflow_warnings_p ()); |
6ac01510 ILT |
2114 | } |
2115 | ||
a5093353 JH |
2116 | /* Clear the last verified flag. */ |
2117 | ||
2118 | static void | |
2119 | clear_last_verified (void *data ATTRIBUTE_UNUSED) | |
2120 | { | |
2121 | cfun->last_verified = 0; | |
2122 | } | |
2123 | ||
2124 | /* Helper function. Verify that the properties has been turn into the | |
2125 | properties expected by the pass. */ | |
bbbe4e7b | 2126 | |
582fd9ce | 2127 | #ifdef ENABLE_CHECKING |
a5093353 JH |
2128 | static void |
2129 | verify_curr_properties (void *data) | |
2130 | { | |
2131 | unsigned int props = (size_t)data; | |
2132 | gcc_assert ((cfun->curr_properties & props) == props); | |
2133 | } | |
582fd9ce | 2134 | #endif |
a5093353 | 2135 | |
17653c00 | 2136 | /* Initialize pass dump file. */ |
090fa0ab | 2137 | /* This is non-static so that the plugins can use it. */ |
17653c00 | 2138 | |
090fa0ab | 2139 | bool |
17653c00 JH |
2140 | pass_init_dump_file (struct opt_pass *pass) |
2141 | { | |
2142 | /* If a dump file name is present, open it if enabled. */ | |
2143 | if (pass->static_pass_number != -1) | |
2144 | { | |
2145 | bool initializing_dump = !dump_initialized_p (pass->static_pass_number); | |
2146 | dump_file_name = get_dump_file_name (pass->static_pass_number); | |
78c60e3d | 2147 | dump_start (pass->static_pass_number, &dump_flags); |
17653c00 | 2148 | if (dump_file && current_function_decl) |
6d8402ac | 2149 | dump_function_header (dump_file, current_function_decl, dump_flags); |
17653c00 JH |
2150 | return initializing_dump; |
2151 | } | |
2152 | else | |
2153 | return false; | |
2154 | } | |
2155 | ||
2156 | /* Flush PASS dump file. */ | |
090fa0ab | 2157 | /* This is non-static so that plugins can use it. */ |
17653c00 | 2158 | |
090fa0ab | 2159 | void |
17653c00 JH |
2160 | pass_fini_dump_file (struct opt_pass *pass) |
2161 | { | |
2162 | /* Flush and close dump file. */ | |
2163 | if (dump_file_name) | |
2164 | { | |
2165 | free (CONST_CAST (char *, dump_file_name)); | |
2166 | dump_file_name = NULL; | |
2167 | } | |
2168 | ||
78c60e3d | 2169 | dump_finish (pass->static_pass_number); |
17653c00 JH |
2170 | } |
2171 | ||
a5093353 JH |
2172 | /* After executing the pass, apply expected changes to the function |
2173 | properties. */ | |
17653c00 | 2174 | |
a5093353 JH |
2175 | static void |
2176 | update_properties_after_pass (void *data) | |
2177 | { | |
d3bfe4de | 2178 | struct opt_pass *pass = (struct opt_pass *) data; |
a5093353 JH |
2179 | cfun->curr_properties = (cfun->curr_properties | pass->properties_provided) |
2180 | & ~pass->properties_destroyed; | |
f6db1481 RH |
2181 | } |
2182 | ||
1920df6c | 2183 | /* Execute summary generation for all of the passes in IPA_PASS. */ |
17653c00 | 2184 | |
d7f09764 | 2185 | void |
7e5487a2 | 2186 | execute_ipa_summary_passes (struct ipa_opt_pass_d *ipa_pass) |
17653c00 | 2187 | { |
1920df6c | 2188 | while (ipa_pass) |
17653c00 JH |
2189 | { |
2190 | struct opt_pass *pass = &ipa_pass->pass; | |
1920df6c KZ |
2191 | |
2192 | /* Execute all of the IPA_PASSes in the list. */ | |
b8698a0f | 2193 | if (ipa_pass->pass.type == IPA_PASS |
d7f09764 DN |
2194 | && (!pass->gate || pass->gate ()) |
2195 | && ipa_pass->generate_summary) | |
17653c00 JH |
2196 | { |
2197 | pass_init_dump_file (pass); | |
d7f09764 DN |
2198 | |
2199 | /* If a timevar is present, start it. */ | |
2200 | if (pass->tv_id) | |
2201 | timevar_push (pass->tv_id); | |
2202 | ||
1920df6c | 2203 | ipa_pass->generate_summary (); |
d7f09764 DN |
2204 | |
2205 | /* Stop timevar. */ | |
2206 | if (pass->tv_id) | |
2207 | timevar_pop (pass->tv_id); | |
2208 | ||
17653c00 JH |
2209 | pass_fini_dump_file (pass); |
2210 | } | |
7e5487a2 | 2211 | ipa_pass = (struct ipa_opt_pass_d *)ipa_pass->pass.next; |
17653c00 JH |
2212 | } |
2213 | } | |
2214 | ||
2215 | /* Execute IPA_PASS function transform on NODE. */ | |
2216 | ||
2217 | static void | |
2218 | execute_one_ipa_transform_pass (struct cgraph_node *node, | |
7e5487a2 | 2219 | struct ipa_opt_pass_d *ipa_pass) |
17653c00 JH |
2220 | { |
2221 | struct opt_pass *pass = &ipa_pass->pass; | |
2222 | unsigned int todo_after = 0; | |
2223 | ||
2224 | current_pass = pass; | |
2225 | if (!ipa_pass->function_transform) | |
2226 | return; | |
2227 | ||
2228 | /* Note that the folders should only create gimple expressions. | |
2229 | This is a hack until the new folder is ready. */ | |
2230 | in_gimple_form = (cfun && (cfun->curr_properties & PROP_trees)) != 0; | |
2231 | ||
2232 | pass_init_dump_file (pass); | |
2233 | ||
2234 | /* Run pre-pass verification. */ | |
a12f79f5 | 2235 | execute_todo (ipa_pass->function_transform_todo_flags_start); |
17653c00 JH |
2236 | |
2237 | /* If a timevar is present, start it. */ | |
7072a650 | 2238 | if (pass->tv_id != TV_NONE) |
17653c00 JH |
2239 | timevar_push (pass->tv_id); |
2240 | ||
2241 | /* Do it! */ | |
2242 | todo_after = ipa_pass->function_transform (node); | |
2243 | ||
2244 | /* Stop timevar. */ | |
7072a650 | 2245 | if (pass->tv_id != TV_NONE) |
17653c00 JH |
2246 | timevar_pop (pass->tv_id); |
2247 | ||
37e5402b JH |
2248 | if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) |
2249 | check_profile_consistency (pass->static_pass_number, 0, true); | |
2250 | ||
17653c00 JH |
2251 | /* Run post-pass cleanup and verification. */ |
2252 | execute_todo (todo_after); | |
2253 | verify_interpass_invariants (); | |
37e5402b JH |
2254 | if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) |
2255 | check_profile_consistency (pass->static_pass_number, 1, true); | |
17653c00 | 2256 | |
22c5fa5f | 2257 | do_per_function (execute_function_dump, NULL); |
17653c00 JH |
2258 | pass_fini_dump_file (pass); |
2259 | ||
2260 | current_pass = NULL; | |
17653c00 JH |
2261 | } |
2262 | ||
d7f09764 | 2263 | /* For the current function, execute all ipa transforms. */ |
9e016eba | 2264 | |
d7f09764 DN |
2265 | void |
2266 | execute_all_ipa_transforms (void) | |
2267 | { | |
0e3776db JH |
2268 | struct cgraph_node *node; |
2269 | if (!cfun) | |
2270 | return; | |
581985d7 | 2271 | node = cgraph_get_node (current_function_decl); |
bc58d7e1 | 2272 | |
0e3776db | 2273 | if (node->ipa_transforms_to_apply) |
17653c00 JH |
2274 | { |
2275 | unsigned int i; | |
17653c00 | 2276 | |
0e3776db | 2277 | for (i = 0; i < VEC_length (ipa_opt_pass, node->ipa_transforms_to_apply); |
17653c00 JH |
2278 | i++) |
2279 | execute_one_ipa_transform_pass (node, | |
d7f09764 | 2280 | VEC_index (ipa_opt_pass, |
0e3776db | 2281 | node->ipa_transforms_to_apply, |
17653c00 | 2282 | i)); |
0e3776db JH |
2283 | VEC_free (ipa_opt_pass, heap, node->ipa_transforms_to_apply); |
2284 | node->ipa_transforms_to_apply = NULL; | |
17653c00 | 2285 | } |
d7f09764 DN |
2286 | } |
2287 | ||
febb1302 JH |
2288 | /* Callback for do_per_function to apply all IPA transforms. */ |
2289 | ||
2290 | static void | |
2291 | apply_ipa_transforms (void *data) | |
2292 | { | |
2293 | struct cgraph_node *node = cgraph_get_node (current_function_decl); | |
2294 | if (!node->global.inlined_to && node->ipa_transforms_to_apply) | |
2295 | { | |
2296 | *(bool *)data = true; | |
2297 | execute_all_ipa_transforms(); | |
2298 | rebuild_cgraph_edges (); | |
2299 | } | |
2300 | } | |
2301 | ||
226c52aa XDL |
2302 | /* Check if PASS is explicitly disabled or enabled and return |
2303 | the gate status. FUNC is the function to be processed, and | |
2304 | GATE_STATUS is the gate status determined by pass manager by | |
2305 | default. */ | |
2306 | ||
2307 | static bool | |
2308 | override_gate_status (struct opt_pass *pass, tree func, bool gate_status) | |
2309 | { | |
2310 | bool explicitly_enabled = false; | |
2311 | bool explicitly_disabled = false; | |
2312 | ||
2313 | explicitly_enabled | |
2314 | = is_pass_explicitly_enabled_or_disabled (pass, func, | |
2315 | enabled_pass_uid_range_tab); | |
2316 | explicitly_disabled | |
2317 | = is_pass_explicitly_enabled_or_disabled (pass, func, | |
2318 | disabled_pass_uid_range_tab); | |
2319 | ||
2320 | gate_status = !explicitly_disabled && (gate_status || explicitly_enabled); | |
2321 | ||
2322 | return gate_status; | |
2323 | } | |
2324 | ||
2325 | ||
d7f09764 DN |
2326 | /* Execute PASS. */ |
2327 | ||
090fa0ab | 2328 | bool |
d7f09764 DN |
2329 | execute_one_pass (struct opt_pass *pass) |
2330 | { | |
2331 | bool initializing_dump; | |
2332 | unsigned int todo_after = 0; | |
2333 | ||
090fa0ab GF |
2334 | bool gate_status; |
2335 | ||
d7f09764 DN |
2336 | /* IPA passes are executed on whole program, so cfun should be NULL. |
2337 | Other passes need function context set. */ | |
2338 | if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) | |
2339 | gcc_assert (!cfun && !current_function_decl); | |
2340 | else | |
2341 | gcc_assert (cfun && current_function_decl); | |
17653c00 | 2342 | |
6fb5fa3c | 2343 | current_pass = pass; |
726a989a | 2344 | |
090fa0ab GF |
2345 | /* Check whether gate check should be avoided. |
2346 | User controls the value of the gate through the parameter "gate_status". */ | |
2347 | gate_status = (pass->gate == NULL) ? true : pass->gate(); | |
226c52aa | 2348 | gate_status = override_gate_status (pass, current_function_decl, gate_status); |
090fa0ab GF |
2349 | |
2350 | /* Override gate with plugin. */ | |
2351 | invoke_plugin_callbacks (PLUGIN_OVERRIDE_GATE, &gate_status); | |
2352 | ||
2353 | if (!gate_status) | |
2354 | { | |
37e5402b JH |
2355 | /* Run so passes selectively disabling themselves on a given function |
2356 | are not miscounted. */ | |
2357 | if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) | |
2358 | { | |
2359 | check_profile_consistency (pass->static_pass_number, 0, false); | |
2360 | check_profile_consistency (pass->static_pass_number, 1, false); | |
2361 | } | |
090fa0ab GF |
2362 | current_pass = NULL; |
2363 | return false; | |
2364 | } | |
2365 | ||
2366 | /* Pass execution event trigger: useful to identify passes being | |
2367 | executed. */ | |
2368 | invoke_plugin_callbacks (PLUGIN_PASS_EXECUTION, pass); | |
f6db1481 | 2369 | |
febb1302 JH |
2370 | /* SIPLE IPA passes do not handle callgraphs with IPA transforms in it. |
2371 | Apply all trnasforms first. */ | |
2372 | if (pass->type == SIMPLE_IPA_PASS) | |
2373 | { | |
2374 | bool applied = false; | |
2375 | do_per_function (apply_ipa_transforms, (void *)&applied); | |
2376 | if (applied) | |
04142cc3 | 2377 | symtab_remove_unreachable_nodes (true, dump_file); |
1c86160a RG |
2378 | /* Restore current_pass. */ |
2379 | current_pass = pass; | |
febb1302 JH |
2380 | } |
2381 | ||
b9cafe60 | 2382 | if (!quiet_flag && !cfun) |
873aa8f5 JH |
2383 | fprintf (stderr, " <%s>", pass->name ? pass->name : ""); |
2384 | ||
ef330312 PB |
2385 | /* Note that the folders should only create gimple expressions. |
2386 | This is a hack until the new folder is ready. */ | |
a5093353 | 2387 | in_gimple_form = (cfun && (cfun->curr_properties & PROP_trees)) != 0; |
f6db1481 | 2388 | |
5006671f RG |
2389 | initializing_dump = pass_init_dump_file (pass); |
2390 | ||
ef330312 | 2391 | /* Run pre-pass verification. */ |
bbbe4e7b PB |
2392 | execute_todo (pass->todo_flags_start); |
2393 | ||
a5093353 JH |
2394 | #ifdef ENABLE_CHECKING |
2395 | do_per_function (verify_curr_properties, | |
2396 | (void *)(size_t)pass->properties_required); | |
2397 | #endif | |
f6db1481 | 2398 | |
ef330312 | 2399 | /* If a timevar is present, start it. */ |
7072a650 | 2400 | if (pass->tv_id != TV_NONE) |
ef330312 | 2401 | timevar_push (pass->tv_id); |
f6db1481 | 2402 | |
ef330312 PB |
2403 | /* Do it! */ |
2404 | if (pass->execute) | |
bbbe4e7b | 2405 | { |
c2924966 | 2406 | todo_after = pass->execute (); |
a5093353 | 2407 | do_per_function (clear_last_verified, NULL); |
bbbe4e7b | 2408 | } |
f6db1481 | 2409 | |
ef330312 | 2410 | /* Stop timevar. */ |
7072a650 | 2411 | if (pass->tv_id != TV_NONE) |
ef330312 | 2412 | timevar_pop (pass->tv_id); |
f6db1481 | 2413 | |
a5093353 | 2414 | do_per_function (update_properties_after_pass, pass); |
bbbe4e7b PB |
2415 | |
2416 | if (initializing_dump | |
2417 | && dump_file | |
2418 | && graph_dump_format != no_graph | |
6f1fe305 | 2419 | && cfun |
a5093353 JH |
2420 | && (cfun->curr_properties & (PROP_cfg | PROP_rtl)) |
2421 | == (PROP_cfg | PROP_rtl)) | |
bbbe4e7b | 2422 | { |
78c60e3d | 2423 | get_dump_file_info (pass->static_pass_number)->pflags |= TDF_GRAPH; |
bbbe4e7b PB |
2424 | dump_flags |= TDF_GRAPH; |
2425 | clean_graph_dump_file (dump_file_name); | |
2426 | } | |
2427 | ||
37e5402b JH |
2428 | if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) |
2429 | check_profile_consistency (pass->static_pass_number, 0, true); | |
2430 | ||
ef330312 | 2431 | /* Run post-pass cleanup and verification. */ |
c2924966 | 2432 | execute_todo (todo_after | pass->todo_flags_finish); |
37e5402b JH |
2433 | if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) |
2434 | check_profile_consistency (pass->static_pass_number, 1, true); | |
2435 | ||
6ac01510 | 2436 | verify_interpass_invariants (); |
22c5fa5f | 2437 | do_per_function (execute_function_dump, NULL); |
17653c00 | 2438 | if (pass->type == IPA_PASS) |
0e3776db JH |
2439 | { |
2440 | struct cgraph_node *node; | |
c47d0034 JH |
2441 | FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) |
2442 | VEC_safe_push (ipa_opt_pass, heap, node->ipa_transforms_to_apply, | |
2443 | (struct ipa_opt_pass_d *)pass); | |
0e3776db | 2444 | } |
f6db1481 | 2445 | |
f45e0ad1 JH |
2446 | if (!current_function_decl) |
2447 | cgraph_process_new_functions (); | |
2448 | ||
17653c00 | 2449 | pass_fini_dump_file (pass); |
f6db1481 | 2450 | |
17653c00 | 2451 | if (pass->type != SIMPLE_IPA_PASS && pass->type != IPA_PASS) |
e3b5732b JH |
2452 | gcc_assert (!(cfun->curr_properties & PROP_trees) |
2453 | || pass->type != RTL_PASS); | |
2454 | ||
6fb5fa3c | 2455 | current_pass = NULL; |
91851351 | 2456 | |
ef330312 | 2457 | return true; |
f6db1481 RH |
2458 | } |
2459 | ||
ef330312 | 2460 | void |
8ddbbcae | 2461 | execute_pass_list (struct opt_pass *pass) |
f6db1481 | 2462 | { |
ef330312 | 2463 | do |
f6db1481 | 2464 | { |
9e016eba JH |
2465 | gcc_assert (pass->type == GIMPLE_PASS |
2466 | || pass->type == RTL_PASS); | |
ef330312 PB |
2467 | if (execute_one_pass (pass) && pass->sub) |
2468 | execute_pass_list (pass->sub); | |
2469 | pass = pass->next; | |
f6db1481 | 2470 | } |
ef330312 | 2471 | while (pass); |
f6db1481 RH |
2472 | } |
2473 | ||
ef330312 | 2474 | /* Same as execute_pass_list but assume that subpasses of IPA passes |
d7f09764 DN |
2475 | are local passes. If SET is not NULL, write out summaries of only |
2476 | those node in SET. */ | |
2477 | ||
2478 | static void | |
f27c1867 | 2479 | ipa_write_summaries_2 (struct opt_pass *pass, struct lto_out_decl_state *state) |
d7f09764 DN |
2480 | { |
2481 | while (pass) | |
2482 | { | |
2483 | struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *)pass; | |
2484 | gcc_assert (!current_function_decl); | |
2485 | gcc_assert (!cfun); | |
2486 | gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); | |
2487 | if (pass->type == IPA_PASS | |
2488 | && ipa_pass->write_summary | |
2489 | && (!pass->gate || pass->gate ())) | |
2490 | { | |
2491 | /* If a timevar is present, start it. */ | |
2492 | if (pass->tv_id) | |
2493 | timevar_push (pass->tv_id); | |
2494 | ||
f59292da JH |
2495 | pass_init_dump_file (pass); |
2496 | ||
f27c1867 | 2497 | ipa_pass->write_summary (); |
d7f09764 | 2498 | |
f59292da JH |
2499 | pass_fini_dump_file (pass); |
2500 | ||
d7f09764 DN |
2501 | /* If a timevar is present, start it. */ |
2502 | if (pass->tv_id) | |
2503 | timevar_pop (pass->tv_id); | |
2504 | } | |
2505 | ||
2506 | if (pass->sub && pass->sub->type != GIMPLE_PASS) | |
f27c1867 | 2507 | ipa_write_summaries_2 (pass->sub, state); |
d7f09764 DN |
2508 | |
2509 | pass = pass->next; | |
2510 | } | |
2511 | } | |
2512 | ||
2513 | /* Helper function of ipa_write_summaries. Creates and destroys the | |
2514 | decl state and calls ipa_write_summaries_2 for all passes that have | |
2515 | summaries. SET is the set of nodes to be written. */ | |
2516 | ||
2517 | static void | |
7b99cca4 | 2518 | ipa_write_summaries_1 (lto_symtab_encoder_t encoder) |
d7f09764 DN |
2519 | { |
2520 | struct lto_out_decl_state *state = lto_new_out_decl_state (); | |
b4661bfe | 2521 | state->symtab_node_encoder = encoder; |
5c4f225f | 2522 | |
d7f09764 DN |
2523 | lto_push_out_decl_state (state); |
2524 | ||
e792884f | 2525 | gcc_assert (!flag_wpa); |
f27c1867 JH |
2526 | ipa_write_summaries_2 (all_regular_ipa_passes, state); |
2527 | ipa_write_summaries_2 (all_lto_gen_passes, state); | |
d7f09764 DN |
2528 | |
2529 | gcc_assert (lto_get_out_decl_state () == state); | |
2530 | lto_pop_out_decl_state (); | |
2531 | lto_delete_out_decl_state (state); | |
2532 | } | |
2533 | ||
2534 | /* Write out summaries for all the nodes in the callgraph. */ | |
2535 | ||
ef330312 | 2536 | void |
d7f09764 | 2537 | ipa_write_summaries (void) |
f6db1481 | 2538 | { |
7b99cca4 | 2539 | lto_symtab_encoder_t encoder; |
d7f09764 | 2540 | int i, order_pos; |
7b99cca4 JH |
2541 | struct varpool_node *vnode; |
2542 | struct cgraph_node **order; | |
b8698a0f | 2543 | |
1da2ed5f | 2544 | if (!flag_generate_lto || seen_error ()) |
d7f09764 DN |
2545 | return; |
2546 | ||
7b99cca4 | 2547 | encoder = lto_symtab_encoder_new (); |
d7f09764 DN |
2548 | |
2549 | /* Create the callgraph set in the same order used in | |
2550 | cgraph_expand_all_functions. This mostly facilitates debugging, | |
2551 | since it causes the gimple file to be processed in the same order | |
2552 | as the source code. */ | |
2553 | order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); | |
af8bca3c | 2554 | order_pos = ipa_reverse_postorder (order); |
d7f09764 DN |
2555 | gcc_assert (order_pos == cgraph_n_nodes); |
2556 | ||
2557 | for (i = order_pos - 1; i >= 0; i--) | |
8b220502 MJ |
2558 | { |
2559 | struct cgraph_node *node = order[i]; | |
2560 | ||
c47d0034 | 2561 | if (cgraph_function_with_gimple_body_p (node)) |
8b220502 MJ |
2562 | { |
2563 | /* When streaming out references to statements as part of some IPA | |
2564 | pass summary, the statements need to have uids assigned and the | |
2565 | following does that for all the IPA passes here. Naturally, this | |
2566 | ordering then matches the one IPA-passes get in their stmt_fixup | |
2567 | hooks. */ | |
2568 | ||
960bfb69 | 2569 | push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); |
8b220502 MJ |
2570 | renumber_gimple_stmt_uids (); |
2571 | pop_cfun (); | |
2572 | } | |
9b3cf76a | 2573 | if (node->analyzed) |
7b99cca4 | 2574 | lto_set_symtab_encoder_in_partition (encoder, (symtab_node)node); |
8b220502 | 2575 | } |
d7f09764 | 2576 | |
66058468 JH |
2577 | FOR_EACH_DEFINED_VARIABLE (vnode) |
2578 | if ((!vnode->alias || vnode->alias_of)) | |
7b99cca4 | 2579 | lto_set_symtab_encoder_in_partition (encoder, (symtab_node)vnode); |
2942c502 | 2580 | |
b4661bfe | 2581 | ipa_write_summaries_1 (compute_ltrans_boundary (encoder)); |
d7f09764 DN |
2582 | |
2583 | free (order); | |
d7f09764 DN |
2584 | } |
2585 | ||
e792884f JH |
2586 | /* Same as execute_pass_list but assume that subpasses of IPA passes |
2587 | are local passes. If SET is not NULL, write out optimization summaries of | |
2588 | only those node in SET. */ | |
d7f09764 | 2589 | |
e792884f | 2590 | static void |
f27c1867 | 2591 | ipa_write_optimization_summaries_1 (struct opt_pass *pass, struct lto_out_decl_state *state) |
e792884f JH |
2592 | { |
2593 | while (pass) | |
2594 | { | |
2595 | struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *)pass; | |
2596 | gcc_assert (!current_function_decl); | |
2597 | gcc_assert (!cfun); | |
2598 | gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); | |
2599 | if (pass->type == IPA_PASS | |
2600 | && ipa_pass->write_optimization_summary | |
2601 | && (!pass->gate || pass->gate ())) | |
2602 | { | |
2603 | /* If a timevar is present, start it. */ | |
2604 | if (pass->tv_id) | |
2605 | timevar_push (pass->tv_id); | |
2606 | ||
f59292da JH |
2607 | pass_init_dump_file (pass); |
2608 | ||
f27c1867 | 2609 | ipa_pass->write_optimization_summary (); |
e792884f | 2610 | |
f59292da JH |
2611 | pass_fini_dump_file (pass); |
2612 | ||
e792884f JH |
2613 | /* If a timevar is present, start it. */ |
2614 | if (pass->tv_id) | |
2615 | timevar_pop (pass->tv_id); | |
2616 | } | |
2617 | ||
2618 | if (pass->sub && pass->sub->type != GIMPLE_PASS) | |
f27c1867 | 2619 | ipa_write_optimization_summaries_1 (pass->sub, state); |
e792884f JH |
2620 | |
2621 | pass = pass->next; | |
2622 | } | |
2623 | } | |
2624 | ||
2625 | /* Write all the optimization summaries for the cgraph nodes in SET. If SET is | |
d7f09764 DN |
2626 | NULL, write out all summaries of all nodes. */ |
2627 | ||
2628 | void | |
7b99cca4 | 2629 | ipa_write_optimization_summaries (lto_symtab_encoder_t encoder) |
d7f09764 | 2630 | { |
e792884f | 2631 | struct lto_out_decl_state *state = lto_new_out_decl_state (); |
7b99cca4 | 2632 | lto_symtab_encoder_iterator lsei; |
b4661bfe | 2633 | state->symtab_node_encoder = encoder; |
f3380641 | 2634 | |
e792884f | 2635 | lto_push_out_decl_state (state); |
7b99cca4 JH |
2636 | for (lsei = lsei_start_function_in_partition (encoder); |
2637 | !lsei_end_p (lsei); lsei_next_function_in_partition (&lsei)) | |
f1395d4a | 2638 | { |
7b99cca4 | 2639 | struct cgraph_node *node = lsei_cgraph_node (lsei); |
f1395d4a JH |
2640 | /* When streaming out references to statements as part of some IPA |
2641 | pass summary, the statements need to have uids assigned. | |
2642 | ||
2643 | For functions newly born at WPA stage we need to initialize | |
2644 | the uids here. */ | |
2645 | if (node->analyzed | |
960bfb69 | 2646 | && gimple_has_body_p (node->symbol.decl)) |
f1395d4a | 2647 | { |
960bfb69 | 2648 | push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); |
f1395d4a JH |
2649 | renumber_gimple_stmt_uids (); |
2650 | pop_cfun (); | |
2651 | } | |
2652 | } | |
e792884f JH |
2653 | |
2654 | gcc_assert (flag_wpa); | |
f27c1867 JH |
2655 | ipa_write_optimization_summaries_1 (all_regular_ipa_passes, state); |
2656 | ipa_write_optimization_summaries_1 (all_lto_gen_passes, state); | |
e792884f JH |
2657 | |
2658 | gcc_assert (lto_get_out_decl_state () == state); | |
2659 | lto_pop_out_decl_state (); | |
2660 | lto_delete_out_decl_state (state); | |
d7f09764 DN |
2661 | } |
2662 | ||
2663 | /* Same as execute_pass_list but assume that subpasses of IPA passes | |
2664 | are local passes. */ | |
2665 | ||
2666 | static void | |
2667 | ipa_read_summaries_1 (struct opt_pass *pass) | |
2668 | { | |
2669 | while (pass) | |
f6db1481 | 2670 | { |
d7f09764 DN |
2671 | struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass; |
2672 | ||
a5093353 JH |
2673 | gcc_assert (!current_function_decl); |
2674 | gcc_assert (!cfun); | |
17653c00 | 2675 | gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); |
d7f09764 DN |
2676 | |
2677 | if (pass->gate == NULL || pass->gate ()) | |
17653c00 | 2678 | { |
d7f09764 | 2679 | if (pass->type == IPA_PASS && ipa_pass->read_summary) |
17653c00 | 2680 | { |
d7f09764 DN |
2681 | /* If a timevar is present, start it. */ |
2682 | if (pass->tv_id) | |
2683 | timevar_push (pass->tv_id); | |
2684 | ||
f59292da JH |
2685 | pass_init_dump_file (pass); |
2686 | ||
d7f09764 DN |
2687 | ipa_pass->read_summary (); |
2688 | ||
f59292da JH |
2689 | pass_fini_dump_file (pass); |
2690 | ||
d7f09764 DN |
2691 | /* Stop timevar. */ |
2692 | if (pass->tv_id) | |
2693 | timevar_pop (pass->tv_id); | |
17653c00 | 2694 | } |
d7f09764 DN |
2695 | |
2696 | if (pass->sub && pass->sub->type != GIMPLE_PASS) | |
2697 | ipa_read_summaries_1 (pass->sub); | |
17653c00 | 2698 | } |
d7f09764 DN |
2699 | pass = pass->next; |
2700 | } | |
2701 | } | |
2702 | ||
2703 | ||
2704 | /* Read all the summaries for all_regular_ipa_passes and all_lto_gen_passes. */ | |
2705 | ||
2706 | void | |
2707 | ipa_read_summaries (void) | |
2708 | { | |
e792884f | 2709 | ipa_read_summaries_1 (all_regular_ipa_passes); |
d7f09764 DN |
2710 | ipa_read_summaries_1 (all_lto_gen_passes); |
2711 | } | |
2712 | ||
e792884f JH |
2713 | /* Same as execute_pass_list but assume that subpasses of IPA passes |
2714 | are local passes. */ | |
2715 | ||
2716 | static void | |
2717 | ipa_read_optimization_summaries_1 (struct opt_pass *pass) | |
2718 | { | |
2719 | while (pass) | |
2720 | { | |
2721 | struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass; | |
2722 | ||
2723 | gcc_assert (!current_function_decl); | |
2724 | gcc_assert (!cfun); | |
2725 | gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); | |
2726 | ||
2727 | if (pass->gate == NULL || pass->gate ()) | |
2728 | { | |
2729 | if (pass->type == IPA_PASS && ipa_pass->read_optimization_summary) | |
2730 | { | |
2731 | /* If a timevar is present, start it. */ | |
2732 | if (pass->tv_id) | |
2733 | timevar_push (pass->tv_id); | |
2734 | ||
f59292da JH |
2735 | pass_init_dump_file (pass); |
2736 | ||
e792884f JH |
2737 | ipa_pass->read_optimization_summary (); |
2738 | ||
f59292da JH |
2739 | pass_fini_dump_file (pass); |
2740 | ||
e792884f JH |
2741 | /* Stop timevar. */ |
2742 | if (pass->tv_id) | |
2743 | timevar_pop (pass->tv_id); | |
2744 | } | |
2745 | ||
2746 | if (pass->sub && pass->sub->type != GIMPLE_PASS) | |
2747 | ipa_read_optimization_summaries_1 (pass->sub); | |
2748 | } | |
2749 | pass = pass->next; | |
2750 | } | |
2751 | } | |
2752 | ||
2753 | /* Read all the summaries for all_regular_ipa_passes and all_lto_gen_passes. */ | |
2754 | ||
2755 | void | |
2756 | ipa_read_optimization_summaries (void) | |
2757 | { | |
2758 | ipa_read_optimization_summaries_1 (all_regular_ipa_passes); | |
2759 | ipa_read_optimization_summaries_1 (all_lto_gen_passes); | |
2760 | } | |
2761 | ||
d7f09764 DN |
2762 | /* Same as execute_pass_list but assume that subpasses of IPA passes |
2763 | are local passes. */ | |
2764 | void | |
2765 | execute_ipa_pass_list (struct opt_pass *pass) | |
2766 | { | |
2767 | do | |
2768 | { | |
2769 | gcc_assert (!current_function_decl); | |
2770 | gcc_assert (!cfun); | |
2771 | gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); | |
ef330312 | 2772 | if (execute_one_pass (pass) && pass->sub) |
9e016eba JH |
2773 | { |
2774 | if (pass->sub->type == GIMPLE_PASS) | |
090fa0ab GF |
2775 | { |
2776 | invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_START, NULL); | |
2777 | do_per_function_toporder ((void (*)(void *))execute_pass_list, | |
2778 | pass->sub); | |
2779 | invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_END, NULL); | |
2780 | } | |
17653c00 JH |
2781 | else if (pass->sub->type == SIMPLE_IPA_PASS |
2782 | || pass->sub->type == IPA_PASS) | |
9e016eba JH |
2783 | execute_ipa_pass_list (pass->sub); |
2784 | else | |
2785 | gcc_unreachable (); | |
2786 | } | |
d7f09764 DN |
2787 | gcc_assert (!current_function_decl); |
2788 | cgraph_process_new_functions (); | |
ef330312 | 2789 | pass = pass->next; |
f6db1481 | 2790 | } |
ef330312 | 2791 | while (pass); |
97b0ade3 | 2792 | } |
9fe0cb7d | 2793 | |
2c5721d9 MJ |
2794 | /* Execute stmt fixup hooks of all passes in PASS for NODE and STMTS. */ |
2795 | ||
2796 | static void | |
2797 | execute_ipa_stmt_fixups (struct opt_pass *pass, | |
2798 | struct cgraph_node *node, gimple *stmts) | |
2799 | { | |
2800 | while (pass) | |
2801 | { | |
2802 | /* Execute all of the IPA_PASSes in the list. */ | |
2803 | if (pass->type == IPA_PASS | |
2804 | && (!pass->gate || pass->gate ())) | |
2805 | { | |
2806 | struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass; | |
2807 | ||
2808 | if (ipa_pass->stmt_fixup) | |
2809 | { | |
2810 | pass_init_dump_file (pass); | |
2811 | /* If a timevar is present, start it. */ | |
2812 | if (pass->tv_id) | |
2813 | timevar_push (pass->tv_id); | |
2814 | ||
2815 | ipa_pass->stmt_fixup (node, stmts); | |
2816 | ||
2817 | /* Stop timevar. */ | |
2818 | if (pass->tv_id) | |
2819 | timevar_pop (pass->tv_id); | |
2820 | pass_fini_dump_file (pass); | |
2821 | } | |
2822 | if (pass->sub) | |
2823 | execute_ipa_stmt_fixups (pass->sub, node, stmts); | |
2824 | } | |
2825 | pass = pass->next; | |
2826 | } | |
2827 | } | |
2828 | ||
2829 | /* Execute stmt fixup hooks of all IPA passes for NODE and STMTS. */ | |
2830 | ||
2831 | void | |
2832 | execute_all_ipa_stmt_fixups (struct cgraph_node *node, gimple *stmts) | |
2833 | { | |
2834 | execute_ipa_stmt_fixups (all_regular_ipa_passes, node, stmts); | |
2835 | } | |
2836 | ||
2837 | ||
d7f09764 DN |
2838 | extern void debug_properties (unsigned int); |
2839 | extern void dump_properties (FILE *, unsigned int); | |
2840 | ||
24e47c76 | 2841 | DEBUG_FUNCTION void |
d7f09764 DN |
2842 | dump_properties (FILE *dump, unsigned int props) |
2843 | { | |
2844 | fprintf (dump, "Properties:\n"); | |
2845 | if (props & PROP_gimple_any) | |
2846 | fprintf (dump, "PROP_gimple_any\n"); | |
2847 | if (props & PROP_gimple_lcf) | |
2848 | fprintf (dump, "PROP_gimple_lcf\n"); | |
2849 | if (props & PROP_gimple_leh) | |
2850 | fprintf (dump, "PROP_gimple_leh\n"); | |
2851 | if (props & PROP_cfg) | |
2852 | fprintf (dump, "PROP_cfg\n"); | |
d7f09764 DN |
2853 | if (props & PROP_ssa) |
2854 | fprintf (dump, "PROP_ssa\n"); | |
2855 | if (props & PROP_no_crit_edges) | |
2856 | fprintf (dump, "PROP_no_crit_edges\n"); | |
2857 | if (props & PROP_rtl) | |
2858 | fprintf (dump, "PROP_rtl\n"); | |
2859 | if (props & PROP_gimple_lomp) | |
2860 | fprintf (dump, "PROP_gimple_lomp\n"); | |
688a482d RG |
2861 | if (props & PROP_gimple_lcx) |
2862 | fprintf (dump, "PROP_gimple_lcx\n"); | |
24e47c76 JH |
2863 | if (props & PROP_cfglayout) |
2864 | fprintf (dump, "PROP_cfglayout\n"); | |
d7f09764 DN |
2865 | } |
2866 | ||
24e47c76 | 2867 | DEBUG_FUNCTION void |
d7f09764 DN |
2868 | debug_properties (unsigned int props) |
2869 | { | |
2870 | dump_properties (stderr, props); | |
2871 | } | |
2872 | ||
33977f81 JH |
2873 | /* Called by local passes to see if function is called by already processed nodes. |
2874 | Because we process nodes in topological order, this means that function is | |
2875 | in recursive cycle or we introduced new direct calls. */ | |
2876 | bool | |
2877 | function_called_by_processed_nodes_p (void) | |
2878 | { | |
2879 | struct cgraph_edge *e; | |
581985d7 MJ |
2880 | for (e = cgraph_get_node (current_function_decl)->callers; |
2881 | e; | |
2882 | e = e->next_caller) | |
33977f81 | 2883 | { |
960bfb69 | 2884 | if (e->caller->symbol.decl == current_function_decl) |
33977f81 | 2885 | continue; |
c47d0034 | 2886 | if (!cgraph_function_with_gimple_body_p (e->caller)) |
33977f81 | 2887 | continue; |
960bfb69 | 2888 | if (TREE_ASM_WRITTEN (e->caller->symbol.decl)) |
33977f81 JH |
2889 | continue; |
2890 | if (!e->caller->process && !e->caller->global.inlined_to) | |
2891 | break; | |
2892 | } | |
2893 | if (dump_file && e) | |
2894 | { | |
2895 | fprintf (dump_file, "Already processed call to:\n"); | |
2896 | dump_cgraph_node (dump_file, e->caller); | |
2897 | } | |
2898 | return e != NULL; | |
2899 | } | |
2900 | ||
873aa8f5 | 2901 | #include "gt-passes.h" |