Mercurial > hg > CbC > CbC_gcc
annotate gcc/passes.c @ 63:b7f97abdc517 gcc-4.6-20100522
update gcc from gcc-4.5.0 to gcc-4.6
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 24 May 2010 12:47:05 +0900 |
parents | 77e2b8dfacca |
children | f6334be47118 |
rev | line source |
---|---|
0 | 1 /* Top level of GCC compilers (cc1, cc1plus, etc.) |
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
0 | 4 Free Software Foundation, Inc. |
5 | |
6 This file is part of GCC. | |
7 | |
8 GCC is free software; you can redistribute it and/or modify it under | |
9 the terms of the GNU General Public License as published by the Free | |
10 Software Foundation; either version 3, or (at your option) any later | |
11 version. | |
12 | |
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with GCC; see the file COPYING3. If not see | |
20 <http://www.gnu.org/licenses/>. */ | |
21 | |
22 /* This is the top level of cc1/c++. | |
23 It parses command args, opens files, invokes the various passes | |
24 in the proper order, and counts the time used by each. | |
25 Error messages and low-level interface to malloc also handled here. */ | |
26 | |
27 #include "config.h" | |
28 #include "system.h" | |
29 #include "coretypes.h" | |
30 #include "tm.h" | |
31 #include <signal.h> | |
32 | |
33 #ifdef HAVE_SYS_RESOURCE_H | |
34 # include <sys/resource.h> | |
35 #endif | |
36 | |
37 #ifdef HAVE_SYS_TIMES_H | |
38 # include <sys/times.h> | |
39 #endif | |
40 | |
41 #include "line-map.h" | |
42 #include "input.h" | |
43 #include "tree.h" | |
44 #include "rtl.h" | |
45 #include "tm_p.h" | |
46 #include "flags.h" | |
47 #include "insn-attr.h" | |
48 #include "insn-config.h" | |
49 #include "insn-flags.h" | |
50 #include "hard-reg-set.h" | |
51 #include "recog.h" | |
52 #include "output.h" | |
53 #include "except.h" | |
54 #include "function.h" | |
55 #include "toplev.h" | |
56 #include "expr.h" | |
57 #include "basic-block.h" | |
58 #include "intl.h" | |
59 #include "ggc.h" | |
60 #include "graph.h" | |
61 #include "regs.h" | |
62 #include "timevar.h" | |
63 #include "diagnostic.h" | |
64 #include "params.h" | |
65 #include "reload.h" | |
66 #include "dwarf2asm.h" | |
67 #include "integrate.h" | |
68 #include "debug.h" | |
69 #include "target.h" | |
70 #include "langhooks.h" | |
71 #include "cfglayout.h" | |
72 #include "cfgloop.h" | |
73 #include "hosthooks.h" | |
74 #include "cgraph.h" | |
75 #include "opts.h" | |
76 #include "coverage.h" | |
77 #include "value-prof.h" | |
78 #include "tree-inline.h" | |
79 #include "tree-flow.h" | |
80 #include "tree-pass.h" | |
81 #include "tree-dump.h" | |
82 #include "df.h" | |
83 #include "predict.h" | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
84 #include "lto-streamer.h" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
85 #include "plugin.h" |
0 | 86 |
87 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO) | |
88 #include "dwarf2out.h" | |
89 #endif | |
90 | |
91 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) | |
92 #include "dbxout.h" | |
93 #endif | |
94 | |
95 #ifdef SDB_DEBUGGING_INFO | |
96 #include "sdbout.h" | |
97 #endif | |
98 | |
99 #ifdef XCOFF_DEBUGGING_INFO | |
100 #include "xcoffout.h" /* Needed for external data | |
101 declarations for e.g. AIX 4.x. */ | |
102 #endif | |
103 | |
104 /* 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
|
105 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
|
106 The variable current_pass is also used for statistics and plugins. */ |
0 | 107 struct opt_pass *current_pass; |
108 | |
109 /* Call from anywhere to find out what pass this is. Useful for | |
110 printing out debugging information deep inside an service | |
111 routine. */ | |
112 void | |
113 print_current_pass (FILE *file) | |
114 { | |
115 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
|
116 fprintf (file, "current pass = %s (%d)\n", |
0 | 117 current_pass->name, current_pass->static_pass_number); |
118 else | |
119 fprintf (file, "no current pass.\n"); | |
120 } | |
121 | |
122 | |
123 /* Call from the debugger to get the current pass name. */ | |
124 void | |
125 debug_pass (void) | |
126 { | |
127 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
|
128 } |
0 | 129 |
130 | |
131 | |
132 /* Global variables used to communicate with passes. */ | |
133 int dump_flags; | |
134 bool in_gimple_form; | |
135 bool first_pass_instance; | |
136 | |
137 | |
138 /* This is called from various places for FUNCTION_DECL, VAR_DECL, | |
139 and TYPE_DECL nodes. | |
140 | |
141 This does nothing for local (non-static) variables, unless the | |
142 variable is a register variable with DECL_ASSEMBLER_NAME set. In | |
143 that case, or if the variable is not an automatic, it sets up the | |
144 RTL and outputs any assembler code (label definition, storage | |
145 allocation and initialization). | |
146 | |
147 DECL is the declaration. TOP_LEVEL is nonzero | |
148 if this declaration is not within a function. */ | |
149 | |
150 void | |
151 rest_of_decl_compilation (tree decl, | |
152 int top_level, | |
153 int at_end) | |
154 { | |
155 /* We deferred calling assemble_alias so that we could collect | |
156 other attributes such as visibility. Emit the alias now. */ | |
157 { | |
158 tree alias; | |
159 alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl)); | |
160 if (alias) | |
161 { | |
162 alias = TREE_VALUE (TREE_VALUE (alias)); | |
163 alias = get_identifier (TREE_STRING_POINTER (alias)); | |
164 assemble_alias (decl, alias); | |
165 } | |
166 } | |
167 | |
168 /* Can't defer this, because it needs to happen before any | |
169 later function definitions are processed. */ | |
170 if (DECL_ASSEMBLER_NAME_SET_P (decl) && DECL_REGISTER (decl)) | |
171 make_decl_rtl (decl); | |
172 | |
173 /* Forward declarations for nested functions are not "external", | |
174 but we need to treat them as if they were. */ | |
175 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl) | |
176 || TREE_CODE (decl) == FUNCTION_DECL) | |
177 { | |
178 timevar_push (TV_VARCONST); | |
179 | |
180 /* Don't output anything when a tentative file-scope definition | |
181 is seen. But at end of compilation, do output code for them. | |
182 | |
183 We do output all variables and rely on | |
184 callgraph code to defer them except for forward declarations | |
185 (see gcc.c-torture/compile/920624-1.c) */ | |
186 if ((at_end | |
187 || !DECL_DEFER_OUTPUT (decl) | |
188 || DECL_INITIAL (decl)) | |
189 && !DECL_EXTERNAL (decl)) | |
190 { | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
191 /* 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
|
192 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
|
193 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
|
194 ; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
195 else if (TREE_CODE (decl) != FUNCTION_DECL) |
0 | 196 varpool_finalize_decl (decl); |
197 else | |
198 assemble_variable (decl, top_level, at_end, 0); | |
199 } | |
200 | |
201 #ifdef ASM_FINISH_DECLARE_OBJECT | |
202 if (decl == last_assemble_variable_decl) | |
203 { | |
204 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl, | |
205 top_level, at_end); | |
206 } | |
207 #endif | |
208 | |
209 timevar_pop (TV_VARCONST); | |
210 } | |
211 else if (TREE_CODE (decl) == TYPE_DECL | |
212 /* Like in rest_of_type_compilation, avoid confusing the debug | |
213 information machinery when there are errors. */ | |
214 && !(sorrycount || errorcount)) | |
215 { | |
216 timevar_push (TV_SYMOUT); | |
217 debug_hooks->type_decl (decl, !top_level); | |
218 timevar_pop (TV_SYMOUT); | |
219 } | |
220 | |
221 /* 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
|
222 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
|
223 ; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
224 else if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl)) |
0 | 225 varpool_node (decl); |
226 } | |
227 | |
228 /* Called after finishing a record, union or enumeral type. */ | |
229 | |
230 void | |
231 rest_of_type_compilation (tree type, int toplev) | |
232 { | |
233 /* Avoid confusing the debug information machinery when there are | |
234 errors. */ | |
235 if (errorcount != 0 || sorrycount != 0) | |
236 return; | |
237 | |
238 timevar_push (TV_SYMOUT); | |
239 debug_hooks->type_decl (TYPE_STUB_DECL (type), !toplev); | |
240 timevar_pop (TV_SYMOUT); | |
241 } | |
242 | |
243 | |
244 | |
245 void | |
246 finish_optimization_passes (void) | |
247 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
248 int i; |
0 | 249 struct dump_file_info *dfi; |
250 char *name; | |
251 | |
252 timevar_push (TV_DUMP); | |
253 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) | |
254 { | |
255 dump_file = dump_begin (pass_profile.pass.static_pass_number, NULL); | |
256 end_branch_prob (); | |
257 if (dump_file) | |
258 dump_end (pass_profile.pass.static_pass_number, dump_file); | |
259 } | |
260 | |
261 if (optimize > 0) | |
262 { | |
263 dump_file = dump_begin (pass_combine.pass.static_pass_number, NULL); | |
264 if (dump_file) | |
265 { | |
266 dump_combine_total_stats (dump_file); | |
267 dump_end (pass_combine.pass.static_pass_number, dump_file); | |
268 } | |
269 } | |
270 | |
271 /* Do whatever is necessary to finish printing the graphs. */ | |
272 if (graph_dump_format != no_graph) | |
273 for (i = TDI_end; (dfi = get_dump_file_info (i)) != NULL; ++i) | |
274 if (dump_initialized_p (i) | |
275 && (dfi->flags & TDF_GRAPH) != 0 | |
276 && (name = get_dump_file_name (i)) != NULL) | |
277 { | |
278 finish_graph_dump_file (name); | |
279 free (name); | |
280 } | |
281 | |
282 timevar_pop (TV_DUMP); | |
283 } | |
284 | |
285 static bool | |
286 gate_rest_of_compilation (void) | |
287 { | |
288 /* Early return if there were errors. We can run afoul of our | |
289 consistency checks, and there's not really much point in fixing them. */ | |
290 return !(rtl_dump_and_exit || flag_syntax_only || errorcount || sorrycount); | |
291 } | |
292 | |
293 struct gimple_opt_pass pass_rest_of_compilation = | |
294 { | |
295 { | |
296 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
|
297 "*rest_of_compilation", /* name */ |
0 | 298 gate_rest_of_compilation, /* gate */ |
299 NULL, /* execute */ | |
300 NULL, /* sub */ | |
301 NULL, /* next */ | |
302 0, /* static_pass_number */ | |
303 TV_REST_OF_COMPILATION, /* tv_id */ | |
304 PROP_rtl, /* properties_required */ | |
305 0, /* properties_provided */ | |
306 0, /* properties_destroyed */ | |
307 0, /* todo_flags_start */ | |
308 TODO_ggc_collect /* todo_flags_finish */ | |
309 } | |
310 }; | |
311 | |
312 static bool | |
313 gate_postreload (void) | |
314 { | |
315 return reload_completed; | |
316 } | |
317 | |
318 struct rtl_opt_pass pass_postreload = | |
319 { | |
320 { | |
321 RTL_PASS, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
322 "*all-postreload", /* name */ |
0 | 323 gate_postreload, /* gate */ |
324 NULL, /* execute */ | |
325 NULL, /* sub */ | |
326 NULL, /* next */ | |
327 0, /* 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
|
328 TV_NONE, /* tv_id */ |
0 | 329 PROP_rtl, /* properties_required */ |
330 0, /* properties_provided */ | |
331 0, /* properties_destroyed */ | |
332 0, /* todo_flags_start */ | |
333 TODO_ggc_collect | TODO_verify_rtl_sharing /* todo_flags_finish */ | |
334 } | |
335 }; | |
336 | |
337 | |
338 | |
339 /* The root of the compilation pass tree, once constructed. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
340 struct opt_pass *all_passes, *all_small_ipa_passes, *all_lowering_passes, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
341 *all_regular_ipa_passes, *all_lto_gen_passes; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
342 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
343 /* This is used by plugins, and should also be used in register_pass. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
344 #define DEF_PASS_LIST(LIST) &LIST, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
345 struct opt_pass **gcc_pass_lists[] = { GCC_PASS_LISTS NULL }; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
346 #undef DEF_PASS_LIST |
0 | 347 |
348 /* A map from static pass id to optimization pass. */ | |
349 struct opt_pass **passes_by_id; | |
350 int passes_by_id_size; | |
351 | |
352 /* Set the static pass number of pass PASS to ID and record that | |
353 in the mapping from static pass number to pass. */ | |
354 | |
355 static void | |
356 set_pass_for_id (int id, struct opt_pass *pass) | |
357 { | |
358 pass->static_pass_number = id; | |
359 if (passes_by_id_size <= id) | |
360 { | |
361 passes_by_id = XRESIZEVEC (struct opt_pass *, passes_by_id, id + 1); | |
362 memset (passes_by_id + passes_by_id_size, 0, | |
363 (id + 1 - passes_by_id_size) * sizeof (void *)); | |
364 passes_by_id_size = id + 1; | |
365 } | |
366 passes_by_id[id] = pass; | |
367 } | |
368 | |
369 /* Return the pass with the static pass number ID. */ | |
370 | |
371 struct opt_pass * | |
372 get_pass_for_id (int id) | |
373 { | |
374 if (id >= passes_by_id_size) | |
375 return NULL; | |
376 return passes_by_id[id]; | |
377 } | |
378 | |
379 /* Iterate over the pass tree allocating dump file numbers. We want | |
380 to do this depth first, and independent of whether the pass is | |
381 enabled or not. */ | |
382 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
383 void |
0 | 384 register_one_dump_file (struct opt_pass *pass) |
385 { | |
386 char *dot_name, *flag_name, *glob_name; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
387 const char *name, *prefix; |
0 | 388 char num[10]; |
389 int flags, id; | |
390 | |
391 /* See below in next_pass_1. */ | |
392 num[0] = '\0'; | |
393 if (pass->static_pass_number != -1) | |
394 sprintf (num, "%d", ((int) pass->static_pass_number < 0 | |
395 ? 1 : pass->static_pass_number)); | |
396 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
397 /* 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
|
398 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
|
399 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
|
400 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
|
401 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
|
402 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
|
403 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
|
404 dot_name = concat (".", name, num, NULL); |
0 | 405 if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) |
406 prefix = "ipa-", flags = TDF_IPA; | |
407 else if (pass->type == GIMPLE_PASS) | |
408 prefix = "tree-", flags = TDF_TREE; | |
409 else | |
410 prefix = "rtl-", flags = TDF_RTL; | |
411 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
412 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
|
413 glob_name = concat (prefix, name, NULL); |
0 | 414 id = dump_register (dot_name, flag_name, glob_name, flags); |
415 set_pass_for_id (id, pass); | |
416 } | |
417 | |
418 /* Recursive worker function for register_dump_files. */ | |
419 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
420 static int |
0 | 421 register_dump_files_1 (struct opt_pass *pass, int properties) |
422 { | |
423 do | |
424 { | |
425 int new_properties = (properties | pass->properties_provided) | |
426 & ~pass->properties_destroyed; | |
427 | |
428 if (pass->name && pass->name[0] != '*') | |
429 register_one_dump_file (pass); | |
430 | |
431 if (pass->sub) | |
432 new_properties = register_dump_files_1 (pass->sub, new_properties); | |
433 | |
434 /* If we have a gate, combine the properties that we could have with | |
435 and without the pass being examined. */ | |
436 if (pass->gate) | |
437 properties &= new_properties; | |
438 else | |
439 properties = new_properties; | |
440 | |
441 pass = pass->next; | |
442 } | |
443 while (pass); | |
444 | |
445 return properties; | |
446 } | |
447 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
448 /* Register the dump files for the pipeline starting at PASS. |
0 | 449 PROPERTIES reflects the properties that are guaranteed to be available at |
450 the beginning of the pipeline. */ | |
451 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
452 static void |
0 | 453 register_dump_files (struct opt_pass *pass,int properties) |
454 { | |
455 pass->properties_required |= properties; | |
456 register_dump_files_1 (pass, properties); | |
457 } | |
458 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
459 /* Look at the static_pass_number and duplicate the pass |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
460 if it is already added to a list. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
461 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
462 static struct opt_pass * |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
463 make_pass_instance (struct opt_pass *pass, bool track_duplicates) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
464 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
465 /* A nonzero static_pass_number indicates that the |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
466 pass is already 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
|
467 if (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
|
468 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
469 struct opt_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
|
470 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
471 if (pass->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
|
472 || pass->type == RTL_PASS |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
473 || pass->type == SIMPLE_IPA_PASS) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
474 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
475 new_pass = XNEW (struct opt_pass); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
476 memcpy (new_pass, pass, sizeof (struct opt_pass)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
477 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
478 else 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
|
479 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
480 new_pass = (struct opt_pass *)XNEW (struct ipa_opt_pass_d); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
481 memcpy (new_pass, pass, sizeof (struct ipa_opt_pass_d)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
482 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
483 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
484 gcc_unreachable (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
485 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
486 new_pass->next = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
487 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
488 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
|
489 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
490 /* 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
|
491 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
|
492 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
|
493 Subsequent instances will be > 0 and just the duplicate number. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
494 if ((pass->name && pass->name[0] != '*') || track_duplicates) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
495 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
496 pass->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
|
497 new_pass->static_pass_number = -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
|
498 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
499 return new_pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
500 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
501 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
502 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
503 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
|
504 pass->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
|
505 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
506 invoke_plugin_callbacks (PLUGIN_NEW_PASS, pass); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
507 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
508 return pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
509 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
510 |
0 | 511 /* Add a pass to the pass list. Duplicate the pass if it's already |
512 in the list. */ | |
513 | |
514 static struct opt_pass ** | |
515 next_pass_1 (struct opt_pass **list, struct opt_pass *pass) | |
516 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
517 /* 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
|
518 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
|
519 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
520 *list = make_pass_instance (pass, false); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
521 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
522 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
|
523 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
524 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
525 /* 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
|
526 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
|
527 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
|
528 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
|
529 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
|
530 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
|
531 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
532 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
|
533 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
534 struct opt_pass *pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
535 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
|
536 }; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
537 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
538 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
|
539 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
|
540 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
541 /* 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
|
542 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
|
543 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
544 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
|
545 PASS_LIST - root of the pass list to insert the new pass to */ |
0 | 546 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
547 static bool |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
548 position_pass (struct register_pass_info *new_pass_info, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
549 struct opt_pass **pass_list) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
550 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
551 struct opt_pass *pass = *pass_list, *prev_pass = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
552 bool success = false; |
0 | 553 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
554 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
|
555 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
556 /* 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
|
557 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
|
558 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
|
559 && pass->name |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
560 && !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
|
561 && ((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
|
562 || (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
|
563 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
|
564 || (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
|
565 && 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
|
566 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
567 struct opt_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
|
568 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
|
569 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
570 new_pass = make_pass_instance (new_pass_info->pass, true); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
571 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
572 /* 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
|
573 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
|
574 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
575 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
|
576 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
|
577 pass->next = new_pass; |
0 | 578 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
579 /* 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
|
580 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
|
581 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
|
582 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
|
583 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
584 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
|
585 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
|
586 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
|
587 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
|
588 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
589 *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
|
590 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
591 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
|
592 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
|
593 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
|
594 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
|
595 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
596 *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
|
597 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
|
598 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
|
599 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
|
600 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
601 default: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
602 error ("Invalid pass positioning operation"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
603 return false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
604 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
605 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
606 /* 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
|
607 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
|
608 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
|
609 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
|
610 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
|
611 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
|
612 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
|
613 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
|
614 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
|
615 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
616 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
|
617 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
|
618 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
619 success = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
620 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
621 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
622 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
|
623 success = true; |
0 | 624 } |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
625 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
626 return success; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
627 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
628 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
629 /* 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
|
630 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
631 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
|
632 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
|
633 the pass */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
634 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
635 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
636 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
|
637 { |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
638 bool all_instances, success; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
639 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
640 /* 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
|
641 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
|
642 the messages. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
643 if (!pass_info->pass) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
644 fatal_error ("plugin cannot register a missing pass"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
645 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
646 if (!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
|
647 fatal_error ("plugin cannot register an unnamed pass"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
648 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
649 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
|
650 fatal_error |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
651 ("plugin cannot register pass %qs without 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
|
652 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
|
653 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
654 /* 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
|
655 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
|
656 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
|
657 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
|
658 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
|
659 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
|
660 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
|
661 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
|
662 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
|
663 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
|
664 success |= position_pass (pass_info, &all_lto_gen_passes); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
665 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
|
666 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
|
667 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
|
668 fatal_error |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
669 ("pass %qs not found but is referenced by new pass %qs", |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
670 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
|
671 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
672 /* 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
|
673 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
|
674 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
|
675 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
|
676 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
|
677 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
|
678 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
|
679 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
|
680 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
|
681 while (added_pass_nodes) |
0 | 682 { |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
683 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
|
684 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
|
685 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
|
686 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
|
687 || 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
|
688 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
|
689 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
|
690 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
|
691 else |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
692 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
|
693 /* Check if dump-all flag is specified. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
694 if (get_dump_file_info (tdi)->state) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
695 get_dump_file_info (added_pass_nodes->pass->static_pass_number) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
696 ->state = get_dump_file_info (tdi)->state; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
697 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
|
698 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
|
699 } |
0 | 700 } |
701 | |
702 /* Construct the pass tree. The sequencing of passes is driven by | |
703 the cgraph routines: | |
704 | |
705 cgraph_finalize_compilation_unit () | |
706 for each node N in the cgraph | |
707 cgraph_analyze_function (N) | |
708 cgraph_lower_function (N) -> all_lowering_passes | |
709 | |
710 If we are optimizing, cgraph_optimize is then invoked: | |
711 | |
712 cgraph_optimize () | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
713 ipa_passes () -> all_small_ipa_passes |
0 | 714 cgraph_expand_all_functions () |
715 for each node N in the cgraph | |
716 cgraph_expand_function (N) | |
717 tree_rest_of_compilation (DECL (N)) -> all_passes | |
718 */ | |
719 | |
720 void | |
721 init_optimization_passes (void) | |
722 { | |
723 struct opt_pass **p; | |
724 | |
725 #define NEXT_PASS(PASS) (p = next_pass_1 (p, &((PASS).pass))) | |
726 | |
727 /* All passes needed to lower the function into shape optimizers can | |
728 operate on. These passes are always run first on the function, but | |
729 backend might produce already lowered functions that are not processed | |
730 by these passes. */ | |
731 p = &all_lowering_passes; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
732 NEXT_PASS (pass_warn_unused_result); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
733 NEXT_PASS (pass_diagnose_omp_blocks); |
0 | 734 NEXT_PASS (pass_mudflap_1); |
735 NEXT_PASS (pass_lower_omp); | |
736 NEXT_PASS (pass_lower_cf); | |
737 NEXT_PASS (pass_refactor_eh); | |
738 NEXT_PASS (pass_lower_eh); | |
739 NEXT_PASS (pass_build_cfg); | |
740 NEXT_PASS (pass_lower_vector); | |
741 NEXT_PASS (pass_warn_function_return); | |
742 NEXT_PASS (pass_build_cgraph_edges); | |
743 NEXT_PASS (pass_inline_parameters); | |
744 *p = NULL; | |
745 | |
746 /* Interprocedural optimization passes. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
747 p = &all_small_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
|
748 NEXT_PASS (pass_ipa_free_lang_data); |
0 | 749 NEXT_PASS (pass_ipa_function_and_variable_visibility); |
750 NEXT_PASS (pass_ipa_early_inline); | |
751 { | |
752 struct opt_pass **p = &pass_ipa_early_inline.pass.sub; | |
753 NEXT_PASS (pass_early_inline); | |
754 NEXT_PASS (pass_inline_parameters); | |
755 NEXT_PASS (pass_rebuild_cgraph_edges); | |
756 } | |
757 NEXT_PASS (pass_early_local_passes); | |
758 { | |
759 struct opt_pass **p = &pass_early_local_passes.pass.sub; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
760 NEXT_PASS (pass_fixup_cfg); |
0 | 761 NEXT_PASS (pass_tree_profile); |
762 NEXT_PASS (pass_cleanup_cfg); | |
763 NEXT_PASS (pass_init_datastructures); | |
764 NEXT_PASS (pass_expand_omp); | |
765 | |
766 NEXT_PASS (pass_referenced_vars); | |
767 NEXT_PASS (pass_build_ssa); | |
768 NEXT_PASS (pass_early_warn_uninitialized); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
769 /* Note that it is not strictly necessary to schedule an early |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
770 inline pass here. However, some test cases (e.g., |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
771 g++.dg/other/p334435.C g++.dg/other/i386-1.C) expect extern |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
772 inline functions to be inlined even at -O0. This does not |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
773 happen during the first early inline pass. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
774 NEXT_PASS (pass_rebuild_cgraph_edges); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
775 NEXT_PASS (pass_early_inline); |
0 | 776 NEXT_PASS (pass_all_early_optimizations); |
777 { | |
778 struct opt_pass **p = &pass_all_early_optimizations.pass.sub; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
779 NEXT_PASS (pass_remove_cgraph_callee_edges); |
0 | 780 NEXT_PASS (pass_rename_ssa_copies); |
781 NEXT_PASS (pass_ccp); | |
782 NEXT_PASS (pass_forwprop); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
783 /* pass_build_ealias is a dummy pass that ensures that we |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
784 execute TODO_rebuild_alias at this point. Re-building |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
785 alias information also rewrites no longer addressed |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
786 locals into SSA form if possible. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
787 NEXT_PASS (pass_build_ealias); |
0 | 788 NEXT_PASS (pass_sra_early); |
789 NEXT_PASS (pass_copy_prop); | |
790 NEXT_PASS (pass_merge_phi); | |
791 NEXT_PASS (pass_cd_dce); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
792 NEXT_PASS (pass_early_ipa_sra); |
0 | 793 NEXT_PASS (pass_tail_recursion); |
794 NEXT_PASS (pass_convert_switch); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
795 NEXT_PASS (pass_cleanup_eh); |
0 | 796 NEXT_PASS (pass_profile); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
797 NEXT_PASS (pass_local_pure_const); |
0 | 798 } |
799 NEXT_PASS (pass_release_ssa_names); | |
800 NEXT_PASS (pass_rebuild_cgraph_edges); | |
801 NEXT_PASS (pass_inline_parameters); | |
802 } | |
803 NEXT_PASS (pass_ipa_increase_alignment); | |
804 NEXT_PASS (pass_ipa_matrix_reorg); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
805 *p = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
806 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
807 p = &all_regular_ipa_passes; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
808 NEXT_PASS (pass_ipa_whole_program_visibility); |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
809 NEXT_PASS (pass_ipa_profile); |
0 | 810 NEXT_PASS (pass_ipa_cp); |
811 NEXT_PASS (pass_ipa_inline); | |
812 NEXT_PASS (pass_ipa_reference); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
813 NEXT_PASS (pass_ipa_pure_const); |
0 | 814 NEXT_PASS (pass_ipa_type_escape); |
815 NEXT_PASS (pass_ipa_pta); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
816 NEXT_PASS (pass_ipa_struct_reorg); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
817 *p = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
818 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
819 p = &all_lto_gen_passes; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
820 NEXT_PASS (pass_ipa_lto_gimple_out); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
821 NEXT_PASS (pass_ipa_lto_finish_out); /* This must be the last LTO pass. */ |
0 | 822 *p = NULL; |
823 | |
824 /* These passes are run after IPA passes on every function that is being | |
825 output to the assembler file. */ | |
826 p = &all_passes; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
827 NEXT_PASS (pass_lower_eh_dispatch); |
0 | 828 NEXT_PASS (pass_all_optimizations); |
829 { | |
830 struct opt_pass **p = &pass_all_optimizations.pass.sub; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
831 NEXT_PASS (pass_remove_cgraph_callee_edges); |
0 | 832 /* Initial scalar cleanups before alias computation. |
833 They ensure memory accesses are not indirect wherever possible. */ | |
834 NEXT_PASS (pass_strip_predict_hints); | |
835 NEXT_PASS (pass_update_address_taken); | |
836 NEXT_PASS (pass_rename_ssa_copies); | |
837 NEXT_PASS (pass_complete_unrolli); | |
838 NEXT_PASS (pass_ccp); | |
839 NEXT_PASS (pass_forwprop); | |
840 NEXT_PASS (pass_call_cdce); | |
841 /* pass_build_alias is a dummy pass that ensures that we | |
842 execute TODO_rebuild_alias at this point. Re-building | |
843 alias information also rewrites no longer addressed | |
844 locals into SSA form if possible. */ | |
845 NEXT_PASS (pass_build_alias); | |
846 NEXT_PASS (pass_return_slot); | |
847 NEXT_PASS (pass_phiprop); | |
848 NEXT_PASS (pass_fre); | |
849 NEXT_PASS (pass_copy_prop); | |
850 NEXT_PASS (pass_merge_phi); | |
851 NEXT_PASS (pass_vrp); | |
852 NEXT_PASS (pass_dce); | |
853 NEXT_PASS (pass_cselim); | |
854 NEXT_PASS (pass_tree_ifcombine); | |
855 NEXT_PASS (pass_phiopt); | |
856 NEXT_PASS (pass_tail_recursion); | |
857 NEXT_PASS (pass_ch); | |
858 NEXT_PASS (pass_stdarg); | |
859 NEXT_PASS (pass_lower_complex); | |
860 NEXT_PASS (pass_sra); | |
861 NEXT_PASS (pass_rename_ssa_copies); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
862 /* The dom pass will also resolve all __builtin_constant_p calls |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
863 that are still there to 0. This has to be done after some |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
864 propagations have already run, but before some more dead code |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
865 is removed, and this place fits nicely. Remember this when |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
866 trying to move or duplicate pass_dominator somewhere earlier. */ |
0 | 867 NEXT_PASS (pass_dominator); |
868 /* The only const/copy propagation opportunities left after | |
869 DOM should be due to degenerate PHI nodes. So rather than | |
870 run the full propagators, run a specialized pass which | |
871 only examines PHIs to discover const/copy propagation | |
872 opportunities. */ | |
873 NEXT_PASS (pass_phi_only_cprop); | |
874 NEXT_PASS (pass_dse); | |
875 NEXT_PASS (pass_reassoc); | |
876 NEXT_PASS (pass_dce); | |
877 NEXT_PASS (pass_forwprop); | |
878 NEXT_PASS (pass_phiopt); | |
879 NEXT_PASS (pass_object_sizes); | |
880 NEXT_PASS (pass_ccp); | |
881 NEXT_PASS (pass_copy_prop); | |
882 NEXT_PASS (pass_cse_sincos); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
883 NEXT_PASS (pass_optimize_bswap); |
0 | 884 NEXT_PASS (pass_split_crit_edges); |
885 NEXT_PASS (pass_pre); | |
886 NEXT_PASS (pass_sink_code); | |
887 NEXT_PASS (pass_tree_loop); | |
888 { | |
889 struct opt_pass **p = &pass_tree_loop.pass.sub; | |
890 NEXT_PASS (pass_tree_loop_init); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
891 NEXT_PASS (pass_lim); |
0 | 892 NEXT_PASS (pass_copy_prop); |
893 NEXT_PASS (pass_dce_loop); | |
894 NEXT_PASS (pass_tree_unswitch); | |
895 NEXT_PASS (pass_scev_cprop); | |
896 NEXT_PASS (pass_record_bounds); | |
897 NEXT_PASS (pass_check_data_deps); | |
898 NEXT_PASS (pass_loop_distribution); | |
899 NEXT_PASS (pass_linear_transform); | |
900 NEXT_PASS (pass_graphite_transforms); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
901 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
902 struct opt_pass **p = &pass_graphite_transforms.pass.sub; |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
903 NEXT_PASS (pass_copy_prop); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
904 NEXT_PASS (pass_dce_loop); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
905 NEXT_PASS (pass_lim); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
906 } |
0 | 907 NEXT_PASS (pass_iv_canon); |
908 NEXT_PASS (pass_if_conversion); | |
909 NEXT_PASS (pass_vectorize); | |
910 { | |
911 struct opt_pass **p = &pass_vectorize.pass.sub; | |
912 NEXT_PASS (pass_lower_vector_ssa); | |
913 NEXT_PASS (pass_dce_loop); | |
914 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
915 NEXT_PASS (pass_predcom); |
0 | 916 NEXT_PASS (pass_complete_unroll); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
917 NEXT_PASS (pass_slp_vectorize); |
0 | 918 NEXT_PASS (pass_parallelize_loops); |
919 NEXT_PASS (pass_loop_prefetch); | |
920 NEXT_PASS (pass_iv_optimize); | |
921 NEXT_PASS (pass_tree_loop_done); | |
922 } | |
923 NEXT_PASS (pass_cse_reciprocals); | |
924 NEXT_PASS (pass_reassoc); | |
925 NEXT_PASS (pass_vrp); | |
926 NEXT_PASS (pass_dominator); | |
927 /* The only const/copy propagation opportunities left after | |
928 DOM should be due to degenerate PHI nodes. So rather than | |
929 run the full propagators, run a specialized pass which | |
930 only examines PHIs to discover const/copy propagation | |
931 opportunities. */ | |
932 NEXT_PASS (pass_phi_only_cprop); | |
933 NEXT_PASS (pass_cd_dce); | |
934 NEXT_PASS (pass_tracer); | |
935 | |
936 /* FIXME: If DCE is not run before checking for uninitialized uses, | |
937 we may get false warnings (e.g., testsuite/gcc.dg/uninit-5.c). | |
938 However, this also causes us to misdiagnose cases that should be | |
939 real warnings (e.g., testsuite/gcc.dg/pr18501.c). | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
940 |
0 | 941 To fix the false positives in uninit-5.c, we would have to |
942 account for the predicates protecting the set and the use of each | |
943 variable. Using a representation like Gated Single Assignment | |
944 may help. */ | |
945 NEXT_PASS (pass_late_warn_uninitialized); | |
946 NEXT_PASS (pass_dse); | |
947 NEXT_PASS (pass_forwprop); | |
948 NEXT_PASS (pass_phiopt); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
949 NEXT_PASS (pass_fold_builtins); |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
950 NEXT_PASS (pass_optimize_widening_mul); |
0 | 951 NEXT_PASS (pass_tail_calls); |
952 NEXT_PASS (pass_rename_ssa_copies); | |
953 NEXT_PASS (pass_uncprop); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
954 NEXT_PASS (pass_local_pure_const); |
0 | 955 } |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
956 NEXT_PASS (pass_lower_complex_O0); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
957 NEXT_PASS (pass_cleanup_eh); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
958 NEXT_PASS (pass_lower_resx); |
0 | 959 NEXT_PASS (pass_nrv); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
960 NEXT_PASS (pass_mudflap_2); |
0 | 961 NEXT_PASS (pass_cleanup_cfg_post_optimizing); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
962 NEXT_PASS (pass_warn_function_noreturn); |
0 | 963 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
964 NEXT_PASS (pass_expand); |
0 | 965 |
966 NEXT_PASS (pass_rest_of_compilation); | |
967 { | |
968 struct opt_pass **p = &pass_rest_of_compilation.pass.sub; | |
969 NEXT_PASS (pass_init_function); | |
970 NEXT_PASS (pass_jump); | |
971 NEXT_PASS (pass_rtl_eh); | |
972 NEXT_PASS (pass_initial_value_sets); | |
973 NEXT_PASS (pass_unshare_all_rtl); | |
974 NEXT_PASS (pass_instantiate_virtual_regs); | |
975 NEXT_PASS (pass_into_cfg_layout_mode); | |
976 NEXT_PASS (pass_jump2); | |
977 NEXT_PASS (pass_lower_subreg); | |
978 NEXT_PASS (pass_df_initialize_opt); | |
979 NEXT_PASS (pass_cse); | |
980 NEXT_PASS (pass_rtl_fwprop); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
981 NEXT_PASS (pass_rtl_cprop); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
982 NEXT_PASS (pass_rtl_pre); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
983 NEXT_PASS (pass_rtl_hoist); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
984 NEXT_PASS (pass_rtl_cprop); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
985 NEXT_PASS (pass_rtl_store_motion); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
986 NEXT_PASS (pass_cse_after_global_opts); |
0 | 987 NEXT_PASS (pass_rtl_ifcvt); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
988 NEXT_PASS (pass_reginfo_init); |
0 | 989 /* Perform loop optimizations. It might be better to do them a bit |
990 sooner, but we want the profile feedback to work more | |
991 efficiently. */ | |
992 NEXT_PASS (pass_loop2); | |
993 { | |
994 struct opt_pass **p = &pass_loop2.pass.sub; | |
995 NEXT_PASS (pass_rtl_loop_init); | |
996 NEXT_PASS (pass_rtl_move_loop_invariants); | |
997 NEXT_PASS (pass_rtl_unswitch); | |
998 NEXT_PASS (pass_rtl_unroll_and_peel_loops); | |
999 NEXT_PASS (pass_rtl_doloop); | |
1000 NEXT_PASS (pass_rtl_loop_done); | |
1001 *p = NULL; | |
1002 } | |
1003 NEXT_PASS (pass_web); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1004 NEXT_PASS (pass_rtl_cprop); |
0 | 1005 NEXT_PASS (pass_cse2); |
1006 NEXT_PASS (pass_rtl_dse1); | |
1007 NEXT_PASS (pass_rtl_fwprop_addr); | |
1008 NEXT_PASS (pass_inc_dec); | |
1009 NEXT_PASS (pass_initialize_regs); | |
1010 NEXT_PASS (pass_ud_rtl_dce); | |
1011 NEXT_PASS (pass_combine); | |
1012 NEXT_PASS (pass_if_after_combine); | |
1013 NEXT_PASS (pass_partition_blocks); | |
1014 NEXT_PASS (pass_regmove); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1015 NEXT_PASS (pass_outof_cfg_layout_mode); |
0 | 1016 NEXT_PASS (pass_split_all_insns); |
1017 NEXT_PASS (pass_lower_subreg2); | |
1018 NEXT_PASS (pass_df_initialize_no_opt); | |
1019 NEXT_PASS (pass_stack_ptr_mod); | |
1020 NEXT_PASS (pass_mode_switching); | |
1021 NEXT_PASS (pass_match_asm_constraints); | |
1022 NEXT_PASS (pass_sms); | |
1023 NEXT_PASS (pass_sched); | |
1024 NEXT_PASS (pass_ira); | |
1025 NEXT_PASS (pass_postreload); | |
1026 { | |
1027 struct opt_pass **p = &pass_postreload.pass.sub; | |
1028 NEXT_PASS (pass_postreload_cse); | |
1029 NEXT_PASS (pass_gcse2); | |
1030 NEXT_PASS (pass_split_after_reload); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1031 NEXT_PASS (pass_implicit_zee); |
0 | 1032 NEXT_PASS (pass_branch_target_load_optimize1); |
1033 NEXT_PASS (pass_thread_prologue_and_epilogue); | |
1034 NEXT_PASS (pass_rtl_dse2); | |
1035 NEXT_PASS (pass_stack_adjustments); | |
1036 NEXT_PASS (pass_peephole2); | |
1037 NEXT_PASS (pass_if_after_reload); | |
1038 NEXT_PASS (pass_regrename); | |
1039 NEXT_PASS (pass_cprop_hardreg); | |
1040 NEXT_PASS (pass_fast_rtl_dce); | |
1041 NEXT_PASS (pass_reorder_blocks); | |
1042 NEXT_PASS (pass_branch_target_load_optimize2); | |
1043 NEXT_PASS (pass_leaf_regs); | |
1044 NEXT_PASS (pass_split_before_sched2); | |
1045 NEXT_PASS (pass_sched2); | |
1046 NEXT_PASS (pass_stack_regs); | |
1047 { | |
1048 struct opt_pass **p = &pass_stack_regs.pass.sub; | |
1049 NEXT_PASS (pass_split_before_regstack); | |
1050 NEXT_PASS (pass_stack_regs_run); | |
1051 } | |
1052 NEXT_PASS (pass_compute_alignments); | |
1053 NEXT_PASS (pass_duplicate_computed_gotos); | |
1054 NEXT_PASS (pass_variable_tracking); | |
1055 NEXT_PASS (pass_free_cfg); | |
1056 NEXT_PASS (pass_machine_reorg); | |
1057 NEXT_PASS (pass_cleanup_barriers); | |
1058 NEXT_PASS (pass_delay_slots); | |
1059 NEXT_PASS (pass_split_for_shorten_branches); | |
1060 NEXT_PASS (pass_convert_to_eh_region_ranges); | |
1061 NEXT_PASS (pass_shorten_branches); | |
1062 NEXT_PASS (pass_set_nothrow_function_flags); | |
1063 NEXT_PASS (pass_final); | |
1064 } | |
1065 NEXT_PASS (pass_df_finish); | |
1066 } | |
1067 NEXT_PASS (pass_clean_state); | |
1068 *p = NULL; | |
1069 | |
1070 #undef NEXT_PASS | |
1071 | |
1072 /* Register the passes with the tree dump code. */ | |
1073 register_dump_files (all_lowering_passes, PROP_gimple_any); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1074 register_dump_files (all_small_ipa_passes, |
0 | 1075 PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh |
1076 | PROP_cfg); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1077 register_dump_files (all_regular_ipa_passes, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1078 PROP_gimple_any | PROP_gimple_lcf | 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
|
1079 | PROP_cfg); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1080 register_dump_files (all_lto_gen_passes, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1081 PROP_gimple_any | PROP_gimple_lcf | 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
|
1082 | PROP_cfg); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1083 register_dump_files (all_passes, |
0 | 1084 PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh |
1085 | PROP_cfg); | |
1086 } | |
1087 | |
1088 /* If we are in IPA mode (i.e., current_function_decl is NULL), call | |
1089 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
|
1090 call CALLBACK on the current function. */ |
0 | 1091 |
1092 static void | |
1093 do_per_function (void (*callback) (void *data), void *data) | |
1094 { | |
1095 if (current_function_decl) | |
1096 callback (data); | |
1097 else | |
1098 { | |
1099 struct cgraph_node *node; | |
1100 for (node = cgraph_nodes; node; node = node->next) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1101 if (node->analyzed && gimple_has_body_p (node->decl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1102 && (!node->clone_of || node->decl != node->clone_of->decl)) |
0 | 1103 { |
1104 push_cfun (DECL_STRUCT_FUNCTION (node->decl)); | |
1105 current_function_decl = node->decl; | |
1106 callback (data); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1107 if (!flag_wpa) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1108 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1109 free_dominance_info (CDI_DOMINATORS); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1110 free_dominance_info (CDI_POST_DOMINATORS); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1111 } |
0 | 1112 current_function_decl = NULL; |
1113 pop_cfun (); | |
1114 ggc_collect (); | |
1115 } | |
1116 } | |
1117 } | |
1118 | |
1119 /* Because inlining might remove no-longer reachable nodes, we need to | |
1120 keep the array visible to garbage collector to avoid reading collected | |
1121 out nodes. */ | |
1122 static int nnodes; | |
1123 static GTY ((length ("nnodes"))) struct cgraph_node **order; | |
1124 | |
1125 /* If we are in IPA mode (i.e., current_function_decl is NULL), call | |
1126 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
|
1127 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
|
1128 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
|
1129 void |
0 | 1130 do_per_function_toporder (void (*callback) (void *data), void *data) |
1131 { | |
1132 int i; | |
1133 | |
1134 if (current_function_decl) | |
1135 callback (data); | |
1136 else | |
1137 { | |
1138 gcc_assert (!order); | |
1139 order = GGC_NEWVEC (struct cgraph_node *, cgraph_n_nodes); | |
1140 nnodes = cgraph_postorder (order); | |
1141 for (i = nnodes - 1; i >= 0; i--) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1142 order[i]->process = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1143 for (i = nnodes - 1; i >= 0; i--) |
0 | 1144 { |
1145 struct cgraph_node *node = order[i]; | |
1146 | |
1147 /* Allow possibly removed nodes to be garbage collected. */ | |
1148 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
|
1149 node->process = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1150 if (node->analyzed) |
0 | 1151 { |
1152 push_cfun (DECL_STRUCT_FUNCTION (node->decl)); | |
1153 current_function_decl = node->decl; | |
1154 callback (data); | |
1155 free_dominance_info (CDI_DOMINATORS); | |
1156 free_dominance_info (CDI_POST_DOMINATORS); | |
1157 current_function_decl = NULL; | |
1158 pop_cfun (); | |
1159 ggc_collect (); | |
1160 } | |
1161 } | |
1162 } | |
1163 ggc_free (order); | |
1164 order = NULL; | |
1165 nnodes = 0; | |
1166 } | |
1167 | |
1168 /* Perform all TODO actions that ought to be done on each function. */ | |
1169 | |
1170 static void | |
1171 execute_function_todo (void *data) | |
1172 { | |
1173 unsigned int flags = (size_t)data; | |
1174 if (cfun->curr_properties & PROP_ssa) | |
1175 flags |= TODO_verify_ssa; | |
1176 flags &= ~cfun->last_verified; | |
1177 if (!flags) | |
1178 return; | |
1179 | |
1180 statistics_fini_pass (); | |
1181 | |
1182 /* Always cleanup the CFG before trying to update SSA. */ | |
1183 if (flags & TODO_cleanup_cfg) | |
1184 { | |
1185 bool cleanup = cleanup_tree_cfg (); | |
1186 | |
1187 if (cleanup && (cfun->curr_properties & PROP_ssa)) | |
1188 flags |= TODO_remove_unused_locals; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1189 |
0 | 1190 /* When cleanup_tree_cfg merges consecutive blocks, it may |
1191 perform some simplistic propagation when removing single | |
1192 valued PHI nodes. This propagation may, in turn, cause the | |
1193 SSA form to become out-of-date (see PR 22037). So, even | |
1194 if the parent pass had not scheduled an SSA update, we may | |
1195 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
|
1196 if (!(flags & TODO_update_ssa_any) && need_ssa_update_p (cfun)) |
0 | 1197 flags |= TODO_update_ssa; |
1198 } | |
1199 | |
1200 if (flags & TODO_update_ssa_any) | |
1201 { | |
1202 unsigned update_flags = flags & TODO_update_ssa_any; | |
1203 update_ssa (update_flags); | |
1204 cfun->last_verified &= ~TODO_verify_ssa; | |
1205 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1206 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1207 if (flags & TODO_update_address_taken) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1208 execute_update_addresses_taken (true); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1209 |
0 | 1210 if (flags & TODO_rebuild_alias) |
1211 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1212 if (!(flags & TODO_update_address_taken)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1213 execute_update_addresses_taken (true); |
0 | 1214 compute_may_aliases (); |
1215 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1216 |
0 | 1217 if (flags & TODO_remove_unused_locals) |
1218 remove_unused_locals (); | |
1219 | |
1220 if ((flags & TODO_dump_func) && dump_file && current_function_decl) | |
1221 { | |
1222 if (cfun->curr_properties & PROP_trees) | |
1223 dump_function_to_file (current_function_decl, dump_file, dump_flags); | |
1224 else | |
1225 { | |
1226 if (dump_flags & TDF_SLIM) | |
1227 print_rtl_slim_with_bb (dump_file, get_insns (), dump_flags); | |
1228 else if ((cfun->curr_properties & PROP_cfg) | |
1229 && (dump_flags & TDF_BLOCKS)) | |
1230 print_rtl_with_bb (dump_file, get_insns ()); | |
1231 else | |
1232 print_rtl (dump_file, get_insns ()); | |
1233 | |
1234 if ((cfun->curr_properties & PROP_cfg) | |
1235 && graph_dump_format != no_graph | |
1236 && (dump_flags & TDF_GRAPH)) | |
1237 print_rtl_graph_with_bb (dump_file_name, get_insns ()); | |
1238 } | |
1239 | |
1240 /* Flush the file. If verification fails, we won't be able to | |
1241 close the file before aborting. */ | |
1242 fflush (dump_file); | |
1243 } | |
1244 | |
1245 if (flags & TODO_rebuild_frequencies) | |
1246 { | |
1247 if (profile_status == PROFILE_GUESSED) | |
1248 { | |
1249 loop_optimizer_init (0); | |
1250 add_noreturn_fake_exit_edges (); | |
1251 mark_irreducible_loops (); | |
1252 connect_infinite_loops_to_exit (); | |
1253 estimate_bb_frequencies (); | |
1254 remove_fake_exit_edges (); | |
1255 loop_optimizer_finalize (); | |
1256 } | |
1257 else if (profile_status == PROFILE_READ) | |
1258 counts_to_freqs (); | |
1259 else | |
1260 gcc_unreachable (); | |
1261 } | |
1262 | |
1263 #if defined ENABLE_CHECKING | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1264 if (flags & TODO_verify_ssa |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1265 || (current_loops && loops_state_satisfies_p (LOOP_CLOSED_SSA))) |
0 | 1266 verify_ssa (true); |
1267 if (flags & TODO_verify_flow) | |
1268 verify_flow_info (); | |
1269 if (flags & TODO_verify_stmts) | |
1270 verify_stmts (); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1271 if (current_loops && loops_state_satisfies_p (LOOP_CLOSED_SSA)) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1272 verify_loop_closed_ssa (false); |
0 | 1273 if (flags & TODO_verify_rtl_sharing) |
1274 verify_rtl_sharing (); | |
1275 #endif | |
1276 | |
1277 cfun->last_verified = flags & TODO_verify_all; | |
1278 } | |
1279 | |
1280 /* Perform all TODO actions. */ | |
1281 static void | |
1282 execute_todo (unsigned int flags) | |
1283 { | |
1284 #if defined ENABLE_CHECKING | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1285 if (cfun |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1286 && need_ssa_update_p (cfun)) |
0 | 1287 gcc_assert (flags & TODO_update_ssa_any); |
1288 #endif | |
1289 | |
1290 /* Inform the pass whether it is the first time it is run. */ | |
1291 first_pass_instance = (flags & TODO_mark_first_instance) != 0; | |
1292 | |
1293 do_per_function (execute_function_todo, (void *)(size_t) flags); | |
1294 | |
1295 /* Always remove functions just as before inlining: IPA passes might be | |
1296 interested to see bodies of extern inline functions that are not inlined | |
1297 to analyze side effects. The full removal is done just at the end | |
1298 of IPA pass queue. */ | |
1299 if (flags & TODO_remove_functions) | |
1300 { | |
1301 gcc_assert (!cfun); | |
1302 cgraph_remove_unreachable_nodes (true, dump_file); | |
1303 } | |
1304 | |
1305 if ((flags & TODO_dump_cgraph) && dump_file && !current_function_decl) | |
1306 { | |
1307 gcc_assert (!cfun); | |
1308 dump_cgraph (dump_file); | |
1309 /* Flush the file. If verification fails, we won't be able to | |
1310 close the file before aborting. */ | |
1311 fflush (dump_file); | |
1312 } | |
1313 | |
1314 if (flags & TODO_ggc_collect) | |
1315 ggc_collect (); | |
1316 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1317 /* Now that the dumping has been done, we can get rid of the optional |
0 | 1318 df problems. */ |
1319 if (flags & TODO_df_finish) | |
1320 df_finish_pass ((flags & TODO_df_verify) != 0); | |
1321 } | |
1322 | |
1323 /* Verify invariants that should hold between passes. This is a place | |
1324 to put simple sanity checks. */ | |
1325 | |
1326 static void | |
1327 verify_interpass_invariants (void) | |
1328 { | |
1329 #ifdef ENABLE_CHECKING | |
1330 gcc_assert (!fold_deferring_overflow_warnings_p ()); | |
1331 #endif | |
1332 } | |
1333 | |
1334 /* Clear the last verified flag. */ | |
1335 | |
1336 static void | |
1337 clear_last_verified (void *data ATTRIBUTE_UNUSED) | |
1338 { | |
1339 cfun->last_verified = 0; | |
1340 } | |
1341 | |
1342 /* Helper function. Verify that the properties has been turn into the | |
1343 properties expected by the pass. */ | |
1344 | |
1345 #ifdef ENABLE_CHECKING | |
1346 static void | |
1347 verify_curr_properties (void *data) | |
1348 { | |
1349 unsigned int props = (size_t)data; | |
1350 gcc_assert ((cfun->curr_properties & props) == props); | |
1351 } | |
1352 #endif | |
1353 | |
1354 /* 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
|
1355 /* This is non-static so that the plugins can use it. */ |
0 | 1356 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1357 bool |
0 | 1358 pass_init_dump_file (struct opt_pass *pass) |
1359 { | |
1360 /* If a dump file name is present, open it if enabled. */ | |
1361 if (pass->static_pass_number != -1) | |
1362 { | |
1363 bool initializing_dump = !dump_initialized_p (pass->static_pass_number); | |
1364 dump_file_name = get_dump_file_name (pass->static_pass_number); | |
1365 dump_file = dump_begin (pass->static_pass_number, &dump_flags); | |
1366 if (dump_file && current_function_decl) | |
1367 { | |
1368 const char *dname, *aname; | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1369 struct cgraph_node *node = cgraph_node (current_function_decl); |
0 | 1370 dname = lang_hooks.decl_printable_name (current_function_decl, 2); |
1371 aname = (IDENTIFIER_POINTER | |
1372 (DECL_ASSEMBLER_NAME (current_function_decl))); | |
1373 fprintf (dump_file, "\n;; Function %s (%s)%s\n\n", dname, aname, | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1374 node->frequency == NODE_FREQUENCY_HOT |
0 | 1375 ? " (hot)" |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1376 : node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED |
0 | 1377 ? " (unlikely executed)" |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1378 : node->frequency == NODE_FREQUENCY_EXECUTED_ONCE |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1379 ? " (executed once)" |
0 | 1380 : ""); |
1381 } | |
1382 return initializing_dump; | |
1383 } | |
1384 else | |
1385 return false; | |
1386 } | |
1387 | |
1388 /* 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
|
1389 /* This is non-static so that plugins can use it. */ |
0 | 1390 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1391 void |
0 | 1392 pass_fini_dump_file (struct opt_pass *pass) |
1393 { | |
1394 /* Flush and close dump file. */ | |
1395 if (dump_file_name) | |
1396 { | |
1397 free (CONST_CAST (char *, dump_file_name)); | |
1398 dump_file_name = NULL; | |
1399 } | |
1400 | |
1401 if (dump_file) | |
1402 { | |
1403 dump_end (pass->static_pass_number, dump_file); | |
1404 dump_file = NULL; | |
1405 } | |
1406 } | |
1407 | |
1408 /* After executing the pass, apply expected changes to the function | |
1409 properties. */ | |
1410 | |
1411 static void | |
1412 update_properties_after_pass (void *data) | |
1413 { | |
1414 struct opt_pass *pass = (struct opt_pass *) data; | |
1415 cfun->curr_properties = (cfun->curr_properties | pass->properties_provided) | |
1416 & ~pass->properties_destroyed; | |
1417 } | |
1418 | |
1419 /* Execute summary generation for all of the passes in IPA_PASS. */ | |
1420 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1421 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1422 execute_ipa_summary_passes (struct ipa_opt_pass_d *ipa_pass) |
0 | 1423 { |
1424 while (ipa_pass) | |
1425 { | |
1426 struct opt_pass *pass = &ipa_pass->pass; | |
1427 | |
1428 /* Execute all of the IPA_PASSes in the list. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1429 if (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
|
1430 && (!pass->gate || pass->gate ()) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1431 && ipa_pass->generate_summary) |
0 | 1432 { |
1433 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
|
1434 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1435 /* 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
|
1436 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
|
1437 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
|
1438 |
0 | 1439 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
|
1440 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1441 /* Stop timevar. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1442 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
|
1443 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
|
1444 |
0 | 1445 pass_fini_dump_file (pass); |
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 ipa_pass = (struct ipa_opt_pass_d *)ipa_pass->pass.next; |
0 | 1448 } |
1449 } | |
1450 | |
1451 /* Execute IPA_PASS function transform on NODE. */ | |
1452 | |
1453 static void | |
1454 execute_one_ipa_transform_pass (struct cgraph_node *node, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1455 struct ipa_opt_pass_d *ipa_pass) |
0 | 1456 { |
1457 struct opt_pass *pass = &ipa_pass->pass; | |
1458 unsigned int todo_after = 0; | |
1459 | |
1460 current_pass = pass; | |
1461 if (!ipa_pass->function_transform) | |
1462 return; | |
1463 | |
1464 /* Note that the folders should only create gimple expressions. | |
1465 This is a hack until the new folder is ready. */ | |
1466 in_gimple_form = (cfun && (cfun->curr_properties & PROP_trees)) != 0; | |
1467 | |
1468 pass_init_dump_file (pass); | |
1469 | |
1470 /* Run pre-pass verification. */ | |
1471 execute_todo (ipa_pass->function_transform_todo_flags_start); | |
1472 | |
1473 /* 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
|
1474 if (pass->tv_id != TV_NONE) |
0 | 1475 timevar_push (pass->tv_id); |
1476 | |
1477 /* Do it! */ | |
1478 todo_after = ipa_pass->function_transform (node); | |
1479 | |
1480 /* 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
|
1481 if (pass->tv_id != TV_NONE) |
0 | 1482 timevar_pop (pass->tv_id); |
1483 | |
1484 /* Run post-pass cleanup and verification. */ | |
1485 execute_todo (todo_after); | |
1486 verify_interpass_invariants (); | |
1487 | |
1488 pass_fini_dump_file (pass); | |
1489 | |
1490 current_pass = NULL; | |
1491 } | |
1492 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1493 /* 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
|
1494 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1495 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1496 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
|
1497 { |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1498 enum cgraph_state old_state = cgraph_state; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1499 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
|
1500 if (!cfun) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1501 return; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1502 node = cgraph_node (current_function_decl); |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1503 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1504 /* Statement verification skip verification of nothorw when |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1505 state is IPA_SSA because we do not modify function bodies |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1506 after setting the flag on function. Instead we leave it |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1507 to fixup_cfg to do such a transformation. We need to temporarily |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1508 change the cgraph state so statement verifier before |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1509 transform do not fire. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1510 cgraph_state = CGRAPH_STATE_IPA_SSA; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1511 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1512 if (node->ipa_transforms_to_apply) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1513 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1514 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
|
1515 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1516 for (i = 0; i < VEC_length (ipa_opt_pass, node->ipa_transforms_to_apply); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1517 i++) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1518 execute_one_ipa_transform_pass (node, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1519 VEC_index (ipa_opt_pass, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1520 node->ipa_transforms_to_apply, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1521 i)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1522 VEC_free (ipa_opt_pass, heap, node->ipa_transforms_to_apply); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1523 node->ipa_transforms_to_apply = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1524 } |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1525 cgraph_state = old_state; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1526 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1527 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1528 /* Execute PASS. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1529 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1530 bool |
0 | 1531 execute_one_pass (struct opt_pass *pass) |
1532 { | |
1533 bool initializing_dump; | |
1534 unsigned int todo_after = 0; | |
1535 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1536 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
|
1537 |
0 | 1538 /* IPA passes are executed on whole program, so cfun should be NULL. |
1539 Other passes need function context set. */ | |
1540 if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS) | |
1541 gcc_assert (!cfun && !current_function_decl); | |
1542 else | |
1543 gcc_assert (cfun && current_function_decl); | |
1544 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1545 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
|
1546 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1547 /* 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
|
1548 User controls the value of the gate through the parameter "gate_status". */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1549 gate_status = (pass->gate == NULL) ? true : pass->gate(); |
0 | 1550 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1551 /* 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
|
1552 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
|
1553 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1554 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
|
1555 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1556 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
|
1557 return false; |
0 | 1558 } |
1559 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1560 /* 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
|
1561 executed. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1562 invoke_plugin_callbacks (PLUGIN_PASS_EXECUTION, pass); |
0 | 1563 |
1564 if (!quiet_flag && !cfun) | |
1565 fprintf (stderr, " <%s>", pass->name ? pass->name : ""); | |
1566 | |
1567 /* Note that the folders should only create gimple expressions. | |
1568 This is a hack until the new folder is ready. */ | |
1569 in_gimple_form = (cfun && (cfun->curr_properties & PROP_trees)) != 0; | |
1570 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1571 initializing_dump = 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
|
1572 |
0 | 1573 /* Run pre-pass verification. */ |
1574 execute_todo (pass->todo_flags_start); | |
1575 | |
1576 #ifdef ENABLE_CHECKING | |
1577 do_per_function (verify_curr_properties, | |
1578 (void *)(size_t)pass->properties_required); | |
1579 #endif | |
1580 | |
1581 /* 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
|
1582 if (pass->tv_id != TV_NONE) |
0 | 1583 timevar_push (pass->tv_id); |
1584 | |
1585 /* Do it! */ | |
1586 if (pass->execute) | |
1587 { | |
1588 todo_after = pass->execute (); | |
1589 do_per_function (clear_last_verified, NULL); | |
1590 } | |
1591 | |
1592 /* 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
|
1593 if (pass->tv_id != TV_NONE) |
0 | 1594 timevar_pop (pass->tv_id); |
1595 | |
1596 do_per_function (update_properties_after_pass, pass); | |
1597 | |
1598 if (initializing_dump | |
1599 && dump_file | |
1600 && graph_dump_format != no_graph | |
1601 && cfun | |
1602 && (cfun->curr_properties & (PROP_cfg | PROP_rtl)) | |
1603 == (PROP_cfg | PROP_rtl)) | |
1604 { | |
1605 get_dump_file_info (pass->static_pass_number)->flags |= TDF_GRAPH; | |
1606 dump_flags |= TDF_GRAPH; | |
1607 clean_graph_dump_file (dump_file_name); | |
1608 } | |
1609 | |
1610 /* Run post-pass cleanup and verification. */ | |
1611 execute_todo (todo_after | pass->todo_flags_finish); | |
1612 verify_interpass_invariants (); | |
1613 if (pass->type == IPA_PASS) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1614 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1615 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
|
1616 for (node = cgraph_nodes; node; node = node->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1617 if (node->analyzed) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1618 VEC_safe_push (ipa_opt_pass, heap, node->ipa_transforms_to_apply, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1619 (struct ipa_opt_pass_d *)pass); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1620 } |
0 | 1621 |
1622 if (!current_function_decl) | |
1623 cgraph_process_new_functions (); | |
1624 | |
1625 pass_fini_dump_file (pass); | |
1626 | |
1627 if (pass->type != SIMPLE_IPA_PASS && pass->type != IPA_PASS) | |
1628 gcc_assert (!(cfun->curr_properties & PROP_trees) | |
1629 || pass->type != RTL_PASS); | |
1630 | |
1631 current_pass = NULL; | |
1632 | |
1633 return true; | |
1634 } | |
1635 | |
1636 void | |
1637 execute_pass_list (struct opt_pass *pass) | |
1638 { | |
1639 do | |
1640 { | |
1641 gcc_assert (pass->type == GIMPLE_PASS | |
1642 || pass->type == RTL_PASS); | |
1643 if (execute_one_pass (pass) && pass->sub) | |
1644 execute_pass_list (pass->sub); | |
1645 pass = pass->next; | |
1646 } | |
1647 while (pass); | |
1648 } | |
1649 | |
1650 /* 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
|
1651 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
|
1652 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
|
1653 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1654 static void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1655 ipa_write_summaries_2 (struct opt_pass *pass, cgraph_node_set set, |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1656 varpool_node_set vset, |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1657 struct lto_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
|
1658 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1659 while (pass) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1660 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1661 struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *)pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1662 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
|
1663 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
|
1664 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
|
1665 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
|
1666 && ipa_pass->write_summary |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1667 && (!pass->gate || pass->gate ())) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1668 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1669 /* 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
|
1670 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
|
1671 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
|
1672 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1673 ipa_pass->write_summary (set,vset); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1674 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1675 /* 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
|
1676 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
|
1677 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
|
1678 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1679 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1680 if (pass->sub && pass->sub->type != GIMPLE_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
|
1681 ipa_write_summaries_2 (pass->sub, set, vset, state); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1682 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1683 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
|
1684 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1685 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1686 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1687 /* 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
|
1688 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
|
1689 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
|
1690 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1691 static void |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1692 ipa_write_summaries_1 (cgraph_node_set set, varpool_node_set vset) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1693 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1694 struct lto_out_decl_state *state = lto_new_out_decl_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
|
1695 compute_ltrans_boundary (state, set, vset); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1696 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1697 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
|
1698 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1699 gcc_assert (!flag_wpa); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1700 ipa_write_summaries_2 (all_regular_ipa_passes, set, vset, state); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1701 ipa_write_summaries_2 (all_lto_gen_passes, set, vset, state); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1702 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1703 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
|
1704 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
|
1705 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
|
1706 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1707 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1708 /* 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
|
1709 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1710 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1711 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
|
1712 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1713 cgraph_node_set set; |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1714 varpool_node_set vset; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1715 struct cgraph_node **order; |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1716 struct varpool_node *vnode; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1717 int i, order_pos; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1718 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1719 if (!flag_generate_lto || errorcount || sorrycount) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1720 return; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1721 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1722 set = cgraph_node_set_new (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1723 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1724 /* 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
|
1725 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
|
1726 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
|
1727 as the source code. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1728 order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1729 order_pos = cgraph_postorder (order); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1730 gcc_assert (order_pos == cgraph_n_nodes); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1731 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1732 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
|
1733 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1734 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
|
1735 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1736 if (node->analyzed) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1737 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1738 /* 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
|
1739 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
|
1740 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
|
1741 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
|
1742 hooks. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1743 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1744 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
|
1745 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
|
1746 pop_cfun (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1747 } |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1748 if (node->analyzed) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1749 cgraph_node_set_add (set, node); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1750 } |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1751 vset = varpool_node_set_new (); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1752 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1753 for (vnode = varpool_nodes; vnode; vnode = vnode->next) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1754 if (vnode->needed && !vnode->alias) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1755 varpool_node_set_add (vset, vnode); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1756 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1757 ipa_write_summaries_1 (set, vset); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1758 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1759 free (order); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1760 ggc_free (set); |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1761 ggc_free (vset); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1762 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1763 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1764 /* 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
|
1765 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
|
1766 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
|
1767 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1768 static void |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1769 ipa_write_optimization_summaries_1 (struct opt_pass *pass, cgraph_node_set set, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1770 varpool_node_set vset, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1771 struct lto_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
|
1772 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1773 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
|
1774 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1775 struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *)pass; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1776 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
|
1777 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
|
1778 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
|
1779 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
|
1780 && ipa_pass->write_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
|
1781 && (!pass->gate || pass->gate ())) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1782 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1783 /* 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
|
1784 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
|
1785 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
|
1786 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1787 ipa_pass->write_optimization_summary (set, vset); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1788 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1789 /* 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
|
1790 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
|
1791 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
|
1792 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1793 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1794 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
|
1795 ipa_write_optimization_summaries_1 (pass->sub, set, vset, state); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1796 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1797 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
|
1798 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1799 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1800 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1801 /* 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
|
1802 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
|
1803 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1804 void |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1805 ipa_write_optimization_summaries (cgraph_node_set set, varpool_node_set vset) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1806 { |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1807 struct lto_out_decl_state *state = lto_new_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
|
1808 compute_ltrans_boundary (state, set, vset); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1809 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1810 lto_push_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
|
1811 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1812 gcc_assert (flag_wpa); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1813 ipa_write_optimization_summaries_1 (all_regular_ipa_passes, set, vset, state); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1814 ipa_write_optimization_summaries_1 (all_lto_gen_passes, set, vset, state); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1815 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1816 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
|
1817 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
|
1818 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
|
1819 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1820 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1821 /* 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
|
1822 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
|
1823 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1824 static void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1825 ipa_read_summaries_1 (struct opt_pass *pass) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1826 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1827 while (pass) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1828 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1829 struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1830 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1831 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
|
1832 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
|
1833 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
|
1834 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1835 if (pass->gate == NULL || pass->gate ()) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1836 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1837 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
|
1838 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1839 /* 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
|
1840 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
|
1841 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
|
1842 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1843 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
|
1844 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1845 /* Stop timevar. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1846 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
|
1847 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
|
1848 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1849 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1850 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
|
1851 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
|
1852 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1853 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
|
1854 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1855 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1856 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1857 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1858 /* Read all the summaries for all_regular_ipa_passes and all_lto_gen_passes. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1859 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1860 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1861 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
|
1862 { |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1863 ipa_read_summaries_1 (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
|
1864 ipa_read_summaries_1 (all_lto_gen_passes); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1865 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1866 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1867 /* Same as execute_pass_list but assume that subpasses of IPA passes |
0 | 1868 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
|
1869 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1870 static void |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1871 ipa_read_optimization_summaries_1 (struct opt_pass *pass) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1872 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1873 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
|
1874 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1875 struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1876 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1877 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
|
1878 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
|
1879 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
|
1880 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1881 if (pass->gate == NULL || pass->gate ()) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1882 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1883 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
|
1884 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1885 /* 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
|
1886 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
|
1887 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
|
1888 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1889 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
|
1890 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1891 /* 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
|
1892 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
|
1893 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
|
1894 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1895 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1896 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
|
1897 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
|
1898 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1899 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
|
1900 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1901 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1902 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1903 /* Read all the summaries for all_regular_ipa_passes and all_lto_gen_passes. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1904 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1905 void |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1906 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
|
1907 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1908 ipa_read_optimization_summaries_1 (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
|
1909 ipa_read_optimization_summaries_1 (all_lto_gen_passes); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1910 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1911 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1912 /* 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
|
1913 are local passes. */ |
0 | 1914 void |
1915 execute_ipa_pass_list (struct opt_pass *pass) | |
1916 { | |
1917 do | |
1918 { | |
1919 gcc_assert (!current_function_decl); | |
1920 gcc_assert (!cfun); | |
1921 gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS); | |
1922 if (execute_one_pass (pass) && pass->sub) | |
1923 { | |
1924 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
|
1925 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1926 invoke_plugin_callbacks (PLUGIN_EARLY_GIMPLE_PASSES_START, NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1927 do_per_function_toporder ((void (*)(void *))execute_pass_list, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1928 pass->sub); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1929 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
|
1930 } |
0 | 1931 else if (pass->sub->type == SIMPLE_IPA_PASS |
1932 || pass->sub->type == IPA_PASS) | |
1933 execute_ipa_pass_list (pass->sub); | |
1934 else | |
1935 gcc_unreachable (); | |
1936 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1937 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
|
1938 cgraph_process_new_functions (); |
0 | 1939 pass = pass->next; |
1940 } | |
1941 while (pass); | |
1942 } | |
1943 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1944 /* 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
|
1945 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1946 static void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1947 execute_ipa_stmt_fixups (struct opt_pass *pass, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1948 struct cgraph_node *node, gimple *stmts) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1949 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1950 while (pass) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1951 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1952 /* 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
|
1953 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
|
1954 && (!pass->gate || pass->gate ())) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1955 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1956 struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1957 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1958 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
|
1959 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1960 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
|
1961 /* 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
|
1962 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
|
1963 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
|
1964 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1965 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
|
1966 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1967 /* Stop timevar. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1968 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
|
1969 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
|
1970 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
|
1971 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1972 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
|
1973 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
|
1974 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1975 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
|
1976 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1977 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1978 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1979 /* 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
|
1980 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1981 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1982 execute_all_ipa_stmt_fixups (struct cgraph_node *node, gimple *stmts) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1983 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1984 execute_ipa_stmt_fixups (all_regular_ipa_passes, node, stmts); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1985 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1986 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1987 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1988 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
|
1989 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
|
1990 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1991 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1992 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
|
1993 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1994 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
|
1995 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
|
1996 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
|
1997 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
|
1998 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
|
1999 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
|
2000 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
|
2001 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
|
2002 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
|
2003 if (props & PROP_referenced_vars) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2004 fprintf (dump, "PROP_referenced_vars\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2005 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
|
2006 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
|
2007 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
|
2008 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
|
2009 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
|
2010 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
|
2011 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
|
2012 fprintf (dump, "PROP_gimple_lomp\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
|
2013 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
|
2014 fprintf (dump, "PROP_gimple_lcx\n"); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2015 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2016 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2017 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2018 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
|
2019 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2020 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
|
2021 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2022 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2023 /* 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
|
2024 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
|
2025 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
|
2026 bool |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2027 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
|
2028 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2029 struct cgraph_edge *e; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2030 for (e = cgraph_node (current_function_decl)->callers; e; e = e->next_caller) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2031 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2032 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
|
2033 continue; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2034 if (!e->caller->analyzed) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2035 continue; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2036 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
|
2037 continue; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2038 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
|
2039 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2040 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2041 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
|
2042 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2043 fprintf (dump_file, "Already processed call to:\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2044 dump_cgraph_node (dump_file, e->caller); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2045 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2046 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
|
2047 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2048 |
0 | 2049 #include "gt-passes.h" |