xref: /openbsd/gnu/usr.bin/gcc/gcc/toplev.c (revision 17df1aa7)
1 /* Top level of GNU C compiler
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 <signal.h>
32 
33 #ifdef HAVE_SYS_RESOURCE_H
34 # include <sys/resource.h>
35 #endif
36 
37 #ifdef HAVE_SYS_TIMES_H
38 # include <sys/times.h>
39 #endif
40 
41 #include "input.h"
42 #include "tree.h"
43 #include "rtl.h"
44 #include "tm_p.h"
45 #include "flags.h"
46 #include "insn-attr.h"
47 #include "insn-config.h"
48 #include "insn-flags.h"
49 #include "hard-reg-set.h"
50 #include "recog.h"
51 #include "output.h"
52 #include "except.h"
53 #include "function.h"
54 #include "toplev.h"
55 #include "expr.h"
56 #include "basic-block.h"
57 #include "intl.h"
58 #include "ggc.h"
59 #include "graph.h"
60 #include "loop.h"
61 #include "regs.h"
62 #include "timevar.h"
63 #include "diagnostic.h"
64 #include "ssa.h"
65 #include "params.h"
66 #include "reload.h"
67 #include "dwarf2asm.h"
68 #include "integrate.h"
69 #include "real.h"
70 #include "debug.h"
71 #include "target.h"
72 #include "langhooks.h"
73 #include "cfglayout.h"
74 
75 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
76 #include "dwarf2out.h"
77 #endif
78 
79 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
80 #include "dbxout.h"
81 #endif
82 
83 #ifdef SDB_DEBUGGING_INFO
84 #include "sdbout.h"
85 #endif
86 
87 #ifdef XCOFF_DEBUGGING_INFO
88 #include "xcoffout.h"		/* Needed for external data
89 				   declarations for e.g. AIX 4.x.  */
90 #endif
91 
92 /* Carry information from ASM_DECLARE_OBJECT_NAME
93    to ASM_FINISH_DECLARE_OBJECT.  */
94 
95 extern int size_directive_output;
96 extern tree last_assemble_variable_decl;
97 
98 extern void reg_alloc PARAMS ((void));
99 
100 static void general_init PARAMS ((char *));
101 static void parse_options_and_default_flags PARAMS ((int, char **));
102 static void do_compile PARAMS ((void));
103 static void process_options PARAMS ((void));
104 static void backend_init PARAMS ((void));
105 static int lang_dependent_init PARAMS ((const char *));
106 static void init_asm_output PARAMS ((const char *));
107 static void finalize PARAMS ((void));
108 
109 static void set_target_switch PARAMS ((const char *));
110 
111 static void crash_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
112 static void compile_file PARAMS ((void));
113 static void display_help PARAMS ((void));
114 static void display_target_options PARAMS ((void));
115 
116 static void decode_d_option PARAMS ((const char *));
117 static int decode_f_option PARAMS ((const char *));
118 static int decode_W_option PARAMS ((const char *));
119 static int decode_g_option PARAMS ((const char *));
120 static unsigned int independent_decode_option PARAMS ((int, char **));
121 
122 static void print_version PARAMS ((FILE *, const char *));
123 static int print_single_switch PARAMS ((FILE *, int, int, const char *,
124 				      const char *, const char *,
125 				      const char *, const char *));
126 static void print_switch_values PARAMS ((FILE *, int, int, const char *,
127 				       const char *, const char *));
128 
129 /* Nonzero to dump debug info whilst parsing (-dy option).  */
130 static int set_yydebug;
131 
132 /* Length of line when printing switch values.  */
133 #define MAX_LINE 75
134 
135 /* Name of program invoked, sans directories.  */
136 
137 const char *progname;
138 
139 /* Copy of arguments to toplev_main.  */
140 int save_argc;
141 char **save_argv;
142 
143 /* Name of current original source file (what was input to cpp).
144    This comes from each #-command in the actual input.  */
145 
146 const char *input_filename;
147 
148 /* Name of top-level original source file (what was input to cpp).
149    This comes from the #-command at the beginning of the actual input.
150    If there isn't any there, then this is the cc1 input file name.  */
151 
152 const char *main_input_filename;
153 
154 /* Current line number in real source file.  */
155 
156 int lineno;
157 
158 /* Nonzero if it is unsafe to create any new pseudo registers.  */
159 int no_new_pseudos;
160 
161 /* Stack of currently pending input files.  */
162 
163 struct file_stack *input_file_stack;
164 
165 /* Incremented on each change to input_file_stack.  */
166 int input_file_stack_tick;
167 
168 /* Name to use as base of names for dump output files.  */
169 
170 const char *dump_base_name;
171 
172 /* Name to use as a base for auxiliary output files.  */
173 
174 const char *aux_base_name;
175 
176 /* Format to use to print dumpfile index value */
177 #ifndef DUMPFILE_FORMAT
178 #define DUMPFILE_FORMAT ".%02d."
179 #endif
180 
181 /* Bit flags that specify the machine subtype we are compiling for.
182    Bits are tested using macros TARGET_... defined in the tm.h file
183    and set by `-m...' switches.  Must be defined in rtlanal.c.  */
184 
185 extern int target_flags;
186 
187 /* A mask of target_flags that includes bit X if X was set or cleared
188    on the command line.  */
189 
190 int target_flags_explicit;
191 
192 /* Debug hooks - dependent upon command line options.  */
193 
194 const struct gcc_debug_hooks *debug_hooks = &do_nothing_debug_hooks;
195 
196 /* Describes a dump file.  */
197 
198 struct dump_file_info
199 {
200   /* The unique extension to apply, e.g. ".jump".  */
201   const char *const extension;
202 
203   /* The -d<c> character that enables this dump file.  */
204   char const debug_switch;
205 
206   /* True if there is a corresponding graph dump file.  */
207   char const graph_dump_p;
208 
209   /* True if the user selected this dump.  */
210   char enabled;
211 
212   /* True if the files have been initialized (ie truncated).  */
213   char initialized;
214 };
215 
216 /* Enumerate the extant dump files.  */
217 
218 enum dump_file_index
219 {
220   DFI_rtl,
221   DFI_sibling,
222   DFI_eh,
223   DFI_jump,
224   DFI_ssa,
225   DFI_ssa_ccp,
226   DFI_ssa_dce,
227   DFI_ussa,
228   DFI_null,
229   DFI_cse,
230   DFI_addressof,
231   DFI_gcse,
232   DFI_loop,
233   DFI_cfg,
234   DFI_bp,
235   DFI_ce1,
236   DFI_tracer,
237   DFI_cse2,
238   DFI_life,
239   DFI_combine,
240   DFI_ce2,
241   DFI_regmove,
242   DFI_sched,
243   DFI_lreg,
244   DFI_greg,
245   DFI_postreload,
246   DFI_flow2,
247   DFI_peephole2,
248   DFI_rnreg,
249   DFI_ce3,
250   DFI_sched2,
251   DFI_stack,
252   DFI_bbro,
253   DFI_mach,
254   DFI_dbr,
255   DFI_MAX
256 };
257 
258 /* Describes all the dump files.  Should be kept in order of the
259    pass and in sync with dump_file_index above.
260 
261    Remaining -d letters:
262 
263 	"              o q         "
264 	"       H JK   OPQ  TUV  YZ"
265 */
266 
267 static struct dump_file_info dump_file[DFI_MAX] =
268 {
269   { "rtl",	'r', 0, 0, 0 },
270   { "sibling",  'i', 0, 0, 0 },
271   { "eh",	'h', 0, 0, 0 },
272   { "jump",	'j', 0, 0, 0 },
273   { "ssa",	'e', 1, 0, 0 },
274   { "ssaccp",	'W', 1, 0, 0 },
275   { "ssadce",	'X', 1, 0, 0 },
276   { "ussa",	'e', 1, 0, 0 },	/* Yes, duplicate enable switch.  */
277   { "null",	'u', 0, 0, 0 },
278   { "cse",	's', 0, 0, 0 },
279   { "addressof", 'F', 0, 0, 0 },
280   { "gcse",	'G', 1, 0, 0 },
281   { "loop",	'L', 1, 0, 0 },
282   { "cfg",	'f', 1, 0, 0 },
283   { "bp",	'b', 1, 0, 0 },
284   { "ce1",	'C', 1, 0, 0 },
285   { "tracer",	'T', 1, 0, 0 },
286   { "cse2",	't', 1, 0, 0 },
287   { "life",	'f', 1, 0, 0 },	/* Yes, duplicate enable switch.  */
288   { "combine",	'c', 1, 0, 0 },
289   { "ce2",	'C', 1, 0, 0 },
290   { "regmove",	'N', 1, 0, 0 },
291   { "sched",	'S', 1, 0, 0 },
292   { "lreg",	'l', 1, 0, 0 },
293   { "greg",	'g', 1, 0, 0 },
294   { "postreload", 'o', 1, 0, 0 },
295   { "flow2",	'w', 1, 0, 0 },
296   { "peephole2", 'z', 1, 0, 0 },
297   { "rnreg",	'n', 1, 0, 0 },
298   { "ce3",	'E', 1, 0, 0 },
299   { "sched2",	'R', 1, 0, 0 },
300   { "stack",	'k', 1, 0, 0 },
301   { "bbro",	'B', 1, 0, 0 },
302   { "mach",	'M', 1, 0, 0 },
303   { "dbr",	'd', 0, 0, 0 },
304 };
305 
306 static int open_dump_file PARAMS ((enum dump_file_index, tree));
307 static void close_dump_file PARAMS ((enum dump_file_index,
308 				     void (*) (FILE *, rtx), rtx));
309 
310 /* Other flags saying which kinds of debugging dump have been requested.  */
311 
312 int rtl_dump_and_exit;
313 int flag_print_asm_name;
314 static int version_flag;
315 static char *filename;
316 enum graph_dump_types graph_dump_format;
317 
318 /* Name for output file of assembly code, specified with -o.  */
319 
320 char *asm_file_name;
321 
322 /* Value of the -G xx switch, and whether it was passed or not.  */
323 int g_switch_value;
324 int g_switch_set;
325 
326 /* Type(s) of debugging information we are producing (if any).
327    See flags.h for the definitions of the different possible
328    types of debugging information.  */
329 enum debug_info_type write_symbols = NO_DEBUG;
330 
331 /* Level of debugging information we are producing.  See flags.h
332    for the definitions of the different possible levels.  */
333 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
334 
335 /* Nonzero means use GNU-only extensions in the generated symbolic
336    debugging information.  */
337 /* Currently, this only has an effect when write_symbols is set to
338    DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG.  */
339 int use_gnu_debug_info_extensions = 0;
340 
341 /* Nonzero means do optimizations.  -O.
342    Particular numeric values stand for particular amounts of optimization;
343    thus, -O2 stores 2 here.  However, the optimizations beyond the basic
344    ones are not controlled directly by this variable.  Instead, they are
345    controlled by individual `flag_...' variables that are defaulted
346    based on this variable.  */
347 
348 int optimize = 0;
349 
350 /* Nonzero means optimize for size.  -Os.
351    The only valid values are zero and nonzero. When optimize_size is
352    nonzero, optimize defaults to 2, but certain individual code
353    bloating optimizations are disabled.  */
354 
355 int optimize_size = 0;
356 
357 /* Nonzero if we should exit after parsing options.  */
358 static int exit_after_options = 0;
359 
360 /* The FUNCTION_DECL for the function currently being compiled,
361    or 0 if between functions.  */
362 tree current_function_decl;
363 
364 /* Set to the FUNC_BEGIN label of the current function, or NULL_TREE
365    if none.  */
366 tree current_function_func_begin_label;
367 
368 /* Nonzero if doing dwarf2 duplicate elimination.  */
369 
370 int flag_eliminate_dwarf2_dups = 0;
371 
372 /* Nonzero if generating code to do profiling.  */
373 
374 int profile_flag = 0;
375 
376 /* Nonzero if generating code to profile program flow graph arcs.  */
377 
378 int profile_arc_flag = 0;
379 
380 /* Nonzero if generating info for gcov to calculate line test coverage.  */
381 
382 int flag_test_coverage = 0;
383 
384 /* Nonzero indicates that branch taken probabilities should be calculated.  */
385 
386 int flag_branch_probabilities = 0;
387 
388 /* Nonzero if basic blocks should be reordered.  */
389 
390 int flag_reorder_blocks = 0;
391 
392 /* Nonzero if functions should be reordered.  */
393 
394 int flag_reorder_functions = 0;
395 
396 /* Nonzero if registers should be renamed.  */
397 
398 int flag_rename_registers = 0;
399 int flag_cprop_registers = 0;
400 
401 /* Nonzero for -pedantic switch: warn about anything
402    that standard spec forbids.  */
403 
404 int pedantic = 0;
405 
406 /* Temporarily suppress certain warnings.
407    This is set while reading code from a system header file.  */
408 
409 int in_system_header = 0;
410 
411 /* Don't print functions as they are compiled.  -quiet.  */
412 
413 int quiet_flag = 0;
414 
415 /* Print times taken by the various passes.  -ftime-report.  */
416 
417 int time_report = 0;
418 
419 /* Print memory still in use at end of compilation (which may have little
420    to do with peak memory consumption).  -fmem-report.  */
421 
422 int mem_report = 0;
423 
424 /* Non-zero means to collect statistics which might be expensive
425    and to print them when we are done.  */
426 int flag_detailed_statistics = 0;
427 
428 
429 /* -f flags.  */
430 
431 /* Nonzero means `char' should be signed.  */
432 
433 int flag_signed_char;
434 
435 /* Nonzero means give an enum type only as many bytes as it needs.  */
436 
437 int flag_short_enums;
438 
439 /* Nonzero for -fcaller-saves: allocate values in regs that need to
440    be saved across function calls, if that produces overall better code.
441    Optional now, so people can test it.  */
442 
443 #ifdef DEFAULT_CALLER_SAVES
444 int flag_caller_saves = 1;
445 #else
446 int flag_caller_saves = 0;
447 #endif
448 
449 /* Nonzero if structures and unions should be returned in memory.
450 
451    This should only be defined if compatibility with another compiler or
452    with an ABI is needed, because it results in slower code.  */
453 
454 #ifndef DEFAULT_PCC_STRUCT_RETURN
455 #define DEFAULT_PCC_STRUCT_RETURN 1
456 #endif
457 
458 /* Nonzero for -fpcc-struct-return: return values the same way PCC does.  */
459 
460 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
461 
462 /* Nonzero for -fforce-mem: load memory value into a register
463    before arithmetic on it.  This makes better cse but slower compilation.  */
464 
465 int flag_force_mem = 0;
466 
467 /* Nonzero for -fforce-addr: load memory address into a register before
468    reference to memory.  This makes better cse but slower compilation.  */
469 
470 int flag_force_addr = 0;
471 
472 /* Nonzero for -fdefer-pop: don't pop args after each function call;
473    instead save them up to pop many calls' args with one insns.  */
474 
475 int flag_defer_pop = 0;
476 
477 /* Nonzero for -ffloat-store: don't allocate floats and doubles
478    in extended-precision registers.  */
479 
480 int flag_float_store = 0;
481 
482 /* Nonzero for -fcse-follow-jumps:
483    have cse follow jumps to do a more extensive job.  */
484 
485 int flag_cse_follow_jumps;
486 
487 /* Nonzero for -fcse-skip-blocks:
488    have cse follow a branch around a block.  */
489 int flag_cse_skip_blocks;
490 
491 /* Nonzero for -fexpensive-optimizations:
492    perform miscellaneous relatively-expensive optimizations.  */
493 int flag_expensive_optimizations;
494 
495 /* Nonzero for -fthread-jumps:
496    have jump optimize output of loop.  */
497 
498 int flag_thread_jumps;
499 
500 /* Nonzero enables strength-reduction in loop.c.  */
501 
502 int flag_strength_reduce = 0;
503 
504 /* Nonzero enables loop unrolling in unroll.c.  Only loops for which the
505    number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
506    UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
507    unrolled.  */
508 
509 int flag_unroll_loops;
510 
511 /* Nonzero enables loop unrolling in unroll.c.  All loops are unrolled.
512    This is generally not a win.  */
513 
514 int flag_unroll_all_loops;
515 
516 /* Nonzero enables prefetch optimizations for arrays in loops.  */
517 
518 int flag_prefetch_loop_arrays;
519 
520 /* Nonzero forces all invariant computations in loops to be moved
521    outside the loop.  */
522 
523 int flag_move_all_movables = 0;
524 
525 /* Nonzero forces all general induction variables in loops to be
526    strength reduced.  */
527 
528 int flag_reduce_all_givs = 0;
529 
530 /* Nonzero to perform full register move optimization passes.  This is the
531    default for -O2.  */
532 
533 int flag_regmove = 0;
534 
535 /* Nonzero for -fwritable-strings:
536    store string constants in data segment and don't uniquize them.  */
537 
538 int flag_writable_strings = 0;
539 
540 /* Nonzero means don't put addresses of constant functions in registers.
541    Used for compiling the Unix kernel, where strange substitutions are
542    done on the assembly output.  */
543 
544 int flag_no_function_cse = 0;
545 
546 /* Nonzero for -fomit-frame-pointer:
547    don't make a frame pointer in simple functions that don't require one.  */
548 
549 int flag_omit_frame_pointer = 0;
550 
551 /* Nonzero means place each function into its own section on those platforms
552    which support arbitrary section names and unlimited numbers of sections.  */
553 
554 int flag_function_sections = 0;
555 
556 /* ... and similar for data.  */
557 
558 int flag_data_sections = 0;
559 
560 /* Nonzero to inhibit use of define_optimization peephole opts.  */
561 
562 int flag_no_peephole = 0;
563 
564 /* Nonzero allows GCC to optimize sibling and tail recursive calls.  */
565 
566 int flag_optimize_sibling_calls = 0;
567 
568 /* Nonzero means the front end generally wants `errno' maintained by math
569    operations, like built-in SQRT.  */
570 
571 int flag_errno_math = 1;
572 
573 /* Nonzero means that unsafe floating-point math optimizations are allowed
574    for the sake of speed.  IEEE compliance is not guaranteed, and operations
575    are allowed to assume that their arguments and results are "normal"
576    (e.g., nonnegative for SQRT).  */
577 
578 int flag_unsafe_math_optimizations = 0;
579 
580 /* Nonzero means that no NaNs or +-Infs are expected.  */
581 
582 int flag_finite_math_only = 0;
583 
584 /* Zero means that floating-point math operations cannot generate a
585    (user-visible) trap.  This is the case, for example, in nonstop
586    IEEE 754 arithmetic.  Trapping conditions include division by zero,
587    overflow, underflow, invalid and inexact, but does not include
588    operations on signaling NaNs (see below).  */
589 
590 int flag_trapping_math = 1;
591 
592 /* Nonzero means disable transformations observable by signaling NaNs.
593    This option implies that any operation on a IEEE signaling NaN can
594    generate a (user-visible) trap.  */
595 
596 int flag_signaling_nans = 0;
597 
598 /* 0 means straightforward implementation of complex divide acceptable.
599    1 means wide ranges of inputs must work for complex divide.
600    2 means C99-like requirements for complex divide (not yet implemented).  */
601 
602 int flag_complex_divide_method = 0;
603 
604 /* Nonzero means all references through pointers are volatile.  */
605 
606 int flag_volatile;
607 
608 /* Nonzero means treat all global and extern variables as volatile.  */
609 
610 int flag_volatile_global;
611 
612 /* Nonzero means treat all static variables as volatile.  */
613 
614 int flag_volatile_static;
615 
616 /* Nonzero means just do syntax checking; don't output anything.  */
617 
618 int flag_syntax_only = 0;
619 
620 /* Nonzero means perform global cse.  */
621 
622 static int flag_gcse;
623 
624 /* Nonzero means perform loop optimizer.  */
625 
626 static int flag_loop_optimize;
627 
628 /* Nonzero means perform crossjumping.  */
629 
630 static int flag_crossjumping;
631 
632 /* Nonzero means perform if conversion.  */
633 
634 static int flag_if_conversion;
635 
636 /* Nonzero means perform if conversion after reload.  */
637 
638 static int flag_if_conversion2;
639 
640 /* Nonzero means to use global dataflow analysis to eliminate
641    useless null pointer tests.  */
642 
643 static int flag_delete_null_pointer_checks;
644 
645 /* Nonzero means to do the enhanced load motion during gcse, which trys
646    to hoist loads by not killing them when a store to the same location
647    is seen.  */
648 
649 int flag_gcse_lm = 1;
650 
651 /* Nonzero means to perform store motion after gcse, which will try to
652    move stores closer to the exit block.  Its not very effective without
653    flag_gcse_lm.  */
654 
655 int flag_gcse_sm = 1;
656 
657 /* Nonzero means to rerun cse after loop optimization.  This increases
658    compilation time about 20% and picks up a few more common expressions.  */
659 
660 static int flag_rerun_cse_after_loop;
661 
662 /* Nonzero means to run loop optimizations twice.  */
663 
664 int flag_rerun_loop_opt;
665 
666 /* Nonzero for -finline-functions: ok to inline functions that look like
667    good inline candidates.  */
668 
669 int flag_inline_functions;
670 
671 /* Nonzero for -fkeep-inline-functions: even if we make a function
672    go inline everywhere, keep its definition around for debugging
673    purposes.  */
674 
675 int flag_keep_inline_functions;
676 
677 /* Nonzero means that functions will not be inlined.  */
678 
679 int flag_no_inline = 2;
680 
681 /* Nonzero means that we don't want inlining by virtue of -fno-inline,
682    not just because the tree inliner turned us off.  */
683 
684 int flag_really_no_inline = 2;
685 
686 /* Nonzero means that we should emit static const variables
687    regardless of whether or not optimization is turned on.  */
688 
689 int flag_keep_static_consts = 1;
690 
691 /* Nonzero means we should be saving declaration info into a .X file.  */
692 
693 int flag_gen_aux_info = 0;
694 
695 /* Specified name of aux-info file.  */
696 
697 static char *aux_info_file_name;
698 
699 /* Nonzero means make the text shared if supported.  */
700 
701 int flag_shared_data;
702 
703 /* Nonzero means schedule into delayed branch slots if supported.  */
704 
705 int flag_delayed_branch;
706 
707 /* Nonzero if we are compiling pure (sharable) code.
708    Value is 1 if we are doing "small" pic; value is 2 if we're doing
709    "large" pic.  */
710 
711 int flag_pic;
712 
713 /* Nonzero if we are compiling position independent code for executable.
714    The value is 1 if we are doing "small" pic; value is 2 if we're doing
715    "large" pic.  */
716 int flag_pie;
717 
718 /* Nonzero if we are compiling code for a shared library, zero for
719    executable.  */
720 
721 int flag_shlib;
722 
723 
724 /* Set to the default thread-local storage (tls) model to use.  */
725 
726 enum tls_model flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
727 
728 /* Nonzero means generate extra code for exception handling and enable
729    exception handling.  */
730 
731 int flag_exceptions;
732 
733 /* Nonzero means generate frame unwind info table when supported.  */
734 
735 int flag_unwind_tables = 0;
736 
737 /* Nonzero means generate frame unwind info table exact at each insn boundary */
738 
739 int flag_asynchronous_unwind_tables = 0;
740 
741 /* Nonzero means don't place uninitialized global data in common storage
742    by default.  */
743 
744 int flag_no_common;
745 
746 /* Nonzero means change certain warnings into errors.
747    Usually these are warnings about failure to conform to some standard.  */
748 
749 int flag_pedantic_errors = 0;
750 
751 /* flag_schedule_insns means schedule insns within basic blocks (before
752    local_alloc).
753    flag_schedule_insns_after_reload means schedule insns after
754    global_alloc.  */
755 
756 int flag_schedule_insns = 0;
757 int flag_schedule_insns_after_reload = 0;
758 
759 /* The following flags have effect only for scheduling before register
760    allocation:
761 
762    flag_schedule_interblock means schedule insns accross basic blocks.
763    flag_schedule_speculative means allow speculative motion of non-load insns.
764    flag_schedule_speculative_load means allow speculative motion of some
765    load insns.
766    flag_schedule_speculative_load_dangerous allows speculative motion of more
767    load insns.  */
768 
769 int flag_schedule_interblock = 1;
770 int flag_schedule_speculative = 1;
771 int flag_schedule_speculative_load = 0;
772 int flag_schedule_speculative_load_dangerous = 0;
773 
774 int flag_single_precision_constant;
775 
776 /* flag_branch_on_count_reg means try to replace add-1,compare,branch tupple
777    by a cheaper branch on a count register.  */
778 int flag_branch_on_count_reg = 1;
779 
780 /* -finhibit-size-directive inhibits output of .size for ELF.
781    This is used only for compiling crtstuff.c,
782    and it may be extended to other effects
783    needed for crtstuff.c on other systems.  */
784 int flag_inhibit_size_directive = 0;
785 
786 /* -fverbose-asm causes extra commentary information to be produced in
787    the generated assembly code (to make it more readable).  This option
788    is generally only of use to those who actually need to read the
789    generated assembly code (perhaps while debugging the compiler itself).
790    -fno-verbose-asm, the default, causes the extra information
791    to be omitted and is useful when comparing two assembler files.  */
792 
793 int flag_verbose_asm = 0;
794 
795 /* -dA causes debug commentary information to be produced in
796    the generated assembly code (to make it more readable).  This option
797    is generally only of use to those who actually need to read the
798    generated assembly code (perhaps while debugging the compiler itself).
799    Currently, this switch is only used by dwarfout.c; however, it is intended
800    to be a catchall for printing debug information in the assembler file.  */
801 
802 int flag_debug_asm = 0;
803 
804 /* -dP causes the rtl to be emitted as a comment in assembly.  */
805 
806 int flag_dump_rtl_in_asm = 0;
807 
808 /* -fgnu-linker specifies use of the GNU linker for initializations.
809    (Or, more generally, a linker that handles initializations.)
810    -fno-gnu-linker says that collect2 will be used.  */
811 #ifdef USE_COLLECT2
812 int flag_gnu_linker = 0;
813 #else
814 int flag_gnu_linker = 1;
815 #endif
816 
817 /* Nonzero means put zero initialized data in the bss section.  */
818 #if defined(OPENBSD_NATIVE) || defined(OPENBSD_CROSS)
819 int flag_zero_initialized_in_bss = 0;
820 #else
821 int flag_zero_initialized_in_bss = 1;
822 #endif
823 
824 /* Enable SSA.  */
825 int flag_ssa = 0;
826 
827 /* Enable ssa conditional constant propagation.  */
828 int flag_ssa_ccp = 0;
829 
830 /* Enable ssa aggressive dead code elimination.  */
831 int flag_ssa_dce = 0;
832 
833 /* Tag all structures with __attribute__(packed).  */
834 int flag_pack_struct = 0;
835 
836 /* Emit code to check for stack overflow; also may cause large objects
837    to be allocated dynamically.  */
838 int flag_stack_check;
839 
840 /* When non-NULL, indicates that whenever space is allocated on the
841    stack, the resulting stack pointer must not pass this
842    address---that is, for stacks that grow downward, the stack pointer
843    must always be greater than or equal to this address; for stacks
844    that grow upward, the stack pointer must be less than this address.
845    At present, the rtx may be either a REG or a SYMBOL_REF, although
846    the support provided depends on the backend.  */
847 rtx stack_limit_rtx;
848 
849 /* 0 if pointer arguments may alias each other.  True in C.
850    1 if pointer arguments may not alias each other but may alias
851    global variables.
852    2 if pointer arguments may not alias each other and may not
853    alias global variables.  True in Fortran.
854    This defaults to 0 for C.  */
855 int flag_argument_noalias = 0;
856 
857 /* Nonzero if we should do (language-dependent) alias analysis.
858    Typically, this analysis will assume that expressions of certain
859    types do not alias expressions of certain other types.  Only used
860    if alias analysis (in general) is enabled.  */
861 int flag_strict_aliasing = 0;
862 
863 /* Instrument functions with calls at entry and exit, for profiling.  */
864 int flag_instrument_function_entry_exit = 0;
865 
866 /* Nonzero means ignore `#ident' directives.  0 means handle them.
867    On SVR4 targets, it also controls whether or not to emit a
868    string identifying the compiler.  */
869 
870 #if defined(OPENBSD_NATIVE) || defined(OPENBSD_CROSS)
871 int flag_no_ident = 1;
872 #else
873 int flag_no_ident = 0;
874 #endif
875 
876 /* This will perform a peephole pass before sched2.  */
877 int flag_peephole2 = 0;
878 
879 /* This will try to guess branch probabilities.  */
880 int flag_guess_branch_prob = 0;
881 
882 /* -fcheck-bounds causes gcc to generate array bounds checks.
883    For C, C++, ObjC: defaults to off.
884    For Java: defaults to on.
885    For Fortran: defaults to off.  */
886 int flag_bounds_check = 0;
887 
888 /* This will attempt to merge constant section constants, if 1 only
889    string constants and constants from constant pool, if 2 also constant
890    variables.  */
891 int flag_merge_constants = 1;
892 
893 /* If one, renumber instruction UIDs to reduce the number of
894    unused UIDs if there are a lot of instructions.  If greater than
895    one, unconditionally renumber instruction UIDs.  */
896 int flag_renumber_insns = 1;
897 
898 /* If nonzero, use the graph coloring register allocator.  */
899 int flag_new_regalloc = 0;
900 
901 /* Nonzero if we perform superblock formation.  */
902 
903 int flag_tracer = 0;
904 
905 /* Values of the -falign-* flags: how much to align labels in code.
906    0 means `use default', 1 means `don't align'.
907    For each variable, there is an _log variant which is the power
908    of two not less than the variable, for .align output.  */
909 
910 int align_loops;
911 int align_loops_log;
912 int align_loops_max_skip;
913 int align_jumps;
914 int align_jumps_log;
915 int align_jumps_max_skip;
916 int align_labels;
917 int align_labels_log;
918 int align_labels_max_skip;
919 int align_functions;
920 int align_functions_log;
921 
922 /* Like align_functions_log above, but used by front-ends to force the
923    minimum function alignment.  Zero means no alignment is forced.  */
924 int force_align_functions_log;
925 
926 #if defined(STACK_PROTECTOR) && defined(STACK_GROWS_DOWNWARD)
927 /* Nonzero means use propolice as a stack protection method */
928 int flag_propolice_protection = 1;
929 int flag_stack_protection = 0;
930 #else
931 int flag_propolice_protection = 0;
932 int flag_stack_protection = 0;
933 #endif
934 
935 int flag_trampolines = 0;
936 int warn_trampolines = 0;
937 
938 /* Table of supported debugging formats.  */
939 static const struct
940 {
941   const char *const arg;
942   /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
943      constant expression, we use NO_DEBUG in its place.  */
944   const enum debug_info_type debug_type;
945   const int use_extensions_p;
946   const char *const description;
947 } *da,
948 debug_args[] =
949 {
950   { "",       NO_DEBUG, DEFAULT_GDB_EXTENSIONS,
951     N_("Generate debugging info in default format") },
952   { "gdb",    NO_DEBUG, 1, N_("Generate debugging info in default extended format") },
953 #ifdef DBX_DEBUGGING_INFO
954   { "stabs",  DBX_DEBUG, 0, N_("Generate STABS format debug info") },
955   { "stabs+", DBX_DEBUG, 1, N_("Generate extended STABS format debug info") },
956 #endif
957 #ifdef DWARF_DEBUGGING_INFO
958   { "dwarf",  DWARF_DEBUG, 0, N_("Generate DWARF-1 format debug info") },
959   { "dwarf+", DWARF_DEBUG, 1,
960     N_("Generate extended DWARF-1 format debug info") },
961 #endif
962 #ifdef DWARF2_DEBUGGING_INFO
963   { "dwarf-2", DWARF2_DEBUG, 0, N_("Generate DWARF-2 debug info") },
964 #endif
965 #ifdef XCOFF_DEBUGGING_INFO
966   { "xcoff",  XCOFF_DEBUG, 0, N_("Generate XCOFF format debug info") },
967   { "xcoff+", XCOFF_DEBUG, 1, N_("Generate extended XCOFF format debug info") },
968 #endif
969 #ifdef SDB_DEBUGGING_INFO
970   { "coff", SDB_DEBUG, 0, N_("Generate COFF format debug info") },
971 #endif
972 #ifdef VMS_DEBUGGING_INFO
973   { "vms", VMS_DEBUG, 0, N_("Generate VMS format debug info") },
974 #endif
975   { 0, 0, 0, 0 }
976 };
977 
978 typedef struct
979 {
980   const char *const string;
981   int *const variable;
982   const int on_value;
983   const char *const description;
984 }
985 lang_independent_options;
986 
987 int flag_trapv = 0;
988 
989 /* Add or remove a leading underscore from user symbols.  */
990 int flag_leading_underscore = -1;
991 
992 /* The user symbol prefix after having resolved same.  */
993 const char *user_label_prefix;
994 
995 static const param_info lang_independent_params[] = {
996 #define DEFPARAM(ENUM, OPTION, HELP, DEFAULT) \
997   { OPTION, DEFAULT, HELP },
998 #include "params.def"
999 #undef DEFPARAM
1000   { NULL, 0, NULL }
1001 };
1002 
1003 /* Table of language-independent -f options.
1004    STRING is the option name.  VARIABLE is the address of the variable.
1005    ON_VALUE is the value to store in VARIABLE
1006     if `-fSTRING' is seen as an option.
1007    (If `-fno-STRING' is seen as an option, the opposite value is stored.)  */
1008 
1009 static const lang_independent_options f_options[] =
1010 {
1011   {"eliminate-dwarf2-dups", &flag_eliminate_dwarf2_dups, 1,
1012    N_("Perform DWARF2 duplicate elimination") },
1013   {"float-store", &flag_float_store, 1,
1014    N_("Do not store floats in registers") },
1015   {"volatile", &flag_volatile, 1,
1016    N_("Consider all mem refs through pointers as volatile") },
1017   {"volatile-global", &flag_volatile_global, 1,
1018    N_("Consider all mem refs to global data to be volatile") },
1019   {"volatile-static", &flag_volatile_static, 1,
1020    N_("Consider all mem refs to static data to be volatile") },
1021   {"defer-pop", &flag_defer_pop, 1,
1022    N_("Defer popping functions args from stack until later") },
1023   {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
1024    N_("When possible do not generate stack frames") },
1025   {"optimize-sibling-calls", &flag_optimize_sibling_calls, 1,
1026    N_("Optimize sibling and tail recursive calls") },
1027   {"tracer", &flag_tracer, 1,
1028    N_("Perform superblock formation via tail duplication") },
1029   {"cse-follow-jumps", &flag_cse_follow_jumps, 1,
1030    N_("When running CSE, follow jumps to their targets") },
1031   {"cse-skip-blocks", &flag_cse_skip_blocks, 1,
1032    N_("When running CSE, follow conditional jumps") },
1033   {"expensive-optimizations", &flag_expensive_optimizations, 1,
1034    N_("Perform a number of minor, expensive optimizations") },
1035   {"thread-jumps", &flag_thread_jumps, 1,
1036    N_("Perform jump threading optimizations") },
1037   {"strength-reduce", &flag_strength_reduce, 1,
1038    N_("Perform strength reduction optimizations") },
1039   {"unroll-loops", &flag_unroll_loops, 1,
1040    N_("Perform loop unrolling when iteration count is known") },
1041   {"unroll-all-loops", &flag_unroll_all_loops, 1,
1042    N_("Perform loop unrolling for all loops") },
1043   {"prefetch-loop-arrays", &flag_prefetch_loop_arrays, 1,
1044    N_("Generate prefetch instructions, if available, for arrays in loops") },
1045   {"move-all-movables", &flag_move_all_movables, 1,
1046    N_("Force all loop invariant computations out of loops") },
1047   {"reduce-all-givs", &flag_reduce_all_givs, 1,
1048    N_("Strength reduce all loop general induction variables") },
1049   {"writable-strings", &flag_writable_strings, 1,
1050    N_("Store strings in writable data section") },
1051   {"peephole", &flag_no_peephole, 0,
1052    N_("Enable machine specific peephole optimizations") },
1053   {"force-mem", &flag_force_mem, 1,
1054    N_("Copy memory operands into registers before using") },
1055   {"force-addr", &flag_force_addr, 1,
1056    N_("Copy memory address constants into regs before using") },
1057   {"function-cse", &flag_no_function_cse, 0,
1058    N_("Allow function addresses to be held in registers") },
1059   {"inline-functions", &flag_inline_functions, 1,
1060    N_("Integrate simple functions into their callers") },
1061   {"keep-inline-functions", &flag_keep_inline_functions, 1,
1062    N_("Generate code for funcs even if they are fully inlined") },
1063   {"inline", &flag_no_inline, 0,
1064    N_("Pay attention to the 'inline' keyword") },
1065   {"keep-static-consts", &flag_keep_static_consts, 1,
1066    N_("Emit static const variables even if they are not used") },
1067   {"syntax-only", &flag_syntax_only, 1,
1068    N_("Check for syntax errors, then stop") },
1069   {"shared-data", &flag_shared_data, 1,
1070    N_("Mark data as shared rather than private") },
1071   {"caller-saves", &flag_caller_saves, 1,
1072    N_("Enable saving registers around function calls") },
1073   {"pcc-struct-return", &flag_pcc_struct_return, 1,
1074    N_("Return 'short' aggregates in memory, not registers") },
1075   {"reg-struct-return", &flag_pcc_struct_return, 0,
1076    N_("Return 'short' aggregates in registers") },
1077   {"delayed-branch", &flag_delayed_branch, 1,
1078    N_("Attempt to fill delay slots of branch instructions") },
1079   {"gcse", &flag_gcse, 1,
1080    N_("Perform the global common subexpression elimination") },
1081   {"gcse-lm", &flag_gcse_lm, 1,
1082    N_("Perform enhanced load motion during global subexpression elimination") },
1083   {"gcse-sm", &flag_gcse_sm, 1,
1084    N_("Perform store motion after global subexpression elimination") },
1085   {"loop-optimize", &flag_loop_optimize, 1,
1086    N_("Perform the loop optimizations") },
1087   {"crossjumping", &flag_crossjumping, 1,
1088    N_("Perform cross-jumping optimization") },
1089   {"if-conversion", &flag_if_conversion, 1,
1090    N_("Perform conversion of conditional jumps to branchless equivalents") },
1091   {"if-conversion2", &flag_if_conversion2, 1,
1092    N_("Perform conversion of conditional jumps to conditional execution") },
1093   {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
1094    N_("Run CSE pass after loop optimizations") },
1095   {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
1096    N_("Run the loop optimizer twice") },
1097   {"delete-null-pointer-checks", &flag_delete_null_pointer_checks, 1,
1098    N_("Delete useless null pointer checks") },
1099   {"schedule-insns", &flag_schedule_insns, 1,
1100    N_("Reschedule instructions before register allocation") },
1101   {"schedule-insns2", &flag_schedule_insns_after_reload, 1,
1102    N_("Reschedule instructions after register allocation") },
1103   {"sched-interblock",&flag_schedule_interblock, 1,
1104    N_("Enable scheduling across basic blocks") },
1105   {"sched-spec",&flag_schedule_speculative, 1,
1106    N_("Allow speculative motion of non-loads") },
1107   {"sched-spec-load",&flag_schedule_speculative_load, 1,
1108    N_("Allow speculative motion of some loads") },
1109   {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
1110    N_("Allow speculative motion of more loads") },
1111   {"branch-count-reg",&flag_branch_on_count_reg, 1,
1112    N_("Replace add,compare,branch with branch on count reg") },
1113   {"pic", &flag_pic, 1,
1114    N_("Generate position independent code, if possible") },
1115   {"PIC", &flag_pic, 2, ""},
1116   {"pie", &flag_pie, 1,
1117    N_("Generate position independent code for executables, if possible") },
1118   {"PIE", &flag_pie, 2, ""},
1119   {"exceptions", &flag_exceptions, 1,
1120    N_("Enable exception handling") },
1121   {"unwind-tables", &flag_unwind_tables, 1,
1122    N_("Just generate unwind tables for exception handling") },
1123   {"asynchronous-unwind-tables", &flag_asynchronous_unwind_tables, 1,
1124    N_("Generate unwind tables exact at each instruction boundary") },
1125   {"non-call-exceptions", &flag_non_call_exceptions, 1,
1126    N_("Support synchronous non-call exceptions") },
1127   {"profile-arcs", &profile_arc_flag, 1,
1128    N_("Insert arc based program profiling code") },
1129   {"test-coverage", &flag_test_coverage, 1,
1130    N_("Create data files needed by gcov") },
1131   {"branch-probabilities", &flag_branch_probabilities, 1,
1132    N_("Use profiling information for branch probabilities") },
1133   {"profile", &profile_flag, 1,
1134    N_("Enable basic program profiling code") },
1135   {"reorder-blocks", &flag_reorder_blocks, 1,
1136    N_("Reorder basic blocks to improve code placement") },
1137   {"reorder-functions", &flag_reorder_functions, 1,
1138    N_("Reorder functions to improve code placement") },
1139   {"rename-registers", &flag_rename_registers, 1,
1140    N_("Do the register renaming optimization pass") },
1141   {"cprop-registers", &flag_cprop_registers, 1,
1142    N_("Do the register copy-propagation optimization pass") },
1143   {"common", &flag_no_common, 0,
1144    N_("Do not put uninitialized globals in the common section") },
1145   {"inhibit-size-directive", &flag_inhibit_size_directive, 1,
1146    N_("Do not generate .size directives") },
1147   {"function-sections", &flag_function_sections, 1,
1148    N_("place each function into its own section") },
1149   {"data-sections", &flag_data_sections, 1,
1150    N_("place data items into their own section") },
1151   {"verbose-asm", &flag_verbose_asm, 1,
1152    N_("Add extra commentary to assembler output") },
1153   {"gnu-linker", &flag_gnu_linker, 1,
1154    N_("Output GNU ld formatted global initializers") },
1155   {"regmove", &flag_regmove, 1,
1156    N_("Enables a register move optimization") },
1157   {"optimize-register-move", &flag_regmove, 1,
1158    N_("Do the full regmove optimization pass") },
1159   {"pack-struct", &flag_pack_struct, 1,
1160    N_("Pack structure members together without holes") },
1161   {"stack-check", &flag_stack_check, 1,
1162    N_("Insert stack checking code into the program") },
1163   {"argument-alias", &flag_argument_noalias, 0,
1164    N_("Specify that arguments may alias each other & globals") },
1165   {"argument-noalias", &flag_argument_noalias, 1,
1166    N_("Assume arguments may alias globals but not each other") },
1167   {"argument-noalias-global", &flag_argument_noalias, 2,
1168    N_("Assume arguments do not alias each other or globals") },
1169   {"strict-aliasing", &flag_strict_aliasing, 1,
1170    N_("Assume strict aliasing rules apply") },
1171   {"align-loops", &align_loops, 0,
1172    N_("Align the start of loops") },
1173   {"align-jumps", &align_jumps, 0,
1174    N_("Align labels which are only reached by jumping") },
1175   {"align-labels", &align_labels, 0,
1176    N_("Align all labels") },
1177   {"align-functions", &align_functions, 0,
1178    N_("Align the start of functions") },
1179   {"merge-constants", &flag_merge_constants, 1,
1180    N_("Attempt to merge identical constants across compilation units") },
1181   {"merge-all-constants", &flag_merge_constants, 2,
1182    N_("Attempt to merge identical constants and constant variables") },
1183   {"dump-unnumbered", &flag_dump_unnumbered, 1,
1184    N_("Suppress output of instruction numbers and line number notes in debugging dumps") },
1185   {"instrument-functions", &flag_instrument_function_entry_exit, 1,
1186    N_("Instrument function entry/exit with profiling calls") },
1187   {"zero-initialized-in-bss", &flag_zero_initialized_in_bss, 1,
1188    N_("Put zero initialized data in the bss section") },
1189   {"ssa", &flag_ssa, 1,
1190    N_("Enable SSA optimizations") },
1191   {"ssa-ccp", &flag_ssa_ccp, 1,
1192    N_("Enable SSA conditional constant propagation") },
1193   {"ssa-dce", &flag_ssa_dce, 1,
1194    N_("Enable aggressive SSA dead code elimination") },
1195   {"leading-underscore", &flag_leading_underscore, 1,
1196    N_("External symbols have a leading underscore") },
1197   {"ident", &flag_no_ident, 0,
1198    N_("Process #ident directives") },
1199   { "peephole2", &flag_peephole2, 1,
1200    N_("Enables an rtl peephole pass run before sched2") },
1201   {"finite-math-only", &flag_finite_math_only, 1,
1202    N_("Assume no NaNs or +-Infs are generated") },
1203   { "guess-branch-probability", &flag_guess_branch_prob, 1,
1204    N_("Enables guessing of branch probabilities") },
1205   {"math-errno", &flag_errno_math, 1,
1206    N_("Set errno after built-in math functions") },
1207   {"trapping-math", &flag_trapping_math, 1,
1208    N_("Floating-point operations can trap") },
1209   {"unsafe-math-optimizations", &flag_unsafe_math_optimizations, 1,
1210    N_("Allow math optimizations that may violate IEEE or ANSI standards") },
1211   {"signaling-nans", &flag_signaling_nans, 1,
1212    N_("Disable optimizations observable by IEEE signaling NaNs") },
1213   {"bounds-check", &flag_bounds_check, 1,
1214    N_("Generate code to check bounds before indexing arrays") },
1215   {"single-precision-constant", &flag_single_precision_constant, 1,
1216    N_("Convert floating point constant to single precision constant") },
1217   {"time-report", &time_report, 1,
1218    N_("Report time taken by each compiler pass at end of run") },
1219   {"mem-report", &mem_report, 1,
1220    N_("Report on permanent memory allocation at end of run") },
1221   { "trapv", &flag_trapv, 1,
1222    N_("Trap for signed overflow in addition / subtraction / multiplication") },
1223   { "new-ra", &flag_new_regalloc, 1,
1224    N_("Use graph coloring register allocation.") },
1225   {"stack-protector", &flag_propolice_protection, 1,
1226    N_("Enables stack protection") },
1227   {"stack-protector-all", &flag_stack_protection, 1,
1228    N_("Enables stack protection of every function") } ,
1229   {"trampolines", &flag_trampolines, 1,
1230    N_("Allows trampolines") },
1231 };
1232 
1233 /* Table of language-specific options.  */
1234 
1235 static const struct lang_opt
1236 {
1237   const char *const option;
1238   const char *const description;
1239 }
1240 documented_lang_options[] =
1241 {
1242   /* In order not to overload the --help output, the convention
1243      used here is to only describe those options which are not
1244      enabled by default.  */
1245 
1246   { "-ansi",
1247     N_("Compile just for ISO C90") },
1248   { "-std= ",
1249     N_("Determine language standard") },
1250 
1251   { "-fsigned-bitfields", "" },
1252   { "-funsigned-bitfields",
1253     N_("Make bit-fields by unsigned by default") },
1254   { "-fno-signed-bitfields", "" },
1255   { "-fno-unsigned-bitfields","" },
1256   { "-fsigned-char",
1257     N_("Make 'char' be signed by default") },
1258   { "-funsigned-char",
1259     N_("Make 'char' be unsigned by default") },
1260   { "-fno-signed-char", "" },
1261   { "-fno-unsigned-char", "" },
1262 
1263   { "-fasm", "" },
1264   { "-fno-asm",
1265     N_("Do not recognize the 'asm' keyword") },
1266   { "-fbuiltin", "" },
1267   { "-fno-builtin",
1268     N_("Do not recognize any built in functions") },
1269   { "-fhosted",
1270     N_("Assume normal C execution environment") },
1271   { "-fno-hosted", "" },
1272   { "-ffreestanding",
1273     N_("Assume that standard libraries & main might not exist") },
1274   { "-fno-freestanding", "" },
1275   { "-fcond-mismatch",
1276     N_("Allow different types as args of ? operator") },
1277   { "-fno-cond-mismatch", "" },
1278   { "-fdollars-in-identifiers",
1279     N_("Allow the use of $ inside identifiers") },
1280   { "-fno-dollars-in-identifiers", "" },
1281   { "-fpreprocessed", "" },
1282   { "-fno-preprocessed", "" },
1283   { "-fshort-double",
1284     N_("Use the same size for double as for float") },
1285   { "-fno-short-double", "" },
1286   { "-fshort-enums",
1287     N_("Use the smallest fitting integer to hold enums") },
1288   { "-fno-short-enums", "" },
1289   { "-fshort-wchar",
1290     N_("Override the underlying type for wchar_t to `unsigned short'") },
1291   { "-fno-short-wchar", "" },
1292 
1293   { "-Wall",
1294     N_("Enable most warning messages") },
1295   { "-Wbad-function-cast",
1296     N_("Warn about casting functions to incompatible types") },
1297   { "-Wno-bad-function-cast", "" },
1298   { "-Wmissing-format-attribute",
1299     N_("Warn about functions which might be candidates for format attributes") },
1300   { "-Wno-missing-format-attribute", "" },
1301   { "-Wcast-qual",
1302     N_("Warn about casts which discard qualifiers") },
1303   { "-Wno-cast-qual", "" },
1304   { "-Wchar-subscripts",
1305     N_("Warn about subscripts whose type is 'char'") },
1306   { "-Wno-char-subscripts", "" },
1307   { "-Wcomment",
1308     N_("Warn if nested comments are detected") },
1309   { "-Wno-comment", "" },
1310   { "-Wcomments",
1311     N_("Warn if nested comments are detected") },
1312   { "-Wno-comments", "" },
1313   { "-Wconversion",
1314     N_("Warn about possibly confusing type conversions") },
1315   { "-Wno-conversion", "" },
1316   { "-Wdiv-by-zero", "" },
1317   { "-Wno-div-by-zero",
1318     N_("Do not warn about compile-time integer division by zero") },
1319   { "-Wfloat-equal",
1320     N_("Warn about testing equality of floating point numbers") },
1321   { "-Wno-float-equal", "" },
1322   { "-Wformat",
1323     N_("Warn about printf/scanf/strftime/strfmon format anomalies") },
1324   { "-Wno-format", "" },
1325   { "-Wformat-extra-args", "" },
1326   { "-Wno-format-extra-args",
1327     N_("Don't warn about too many arguments to format functions") },
1328   { "-Wformat-nonliteral",
1329     N_("Warn about non-string-literal format strings") },
1330   { "-Wno-format-nonliteral", "" },
1331   { "-Wformat-security",
1332     N_("Warn about possible security problems with format functions") },
1333   { "-Wno-format-security", "" },
1334   { "-Wformat-y2k", "" },
1335   { "-Wno-format-y2k",
1336     N_("Don't warn about strftime formats yielding 2 digit years") },
1337   { "-Wimplicit-function-declaration",
1338     N_("Warn about implicit function declarations") },
1339   { "-Wno-implicit-function-declaration", "" },
1340   { "-Werror-implicit-function-declaration", "" },
1341   { "-Wimplicit-int",
1342     N_("Warn when a declaration does not specify a type") },
1343   { "-Wno-implicit-int", "" },
1344   { "-Wimplicit", "" },
1345   { "-Wno-implicit", "" },
1346   { "-Wimport",
1347     N_("Warn about the use of the #import directive") },
1348   { "-Wno-import", "" },
1349   { "-Wlong-long","" },
1350   { "-Wno-long-long",
1351     N_("Do not warn about using 'long long' when -pedantic") },
1352   { "-Wmain",
1353     N_("Warn about suspicious declarations of main") },
1354   { "-Wno-main", "" },
1355   { "-Wmissing-braces",
1356     N_("Warn about possibly missing braces around initializers") },
1357   { "-Wno-missing-braces", "" },
1358   { "-Wmissing-declarations",
1359     N_("Warn about global funcs without previous declarations") },
1360   { "-Wno-missing-declarations", "" },
1361   { "-Wmissing-prototypes",
1362     N_("Warn about global funcs without prototypes") },
1363   { "-Wno-missing-prototypes", "" },
1364   { "-Wmultichar",
1365     N_("Warn about use of multicharacter literals") },
1366   { "-Wno-multichar", "" },
1367   { "-Wnested-externs",
1368     N_("Warn about externs not at file scope level") },
1369   { "-Wno-nested-externs", "" },
1370   { "-Wparentheses",
1371     N_("Warn about possible missing parentheses") },
1372   { "-Wno-parentheses", "" },
1373   { "-Wpointer-arith",
1374     N_("Warn about function pointer arithmetic") },
1375   { "-Wno-pointer-arith", "" },
1376   { "-Wredundant-decls",
1377     N_("Warn about multiple declarations of the same object") },
1378   { "-Wno-redundant-decls", "" },
1379   { "-Wreturn-type",
1380     N_("Warn whenever a function's return-type defaults to int") },
1381   { "-Wno-return-type", "" },
1382   { "-Wsequence-point",
1383     N_("Warn about possible violations of sequence point rules") },
1384   { "-Wno-sequence-point", "" },
1385   { "-Wsign-compare",
1386     N_("Warn about signed/unsigned comparisons") },
1387   { "-Wno-sign-compare", "" },
1388   { "-Wstrict-prototypes",
1389     N_("Warn about non-prototyped function decls") },
1390   { "-Wno-strict-prototypes", "" },
1391   { "-Wtraditional",
1392     N_("Warn about constructs whose meanings change in ISO C") },
1393   { "-Wno-traditional", "" },
1394   { "-Wtrigraphs",
1395     N_("Warn when trigraphs are encountered") },
1396   { "-Wno-trigraphs", "" },
1397   { "-Wundef", "" },
1398   { "-Wno-undef", "" },
1399   { "-Wunknown-pragmas",
1400     N_("Warn about unrecognized pragmas") },
1401   { "-Wno-unknown-pragmas", "" },
1402   { "-Wwrite-strings",
1403     N_("Mark strings as 'const char *'") },
1404   { "-Wno-write-strings", "" },
1405   { "-Wbounded",
1406     N_("Fake bounds checking option") },
1407   { "-Wno-bounded", "" },
1408 
1409 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1410 
1411 #include "options.h"
1412 
1413 };
1414 
1415 /* Here is a table, controlled by the tm.h file, listing each -m switch
1416    and which bits in `target_switches' it should set or clear.
1417    If VALUE is positive, it is bits to set.
1418    If VALUE is negative, -VALUE is bits to clear.
1419    (The sign bit is not used so there is no confusion.)  */
1420 
1421 static const struct
1422 {
1423   const char *const name;
1424   const int value;
1425   const char *const description;
1426 }
1427 target_switches[] = TARGET_SWITCHES;
1428 
1429 /* This table is similar, but allows the switch to have a value.  */
1430 
1431 #ifdef TARGET_OPTIONS
1432 static const struct
1433 {
1434   const char *const prefix;
1435   const char **const variable;
1436   const char *const description;
1437 }
1438 target_options[] = TARGET_OPTIONS;
1439 #endif
1440 
1441 /* Options controlling warnings.  */
1442 
1443 /* Don't print warning messages.  -w.  */
1444 
1445 int inhibit_warnings = 0;
1446 
1447 /* Don't suppress warnings from system headers.  -Wsystem-headers.  */
1448 
1449 int warn_system_headers = 0;
1450 
1451 /* Print various extra warnings.  -W.  */
1452 
1453 int extra_warnings = 0;
1454 
1455 /* Treat warnings as errors.  -Werror.  */
1456 
1457 int warnings_are_errors = 0;
1458 
1459 /* Nonzero to warn about unused variables, functions et.al.  */
1460 
1461 int warn_unused_function;
1462 int warn_unused_label;
1463 int warn_unused_parameter;
1464 int warn_unused_variable;
1465 int warn_unused_value;
1466 
1467 /* Nonzero to warn about code which is never reached.  */
1468 
1469 int warn_notreached;
1470 
1471 /* Nonzero to warn about variables used before they are initialized.  */
1472 
1473 int warn_uninitialized;
1474 
1475 /* Nonzero means warn about all declarations which shadow others.  */
1476 
1477 int warn_shadow;
1478 
1479 /* Warn if a switch on an enum, that does not have a default case,
1480    fails to have a case for every enum value.  */
1481 
1482 int warn_switch;
1483 
1484 /* Warn if a switch does not have a default case.  */
1485 
1486 int warn_switch_default;
1487 
1488 /* Warn if a switch on an enum fails to have a case for every enum
1489    value (regardless of the presence or otherwise of a default case).  */
1490 
1491 int warn_switch_enum;
1492 
1493 /* Nonzero means warn about function definitions that default the return type
1494    or that use a null return and have a return-type other than void.  */
1495 
1496 int warn_return_type;
1497 
1498 /* Nonzero means warn about pointer casts that increase the required
1499    alignment of the target type (and might therefore lead to a crash
1500    due to a misaligned access).  */
1501 
1502 int warn_cast_align;
1503 
1504 /* Nonzero means warn about any objects definitions whose size is larger
1505    than N bytes.  Also want about function definitions whose returned
1506    values are larger than N bytes. The value N is in `larger_than_size'.  */
1507 
1508 int warn_larger_than;
1509 HOST_WIDE_INT larger_than_size;
1510 
1511 /* Nonzero means warn about any function whose stack usage is larger
1512    than N bytes.  The value N is in `stack_larger_than_size'.  */
1513 
1514 int warn_stack_larger_than;
1515 HOST_WIDE_INT stack_larger_than_size;
1516 
1517 /* Nonzero means warn if inline function is too large.  */
1518 
1519 int warn_inline;
1520 
1521 /* Warn if a function returns an aggregate,
1522    since there are often incompatible calling conventions for doing this.  */
1523 
1524 int warn_aggregate_return;
1525 
1526 /* Warn if packed attribute on struct is unnecessary and inefficient.  */
1527 
1528 int warn_packed;
1529 
1530 /* Warn when gcc pads a structure to an alignment boundary.  */
1531 
1532 int warn_padded;
1533 
1534 /* Warn when an optimization pass is disabled.  */
1535 
1536 int warn_disabled_optimization;
1537 
1538 /* Warn about functions which might be candidates for attribute noreturn.  */
1539 
1540 int warn_missing_noreturn;
1541 
1542 /* Nonzero means warn about uses of __attribute__((deprecated))
1543    declarations.  */
1544 
1545 int warn_deprecated_decl = 1;
1546 
1547 /* Nonzero means warn about constructs which might not be
1548    strict-aliasing safe.  */
1549 
1550 int warn_strict_aliasing;
1551 
1552 /* Nonzero means warn about any automatic declaration whose size is not
1553    constant.  */
1554 
1555 int warn_variable_decl;
1556 
1557 /* Likewise for -W.  */
1558 
1559 static const lang_independent_options W_options[] =
1560 {
1561   {"unused-function", &warn_unused_function, 1,
1562    N_("Warn when a function is unused") },
1563   {"unused-label", &warn_unused_label, 1,
1564    N_("Warn when a label is unused") },
1565   {"unused-parameter", &warn_unused_parameter, 1,
1566    N_("Warn when a function parameter is unused") },
1567   {"unused-variable", &warn_unused_variable, 1,
1568    N_("Warn when a variable is unused") },
1569   {"unused-value", &warn_unused_value, 1,
1570    N_("Warn when an expression value is unused") },
1571   {"system-headers", &warn_system_headers, 1,
1572    N_("Do not suppress warnings from system headers") },
1573   {"error", &warnings_are_errors, 1,
1574    N_("Treat all warnings as errors") },
1575   {"shadow", &warn_shadow, 1,
1576    N_("Warn when one local variable shadows another") },
1577   {"switch", &warn_switch, 1,
1578    N_("Warn about enumerated switches, with no default, missing a case") },
1579   {"switch-default", &warn_switch_default, 1,
1580    N_("Warn about enumerated switches missing a default case") },
1581   {"switch-enum", &warn_switch_enum, 1,
1582    N_("Warn about all enumerated switches missing a specific case") },
1583   {"aggregate-return", &warn_aggregate_return, 1,
1584    N_("Warn about returning structures, unions or arrays") },
1585   {"cast-align", &warn_cast_align, 1,
1586    N_("Warn about pointer casts which increase alignment") },
1587   {"unreachable-code", &warn_notreached, 1,
1588    N_("Warn about code that will never be executed") },
1589   {"uninitialized", &warn_uninitialized, 1,
1590    N_("Warn about uninitialized automatic variables") },
1591   {"inline", &warn_inline, 1,
1592    N_("Warn when an inlined function cannot be inlined") },
1593   {"packed", &warn_packed, 1,
1594    N_("Warn when the packed attribute has no effect on struct layout") },
1595   {"padded", &warn_padded, 1,
1596    N_("Warn when padding is required to align struct members") },
1597   {"disabled-optimization", &warn_disabled_optimization, 1,
1598    N_("Warn when an optimization pass is disabled") },
1599   {"deprecated-declarations", &warn_deprecated_decl, 1,
1600    N_("Warn about uses of __attribute__((deprecated)) declarations") },
1601   {"missing-noreturn", &warn_missing_noreturn, 1,
1602    N_("Warn about functions which might be candidates for attribute noreturn") },
1603   {"strict-aliasing", &warn_strict_aliasing, 1,
1604    N_ ("Warn about code which might break the strict aliasing rules") },
1605   {"stack-protector", &warn_stack_protector, 1,
1606    N_("Warn when disabling stack protector for some reason")},
1607   {"trampolines", &warn_trampolines, 1,
1608    N_("Warn when trampolines are emitted")},
1609   {"variable-decl", &warn_variable_decl, 1,
1610    N_("Warn about variable-sized declarations")},
1611 };
1612 
1613 void
1614 set_Wunused (setting)
1615      int setting;
1616 {
1617   warn_unused_function = setting;
1618   warn_unused_label = setting;
1619   /* Unused function parameter warnings are reported when either ``-W
1620      -Wunused'' or ``-Wunused-parameter'' is specified.  Differentiate
1621      -Wunused by setting WARN_UNUSED_PARAMETER to -1.  */
1622   if (!setting)
1623     warn_unused_parameter = 0;
1624   else if (!warn_unused_parameter)
1625     warn_unused_parameter = -1;
1626   warn_unused_variable = setting;
1627   warn_unused_value = setting;
1628 }
1629 
1630 /* The following routines are useful in setting all the flags that
1631    -ffast-math and -fno-fast-math imply.  */
1632 
1633 void
1634 set_fast_math_flags (set)
1635      int set;
1636 {
1637   flag_trapping_math = !set;
1638   flag_unsafe_math_optimizations = set;
1639   flag_finite_math_only = set;
1640   flag_errno_math = !set;
1641   if (set)
1642     flag_signaling_nans = 0;
1643 }
1644 
1645 /* Return true iff flags are set as if -ffast-math.  */
1646 bool
1647 fast_math_flags_set_p ()
1648 {
1649   return (!flag_trapping_math
1650 	  && flag_unsafe_math_optimizations
1651 	  && flag_finite_math_only
1652 	  && !flag_errno_math);
1653 }
1654 
1655 
1656 /* Output files for assembler code (real compiler output)
1657    and debugging dumps.  */
1658 
1659 FILE *asm_out_file;
1660 FILE *aux_info_file;
1661 FILE *rtl_dump_file = NULL;
1662 
1663 /* Decode the string P as an integral parameter.
1664    If the string is indeed an integer return its numeric value else
1665    issue an Invalid Option error for the option PNAME and return DEFVAL.
1666    If PNAME is zero just return DEFVAL, do not call error.  */
1667 
1668 int
1669 read_integral_parameter (p, pname, defval)
1670      const char *p;
1671      const char *pname;
1672      const int  defval;
1673 {
1674   const char *endp = p;
1675 
1676   while (*endp)
1677     {
1678       if (ISDIGIT (*endp))
1679 	endp++;
1680       else
1681 	break;
1682     }
1683 
1684   if (*endp != 0)
1685     {
1686       if (pname != 0)
1687 	error ("invalid option `%s'", pname);
1688       return defval;
1689     }
1690 
1691   return atoi (p);
1692 }
1693 
1694 /* This calls abort and is used to avoid problems when abort is a macro.
1695    It is used when we need to pass the address of abort.  */
1696 
1697 void
1698 do_abort ()
1699 {
1700   abort ();
1701 }
1702 
1703 /* When `malloc.c' is compiled with `rcheck' defined,
1704    it calls this function to report clobberage.  */
1705 
1706 void
1707 botch (s)
1708      const char *s ATTRIBUTE_UNUSED;
1709 {
1710   abort ();
1711 }
1712 
1713 /* Return the logarithm of X, base 2, considering X unsigned,
1714    if X is a power of 2.  Otherwise, returns -1.
1715 
1716    This should be used via the `exact_log2' macro.  */
1717 
1718 int
1719 exact_log2_wide (x)
1720      unsigned HOST_WIDE_INT x;
1721 {
1722   int log = 0;
1723   /* Test for 0 or a power of 2.  */
1724   if (x == 0 || x != (x & -x))
1725     return -1;
1726   while ((x >>= 1) != 0)
1727     log++;
1728   return log;
1729 }
1730 
1731 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1732    If X is 0, return -1.
1733 
1734    This should be used via the floor_log2 macro.  */
1735 
1736 int
1737 floor_log2_wide (x)
1738      unsigned HOST_WIDE_INT x;
1739 {
1740   int log = -1;
1741   while (x != 0)
1742     log++,
1743     x >>= 1;
1744   return log;
1745 }
1746 
1747 /* Handler for fatal signals, such as SIGSEGV.  These are transformed
1748    into ICE messages, which is much more user friendly.  */
1749 
1750 static void
1751 crash_signal (signo)
1752      int signo;
1753 {
1754   internal_error ("%s", strsignal (signo));
1755 }
1756 
1757 /* Strip off a legitimate source ending from the input string NAME of
1758    length LEN.  Rather than having to know the names used by all of
1759    our front ends, we strip off an ending of a period followed by
1760    up to five characters.  (Java uses ".class".)  */
1761 
1762 void
1763 strip_off_ending (name, len)
1764      char *name;
1765      int len;
1766 {
1767   int i;
1768   for (i = 2; i < 6 && len > i; i++)
1769     {
1770       if (name[len - i] == '.')
1771 	{
1772 	  name[len - i] = '\0';
1773 	  break;
1774 	}
1775     }
1776 }
1777 
1778 /* Output a quoted string.  */
1779 
1780 void
1781 output_quoted_string (asm_file, string)
1782      FILE *asm_file;
1783      const char *string;
1784 {
1785 #ifdef OUTPUT_QUOTED_STRING
1786   OUTPUT_QUOTED_STRING (asm_file, string);
1787 #else
1788   char c;
1789 
1790   putc ('\"', asm_file);
1791   while ((c = *string++) != 0)
1792     {
1793       if (ISPRINT (c))
1794 	{
1795 	  if (c == '\"' || c == '\\')
1796 	    putc ('\\', asm_file);
1797 	  putc (c, asm_file);
1798 	}
1799       else
1800 	fprintf (asm_file, "\\%03o", (unsigned char) c);
1801     }
1802   putc ('\"', asm_file);
1803 #endif
1804 }
1805 
1806 /* Output NAME into FILE after having turned it into something
1807    usable as an identifier in a target's assembly file.  */
1808 void
1809 output_clean_symbol_name (file, name)
1810      FILE *file;
1811      const char *name;
1812 {
1813   /* Make a copy of NAME.  */
1814   char *id = xstrdup (name);
1815 
1816   /* Make it look like a valid identifier for an assembler.  */
1817   clean_symbol_name (id);
1818 
1819   fputs (id, file);
1820   free (id);
1821 }
1822 
1823 
1824 /* Output a file name in the form wanted by System V.  */
1825 
1826 void
1827 output_file_directive (asm_file, input_name)
1828      FILE *asm_file;
1829      const char *input_name;
1830 {
1831   int len = strlen (input_name);
1832   const char *na = input_name + len;
1833 
1834   /* NA gets INPUT_NAME sans directory names.  */
1835   while (na > input_name)
1836     {
1837       if (IS_DIR_SEPARATOR (na[-1]))
1838 	break;
1839       na--;
1840     }
1841 
1842 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1843   ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1844 #else
1845 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1846   ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1847 #else
1848   fprintf (asm_file, "\t.file\t");
1849   output_quoted_string (asm_file, na);
1850   fputc ('\n', asm_file);
1851 #endif
1852 #endif
1853 }
1854 
1855 /* Routine to open a dump file.  Return true if the dump file is enabled.  */
1856 
1857 static int
1858 open_dump_file (index, decl)
1859      enum dump_file_index index;
1860      tree decl;
1861 {
1862   char *dump_name;
1863   const char *open_arg;
1864   char seq[16];
1865 
1866   if (! dump_file[index].enabled)
1867     return 0;
1868 
1869   timevar_push (TV_DUMP);
1870   if (rtl_dump_file != NULL)
1871     fclose (rtl_dump_file);
1872 
1873   sprintf (seq, DUMPFILE_FORMAT, index);
1874 
1875   if (! dump_file[index].initialized)
1876     {
1877       /* If we've not initialized the files, do so now.  */
1878       if (graph_dump_format != no_graph
1879 	  && dump_file[index].graph_dump_p)
1880 	{
1881 	  dump_name = concat (seq, dump_file[index].extension, NULL);
1882 	  clean_graph_dump_file (dump_base_name, dump_name);
1883 	  free (dump_name);
1884 	}
1885       dump_file[index].initialized = 1;
1886       open_arg = "w";
1887     }
1888   else
1889     open_arg = "a";
1890 
1891   dump_name = concat (dump_base_name, seq,
1892 		      dump_file[index].extension, NULL);
1893 
1894   rtl_dump_file = fopen (dump_name, open_arg);
1895   if (rtl_dump_file == NULL)
1896     fatal_io_error ("can't open %s", dump_name);
1897 
1898   free (dump_name);
1899 
1900   if (decl)
1901     fprintf (rtl_dump_file, "\n;; Function %s%s\n\n",
1902 	     (*lang_hooks.decl_printable_name) (decl, 2),
1903 	     cfun->function_frequency == FUNCTION_FREQUENCY_HOT
1904 	     ? " (hot)"
1905 	     : cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED
1906 	     ? " (unlikely executed)"
1907 	     : "");
1908 
1909   timevar_pop (TV_DUMP);
1910   return 1;
1911 }
1912 
1913 /* Routine to close a dump file.  */
1914 
1915 static void
1916 close_dump_file (index, func, insns)
1917      enum dump_file_index index;
1918      void (*func) PARAMS ((FILE *, rtx));
1919      rtx insns;
1920 {
1921   if (! rtl_dump_file)
1922     return;
1923 
1924   timevar_push (TV_DUMP);
1925   if (insns
1926       && graph_dump_format != no_graph
1927       && dump_file[index].graph_dump_p)
1928     {
1929       char seq[16];
1930       char *suffix;
1931 
1932       sprintf (seq, DUMPFILE_FORMAT, index);
1933       suffix = concat (seq, dump_file[index].extension, NULL);
1934       print_rtl_graph_with_bb (dump_base_name, suffix, insns);
1935       free (suffix);
1936     }
1937 
1938   if (func && insns)
1939     func (rtl_dump_file, insns);
1940 
1941   fflush (rtl_dump_file);
1942   fclose (rtl_dump_file);
1943 
1944   rtl_dump_file = NULL;
1945   timevar_pop (TV_DUMP);
1946 }
1947 
1948 /* Do any final processing required for the declarations in VEC, of
1949    which there are LEN.  We write out inline functions and variables
1950    that have been deferred until this point, but which are required.
1951    Returns nonzero if anything was put out.  */
1952 
1953 int
1954 wrapup_global_declarations (vec, len)
1955      tree *vec;
1956      int len;
1957 {
1958   tree decl;
1959   int i;
1960   int reconsider;
1961   int output_something = 0;
1962 
1963   for (i = 0; i < len; i++)
1964     {
1965       decl = vec[i];
1966 
1967       /* We're not deferring this any longer.  Assignment is
1968 	 conditional to avoid needlessly dirtying PCH pages. */
1969       if (DECL_DEFER_OUTPUT (decl) != 0)
1970 	DECL_DEFER_OUTPUT (decl) = 0;
1971 
1972       if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0)
1973 	(*lang_hooks.finish_incomplete_decl) (decl);
1974     }
1975 
1976   /* Now emit any global variables or functions that we have been
1977      putting off.  We need to loop in case one of the things emitted
1978      here references another one which comes earlier in the list.  */
1979   do
1980     {
1981       reconsider = 0;
1982       for (i = 0; i < len; i++)
1983 	{
1984 	  decl = vec[i];
1985 
1986 	  if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
1987 	    continue;
1988 
1989 	  /* Don't write out static consts, unless we still need them.
1990 
1991 	     We also keep static consts if not optimizing (for debugging),
1992 	     unless the user specified -fno-keep-static-consts.
1993 	     ??? They might be better written into the debug information.
1994 	     This is possible when using DWARF.
1995 
1996 	     A language processor that wants static constants to be always
1997 	     written out (even if it is not used) is responsible for
1998 	     calling rest_of_decl_compilation itself.  E.g. the C front-end
1999 	     calls rest_of_decl_compilation from finish_decl.
2000 	     One motivation for this is that is conventional in some
2001 	     environments to write things like:
2002 	     static const char rcsid[] = "... version string ...";
2003 	     intending to force the string to be in the executable.
2004 
2005 	     A language processor that would prefer to have unneeded
2006 	     static constants "optimized away" would just defer writing
2007 	     them out until here.  E.g. C++ does this, because static
2008 	     constants are often defined in header files.
2009 
2010 	     ??? A tempting alternative (for both C and C++) would be
2011 	     to force a constant to be written if and only if it is
2012 	     defined in a main file, as opposed to an include file.  */
2013 
2014 	  if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
2015 	    {
2016 	      bool needed = 1;
2017 
2018 	      if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2019 		/* needed */;
2020 	      else if (DECL_COMDAT (decl))
2021 		needed = 0;
2022 	      else if (TREE_READONLY (decl) && !TREE_PUBLIC (decl)
2023 		       && (optimize || !flag_keep_static_consts
2024 			   || DECL_ARTIFICIAL (decl)))
2025 		needed = 0;
2026 
2027 	      if (needed)
2028 		{
2029 		  reconsider = 1;
2030 		  rest_of_decl_compilation (decl, NULL, 1, 1);
2031 		}
2032 	    }
2033 
2034 	  if (TREE_CODE (decl) == FUNCTION_DECL
2035 	      && DECL_INITIAL (decl) != 0
2036 	      && DECL_SAVED_INSNS (decl) != 0
2037 	      && (flag_keep_inline_functions
2038 		  || (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
2039 		  || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
2040 	    {
2041 	      reconsider = 1;
2042 	      output_inline_function (decl);
2043 	    }
2044 	}
2045 
2046       if (reconsider)
2047 	output_something = 1;
2048     }
2049   while (reconsider);
2050 
2051   return output_something;
2052 }
2053 
2054 /* Issue appropriate warnings for the global declarations in VEC (of
2055    which there are LEN).  Output debugging information for them.  */
2056 
2057 void
2058 check_global_declarations (vec, len)
2059      tree *vec;
2060      int len;
2061 {
2062   tree decl;
2063   int i;
2064 
2065   for (i = 0; i < len; i++)
2066     {
2067       decl = vec[i];
2068 
2069       if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
2070 	  && ! TREE_ASM_WRITTEN (decl))
2071 	/* Cancel the RTL for this decl so that, if debugging info
2072 	   output for global variables is still to come,
2073 	   this one will be omitted.  */
2074 	SET_DECL_RTL (decl, NULL_RTX);
2075 
2076       /* Warn about any function
2077 	 declared static but not defined.
2078 	 We don't warn about variables,
2079 	 because many programs have static variables
2080 	 that exist only to get some text into the object file.  */
2081       if (TREE_CODE (decl) == FUNCTION_DECL
2082 	  && (warn_unused_function
2083 	      || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2084 	  && DECL_INITIAL (decl) == 0
2085 	  && DECL_EXTERNAL (decl)
2086 	  && ! DECL_ARTIFICIAL (decl)
2087 	  && ! TREE_PUBLIC (decl))
2088 	{
2089 	  if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2090 	    pedwarn_with_decl (decl,
2091 			       "`%s' used but never defined");
2092 	  else
2093 	    warning_with_decl (decl,
2094 			       "`%s' declared `static' but never defined");
2095 	  /* This symbol is effectively an "extern" declaration now.  */
2096 	  TREE_PUBLIC (decl) = 1;
2097 	  assemble_external (decl);
2098 	}
2099 
2100       /* Warn about static fns or vars defined but not used.  */
2101       if (((warn_unused_function && TREE_CODE (decl) == FUNCTION_DECL)
2102 	   /* We don't warn about "static const" variables because the
2103 	      "rcs_id" idiom uses that construction.  */
2104 	   || (warn_unused_variable
2105 	       && TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
2106 	  && ! DECL_IN_SYSTEM_HEADER (decl)
2107 	  && ! TREE_USED (decl)
2108 	  /* The TREE_USED bit for file-scope decls is kept in the identifier,
2109 	     to handle multiple external decls in different scopes.  */
2110 	  && ! TREE_USED (DECL_NAME (decl))
2111 	  && ! DECL_EXTERNAL (decl)
2112 	  && ! TREE_PUBLIC (decl)
2113 	  /* Global register variables must be declared to reserve them.  */
2114 	  && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
2115 	  /* Otherwise, ask the language.  */
2116 	  && (*lang_hooks.decls.warn_unused_global) (decl))
2117 	warning_with_decl (decl, "`%s' defined but not used");
2118 
2119       /* Avoid confusing the debug information machinery when there are
2120 	 errors.  */
2121       if (errorcount == 0 && sorrycount == 0)
2122 	{
2123 	  timevar_push (TV_SYMOUT);
2124 	  (*debug_hooks->global_decl) (decl);
2125 	  timevar_pop (TV_SYMOUT);
2126 	}
2127     }
2128 }
2129 
2130 /* Save the current INPUT_FILENAME and LINENO on the top entry in the
2131    INPUT_FILE_STACK.  Push a new entry for FILE and LINE, and set the
2132    INPUT_FILENAME and LINENO accordingly.  */
2133 
2134 void
2135 push_srcloc (file, line)
2136      const char *file;
2137      int line;
2138 {
2139   struct file_stack *fs;
2140 
2141   if (input_file_stack)
2142     {
2143       input_file_stack->name = input_filename;
2144       input_file_stack->line = lineno;
2145     }
2146 
2147   fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2148   fs->name = input_filename = file;
2149   fs->line = lineno = line;
2150   fs->next = input_file_stack;
2151   input_file_stack = fs;
2152   input_file_stack_tick++;
2153 }
2154 
2155 /* Pop the top entry off the stack of presently open source files.
2156    Restore the INPUT_FILENAME and LINENO from the new topmost entry on
2157    the stack.  */
2158 
2159 void
2160 pop_srcloc ()
2161 {
2162   struct file_stack *fs;
2163 
2164   fs = input_file_stack;
2165   input_file_stack = fs->next;
2166   free (fs);
2167   input_file_stack_tick++;
2168   /* The initial source file is never popped.  */
2169   if (!input_file_stack)
2170     abort ();
2171   input_filename = input_file_stack->name;
2172   lineno = input_file_stack->line;
2173 }
2174 
2175 /* Compile an entire translation unit.  Write a file of assembly
2176    output and various debugging dumps.  */
2177 
2178 static void
2179 compile_file ()
2180 {
2181   /* Initialize yet another pass.  */
2182 
2183   init_final (main_input_filename);
2184   init_branch_prob (aux_base_name);
2185 
2186   timevar_push (TV_PARSE);
2187 
2188   /* Call the parser, which parses the entire file (calling
2189      rest_of_compilation for each function).  */
2190   (*lang_hooks.parse_file) (set_yydebug);
2191 
2192   /* In case there were missing block closers,
2193      get us back to the global binding level.  */
2194   (*lang_hooks.clear_binding_stack) ();
2195 
2196   /* Compilation is now finished except for writing
2197      what's left of the symbol table output.  */
2198   timevar_pop (TV_PARSE);
2199 
2200   if (flag_syntax_only)
2201     return;
2202 
2203   (*lang_hooks.decls.final_write_globals)();
2204 
2205     /* This must occur after the loop to output deferred functions.  Else
2206        the profiler initializer would not be emitted if all the functions
2207        in this compilation unit were deferred.
2208 
2209        output_func_start_profiler can not cause any additional functions or
2210        data to need to be output, so it need not be in the deferred function
2211        loop above.  */
2212     output_func_start_profiler ();
2213 
2214   /* Write out any pending weak symbol declarations.  */
2215 
2216   weak_finish ();
2217 
2218   /* Do dbx symbols.  */
2219   timevar_push (TV_SYMOUT);
2220 
2221 #ifdef DWARF2_UNWIND_INFO
2222   if (dwarf2out_do_frame ())
2223     dwarf2out_frame_finish ();
2224 #endif
2225 
2226   (*debug_hooks->finish) (main_input_filename);
2227   timevar_pop (TV_SYMOUT);
2228 
2229   /* Output some stuff at end of file if nec.  */
2230 
2231   dw2_output_indirect_constants ();
2232 
2233   end_final (aux_base_name);
2234 
2235   if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
2236     {
2237       timevar_push (TV_DUMP);
2238       open_dump_file (DFI_bp, NULL);
2239 
2240       end_branch_prob ();
2241 
2242       close_dump_file (DFI_bp, NULL, NULL_RTX);
2243       timevar_pop (TV_DUMP);
2244     }
2245 
2246 #ifdef ASM_FILE_END
2247   ASM_FILE_END (asm_out_file);
2248 #endif
2249 
2250   /* Attach a special .ident directive to the end of the file to identify
2251      the version of GCC which compiled this code.  The format of the .ident
2252      string is patterned after the ones produced by native SVR4 compilers.  */
2253 #ifdef IDENT_ASM_OP
2254   if (!flag_no_ident)
2255     fprintf (asm_out_file, "%s\"GCC: (GNU) %s\"\n",
2256 	     IDENT_ASM_OP, version_string);
2257 #endif
2258 
2259   if (optimize > 0 && open_dump_file (DFI_combine, NULL))
2260     {
2261       timevar_push (TV_DUMP);
2262       dump_combine_total_stats (rtl_dump_file);
2263       close_dump_file (DFI_combine, NULL, NULL_RTX);
2264       timevar_pop (TV_DUMP);
2265     }
2266 }
2267 
2268 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2269    and TYPE_DECL nodes.
2270 
2271    This does nothing for local (non-static) variables, unless the
2272    variable is a register variable with an ASMSPEC.  In that case, or
2273    if the variable is not an automatic, it sets up the RTL and
2274    outputs any assembler code (label definition, storage allocation
2275    and initialization).
2276 
2277    DECL is the declaration.  If ASMSPEC is nonzero, it specifies
2278    the assembler symbol name to be used.  TOP_LEVEL is nonzero
2279    if this declaration is not within a function.  */
2280 
2281 void
2282 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2283      tree decl;
2284      const char *asmspec;
2285      int top_level;
2286      int at_end;
2287 {
2288   /* Declarations of variables, and of functions defined elsewhere.  */
2289 
2290 /* The most obvious approach, to put an #ifndef around where
2291    this macro is used, doesn't work since it's inside a macro call.  */
2292 #ifndef ASM_FINISH_DECLARE_OBJECT
2293 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2294 #endif
2295 
2296   /* We deferred calling assemble_alias so that we could collect
2297      other attributes such as visibility.  Emit the alias now.  */
2298   {
2299     tree alias;
2300     alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl));
2301     if (alias)
2302       {
2303 	alias = TREE_VALUE (TREE_VALUE (alias));
2304 	alias = get_identifier (TREE_STRING_POINTER (alias));
2305 	assemble_alias (decl, alias);
2306       }
2307   }
2308 
2309   /* Forward declarations for nested functions are not "external",
2310      but we need to treat them as if they were.  */
2311   if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2312       || TREE_CODE (decl) == FUNCTION_DECL)
2313     {
2314       timevar_push (TV_VARCONST);
2315 
2316       if (asmspec)
2317 	make_decl_rtl (decl, asmspec);
2318 
2319       /* Don't output anything when a tentative file-scope definition
2320 	 is seen.  But at end of compilation, do output code for them.  */
2321       if (at_end || !DECL_DEFER_OUTPUT (decl))
2322 	assemble_variable (decl, top_level, at_end, 0);
2323       if (decl == last_assemble_variable_decl)
2324 	{
2325 	  ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2326 				     top_level, at_end);
2327 	}
2328 
2329       timevar_pop (TV_VARCONST);
2330     }
2331   else if (DECL_REGISTER (decl) && asmspec != 0)
2332     {
2333       if (decode_reg_name (asmspec) >= 0)
2334 	{
2335 	  SET_DECL_RTL (decl, NULL_RTX);
2336 	  make_decl_rtl (decl, asmspec);
2337 	}
2338       else
2339 	{
2340 	  error ("invalid register name `%s' for register variable", asmspec);
2341 	  DECL_REGISTER (decl) = 0;
2342 	  if (!top_level)
2343 	    expand_decl (decl);
2344 	}
2345     }
2346 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2347   else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2348 	   && TREE_CODE (decl) == TYPE_DECL)
2349     {
2350       timevar_push (TV_SYMOUT);
2351       dbxout_symbol (decl, 0);
2352       timevar_pop (TV_SYMOUT);
2353     }
2354 #endif
2355 #ifdef SDB_DEBUGGING_INFO
2356   else if (write_symbols == SDB_DEBUG && top_level
2357 	   && TREE_CODE (decl) == TYPE_DECL)
2358     {
2359       timevar_push (TV_SYMOUT);
2360       sdbout_symbol (decl, 0);
2361       timevar_pop (TV_SYMOUT);
2362     }
2363 #endif
2364 #ifdef DWARF2_DEBUGGING_INFO
2365   else if ((write_symbols == DWARF2_DEBUG
2366 	   || write_symbols == VMS_AND_DWARF2_DEBUG)
2367 	   && top_level
2368 	   && TREE_CODE (decl) == TYPE_DECL)
2369     {
2370       timevar_push (TV_SYMOUT);
2371       dwarf2out_decl (decl);
2372       timevar_pop (TV_SYMOUT);
2373     }
2374 #endif
2375 }
2376 
2377 /* Called after finishing a record, union or enumeral type.  */
2378 
2379 void
2380 rest_of_type_compilation (type, toplev)
2381 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
2382      tree type;
2383      int toplev;
2384 #else
2385      tree type ATTRIBUTE_UNUSED;
2386      int toplev ATTRIBUTE_UNUSED;
2387 #endif
2388 {
2389   /* Avoid confusing the debug information machinery when there are
2390      errors.  */
2391   if (errorcount != 0 || sorrycount != 0)
2392     return;
2393 
2394   timevar_push (TV_SYMOUT);
2395 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2396   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2397     dbxout_symbol (TYPE_STUB_DECL (type), !toplev);
2398 #endif
2399 #ifdef SDB_DEBUGGING_INFO
2400   if (write_symbols == SDB_DEBUG)
2401     sdbout_symbol (TYPE_STUB_DECL (type), !toplev);
2402 #endif
2403 #ifdef DWARF2_DEBUGGING_INFO
2404   if ((write_symbols == DWARF2_DEBUG
2405        || write_symbols == VMS_AND_DWARF2_DEBUG)
2406       && toplev)
2407     dwarf2out_decl (TYPE_STUB_DECL (type));
2408 #endif
2409   timevar_pop (TV_SYMOUT);
2410 }
2411 
2412 /* This is called from finish_function (within langhooks.parse_file)
2413    after each top-level definition is parsed.
2414    It is supposed to compile that function or variable
2415    and output the assembler code for it.
2416    After we return, the tree storage is freed.  */
2417 
2418 void
2419 rest_of_compilation (decl)
2420      tree decl;
2421 {
2422   rtx insns;
2423   int tem;
2424   int failure = 0;
2425   int rebuild_label_notes_after_reload;
2426   int register_life_up_to_date;
2427 
2428   timevar_push (TV_REST_OF_COMPILATION);
2429 
2430   /* Now that we're out of the frontend, we shouldn't have any more
2431      CONCATs anywhere.  */
2432   generating_concat_p = 0;
2433 
2434   /* When processing delayed functions, prepare_function_start() won't
2435      have been run to re-initialize it.  */
2436   cse_not_expected = ! optimize;
2437 
2438   /* First, make sure that NOTE_BLOCK is set correctly for each
2439      NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note.  */
2440   if (!cfun->x_whole_function_mode_p)
2441     identify_blocks ();
2442 
2443   /* In function-at-a-time mode, we do not attempt to keep the BLOCK
2444      tree in sensible shape.  So, we just recalculate it here.  */
2445   if (cfun->x_whole_function_mode_p)
2446     reorder_blocks ();
2447 
2448   init_flow ();
2449 
2450   /* If we are reconsidering an inline function
2451      at the end of compilation, skip the stuff for making it inline.  */
2452 
2453   if (DECL_SAVED_INSNS (decl) == 0)
2454     {
2455       int inlinable = 0;
2456       tree parent;
2457       const char *lose;
2458 
2459       /* If this is nested inside an inlined external function, pretend
2460 	 it was only declared.  Since we cannot inline such functions,
2461 	 generating code for this one is not only not necessary but will
2462 	 confuse some debugging output writers.  */
2463       for (parent = DECL_CONTEXT (current_function_decl);
2464 	   parent != NULL_TREE;
2465 	   parent = get_containing_scope (parent))
2466 	if (TREE_CODE (parent) == FUNCTION_DECL
2467 	    && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
2468 	  {
2469 	    DECL_INITIAL (decl) = 0;
2470 	    goto exit_rest_of_compilation;
2471 	  }
2472 	else if (TYPE_P (parent))
2473 	  /* A function in a local class should be treated normally.  */
2474 	  break;
2475 
2476       /* If requested, consider whether to make this function inline.  */
2477       if ((DECL_INLINE (decl) && !flag_no_inline)
2478 	  || flag_inline_functions)
2479 	{
2480 	  timevar_push (TV_INTEGRATION);
2481 	  lose = function_cannot_inline_p (decl);
2482 	  timevar_pop (TV_INTEGRATION);
2483 	  if (lose || ! optimize)
2484 	    {
2485 	      if (warn_inline && DECL_INLINE (decl))
2486 		warning_with_decl (decl, lose);
2487 	      DECL_ABSTRACT_ORIGIN (decl) = 0;
2488 	      /* Don't really compile an extern inline function.
2489 		 If we can't make it inline, pretend
2490 		 it was only declared.  */
2491 	      if (DECL_EXTERNAL (decl))
2492 		{
2493 		  DECL_INITIAL (decl) = 0;
2494 		  goto exit_rest_of_compilation;
2495 		}
2496 	    }
2497           else
2498             {
2499 	      /* ??? Note that we used to just make it look like if
2500 		 the "inline" keyword was specified when we decide
2501 		 to inline it (because of -finline-functions).
2502 		 garloff at suse dot de, 2002-04-24: Add another flag to
2503 		 actually record this piece of information.  */
2504 	      if (!DECL_INLINE (decl))
2505 		DID_INLINE_FUNC (decl) = 1;
2506 	      inlinable = DECL_INLINE (decl) = 1;
2507 	    }
2508 	}
2509 
2510       insns = get_insns ();
2511 
2512       if (flag_propolice_protection) prepare_stack_protection (inlinable);
2513 
2514       /* Dump the rtl code if we are dumping rtl.  */
2515 
2516       if (open_dump_file (DFI_rtl, decl))
2517 	{
2518 	  if (DECL_SAVED_INSNS (decl))
2519 	    fprintf (rtl_dump_file, ";; (integrable)\n\n");
2520 	  close_dump_file (DFI_rtl, print_rtl, insns);
2521 	}
2522 
2523       /* Convert from NOTE_INSN_EH_REGION style notes, and do other
2524 	 sorts of eh initialization.  Delay this until after the
2525          initial rtl dump so that we can see the original nesting.  */
2526       convert_from_eh_region_ranges ();
2527 
2528       /* If function is inline, and we don't yet know whether to
2529          compile it by itself, defer decision till end of compilation.
2530          wrapup_global_declarations will (indirectly) call
2531          rest_of_compilation again for those functions that need to
2532          be output.  Also defer those functions that we are supposed
2533          to defer.  */
2534 
2535       if (inlinable
2536 	  || (DECL_INLINE (decl)
2537 	      && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2538 		   && ! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
2539 		   && ! flag_keep_inline_functions)
2540 		  || DECL_EXTERNAL (decl))))
2541 	DECL_DEFER_OUTPUT (decl) = 1;
2542 
2543       if (DECL_INLINE (decl))
2544 	/* DWARF wants separate debugging info for abstract and
2545 	   concrete instances of all inline functions, including those
2546 	   declared inline but not inlined, and those inlined even
2547 	   though they weren't declared inline.  Conveniently, that's
2548 	   what DECL_INLINE means at this point.  */
2549 	(*debug_hooks->deferred_inline_function) (decl);
2550 
2551       if (DECL_DEFER_OUTPUT (decl))
2552 	{
2553 	  /* If -Wreturn-type, we have to do a bit of compilation.  We just
2554 	     want to call cleanup the cfg to figure out whether or not we can
2555 	     fall off the end of the function; we do the minimum amount of
2556 	     work necessary to make that safe.  */
2557 	  if (warn_return_type)
2558 	    {
2559 	      int saved_optimize = optimize;
2560 
2561 	      optimize = 0;
2562 	      rebuild_jump_labels (insns);
2563 	      find_exception_handler_labels ();
2564 	      find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2565 	      cleanup_cfg (CLEANUP_PRE_SIBCALL | CLEANUP_PRE_LOOP);
2566 	      optimize = saved_optimize;
2567 
2568 	      /* CFG is no longer maintained up-to-date.  */
2569 	      free_bb_for_insn ();
2570 	    }
2571 
2572 	  set_nothrow_function_flags ();
2573 	  if (current_function_nothrow)
2574 	    /* Now we know that this can't throw; set the flag for the benefit
2575 	       of other functions later in this translation unit.  */
2576 	    TREE_NOTHROW (current_function_decl) = 1;
2577 
2578 	  timevar_push (TV_INTEGRATION);
2579 	  save_for_inline (decl);
2580 	  timevar_pop (TV_INTEGRATION);
2581 	  DECL_SAVED_INSNS (decl)->inlinable = inlinable;
2582 	  goto exit_rest_of_compilation;
2583 	}
2584 
2585       /* If specified extern inline but we aren't inlining it, we are
2586 	 done.  This goes for anything that gets here with DECL_EXTERNAL
2587 	 set, not just things with DECL_INLINE.  */
2588       if (DECL_EXTERNAL (decl))
2589 	goto exit_rest_of_compilation;
2590     }
2591 
2592   /* If we're emitting a nested function, make sure its parent gets
2593      emitted as well.  Doing otherwise confuses debug info.  */
2594   {
2595     tree parent;
2596     for (parent = DECL_CONTEXT (current_function_decl);
2597 	 parent != NULL_TREE;
2598 	 parent = get_containing_scope (parent))
2599       if (TREE_CODE (parent) == FUNCTION_DECL)
2600 	TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
2601   }
2602 
2603   /* We are now committed to emitting code for this function.  Do any
2604      preparation, such as emitting abstract debug info for the inline
2605      before it gets mangled by optimization.  */
2606   if (DECL_INLINE (decl))
2607     (*debug_hooks->outlining_inline_function) (decl);
2608 
2609   /* Remove any notes we don't need.  That will make iterating
2610      over the instruction sequence faster, and allow the garbage
2611      collector to reclaim the memory used by the notes.  */
2612   remove_unnecessary_notes ();
2613   reorder_blocks ();
2614 
2615   ggc_collect ();
2616 
2617   /* Initialize some variables used by the optimizers.  */
2618   init_function_for_compilation ();
2619 
2620   if (! DECL_DEFER_OUTPUT (decl))
2621     TREE_ASM_WRITTEN (decl) = 1;
2622 
2623   /* Now that integrate will no longer see our rtl, we need not
2624      distinguish between the return value of this function and the
2625      return value of called functions.  Also, we can remove all SETs
2626      of subregs of hard registers; they are only here because of
2627      integrate.  Also, we can now initialize pseudos intended to
2628      carry magic hard reg data throughout the function.  */
2629   rtx_equal_function_value_matters = 0;
2630   purge_hard_subreg_sets (get_insns ());
2631 
2632   /* Early return if there were errors.  We can run afoul of our
2633      consistency checks, and there's not really much point in fixing them.
2634      Don't return yet if -Wreturn-type; we need to do cleanup_cfg.  */
2635   if (((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
2636       || errorcount || sorrycount)
2637     goto exit_rest_of_compilation;
2638 
2639   timevar_push (TV_JUMP);
2640   open_dump_file (DFI_sibling, decl);
2641   insns = get_insns ();
2642   rebuild_jump_labels (insns);
2643   find_exception_handler_labels ();
2644   find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2645 
2646   delete_unreachable_blocks ();
2647 
2648   /* Turn NOTE_INSN_PREDICTIONs into branch predictions.  */
2649   if (flag_guess_branch_prob)
2650     {
2651       timevar_push (TV_BRANCH_PROB);
2652       note_prediction_to_br_prob ();
2653       timevar_pop (TV_BRANCH_PROB);
2654     }
2655 
2656   /* We may have potential sibling or tail recursion sites.  Select one
2657      (of possibly multiple) methods of performing the call.  */
2658   if (flag_optimize_sibling_calls)
2659     {
2660       rtx insn;
2661       optimize_sibling_and_tail_recursive_calls ();
2662 
2663       /* Recompute the CFG as sibling optimization clobbers it randomly.  */
2664       free_bb_for_insn ();
2665       find_exception_handler_labels ();
2666       rebuild_jump_labels (insns);
2667       find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2668 
2669       /* There is pass ordering problem - we must lower NOTE_INSN_PREDICTION
2670          notes before simplifying cfg and we must do lowering after sibcall
2671          that unhides parts of RTL chain and cleans up the CFG.
2672 
2673          Until sibcall is replaced by tree-level optimizer, lets just
2674          sweep away the NOTE_INSN_PREDICTION notes that leaked out.  */
2675       for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
2676 	if (GET_CODE (insn) == NOTE
2677 	    && NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION)
2678 	  delete_insn (insn);
2679     }
2680   close_dump_file (DFI_sibling, print_rtl, get_insns ());
2681 
2682   /* We have to issue these warnings now already, because CFG cleanups
2683      further down may destroy the required information.  However, this
2684      must be done after the sibcall optimization pass because the barrier
2685      emitted for noreturn calls that are candidate for the optimization
2686      is folded into the CALL_PLACEHOLDER until after this pass, so the
2687      CFG is inaccurate.  */
2688   check_function_return_warnings ();
2689 
2690   timevar_pop (TV_JUMP);
2691 
2692   scope_to_insns_initialize ();
2693   /* Complete generation of exception handling code.  */
2694   if (doing_eh (0))
2695     {
2696       timevar_push (TV_JUMP);
2697       open_dump_file (DFI_eh, decl);
2698 
2699       finish_eh_generation ();
2700 
2701       close_dump_file (DFI_eh, print_rtl, get_insns ());
2702       timevar_pop (TV_JUMP);
2703     }
2704 
2705   /* Delay emitting hard_reg_initial_value sets until after EH landing pad
2706      generation, which might create new sets.  */
2707   emit_initial_value_sets ();
2708 
2709 #ifdef FINALIZE_PIC
2710   /* If we are doing position-independent code generation, now
2711      is the time to output special prologues and epilogues.
2712      We do not want to do this earlier, because it just clutters
2713      up inline functions with meaningless insns.  */
2714   if (flag_pic)
2715     FINALIZE_PIC;
2716 #endif
2717 
2718   insns = get_insns ();
2719 
2720   /* Copy any shared structure that should not be shared.  */
2721   unshare_all_rtl (current_function_decl, insns);
2722 
2723 #ifdef SETJMP_VIA_SAVE_AREA
2724   /* This must be performed before virtual register instantiation.
2725      Please be aware the everything in the compiler that can look
2726      at the RTL up to this point must understand that REG_SAVE_AREA
2727      is just like a use of the REG contained inside.  */
2728   if (current_function_calls_alloca)
2729     optimize_save_area_alloca (insns);
2730 #endif
2731 
2732   /* Instantiate all virtual registers.  */
2733   instantiate_virtual_regs (current_function_decl, insns);
2734 
2735   open_dump_file (DFI_jump, decl);
2736 
2737   /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
2738      are initialized and to compute whether control can drop off the end
2739      of the function.  */
2740 
2741   timevar_push (TV_JUMP);
2742   /* Turn NOTE_INSN_EXPECTED_VALUE into REG_BR_PROB.  Do this
2743      before jump optimization switches branch directions.  */
2744   if (flag_guess_branch_prob)
2745     expected_value_to_br_prob ();
2746 
2747   reg_scan (insns, max_reg_num (), 0);
2748   rebuild_jump_labels (insns);
2749   find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2750   delete_trivially_dead_insns (insns, max_reg_num ());
2751   if (rtl_dump_file)
2752     dump_flow_info (rtl_dump_file);
2753   cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP
2754 	       | (flag_thread_jumps ? CLEANUP_THREADING : 0));
2755 
2756   /* CFG is no longer maintained up-to-date.  */
2757   if (optimize)
2758     {
2759       free_bb_for_insn ();
2760       copy_loop_headers (insns);
2761       find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2762     }
2763   purge_line_number_notes (insns);
2764 
2765   timevar_pop (TV_JUMP);
2766   close_dump_file (DFI_jump, print_rtl, insns);
2767 
2768   /* Now is when we stop if -fsyntax-only and -Wreturn-type.  */
2769   if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
2770     {
2771       goto exit_rest_of_compilation;
2772     }
2773 
2774   /* Long term, this should probably move before the jump optimizer too,
2775      but I didn't want to disturb the rtl_dump_and_exit and related
2776      stuff at this time.  */
2777   if (optimize > 0 && flag_ssa)
2778     {
2779       /* Convert to SSA form.  */
2780 
2781       timevar_push (TV_TO_SSA);
2782       open_dump_file (DFI_ssa, decl);
2783 
2784       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
2785       convert_to_ssa ();
2786 
2787       close_dump_file (DFI_ssa, print_rtl_with_bb, insns);
2788       timevar_pop (TV_TO_SSA);
2789 
2790       /* Perform sparse conditional constant propagation, if requested.  */
2791       if (flag_ssa_ccp)
2792 	{
2793 	  timevar_push (TV_SSA_CCP);
2794 	  open_dump_file (DFI_ssa_ccp, decl);
2795 
2796 	  ssa_const_prop ();
2797 
2798 	  close_dump_file (DFI_ssa_ccp, print_rtl_with_bb, get_insns ());
2799 	  timevar_pop (TV_SSA_CCP);
2800 	}
2801 
2802       /* It would be useful to cleanup the CFG at this point, but block
2803 	 merging and possibly other transformations might leave a PHI
2804 	 node in the middle of a basic block, which is a strict no-no.  */
2805 
2806       /* The SSA implementation uses basic block numbers in its phi
2807 	 nodes.  Thus, changing the control-flow graph or the basic
2808 	 blocks, e.g., calling find_basic_blocks () or cleanup_cfg (),
2809 	 may cause problems.  */
2810 
2811       if (flag_ssa_dce)
2812 	{
2813 	  /* Remove dead code.  */
2814 
2815 	  timevar_push (TV_SSA_DCE);
2816 	  open_dump_file (DFI_ssa_dce, decl);
2817 
2818 	  insns = get_insns ();
2819 	  ssa_eliminate_dead_code ();
2820 
2821 	  close_dump_file (DFI_ssa_dce, print_rtl_with_bb, insns);
2822 	  timevar_pop (TV_SSA_DCE);
2823 	}
2824 
2825       /* Convert from SSA form.  */
2826 
2827       timevar_push (TV_FROM_SSA);
2828       open_dump_file (DFI_ussa, decl);
2829 
2830       convert_from_ssa ();
2831       /* New registers have been created.  Rescan their usage.  */
2832       reg_scan (insns, max_reg_num (), 1);
2833 
2834       close_dump_file (DFI_ussa, print_rtl_with_bb, insns);
2835       timevar_pop (TV_FROM_SSA);
2836 
2837       ggc_collect ();
2838     }
2839 
2840   timevar_push (TV_JUMP);
2841   if (optimize)
2842     cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
2843 
2844   /* Try to identify useless null pointer tests and delete them.  */
2845   if (flag_delete_null_pointer_checks)
2846     {
2847       open_dump_file (DFI_null, decl);
2848       if (rtl_dump_file)
2849 	dump_flow_info (rtl_dump_file);
2850 
2851       if (delete_null_pointer_checks (insns))
2852         cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
2853 
2854       close_dump_file (DFI_null, print_rtl_with_bb, insns);
2855     }
2856 
2857   /* Jump optimization, and the removal of NULL pointer checks, may
2858      have reduced the number of instructions substantially.  CSE, and
2859      future passes, allocate arrays whose dimensions involve the
2860      maximum instruction UID, so if we can reduce the maximum UID
2861      we'll save big on memory.  */
2862   renumber_insns (rtl_dump_file);
2863   timevar_pop (TV_JUMP);
2864 
2865   close_dump_file (DFI_jump, print_rtl_with_bb, insns);
2866 
2867   ggc_collect ();
2868 
2869   /* Perform common subexpression elimination.
2870      Nonzero value from `cse_main' means that jumps were simplified
2871      and some code may now be unreachable, so do
2872      jump optimization again.  */
2873 
2874   if (optimize > 0)
2875     {
2876       open_dump_file (DFI_cse, decl);
2877       if (rtl_dump_file)
2878 	dump_flow_info (rtl_dump_file);
2879       timevar_push (TV_CSE);
2880 
2881       reg_scan (insns, max_reg_num (), 1);
2882 
2883       tem = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
2884       if (tem)
2885 	rebuild_jump_labels (insns);
2886       if (purge_all_dead_edges (0))
2887 	delete_unreachable_blocks ();
2888 
2889       delete_trivially_dead_insns (insns, max_reg_num ());
2890 
2891       /* If we are not running more CSE passes, then we are no longer
2892 	 expecting CSE to be run.  But always rerun it in a cheap mode.  */
2893       cse_not_expected = !flag_rerun_cse_after_loop && !flag_gcse;
2894 
2895       if (tem || optimize > 1)
2896 	cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
2897       /* Try to identify useless null pointer tests and delete them.  */
2898       if (flag_delete_null_pointer_checks)
2899 	{
2900 	  timevar_push (TV_JUMP);
2901 
2902 	  if (delete_null_pointer_checks (insns))
2903 	    cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
2904 	  timevar_pop (TV_JUMP);
2905 	}
2906 
2907       /* The second pass of jump optimization is likely to have
2908          removed a bunch more instructions.  */
2909       renumber_insns (rtl_dump_file);
2910 
2911       timevar_pop (TV_CSE);
2912       close_dump_file (DFI_cse, print_rtl_with_bb, insns);
2913     }
2914 
2915   open_dump_file (DFI_addressof, decl);
2916 
2917   purge_addressof (insns);
2918   if (optimize && purge_all_dead_edges (0))
2919     delete_unreachable_blocks ();
2920   reg_scan (insns, max_reg_num (), 1);
2921 
2922   close_dump_file (DFI_addressof, print_rtl, insns);
2923 
2924   ggc_collect ();
2925 
2926   /* Perform global cse.  */
2927 
2928   if (optimize > 0 && flag_gcse)
2929     {
2930       int save_csb, save_cfj;
2931       int tem2 = 0;
2932 
2933       timevar_push (TV_GCSE);
2934       open_dump_file (DFI_gcse, decl);
2935 
2936       tem = gcse_main (insns, rtl_dump_file);
2937       rebuild_jump_labels (insns);
2938       delete_trivially_dead_insns (insns, max_reg_num ());
2939 
2940       save_csb = flag_cse_skip_blocks;
2941       save_cfj = flag_cse_follow_jumps;
2942       flag_cse_skip_blocks = flag_cse_follow_jumps = 0;
2943 
2944       /* If -fexpensive-optimizations, re-run CSE to clean up things done
2945 	 by gcse.  */
2946       if (flag_expensive_optimizations)
2947 	{
2948 	  timevar_push (TV_CSE);
2949 	  reg_scan (insns, max_reg_num (), 1);
2950 	  tem2 = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
2951 	  purge_all_dead_edges (0);
2952 	  delete_trivially_dead_insns (insns, max_reg_num ());
2953 	  timevar_pop (TV_CSE);
2954 	  cse_not_expected = !flag_rerun_cse_after_loop;
2955 	}
2956 
2957       /* If gcse or cse altered any jumps, rerun jump optimizations to clean
2958 	 things up.  Then possibly re-run CSE again.  */
2959       while (tem || tem2)
2960 	{
2961 	  tem = tem2 = 0;
2962 	  timevar_push (TV_JUMP);
2963 	  rebuild_jump_labels (insns);
2964 	  cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
2965 	  timevar_pop (TV_JUMP);
2966 
2967 	  if (flag_expensive_optimizations)
2968 	    {
2969 	      timevar_push (TV_CSE);
2970 	      reg_scan (insns, max_reg_num (), 1);
2971 	      tem2 = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
2972 	      purge_all_dead_edges (0);
2973 	      delete_trivially_dead_insns (insns, max_reg_num ());
2974 	      timevar_pop (TV_CSE);
2975 	    }
2976 	}
2977 
2978       close_dump_file (DFI_gcse, print_rtl_with_bb, insns);
2979       timevar_pop (TV_GCSE);
2980 
2981       ggc_collect ();
2982       flag_cse_skip_blocks = save_csb;
2983       flag_cse_follow_jumps = save_cfj;
2984 #ifdef ENABLE_CHECKING
2985       verify_flow_info ();
2986 #endif
2987     }
2988 
2989   /* Move constant computations out of loops.  */
2990 
2991   if (optimize > 0 && flag_loop_optimize)
2992     {
2993       int do_unroll, do_prefetch;
2994 
2995       timevar_push (TV_LOOP);
2996       delete_dead_jumptables ();
2997       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
2998       open_dump_file (DFI_loop, decl);
2999       /* CFG is no longer maintained up-to-date.  */
3000       free_bb_for_insn ();
3001 
3002       do_unroll = flag_unroll_loops ? LOOP_UNROLL : LOOP_AUTO_UNROLL;
3003       do_prefetch = flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0;
3004       if (flag_rerun_loop_opt)
3005 	{
3006 	  cleanup_barriers ();
3007 
3008 	  /* We only want to perform unrolling once.  */
3009 	  loop_optimize (insns, rtl_dump_file, do_unroll);
3010 	  do_unroll = 0;
3011 
3012 	  /* The first call to loop_optimize makes some instructions
3013 	     trivially dead.  We delete those instructions now in the
3014 	     hope that doing so will make the heuristics in loop work
3015 	     better and possibly speed up compilation.  */
3016 	  delete_trivially_dead_insns (insns, max_reg_num ());
3017 
3018 	  /* The regscan pass is currently necessary as the alias
3019 		  analysis code depends on this information.  */
3020 	  reg_scan (insns, max_reg_num (), 1);
3021 	}
3022       cleanup_barriers ();
3023       loop_optimize (insns, rtl_dump_file, do_unroll | LOOP_BCT | do_prefetch);
3024 
3025       /* Loop can create trivially dead instructions.  */
3026       delete_trivially_dead_insns (insns, max_reg_num ());
3027       close_dump_file (DFI_loop, print_rtl, insns);
3028       timevar_pop (TV_LOOP);
3029       find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3030 
3031       ggc_collect ();
3032     }
3033 
3034   /* Do control and data flow analysis; wrote some of the results to
3035      the dump file.  */
3036 
3037   timevar_push (TV_FLOW);
3038   open_dump_file (DFI_cfg, decl);
3039   if (rtl_dump_file)
3040     dump_flow_info (rtl_dump_file);
3041   if (optimize)
3042     cleanup_cfg (CLEANUP_EXPENSIVE
3043 		 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
3044 
3045   /* It may make more sense to mark constant functions after dead code is
3046      eliminated by life_analyzis, but we need to do it early, as -fprofile-arcs
3047      may insert code making function non-constant, but we still must consider
3048      it as constant, otherwise -fbranch-probabilities will not read data back.
3049 
3050      life_analyzis rarely eliminates modification of external memory.
3051    */
3052   if (optimize)
3053     mark_constant_function ();
3054 
3055   close_dump_file (DFI_cfg, print_rtl_with_bb, insns);
3056 
3057   /* Do branch profiling and static profile estimation passes.  */
3058   if (optimize > 0 || cfun->arc_profile || flag_branch_probabilities)
3059     {
3060       struct loops loops;
3061 
3062       timevar_push (TV_BRANCH_PROB);
3063       open_dump_file (DFI_bp, decl);
3064       if (cfun->arc_profile || flag_branch_probabilities)
3065 	branch_prob ();
3066 
3067       /* Discover and record the loop depth at the head of each basic
3068 	 block.  The loop infrastructure does the real job for us.  */
3069       flow_loops_find (&loops, LOOP_TREE);
3070 
3071       if (rtl_dump_file)
3072 	flow_loops_dump (&loops, rtl_dump_file, NULL, 0);
3073 
3074       /* Estimate using heuristics if no profiling info is available.  */
3075       if (flag_guess_branch_prob)
3076 	estimate_probability (&loops);
3077 
3078       flow_loops_free (&loops);
3079       close_dump_file (DFI_bp, print_rtl_with_bb, insns);
3080       timevar_pop (TV_BRANCH_PROB);
3081     }
3082   if (optimize > 0)
3083     {
3084       open_dump_file (DFI_ce1, decl);
3085       if (flag_if_conversion)
3086 	{
3087 	  timevar_push (TV_IFCVT);
3088 	  if (rtl_dump_file)
3089 	    dump_flow_info (rtl_dump_file);
3090 	  cleanup_cfg (CLEANUP_EXPENSIVE);
3091 	  reg_scan (insns, max_reg_num (), 0);
3092 	  if_convert (0);
3093 	  timevar_pop (TV_IFCVT);
3094 	}
3095       timevar_push (TV_JUMP);
3096       cleanup_cfg (CLEANUP_EXPENSIVE);
3097       reg_scan (insns, max_reg_num (), 0);
3098       timevar_pop (TV_JUMP);
3099       close_dump_file (DFI_ce1, print_rtl_with_bb, get_insns ());
3100     }
3101   if (flag_tracer)
3102     {
3103       timevar_push (TV_TRACER);
3104       open_dump_file (DFI_tracer, decl);
3105       if (rtl_dump_file)
3106 	dump_flow_info (rtl_dump_file);
3107       tracer ();
3108       cleanup_cfg (CLEANUP_EXPENSIVE);
3109       reg_scan (insns, max_reg_num (), 0);
3110       close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ());
3111       timevar_pop (TV_TRACER);
3112     }
3113 
3114   if (flag_rerun_cse_after_loop)
3115     {
3116       timevar_push (TV_CSE2);
3117       open_dump_file (DFI_cse2, decl);
3118       if (rtl_dump_file)
3119 	dump_flow_info (rtl_dump_file);
3120       /* CFG is no longer maintained up-to-date.  */
3121       tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
3122 
3123       /* Run a pass to eliminate duplicated assignments to condition
3124 	 code registers.  We have to run this after bypass_jumps,
3125 	 because it makes it harder for that pass to determine whether
3126 	 a jump can be bypassed safely.  */
3127       cse_condition_code_reg ();
3128 
3129       purge_all_dead_edges (0);
3130       delete_trivially_dead_insns (insns, max_reg_num ());
3131 
3132       if (tem)
3133 	{
3134 	  timevar_push (TV_JUMP);
3135 	  rebuild_jump_labels (insns);
3136 	  cleanup_cfg (CLEANUP_EXPENSIVE);
3137 	  timevar_pop (TV_JUMP);
3138 	}
3139       reg_scan (insns, max_reg_num (), 0);
3140       close_dump_file (DFI_cse2, print_rtl_with_bb, insns);
3141       ggc_collect ();
3142       timevar_pop (TV_CSE2);
3143     }
3144 
3145   cse_not_expected = 1;
3146 
3147   open_dump_file (DFI_life, decl);
3148   regclass_init ();
3149 
3150 #ifdef ENABLE_CHECKING
3151   verify_flow_info ();
3152 #endif
3153   life_analysis (insns, rtl_dump_file, PROP_FINAL);
3154   if (optimize)
3155     cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_UPDATE_LIFE
3156 		 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
3157   timevar_pop (TV_FLOW);
3158 
3159   if (warn_uninitialized || extra_warnings)
3160     {
3161       uninitialized_vars_warning (DECL_INITIAL (decl));
3162       if (extra_warnings)
3163 	setjmp_args_warning ();
3164     }
3165 
3166   if (optimize)
3167     {
3168       if (!flag_new_regalloc && initialize_uninitialized_subregs ())
3169 	{
3170 	  /* Insns were inserted, and possibly pseudos created, so
3171 	     things might look a bit different.  */
3172 	  insns = get_insns ();
3173 	  allocate_reg_life_data ();
3174 	  update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
3175 			    PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES);
3176 	}
3177     }
3178 
3179   no_new_pseudos = 1;
3180 
3181   close_dump_file (DFI_life, print_rtl_with_bb, insns);
3182 
3183   ggc_collect ();
3184 
3185   /* If -opt, try combining insns through substitution.  */
3186 
3187   if (optimize > 0)
3188     {
3189       int rebuild_jump_labels_after_combine = 0;
3190 
3191       timevar_push (TV_COMBINE);
3192       open_dump_file (DFI_combine, decl);
3193 
3194       rebuild_jump_labels_after_combine
3195 	= combine_instructions (insns, max_reg_num ());
3196 
3197       /* Combining insns may have turned an indirect jump into a
3198 	 direct jump.  Rebuid the JUMP_LABEL fields of jumping
3199 	 instructions.  */
3200       if (rebuild_jump_labels_after_combine)
3201 	{
3202 	  timevar_push (TV_JUMP);
3203 	  rebuild_jump_labels (insns);
3204 	  timevar_pop (TV_JUMP);
3205 
3206 	  cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
3207 	}
3208 
3209       close_dump_file (DFI_combine, print_rtl_with_bb, insns);
3210       timevar_pop (TV_COMBINE);
3211 
3212       ggc_collect ();
3213     }
3214 
3215   /* Rerun if-conversion, as combine may have simplified things enough to
3216      now meet sequence length restrictions.  */
3217   if (flag_if_conversion)
3218     {
3219       timevar_push (TV_IFCVT);
3220       open_dump_file (DFI_ce2, decl);
3221 
3222       no_new_pseudos = 0;
3223       if_convert (1);
3224       no_new_pseudos = 1;
3225 
3226       close_dump_file (DFI_ce2, print_rtl_with_bb, insns);
3227       timevar_pop (TV_IFCVT);
3228     }
3229 
3230   /* Register allocation pre-pass, to reduce number of moves
3231      necessary for two-address machines.  */
3232   if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
3233     {
3234       timevar_push (TV_REGMOVE);
3235       open_dump_file (DFI_regmove, decl);
3236 
3237       regmove_optimize (insns, max_reg_num (), rtl_dump_file);
3238 
3239       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
3240       close_dump_file (DFI_regmove, print_rtl_with_bb, insns);
3241       timevar_pop (TV_REGMOVE);
3242 
3243       ggc_collect ();
3244     }
3245 
3246   /* Do unconditional splitting before register allocation to allow machine
3247      description to add extra information not needed previously.  */
3248   split_all_insns (1);
3249 
3250   /* Any of the several passes since flow1 will have munged register
3251      lifetime data a bit.  */
3252   register_life_up_to_date = 0;
3253 
3254 #ifdef OPTIMIZE_MODE_SWITCHING
3255   timevar_push (TV_MODE_SWITCH);
3256 
3257   no_new_pseudos = 0;
3258   optimize_mode_switching (NULL);
3259   no_new_pseudos = 1;
3260 
3261   timevar_pop (TV_MODE_SWITCH);
3262 #endif
3263 
3264   timevar_push (TV_SCHED);
3265 
3266 #ifdef INSN_SCHEDULING
3267 
3268   /* Print function header into sched dump now
3269      because doing the sched analysis makes some of the dump.  */
3270   if (optimize > 0 && flag_schedule_insns)
3271     {
3272       open_dump_file (DFI_sched, decl);
3273 
3274       /* Do control and data sched analysis,
3275 	 and write some of the results to dump file.  */
3276 
3277       schedule_insns (rtl_dump_file);
3278 
3279       close_dump_file (DFI_sched, print_rtl_with_bb, insns);
3280 
3281       /* Register lifetime information was updated as part of verifying
3282 	 the schedule.  */
3283       register_life_up_to_date = 1;
3284     }
3285 #endif
3286   timevar_pop (TV_SCHED);
3287 
3288   ggc_collect ();
3289 
3290   /* Determine if the current function is a leaf before running reload
3291      since this can impact optimizations done by the prologue and
3292      epilogue thus changing register elimination offsets.  */
3293   current_function_is_leaf = leaf_function_p ();
3294 
3295   timevar_push (TV_LOCAL_ALLOC);
3296   open_dump_file (DFI_lreg, decl);
3297 
3298   /* Allocate pseudo-regs that are used only within 1 basic block.
3299 
3300      RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
3301      jump optimizer after register allocation and reloading are finished.  */
3302 
3303   if (! register_life_up_to_date)
3304     recompute_reg_usage (insns, ! optimize_size);
3305 
3306   if (flag_new_regalloc)
3307     {
3308       delete_trivially_dead_insns (insns, max_reg_num ());
3309       reg_alloc ();
3310 
3311       timevar_pop (TV_LOCAL_ALLOC);
3312       if (dump_file[DFI_lreg].enabled)
3313         {
3314           timevar_push (TV_DUMP);
3315 
3316           close_dump_file (DFI_lreg, NULL, NULL);
3317           timevar_pop (TV_DUMP);
3318         }
3319 
3320       /* XXX clean up the whole mess to bring live info in shape again.  */
3321       timevar_push (TV_GLOBAL_ALLOC);
3322       open_dump_file (DFI_greg, decl);
3323 
3324       build_insn_chain (insns);
3325       failure = reload (insns, 0);
3326 
3327       timevar_pop (TV_GLOBAL_ALLOC);
3328 
3329       if (dump_file[DFI_greg].enabled)
3330         {
3331           timevar_push (TV_DUMP);
3332 
3333           dump_global_regs (rtl_dump_file);
3334 
3335           close_dump_file (DFI_greg, print_rtl_with_bb, insns);
3336           timevar_pop (TV_DUMP);
3337         }
3338 
3339       if (failure)
3340         goto exit_rest_of_compilation;
3341       reload_completed = 1;
3342       rebuild_label_notes_after_reload = 0;
3343     }
3344   else
3345     {
3346       /* Allocate the reg_renumber array.  */
3347       allocate_reg_info (max_regno, FALSE, TRUE);
3348 
3349       /* And the reg_equiv_memory_loc array.  */
3350       reg_equiv_memory_loc = (rtx *) xcalloc (max_regno, sizeof (rtx));
3351 
3352       allocate_initial_values (reg_equiv_memory_loc);
3353 
3354       regclass (insns, max_reg_num (), rtl_dump_file);
3355       rebuild_label_notes_after_reload = local_alloc ();
3356 
3357       timevar_pop (TV_LOCAL_ALLOC);
3358 
3359       if (dump_file[DFI_lreg].enabled)
3360 	{
3361 	  timevar_push (TV_DUMP);
3362 
3363 	  dump_flow_info (rtl_dump_file);
3364 	  dump_local_alloc (rtl_dump_file);
3365 
3366 	  close_dump_file (DFI_lreg, print_rtl_with_bb, insns);
3367 	  timevar_pop (TV_DUMP);
3368 	}
3369 
3370       ggc_collect ();
3371 
3372       timevar_push (TV_GLOBAL_ALLOC);
3373       open_dump_file (DFI_greg, decl);
3374 
3375       /* If optimizing, allocate remaining pseudo-regs.  Do the reload
3376 	 pass fixing up any insns that are invalid.  */
3377 
3378       if (optimize)
3379 	failure = global_alloc (rtl_dump_file);
3380       else
3381 	{
3382 	  build_insn_chain (insns);
3383 	  failure = reload (insns, 0);
3384 	}
3385 
3386       timevar_pop (TV_GLOBAL_ALLOC);
3387 
3388       if (dump_file[DFI_greg].enabled)
3389 	{
3390 	  timevar_push (TV_DUMP);
3391 
3392 	  dump_global_regs (rtl_dump_file);
3393 
3394 	  close_dump_file (DFI_greg, print_rtl_with_bb, insns);
3395 	  timevar_pop (TV_DUMP);
3396 	}
3397 
3398       if (failure)
3399 	goto exit_rest_of_compilation;
3400     }
3401 
3402   ggc_collect ();
3403 
3404   open_dump_file (DFI_postreload, decl);
3405 
3406   /* Do a very simple CSE pass over just the hard registers.  */
3407   if (optimize > 0)
3408     {
3409       timevar_push (TV_RELOAD_CSE_REGS);
3410       reload_cse_regs (insns);
3411       timevar_pop (TV_RELOAD_CSE_REGS);
3412     }
3413 
3414   /* Register allocation and reloading may have turned an indirect jump into
3415      a direct jump.  If so, we must rebuild the JUMP_LABEL fields of
3416      jumping instructions.  */
3417   if (rebuild_label_notes_after_reload)
3418     {
3419       timevar_push (TV_JUMP);
3420 
3421       rebuild_jump_labels (insns);
3422       purge_all_dead_edges (0);
3423 
3424       timevar_pop (TV_JUMP);
3425     }
3426 
3427   close_dump_file (DFI_postreload, print_rtl_with_bb, insns);
3428 
3429   /* Re-create the death notes which were deleted during reload.  */
3430   timevar_push (TV_FLOW2);
3431   open_dump_file (DFI_flow2, decl);
3432 
3433 #ifdef ENABLE_CHECKING
3434   verify_flow_info ();
3435 #endif
3436 
3437   /* If optimizing, then go ahead and split insns now.  */
3438 #ifndef STACK_REGS
3439   if (optimize > 0)
3440 #endif
3441     split_all_insns (0);
3442 
3443   if (optimize)
3444     cleanup_cfg (CLEANUP_EXPENSIVE);
3445 
3446   /* On some machines, the prologue and epilogue code, or parts thereof,
3447      can be represented as RTL.  Doing so lets us schedule insns between
3448      it and the rest of the code and also allows delayed branch
3449      scheduling to operate in the epilogue.  */
3450   thread_prologue_and_epilogue_insns (insns);
3451 
3452   if (optimize)
3453     {
3454       life_analysis (insns, rtl_dump_file, PROP_FINAL);
3455       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE
3456 		   | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
3457 
3458       /* This is kind of a heuristic.  We need to run combine_stack_adjustments
3459          even for machines with possibly nonzero RETURN_POPS_ARGS
3460          and ACCUMULATE_OUTGOING_ARGS.  We expect that only ports having
3461          push instructions will have popping returns.  */
3462 #ifndef PUSH_ROUNDING
3463       if (!ACCUMULATE_OUTGOING_ARGS)
3464 #endif
3465 	combine_stack_adjustments ();
3466 
3467       ggc_collect ();
3468     }
3469 
3470   flow2_completed = 1;
3471 
3472   close_dump_file (DFI_flow2, print_rtl_with_bb, insns);
3473   timevar_pop (TV_FLOW2);
3474 
3475 #ifdef HAVE_peephole2
3476   if (optimize > 0 && flag_peephole2)
3477     {
3478       timevar_push (TV_PEEPHOLE2);
3479       open_dump_file (DFI_peephole2, decl);
3480 
3481       peephole2_optimize (rtl_dump_file);
3482 
3483       close_dump_file (DFI_peephole2, print_rtl_with_bb, insns);
3484       timevar_pop (TV_PEEPHOLE2);
3485     }
3486 #endif
3487 
3488   if (optimize > 0 && (flag_rename_registers || flag_cprop_registers))
3489     {
3490       timevar_push (TV_RENAME_REGISTERS);
3491       open_dump_file (DFI_rnreg, decl);
3492 
3493       if (flag_rename_registers)
3494 	regrename_optimize ();
3495       if (flag_cprop_registers)
3496 	copyprop_hardreg_forward ();
3497 
3498       close_dump_file (DFI_rnreg, print_rtl_with_bb, insns);
3499       timevar_pop (TV_RENAME_REGISTERS);
3500     }
3501 
3502   if (flag_if_conversion2)
3503     {
3504       timevar_push (TV_IFCVT2);
3505       open_dump_file (DFI_ce3, decl);
3506 
3507       if_convert (1);
3508 
3509       close_dump_file (DFI_ce3, print_rtl_with_bb, insns);
3510       timevar_pop (TV_IFCVT2);
3511     }
3512 
3513 #ifdef INSN_SCHEDULING
3514   if (optimize > 0 && flag_schedule_insns_after_reload)
3515     {
3516       timevar_push (TV_SCHED2);
3517       open_dump_file (DFI_sched2, decl);
3518 
3519       /* Do control and data sched analysis again,
3520 	 and write some more of the results to dump file.  */
3521 
3522       split_all_insns (1);
3523 
3524       schedule_insns (rtl_dump_file);
3525 
3526       close_dump_file (DFI_sched2, print_rtl_with_bb, insns);
3527       timevar_pop (TV_SCHED2);
3528 
3529       ggc_collect ();
3530     }
3531 #endif
3532 
3533 #ifdef LEAF_REGISTERS
3534   current_function_uses_only_leaf_regs
3535     = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
3536 #endif
3537 
3538 #ifdef STACK_REGS
3539 #if defined (HAVE_ATTR_length)
3540   /* If flow2 creates new instructions which need splitting
3541      and scheduling after reload is not done, they might not be
3542      splitten until final which doesn't allow splitting
3543      if HAVE_ATTR_length.  */
3544 #ifdef INSN_SCHEDULING
3545   if (optimize && !flag_schedule_insns_after_reload)
3546 #else
3547   if (optimize)
3548 #endif
3549     {
3550       timevar_push (TV_SHORTEN_BRANCH);
3551       split_all_insns (1);
3552       timevar_pop (TV_SHORTEN_BRANCH);
3553     }
3554 #endif
3555 
3556   timevar_push (TV_REG_STACK);
3557   open_dump_file (DFI_stack, decl);
3558 
3559   reg_to_stack (insns, rtl_dump_file);
3560 
3561   close_dump_file (DFI_stack, print_rtl_with_bb, insns);
3562   timevar_pop (TV_REG_STACK);
3563 
3564   ggc_collect ();
3565 #endif
3566   if (optimize > 0)
3567     {
3568       timevar_push (TV_REORDER_BLOCKS);
3569       open_dump_file (DFI_bbro, decl);
3570 
3571       /* Last attempt to optimize CFG, as scheduling, peepholing and insn
3572 	 splitting possibly introduced more crossjumping oppurtuntities.
3573 	 Except that we can't actually run crossjumping without running
3574 	 another DCE pass, which we can't do after reg-stack.  */
3575       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
3576 		   | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
3577       if (flag_reorder_blocks)
3578 	{
3579 	  reorder_basic_blocks ();
3580 	  cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK);
3581 	}
3582 
3583       close_dump_file (DFI_bbro, print_rtl_with_bb, insns);
3584       timevar_pop (TV_REORDER_BLOCKS);
3585     }
3586   compute_alignments ();
3587 
3588   /* CFG is no longer maintained up-to-date.  */
3589   free_bb_for_insn ();
3590 
3591   /* If a machine dependent reorganization is needed, call it.  */
3592 #ifdef MACHINE_DEPENDENT_REORG
3593   timevar_push (TV_MACH_DEP);
3594   open_dump_file (DFI_mach, decl);
3595 
3596   MACHINE_DEPENDENT_REORG (insns);
3597 
3598   close_dump_file (DFI_mach, print_rtl, insns);
3599   timevar_pop (TV_MACH_DEP);
3600 
3601   ggc_collect ();
3602 #endif
3603 
3604   purge_line_number_notes (insns);
3605   cleanup_barriers ();
3606 
3607   /* If a scheduling pass for delayed branches is to be done,
3608      call the scheduling code.  */
3609 
3610 #ifdef DELAY_SLOTS
3611   if (optimize > 0 && flag_delayed_branch)
3612     {
3613       timevar_push (TV_DBR_SCHED);
3614       open_dump_file (DFI_dbr, decl);
3615 
3616       dbr_schedule (insns, rtl_dump_file);
3617 
3618       close_dump_file (DFI_dbr, print_rtl, insns);
3619       timevar_pop (TV_DBR_SCHED);
3620 
3621       ggc_collect ();
3622     }
3623 #endif
3624 
3625 #if defined (HAVE_ATTR_length) && !defined (STACK_REGS)
3626   timevar_push (TV_SHORTEN_BRANCH);
3627   split_all_insns_noflow ();
3628   timevar_pop (TV_SHORTEN_BRANCH);
3629 #endif
3630 
3631   convert_to_eh_region_ranges ();
3632 
3633   /* Shorten branches.  */
3634   timevar_push (TV_SHORTEN_BRANCH);
3635   shorten_branches (get_insns ());
3636   timevar_pop (TV_SHORTEN_BRANCH);
3637 
3638   set_nothrow_function_flags ();
3639   if (current_function_nothrow)
3640     /* Now we know that this can't throw; set the flag for the benefit
3641        of other functions later in this translation unit.  */
3642     TREE_NOTHROW (current_function_decl) = 1;
3643 
3644   /* Now turn the rtl into assembler code.  */
3645 
3646   timevar_push (TV_FINAL);
3647   {
3648     rtx x;
3649     const char *fnname;
3650 
3651     /* Get the function's name, as described by its RTL.  This may be
3652        different from the DECL_NAME name used in the source file.  */
3653 
3654     x = DECL_RTL (decl);
3655     if (GET_CODE (x) != MEM)
3656       abort ();
3657     x = XEXP (x, 0);
3658     if (GET_CODE (x) != SYMBOL_REF)
3659       abort ();
3660     fnname = XSTR (x, 0);
3661 
3662     assemble_start_function (decl, fnname);
3663     final_start_function (insns, asm_out_file, optimize);
3664     final (insns, asm_out_file, optimize, 0);
3665     final_end_function ();
3666 
3667 #ifdef IA64_UNWIND_INFO
3668     /* ??? The IA-64 ".handlerdata" directive must be issued before
3669        the ".endp" directive that closes the procedure descriptor.  */
3670     output_function_exception_table ();
3671 #endif
3672 
3673     assemble_end_function (decl, fnname);
3674 
3675 #ifndef IA64_UNWIND_INFO
3676     /* Otherwise, it feels unclean to switch sections in the middle.  */
3677     output_function_exception_table ();
3678 #endif
3679 
3680     if (! quiet_flag)
3681       fflush (asm_out_file);
3682 
3683     /* Release all memory allocated by flow.  */
3684     free_basic_block_vars (0);
3685 
3686     /* Release all memory held by regsets now.  */
3687     regset_release_memory ();
3688   }
3689   timevar_pop (TV_FINAL);
3690 
3691   ggc_collect ();
3692 
3693   /* Write DBX symbols if requested.  */
3694 
3695   /* Note that for those inline functions where we don't initially
3696      know for certain that we will be generating an out-of-line copy,
3697      the first invocation of this routine (rest_of_compilation) will
3698      skip over this code by doing a `goto exit_rest_of_compilation;'.
3699      Later on, wrapup_global_declarations will (indirectly) call
3700      rest_of_compilation again for those inline functions that need
3701      to have out-of-line copies generated.  During that call, we
3702      *will* be routed past here.  */
3703 
3704   timevar_push (TV_SYMOUT);
3705   (*debug_hooks->function_decl) (decl);
3706   timevar_pop (TV_SYMOUT);
3707 
3708  exit_rest_of_compilation:
3709 
3710   /* In case the function was not output,
3711      don't leave any temporary anonymous types
3712      queued up for sdb output.  */
3713 #ifdef SDB_DEBUGGING_INFO
3714   if (write_symbols == SDB_DEBUG)
3715     sdbout_types (NULL_TREE);
3716 #endif
3717 
3718   reload_completed = 0;
3719   flow2_completed = 0;
3720   no_new_pseudos = 0;
3721 
3722   timevar_push (TV_FINAL);
3723 
3724   /* Clear out the insn_length contents now that they are no
3725      longer valid.  */
3726   init_insn_lengths ();
3727 
3728   /* Show no temporary slots allocated.  */
3729   init_temp_slots ();
3730 
3731   free_basic_block_vars (0);
3732   free_bb_for_insn ();
3733 
3734   timevar_pop (TV_FINAL);
3735 
3736   /* Make sure volatile mem refs aren't considered valid operands for
3737      arithmetic insns.  We must call this here if this is a nested inline
3738      function, since the above code leaves us in the init_recog state
3739      (from final.c), and the function context push/pop code does not
3740      save/restore volatile_ok.
3741 
3742      ??? Maybe it isn't necessary for expand_start_function to call this
3743      anymore if we do it here?  */
3744 
3745   init_recog_no_volatile ();
3746 
3747   /* We're done with this function.  Free up memory if we can.  */
3748   free_after_parsing (cfun);
3749   if (! DECL_DEFER_OUTPUT (decl))
3750     {
3751       free_after_compilation (cfun);
3752 
3753       /* Clear integrate.c's pointer to the cfun structure we just
3754 	 destroyed.  */
3755       DECL_SAVED_INSNS (decl) = 0;
3756     }
3757   cfun = 0;
3758 
3759   ggc_collect ();
3760 
3761   timevar_pop (TV_REST_OF_COMPILATION);
3762 }
3763 
3764 static void
3765 display_help ()
3766 {
3767   int undoc;
3768   unsigned long i;
3769   const char *lang;
3770 
3771   printf (_("  -ffixed-<register>      Mark <register> as being unavailable to the compiler\n"));
3772   printf (_("  -fcall-used-<register>  Mark <register> as being corrupted by function calls\n"));
3773   printf (_("  -fcall-saved-<register> Mark <register> as being preserved across functions\n"));
3774   printf (_("  -finline-limit=<number> Limits the size of inlined functions to <number>\n"));
3775   printf (_("  -fmessage-length=<number> Limits diagnostics messages lengths to <number> characters per line.  0 suppresses line-wrapping\n"));
3776   printf (_("  -fdiagnostics-show-location=[once | every-line] Indicates how often source location information should be emitted, as prefix, at the beginning of diagnostics when line-wrapping\n"));
3777   printf (_("  -ftls-model=[global-dynamic | local-dynamic | initial-exec | local-exec] Indicates the default thread-local storage code generation model\n"));
3778   printf (_("  -fstack-limit-register=<register>  Trap if the stack goes past <register>\n"));
3779   printf (_("  -fstack-limit-symbol=<name>  Trap if the stack goes past symbol <name>\n"));
3780   printf (_("  -frandom-seed=<string>  Make compile reproducible using <string>\n"));
3781 
3782 
3783   for (i = ARRAY_SIZE (f_options); i--;)
3784     {
3785       const char *description = f_options[i].description;
3786 
3787       if (description != NULL && *description != 0)
3788 	printf ("  -f%-21s %s\n",
3789 		f_options[i].string, _(description));
3790     }
3791 
3792   printf (_("  -O[number]              Set optimization level to [number]\n"));
3793   printf (_("  -Os                     Optimize for space rather than speed\n"));
3794   for (i = LAST_PARAM; i--;)
3795     {
3796       const char *description = compiler_params[i].help;
3797       const int length = 21 - strlen (compiler_params[i].option);
3798 
3799       if (description != NULL && *description != 0)
3800 	printf ("  --param %s=<value>%.*s%s\n",
3801 		compiler_params[i].option,
3802 		length > 0 ? length : 1, "                     ",
3803 		_(description));
3804     }
3805   printf (_("  -pedantic               Issue warnings needed by strict compliance to ISO C\n"));
3806   printf (_("  -pedantic-errors        Like -pedantic except that errors are produced\n"));
3807   printf (_("  -w                      Suppress warnings\n"));
3808   printf (_("  -W                      Enable extra warnings\n"));
3809 
3810   for (i = ARRAY_SIZE (W_options); i--;)
3811     {
3812       const char *description = W_options[i].description;
3813 
3814       if (description != NULL && *description != 0)
3815 	printf ("  -W%-21s %s\n",
3816 		W_options[i].string, _(description));
3817     }
3818 
3819   printf (_("  -Wunused                Enable unused warnings\n"));
3820   printf (_("  -Wlarger-than-<number>  Warn if an object is larger than <number> bytes\n"));
3821   printf (_("  -p                      Enable function profiling\n"));
3822   printf (_("  -o <file>               Place output into <file> \n"));
3823   printf (_("\
3824   -G <number>             Put global and static data smaller than <number>\n\
3825                           bytes into a special section (on some targets)\n"));
3826 
3827   for (i = ARRAY_SIZE (debug_args); i--;)
3828     {
3829       if (debug_args[i].description != NULL)
3830 	printf ("  -g%-21s %s\n",
3831 		debug_args[i].arg, _(debug_args[i].description));
3832     }
3833 
3834   printf (_("  -aux-info <file>        Emit declaration info into <file>\n"));
3835   printf (_("  -quiet                  Do not display functions compiled or elapsed time\n"));
3836   printf (_("  -version                Display the compiler's version\n"));
3837   printf (_("  -d[letters]             Enable dumps from specific passes of the compiler\n"));
3838   printf (_("  -dumpbase <file>        Base name to be used for dumps from specific passes\n"));
3839 #if defined INSN_SCHEDULING
3840   printf (_("  -fsched-verbose=<number> Set the verbosity level of the scheduler\n"));
3841 #endif
3842   printf (_("  --help                  Display this information\n"));
3843 
3844   undoc = 0;
3845   lang  = "language";
3846 
3847   /* Display descriptions of language specific options.
3848      If there is no description, note that there is an undocumented option.
3849      If the description is empty, do not display anything.  (This allows
3850      options to be deliberately undocumented, for whatever reason).
3851      If the option string is missing, then this is a marker, indicating
3852      that the description string is in fact the name of a language, whose
3853      language specific options are to follow.  */
3854 
3855   if (ARRAY_SIZE (documented_lang_options) > 1)
3856     {
3857       printf (_("\nLanguage specific options:\n"));
3858 
3859       for (i = 0; i < ARRAY_SIZE (documented_lang_options); i++)
3860 	{
3861 	  const char *description = documented_lang_options[i].description;
3862 	  const char *option      = documented_lang_options[i].option;
3863 
3864 	  if (description == NULL)
3865 	    {
3866 	      undoc = 1;
3867 
3868 	      if (extra_warnings)
3869 		printf (_("  %-23.23s [undocumented]\n"), option);
3870 	    }
3871 	  else if (*description == 0)
3872 	    continue;
3873 	  else if (option == NULL)
3874 	    {
3875 	      if (undoc)
3876 		printf
3877 		  (_("\nThere are undocumented %s specific options as well.\n"),
3878 			lang);
3879 	      undoc = 0;
3880 
3881 	      printf (_("\n Options for %s:\n"), description);
3882 
3883 	      lang = description;
3884 	    }
3885 	  else
3886 	    printf ("  %-23.23s %s\n", option, _(description));
3887 	}
3888     }
3889 
3890   if (undoc)
3891     printf (_("\nThere are undocumented %s specific options as well.\n"),
3892 	    lang);
3893 
3894   display_target_options ();
3895 }
3896 
3897 static void
3898 display_target_options ()
3899 {
3900   int undoc, i;
3901   static bool displayed = false;
3902 
3903   /* Avoid double printing for --help --target-help.  */
3904   if (displayed)
3905     return;
3906   displayed = true;
3907 
3908   if (ARRAY_SIZE (target_switches) > 1
3909 #ifdef TARGET_OPTIONS
3910       || ARRAY_SIZE (target_options) > 1
3911 #endif
3912       )
3913     {
3914       int doc = 0;
3915 
3916       undoc = 0;
3917 
3918       printf (_("\nTarget specific options:\n"));
3919 
3920       for (i = ARRAY_SIZE (target_switches); i--;)
3921 	{
3922 	  const char *option      = target_switches[i].name;
3923 	  const char *description = target_switches[i].description;
3924 
3925 	  if (option == NULL || *option == 0)
3926 	    continue;
3927 	  else if (description == NULL)
3928 	    {
3929 	      undoc = 1;
3930 
3931 	      if (extra_warnings)
3932 		printf (_("  -m%-23.23s [undocumented]\n"), option);
3933 	    }
3934 	  else if (*description != 0)
3935 	    doc += printf ("  -m%-23.23s %s\n", option, _(description));
3936 	}
3937 
3938 #ifdef TARGET_OPTIONS
3939       for (i = ARRAY_SIZE (target_options); i--;)
3940 	{
3941 	  const char *option      = target_options[i].prefix;
3942 	  const char *description = target_options[i].description;
3943 
3944 	  if (option == NULL || *option == 0)
3945 	    continue;
3946 	  else if (description == NULL)
3947 	    {
3948 	      undoc = 1;
3949 
3950 	      if (extra_warnings)
3951 		printf (_("  -m%-23.23s [undocumented]\n"), option);
3952 	    }
3953 	  else if (*description != 0)
3954 	    doc += printf ("  -m%-23.23s %s\n", option, _(description));
3955 	}
3956 #endif
3957       if (undoc)
3958 	{
3959 	  if (doc)
3960 	    printf (_("\nThere are undocumented target specific options as well.\n"));
3961 	  else
3962 	    printf (_("  They exist, but they are not documented.\n"));
3963 	}
3964     }
3965 }
3966 
3967 /* Parse a -d... command line switch.  */
3968 
3969 static void
3970 decode_d_option (arg)
3971      const char *arg;
3972 {
3973   int i, c, matched;
3974 
3975   while (*arg)
3976     switch (c = *arg++)
3977       {
3978       case 'a':
3979 	for (i = 0; i < (int) DFI_MAX; ++i)
3980 	  dump_file[i].enabled = 1;
3981 	break;
3982       case 'A':
3983 	flag_debug_asm = 1;
3984 	break;
3985       case 'p':
3986 	flag_print_asm_name = 1;
3987 	break;
3988       case 'P':
3989 	flag_dump_rtl_in_asm = 1;
3990 	flag_print_asm_name = 1;
3991 	break;
3992       case 'v':
3993 	graph_dump_format = vcg;
3994 	break;
3995       case 'x':
3996 	rtl_dump_and_exit = 1;
3997 	break;
3998       case 'y':
3999 	set_yydebug = 1;
4000 	break;
4001       case 'D':	/* These are handled by the preprocessor.  */
4002       case 'I':
4003 	break;
4004 
4005       default:
4006 	matched = 0;
4007 	for (i = 0; i < (int) DFI_MAX; ++i)
4008 	  if (c == dump_file[i].debug_switch)
4009 	    {
4010 	      dump_file[i].enabled = 1;
4011 	      matched = 1;
4012 	    }
4013 
4014 	if (! matched)
4015 	  warning ("unrecognized gcc debugging option: %c", c);
4016 	break;
4017       }
4018 }
4019 
4020 /* Parse a -f... command line switch.  ARG is the value after the -f.
4021    It is safe to access 'ARG - 2' to generate the full switch name.
4022    Return the number of strings consumed.  */
4023 
4024 static int
4025 decode_f_option (arg)
4026      const char *arg;
4027 {
4028   int j;
4029   const char *option_value = NULL;
4030 
4031   /* Search for the option in the table of binary f options.  */
4032   for (j = ARRAY_SIZE (f_options); j--;)
4033     {
4034       if (!strcmp (arg, f_options[j].string))
4035 	{
4036 	  *f_options[j].variable = f_options[j].on_value;
4037 	  return 1;
4038 	}
4039 
4040       if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4041 	  && ! strcmp (arg + 3, f_options[j].string))
4042 	{
4043 	  *f_options[j].variable = ! f_options[j].on_value;
4044 	  return 1;
4045 	}
4046     }
4047 
4048   if (!strcmp (arg, "fast-math"))
4049     set_fast_math_flags (1);
4050   else if (!strcmp (arg, "no-fast-math"))
4051     set_fast_math_flags (0);
4052   else if ((option_value = skip_leading_substring (arg, "inline-limit-"))
4053 	   || (option_value = skip_leading_substring (arg, "inline-limit=")))
4054     {
4055       int val =
4056 	read_integral_parameter (option_value, arg - 2,
4057 				 MAX_INLINE_INSNS);
4058       set_param_value ("max-inline-insns", val);
4059       set_param_value ("max-inline-insns-single", val/2);
4060       set_param_value ("max-inline-insns-auto", val/2);
4061       set_param_value ("max-inline-insns-rtl", val);
4062       if (val/4 < MIN_INLINE_INSNS)
4063 	{
4064 	  if (val/4 > 10)
4065 	    set_param_value ("min-inline-insns", val/4);
4066 	  else
4067 	    set_param_value ("min-inline-insns", 10);
4068 	}
4069     }
4070   else if ((option_value = skip_leading_substring (arg, "tls-model=")))
4071     {
4072       if (strcmp (option_value, "global-dynamic") == 0)
4073 	flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
4074       else if (strcmp (option_value, "local-dynamic") == 0)
4075 	flag_tls_default = TLS_MODEL_LOCAL_DYNAMIC;
4076       else if (strcmp (option_value, "initial-exec") == 0)
4077 	flag_tls_default = TLS_MODEL_INITIAL_EXEC;
4078       else if (strcmp (option_value, "local-exec") == 0)
4079 	flag_tls_default = TLS_MODEL_LOCAL_EXEC;
4080       else
4081 	warning ("`%s': unknown tls-model option", arg - 2);
4082     }
4083 #ifdef INSN_SCHEDULING
4084   else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
4085     fix_sched_param ("verbose", option_value);
4086 #endif
4087   else if ((option_value = skip_leading_substring (arg, "fixed-")))
4088     fix_register (option_value, 1, 1);
4089   else if ((option_value = skip_leading_substring (arg, "call-used-")))
4090     fix_register (option_value, 0, 1);
4091   else if ((option_value = skip_leading_substring (arg, "call-saved-")))
4092     fix_register (option_value, 0, 0);
4093   else if ((option_value = skip_leading_substring (arg, "align-loops=")))
4094     align_loops = read_integral_parameter (option_value, arg - 2, align_loops);
4095   else if ((option_value = skip_leading_substring (arg, "align-functions=")))
4096     align_functions
4097       = read_integral_parameter (option_value, arg - 2, align_functions);
4098   else if ((option_value = skip_leading_substring (arg, "align-jumps=")))
4099     align_jumps = read_integral_parameter (option_value, arg - 2, align_jumps);
4100   else if ((option_value = skip_leading_substring (arg, "align-labels=")))
4101     align_labels
4102       = read_integral_parameter (option_value, arg - 2, align_labels);
4103   else if ((option_value
4104 	    = skip_leading_substring (arg, "stack-limit-register=")))
4105     {
4106       int reg = decode_reg_name (option_value);
4107       if (reg < 0)
4108 	error ("unrecognized register name `%s'", option_value);
4109       else
4110 	stack_limit_rtx = gen_rtx_REG (Pmode, reg);
4111     }
4112   else if ((option_value
4113 	    = skip_leading_substring (arg, "stack-limit-symbol=")))
4114     {
4115       const char *nm;
4116       nm = ggc_strdup (option_value);
4117       stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
4118     }
4119   else if ((option_value
4120 	    = skip_leading_substring (arg, "message-length=")))
4121     output_set_maximum_length
4122       (&global_dc->buffer, read_integral_parameter
4123        (option_value, arg - 2, diagnostic_line_cutoff (global_dc)));
4124   else if ((option_value
4125 	    = skip_leading_substring (arg, "diagnostics-show-location=")))
4126     {
4127       if (!strcmp (option_value, "once"))
4128 	diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
4129       else if (!strcmp (option_value, "every-line"))
4130 	diagnostic_prefixing_rule (global_dc)
4131 	  = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
4132       else
4133 	error ("unrecognized option `%s'", arg - 2);
4134     }
4135   else if (!strcmp (arg, "no-stack-limit"))
4136     stack_limit_rtx = NULL_RTX;
4137   else if ((option_value = skip_leading_substring (arg, "random-seed=")))
4138     flag_random_seed = option_value;
4139   else if (!strcmp (arg, "no-random-seed"))
4140     flag_random_seed = NULL;
4141   else if (!strcmp (arg, "preprocessed"))
4142     /* Recognize this switch but do nothing.  This prevents warnings
4143        about an unrecognized switch if cpplib has not been linked in.  */
4144     ;
4145   else
4146     return 0;
4147 
4148   return 1;
4149 }
4150 
4151 /* Parse a -W... command line switch.  ARG is the value after the -W.
4152    It is safe to access 'ARG - 2' to generate the full switch name.
4153    Return the number of strings consumed.  */
4154 
4155 static int
4156 decode_W_option (arg)
4157      const char *arg;
4158 {
4159   const char *option_value = NULL;
4160   int j;
4161 
4162   /* Search for the option in the table of binary W options.  */
4163 
4164   for (j = ARRAY_SIZE (W_options); j--;)
4165     {
4166       if (!strcmp (arg, W_options[j].string))
4167 	{
4168 	  *W_options[j].variable = W_options[j].on_value;
4169 	  return 1;
4170 	}
4171 
4172       if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4173 	  && ! strcmp (arg + 3, W_options[j].string))
4174 	{
4175 	  *W_options[j].variable = ! W_options[j].on_value;
4176 	  return 1;
4177 	}
4178     }
4179 
4180   if ((option_value = skip_leading_substring (arg, "id-clash-")))
4181     warning ("-Wid-clash-LEN is no longer supported");
4182   else if ((option_value = skip_leading_substring (arg, "larger-than-")))
4183     {
4184       larger_than_size = read_integral_parameter (option_value, arg - 2, -1);
4185 
4186       warn_larger_than = larger_than_size != -1;
4187     }
4188   else if ((option_value = skip_leading_substring (arg, "stack-larger-than-")))
4189     {
4190       stack_larger_than_size = read_integral_parameter (option_value, arg - 2, -1);
4191 
4192       warn_stack_larger_than = stack_larger_than_size != -1;
4193     }
4194   else if (!strcmp (arg, "unused"))
4195     {
4196       set_Wunused (1);
4197     }
4198   else if (!strcmp (arg, "no-unused"))
4199     {
4200       set_Wunused (0);
4201     }
4202   else
4203     return 0;
4204 
4205   return 1;
4206 }
4207 
4208 /* Parse a -g... command line switch.  ARG is the value after the -g.
4209    It is safe to access 'ARG - 2' to generate the full switch name.
4210    Return the number of strings consumed.  */
4211 
4212 static int
4213 decode_g_option (arg)
4214      const char *arg;
4215 {
4216   static unsigned level = 0;
4217   /* A lot of code assumes write_symbols == NO_DEBUG if the
4218      debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4219      of what debugging type has been selected).  This records the
4220      selected type.  It is an error to specify more than one
4221      debugging type.  */
4222   static enum debug_info_type selected_debug_type = NO_DEBUG;
4223   /* Non-zero if debugging format has been explicitly set.
4224      -g and -ggdb don't explicitly set the debugging format so
4225      -gdwarf -g3 is equivalent to -gdwarf3.  */
4226   static int type_explicitly_set_p = 0;
4227   /* Indexed by enum debug_info_type.  */
4228   static const char *const debug_type_names[] =
4229   {
4230     "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff", "vms"
4231   };
4232 
4233   /* The maximum admissible debug level value.  */
4234   static const unsigned max_debug_level = 3;
4235 
4236   /* Look up ARG in the table.  */
4237   for (da = debug_args; da->arg; da++)
4238     {
4239       const int da_len = strlen (da->arg);
4240 
4241       if (da_len == 0 || ! strncmp (arg, da->arg, da_len))
4242 	{
4243 	  enum debug_info_type type = da->debug_type;
4244 	  const char *p = arg + da_len;
4245 
4246 	  if (*p && ! ISDIGIT (*p))
4247 	    continue;
4248 
4249 	  /* A debug flag without a level defaults to level 2.
4250 	     Note we do not want to call read_integral_parameter
4251 	     for that case since it will call atoi which
4252 	     will return zero.
4253 
4254 	     ??? We may want to generalize the interface to
4255 	     read_integral_parameter to better handle this case
4256 	     if this case shows up often.  */
4257 	  if (*p)
4258 	    level = read_integral_parameter (p, 0, max_debug_level + 1);
4259 	  else
4260 	    level = (level == 0) ? 2 : level;
4261 
4262 	  if (da_len > 1 && *p && !strncmp (arg, "dwarf", da_len))
4263 	    {
4264 	      error ("use -gdwarf -g%d for DWARF v1, level %d",
4265 		     level, level);
4266 	      if (level == 2)
4267 		error ("use -gdwarf-2   for DWARF v2");
4268 	    }
4269 
4270 	  if (level > max_debug_level)
4271 	    {
4272 	      warning ("\
4273 ignoring option `%s' due to invalid debug level specification",
4274 		       arg - 2);
4275 	      level = debug_info_level;
4276 	    }
4277 
4278 	  if (type == NO_DEBUG)
4279 	    {
4280 	      type = PREFERRED_DEBUGGING_TYPE;
4281 
4282 	      if (da_len > 1 && strncmp (arg, "gdb", da_len) == 0)
4283 		{
4284 #ifdef DWARF2_DEBUGGING_INFO
4285 		  type = DWARF2_DEBUG;
4286 #else
4287 #ifdef DBX_DEBUGGING_INFO
4288 		  type = DBX_DEBUG;
4289 #endif
4290 #endif
4291 		}
4292 	    }
4293 
4294 	  if (type == NO_DEBUG)
4295 	    warning ("`%s': unknown or unsupported -g option", arg - 2);
4296 
4297 	  /* Does it conflict with an already selected type?  */
4298 	  if (type_explicitly_set_p
4299 	      /* -g/-ggdb don't conflict with anything.  */
4300 	      && da->debug_type != NO_DEBUG
4301 	      && type != selected_debug_type)
4302 	    warning ("`%s' ignored, conflicts with `-g%s'",
4303 		     arg - 2, debug_type_names[(int) selected_debug_type]);
4304 	  else
4305 	    {
4306 	      /* If the format has already been set, -g/-ggdb
4307 		 only change the debug level.  */
4308 	      if (type_explicitly_set_p && da->debug_type == NO_DEBUG)
4309 		/* Don't change debugging type.  */
4310 		;
4311 	      else
4312 		{
4313 		  selected_debug_type = type;
4314 		  type_explicitly_set_p = da->debug_type != NO_DEBUG;
4315 		}
4316 
4317 	      write_symbols = (level == 0
4318 			       ? NO_DEBUG
4319 			       : selected_debug_type);
4320 	      use_gnu_debug_info_extensions = da->use_extensions_p;
4321 	      debug_info_level = (enum debug_info_level) level;
4322 	    }
4323 
4324 	  break;
4325 	}
4326     }
4327 
4328   if (! da->arg)
4329     return 0;
4330 
4331   return 1;
4332 }
4333 
4334 /* Decode the first argument in the argv as a language-independent option.
4335    Return the number of strings consumed.  */
4336 
4337 static unsigned int
4338 independent_decode_option (argc, argv)
4339      int argc;
4340      char **argv;
4341 {
4342   char *arg = argv[0];
4343 
4344   if (arg[0] != '-' || arg[1] == 0)
4345     {
4346       if (arg[0] == '+')
4347 	return 0;
4348 
4349       filename = arg;
4350 
4351       return 1;
4352     }
4353 
4354   arg++;
4355 
4356   if (!strcmp (arg, "-help"))
4357     {
4358       display_help ();
4359       exit_after_options = 1;
4360       return 1;
4361     }
4362 
4363   if (!strcmp (arg, "-target-help"))
4364     {
4365       display_target_options ();
4366       exit_after_options = 1;
4367       return 1;
4368     }
4369 
4370   if (!strcmp (arg, "-version"))
4371     {
4372       print_version (stderr, "");
4373       exit_after_options = 1;
4374       return 1;
4375     }
4376 
4377   /* Handle '--param <name>=<value>'.  */
4378   if (strcmp (arg, "-param") == 0)
4379     {
4380       char *equal;
4381 
4382       if (argc == 1)
4383 	{
4384 	  error ("-param option missing argument");
4385 	  return 1;
4386 	}
4387 
4388       /* Get the '<name>=<value>' parameter.  */
4389       arg = argv[1];
4390       /* Look for the `='.  */
4391       equal = strchr (arg, '=');
4392       if (!equal)
4393 	error ("invalid --param option: %s", arg);
4394       else
4395 	{
4396 	  int val;
4397 
4398 	  /* Zero out the `=' sign so that we get two separate strings.  */
4399 	  *equal = '\0';
4400 	  /* Figure out what value is specified.  */
4401 	  val = read_integral_parameter (equal + 1, NULL, INVALID_PARAM_VAL);
4402 	  if (val != INVALID_PARAM_VAL)
4403 	    set_param_value (arg, val);
4404 	  else
4405 	    error ("invalid parameter value `%s'", equal + 1);
4406 	}
4407 
4408       return 2;
4409     }
4410 
4411   if (*arg == 'Y')
4412     arg++;
4413 
4414   switch (*arg)
4415     {
4416     default:
4417       return 0;
4418 
4419     case 'O':
4420       /* Already been treated in main (). Do nothing.  */
4421       break;
4422 
4423     case 'm':
4424       set_target_switch (arg + 1);
4425       break;
4426 
4427     case 'f':
4428       return decode_f_option (arg + 1);
4429 
4430     case 'g':
4431       return decode_g_option (arg + 1);
4432 
4433     case 'd':
4434       if (!strcmp (arg, "dumpbase"))
4435 	{
4436 	  if (argc == 1)
4437 	    return 0;
4438 
4439 	  if (argv[1][0])
4440 	    dump_base_name = argv[1];
4441 
4442 	  return 2;
4443 	}
4444       else
4445 	decode_d_option (arg + 1);
4446       break;
4447 
4448     case 'p':
4449       if (!strcmp (arg, "pedantic"))
4450 	pedantic = 1;
4451       else if (!strcmp (arg, "pedantic-errors"))
4452 	flag_pedantic_errors = pedantic = 1;
4453       else if (arg[1] == 0)
4454 	profile_flag = 1;
4455       else
4456 	return 0;
4457       break;
4458 
4459     case 'q':
4460       if (!strcmp (arg, "quiet"))
4461 	quiet_flag = 1;
4462       else
4463 	return 0;
4464       break;
4465 
4466     case 'v':
4467       if (!strcmp (arg, "version"))
4468 	version_flag = 1;
4469       else
4470 	return 0;
4471       break;
4472 
4473     case 'w':
4474       if (arg[1] == 0)
4475 	inhibit_warnings = 1;
4476       else
4477 	return 0;
4478       break;
4479 
4480     case 'W':
4481       if (arg[1] == 0)
4482 	{
4483 	  extra_warnings = 1;
4484 	  /* We save the value of warn_uninitialized, since if they put
4485 	     -Wuninitialized on the command line, we need to generate a
4486 	     warning about not using it without also specifying -O.  */
4487 	  if (warn_uninitialized != 1)
4488 	    warn_uninitialized = 2;
4489 	}
4490       else
4491 	return decode_W_option (arg + 1);
4492       break;
4493 
4494     case 'a':
4495       if (!strncmp (arg, "aux-info", 8))
4496 	{
4497 	  if (arg[8] == '\0')
4498 	    {
4499 	      if (argc == 1)
4500 		return 0;
4501 
4502 	      aux_info_file_name = argv[1];
4503 	      flag_gen_aux_info = 1;
4504 	      return 2;
4505 	    }
4506 	  else if (arg[8] == '=')
4507 	    {
4508 	      aux_info_file_name = arg + 9;
4509 	      flag_gen_aux_info = 1;
4510 	    }
4511 	  else
4512 	    return 0;
4513 	}
4514       else if (!strcmp (arg, "auxbase"))
4515 	{
4516 	  if (argc == 1)
4517 	    return 0;
4518 
4519 	  if (argv[1][0])
4520 	    aux_base_name = argv[1];
4521 
4522 	  return 2;
4523 	}
4524       else if (!strcmp (arg, "auxbase-strip"))
4525 	{
4526 	  if (argc == 1)
4527 	    return 0;
4528 
4529 	  if (argv[1][0])
4530 	    {
4531 	      strip_off_ending (argv[1], strlen (argv[1]));
4532 	      if (argv[1][0])
4533 		aux_base_name = argv[1];
4534 	    }
4535 
4536 	  return 2;
4537 	}
4538       else
4539 	return 0;
4540       break;
4541 
4542     case 'o':
4543       if (arg[1] == 0)
4544 	{
4545 	  if (argc == 1)
4546 	    return 0;
4547 
4548 	  asm_file_name = argv[1];
4549 	  return 2;
4550 	}
4551       return 0;
4552 
4553     case 'G':
4554       {
4555 	int g_switch_val;
4556 	int return_val;
4557 
4558 	if (arg[1] == 0)
4559 	  {
4560 	    if (argc == 1)
4561 	      return 0;
4562 
4563 	    g_switch_val = read_integral_parameter (argv[1], 0, -1);
4564 	    return_val = 2;
4565 	  }
4566 	else
4567 	  {
4568 	    g_switch_val = read_integral_parameter (arg + 1, 0, -1);
4569 	    return_val = 1;
4570 	  }
4571 
4572 	if (g_switch_val == -1)
4573 	  return_val = 0;
4574 	else
4575 	  {
4576 	    g_switch_set = TRUE;
4577 	    g_switch_value = g_switch_val;
4578 	  }
4579 
4580 	return return_val;
4581       }
4582     }
4583 
4584   return 1;
4585 }
4586 
4587 /* Decode -m switches.  */
4588 /* Decode the switch -mNAME.  */
4589 
4590 static void
4591 set_target_switch (name)
4592      const char *name;
4593 {
4594   size_t j;
4595   int valid_target_option = 0;
4596 
4597   for (j = 0; j < ARRAY_SIZE (target_switches); j++)
4598     if (!strcmp (target_switches[j].name, name))
4599       {
4600 	if (target_switches[j].value < 0)
4601 	  target_flags &= ~-target_switches[j].value;
4602 	else
4603 	  target_flags |= target_switches[j].value;
4604 	if (name[0] != 0)
4605 	  {
4606 	    if (target_switches[j].value < 0)
4607 	      target_flags_explicit |= -target_switches[j].value;
4608 	    else
4609 	      target_flags_explicit |= target_switches[j].value;
4610 	  }
4611 	valid_target_option = 1;
4612       }
4613 
4614 #ifdef TARGET_OPTIONS
4615   if (!valid_target_option)
4616     for (j = 0; j < ARRAY_SIZE (target_options); j++)
4617       {
4618 	int len = strlen (target_options[j].prefix);
4619 	if (!strncmp (target_options[j].prefix, name, len))
4620 	  {
4621 	    *target_options[j].variable = name + len;
4622 	    valid_target_option = 1;
4623 	  }
4624       }
4625 #endif
4626 
4627   if (!valid_target_option)
4628     error ("invalid option `%s'", name);
4629 }
4630 
4631 /* Print version information to FILE.
4632    Each line begins with INDENT (for the case where FILE is the
4633    assembler output file).  */
4634 
4635 static void
4636 print_version (file, indent)
4637      FILE *file;
4638      const char *indent;
4639 {
4640 #ifndef __VERSION__
4641 #define __VERSION__ "[?]"
4642 #endif
4643   fnotice (file,
4644 #ifdef __GNUC__
4645 	   "%s%s%s version %s (%s)\n%s\tcompiled by GNU C version %s.\n"
4646 #else
4647 	   "%s%s%s version %s (%s) compiled by CC.\n"
4648 #endif
4649 	   , indent, *indent != 0 ? " " : "",
4650 	   lang_hooks.name, version_string, TARGET_NAME,
4651 	   indent, __VERSION__);
4652   fnotice (file, "%s%sGGC heuristics: --param ggc-min-expand=%d --param ggc-min-heapsize=%d\n",
4653 	   indent, *indent != 0 ? " " : "",
4654 	   PARAM_VALUE (GGC_MIN_EXPAND), PARAM_VALUE (GGC_MIN_HEAPSIZE));
4655 }
4656 
4657 /* Print an option value and return the adjusted position in the line.
4658    ??? We don't handle error returns from fprintf (disk full); presumably
4659    other code will catch a disk full though.  */
4660 
4661 static int
4662 print_single_switch (file, pos, max, indent, sep, term, type, name)
4663      FILE *file;
4664      int pos, max;
4665      const char *indent, *sep, *term, *type, *name;
4666 {
4667   /* The ultrix fprintf returns 0 on success, so compute the result we want
4668      here since we need it for the following test.  */
4669   int len = strlen (sep) + strlen (type) + strlen (name);
4670 
4671   if (pos != 0
4672       && pos + len > max)
4673     {
4674       fprintf (file, "%s", term);
4675       pos = 0;
4676     }
4677   if (pos == 0)
4678     {
4679       fprintf (file, "%s", indent);
4680       pos = strlen (indent);
4681     }
4682   fprintf (file, "%s%s%s", sep, type, name);
4683   pos += len;
4684   return pos;
4685 }
4686 
4687 /* Print active target switches to FILE.
4688    POS is the current cursor position and MAX is the size of a "line".
4689    Each line begins with INDENT and ends with TERM.
4690    Each switch is separated from the next by SEP.  */
4691 
4692 static void
4693 print_switch_values (file, pos, max, indent, sep, term)
4694      FILE *file;
4695      int pos, max;
4696      const char *indent, *sep, *term;
4697 {
4698   size_t j;
4699   char **p;
4700 
4701   /* Fill in the -frandom-seed option, if the user didn't pass it, so
4702      that it can be printed below.  This helps reproducibility.  Of
4703      course, the string may never be used, but we can't tell that at
4704      this point in the compile.  */
4705   default_flag_random_seed ();
4706 
4707   /* Print the options as passed.  */
4708 
4709   pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
4710 			     _("options passed: "), "");
4711 
4712   for (p = &save_argv[1]; *p != NULL; p++)
4713     if (**p == '-')
4714       {
4715 	/* Ignore these.  */
4716 	if (strcmp (*p, "-o") == 0)
4717 	  {
4718 	    if (p[1] != NULL)
4719 	      p++;
4720 	    continue;
4721 	  }
4722 	if (strcmp (*p, "-quiet") == 0)
4723 	  continue;
4724 	if (strcmp (*p, "-version") == 0)
4725 	  continue;
4726 	if ((*p)[1] == 'd')
4727 	  continue;
4728 
4729 	pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
4730       }
4731   if (pos > 0)
4732     fprintf (file, "%s", term);
4733 
4734   /* Print the -f and -m options that have been enabled.
4735      We don't handle language specific options but printing argv
4736      should suffice.  */
4737 
4738   pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
4739 			     _("options enabled: "), "");
4740 
4741   for (j = 0; j < ARRAY_SIZE (f_options); j++)
4742     if (*f_options[j].variable == f_options[j].on_value)
4743       pos = print_single_switch (file, pos, max, indent, sep, term,
4744 				 "-f", f_options[j].string);
4745 
4746   /* Print target specific options.  */
4747 
4748   for (j = 0; j < ARRAY_SIZE (target_switches); j++)
4749     if (target_switches[j].name[0] != '\0'
4750 	&& target_switches[j].value > 0
4751 	&& ((target_switches[j].value & target_flags)
4752 	    == target_switches[j].value))
4753       {
4754 	pos = print_single_switch (file, pos, max, indent, sep, term,
4755 				   "-m", target_switches[j].name);
4756       }
4757 
4758 #ifdef TARGET_OPTIONS
4759   for (j = 0; j < ARRAY_SIZE (target_options); j++)
4760     if (*target_options[j].variable != NULL)
4761       {
4762 	char prefix[256];
4763 	sprintf (prefix, "-m%s", target_options[j].prefix);
4764 	pos = print_single_switch (file, pos, max, indent, sep, term,
4765 				   prefix, *target_options[j].variable);
4766       }
4767 #endif
4768 
4769   fprintf (file, "%s", term);
4770 }
4771 
4772 /* Open assembly code output file.  Do this even if -fsyntax-only is
4773    on, because then the driver will have provided the name of a
4774    temporary file or bit bucket for us.  NAME is the file specified on
4775    the command line, possibly NULL.  */
4776 static void
4777 init_asm_output (name)
4778      const char *name;
4779 {
4780   if (name == NULL && asm_file_name == 0)
4781     asm_out_file = stdout;
4782   else
4783     {
4784       if (asm_file_name == 0)
4785 	{
4786 	  int len = strlen (dump_base_name);
4787 	  char *dumpname = (char *) xmalloc (len + 6);
4788 	  memcpy (dumpname, dump_base_name, len + 1);
4789 	  strip_off_ending (dumpname, len);
4790 	  strcat (dumpname, ".s");
4791 	  asm_file_name = dumpname;
4792 	}
4793       if (!strcmp (asm_file_name, "-"))
4794 	asm_out_file = stdout;
4795       else
4796 	asm_out_file = fopen (asm_file_name, "w");
4797       if (asm_out_file == 0)
4798 	fatal_io_error ("can't open %s for writing", asm_file_name);
4799     }
4800 
4801 #ifdef IO_BUFFER_SIZE
4802   setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
4803 	   _IOFBF, IO_BUFFER_SIZE);
4804 #endif
4805 
4806   if (!flag_syntax_only)
4807     {
4808 #ifdef ASM_FILE_START
4809       ASM_FILE_START (asm_out_file);
4810 #endif
4811 
4812 #ifdef ASM_COMMENT_START
4813       if (flag_verbose_asm)
4814 	{
4815 	  /* Print the list of options in effect.  */
4816 	  print_version (asm_out_file, ASM_COMMENT_START);
4817 	  print_switch_values (asm_out_file, 0, MAX_LINE,
4818 			       ASM_COMMENT_START, " ", "\n");
4819 	  /* Add a blank line here so it appears in assembler output but not
4820 	     screen output.  */
4821 	  fprintf (asm_out_file, "\n");
4822 	}
4823 #endif
4824     }
4825 }
4826 
4827 /* Initialization of the front end environment, before command line
4828    options are parsed.  Signal handlers, internationalization etc.
4829    ARGV0 is main's argv[0].  */
4830 static void
4831 general_init (argv0)
4832      char *argv0;
4833 {
4834   char *p;
4835 
4836   p = argv0 + strlen (argv0);
4837   while (p != argv0 && !IS_DIR_SEPARATOR (p[-1]))
4838     --p;
4839   progname = p;
4840 
4841   xmalloc_set_program_name (progname);
4842 
4843   hex_init ();
4844 
4845   gcc_init_libintl ();
4846 
4847   /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages.  */
4848 #ifdef SIGSEGV
4849   signal (SIGSEGV, crash_signal);
4850 #endif
4851 #ifdef SIGILL
4852   signal (SIGILL, crash_signal);
4853 #endif
4854 #ifdef SIGBUS
4855   signal (SIGBUS, crash_signal);
4856 #endif
4857 #ifdef SIGABRT
4858   signal (SIGABRT, crash_signal);
4859 #endif
4860 #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
4861   signal (SIGIOT, crash_signal);
4862 #endif
4863 #ifdef SIGFPE
4864   signal (SIGFPE, crash_signal);
4865 #endif
4866 
4867   /* Initialize the diagnostics reporting machinery, so option parsing
4868      can give warnings and errors.  */
4869   diagnostic_initialize (global_dc);
4870 
4871   /* Initialize the garbage-collector, string pools and tree type hash
4872      table.  */
4873   init_ggc ();
4874   init_stringpool ();
4875   init_ttree ();
4876 }
4877 
4878 /* Parse command line options and set default flag values, called
4879    after language-independent option-independent initialization.  Do
4880    minimal options processing.  Outputting diagnostics is OK, but GC
4881    and identifier hashtables etc. are not initialized yet.
4882 
4883    Return nonzero to suppress compiler back end initialization.  */
4884 static void
4885 parse_options_and_default_flags (argc, argv)
4886      int argc;
4887      char **argv;
4888 {
4889   int i;
4890 
4891   /* Save in case md file wants to emit args as a comment.  */
4892   save_argc = argc;
4893   save_argv = argv;
4894 
4895   /* Initialize register usage now so switches may override.  */
4896   init_reg_sets ();
4897 
4898   /* Register the language-independent parameters.  */
4899   add_params (lang_independent_params, LAST_PARAM);
4900 
4901   /* This must be done after add_params but before argument processing.  */
4902   init_ggc_heuristics();
4903 
4904   /* Perform language-specific options initialization.  */
4905   (*lang_hooks.init_options) ();
4906 
4907   /* Scan to see what optimization level has been specified.  That will
4908      determine the default value of many flags.  */
4909   for (i = 1; i < argc; i++)
4910     {
4911       if (!strcmp (argv[i], "-O"))
4912 	{
4913 	  optimize = 1;
4914 	  optimize_size = 0;
4915 	}
4916       else if (argv[i][0] == '-' && argv[i][1] == 'O')
4917 	{
4918 	  /* Handle -Os, -O2, -O3, -O69, ...  */
4919 	  char *p = &argv[i][2];
4920 
4921 	  if ((p[0] == 's') && (p[1] == 0))
4922 	    {
4923 	      optimize_size = 1;
4924 
4925 	      /* Optimizing for size forces optimize to be 2.  */
4926 	      optimize = 2;
4927 	    }
4928 	  else
4929 	    {
4930 	      const int optimize_val = read_integral_parameter (p, p - 2, -1);
4931 	      if (optimize_val != -1)
4932 		{
4933 		  optimize = optimize_val;
4934 		  optimize_size = 0;
4935 		}
4936 	    }
4937 	}
4938     }
4939 
4940   if (!optimize)
4941     {
4942       flag_merge_constants = 0;
4943     }
4944 
4945   if (optimize >= 1)
4946     {
4947       flag_defer_pop = 1;
4948       flag_thread_jumps = 1;
4949 #ifdef DELAY_SLOTS
4950       flag_delayed_branch = 1;
4951 #endif
4952 #ifdef CAN_DEBUG_WITHOUT_FP
4953       flag_omit_frame_pointer = 1;
4954 #endif
4955       flag_guess_branch_prob = 1;
4956       flag_cprop_registers = 1;
4957       flag_loop_optimize = 1;
4958       flag_crossjumping = 1;
4959       flag_if_conversion = 1;
4960       flag_if_conversion2 = 1;
4961     }
4962 
4963   if (optimize >= 2)
4964     {
4965       flag_optimize_sibling_calls = 1;
4966       flag_cse_follow_jumps = 1;
4967       flag_cse_skip_blocks = 1;
4968       flag_gcse = 1;
4969       flag_expensive_optimizations = 1;
4970       flag_strength_reduce = 1;
4971       flag_rerun_cse_after_loop = 1;
4972       flag_rerun_loop_opt = 1;
4973       flag_caller_saves = 1;
4974       flag_force_mem = 1;
4975       flag_peephole2 = 1;
4976 #ifdef INSN_SCHEDULING
4977       flag_schedule_insns = 1;
4978       flag_schedule_insns_after_reload = 1;
4979 #endif
4980       flag_regmove = 1;
4981 #if !defined(OPENBSD_NATIVE) && !defined(OPENBSD_CROSS)
4982       flag_delete_null_pointer_checks = 1;
4983 #endif
4984       flag_reorder_blocks = 1;
4985       flag_reorder_functions = 1;
4986     }
4987 
4988   if (optimize >= 3)
4989     {
4990       flag_strict_aliasing = 1;
4991       flag_inline_functions = 1;
4992       flag_rename_registers = 1;
4993     }
4994 
4995   if (optimize < 2 || optimize_size)
4996     {
4997       align_loops = 1;
4998       align_jumps = 1;
4999       align_labels = 1;
5000       align_functions = 1;
5001 
5002       /* Don't reorder blocks when optimizing for size because extra
5003 	 jump insns may be created; also barrier may create extra padding.
5004 
5005 	 More correctly we should have a block reordering mode that tried
5006 	 to minimize the combined size of all the jumps.  This would more
5007 	 or less automatically remove extra jumps, but would also try to
5008 	 use more short jumps instead of long jumps.  */
5009       flag_reorder_blocks = 0;
5010     }
5011 
5012   /* Initialize whether `char' is signed.  */
5013   flag_signed_char = DEFAULT_SIGNED_CHAR;
5014 #ifdef DEFAULT_SHORT_ENUMS
5015   /* Initialize how much space enums occupy, by default.  */
5016   flag_short_enums = DEFAULT_SHORT_ENUMS;
5017 #endif
5018 
5019   /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
5020      modify it.  */
5021   target_flags = 0;
5022   set_target_switch ("");
5023 
5024   /* Unwind tables are always present in an ABI-conformant IA-64
5025      object file, so the default should be ON.  */
5026 #ifdef IA64_UNWIND_INFO
5027   flag_unwind_tables = IA64_UNWIND_INFO;
5028 #endif
5029 
5030 #ifdef OPTIMIZATION_OPTIONS
5031   /* Allow default optimizations to be specified on a per-machine basis.  */
5032   OPTIMIZATION_OPTIONS (optimize, optimize_size);
5033 #endif
5034 
5035   /* Perform normal command line switch decoding.  */
5036   for (i = 1; i < argc;)
5037     {
5038       int lang_processed;
5039       int indep_processed;
5040 
5041       /* Give the language a chance to decode the option for itself.  */
5042       lang_processed = (*lang_hooks.decode_option) (argc - i, argv + i);
5043 
5044       if (lang_processed >= 0)
5045 	/* Now see if the option also has a language independent meaning.
5046 	   Some options are both language specific and language independent,
5047 	   eg --help.  */
5048 	indep_processed = independent_decode_option (argc - i, argv + i);
5049       else
5050 	{
5051 	  lang_processed = -lang_processed;
5052 	  indep_processed = 0;
5053 	}
5054 
5055       if (lang_processed || indep_processed)
5056 	i += MAX (lang_processed, indep_processed);
5057       else
5058 	{
5059 	  const char *option = NULL;
5060 	  const char *lang = NULL;
5061 	  unsigned int j;
5062 
5063 	  /* It is possible that the command line switch is not valid for the
5064 	     current language, but it is valid for another language.  In order
5065 	     to be compatible with previous versions of the compiler (which
5066 	     did not issue an error message in this case) we check for this
5067 	     possibility here.  If we do find a match, then if extra_warnings
5068 	     is set we generate a warning message, otherwise we will just
5069 	     ignore the option.  */
5070 	  for (j = 0; j < ARRAY_SIZE (documented_lang_options); j++)
5071 	    {
5072 	      option = documented_lang_options[j].option;
5073 
5074 	      if (option == NULL)
5075 		lang = documented_lang_options[j].description;
5076 	      else if (! strncmp (argv[i], option, strlen (option)))
5077 		break;
5078 	    }
5079 
5080 	  if (j != ARRAY_SIZE (documented_lang_options))
5081 	    {
5082 	      if (extra_warnings)
5083 		{
5084 		  warning ("ignoring command line option '%s'", argv[i]);
5085 		  if (lang)
5086 		    warning
5087 		      ("(it is valid for %s but not the selected language)",
5088 		       lang);
5089 		}
5090 	    }
5091 	  else if (argv[i][0] == '-' && argv[i][1] == 'g')
5092 	    warning ("`%s': unknown or unsupported -g option", &argv[i][2]);
5093 	  else
5094 	    error ("unrecognized option `%s'", argv[i]);
5095 
5096 	  i++;
5097 	}
5098     }
5099 
5100   if (flag_pie)
5101     flag_pic = flag_pie;
5102 
5103   if (flag_pic && !flag_pie)
5104     flag_shlib = 1;
5105 
5106   if (flag_no_inline == 2)
5107     flag_no_inline = 0;
5108   else
5109     flag_really_no_inline = flag_no_inline;
5110 
5111   /* Set flag_no_inline before the post_options () hook.  The C front
5112      ends use it to determine tree inlining defaults.  FIXME: such
5113      code should be lang-independent when all front ends use tree
5114      inlining, in which case it, and this condition, should be moved
5115      to the top of process_options() instead.  */
5116   if (optimize == 0)
5117     {
5118       /* Inlining does not work if not optimizing,
5119 	 so force it not to be done.  */
5120       flag_no_inline = 1;
5121       warn_inline = 0;
5122 
5123       /* The c_decode_option function and decode_option hook set
5124 	 this to `2' if -Wall is used, so we can avoid giving out
5125 	 lots of errors for people who don't realize what -Wall does.  */
5126       if (warn_uninitialized == 1)
5127 	warning ("-Wuninitialized is not supported without -O");
5128     }
5129 
5130   if (flag_really_no_inline == 2)
5131     flag_really_no_inline = flag_no_inline;
5132 }
5133 
5134 /* Process the options that have been parsed.  */
5135 static void
5136 process_options ()
5137 {
5138 #ifdef OVERRIDE_OPTIONS
5139   /* Some machines may reject certain combinations of options.  */
5140   OVERRIDE_OPTIONS;
5141 #endif
5142 
5143   /* Set up the align_*_log variables, defaulting them to 1 if they
5144      were still unset.  */
5145   if (align_loops <= 0) align_loops = 1;
5146   if (align_loops_max_skip > align_loops || !align_loops)
5147     align_loops_max_skip = align_loops - 1;
5148   align_loops_log = floor_log2 (align_loops * 2 - 1);
5149   if (align_jumps <= 0) align_jumps = 1;
5150   if (align_jumps_max_skip > align_jumps || !align_jumps)
5151     align_jumps_max_skip = align_jumps - 1;
5152   align_jumps_log = floor_log2 (align_jumps * 2 - 1);
5153   if (align_labels <= 0) align_labels = 1;
5154   align_labels_log = floor_log2 (align_labels * 2 - 1);
5155   if (align_labels_max_skip > align_labels || !align_labels)
5156     align_labels_max_skip = align_labels - 1;
5157   if (align_functions <= 0) align_functions = 1;
5158   align_functions_log = floor_log2 (align_functions * 2 - 1);
5159 
5160   /* Unrolling all loops implies that standard loop unrolling must also
5161      be done.  */
5162   if (flag_unroll_all_loops)
5163     flag_unroll_loops = 1;
5164   /* Loop unrolling requires that strength_reduction be on also.  Silently
5165      turn on strength reduction here if it isn't already on.  Also, the loop
5166      unrolling code assumes that cse will be run after loop, so that must
5167      be turned on also.  */
5168   if (flag_unroll_loops)
5169     {
5170       flag_strength_reduce = 1;
5171       flag_rerun_cse_after_loop = 1;
5172     }
5173 
5174   if (flag_non_call_exceptions)
5175     flag_asynchronous_unwind_tables = 1;
5176   if (flag_asynchronous_unwind_tables)
5177     flag_unwind_tables = 1;
5178 
5179   /* Warn about options that are not supported on this machine.  */
5180 #ifndef INSN_SCHEDULING
5181   if (flag_schedule_insns || flag_schedule_insns_after_reload)
5182     warning ("instruction scheduling not supported on this target machine");
5183 #endif
5184 #ifndef DELAY_SLOTS
5185   if (flag_delayed_branch)
5186     warning ("this target machine does not have delayed branches");
5187 #endif
5188 
5189   user_label_prefix = USER_LABEL_PREFIX;
5190   if (flag_leading_underscore != -1)
5191     {
5192       /* If the default prefix is more complicated than "" or "_",
5193 	 issue a warning and ignore this option.  */
5194       if (user_label_prefix[0] == 0 ||
5195 	  (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
5196 	{
5197 	  user_label_prefix = flag_leading_underscore ? "_" : "";
5198 	}
5199       else
5200 	warning ("-f%sleading-underscore not supported on this target machine",
5201 		 flag_leading_underscore ? "" : "no-");
5202     }
5203 
5204   /* If we are in verbose mode, write out the version and maybe all the
5205      option flags in use.  */
5206   if (version_flag)
5207     {
5208       print_version (stderr, "");
5209       if (! quiet_flag)
5210 	print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
5211     }
5212 
5213   if (! quiet_flag || flag_detailed_statistics)
5214     time_report = 1;
5215 
5216   if (flag_syntax_only)
5217     {
5218       write_symbols = NO_DEBUG;
5219       profile_flag = 0;
5220     }
5221 
5222   /* Now we know write_symbols, set up the debug hooks based on it.
5223      By default we do nothing for debug output.  */
5224 #if defined(DBX_DEBUGGING_INFO)
5225   if (write_symbols == DBX_DEBUG)
5226     debug_hooks = &dbx_debug_hooks;
5227 #endif
5228 #if defined(XCOFF_DEBUGGING_INFO)
5229   if (write_symbols == XCOFF_DEBUG)
5230     debug_hooks = &xcoff_debug_hooks;
5231 #endif
5232 #ifdef SDB_DEBUGGING_INFO
5233   if (write_symbols == SDB_DEBUG)
5234     debug_hooks = &sdb_debug_hooks;
5235 #endif
5236 #ifdef DWARF_DEBUGGING_INFO
5237   if (write_symbols == DWARF_DEBUG)
5238     debug_hooks = &dwarf_debug_hooks;
5239 #endif
5240 #ifdef DWARF2_DEBUGGING_INFO
5241   if (write_symbols == DWARF2_DEBUG)
5242     debug_hooks = &dwarf2_debug_hooks;
5243 #endif
5244 #ifdef VMS_DEBUGGING_INFO
5245   if (write_symbols == VMS_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
5246     debug_hooks = &vmsdbg_debug_hooks;
5247 #endif
5248 
5249   /* If auxiliary info generation is desired, open the output file.
5250      This goes in the same directory as the source file--unlike
5251      all the other output files.  */
5252   if (flag_gen_aux_info)
5253     {
5254       aux_info_file = fopen (aux_info_file_name, "w");
5255       if (aux_info_file == 0)
5256 	fatal_io_error ("can't open %s", aux_info_file_name);
5257     }
5258 
5259   if (! targetm.have_named_sections)
5260     {
5261       if (flag_function_sections)
5262 	{
5263 	  warning ("-ffunction-sections not supported for this target");
5264 	  flag_function_sections = 0;
5265 	}
5266       if (flag_data_sections)
5267 	{
5268 	  warning ("-fdata-sections not supported for this target");
5269 	  flag_data_sections = 0;
5270 	}
5271     }
5272 
5273   if (flag_function_sections && profile_flag)
5274     {
5275       warning ("-ffunction-sections disabled; it makes profiling impossible");
5276       flag_function_sections = 0;
5277     }
5278 
5279 #ifndef HAVE_prefetch
5280   if (flag_prefetch_loop_arrays)
5281     {
5282       warning ("-fprefetch-loop-arrays not supported for this target");
5283       flag_prefetch_loop_arrays = 0;
5284     }
5285 #else
5286   if (flag_prefetch_loop_arrays && !HAVE_prefetch)
5287     {
5288       warning ("-fprefetch-loop-arrays not supported for this target (try -march switches)");
5289       flag_prefetch_loop_arrays = 0;
5290     }
5291 #endif
5292 
5293   /* This combination of options isn't handled for i386 targets and doesn't
5294      make much sense anyway, so don't allow it.  */
5295   if (flag_prefetch_loop_arrays && optimize_size)
5296     {
5297       warning ("-fprefetch-loop-arrays is not supported with -Os");
5298       flag_prefetch_loop_arrays = 0;
5299     }
5300 
5301 #ifndef OBJECT_FORMAT_ELF
5302   if (flag_function_sections && write_symbols != NO_DEBUG)
5303     warning ("-ffunction-sections may affect debugging on some targets");
5304 #endif
5305 
5306     /* The presence of IEEE signaling NaNs, implies all math can trap.  */
5307     if (flag_signaling_nans)
5308       flag_trapping_math = 1;
5309 
5310     /* This combination makes optimized frame addressings and causes
5311        a internal compilation error at prepare_stack_protection.
5312        so don't allow it.  */
5313     if (flag_stack_protection && !flag_propolice_protection)
5314       flag_propolice_protection = TRUE;
5315 }
5316 
5317 /* Initialize the compiler back end.  */
5318 static void
5319 backend_init ()
5320 {
5321   /* init_emit_once uses reg_raw_mode and therefore must be called
5322      after init_regs which initialized reg_raw_mode.  */
5323   init_regs ();
5324   init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
5325 		  || debug_info_level == DINFO_LEVEL_VERBOSE
5326 #ifdef VMS_DEBUGGING_INFO
5327 		    /* Enable line number info for traceback */
5328 		    || debug_info_level > DINFO_LEVEL_NONE
5329 #endif
5330 		    || flag_test_coverage
5331 		    || warn_notreached);
5332   init_fake_stack_mems ();
5333   init_alias_once ();
5334   init_loop ();
5335   init_reload ();
5336   init_function_once ();
5337   init_varasm_once ();
5338 
5339   /* The following initialization functions need to generate rtl, so
5340      provide a dummy function context for them.  */
5341   init_dummy_function_start ();
5342   init_expmed ();
5343   if (flag_caller_saves)
5344     init_caller_save ();
5345   expand_dummy_function_end ();
5346 }
5347 
5348 /* Language-dependent initialization.  Returns nonzero on success.  */
5349 static int
5350 lang_dependent_init (name)
5351      const char *name;
5352 {
5353   if (dump_base_name == 0)
5354     dump_base_name = name ? name : "gccdump";
5355 
5356   /* Front-end initialization.  This hook can assume that GC,
5357      identifier hashes etc. are set up, but debug initialization is
5358      not done yet.  This routine must return the original filename
5359      (e.g. foo.i -> foo.c) so can correctly initialize debug output.  */
5360   name = (*lang_hooks.init) (name);
5361   if (name == NULL)
5362     return 0;
5363 
5364   /* Is this duplication necessary?  */
5365   name = ggc_strdup (name);
5366   main_input_filename = input_filename = name;
5367   init_asm_output (name);
5368 
5369   /* These create various _DECL nodes, so need to be called after the
5370      front end is initialized.  */
5371   init_eh ();
5372   init_optabs ();
5373 
5374   /* The following initialization functions need to generate rtl, so
5375      provide a dummy function context for them.  */
5376   init_dummy_function_start ();
5377   init_expr_once ();
5378   expand_dummy_function_end ();
5379 
5380   /* Put an entry on the input file stack for the main input file.  */
5381   push_srcloc (input_filename, 0);
5382 
5383   /* If dbx symbol table desired, initialize writing it and output the
5384      predefined types.  */
5385   timevar_push (TV_SYMOUT);
5386 
5387 #ifdef DWARF2_UNWIND_INFO
5388   if (dwarf2out_do_frame ())
5389     dwarf2out_frame_init ();
5390 #endif
5391 
5392   /* Now we have the correct original filename, we can initialize
5393      debug output.  */
5394   (*debug_hooks->init) (name);
5395 
5396   timevar_pop (TV_SYMOUT);
5397 
5398   return 1;
5399 }
5400 
5401 /* Clean up: close opened files, etc.  */
5402 
5403 static void
5404 finalize ()
5405 {
5406   /* Close the dump files.  */
5407   if (flag_gen_aux_info)
5408     {
5409       fclose (aux_info_file);
5410       if (errorcount)
5411 	unlink (aux_info_file_name);
5412     }
5413 
5414   /* Close non-debugging input and output files.  Take special care to note
5415      whether fclose returns an error, since the pages might still be on the
5416      buffer chain while the file is open.  */
5417 
5418   if (asm_out_file)
5419     {
5420       if (ferror (asm_out_file) != 0)
5421 	fatal_io_error ("error writing to %s", asm_file_name);
5422       if (fclose (asm_out_file) != 0)
5423 	fatal_io_error ("error closing %s", asm_file_name);
5424     }
5425 
5426   /* Do whatever is necessary to finish printing the graphs.  */
5427   if (graph_dump_format != no_graph)
5428     {
5429       int i;
5430 
5431       for (i = 0; i < (int) DFI_MAX; ++i)
5432 	if (dump_file[i].initialized && dump_file[i].graph_dump_p)
5433 	  {
5434 	    char seq[16];
5435 	    char *suffix;
5436 
5437 	    sprintf (seq, DUMPFILE_FORMAT, i);
5438 	    suffix = concat (seq, dump_file[i].extension, NULL);
5439 	    finish_graph_dump_file (dump_base_name, suffix);
5440 	    free (suffix);
5441 	  }
5442     }
5443 
5444   if (mem_report)
5445     {
5446       ggc_print_statistics ();
5447       stringpool_statistics ();
5448       dump_tree_statistics ();
5449     }
5450 
5451   /* Free up memory for the benefit of leak detectors.  */
5452   free_reg_info ();
5453 
5454   /* Language-specific end of compilation actions.  */
5455   (*lang_hooks.finish) ();
5456 }
5457 
5458 /* Initialize the compiler, and compile the input file.  */
5459 static void
5460 do_compile ()
5461 {
5462   /* All command line options have been parsed; allow the front end to
5463      perform consistency checks, etc.  */
5464   bool no_backend = (*lang_hooks.post_options) ();
5465 
5466   /* The bulk of command line switch processing.  */
5467   process_options ();
5468 
5469   /* If an error has already occurred, give up.  */
5470   if (errorcount)
5471     return;
5472 
5473   if (aux_base_name)
5474     /*NOP*/;
5475   else if (filename)
5476     {
5477       char *name = xstrdup (lbasename (filename));
5478 
5479       aux_base_name = name;
5480       strip_off_ending (name, strlen (name));
5481     }
5482   else
5483     aux_base_name = "gccaux";
5484 
5485   /* We cannot start timing until after options are processed since that
5486      says if we run timers or not.  */
5487   init_timevar ();
5488   timevar_start (TV_TOTAL);
5489 
5490   /* Set up the back-end if requested.  */
5491   if (!no_backend)
5492     backend_init ();
5493 
5494   /* Language-dependent initialization.  Returns true on success.  */
5495   if (lang_dependent_init (filename))
5496     compile_file ();
5497 
5498   finalize ();
5499 
5500   /* Stop timing and print the times.  */
5501   timevar_stop (TV_TOTAL);
5502   timevar_print (stderr);
5503 }
5504 
5505 /* Entry point of cc1, cc1plus, jc1, f771, etc.
5506    Decode command args, then call compile_file.
5507    Exit code is FATAL_EXIT_CODE if can't open files or if there were
5508    any errors, or SUCCESS_EXIT_CODE if compilation succeeded.
5509 
5510    It is not safe to call this function more than once.  */
5511 
5512 int
5513 toplev_main (argc, argv)
5514      int argc;
5515      char **argv;
5516 {
5517   /* Initialization of GCC's environment, and diagnostics.  */
5518   general_init (argv[0]);
5519 
5520   /* Parse the options and do minimal processing; basically just
5521      enough to default flags appropriately.  */
5522   parse_options_and_default_flags (argc, argv);
5523 
5524   /* Exit early if we can (e.g. -help).  */
5525   if (!exit_after_options)
5526     do_compile ();
5527 
5528   if (errorcount || sorrycount)
5529     return (FATAL_EXIT_CODE);
5530 
5531   return (SUCCESS_EXIT_CODE);
5532 }
5533