OSDN Git Service

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