OSDN Git Service

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