Mercurial > hg > CbC > CbC_gcc
annotate gcc/passes.c @ 117:f81c5aa9f14f
fix
author | mir3636 |
---|---|
date | Tue, 28 Nov 2017 21:17:15 +0900 |
parents | ab0bcb71f44d |
children | d34655255c78 |
rev | line source |
---|---|
0 | 1 /* Top level of GCC compilers (cc1, cc1plus, etc.) |
111 | 2 Copyright (C) 1987-2017 Free Software Foundation, Inc. |
0 | 3 |
4 This file is part of GCC. | |
5 | |
6 GCC is free software; you can redistribute it and/or modify it under | |
7 the terms of the GNU General Public License as published by the Free | |
8 Software Foundation; either version 3, or (at your option) any later | |
9 version. | |
10 | |
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GCC; see the file COPYING3. If not see | |
18 <http://www.gnu.org/licenses/>. */ | |
19 | |
20 /* This is the top level of cc1/c++. | |
21 It parses command args, opens files, invokes the various passes | |
22 in the proper order, and counts the time used by each. | |
23 Error messages and low-level interface to malloc also handled here. */ | |
24 | |
25 #include "config.h" | |
26 #include "system.h" | |
27 #include "coretypes.h" | |
111 | 28 #include "backend.h" |
0 | 29 #include "target.h" |
111 | 30 #include "rtl.h" |
31 #include "tree.h" | |
32 #include "gimple.h" | |
33 #include "cfghooks.h" | |
34 #include "df.h" | |
35 #include "memmodel.h" | |
36 #include "tm_p.h" | |
37 #include "ssa.h" | |
38 #include "emit-rtl.h" | |
39 #include "cgraph.h" | |
40 #include "lto-streamer.h" | |
41 #include "fold-const.h" | |
42 #include "varasm.h" | |
43 #include "output.h" | |
44 #include "graph.h" | |
45 #include "debug.h" | |
0 | 46 #include "cfgloop.h" |
47 #include "value-prof.h" | |
111 | 48 #include "tree-cfg.h" |
49 #include "tree-ssa-loop-manip.h" | |
50 #include "tree-into-ssa.h" | |
51 #include "tree-dfa.h" | |
52 #include "tree-ssa.h" | |
0 | 53 #include "tree-pass.h" |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
54 #include "plugin.h" |
111 | 55 #include "ipa-utils.h" |
56 #include "tree-pretty-print.h" /* for dump_function_header */ | |
57 #include "context.h" | |
58 #include "pass_manager.h" | |
59 #include "cfgrtl.h" | |
60 #include "tree-ssa-live.h" /* For remove_unused_locals. */ | |
61 #include "tree-cfgcleanup.h" | |
62 #include "insn-addr.h" /* for INSN_ADDRESSES_ALLOC. */ | |
63 #include "diagnostic-core.h" /* for fnotice */ | |
64 #include "stringpool.h" | |
65 #include "attribs.h" | |
66 | |
67 using namespace gcc; | |
0 | 68 |
69 /* This is used for debugging. It allows the current pass to printed | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
70 from anywhere in compilation. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
71 The variable current_pass is also used for statistics and plugins. */ |
111 | 72 opt_pass *current_pass; |
73 | |
74 /* Most passes are single-instance (within their context) and thus don't | |
75 need to implement cloning, but passes that support multiple instances | |
76 *must* provide their own implementation of the clone method. | |
77 | |
78 Handle this by providing a default implemenation, but make it a fatal | |
79 error to call it. */ | |
80 | |
81 opt_pass * | |
82 opt_pass::clone () | |
83 { | |
84 internal_error ("pass %s does not support cloning", name); | |
85 } | |
86 | |
87 void | |
88 opt_pass::set_pass_param (unsigned int, bool) | |
89 { | |
90 internal_error ("pass %s needs a set_pass_param implementation to handle the" | |
91 " extra argument in NEXT_PASS", name); | |
92 } | |
93 | |
94 bool | |
95 opt_pass::gate (function *) | |
96 { | |
97 return true; | |
98 } | |
99 | |
100 unsigned int | |
101 opt_pass::execute (function *) | |
102 { | |
103 return 0; | |
104 } | |
105 | |
106 opt_pass::opt_pass (const pass_data &data, context *ctxt) | |
107 : pass_data (data), | |
108 sub (NULL), | |
109 next (NULL), | |
110 static_pass_number (0), | |
111 m_ctxt (ctxt) | |
112 { | |
113 } | |
114 | |
115 | |
116 void | |
117 pass_manager::execute_early_local_passes () | |
118 { | |
119 execute_pass_list (cfun, pass_build_ssa_passes_1->sub); | |
120 if (flag_check_pointer_bounds) | |
121 execute_pass_list (cfun, pass_chkp_instrumentation_passes_1->sub); | |
122 execute_pass_list (cfun, pass_local_optimization_passes_1->sub); | |
123 } | |
124 | |
125 unsigned int | |
126 pass_manager::execute_pass_mode_switching () | |
127 { | |
128 return pass_mode_switching_1->execute (cfun); | |
129 } | |
130 | |
0 | 131 |
132 /* Call from anywhere to find out what pass this is. Useful for | |
133 printing out debugging information deep inside an service | |
134 routine. */ | |
135 void | |
136 print_current_pass (FILE *file) | |
137 { | |
138 if (current_pass) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
139 fprintf (file, "current pass = %s (%d)\n", |
0 | 140 current_pass->name, current_pass->static_pass_number); |
141 else | |
142 fprintf (file, "no current pass.\n"); | |
143 } | |
144 | |
145 | |
146 /* Call from the debugger to get the current pass name. */ | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
147 DEBUG_FUNCTION void |
0 | 148 debug_pass (void) |
149 { | |
150 print_current_pass (stderr); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
151 } |
0 | 152 |
153 | |
154 | |
155 /* Global variables used to communicate with passes. */ | |
156 bool in_gimple_form; | |
157 | |
158 | |
159 /* This is called from various places for FUNCTION_DECL, VAR_DECL, | |
160 and TYPE_DECL nodes. | |
161 | |
162 This does nothing for local (non-static) variables, unless the | |
163 variable is a register variable with DECL_ASSEMBLER_NAME set. In | |
164 that case, or if the variable is not an automatic, it sets up the | |
165 RTL and outputs any assembler code (label definition, storage | |
166 allocation and initialization). | |
167 | |
168 DECL is the declaration. TOP_LEVEL is nonzero | |
169 if this declaration is not within a function. */ | |
170 | |
171 void | |
172 rest_of_decl_compilation (tree decl, | |
173 int top_level, | |
174 int at_end) | |
175 { | |
111 | 176 bool finalize = true; |
177 | |
0 | 178 /* We deferred calling assemble_alias so that we could collect |
179 other attributes such as visibility. Emit the alias now. */ | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
180 if (!in_lto_p) |
0 | 181 { |
182 tree alias; | |
183 alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl)); | |
184 if (alias) | |
185 { | |
186 alias = TREE_VALUE (TREE_VALUE (alias)); | |
187 alias = get_identifier (TREE_STRING_POINTER (alias)); | |
111 | 188 /* A quirk of the initial implementation of aliases required that the |
189 user add "extern" to all of them. Which is silly, but now | |
190 historical. Do note that the symbol is in fact locally defined. */ | |
191 DECL_EXTERNAL (decl) = 0; | |
192 TREE_STATIC (decl) = 1; | |
0 | 193 assemble_alias (decl, alias); |
111 | 194 finalize = false; |
0 | 195 } |
196 } | |
197 | |
198 /* Can't defer this, because it needs to happen before any | |
199 later function definitions are processed. */ | |
111 | 200 if (HAS_DECL_ASSEMBLER_NAME_P (decl) |
201 && DECL_ASSEMBLER_NAME_SET_P (decl) | |
202 && DECL_REGISTER (decl)) | |
0 | 203 make_decl_rtl (decl); |
204 | |
205 /* Forward declarations for nested functions are not "external", | |
206 but we need to treat them as if they were. */ | |
207 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl) | |
208 || TREE_CODE (decl) == FUNCTION_DECL) | |
209 { | |
210 timevar_push (TV_VARCONST); | |
211 | |
212 /* Don't output anything when a tentative file-scope definition | |
213 is seen. But at end of compilation, do output code for them. | |
214 | |
215 We do output all variables and rely on | |
216 callgraph code to defer them except for forward declarations | |
217 (see gcc.c-torture/compile/920624-1.c) */ | |
218 if ((at_end | |
219 || !DECL_DEFER_OUTPUT (decl) | |
220 || DECL_INITIAL (decl)) | |
111 | 221 && (!VAR_P (decl) || !DECL_HAS_VALUE_EXPR_P (decl)) |
0 | 222 && !DECL_EXTERNAL (decl)) |
223 { | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
224 /* When reading LTO unit, we also read varpool, so do not |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
225 rebuild it. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
226 if (in_lto_p && !at_end) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
227 ; |
111 | 228 else if (finalize && TREE_CODE (decl) != FUNCTION_DECL) |
229 varpool_node::finalize_decl (decl); | |
0 | 230 } |
231 | |
232 #ifdef ASM_FINISH_DECLARE_OBJECT | |
233 if (decl == last_assemble_variable_decl) | |
234 { | |
235 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl, | |
236 top_level, at_end); | |
237 } | |
238 #endif | |
239 | |
111 | 240 /* Now that we have activated any function-specific attributes |
241 that might affect function decl, particularly align, relayout it. */ | |
242 if (TREE_CODE (decl) == FUNCTION_DECL) | |
243 targetm.target_option.relayout_function (decl); | |
244 | |
0 | 245 timevar_pop (TV_VARCONST); |
246 } | |
247 else if (TREE_CODE (decl) == TYPE_DECL | |
248 /* Like in rest_of_type_compilation, avoid confusing the debug | |
249 information machinery when there are errors. */ | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
250 && !seen_error ()) |
0 | 251 { |
252 timevar_push (TV_SYMOUT); | |
253 debug_hooks->type_decl (decl, !top_level); | |
254 timevar_pop (TV_SYMOUT); | |
255 } | |
256 | |
257 /* Let cgraph know about the existence of variables. */ | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
258 if (in_lto_p && !at_end) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
259 ; |
111 | 260 else if (VAR_P (decl) && !DECL_EXTERNAL (decl) |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
261 && TREE_STATIC (decl)) |
111 | 262 varpool_node::get_create (decl); |
263 | |
264 /* Generate early debug for global variables. Any local variables will | |
265 be handled by either handling reachable functions from | |
266 finalize_compilation_unit (and by consequence, locally scoped | |
267 symbols), or by rest_of_type_compilation below. | |
268 | |
269 For Go's hijack of the debug_hooks to implement -fdump-go-spec, pick up | |
270 function prototypes. Go's debug_hooks will not forward them to the | |
271 wrapped hooks. */ | |
272 if (!in_lto_p | |
273 && (TREE_CODE (decl) != FUNCTION_DECL | |
274 /* This will pick up function prototypes with no bodies, | |
275 which are not visible in finalize_compilation_unit() | |
276 while iterating with FOR_EACH_*_FUNCTION through the | |
277 symbol table. */ | |
278 || (flag_dump_go_spec != NULL | |
279 && !DECL_SAVED_TREE (decl) | |
280 && DECL_STRUCT_FUNCTION (decl) == NULL)) | |
281 | |
282 /* We need to check both decl_function_context and | |
283 current_function_decl here to make sure local extern | |
284 declarations end up with the correct context. | |
285 | |
286 For local extern declarations, decl_function_context is | |
287 empty, but current_function_decl is set to the function where | |
288 the extern was declared . Without the check for | |
289 !current_function_decl below, the local extern ends up | |
290 incorrectly with a top-level context. | |
291 | |
292 For example: | |
293 | |
294 namespace S | |
295 { | |
296 int | |
297 f() | |
298 { | |
299 { | |
300 int i = 42; | |
301 { | |
302 extern int i; // Local extern declaration. | |
303 return i; | |
304 } | |
305 } | |
306 } | |
307 } | |
308 */ | |
309 && !decl_function_context (decl) | |
310 && !current_function_decl | |
311 && DECL_SOURCE_LOCATION (decl) != BUILTINS_LOCATION | |
312 && (!decl_type_context (decl) | |
313 /* If we created a varpool node for the decl make sure to | |
314 call early_global_decl. Otherwise we miss changes | |
315 introduced by member definitions like | |
316 struct A { static int staticdatamember; }; | |
317 int A::staticdatamember; | |
318 and thus have incomplete early debug and late debug | |
319 called from varpool node removal fails to handle it | |
320 properly. */ | |
321 || (finalize | |
322 && VAR_P (decl) | |
323 && TREE_STATIC (decl) && !DECL_EXTERNAL (decl))) | |
324 /* Avoid confusing the debug information machinery when there are | |
325 errors. */ | |
326 && !seen_error ()) | |
327 (*debug_hooks->early_global_decl) (decl); | |
0 | 328 } |
329 | |
330 /* Called after finishing a record, union or enumeral type. */ | |
331 | |
332 void | |
333 rest_of_type_compilation (tree type, int toplev) | |
334 { | |
335 /* Avoid confusing the debug information machinery when there are | |
336 errors. */ | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
337 if (seen_error ()) |
0 | 338 return; |
339 | |
340 timevar_push (TV_SYMOUT); | |
341 debug_hooks->type_decl (TYPE_STUB_DECL (type), !toplev); | |
342 timevar_pop (TV_SYMOUT); | |
343 } | |
344 | |
345 | |
346 | |
347 void | |
111 | 348 pass_manager:: |
0 | 349 finish_optimization_passes (void) |
350 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
351 int i; |
0 | 352 struct dump_file_info *dfi; |
353 char *name; | |
111 | 354 gcc::dump_manager *dumps = m_ctxt->get_dumps (); |
0 | 355 |
356 timevar_push (TV_DUMP); | |
357 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) | |
358 { | |
111 | 359 dumps->dump_start (pass_profile_1->static_pass_number, NULL); |
0 | 360 end_branch_prob (); |
111 | 361 dumps->dump_finish (pass_profile_1->static_pass_number); |
0 | 362 } |
363 | |
364 if (optimize > 0) | |
365 { | |
111 | 366 dumps->dump_start (pass_profile_1->static_pass_number, NULL); |
367 print_combine_total_stats (); | |
368 dumps->dump_finish (pass_profile_1->static_pass_number); | |
0 | 369 } |
370 | |
371 /* Do whatever is necessary to finish printing the graphs. */ | |
111 | 372 for (i = TDI_end; (dfi = dumps->get_dump_file_info (i)) != NULL; ++i) |
373 if (dfi->graph_dump_initialized) | |
374 { | |
375 name = dumps->get_dump_file_name (dfi); | |
376 finish_graph_dump_file (name); | |
377 free (name); | |
378 } | |
0 | 379 |
380 timevar_pop (TV_DUMP); | |
381 } | |
382 | |
111 | 383 static unsigned int |
384 execute_build_ssa_passes (void) | |
385 { | |
386 /* Once this pass (and its sub-passes) are complete, all functions | |
387 will be in SSA form. Technically this state change is happening | |
388 a tad early, since the sub-passes have not yet run, but since | |
389 none of the sub-passes are IPA passes and do not create new | |
390 functions, this is ok. We're setting this value for the benefit | |
391 of IPA passes that follow. */ | |
392 if (symtab->state < IPA_SSA) | |
393 symtab->state = IPA_SSA; | |
394 return 0; | |
395 } | |
396 | |
397 namespace { | |
398 | |
399 const pass_data pass_data_build_ssa_passes = | |
400 { | |
401 SIMPLE_IPA_PASS, /* type */ | |
402 "build_ssa_passes", /* name */ | |
403 OPTGROUP_NONE, /* optinfo_flags */ | |
404 TV_EARLY_LOCAL, /* tv_id */ | |
405 0, /* properties_required */ | |
406 0, /* properties_provided */ | |
407 0, /* properties_destroyed */ | |
408 0, /* todo_flags_start */ | |
409 /* todo_flags_finish is executed before subpases. For this reason | |
410 it makes no sense to remove unreachable functions here. */ | |
411 0, /* todo_flags_finish */ | |
412 }; | |
413 | |
414 class pass_build_ssa_passes : public simple_ipa_opt_pass | |
0 | 415 { |
111 | 416 public: |
417 pass_build_ssa_passes (gcc::context *ctxt) | |
418 : simple_ipa_opt_pass (pass_data_build_ssa_passes, ctxt) | |
419 {} | |
420 | |
421 /* opt_pass methods: */ | |
422 virtual bool gate (function *) | |
423 { | |
424 /* Don't bother doing anything if the program has errors. */ | |
425 return (!seen_error () && !in_lto_p); | |
426 } | |
427 | |
428 virtual unsigned int execute (function *) | |
429 { | |
430 return execute_build_ssa_passes (); | |
431 } | |
432 | |
433 }; // class pass_build_ssa_passes | |
434 | |
435 const pass_data pass_data_chkp_instrumentation_passes = | |
436 { | |
437 SIMPLE_IPA_PASS, /* type */ | |
438 "chkp_passes", /* name */ | |
439 OPTGROUP_NONE, /* optinfo_flags */ | |
440 TV_NONE, /* tv_id */ | |
441 0, /* properties_required */ | |
442 0, /* properties_provided */ | |
443 0, /* properties_destroyed */ | |
444 0, /* todo_flags_start */ | |
445 0, /* todo_flags_finish */ | |
446 }; | |
447 | |
448 class pass_chkp_instrumentation_passes : public simple_ipa_opt_pass | |
449 { | |
450 public: | |
451 pass_chkp_instrumentation_passes (gcc::context *ctxt) | |
452 : simple_ipa_opt_pass (pass_data_chkp_instrumentation_passes, ctxt) | |
453 {} | |
454 | |
455 /* opt_pass methods: */ | |
456 virtual bool gate (function *) | |
457 { | |
458 /* Don't bother doing anything if the program has errors. */ | |
459 return (flag_check_pointer_bounds | |
460 && !seen_error () && !in_lto_p); | |
461 } | |
462 | |
463 }; // class pass_chkp_instrumentation_passes | |
464 | |
465 const pass_data pass_data_local_optimization_passes = | |
0 | 466 { |
111 | 467 SIMPLE_IPA_PASS, /* type */ |
468 "opt_local_passes", /* name */ | |
469 OPTGROUP_NONE, /* optinfo_flags */ | |
470 TV_NONE, /* tv_id */ | |
471 0, /* properties_required */ | |
472 0, /* properties_provided */ | |
473 0, /* properties_destroyed */ | |
474 0, /* todo_flags_start */ | |
475 0, /* todo_flags_finish */ | |
0 | 476 }; |
477 | |
111 | 478 class pass_local_optimization_passes : public simple_ipa_opt_pass |
479 { | |
480 public: | |
481 pass_local_optimization_passes (gcc::context *ctxt) | |
482 : simple_ipa_opt_pass (pass_data_local_optimization_passes, ctxt) | |
483 {} | |
484 | |
485 /* opt_pass methods: */ | |
486 virtual bool gate (function *) | |
487 { | |
488 /* Don't bother doing anything if the program has errors. */ | |
489 return (!seen_error () && !in_lto_p); | |
490 } | |
491 | |
492 }; // class pass_local_optimization_passes | |
493 | |
494 } // anon namespace | |
495 | |
496 simple_ipa_opt_pass * | |
497 make_pass_build_ssa_passes (gcc::context *ctxt) | |
498 { | |
499 return new pass_build_ssa_passes (ctxt); | |
500 } | |
501 | |
502 simple_ipa_opt_pass * | |
503 make_pass_chkp_instrumentation_passes (gcc::context *ctxt) | |
504 { | |
505 return new pass_chkp_instrumentation_passes (ctxt); | |
506 } | |
507 | |
508 simple_ipa_opt_pass * | |
509 make_pass_local_optimization_passes (gcc::context *ctxt) | |
0 | 510 { |
111 | 511 return new pass_local_optimization_passes (ctxt); |
512 } | |
513 | |
514 namespace { | |
515 | |
516 const pass_data pass_data_all_early_optimizations = | |
517 { | |
518 GIMPLE_PASS, /* type */ | |
519 "early_optimizations", /* name */ | |
520 OPTGROUP_NONE, /* optinfo_flags */ | |
521 TV_NONE, /* tv_id */ | |
522 0, /* properties_required */ | |
523 0, /* properties_provided */ | |
524 0, /* properties_destroyed */ | |
525 0, /* todo_flags_start */ | |
526 0, /* todo_flags_finish */ | |
527 }; | |
528 | |
529 class pass_all_early_optimizations : public gimple_opt_pass | |
530 { | |
531 public: | |
532 pass_all_early_optimizations (gcc::context *ctxt) | |
533 : gimple_opt_pass (pass_data_all_early_optimizations, ctxt) | |
534 {} | |
535 | |
536 /* opt_pass methods: */ | |
537 virtual bool gate (function *) | |
538 { | |
539 return (optimize >= 1 | |
540 /* Don't bother doing anything if the program has errors. */ | |
541 && !seen_error ()); | |
542 } | |
543 | |
544 }; // class pass_all_early_optimizations | |
545 | |
546 } // anon namespace | |
547 | |
548 static gimple_opt_pass * | |
549 make_pass_all_early_optimizations (gcc::context *ctxt) | |
550 { | |
551 return new pass_all_early_optimizations (ctxt); | |
0 | 552 } |
553 | |
111 | 554 namespace { |
555 | |
556 const pass_data pass_data_all_optimizations = | |
557 { | |
558 GIMPLE_PASS, /* type */ | |
559 "*all_optimizations", /* name */ | |
560 OPTGROUP_NONE, /* optinfo_flags */ | |
561 TV_OPTIMIZE, /* tv_id */ | |
562 0, /* properties_required */ | |
563 0, /* properties_provided */ | |
564 0, /* properties_destroyed */ | |
565 0, /* todo_flags_start */ | |
566 0, /* todo_flags_finish */ | |
567 }; | |
568 | |
569 class pass_all_optimizations : public gimple_opt_pass | |
570 { | |
571 public: | |
572 pass_all_optimizations (gcc::context *ctxt) | |
573 : gimple_opt_pass (pass_data_all_optimizations, ctxt) | |
574 {} | |
575 | |
576 /* opt_pass methods: */ | |
577 virtual bool gate (function *) { return optimize >= 1 && !optimize_debug; } | |
578 | |
579 }; // class pass_all_optimizations | |
580 | |
581 } // anon namespace | |
582 | |
583 static gimple_opt_pass * | |
584 make_pass_all_optimizations (gcc::context *ctxt) | |
585 { | |
586 return new pass_all_optimizations (ctxt); | |
587 } | |
588 | |
589 namespace { | |
590 | |
591 const pass_data pass_data_all_optimizations_g = | |
592 { | |
593 GIMPLE_PASS, /* type */ | |
594 "*all_optimizations_g", /* name */ | |
595 OPTGROUP_NONE, /* optinfo_flags */ | |
596 TV_OPTIMIZE, /* tv_id */ | |
597 0, /* properties_required */ | |
598 0, /* properties_provided */ | |
599 0, /* properties_destroyed */ | |
600 0, /* todo_flags_start */ | |
601 0, /* todo_flags_finish */ | |
602 }; | |
603 | |
604 class pass_all_optimizations_g : public gimple_opt_pass | |
605 { | |
606 public: | |
607 pass_all_optimizations_g (gcc::context *ctxt) | |
608 : gimple_opt_pass (pass_data_all_optimizations_g, ctxt) | |
609 {} | |
610 | |
611 /* opt_pass methods: */ | |
612 virtual bool gate (function *) { return optimize >= 1 && optimize_debug; } | |
613 | |
614 }; // class pass_all_optimizations_g | |
615 | |
616 } // anon namespace | |
617 | |
618 static gimple_opt_pass * | |
619 make_pass_all_optimizations_g (gcc::context *ctxt) | |
620 { | |
621 return new pass_all_optimizations_g (ctxt); | |
622 } | |
623 | |
624 namespace { | |
625 | |
626 const pass_data pass_data_rest_of_compilation = | |
627 { | |
628 RTL_PASS, /* type */ | |
629 "*rest_of_compilation", /* name */ | |
630 OPTGROUP_NONE, /* optinfo_flags */ | |
631 TV_REST_OF_COMPILATION, /* tv_id */ | |
632 PROP_rtl, /* properties_required */ | |
633 0, /* properties_provided */ | |
634 0, /* properties_destroyed */ | |
635 0, /* todo_flags_start */ | |
636 0, /* todo_flags_finish */ | |
637 }; | |
638 | |
639 class pass_rest_of_compilation : public rtl_opt_pass | |
0 | 640 { |
111 | 641 public: |
642 pass_rest_of_compilation (gcc::context *ctxt) | |
643 : rtl_opt_pass (pass_data_rest_of_compilation, ctxt) | |
644 {} | |
645 | |
646 /* opt_pass methods: */ | |
647 virtual bool gate (function *) | |
648 { | |
649 /* Early return if there were errors. We can run afoul of our | |
650 consistency checks, and there's not really much point in fixing them. */ | |
651 return !(rtl_dump_and_exit || flag_syntax_only || seen_error ()); | |
652 } | |
653 | |
654 }; // class pass_rest_of_compilation | |
655 | |
656 } // anon namespace | |
657 | |
658 static rtl_opt_pass * | |
659 make_pass_rest_of_compilation (gcc::context *ctxt) | |
660 { | |
661 return new pass_rest_of_compilation (ctxt); | |
662 } | |
663 | |
664 namespace { | |
665 | |
666 const pass_data pass_data_postreload = | |
667 { | |
668 RTL_PASS, /* type */ | |
669 "*all-postreload", /* name */ | |
670 OPTGROUP_NONE, /* optinfo_flags */ | |
671 TV_POSTRELOAD, /* tv_id */ | |
672 PROP_rtl, /* properties_required */ | |
673 0, /* properties_provided */ | |
674 0, /* properties_destroyed */ | |
675 0, /* todo_flags_start */ | |
676 0, /* todo_flags_finish */ | |
0 | 677 }; |
678 | |
111 | 679 class pass_postreload : public rtl_opt_pass |
680 { | |
681 public: | |
682 pass_postreload (gcc::context *ctxt) | |
683 : rtl_opt_pass (pass_data_postreload, ctxt) | |
684 {} | |
685 | |
686 /* opt_pass methods: */ | |
687 virtual bool gate (function *) { return reload_completed; } | |
688 | |
689 }; // class pass_postreload | |
690 | |
691 } // anon namespace | |
692 | |
693 static rtl_opt_pass * | |
694 make_pass_postreload (gcc::context *ctxt) | |
695 { | |
696 return new pass_postreload (ctxt); | |
697 } | |
698 | |
699 namespace { | |
700 | |
701 const pass_data pass_data_late_compilation = | |
702 { | |
703 RTL_PASS, /* type */ | |
704 "*all-late_compilation", /* name */ | |
705 OPTGROUP_NONE, /* optinfo_flags */ | |
706 TV_LATE_COMPILATION, /* tv_id */ | |
707 PROP_rtl, /* properties_required */ | |
708 0, /* properties_provided */ | |
709 0, /* properties_destroyed */ | |
710 0, /* todo_flags_start */ | |
711 0, /* todo_flags_finish */ | |
712 }; | |
713 | |
714 class pass_late_compilation : public rtl_opt_pass | |
715 { | |
716 public: | |
717 pass_late_compilation (gcc::context *ctxt) | |
718 : rtl_opt_pass (pass_data_late_compilation, ctxt) | |
719 {} | |
720 | |
721 /* opt_pass methods: */ | |
722 virtual bool gate (function *) | |
723 { | |
724 return reload_completed || targetm.no_register_allocation; | |
725 } | |
726 | |
727 }; // class pass_late_compilation | |
728 | |
729 } // anon namespace | |
730 | |
731 static rtl_opt_pass * | |
732 make_pass_late_compilation (gcc::context *ctxt) | |
733 { | |
734 return new pass_late_compilation (ctxt); | |
735 } | |
736 | |
737 | |
0 | 738 |
739 /* Set the static pass number of pass PASS to ID and record that | |
740 in the mapping from static pass number to pass. */ | |
741 | |
111 | 742 void |
743 pass_manager:: | |
744 set_pass_for_id (int id, opt_pass *pass) | |
0 | 745 { |
746 pass->static_pass_number = id; | |
747 if (passes_by_id_size <= id) | |
748 { | |
111 | 749 passes_by_id = XRESIZEVEC (opt_pass *, passes_by_id, id + 1); |
0 | 750 memset (passes_by_id + passes_by_id_size, 0, |
751 (id + 1 - passes_by_id_size) * sizeof (void *)); | |
752 passes_by_id_size = id + 1; | |
753 } | |
754 passes_by_id[id] = pass; | |
755 } | |
756 | |
757 /* Return the pass with the static pass number ID. */ | |
758 | |
111 | 759 opt_pass * |
760 pass_manager::get_pass_for_id (int id) const | |
0 | 761 { |
762 if (id >= passes_by_id_size) | |
763 return NULL; | |
764 return passes_by_id[id]; | |
765 } | |
766 | |
767 /* Iterate over the pass tree allocating dump file numbers. We want | |
768 to do this depth first, and independent of whether the pass is | |
769 enabled or not. */ | |
770 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
771 void |
111 | 772 register_one_dump_file (opt_pass *pass) |
773 { | |
774 g->get_passes ()->register_one_dump_file (pass); | |
775 } | |
776 | |
777 void | |
778 pass_manager::register_one_dump_file (opt_pass *pass) | |
0 | 779 { |
780 char *dot_name, *flag_name, *glob_name; | |
111 | 781 const char *name, *full_name, *prefix; |
782 | |
783 /* Buffer big enough to format a 32-bit UINT_MAX into. */ | |
784 char num[11]; | |
785 dump_kind dkind; | |
786 int id; | |
787 int optgroup_flags = OPTGROUP_NONE; | |
788 gcc::dump_manager *dumps = m_ctxt->get_dumps (); | |
0 | 789 |
790 /* See below in next_pass_1. */ | |
791 num[0] = '\0'; | |
792 if (pass->static_pass_number != -1) | |
111 | 793 sprintf (num, "%u", ((int) pass->static_pass_number < 0 |
0 | 794 ? 1 : pass->static_pass_number)); |
795 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
796 /* The name is both used to identify the pass for the purposes of plugins, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
797 and to specify dump file name and option. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
798 The latter two might want something short which is not quite unique; for |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
799 that reason, we may have a disambiguating prefix, followed by a space |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
800 to mark the start of the following dump file name / option string. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
801 name = strchr (pass->name, ' '); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
802 name = name ? name + 1 : pass->name; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
803 dot_name = concat (".", name, num, NULL); |
0 | 804 if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) |
111 | 805 { |
806 prefix = "ipa-"; | |
807 dkind = DK_ipa; | |
808 optgroup_flags |= OPTGROUP_IPA; | |
809 } | |
0 | 810 else if (pass->type == GIMPLE_PASS) |
111 | 811 { |
812 prefix = "tree-"; | |
813 dkind = DK_tree; | |
814 } | |
0 | 815 else |
111 | 816 { |
817 prefix = "rtl-"; | |
818 dkind = DK_rtl; | |
819 } | |
0 | 820 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
821 flag_name = concat (prefix, name, num, NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
822 glob_name = concat (prefix, name, NULL); |
111 | 823 optgroup_flags |= pass->optinfo_flags; |
824 /* For any passes that do not have an optgroup set, and which are not | |
825 IPA passes setup above, set the optgroup to OPTGROUP_OTHER so that | |
826 any dump messages are emitted properly under -fopt-info(-optall). */ | |
827 if (optgroup_flags == OPTGROUP_NONE) | |
828 optgroup_flags = OPTGROUP_OTHER; | |
829 id = dumps->dump_register (dot_name, flag_name, glob_name, dkind, | |
830 optgroup_flags, | |
831 true); | |
0 | 832 set_pass_for_id (id, pass); |
111 | 833 full_name = concat (prefix, pass->name, num, NULL); |
834 register_pass_name (pass, full_name); | |
835 free (CONST_CAST (char *, full_name)); | |
0 | 836 } |
837 | |
111 | 838 /* Register the dump files for the pass_manager starting at PASS. */ |
839 | |
840 void | |
841 pass_manager::register_dump_files (opt_pass *pass) | |
0 | 842 { |
843 do | |
844 { | |
845 if (pass->name && pass->name[0] != '*') | |
846 register_one_dump_file (pass); | |
847 | |
848 if (pass->sub) | |
111 | 849 register_dump_files (pass->sub); |
0 | 850 |
851 pass = pass->next; | |
852 } | |
853 while (pass); | |
111 | 854 } |
855 | |
856 /* Register PASS with NAME. */ | |
857 | |
858 void | |
859 pass_manager::register_pass_name (opt_pass *pass, const char *name) | |
860 { | |
861 if (!m_name_to_pass_map) | |
862 m_name_to_pass_map = new hash_map<nofree_string_hash, opt_pass *> (256); | |
863 | |
864 if (m_name_to_pass_map->get (name)) | |
865 return; /* Ignore plugin passes. */ | |
866 | |
867 const char *unique_name = xstrdup (name); | |
868 m_name_to_pass_map->put (unique_name, pass); | |
869 } | |
870 | |
871 /* Map from pass id to canonicalized pass name. */ | |
872 | |
873 typedef const char *char_ptr; | |
874 static vec<char_ptr> pass_tab; | |
875 | |
876 /* Callback function for traversing NAME_TO_PASS_MAP. */ | |
877 | |
878 bool | |
879 passes_pass_traverse (const char *const &name, opt_pass *const &pass, void *) | |
880 { | |
881 gcc_assert (pass->static_pass_number > 0); | |
882 gcc_assert (pass_tab.exists ()); | |
883 | |
884 pass_tab[pass->static_pass_number] = name; | |
885 | |
886 return 1; | |
887 } | |
888 | |
889 /* The function traverses NAME_TO_PASS_MAP and creates a pass info | |
890 table for dumping purpose. */ | |
891 | |
892 void | |
893 pass_manager::create_pass_tab (void) const | |
894 { | |
895 if (!flag_dump_passes) | |
896 return; | |
897 | |
898 pass_tab.safe_grow_cleared (passes_by_id_size + 1); | |
899 m_name_to_pass_map->traverse <void *, passes_pass_traverse> (NULL); | |
900 } | |
901 | |
902 static bool override_gate_status (opt_pass *, tree, bool); | |
903 | |
904 /* Dump the instantiated name for PASS. IS_ON indicates if PASS | |
905 is turned on or not. */ | |
906 | |
907 static void | |
908 dump_one_pass (opt_pass *pass, int pass_indent) | |
909 { | |
910 int indent = 3 * pass_indent; | |
911 const char *pn; | |
912 bool is_on, is_really_on; | |
913 | |
914 is_on = pass->gate (cfun); | |
915 is_really_on = override_gate_status (pass, current_function_decl, is_on); | |
916 | |
917 if (pass->static_pass_number <= 0) | |
918 pn = pass->name; | |
919 else | |
920 pn = pass_tab[pass->static_pass_number]; | |
921 | |
922 fprintf (stderr, "%*s%-40s%*s:%s%s\n", indent, " ", pn, | |
923 (15 - indent < 0 ? 0 : 15 - indent), " ", | |
924 is_on ? " ON" : " OFF", | |
925 ((!is_on) == (!is_really_on) ? "" | |
926 : (is_really_on ? " (FORCED_ON)" : " (FORCED_OFF)"))); | |
0 | 927 } |
928 | |
111 | 929 /* Dump pass list PASS with indentation INDENT. */ |
930 | |
931 static void | |
932 dump_pass_list (opt_pass *pass, int indent) | |
933 { | |
934 do | |
935 { | |
936 dump_one_pass (pass, indent); | |
937 if (pass->sub) | |
938 dump_pass_list (pass->sub, indent + 1); | |
939 pass = pass->next; | |
940 } | |
941 while (pass); | |
942 } | |
943 | |
944 /* Dump all optimization passes. */ | |
945 | |
946 void | |
947 dump_passes (void) | |
948 { | |
949 g->get_passes ()->dump_passes (); | |
950 } | |
951 | |
952 void | |
953 pass_manager::dump_passes () const | |
954 { | |
955 push_dummy_function (true); | |
956 | |
957 create_pass_tab (); | |
958 | |
959 dump_pass_list (all_lowering_passes, 1); | |
960 dump_pass_list (all_small_ipa_passes, 1); | |
961 dump_pass_list (all_regular_ipa_passes, 1); | |
962 dump_pass_list (all_late_ipa_passes, 1); | |
963 dump_pass_list (all_passes, 1); | |
964 | |
965 pop_dummy_function (); | |
966 } | |
967 | |
968 /* Returns the pass with NAME. */ | |
969 | |
970 opt_pass * | |
971 pass_manager::get_pass_by_name (const char *name) | |
972 { | |
973 opt_pass **p = m_name_to_pass_map->get (name); | |
974 if (p) | |
975 return *p; | |
976 | |
977 return NULL; | |
978 } | |
979 | |
980 | |
981 /* Range [start, last]. */ | |
982 | |
983 struct uid_range | |
984 { | |
985 unsigned int start; | |
986 unsigned int last; | |
987 const char *assem_name; | |
988 struct uid_range *next; | |
989 }; | |
990 | |
991 typedef struct uid_range *uid_range_p; | |
992 | |
993 | |
994 static vec<uid_range_p> enabled_pass_uid_range_tab; | |
995 static vec<uid_range_p> disabled_pass_uid_range_tab; | |
996 | |
997 | |
998 /* Parse option string for -fdisable- and -fenable- | |
999 The syntax of the options: | |
1000 | |
1001 -fenable-<pass_name> | |
1002 -fdisable-<pass_name> | |
1003 | |
1004 -fenable-<pass_name>=s1:e1,s2:e2,... | |
1005 -fdisable-<pass_name>=s1:e1,s2:e2,... | |
1006 */ | |
0 | 1007 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1008 static void |
111 | 1009 enable_disable_pass (const char *arg, bool is_enable) |
0 | 1010 { |
111 | 1011 opt_pass *pass; |
1012 char *range_str, *phase_name; | |
1013 char *argstr = xstrdup (arg); | |
1014 vec<uid_range_p> *tab = 0; | |
1015 | |
1016 range_str = strchr (argstr,'='); | |
1017 if (range_str) | |
1018 { | |
1019 *range_str = '\0'; | |
1020 range_str++; | |
1021 } | |
1022 | |
1023 phase_name = argstr; | |
1024 if (!*phase_name) | |
1025 { | |
1026 if (is_enable) | |
1027 error ("unrecognized option -fenable"); | |
1028 else | |
1029 error ("unrecognized option -fdisable"); | |
1030 free (argstr); | |
1031 return; | |
1032 } | |
1033 pass = g->get_passes ()->get_pass_by_name (phase_name); | |
1034 if (!pass || pass->static_pass_number == -1) | |
1035 { | |
1036 if (is_enable) | |
1037 error ("unknown pass %s specified in -fenable", phase_name); | |
1038 else | |
1039 error ("unknown pass %s specified in -fdisable", phase_name); | |
1040 free (argstr); | |
1041 return; | |
1042 } | |
1043 | |
1044 if (is_enable) | |
1045 tab = &enabled_pass_uid_range_tab; | |
1046 else | |
1047 tab = &disabled_pass_uid_range_tab; | |
1048 | |
1049 if ((unsigned) pass->static_pass_number >= tab->length ()) | |
1050 tab->safe_grow_cleared (pass->static_pass_number + 1); | |
1051 | |
1052 if (!range_str) | |
1053 { | |
1054 uid_range_p slot; | |
1055 uid_range_p new_range = XCNEW (struct uid_range); | |
1056 | |
1057 new_range->start = 0; | |
1058 new_range->last = (unsigned)-1; | |
1059 | |
1060 slot = (*tab)[pass->static_pass_number]; | |
1061 new_range->next = slot; | |
1062 (*tab)[pass->static_pass_number] = new_range; | |
1063 if (is_enable) | |
1064 inform (UNKNOWN_LOCATION, "enable pass %s for functions in the range " | |
1065 "of [%u, %u]", phase_name, new_range->start, new_range->last); | |
1066 else | |
1067 inform (UNKNOWN_LOCATION, "disable pass %s for functions in the range " | |
1068 "of [%u, %u]", phase_name, new_range->start, new_range->last); | |
1069 } | |
1070 else | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1071 { |
111 | 1072 char *next_range = NULL; |
1073 char *one_range = range_str; | |
1074 char *end_val = NULL; | |
1075 | |
1076 do | |
1077 { | |
1078 uid_range_p slot; | |
1079 uid_range_p new_range; | |
1080 char *invalid = NULL; | |
1081 long start; | |
1082 char *func_name = NULL; | |
1083 | |
1084 next_range = strchr (one_range, ','); | |
1085 if (next_range) | |
1086 { | |
1087 *next_range = '\0'; | |
1088 next_range++; | |
1089 } | |
1090 | |
1091 end_val = strchr (one_range, ':'); | |
1092 if (end_val) | |
1093 { | |
1094 *end_val = '\0'; | |
1095 end_val++; | |
1096 } | |
1097 start = strtol (one_range, &invalid, 10); | |
1098 if (*invalid || start < 0) | |
1099 { | |
1100 if (end_val || (one_range[0] >= '0' | |
1101 && one_range[0] <= '9')) | |
1102 { | |
1103 error ("Invalid range %s in option %s", | |
1104 one_range, | |
1105 is_enable ? "-fenable" : "-fdisable"); | |
1106 free (argstr); | |
1107 return; | |
1108 } | |
1109 func_name = one_range; | |
1110 } | |
1111 if (!end_val) | |
1112 { | |
1113 new_range = XCNEW (struct uid_range); | |
1114 if (!func_name) | |
1115 { | |
1116 new_range->start = (unsigned) start; | |
1117 new_range->last = (unsigned) start; | |
1118 } | |
1119 else | |
1120 { | |
1121 new_range->start = (unsigned) -1; | |
1122 new_range->last = (unsigned) -1; | |
1123 new_range->assem_name = xstrdup (func_name); | |
1124 } | |
1125 } | |
1126 else | |
1127 { | |
1128 long last = strtol (end_val, &invalid, 10); | |
1129 if (*invalid || last < start) | |
1130 { | |
1131 error ("Invalid range %s in option %s", | |
1132 end_val, | |
1133 is_enable ? "-fenable" : "-fdisable"); | |
1134 free (argstr); | |
1135 return; | |
1136 } | |
1137 new_range = XCNEW (struct uid_range); | |
1138 new_range->start = (unsigned) start; | |
1139 new_range->last = (unsigned) last; | |
1140 } | |
1141 | |
1142 slot = (*tab)[pass->static_pass_number]; | |
1143 new_range->next = slot; | |
1144 (*tab)[pass->static_pass_number] = new_range; | |
1145 if (is_enable) | |
1146 { | |
1147 if (new_range->assem_name) | |
1148 inform (UNKNOWN_LOCATION, | |
1149 "enable pass %s for function %s", | |
1150 phase_name, new_range->assem_name); | |
1151 else | |
1152 inform (UNKNOWN_LOCATION, | |
1153 "enable pass %s for functions in the range of [%u, %u]", | |
1154 phase_name, new_range->start, new_range->last); | |
1155 } | |
1156 else | |
1157 { | |
1158 if (new_range->assem_name) | |
1159 inform (UNKNOWN_LOCATION, | |
1160 "disable pass %s for function %s", | |
1161 phase_name, new_range->assem_name); | |
1162 else | |
1163 inform (UNKNOWN_LOCATION, | |
1164 "disable pass %s for functions in the range of [%u, %u]", | |
1165 phase_name, new_range->start, new_range->last); | |
1166 } | |
1167 | |
1168 one_range = next_range; | |
1169 } while (next_range); | |
1170 } | |
1171 | |
1172 free (argstr); | |
1173 } | |
1174 | |
1175 /* Enable pass specified by ARG. */ | |
1176 | |
1177 void | |
1178 enable_pass (const char *arg) | |
1179 { | |
1180 enable_disable_pass (arg, true); | |
1181 } | |
1182 | |
1183 /* Disable pass specified by ARG. */ | |
1184 | |
1185 void | |
1186 disable_pass (const char *arg) | |
1187 { | |
1188 enable_disable_pass (arg, false); | |
1189 } | |
1190 | |
1191 /* Returns true if PASS is explicitly enabled/disabled for FUNC. */ | |
1192 | |
1193 static bool | |
1194 is_pass_explicitly_enabled_or_disabled (opt_pass *pass, | |
1195 tree func, | |
1196 vec<uid_range_p> tab) | |
1197 { | |
1198 uid_range_p slot, range; | |
1199 int cgraph_uid; | |
1200 const char *aname = NULL; | |
1201 | |
1202 if (!tab.exists () | |
1203 || (unsigned) pass->static_pass_number >= tab.length () | |
1204 || pass->static_pass_number == -1) | |
1205 return false; | |
1206 | |
1207 slot = tab[pass->static_pass_number]; | |
1208 if (!slot) | |
1209 return false; | |
1210 | |
1211 cgraph_uid = func ? cgraph_node::get (func)->uid : 0; | |
1212 if (func && DECL_ASSEMBLER_NAME_SET_P (func)) | |
1213 aname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (func)); | |
1214 | |
1215 range = slot; | |
1216 while (range) | |
1217 { | |
1218 if ((unsigned) cgraph_uid >= range->start | |
1219 && (unsigned) cgraph_uid <= range->last) | |
1220 return true; | |
1221 if (range->assem_name && aname | |
1222 && !strcmp (range->assem_name, aname)) | |
1223 return true; | |
1224 range = range->next; | |
1225 } | |
1226 | |
1227 return false; | |
1228 } | |
1229 | |
1230 | |
1231 /* Update static_pass_number for passes (and the flag | |
1232 TODO_mark_first_instance). | |
1233 | |
1234 Passes are constructed with static_pass_number preinitialized to 0 | |
1235 | |
1236 This field is used in two different ways: initially as instance numbers | |
1237 of their kind, and then as ids within the entire pass manager. | |
1238 | |
1239 Within pass_manager::pass_manager: | |
1240 | |
1241 * In add_pass_instance(), as called by next_pass_1 in | |
1242 NEXT_PASS in init_optimization_passes | |
1243 | |
1244 * When the initial instance of a pass within a pass manager is seen, | |
1245 it is flagged, and its static_pass_number is set to -1 | |
1246 | |
1247 * On subsequent times that it is seen, the static pass number | |
1248 is decremented each time, so that if there are e.g. 4 dups, | |
1249 they have static_pass_number -4, 2, 3, 4 respectively (note | |
1250 how the initial one is negative and gives the count); these | |
1251 can be thought of as instance numbers of the specific pass | |
1252 | |
1253 * Within the register_dump_files () traversal, set_pass_for_id() | |
1254 is called on each pass, using these instance numbers to create | |
1255 dumpfile switches, and then overwriting them with a pass id, | |
1256 which are global to the whole pass manager (based on | |
1257 (TDI_end + current value of extra_dump_files_in_use) ) */ | |
1258 | |
1259 static void | |
1260 add_pass_instance (opt_pass *new_pass, bool track_duplicates, | |
1261 opt_pass *initial_pass) | |
1262 { | |
1263 /* Are we dealing with the first pass of its kind, or a clone? */ | |
1264 if (new_pass != initial_pass) | |
1265 { | |
1266 /* We're dealing with a clone. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1267 new_pass->todo_flags_start &= ~TODO_mark_first_instance; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1268 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1269 /* Indicate to register_dump_files that this pass has duplicates, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1270 and so it should rename the dump file. The first instance will |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1271 be -1, and be number of duplicates = -static_pass_number - 1. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1272 Subsequent instances will be > 0 and just the duplicate number. */ |
111 | 1273 if ((new_pass->name && new_pass->name[0] != '*') || track_duplicates) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1274 { |
111 | 1275 initial_pass->static_pass_number -= 1; |
1276 new_pass->static_pass_number = -initial_pass->static_pass_number; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1277 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1278 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1279 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1280 { |
111 | 1281 /* We're dealing with the first pass of its kind. */ |
1282 new_pass->todo_flags_start |= TODO_mark_first_instance; | |
1283 new_pass->static_pass_number = -1; | |
1284 | |
1285 invoke_plugin_callbacks (PLUGIN_NEW_PASS, new_pass); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1286 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1287 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1288 |
0 | 1289 /* Add a pass to the pass list. Duplicate the pass if it's already |
1290 in the list. */ | |
1291 | |
111 | 1292 static opt_pass ** |
1293 next_pass_1 (opt_pass **list, opt_pass *pass, opt_pass *initial_pass) | |
0 | 1294 { |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1295 /* Every pass should have a name so that plugins can refer to them. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1296 gcc_assert (pass->name != NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1297 |
111 | 1298 add_pass_instance (pass, false, initial_pass); |
1299 *list = pass; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1300 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1301 return &(*list)->next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1302 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1303 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1304 /* List node for an inserted pass instance. We need to keep track of all |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1305 the newly-added pass instances (with 'added_pass_nodes' defined below) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1306 so that we can register their dump files after pass-positioning is finished. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1307 Registering dumping files needs to be post-processed or the |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1308 static_pass_number of the opt_pass object would be modified and mess up |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1309 the dump file names of future pass instances to be added. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1310 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1311 struct pass_list_node |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1312 { |
111 | 1313 opt_pass *pass; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1314 struct pass_list_node *next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1315 }; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1316 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1317 static struct pass_list_node *added_pass_nodes = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1318 static struct pass_list_node *prev_added_pass_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1319 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1320 /* Insert the pass at the proper position. Return true if the pass |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1321 is successfully added. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1322 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1323 NEW_PASS_INFO - new pass to be inserted |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1324 PASS_LIST - root of the pass list to insert the new pass to */ |
0 | 1325 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1326 static bool |
111 | 1327 position_pass (struct register_pass_info *new_pass_info, opt_pass **pass_list) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1328 { |
111 | 1329 opt_pass *pass = *pass_list, *prev_pass = NULL; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1330 bool success = false; |
0 | 1331 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1332 for ( ; pass; prev_pass = pass, pass = pass->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1333 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1334 /* Check if the current pass is of the same type as the new pass and |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1335 matches the name and the instance number of the reference pass. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1336 if (pass->type == new_pass_info->pass->type |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1337 && pass->name |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1338 && !strcmp (pass->name, new_pass_info->reference_pass_name) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1339 && ((new_pass_info->ref_pass_instance_number == 0) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1340 || (new_pass_info->ref_pass_instance_number == |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1341 pass->static_pass_number) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1342 || (new_pass_info->ref_pass_instance_number == 1 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1343 && pass->todo_flags_start & TODO_mark_first_instance))) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1344 { |
111 | 1345 opt_pass *new_pass; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1346 struct pass_list_node *new_pass_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1347 |
111 | 1348 if (new_pass_info->ref_pass_instance_number == 0) |
1349 { | |
1350 new_pass = new_pass_info->pass->clone (); | |
1351 add_pass_instance (new_pass, true, new_pass_info->pass); | |
1352 } | |
1353 else | |
1354 { | |
1355 new_pass = new_pass_info->pass; | |
1356 add_pass_instance (new_pass, true, new_pass); | |
1357 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1358 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1359 /* Insert the new pass instance based on the positioning op. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1360 switch (new_pass_info->pos_op) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1361 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1362 case PASS_POS_INSERT_AFTER: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1363 new_pass->next = pass->next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1364 pass->next = new_pass; |
0 | 1365 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1366 /* Skip newly inserted pass to avoid repeated |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1367 insertions in the case where the new pass and the |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1368 existing one have the same name. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1369 pass = new_pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1370 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1371 case PASS_POS_INSERT_BEFORE: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1372 new_pass->next = pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1373 if (prev_pass) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1374 prev_pass->next = new_pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1375 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1376 *pass_list = new_pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1377 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1378 case PASS_POS_REPLACE: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1379 new_pass->next = pass->next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1380 if (prev_pass) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1381 prev_pass->next = new_pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1382 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1383 *pass_list = new_pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1384 new_pass->sub = pass->sub; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1385 new_pass->tv_id = pass->tv_id; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1386 pass = new_pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1387 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1388 default: |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
1389 error ("invalid pass positioning operation"); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1390 return false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1391 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1392 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1393 /* Save the newly added pass (instance) in the added_pass_nodes |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1394 list so that we can register its dump file later. Note that |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1395 we cannot register the dump file now because doing so will modify |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1396 the static_pass_number of the opt_pass object and therefore |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1397 mess up the dump file name of future instances. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1398 new_pass_node = XCNEW (struct pass_list_node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1399 new_pass_node->pass = new_pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1400 if (!added_pass_nodes) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1401 added_pass_nodes = new_pass_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1402 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1403 prev_added_pass_node->next = new_pass_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1404 prev_added_pass_node = new_pass_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1405 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1406 success = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1407 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1408 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1409 if (pass->sub && position_pass (new_pass_info, &pass->sub)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1410 success = true; |
0 | 1411 } |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1412 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1413 return success; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1414 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1415 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1416 /* Hooks a new pass into the pass lists. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1417 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1418 PASS_INFO - pass information that specifies the opt_pass object, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1419 reference pass, instance number, and how to position |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1420 the pass */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1421 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1422 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1423 register_pass (struct register_pass_info *pass_info) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1424 { |
111 | 1425 g->get_passes ()->register_pass (pass_info); |
1426 } | |
1427 | |
1428 void | |
1429 register_pass (opt_pass* pass, pass_positioning_ops pos, | |
1430 const char* ref_pass_name, int ref_pass_inst_number) | |
1431 { | |
1432 register_pass_info i; | |
1433 i.pass = pass; | |
1434 i.reference_pass_name = ref_pass_name; | |
1435 i.ref_pass_instance_number = ref_pass_inst_number; | |
1436 i.pos_op = pos; | |
1437 | |
1438 g->get_passes ()->register_pass (&i); | |
1439 } | |
1440 | |
1441 void | |
1442 pass_manager::register_pass (struct register_pass_info *pass_info) | |
1443 { | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1444 bool all_instances, success; |
111 | 1445 gcc::dump_manager *dumps = m_ctxt->get_dumps (); |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1446 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1447 /* The checks below could fail in buggy plugins. Existing GCC |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1448 passes should never fail these checks, so we mention plugin in |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1449 the messages. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1450 if (!pass_info->pass) |
111 | 1451 fatal_error (input_location, "plugin cannot register a missing pass"); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1452 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1453 if (!pass_info->pass->name) |
111 | 1454 fatal_error (input_location, "plugin cannot register an unnamed pass"); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1455 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1456 if (!pass_info->reference_pass_name) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1457 fatal_error |
111 | 1458 (input_location, |
1459 "plugin cannot register pass %qs without reference pass name", | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1460 pass_info->pass->name); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1461 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1462 /* Try to insert the new pass to the pass lists. We need to check |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1463 all five lists as the reference pass could be in one (or all) of |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1464 them. */ |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1465 all_instances = pass_info->ref_pass_instance_number == 0; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1466 success = position_pass (pass_info, &all_lowering_passes); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1467 if (!success || all_instances) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1468 success |= position_pass (pass_info, &all_small_ipa_passes); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1469 if (!success || all_instances) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1470 success |= position_pass (pass_info, &all_regular_ipa_passes); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1471 if (!success || all_instances) |
111 | 1472 success |= position_pass (pass_info, &all_late_ipa_passes); |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1473 if (!success || all_instances) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1474 success |= position_pass (pass_info, &all_passes); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1475 if (!success) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1476 fatal_error |
111 | 1477 (input_location, |
1478 "pass %qs not found but is referenced by new pass %qs", | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1479 pass_info->reference_pass_name, pass_info->pass->name); |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1480 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1481 /* OK, we have successfully inserted the new pass. We need to register |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1482 the dump files for the newly added pass and its duplicates (if any). |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1483 Because the registration of plugin/backend passes happens after the |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1484 command-line options are parsed, the options that specify single |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1485 pass dumping (e.g. -fdump-tree-PASSNAME) cannot be used for new |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1486 passes. Therefore we currently can only enable dumping of |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1487 new passes when the 'dump-all' flags (e.g. -fdump-tree-all) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1488 are specified. While doing so, we also delete the pass_list_node |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1489 objects created during pass positioning. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1490 while (added_pass_nodes) |
0 | 1491 { |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1492 struct pass_list_node *next_node = added_pass_nodes->next; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1493 enum tree_dump_index tdi; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1494 register_one_dump_file (added_pass_nodes->pass); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1495 if (added_pass_nodes->pass->type == SIMPLE_IPA_PASS |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1496 || added_pass_nodes->pass->type == IPA_PASS) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1497 tdi = TDI_ipa_all; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1498 else if (added_pass_nodes->pass->type == GIMPLE_PASS) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1499 tdi = TDI_tree_all; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1500 else |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1501 tdi = TDI_rtl_all; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1502 /* Check if dump-all flag is specified. */ |
111 | 1503 if (dumps->get_dump_file_info (tdi)->pstate) |
1504 { | |
1505 dumps->get_dump_file_info (added_pass_nodes->pass->static_pass_number) | |
1506 ->pstate = dumps->get_dump_file_info (tdi)->pstate; | |
1507 dumps->get_dump_file_info (added_pass_nodes->pass->static_pass_number) | |
1508 ->pflags = dumps->get_dump_file_info (tdi)->pflags; | |
1509 } | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1510 XDELETE (added_pass_nodes); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1511 added_pass_nodes = next_node; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1512 } |
0 | 1513 } |
1514 | |
1515 /* Construct the pass tree. The sequencing of passes is driven by | |
1516 the cgraph routines: | |
1517 | |
111 | 1518 finalize_compilation_unit () |
0 | 1519 for each node N in the cgraph |
1520 cgraph_analyze_function (N) | |
1521 cgraph_lower_function (N) -> all_lowering_passes | |
1522 | |
111 | 1523 If we are optimizing, compile is then invoked: |
1524 | |
1525 compile () | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1526 ipa_passes () -> all_small_ipa_passes |
111 | 1527 -> Analysis of all_regular_ipa_passes |
1528 * possible LTO streaming at copmilation time * | |
1529 -> Execution of all_regular_ipa_passes | |
1530 * possible LTO streaming at link time * | |
1531 -> all_late_ipa_passes | |
1532 expand_all_functions () | |
0 | 1533 for each node N in the cgraph |
111 | 1534 expand_function (N) -> Transformation of all_regular_ipa_passes |
1535 -> all_passes | |
0 | 1536 */ |
1537 | |
111 | 1538 pass_manager::pass_manager (context *ctxt) |
1539 : all_passes (NULL), all_small_ipa_passes (NULL), all_lowering_passes (NULL), | |
1540 all_regular_ipa_passes (NULL), | |
1541 all_late_ipa_passes (NULL), passes_by_id (NULL), passes_by_id_size (0), | |
1542 m_ctxt (ctxt), m_name_to_pass_map (NULL) | |
0 | 1543 { |
111 | 1544 opt_pass **p; |
1545 | |
1546 /* Zero-initialize pass members. */ | |
1547 #define INSERT_PASSES_AFTER(PASS) | |
1548 #define PUSH_INSERT_PASSES_WITHIN(PASS) | |
1549 #define POP_INSERT_PASSES() | |
1550 #define NEXT_PASS(PASS, NUM) PASS ## _ ## NUM = NULL | |
1551 #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM) | |
1552 #define TERMINATE_PASS_LIST(PASS) | |
1553 #include "pass-instances.def" | |
1554 #undef INSERT_PASSES_AFTER | |
1555 #undef PUSH_INSERT_PASSES_WITHIN | |
1556 #undef POP_INSERT_PASSES | |
0 | 1557 #undef NEXT_PASS |
111 | 1558 #undef NEXT_PASS_WITH_ARG |
1559 #undef TERMINATE_PASS_LIST | |
1560 | |
1561 /* Initialize the pass_lists array. */ | |
1562 #define DEF_PASS_LIST(LIST) pass_lists[PASS_LIST_NO_##LIST] = &LIST; | |
1563 GCC_PASS_LISTS | |
1564 #undef DEF_PASS_LIST | |
1565 | |
1566 /* Build the tree of passes. */ | |
1567 | |
1568 #define INSERT_PASSES_AFTER(PASS) \ | |
1569 { \ | |
1570 opt_pass **p_start; \ | |
1571 p_start = p = &(PASS); | |
1572 | |
1573 #define TERMINATE_PASS_LIST(PASS) \ | |
1574 gcc_assert (p_start == &PASS); \ | |
1575 *p = NULL; \ | |
1576 } | |
1577 | |
1578 #define PUSH_INSERT_PASSES_WITHIN(PASS) \ | |
1579 { \ | |
1580 opt_pass **p = &(PASS ## _1)->sub; | |
1581 | |
1582 #define POP_INSERT_PASSES() \ | |
1583 } | |
1584 | |
1585 #define NEXT_PASS(PASS, NUM) \ | |
1586 do { \ | |
1587 gcc_assert (NULL == PASS ## _ ## NUM); \ | |
1588 if ((NUM) == 1) \ | |
1589 PASS ## _1 = make_##PASS (m_ctxt); \ | |
1590 else \ | |
1591 { \ | |
1592 gcc_assert (PASS ## _1); \ | |
1593 PASS ## _ ## NUM = PASS ## _1->clone (); \ | |
1594 } \ | |
1595 p = next_pass_1 (p, PASS ## _ ## NUM, PASS ## _1); \ | |
1596 } while (0) | |
1597 | |
1598 #define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) \ | |
1599 do { \ | |
1600 NEXT_PASS (PASS, NUM); \ | |
1601 PASS ## _ ## NUM->set_pass_param (0, ARG); \ | |
1602 } while (0) | |
1603 | |
1604 #include "pass-instances.def" | |
1605 | |
1606 #undef INSERT_PASSES_AFTER | |
1607 #undef PUSH_INSERT_PASSES_WITHIN | |
1608 #undef POP_INSERT_PASSES | |
1609 #undef NEXT_PASS | |
1610 #undef NEXT_PASS_WITH_ARG | |
1611 #undef TERMINATE_PASS_LIST | |
0 | 1612 |
1613 /* Register the passes with the tree dump code. */ | |
111 | 1614 register_dump_files (all_lowering_passes); |
1615 register_dump_files (all_small_ipa_passes); | |
1616 register_dump_files (all_regular_ipa_passes); | |
1617 register_dump_files (all_late_ipa_passes); | |
1618 register_dump_files (all_passes); | |
1619 } | |
1620 | |
1621 static void | |
1622 delete_pass_tree (opt_pass *pass) | |
1623 { | |
1624 while (pass) | |
0 | 1625 { |
111 | 1626 /* Recurse into child passes. */ |
1627 delete_pass_tree (pass->sub); | |
1628 | |
1629 opt_pass *next = pass->next; | |
1630 | |
1631 /* Delete this pass. */ | |
1632 delete pass; | |
1633 | |
1634 /* Iterate onto sibling passes. */ | |
1635 pass = next; | |
0 | 1636 } |
111 | 1637 } |
1638 | |
1639 pass_manager::~pass_manager () | |
1640 { | |
1641 XDELETEVEC (passes_by_id); | |
1642 | |
1643 /* Call delete_pass_tree on each of the pass_lists. */ | |
1644 #define DEF_PASS_LIST(LIST) \ | |
1645 delete_pass_tree (*pass_lists[PASS_LIST_NO_##LIST]); | |
1646 GCC_PASS_LISTS | |
1647 #undef DEF_PASS_LIST | |
1648 | |
0 | 1649 } |
1650 | |
1651 /* If we are in IPA mode (i.e., current_function_decl is NULL), call | |
1652 function CALLBACK for every function in the call graph. Otherwise, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1653 call CALLBACK on the current function. */ |
0 | 1654 |
1655 static void | |
111 | 1656 do_per_function (void (*callback) (function *, void *data), void *data) |
0 | 1657 { |
1658 if (current_function_decl) | |
111 | 1659 callback (cfun, data); |
0 | 1660 else |
1661 { | |
1662 struct cgraph_node *node; | |
111 | 1663 FOR_EACH_DEFINED_FUNCTION (node) |
1664 if (node->analyzed && (gimple_has_body_p (node->decl) && !in_lto_p) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1665 && (!node->clone_of || node->decl != node->clone_of->decl)) |
111 | 1666 callback (DECL_STRUCT_FUNCTION (node->decl), data); |
0 | 1667 } |
1668 } | |
1669 | |
1670 /* Because inlining might remove no-longer reachable nodes, we need to | |
1671 keep the array visible to garbage collector to avoid reading collected | |
1672 out nodes. */ | |
1673 static int nnodes; | |
111 | 1674 static GTY ((length ("nnodes"))) cgraph_node **order; |
1675 | |
1676 /* Hook called when NODE is removed and therefore should be | |
1677 excluded from order vector. DATA is an array of integers. | |
1678 DATA[0] holds max index it may be accessed by. For cgraph | |
1679 node DATA[node->uid + 1] holds index of this node in order | |
1680 vector. */ | |
1681 static void | |
1682 remove_cgraph_node_from_order (cgraph_node *node, void *data) | |
1683 { | |
1684 int *order_idx = (int *)data; | |
1685 | |
1686 if (node->uid >= order_idx[0]) | |
1687 return; | |
1688 | |
1689 int idx = order_idx[node->uid + 1]; | |
1690 if (idx >= 0 && idx < nnodes && order[idx] == node) | |
1691 order[idx] = NULL; | |
1692 } | |
0 | 1693 |
1694 /* If we are in IPA mode (i.e., current_function_decl is NULL), call | |
1695 function CALLBACK for every function in the call graph. Otherwise, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1696 call CALLBACK on the current function. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1697 This function is global so that plugins can use it. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1698 void |
111 | 1699 do_per_function_toporder (void (*callback) (function *, void *data), void *data) |
0 | 1700 { |
1701 int i; | |
1702 | |
1703 if (current_function_decl) | |
111 | 1704 callback (cfun, data); |
0 | 1705 else |
1706 { | |
111 | 1707 cgraph_node_hook_list *hook; |
1708 int *order_idx; | |
0 | 1709 gcc_assert (!order); |
111 | 1710 order = ggc_vec_alloc<cgraph_node *> (symtab->cgraph_count); |
1711 | |
1712 order_idx = XALLOCAVEC (int, symtab->cgraph_max_uid + 1); | |
1713 memset (order_idx + 1, -1, sizeof (int) * symtab->cgraph_max_uid); | |
1714 order_idx[0] = symtab->cgraph_max_uid; | |
1715 | |
1716 nnodes = ipa_reverse_postorder (order); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1717 for (i = nnodes - 1; i >= 0; i--) |
0 | 1718 { |
111 | 1719 order[i]->process = 1; |
1720 order_idx[order[i]->uid + 1] = i; | |
1721 } | |
1722 hook = symtab->add_cgraph_removal_hook (remove_cgraph_node_from_order, | |
1723 order_idx); | |
1724 for (i = nnodes - 1; i >= 0; i--) | |
1725 { | |
1726 /* Function could be inlined and removed as unreachable. */ | |
1727 if (!order[i]) | |
1728 continue; | |
1729 | |
0 | 1730 struct cgraph_node *node = order[i]; |
1731 | |
1732 /* Allow possibly removed nodes to be garbage collected. */ | |
1733 order[i] = NULL; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1734 node->process = 0; |
111 | 1735 if (node->has_gimple_body_p ()) |
0 | 1736 { |
111 | 1737 struct function *fn = DECL_STRUCT_FUNCTION (node->decl); |
1738 push_cfun (fn); | |
1739 callback (fn, data); | |
0 | 1740 pop_cfun (); |
1741 } | |
1742 } | |
111 | 1743 symtab->remove_cgraph_removal_hook (hook); |
0 | 1744 } |
1745 ggc_free (order); | |
1746 order = NULL; | |
1747 nnodes = 0; | |
1748 } | |
1749 | |
111 | 1750 /* Helper function to perform function body dump. */ |
1751 | |
1752 static void | |
1753 execute_function_dump (function *fn, void *data) | |
1754 { | |
1755 opt_pass *pass = (opt_pass *)data; | |
1756 | |
1757 if (dump_file) | |
1758 { | |
1759 push_cfun (fn); | |
1760 | |
1761 if (fn->curr_properties & PROP_trees) | |
1762 dump_function_to_file (fn->decl, dump_file, dump_flags); | |
1763 else | |
1764 print_rtl_with_bb (dump_file, get_insns (), dump_flags); | |
1765 | |
1766 /* Flush the file. If verification fails, we won't be able to | |
1767 close the file before aborting. */ | |
1768 fflush (dump_file); | |
1769 | |
1770 if ((fn->curr_properties & PROP_cfg) | |
1771 && (dump_flags & TDF_GRAPH)) | |
1772 { | |
1773 gcc::dump_manager *dumps = g->get_dumps (); | |
1774 struct dump_file_info *dfi | |
1775 = dumps->get_dump_file_info (pass->static_pass_number); | |
1776 if (!dfi->graph_dump_initialized) | |
1777 { | |
1778 clean_graph_dump_file (dump_file_name); | |
1779 dfi->graph_dump_initialized = true; | |
1780 } | |
1781 print_graph_cfg (dump_file_name, fn); | |
1782 } | |
1783 | |
1784 pop_cfun (); | |
1785 } | |
1786 } | |
1787 | |
1788 /* This function is called when an internal compiler error is encountered. | |
1789 Ensure that function dump is made available before compiler is aborted. */ | |
1790 | |
1791 void | |
1792 emergency_dump_function () | |
1793 { | |
1794 if (!current_pass) | |
1795 return; | |
1796 enum opt_pass_type pt = current_pass->type; | |
1797 fnotice (stderr, "during %s pass: %s\n", | |
1798 pt == GIMPLE_PASS ? "GIMPLE" : pt == RTL_PASS ? "RTL" : "IPA", | |
1799 current_pass->name); | |
1800 if (!dump_file || !cfun) | |
1801 return; | |
1802 fnotice (stderr, "dump file: %s\n", dump_file_name); | |
1803 fprintf (dump_file, "\n\n\nEMERGENCY DUMP:\n\n"); | |
1804 execute_function_dump (cfun, current_pass); | |
1805 } | |
1806 | |
1807 static struct profile_record *profile_record; | |
1808 | |
1809 /* Do profile consistency book-keeping for the pass with static number INDEX. | |
1810 If SUBPASS is zero, we run _before_ the pass, and if SUBPASS is one, then | |
1811 we run _after_ the pass. RUN is true if the pass really runs, or FALSE | |
1812 if we are only book-keeping on passes that may have selectively disabled | |
1813 themselves on a given function. */ | |
1814 static void | |
1815 check_profile_consistency (int index, int subpass, bool run) | |
1816 { | |
1817 pass_manager *passes = g->get_passes (); | |
1818 if (index == -1) | |
1819 return; | |
1820 if (!profile_record) | |
1821 profile_record = XCNEWVEC (struct profile_record, | |
1822 passes->passes_by_id_size); | |
1823 gcc_assert (index < passes->passes_by_id_size && index >= 0); | |
1824 gcc_assert (subpass < 2); | |
1825 profile_record[index].run |= run; | |
1826 account_profile_record (&profile_record[index], subpass); | |
1827 } | |
1828 | |
1829 /* Output profile consistency. */ | |
1830 | |
1831 void | |
1832 dump_profile_report (void) | |
1833 { | |
1834 g->get_passes ()->dump_profile_report (); | |
1835 } | |
1836 | |
1837 void | |
1838 pass_manager::dump_profile_report () const | |
1839 { | |
1840 int i, j; | |
1841 int last_freq_in = 0, last_count_in = 0, last_freq_out = 0, last_count_out = 0; | |
1842 gcov_type last_time = 0, last_size = 0; | |
1843 double rel_time_change, rel_size_change; | |
1844 int last_reported = 0; | |
1845 | |
1846 if (!profile_record) | |
1847 return; | |
1848 fprintf (stderr, "\nProfile consistency report:\n\n"); | |
1849 fprintf (stderr, "Pass name |mismatch in |mismated out|Overall\n"); | |
1850 fprintf (stderr, " |freq count |freq count |size time\n"); | |
1851 | |
1852 for (i = 0; i < passes_by_id_size; i++) | |
1853 for (j = 0 ; j < 2; j++) | |
1854 if (profile_record[i].run) | |
1855 { | |
1856 if (last_time) | |
1857 rel_time_change = (profile_record[i].time[j] | |
1858 - (double)last_time) * 100 / (double)last_time; | |
1859 else | |
1860 rel_time_change = 0; | |
1861 if (last_size) | |
1862 rel_size_change = (profile_record[i].size[j] | |
1863 - (double)last_size) * 100 / (double)last_size; | |
1864 else | |
1865 rel_size_change = 0; | |
1866 | |
1867 if (profile_record[i].num_mismatched_freq_in[j] != last_freq_in | |
1868 || profile_record[i].num_mismatched_freq_out[j] != last_freq_out | |
1869 || profile_record[i].num_mismatched_count_in[j] != last_count_in | |
1870 || profile_record[i].num_mismatched_count_out[j] != last_count_out | |
1871 || rel_time_change || rel_size_change) | |
1872 { | |
1873 last_reported = i; | |
1874 fprintf (stderr, "%-20s %s", | |
1875 passes_by_id [i]->name, | |
1876 j ? "(after TODO)" : " "); | |
1877 if (profile_record[i].num_mismatched_freq_in[j] != last_freq_in) | |
1878 fprintf (stderr, "| %+5i", | |
1879 profile_record[i].num_mismatched_freq_in[j] | |
1880 - last_freq_in); | |
1881 else | |
1882 fprintf (stderr, "| "); | |
1883 if (profile_record[i].num_mismatched_count_in[j] != last_count_in) | |
1884 fprintf (stderr, " %+5i", | |
1885 profile_record[i].num_mismatched_count_in[j] | |
1886 - last_count_in); | |
1887 else | |
1888 fprintf (stderr, " "); | |
1889 if (profile_record[i].num_mismatched_freq_out[j] != last_freq_out) | |
1890 fprintf (stderr, "| %+5i", | |
1891 profile_record[i].num_mismatched_freq_out[j] | |
1892 - last_freq_out); | |
1893 else | |
1894 fprintf (stderr, "| "); | |
1895 if (profile_record[i].num_mismatched_count_out[j] != last_count_out) | |
1896 fprintf (stderr, " %+5i", | |
1897 profile_record[i].num_mismatched_count_out[j] | |
1898 - last_count_out); | |
1899 else | |
1900 fprintf (stderr, " "); | |
1901 | |
1902 /* Size/time units change across gimple and RTL. */ | |
1903 if (i == pass_expand_1->static_pass_number) | |
1904 fprintf (stderr, "|----------"); | |
1905 else | |
1906 { | |
1907 if (rel_size_change) | |
1908 fprintf (stderr, "| %+8.4f%%", rel_size_change); | |
1909 else | |
1910 fprintf (stderr, "| "); | |
1911 if (rel_time_change) | |
1912 fprintf (stderr, " %+8.4f%%", rel_time_change); | |
1913 } | |
1914 fprintf (stderr, "\n"); | |
1915 last_freq_in = profile_record[i].num_mismatched_freq_in[j]; | |
1916 last_freq_out = profile_record[i].num_mismatched_freq_out[j]; | |
1917 last_count_in = profile_record[i].num_mismatched_count_in[j]; | |
1918 last_count_out = profile_record[i].num_mismatched_count_out[j]; | |
1919 } | |
1920 else if (j && last_reported != i) | |
1921 { | |
1922 last_reported = i; | |
1923 fprintf (stderr, "%-20s ------------| | |\n", | |
1924 passes_by_id [i]->name); | |
1925 } | |
1926 last_time = profile_record[i].time[j]; | |
1927 last_size = profile_record[i].size[j]; | |
1928 } | |
1929 } | |
1930 | |
0 | 1931 /* Perform all TODO actions that ought to be done on each function. */ |
1932 | |
1933 static void | |
111 | 1934 execute_function_todo (function *fn, void *data) |
0 | 1935 { |
111 | 1936 bool from_ipa_pass = (cfun == NULL); |
0 | 1937 unsigned int flags = (size_t)data; |
111 | 1938 flags &= ~fn->last_verified; |
0 | 1939 if (!flags) |
1940 return; | |
1941 | |
111 | 1942 push_cfun (fn); |
1943 | |
0 | 1944 /* Always cleanup the CFG before trying to update SSA. */ |
1945 if (flags & TODO_cleanup_cfg) | |
1946 { | |
111 | 1947 cleanup_tree_cfg (); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1948 |
0 | 1949 /* When cleanup_tree_cfg merges consecutive blocks, it may |
1950 perform some simplistic propagation when removing single | |
1951 valued PHI nodes. This propagation may, in turn, cause the | |
1952 SSA form to become out-of-date (see PR 22037). So, even | |
1953 if the parent pass had not scheduled an SSA update, we may | |
1954 still need to do one. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1955 if (!(flags & TODO_update_ssa_any) && need_ssa_update_p (cfun)) |
0 | 1956 flags |= TODO_update_ssa; |
1957 } | |
1958 | |
1959 if (flags & TODO_update_ssa_any) | |
1960 { | |
1961 unsigned update_flags = flags & TODO_update_ssa_any; | |
1962 update_ssa (update_flags); | |
1963 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1964 |
111 | 1965 if (flag_tree_pta && (flags & TODO_rebuild_alias)) |
1966 compute_may_aliases (); | |
1967 | |
1968 if (optimize && (flags & TODO_update_address_taken)) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
1969 execute_update_addresses_taken (); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1970 |
0 | 1971 if (flags & TODO_remove_unused_locals) |
1972 remove_unused_locals (); | |
1973 | |
1974 if (flags & TODO_rebuild_frequencies) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
1975 rebuild_frequencies (); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
1976 |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
1977 if (flags & TODO_rebuild_cgraph_edges) |
111 | 1978 cgraph_edge::rebuild_edges (); |
1979 | |
1980 gcc_assert (dom_info_state (fn, CDI_POST_DOMINATORS) == DOM_NONE); | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
1981 /* If we've seen errors do not bother running any verifiers. */ |
111 | 1982 if (flag_checking && !seen_error ()) |
1983 { | |
1984 dom_state pre_verify_state = dom_info_state (fn, CDI_DOMINATORS); | |
1985 dom_state pre_verify_pstate = dom_info_state (fn, CDI_POST_DOMINATORS); | |
1986 | |
1987 if (flags & TODO_verify_il) | |
1988 { | |
1989 if (cfun->curr_properties & PROP_trees) | |
1990 { | |
1991 if (cfun->curr_properties & PROP_cfg) | |
1992 /* IPA passes leave stmts to be fixed up, so make sure to | |
1993 not verify stmts really throw. */ | |
1994 verify_gimple_in_cfg (cfun, !from_ipa_pass); | |
1995 else | |
1996 verify_gimple_in_seq (gimple_body (cfun->decl)); | |
1997 } | |
1998 if (cfun->curr_properties & PROP_ssa) | |
1999 /* IPA passes leave stmts to be fixed up, so make sure to | |
2000 not verify SSA operands whose verifier will choke on that. */ | |
2001 verify_ssa (true, !from_ipa_pass); | |
2002 /* IPA passes leave basic-blocks unsplit, so make sure to | |
2003 not trip on that. */ | |
2004 if ((cfun->curr_properties & PROP_cfg) | |
2005 && !from_ipa_pass) | |
2006 verify_flow_info (); | |
2007 if (current_loops | |
2008 && ! loops_state_satisfies_p (LOOPS_NEED_FIXUP)) | |
2009 { | |
2010 verify_loop_structure (); | |
2011 if (loops_state_satisfies_p (LOOP_CLOSED_SSA)) | |
2012 verify_loop_closed_ssa (false); | |
2013 } | |
2014 if (cfun->curr_properties & PROP_rtl) | |
2015 verify_rtl_sharing (); | |
2016 } | |
2017 | |
2018 /* Make sure verifiers don't change dominator state. */ | |
2019 gcc_assert (dom_info_state (fn, CDI_DOMINATORS) == pre_verify_state); | |
2020 gcc_assert (dom_info_state (fn, CDI_POST_DOMINATORS) == pre_verify_pstate); | |
2021 } | |
2022 | |
2023 fn->last_verified = flags & TODO_verify_all; | |
2024 | |
2025 pop_cfun (); | |
2026 | |
2027 /* For IPA passes make sure to release dominator info, it can be | |
2028 computed by non-verifying TODOs. */ | |
2029 if (from_ipa_pass) | |
2030 { | |
2031 free_dominance_info (fn, CDI_DOMINATORS); | |
2032 free_dominance_info (fn, CDI_POST_DOMINATORS); | |
2033 } | |
0 | 2034 } |
2035 | |
2036 /* Perform all TODO actions. */ | |
2037 static void | |
2038 execute_todo (unsigned int flags) | |
2039 { | |
111 | 2040 if (flag_checking |
2041 && cfun | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2042 && need_ssa_update_p (cfun)) |
0 | 2043 gcc_assert (flags & TODO_update_ssa_any); |
2044 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2045 statistics_fini_pass (); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2046 |
111 | 2047 if (flags) |
2048 do_per_function (execute_function_todo, (void *)(size_t) flags); | |
2049 | |
2050 /* At this point we should not have any unreachable code in the | |
2051 CFG, so it is safe to flush the pending freelist for SSA_NAMES. */ | |
2052 if (cfun && cfun->gimple_df) | |
2053 flush_ssaname_freelist (); | |
0 | 2054 |
2055 /* Always remove functions just as before inlining: IPA passes might be | |
2056 interested to see bodies of extern inline functions that are not inlined | |
2057 to analyze side effects. The full removal is done just at the end | |
2058 of IPA pass queue. */ | |
2059 if (flags & TODO_remove_functions) | |
2060 { | |
2061 gcc_assert (!cfun); | |
111 | 2062 symtab->remove_unreachable_nodes (dump_file); |
0 | 2063 } |
2064 | |
111 | 2065 if ((flags & TODO_dump_symtab) && dump_file && !current_function_decl) |
0 | 2066 { |
2067 gcc_assert (!cfun); | |
111 | 2068 symtab->dump (dump_file); |
0 | 2069 /* Flush the file. If verification fails, we won't be able to |
2070 close the file before aborting. */ | |
2071 fflush (dump_file); | |
2072 } | |
2073 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2074 /* Now that the dumping has been done, we can get rid of the optional |
0 | 2075 df problems. */ |
2076 if (flags & TODO_df_finish) | |
2077 df_finish_pass ((flags & TODO_df_verify) != 0); | |
2078 } | |
2079 | |
2080 /* Verify invariants that should hold between passes. This is a place | |
2081 to put simple sanity checks. */ | |
2082 | |
2083 static void | |
2084 verify_interpass_invariants (void) | |
2085 { | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2086 gcc_checking_assert (!fold_deferring_overflow_warnings_p ()); |
0 | 2087 } |
2088 | |
2089 /* Clear the last verified flag. */ | |
2090 | |
2091 static void | |
111 | 2092 clear_last_verified (function *fn, void *data ATTRIBUTE_UNUSED) |
0 | 2093 { |
111 | 2094 fn->last_verified = 0; |
0 | 2095 } |
2096 | |
2097 /* Helper function. Verify that the properties has been turn into the | |
2098 properties expected by the pass. */ | |
2099 | |
2100 static void | |
111 | 2101 verify_curr_properties (function *fn, void *data) |
0 | 2102 { |
2103 unsigned int props = (size_t)data; | |
111 | 2104 gcc_assert ((fn->curr_properties & props) == props); |
0 | 2105 } |
111 | 2106 |
2107 /* Release dump file name if set. */ | |
2108 | |
2109 static void | |
2110 release_dump_file_name (void) | |
2111 { | |
2112 if (dump_file_name) | |
2113 { | |
2114 free (CONST_CAST (char *, dump_file_name)); | |
2115 dump_file_name = NULL; | |
2116 } | |
2117 } | |
0 | 2118 |
2119 /* Initialize pass dump file. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2120 /* This is non-static so that the plugins can use it. */ |
0 | 2121 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2122 bool |
111 | 2123 pass_init_dump_file (opt_pass *pass) |
0 | 2124 { |
2125 /* If a dump file name is present, open it if enabled. */ | |
2126 if (pass->static_pass_number != -1) | |
2127 { | |
111 | 2128 timevar_push (TV_DUMP); |
2129 gcc::dump_manager *dumps = g->get_dumps (); | |
2130 bool initializing_dump = | |
2131 !dumps->dump_initialized_p (pass->static_pass_number); | |
2132 release_dump_file_name (); | |
2133 dump_file_name = dumps->get_dump_file_name (pass->static_pass_number); | |
2134 dumps->dump_start (pass->static_pass_number, &dump_flags); | |
2135 if (dump_file && current_function_decl && ! (dump_flags & TDF_GIMPLE)) | |
2136 dump_function_header (dump_file, current_function_decl, dump_flags); | |
2137 if (initializing_dump | |
2138 && dump_file && (dump_flags & TDF_GRAPH) | |
2139 && cfun && (cfun->curr_properties & PROP_cfg)) | |
0 | 2140 { |
111 | 2141 clean_graph_dump_file (dump_file_name); |
2142 struct dump_file_info *dfi | |
2143 = dumps->get_dump_file_info (pass->static_pass_number); | |
2144 dfi->graph_dump_initialized = true; | |
0 | 2145 } |
111 | 2146 timevar_pop (TV_DUMP); |
0 | 2147 return initializing_dump; |
2148 } | |
2149 else | |
2150 return false; | |
2151 } | |
2152 | |
2153 /* Flush PASS dump file. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2154 /* This is non-static so that plugins can use it. */ |
0 | 2155 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2156 void |
111 | 2157 pass_fini_dump_file (opt_pass *pass) |
0 | 2158 { |
111 | 2159 timevar_push (TV_DUMP); |
2160 | |
0 | 2161 /* Flush and close dump file. */ |
111 | 2162 release_dump_file_name (); |
2163 | |
2164 g->get_dumps ()->dump_finish (pass->static_pass_number); | |
2165 timevar_pop (TV_DUMP); | |
0 | 2166 } |
2167 | |
2168 /* After executing the pass, apply expected changes to the function | |
2169 properties. */ | |
2170 | |
2171 static void | |
111 | 2172 update_properties_after_pass (function *fn, void *data) |
0 | 2173 { |
111 | 2174 opt_pass *pass = (opt_pass *) data; |
2175 fn->curr_properties = (fn->curr_properties | pass->properties_provided) | |
2176 & ~pass->properties_destroyed; | |
0 | 2177 } |
2178 | |
2179 /* Execute summary generation for all of the passes in IPA_PASS. */ | |
2180 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2181 void |
111 | 2182 execute_ipa_summary_passes (ipa_opt_pass_d *ipa_pass) |
0 | 2183 { |
2184 while (ipa_pass) | |
2185 { | |
111 | 2186 opt_pass *pass = ipa_pass; |
0 | 2187 |
2188 /* Execute all of the IPA_PASSes in the list. */ | |
111 | 2189 if (ipa_pass->type == IPA_PASS |
2190 && pass->gate (cfun) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2191 && ipa_pass->generate_summary) |
0 | 2192 { |
2193 pass_init_dump_file (pass); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2194 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2195 /* If a timevar is present, start it. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2196 if (pass->tv_id) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2197 timevar_push (pass->tv_id); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2198 |
111 | 2199 current_pass = pass; |
0 | 2200 ipa_pass->generate_summary (); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2201 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2202 /* Stop timevar. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2203 if (pass->tv_id) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2204 timevar_pop (pass->tv_id); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2205 |
0 | 2206 pass_fini_dump_file (pass); |
2207 } | |
111 | 2208 ipa_pass = (ipa_opt_pass_d *)ipa_pass->next; |
0 | 2209 } |
2210 } | |
2211 | |
2212 /* Execute IPA_PASS function transform on NODE. */ | |
2213 | |
2214 static void | |
2215 execute_one_ipa_transform_pass (struct cgraph_node *node, | |
111 | 2216 ipa_opt_pass_d *ipa_pass) |
0 | 2217 { |
111 | 2218 opt_pass *pass = ipa_pass; |
0 | 2219 unsigned int todo_after = 0; |
2220 | |
2221 current_pass = pass; | |
2222 if (!ipa_pass->function_transform) | |
2223 return; | |
2224 | |
2225 /* Note that the folders should only create gimple expressions. | |
2226 This is a hack until the new folder is ready. */ | |
2227 in_gimple_form = (cfun && (cfun->curr_properties & PROP_trees)) != 0; | |
2228 | |
2229 pass_init_dump_file (pass); | |
2230 | |
2231 /* If a timevar is present, start it. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2232 if (pass->tv_id != TV_NONE) |
0 | 2233 timevar_push (pass->tv_id); |
2234 | |
111 | 2235 /* Run pre-pass verification. */ |
2236 execute_todo (ipa_pass->function_transform_todo_flags_start); | |
2237 | |
0 | 2238 /* Do it! */ |
2239 todo_after = ipa_pass->function_transform (node); | |
2240 | |
111 | 2241 if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) |
2242 check_profile_consistency (pass->static_pass_number, 0, true); | |
2243 | |
2244 /* Run post-pass cleanup and verification. */ | |
2245 execute_todo (todo_after); | |
2246 verify_interpass_invariants (); | |
2247 if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) | |
2248 check_profile_consistency (pass->static_pass_number, 1, true); | |
2249 | |
0 | 2250 /* Stop timevar. */ |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2251 if (pass->tv_id != TV_NONE) |
0 | 2252 timevar_pop (pass->tv_id); |
2253 | |
111 | 2254 if (dump_file) |
2255 do_per_function (execute_function_dump, pass); | |
0 | 2256 pass_fini_dump_file (pass); |
2257 | |
2258 current_pass = NULL; | |
111 | 2259 redirect_edge_var_map_empty (); |
2260 | |
2261 /* Signal this is a suitable GC collection point. */ | |
2262 if (!(todo_after & TODO_do_not_ggc_collect)) | |
2263 ggc_collect (); | |
0 | 2264 } |
2265 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2266 /* For the current function, execute all ipa transforms. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2267 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2268 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2269 execute_all_ipa_transforms (void) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2270 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2271 struct cgraph_node *node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2272 if (!cfun) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2273 return; |
111 | 2274 node = cgraph_node::get (current_function_decl); |
2275 | |
2276 if (node->ipa_transforms_to_apply.exists ()) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2277 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2278 unsigned int i; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2279 |
111 | 2280 for (i = 0; i < node->ipa_transforms_to_apply.length (); i++) |
2281 execute_one_ipa_transform_pass (node, node->ipa_transforms_to_apply[i]); | |
2282 node->ipa_transforms_to_apply.release (); | |
2283 } | |
2284 } | |
2285 | |
2286 /* Check if PASS is explicitly disabled or enabled and return | |
2287 the gate status. FUNC is the function to be processed, and | |
2288 GATE_STATUS is the gate status determined by pass manager by | |
2289 default. */ | |
2290 | |
2291 static bool | |
2292 override_gate_status (opt_pass *pass, tree func, bool gate_status) | |
2293 { | |
2294 bool explicitly_enabled = false; | |
2295 bool explicitly_disabled = false; | |
2296 | |
2297 explicitly_enabled | |
2298 = is_pass_explicitly_enabled_or_disabled (pass, func, | |
2299 enabled_pass_uid_range_tab); | |
2300 explicitly_disabled | |
2301 = is_pass_explicitly_enabled_or_disabled (pass, func, | |
2302 disabled_pass_uid_range_tab); | |
2303 | |
2304 gate_status = !explicitly_disabled && (gate_status || explicitly_enabled); | |
2305 | |
2306 return gate_status; | |
2307 } | |
2308 | |
2309 /* Determine if PASS_NAME matches CRITERION. | |
2310 Not a pure predicate, since it can update CRITERION, to support | |
2311 matching the Nth invocation of a pass. | |
2312 Subroutine of should_skip_pass_p. */ | |
2313 | |
2314 static bool | |
2315 determine_pass_name_match (const char *pass_name, char *criterion) | |
2316 { | |
2317 size_t namelen = strlen (pass_name); | |
2318 if (! strncmp (pass_name, criterion, namelen)) | |
2319 { | |
2320 /* The following supports starting with the Nth invocation | |
2321 of a pass (where N does not necessarily is equal to the | |
2322 dump file suffix). */ | |
2323 if (criterion[namelen] == '\0' | |
2324 || (criterion[namelen] == '1' | |
2325 && criterion[namelen + 1] == '\0')) | |
2326 return true; | |
2327 else | |
2328 { | |
2329 if (criterion[namelen + 1] == '\0') | |
2330 --criterion[namelen]; | |
2331 return false; | |
2332 } | |
2333 } | |
2334 else | |
2335 return false; | |
2336 } | |
2337 | |
2338 /* For skipping passes until "startwith" pass. | |
2339 Return true iff PASS should be skipped. | |
2340 Clear cfun->pass_startwith when encountering the "startwith" pass, | |
2341 so that all subsequent passes are run. */ | |
2342 | |
2343 static bool | |
2344 should_skip_pass_p (opt_pass *pass) | |
2345 { | |
2346 if (!cfun) | |
2347 return false; | |
2348 if (!cfun->pass_startwith) | |
2349 return false; | |
2350 | |
2351 /* For __GIMPLE functions, we have to at least start when we leave | |
2352 SSA. Hence, we need to detect the "expand" pass, and stop skipping | |
2353 when we encounter it. A cheap way to identify "expand" is it to | |
2354 detect the destruction of PROP_ssa. | |
2355 For __RTL functions, we invoke "rest_of_compilation" directly, which | |
2356 is after "expand", and hence we don't reach this conditional. */ | |
2357 if (pass->properties_destroyed & PROP_ssa) | |
2358 { | |
2359 if (!quiet_flag) | |
2360 fprintf (stderr, "starting anyway when leaving SSA: %s\n", pass->name); | |
2361 cfun->pass_startwith = NULL; | |
2362 return false; | |
2363 } | |
2364 | |
2365 if (determine_pass_name_match (pass->name, cfun->pass_startwith)) | |
2366 { | |
2367 if (!quiet_flag) | |
2368 fprintf (stderr, "found starting pass: %s\n", pass->name); | |
2369 cfun->pass_startwith = NULL; | |
2370 return false; | |
2371 } | |
2372 | |
2373 /* For GIMPLE passes, run any property provider (but continue skipping | |
2374 afterwards). | |
2375 We don't want to force running RTL passes that are property providers: | |
2376 "expand" is covered above, and the only pass other than "expand" that | |
2377 provides a property is "into_cfglayout" (PROP_cfglayout), which does | |
2378 too much for a dumped __RTL function. */ | |
2379 if (pass->type == GIMPLE_PASS | |
2380 && pass->properties_provided != 0) | |
2381 return false; | |
2382 | |
2383 /* Don't skip df init; later RTL passes need it. */ | |
2384 if (strstr (pass->name, "dfinit") != NULL) | |
2385 return false; | |
2386 | |
2387 if (!quiet_flag) | |
2388 fprintf (stderr, "skipping pass: %s\n", pass->name); | |
2389 | |
2390 /* If we get here, then we have a "startwith" that we haven't seen yet; | |
2391 skip the pass. */ | |
2392 return true; | |
2393 } | |
2394 | |
2395 /* Skip the given pass, for handling passes before "startwith" | |
2396 in __GIMPLE and__RTL-marked functions. | |
2397 In theory, this ought to be a no-op, but some of the RTL passes | |
2398 need additional processing here. */ | |
2399 | |
2400 static void | |
2401 skip_pass (opt_pass *pass) | |
2402 { | |
2403 /* Pass "reload" sets the global "reload_completed", and many | |
2404 things depend on this (e.g. instructions in .md files). */ | |
2405 if (strcmp (pass->name, "reload") == 0) | |
2406 reload_completed = 1; | |
2407 | |
2408 /* The INSN_ADDRESSES vec is normally set up by | |
2409 shorten_branches; set it up for the benefit of passes that | |
2410 run after this. */ | |
2411 if (strcmp (pass->name, "shorten") == 0) | |
2412 INSN_ADDRESSES_ALLOC (get_max_uid ()); | |
2413 | |
2414 /* Update the cfg hooks as appropriate. */ | |
2415 if (strcmp (pass->name, "into_cfglayout") == 0) | |
2416 { | |
2417 cfg_layout_rtl_register_cfg_hooks (); | |
2418 cfun->curr_properties |= PROP_cfglayout; | |
2419 } | |
2420 if (strcmp (pass->name, "outof_cfglayout") == 0) | |
2421 { | |
2422 rtl_register_cfg_hooks (); | |
2423 cfun->curr_properties &= ~PROP_cfglayout; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2424 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2425 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2426 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2427 /* Execute PASS. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2428 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2429 bool |
111 | 2430 execute_one_pass (opt_pass *pass) |
0 | 2431 { |
2432 unsigned int todo_after = 0; | |
2433 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2434 bool gate_status; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2435 |
0 | 2436 /* IPA passes are executed on whole program, so cfun should be NULL. |
2437 Other passes need function context set. */ | |
2438 if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) | |
2439 gcc_assert (!cfun && !current_function_decl); | |
2440 else | |
2441 gcc_assert (cfun && current_function_decl); | |
2442 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2443 current_pass = pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2444 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2445 /* Check whether gate check should be avoided. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2446 User controls the value of the gate through the parameter "gate_status". */ |
111 | 2447 gate_status = pass->gate (cfun); |
2448 gate_status = override_gate_status (pass, current_function_decl, gate_status); | |
0 | 2449 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2450 /* Override gate with plugin. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2451 invoke_plugin_callbacks (PLUGIN_OVERRIDE_GATE, &gate_status); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2452 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2453 if (!gate_status) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2454 { |
111 | 2455 /* Run so passes selectively disabling themselves on a given function |
2456 are not miscounted. */ | |
2457 if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) | |
2458 { | |
2459 check_profile_consistency (pass->static_pass_number, 0, false); | |
2460 check_profile_consistency (pass->static_pass_number, 1, false); | |
2461 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2462 current_pass = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2463 return false; |
0 | 2464 } |
2465 | |
111 | 2466 if (should_skip_pass_p (pass)) |
2467 { | |
2468 skip_pass (pass); | |
2469 return true; | |
2470 } | |
2471 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2472 /* Pass execution event trigger: useful to identify passes being |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2473 executed. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2474 invoke_plugin_callbacks (PLUGIN_PASS_EXECUTION, pass); |
0 | 2475 |
2476 if (!quiet_flag && !cfun) | |
2477 fprintf (stderr, " <%s>", pass->name ? pass->name : ""); | |
2478 | |
2479 /* Note that the folders should only create gimple expressions. | |
2480 This is a hack until the new folder is ready. */ | |
2481 in_gimple_form = (cfun && (cfun->curr_properties & PROP_trees)) != 0; | |
2482 | |
111 | 2483 pass_init_dump_file (pass); |
0 | 2484 |
2485 /* If a timevar is present, start it. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2486 if (pass->tv_id != TV_NONE) |
0 | 2487 timevar_push (pass->tv_id); |
2488 | |
111 | 2489 /* Run pre-pass verification. */ |
2490 execute_todo (pass->todo_flags_start); | |
2491 | |
2492 if (flag_checking) | |
2493 do_per_function (verify_curr_properties, | |
2494 (void *)(size_t)pass->properties_required); | |
2495 | |
0 | 2496 /* Do it! */ |
111 | 2497 todo_after = pass->execute (cfun); |
2498 | |
2499 if (todo_after & TODO_discard_function) | |
0 | 2500 { |
111 | 2501 /* Stop timevar. */ |
2502 if (pass->tv_id != TV_NONE) | |
2503 timevar_pop (pass->tv_id); | |
2504 | |
2505 pass_fini_dump_file (pass); | |
2506 | |
2507 gcc_assert (cfun); | |
2508 /* As cgraph_node::release_body expects release dominators info, | |
2509 we have to release it. */ | |
2510 if (dom_info_available_p (CDI_DOMINATORS)) | |
2511 free_dominance_info (CDI_DOMINATORS); | |
2512 | |
2513 if (dom_info_available_p (CDI_POST_DOMINATORS)) | |
2514 free_dominance_info (CDI_POST_DOMINATORS); | |
2515 | |
2516 tree fn = cfun->decl; | |
2517 pop_cfun (); | |
2518 gcc_assert (!cfun); | |
2519 cgraph_node::get (fn)->release_body (); | |
2520 | |
2521 current_pass = NULL; | |
2522 redirect_edge_var_map_empty (); | |
2523 | |
2524 ggc_collect (); | |
2525 | |
2526 return true; | |
0 | 2527 } |
2528 | |
111 | 2529 do_per_function (clear_last_verified, NULL); |
2530 | |
2531 do_per_function (update_properties_after_pass, pass); | |
2532 | |
2533 if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) | |
2534 check_profile_consistency (pass->static_pass_number, 0, true); | |
2535 | |
2536 /* Run post-pass cleanup and verification. */ | |
2537 execute_todo (todo_after | pass->todo_flags_finish | TODO_verify_il); | |
2538 if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) | |
2539 check_profile_consistency (pass->static_pass_number, 1, true); | |
2540 | |
2541 verify_interpass_invariants (); | |
2542 | |
0 | 2543 /* Stop timevar. */ |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2544 if (pass->tv_id != TV_NONE) |
0 | 2545 timevar_pop (pass->tv_id); |
2546 | |
111 | 2547 if (pass->type == IPA_PASS |
2548 && ((ipa_opt_pass_d *)pass)->function_transform) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2549 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2550 struct cgraph_node *node; |
111 | 2551 FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) |
2552 node->ipa_transforms_to_apply.safe_push ((ipa_opt_pass_d *)pass); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2553 } |
111 | 2554 else if (dump_file) |
2555 do_per_function (execute_function_dump, pass); | |
0 | 2556 |
2557 if (!current_function_decl) | |
111 | 2558 symtab->process_new_functions (); |
0 | 2559 |
2560 pass_fini_dump_file (pass); | |
2561 | |
2562 if (pass->type != SIMPLE_IPA_PASS && pass->type != IPA_PASS) | |
2563 gcc_assert (!(cfun->curr_properties & PROP_trees) | |
2564 || pass->type != RTL_PASS); | |
2565 | |
2566 current_pass = NULL; | |
111 | 2567 redirect_edge_var_map_empty (); |
2568 | |
2569 /* Signal this is a suitable GC collection point. */ | |
2570 if (!((todo_after | pass->todo_flags_finish) & TODO_do_not_ggc_collect)) | |
2571 ggc_collect (); | |
0 | 2572 |
2573 return true; | |
2574 } | |
2575 | |
111 | 2576 static void |
2577 execute_pass_list_1 (opt_pass *pass) | |
0 | 2578 { |
2579 do | |
2580 { | |
2581 gcc_assert (pass->type == GIMPLE_PASS | |
2582 || pass->type == RTL_PASS); | |
111 | 2583 |
2584 if (cfun == NULL) | |
2585 return; | |
0 | 2586 if (execute_one_pass (pass) && pass->sub) |
111 | 2587 execute_pass_list_1 (pass->sub); |
0 | 2588 pass = pass->next; |
2589 } | |
2590 while (pass); | |
2591 } | |
2592 | |
111 | 2593 void |
2594 execute_pass_list (function *fn, opt_pass *pass) | |
2595 { | |
2596 gcc_assert (fn == cfun); | |
2597 execute_pass_list_1 (pass); | |
2598 if (cfun && fn->cfg) | |
2599 { | |
2600 free_dominance_info (CDI_DOMINATORS); | |
2601 free_dominance_info (CDI_POST_DOMINATORS); | |
2602 } | |
2603 } | |
2604 | |
2605 /* Write out all LTO data. */ | |
2606 static void | |
2607 write_lto (void) | |
2608 { | |
2609 timevar_push (TV_IPA_LTO_GIMPLE_OUT); | |
2610 lto_output (); | |
2611 timevar_pop (TV_IPA_LTO_GIMPLE_OUT); | |
2612 timevar_push (TV_IPA_LTO_DECL_OUT); | |
2613 produce_asm_for_decls (); | |
2614 timevar_pop (TV_IPA_LTO_DECL_OUT); | |
2615 } | |
2616 | |
0 | 2617 /* Same as execute_pass_list but assume that subpasses of IPA passes |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2618 are local passes. If SET is not NULL, write out summaries of only |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2619 those node in SET. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2620 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2621 static void |
111 | 2622 ipa_write_summaries_2 (opt_pass *pass, struct lto_out_decl_state *state) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2623 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2624 while (pass) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2625 { |
111 | 2626 ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *)pass; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2627 gcc_assert (!current_function_decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2628 gcc_assert (!cfun); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2629 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2630 if (pass->type == IPA_PASS |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2631 && ipa_pass->write_summary |
111 | 2632 && pass->gate (cfun)) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2633 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2634 /* If a timevar is present, start it. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2635 if (pass->tv_id) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2636 timevar_push (pass->tv_id); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2637 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2638 pass_init_dump_file (pass); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2639 |
111 | 2640 current_pass = pass; |
2641 ipa_pass->write_summary (); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2642 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2643 pass_fini_dump_file (pass); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2644 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2645 /* If a timevar is present, start it. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2646 if (pass->tv_id) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2647 timevar_pop (pass->tv_id); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2648 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2649 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2650 if (pass->sub && pass->sub->type != GIMPLE_PASS) |
111 | 2651 ipa_write_summaries_2 (pass->sub, state); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2652 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2653 pass = pass->next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2654 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2655 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2656 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2657 /* Helper function of ipa_write_summaries. Creates and destroys the |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2658 decl state and calls ipa_write_summaries_2 for all passes that have |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2659 summaries. SET is the set of nodes to be written. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2660 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2661 static void |
111 | 2662 ipa_write_summaries_1 (lto_symtab_encoder_t encoder) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2663 { |
111 | 2664 pass_manager *passes = g->get_passes (); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2665 struct lto_out_decl_state *state = lto_new_out_decl_state (); |
111 | 2666 state->symtab_node_encoder = encoder; |
2667 | |
2668 lto_output_init_mode_table (); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2669 lto_push_out_decl_state (state); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2670 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2671 gcc_assert (!flag_wpa); |
111 | 2672 ipa_write_summaries_2 (passes->all_regular_ipa_passes, state); |
2673 | |
2674 write_lto (); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2675 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2676 gcc_assert (lto_get_out_decl_state () == state); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2677 lto_pop_out_decl_state (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2678 lto_delete_out_decl_state (state); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2679 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2680 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2681 /* Write out summaries for all the nodes in the callgraph. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2682 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2683 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2684 ipa_write_summaries (void) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2685 { |
111 | 2686 lto_symtab_encoder_t encoder; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2687 int i, order_pos; |
111 | 2688 varpool_node *vnode; |
2689 struct cgraph_node *node; | |
2690 struct cgraph_node **order; | |
2691 | |
2692 if ((!flag_generate_lto && !flag_generate_offload) || seen_error ()) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2693 return; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2694 |
111 | 2695 select_what_to_stream (); |
2696 | |
2697 encoder = lto_symtab_encoder_new (false); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2698 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2699 /* Create the callgraph set in the same order used in |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2700 cgraph_expand_all_functions. This mostly facilitates debugging, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2701 since it causes the gimple file to be processed in the same order |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2702 as the source code. */ |
111 | 2703 order = XCNEWVEC (struct cgraph_node *, symtab->cgraph_count); |
2704 order_pos = ipa_reverse_postorder (order); | |
2705 gcc_assert (order_pos == symtab->cgraph_count); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2706 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2707 for (i = order_pos - 1; i >= 0; i--) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2708 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2709 struct cgraph_node *node = order[i]; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2710 |
111 | 2711 if (node->has_gimple_body_p ()) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2712 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2713 /* When streaming out references to statements as part of some IPA |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2714 pass summary, the statements need to have uids assigned and the |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2715 following does that for all the IPA passes here. Naturally, this |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2716 ordering then matches the one IPA-passes get in their stmt_fixup |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2717 hooks. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2718 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2719 push_cfun (DECL_STRUCT_FUNCTION (node->decl)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2720 renumber_gimple_stmt_uids (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2721 pop_cfun (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2722 } |
111 | 2723 if (node->definition && node->need_lto_streaming) |
2724 lto_set_symtab_encoder_in_partition (encoder, node); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2725 } |
111 | 2726 |
2727 FOR_EACH_DEFINED_FUNCTION (node) | |
2728 if (node->alias && node->need_lto_streaming) | |
2729 lto_set_symtab_encoder_in_partition (encoder, node); | |
2730 FOR_EACH_DEFINED_VARIABLE (vnode) | |
2731 if (vnode->need_lto_streaming) | |
2732 lto_set_symtab_encoder_in_partition (encoder, vnode); | |
2733 | |
2734 ipa_write_summaries_1 (compute_ltrans_boundary (encoder)); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2735 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2736 free (order); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2737 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2738 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2739 /* Same as execute_pass_list but assume that subpasses of IPA passes |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2740 are local passes. If SET is not NULL, write out optimization summaries of |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2741 only those node in SET. */ |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2742 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2743 static void |
111 | 2744 ipa_write_optimization_summaries_1 (opt_pass *pass, |
2745 struct lto_out_decl_state *state) | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2746 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2747 while (pass) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2748 { |
111 | 2749 ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *)pass; |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2750 gcc_assert (!current_function_decl); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2751 gcc_assert (!cfun); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2752 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2753 if (pass->type == IPA_PASS |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2754 && ipa_pass->write_optimization_summary |
111 | 2755 && pass->gate (cfun)) |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2756 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2757 /* If a timevar is present, start it. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2758 if (pass->tv_id) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2759 timevar_push (pass->tv_id); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2760 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2761 pass_init_dump_file (pass); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2762 |
111 | 2763 current_pass = pass; |
2764 ipa_pass->write_optimization_summary (); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2765 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2766 pass_fini_dump_file (pass); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2767 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2768 /* If a timevar is present, start it. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2769 if (pass->tv_id) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2770 timevar_pop (pass->tv_id); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2771 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2772 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2773 if (pass->sub && pass->sub->type != GIMPLE_PASS) |
111 | 2774 ipa_write_optimization_summaries_1 (pass->sub, state); |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2775 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2776 pass = pass->next; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2777 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2778 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2779 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2780 /* Write all the optimization summaries for the cgraph nodes in SET. If SET is |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2781 NULL, write out all summaries of all nodes. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2782 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2783 void |
111 | 2784 ipa_write_optimization_summaries (lto_symtab_encoder_t encoder) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2785 { |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2786 struct lto_out_decl_state *state = lto_new_out_decl_state (); |
111 | 2787 lto_symtab_encoder_iterator lsei; |
2788 state->symtab_node_encoder = encoder; | |
2789 | |
2790 lto_output_init_mode_table (); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2791 lto_push_out_decl_state (state); |
111 | 2792 for (lsei = lsei_start_function_in_partition (encoder); |
2793 !lsei_end_p (lsei); lsei_next_function_in_partition (&lsei)) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2794 { |
111 | 2795 struct cgraph_node *node = lsei_cgraph_node (lsei); |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2796 /* When streaming out references to statements as part of some IPA |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2797 pass summary, the statements need to have uids assigned. |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2798 |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2799 For functions newly born at WPA stage we need to initialize |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2800 the uids here. */ |
111 | 2801 if (node->definition |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2802 && gimple_has_body_p (node->decl)) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2803 { |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2804 push_cfun (DECL_STRUCT_FUNCTION (node->decl)); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2805 renumber_gimple_stmt_uids (); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2806 pop_cfun (); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2807 } |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2808 } |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2809 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2810 gcc_assert (flag_wpa); |
111 | 2811 pass_manager *passes = g->get_passes (); |
2812 ipa_write_optimization_summaries_1 (passes->all_regular_ipa_passes, state); | |
2813 | |
2814 write_lto (); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2815 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2816 gcc_assert (lto_get_out_decl_state () == state); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2817 lto_pop_out_decl_state (); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2818 lto_delete_out_decl_state (state); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2819 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2820 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2821 /* Same as execute_pass_list but assume that subpasses of IPA passes |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2822 are local passes. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2823 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2824 static void |
111 | 2825 ipa_read_summaries_1 (opt_pass *pass) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2826 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2827 while (pass) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2828 { |
111 | 2829 ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2830 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2831 gcc_assert (!current_function_decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2832 gcc_assert (!cfun); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2833 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2834 |
111 | 2835 if (pass->gate (cfun)) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2836 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2837 if (pass->type == IPA_PASS && ipa_pass->read_summary) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2838 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2839 /* If a timevar is present, start it. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2840 if (pass->tv_id) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2841 timevar_push (pass->tv_id); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2842 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2843 pass_init_dump_file (pass); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2844 |
111 | 2845 current_pass = pass; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2846 ipa_pass->read_summary (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2847 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2848 pass_fini_dump_file (pass); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2849 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2850 /* Stop timevar. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2851 if (pass->tv_id) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2852 timevar_pop (pass->tv_id); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2853 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2854 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2855 if (pass->sub && pass->sub->type != GIMPLE_PASS) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2856 ipa_read_summaries_1 (pass->sub); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2857 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2858 pass = pass->next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2859 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2860 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2861 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2862 |
111 | 2863 /* Read all the summaries for all_regular_ipa_passes. */ |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2864 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2865 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2866 ipa_read_summaries (void) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2867 { |
111 | 2868 pass_manager *passes = g->get_passes (); |
2869 ipa_read_summaries_1 (passes->all_regular_ipa_passes); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2870 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2871 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2872 /* Same as execute_pass_list but assume that subpasses of IPA passes |
0 | 2873 are local passes. */ |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2874 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2875 static void |
111 | 2876 ipa_read_optimization_summaries_1 (opt_pass *pass) |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2877 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2878 while (pass) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2879 { |
111 | 2880 ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass; |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2881 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2882 gcc_assert (!current_function_decl); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2883 gcc_assert (!cfun); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2884 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2885 |
111 | 2886 if (pass->gate (cfun)) |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2887 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2888 if (pass->type == IPA_PASS && ipa_pass->read_optimization_summary) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2889 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2890 /* If a timevar is present, start it. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2891 if (pass->tv_id) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2892 timevar_push (pass->tv_id); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2893 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2894 pass_init_dump_file (pass); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2895 |
111 | 2896 current_pass = pass; |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2897 ipa_pass->read_optimization_summary (); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2898 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2899 pass_fini_dump_file (pass); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2900 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2901 /* Stop timevar. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2902 if (pass->tv_id) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2903 timevar_pop (pass->tv_id); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2904 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2905 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2906 if (pass->sub && pass->sub->type != GIMPLE_PASS) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2907 ipa_read_optimization_summaries_1 (pass->sub); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2908 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2909 pass = pass->next; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2910 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2911 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2912 |
111 | 2913 /* Read all the summaries for all_regular_ipa_passes. */ |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2914 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2915 void |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2916 ipa_read_optimization_summaries (void) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2917 { |
111 | 2918 pass_manager *passes = g->get_passes (); |
2919 ipa_read_optimization_summaries_1 (passes->all_regular_ipa_passes); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2920 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2921 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2922 /* Same as execute_pass_list but assume that subpasses of IPA passes |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2923 are local passes. */ |
0 | 2924 void |
111 | 2925 execute_ipa_pass_list (opt_pass *pass) |
0 | 2926 { |
2927 do | |
2928 { | |
2929 gcc_assert (!current_function_decl); | |
2930 gcc_assert (!cfun); | |
2931 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); | |
2932 if (execute_one_pass (pass) && pass->sub) | |
2933 { | |
2934 if (pass->sub->type == GIMPLE_PASS) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2935 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2936 invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_START, NULL); |
111 | 2937 do_per_function_toporder ((void (*)(function *, void *)) |
2938 execute_pass_list, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2939 pass->sub); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2940 invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_END, NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2941 } |
0 | 2942 else if (pass->sub->type == SIMPLE_IPA_PASS |
2943 || pass->sub->type == IPA_PASS) | |
2944 execute_ipa_pass_list (pass->sub); | |
2945 else | |
2946 gcc_unreachable (); | |
2947 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2948 gcc_assert (!current_function_decl); |
111 | 2949 symtab->process_new_functions (); |
0 | 2950 pass = pass->next; |
2951 } | |
2952 while (pass); | |
2953 } | |
2954 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2955 /* Execute stmt fixup hooks of all passes in PASS for NODE and STMTS. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2956 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2957 static void |
111 | 2958 execute_ipa_stmt_fixups (opt_pass *pass, |
2959 struct cgraph_node *node, gimple **stmts) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2960 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2961 while (pass) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2962 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2963 /* Execute all of the IPA_PASSes in the list. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2964 if (pass->type == IPA_PASS |
111 | 2965 && pass->gate (cfun)) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2966 { |
111 | 2967 ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2968 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2969 if (ipa_pass->stmt_fixup) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2970 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2971 pass_init_dump_file (pass); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2972 /* If a timevar is present, start it. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2973 if (pass->tv_id) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2974 timevar_push (pass->tv_id); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2975 |
111 | 2976 current_pass = pass; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2977 ipa_pass->stmt_fixup (node, stmts); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2978 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2979 /* Stop timevar. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2980 if (pass->tv_id) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2981 timevar_pop (pass->tv_id); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2982 pass_fini_dump_file (pass); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2983 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2984 if (pass->sub) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2985 execute_ipa_stmt_fixups (pass->sub, node, stmts); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2986 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2987 pass = pass->next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2988 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2989 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2990 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2991 /* Execute stmt fixup hooks of all IPA passes for NODE and STMTS. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2992 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2993 void |
111 | 2994 execute_all_ipa_stmt_fixups (struct cgraph_node *node, gimple **stmts) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2995 { |
111 | 2996 pass_manager *passes = g->get_passes (); |
2997 execute_ipa_stmt_fixups (passes->all_regular_ipa_passes, node, stmts); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2998 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2999 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3000 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3001 extern void debug_properties (unsigned int); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3002 extern void dump_properties (FILE *, unsigned int); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3003 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
3004 DEBUG_FUNCTION void |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3005 dump_properties (FILE *dump, unsigned int props) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3006 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3007 fprintf (dump, "Properties:\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3008 if (props & PROP_gimple_any) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3009 fprintf (dump, "PROP_gimple_any\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3010 if (props & PROP_gimple_lcf) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3011 fprintf (dump, "PROP_gimple_lcf\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3012 if (props & PROP_gimple_leh) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3013 fprintf (dump, "PROP_gimple_leh\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3014 if (props & PROP_cfg) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3015 fprintf (dump, "PROP_cfg\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3016 if (props & PROP_ssa) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3017 fprintf (dump, "PROP_ssa\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3018 if (props & PROP_no_crit_edges) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3019 fprintf (dump, "PROP_no_crit_edges\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3020 if (props & PROP_rtl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3021 fprintf (dump, "PROP_rtl\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3022 if (props & PROP_gimple_lomp) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3023 fprintf (dump, "PROP_gimple_lomp\n"); |
111 | 3024 if (props & PROP_gimple_lomp_dev) |
3025 fprintf (dump, "PROP_gimple_lomp_dev\n"); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
3026 if (props & PROP_gimple_lcx) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
3027 fprintf (dump, "PROP_gimple_lcx\n"); |
111 | 3028 if (props & PROP_gimple_lvec) |
3029 fprintf (dump, "PROP_gimple_lvec\n"); | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
3030 if (props & PROP_cfglayout) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
3031 fprintf (dump, "PROP_cfglayout\n"); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3032 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3033 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
3034 DEBUG_FUNCTION void |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3035 debug_properties (unsigned int props) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3036 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3037 dump_properties (stderr, props); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3038 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3039 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3040 /* Called by local passes to see if function is called by already processed nodes. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3041 Because we process nodes in topological order, this means that function is |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3042 in recursive cycle or we introduced new direct calls. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3043 bool |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3044 function_called_by_processed_nodes_p (void) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3045 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3046 struct cgraph_edge *e; |
111 | 3047 for (e = cgraph_node::get (current_function_decl)->callers; |
3048 e; | |
3049 e = e->next_caller) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3050 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3051 if (e->caller->decl == current_function_decl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3052 continue; |
111 | 3053 if (!e->caller->has_gimple_body_p ()) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3054 continue; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3055 if (TREE_ASM_WRITTEN (e->caller->decl)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3056 continue; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3057 if (!e->caller->process && !e->caller->global.inlined_to) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3058 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3059 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3060 if (dump_file && e) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3061 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3062 fprintf (dump_file, "Already processed call to:\n"); |
111 | 3063 e->caller->dump (dump_file); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3064 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3065 return e != NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3066 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
3067 |
0 | 3068 #include "gt-passes.h" |