1 /* Top level of GCC compilers (cc1, cc1plus, etc.)
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5 This file is part of GCC.
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
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
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
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. */
28 #undef FLOAT /* This is for hpux. They should change hpux. */
29 #undef FFS /* Some systems define this in param.h. */
31 #include "coretypes.h"
35 #ifdef HAVE_SYS_RESOURCE_H
36 # include <sys/resource.h>
39 #ifdef HAVE_SYS_TIMES_H
40 # include <sys/times.h>
48 #include "insn-attr.h"
49 #include "insn-config.h"
50 #include "insn-flags.h"
51 #include "hard-reg-set.h"
58 #include "basic-block.h"
65 #include "diagnostic.h"
69 #include "dwarf2asm.h"
70 #include "integrate.h"
74 #include "langhooks.h"
75 #include "cfglayout.h"
77 #include "hosthooks.h"
81 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
82 #include "dwarf2out.h"
85 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
89 #ifdef SDB_DEBUGGING_INFO
93 #ifdef XCOFF_DEBUGGING_INFO
94 #include "xcoffout.h" /* Needed for external data
95 declarations for e.g. AIX 4.x. */
98 /* Carry information from ASM_DECLARE_OBJECT_NAME
99 to ASM_FINISH_DECLARE_OBJECT. */
101 extern int size_directive_output;
102 extern tree last_assemble_variable_decl;
104 extern void reg_alloc (void);
106 static void general_init (char *);
107 static void parse_options_and_default_flags (int, char **);
108 static void do_compile (void);
109 static void process_options (void);
110 static void backend_init (void);
111 static int lang_dependent_init (const char *);
112 static void init_asm_output (const char *);
113 static void finalize (void);
115 static void set_target_switch (const char *);
117 static void crash_signal (int) ATTRIBUTE_NORETURN;
118 static void setup_core_dumping (void);
119 static void compile_file (void);
121 void decode_d_option (const char *);
122 static int decode_f_option (const char *);
123 static int decode_W_option (const char *);
124 static int decode_g_option (const char *);
125 static unsigned int independent_decode_option (int, char **);
126 static void set_Wextra (int);
128 static int print_single_switch (FILE *, int, int, const char *,
129 const char *, const char *,
130 const char *, const char *);
131 static void print_switch_values (FILE *, int, int, const char *,
132 const char *, const char *);
134 /* Rest of compilation helper functions. */
135 static bool rest_of_handle_inlining (tree);
136 static rtx rest_of_handle_ssa (tree, rtx);
137 static void rest_of_handle_cse (tree, rtx);
138 static void rest_of_handle_cse2 (tree, rtx);
139 static void rest_of_handle_gcse (tree, rtx);
140 static void rest_of_handle_life (tree, rtx);
141 static void rest_of_handle_loop_optimize (tree, rtx);
142 static void rest_of_handle_loop2 (tree, rtx);
143 static void rest_of_handle_jump_bypass (tree, rtx);
144 static void rest_of_handle_sibling_calls (rtx);
145 static void rest_of_handle_null_pointer (tree, rtx);
146 static void rest_of_handle_addresof (tree, rtx);
147 static void rest_of_handle_cfg (tree, rtx);
148 static void rest_of_handle_branch_prob (tree, rtx);
149 static void rest_of_handle_if_conversion (tree, rtx);
150 static void rest_of_handle_if_after_combine (tree, rtx);
151 static void rest_of_handle_tracer (tree, rtx);
152 static void rest_of_handle_combine (tree, rtx);
153 static void rest_of_handle_regmove (tree, rtx);
154 static void rest_of_handle_sched (tree, rtx);
155 #ifdef INSN_SCHEDULING
156 static void rest_of_handle_sched2 (tree, rtx);
158 static bool rest_of_handle_new_regalloc (tree, rtx, int *);
159 static bool rest_of_handle_old_regalloc (tree, rtx, int *);
160 static void rest_of_handle_regrename (tree, rtx);
161 static void rest_of_handle_reorder_blocks (tree, rtx);
163 static void rest_of_handle_stack_regs (tree, rtx);
165 static void rest_of_handle_machine_reorg (tree, rtx);
167 static void rest_of_handle_delay_slots (tree, rtx);
169 static void rest_of_handle_final (tree, rtx);
171 /* Nonzero to dump debug info whilst parsing (-dy option). */
172 static int set_yydebug;
174 /* True if we don't need a backend (e.g. preprocessing only). */
175 static bool no_backend;
177 /* Length of line when printing switch values. */
180 /* Name of program invoked, sans directories. */
182 const char *progname;
184 /* Copy of arguments to toplev_main. */
188 /* Name of top-level original source file (what was input to cpp).
189 This comes from the #-command at the beginning of the actual input.
190 If there isn't any there, then this is the cc1 input file name. */
192 const char *main_input_filename;
194 /* Current position in real source file. */
196 location_t input_location;
198 /* Nonzero if it is unsafe to create any new pseudo registers. */
201 /* Stack of currently pending input files. */
203 struct file_stack *input_file_stack;
205 /* Incremented on each change to input_file_stack. */
206 int input_file_stack_tick;
208 /* Name to use as base of names for dump output files. */
210 const char *dump_base_name;
212 /* Name to use as a base for auxiliary output files. */
214 const char *aux_base_name;
216 /* Format to use to print dumpfile index value */
217 #ifndef DUMPFILE_FORMAT
218 #define DUMPFILE_FORMAT ".%02d."
221 /* Bit flags that specify the machine subtype we are compiling for.
222 Bits are tested using macros TARGET_... defined in the tm.h file
223 and set by `-m...' switches. Must be defined in rtlanal.c. */
225 extern int target_flags;
227 /* A mask of target_flags that includes bit X if X was set or cleared
228 on the command line. */
230 int target_flags_explicit;
232 /* Debug hooks - dependent upon command line options. */
234 const struct gcc_debug_hooks *debug_hooks = &do_nothing_debug_hooks;
236 /* Describes a dump file. */
238 struct dump_file_info
240 /* The unique extension to apply, e.g. ".jump". */
241 const char *const extension;
243 /* The -d<c> character that enables this dump file. */
244 char const debug_switch;
246 /* True if there is a corresponding graph dump file. */
247 char const graph_dump_p;
249 /* True if the user selected this dump. */
252 /* True if the files have been initialized (ie truncated). */
256 /* Enumerate the extant dump files. */
300 /* Describes all the dump files. Should be kept in order of the
301 pass and in sync with dump_file_index above.
303 Remaining -d letters:
309 static struct dump_file_info dump_file[DFI_MAX] =
311 { "rtl", 'r', 0, 0, 0 },
312 { "sibling", 'i', 0, 0, 0 },
313 { "eh", 'h', 0, 0, 0 },
314 { "jump", 'j', 0, 0, 0 },
315 { "ssa", 'e', 1, 0, 0 },
316 { "ssaccp", 'W', 1, 0, 0 },
317 { "ssadce", 'X', 1, 0, 0 },
318 { "ussa", 'e', 1, 0, 0 }, /* Yes, duplicate enable switch. */
319 { "null", 'u', 0, 0, 0 },
320 { "cse", 's', 0, 0, 0 },
321 { "addressof", 'F', 0, 0, 0 },
322 { "gcse", 'G', 1, 0, 0 },
323 { "loop", 'L', 1, 0, 0 },
324 { "bypass", 'G', 1, 0, 0 }, /* Yes, duplicate enable switch. */
325 { "cfg", 'f', 1, 0, 0 },
326 { "bp", 'b', 1, 0, 0 },
327 { "ce1", 'C', 1, 0, 0 },
328 { "tracer", 'T', 1, 0, 0 },
329 { "loop2", 'L', 1, 0, 0 },
330 { "cse2", 't', 1, 0, 0 },
331 { "life", 'f', 1, 0, 0 }, /* Yes, duplicate enable switch. */
332 { "combine", 'c', 1, 0, 0 },
333 { "ce2", 'C', 1, 0, 0 },
334 { "regmove", 'N', 1, 0, 0 },
335 { "sched", 'S', 1, 0, 0 },
336 { "lreg", 'l', 1, 0, 0 },
337 { "greg", 'g', 1, 0, 0 },
338 { "postreload", 'o', 1, 0, 0 },
339 { "flow2", 'w', 1, 0, 0 },
340 { "peephole2", 'z', 1, 0, 0 },
341 { "rnreg", 'n', 1, 0, 0 },
342 { "bbro", 'B', 1, 0, 0 },
343 { "ce3", 'E', 1, 0, 0 },
344 { "sched2", 'R', 1, 0, 0 },
345 { "stack", 'k', 1, 0, 0 },
346 { "mach", 'M', 1, 0, 0 },
347 { "dbr", 'd', 0, 0, 0 },
350 static int open_dump_file (enum dump_file_index, tree);
351 static void close_dump_file (enum dump_file_index,
352 void (*) (FILE *, rtx), rtx);
354 /* Other flags saying which kinds of debugging dump have been requested. */
356 int rtl_dump_and_exit;
357 int flag_print_asm_name;
358 enum graph_dump_types graph_dump_format;
360 /* Name for output file of assembly code, specified with -o. */
362 const char *asm_file_name;
364 /* Type(s) of debugging information we are producing (if any).
365 See flags.h for the definitions of the different possible
366 types of debugging information. */
367 enum debug_info_type write_symbols = NO_DEBUG;
369 /* Level of debugging information we are producing. See flags.h
370 for the definitions of the different possible levels. */
371 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
373 /* Nonzero means use GNU-only extensions in the generated symbolic
374 debugging information. */
375 /* Currently, this only has an effect when write_symbols is set to
376 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
377 int use_gnu_debug_info_extensions = 0;
379 /* Nonzero means do optimizations. -O.
380 Particular numeric values stand for particular amounts of optimization;
381 thus, -O2 stores 2 here. However, the optimizations beyond the basic
382 ones are not controlled directly by this variable. Instead, they are
383 controlled by individual `flag_...' variables that are defaulted
384 based on this variable. */
388 /* Nonzero means optimize for size. -Os.
389 The only valid values are zero and nonzero. When optimize_size is
390 nonzero, optimize defaults to 2, but certain individual code
391 bloating optimizations are disabled. */
393 int optimize_size = 0;
395 /* The FUNCTION_DECL for the function currently being compiled,
396 or 0 if between functions. */
397 tree current_function_decl;
399 /* Set to the FUNC_BEGIN label of the current function, or NULL_TREE
401 tree current_function_func_begin_label;
403 /* Nonzero if doing dwarf2 duplicate elimination. */
405 int flag_eliminate_dwarf2_dups = 0;
407 /* Nonzero if doing unused type elimination. */
409 int flag_eliminate_unused_debug_types = 1;
411 /* Nonzero if generating code to do profiling. */
413 int profile_flag = 0;
415 /* Nonzero if generating code to profile program flow graph arcs. */
417 int profile_arc_flag = 0;
419 /* Nonzero if generating info for gcov to calculate line test coverage. */
421 int flag_test_coverage = 0;
423 /* Nonzero indicates that branch taken probabilities should be calculated. */
425 int flag_branch_probabilities = 0;
427 /* Nonzero if basic blocks should be reordered. */
429 int flag_reorder_blocks = 0;
431 /* Nonzero if functions should be reordered. */
433 int flag_reorder_functions = 0;
435 /* Nonzero if registers should be renamed. */
437 int flag_rename_registers = 0;
438 int flag_cprop_registers = 0;
440 /* Nonzero for -pedantic switch: warn about anything
441 that standard spec forbids. */
445 /* Temporarily suppress certain warnings.
446 This is set while reading code from a system header file. */
448 int in_system_header = 0;
450 /* Don't print functions as they are compiled. -quiet. */
454 /* Print times taken by the various passes. -ftime-report. */
456 static int time_report = 0;
458 /* Print memory still in use at end of compilation (which may have little
459 to do with peak memory consumption). -fmem-report. */
463 /* Nonzero means to collect statistics which might be expensive
464 and to print them when we are done. */
465 int flag_detailed_statistics = 0;
469 /* Nonzero means `char' should be signed. */
471 int flag_signed_char;
473 /* Nonzero means give an enum type only as many bytes as it needs. */
475 int flag_short_enums;
477 /* Nonzero for -fcaller-saves: allocate values in regs that need to
478 be saved across function calls, if that produces overall better code.
479 Optional now, so people can test it. */
481 #ifdef DEFAULT_CALLER_SAVES
482 int flag_caller_saves = 1;
484 int flag_caller_saves = 0;
487 /* Nonzero if structures and unions should be returned in memory.
489 This should only be defined if compatibility with another compiler or
490 with an ABI is needed, because it results in slower code. */
492 #ifndef DEFAULT_PCC_STRUCT_RETURN
493 #define DEFAULT_PCC_STRUCT_RETURN 1
496 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
498 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
500 /* Nonzero for -fforce-mem: load memory value into a register
501 before arithmetic on it. This makes better cse but slower compilation. */
503 int flag_force_mem = 0;
505 /* Nonzero for -fforce-addr: load memory address into a register before
506 reference to memory. This makes better cse but slower compilation. */
508 int flag_force_addr = 0;
510 /* Nonzero for -fdefer-pop: don't pop args after each function call;
511 instead save them up to pop many calls' args with one insns. */
513 int flag_defer_pop = 0;
515 /* Nonzero for -ffloat-store: don't allocate floats and doubles
516 in extended-precision registers. */
518 int flag_float_store = 0;
520 /* Nonzero for -fcse-follow-jumps:
521 have cse follow jumps to do a more extensive job. */
523 int flag_cse_follow_jumps;
525 /* Nonzero for -fcse-skip-blocks:
526 have cse follow a branch around a block. */
527 int flag_cse_skip_blocks;
529 /* Nonzero for -fexpensive-optimizations:
530 perform miscellaneous relatively-expensive optimizations. */
531 int flag_expensive_optimizations;
533 /* Nonzero for -fthread-jumps:
534 have jump optimize output of loop. */
536 int flag_thread_jumps;
538 /* Nonzero enables strength-reduction in loop.c. */
540 int flag_strength_reduce = 0;
542 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
543 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
544 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
547 int flag_old_unroll_loops;
549 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
550 This is generally not a win. */
552 int flag_old_unroll_all_loops;
554 /* Enables unrolling of simple loops in loop-unroll.c. */
555 int flag_unroll_loops;
557 /* Enables unrolling of all loops in loop-unroll.c. */
558 int flag_unroll_all_loops;
560 /* Nonzero enables loop peeling. */
563 /* Nonzero enables loop unswitching. */
564 int flag_unswitch_loops;
566 /* Nonzero enables prefetch optimizations for arrays in loops. */
568 int flag_prefetch_loop_arrays;
570 /* Nonzero forces all invariant computations in loops to be moved
573 int flag_move_all_movables = 0;
575 /* Nonzero forces all general induction variables in loops to be
578 int flag_reduce_all_givs = 0;
580 /* Nonzero to perform full register move optimization passes. This is the
583 int flag_regmove = 0;
585 /* Nonzero for -fwritable-strings:
586 store string constants in data segment and don't uniquize them. */
588 int flag_writable_strings = 0;
590 /* Nonzero means don't put addresses of constant functions in registers.
591 Used for compiling the Unix kernel, where strange substitutions are
592 done on the assembly output. */
594 int flag_no_function_cse = 0;
596 /* Nonzero for -fomit-frame-pointer:
597 don't make a frame pointer in simple functions that don't require one. */
599 int flag_omit_frame_pointer = 0;
601 /* Nonzero means place each function into its own section on those platforms
602 which support arbitrary section names and unlimited numbers of sections. */
604 int flag_function_sections = 0;
606 /* ... and similar for data. */
608 int flag_data_sections = 0;
610 /* Nonzero to inhibit use of define_optimization peephole opts. */
612 int flag_no_peephole = 0;
614 /* Nonzero allows GCC to optimize sibling and tail recursive calls. */
616 int flag_optimize_sibling_calls = 0;
618 /* Nonzero means the front end generally wants `errno' maintained by math
619 operations, like built-in SQRT. */
621 int flag_errno_math = 1;
623 /* Nonzero means that unsafe floating-point math optimizations are allowed
624 for the sake of speed. IEEE compliance is not guaranteed, and operations
625 are allowed to assume that their arguments and results are "normal"
626 (e.g., nonnegative for SQRT). */
628 int flag_unsafe_math_optimizations = 0;
630 /* Nonzero means that no NaNs or +-Infs are expected. */
632 int flag_finite_math_only = 0;
634 /* Zero means that floating-point math operations cannot generate a
635 (user-visible) trap. This is the case, for example, in nonstop
636 IEEE 754 arithmetic. Trapping conditions include division by zero,
637 overflow, underflow, invalid and inexact, but does not include
638 operations on signaling NaNs (see below). */
640 int flag_trapping_math = 1;
642 /* Nonzero means disable transformations observable by signaling NaNs.
643 This option implies that any operation on a IEEE signaling NaN can
644 generate a (user-visible) trap. */
646 int flag_signaling_nans = 0;
648 /* 0 means straightforward implementation of complex divide acceptable.
649 1 means wide ranges of inputs must work for complex divide.
650 2 means C99-like requirements for complex divide (not yet implemented). */
652 int flag_complex_divide_method = 0;
654 /* Nonzero means just do syntax checking; don't output anything. */
656 int flag_syntax_only = 0;
658 /* Nonzero means perform loop optimizer. */
660 static int flag_loop_optimize;
662 /* Nonzero means perform crossjumping. */
664 static int flag_crossjumping;
666 /* Nonzero means perform if conversion. */
668 static int flag_if_conversion;
670 /* Nonzero means perform if conversion after reload. */
672 static int flag_if_conversion2;
674 /* Nonzero means to use global dataflow analysis to eliminate
675 useless null pointer tests. */
677 static int flag_delete_null_pointer_checks;
679 /* Nonzero means perform global CSE. */
683 /* Nonzero means to do the enhanced load motion during gcse, which trys
684 to hoist loads by not killing them when a store to the same location
687 int flag_gcse_lm = 1;
689 /* Nonzero means to perform store motion after gcse, which will try to
690 move stores closer to the exit block. Its not very effective without
693 int flag_gcse_sm = 1;
695 /* Nonzero means to rerun cse after loop optimization. This increases
696 compilation time about 20% and picks up a few more common expressions. */
698 static int flag_rerun_cse_after_loop;
700 /* Nonzero means to run loop optimizations twice. */
702 int flag_rerun_loop_opt;
704 /* Nonzero for -finline-functions: ok to inline functions that look like
705 good inline candidates. */
707 int flag_inline_functions;
709 /* Nonzero for -fkeep-inline-functions: even if we make a function
710 go inline everywhere, keep its definition around for debugging
713 int flag_keep_inline_functions;
715 /* Nonzero means that functions will not be inlined. */
717 int flag_no_inline = 2;
719 /* Nonzero means that we don't want inlining by virtue of -fno-inline,
720 not just because the tree inliner turned us off. */
722 int flag_really_no_inline = 2;
724 /* Nonzero means that we should emit static const variables
725 regardless of whether or not optimization is turned on. */
727 int flag_keep_static_consts = 1;
729 /* Nonzero means we should be saving declaration info into a .X file. */
731 int flag_gen_aux_info = 0;
733 /* Specified name of aux-info file. */
735 const char *aux_info_file_name;
737 /* Nonzero means make the text shared if supported. */
739 int flag_shared_data;
741 /* Nonzero means schedule into delayed branch slots if supported. */
743 int flag_delayed_branch;
745 /* Nonzero if we are compiling pure (sharable) code.
746 Value is 1 if we are doing "small" pic; value is 2 if we're doing
751 /* Nonzero if we are compiling position independent code for executable.
752 The value is 1 if we are doing "small" pic; value is 2 if we're doing
757 /* Nonzero if we are compiling code for a shared library, zero for
762 /* Set to the default thread-local storage (tls) model to use. */
764 enum tls_model flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
766 /* Nonzero means generate extra code for exception handling and enable
767 exception handling. */
771 /* Nonzero means generate frame unwind info table when supported. */
773 int flag_unwind_tables = 0;
775 /* Nonzero means generate frame unwind info table exact at each insn boundary */
777 int flag_asynchronous_unwind_tables = 0;
779 /* Nonzero means don't place uninitialized global data in common storage
784 /* Nonzero means change certain warnings into errors.
785 Usually these are warnings about failure to conform to some standard. */
787 int flag_pedantic_errors = 0;
789 /* flag_schedule_insns means schedule insns within basic blocks (before
791 flag_schedule_insns_after_reload means schedule insns after
794 int flag_schedule_insns = 0;
795 int flag_schedule_insns_after_reload = 0;
797 /* When flag_schedule_insns_after_reload is set, use EBB scheduler. */
798 int flag_sched2_use_superblocks = 0;
800 /* When flag_schedule_insns_after_reload is set, construct traces and EBB
802 int flag_sched2_use_traces = 0;
804 /* The following flags have effect only for scheduling before register
807 flag_schedule_interblock means schedule insns across basic blocks.
808 flag_schedule_speculative means allow speculative motion of non-load insns.
809 flag_schedule_speculative_load means allow speculative motion of some
811 flag_schedule_speculative_load_dangerous allows speculative motion of more
814 int flag_schedule_interblock = 1;
815 int flag_schedule_speculative = 1;
816 int flag_schedule_speculative_load = 0;
817 int flag_schedule_speculative_load_dangerous = 0;
819 int flag_single_precision_constant;
821 /* flag_branch_on_count_reg means try to replace add-1,compare,branch tupple
822 by a cheaper branch on a count register. */
823 int flag_branch_on_count_reg = 1;
825 /* -finhibit-size-directive inhibits output of .size for ELF.
826 This is used only for compiling crtstuff.c,
827 and it may be extended to other effects
828 needed for crtstuff.c on other systems. */
829 int flag_inhibit_size_directive = 0;
831 /* -fverbose-asm causes extra commentary information to be produced in
832 the generated assembly code (to make it more readable). This option
833 is generally only of use to those who actually need to read the
834 generated assembly code (perhaps while debugging the compiler itself).
835 -fno-verbose-asm, the default, causes the extra information
836 to be omitted and is useful when comparing two assembler files. */
838 int flag_verbose_asm = 0;
840 /* -dA causes debug commentary information to be produced in
841 the generated assembly code (to make it more readable). This option
842 is generally only of use to those who actually need to read the
843 generated assembly code (perhaps while debugging the compiler itself).
844 Currently, this switch is only used by dwarfout.c; however, it is intended
845 to be a catchall for printing debug information in the assembler file. */
847 int flag_debug_asm = 0;
849 /* -dP causes the rtl to be emitted as a comment in assembly. */
851 int flag_dump_rtl_in_asm = 0;
853 /* -fgnu-linker specifies use of the GNU linker for initializations.
854 (Or, more generally, a linker that handles initializations.)
855 -fno-gnu-linker says that collect2 will be used. */
857 int flag_gnu_linker = 0;
859 int flag_gnu_linker = 1;
862 /* Nonzero means put zero initialized data in the bss section. */
863 int flag_zero_initialized_in_bss = 1;
868 /* Enable ssa conditional constant propagation. */
869 int flag_ssa_ccp = 0;
871 /* Enable ssa aggressive dead code elimination. */
872 int flag_ssa_dce = 0;
874 /* Tag all structures with __attribute__(packed). */
875 int flag_pack_struct = 0;
877 /* Emit code to check for stack overflow; also may cause large objects
878 to be allocated dynamically. */
879 int flag_stack_check;
881 /* When non-NULL, indicates that whenever space is allocated on the
882 stack, the resulting stack pointer must not pass this
883 address---that is, for stacks that grow downward, the stack pointer
884 must always be greater than or equal to this address; for stacks
885 that grow upward, the stack pointer must be less than this address.
886 At present, the rtx may be either a REG or a SYMBOL_REF, although
887 the support provided depends on the backend. */
890 /* 0 if pointer arguments may alias each other. True in C.
891 1 if pointer arguments may not alias each other but may alias
893 2 if pointer arguments may not alias each other and may not
894 alias global variables. True in Fortran.
895 This defaults to 0 for C. */
896 int flag_argument_noalias = 0;
898 /* Nonzero if we should do (language-dependent) alias analysis.
899 Typically, this analysis will assume that expressions of certain
900 types do not alias expressions of certain other types. Only used
901 if alias analysis (in general) is enabled. */
902 int flag_strict_aliasing = 0;
904 /* Instrument functions with calls at entry and exit, for profiling. */
905 int flag_instrument_function_entry_exit = 0;
907 /* Nonzero means ignore `#ident' directives. 0 means handle them.
908 On SVR4 targets, it also controls whether or not to emit a
909 string identifying the compiler. */
911 int flag_no_ident = 0;
913 /* This will perform a peephole pass before sched2. */
914 int flag_peephole2 = 0;
916 /* This will try to guess branch probabilities. */
917 int flag_guess_branch_prob = 0;
919 /* -fcheck-bounds causes gcc to generate array bounds checks.
920 For C, C++, ObjC: defaults to off.
921 For Java: defaults to on.
922 For Fortran: defaults to off. */
923 int flag_bounds_check = 0;
925 /* This will attempt to merge constant section constants, if 1 only
926 string constants and constants from constant pool, if 2 also constant
928 int flag_merge_constants = 1;
930 /* If one, renumber instruction UIDs to reduce the number of
931 unused UIDs if there are a lot of instructions. If greater than
932 one, unconditionally renumber instruction UIDs. */
933 int flag_renumber_insns = 1;
935 /* If nonzero, use the graph coloring register allocator. */
936 int flag_new_regalloc = 0;
938 /* Nonzero if we perform superblock formation. */
942 /* Nonzero if we perform whole unit at a time compilation. */
944 int flag_unit_at_a_time = 0;
946 /* Values of the -falign-* flags: how much to align labels in code.
947 0 means `use default', 1 means `don't align'.
948 For each variable, there is an _log variant which is the power
949 of two not less than the variable, for .align output. */
953 int align_loops_max_skip;
956 int align_jumps_max_skip;
958 int align_labels_log;
959 int align_labels_max_skip;
961 int align_functions_log;
963 /* Like align_functions_log above, but used by front-ends to force the
964 minimum function alignment. Zero means no alignment is forced. */
965 int force_align_functions_log;
967 /* Table of supported debugging formats. */
970 const char *const arg;
971 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
972 constant expression, we use NO_DEBUG in its place. */
973 const enum debug_info_type debug_type;
974 const int use_extensions_p;
975 const char *const description;
979 { "", NO_DEBUG, DEFAULT_GDB_EXTENSIONS,
980 N_("Generate debugging info in default format") },
981 { "gdb", NO_DEBUG, 1, N_("Generate debugging info in default extended format") },
982 #ifdef DBX_DEBUGGING_INFO
983 { "stabs", DBX_DEBUG, 0, N_("Generate STABS format debug info") },
984 { "stabs+", DBX_DEBUG, 1, N_("Generate extended STABS format debug info") },
986 #ifdef DWARF_DEBUGGING_INFO
987 { "dwarf", DWARF_DEBUG, 0, N_("Generate DWARF-1 format debug info") },
988 { "dwarf+", DWARF_DEBUG, 1,
989 N_("Generate extended DWARF-1 format debug info") },
991 #ifdef DWARF2_DEBUGGING_INFO
992 { "dwarf-2", DWARF2_DEBUG, 0, N_("Generate DWARF-2 debug info") },
994 #ifdef XCOFF_DEBUGGING_INFO
995 { "xcoff", XCOFF_DEBUG, 0, N_("Generate XCOFF format debug info") },
996 { "xcoff+", XCOFF_DEBUG, 1, N_("Generate extended XCOFF format debug info") },
998 #ifdef SDB_DEBUGGING_INFO
999 { "coff", SDB_DEBUG, 0, N_("Generate COFF format debug info") },
1001 #ifdef VMS_DEBUGGING_INFO
1002 { "vms", VMS_DEBUG, 0, N_("Generate VMS format debug info") },
1009 const char *const string;
1010 int *const variable;
1012 const char *const description;
1014 lang_independent_options;
1016 /* Nonzero if signed arithmetic overflow should trap. */
1019 /* Nonzero if signed arithmetic overflow should wrap around. */
1022 /* Add or remove a leading underscore from user symbols. */
1023 int flag_leading_underscore = -1;
1025 /* The user symbol prefix after having resolved same. */
1026 const char *user_label_prefix;
1028 static const param_info lang_independent_params[] = {
1029 #define DEFPARAM(ENUM, OPTION, HELP, DEFAULT) \
1030 { OPTION, DEFAULT, HELP },
1031 #include "params.def"
1036 /* Table of language-independent -f options.
1037 STRING is the option name. VARIABLE is the address of the variable.
1038 ON_VALUE is the value to store in VARIABLE
1039 if `-fSTRING' is seen as an option.
1040 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
1042 static const lang_independent_options f_options[] =
1044 {"eliminate-dwarf2-dups", &flag_eliminate_dwarf2_dups, 1,
1045 N_("Perform DWARF2 duplicate elimination") },
1046 {"eliminate-unused-debug-types", &flag_eliminate_unused_debug_types, 1,
1047 N_("Perform unused type elimination in debug info") },
1048 {"float-store", &flag_float_store, 1,
1049 N_("Do not store floats in registers") },
1050 {"defer-pop", &flag_defer_pop, 1,
1051 N_("Defer popping functions args from stack until later") },
1052 {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
1053 N_("When possible do not generate stack frames") },
1054 {"optimize-sibling-calls", &flag_optimize_sibling_calls, 1,
1055 N_("Optimize sibling and tail recursive calls") },
1056 {"tracer", &flag_tracer, 1,
1057 N_("Perform superblock formation via tail duplication") },
1058 {"unit-at-a-time", &flag_unit_at_a_time, 1,
1059 N_("Compile whole compilation unit at a time") },
1060 {"cse-follow-jumps", &flag_cse_follow_jumps, 1,
1061 N_("When running CSE, follow jumps to their targets") },
1062 {"cse-skip-blocks", &flag_cse_skip_blocks, 1,
1063 N_("When running CSE, follow conditional jumps") },
1064 {"expensive-optimizations", &flag_expensive_optimizations, 1,
1065 N_("Perform a number of minor, expensive optimizations") },
1066 {"thread-jumps", &flag_thread_jumps, 1,
1067 N_("Perform jump threading optimizations") },
1068 {"strength-reduce", &flag_strength_reduce, 1,
1069 N_("Perform strength reduction optimizations") },
1070 {"unroll-loops", &flag_unroll_loops, 1,
1071 N_("Perform loop unrolling when iteration count is known") },
1072 {"unroll-all-loops", &flag_unroll_all_loops, 1,
1073 N_("Perform loop unrolling for all loops") },
1074 {"old-unroll-loops", &flag_old_unroll_loops, 1,
1075 N_("Perform loop unrolling when iteration count is known") },
1076 {"old-unroll-all-loops", &flag_old_unroll_all_loops, 1,
1077 N_("Perform loop unrolling for all loops") },
1078 {"peel-loops", &flag_peel_loops, 1,
1079 N_("Perform loop peeling") },
1080 {"unswitch-loops", &flag_unswitch_loops, 1,
1081 N_("Perform loop unswitching") },
1082 {"prefetch-loop-arrays", &flag_prefetch_loop_arrays, 1,
1083 N_("Generate prefetch instructions, if available, for arrays in loops") },
1084 {"move-all-movables", &flag_move_all_movables, 1,
1085 N_("Force all loop invariant computations out of loops") },
1086 {"reduce-all-givs", &flag_reduce_all_givs, 1,
1087 N_("Strength reduce all loop general induction variables") },
1088 {"writable-strings", &flag_writable_strings, 1,
1089 N_("Store strings in writable data section") },
1090 {"peephole", &flag_no_peephole, 0,
1091 N_("Enable machine specific peephole optimizations") },
1092 {"force-mem", &flag_force_mem, 1,
1093 N_("Copy memory operands into registers before using") },
1094 {"force-addr", &flag_force_addr, 1,
1095 N_("Copy memory address constants into regs before using") },
1096 {"function-cse", &flag_no_function_cse, 0,
1097 N_("Allow function addresses to be held in registers") },
1098 {"inline-functions", &flag_inline_functions, 1,
1099 N_("Integrate simple functions into their callers") },
1100 {"keep-inline-functions", &flag_keep_inline_functions, 1,
1101 N_("Generate code for funcs even if they are fully inlined") },
1102 {"inline", &flag_no_inline, 0,
1103 N_("Pay attention to the 'inline' keyword") },
1104 {"keep-static-consts", &flag_keep_static_consts, 1,
1105 N_("Emit static const variables even if they are not used") },
1106 {"syntax-only", &flag_syntax_only, 1,
1107 N_("Check for syntax errors, then stop") },
1108 {"shared-data", &flag_shared_data, 1,
1109 N_("Mark data as shared rather than private") },
1110 {"caller-saves", &flag_caller_saves, 1,
1111 N_("Enable saving registers around function calls") },
1112 {"pcc-struct-return", &flag_pcc_struct_return, 1,
1113 N_("Return 'short' aggregates in memory, not registers") },
1114 {"reg-struct-return", &flag_pcc_struct_return, 0,
1115 N_("Return 'short' aggregates in registers") },
1116 {"delayed-branch", &flag_delayed_branch, 1,
1117 N_("Attempt to fill delay slots of branch instructions") },
1118 {"gcse", &flag_gcse, 1,
1119 N_("Perform the global common subexpression elimination") },
1120 {"gcse-lm", &flag_gcse_lm, 1,
1121 N_("Perform enhanced load motion during global subexpression elimination") },
1122 {"gcse-sm", &flag_gcse_sm, 1,
1123 N_("Perform store motion after global subexpression elimination") },
1124 {"loop-optimize", &flag_loop_optimize, 1,
1125 N_("Perform the loop optimizations") },
1126 {"crossjumping", &flag_crossjumping, 1,
1127 N_("Perform cross-jumping optimization") },
1128 {"if-conversion", &flag_if_conversion, 1,
1129 N_("Perform conversion of conditional jumps to branchless equivalents") },
1130 {"if-conversion2", &flag_if_conversion2, 1,
1131 N_("Perform conversion of conditional jumps to conditional execution") },
1132 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
1133 N_("Run CSE pass after loop optimizations") },
1134 {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
1135 N_("Run the loop optimizer twice") },
1136 {"delete-null-pointer-checks", &flag_delete_null_pointer_checks, 1,
1137 N_("Delete useless null pointer checks") },
1138 {"schedule-insns", &flag_schedule_insns, 1,
1139 N_("Reschedule instructions before register allocation") },
1140 {"schedule-insns2", &flag_schedule_insns_after_reload, 1,
1141 N_("Reschedule instructions after register allocation") },
1142 {"sched-interblock",&flag_schedule_interblock, 1,
1143 N_("Enable scheduling across basic blocks") },
1144 {"sched-spec",&flag_schedule_speculative, 1,
1145 N_("Allow speculative motion of non-loads") },
1146 {"sched-spec-load",&flag_schedule_speculative_load, 1,
1147 N_("Allow speculative motion of some loads") },
1148 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
1149 N_("Allow speculative motion of more loads") },
1150 {"sched2-use-superblocks", &flag_sched2_use_superblocks, 1,
1151 N_("If scheduling post reload, do superblock scheduling") },
1152 {"sched2-use-traces", &flag_sched2_use_traces, 1,
1153 N_("If scheduling post reload, do trace scheduling") },
1154 {"branch-count-reg",&flag_branch_on_count_reg, 1,
1155 N_("Replace add,compare,branch with branch on count reg") },
1156 {"pic", &flag_pic, 1,
1157 N_("Generate position independent code, if possible") },
1158 {"PIC", &flag_pic, 2, ""},
1159 {"pie", &flag_pie, 1,
1160 N_("Generate position independent code for executables, if possible") },
1161 {"PIE", &flag_pie, 2, ""},
1162 {"exceptions", &flag_exceptions, 1,
1163 N_("Enable exception handling") },
1164 {"unwind-tables", &flag_unwind_tables, 1,
1165 N_("Just generate unwind tables for exception handling") },
1166 {"asynchronous-unwind-tables", &flag_asynchronous_unwind_tables, 1,
1167 N_("Generate unwind tables exact at each instruction boundary") },
1168 {"non-call-exceptions", &flag_non_call_exceptions, 1,
1169 N_("Support synchronous non-call exceptions") },
1170 {"profile-arcs", &profile_arc_flag, 1,
1171 N_("Insert arc based program profiling code") },
1172 {"test-coverage", &flag_test_coverage, 1,
1173 N_("Create data files needed by gcov") },
1174 {"branch-probabilities", &flag_branch_probabilities, 1,
1175 N_("Use profiling information for branch probabilities") },
1176 {"profile", &profile_flag, 1,
1177 N_("Enable basic program profiling code") },
1178 {"reorder-blocks", &flag_reorder_blocks, 1,
1179 N_("Reorder basic blocks to improve code placement") },
1180 {"reorder-functions", &flag_reorder_functions, 1,
1181 N_("Reorder functions to improve code placement") },
1182 {"rename-registers", &flag_rename_registers, 1,
1183 N_("Do the register renaming optimization pass") },
1184 {"cprop-registers", &flag_cprop_registers, 1,
1185 N_("Do the register copy-propagation optimization pass") },
1186 {"common", &flag_no_common, 0,
1187 N_("Do not put uninitialized globals in the common section") },
1188 {"inhibit-size-directive", &flag_inhibit_size_directive, 1,
1189 N_("Do not generate .size directives") },
1190 {"function-sections", &flag_function_sections, 1,
1191 N_("place each function into its own section") },
1192 {"data-sections", &flag_data_sections, 1,
1193 N_("place data items into their own section") },
1194 {"verbose-asm", &flag_verbose_asm, 1,
1195 N_("Add extra commentary to assembler output") },
1196 {"gnu-linker", &flag_gnu_linker, 1,
1197 N_("Output GNU ld formatted global initializers") },
1198 {"regmove", &flag_regmove, 1,
1199 N_("Enables a register move optimization") },
1200 {"optimize-register-move", &flag_regmove, 1,
1201 N_("Do the full regmove optimization pass") },
1202 {"pack-struct", &flag_pack_struct, 1,
1203 N_("Pack structure members together without holes") },
1204 {"stack-check", &flag_stack_check, 1,
1205 N_("Insert stack checking code into the program") },
1206 {"argument-alias", &flag_argument_noalias, 0,
1207 N_("Specify that arguments may alias each other & globals") },
1208 {"argument-noalias", &flag_argument_noalias, 1,
1209 N_("Assume arguments may alias globals but not each other") },
1210 {"argument-noalias-global", &flag_argument_noalias, 2,
1211 N_("Assume arguments do not alias each other or globals") },
1212 {"strict-aliasing", &flag_strict_aliasing, 1,
1213 N_("Assume strict aliasing rules apply") },
1214 {"align-loops", &align_loops, 0,
1215 N_("Align the start of loops") },
1216 {"align-jumps", &align_jumps, 0,
1217 N_("Align labels which are only reached by jumping") },
1218 {"align-labels", &align_labels, 0,
1219 N_("Align all labels") },
1220 {"align-functions", &align_functions, 0,
1221 N_("Align the start of functions") },
1222 {"merge-constants", &flag_merge_constants, 1,
1223 N_("Attempt to merge identical constants across compilation units") },
1224 {"merge-all-constants", &flag_merge_constants, 2,
1225 N_("Attempt to merge identical constants and constant variables") },
1226 {"dump-unnumbered", &flag_dump_unnumbered, 1,
1227 N_("Suppress output of instruction numbers and line number notes in debugging dumps") },
1228 {"instrument-functions", &flag_instrument_function_entry_exit, 1,
1229 N_("Instrument function entry/exit with profiling calls") },
1230 {"zero-initialized-in-bss", &flag_zero_initialized_in_bss, 1,
1231 N_("Put zero initialized data in the bss section") },
1232 {"ssa", &flag_ssa, 1,
1233 N_("Enable SSA optimizations") },
1234 {"ssa-ccp", &flag_ssa_ccp, 1,
1235 N_("Enable SSA conditional constant propagation") },
1236 {"ssa-dce", &flag_ssa_dce, 1,
1237 N_("Enable aggressive SSA dead code elimination") },
1238 {"leading-underscore", &flag_leading_underscore, 1,
1239 N_("External symbols have a leading underscore") },
1240 {"ident", &flag_no_ident, 0,
1241 N_("Process #ident directives") },
1242 { "peephole2", &flag_peephole2, 1,
1243 N_("Enables an rtl peephole pass run before sched2") },
1244 {"finite-math-only", &flag_finite_math_only, 1,
1245 N_("Assume no NaNs or +-Infs are generated") },
1246 { "guess-branch-probability", &flag_guess_branch_prob, 1,
1247 N_("Enables guessing of branch probabilities") },
1248 {"math-errno", &flag_errno_math, 1,
1249 N_("Set errno after built-in math functions") },
1250 {"trapping-math", &flag_trapping_math, 1,
1251 N_("Floating-point operations can trap") },
1252 {"unsafe-math-optimizations", &flag_unsafe_math_optimizations, 1,
1253 N_("Allow math optimizations that may violate IEEE or ANSI standards") },
1254 {"signaling-nans", &flag_signaling_nans, 1,
1255 N_("Disable optimizations observable by IEEE signaling NaNs") },
1256 {"bounds-check", &flag_bounds_check, 1,
1257 N_("Generate code to check bounds before indexing arrays") },
1258 {"single-precision-constant", &flag_single_precision_constant, 1,
1259 N_("Convert floating point constant to single precision constant") },
1260 {"time-report", &time_report, 1,
1261 N_("Report time taken by each compiler pass at end of run") },
1262 {"mem-report", &mem_report, 1,
1263 N_("Report on permanent memory allocation at end of run") },
1264 { "trapv", &flag_trapv, 1,
1265 N_("Trap for signed overflow in addition / subtraction / multiplication") },
1266 { "wrapv", &flag_wrapv, 1,
1267 N_("Assume signed arithmetic overflow wraps around") },
1268 { "new-ra", &flag_new_regalloc, 1,
1269 N_("Use graph coloring register allocation.") },
1272 /* Table of language-specific options. */
1274 static const struct lang_opt
1276 const char *const option;
1277 const char *const description;
1279 documented_lang_options[] =
1281 /* In order not to overload the --help output, the convention
1282 used here is to only describe those options which are not
1283 enabled by default. */
1286 N_("Compile just for ISO C90") },
1288 N_("Determine language standard") },
1290 { "-fsigned-bitfields", "" },
1291 { "-funsigned-bitfields",
1292 N_("Make bit-fields by unsigned by default") },
1293 { "-fno-signed-bitfields", "" },
1294 { "-fno-unsigned-bitfields","" },
1296 N_("Make 'char' be signed by default") },
1297 { "-funsigned-char",
1298 N_("Make 'char' be unsigned by default") },
1299 { "-fno-signed-char", "" },
1300 { "-fno-unsigned-char", "" },
1304 N_("Do not recognize the 'asm' keyword") },
1305 { "-fbuiltin", "" },
1307 N_("Do not recognize any built in functions") },
1309 N_("Assume normal C execution environment") },
1310 { "-fno-hosted", "" },
1312 N_("Assume that standard libraries & main might not exist") },
1313 { "-fno-freestanding", "" },
1314 { "-fcond-mismatch",
1315 N_("Allow different types as args of ? operator") },
1316 { "-fno-cond-mismatch", "" },
1317 { "-fdollars-in-identifiers",
1318 N_("Allow the use of $ inside identifiers") },
1319 { "-fno-dollars-in-identifiers", "" },
1320 { "-fpreprocessed", "" },
1321 { "-fno-preprocessed", "" },
1323 N_("Use the same size for double as for float") },
1324 { "-fno-short-double", "" },
1326 N_("Use the smallest fitting integer to hold enums") },
1327 { "-fno-short-enums", "" },
1329 N_("Override the underlying type for wchar_t to `unsigned short'") },
1330 { "-fno-short-wchar", "" },
1333 N_("Enable most warning messages") },
1334 { "-Wbad-function-cast",
1335 N_("Warn about casting functions to incompatible types") },
1336 { "-Wno-bad-function-cast", "" },
1337 { "-Wmissing-format-attribute",
1338 N_("Warn about functions which might be candidates for format attributes") },
1339 { "-Wno-missing-format-attribute", "" },
1341 N_("Warn about casts which discard qualifiers") },
1342 { "-Wno-cast-qual", "" },
1343 { "-Wchar-subscripts",
1344 N_("Warn about subscripts whose type is 'char'") },
1345 { "-Wno-char-subscripts", "" },
1347 N_("Warn if nested comments are detected") },
1348 { "-Wno-comment", "" },
1350 N_("Warn if nested comments are detected") },
1351 { "-Wno-comments", "" },
1353 N_("Warn about possibly confusing type conversions") },
1354 { "-Wno-conversion", "" },
1355 { "-Wdiv-by-zero", "" },
1356 { "-Wno-div-by-zero",
1357 N_("Do not warn about compile-time integer division by zero") },
1359 N_("Warn about testing equality of floating point numbers") },
1360 { "-Wno-float-equal", "" },
1362 N_("Warn about printf/scanf/strftime/strfmon format anomalies") },
1363 { "-Wno-format", "" },
1364 { "-Wformat-extra-args", "" },
1365 { "-Wno-format-extra-args",
1366 N_("Don't warn about too many arguments to format functions") },
1367 { "-Wformat-nonliteral",
1368 N_("Warn about non-string-literal format strings") },
1369 { "-Wno-format-nonliteral", "" },
1370 { "-Wformat-security",
1371 N_("Warn about possible security problems with format functions") },
1372 { "-Wno-format-security", "" },
1373 { "-Wformat-y2k", "" },
1374 { "-Wno-format-y2k",
1375 N_("Don't warn about strftime formats yielding 2 digit years") },
1376 { "-Wimplicit-function-declaration",
1377 N_("Warn about implicit function declarations") },
1378 { "-Wno-implicit-function-declaration", "" },
1379 { "-Werror-implicit-function-declaration", "" },
1381 N_("Warn when a declaration does not specify a type") },
1382 { "-Wno-implicit-int", "" },
1383 { "-Wimplicit", "" },
1384 { "-Wno-implicit", "" },
1386 N_("Warn about the use of the #import directive") },
1387 { "-Wno-import", "" },
1389 N_("Warn about PCH files that are found but not used") },
1390 { "-Wlong-long","" },
1392 N_("Do not warn about using 'long long' when -pedantic") },
1394 N_("Warn about suspicious declarations of main") },
1395 { "-Wno-main", "" },
1396 { "-Wmissing-braces",
1397 N_("Warn about possibly missing braces around initializers") },
1398 { "-Wno-missing-braces", "" },
1399 { "-Wmissing-declarations",
1400 N_("Warn about global funcs without previous declarations") },
1401 { "-Wno-missing-declarations", "" },
1402 { "-Wmissing-prototypes",
1403 N_("Warn about global funcs without prototypes") },
1404 { "-Wno-missing-prototypes", "" },
1406 N_("Warn about use of multicharacter literals") },
1407 { "-Wno-multichar", "" },
1408 { "-Wnested-externs",
1409 N_("Warn about externs not at file scope level") },
1410 { "-Wno-nested-externs", "" },
1412 N_("Warn about possible missing parentheses") },
1413 { "-Wno-parentheses", "" },
1414 { "-Wpointer-arith",
1415 N_("Warn about function pointer arithmetic") },
1416 { "-Wno-pointer-arith", "" },
1417 { "-Wredundant-decls",
1418 N_("Warn about multiple declarations of the same object") },
1419 { "-Wno-redundant-decls", "" },
1421 N_("Warn whenever a function's return-type defaults to int") },
1422 { "-Wno-return-type", "" },
1423 { "-Wsequence-point",
1424 N_("Warn about possible violations of sequence point rules") },
1425 { "-Wno-sequence-point", "" },
1427 N_("Warn about signed/unsigned comparisons") },
1428 { "-Wno-sign-compare", "" },
1429 { "-Wstrict-prototypes",
1430 N_("Warn about non-prototyped function decls") },
1431 { "-Wno-strict-prototypes", "" },
1433 N_("Warn about constructs whose meanings change in ISO C") },
1434 { "-Wno-traditional", "" },
1436 N_("Warn when trigraphs are encountered") },
1437 { "-Wno-trigraphs", "" },
1439 { "-Wno-undef", "" },
1440 { "-Wunknown-pragmas",
1441 N_("Warn about unrecognized pragmas") },
1442 { "-Wno-unknown-pragmas", "" },
1443 { "-Wwrite-strings",
1444 N_("Mark strings as 'const char *'") },
1445 { "-Wno-write-strings", "" },
1447 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1449 #include "options_.h"
1453 /* Here is a table, controlled by the tm.h file, listing each -m switch
1454 and which bits in `target_switches' it should set or clear.
1455 If VALUE is positive, it is bits to set.
1456 If VALUE is negative, -VALUE is bits to clear.
1457 (The sign bit is not used so there is no confusion.) */
1461 const char *const name;
1463 const char *const description;
1465 target_switches[] = TARGET_SWITCHES;
1467 /* This table is similar, but allows the switch to have a value. */
1469 #ifdef TARGET_OPTIONS
1472 const char *const prefix;
1473 const char **const variable;
1474 const char *const description;
1475 const char *const value;
1477 target_options[] = TARGET_OPTIONS;
1480 /* Options controlling warnings. */
1482 /* Don't print warning messages. -w. */
1484 int inhibit_warnings = 0;
1486 /* Don't suppress warnings from system headers. -Wsystem-headers. */
1488 int warn_system_headers = 0;
1490 /* Print various extra warnings. -W/-Wextra. */
1492 int extra_warnings = 0;
1494 /* Treat warnings as errors. -Werror. */
1496 int warnings_are_errors = 0;
1498 /* Nonzero to warn about unused variables, functions et.al. */
1500 int warn_unused_function;
1501 int warn_unused_label;
1502 int warn_unused_parameter;
1503 int warn_unused_variable;
1504 int warn_unused_value;
1506 /* Used for cooperation between set_Wunused and set_Wextra. */
1507 static int maybe_warn_unused_parameter;
1509 /* Nonzero to warn about code which is never reached. */
1511 int warn_notreached;
1513 /* Nonzero to warn about variables used before they are initialized. */
1515 int warn_uninitialized;
1517 /* Nonzero means warn about all declarations which shadow others. */
1521 /* Warn if a switch on an enum, that does not have a default case,
1522 fails to have a case for every enum value. */
1526 /* Warn if a switch does not have a default case. */
1528 int warn_switch_default;
1530 /* Warn if a switch on an enum fails to have a case for every enum
1531 value (regardless of the presence or otherwise of a default case). */
1533 int warn_switch_enum;
1535 /* Nonzero means warn about function definitions that default the return type
1536 or that use a null return and have a return-type other than void. */
1538 int warn_return_type;
1540 /* Nonzero means warn about pointer casts that increase the required
1541 alignment of the target type (and might therefore lead to a crash
1542 due to a misaligned access). */
1544 int warn_cast_align;
1546 /* Nonzero means warn about any objects definitions whose size is larger
1547 than N bytes. Also want about function definitions whose returned
1548 values are larger than N bytes. The value N is in `larger_than_size'. */
1550 int warn_larger_than;
1551 HOST_WIDE_INT larger_than_size;
1553 /* Nonzero means warn if inline function is too large. */
1557 /* Warn if a function returns an aggregate,
1558 since there are often incompatible calling conventions for doing this. */
1560 int warn_aggregate_return;
1562 /* Warn if packed attribute on struct is unnecessary and inefficient. */
1566 /* Warn when gcc pads a structure to an alignment boundary. */
1570 /* Warn when an optimization pass is disabled. */
1572 int warn_disabled_optimization;
1574 /* Warn about functions which might be candidates for attribute noreturn. */
1576 int warn_missing_noreturn;
1578 /* Nonzero means warn about uses of __attribute__((deprecated))
1581 int warn_deprecated_decl = 1;
1583 /* Nonzero means warn about constructs which might not be
1584 strict-aliasing safe. */
1586 int warn_strict_aliasing;
1588 /* Like f_options, but for -W. */
1590 static const lang_independent_options W_options[] =
1592 {"unused-function", &warn_unused_function, 1,
1593 N_("Warn when a function is unused") },
1594 {"unused-label", &warn_unused_label, 1,
1595 N_("Warn when a label is unused") },
1596 {"unused-parameter", &warn_unused_parameter, 1,
1597 N_("Warn when a function parameter is unused") },
1598 {"unused-variable", &warn_unused_variable, 1,
1599 N_("Warn when a variable is unused") },
1600 {"unused-value", &warn_unused_value, 1,
1601 N_("Warn when an expression value is unused") },
1602 {"system-headers", &warn_system_headers, 1,
1603 N_("Do not suppress warnings from system headers") },
1604 {"error", &warnings_are_errors, 1,
1605 N_("Treat all warnings as errors") },
1606 {"shadow", &warn_shadow, 1,
1607 N_("Warn when one local variable shadows another") },
1608 {"switch", &warn_switch, 1,
1609 N_("Warn about enumerated switches, with no default, missing a case") },
1610 {"switch-default", &warn_switch_default, 1,
1611 N_("Warn about enumerated switches missing a default case") },
1612 {"switch-enum", &warn_switch_enum, 1,
1613 N_("Warn about all enumerated switches missing a specific case") },
1614 {"aggregate-return", &warn_aggregate_return, 1,
1615 N_("Warn about returning structures, unions or arrays") },
1616 {"cast-align", &warn_cast_align, 1,
1617 N_("Warn about pointer casts which increase alignment") },
1618 {"unreachable-code", &warn_notreached, 1,
1619 N_("Warn about code that will never be executed") },
1620 {"uninitialized", &warn_uninitialized, 1,
1621 N_("Warn about uninitialized automatic variables") },
1622 {"inline", &warn_inline, 1,
1623 N_("Warn when an inlined function cannot be inlined") },
1624 {"packed", &warn_packed, 1,
1625 N_("Warn when the packed attribute has no effect on struct layout") },
1626 {"padded", &warn_padded, 1,
1627 N_("Warn when padding is required to align struct members") },
1628 {"disabled-optimization", &warn_disabled_optimization, 1,
1629 N_("Warn when an optimization pass is disabled") },
1630 {"deprecated-declarations", &warn_deprecated_decl, 1,
1631 N_("Warn about uses of __attribute__((deprecated)) declarations") },
1632 {"missing-noreturn", &warn_missing_noreturn, 1,
1633 N_("Warn about functions which might be candidates for attribute noreturn") },
1634 {"strict-aliasing", &warn_strict_aliasing, 1,
1635 N_ ("Warn about code which might break the strict aliasing rules") }
1638 /* Initialize unused warning flags. */
1640 set_Wunused (int setting)
1642 warn_unused_function = setting;
1643 warn_unused_label = setting;
1644 /* Unused function parameter warnings are reported when either
1645 ``-Wextra -Wunused'' or ``-Wunused-parameter'' is specified.
1646 Thus, if -Wextra has already been seen, set warn_unused_parameter;
1647 otherwise set maybe_warn_extra_parameter, which will be picked up
1649 maybe_warn_unused_parameter = setting;
1650 warn_unused_parameter = (setting && extra_warnings);
1651 warn_unused_variable = setting;
1652 warn_unused_value = setting;
1655 /* Initialize more unused warning flags. */
1657 set_Wextra (int setting)
1659 extra_warnings = setting;
1660 warn_unused_value = setting;
1661 warn_unused_parameter = (setting && maybe_warn_unused_parameter);
1663 /* We save the value of warn_uninitialized, since if they put
1664 -Wuninitialized on the command line, we need to generate a
1665 warning about not using it without also specifying -O. */
1667 warn_uninitialized = 0;
1668 else if (warn_uninitialized != 1)
1669 warn_uninitialized = 2;
1672 /* The following routines are useful in setting all the flags that
1673 -ffast-math and -fno-fast-math imply. */
1676 set_fast_math_flags (int set)
1678 flag_trapping_math = !set;
1679 flag_unsafe_math_optimizations = set;
1680 flag_finite_math_only = set;
1681 flag_errno_math = !set;
1683 flag_signaling_nans = 0;
1686 /* Return true iff flags are set as if -ffast-math. */
1688 fast_math_flags_set_p (void)
1690 return (!flag_trapping_math
1691 && flag_unsafe_math_optimizations
1692 && flag_finite_math_only
1693 && !flag_errno_math);
1696 /* Output files for assembler code (real compiler output)
1697 and debugging dumps. */
1700 FILE *aux_info_file;
1701 FILE *rtl_dump_file = NULL;
1703 /* Decode the string P as an integral parameter.
1704 If the string is indeed an integer return its numeric value else
1705 issue an Invalid Option error for the option PNAME and return DEFVAL.
1706 If PNAME is zero just return DEFVAL, do not call error. */
1709 read_integral_parameter (const char *p, const char *pname, const int defval)
1711 const char *endp = p;
1715 if (ISDIGIT (*endp))
1724 error ("invalid option argument `%s'", pname);
1731 /* Return the logarithm of X, base 2, considering X unsigned,
1732 if X is a power of 2. Otherwise, returns -1.
1734 This should be used via the `exact_log2' macro. */
1737 exact_log2_wide (unsigned HOST_WIDE_INT x)
1740 /* Test for 0 or a power of 2. */
1741 if (x == 0 || x != (x & -x))
1743 while ((x >>= 1) != 0)
1748 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1749 If X is 0, return -1.
1751 This should be used via the floor_log2 macro. */
1754 floor_log2_wide (unsigned HOST_WIDE_INT x)
1763 /* Handler for fatal signals, such as SIGSEGV. These are transformed
1764 into ICE messages, which is much more user friendly. In case the
1765 error printer crashes, reset the signal to prevent infinite recursion. */
1768 crash_signal (int signo)
1770 signal (signo, SIG_DFL);
1771 internal_error ("%s", strsignal (signo));
1774 /* Arrange to dump core on error. (The regular error message is still
1775 printed first, except in the case of abort().) */
1778 setup_core_dumping (void)
1781 signal (SIGABRT, SIG_DFL);
1783 #if defined(HAVE_SETRLIMIT)
1786 if (getrlimit (RLIMIT_CORE, &rlim) != 0)
1787 fatal_error ("getting core file size maximum limit: %m");
1788 rlim.rlim_cur = rlim.rlim_max;
1789 if (setrlimit (RLIMIT_CORE, &rlim) != 0)
1790 fatal_error ("setting core file size limit to maximum: %m");
1793 diagnostic_abort_on_error (global_dc);
1797 /* Strip off a legitimate source ending from the input string NAME of
1798 length LEN. Rather than having to know the names used by all of
1799 our front ends, we strip off an ending of a period followed by
1800 up to five characters. (Java uses ".class".) */
1803 strip_off_ending (char *name, int len)
1806 for (i = 2; i < 6 && len > i; i++)
1808 if (name[len - i] == '.')
1810 name[len - i] = '\0';
1816 /* Output a quoted string. */
1819 output_quoted_string (FILE *asm_file, const char *string)
1821 #ifdef OUTPUT_QUOTED_STRING
1822 OUTPUT_QUOTED_STRING (asm_file, string);
1826 putc ('\"', asm_file);
1827 while ((c = *string++) != 0)
1831 if (c == '\"' || c == '\\')
1832 putc ('\\', asm_file);
1836 fprintf (asm_file, "\\%03o", (unsigned char) c);
1838 putc ('\"', asm_file);
1842 /* Output NAME into FILE after having turned it into something
1843 usable as an identifier in a target's assembly file. */
1845 output_clean_symbol_name (FILE *file, const char *name)
1847 /* Make a copy of NAME. */
1848 char *id = xstrdup (name);
1850 /* Make it look like a valid identifier for an assembler. */
1851 clean_symbol_name (id);
1858 /* Output a file name in the form wanted by System V. */
1861 output_file_directive (FILE *asm_file, const char *input_name)
1863 int len = strlen (input_name);
1864 const char *na = input_name + len;
1866 /* NA gets INPUT_NAME sans directory names. */
1867 while (na > input_name)
1869 if (IS_DIR_SEPARATOR (na[-1]))
1874 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1875 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1877 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1878 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1880 fprintf (asm_file, "\t.file\t");
1881 output_quoted_string (asm_file, na);
1882 fputc ('\n', asm_file);
1887 /* Routine to open a dump file. Return true if the dump file is enabled. */
1890 open_dump_file (enum dump_file_index index, tree decl)
1893 const char *open_arg;
1896 if (! dump_file[index].enabled)
1899 timevar_push (TV_DUMP);
1900 if (rtl_dump_file != NULL)
1901 fclose (rtl_dump_file);
1903 sprintf (seq, DUMPFILE_FORMAT, index);
1905 if (! dump_file[index].initialized)
1907 /* If we've not initialized the files, do so now. */
1908 if (graph_dump_format != no_graph
1909 && dump_file[index].graph_dump_p)
1911 dump_name = concat (seq, dump_file[index].extension, NULL);
1912 clean_graph_dump_file (dump_base_name, dump_name);
1915 dump_file[index].initialized = 1;
1921 dump_name = concat (dump_base_name, seq,
1922 dump_file[index].extension, NULL);
1924 rtl_dump_file = fopen (dump_name, open_arg);
1925 if (rtl_dump_file == NULL)
1926 fatal_error ("can't open %s: %m", dump_name);
1931 fprintf (rtl_dump_file, "\n;; Function %s%s\n\n",
1932 (*lang_hooks.decl_printable_name) (decl, 2),
1933 cfun->function_frequency == FUNCTION_FREQUENCY_HOT
1935 : cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED
1936 ? " (unlikely executed)"
1939 timevar_pop (TV_DUMP);
1943 /* Routine to close a dump file. */
1946 close_dump_file (enum dump_file_index index,
1947 void (*func) (FILE *, rtx),
1950 if (! rtl_dump_file)
1953 timevar_push (TV_DUMP);
1955 && graph_dump_format != no_graph
1956 && dump_file[index].graph_dump_p)
1961 sprintf (seq, DUMPFILE_FORMAT, index);
1962 suffix = concat (seq, dump_file[index].extension, NULL);
1963 print_rtl_graph_with_bb (dump_base_name, suffix, insns);
1968 func (rtl_dump_file, insns);
1970 fflush (rtl_dump_file);
1971 fclose (rtl_dump_file);
1973 rtl_dump_file = NULL;
1974 timevar_pop (TV_DUMP);
1977 /* Do any final processing required for the declarations in VEC, of
1978 which there are LEN. We write out inline functions and variables
1979 that have been deferred until this point, but which are required.
1980 Returns nonzero if anything was put out. */
1983 wrapup_global_declarations (tree *vec, int len)
1988 int output_something = 0;
1990 for (i = 0; i < len; i++)
1994 /* We're not deferring this any longer. Assignment is
1995 conditional to avoid needlessly dirtying PCH pages. */
1996 if (DECL_DEFER_OUTPUT (decl) != 0)
1997 DECL_DEFER_OUTPUT (decl) = 0;
1999 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0)
2000 (*lang_hooks.finish_incomplete_decl) (decl);
2003 /* Now emit any global variables or functions that we have been
2004 putting off. We need to loop in case one of the things emitted
2005 here references another one which comes earlier in the list. */
2009 for (i = 0; i < len; i++)
2013 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
2016 /* Don't write out static consts, unless we still need them.
2018 We also keep static consts if not optimizing (for debugging),
2019 unless the user specified -fno-keep-static-consts.
2020 ??? They might be better written into the debug information.
2021 This is possible when using DWARF.
2023 A language processor that wants static constants to be always
2024 written out (even if it is not used) is responsible for
2025 calling rest_of_decl_compilation itself. E.g. the C front-end
2026 calls rest_of_decl_compilation from finish_decl.
2027 One motivation for this is that is conventional in some
2028 environments to write things like:
2029 static const char rcsid[] = "... version string ...";
2030 intending to force the string to be in the executable.
2032 A language processor that would prefer to have unneeded
2033 static constants "optimized away" would just defer writing
2034 them out until here. E.g. C++ does this, because static
2035 constants are often defined in header files.
2037 ??? A tempting alternative (for both C and C++) would be
2038 to force a constant to be written if and only if it is
2039 defined in a main file, as opposed to an include file. */
2041 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
2045 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2047 else if (DECL_COMDAT (decl))
2049 else if (TREE_READONLY (decl) && !TREE_PUBLIC (decl)
2050 && (optimize || !flag_keep_static_consts
2051 || DECL_ARTIFICIAL (decl)))
2057 rest_of_decl_compilation (decl, NULL, 1, 1);
2061 if (TREE_CODE (decl) == FUNCTION_DECL
2062 && DECL_INITIAL (decl) != 0
2063 && DECL_SAVED_INSNS (decl) != 0
2064 && (flag_keep_inline_functions
2065 || (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
2066 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
2069 output_inline_function (decl);
2074 output_something = 1;
2078 return output_something;
2081 /* Issue appropriate warnings for the global declarations in VEC (of
2082 which there are LEN). Output debugging information for them. */
2085 check_global_declarations (tree *vec, int len)
2090 for (i = 0; i < len; i++)
2094 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
2095 && ! TREE_ASM_WRITTEN (decl))
2096 /* Cancel the RTL for this decl so that, if debugging info
2097 output for global variables is still to come,
2098 this one will be omitted. */
2099 SET_DECL_RTL (decl, NULL_RTX);
2101 /* Warn about any function
2102 declared static but not defined.
2103 We don't warn about variables,
2104 because many programs have static variables
2105 that exist only to get some text into the object file. */
2106 if (TREE_CODE (decl) == FUNCTION_DECL
2107 && (warn_unused_function
2108 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2109 && DECL_INITIAL (decl) == 0
2110 && DECL_EXTERNAL (decl)
2111 && ! DECL_ARTIFICIAL (decl)
2112 && ! TREE_PUBLIC (decl))
2114 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2115 pedwarn_with_decl (decl,
2116 "`%s' used but never defined");
2118 warning_with_decl (decl,
2119 "`%s' declared `static' but never defined");
2120 /* This symbol is effectively an "extern" declaration now. */
2121 TREE_PUBLIC (decl) = 1;
2122 assemble_external (decl);
2125 /* Warn about static fns or vars defined but not used. */
2126 if (((warn_unused_function && TREE_CODE (decl) == FUNCTION_DECL)
2127 || (warn_unused_variable && TREE_CODE (decl) == VAR_DECL))
2128 && ! TREE_USED (decl)
2129 /* The TREE_USED bit for file-scope decls is kept in the identifier,
2130 to handle multiple external decls in different scopes. */
2131 && ! TREE_USED (DECL_NAME (decl))
2132 && ! DECL_EXTERNAL (decl)
2133 && ! TREE_PUBLIC (decl)
2134 /* A volatile variable might be used in some non-obvious way. */
2135 && ! TREE_THIS_VOLATILE (decl)
2136 /* Global register variables must be declared to reserve them. */
2137 && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
2138 /* Otherwise, ask the language. */
2139 && (*lang_hooks.decls.warn_unused_global) (decl))
2140 warning_with_decl (decl, "`%s' defined but not used");
2142 /* Avoid confusing the debug information machinery when there are
2144 if (errorcount == 0 && sorrycount == 0)
2146 timevar_push (TV_SYMOUT);
2147 (*debug_hooks->global_decl) (decl);
2148 timevar_pop (TV_SYMOUT);
2153 /* Save the current INPUT_LOCATION on the top entry in the
2154 INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
2155 INPUT_LOCATION accordingly. */
2158 push_srcloc (const char *file, int line)
2160 struct file_stack *fs;
2162 fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2163 fs->location = input_location;
2164 fs->next = input_file_stack;
2165 input_filename = file;
2167 input_file_stack = fs;
2168 input_file_stack_tick++;
2171 /* Pop the top entry off the stack of presently open source files.
2172 Restore the INPUT_LOCATION from the new topmost entry on the
2178 struct file_stack *fs;
2180 fs = input_file_stack;
2181 input_location = fs->location;
2182 input_file_stack = fs->next;
2184 input_file_stack_tick++;
2187 /* Compile an entire translation unit. Write a file of assembly
2188 output and various debugging dumps. */
2193 /* Initialize yet another pass. */
2195 init_final (main_input_filename);
2196 coverage_init (aux_base_name);
2198 timevar_push (TV_PARSE);
2200 /* Call the parser, which parses the entire file (calling
2201 rest_of_compilation for each function). */
2202 (*lang_hooks.parse_file) (set_yydebug);
2204 /* In case there were missing block closers,
2205 get us back to the global binding level. */
2206 (*lang_hooks.clear_binding_stack) ();
2208 /* Compilation is now finished except for writing
2209 what's left of the symbol table output. */
2210 timevar_pop (TV_PARSE);
2212 if (flag_syntax_only)
2215 (*lang_hooks.decls.final_write_globals)();
2217 /* This must occur after the loop to output deferred functions.
2218 Else the coverage initializer would not be emitted if all the
2219 functions in this compilation unit were deferred. */
2222 /* Write out any pending weak symbol declarations. */
2226 /* Do dbx symbols. */
2227 timevar_push (TV_SYMOUT);
2229 #ifdef DWARF2_UNWIND_INFO
2230 if (dwarf2out_do_frame ())
2231 dwarf2out_frame_finish ();
2234 (*debug_hooks->finish) (main_input_filename);
2235 timevar_pop (TV_SYMOUT);
2237 /* Output some stuff at end of file if nec. */
2239 dw2_output_indirect_constants ();
2241 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
2243 timevar_push (TV_DUMP);
2244 open_dump_file (DFI_bp, NULL);
2248 close_dump_file (DFI_bp, NULL, NULL_RTX);
2249 timevar_pop (TV_DUMP);
2252 targetm.asm_out.file_end ();
2254 /* Attach a special .ident directive to the end of the file to identify
2255 the version of GCC which compiled this code. The format of the .ident
2256 string is patterned after the ones produced by native SVR4 compilers. */
2259 fprintf (asm_out_file, "%s\"GCC: (GNU) %s\"\n",
2260 IDENT_ASM_OP, version_string);
2263 if (optimize > 0 && open_dump_file (DFI_combine, NULL))
2265 timevar_push (TV_DUMP);
2266 dump_combine_total_stats (rtl_dump_file);
2267 close_dump_file (DFI_combine, NULL, NULL_RTX);
2268 timevar_pop (TV_DUMP);
2272 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2273 and TYPE_DECL nodes.
2275 This does nothing for local (non-static) variables, unless the
2276 variable is a register variable with an ASMSPEC. In that case, or
2277 if the variable is not an automatic, it sets up the RTL and
2278 outputs any assembler code (label definition, storage allocation
2279 and initialization).
2281 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2282 the assembler symbol name to be used. TOP_LEVEL is nonzero
2283 if this declaration is not within a function. */
2286 rest_of_decl_compilation (tree decl,
2287 const char *asmspec,
2291 /* We deferred calling assemble_alias so that we could collect
2292 other attributes such as visibility. Emit the alias now. */
2295 alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl));
2298 alias = TREE_VALUE (TREE_VALUE (alias));
2299 alias = get_identifier (TREE_STRING_POINTER (alias));
2300 assemble_alias (decl, alias);
2304 /* Forward declarations for nested functions are not "external",
2305 but we need to treat them as if they were. */
2306 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2307 || TREE_CODE (decl) == FUNCTION_DECL)
2309 timevar_push (TV_VARCONST);
2312 make_decl_rtl (decl, asmspec);
2314 /* Don't output anything when a tentative file-scope definition
2315 is seen. But at end of compilation, do output code for them. */
2316 if (at_end || !DECL_DEFER_OUTPUT (decl))
2317 assemble_variable (decl, top_level, at_end, 0);
2319 #ifdef ASM_FINISH_DECLARE_OBJECT
2320 if (decl == last_assemble_variable_decl)
2322 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2327 timevar_pop (TV_VARCONST);
2329 else if (DECL_REGISTER (decl) && asmspec != 0)
2331 if (decode_reg_name (asmspec) >= 0)
2333 SET_DECL_RTL (decl, NULL_RTX);
2334 make_decl_rtl (decl, asmspec);
2338 error ("invalid register name `%s' for register variable", asmspec);
2339 DECL_REGISTER (decl) = 0;
2344 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2345 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2346 && TREE_CODE (decl) == TYPE_DECL)
2348 timevar_push (TV_SYMOUT);
2349 dbxout_symbol (decl, 0);
2350 timevar_pop (TV_SYMOUT);
2353 #ifdef SDB_DEBUGGING_INFO
2354 else if (write_symbols == SDB_DEBUG && top_level
2355 && TREE_CODE (decl) == TYPE_DECL)
2357 timevar_push (TV_SYMOUT);
2358 sdbout_symbol (decl, 0);
2359 timevar_pop (TV_SYMOUT);
2362 #ifdef DWARF2_DEBUGGING_INFO
2363 else if ((write_symbols == DWARF2_DEBUG
2364 || write_symbols == VMS_AND_DWARF2_DEBUG)
2366 && TREE_CODE (decl) == TYPE_DECL)
2368 timevar_push (TV_SYMOUT);
2369 dwarf2out_decl (decl);
2370 timevar_pop (TV_SYMOUT);
2375 /* Called after finishing a record, union or enumeral type. */
2378 rest_of_type_compilation (
2379 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) \
2380 || defined (SDB_DEBUGGING_INFO) || defined (DWARF2_DEBUGGING_INFO)
2384 tree type ATTRIBUTE_UNUSED,
2385 int toplev ATTRIBUTE_UNUSED
2389 /* Avoid confusing the debug information machinery when there are
2391 if (errorcount != 0 || sorrycount != 0)
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);
2399 #ifdef SDB_DEBUGGING_INFO
2400 if (write_symbols == SDB_DEBUG)
2401 sdbout_symbol (TYPE_STUB_DECL (type), !toplev);
2403 #ifdef DWARF2_DEBUGGING_INFO
2404 if ((write_symbols == DWARF2_DEBUG
2405 || write_symbols == VMS_AND_DWARF2_DEBUG)
2407 dwarf2out_decl (TYPE_STUB_DECL (type));
2409 timevar_pop (TV_SYMOUT);
2412 /* Turn the RTL into assembly. */
2414 rest_of_handle_final (tree decl, rtx insns)
2416 timevar_push (TV_FINAL);
2421 /* Get the function's name, as described by its RTL. This may be
2422 different from the DECL_NAME name used in the source file. */
2424 x = DECL_RTL (decl);
2425 if (GET_CODE (x) != MEM)
2428 if (GET_CODE (x) != SYMBOL_REF)
2430 fnname = XSTR (x, 0);
2432 assemble_start_function (decl, fnname);
2433 final_start_function (insns, asm_out_file, optimize);
2434 final (insns, asm_out_file, optimize, 0);
2435 final_end_function ();
2437 #ifdef IA64_UNWIND_INFO
2438 /* ??? The IA-64 ".handlerdata" directive must be issued before
2439 the ".endp" directive that closes the procedure descriptor. */
2440 output_function_exception_table ();
2443 assemble_end_function (decl, fnname);
2445 #ifndef IA64_UNWIND_INFO
2446 /* Otherwise, it feels unclean to switch sections in the middle. */
2447 output_function_exception_table ();
2451 fflush (asm_out_file);
2453 /* Release all memory allocated by flow. */
2454 free_basic_block_vars (0);
2456 /* Release all memory held by regsets now. */
2457 regset_release_memory ();
2459 timevar_pop (TV_FINAL);
2465 /* Run delay slot optimization. */
2467 rest_of_handle_delay_slots (tree decl, rtx insns)
2469 timevar_push (TV_DBR_SCHED);
2470 open_dump_file (DFI_dbr, decl);
2472 dbr_schedule (insns, rtl_dump_file);
2474 close_dump_file (DFI_dbr, print_rtl, insns);
2475 timevar_pop (TV_DBR_SCHED);
2482 /* Convert register usage from flat register file usage to a stack
2485 rest_of_handle_stack_regs (tree decl, rtx insns)
2487 timevar_push (TV_REG_STACK);
2488 open_dump_file (DFI_stack, decl);
2490 if (reg_to_stack (insns, rtl_dump_file) && optimize)
2492 if (cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
2493 | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0))
2494 && flag_reorder_blocks)
2496 reorder_basic_blocks ();
2497 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK);
2501 close_dump_file (DFI_stack, print_rtl_with_bb, insns);
2502 timevar_pop (TV_REG_STACK);
2509 /* Machine independent reorg pass. */
2511 rest_of_handle_machine_reorg (tree decl, rtx insns)
2513 timevar_push (TV_MACH_DEP);
2514 open_dump_file (DFI_mach, decl);
2516 (*targetm.machine_dependent_reorg) ();
2518 close_dump_file (DFI_mach, print_rtl, insns);
2519 timevar_pop (TV_MACH_DEP);
2525 /* Run new register allocator. Return TRUE if we must exit
2526 rest_of_compilation upon return. */
2528 rest_of_handle_new_regalloc (tree decl, rtx insns, int *rebuild_notes)
2532 delete_trivially_dead_insns (insns, max_reg_num ());
2535 timevar_pop (TV_LOCAL_ALLOC);
2536 if (dump_file[DFI_lreg].enabled)
2538 timevar_push (TV_DUMP);
2540 close_dump_file (DFI_lreg, NULL, NULL);
2541 timevar_pop (TV_DUMP);
2544 /* XXX clean up the whole mess to bring live info in shape again. */
2545 timevar_push (TV_GLOBAL_ALLOC);
2546 open_dump_file (DFI_greg, decl);
2548 build_insn_chain (insns);
2549 failure = reload (insns, 0);
2551 timevar_pop (TV_GLOBAL_ALLOC);
2553 if (dump_file[DFI_greg].enabled)
2555 timevar_push (TV_DUMP);
2557 dump_global_regs (rtl_dump_file);
2559 close_dump_file (DFI_greg, print_rtl_with_bb, insns);
2560 timevar_pop (TV_DUMP);
2566 reload_completed = 1;
2572 /* Run old register allocator. Return TRUE if we must exit
2573 rest_of_compilation upon return. */
2575 rest_of_handle_old_regalloc (tree decl, rtx insns, int *rebuild_notes)
2579 /* Allocate the reg_renumber array. */
2580 allocate_reg_info (max_regno, FALSE, TRUE);
2582 /* And the reg_equiv_memory_loc array. */
2583 reg_equiv_memory_loc = (rtx *) xcalloc (max_regno, sizeof (rtx));
2585 allocate_initial_values (reg_equiv_memory_loc);
2587 regclass (insns, max_reg_num (), rtl_dump_file);
2588 *rebuild_notes = local_alloc ();
2590 timevar_pop (TV_LOCAL_ALLOC);
2592 if (dump_file[DFI_lreg].enabled)
2594 timevar_push (TV_DUMP);
2596 dump_flow_info (rtl_dump_file);
2597 dump_local_alloc (rtl_dump_file);
2599 close_dump_file (DFI_lreg, print_rtl_with_bb, insns);
2600 timevar_pop (TV_DUMP);
2605 timevar_push (TV_GLOBAL_ALLOC);
2606 open_dump_file (DFI_greg, decl);
2608 /* If optimizing, allocate remaining pseudo-regs. Do the reload
2609 pass fixing up any insns that are invalid. */
2612 failure = global_alloc (rtl_dump_file);
2615 build_insn_chain (insns);
2616 failure = reload (insns, 0);
2619 timevar_pop (TV_GLOBAL_ALLOC);
2621 if (dump_file[DFI_greg].enabled)
2623 timevar_push (TV_DUMP);
2625 dump_global_regs (rtl_dump_file);
2627 close_dump_file (DFI_greg, print_rtl_with_bb, insns);
2628 timevar_pop (TV_DUMP);
2634 /* Run the regrename and cprop passes. */
2636 rest_of_handle_regrename (tree decl, rtx insns)
2638 timevar_push (TV_RENAME_REGISTERS);
2639 open_dump_file (DFI_rnreg, decl);
2641 if (flag_rename_registers)
2642 regrename_optimize ();
2643 if (flag_cprop_registers)
2644 copyprop_hardreg_forward ();
2646 close_dump_file (DFI_rnreg, print_rtl_with_bb, insns);
2647 timevar_pop (TV_RENAME_REGISTERS);
2650 /* Reorder basic blocks. */
2652 rest_of_handle_reorder_blocks (tree decl, rtx insns)
2654 timevar_push (TV_REORDER_BLOCKS);
2655 open_dump_file (DFI_bbro, decl);
2657 /* Last attempt to optimize CFG, as scheduling, peepholing and insn
2658 splitting possibly introduced more crossjumping opportunities. */
2659 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE
2660 | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
2662 if (flag_sched2_use_traces && flag_schedule_insns_after_reload)
2664 if (flag_reorder_blocks)
2665 reorder_basic_blocks ();
2666 if (flag_reorder_blocks
2667 || (flag_sched2_use_traces && flag_schedule_insns_after_reload))
2668 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
2670 close_dump_file (DFI_bbro, print_rtl_with_bb, insns);
2671 timevar_pop (TV_REORDER_BLOCKS);
2674 /* Run instruction scheduler. */
2676 rest_of_handle_sched (tree decl, rtx insns)
2678 timevar_push (TV_SCHED);
2679 #ifdef INSN_SCHEDULING
2681 /* Print function header into sched dump now
2682 because doing the sched analysis makes some of the dump. */
2683 if (optimize > 0 && flag_schedule_insns)
2685 open_dump_file (DFI_sched, decl);
2687 /* Do control and data sched analysis,
2688 and write some of the results to dump file. */
2690 schedule_insns (rtl_dump_file);
2692 close_dump_file (DFI_sched, print_rtl_with_bb, insns);
2695 timevar_pop (TV_SCHED);
2700 #ifdef INSN_SCHEDULING
2701 /* Run second scheduling pass after reload. */
2703 rest_of_handle_sched2 (tree decl, rtx insns)
2705 timevar_push (TV_SCHED2);
2706 open_dump_file (DFI_sched2, decl);
2708 /* Do control and data sched analysis again,
2709 and write some more of the results to dump file. */
2711 split_all_insns (1);
2713 if (flag_sched2_use_superblocks || flag_sched2_use_traces)
2715 schedule_ebbs (rtl_dump_file);
2716 /* No liveness updating code yet, but it should be easy to do.
2717 reg-stack recompute the liveness when needed for now. */
2718 count_or_remove_death_notes (NULL, 1);
2719 cleanup_cfg (CLEANUP_EXPENSIVE);
2722 schedule_insns (rtl_dump_file);
2724 close_dump_file (DFI_sched2, print_rtl_with_bb, insns);
2725 timevar_pop (TV_SCHED2);
2731 /* Register allocation pre-pass, to reduce number of moves necessary
2732 for two-address machines. */
2734 rest_of_handle_regmove (tree decl, rtx insns)
2736 timevar_push (TV_REGMOVE);
2737 open_dump_file (DFI_regmove, decl);
2739 regmove_optimize (insns, max_reg_num (), rtl_dump_file);
2741 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
2742 close_dump_file (DFI_regmove, print_rtl_with_bb, insns);
2743 timevar_pop (TV_REGMOVE);
2750 rest_of_handle_tracer (tree decl, rtx insns)
2752 timevar_push (TV_TRACER);
2753 open_dump_file (DFI_tracer, decl);
2755 dump_flow_info (rtl_dump_file);
2757 cleanup_cfg (CLEANUP_EXPENSIVE);
2758 reg_scan (insns, max_reg_num (), 0);
2759 close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ());
2760 timevar_pop (TV_TRACER);
2763 /* If-conversion and CFG cleanup. */
2765 rest_of_handle_if_conversion (tree decl, rtx insns)
2767 open_dump_file (DFI_ce1, decl);
2768 if (flag_if_conversion)
2770 timevar_push (TV_IFCVT);
2772 dump_flow_info (rtl_dump_file);
2773 cleanup_cfg (CLEANUP_EXPENSIVE);
2774 reg_scan (insns, max_reg_num (), 0);
2776 timevar_pop (TV_IFCVT);
2778 timevar_push (TV_JUMP);
2779 cleanup_cfg (CLEANUP_EXPENSIVE);
2780 reg_scan (insns, max_reg_num (), 0);
2781 timevar_pop (TV_JUMP);
2782 close_dump_file (DFI_ce1, print_rtl_with_bb, get_insns ());
2785 /* Rerun if-conversion, as combine may have simplified things enough
2786 to now meet sequence length restrictions. */
2788 rest_of_handle_if_after_combine (tree decl, rtx insns)
2790 timevar_push (TV_IFCVT);
2791 open_dump_file (DFI_ce2, decl);
2797 close_dump_file (DFI_ce2, print_rtl_with_bb, insns);
2798 timevar_pop (TV_IFCVT);
2801 /* Do branch profiling and static profile estimation passes. */
2803 rest_of_handle_branch_prob (tree decl, rtx insns)
2807 timevar_push (TV_BRANCH_PROB);
2808 open_dump_file (DFI_bp, decl);
2809 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
2812 /* Discover and record the loop depth at the head of each basic
2813 block. The loop infrastructure does the real job for us. */
2814 flow_loops_find (&loops, LOOP_TREE);
2817 flow_loops_dump (&loops, rtl_dump_file, NULL, 0);
2819 /* Estimate using heuristics if no profiling info is available. */
2820 if (flag_guess_branch_prob)
2821 estimate_probability (&loops);
2823 flow_loops_free (&loops);
2824 close_dump_file (DFI_bp, print_rtl_with_bb, insns);
2825 timevar_pop (TV_BRANCH_PROB);
2828 /* Do control and data flow analysis; write some of the results to the
2831 rest_of_handle_cfg (tree decl, rtx insns)
2833 open_dump_file (DFI_cfg, decl);
2835 dump_flow_info (rtl_dump_file);
2837 cleanup_cfg (CLEANUP_EXPENSIVE
2838 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
2840 /* It may make more sense to mark constant functions after dead code is
2841 eliminated by life_analysis, but we need to do it early, as -fprofile-arcs
2842 may insert code making function non-constant, but we still must consider
2843 it as constant, otherwise -fbranch-probabilities will not read data back.
2845 life_analysis rarely eliminates modification of external memory.
2848 mark_constant_function ();
2850 close_dump_file (DFI_cfg, print_rtl_with_bb, insns);
2853 /* Purge addressofs. */
2855 rest_of_handle_addresof (tree decl, rtx insns)
2857 open_dump_file (DFI_addressof, decl);
2859 purge_addressof (insns);
2861 purge_all_dead_edges (0);
2862 reg_scan (insns, max_reg_num (), 1);
2864 close_dump_file (DFI_addressof, print_rtl, insns);
2867 /* We may have potential sibling or tail recursion sites. Select one
2868 (of possibly multiple) methods of performing the call. */
2870 rest_of_handle_sibling_calls (rtx insns)
2873 optimize_sibling_and_tail_recursive_calls ();
2875 /* Recompute the CFG as sibling optimization clobbers it randomly. */
2876 free_bb_for_insn ();
2877 find_exception_handler_labels ();
2878 rebuild_jump_labels (insns);
2879 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2881 /* There is pass ordering problem - we must lower NOTE_INSN_PREDICTION
2882 notes before simplifying cfg and we must do lowering after sibcall
2883 that unhides parts of RTL chain and cleans up the CFG.
2885 Until sibcall is replaced by tree-level optimizer, lets just
2886 sweep away the NOTE_INSN_PREDICTION notes that leaked out. */
2887 for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
2888 if (GET_CODE (insn) == NOTE
2889 && NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION)
2892 close_dump_file (DFI_sibling, print_rtl, get_insns ());
2895 /* Perform jump bypassing and control flow optimizations. */
2897 rest_of_handle_jump_bypass (tree decl, rtx insns)
2899 timevar_push (TV_BYPASS);
2900 open_dump_file (DFI_bypass, decl);
2902 cleanup_cfg (CLEANUP_EXPENSIVE);
2904 if (bypass_jumps (rtl_dump_file))
2906 rebuild_jump_labels (insns);
2907 cleanup_cfg (CLEANUP_EXPENSIVE);
2908 delete_trivially_dead_insns (insns, max_reg_num ());
2911 close_dump_file (DFI_bypass, print_rtl_with_bb, insns);
2912 timevar_pop (TV_BYPASS);
2916 #ifdef ENABLE_CHECKING
2917 verify_flow_info ();
2921 /* Handle inlining of functions in rest_of_compilation. Return TRUE
2922 if we must exit rest_of_compilation upon return. */
2924 rest_of_handle_inlining (tree decl)
2931 /* If we are reconsidering an inline function at the end of
2932 compilation, skip the stuff for making it inline. */
2933 if (DECL_SAVED_INSNS (decl) != 0)
2936 /* If this is nested inside an inlined external function, pretend
2937 it was only declared. Since we cannot inline such functions,
2938 generating code for this one is not only not necessary but will
2939 confuse some debugging output writers. */
2940 for (parent = DECL_CONTEXT (current_function_decl);
2941 parent != NULL_TREE;
2942 parent = get_containing_scope (parent))
2943 if (TREE_CODE (parent) == FUNCTION_DECL
2944 && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
2946 DECL_INITIAL (decl) = 0;
2949 else if (TYPE_P (parent))
2950 /* A function in a local class should be treated normally. */
2953 /* If requested, consider whether to make this function inline. */
2954 if ((DECL_INLINE (decl) && !flag_no_inline)
2955 || flag_inline_functions)
2957 timevar_push (TV_INTEGRATION);
2958 lose = function_cannot_inline_p (decl);
2959 timevar_pop (TV_INTEGRATION);
2960 if (lose || ! optimize)
2962 if (warn_inline && DECL_INLINE (decl))
2963 warning_with_decl (decl, lose);
2964 DECL_ABSTRACT_ORIGIN (decl) = 0;
2965 /* Don't really compile an extern inline function.
2966 If we can't make it inline, pretend
2967 it was only declared. */
2968 if (DECL_EXTERNAL (decl))
2970 DECL_INITIAL (decl) = 0;
2975 /* ??? Note that we used to just make it look like if
2976 the "inline" keyword was specified when we decide
2977 to inline it (because of -finline-functions).
2978 garloff@suse.de, 2002-04-24: Add another flag to
2979 actually record this piece of information. */
2980 if (!DECL_INLINE (decl))
2981 DID_INLINE_FUNC (decl) = 1;
2982 inlinable = DECL_INLINE (decl) = 1;
2986 insns = get_insns ();
2988 /* Dump the rtl code if we are dumping rtl. */
2990 if (open_dump_file (DFI_rtl, decl))
2992 if (DECL_SAVED_INSNS (decl))
2993 fprintf (rtl_dump_file, ";; (integrable)\n\n");
2994 close_dump_file (DFI_rtl, print_rtl, insns);
2997 /* Convert from NOTE_INSN_EH_REGION style notes, and do other
2998 sorts of eh initialization. Delay this until after the
2999 initial rtl dump so that we can see the original nesting. */
3000 convert_from_eh_region_ranges ();
3002 /* If function is inline, and we don't yet know whether to
3003 compile it by itself, defer decision till end of compilation.
3004 wrapup_global_declarations will (indirectly) call
3005 rest_of_compilation again for those functions that need to
3006 be output. Also defer those functions that we are supposed
3010 || (DECL_INLINE (decl)
3011 && flag_inline_functions
3012 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
3013 && ! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
3014 && ! flag_keep_inline_functions)
3015 || DECL_EXTERNAL (decl))))
3016 DECL_DEFER_OUTPUT (decl) = 1;
3018 if (DECL_INLINE (decl))
3019 /* DWARF wants separate debugging info for abstract and
3020 concrete instances of all inline functions, including those
3021 declared inline but not inlined, and those inlined even
3022 though they weren't declared inline. Conveniently, that's
3023 what DECL_INLINE means at this point. */
3024 (*debug_hooks->deferred_inline_function) (decl);
3026 if (DECL_DEFER_OUTPUT (decl))
3028 /* If -Wreturn-type, we have to do a bit of compilation. We just
3029 want to call cleanup the cfg to figure out whether or not we can
3030 fall off the end of the function; we do the minimum amount of
3031 work necessary to make that safe. */
3032 if (warn_return_type)
3034 int saved_optimize = optimize;
3037 rebuild_jump_labels (insns);
3038 find_exception_handler_labels ();
3039 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3040 cleanup_cfg (CLEANUP_PRE_SIBCALL | CLEANUP_PRE_LOOP);
3041 optimize = saved_optimize;
3043 /* CFG is no longer maintained up-to-date. */
3044 free_bb_for_insn ();
3047 set_nothrow_function_flags ();
3048 if (current_function_nothrow)
3049 /* Now we know that this can't throw; set the flag for the benefit
3050 of other functions later in this translation unit. */
3051 TREE_NOTHROW (current_function_decl) = 1;
3053 timevar_push (TV_INTEGRATION);
3054 save_for_inline (decl);
3055 timevar_pop (TV_INTEGRATION);
3056 DECL_SAVED_INSNS (decl)->inlinable = inlinable;
3060 /* If specified extern inline but we aren't inlining it, we are
3061 done. This goes for anything that gets here with DECL_EXTERNAL
3062 set, not just things with DECL_INLINE. */
3063 return (bool) DECL_EXTERNAL (decl);
3066 /* Rest of compilation helper to convert the rtl to SSA form. */
3068 rest_of_handle_ssa (tree decl, rtx insns)
3070 timevar_push (TV_TO_SSA);
3071 open_dump_file (DFI_ssa, decl);
3073 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
3076 close_dump_file (DFI_ssa, print_rtl_with_bb, insns);
3077 timevar_pop (TV_TO_SSA);
3079 /* Perform sparse conditional constant propagation, if requested. */
3082 timevar_push (TV_SSA_CCP);
3083 open_dump_file (DFI_ssa_ccp, decl);
3087 close_dump_file (DFI_ssa_ccp, print_rtl_with_bb, get_insns ());
3088 timevar_pop (TV_SSA_CCP);
3091 /* It would be useful to cleanup the CFG at this point, but block
3092 merging and possibly other transformations might leave a PHI
3093 node in the middle of a basic block, which is a strict no-no. */
3095 /* The SSA implementation uses basic block numbers in its phi
3096 nodes. Thus, changing the control-flow graph or the basic
3097 blocks, e.g., calling find_basic_blocks () or cleanup_cfg (),
3098 may cause problems. */
3102 /* Remove dead code. */
3104 timevar_push (TV_SSA_DCE);
3105 open_dump_file (DFI_ssa_dce, decl);
3107 insns = get_insns ();
3108 ssa_eliminate_dead_code ();
3110 close_dump_file (DFI_ssa_dce, print_rtl_with_bb, insns);
3111 timevar_pop (TV_SSA_DCE);
3114 /* Convert from SSA form. */
3116 timevar_push (TV_FROM_SSA);
3117 open_dump_file (DFI_ussa, decl);
3119 convert_from_ssa ();
3120 /* New registers have been created. Rescan their usage. */
3121 reg_scan (insns, max_reg_num (), 1);
3123 close_dump_file (DFI_ussa, print_rtl_with_bb, insns);
3124 timevar_pop (TV_FROM_SSA);
3131 /* Try to identify useless null pointer tests and delete them. */
3133 rest_of_handle_null_pointer (tree decl, rtx insns)
3135 open_dump_file (DFI_null, decl);
3137 dump_flow_info (rtl_dump_file);
3139 if (delete_null_pointer_checks (insns))
3140 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
3142 close_dump_file (DFI_null, print_rtl_with_bb, insns);
3145 /* Try combining insns through substitution. */
3147 rest_of_handle_combine (tree decl, rtx insns)
3149 int rebuild_jump_labels_after_combine = 0;
3151 timevar_push (TV_COMBINE);
3152 open_dump_file (DFI_combine, decl);
3154 rebuild_jump_labels_after_combine
3155 = combine_instructions (insns, max_reg_num ());
3157 /* Combining insns may have turned an indirect jump into a
3158 direct jump. Rebuild the JUMP_LABEL fields of jumping
3160 if (rebuild_jump_labels_after_combine)
3162 timevar_push (TV_JUMP);
3163 rebuild_jump_labels (insns);
3164 timevar_pop (TV_JUMP);
3166 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
3169 close_dump_file (DFI_combine, print_rtl_with_bb, insns);
3170 timevar_pop (TV_COMBINE);
3175 /* Perform life analysis. */
3177 rest_of_handle_life (tree decl, rtx insns)
3179 open_dump_file (DFI_life, decl);
3182 #ifdef ENABLE_CHECKING
3183 verify_flow_info ();
3185 life_analysis (insns, rtl_dump_file, PROP_FINAL);
3187 cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_UPDATE_LIFE
3188 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
3189 timevar_pop (TV_FLOW);
3191 if (warn_uninitialized)
3193 uninitialized_vars_warning (DECL_INITIAL (decl));
3195 setjmp_args_warning ();
3200 if (!flag_new_regalloc && initialize_uninitialized_subregs ())
3202 /* Insns were inserted, and possibly pseudos created, so
3203 things might look a bit different. */
3204 insns = get_insns ();
3205 allocate_reg_life_data ();
3206 update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
3207 PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES);
3213 close_dump_file (DFI_life, print_rtl_with_bb, insns);
3218 /* Perform common subexpression elimination. Nonzero value from
3219 `cse_main' means that jumps were simplified and some code may now
3220 be unreachable, so do jump optimization again. */
3222 rest_of_handle_cse (tree decl, rtx insns)
3226 open_dump_file (DFI_cse, decl);
3228 dump_flow_info (rtl_dump_file);
3229 timevar_push (TV_CSE);
3231 reg_scan (insns, max_reg_num (), 1);
3233 tem = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
3235 rebuild_jump_labels (insns);
3236 purge_all_dead_edges (0);
3238 delete_trivially_dead_insns (insns, max_reg_num ());
3240 /* If we are not running more CSE passes, then we are no longer
3241 expecting CSE to be run. But always rerun it in a cheap mode. */
3242 cse_not_expected = !flag_rerun_cse_after_loop && !flag_gcse;
3244 if (tem || optimize > 1)
3245 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
3246 /* Try to identify useless null pointer tests and delete them. */
3247 if (flag_delete_null_pointer_checks)
3249 timevar_push (TV_JUMP);
3251 if (delete_null_pointer_checks (insns))
3252 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
3253 timevar_pop (TV_JUMP);
3256 /* The second pass of jump optimization is likely to have
3257 removed a bunch more instructions. */
3258 renumber_insns (rtl_dump_file);
3260 timevar_pop (TV_CSE);
3261 close_dump_file (DFI_cse, print_rtl_with_bb, insns);
3264 /* Run second CSE pass after loop optimizations. */
3266 rest_of_handle_cse2 (tree decl, rtx insns)
3270 timevar_push (TV_CSE2);
3271 open_dump_file (DFI_cse2, decl);
3273 dump_flow_info (rtl_dump_file);
3274 /* CFG is no longer maintained up-to-date. */
3275 tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
3276 purge_all_dead_edges (0);
3277 delete_trivially_dead_insns (insns, max_reg_num ());
3281 timevar_push (TV_JUMP);
3282 rebuild_jump_labels (insns);
3283 cleanup_cfg (CLEANUP_EXPENSIVE);
3284 timevar_pop (TV_JUMP);
3286 reg_scan (insns, max_reg_num (), 0);
3287 close_dump_file (DFI_cse2, print_rtl_with_bb, insns);
3289 timevar_pop (TV_CSE2);
3292 /* Perform global cse. */
3294 rest_of_handle_gcse (tree decl, rtx insns)
3296 int save_csb, save_cfj;
3299 timevar_push (TV_GCSE);
3300 open_dump_file (DFI_gcse, decl);
3302 tem = gcse_main (insns, rtl_dump_file);
3303 rebuild_jump_labels (insns);
3304 delete_trivially_dead_insns (insns, max_reg_num ());
3306 save_csb = flag_cse_skip_blocks;
3307 save_cfj = flag_cse_follow_jumps;
3308 flag_cse_skip_blocks = flag_cse_follow_jumps = 0;
3310 /* Instantiate any remaining CONSTANT_P_RTX nodes. */
3311 if (current_function_calls_constant_p)
3312 purge_builtin_constant_p ();
3314 /* If -fexpensive-optimizations, re-run CSE to clean up things done
3316 if (flag_expensive_optimizations)
3318 timevar_push (TV_CSE);
3319 reg_scan (insns, max_reg_num (), 1);
3320 tem2 = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
3321 purge_all_dead_edges (0);
3322 delete_trivially_dead_insns (insns, max_reg_num ());
3323 timevar_pop (TV_CSE);
3324 cse_not_expected = !flag_rerun_cse_after_loop;
3327 /* If gcse or cse altered any jumps, rerun jump optimizations to clean
3328 things up. Then possibly re-run CSE again. */
3332 timevar_push (TV_JUMP);
3333 rebuild_jump_labels (insns);
3334 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
3335 timevar_pop (TV_JUMP);
3337 if (flag_expensive_optimizations)
3339 timevar_push (TV_CSE);
3340 reg_scan (insns, max_reg_num (), 1);
3341 tem2 = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
3342 purge_all_dead_edges (0);
3343 delete_trivially_dead_insns (insns, max_reg_num ());
3344 timevar_pop (TV_CSE);
3348 close_dump_file (DFI_gcse, print_rtl_with_bb, insns);
3349 timevar_pop (TV_GCSE);
3352 flag_cse_skip_blocks = save_csb;
3353 flag_cse_follow_jumps = save_cfj;
3354 #ifdef ENABLE_CHECKING
3355 verify_flow_info ();
3359 /* Move constant computations out of loops. */
3361 rest_of_handle_loop_optimize (tree decl, rtx insns)
3363 int do_unroll, do_prefetch;
3365 timevar_push (TV_LOOP);
3366 delete_dead_jumptables ();
3367 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
3368 open_dump_file (DFI_loop, decl);
3370 /* CFG is no longer maintained up-to-date. */
3371 free_bb_for_insn ();
3373 if (flag_unroll_loops)
3374 do_unroll = 0; /* Having two unrollers is useless. */
3376 do_unroll = flag_old_unroll_loops ? LOOP_UNROLL : LOOP_AUTO_UNROLL;
3377 do_prefetch = flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0;
3379 if (flag_rerun_loop_opt)
3381 cleanup_barriers ();
3383 /* We only want to perform unrolling once. */
3384 loop_optimize (insns, rtl_dump_file, do_unroll);
3387 /* The first call to loop_optimize makes some instructions
3388 trivially dead. We delete those instructions now in the
3389 hope that doing so will make the heuristics in loop work
3390 better and possibly speed up compilation. */
3391 delete_trivially_dead_insns (insns, max_reg_num ());
3393 /* The regscan pass is currently necessary as the alias
3394 analysis code depends on this information. */
3395 reg_scan (insns, max_reg_num (), 1);
3397 cleanup_barriers ();
3398 loop_optimize (insns, rtl_dump_file, do_unroll | LOOP_BCT | do_prefetch);
3400 /* Loop can create trivially dead instructions. */
3401 delete_trivially_dead_insns (insns, max_reg_num ());
3402 close_dump_file (DFI_loop, print_rtl, insns);
3403 timevar_pop (TV_LOOP);
3404 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3409 /* Perform loop optimalizations. It might be better to do them a bit
3410 sooner, but we want the profile feedback to work more
3413 rest_of_handle_loop2 (tree decl, rtx insns)
3415 struct loops *loops;
3416 timevar_push (TV_LOOP);
3417 open_dump_file (DFI_loop2, decl);
3419 dump_flow_info (rtl_dump_file);
3421 loops = loop_optimizer_init (rtl_dump_file);
3425 /* The optimalizations: */
3426 if (flag_unswitch_loops)
3427 unswitch_loops (loops);
3429 if (flag_peel_loops || flag_unroll_loops)
3430 unroll_and_peel_loops (loops,
3431 (flag_peel_loops ? UAP_PEEL : 0) |
3432 (flag_unroll_loops ? UAP_UNROLL : 0) |
3433 (flag_unroll_all_loops ? UAP_UNROLL_ALL : 0));
3435 loop_optimizer_finalize (loops, rtl_dump_file);
3438 cleanup_cfg (CLEANUP_EXPENSIVE);
3439 delete_trivially_dead_insns (insns, max_reg_num ());
3440 reg_scan (insns, max_reg_num (), 0);
3442 dump_flow_info (rtl_dump_file);
3443 close_dump_file (DFI_loop2, print_rtl_with_bb, get_insns ());
3444 timevar_pop (TV_LOOP);
3448 /* This is called from finish_function (within langhooks.parse_file)
3449 after each top-level definition is parsed.
3450 It is supposed to compile that function or variable
3451 and output the assembler code for it.
3452 After we return, the tree storage is freed. */
3455 rest_of_compilation (tree decl)
3458 int rebuild_label_notes_after_reload;
3460 timevar_push (TV_REST_OF_COMPILATION);
3462 /* Register rtl specific functions for cfg. */
3463 rtl_register_cfg_hooks ();
3465 /* Now that we're out of the frontend, we shouldn't have any more
3466 CONCATs anywhere. */
3467 generating_concat_p = 0;
3469 /* When processing delayed functions, prepare_function_start() won't
3470 have been run to re-initialize it. */
3471 cse_not_expected = ! optimize;
3473 /* First, make sure that NOTE_BLOCK is set correctly for each
3474 NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
3475 if (!cfun->x_whole_function_mode_p)
3478 /* In function-at-a-time mode, we do not attempt to keep the BLOCK
3479 tree in sensible shape. So, we just recalculate it here. */
3480 if (cfun->x_whole_function_mode_p)
3485 if (rest_of_handle_inlining (decl))
3486 goto exit_rest_of_compilation;
3488 /* If we're emitting a nested function, make sure its parent gets
3489 emitted as well. Doing otherwise confuses debug info. */
3492 for (parent = DECL_CONTEXT (current_function_decl);
3493 parent != NULL_TREE;
3494 parent = get_containing_scope (parent))
3495 if (TREE_CODE (parent) == FUNCTION_DECL)
3496 TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
3499 /* We are now committed to emitting code for this function. Do any
3500 preparation, such as emitting abstract debug info for the inline
3501 before it gets mangled by optimization. */
3502 if (DECL_INLINE (decl))
3503 (*debug_hooks->outlining_inline_function) (decl);
3505 /* Remove any notes we don't need. That will make iterating
3506 over the instruction sequence faster, and allow the garbage
3507 collector to reclaim the memory used by the notes. */
3508 remove_unnecessary_notes ();
3513 /* Initialize some variables used by the optimizers. */
3514 init_function_for_compilation ();
3516 if (! DECL_DEFER_OUTPUT (decl))
3517 TREE_ASM_WRITTEN (decl) = 1;
3519 /* Now that integrate will no longer see our rtl, we need not
3520 distinguish between the return value of this function and the
3521 return value of called functions. Also, we can remove all SETs
3522 of subregs of hard registers; they are only here because of
3523 integrate. Also, we can now initialize pseudos intended to
3524 carry magic hard reg data throughout the function. */
3525 rtx_equal_function_value_matters = 0;
3526 purge_hard_subreg_sets (get_insns ());
3528 /* Early return if there were errors. We can run afoul of our
3529 consistency checks, and there's not really much point in fixing them.
3530 Don't return yet if -Wreturn-type; we need to do cleanup_cfg. */
3531 if (((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
3532 || errorcount || sorrycount)
3533 goto exit_rest_of_compilation;
3535 timevar_push (TV_JUMP);
3536 open_dump_file (DFI_sibling, decl);
3537 insns = get_insns ();
3538 rebuild_jump_labels (insns);
3539 find_exception_handler_labels ();
3540 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3542 delete_unreachable_blocks ();
3544 /* We have to issue these warnings now already, because CFG cleanups
3545 further down may destroy the required information. */
3546 check_function_return_warnings ();
3548 /* Turn NOTE_INSN_PREDICTIONs into branch predictions. */
3549 if (flag_guess_branch_prob)
3551 timevar_push (TV_BRANCH_PROB);
3552 note_prediction_to_br_prob ();
3553 timevar_pop (TV_BRANCH_PROB);
3556 if (flag_optimize_sibling_calls)
3557 rest_of_handle_sibling_calls (insns);
3559 timevar_pop (TV_JUMP);
3561 insn_locators_initialize ();
3562 /* Complete generation of exception handling code. */
3565 timevar_push (TV_JUMP);
3566 open_dump_file (DFI_eh, decl);
3568 finish_eh_generation ();
3570 close_dump_file (DFI_eh, print_rtl, get_insns ());
3571 timevar_pop (TV_JUMP);
3574 /* Delay emitting hard_reg_initial_value sets until after EH landing pad
3575 generation, which might create new sets. */
3576 emit_initial_value_sets ();
3579 /* If we are doing position-independent code generation, now
3580 is the time to output special prologues and epilogues.
3581 We do not want to do this earlier, because it just clutters
3582 up inline functions with meaningless insns. */
3587 insns = get_insns ();
3589 /* Copy any shared structure that should not be shared. */
3590 unshare_all_rtl (current_function_decl, insns);
3592 #ifdef SETJMP_VIA_SAVE_AREA
3593 /* This must be performed before virtual register instantiation.
3594 Please be aware the everything in the compiler that can look
3595 at the RTL up to this point must understand that REG_SAVE_AREA
3596 is just like a use of the REG contained inside. */
3597 if (current_function_calls_alloca)
3598 optimize_save_area_alloca (insns);
3601 /* Instantiate all virtual registers. */
3602 instantiate_virtual_regs (current_function_decl, insns);
3604 open_dump_file (DFI_jump, decl);
3606 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
3607 are initialized and to compute whether control can drop off the end
3610 timevar_push (TV_JUMP);
3611 /* Turn NOTE_INSN_EXPECTED_VALUE into REG_BR_PROB. Do this
3612 before jump optimization switches branch directions. */
3613 if (flag_guess_branch_prob)
3614 expected_value_to_br_prob ();
3616 reg_scan (insns, max_reg_num (), 0);
3617 rebuild_jump_labels (insns);
3618 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3619 delete_trivially_dead_insns (insns, max_reg_num ());
3621 dump_flow_info (rtl_dump_file);
3622 cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP
3623 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
3627 free_bb_for_insn ();
3628 copy_loop_headers (insns);
3629 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3631 purge_line_number_notes (insns);
3633 timevar_pop (TV_JUMP);
3634 close_dump_file (DFI_jump, print_rtl, insns);
3636 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
3637 if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
3638 goto exit_rest_of_compilation;
3640 /* Long term, this should probably move before the jump optimizer too,
3641 but I didn't want to disturb the rtl_dump_and_exit and related
3642 stuff at this time. */
3643 if (optimize > 0 && flag_ssa)
3644 insns = rest_of_handle_ssa (decl, insns);
3646 timevar_push (TV_JUMP);
3649 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
3651 if (flag_delete_null_pointer_checks)
3652 rest_of_handle_null_pointer (decl, insns);
3654 /* Jump optimization, and the removal of NULL pointer checks, may
3655 have reduced the number of instructions substantially. CSE, and
3656 future passes, allocate arrays whose dimensions involve the
3657 maximum instruction UID, so if we can reduce the maximum UID
3658 we'll save big on memory. */
3659 renumber_insns (rtl_dump_file);
3660 timevar_pop (TV_JUMP);
3662 close_dump_file (DFI_jump, print_rtl_with_bb, insns);
3667 rest_of_handle_cse (decl, insns);
3669 rest_of_handle_addresof (decl, insns);
3676 rest_of_handle_gcse (decl, insns);
3678 if (flag_loop_optimize)
3679 rest_of_handle_loop_optimize (decl, insns);
3682 rest_of_handle_jump_bypass (decl, insns);
3685 timevar_push (TV_FLOW);
3687 rest_of_handle_cfg (decl, insns);
3690 || profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
3691 rest_of_handle_branch_prob (decl, insns);
3694 rest_of_handle_if_conversion (decl, insns);
3697 rest_of_handle_tracer (decl, insns);
3700 && (flag_unswitch_loops
3702 || flag_unroll_loops))
3703 rest_of_handle_loop2 (decl, insns);
3705 if (flag_rerun_cse_after_loop)
3706 rest_of_handle_cse2 (decl, insns);
3708 cse_not_expected = 1;
3710 rest_of_handle_life (decl, insns);
3713 rest_of_handle_combine (decl, insns);
3715 if (flag_if_conversion)
3716 rest_of_handle_if_after_combine (decl, insns);
3718 if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
3719 rest_of_handle_regmove (decl, insns);
3721 /* Do unconditional splitting before register allocation to allow machine
3722 description to add extra information not needed previously. */
3723 split_all_insns (1);
3725 #ifdef OPTIMIZE_MODE_SWITCHING
3726 timevar_push (TV_MODE_SWITCH);
3729 optimize_mode_switching (NULL);
3732 timevar_pop (TV_MODE_SWITCH);
3735 /* Any of the several passes since flow1 will have munged register
3736 lifetime data a bit. We need it to be up to date for scheduling
3737 (see handling of reg_known_equiv in init_alias_analysis). */
3738 recompute_reg_usage (insns, !optimize_size);
3740 rest_of_handle_sched (decl, insns);
3742 /* Determine if the current function is a leaf before running reload
3743 since this can impact optimizations done by the prologue and
3744 epilogue thus changing register elimination offsets. */
3745 current_function_is_leaf = leaf_function_p ();
3747 timevar_push (TV_LOCAL_ALLOC);
3748 open_dump_file (DFI_lreg, decl);
3750 if (flag_new_regalloc)
3752 if (rest_of_handle_new_regalloc (decl, insns,
3753 &rebuild_label_notes_after_reload))
3754 goto exit_rest_of_compilation;
3758 if (rest_of_handle_old_regalloc (decl, insns,
3759 &rebuild_label_notes_after_reload))
3760 goto exit_rest_of_compilation;
3765 open_dump_file (DFI_postreload, decl);
3767 /* Do a very simple CSE pass over just the hard registers. */
3770 timevar_push (TV_RELOAD_CSE_REGS);
3771 reload_cse_regs (insns);
3772 timevar_pop (TV_RELOAD_CSE_REGS);
3775 /* Register allocation and reloading may have turned an indirect jump into
3776 a direct jump. If so, we must rebuild the JUMP_LABEL fields of
3777 jumping instructions. */
3778 if (rebuild_label_notes_after_reload)
3780 timevar_push (TV_JUMP);
3782 rebuild_jump_labels (insns);
3783 purge_all_dead_edges (0);
3785 timevar_pop (TV_JUMP);
3788 close_dump_file (DFI_postreload, print_rtl_with_bb, insns);
3790 /* Re-create the death notes which were deleted during reload. */
3791 timevar_push (TV_FLOW2);
3792 open_dump_file (DFI_flow2, decl);
3794 #ifdef ENABLE_CHECKING
3795 verify_flow_info ();
3798 /* If optimizing, then go ahead and split insns now. */
3802 split_all_insns (0);
3805 cleanup_cfg (CLEANUP_EXPENSIVE);
3807 /* On some machines, the prologue and epilogue code, or parts thereof,
3808 can be represented as RTL. Doing so lets us schedule insns between
3809 it and the rest of the code and also allows delayed branch
3810 scheduling to operate in the epilogue. */
3811 thread_prologue_and_epilogue_insns (insns);
3815 life_analysis (insns, rtl_dump_file, PROP_FINAL);
3816 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE
3817 | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
3819 /* This is kind of a heuristic. We need to run combine_stack_adjustments
3820 even for machines with possibly nonzero RETURN_POPS_ARGS
3821 and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having
3822 push instructions will have popping returns. */
3823 #ifndef PUSH_ROUNDING
3824 if (!ACCUMULATE_OUTGOING_ARGS)
3826 combine_stack_adjustments ();
3831 flow2_completed = 1;
3833 close_dump_file (DFI_flow2, print_rtl_with_bb, insns);
3834 timevar_pop (TV_FLOW2);
3836 #ifdef HAVE_peephole2
3837 if (optimize > 0 && flag_peephole2)
3839 timevar_push (TV_PEEPHOLE2);
3840 open_dump_file (DFI_peephole2, decl);
3842 peephole2_optimize (rtl_dump_file);
3844 close_dump_file (DFI_peephole2, print_rtl_with_bb, insns);
3845 timevar_pop (TV_PEEPHOLE2);
3851 if (flag_rename_registers || flag_cprop_registers)
3852 rest_of_handle_regrename (decl, insns);
3854 rest_of_handle_reorder_blocks (decl, insns);
3857 if (flag_if_conversion2)
3859 timevar_push (TV_IFCVT2);
3860 open_dump_file (DFI_ce3, decl);
3864 close_dump_file (DFI_ce3, print_rtl_with_bb, insns);
3865 timevar_pop (TV_IFCVT2);
3868 #ifdef INSN_SCHEDULING
3869 if (optimize > 0 && flag_schedule_insns_after_reload)
3870 rest_of_handle_sched2 (decl, insns);
3873 #ifdef LEAF_REGISTERS
3874 current_function_uses_only_leaf_regs
3875 = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
3879 rest_of_handle_stack_regs (decl, insns);
3882 compute_alignments ();
3884 /* CFG is no longer maintained up-to-date. */
3885 free_bb_for_insn ();
3887 if (targetm.machine_dependent_reorg != 0)
3888 rest_of_handle_machine_reorg (decl, insns);
3890 purge_line_number_notes (insns);
3891 cleanup_barriers ();
3894 if (optimize > 0 && flag_delayed_branch)
3895 rest_of_handle_delay_slots (decl, insns);
3898 #if defined (HAVE_ATTR_length) && !defined (STACK_REGS)
3899 timevar_push (TV_SHORTEN_BRANCH);
3900 split_all_insns_noflow ();
3901 timevar_pop (TV_SHORTEN_BRANCH);
3904 convert_to_eh_region_ranges ();
3906 /* Shorten branches. */
3907 timevar_push (TV_SHORTEN_BRANCH);
3908 shorten_branches (get_insns ());
3909 timevar_pop (TV_SHORTEN_BRANCH);
3911 set_nothrow_function_flags ();
3912 if (current_function_nothrow)
3913 /* Now we know that this can't throw; set the flag for the benefit
3914 of other functions later in this translation unit. */
3915 TREE_NOTHROW (current_function_decl) = 1;
3917 rest_of_handle_final (decl, insns);
3919 /* Write DBX symbols if requested. */
3921 /* Note that for those inline functions where we don't initially
3922 know for certain that we will be generating an out-of-line copy,
3923 the first invocation of this routine (rest_of_compilation) will
3924 skip over this code by doing a `goto exit_rest_of_compilation;'.
3925 Later on, wrapup_global_declarations will (indirectly) call
3926 rest_of_compilation again for those inline functions that need
3927 to have out-of-line copies generated. During that call, we
3928 *will* be routed past here. */
3930 timevar_push (TV_SYMOUT);
3931 (*debug_hooks->function_decl) (decl);
3932 timevar_pop (TV_SYMOUT);
3934 exit_rest_of_compilation:
3936 coverage_end_function ();
3938 /* In case the function was not output,
3939 don't leave any temporary anonymous types
3940 queued up for sdb output. */
3941 #ifdef SDB_DEBUGGING_INFO
3942 if (write_symbols == SDB_DEBUG)
3943 sdbout_types (NULL_TREE);
3946 reload_completed = 0;
3947 flow2_completed = 0;
3950 timevar_push (TV_FINAL);
3952 /* Clear out the insn_length contents now that they are no
3954 init_insn_lengths ();
3956 /* Show no temporary slots allocated. */
3959 free_basic_block_vars (0);
3960 free_bb_for_insn ();
3962 timevar_pop (TV_FINAL);
3964 if ((*targetm.binds_local_p) (current_function_decl))
3966 int pref = cfun->preferred_stack_boundary;
3967 if (cfun->recursive_call_emit
3968 && cfun->stack_alignment_needed > cfun->preferred_stack_boundary)
3969 pref = cfun->stack_alignment_needed;
3970 cgraph_rtl_info (current_function_decl)->preferred_incoming_stack_boundary
3974 /* Make sure volatile mem refs aren't considered valid operands for
3975 arithmetic insns. We must call this here if this is a nested inline
3976 function, since the above code leaves us in the init_recog state
3977 (from final.c), and the function context push/pop code does not
3978 save/restore volatile_ok.
3980 ??? Maybe it isn't necessary for expand_start_function to call this
3981 anymore if we do it here? */
3983 init_recog_no_volatile ();
3985 /* We're done with this function. Free up memory if we can. */
3986 free_after_parsing (cfun);
3987 if (! DECL_DEFER_OUTPUT (decl))
3989 free_after_compilation (cfun);
3991 /* Clear integrate.c's pointer to the cfun structure we just
3993 DECL_SAVED_INSNS (decl) = 0;
3999 timevar_pop (TV_REST_OF_COMPILATION);
4002 /* Display help for generic options. */
4010 printf (_(" -ffixed-<register> Mark <register> as being unavailable to the compiler\n"));
4011 printf (_(" -fcall-used-<register> Mark <register> as being corrupted by function calls\n"));
4012 printf (_(" -fcall-saved-<register> Mark <register> as being preserved across functions\n"));
4013 printf (_(" -finline-limit=<number> Limits the size of inlined functions to <number>\n"));
4014 printf (_(" -fmessage-length=<number> Limits diagnostics messages lengths to <number> characters per line. 0 suppresses line-wrapping\n"));
4015 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"));
4016 printf (_(" -ftls-model=[global-dynamic | local-dynamic | initial-exec | local-exec] Indicates the default thread-local storage code generation model\n"));
4017 printf (_(" -fstack-limit-register=<register> Trap if the stack goes past <register>\n"));
4018 printf (_(" -fstack-limit-symbol=<name> Trap if the stack goes past symbol <name>\n"));
4019 printf (_(" -frandom-seed=<string> Make compile reproducible using <string>\n"));
4022 for (i = ARRAY_SIZE (f_options); i--;)
4024 const char *description = f_options[i].description;
4026 if (description != NULL && *description != 0)
4027 printf (" -f%-21s %s\n",
4028 f_options[i].string, _(description));
4031 printf (_(" -O[number] Set optimization level to [number]\n"));
4032 printf (_(" -Os Optimize for space rather than speed\n"));
4033 for (i = LAST_PARAM; i--;)
4035 const char *description = compiler_params[i].help;
4036 const int length = 21 - strlen (compiler_params[i].option);
4038 if (description != NULL && *description != 0)
4039 printf (" --param %s=<value>%.*s%s\n",
4040 compiler_params[i].option,
4041 length > 0 ? length : 1, " ",
4044 printf (_(" -pedantic Issue warnings needed by strict compliance to ISO C\n"));
4045 printf (_(" -pedantic-errors Like -pedantic except that errors are produced\n"));
4046 printf (_(" -w Suppress warnings\n"));
4048 for (i = ARRAY_SIZE (W_options); i--;)
4050 const char *description = W_options[i].description;
4052 if (description != NULL && *description != 0)
4053 printf (" -W%-21s %s\n",
4054 W_options[i].string, _(description));
4057 printf (_(" -Wextra Print extra (possibly unwanted) warnings\n"));
4058 printf (_(" -Wunused Enable unused warnings\n"));
4059 printf (_(" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n"));
4060 printf (_(" -p Enable function profiling\n"));
4061 printf (_(" -o <file> Place output into <file> \n"));
4063 -G <number> Put global and static data smaller than <number>\n\
4064 bytes into a special section (on some targets)\n"));
4066 for (i = ARRAY_SIZE (debug_args); i--;)
4068 if (debug_args[i].description != NULL)
4069 printf (" -g%-21s %s\n",
4070 debug_args[i].arg, _(debug_args[i].description));
4073 printf (_(" -aux-info <file> Emit declaration info into <file>\n"));
4074 printf (_(" -quiet Do not display functions compiled or elapsed time\n"));
4075 printf (_(" -version Display the compiler's version\n"));
4076 printf (_(" -d[letters] Enable dumps from specific passes of the compiler\n"));
4077 printf (_(" -dumpbase <file> Base name to be used for dumps from specific passes\n"));
4078 #if defined INSN_SCHEDULING
4079 printf (_(" -fsched-verbose=<number> Set the verbosity level of the scheduler\n"));
4081 printf (_(" --help Display this information\n"));
4086 /* Display descriptions of language specific options.
4087 If there is no description, note that there is an undocumented option.
4088 If the description is empty, do not display anything. (This allows
4089 options to be deliberately undocumented, for whatever reason).
4090 If the option string is missing, then this is a marker, indicating
4091 that the description string is in fact the name of a language, whose
4092 language specific options are to follow. */
4094 if (ARRAY_SIZE (documented_lang_options) > 1)
4096 printf (_("\nLanguage specific options:\n"));
4098 for (i = 0; i < ARRAY_SIZE (documented_lang_options); i++)
4100 const char *description = documented_lang_options[i].description;
4101 const char *option = documented_lang_options[i].option;
4103 if (description == NULL)
4108 printf (_(" %-23.23s [undocumented]\n"), option);
4110 else if (*description == 0)
4112 else if (option == NULL)
4116 (_("\nThere are undocumented %s specific options as well.\n"),
4120 printf (_("\n Options for %s:\n"), description);
4125 printf (" %-23.23s %s\n", option, _(description));
4130 printf (_("\nThere are undocumented %s specific options as well.\n"),
4133 display_target_options ();
4136 /* Display help for target options. */
4138 display_target_options (void)
4141 static bool displayed = false;
4143 /* Avoid double printing for --help --target-help. */
4149 if (ARRAY_SIZE (target_switches) > 1
4150 #ifdef TARGET_OPTIONS
4151 || ARRAY_SIZE (target_options) > 1
4159 printf (_("\nTarget specific options:\n"));
4161 for (i = ARRAY_SIZE (target_switches); i--;)
4163 const char *option = target_switches[i].name;
4164 const char *description = target_switches[i].description;
4166 if (option == NULL || *option == 0)
4168 else if (description == NULL)
4173 printf (_(" -m%-23.23s [undocumented]\n"), option);
4175 else if (*description != 0)
4176 doc += printf (" -m%-23.23s %s\n", option, _(description));
4179 #ifdef TARGET_OPTIONS
4180 for (i = ARRAY_SIZE (target_options); i--;)
4182 const char *option = target_options[i].prefix;
4183 const char *description = target_options[i].description;
4185 if (option == NULL || *option == 0)
4187 else if (description == NULL)
4192 printf (_(" -m%-23.23s [undocumented]\n"), option);
4194 else if (*description != 0)
4195 doc += printf (" -m%-23.23s %s\n", option, _(description));
4201 printf (_("\nThere are undocumented target specific options as well.\n"));
4203 printf (_(" They exist, but they are not documented.\n"));
4208 /* Parse a -d... command line switch. */
4211 decode_d_option (const char *arg)
4219 for (i = 0; i < (int) DFI_MAX; ++i)
4220 dump_file[i].enabled = 1;
4226 flag_print_asm_name = 1;
4229 flag_dump_rtl_in_asm = 1;
4230 flag_print_asm_name = 1;
4233 graph_dump_format = vcg;
4236 rtl_dump_and_exit = 1;
4241 case 'D': /* These are handled by the preprocessor. */
4245 setup_core_dumping();
4250 for (i = 0; i < (int) DFI_MAX; ++i)
4251 if (c == dump_file[i].debug_switch)
4253 dump_file[i].enabled = 1;
4258 warning ("unrecognized gcc debugging option: %c", c);
4263 /* Parse a -f... command line switch. ARG is the value after the -f.
4264 It is safe to access 'ARG - 2' to generate the full switch name.
4265 Return the number of strings consumed. */
4268 decode_f_option (const char *arg)
4271 const char *option_value = NULL;
4273 /* Search for the option in the table of binary f options. */
4274 for (j = ARRAY_SIZE (f_options); j--;)
4276 if (!strcmp (arg, f_options[j].string))
4278 *f_options[j].variable = f_options[j].on_value;
4282 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4283 && ! strcmp (arg + 3, f_options[j].string))
4285 *f_options[j].variable = ! f_options[j].on_value;
4290 if (!strcmp (arg, "fast-math"))
4291 set_fast_math_flags (1);
4292 else if (!strcmp (arg, "no-fast-math"))
4293 set_fast_math_flags (0);
4294 else if ((option_value = skip_leading_substring (arg, "inline-limit-"))
4295 || (option_value = skip_leading_substring (arg, "inline-limit=")))
4298 read_integral_parameter (option_value, arg - 2,
4300 set_param_value ("max-inline-insns", val);
4301 set_param_value ("max-inline-insns-single", val/2);
4302 set_param_value ("max-inline-insns-auto", val/2);
4303 set_param_value ("max-inline-insns-rtl", val);
4304 if (val/4 < MIN_INLINE_INSNS)
4307 set_param_value ("min-inline-insns", val/4);
4309 set_param_value ("min-inline-insns", 10);
4312 else if ((option_value = skip_leading_substring (arg, "tls-model=")))
4314 if (strcmp (option_value, "global-dynamic") == 0)
4315 flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
4316 else if (strcmp (option_value, "local-dynamic") == 0)
4317 flag_tls_default = TLS_MODEL_LOCAL_DYNAMIC;
4318 else if (strcmp (option_value, "initial-exec") == 0)
4319 flag_tls_default = TLS_MODEL_INITIAL_EXEC;
4320 else if (strcmp (option_value, "local-exec") == 0)
4321 flag_tls_default = TLS_MODEL_LOCAL_EXEC;
4323 warning ("`%s': unknown tls-model option", arg - 2);
4325 #ifdef INSN_SCHEDULING
4326 else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
4327 fix_sched_param ("verbose", option_value);
4329 else if ((option_value = skip_leading_substring (arg, "fixed-")))
4330 fix_register (option_value, 1, 1);
4331 else if ((option_value = skip_leading_substring (arg, "call-used-")))
4332 fix_register (option_value, 0, 1);
4333 else if ((option_value = skip_leading_substring (arg, "call-saved-")))
4334 fix_register (option_value, 0, 0);
4335 else if ((option_value = skip_leading_substring (arg, "align-loops=")))
4336 align_loops = read_integral_parameter (option_value, arg - 2, align_loops);
4337 else if ((option_value = skip_leading_substring (arg, "align-functions=")))
4339 = read_integral_parameter (option_value, arg - 2, align_functions);
4340 else if ((option_value = skip_leading_substring (arg, "align-jumps=")))
4341 align_jumps = read_integral_parameter (option_value, arg - 2, align_jumps);
4342 else if ((option_value = skip_leading_substring (arg, "align-labels=")))
4344 = read_integral_parameter (option_value, arg - 2, align_labels);
4345 else if ((option_value
4346 = skip_leading_substring (arg, "stack-limit-register=")))
4348 int reg = decode_reg_name (option_value);
4350 error ("unrecognized register name `%s'", option_value);
4352 stack_limit_rtx = gen_rtx_REG (Pmode, reg);
4354 else if ((option_value
4355 = skip_leading_substring (arg, "stack-limit-symbol=")))
4358 nm = ggc_strdup (option_value);
4359 stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
4361 else if ((option_value
4362 = skip_leading_substring (arg, "message-length=")))
4363 output_set_maximum_length
4364 (&global_dc->buffer, read_integral_parameter
4365 (option_value, arg - 2, diagnostic_line_cutoff (global_dc)));
4366 else if ((option_value
4367 = skip_leading_substring (arg, "diagnostics-show-location=")))
4369 if (!strcmp (option_value, "once"))
4370 diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
4371 else if (!strcmp (option_value, "every-line"))
4372 diagnostic_prefixing_rule (global_dc)
4373 = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
4375 error ("unrecognized option `%s'", arg - 2);
4377 else if (!strcmp (arg, "no-stack-limit"))
4378 stack_limit_rtx = NULL_RTX;
4379 else if ((option_value = skip_leading_substring (arg, "random-seed=")))
4380 flag_random_seed = option_value;
4381 else if (!strcmp (arg, "no-random-seed"))
4382 flag_random_seed = NULL;
4383 else if (!strcmp (arg, "preprocessed"))
4384 /* Recognize this switch but do nothing. This prevents warnings
4385 about an unrecognized switch if cpplib has not been linked in. */
4393 /* Parse a -W... command line switch. ARG is the value after the -W.
4394 It is safe to access 'ARG - 2' to generate the full switch name.
4395 Return the number of strings consumed. */
4398 decode_W_option (const char *arg)
4400 const char *option_value = NULL;
4403 /* Search for the option in the table of binary W options. */
4405 for (j = ARRAY_SIZE (W_options); j--;)
4407 if (!strcmp (arg, W_options[j].string))
4409 *W_options[j].variable = W_options[j].on_value;
4413 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4414 && ! strcmp (arg + 3, W_options[j].string))
4416 *W_options[j].variable = ! W_options[j].on_value;
4421 if ((option_value = skip_leading_substring (arg, "id-clash-")))
4422 warning ("-Wid-clash-LEN is no longer supported");
4423 else if ((option_value = skip_leading_substring (arg, "larger-than-")))
4425 larger_than_size = read_integral_parameter (option_value, arg - 2, -1);
4427 warn_larger_than = larger_than_size != -1;
4429 else if (!strcmp (arg, "unused"))
4433 else if (!strcmp (arg, "no-unused"))
4437 else if (!strcmp (arg, "extra"))
4441 else if (!strcmp (arg, "no-extra"))
4451 /* Indexed by enum debug_info_type. */
4452 const char *const debug_type_names[] =
4454 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff", "vms"
4457 /* Parse a -g... command line switch. ARG is the value after the -g.
4458 It is safe to access 'ARG - 2' to generate the full switch name.
4459 Return the number of strings consumed. */
4462 decode_g_option (const char *arg)
4464 static unsigned level = 0;
4465 /* A lot of code assumes write_symbols == NO_DEBUG if the
4466 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4467 of what debugging type has been selected). This records the
4468 selected type. It is an error to specify more than one
4470 static enum debug_info_type selected_debug_type = NO_DEBUG;
4471 /* Nonzero if debugging format has been explicitly set.
4472 -g and -ggdb don't explicitly set the debugging format so
4473 -gdwarf -g3 is equivalent to -gdwarf3. */
4474 static int type_explicitly_set_p = 0;
4476 /* The maximum admissible debug level value. */
4477 static const unsigned max_debug_level = 3;
4479 /* Look up ARG in the table. */
4480 for (da = debug_args; da->arg; da++)
4482 const int da_len = strlen (da->arg);
4484 if (da_len == 0 || ! strncmp (arg, da->arg, da_len))
4486 enum debug_info_type type = da->debug_type;
4487 const char *p = arg + da_len;
4489 if (*p && ! ISDIGIT (*p))
4492 /* A debug flag without a level defaults to level 2.
4493 Note we do not want to call read_integral_parameter
4494 for that case since it will call atoi which
4497 ??? We may want to generalize the interface to
4498 read_integral_parameter to better handle this case
4499 if this case shows up often. */
4501 level = read_integral_parameter (p, 0, max_debug_level + 1);
4503 level = (level == 0) ? 2 : level;
4505 if (da_len > 1 && *p && !strncmp (arg, "dwarf", da_len))
4507 error ("use -gdwarf -g%d for DWARF v1, level %d",
4510 error ("use -gdwarf-2 for DWARF v2");
4513 if (level > max_debug_level)
4516 ignoring option `%s' due to invalid debug level specification",
4518 level = debug_info_level;
4521 if (type == NO_DEBUG)
4523 type = PREFERRED_DEBUGGING_TYPE;
4525 if (da_len > 1 && strncmp (arg, "gdb", da_len) == 0)
4527 #ifdef DWARF2_DEBUGGING_INFO
4528 type = DWARF2_DEBUG;
4530 #ifdef DBX_DEBUGGING_INFO
4537 if (type == NO_DEBUG)
4538 warning ("`%s': unknown or unsupported -g option", arg - 2);
4540 /* Does it conflict with an already selected type? */
4541 if (type_explicitly_set_p
4542 /* -g/-ggdb don't conflict with anything. */
4543 && da->debug_type != NO_DEBUG
4544 && type != selected_debug_type)
4545 warning ("`%s' ignored, conflicts with `-g%s'",
4546 arg - 2, debug_type_names[(int) selected_debug_type]);
4549 /* If the format has already been set, -g/-ggdb
4550 only change the debug level. */
4551 if (type_explicitly_set_p && da->debug_type == NO_DEBUG)
4552 /* Don't change debugging type. */
4556 selected_debug_type = type;
4557 type_explicitly_set_p = da->debug_type != NO_DEBUG;
4560 write_symbols = (level == 0
4562 : selected_debug_type);
4563 use_gnu_debug_info_extensions = da->use_extensions_p;
4564 debug_info_level = (enum debug_info_level) level;
4577 /* Decode the first argument in the argv as a language-independent option.
4578 Return the number of strings consumed. */
4581 independent_decode_option (int argc, char **argv)
4583 char *arg = argv[0];
4585 if (arg[0] != '-' || arg[1] == 0)
4590 /* Handle '--param <name>=<value>'. */
4591 if (strcmp (arg, "-param") == 0)
4597 error ("-param option missing argument");
4601 /* Get the '<name>=<value>' parameter. */
4603 /* Look for the `='. */
4604 equal = strchr (arg, '=');
4606 error ("invalid --param option: %s", arg);
4611 /* Zero out the `=' sign so that we get two separate strings. */
4613 /* Figure out what value is specified. */
4614 val = read_integral_parameter (equal + 1, NULL, INVALID_PARAM_VAL);
4615 if (val != INVALID_PARAM_VAL)
4616 set_param_value (arg, val);
4618 error ("invalid parameter value `%s'", equal + 1);
4630 /* Already been treated in main (). Do nothing. */
4634 set_target_switch (arg + 1);
4638 return decode_f_option (arg + 1);
4641 return decode_g_option (arg + 1);
4644 /* For backward compatibility, -W is the same as -Wextra. */
4648 return decode_W_option (arg + 1);
4655 /* Decode -m switches. */
4656 /* Decode the switch -mNAME. */
4659 set_target_switch (const char *name)
4662 int valid_target_option = 0;
4664 for (j = 0; j < ARRAY_SIZE (target_switches); j++)
4665 if (!strcmp (target_switches[j].name, name))
4667 if (target_switches[j].value < 0)
4668 target_flags &= ~-target_switches[j].value;
4670 target_flags |= target_switches[j].value;
4673 if (target_switches[j].value < 0)
4674 target_flags_explicit |= -target_switches[j].value;
4676 target_flags_explicit |= target_switches[j].value;
4678 valid_target_option = 1;
4681 #ifdef TARGET_OPTIONS
4682 if (!valid_target_option)
4683 for (j = 0; j < ARRAY_SIZE (target_options); j++)
4685 int len = strlen (target_options[j].prefix);
4686 if (target_options[j].value)
4688 if (!strcmp (target_options[j].prefix, name))
4690 *target_options[j].variable = target_options[j].value;
4691 valid_target_option = 1;
4696 if (!strncmp (target_options[j].prefix, name, len))
4698 *target_options[j].variable = name + len;
4699 valid_target_option = 1;
4705 if (!valid_target_option)
4706 error ("invalid option `%s'", name);
4709 /* Print version information to FILE.
4710 Each line begins with INDENT (for the case where FILE is the
4711 assembler output file). */
4714 print_version (FILE *file, const char *indent)
4717 #define __VERSION__ "[?]"
4721 "%s%s%s version %s (%s)\n%s\tcompiled by GNU C version %s.\n"
4723 "%s%s%s version %s (%s) compiled by CC.\n"
4725 , indent, *indent != 0 ? " " : "",
4726 lang_hooks.name, version_string, TARGET_NAME,
4727 indent, __VERSION__);
4728 fnotice (file, "%s%sGGC heuristics: --param ggc-min-expand=%d --param ggc-min-heapsize=%d\n",
4729 indent, *indent != 0 ? " " : "",
4730 PARAM_VALUE (GGC_MIN_EXPAND), PARAM_VALUE (GGC_MIN_HEAPSIZE));
4733 /* Print an option value and return the adjusted position in the line.
4734 ??? We don't handle error returns from fprintf (disk full); presumably
4735 other code will catch a disk full though. */
4738 print_single_switch (FILE *file, int pos, int max,
4739 const char *indent, const char *sep, const char *term,
4740 const char *type, const char *name)
4742 /* The ultrix fprintf returns 0 on success, so compute the result we want
4743 here since we need it for the following test. */
4744 int len = strlen (sep) + strlen (type) + strlen (name);
4749 fprintf (file, "%s", term);
4754 fprintf (file, "%s", indent);
4755 pos = strlen (indent);
4757 fprintf (file, "%s%s%s", sep, type, name);
4762 /* Print active target switches to FILE.
4763 POS is the current cursor position and MAX is the size of a "line".
4764 Each line begins with INDENT and ends with TERM.
4765 Each switch is separated from the next by SEP. */
4768 print_switch_values (FILE *file, int pos, int max,
4769 const char *indent, const char *sep, const char *term)
4774 /* Fill in the -frandom-seed option, if the user didn't pass it, so
4775 that it can be printed below. This helps reproducibility. Of
4776 course, the string may never be used, but we can't tell that at
4777 this point in the compile. */
4778 default_flag_random_seed ();
4780 /* Print the options as passed. */
4782 pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
4783 _("options passed: "), "");
4785 for (p = &save_argv[1]; *p != NULL; p++)
4789 if (strcmp (*p, "-o") == 0)
4795 if (strcmp (*p, "-quiet") == 0)
4797 if (strcmp (*p, "-version") == 0)
4802 pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
4805 fprintf (file, "%s", term);
4807 /* Print the -f and -m options that have been enabled.
4808 We don't handle language specific options but printing argv
4811 pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
4812 _("options enabled: "), "");
4814 for (j = 0; j < ARRAY_SIZE (f_options); j++)
4815 if (*f_options[j].variable == f_options[j].on_value)
4816 pos = print_single_switch (file, pos, max, indent, sep, term,
4817 "-f", f_options[j].string);
4819 /* Print target specific options. */
4821 for (j = 0; j < ARRAY_SIZE (target_switches); j++)
4822 if (target_switches[j].name[0] != '\0'
4823 && target_switches[j].value > 0
4824 && ((target_switches[j].value & target_flags)
4825 == target_switches[j].value))
4827 pos = print_single_switch (file, pos, max, indent, sep, term,
4828 "-m", target_switches[j].name);
4831 #ifdef TARGET_OPTIONS
4832 for (j = 0; j < ARRAY_SIZE (target_options); j++)
4833 if (*target_options[j].variable != NULL)
4836 sprintf (prefix, "-m%s", target_options[j].prefix);
4837 pos = print_single_switch (file, pos, max, indent, sep, term,
4838 prefix, *target_options[j].variable);
4842 fprintf (file, "%s", term);
4845 /* Open assembly code output file. Do this even if -fsyntax-only is
4846 on, because then the driver will have provided the name of a
4847 temporary file or bit bucket for us. NAME is the file specified on
4848 the command line, possibly NULL. */
4850 init_asm_output (const char *name)
4852 if (name == NULL && asm_file_name == 0)
4853 asm_out_file = stdout;
4856 if (asm_file_name == 0)
4858 int len = strlen (dump_base_name);
4859 char *dumpname = (char *) xmalloc (len + 6);
4860 memcpy (dumpname, dump_base_name, len + 1);
4861 strip_off_ending (dumpname, len);
4862 strcat (dumpname, ".s");
4863 asm_file_name = dumpname;
4865 if (!strcmp (asm_file_name, "-"))
4866 asm_out_file = stdout;
4868 asm_out_file = fopen (asm_file_name, "w+");
4869 if (asm_out_file == 0)
4870 fatal_error ("can't open %s for writing: %m", asm_file_name);
4873 #ifdef IO_BUFFER_SIZE
4874 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
4875 _IOFBF, IO_BUFFER_SIZE);
4878 if (!flag_syntax_only)
4880 #ifdef ASM_FILE_START
4881 ASM_FILE_START (asm_out_file);
4884 #ifdef ASM_COMMENT_START
4885 if (flag_verbose_asm)
4887 /* Print the list of options in effect. */
4888 print_version (asm_out_file, ASM_COMMENT_START);
4889 print_switch_values (asm_out_file, 0, MAX_LINE,
4890 ASM_COMMENT_START, " ", "\n");
4891 /* Add a blank line here so it appears in assembler output but not
4893 fprintf (asm_out_file, "\n");
4899 /* Initialization of the front end environment, before command line
4900 options are parsed. Signal handlers, internationalization etc.
4901 ARGV0 is main's argv[0]. */
4903 general_init (char *argv0)
4907 p = argv0 + strlen (argv0);
4908 while (p != argv0 && !IS_DIR_SEPARATOR (p[-1]))
4912 xmalloc_set_program_name (progname);
4916 gcc_init_libintl ();
4918 /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */
4920 signal (SIGSEGV, crash_signal);
4923 signal (SIGILL, crash_signal);
4926 signal (SIGBUS, crash_signal);
4929 signal (SIGABRT, crash_signal);
4931 #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
4932 signal (SIGIOT, crash_signal);
4935 signal (SIGFPE, crash_signal);
4938 /* Other host-specific signal setup. */
4939 (*host_hooks.extra_signals)();
4941 /* Initialize the diagnostics reporting machinery, so option parsing
4942 can give warnings and errors. */
4943 diagnostic_initialize (global_dc);
4945 /* Initialize the garbage-collector, string pools and tree type hash
4952 /* Parse command line options and set default flag values, called
4953 after language-independent option-independent initialization. Do
4954 minimal options processing. Outputting diagnostics is OK, but GC
4955 and identifier hashtables etc. are not initialized yet.
4957 Return nonzero to suppress compiler back end initialization. */
4959 parse_options_and_default_flags (int argc, char **argv)
4963 /* Save in case md file wants to emit args as a comment. */
4967 /* Initialize register usage now so switches may override. */
4970 /* Register the language-independent parameters. */
4971 add_params (lang_independent_params, LAST_PARAM);
4973 /* This must be done after add_params but before argument processing. */
4974 init_ggc_heuristics();
4976 /* Perform language-specific options initialization. */
4977 lang_mask = (*lang_hooks.init_options) ();
4979 /* Scan to see what optimization level has been specified. That will
4980 determine the default value of many flags. */
4981 for (i = 1; i < argc; i++)
4983 if (!strcmp (argv[i], "-O"))
4988 else if (argv[i][0] == '-' && argv[i][1] == 'O')
4990 /* Handle -Os, -O2, -O3, -O69, ... */
4991 char *p = &argv[i][2];
4993 if ((p[0] == 's') && (p[1] == 0))
4997 /* Optimizing for size forces optimize to be 2. */
5002 const int optimize_val = read_integral_parameter (p, p - 2, -1);
5003 if (optimize_val != -1)
5005 optimize = optimize_val;
5014 flag_merge_constants = 0;
5020 flag_thread_jumps = 1;
5022 flag_delayed_branch = 1;
5024 #ifdef CAN_DEBUG_WITHOUT_FP
5025 flag_omit_frame_pointer = 1;
5027 flag_guess_branch_prob = 1;
5028 flag_cprop_registers = 1;
5029 flag_loop_optimize = 1;
5030 flag_crossjumping = 1;
5031 flag_if_conversion = 1;
5032 flag_if_conversion2 = 1;
5037 flag_optimize_sibling_calls = 1;
5038 flag_cse_follow_jumps = 1;
5039 flag_cse_skip_blocks = 1;
5041 flag_expensive_optimizations = 1;
5042 flag_strength_reduce = 1;
5043 flag_rerun_cse_after_loop = 1;
5044 flag_rerun_loop_opt = 1;
5045 flag_caller_saves = 1;
5048 #ifdef INSN_SCHEDULING
5049 flag_schedule_insns = 1;
5050 flag_schedule_insns_after_reload = 1;
5053 flag_strict_aliasing = 1;
5054 flag_delete_null_pointer_checks = 1;
5055 flag_reorder_blocks = 1;
5056 flag_reorder_functions = 1;
5061 flag_inline_functions = 1;
5062 flag_rename_registers = 1;
5063 flag_unswitch_loops = 1;
5064 flag_unit_at_a_time = 1;
5067 if (optimize < 2 || optimize_size)
5072 align_functions = 1;
5074 /* Don't reorder blocks when optimizing for size because extra
5075 jump insns may be created; also barrier may create extra padding.
5077 More correctly we should have a block reordering mode that tried
5078 to minimize the combined size of all the jumps. This would more
5079 or less automatically remove extra jumps, but would also try to
5080 use more short jumps instead of long jumps. */
5081 flag_reorder_blocks = 0;
5084 /* Initialize whether `char' is signed. */
5085 flag_signed_char = DEFAULT_SIGNED_CHAR;
5086 #ifdef DEFAULT_SHORT_ENUMS
5087 /* Initialize how much space enums occupy, by default. */
5088 flag_short_enums = DEFAULT_SHORT_ENUMS;
5091 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
5094 set_target_switch ("");
5096 /* Unwind tables are always present in an ABI-conformant IA-64
5097 object file, so the default should be ON. */
5098 #ifdef IA64_UNWIND_INFO
5099 flag_unwind_tables = IA64_UNWIND_INFO;
5102 #ifdef OPTIMIZATION_OPTIONS
5103 /* Allow default optimizations to be specified on a per-machine basis. */
5104 OPTIMIZATION_OPTIONS (optimize, optimize_size);
5107 /* Perform normal command line switch decoding. */
5108 for (i = 1; i < argc;)
5111 int indep_processed;
5113 /* Give the language a chance to decode the option for itself. */
5114 lang_processed = handle_option (argc - i, argv + i, lang_mask);
5116 if (lang_processed >= 0)
5117 /* Now see if the option also has a language independent meaning.
5118 Some options are both language specific and language independent,
5120 indep_processed = independent_decode_option (argc - i, argv + i);
5123 lang_processed = -lang_processed;
5124 indep_processed = 0;
5127 if (lang_processed || indep_processed)
5128 i += MAX (lang_processed, indep_processed);
5131 const char *option = NULL;
5132 const char *lang = NULL;
5135 /* It is possible that the command line switch is not valid for the
5136 current language, but it is valid for another language. In order
5137 to be compatible with previous versions of the compiler (which
5138 did not issue an error message in this case) we check for this
5139 possibility here. If we do find a match, then if extra_warnings
5140 is set we generate a warning message, otherwise we will just
5141 ignore the option. */
5142 for (j = 0; j < ARRAY_SIZE (documented_lang_options); j++)
5144 option = documented_lang_options[j].option;
5147 lang = documented_lang_options[j].description;
5148 else if (! strncmp (argv[i], option, strlen (option)))
5152 if (j != ARRAY_SIZE (documented_lang_options))
5156 warning ("ignoring command line option '%s'", argv[i]);
5159 ("(it is valid for %s but not the selected language)",
5163 else if (argv[i][0] == '-' && argv[i][1] == 'g')
5164 warning ("`%s': unknown or unsupported -g option", &argv[i][2]);
5166 error ("unrecognized option `%s'", argv[i]);
5173 flag_pic = flag_pie;
5174 if (flag_pic && !flag_pie)
5177 if (flag_no_inline == 2)
5180 flag_really_no_inline = flag_no_inline;
5182 /* Set flag_no_inline before the post_options () hook. The C front
5183 ends use it to determine tree inlining defaults. FIXME: such
5184 code should be lang-independent when all front ends use tree
5185 inlining, in which case it, and this condition, should be moved
5186 to the top of process_options() instead. */
5189 /* Inlining does not work if not optimizing,
5190 so force it not to be done. */
5194 /* The c_decode_option function and decode_option hook set
5195 this to `2' if -Wall is used, so we can avoid giving out
5196 lots of errors for people who don't realize what -Wall does. */
5197 if (warn_uninitialized == 1)
5198 warning ("-Wuninitialized is not supported without -O");
5201 if (flag_really_no_inline == 2)
5202 flag_really_no_inline = flag_no_inline;
5205 /* Process the options that have been parsed. */
5207 process_options (void)
5209 /* Allow the front end to perform consistency checks and do further
5210 initialization based on the command line options. This hook also
5211 sets the original filename if appropriate (e.g. foo.i -> foo.c)
5212 so we can correctly initialize debug output. */
5213 no_backend = (*lang_hooks.post_options) (&main_input_filename);
5214 input_filename = main_input_filename;
5216 #ifdef OVERRIDE_OPTIONS
5217 /* Some machines may reject certain combinations of options. */
5221 /* Set aux_base_name if not already set. */
5224 else if (main_input_filename)
5226 char *name = xstrdup (lbasename (main_input_filename));
5228 strip_off_ending (name, strlen (name));
5229 aux_base_name = name;
5232 aux_base_name = "gccaux";
5234 /* Set up the align_*_log variables, defaulting them to 1 if they
5235 were still unset. */
5236 if (align_loops <= 0) align_loops = 1;
5237 if (align_loops_max_skip > align_loops || !align_loops)
5238 align_loops_max_skip = align_loops - 1;
5239 align_loops_log = floor_log2 (align_loops * 2 - 1);
5240 if (align_jumps <= 0) align_jumps = 1;
5241 if (align_jumps_max_skip > align_jumps || !align_jumps)
5242 align_jumps_max_skip = align_jumps - 1;
5243 align_jumps_log = floor_log2 (align_jumps * 2 - 1);
5244 if (align_labels <= 0) align_labels = 1;
5245 align_labels_log = floor_log2 (align_labels * 2 - 1);
5246 if (align_labels_max_skip > align_labels || !align_labels)
5247 align_labels_max_skip = align_labels - 1;
5248 if (align_functions <= 0) align_functions = 1;
5249 align_functions_log = floor_log2 (align_functions * 2 - 1);
5251 /* Unrolling all loops implies that standard loop unrolling must also
5253 if (flag_unroll_all_loops)
5254 flag_unroll_loops = 1;
5256 if (flag_unroll_loops)
5258 flag_old_unroll_loops = 0;
5259 flag_old_unroll_all_loops = 0;
5262 if (flag_old_unroll_all_loops)
5263 flag_old_unroll_loops = 1;
5265 /* Old loop unrolling requires that strength_reduction be on also. Silently
5266 turn on strength reduction here if it isn't already on. Also, the loop
5267 unrolling code assumes that cse will be run after loop, so that must
5268 be turned on also. */
5269 if (flag_old_unroll_loops)
5271 flag_strength_reduce = 1;
5272 flag_rerun_cse_after_loop = 1;
5274 if (flag_unroll_loops || flag_peel_loops)
5275 flag_rerun_cse_after_loop = 1;
5277 if (flag_non_call_exceptions)
5278 flag_asynchronous_unwind_tables = 1;
5279 if (flag_asynchronous_unwind_tables)
5280 flag_unwind_tables = 1;
5282 /* Disable unit-at-a-time mode for frontends not supporting callgraph
5284 if (flag_unit_at_a_time && ! lang_hooks.callgraph.expand_function)
5285 flag_unit_at_a_time = 0;
5287 /* Warn about options that are not supported on this machine. */
5288 #ifndef INSN_SCHEDULING
5289 if (flag_schedule_insns || flag_schedule_insns_after_reload)
5290 warning ("instruction scheduling not supported on this target machine");
5293 if (flag_delayed_branch)
5294 warning ("this target machine does not have delayed branches");
5297 user_label_prefix = USER_LABEL_PREFIX;
5298 if (flag_leading_underscore != -1)
5300 /* If the default prefix is more complicated than "" or "_",
5301 issue a warning and ignore this option. */
5302 if (user_label_prefix[0] == 0 ||
5303 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
5305 user_label_prefix = flag_leading_underscore ? "_" : "";
5308 warning ("-f%sleading-underscore not supported on this target machine",
5309 flag_leading_underscore ? "" : "no-");
5312 /* If we are in verbose mode, write out the version and maybe all the
5313 option flags in use. */
5316 print_version (stderr, "");
5318 print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
5321 if (flag_syntax_only)
5323 write_symbols = NO_DEBUG;
5327 /* Now we know write_symbols, set up the debug hooks based on it.
5328 By default we do nothing for debug output. */
5329 #if defined(DBX_DEBUGGING_INFO)
5330 if (write_symbols == DBX_DEBUG)
5331 debug_hooks = &dbx_debug_hooks;
5333 #if defined(XCOFF_DEBUGGING_INFO)
5334 if (write_symbols == XCOFF_DEBUG)
5335 debug_hooks = &xcoff_debug_hooks;
5337 #ifdef SDB_DEBUGGING_INFO
5338 if (write_symbols == SDB_DEBUG)
5339 debug_hooks = &sdb_debug_hooks;
5341 #ifdef DWARF_DEBUGGING_INFO
5342 if (write_symbols == DWARF_DEBUG)
5343 debug_hooks = &dwarf_debug_hooks;
5345 #ifdef DWARF2_DEBUGGING_INFO
5346 if (write_symbols == DWARF2_DEBUG)
5347 debug_hooks = &dwarf2_debug_hooks;
5349 #ifdef VMS_DEBUGGING_INFO
5350 if (write_symbols == VMS_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
5351 debug_hooks = &vmsdbg_debug_hooks;
5354 /* If auxiliary info generation is desired, open the output file.
5355 This goes in the same directory as the source file--unlike
5356 all the other output files. */
5357 if (flag_gen_aux_info)
5359 aux_info_file = fopen (aux_info_file_name, "w");
5360 if (aux_info_file == 0)
5361 fatal_error ("can't open %s: %m", aux_info_file_name);
5364 if (! targetm.have_named_sections)
5366 if (flag_function_sections)
5368 warning ("-ffunction-sections not supported for this target");
5369 flag_function_sections = 0;
5371 if (flag_data_sections)
5373 warning ("-fdata-sections not supported for this target");
5374 flag_data_sections = 0;
5378 if (flag_function_sections && profile_flag)
5380 warning ("-ffunction-sections disabled; it makes profiling impossible");
5381 flag_function_sections = 0;
5384 #ifndef HAVE_prefetch
5385 if (flag_prefetch_loop_arrays)
5387 warning ("-fprefetch-loop-arrays not supported for this target");
5388 flag_prefetch_loop_arrays = 0;
5391 if (flag_prefetch_loop_arrays && !HAVE_prefetch)
5393 warning ("-fprefetch-loop-arrays not supported for this target (try -march switches)");
5394 flag_prefetch_loop_arrays = 0;
5398 /* This combination of options isn't handled for i386 targets and doesn't
5399 make much sense anyway, so don't allow it. */
5400 if (flag_prefetch_loop_arrays && optimize_size)
5402 warning ("-fprefetch-loop-arrays is not supported with -Os");
5403 flag_prefetch_loop_arrays = 0;
5406 #ifndef OBJECT_FORMAT_ELF
5407 if (flag_function_sections && write_symbols != NO_DEBUG)
5408 warning ("-ffunction-sections may affect debugging on some targets");
5411 /* The presence of IEEE signaling NaNs, implies all math can trap. */
5412 if (flag_signaling_nans)
5413 flag_trapping_math = 1;
5416 /* Initialize the compiler back end. */
5420 /* init_emit_once uses reg_raw_mode and therefore must be called
5421 after init_regs which initialized reg_raw_mode. */
5423 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
5424 || debug_info_level == DINFO_LEVEL_VERBOSE
5425 #ifdef VMS_DEBUGGING_INFO
5426 /* Enable line number info for traceback */
5427 || debug_info_level > DINFO_LEVEL_NONE
5429 || flag_test_coverage
5430 || warn_notreached);
5431 init_fake_stack_mems ();
5435 init_function_once ();
5436 init_varasm_once ();
5438 /* The following initialization functions need to generate rtl, so
5439 provide a dummy function context for them. */
5440 init_dummy_function_start ();
5442 if (flag_caller_saves)
5443 init_caller_save ();
5444 expand_dummy_function_end ();
5447 /* Language-dependent initialization. Returns nonzero on success. */
5449 lang_dependent_init (const char *name)
5451 if (dump_base_name == 0)
5452 dump_base_name = name ? name : "gccdump";
5454 /* Other front-end initialization. */
5455 if ((*lang_hooks.init) () == 0)
5458 init_asm_output (name);
5460 /* These create various _DECL nodes, so need to be called after the
5461 front end is initialized. */
5465 /* The following initialization functions need to generate rtl, so
5466 provide a dummy function context for them. */
5467 init_dummy_function_start ();
5469 expand_dummy_function_end ();
5471 /* If dbx symbol table desired, initialize writing it and output the
5472 predefined types. */
5473 timevar_push (TV_SYMOUT);
5475 #ifdef DWARF2_UNWIND_INFO
5476 if (dwarf2out_do_frame ())
5477 dwarf2out_frame_init ();
5480 /* Now we have the correct original filename, we can initialize
5482 (*debug_hooks->init) (name);
5484 timevar_pop (TV_SYMOUT);
5489 /* Clean up: close opened files, etc. */
5494 /* Close the dump files. */
5495 if (flag_gen_aux_info)
5497 fclose (aux_info_file);
5499 unlink (aux_info_file_name);
5502 /* Close non-debugging input and output files. Take special care to note
5503 whether fclose returns an error, since the pages might still be on the
5504 buffer chain while the file is open. */
5508 if (ferror (asm_out_file) != 0)
5509 fatal_error ("error writing to %s: %m", asm_file_name);
5510 if (fclose (asm_out_file) != 0)
5511 fatal_error ("error closing %s: %m", asm_file_name);
5514 /* Do whatever is necessary to finish printing the graphs. */
5515 if (graph_dump_format != no_graph)
5519 for (i = 0; i < (int) DFI_MAX; ++i)
5520 if (dump_file[i].initialized && dump_file[i].graph_dump_p)
5525 sprintf (seq, DUMPFILE_FORMAT, i);
5526 suffix = concat (seq, dump_file[i].extension, NULL);
5527 finish_graph_dump_file (dump_base_name, suffix);
5534 ggc_print_statistics ();
5535 stringpool_statistics ();
5536 dump_tree_statistics ();
5539 /* Free up memory for the benefit of leak detectors. */
5542 /* Language-specific end of compilation actions. */
5543 (*lang_hooks.finish) ();
5546 /* Initialize the compiler, and compile the input file. */
5550 /* Initialize timing first. The C front ends read the main file in
5551 the post_options hook, and C++ does file timings. */
5552 if (time_report || !quiet_flag || flag_detailed_statistics)
5554 timevar_start (TV_TOTAL);
5558 /* Don't do any more if an error has already occurred. */
5561 /* Set up the back-end if requested. */
5565 /* Language-dependent initialization. Returns true on success. */
5566 if (lang_dependent_init (main_input_filename))
5572 /* Stop timing and print the times. */
5573 timevar_stop (TV_TOTAL);
5574 timevar_print (stderr);
5577 /* Entry point of cc1, cc1plus, jc1, f771, etc.
5578 Decode command args, then call compile_file.
5579 Exit code is FATAL_EXIT_CODE if can't open files or if there were
5580 any errors, or SUCCESS_EXIT_CODE if compilation succeeded.
5582 It is not safe to call this function more than once. */
5585 toplev_main (int argc, char **argv)
5587 /* Initialization of GCC's environment, and diagnostics. */
5588 general_init (argv[0]);
5590 /* Parse the options and do minimal processing; basically just
5591 enough to default flags appropriately. */
5592 parse_options_and_default_flags (argc, argv);
5594 /* Exit early if we can (e.g. -help). */
5595 if (!exit_after_options)
5598 if (errorcount || sorrycount)
5599 return (FATAL_EXIT_CODE);
5601 return (SUCCESS_EXIT_CODE);