tree.h (PHI_CHAIN): New.
[gcc.git] / gcc / passes.c
1 /* Top level of GCC compilers (cc1, cc1plus, etc.)
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
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 #undef FLOAT /* This is for hpux. They should change hpux. */
29 #undef FFS /* Some systems define this in param.h. */
30 #include "system.h"
31 #include "coretypes.h"
32 #include "tm.h"
33 #include <signal.h>
34
35 #ifdef HAVE_SYS_RESOURCE_H
36 # include <sys/resource.h>
37 #endif
38
39 #ifdef HAVE_SYS_TIMES_H
40 # include <sys/times.h>
41 #endif
42
43 #include "line-map.h"
44 #include "input.h"
45 #include "tree.h"
46 #include "rtl.h"
47 #include "tm_p.h"
48 #include "flags.h"
49 #include "insn-attr.h"
50 #include "insn-config.h"
51 #include "insn-flags.h"
52 #include "hard-reg-set.h"
53 #include "recog.h"
54 #include "output.h"
55 #include "except.h"
56 #include "function.h"
57 #include "toplev.h"
58 #include "expr.h"
59 #include "basic-block.h"
60 #include "intl.h"
61 #include "ggc.h"
62 #include "graph.h"
63 #include "loop.h"
64 #include "regs.h"
65 #include "timevar.h"
66 #include "diagnostic.h"
67 #include "params.h"
68 #include "reload.h"
69 #include "dwarf2asm.h"
70 #include "integrate.h"
71 #include "real.h"
72 #include "debug.h"
73 #include "target.h"
74 #include "langhooks.h"
75 #include "cfglayout.h"
76 #include "cfgloop.h"
77 #include "hosthooks.h"
78 #include "cgraph.h"
79 #include "opts.h"
80 #include "coverage.h"
81 #include "value-prof.h"
82 #include "alloc-pool.h"
83 #include "tree-pass.h"
84
85 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
86 #include "dwarf2out.h"
87 #endif
88
89 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
90 #include "dbxout.h"
91 #endif
92
93 #ifdef SDB_DEBUGGING_INFO
94 #include "sdbout.h"
95 #endif
96
97 #ifdef XCOFF_DEBUGGING_INFO
98 #include "xcoffout.h" /* Needed for external data
99 declarations for e.g. AIX 4.x. */
100 #endif
101
102 #ifndef HAVE_conditional_execution
103 #define HAVE_conditional_execution 0
104 #endif
105
106 /* Format to use to print dumpfile index value */
107 #ifndef DUMPFILE_FORMAT
108 #define DUMPFILE_FORMAT ".%02d."
109 #endif
110
111 /* Describes a dump file. */
112
113 struct dump_file_info
114 {
115 /* The unique extension to apply, e.g. ".jump". */
116 const char *const extension;
117
118 /* The -d<c> character that enables this dump file. */
119 char const debug_switch;
120
121 /* True if there is a corresponding graph dump file. */
122 char const graph_dump_p;
123
124 /* True if the user selected this dump. */
125 char enabled;
126
127 /* True if the files have been initialized (ie truncated). */
128 char initialized;
129 };
130
131 /* Enumerate the extant dump files. */
132
133 enum dump_file_index
134 {
135 DFI_cgraph,
136 DFI_rtl,
137 DFI_sibling,
138 DFI_eh,
139 DFI_jump,
140 DFI_null,
141 DFI_cse,
142 DFI_addressof,
143 DFI_gcse,
144 DFI_loop,
145 DFI_bypass,
146 DFI_cfg,
147 DFI_bp,
148 DFI_vpt,
149 DFI_ce1,
150 DFI_tracer,
151 DFI_loop2,
152 DFI_web,
153 DFI_cse2,
154 DFI_life,
155 DFI_combine,
156 DFI_ce2,
157 DFI_regmove,
158 DFI_sms,
159 DFI_sched,
160 DFI_lreg,
161 DFI_greg,
162 DFI_postreload,
163 DFI_gcse2,
164 DFI_flow2,
165 DFI_peephole2,
166 DFI_ce3,
167 DFI_rnreg,
168 DFI_bbro,
169 DFI_branch_target_load,
170 DFI_sched2,
171 DFI_stack,
172 DFI_vartrack,
173 DFI_mach,
174 DFI_dbr,
175 DFI_MAX
176 };
177
178 /* Describes all the dump files. Should be kept in order of the
179 pass and in sync with dump_file_index above.
180
181 Remaining -d letters:
182
183 " e q "
184 " K O Q WXY "
185 */
186
187 static struct dump_file_info dump_file_tbl[DFI_MAX] =
188 {
189 { "cgraph", 'U', 0, 0, 0 },
190 { "rtl", 'r', 0, 0, 0 },
191 { "sibling", 'i', 0, 0, 0 },
192 { "eh", 'h', 0, 0, 0 },
193 { "jump", 'j', 0, 0, 0 },
194 { "null", 'u', 0, 0, 0 },
195 { "cse", 's', 0, 0, 0 },
196 { "addressof", 'F', 0, 0, 0 },
197 { "gcse", 'G', 1, 0, 0 },
198 { "loop", 'L', 1, 0, 0 },
199 { "bypass", 'G', 1, 0, 0 }, /* Yes, duplicate enable switch. */
200 { "cfg", 'f', 1, 0, 0 },
201 { "bp", 'b', 1, 0, 0 },
202 { "vpt", 'V', 1, 0, 0 },
203 { "ce1", 'C', 1, 0, 0 },
204 { "tracer", 'T', 1, 0, 0 },
205 { "loop2", 'L', 1, 0, 0 },
206 { "web", 'Z', 0, 0, 0 },
207 { "cse2", 't', 1, 0, 0 },
208 { "life", 'f', 1, 0, 0 }, /* Yes, duplicate enable switch. */
209 { "combine", 'c', 1, 0, 0 },
210 { "ce2", 'C', 1, 0, 0 },
211 { "regmove", 'N', 1, 0, 0 },
212 { "sms", 'm', 0, 0, 0 },
213 { "sched", 'S', 1, 0, 0 },
214 { "lreg", 'l', 1, 0, 0 },
215 { "greg", 'g', 1, 0, 0 },
216 { "postreload", 'o', 1, 0, 0 },
217 { "gcse2", 'J', 0, 0, 0 },
218 { "flow2", 'w', 1, 0, 0 },
219 { "peephole2", 'z', 1, 0, 0 },
220 { "ce3", 'E', 1, 0, 0 },
221 { "rnreg", 'n', 1, 0, 0 },
222 { "bbro", 'B', 1, 0, 0 },
223 { "btl", 'd', 1, 0, 0 }, /* Yes, duplicate enable switch. */
224 { "sched2", 'R', 1, 0, 0 },
225 { "stack", 'k', 1, 0, 0 },
226 { "vartrack", 'V', 1, 0, 0 }, /* Yes, duplicate enable switch. */
227 { "mach", 'M', 1, 0, 0 },
228 { "dbr", 'd', 0, 0, 0 },
229 };
230
231 /* Routine to open a dump file. Return true if the dump file is enabled. */
232
233 static int
234 open_dump_file (enum dump_file_index index, tree decl)
235 {
236 char *dump_name;
237 const char *open_arg;
238 char seq[16];
239
240 if (! dump_file_tbl[index].enabled)
241 return 0;
242
243 timevar_push (TV_DUMP);
244 if (dump_file != NULL)
245 fclose (dump_file);
246
247 sprintf (seq, DUMPFILE_FORMAT, index);
248
249 if (! dump_file_tbl[index].initialized)
250 {
251 /* If we've not initialized the files, do so now. */
252 if (graph_dump_format != no_graph
253 && dump_file_tbl[index].graph_dump_p)
254 {
255 dump_name = concat (seq, dump_file_tbl[index].extension, NULL);
256 clean_graph_dump_file (dump_base_name, dump_name);
257 free (dump_name);
258 }
259 dump_file_tbl[index].initialized = 1;
260 open_arg = "w";
261 }
262 else
263 open_arg = "a";
264
265 dump_name = concat (dump_base_name, seq,
266 dump_file_tbl[index].extension, NULL);
267
268 dump_file = fopen (dump_name, open_arg);
269 if (dump_file == NULL)
270 fatal_error ("can't open %s: %m", dump_name);
271
272 free (dump_name);
273
274 if (decl)
275 fprintf (dump_file, "\n;; Function %s%s\n\n",
276 lang_hooks.decl_printable_name (decl, 2),
277 cfun->function_frequency == FUNCTION_FREQUENCY_HOT
278 ? " (hot)"
279 : cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED
280 ? " (unlikely executed)"
281 : "");
282
283 timevar_pop (TV_DUMP);
284 return 1;
285 }
286
287 /* Routine to close a dump file. */
288
289 static void
290 close_dump_file (enum dump_file_index index,
291 void (*func) (FILE *, rtx),
292 rtx insns)
293 {
294 if (! dump_file)
295 return;
296
297 timevar_push (TV_DUMP);
298 if (insns
299 && graph_dump_format != no_graph
300 && dump_file_tbl[index].graph_dump_p)
301 {
302 char seq[16];
303 char *suffix;
304
305 sprintf (seq, DUMPFILE_FORMAT, index);
306 suffix = concat (seq, dump_file_tbl[index].extension, NULL);
307 print_rtl_graph_with_bb (dump_base_name, suffix, insns);
308 free (suffix);
309 }
310
311 if (func && insns)
312 func (dump_file, insns);
313
314 fflush (dump_file);
315 fclose (dump_file);
316
317 dump_file = NULL;
318 timevar_pop (TV_DUMP);
319 }
320
321 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
322 and TYPE_DECL nodes.
323
324 This does nothing for local (non-static) variables, unless the
325 variable is a register variable with an ASMSPEC. In that case, or
326 if the variable is not an automatic, it sets up the RTL and
327 outputs any assembler code (label definition, storage allocation
328 and initialization).
329
330 DECL is the declaration. If ASMSPEC is nonzero, it specifies
331 the assembler symbol name to be used. TOP_LEVEL is nonzero
332 if this declaration is not within a function. */
333
334 void
335 rest_of_decl_compilation (tree decl,
336 const char *asmspec,
337 int top_level,
338 int at_end)
339 {
340 /* We deferred calling assemble_alias so that we could collect
341 other attributes such as visibility. Emit the alias now. */
342 {
343 tree alias;
344 alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl));
345 if (alias)
346 {
347 alias = TREE_VALUE (TREE_VALUE (alias));
348 alias = get_identifier (TREE_STRING_POINTER (alias));
349 assemble_alias (decl, alias);
350 }
351 }
352
353 /* Forward declarations for nested functions are not "external",
354 but we need to treat them as if they were. */
355 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
356 || TREE_CODE (decl) == FUNCTION_DECL)
357 {
358 timevar_push (TV_VARCONST);
359
360 if (asmspec)
361 make_decl_rtl (decl, asmspec);
362
363 /* Don't output anything when a tentative file-scope definition
364 is seen. But at end of compilation, do output code for them.
365
366 We do output all variables when unit-at-a-time is active and rely on
367 callgraph code to defer them except for forward declarations
368 (see gcc.c-torture/compile/920624-1.c) */
369 if ((at_end
370 || !DECL_DEFER_OUTPUT (decl)
371 || (flag_unit_at_a_time && DECL_INITIAL (decl)))
372 && !DECL_EXTERNAL (decl))
373 {
374 if (flag_unit_at_a_time && !cgraph_global_info_ready
375 && TREE_CODE (decl) != FUNCTION_DECL && top_level)
376 cgraph_varpool_finalize_decl (decl);
377 else
378 assemble_variable (decl, top_level, at_end, 0);
379 }
380
381 #ifdef ASM_FINISH_DECLARE_OBJECT
382 if (decl == last_assemble_variable_decl)
383 {
384 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
385 top_level, at_end);
386 }
387 #endif
388
389 timevar_pop (TV_VARCONST);
390 }
391 else if (DECL_REGISTER (decl) && asmspec != 0)
392 {
393 if (decode_reg_name (asmspec) >= 0)
394 {
395 SET_DECL_RTL (decl, NULL_RTX);
396 make_decl_rtl (decl, asmspec);
397 }
398 else
399 {
400 error ("%Hinvalid register name `%s' for register variable",
401 &DECL_SOURCE_LOCATION (decl), asmspec);
402 DECL_REGISTER (decl) = 0;
403 if (!top_level)
404 expand_decl (decl);
405 }
406 }
407 else if (TREE_CODE (decl) == TYPE_DECL)
408 {
409 timevar_push (TV_SYMOUT);
410 debug_hooks->type_decl (decl, !top_level);
411 timevar_pop (TV_SYMOUT);
412 }
413 }
414
415 /* Called after finishing a record, union or enumeral type. */
416
417 void
418 rest_of_type_compilation (tree type, int toplev)
419 {
420 /* Avoid confusing the debug information machinery when there are
421 errors. */
422 if (errorcount != 0 || sorrycount != 0)
423 return;
424
425 timevar_push (TV_SYMOUT);
426 debug_hooks->type_decl (TYPE_STUB_DECL (type), !toplev);
427 timevar_pop (TV_SYMOUT);
428 }
429
430 /* Turn the RTL into assembly. */
431 static void
432 rest_of_handle_final (tree decl, rtx insns)
433 {
434 if (decl != current_function_decl || insns != get_insns ())
435 abort ();
436
437 timevar_push (TV_FINAL);
438 {
439 rtx x;
440 const char *fnname;
441
442 /* Get the function's name, as described by its RTL. This may be
443 different from the DECL_NAME name used in the source file. */
444
445 x = DECL_RTL (decl);
446 if (GET_CODE (x) != MEM)
447 abort ();
448 x = XEXP (x, 0);
449 if (GET_CODE (x) != SYMBOL_REF)
450 abort ();
451 fnname = XSTR (x, 0);
452
453 assemble_start_function (decl, fnname);
454 final_start_function (insns, asm_out_file, optimize);
455 final (insns, asm_out_file, optimize, 0);
456 final_end_function ();
457
458 #ifdef IA64_UNWIND_INFO
459 /* ??? The IA-64 ".handlerdata" directive must be issued before
460 the ".endp" directive that closes the procedure descriptor. */
461 output_function_exception_table ();
462 #endif
463
464 assemble_end_function (decl, fnname);
465
466 #ifndef IA64_UNWIND_INFO
467 /* Otherwise, it feels unclean to switch sections in the middle. */
468 output_function_exception_table ();
469 #endif
470
471 if (! quiet_flag)
472 fflush (asm_out_file);
473
474 /* Release all memory allocated by flow. */
475 free_basic_block_vars ();
476
477 /* Release all memory held by regsets now. */
478 regset_release_memory ();
479 }
480 timevar_pop (TV_FINAL);
481
482 ggc_collect ();
483 }
484
485 #ifdef DELAY_SLOTS
486 /* Run delay slot optimization. */
487 static void
488 rest_of_handle_delay_slots (tree decl, rtx insns)
489 {
490 if (decl != current_function_decl || insns != get_insns ())
491 abort ();
492
493 timevar_push (TV_DBR_SCHED);
494 open_dump_file (DFI_dbr, decl);
495
496 dbr_schedule (insns, dump_file);
497
498 close_dump_file (DFI_dbr, print_rtl, insns);
499 timevar_pop (TV_DBR_SCHED);
500
501 ggc_collect ();
502 }
503 #endif
504
505 #ifdef STACK_REGS
506 /* Convert register usage from flat register file usage to a stack
507 register file. */
508 static void
509 rest_of_handle_stack_regs (tree decl, rtx insns)
510 {
511 if (decl != current_function_decl || insns != get_insns ())
512 abort ();
513
514 #if defined (HAVE_ATTR_length)
515 /* If flow2 creates new instructions which need splitting
516 and scheduling after reload is not done, they might not be
517 split until final which doesn't allow splitting
518 if HAVE_ATTR_length. */
519 #ifdef INSN_SCHEDULING
520 if (optimize && !flag_schedule_insns_after_reload)
521 #else
522 if (optimize)
523 #endif
524 {
525 timevar_push (TV_SHORTEN_BRANCH);
526 split_all_insns (1);
527 timevar_pop (TV_SHORTEN_BRANCH);
528 }
529 #endif
530
531 timevar_push (TV_REG_STACK);
532 open_dump_file (DFI_stack, decl);
533
534 if (reg_to_stack (dump_file) && optimize)
535 {
536 if (cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
537 | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0))
538 && (flag_reorder_blocks || flag_reorder_blocks_and_partition))
539 {
540 reorder_basic_blocks ();
541 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK);
542 }
543 }
544
545 close_dump_file (DFI_stack, print_rtl_with_bb, insns);
546 timevar_pop (TV_REG_STACK);
547
548 ggc_collect ();
549 }
550 #endif
551
552 /* Track the variables, ie. compute where the variable is stored at each position in function. */
553 static void
554 rest_of_handle_variable_tracking (tree decl, rtx insns)
555 {
556 if (decl != current_function_decl || insns != get_insns ())
557 abort ();
558
559 timevar_push (TV_VAR_TRACKING);
560 open_dump_file (DFI_vartrack, decl);
561
562 variable_tracking_main ();
563
564 close_dump_file (DFI_vartrack, print_rtl_with_bb, insns);
565 timevar_pop (TV_VAR_TRACKING);
566 }
567
568 /* Machine independent reorg pass. */
569 static void
570 rest_of_handle_machine_reorg (tree decl, rtx insns)
571 {
572 if (decl != current_function_decl || insns != get_insns ())
573 abort ();
574
575 timevar_push (TV_MACH_DEP);
576 open_dump_file (DFI_mach, decl);
577
578 targetm.machine_dependent_reorg ();
579
580 close_dump_file (DFI_mach, print_rtl, insns);
581 timevar_pop (TV_MACH_DEP);
582
583 ggc_collect ();
584 }
585
586
587 /* Run new register allocator. Return TRUE if we must exit
588 rest_of_compilation upon return. */
589 static bool
590 rest_of_handle_new_regalloc (tree decl, rtx insns)
591 {
592 int failure;
593
594 if (decl != current_function_decl || insns != get_insns ())
595 abort ();
596
597 delete_trivially_dead_insns (insns, max_reg_num ());
598 reg_alloc ();
599
600 timevar_pop (TV_LOCAL_ALLOC);
601 if (dump_file_tbl[DFI_lreg].enabled)
602 {
603 timevar_push (TV_DUMP);
604
605 close_dump_file (DFI_lreg, NULL, NULL);
606 timevar_pop (TV_DUMP);
607 }
608
609 /* XXX clean up the whole mess to bring live info in shape again. */
610 timevar_push (TV_GLOBAL_ALLOC);
611 open_dump_file (DFI_greg, decl);
612
613 build_insn_chain (insns);
614 failure = reload (insns, 0);
615
616 timevar_pop (TV_GLOBAL_ALLOC);
617
618 if (dump_file_tbl[DFI_greg].enabled)
619 {
620 timevar_push (TV_DUMP);
621
622 dump_global_regs (dump_file);
623
624 close_dump_file (DFI_greg, print_rtl_with_bb, insns);
625 timevar_pop (TV_DUMP);
626 }
627
628 if (failure)
629 return true;
630
631 reload_completed = 1;
632
633 return false;
634 }
635
636 /* Run old register allocator. Return TRUE if we must exit
637 rest_of_compilation upon return. */
638 static bool
639 rest_of_handle_old_regalloc (tree decl, rtx insns)
640 {
641 int failure;
642 int rebuild_notes;
643
644 if (decl != current_function_decl || insns != get_insns ())
645 abort ();
646
647 /* Allocate the reg_renumber array. */
648 allocate_reg_info (max_regno, FALSE, TRUE);
649
650 /* And the reg_equiv_memory_loc array. */
651 VARRAY_GROW (reg_equiv_memory_loc_varray, max_regno);
652 reg_equiv_memory_loc = &VARRAY_RTX (reg_equiv_memory_loc_varray, 0);
653
654 allocate_initial_values (reg_equiv_memory_loc);
655
656 regclass (insns, max_reg_num (), dump_file);
657 rebuild_notes = local_alloc ();
658
659 timevar_pop (TV_LOCAL_ALLOC);
660
661 /* Local allocation may have turned an indirect jump into a direct
662 jump. If so, we must rebuild the JUMP_LABEL fields of jumping
663 instructions. */
664 if (rebuild_notes)
665 {
666 timevar_push (TV_JUMP);
667
668 rebuild_jump_labels (insns);
669 purge_all_dead_edges (0);
670
671 timevar_pop (TV_JUMP);
672 }
673
674 if (dump_file_tbl[DFI_lreg].enabled)
675 {
676 timevar_push (TV_DUMP);
677
678 dump_flow_info (dump_file);
679 dump_local_alloc (dump_file);
680
681 close_dump_file (DFI_lreg, print_rtl_with_bb, insns);
682 timevar_pop (TV_DUMP);
683 }
684
685 ggc_collect ();
686
687 timevar_push (TV_GLOBAL_ALLOC);
688 open_dump_file (DFI_greg, decl);
689
690 /* If optimizing, allocate remaining pseudo-regs. Do the reload
691 pass fixing up any insns that are invalid. */
692
693 if (optimize)
694 failure = global_alloc (dump_file);
695 else
696 {
697 build_insn_chain (insns);
698 failure = reload (insns, 0);
699 }
700
701 timevar_pop (TV_GLOBAL_ALLOC);
702
703 if (dump_file_tbl[DFI_greg].enabled)
704 {
705 timevar_push (TV_DUMP);
706
707 dump_global_regs (dump_file);
708
709 close_dump_file (DFI_greg, print_rtl_with_bb, insns);
710 timevar_pop (TV_DUMP);
711 }
712
713 return failure;
714 }
715
716 /* Run the regrename and cprop passes. */
717 static void
718 rest_of_handle_regrename (tree decl, rtx insns)
719 {
720 if (decl != current_function_decl || insns != get_insns ())
721 abort ();
722
723 timevar_push (TV_RENAME_REGISTERS);
724 open_dump_file (DFI_rnreg, decl);
725
726 if (flag_rename_registers)
727 regrename_optimize ();
728 if (flag_cprop_registers)
729 copyprop_hardreg_forward ();
730
731 close_dump_file (DFI_rnreg, print_rtl_with_bb, insns);
732 timevar_pop (TV_RENAME_REGISTERS);
733 }
734
735 /* Reorder basic blocks. */
736 static void
737 rest_of_handle_reorder_blocks (tree decl, rtx insns)
738 {
739 bool changed;
740 open_dump_file (DFI_bbro, decl);
741
742 if (decl != current_function_decl || insns != get_insns ())
743 abort ();
744
745 /* Last attempt to optimize CFG, as scheduling, peepholing and insn
746 splitting possibly introduced more crossjumping opportunities. */
747 changed = cleanup_cfg (CLEANUP_EXPENSIVE
748 | (!HAVE_conditional_execution
749 ? CLEANUP_UPDATE_LIFE : 0));
750
751 if (flag_sched2_use_traces && flag_schedule_insns_after_reload)
752 tracer ();
753 if (flag_reorder_blocks || flag_reorder_blocks_and_partition)
754 reorder_basic_blocks ();
755 if (flag_reorder_blocks || flag_reorder_blocks_and_partition
756 || (flag_sched2_use_traces && flag_schedule_insns_after_reload))
757 changed |= cleanup_cfg (CLEANUP_EXPENSIVE
758 | (!HAVE_conditional_execution
759 ? CLEANUP_UPDATE_LIFE : 0));
760
761 /* On conditional execution targets we can not update the life cheaply, so
762 we deffer the updating to after both cleanups. This may lose some cases
763 but should not be terribly bad. */
764 if (changed && HAVE_conditional_execution)
765 update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
766 PROP_DEATH_NOTES);
767 close_dump_file (DFI_bbro, print_rtl_with_bb, insns);
768 }
769
770 #ifdef INSN_SCHEDULING
771 /* Run instruction scheduler. */
772 static void
773 rest_of_handle_sched (tree decl, rtx insns)
774 {
775 if (decl != current_function_decl || insns != get_insns ())
776 abort ();
777
778 timevar_push (TV_SMS);
779 if (optimize > 0 && flag_modulo_sched)
780 {
781
782 /* Perform SMS module scheduling. */
783 open_dump_file (DFI_sms, decl);
784
785 /* We want to be able to create new pseudos. */
786 no_new_pseudos = 0;
787 sms_schedule (dump_file);
788 close_dump_file (DFI_sms, print_rtl, get_insns ());
789
790
791 /* Update the life information, becuase we add pseudos. */
792 max_regno = max_reg_num ();
793 allocate_reg_info (max_regno, FALSE, FALSE);
794 update_life_info_in_dirty_blocks (UPDATE_LIFE_GLOBAL_RM_NOTES,
795 (PROP_DEATH_NOTES
796 | PROP_KILL_DEAD_CODE
797 | PROP_SCAN_DEAD_CODE));
798 no_new_pseudos = 1;
799 }
800 timevar_pop (TV_SMS);
801 timevar_push (TV_SCHED);
802
803 /* Print function header into sched dump now
804 because doing the sched analysis makes some of the dump. */
805 if (optimize > 0 && flag_schedule_insns)
806 {
807 open_dump_file (DFI_sched, decl);
808
809 /* Do control and data sched analysis,
810 and write some of the results to dump file. */
811
812 schedule_insns (dump_file);
813
814 close_dump_file (DFI_sched, print_rtl_with_bb, insns);
815 }
816 timevar_pop (TV_SCHED);
817
818 ggc_collect ();
819 }
820
821 /* Run second scheduling pass after reload. */
822 static void
823 rest_of_handle_sched2 (tree decl, rtx insns)
824 {
825 if (decl != current_function_decl || insns != get_insns ())
826 abort ();
827
828 timevar_push (TV_SCHED2);
829 open_dump_file (DFI_sched2, decl);
830
831 /* Do control and data sched analysis again,
832 and write some more of the results to dump file. */
833
834 split_all_insns (1);
835
836 if (flag_sched2_use_superblocks || flag_sched2_use_traces)
837 {
838 schedule_ebbs (dump_file);
839 /* No liveness updating code yet, but it should be easy to do.
840 reg-stack recomputes the liveness when needed for now. */
841 count_or_remove_death_notes (NULL, 1);
842 cleanup_cfg (CLEANUP_EXPENSIVE);
843 }
844 else
845 schedule_insns (dump_file);
846
847 close_dump_file (DFI_sched2, print_rtl_with_bb, insns);
848 timevar_pop (TV_SCHED2);
849
850 ggc_collect ();
851 }
852 #endif
853
854 static void
855 rest_of_handle_gcse2 (tree decl, rtx insns)
856 {
857 if (decl != current_function_decl || insns != get_insns ())
858 abort ();
859
860 open_dump_file (DFI_gcse2, decl);
861
862 gcse_after_reload_main (insns, dump_file);
863 rebuild_jump_labels (insns);
864 delete_trivially_dead_insns (insns, max_reg_num ());
865 close_dump_file (DFI_gcse2, print_rtl_with_bb, insns);
866
867 ggc_collect ();
868
869 #ifdef ENABLE_CHECKING
870 verify_flow_info ();
871 #endif
872 }
873
874 /* Register allocation pre-pass, to reduce number of moves necessary
875 for two-address machines. */
876 static void
877 rest_of_handle_regmove (tree decl, rtx insns)
878 {
879 if (decl != current_function_decl || insns != get_insns ())
880 abort ();
881
882 timevar_push (TV_REGMOVE);
883 open_dump_file (DFI_regmove, decl);
884
885 regmove_optimize (insns, max_reg_num (), dump_file);
886
887 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
888 close_dump_file (DFI_regmove, print_rtl_with_bb, insns);
889 timevar_pop (TV_REGMOVE);
890
891 ggc_collect ();
892 }
893
894 /* Run tracer. */
895 static void
896 rest_of_handle_tracer (tree decl, rtx insns)
897 {
898 if (decl != current_function_decl || insns != get_insns ())
899 abort ();
900
901 open_dump_file (DFI_tracer, decl);
902 if (dump_file)
903 dump_flow_info (dump_file);
904 tracer ();
905 cleanup_cfg (CLEANUP_EXPENSIVE);
906 reg_scan (insns, max_reg_num (), 0);
907 close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ());
908 }
909
910 /* If-conversion and CFG cleanup. */
911 static void
912 rest_of_handle_if_conversion (tree decl, rtx insns)
913 {
914 if (decl != current_function_decl || insns != get_insns ())
915 abort ();
916
917 open_dump_file (DFI_ce1, decl);
918 if (flag_if_conversion)
919 {
920 timevar_push (TV_IFCVT);
921 if (dump_file)
922 dump_flow_info (dump_file);
923 cleanup_cfg (CLEANUP_EXPENSIVE);
924 reg_scan (insns, max_reg_num (), 0);
925 if_convert (0);
926 timevar_pop (TV_IFCVT);
927 }
928 timevar_push (TV_JUMP);
929 cleanup_cfg (CLEANUP_EXPENSIVE);
930 reg_scan (insns, max_reg_num (), 0);
931 timevar_pop (TV_JUMP);
932 close_dump_file (DFI_ce1, print_rtl_with_bb, get_insns ());
933 }
934
935 /* Rerun if-conversion, as combine may have simplified things enough
936 to now meet sequence length restrictions. */
937 static void
938 rest_of_handle_if_after_combine (tree decl, rtx insns)
939 {
940 if (decl != current_function_decl || insns != get_insns ())
941 abort ();
942
943 timevar_push (TV_IFCVT);
944 open_dump_file (DFI_ce2, decl);
945
946 no_new_pseudos = 0;
947 if_convert (1);
948 no_new_pseudos = 1;
949
950 close_dump_file (DFI_ce2, print_rtl_with_bb, insns);
951 timevar_pop (TV_IFCVT);
952 }
953
954 static void
955 rest_of_handle_web (tree decl, rtx insns)
956 {
957 if (decl != current_function_decl || insns != get_insns ())
958 abort ();
959
960 open_dump_file (DFI_web, decl);
961 timevar_push (TV_WEB);
962 web_main ();
963 delete_trivially_dead_insns (insns, max_reg_num ());
964 cleanup_cfg (CLEANUP_EXPENSIVE);
965
966 timevar_pop (TV_WEB);
967 close_dump_file (DFI_web, print_rtl_with_bb, insns);
968 reg_scan (get_insns (), max_reg_num (), 0);
969 }
970
971 /* Do branch profiling and static profile estimation passes. */
972 static void
973 rest_of_handle_branch_prob (tree decl, rtx insns)
974 {
975 struct loops loops;
976 if (decl != current_function_decl || insns != get_insns ())
977 abort ();
978
979 timevar_push (TV_BRANCH_PROB);
980 open_dump_file (DFI_bp, decl);
981
982 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
983 branch_prob ();
984
985 /* Discover and record the loop depth at the head of each basic
986 block. The loop infrastructure does the real job for us. */
987 flow_loops_find (&loops, LOOP_TREE);
988
989 if (dump_file)
990 flow_loops_dump (&loops, dump_file, NULL, 0);
991
992 /* Estimate using heuristics if no profiling info is available. */
993 if (flag_guess_branch_prob)
994 estimate_probability (&loops);
995
996 flow_loops_free (&loops);
997 free_dominance_info (CDI_DOMINATORS);
998 close_dump_file (DFI_bp, print_rtl_with_bb, insns);
999 timevar_pop (TV_BRANCH_PROB);
1000 }
1001
1002 /* Do optimizations based on expression value profiles. */
1003 static void
1004 rest_of_handle_value_profile_transformations (tree decl, rtx insns)
1005 {
1006 if (decl != current_function_decl || insns != get_insns ())
1007 abort ();
1008
1009 open_dump_file (DFI_vpt, decl);
1010 timevar_push (TV_VPT);
1011
1012 if (value_profile_transformations ())
1013 cleanup_cfg (CLEANUP_EXPENSIVE);
1014
1015 timevar_pop (TV_VPT);
1016 close_dump_file (DFI_vpt, print_rtl_with_bb, insns);
1017 }
1018
1019 /* Do control and data flow analysis; write some of the results to the
1020 dump file. */
1021 static void
1022 rest_of_handle_cfg (tree decl, rtx insns)
1023 {
1024 if (decl != current_function_decl || insns != get_insns ())
1025 abort ();
1026
1027 open_dump_file (DFI_cfg, decl);
1028 if (dump_file)
1029 dump_flow_info (dump_file);
1030 if (optimize)
1031 cleanup_cfg (CLEANUP_EXPENSIVE
1032 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
1033
1034 /* It may make more sense to mark constant functions after dead code is
1035 eliminated by life_analysis, but we need to do it early, as -fprofile-arcs
1036 may insert code making function non-constant, but we still must consider
1037 it as constant, otherwise -fbranch-probabilities will not read data back.
1038
1039 life_analysis rarely eliminates modification of external memory.
1040 */
1041 if (optimize)
1042 {
1043 /* Alias analysis depends on this information and mark_constant_function
1044 depends on alias analysis. */
1045 reg_scan (insns, max_reg_num (), 1);
1046 mark_constant_function ();
1047 }
1048
1049 close_dump_file (DFI_cfg, print_rtl_with_bb, insns);
1050 }
1051
1052 /* Purge addressofs. */
1053 static void
1054 rest_of_handle_addressof (tree decl, rtx insns)
1055 {
1056 if (decl != current_function_decl || insns != get_insns ())
1057 abort ();
1058
1059 open_dump_file (DFI_addressof, decl);
1060
1061 purge_addressof (insns);
1062 if (optimize && purge_all_dead_edges (0))
1063 delete_unreachable_blocks ();
1064 reg_scan (insns, max_reg_num (), 1);
1065
1066 close_dump_file (DFI_addressof, print_rtl, insns);
1067 }
1068
1069 /* Perform jump bypassing and control flow optimizations. */
1070 static void
1071 rest_of_handle_jump_bypass (tree decl, rtx insns)
1072 {
1073 if (decl != current_function_decl || insns != get_insns ())
1074 abort ();
1075
1076 timevar_push (TV_BYPASS);
1077 open_dump_file (DFI_bypass, decl);
1078
1079 cleanup_cfg (CLEANUP_EXPENSIVE);
1080 reg_scan (insns, max_reg_num (), 1);
1081
1082 if (bypass_jumps (dump_file))
1083 {
1084 rebuild_jump_labels (insns);
1085 cleanup_cfg (CLEANUP_EXPENSIVE);
1086 delete_trivially_dead_insns (insns, max_reg_num ());
1087 }
1088
1089 close_dump_file (DFI_bypass, print_rtl_with_bb, insns);
1090 timevar_pop (TV_BYPASS);
1091
1092 ggc_collect ();
1093
1094 #ifdef ENABLE_CHECKING
1095 verify_flow_info ();
1096 #endif
1097 }
1098
1099 /* Try combining insns through substitution. */
1100 static void
1101 rest_of_handle_combine (tree decl, rtx insns)
1102 {
1103 int rebuild_jump_labels_after_combine = 0;
1104
1105 if (decl != current_function_decl || insns != get_insns ())
1106 abort ();
1107
1108 timevar_push (TV_COMBINE);
1109 open_dump_file (DFI_combine, decl);
1110
1111 rebuild_jump_labels_after_combine
1112 = combine_instructions (insns, max_reg_num ());
1113
1114 /* Combining insns may have turned an indirect jump into a
1115 direct jump. Rebuild the JUMP_LABEL fields of jumping
1116 instructions. */
1117 if (rebuild_jump_labels_after_combine)
1118 {
1119 timevar_push (TV_JUMP);
1120 rebuild_jump_labels (insns);
1121 timevar_pop (TV_JUMP);
1122
1123 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
1124 }
1125
1126 close_dump_file (DFI_combine, print_rtl_with_bb, insns);
1127 timevar_pop (TV_COMBINE);
1128
1129 ggc_collect ();
1130 }
1131
1132 /* Perform life analysis. */
1133 static void
1134 rest_of_handle_life (tree decl, rtx insns)
1135 {
1136 if (decl != current_function_decl || insns != get_insns ())
1137 abort ();
1138
1139 open_dump_file (DFI_life, decl);
1140 regclass_init ();
1141
1142 #ifdef ENABLE_CHECKING
1143 verify_flow_info ();
1144 #endif
1145 life_analysis (dump_file, PROP_FINAL);
1146 if (optimize)
1147 cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_UPDATE_LIFE
1148 | CLEANUP_LOG_LINKS
1149 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
1150 timevar_pop (TV_FLOW);
1151
1152 if (extra_warnings)
1153 {
1154 setjmp_vars_warning (DECL_INITIAL (decl));
1155 setjmp_args_warning ();
1156 }
1157
1158 if (optimize)
1159 {
1160 if (!flag_new_regalloc && initialize_uninitialized_subregs ())
1161 {
1162 /* Insns were inserted, and possibly pseudos created, so
1163 things might look a bit different. */
1164 insns = get_insns ();
1165 allocate_reg_life_data ();
1166 update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
1167 PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES);
1168 }
1169 }
1170
1171 no_new_pseudos = 1;
1172
1173 close_dump_file (DFI_life, print_rtl_with_bb, insns);
1174
1175 ggc_collect ();
1176 }
1177
1178 /* Perform common subexpression elimination. Nonzero value from
1179 `cse_main' means that jumps were simplified and some code may now
1180 be unreachable, so do jump optimization again. */
1181 static void
1182 rest_of_handle_cse (tree decl, rtx insns)
1183 {
1184 int tem;
1185 if (decl != current_function_decl || insns != get_insns ())
1186 abort ();
1187
1188 open_dump_file (DFI_cse, decl);
1189 if (dump_file)
1190 dump_flow_info (dump_file);
1191 timevar_push (TV_CSE);
1192
1193 reg_scan (insns, max_reg_num (), 1);
1194
1195 tem = cse_main (insns, max_reg_num (), 0, dump_file);
1196 if (tem)
1197 rebuild_jump_labels (insns);
1198 if (purge_all_dead_edges (0))
1199 delete_unreachable_blocks ();
1200
1201 delete_trivially_dead_insns (insns, max_reg_num ());
1202
1203 /* If we are not running more CSE passes, then we are no longer
1204 expecting CSE to be run. But always rerun it in a cheap mode. */
1205 cse_not_expected = !flag_rerun_cse_after_loop && !flag_gcse;
1206
1207 if (tem || optimize > 1)
1208 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
1209
1210 timevar_pop (TV_CSE);
1211 close_dump_file (DFI_cse, print_rtl_with_bb, insns);
1212 }
1213
1214 /* Run second CSE pass after loop optimizations. */
1215 static void
1216 rest_of_handle_cse2 (tree decl, rtx insns)
1217 {
1218 int tem;
1219 if (decl != current_function_decl || insns != get_insns ())
1220 abort ();
1221
1222 timevar_push (TV_CSE2);
1223 open_dump_file (DFI_cse2, decl);
1224 if (dump_file)
1225 dump_flow_info (dump_file);
1226 /* CFG is no longer maintained up-to-date. */
1227 tem = cse_main (insns, max_reg_num (), 1, dump_file);
1228
1229 /* Run a pass to eliminate duplicated assignments to condition code
1230 registers. We have to run this after bypass_jumps, because it
1231 makes it harder for that pass to determine whether a jump can be
1232 bypassed safely. */
1233 cse_condition_code_reg ();
1234
1235 purge_all_dead_edges (0);
1236 delete_trivially_dead_insns (insns, max_reg_num ());
1237
1238 if (tem)
1239 {
1240 timevar_push (TV_JUMP);
1241 rebuild_jump_labels (insns);
1242 cleanup_cfg (CLEANUP_EXPENSIVE);
1243 timevar_pop (TV_JUMP);
1244 }
1245 reg_scan (insns, max_reg_num (), 0);
1246 close_dump_file (DFI_cse2, print_rtl_with_bb, insns);
1247 ggc_collect ();
1248 timevar_pop (TV_CSE2);
1249 }
1250
1251 /* Perform global cse. */
1252 static void
1253 rest_of_handle_gcse (tree decl, rtx insns)
1254 {
1255 int save_csb, save_cfj;
1256 int tem2 = 0, tem;
1257 if (decl != current_function_decl || insns != get_insns ())
1258 abort ();
1259
1260 timevar_push (TV_GCSE);
1261 open_dump_file (DFI_gcse, decl);
1262
1263 tem = gcse_main (insns, dump_file);
1264 rebuild_jump_labels (insns);
1265 delete_trivially_dead_insns (insns, max_reg_num ());
1266
1267 save_csb = flag_cse_skip_blocks;
1268 save_cfj = flag_cse_follow_jumps;
1269 flag_cse_skip_blocks = flag_cse_follow_jumps = 0;
1270
1271 /* If -fexpensive-optimizations, re-run CSE to clean up things done
1272 by gcse. */
1273 if (flag_expensive_optimizations)
1274 {
1275 timevar_push (TV_CSE);
1276 reg_scan (insns, max_reg_num (), 1);
1277 tem2 = cse_main (insns, max_reg_num (), 0, dump_file);
1278 purge_all_dead_edges (0);
1279 delete_trivially_dead_insns (insns, max_reg_num ());
1280 timevar_pop (TV_CSE);
1281 cse_not_expected = !flag_rerun_cse_after_loop;
1282 }
1283
1284 /* If gcse or cse altered any jumps, rerun jump optimizations to clean
1285 things up. Then possibly re-run CSE again. */
1286 while (tem || tem2)
1287 {
1288 tem = tem2 = 0;
1289 timevar_push (TV_JUMP);
1290 rebuild_jump_labels (insns);
1291 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
1292 timevar_pop (TV_JUMP);
1293
1294 if (flag_expensive_optimizations)
1295 {
1296 timevar_push (TV_CSE);
1297 reg_scan (insns, max_reg_num (), 1);
1298 tem2 = cse_main (insns, max_reg_num (), 0, dump_file);
1299 purge_all_dead_edges (0);
1300 delete_trivially_dead_insns (insns, max_reg_num ());
1301 timevar_pop (TV_CSE);
1302 }
1303 }
1304
1305 close_dump_file (DFI_gcse, print_rtl_with_bb, insns);
1306 timevar_pop (TV_GCSE);
1307
1308 ggc_collect ();
1309 flag_cse_skip_blocks = save_csb;
1310 flag_cse_follow_jumps = save_cfj;
1311 #ifdef ENABLE_CHECKING
1312 verify_flow_info ();
1313 #endif
1314 }
1315
1316 /* Move constant computations out of loops. */
1317 static void
1318 rest_of_handle_loop_optimize (tree decl, rtx insns)
1319 {
1320 int do_unroll, do_prefetch;
1321
1322 if (decl != current_function_decl || insns != get_insns ())
1323 abort ();
1324
1325 timevar_push (TV_LOOP);
1326 delete_dead_jumptables ();
1327 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
1328 open_dump_file (DFI_loop, decl);
1329
1330 /* CFG is no longer maintained up-to-date. */
1331 free_bb_for_insn ();
1332
1333 if (flag_unroll_loops)
1334 do_unroll = LOOP_AUTO_UNROLL; /* Having two unrollers is useless. */
1335 else
1336 do_unroll = flag_old_unroll_loops ? LOOP_UNROLL : LOOP_AUTO_UNROLL;
1337 do_prefetch = flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0;
1338
1339 if (flag_rerun_loop_opt)
1340 {
1341 cleanup_barriers ();
1342
1343 /* We only want to perform unrolling once. */
1344 loop_optimize (insns, dump_file, do_unroll);
1345 do_unroll = 0;
1346
1347 /* The first call to loop_optimize makes some instructions
1348 trivially dead. We delete those instructions now in the
1349 hope that doing so will make the heuristics in loop work
1350 better and possibly speed up compilation. */
1351 delete_trivially_dead_insns (insns, max_reg_num ());
1352
1353 /* The regscan pass is currently necessary as the alias
1354 analysis code depends on this information. */
1355 reg_scan (insns, max_reg_num (), 1);
1356 }
1357 cleanup_barriers ();
1358 loop_optimize (insns, dump_file, do_unroll | do_prefetch);
1359
1360 /* Loop can create trivially dead instructions. */
1361 delete_trivially_dead_insns (insns, max_reg_num ());
1362 close_dump_file (DFI_loop, print_rtl, insns);
1363 timevar_pop (TV_LOOP);
1364 find_basic_blocks (insns, max_reg_num (), dump_file);
1365
1366 ggc_collect ();
1367 }
1368
1369 /* Perform loop optimizations. It might be better to do them a bit
1370 sooner, but we want the profile feedback to work more
1371 efficiently. */
1372 static void
1373 rest_of_handle_loop2 (tree decl, rtx insns)
1374 {
1375 struct loops *loops;
1376 basic_block bb;
1377
1378 if (decl != current_function_decl || insns != get_insns ())
1379 abort ();
1380
1381 if (!flag_unswitch_loops
1382 && !flag_peel_loops
1383 && !flag_unroll_loops
1384 && !flag_branch_on_count_reg)
1385 return;
1386
1387 timevar_push (TV_LOOP);
1388 open_dump_file (DFI_loop2, decl);
1389 if (dump_file)
1390 dump_flow_info (dump_file);
1391
1392 /* Initialize structures for layout changes. */
1393 cfg_layout_initialize ();
1394
1395 loops = loop_optimizer_init (dump_file);
1396
1397 if (loops)
1398 {
1399 /* The optimizations: */
1400 if (flag_unswitch_loops)
1401 unswitch_loops (loops);
1402
1403 if (flag_peel_loops || flag_unroll_loops)
1404 unroll_and_peel_loops (loops,
1405 (flag_peel_loops ? UAP_PEEL : 0) |
1406 (flag_unroll_loops ? UAP_UNROLL : 0) |
1407 (flag_unroll_all_loops ? UAP_UNROLL_ALL : 0));
1408
1409 #ifdef HAVE_doloop_end
1410 if (flag_branch_on_count_reg && HAVE_doloop_end)
1411 doloop_optimize_loops (loops);
1412 #endif /* HAVE_doloop_end */
1413
1414 loop_optimizer_finalize (loops, dump_file);
1415 }
1416
1417 /* Finalize layout changes. */
1418 FOR_EACH_BB (bb)
1419 if (bb->next_bb != EXIT_BLOCK_PTR)
1420 bb->rbi->next = bb->next_bb;
1421 cfg_layout_finalize ();
1422
1423 cleanup_cfg (CLEANUP_EXPENSIVE);
1424 delete_trivially_dead_insns (insns, max_reg_num ());
1425 reg_scan (insns, max_reg_num (), 0);
1426 if (dump_file)
1427 dump_flow_info (dump_file);
1428 close_dump_file (DFI_loop2, print_rtl_with_bb, get_insns ());
1429 timevar_pop (TV_LOOP);
1430 ggc_collect ();
1431 }
1432
1433 /* This is called from finish_function (within langhooks.parse_file)
1434 after each top-level definition is parsed.
1435 It is supposed to compile that function or variable
1436 and output the assembler code for it.
1437 After we return, the tree storage is freed. */
1438
1439 void
1440 rest_of_compilation (void)
1441 {
1442 tree decl = current_function_decl;
1443 rtx insns;
1444
1445
1446 /* There's no need to defer outputting this function any more; we
1447 know we want to output it. */
1448 DECL_DEFER_OUTPUT (current_function_decl) = 0;
1449
1450 /* There's no need to defer outputting this function any more; we
1451 know we want to output it. */
1452 DECL_DEFER_OUTPUT (current_function_decl) = 0;
1453
1454 /* Register rtl specific functions for cfg. */
1455 rtl_register_cfg_hooks ();
1456
1457 /* Now that we're out of the frontend, we shouldn't have any more
1458 CONCATs anywhere. */
1459 generating_concat_p = 0;
1460
1461 /* When processing delayed functions, prepare_function_start() won't
1462 have been run to re-initialize it. */
1463 cse_not_expected = ! optimize;
1464
1465 if (!cfun->dont_emit_block_notes)
1466 {
1467 /* First, make sure that NOTE_BLOCK is set correctly for each
1468 NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
1469 if (!cfun->x_whole_function_mode_p)
1470 identify_blocks ();
1471
1472 /* In function-at-a-time mode, we do not attempt to keep the BLOCK
1473 tree in sensible shape. So, we just recalculate it here. */
1474 if (cfun->x_whole_function_mode_p)
1475 reorder_blocks ();
1476 }
1477 else
1478 finalize_block_changes ();
1479
1480 init_flow ();
1481
1482 /* Dump the rtl code if we are dumping rtl. */
1483 if (open_dump_file (DFI_rtl, decl))
1484 close_dump_file (DFI_rtl, print_rtl, get_insns ());
1485
1486 /* Convert from NOTE_INSN_EH_REGION style notes, and do other
1487 sorts of eh initialization. Delay this until after the
1488 initial rtl dump so that we can see the original nesting. */
1489 convert_from_eh_region_ranges ();
1490
1491 /* If we're emitting a nested function, make sure its parent gets
1492 emitted as well. Doing otherwise confuses debug info. */
1493 {
1494 tree parent;
1495 for (parent = DECL_CONTEXT (current_function_decl);
1496 parent != NULL_TREE;
1497 parent = get_containing_scope (parent))
1498 if (TREE_CODE (parent) == FUNCTION_DECL)
1499 TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
1500 }
1501
1502 /* We are now committed to emitting code for this function. Do any
1503 preparation, such as emitting abstract debug info for the inline
1504 before it gets mangled by optimization. */
1505 if (cgraph_function_possibly_inlined_p (decl))
1506 (*debug_hooks->outlining_inline_function) (decl);
1507
1508 /* Remove any notes we don't need. That will make iterating
1509 over the instruction sequence faster, and allow the garbage
1510 collector to reclaim the memory used by the notes. */
1511 remove_unnecessary_notes ();
1512 if (!cfun->dont_emit_block_notes)
1513 reorder_blocks ();
1514
1515 ggc_collect ();
1516
1517 /* Initialize some variables used by the optimizers. */
1518 init_function_for_compilation ();
1519
1520 TREE_ASM_WRITTEN (decl) = 1;
1521
1522 /* Now that integrate will no longer see our rtl, we need not
1523 distinguish between the return value of this function and the
1524 return value of called functions. Also, we can remove all SETs
1525 of subregs of hard registers; they are only here because of
1526 integrate. Also, we can now initialize pseudos intended to
1527 carry magic hard reg data throughout the function. */
1528 rtx_equal_function_value_matters = 0;
1529 purge_hard_subreg_sets (get_insns ());
1530
1531 /* Early return if there were errors. We can run afoul of our
1532 consistency checks, and there's not really much point in fixing them. */
1533 if (rtl_dump_and_exit || flag_syntax_only || errorcount || sorrycount)
1534 goto exit_rest_of_compilation;
1535
1536 timevar_push (TV_JUMP);
1537 open_dump_file (DFI_sibling, decl);
1538 insns = get_insns ();
1539 rebuild_jump_labels (insns);
1540 find_exception_handler_labels ();
1541 find_basic_blocks (insns, max_reg_num (), dump_file);
1542
1543 delete_unreachable_blocks ();
1544
1545 /* Turn NOTE_INSN_PREDICTIONs into branch predictions. */
1546 if (flag_guess_branch_prob)
1547 {
1548 timevar_push (TV_BRANCH_PROB);
1549 note_prediction_to_br_prob ();
1550 timevar_pop (TV_BRANCH_PROB);
1551 }
1552
1553 timevar_pop (TV_JUMP);
1554
1555 if (cfun->tail_call_emit)
1556 fixup_tail_calls ();
1557
1558 insn_locators_initialize ();
1559 /* Complete generation of exception handling code. */
1560 if (doing_eh (0))
1561 {
1562 timevar_push (TV_JUMP);
1563 open_dump_file (DFI_eh, decl);
1564
1565 finish_eh_generation ();
1566
1567 close_dump_file (DFI_eh, print_rtl, get_insns ());
1568 timevar_pop (TV_JUMP);
1569 }
1570
1571 /* Delay emitting hard_reg_initial_value sets until after EH landing pad
1572 generation, which might create new sets. */
1573 emit_initial_value_sets ();
1574
1575 #ifdef FINALIZE_PIC
1576 /* If we are doing position-independent code generation, now
1577 is the time to output special prologues and epilogues.
1578 We do not want to do this earlier, because it just clutters
1579 up inline functions with meaningless insns. */
1580 if (flag_pic)
1581 FINALIZE_PIC;
1582 #endif
1583
1584 insns = get_insns ();
1585
1586 /* Copy any shared structure that should not be shared. */
1587 unshare_all_rtl (current_function_decl, insns);
1588
1589 #ifdef SETJMP_VIA_SAVE_AREA
1590 /* This must be performed before virtual register instantiation.
1591 Please be aware that everything in the compiler that can look
1592 at the RTL up to this point must understand that REG_SAVE_AREA
1593 is just like a use of the REG contained inside. */
1594 if (current_function_calls_alloca)
1595 optimize_save_area_alloca (insns);
1596 #endif
1597
1598 /* Instantiate all virtual registers. */
1599 instantiate_virtual_regs (current_function_decl, insns);
1600
1601 open_dump_file (DFI_jump, decl);
1602
1603 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
1604 are initialized and to compute whether control can drop off the end
1605 of the function. */
1606
1607 timevar_push (TV_JUMP);
1608 /* Turn NOTE_INSN_EXPECTED_VALUE into REG_BR_PROB. Do this
1609 before jump optimization switches branch directions. */
1610 if (flag_guess_branch_prob)
1611 expected_value_to_br_prob ();
1612
1613 reg_scan (insns, max_reg_num (), 0);
1614 rebuild_jump_labels (insns);
1615 find_basic_blocks (insns, max_reg_num (), dump_file);
1616 delete_trivially_dead_insns (insns, max_reg_num ());
1617 if (dump_file)
1618 dump_flow_info (dump_file);
1619 cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP
1620 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
1621
1622 create_loop_notes ();
1623
1624 purge_line_number_notes (insns);
1625
1626 close_dump_file (DFI_jump, print_rtl, insns);
1627
1628 if (optimize)
1629 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
1630
1631 /* Jump optimization, and the removal of NULL pointer checks, may
1632 have reduced the number of instructions substantially. CSE, and
1633 future passes, allocate arrays whose dimensions involve the
1634 maximum instruction UID, so if we can reduce the maximum UID
1635 we'll save big on memory. */
1636 renumber_insns (dump_file);
1637 timevar_pop (TV_JUMP);
1638
1639 close_dump_file (DFI_jump, print_rtl_with_bb, insns);
1640
1641 ggc_collect ();
1642
1643 if (optimize > 0)
1644 rest_of_handle_cse (decl, insns);
1645
1646 rest_of_handle_addressof (decl, insns);
1647
1648 ggc_collect ();
1649
1650 if (optimize > 0)
1651 {
1652 if (flag_gcse)
1653 rest_of_handle_gcse (decl, insns);
1654
1655 if (flag_loop_optimize)
1656 rest_of_handle_loop_optimize (decl, insns);
1657
1658 if (flag_gcse)
1659 rest_of_handle_jump_bypass (decl, insns);
1660 }
1661
1662 timevar_push (TV_FLOW);
1663
1664 rest_of_handle_cfg (decl, insns);
1665
1666 if (!flag_tree_based_profiling
1667 && (optimize > 0 || profile_arc_flag
1668 || flag_test_coverage || flag_branch_probabilities))
1669 {
1670 rtl_register_profile_hooks ();
1671 rtl_register_value_prof_hooks ();
1672 rest_of_handle_branch_prob (decl, insns);
1673
1674 if (flag_branch_probabilities
1675 && flag_profile_values
1676 && flag_value_profile_transformations)
1677 rest_of_handle_value_profile_transformations (decl, insns);
1678
1679 /* Remove the death notes created for vpt. */
1680 if (flag_profile_values)
1681 count_or_remove_death_notes (NULL, 1);
1682 }
1683
1684 if (optimize > 0)
1685 rest_of_handle_if_conversion (decl, insns);
1686
1687 if (flag_tracer)
1688 rest_of_handle_tracer (decl, insns);
1689
1690 if (optimize > 0)
1691 rest_of_handle_loop2 (decl, insns);
1692
1693 if (flag_web)
1694 rest_of_handle_web (decl, insns);
1695
1696 if (flag_rerun_cse_after_loop)
1697 rest_of_handle_cse2 (decl, insns);
1698
1699 cse_not_expected = 1;
1700
1701 rest_of_handle_life (decl, insns);
1702
1703 if (optimize > 0)
1704 rest_of_handle_combine (decl, insns);
1705
1706 if (flag_if_conversion)
1707 rest_of_handle_if_after_combine (decl, insns);
1708
1709 /* The optimization to partition hot/cold basic blocks into separate
1710 sections of the .o file does not work well with exception handling.
1711 Don't call it if there are exceptions. */
1712
1713 if (flag_reorder_blocks_and_partition && !flag_exceptions)
1714 {
1715 no_new_pseudos = 0;
1716 partition_hot_cold_basic_blocks ();
1717 allocate_reg_life_data ();
1718 update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
1719 PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES);
1720 no_new_pseudos = 1;
1721 }
1722
1723 if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
1724 rest_of_handle_regmove (decl, insns);
1725
1726 /* Do unconditional splitting before register allocation to allow machine
1727 description to add extra information not needed previously. */
1728 split_all_insns (1);
1729
1730 #ifdef OPTIMIZE_MODE_SWITCHING
1731 timevar_push (TV_MODE_SWITCH);
1732
1733 no_new_pseudos = 0;
1734 optimize_mode_switching (NULL);
1735 no_new_pseudos = 1;
1736
1737 timevar_pop (TV_MODE_SWITCH);
1738 #endif
1739
1740 /* Any of the several passes since flow1 will have munged register
1741 lifetime data a bit. We need it to be up to date for scheduling
1742 (see handling of reg_known_equiv in init_alias_analysis). */
1743 recompute_reg_usage (insns, !optimize_size);
1744
1745 #ifdef INSN_SCHEDULING
1746 rest_of_handle_sched (decl, insns);
1747 #endif
1748
1749 /* Determine if the current function is a leaf before running reload
1750 since this can impact optimizations done by the prologue and
1751 epilogue thus changing register elimination offsets. */
1752 current_function_is_leaf = leaf_function_p ();
1753
1754 timevar_push (TV_LOCAL_ALLOC);
1755 open_dump_file (DFI_lreg, decl);
1756
1757 if (flag_new_regalloc)
1758 {
1759 if (rest_of_handle_new_regalloc (decl, insns))
1760 goto exit_rest_of_compilation;
1761 }
1762 else
1763 {
1764 if (rest_of_handle_old_regalloc (decl, insns))
1765 goto exit_rest_of_compilation;
1766 }
1767
1768 ggc_collect ();
1769
1770 open_dump_file (DFI_postreload, decl);
1771
1772 /* Do a very simple CSE pass over just the hard registers. */
1773 if (optimize > 0)
1774 {
1775 timevar_push (TV_RELOAD_CSE_REGS);
1776 reload_cse_regs (insns);
1777 /* reload_cse_regs can eliminate potentially-trapping MEMs.
1778 Remove any EH edges associated with them. */
1779 if (flag_non_call_exceptions)
1780 purge_all_dead_edges (0);
1781 timevar_pop (TV_RELOAD_CSE_REGS);
1782 }
1783
1784 close_dump_file (DFI_postreload, print_rtl_with_bb, insns);
1785
1786 if (optimize > 0 && flag_gcse_after_reload)
1787 rest_of_handle_gcse2 (decl, insns);
1788
1789 /* Re-create the death notes which were deleted during reload. */
1790 timevar_push (TV_FLOW2);
1791 open_dump_file (DFI_flow2, decl);
1792
1793 #ifdef ENABLE_CHECKING
1794 verify_flow_info ();
1795 #endif
1796
1797 /* If optimizing, then go ahead and split insns now. */
1798 #ifndef STACK_REGS
1799 if (optimize > 0)
1800 #endif
1801 split_all_insns (0);
1802
1803 if (flag_branch_target_load_optimize)
1804 {
1805 open_dump_file (DFI_branch_target_load, decl);
1806
1807 branch_target_load_optimize (/*after_prologue_epilogue_gen=*/false);
1808
1809 close_dump_file (DFI_branch_target_load, print_rtl_with_bb, insns);
1810
1811 ggc_collect ();
1812 }
1813
1814 if (optimize)
1815 cleanup_cfg (CLEANUP_EXPENSIVE);
1816
1817 /* On some machines, the prologue and epilogue code, or parts thereof,
1818 can be represented as RTL. Doing so lets us schedule insns between
1819 it and the rest of the code and also allows delayed branch
1820 scheduling to operate in the epilogue. */
1821 thread_prologue_and_epilogue_insns (insns);
1822 epilogue_completed = 1;
1823
1824 if (optimize)
1825 {
1826 life_analysis (dump_file, PROP_POSTRELOAD);
1827 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE
1828 | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
1829
1830 /* This is kind of a heuristic. We need to run combine_stack_adjustments
1831 even for machines with possibly nonzero RETURN_POPS_ARGS
1832 and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having
1833 push instructions will have popping returns. */
1834 #ifndef PUSH_ROUNDING
1835 if (!ACCUMULATE_OUTGOING_ARGS)
1836 #endif
1837 combine_stack_adjustments ();
1838
1839 ggc_collect ();
1840 }
1841
1842 flow2_completed = 1;
1843
1844 close_dump_file (DFI_flow2, print_rtl_with_bb, insns);
1845 timevar_pop (TV_FLOW2);
1846
1847 #ifdef HAVE_peephole2
1848 if (optimize > 0 && flag_peephole2)
1849 {
1850 timevar_push (TV_PEEPHOLE2);
1851 open_dump_file (DFI_peephole2, decl);
1852
1853 peephole2_optimize (dump_file);
1854
1855 close_dump_file (DFI_peephole2, print_rtl_with_bb, insns);
1856 timevar_pop (TV_PEEPHOLE2);
1857 }
1858 #endif
1859
1860 open_dump_file (DFI_ce3, decl);
1861 if (optimize)
1862 /* Last attempt to optimize CFG, as scheduling, peepholing and insn
1863 splitting possibly introduced more crossjumping opportunities. */
1864 cleanup_cfg (CLEANUP_EXPENSIVE
1865 | CLEANUP_UPDATE_LIFE
1866 | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
1867 if (flag_if_conversion2)
1868 {
1869 timevar_push (TV_IFCVT2);
1870
1871 if_convert (1);
1872
1873 timevar_pop (TV_IFCVT2);
1874 }
1875 close_dump_file (DFI_ce3, print_rtl_with_bb, insns);
1876
1877 if (optimize > 0)
1878 {
1879 if (flag_rename_registers || flag_cprop_registers)
1880 rest_of_handle_regrename (decl, insns);
1881
1882 rest_of_handle_reorder_blocks (decl, insns);
1883 }
1884
1885 if (flag_branch_target_load_optimize2)
1886 {
1887 /* Leave this a warning for now so that it is possible to experiment
1888 with running this pass twice. In 3.6, we should either make this
1889 an error, or use separate dump files. */
1890 if (flag_branch_target_load_optimize)
1891 warning ("branch target register load optimization is not intended "
1892 "to be run twice");
1893
1894 open_dump_file (DFI_branch_target_load, decl);
1895
1896 branch_target_load_optimize (/*after_prologue_epilogue_gen=*/true);
1897
1898 close_dump_file (DFI_branch_target_load, print_rtl_with_bb, insns);
1899
1900 ggc_collect ();
1901 }
1902
1903 #ifdef INSN_SCHEDULING
1904 if (optimize > 0 && flag_schedule_insns_after_reload)
1905 rest_of_handle_sched2 (decl, insns);
1906 #endif
1907
1908 #ifdef LEAF_REGISTERS
1909 current_function_uses_only_leaf_regs
1910 = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
1911 #endif
1912
1913 #ifdef STACK_REGS
1914 rest_of_handle_stack_regs (decl, insns);
1915 #endif
1916
1917 compute_alignments ();
1918
1919 if (flag_var_tracking)
1920 rest_of_handle_variable_tracking (decl, insns);
1921
1922 /* CFG is no longer maintained up-to-date. */
1923 free_bb_for_insn ();
1924
1925 if (targetm.machine_dependent_reorg != 0)
1926 rest_of_handle_machine_reorg (decl, insns);
1927
1928 purge_line_number_notes (insns);
1929 cleanup_barriers ();
1930
1931 #ifdef DELAY_SLOTS
1932 if (optimize > 0 && flag_delayed_branch)
1933 rest_of_handle_delay_slots (decl, insns);
1934 #endif
1935
1936 #if defined (HAVE_ATTR_length) && !defined (STACK_REGS)
1937 timevar_push (TV_SHORTEN_BRANCH);
1938 split_all_insns_noflow ();
1939 timevar_pop (TV_SHORTEN_BRANCH);
1940 #endif
1941
1942 convert_to_eh_region_ranges ();
1943
1944 /* Shorten branches. */
1945 timevar_push (TV_SHORTEN_BRANCH);
1946 shorten_branches (get_insns ());
1947 timevar_pop (TV_SHORTEN_BRANCH);
1948
1949 set_nothrow_function_flags ();
1950 if (current_function_nothrow)
1951 /* Now we know that this can't throw; set the flag for the benefit
1952 of other functions later in this translation unit. */
1953 TREE_NOTHROW (current_function_decl) = 1;
1954
1955 rest_of_handle_final (decl, insns);
1956
1957 /* Write DBX symbols if requested. */
1958
1959 /* Note that for those inline functions where we don't initially
1960 know for certain that we will be generating an out-of-line copy,
1961 the first invocation of this routine (rest_of_compilation) will
1962 skip over this code by doing a `goto exit_rest_of_compilation;'.
1963 Later on, wrapup_global_declarations will (indirectly) call
1964 rest_of_compilation again for those inline functions that need
1965 to have out-of-line copies generated. During that call, we
1966 *will* be routed past here. */
1967
1968 timevar_push (TV_SYMOUT);
1969 (*debug_hooks->function_decl) (decl);
1970 timevar_pop (TV_SYMOUT);
1971
1972 exit_rest_of_compilation:
1973
1974 coverage_end_function ();
1975
1976 /* In case the function was not output,
1977 don't leave any temporary anonymous types
1978 queued up for sdb output. */
1979 #ifdef SDB_DEBUGGING_INFO
1980 if (write_symbols == SDB_DEBUG)
1981 sdbout_types (NULL_TREE);
1982 #endif
1983
1984 reload_completed = 0;
1985 epilogue_completed = 0;
1986 flow2_completed = 0;
1987 no_new_pseudos = 0;
1988
1989 timevar_push (TV_FINAL);
1990
1991 /* Clear out the insn_length contents now that they are no
1992 longer valid. */
1993 init_insn_lengths ();
1994
1995 /* Show no temporary slots allocated. */
1996 init_temp_slots ();
1997
1998 free_basic_block_vars ();
1999 free_bb_for_insn ();
2000
2001 timevar_pop (TV_FINAL);
2002
2003 if (targetm.binds_local_p (current_function_decl))
2004 {
2005 int pref = cfun->preferred_stack_boundary;
2006 if (cfun->recursive_call_emit
2007 && cfun->stack_alignment_needed > cfun->preferred_stack_boundary)
2008 pref = cfun->stack_alignment_needed;
2009 cgraph_rtl_info (current_function_decl)->preferred_incoming_stack_boundary
2010 = pref;
2011 }
2012
2013 /* Make sure volatile mem refs aren't considered valid operands for
2014 arithmetic insns. We must call this here if this is a nested inline
2015 function, since the above code leaves us in the init_recog state
2016 (from final.c), and the function context push/pop code does not
2017 save/restore volatile_ok.
2018
2019 ??? Maybe it isn't necessary for expand_start_function to call this
2020 anymore if we do it here? */
2021
2022 init_recog_no_volatile ();
2023
2024 /* We're done with this function. Free up memory if we can. */
2025 free_after_parsing (cfun);
2026 }
2027
2028 void
2029 init_optimization_passes (void)
2030 {
2031 open_dump_file (DFI_cgraph, NULL);
2032 cgraph_dump_file = dump_file;
2033 dump_file = NULL;
2034 }
2035
2036 void
2037 finish_optimization_passes (void)
2038 {
2039 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
2040 {
2041 timevar_push (TV_DUMP);
2042 open_dump_file (DFI_bp, NULL);
2043
2044 end_branch_prob ();
2045
2046 close_dump_file (DFI_bp, NULL, NULL_RTX);
2047 timevar_pop (TV_DUMP);
2048 }
2049
2050 if (optimize > 0 && open_dump_file (DFI_combine, NULL))
2051 {
2052 timevar_push (TV_DUMP);
2053 dump_combine_total_stats (dump_file);
2054 close_dump_file (DFI_combine, NULL, NULL_RTX);
2055 timevar_pop (TV_DUMP);
2056 }
2057
2058 dump_file = cgraph_dump_file;
2059 cgraph_dump_file = NULL;
2060 close_dump_file (DFI_cgraph, NULL, NULL_RTX);
2061
2062 /* Do whatever is necessary to finish printing the graphs. */
2063 if (graph_dump_format != no_graph)
2064 {
2065 int i;
2066
2067 for (i = 0; i < (int) DFI_MAX; ++i)
2068 if (dump_file_tbl[i].initialized && dump_file_tbl[i].graph_dump_p)
2069 {
2070 char seq[16];
2071 char *suffix;
2072
2073 sprintf (seq, DUMPFILE_FORMAT, i);
2074 suffix = concat (seq, dump_file_tbl[i].extension, NULL);
2075 finish_graph_dump_file (dump_base_name, suffix);
2076 free (suffix);
2077 }
2078 }
2079
2080 }
2081
2082 bool
2083 enable_rtl_dump_file (int letter)
2084 {
2085 bool matched = false;
2086 int i;
2087
2088 if (letter == 'a')
2089 {
2090 for (i = 0; i < (int) DFI_MAX; ++i)
2091 dump_file_tbl[i].enabled = 1;
2092 matched = true;
2093 }
2094 else
2095 {
2096 for (i = 0; i < (int) DFI_MAX; ++i)
2097 if (letter == dump_file_tbl[i].debug_switch)
2098 {
2099 dump_file_tbl[i].enabled = 1;
2100 matched = true;
2101 }
2102 }
2103
2104 return matched;
2105 }
2106
2107 struct tree_opt_pass pass_rest_of_compilation =
2108 {
2109 "rest of compilation", /* name */
2110 NULL, /* gate */
2111 rest_of_compilation, /* execute */
2112 NULL, /* sub */
2113 NULL, /* next */
2114 0, /* static_pass_number */
2115 TV_REST_OF_COMPILATION, /* tv_id */
2116 PROP_rtl, /* properties_required */
2117 0, /* properties_provided */
2118 PROP_rtl, /* properties_destroyed */
2119 0, /* todo_flags_start */
2120 TODO_ggc_collect /* todo_flags_finish */
2121 };
2122
2123