1 /* Top level of GNU C compiler
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
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. */
34 #ifdef HAVE_SYS_RESOURCE_H
35 # include <sys/resource.h>
38 #ifdef HAVE_SYS_TIMES_H
39 # include <sys/times.h>
47 #include "insn-attr.h"
48 #include "insn-codes.h"
49 #include "insn-config.h"
50 #include "hard-reg-set.h"
58 #include "basic-block.h"
65 #include "diagnostic.h"
68 #ifndef ACCUMULATE_OUTGOING_ARGS
69 #define ACCUMULATE_OUTGOING_ARGS 0
72 #ifdef DWARF_DEBUGGING_INFO
76 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
77 #include "dwarf2out.h"
80 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
84 #ifdef SDB_DEBUGGING_INFO
88 #ifdef XCOFF_DEBUGGING_INFO
93 /* The extra parameters substantially improve the I/O performance. */
96 vms_fopen (fname, type)
100 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
101 fixed arguments, which matches ANSI's specification but not VAXCRTL's
102 pre-ANSI implementation. This hack circumvents the mismatch problem. */
103 FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
106 return (*vmslib_fopen) (fname, type, "mbc=32",
107 "deq=64", "fop=tef", "shr=nil");
109 return (*vmslib_fopen) (fname, type, "mbc=32");
112 #define fopen vms_fopen
115 #ifndef DEFAULT_GDB_EXTENSIONS
116 #define DEFAULT_GDB_EXTENSIONS 1
119 /* If more than one debugging type is supported, you must define
120 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
122 This is one long line cause VAXC can't handle a \-newline. */
123 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
124 #ifndef PREFERRED_DEBUGGING_TYPE
125 You Lose! You must define PREFERRED_DEBUGGING_TYPE!
126 #endif /* no PREFERRED_DEBUGGING_TYPE */
127 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
128 so the following code needn't care. */
129 #ifdef DBX_DEBUGGING_INFO
130 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
132 #ifdef SDB_DEBUGGING_INFO
133 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
135 #ifdef DWARF_DEBUGGING_INFO
136 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
138 #ifdef DWARF2_DEBUGGING_INFO
139 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
141 #ifdef XCOFF_DEBUGGING_INFO
142 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
144 #endif /* More than one debugger format enabled. */
146 /* If still not defined, must have been because no debugging formats
148 #ifndef PREFERRED_DEBUGGING_TYPE
149 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
152 #if defined (HAVE_DECL_ENVIRON) && !HAVE_DECL_ENVIRON
153 extern char **environ;
156 /* Carry information from ASM_DECLARE_OBJECT_NAME
157 to ASM_FINISH_DECLARE_OBJECT. */
159 extern int size_directive_output;
160 extern tree last_assemble_variable_decl;
162 static void set_target_switch PARAMS ((const char *));
163 static const char *decl_name PARAMS ((tree, int));
165 static void float_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
166 static void crash_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
167 #ifdef ASM_IDENTIFY_LANGUAGE
168 /* This might or might not be used in ASM_IDENTIFY_LANGUAGE. */
169 static void output_lang_identify PARAMS ((FILE *)) ATTRIBUTE_UNUSED;
171 static void compile_file PARAMS ((const char *));
172 static void display_help PARAMS ((void));
173 static void display_target_options PARAMS ((void));
174 static void mark_file_stack PARAMS ((void *));
176 static void decode_d_option PARAMS ((const char *));
177 static int decode_f_option PARAMS ((const char *));
178 static int decode_W_option PARAMS ((const char *));
179 static int decode_g_option PARAMS ((const char *));
180 static unsigned int independent_decode_option PARAMS ((int, char **));
182 static void print_version PARAMS ((FILE *, const char *));
183 static int print_single_switch PARAMS ((FILE *, int, int, const char *,
184 const char *, const char *,
185 const char *, const char *));
186 static void print_switch_values PARAMS ((FILE *, int, int, const char *,
187 const char *, const char *));
189 /* Length of line when printing switch values. */
192 /* Name of program invoked, sans directories. */
194 const char *progname;
196 /* Copy of arguments to main. */
200 /* Name of current original source file (what was input to cpp).
201 This comes from each #-command in the actual input. */
203 const char *input_filename;
205 /* Name of top-level original source file (what was input to cpp).
206 This comes from the #-command at the beginning of the actual input.
207 If there isn't any there, then this is the cc1 input file name. */
209 const char *main_input_filename;
211 /* Current line number in real source file. */
215 /* Nonzero if it is unsafe to create any new pseudo registers. */
218 /* Stack of currently pending input files. */
220 struct file_stack *input_file_stack;
222 /* Incremented on each change to input_file_stack. */
223 int input_file_stack_tick;
225 /* Name to use as base of names for dump output files. */
227 const char *dump_base_name;
229 /* Bit flags that specify the machine subtype we are compiling for.
230 Bits are tested using macros TARGET_... defined in the tm.h file
231 and set by `-m...' switches. Must be defined in rtlanal.c. */
233 extern int target_flags;
235 /* Describes a dump file. */
237 struct dump_file_info
239 /* The unique extension to apply, e.g. ".jump". */
240 const char *const extension;
242 /* The -d<c> character that enables this dump file. */
243 char const debug_switch;
245 /* True if there is a corresponding graph dump file. */
246 char const graph_dump_p;
248 /* True if the user selected this dump. */
251 /* True if the files have been initialized (ie truncated). */
255 /* Enumerate the extant dump files. */
292 /* Describes all the dump files. Should be kept in order of the
293 pass and in sync with dump_file_index above.
295 Remaining -d letters:
301 struct dump_file_info dump_file[DFI_MAX] =
303 { "rtl", 'r', 0, 0, 0 },
304 { "sibling", 'i', 0, 0, 0 },
305 { "jump", 'j', 0, 0, 0 },
306 { "cse", 's', 0, 0, 0 },
307 { "addressof", 'F', 0, 0, 0 },
308 { "ssa", 'e', 1, 0, 0 },
309 { "dce", 'X', 1, 0, 0 },
310 { "ussa", 'e', 1, 0, 0 }, /* Yes, duplicate enable switch. */
311 { "gcse", 'G', 1, 0, 0 },
312 { "loop", 'L', 1, 0, 0 },
313 { "cse2", 't', 1, 0, 0 },
314 { "cfg", 'f', 1, 0, 0 },
315 { "bp", 'b', 1, 0, 0 },
316 { "life", 'f', 1, 0, 0 }, /* Yes, duplicate enable switch. */
317 { "combine", 'c', 1, 0, 0 },
318 { "ce", 'C', 1, 0, 0 },
319 { "regmove", 'N', 1, 0, 0 },
320 { "sched", 'S', 1, 0, 0 },
321 { "lreg", 'l', 1, 0, 0 },
322 { "greg", 'g', 1, 0, 0 },
323 { "flow2", 'w', 1, 0, 0 },
324 { "ce2", 'E', 1, 0, 0 },
325 { "peephole2", 'z', 1, 0, 0 },
326 { "rnreg", 'n', 1, 0, 0 },
327 { "sched2", 'R', 1, 0, 0 },
328 { "bbro", 'B', 1, 0, 0 },
329 { "jump2", 'J', 1, 0, 0 },
330 { "mach", 'M', 1, 0, 0 },
331 { "dbr", 'd', 0, 0, 0 },
332 { "stack", 'k', 1, 0, 0 },
335 static int open_dump_file PARAMS ((enum dump_file_index, tree));
336 static void close_dump_file PARAMS ((enum dump_file_index,
337 void (*) (FILE *, rtx), rtx));
339 /* Other flags saying which kinds of debugging dump have been requested. */
341 int rtl_dump_and_exit;
342 int flag_print_asm_name;
343 static int flag_print_mem;
344 static int version_flag;
345 static char *filename;
346 enum graph_dump_types graph_dump_format;
348 /* Name for output file of assembly code, specified with -o. */
352 /* Value of the -G xx switch, and whether it was passed or not. */
356 /* Type(s) of debugging information we are producing (if any).
357 See flags.h for the definitions of the different possible
358 types of debugging information. */
359 enum debug_info_type write_symbols = NO_DEBUG;
361 /* Level of debugging information we are producing. See flags.h
362 for the definitions of the different possible levels. */
363 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
365 /* Nonzero means use GNU-only extensions in the generated symbolic
366 debugging information. */
367 /* Currently, this only has an effect when write_symbols is set to
368 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
369 int use_gnu_debug_info_extensions = 0;
371 /* Nonzero means do optimizations. -O.
372 Particular numeric values stand for particular amounts of optimization;
373 thus, -O2 stores 2 here. However, the optimizations beyond the basic
374 ones are not controlled directly by this variable. Instead, they are
375 controlled by individual `flag_...' variables that are defaulted
376 based on this variable. */
380 /* Nonzero means optimize for size. -Os.
381 The only valid values are zero and non-zero. When optimize_size is
382 non-zero, optimize defaults to 2, but certain individual code
383 bloating optimizations are disabled. */
385 int optimize_size = 0;
387 /* Number of error messages and warning messages so far. */
390 int warningcount = 0;
393 /* The FUNCTION_DECL for the function currently being compiled,
394 or 0 if between functions. */
395 tree current_function_decl;
397 /* Set to the FUNC_BEGIN label of the current function, or NULL_TREE
399 tree current_function_func_begin_label;
401 /* Pointer to function to compute the name to use to print a declaration.
402 DECL is the declaration in question.
403 VERBOSITY determines what information will be printed:
404 0: DECL_NAME, demangled as necessary.
405 1: and scope information.
406 2: and any other information that might be interesting, such as function
407 parameter types in C++. */
409 const char *(*decl_printable_name) PARAMS ((tree, int));
411 /* Pointer to function to compute rtl for a language-specific tree code. */
413 typedef rtx (*lang_expand_expr_t)
414 PARAMS ((union tree_node *, rtx, enum machine_mode,
415 enum expand_modifier modifier));
417 lang_expand_expr_t lang_expand_expr = 0;
419 tree (*lang_expand_constant) PARAMS ((tree)) = 0;
421 /* Pointer to function to finish handling an incomplete decl at the
422 end of compilation. */
424 void (*incomplete_decl_finalize_hook) PARAMS ((tree)) = 0;
426 /* Nonzero if doing dwarf2 duplicate elimination. */
428 int flag_eliminate_dwarf2_dups = 0;
430 /* Nonzero if generating code to do profiling. */
432 int profile_flag = 0;
434 /* Nonzero if generating code to do profiling on a line-by-line basis. */
436 int profile_block_flag;
438 /* Nonzero if generating code to profile program flow graph arcs. */
440 int profile_arc_flag = 0;
442 /* Nonzero if generating info for gcov to calculate line test coverage. */
444 int flag_test_coverage = 0;
446 /* Nonzero indicates that branch taken probabilities should be calculated. */
448 int flag_branch_probabilities = 0;
450 /* Nonzero if basic blocks should be reordered. */
452 int flag_reorder_blocks = 0;
454 /* Nonzero if registers should be renamed. */
456 int flag_rename_registers = 0;
458 /* Nonzero for -pedantic switch: warn about anything
459 that standard spec forbids. */
463 /* Temporarily suppress certain warnings.
464 This is set while reading code from a system header file. */
466 int in_system_header = 0;
468 /* Don't print functions as they are compiled. -quiet. */
472 /* Print times taken by the various passes. -ftime-report. */
476 /* Print memory still in use at end of compilation (which may have little
477 to do with peak memory consumption). -fmem-report. */
481 /* Non-zero means to collect statistics which might be expensive
482 and to print them when we are done. */
483 int flag_detailed_statistics = 0;
488 /* Nonzero means `char' should be signed. */
490 int flag_signed_char;
492 /* Nonzero means give an enum type only as many bytes as it needs. */
494 int flag_short_enums;
496 /* Nonzero for -fcaller-saves: allocate values in regs that need to
497 be saved across function calls, if that produces overall better code.
498 Optional now, so people can test it. */
500 #ifdef DEFAULT_CALLER_SAVES
501 int flag_caller_saves = 1;
503 int flag_caller_saves = 0;
506 /* Nonzero if structures and unions should be returned in memory.
508 This should only be defined if compatibility with another compiler or
509 with an ABI is needed, because it results in slower code. */
511 #ifndef DEFAULT_PCC_STRUCT_RETURN
512 #define DEFAULT_PCC_STRUCT_RETURN 1
515 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
517 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
519 /* Nonzero for -fforce-mem: load memory value into a register
520 before arithmetic on it. This makes better cse but slower compilation. */
522 int flag_force_mem = 0;
524 /* Nonzero for -fforce-addr: load memory address into a register before
525 reference to memory. This makes better cse but slower compilation. */
527 int flag_force_addr = 0;
529 /* Nonzero for -fdefer-pop: don't pop args after each function call;
530 instead save them up to pop many calls' args with one insns. */
532 int flag_defer_pop = 0;
534 /* Nonzero for -ffloat-store: don't allocate floats and doubles
535 in extended-precision registers. */
537 int flag_float_store = 0;
539 /* Nonzero for -fcse-follow-jumps:
540 have cse follow jumps to do a more extensive job. */
542 int flag_cse_follow_jumps;
544 /* Nonzero for -fcse-skip-blocks:
545 have cse follow a branch around a block. */
546 int flag_cse_skip_blocks;
548 /* Nonzero for -fexpensive-optimizations:
549 perform miscellaneous relatively-expensive optimizations. */
550 int flag_expensive_optimizations;
552 /* Nonzero for -fthread-jumps:
553 have jump optimize output of loop. */
555 int flag_thread_jumps;
557 /* Nonzero enables strength-reduction in loop.c. */
559 int flag_strength_reduce = 0;
561 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
562 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
563 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
566 int flag_unroll_loops;
568 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
569 This is generally not a win. */
571 int flag_unroll_all_loops;
573 /* Nonzero forces all invariant computations in loops to be moved
576 int flag_move_all_movables = 0;
578 /* Nonzero forces all general induction variables in loops to be
581 int flag_reduce_all_givs = 0;
583 /* Nonzero to perform full register move optimization passes. This is the
586 int flag_regmove = 0;
588 /* Nonzero for -fwritable-strings:
589 store string constants in data segment and don't uniquize them. */
591 int flag_writable_strings = 0;
593 /* Nonzero means don't put addresses of constant functions in registers.
594 Used for compiling the Unix kernel, where strange substitutions are
595 done on the assembly output. */
597 int flag_no_function_cse = 0;
599 /* Nonzero for -fomit-frame-pointer:
600 don't make a frame pointer in simple functions that don't require one. */
602 int flag_omit_frame_pointer = 0;
604 /* Nonzero means place each function into its own section on those platforms
605 which support arbitrary section names and unlimited numbers of sections. */
607 int flag_function_sections = 0;
609 /* ... and similar for data. */
611 int flag_data_sections = 0;
613 /* Nonzero to inhibit use of define_optimization peephole opts. */
615 int flag_no_peephole = 0;
617 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
618 operations in the interest of optimization. For example it allows
619 GCC to assume arguments to sqrt are nonnegative numbers, allowing
620 faster code for sqrt to be generated. */
622 int flag_fast_math = 0;
624 /* Nonzero allows GCC to optimize sibling and tail recursive calls. */
626 int flag_optimize_sibling_calls = 0;
628 /* Nonzero means the front end generally wants `errno' maintained by math
629 operations, like built-in SQRT, unless overridden by flag_fast_math. */
631 int flag_errno_math = 1;
633 /* 0 means straightforward implementation of complex divide acceptable.
634 1 means wide ranges of inputs must work for complex divide.
635 2 means C9X-like requirements for complex divide (not yet implemented). */
637 int flag_complex_divide_method = 0;
639 /* Nonzero means all references through pointers are volatile. */
643 /* Nonzero means treat all global and extern variables as volatile. */
645 int flag_volatile_global;
647 /* Nonzero means treat all static variables as volatile. */
649 int flag_volatile_static;
651 /* Nonzero means just do syntax checking; don't output anything. */
653 int flag_syntax_only = 0;
655 /* Nonzero means perform global cse. */
657 static int flag_gcse;
659 /* Nonzero means to use global dataflow analysis to eliminate
660 useless null pointer tests. */
662 static int flag_delete_null_pointer_checks;
664 /* Nonzero means to rerun cse after loop optimization. This increases
665 compilation time about 20% and picks up a few more common expressions. */
667 static int flag_rerun_cse_after_loop;
669 /* Nonzero means to run loop optimizations twice. */
671 int flag_rerun_loop_opt;
673 /* Nonzero for -finline-functions: ok to inline functions that look like
674 good inline candidates. */
676 int flag_inline_functions;
678 /* Nonzero for -fkeep-inline-functions: even if we make a function
679 go inline everywhere, keep its definition around for debugging
682 int flag_keep_inline_functions;
684 /* Nonzero means that functions will not be inlined. */
688 /* Nonzero means that we should emit static const variables
689 regardless of whether or not optimization is turned on. */
691 int flag_keep_static_consts = 1;
693 /* Nonzero means we should be saving declaration info into a .X file. */
695 int flag_gen_aux_info = 0;
697 /* Specified name of aux-info file. */
699 static char *aux_info_file_name;
701 /* Nonzero means make the text shared if supported. */
703 int flag_shared_data;
705 /* Nonzero means schedule into delayed branch slots if supported. */
707 int flag_delayed_branch;
709 /* Nonzero if we are compiling pure (sharable) code.
710 Value is 1 if we are doing reasonable (i.e. simple
711 offset into offset table) pic. Value is 2 if we can
712 only perform register offsets. */
716 /* Nonzero means generate extra code for exception handling and enable
717 exception handling. */
721 /* Nonzero means use the new model for exception handling. Replaces
722 -DNEW_EH_MODEL as a compile option. */
724 int flag_new_exceptions = 1;
726 /* Nonzero means generate frame unwind info table when supported. */
728 int flag_unwind_tables = 0;
730 /* Nonzero means don't place uninitialized global data in common storage
735 /* Nonzero means pretend it is OK to examine bits of target floats,
736 even if that isn't true. The resulting code will have incorrect constants,
737 but the same series of instructions that the native compiler would make. */
739 int flag_pretend_float;
741 /* Nonzero means change certain warnings into errors.
742 Usually these are warnings about failure to conform to some standard. */
744 int flag_pedantic_errors = 0;
746 /* flag_schedule_insns means schedule insns within basic blocks (before
748 flag_schedule_insns_after_reload means schedule insns after
751 int flag_schedule_insns = 0;
752 int flag_schedule_insns_after_reload = 0;
754 /* The following flags have effect only for scheduling before register
757 flag_schedule_interblock means schedule insns accross basic blocks.
758 flag_schedule_speculative means allow speculative motion of non-load insns.
759 flag_schedule_speculative_load means allow speculative motion of some
761 flag_schedule_speculative_load_dangerous allows speculative motion of more
764 int flag_schedule_interblock = 1;
765 int flag_schedule_speculative = 1;
766 int flag_schedule_speculative_load = 0;
767 int flag_schedule_speculative_load_dangerous = 0;
769 int flag_single_precision_constant;
771 /* flag_branch_on_count_reg means try to replace add-1,compare,branch tupple
772 by a cheaper branch on a count register. */
773 int flag_branch_on_count_reg = 1;
775 /* -finhibit-size-directive inhibits output of .size for ELF.
776 This is used only for compiling crtstuff.c,
777 and it may be extended to other effects
778 needed for crtstuff.c on other systems. */
779 int flag_inhibit_size_directive = 0;
781 /* -fverbose-asm causes extra commentary information to be produced in
782 the generated assembly code (to make it more readable). This option
783 is generally only of use to those who actually need to read the
784 generated assembly code (perhaps while debugging the compiler itself).
785 -fno-verbose-asm, the default, causes the extra information
786 to be omitted and is useful when comparing two assembler files. */
788 int flag_verbose_asm = 0;
790 /* -dA causes debug commentary information to be produced in
791 the generated assembly code (to make it more readable). This option
792 is generally only of use to those who actually need to read the
793 generated assembly code (perhaps while debugging the compiler itself).
794 Currently, this switch is only used by dwarfout.c; however, it is intended
795 to be a catchall for printing debug information in the assembler file. */
797 int flag_debug_asm = 0;
799 /* -dP causes the rtl to be emitted as a comment in assembly. */
801 int flag_dump_rtl_in_asm = 0;
803 /* -fgnu-linker specifies use of the GNU linker for initializations.
804 (Or, more generally, a linker that handles initializations.)
805 -fno-gnu-linker says that collect2 will be used. */
807 int flag_gnu_linker = 0;
809 int flag_gnu_linker = 1;
815 /* Enable dead code elimination. */
818 /* Tag all structures with __attribute__(packed). */
819 int flag_pack_struct = 0;
821 /* Emit code to check for stack overflow; also may cause large objects
822 to be allocated dynamically. */
823 int flag_stack_check;
825 /* When non-NULL, indicates that whenever space is allocated on the
826 stack, the resulting stack pointer must not pass this
827 address---that is, for stacks that grow downward, the stack pointer
828 must always be greater than or equal to this address; for stacks
829 that grow upward, the stack pointer must be less than this address.
830 At present, the rtx may be either a REG or a SYMBOL_REF, although
831 the support provided depends on the backend. */
834 /* -fcheck-memory-usage causes extra code to be generated in order to check
835 memory accesses. This is used by a detector of bad memory accesses such
837 int flag_check_memory_usage = 0;
839 /* -fprefix-function-name causes function name to be prefixed. This
840 can be used with -fcheck-memory-usage to isolate code compiled with
841 -fcheck-memory-usage. */
842 int flag_prefix_function_name = 0;
844 /* 0 if pointer arguments may alias each other. True in C.
845 1 if pointer arguments may not alias each other but may alias
847 2 if pointer arguments may not alias each other and may not
848 alias global variables. True in Fortran.
849 This defaults to 0 for C. */
850 int flag_argument_noalias = 0;
852 /* Nonzero if we should do (language-dependent) alias analysis.
853 Typically, this analysis will assume that expressions of certain
854 types do not alias expressions of certain other types. Only used
855 if alias analysis (in general) is enabled. */
856 int flag_strict_aliasing = 0;
858 /* Instrument functions with calls at entry and exit, for profiling. */
859 int flag_instrument_function_entry_exit = 0;
861 /* Nonzero means ignore `#ident' directives. 0 means handle them.
862 On SVR4 targets, it also controls whether or not to emit a
863 string identifying the compiler. */
865 int flag_no_ident = 0;
867 /* This will perform a peephole pass before sched2. */
868 int flag_peephole2 = 0;
870 /* -fbounded-pointers causes gcc to compile pointers as composite
871 objects occupying three words: the pointer value, the base address
872 of the referent object, and the address immediately beyond the end
873 of the referent object. The base and extent allow us to perform
874 runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
875 int flag_bounded_pointers = 0;
877 /* -fcheck-bounds causes gcc to generate array bounds checks.
878 For C, C++: defaults to value of flag_bounded_pointers.
879 For ObjC: defaults to off.
880 For Java: defaults to on.
881 For Fortran: defaults to off.
882 For CHILL: defaults to off. */
883 int flag_bounds_check = 0;
885 /* If one, renumber instruction UIDs to reduce the number of
886 unused UIDs if there are a lot of instructions. If greater than
887 one, unconditionally renumber instruction UIDs. */
888 int flag_renumber_insns = 1;
890 /* Values of the -falign-* flags: how much to align labels in code.
891 0 means `use default', 1 means `don't align'.
892 For each variable, there is an _log variant which is the power
893 of two not less than the variable, for .align output. */
900 int align_labels_log;
902 int align_functions_log;
904 /* Table of supported debugging formats. */
908 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
909 constant expression, we use NO_DEBUG in its place. */
910 enum debug_info_type debug_type;
911 int use_extensions_p;
912 const char *description;
916 { "", NO_DEBUG, DEFAULT_GDB_EXTENSIONS,
917 "Generate default debug format output" },
918 { "gdb", NO_DEBUG, 1, "Generate default extended debug format output" },
919 #ifdef DBX_DEBUGGING_INFO
920 { "stabs", DBX_DEBUG, 0, "Generate STABS format debug output" },
921 { "stabs+", DBX_DEBUG, 1, "Generate extended STABS format debug output" },
923 #ifdef DWARF_DEBUGGING_INFO
924 { "dwarf", DWARF_DEBUG, 0, "Generate DWARF-1 format debug output"},
925 { "dwarf+", DWARF_DEBUG, 1,
926 "Generated extended DWARF-1 format debug output" },
928 #ifdef DWARF2_DEBUGGING_INFO
929 { "dwarf-2", DWARF2_DEBUG, 0, "Enable DWARF-2 debug output" },
931 #ifdef XCOFF_DEBUGGING_INFO
932 { "xcoff", XCOFF_DEBUG, 0, "Generate XCOFF format debug output" },
933 { "xcoff+", XCOFF_DEBUG, 1, "Generate extended XCOFF format debug output" },
935 #ifdef SDB_DEBUGGING_INFO
936 { "coff", SDB_DEBUG, 0, "Generate COFF format debug output" },
946 const char *description;
948 lang_independent_options;
950 /* Add or remove a leading underscore from user symbols. */
951 int flag_leading_underscore = -1;
953 /* The user symbol prefix after having resolved same. */
954 const char *user_label_prefix;
956 /* A default for same. */
957 #ifndef USER_LABEL_PREFIX
958 #define USER_LABEL_PREFIX ""
961 /* Table of language-independent -f options.
962 STRING is the option name. VARIABLE is the address of the variable.
963 ON_VALUE is the value to store in VARIABLE
964 if `-fSTRING' is seen as an option.
965 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
967 lang_independent_options f_options[] =
969 {"eliminate-dwarf2-dups", &flag_eliminate_dwarf2_dups, 1,
970 "Perform DWARF2 duplicate elimination"},
971 {"float-store", &flag_float_store, 1,
972 "Do not store floats in registers" },
973 {"volatile", &flag_volatile, 1,
974 "Consider all mem refs through pointers as volatile"},
975 {"volatile-global", &flag_volatile_global, 1,
976 "Consider all mem refs to global data to be volatile" },
977 {"volatile-static", &flag_volatile_static, 1,
978 "Consider all mem refs to static data to be volatile" },
979 {"defer-pop", &flag_defer_pop, 1,
980 "Defer popping functions args from stack until later" },
981 {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
982 "When possible do not generate stack frames"},
983 {"optimize-sibling-calls", &flag_optimize_sibling_calls, 1,
984 "Optimize sibling and tail recursive calls" },
985 {"cse-follow-jumps", &flag_cse_follow_jumps, 1,
986 "When running CSE, follow jumps to their targets" },
987 {"cse-skip-blocks", &flag_cse_skip_blocks, 1,
988 "When running CSE, follow conditional jumps" },
989 {"expensive-optimizations", &flag_expensive_optimizations, 1,
990 "Perform a number of minor, expensive optimisations" },
991 {"thread-jumps", &flag_thread_jumps, 1,
992 "Perform jump threading optimisations"},
993 {"strength-reduce", &flag_strength_reduce, 1,
994 "Perform strength reduction optimisations" },
995 {"unroll-loops", &flag_unroll_loops, 1,
996 "Perform loop unrolling when iteration count is known" },
997 {"unroll-all-loops", &flag_unroll_all_loops, 1,
998 "Perform loop unrolling for all loops" },
999 {"move-all-movables", &flag_move_all_movables, 1,
1000 "Force all loop invariant computations out of loops" },
1001 {"reduce-all-givs", &flag_reduce_all_givs, 1,
1002 "Strength reduce all loop general induction variables" },
1003 {"writable-strings", &flag_writable_strings, 1,
1004 "Store strings in writable data section" },
1005 {"peephole", &flag_no_peephole, 0,
1006 "Enable machine specific peephole optimisations" },
1007 {"force-mem", &flag_force_mem, 1,
1008 "Copy memory operands into registers before using" },
1009 {"force-addr", &flag_force_addr, 1,
1010 "Copy memory address constants into regs before using" },
1011 {"function-cse", &flag_no_function_cse, 0,
1012 "Allow function addresses to be held in registers" },
1013 {"inline-functions", &flag_inline_functions, 1,
1014 "Integrate simple functions into their callers" },
1015 {"keep-inline-functions", &flag_keep_inline_functions, 1,
1016 "Generate code for funcs even if they are fully inlined" },
1017 {"inline", &flag_no_inline, 0,
1018 "Pay attention to the 'inline' keyword"},
1019 {"keep-static-consts", &flag_keep_static_consts, 1,
1020 "Emit static const variables even if they are not used" },
1021 {"syntax-only", &flag_syntax_only, 1,
1022 "Check for syntax errors, then stop" },
1023 {"shared-data", &flag_shared_data, 1,
1024 "Mark data as shared rather than private" },
1025 {"caller-saves", &flag_caller_saves, 1,
1026 "Enable saving registers around function calls" },
1027 {"pcc-struct-return", &flag_pcc_struct_return, 1,
1028 "Return 'short' aggregates in memory, not registers" },
1029 {"reg-struct-return", &flag_pcc_struct_return, 0,
1030 "Return 'short' aggregates in registers" },
1031 {"delayed-branch", &flag_delayed_branch, 1,
1032 "Attempt to fill delay slots of branch instructions" },
1033 {"gcse", &flag_gcse, 1,
1034 "Perform the global common subexpression elimination" },
1035 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
1036 "Run CSE pass after loop optimisations"},
1037 {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
1038 "Run the loop optimiser twice"},
1039 {"delete-null-pointer-checks", &flag_delete_null_pointer_checks, 1,
1040 "Delete useless null pointer checks" },
1041 {"pretend-float", &flag_pretend_float, 1,
1042 "Pretend that host and target use the same FP format"},
1043 {"schedule-insns", &flag_schedule_insns, 1,
1044 "Reschedule instructions to avoid pipeline stalls"},
1045 {"schedule-insns2", &flag_schedule_insns_after_reload, 1,
1046 "Run two passes of the instruction scheduler"},
1047 {"sched-interblock",&flag_schedule_interblock, 1,
1048 "Enable scheduling across basic blocks" },
1049 {"sched-spec",&flag_schedule_speculative, 1,
1050 "Allow speculative motion of non-loads" },
1051 {"sched-spec-load",&flag_schedule_speculative_load, 1,
1052 "Allow speculative motion of some loads" },
1053 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
1054 "Allow speculative motion of more loads" },
1055 {"branch-count-reg",&flag_branch_on_count_reg, 1,
1056 "Replace add,compare,branch with branch on count reg"},
1057 {"pic", &flag_pic, 1,
1058 "Generate position independent code, if possible"},
1059 {"PIC", &flag_pic, 2, ""},
1060 {"exceptions", &flag_exceptions, 1,
1061 "Enable exception handling" },
1062 {"new-exceptions", &flag_new_exceptions, 1,
1063 "Use the new model for exception handling" },
1064 {"unwind-tables", &flag_unwind_tables, 1,
1065 "Just generate unwind tables for exception handling" },
1066 {"sjlj-exceptions", &exceptions_via_longjmp, 1,
1067 "Use setjmp/longjmp to handle exceptions" },
1068 {"asynchronous-exceptions", &asynchronous_exceptions, 1,
1069 "Support asynchronous exceptions" },
1070 {"profile-arcs", &profile_arc_flag, 1,
1071 "Insert arc based program profiling code" },
1072 {"test-coverage", &flag_test_coverage, 1,
1073 "Create data files needed by gcov" },
1074 {"branch-probabilities", &flag_branch_probabilities, 1,
1075 "Use profiling information for branch probabilities" },
1076 {"reorder-blocks", &flag_reorder_blocks, 1,
1077 "Reorder basic blocks to improve code placement" },
1078 {"rename-registers", &flag_rename_registers, 1,
1079 "Do the register renaming optimization pass"},
1080 {"fast-math", &flag_fast_math, 1,
1081 "Improve FP speed by violating ANSI & IEEE rules" },
1082 {"common", &flag_no_common, 0,
1083 "Do not put unitialised globals in the common section" },
1084 {"inhibit-size-directive", &flag_inhibit_size_directive, 1,
1085 "Do not generate .size directives" },
1086 {"function-sections", &flag_function_sections, 1,
1087 "place each function into its own section" },
1088 {"data-sections", &flag_data_sections, 1,
1089 "place data items into their own section" },
1090 {"verbose-asm", &flag_verbose_asm, 1,
1091 "Add extra commentry to assembler output"},
1092 {"gnu-linker", &flag_gnu_linker, 1,
1093 "Output GNU ld formatted global initialisers"},
1094 {"regmove", &flag_regmove, 1,
1095 "Enables a register move optimisation"},
1096 {"optimize-register-move", &flag_regmove, 1,
1097 "Do the full regmove optimization pass"},
1098 {"pack-struct", &flag_pack_struct, 1,
1099 "Pack structure members together without holes" },
1100 {"stack-check", &flag_stack_check, 1,
1101 "Insert stack checking code into the program" },
1102 {"argument-alias", &flag_argument_noalias, 0,
1103 "Specify that arguments may alias each other & globals"},
1104 {"argument-noalias", &flag_argument_noalias, 1,
1105 "Assume arguments may alias globals but not each other"},
1106 {"argument-noalias-global", &flag_argument_noalias, 2,
1107 "Assume arguments do not alias each other or globals" },
1108 {"strict-aliasing", &flag_strict_aliasing, 1,
1109 "Assume strict aliasing rules apply" },
1110 {"align-loops", &align_loops, 0,
1111 "Align the start of loops" },
1112 {"align-jumps", &align_jumps, 0,
1113 "Align labels which are only reached by jumping" },
1114 {"align-labels", &align_labels, 0,
1115 "Align all labels" },
1116 {"align-functions", &align_functions, 0,
1117 "Align the start of functions" },
1118 {"check-memory-usage", &flag_check_memory_usage, 1,
1119 "Generate code to check every memory access" },
1120 {"prefix-function-name", &flag_prefix_function_name, 1,
1121 "Add a prefix to all function names" },
1122 {"dump-unnumbered", &flag_dump_unnumbered, 1,
1123 "Suppress output of instruction numbers and line number notes in debugging dumps"},
1124 {"instrument-functions", &flag_instrument_function_entry_exit, 1,
1125 "Instrument function entry/exit with profiling calls"},
1126 {"ssa", &flag_ssa, 1,
1127 "Enable SSA optimizations" },
1128 {"dce", &flag_dce, 1,
1129 "Enable dead code elimination" },
1130 {"leading-underscore", &flag_leading_underscore, 1,
1131 "External symbols have a leading underscore" },
1132 {"ident", &flag_no_ident, 0,
1133 "Process #ident directives"},
1134 { "peephole2", &flag_peephole2, 1,
1135 "Enables an rtl peephole pass run before sched2" },
1136 {"math-errno", &flag_errno_math, 1,
1137 "Set errno after built-in math functions"},
1138 {"bounded-pointers", &flag_bounded_pointers, 1,
1139 "Compile pointers as triples: value, base & end" },
1140 {"bounds-check", &flag_bounds_check, 1,
1141 "Generate code to check bounds before dereferencing pointers and arrays" },
1142 {"single-precision-constant", &flag_single_precision_constant, 1,
1143 "Convert floating point constant to single precision constant"},
1144 {"time-report", &time_report, 1,
1145 "Report time taken by each compiler pass at end of run"},
1146 {"mem-report", &mem_report, 1,
1147 "Report on permanent memory allocation at end of run"},
1150 /* Table of language-specific options. */
1152 static struct lang_opt
1155 const char *description;
1157 documented_lang_options[] =
1159 /* In order not to overload the --help output, the convention
1160 used here is to only describe those options which are not
1161 enabled by default. */
1163 { "-ansi", "Compile just for ISO C89" },
1164 { "-fallow-single-precision",
1165 "Do not promote floats to double if using -traditional" },
1166 { "-std= ", "Determine language standard"},
1168 { "-fsigned-bitfields", "" },
1169 { "-funsigned-bitfields","Make bitfields by unsigned by default" },
1170 { "-fno-signed-bitfields", "" },
1171 { "-fno-unsigned-bitfields","" },
1172 { "-fsigned-char", "Make 'char' be signed by default"},
1173 { "-funsigned-char", "Make 'char' be unsigned by default"},
1174 { "-fno-signed-char", "" },
1175 { "-fno-unsigned-char", "" },
1177 { "-ftraditional", "" },
1178 { "-traditional", "Attempt to support traditional K&R style C"},
1179 { "-fnotraditional", "" },
1180 { "-fno-traditional", "" },
1183 { "-fno-asm", "Do not recognise the 'asm' keyword" },
1184 { "-fbuiltin", "" },
1185 { "-fno-builtin", "Do not recognise any built in functions" },
1186 { "-fhosted", "Assume normal C execution environment" },
1187 { "-fno-hosted", "" },
1189 "Assume that standard libraries & main might not exist" },
1190 { "-fno-freestanding", "" },
1191 { "-fcond-mismatch", "Allow different types as args of ? operator"},
1192 { "-fno-cond-mismatch", "" },
1193 { "-fdollars-in-identifiers", "Allow the use of $ inside identifiers" },
1194 { "-fno-dollars-in-identifiers", "" },
1195 { "-fpreprocessed", "" },
1196 { "-fno-preprocessed", "" },
1197 { "-fshort-double", "Use the same size for double as for float" },
1198 { "-fno-short-double", "" },
1199 { "-fshort-enums", "Use the smallest fitting integer to hold enums"},
1200 { "-fno-short-enums", "" },
1201 { "-fshort-wchar", "Override the underlying type for wchar_t to `unsigned short'" },
1202 { "-fno-short-wchar", "" },
1204 { "-Wall", "Enable most warning messages" },
1205 { "-Wbad-function-cast",
1206 "Warn about casting functions to incompatible types" },
1207 { "-Wno-bad-function-cast", "" },
1208 { "-Wmissing-noreturn",
1209 "Warn about functions which might be candidates for attribute noreturn" },
1210 { "-Wno-missing-noreturn", "" },
1211 { "-Wmissing-format-attribute",
1212 "Warn about functions which might be candidates for format attributes" },
1213 { "-Wno-missing-format-attribute", "" },
1214 { "-Wcast-qual", "Warn about casts which discard qualifiers"},
1215 { "-Wno-cast-qual", "" },
1216 { "-Wchar-subscripts", "Warn about subscripts whose type is 'char'"},
1217 { "-Wno-char-subscripts", "" },
1218 { "-Wcomment", "Warn if nested comments are detected" },
1219 { "-Wno-comment", "" },
1220 { "-Wcomments", "Warn if nested comments are detected" },
1221 { "-Wno-comments", "" },
1222 { "-Wconversion", "Warn about possibly confusing type conversions" },
1223 { "-Wno-conversion", "" },
1224 { "-Wformat", "Warn about printf format anomalies" },
1225 { "-Wno-format", "" },
1226 { "-Wimplicit-function-declaration",
1227 "Warn about implicit function declarations" },
1228 { "-Wno-implicit-function-declaration", "" },
1229 { "-Werror-implicit-function-declaration", "" },
1230 { "-Wimplicit-int", "Warn when a declaration does not specify a type" },
1231 { "-Wno-implicit-int", "" },
1232 { "-Wimplicit", "" },
1233 { "-Wno-implicit", "" },
1234 { "-Wimport", "Warn about the use of the #import directive" },
1235 { "-Wno-import", "" },
1236 { "-Wlong-long","" },
1237 { "-Wno-long-long", "Do not warn about using 'long long' when -pedantic" },
1238 { "-Wmain", "Warn about suspicious declarations of main" },
1239 { "-Wno-main", "" },
1240 { "-Wmissing-braces",
1241 "Warn about possibly missing braces around initialisers" },
1242 { "-Wno-missing-braces", "" },
1243 { "-Wmissing-declarations",
1244 "Warn about global funcs without previous declarations"},
1245 { "-Wno-missing-declarations", "" },
1246 { "-Wmissing-prototypes", "Warn about global funcs without prototypes" },
1247 { "-Wno-missing-prototypes", "" },
1248 { "-Wmultichar", "Warn about use of multicharacter literals"},
1249 { "-Wno-multichar", "" },
1250 { "-Wnested-externs", "Warn about externs not at file scope level" },
1251 { "-Wno-nested-externs", "" },
1252 { "-Wparentheses", "Warn about possible missing parentheses" },
1253 { "-Wno-parentheses", "" },
1254 { "-Wsequence-point",
1255 "Warn about possible violations of sequence point rules" },
1256 { "-Wno-sequence-point", "" },
1257 { "-Wpointer-arith", "Warn about function pointer arithmetic" },
1258 { "-Wno-pointer-arith", "" },
1259 { "-Wredundant-decls",
1260 "Warn about multiple declarations of the same object" },
1261 { "-Wno-redundant-decls", "" },
1262 { "-Wsign-compare", "Warn about signed/unsigned comparisons" },
1263 { "-Wno-sign-compare", "" },
1264 { "-Wfloat-equal", "Warn about testing equality of floating point numbers" },
1265 { "-Wno-float-equal", "" },
1266 { "-Wunknown-pragmas", "Warn about unrecognized pragmas" },
1267 { "-Wno-unknown-pragmas", "" },
1268 { "-Wstrict-prototypes", "Warn about non-prototyped function decls" },
1269 { "-Wno-strict-prototypes", "" },
1270 { "-Wtraditional", "Warn about constructs whose meaning change in ISO C"},
1271 { "-Wno-traditional", "" },
1272 { "-Wtrigraphs", "Warn when trigraphs are encountered" },
1273 { "-Wno-trigraphs", "" },
1275 { "-Wno-undef", "" },
1276 { "-Wwrite-strings", "Mark strings as 'const char *'"},
1277 { "-Wno-write-strings", "" },
1279 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1281 #include "options.h"
1285 /* Here is a table, controlled by the tm.h file, listing each -m switch
1286 and which bits in `target_switches' it should set or clear.
1287 If VALUE is positive, it is bits to set.
1288 If VALUE is negative, -VALUE is bits to clear.
1289 (The sign bit is not used so there is no confusion.) */
1295 const char *description;
1297 target_switches [] = TARGET_SWITCHES;
1299 /* This table is similar, but allows the switch to have a value. */
1301 #ifdef TARGET_OPTIONS
1305 const char **variable;
1306 const char *description;
1308 target_options [] = TARGET_OPTIONS;
1311 /* Options controlling warnings. */
1313 /* Don't print warning messages. -w. */
1315 int inhibit_warnings = 0;
1317 /* Don't suppress warnings from system headers. -Wsystem-headers. */
1319 int warn_system_headers = 0;
1321 /* Print various extra warnings. -W. */
1323 int extra_warnings = 0;
1325 /* Treat warnings as errors. -Werror. */
1327 int warnings_are_errors = 0;
1329 /* Nonzero to warn about unused variables, functions et.al. */
1331 int warn_unused_function;
1332 int warn_unused_label;
1333 int warn_unused_parameter;
1334 int warn_unused_variable;
1335 int warn_unused_value;
1338 set_Wunused (setting)
1341 warn_unused_function = setting;
1342 warn_unused_label = setting;
1343 /* Unused function parameter warnings are reported when either ``-W
1344 -Wunused'' or ``-Wunused-parameter'' is specified. Differentiate
1345 -Wunused by setting WARN_UNUSED_PARAMETER to -1. */
1347 warn_unused_parameter = 0;
1348 else if (!warn_unused_parameter)
1349 warn_unused_parameter = -1;
1350 warn_unused_variable = setting;
1351 warn_unused_value = setting;
1354 /* Nonzero to warn about code which is never reached. */
1356 int warn_notreached;
1358 /* Nonzero to warn about variables used before they are initialized. */
1360 int warn_uninitialized;
1362 /* Nonzero means warn about all declarations which shadow others. */
1366 /* Warn if a switch on an enum fails to have a case for every enum value. */
1370 /* Nonzero means warn about function definitions that default the return type
1371 or that use a null return and have a return-type other than void. */
1373 int warn_return_type;
1375 /* Nonzero means warn about pointer casts that increase the required
1376 alignment of the target type (and might therefore lead to a crash
1377 due to a misaligned access). */
1379 int warn_cast_align;
1381 /* Nonzero means warn about any identifiers that match in the first N
1382 characters. The value N is in `id_clash_len'. */
1387 /* Nonzero means warn about any objects definitions whose size is larger
1388 than N bytes. Also want about function definitions whose returned
1389 values are larger than N bytes. The value N is in `larger_than_size'. */
1391 int warn_larger_than;
1392 HOST_WIDE_INT larger_than_size;
1394 /* Nonzero means warn if inline function is too large. */
1398 /* Warn if a function returns an aggregate,
1399 since there are often incompatible calling conventions for doing this. */
1401 int warn_aggregate_return;
1403 /* Warn if packed attribute on struct is unnecessary and inefficient. */
1407 /* Warn when gcc pads a structure to an alignment boundary. */
1411 /* Warn when an optimization pass is disabled. */
1413 int warn_disabled_optimization;
1415 /* Warn about functions which might be candidates for attribute noreturn. */
1417 int warn_missing_noreturn;
1419 /* Likewise for -W. */
1421 lang_independent_options W_options[] =
1423 {"unused-function", &warn_unused_function, 1, "Warn when a function is unused" },
1424 {"unused-label", &warn_unused_label, 1, "Warn when a label is unused" },
1425 {"unused-parameter", &warn_unused_parameter, 1, "Warn when a function parameter is unused" },
1426 {"unused-variable", &warn_unused_variable, 1, "Warn when a variable is unused" },
1427 {"unused-value", &warn_unused_value, 1, "Warn when an expression value is unused" },
1428 {"system-headers", &warn_system_headers, 1, "Do not suppress warnings from system headers"},
1429 {"error", &warnings_are_errors, 1, ""},
1430 {"shadow", &warn_shadow, 1, "Warn when one local variable shadows another" },
1431 {"switch", &warn_switch, 1,
1432 "Warn about enumerated switches missing a specific case" },
1433 {"aggregate-return", &warn_aggregate_return, 1,
1434 "Warn about returning structures, unions or arrays" },
1435 {"cast-align", &warn_cast_align, 1,
1436 "Warn about pointer casts which increase alignment" },
1437 {"unreachable-code", &warn_notreached, 1,
1438 "Warn about code that will never be executed" },
1439 {"uninitialized", &warn_uninitialized, 1,
1440 "Warn about unitialized automatic variables"},
1441 {"inline", &warn_inline, 1,
1442 "Warn when an inlined function cannot be inlined"},
1443 {"packed", &warn_packed, 1,
1444 "Warn when the packed attribute has no effect on struct layout"},
1445 {"padded", &warn_padded, 1,
1446 "Warn when padding is required to align struct members"},
1447 {"disabled-optimization", &warn_disabled_optimization, 1,
1448 "Warn when an optimization pass is disabled"}
1451 /* Output files for assembler code (real compiler output)
1452 and debugging dumps. */
1455 FILE *aux_info_file;
1456 FILE *rtl_dump_file = NULL;
1458 /* Decode the string P as an integral parameter.
1459 If the string is indeed an integer return its numeric value else
1460 issue an Invalid Option error for the option PNAME and return DEFVAL.
1461 If PNAME is zero just return DEFVAL, do not call error. */
1464 read_integral_parameter (p, pname, defval)
1469 const char *endp = p;
1473 if (*endp >= '0' && *endp <= '9')
1482 error ("Invalid option `%s'", pname);
1490 /* This is the default decl_printable_name function. */
1493 decl_name (decl, verbosity)
1495 int verbosity ATTRIBUTE_UNUSED;
1497 return IDENTIFIER_POINTER (DECL_NAME (decl));
1500 /* Mark P for GC. Also mark main_input_filename and input_filename. */
1506 struct file_stack *stack = *(struct file_stack **)p;
1508 /* We're only called for input_file_stack, so we can mark the current
1509 input_filename here as well. */
1510 ggc_mark_string (main_input_filename);
1511 ggc_mark_string (input_filename);
1515 ggc_mark_string (stack->name);
1516 stack = stack->next;
1521 /* This calls abort and is used to avoid problems when abort if a macro.
1522 It is used when we need to pass the address of abort. */
1530 /* When `malloc.c' is compiled with `rcheck' defined,
1531 it calls this function to report clobberage. */
1535 const char *s ATTRIBUTE_UNUSED;
1540 /* Return the logarithm of X, base 2, considering X unsigned,
1541 if X is a power of 2. Otherwise, returns -1.
1543 This should be used via the `exact_log2' macro. */
1547 register unsigned HOST_WIDE_INT x;
1549 register int log = 0;
1550 /* Test for 0 or a power of 2. */
1551 if (x == 0 || x != (x & -x))
1553 while ((x >>= 1) != 0)
1558 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1559 If X is 0, return -1.
1561 This should be used via the floor_log2 macro. */
1565 register unsigned HOST_WIDE_INT x;
1567 register int log = -1;
1574 static int float_handler_set;
1576 jmp_buf float_handler;
1578 /* Signals actually come here. */
1581 float_signal (signo)
1582 /* If this is missing, some compilers complain. */
1583 int signo ATTRIBUTE_UNUSED;
1585 if (float_handled == 0)
1586 crash_signal (signo);
1587 #if defined (USG) || defined (hpux)
1588 /* Re-enable the signal catcher. */
1589 signal (SIGFPE, float_signal);
1592 signal (SIGFPE, float_signal);
1593 longjmp (float_handler, 1);
1596 /* Specify where to longjmp to when a floating arithmetic error happens.
1597 If HANDLER is 0, it means don't handle the errors any more. */
1600 set_float_handler (handler)
1603 float_handled = (handler != 0);
1605 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1607 if (float_handled && ! float_handler_set)
1609 signal (SIGFPE, float_signal);
1610 float_handler_set = 1;
1614 /* This is a wrapper function for code which might elicit an
1615 arithmetic exception. That code should be passed in as a function
1616 pointer FN, and one argument DATA. DATA is usually a struct which
1617 contains the real input and output for function FN. This function
1618 returns 0 (failure) if longjmp was called (i.e. an exception
1619 occured.) It returns 1 (success) otherwise. */
1622 do_float_handler (fn, data)
1623 void (*fn) PARAMS ((PTR));
1630 /* We got here via longjmp () caused by an exception in function
1632 set_float_handler (NULL);
1636 set_float_handler (buf);
1638 set_float_handler (NULL);
1642 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1643 error happens, pushing the previous specification into OLD_HANDLER.
1644 Return an indication of whether there was a previous handler in effect. */
1647 push_float_handler (handler, old_handler)
1648 jmp_buf handler, old_handler;
1650 int was_handled = float_handled;
1654 memcpy ((char *) old_handler, (char *) float_handler,
1655 sizeof (float_handler));
1657 memcpy ((char *) float_handler, (char *) handler, sizeof (float_handler));
1661 /* Restore the previous specification of whether and where to longjmp to
1662 when a floating arithmetic error happens. */
1665 pop_float_handler (handled, handler)
1669 float_handled = handled;
1671 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1674 /* Handler for fatal signals, such as SIGSEGV. These are transformed
1675 into ICE messages, which is much more user friendly. */
1678 crash_signal (signo)
1679 /* If this is missing, some compilers complain. */
1682 fatal ("Internal error: %s.\n\
1683 Please submit a full bug report.\n\
1684 See %s for instructions.", strsignal (signo), GCCBUGURL);
1687 /* Strip off a legitimate source ending from the input string NAME of
1688 length LEN. Rather than having to know the names used by all of
1689 our front ends, we strip off an ending of a period followed by
1690 up to five characters. (Java uses ".class".) */
1693 strip_off_ending (name, len)
1698 for (i = 2; i < 6 && len > i; i++)
1700 if (name[len - i] == '.')
1702 name[len - i] = '\0';
1708 /* Given a file name X, return the nondirectory portion. */
1711 file_name_nondirectory (x)
1714 char *tmp = (char *) rindex (x, '/');
1715 if (DIR_SEPARATOR != '/' && ! tmp)
1716 tmp = (char *) rindex (x, DIR_SEPARATOR);
1718 return (char *) (tmp + 1);
1723 /* Output a quoted string. */
1726 output_quoted_string (asm_file, string)
1730 #ifdef OUTPUT_QUOTED_STRING
1731 OUTPUT_QUOTED_STRING (asm_file, string);
1735 putc ('\"', asm_file);
1736 while ((c = *string++) != 0)
1738 if (c == '\"' || c == '\\')
1739 putc ('\\', asm_file);
1742 putc ('\"', asm_file);
1746 /* Output a file name in the form wanted by System V. */
1749 output_file_directive (asm_file, input_name)
1751 const char *input_name;
1753 int len = strlen (input_name);
1754 const char *na = input_name + len;
1756 /* NA gets INPUT_NAME sans directory names. */
1757 while (na > input_name)
1759 if (IS_DIR_SEPARATOR (na[-1]))
1764 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1765 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1767 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1768 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1770 fprintf (asm_file, "\t.file\t");
1771 output_quoted_string (asm_file, na);
1772 fputc ('\n', asm_file);
1777 #ifdef ASM_IDENTIFY_LANGUAGE
1778 /* Routine to build language identifier for object file. */
1781 output_lang_identify (asm_out_file)
1784 int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1785 char *s = (char *) alloca (len);
1787 sprintf (s, "__gnu_compiled_%s", lang_identify ());
1788 ASM_OUTPUT_LABEL (asm_out_file, s);
1792 /* Routine to open a dump file. Return true if the dump file is enabled. */
1795 open_dump_file (index, decl)
1796 enum dump_file_index index;
1800 const char *open_arg;
1803 if (! dump_file[index].enabled)
1806 timevar_push (TV_DUMP);
1807 if (rtl_dump_file != NULL)
1808 fclose (rtl_dump_file);
1810 sprintf (seq, ".%02d.", index);
1812 if (! dump_file[index].initialized)
1814 /* If we've not initialized the files, do so now. */
1815 if (graph_dump_format != no_graph
1816 && dump_file[index].graph_dump_p)
1818 dump_name = concat (seq, dump_file[index].extension, NULL);
1819 clean_graph_dump_file (dump_base_name, dump_name);
1822 dump_file[index].initialized = 1;
1828 dump_name = concat (dump_base_name, seq,
1829 dump_file[index].extension, NULL);
1831 rtl_dump_file = fopen (dump_name, open_arg);
1832 if (rtl_dump_file == NULL)
1833 pfatal_with_name (dump_name);
1838 fprintf (rtl_dump_file, "\n;; Function %s\n\n",
1839 decl_printable_name (decl, 2));
1841 timevar_pop (TV_DUMP);
1845 /* Routine to close a dump file. */
1848 close_dump_file (index, func, insns)
1849 enum dump_file_index index;
1850 void (*func) PARAMS ((FILE *, rtx));
1853 if (! rtl_dump_file)
1856 timevar_push (TV_DUMP);
1858 && graph_dump_format != no_graph
1859 && dump_file[index].graph_dump_p)
1864 sprintf (seq, ".%02d.", index);
1865 suffix = concat (seq, dump_file[index].extension, NULL);
1866 print_rtl_graph_with_bb (dump_base_name, suffix, insns);
1871 func (rtl_dump_file, insns);
1873 fflush (rtl_dump_file);
1874 fclose (rtl_dump_file);
1876 rtl_dump_file = NULL;
1877 timevar_pop (TV_DUMP);
1880 /* Do any final processing required for the declarations in VEC, of
1881 which there are LEN. We write out inline functions and variables
1882 that have been deferred until this point, but which are required.
1883 Returns non-zero if anything was put out. */
1886 wrapup_global_declarations (vec, len)
1893 int output_something = 0;
1895 for (i = 0; i < len; i++)
1899 /* We're not deferring this any longer. */
1900 DECL_DEFER_OUTPUT (decl) = 0;
1902 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
1903 && incomplete_decl_finalize_hook != 0)
1904 (*incomplete_decl_finalize_hook) (decl);
1907 /* Now emit any global variables or functions that we have been
1908 putting off. We need to loop in case one of the things emitted
1909 here references another one which comes earlier in the list. */
1913 for (i = 0; i < len; i++)
1917 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
1920 /* Don't write out static consts, unless we still need them.
1922 We also keep static consts if not optimizing (for debugging),
1923 unless the user specified -fno-keep-static-consts.
1924 ??? They might be better written into the debug information.
1925 This is possible when using DWARF.
1927 A language processor that wants static constants to be always
1928 written out (even if it is not used) is responsible for
1929 calling rest_of_decl_compilation itself. E.g. the C front-end
1930 calls rest_of_decl_compilation from finish_decl.
1931 One motivation for this is that is conventional in some
1932 environments to write things like:
1933 static const char rcsid[] = "... version string ...";
1934 intending to force the string to be in the executable.
1936 A language processor that would prefer to have unneeded
1937 static constants "optimized away" would just defer writing
1938 them out until here. E.g. C++ does this, because static
1939 constants are often defined in header files.
1941 ??? A tempting alternative (for both C and C++) would be
1942 to force a constant to be written if and only if it is
1943 defined in a main file, as opposed to an include file. */
1945 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1946 && (! TREE_READONLY (decl)
1947 || TREE_PUBLIC (decl)
1948 || (!optimize && flag_keep_static_consts)
1949 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1952 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
1955 if (TREE_CODE (decl) == FUNCTION_DECL
1956 && DECL_INITIAL (decl) != 0
1957 && DECL_SAVED_INSNS (decl) != 0
1958 && (flag_keep_inline_functions
1959 || (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
1960 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1963 output_inline_function (decl);
1968 output_something = 1;
1972 return output_something;
1975 /* Issue appropriate warnings for the global declarations in VEC (of
1976 which there are LEN). Output debugging information for them. */
1979 check_global_declarations (vec, len)
1986 for (i = 0; i < len; i++)
1990 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1991 && ! TREE_ASM_WRITTEN (decl))
1992 /* Cancel the RTL for this decl so that, if debugging info
1993 output for global variables is still to come,
1994 this one will be omitted. */
1995 DECL_RTL (decl) = NULL;
1997 /* Warn about any function
1998 declared static but not defined.
1999 We don't warn about variables,
2000 because many programs have static variables
2001 that exist only to get some text into the object file. */
2002 if (TREE_CODE (decl) == FUNCTION_DECL
2003 && (warn_unused_function
2004 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2005 && DECL_INITIAL (decl) == 0
2006 && DECL_EXTERNAL (decl)
2007 && ! DECL_ARTIFICIAL (decl)
2008 && ! TREE_PUBLIC (decl))
2010 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2011 pedwarn_with_decl (decl,
2012 "`%s' used but never defined");
2014 warning_with_decl (decl,
2015 "`%s' declared `static' but never defined");
2016 /* This symbol is effectively an "extern" declaration now. */
2017 TREE_PUBLIC (decl) = 1;
2018 assemble_external (decl);
2021 /* Warn about static fns or vars defined but not used,
2022 but not about inline functions or static consts
2023 since defining those in header files is normal practice. */
2024 if (((warn_unused_function
2025 && TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
2026 || (warn_unused_variable
2027 && TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
2028 && ! DECL_IN_SYSTEM_HEADER (decl)
2029 && ! DECL_EXTERNAL (decl)
2030 && ! TREE_PUBLIC (decl)
2031 && ! TREE_USED (decl)
2032 && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
2033 /* The TREE_USED bit for file-scope decls
2034 is kept in the identifier, to handle multiple
2035 external decls in different scopes. */
2036 && ! TREE_USED (DECL_NAME (decl)))
2037 warning_with_decl (decl, "`%s' defined but not used");
2039 timevar_push (TV_SYMOUT);
2040 #ifdef SDB_DEBUGGING_INFO
2041 /* The COFF linker can move initialized global vars to the end.
2042 And that can screw up the symbol ordering.
2043 By putting the symbols in that order to begin with,
2044 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
2045 if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
2046 && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
2047 && ! DECL_EXTERNAL (decl)
2048 && DECL_RTL (decl) != 0)
2049 sdbout_symbol (decl, 0);
2051 /* Output COFF information for non-global
2052 file-scope initialized variables. */
2053 if (write_symbols == SDB_DEBUG
2054 && TREE_CODE (decl) == VAR_DECL
2055 && DECL_INITIAL (decl)
2056 && ! DECL_EXTERNAL (decl)
2057 && DECL_RTL (decl) != 0
2058 && GET_CODE (DECL_RTL (decl)) == MEM)
2059 sdbout_toplevel_data (decl);
2060 #endif /* SDB_DEBUGGING_INFO */
2061 #ifdef DWARF_DEBUGGING_INFO
2062 /* Output DWARF information for file-scope tentative data object
2063 declarations, file-scope (extern) function declarations (which
2064 had no corresponding body) and file-scope tagged type declarations
2065 and definitions which have not yet been forced out. */
2067 if (write_symbols == DWARF_DEBUG
2068 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2069 dwarfout_file_scope_decl (decl, 1);
2071 #ifdef DWARF2_DEBUGGING_INFO
2072 /* Output DWARF2 information for file-scope tentative data object
2073 declarations, file-scope (extern) function declarations (which
2074 had no corresponding body) and file-scope tagged type declarations
2075 and definitions which have not yet been forced out. */
2077 if (write_symbols == DWARF2_DEBUG
2078 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2079 dwarf2out_decl (decl);
2081 timevar_pop (TV_SYMOUT);
2085 /* Save the current INPUT_FILENAME and LINENO on the top entry in the
2086 INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
2087 INPUT_FILENAME and LINENO accordingly. */
2090 push_srcloc (file, line)
2094 struct file_stack *fs;
2096 if (input_file_stack)
2098 input_file_stack->name = input_filename;
2099 input_file_stack->line = lineno;
2102 fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2103 fs->name = input_filename = file;
2104 fs->line = lineno = line;
2105 fs->indent_level = 0;
2106 fs->next = input_file_stack;
2107 input_file_stack = fs;
2108 input_file_stack_tick++;
2111 /* Pop the top entry off the stack of presently open source files.
2112 Restore the INPUT_FILENAME and LINENO from the new topmost entry on
2118 struct file_stack *fs;
2120 fs = input_file_stack;
2121 input_file_stack = fs->next;
2123 input_file_stack_tick++;
2124 /* The initial souce file is never popped. */
2125 if (!input_file_stack)
2127 input_filename = input_file_stack->name;
2128 lineno = input_file_stack->line;
2131 /* Compile an entire file of output from cpp, named NAME.
2132 Write a file of assembly output and various debugging dumps. */
2140 int name_specified = name != 0;
2142 if (dump_base_name == 0)
2143 dump_base_name = name ? name : "gccdump";
2148 /* Start timing total execution time. */
2151 timevar_start (TV_TOTAL);
2153 /* Initialize data in various passes. */
2157 name = init_parse (name);
2158 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
2159 || debug_info_level == DINFO_LEVEL_VERBOSE
2160 || flag_test_coverage
2161 || warn_notreached);
2164 init_decl_processing ();
2170 init_function_once ();
2171 init_stor_layout_once ();
2172 init_varasm_once ();
2174 /* The following initialization functions need to generate rtl, so
2175 provide a dummy function context for them. */
2176 init_dummy_function_start ();
2179 if (flag_caller_saves)
2180 init_caller_save ();
2181 expand_dummy_function_end ();
2183 /* If auxiliary info generation is desired, open the output file.
2184 This goes in the same directory as the source file--unlike
2185 all the other output files. */
2186 if (flag_gen_aux_info)
2188 aux_info_file = fopen (aux_info_file_name, "w");
2189 if (aux_info_file == 0)
2190 pfatal_with_name (aux_info_file_name);
2193 /* Open assembler code output file. Do this even if -fsyntax-only is on,
2194 because then the driver will have provided the name of a temporary
2195 file or bit bucket for us. */
2197 if (! name_specified && asm_file_name == 0)
2198 asm_out_file = stdout;
2201 if (asm_file_name == 0)
2203 int len = strlen (dump_base_name);
2204 char *dumpname = (char *) xmalloc (len + 6);
2205 memcpy (dumpname, dump_base_name, len + 1);
2206 strip_off_ending (dumpname, len);
2207 strcat (dumpname, ".s");
2208 asm_file_name = dumpname;
2210 if (!strcmp (asm_file_name, "-"))
2211 asm_out_file = stdout;
2213 asm_out_file = fopen (asm_file_name, "w");
2214 if (asm_out_file == 0)
2215 pfatal_with_name (asm_file_name);
2218 #ifdef IO_BUFFER_SIZE
2219 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
2220 _IOFBF, IO_BUFFER_SIZE);
2224 name = ggc_alloc_string (name, strlen (name));
2226 input_filename = name;
2228 /* Put an entry on the input file stack for the main input file. */
2229 push_srcloc (input_filename, 0);
2231 /* Perform language-specific initialization.
2232 This may set main_input_filename. */
2235 /* If the input doesn't start with a #line, use the input name
2236 as the official input file name. */
2237 if (main_input_filename == 0)
2238 main_input_filename = name;
2240 if (flag_syntax_only)
2242 write_symbols = NO_DEBUG;
2244 profile_block_flag = 0;
2248 ASM_FILE_START (asm_out_file);
2250 #ifdef ASM_COMMENT_START
2251 if (flag_verbose_asm)
2253 /* Print the list of options in effect. */
2254 print_version (asm_out_file, ASM_COMMENT_START);
2255 print_switch_values (asm_out_file, 0, MAX_LINE,
2256 ASM_COMMENT_START, " ", "\n");
2257 /* Add a blank line here so it appears in assembler output but not
2259 fprintf (asm_out_file, "\n");
2263 /* Output something to inform GDB that this compilation was by GCC. */
2264 #ifndef ASM_IDENTIFY_GCC
2265 fprintf (asm_out_file, "gcc2_compiled.:\n");
2267 ASM_IDENTIFY_GCC (asm_out_file);
2270 /* Output something to identify which front-end produced this file. */
2271 #ifdef ASM_IDENTIFY_LANGUAGE
2272 ASM_IDENTIFY_LANGUAGE (asm_out_file);
2274 } /* ! flag_syntax_only */
2276 #ifndef ASM_OUTPUT_SECTION_NAME
2277 if (flag_function_sections)
2279 warning ("-ffunction-sections not supported for this target.");
2280 flag_function_sections = 0;
2282 if (flag_data_sections)
2284 warning ("-fdata-sections not supported for this target.");
2285 flag_data_sections = 0;
2289 if (flag_function_sections
2290 && (profile_flag || profile_block_flag))
2292 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2293 flag_function_sections = 0;
2296 #ifndef OBJECT_FORMAT_ELF
2297 if (flag_function_sections && write_symbols != NO_DEBUG)
2298 warning ("-ffunction-sections may affect debugging on some targets.");
2301 /* ??? Note: There used to be a conditional here
2302 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2303 This was to guarantee separation between gcc_compiled. and
2304 the first function, for the sake of dbx on Suns.
2305 However, having the extra zero here confused the Emacs
2306 code for unexec, and might confuse other programs too.
2307 Therefore, I took out that change.
2308 In future versions we should find another way to solve
2309 that dbx problem. -- rms, 23 May 93. */
2311 /* Don't let the first function fall at the same address
2312 as gcc_compiled., if profiling. */
2313 if (profile_flag || profile_block_flag)
2315 /* It's best if we can write a nop here since some
2316 assemblers don't tolerate zeros in the text section. */
2317 output_asm_insn (get_insn_template (CODE_FOR_nop, NULL), NULL_PTR);
2320 /* If dbx symbol table desired, initialize writing it
2321 and output the predefined types. */
2322 timevar_push (TV_SYMOUT);
2323 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2324 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2325 dbxout_init (asm_out_file, main_input_filename, getdecls ());
2327 #ifdef SDB_DEBUGGING_INFO
2328 if (write_symbols == SDB_DEBUG)
2329 sdbout_init (asm_out_file, main_input_filename, getdecls ());
2331 #ifdef DWARF_DEBUGGING_INFO
2332 if (write_symbols == DWARF_DEBUG)
2333 dwarfout_init (asm_out_file, main_input_filename);
2335 #ifdef DWARF2_UNWIND_INFO
2336 if (dwarf2out_do_frame ())
2337 dwarf2out_frame_init ();
2339 #ifdef DWARF2_DEBUGGING_INFO
2340 if (write_symbols == DWARF2_DEBUG)
2341 dwarf2out_init (asm_out_file, main_input_filename);
2343 timevar_pop (TV_SYMOUT);
2345 /* Initialize yet another pass. */
2347 init_final (main_input_filename);
2348 init_branch_prob (dump_base_name);
2350 timevar_push (TV_PARSE);
2352 /* Call the parser, which parses the entire file
2353 (calling rest_of_compilation for each function). */
2355 if (yyparse () != 0)
2357 if (errorcount == 0)
2358 fnotice (stderr, "Errors detected in input file (your bison.simple is out of date)\n");
2360 /* In case there were missing closebraces,
2361 get us back to the global binding level. */
2362 while (! global_bindings_p ())
2366 /* Compilation is now finished except for writing
2367 what's left of the symbol table output. */
2369 timevar_pop (TV_PARSE);
2371 if (flag_syntax_only)
2374 globals = getdecls ();
2376 /* Really define vars that have had only a tentative definition.
2377 Really output inline functions that must actually be callable
2378 and have not been output so far. */
2381 int len = list_length (globals);
2382 tree *vec = (tree *) xmalloc (sizeof (tree) * len);
2386 /* Process the decls in reverse order--earliest first.
2387 Put them into VEC from back to front, then take out from front. */
2389 for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
2390 vec[len - i - 1] = decl;
2392 wrapup_global_declarations (vec, len);
2394 /* This must occur after the loop to output deferred functions. Else
2395 the profiler initializer would not be emitted if all the functions
2396 in this compilation unit were deferred.
2398 output_func_start_profiler can not cause any additional functions or
2399 data to need to be output, so it need not be in the deferred function
2401 output_func_start_profiler ();
2403 /* Now that all possible functions have been output, we can dump
2404 the exception table. */
2406 #ifndef IA64_UNWIND_INFO
2407 output_exception_table ();
2409 free_exception_table ();
2411 check_global_declarations (vec, len);
2417 /* Write out any pending weak symbol declarations. */
2421 /* Do dbx symbols. */
2422 timevar_push (TV_SYMOUT);
2423 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2424 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2425 dbxout_finish (asm_out_file, main_input_filename);
2428 #ifdef DWARF_DEBUGGING_INFO
2429 if (write_symbols == DWARF_DEBUG)
2433 #ifdef DWARF2_UNWIND_INFO
2434 if (dwarf2out_do_frame ())
2435 dwarf2out_frame_finish ();
2438 #ifdef DWARF2_DEBUGGING_INFO
2439 if (write_symbols == DWARF2_DEBUG)
2440 dwarf2out_finish ();
2442 timevar_pop (TV_SYMOUT);
2444 /* Output some stuff at end of file if nec. */
2446 end_final (dump_base_name);
2448 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
2450 timevar_push (TV_DUMP);
2451 open_dump_file (DFI_bp, NULL);
2455 close_dump_file (DFI_bp, NULL, NULL_RTX);
2456 timevar_pop (TV_DUMP);
2460 ASM_FILE_END (asm_out_file);
2463 /* Language-specific end of compilation actions. */
2467 /* Close the dump files. */
2469 if (flag_gen_aux_info)
2471 fclose (aux_info_file);
2473 unlink (aux_info_file_name);
2476 if (optimize > 0 && open_dump_file (DFI_combine, NULL))
2478 timevar_push (TV_DUMP);
2479 dump_combine_total_stats (rtl_dump_file);
2480 close_dump_file (DFI_combine, NULL, NULL_RTX);
2481 timevar_pop (TV_DUMP);
2484 /* Close non-debugging input and output files. Take special care to note
2485 whether fclose returns an error, since the pages might still be on the
2486 buffer chain while the file is open. */
2490 if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
2491 fatal_io_error (asm_file_name);
2493 /* Do whatever is necessary to finish printing the graphs. */
2494 if (graph_dump_format != no_graph)
2498 for (i = 0; i < DFI_MAX; ++i)
2499 if (dump_file[i].initialized && dump_file[i].graph_dump_p)
2504 sprintf (seq, ".%02d.", i);
2505 suffix = concat (seq, dump_file[i].extension, NULL);
2506 finish_graph_dump_file (dump_base_name, suffix);
2512 ggc_print_statistics ();
2514 /* Free up memory for the benefit of leak detectors. */
2517 /* Stop timing total execution time. */
2518 timevar_stop (TV_TOTAL);
2520 /* Print the times. */
2522 timevar_print (stderr);
2525 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2526 and TYPE_DECL nodes.
2528 This does nothing for local (non-static) variables, unless the
2529 variable is a register variable with an ASMSPEC. In that case, or
2530 if the variable is not an automatice, it sets up the RTL and
2531 outputs any assembler code (label definition, storage allocation
2532 and initialization).
2534 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2535 the assembler symbol name to be used. TOP_LEVEL is nonzero
2536 if this declaration is not within a function. */
2539 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2541 const char *asmspec;
2545 /* Declarations of variables, and of functions defined elsewhere. */
2547 /* The most obvious approach, to put an #ifndef around where
2548 this macro is used, doesn't work since it's inside a macro call. */
2549 #ifndef ASM_FINISH_DECLARE_OBJECT
2550 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2553 /* Forward declarations for nested functions are not "external",
2554 but we need to treat them as if they were. */
2555 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2556 || TREE_CODE (decl) == FUNCTION_DECL)
2558 timevar_push (TV_VARCONST);
2559 make_decl_rtl (decl, asmspec, top_level);
2560 /* Initialized extern variable exists to be replaced
2561 with its value, or represents something that will be
2562 output in another file. */
2563 if (! (TREE_CODE (decl) == VAR_DECL
2564 && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
2565 && DECL_INITIAL (decl) != 0
2566 && DECL_INITIAL (decl) != error_mark_node))
2567 /* Don't output anything
2568 when a tentative file-scope definition is seen.
2569 But at end of compilation, do output code for them. */
2570 if (! (! at_end && top_level
2571 && (DECL_INITIAL (decl) == 0
2572 || DECL_INITIAL (decl) == error_mark_node)))
2573 assemble_variable (decl, top_level, at_end, 0);
2574 if (decl == last_assemble_variable_decl)
2576 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2579 timevar_pop (TV_VARCONST);
2581 else if (DECL_REGISTER (decl) && asmspec != 0)
2583 if (decode_reg_name (asmspec) >= 0)
2585 DECL_RTL (decl) = 0;
2586 make_decl_rtl (decl, asmspec, top_level);
2590 error ("invalid register name `%s' for register variable", asmspec);
2591 DECL_REGISTER (decl) = 0;
2592 make_decl_rtl (decl, NULL, top_level);
2595 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2596 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2597 && TREE_CODE (decl) == TYPE_DECL)
2599 timevar_push (TV_SYMOUT);
2600 dbxout_symbol (decl, 0);
2601 timevar_pop (TV_SYMOUT);
2604 #ifdef SDB_DEBUGGING_INFO
2605 else if (write_symbols == SDB_DEBUG && top_level
2606 && TREE_CODE (decl) == TYPE_DECL)
2608 timevar_push (TV_SYMOUT);
2609 sdbout_symbol (decl, 0);
2610 timevar_pop (TV_SYMOUT);
2615 /* Called after finishing a record, union or enumeral type. */
2618 rest_of_type_compilation (type, toplev)
2619 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
2623 tree type ATTRIBUTE_UNUSED;
2624 int toplev ATTRIBUTE_UNUSED;
2627 timevar_push (TV_SYMOUT);
2628 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2629 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2630 dbxout_symbol (TYPE_STUB_DECL (type), !toplev);
2632 #ifdef SDB_DEBUGGING_INFO
2633 if (write_symbols == SDB_DEBUG)
2634 sdbout_symbol (TYPE_STUB_DECL (type), !toplev);
2636 #ifdef DWARF2_DEBUGGING_INFO
2637 if (write_symbols == DWARF2_DEBUG && toplev)
2638 dwarf2out_decl (TYPE_STUB_DECL (type));
2640 timevar_pop (TV_SYMOUT);
2643 /* DECL is an inline function, whose body is present, but which is not
2644 being output at this point. (We're putting that off until we need
2645 to do it.) If there are any actions that need to take place,
2646 including the emission of debugging information for the function,
2647 this is where they should go. This function may be called by
2648 language-dependent code for front-ends that do not even generate
2649 RTL for functions that don't need to be put out. */
2652 note_deferral_of_defined_inline_function (decl)
2653 tree decl ATTRIBUTE_UNUSED;
2655 #ifdef DWARF_DEBUGGING_INFO
2656 /* Generate the DWARF info for the "abstract" instance of a function
2657 which we may later generate inlined and/or out-of-line instances
2659 if (write_symbols == DWARF_DEBUG && DECL_INLINE (decl))
2661 /* The front-end may not have set CURRENT_FUNCTION_DECL, but the
2662 DWARF code expects it to be set in this case. Intuitively,
2663 DECL is the function we just finished defining, so setting
2664 CURRENT_FUNCTION_DECL is sensible. */
2665 tree saved_cfd = current_function_decl;
2666 current_function_decl = decl;
2668 /* Let the DWARF code do its work. */
2669 set_decl_abstract_flags (decl, 1);
2670 dwarfout_file_scope_decl (decl, 0);
2671 set_decl_abstract_flags (decl, 0);
2673 /* Reset CURRENT_FUNCTION_DECL. */
2674 current_function_decl = saved_cfd;
2679 /* This is called from finish_function (within yyparse)
2680 after each top-level definition is parsed.
2681 It is supposed to compile that function or variable
2682 and output the assembler code for it.
2683 After we return, the tree storage is freed. */
2686 rest_of_compilation (decl)
2692 int rebuild_label_notes_after_reload;
2693 int register_life_up_to_date;
2695 timevar_push (TV_REST_OF_COMPILATION);
2697 /* Now that we're out of the frontend, we shouldn't have any more
2698 CONCATs anywhere. */
2699 generating_concat_p = 0;
2701 /* When processing delayed functions, prepare_function_start() won't
2702 have been run to re-initialize it. */
2703 cse_not_expected = ! optimize;
2705 /* First, make sure that NOTE_BLOCK is set correctly for each
2706 NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
2707 if (!cfun->x_whole_function_mode_p)
2710 /* Then remove any notes we don't need. That will make iterating
2711 over the instruction sequence faster, and allow the garbage
2712 collector to reclaim the memory used by the notes. */
2713 remove_unnecessary_notes ();
2715 /* In function-at-a-time mode, we do not attempt to keep the BLOCK
2716 tree in sensible shape. So, we just recalculate it here. */
2717 if (cfun->x_whole_function_mode_p)
2722 /* If we are reconsidering an inline function
2723 at the end of compilation, skip the stuff for making it inline. */
2725 if (DECL_SAVED_INSNS (decl) == 0)
2731 /* If this is nested inside an inlined external function, pretend
2732 it was only declared. Since we cannot inline such functions,
2733 generating code for this one is not only not necessary but will
2734 confuse some debugging output writers. */
2735 for (parent = DECL_CONTEXT (current_function_decl);
2736 parent != NULL_TREE;
2737 parent = get_containing_scope (parent))
2738 if (TREE_CODE (parent) == FUNCTION_DECL
2739 && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
2741 DECL_INITIAL (decl) = 0;
2742 goto exit_rest_of_compilation;
2745 /* If requested, consider whether to make this function inline. */
2746 if (DECL_INLINE (decl) || flag_inline_functions)
2748 timevar_push (TV_INTEGRATION);
2749 lose = function_cannot_inline_p (decl);
2750 timevar_pop (TV_INTEGRATION);
2751 if (lose || ! optimize)
2753 if (warn_inline && DECL_INLINE (decl))
2754 warning_with_decl (decl, lose);
2755 DECL_ABSTRACT_ORIGIN (decl) = 0;
2756 /* Don't really compile an extern inline function.
2757 If we can't make it inline, pretend
2758 it was only declared. */
2759 if (DECL_EXTERNAL (decl))
2761 DECL_INITIAL (decl) = 0;
2762 goto exit_rest_of_compilation;
2766 /* ??? Note that this has the effect of making it look
2767 like "inline" was specified for a function if we choose
2768 to inline it. This isn't quite right, but it's
2769 probably not worth the trouble to fix. */
2770 inlinable = DECL_INLINE (decl) = 1;
2773 insns = get_insns ();
2775 /* Dump the rtl code if we are dumping rtl. */
2777 if (open_dump_file (DFI_rtl, decl))
2779 if (DECL_SAVED_INSNS (decl))
2780 fprintf (rtl_dump_file, ";; (integrable)\n\n");
2781 close_dump_file (DFI_rtl, print_rtl, insns);
2784 /* If function is inline, and we don't yet know whether to
2785 compile it by itself, defer decision till end of compilation.
2786 finish_compilation will call rest_of_compilation again
2787 for those functions that need to be output. Also defer those
2788 functions that we are supposed to defer. */
2791 || (DECL_INLINE (decl)
2792 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2793 && ! flag_keep_inline_functions)
2794 || DECL_EXTERNAL (decl))))
2795 DECL_DEFER_OUTPUT (decl) = 1;
2797 if (DECL_INLINE (decl))
2798 /* DWARF wants seperate debugging info for abstract and
2799 concrete instances of all inline functions, including those
2800 declared inline but not inlined, and those inlined even
2801 though they weren't declared inline. Conveniently, that's
2802 what DECL_INLINE means at this point. */
2803 note_deferral_of_defined_inline_function (decl);
2805 if (DECL_DEFER_OUTPUT (decl))
2807 /* If -Wreturn-type, we have to do a bit of compilation. We just
2808 want to call jump_optimize to figure out whether or not we can
2809 fall off the end of the function; we do the minimum amount of
2810 work necessary to make that safe. And, we set optimize to zero
2811 to keep jump_optimize from working too hard. */
2812 if (warn_return_type)
2814 int saved_optimize = optimize;
2817 find_exception_handler_labels ();
2818 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2819 !JUMP_AFTER_REGSCAN);
2820 optimize = saved_optimize;
2823 current_function_nothrow = nothrow_function_p ();
2824 if (current_function_nothrow)
2825 /* Now we know that this can't throw; set the flag for the benefit
2826 of other functions later in this translation unit. */
2827 TREE_NOTHROW (current_function_decl) = 1;
2829 timevar_push (TV_INTEGRATION);
2830 save_for_inline (decl);
2831 timevar_pop (TV_INTEGRATION);
2832 DECL_SAVED_INSNS (decl)->inlinable = inlinable;
2833 goto exit_rest_of_compilation;
2836 /* If specified extern inline but we aren't inlining it, we are
2837 done. This goes for anything that gets here with DECL_EXTERNAL
2838 set, not just things with DECL_INLINE. */
2839 if (DECL_EXTERNAL (decl))
2840 goto exit_rest_of_compilation;
2843 init_EXPR_INSN_LIST_cache ();
2847 /* Initialize some variables used by the optimizers. */
2848 init_function_for_compilation ();
2850 if (! DECL_DEFER_OUTPUT (decl))
2851 TREE_ASM_WRITTEN (decl) = 1;
2853 /* Now that integrate will no longer see our rtl, we need not
2854 distinguish between the return value of this function and the
2855 return value of called functions. Also, we can remove all SETs
2856 of subregs of hard registers; they are only here because of
2858 rtx_equal_function_value_matters = 0;
2859 purge_hard_subreg_sets (get_insns ());
2861 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
2862 if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
2863 goto exit_rest_of_compilation;
2865 /* Emit code to get eh context, if needed. */
2868 /* We may have potential sibling or tail recursion sites. Select one
2869 (of possibly multiple) methods of performing the call. */
2870 if (flag_optimize_sibling_calls)
2872 timevar_push (TV_JUMP);
2873 open_dump_file (DFI_sibling, decl);
2875 optimize_sibling_and_tail_recursive_calls ();
2877 close_dump_file (DFI_sibling, print_rtl, get_insns ());
2878 timevar_pop (TV_JUMP);
2882 /* If we are doing position-independent code generation, now
2883 is the time to output special prologues and epilogues.
2884 We do not want to do this earlier, because it just clutters
2885 up inline functions with meaningless insns. */
2890 insns = get_insns ();
2892 /* Copy any shared structure that should not be shared. */
2893 unshare_all_rtl (current_function_decl, insns);
2895 #ifdef SETJMP_VIA_SAVE_AREA
2896 /* This must be performed before virutal register instantiation. */
2897 if (current_function_calls_alloca)
2898 optimize_save_area_alloca (insns);
2901 /* Instantiate all virtual registers. */
2902 instantiate_virtual_regs (current_function_decl, insns);
2904 /* Find all the EH handlers. */
2905 find_exception_handler_labels ();
2907 open_dump_file (DFI_jump, decl);
2909 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
2910 are initialized and to compute whether control can drop off the end
2913 timevar_push (TV_JUMP);
2914 /* Turn NOTE_INSN_EXPECTED_VALUE into REG_BR_PROB. Do this
2915 before jump optimization switches branch directions. */
2916 expected_value_to_br_prob ();
2918 reg_scan (insns, max_reg_num (), 0);
2919 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2920 JUMP_AFTER_REGSCAN);
2922 timevar_pop (TV_JUMP);
2924 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
2925 if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
2927 close_dump_file (DFI_jump, print_rtl, insns);
2928 goto exit_rest_of_compilation;
2931 timevar_push (TV_JUMP);
2935 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2936 cleanup_cfg (insns);
2938 /* ??? Run if-conversion before delete_null_pointer_checks,
2939 since the later does not preserve the CFG. This should
2940 be changed -- no since converting if's that are going to
2942 timevar_push (TV_IFCVT);
2944 timevar_pop (TV_IFCVT);
2946 /* Try to identify useless null pointer tests and delete them. */
2947 if (flag_delete_null_pointer_checks)
2948 delete_null_pointer_checks (insns);
2951 /* Jump optimization, and the removal of NULL pointer checks, may
2952 have reduced the number of instructions substantially. CSE, and
2953 future passes, allocate arrays whose dimensions involve the
2954 maximum instruction UID, so if we can reduce the maximum UID
2955 we'll save big on memory. */
2956 renumber_insns (rtl_dump_file);
2957 timevar_pop (TV_JUMP);
2959 close_dump_file (DFI_jump, print_rtl, insns);
2963 /* Perform common subexpression elimination.
2964 Nonzero value from `cse_main' means that jumps were simplified
2965 and some code may now be unreachable, so do
2966 jump optimization again. */
2970 open_dump_file (DFI_cse, decl);
2971 timevar_push (TV_CSE);
2973 reg_scan (insns, max_reg_num (), 1);
2975 if (flag_thread_jumps)
2977 timevar_push (TV_JUMP);
2978 thread_jumps (insns, max_reg_num (), 1);
2979 timevar_pop (TV_JUMP);
2982 tem = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
2984 /* If we are not running the second CSE pass, then we are no longer
2985 expecting CSE to be run. */
2986 cse_not_expected = !flag_rerun_cse_after_loop;
2988 if (tem || optimize > 1)
2990 timevar_push (TV_JUMP);
2991 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2992 !JUMP_AFTER_REGSCAN);
2993 timevar_pop (TV_JUMP);
2996 /* Run this after jump optmizations remove all the unreachable code
2997 so that unreachable code will not keep values live. */
2998 delete_trivially_dead_insns (insns, max_reg_num ());
3000 /* Try to identify useless null pointer tests and delete them. */
3001 if (flag_delete_null_pointer_checks)
3003 timevar_push (TV_JUMP);
3004 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3006 cleanup_cfg (insns);
3008 delete_null_pointer_checks (insns);
3009 timevar_pop (TV_JUMP);
3012 /* The second pass of jump optimization is likely to have
3013 removed a bunch more instructions. */
3014 renumber_insns (rtl_dump_file);
3016 timevar_pop (TV_CSE);
3017 close_dump_file (DFI_cse, print_rtl, insns);
3020 open_dump_file (DFI_addressof, decl);
3022 purge_addressof (insns);
3023 reg_scan (insns, max_reg_num (), 1);
3025 close_dump_file (DFI_addressof, print_rtl, insns);
3029 if (optimize > 0 && flag_ssa)
3031 /* Convert to SSA form. */
3033 timevar_push (TV_TO_SSA);
3034 open_dump_file (DFI_ssa, decl);
3036 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3037 cleanup_cfg (insns);
3040 close_dump_file (DFI_ssa, print_rtl_with_bb, insns);
3041 timevar_pop (TV_TO_SSA);
3043 /* The SSA implementation uses basic block numbers in its phi
3044 nodes. Thus, changing the control-flow graph or the basic
3045 blocks, e.g., calling find_basic_blocks () or cleanup_cfg (),
3046 may cause problems. */
3050 /* Remove dead code. */
3052 timevar_push (TV_DEAD_CODE_ELIM);
3053 open_dump_file (DFI_dce, decl);
3055 insns = get_insns ();
3056 eliminate_dead_code();
3058 close_dump_file (DFI_dce, print_rtl_with_bb, insns);
3059 timevar_pop (TV_DEAD_CODE_ELIM);
3062 /* Convert from SSA form. */
3064 timevar_push (TV_FROM_SSA);
3065 open_dump_file (DFI_ussa, decl);
3067 convert_from_ssa ();
3068 /* New registers have been created. Rescan their usage. */
3069 reg_scan (insns, max_reg_num (), 1);
3070 /* Life analysis used in SSA adds log_links but these
3071 shouldn't be there until the flow stage, so clear
3073 clear_log_links (insns);
3075 close_dump_file (DFI_ussa, print_rtl_with_bb, insns);
3076 timevar_pop (TV_FROM_SSA);
3081 /* Perform global cse. */
3083 if (optimize > 0 && flag_gcse)
3085 timevar_push (TV_GCSE);
3086 open_dump_file (DFI_gcse, decl);
3088 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3089 cleanup_cfg (insns);
3090 tem = gcse_main (insns, rtl_dump_file);
3092 /* If gcse altered any jumps, rerun jump optimizations to clean
3096 timevar_push (TV_JUMP);
3097 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
3098 !JUMP_AFTER_REGSCAN);
3099 timevar_pop (TV_JUMP);
3102 close_dump_file (DFI_gcse, print_rtl, insns);
3103 timevar_pop (TV_GCSE);
3108 /* Move constant computations out of loops. */
3112 timevar_push (TV_LOOP);
3113 open_dump_file (DFI_loop, decl);
3115 if (flag_rerun_loop_opt)
3117 /* We only want to perform unrolling once. */
3119 loop_optimize (insns, rtl_dump_file, 0);
3121 /* The first call to loop_optimize makes some instructions
3122 trivially dead. We delete those instructions now in the
3123 hope that doing so will make the heuristics in loop work
3124 better and possibly speed up compilation. */
3125 delete_trivially_dead_insns (insns, max_reg_num ());
3127 /* The regscan pass is currently necessary as the alias
3128 analysis code depends on this information. */
3129 reg_scan (insns, max_reg_num (), 1);
3131 loop_optimize (insns, rtl_dump_file,
3132 (flag_unroll_loops ? LOOP_UNROLL : 0) | LOOP_BCT);
3134 close_dump_file (DFI_loop, print_rtl, insns);
3135 timevar_pop (TV_LOOP);
3142 timevar_push (TV_CSE2);
3143 open_dump_file (DFI_cse2, decl);
3145 if (flag_rerun_cse_after_loop)
3147 /* Running another jump optimization pass before the second
3148 cse pass sometimes simplifies the RTL enough to allow
3149 the second CSE pass to do a better job. Jump_optimize can change
3150 max_reg_num so we must rerun reg_scan afterwards.
3151 ??? Rework to not call reg_scan so often. */
3152 timevar_push (TV_JUMP);
3154 reg_scan (insns, max_reg_num (), 0);
3155 jump_optimize (insns, !JUMP_CROSS_JUMP,
3156 !JUMP_NOOP_MOVES, JUMP_AFTER_REGSCAN);
3158 timevar_push (TV_IFCVT);
3160 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3161 cleanup_cfg (insns);
3164 timevar_pop(TV_IFCVT);
3166 timevar_pop (TV_JUMP);
3168 reg_scan (insns, max_reg_num (), 0);
3169 tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
3173 timevar_push (TV_JUMP);
3174 jump_optimize (insns, !JUMP_CROSS_JUMP,
3175 !JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
3176 timevar_pop (TV_JUMP);
3180 if (flag_thread_jumps)
3182 /* This pass of jump threading straightens out code
3183 that was kinked by loop optimization. */
3184 timevar_push (TV_JUMP);
3185 reg_scan (insns, max_reg_num (), 0);
3186 thread_jumps (insns, max_reg_num (), 0);
3187 timevar_pop (TV_JUMP);
3190 close_dump_file (DFI_cse2, print_rtl, insns);
3191 timevar_pop (TV_CSE2);
3196 cse_not_expected = 1;
3200 /* Do control and data flow analysis; wrote some of the results to
3203 timevar_push (TV_FLOW);
3204 open_dump_file (DFI_cfg, decl);
3206 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3207 cleanup_cfg (insns);
3208 check_function_return_warnings ();
3210 close_dump_file (DFI_cfg, print_rtl_with_bb, insns);
3212 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
3214 timevar_push (TV_BRANCH_PROB);
3215 open_dump_file (DFI_bp, decl);
3219 close_dump_file (DFI_bp, print_rtl_with_bb, insns);
3220 timevar_pop (TV_BRANCH_PROB);
3223 open_dump_file (DFI_life, decl);
3228 /* Discover and record the loop depth at the head of each basic
3229 block. The loop infrastructure does the real job for us. */
3230 flow_loops_find (&loops, LOOP_TREE);
3232 /* Estimate using heuristics if no profiling info is available. */
3233 estimate_probability (&loops);
3236 flow_loops_dump (&loops, rtl_dump_file, NULL, 0);
3238 flow_loops_free (&loops);
3240 life_analysis (insns, rtl_dump_file, PROP_FINAL);
3241 mark_constant_function ();
3242 timevar_pop (TV_FLOW);
3244 register_life_up_to_date = 1;
3247 if (warn_uninitialized || extra_warnings)
3249 uninitialized_vars_warning (DECL_INITIAL (decl));
3251 setjmp_args_warning ();
3254 close_dump_file (DFI_life, print_rtl_with_bb, insns);
3258 /* If -opt, try combining insns through substitution. */
3262 int rebuild_jump_labels_after_combine = 0;
3264 timevar_push (TV_COMBINE);
3265 open_dump_file (DFI_combine, decl);
3267 rebuild_jump_labels_after_combine
3268 = combine_instructions (insns, max_reg_num ());
3270 /* Combining insns may have turned an indirect jump into a
3271 direct jump. Rebuid the JUMP_LABEL fields of jumping
3273 if (rebuild_jump_labels_after_combine)
3275 timevar_push (TV_JUMP);
3276 rebuild_jump_labels (insns);
3277 timevar_pop (TV_JUMP);
3279 timevar_push (TV_FLOW);
3280 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3281 cleanup_cfg (insns);
3283 /* Blimey. We've got to have the CFG up to date for the call to
3284 if_convert below. However, the random deletion of blocks
3285 without updating life info can wind up with Wierd Stuff in
3286 global_live_at_end. We then run sched1, which updates things
3287 properly, discovers the wierdness and aborts. */
3288 update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
3289 PROP_DEATH_NOTES | PROP_KILL_DEAD_CODE
3290 | PROP_SCAN_DEAD_CODE);
3292 timevar_pop (TV_FLOW);
3295 close_dump_file (DFI_combine, print_rtl_with_bb, insns);
3296 timevar_pop (TV_COMBINE);
3301 /* Rerun if-conversion, as combine may have simplified things enough to
3302 now meet sequence length restrictions. */
3305 timevar_push (TV_IFCVT);
3306 open_dump_file (DFI_ce, decl);
3312 close_dump_file (DFI_ce, print_rtl_with_bb, insns);
3313 timevar_pop (TV_IFCVT);
3316 /* Register allocation pre-pass, to reduce number of moves
3317 necessary for two-address machines. */
3318 if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
3320 timevar_push (TV_REGMOVE);
3321 open_dump_file (DFI_regmove, decl);
3323 regmove_optimize (insns, max_reg_num (), rtl_dump_file);
3325 close_dump_file (DFI_regmove, print_rtl_with_bb, insns);
3326 timevar_pop (TV_REGMOVE);
3331 /* Any of the several passes since flow1 will have munged register
3332 lifetime data a bit. */
3334 register_life_up_to_date = 0;
3336 #ifdef OPTIMIZE_MODE_SWITCHING
3339 timevar_push (TV_GCSE);
3341 if (optimize_mode_switching (NULL_PTR))
3343 /* We did work, and so had to regenerate global life information.
3344 Take advantage of this and don't re-recompute register life
3345 information below. */
3346 register_life_up_to_date = 1;
3349 timevar_pop (TV_GCSE);
3353 #ifdef INSN_SCHEDULING
3355 /* Print function header into sched dump now
3356 because doing the sched analysis makes some of the dump. */
3357 if (optimize > 0 && flag_schedule_insns)
3359 timevar_push (TV_SCHED);
3360 open_dump_file (DFI_sched, decl);
3362 /* Do control and data sched analysis,
3363 and write some of the results to dump file. */
3365 schedule_insns (rtl_dump_file);
3367 close_dump_file (DFI_sched, print_rtl_with_bb, insns);
3368 timevar_pop (TV_SCHED);
3372 /* Register lifetime information was updated as part of verifying
3374 register_life_up_to_date = 1;
3378 /* Determine if the current function is a leaf before running reload
3379 since this can impact optimizations done by the prologue and
3380 epilogue thus changing register elimination offsets. */
3381 current_function_is_leaf = leaf_function_p ();
3383 timevar_push (TV_LOCAL_ALLOC);
3384 open_dump_file (DFI_lreg, decl);
3386 /* Allocate pseudo-regs that are used only within 1 basic block.
3388 RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
3389 jump optimizer after register allocation and reloading are finished. */
3391 if (! register_life_up_to_date)
3392 recompute_reg_usage (insns, ! optimize_size);
3393 regclass (insns, max_reg_num (), rtl_dump_file);
3394 rebuild_label_notes_after_reload = local_alloc ();
3396 timevar_pop (TV_LOCAL_ALLOC);
3398 if (dump_file[DFI_lreg].enabled)
3400 timevar_push (TV_DUMP);
3402 dump_flow_info (rtl_dump_file);
3403 dump_local_alloc (rtl_dump_file);
3405 close_dump_file (DFI_lreg, print_rtl_with_bb, insns);
3406 timevar_pop (TV_DUMP);
3411 timevar_push (TV_GLOBAL_ALLOC);
3412 open_dump_file (DFI_greg, decl);
3414 /* If optimizing, allocate remaining pseudo-regs. Do the reload
3415 pass fixing up any insns that are invalid. */
3418 failure = global_alloc (rtl_dump_file);
3421 build_insn_chain (insns);
3422 failure = reload (insns, 0);
3425 timevar_pop (TV_GLOBAL_ALLOC);
3428 goto exit_rest_of_compilation;
3432 /* Do a very simple CSE pass over just the hard registers. */
3435 timevar_push (TV_RELOAD_CSE_REGS);
3436 reload_cse_regs (insns);
3437 timevar_pop (TV_RELOAD_CSE_REGS);
3440 /* If optimizing, then go ahead and split insns now since we are about
3441 to recompute flow information anyway. */
3444 int old_labelnum = max_label_num ();
3446 split_all_insns (0);
3447 rebuild_label_notes_after_reload |= old_labelnum != max_label_num ();
3450 /* Register allocation and reloading may have turned an indirect jump into
3451 a direct jump. If so, we must rebuild the JUMP_LABEL fields of
3452 jumping instructions. */
3453 if (rebuild_label_notes_after_reload)
3455 timevar_push (TV_JUMP);
3457 rebuild_jump_labels (insns);
3459 timevar_pop (TV_JUMP);
3462 if (dump_file[DFI_greg].enabled)
3464 timevar_push (TV_DUMP);
3466 dump_global_regs (rtl_dump_file);
3468 close_dump_file (DFI_greg, print_rtl_with_bb, insns);
3469 timevar_pop (TV_DUMP);
3472 /* Re-create the death notes which were deleted during reload. */
3473 timevar_push (TV_FLOW2);
3474 open_dump_file (DFI_flow2, decl);
3476 jump_optimize (insns, !JUMP_CROSS_JUMP,
3477 !JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
3478 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3480 /* On some machines, the prologue and epilogue code, or parts thereof,
3481 can be represented as RTL. Doing so lets us schedule insns between
3482 it and the rest of the code and also allows delayed branch
3483 scheduling to operate in the epilogue. */
3484 thread_prologue_and_epilogue_insns (insns);
3488 cleanup_cfg (insns);
3489 life_analysis (insns, rtl_dump_file, PROP_FINAL);
3491 /* This is kind of a heuristic. We need to run combine_stack_adjustments
3492 even for machines with possibly nonzero RETURN_POPS_ARGS
3493 and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having
3494 push instructions will have popping returns. */
3495 #ifndef PUSH_ROUNDING
3496 if (!ACCUMULATE_OUTGOING_ARGS)
3498 combine_stack_adjustments ();
3503 flow2_completed = 1;
3505 close_dump_file (DFI_flow2, print_rtl_with_bb, insns);
3506 timevar_pop (TV_FLOW2);
3510 timevar_push (TV_IFCVT2);
3511 open_dump_file (DFI_ce2, decl);
3515 close_dump_file (DFI_ce2, print_rtl_with_bb, insns);
3516 timevar_pop (TV_IFCVT2);
3519 #ifdef HAVE_peephole2
3520 if (optimize > 0 && flag_peephole2)
3522 timevar_push (TV_PEEPHOLE2);
3523 open_dump_file (DFI_peephole2, decl);
3525 peephole2_optimize (rtl_dump_file);
3527 close_dump_file (DFI_peephole2, print_rtl_with_bb, insns);
3528 timevar_pop (TV_PEEPHOLE2);
3532 if (optimize > 0 && flag_rename_registers)
3534 timevar_push (TV_RENAME_REGISTERS);
3535 open_dump_file (DFI_rnreg, decl);
3537 regrename_optimize ();
3539 close_dump_file (DFI_rnreg, print_rtl_with_bb, insns);
3540 timevar_pop (TV_RENAME_REGISTERS);
3543 #ifdef INSN_SCHEDULING
3544 if (optimize > 0 && flag_schedule_insns_after_reload)
3546 timevar_push (TV_SCHED2);
3547 open_dump_file (DFI_sched2, decl);
3549 /* Do control and data sched analysis again,
3550 and write some more of the results to dump file. */
3552 schedule_insns (rtl_dump_file);
3554 close_dump_file (DFI_sched2, print_rtl_with_bb, insns);
3555 timevar_pop (TV_SCHED2);
3561 #ifdef LEAF_REGISTERS
3562 current_function_uses_only_leaf_regs
3563 = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
3566 if (optimize > 0 && flag_reorder_blocks)
3568 timevar_push (TV_REORDER_BLOCKS);
3569 open_dump_file (DFI_bbro, decl);
3571 reorder_basic_blocks ();
3573 close_dump_file (DFI_bbro, print_rtl_with_bb, insns);
3574 timevar_pop (TV_REORDER_BLOCKS);
3577 /* One more attempt to remove jumps to .+1 left by dead-store elimination.
3578 Also do cross-jumping this time and delete no-op move insns. */
3582 timevar_push (TV_JUMP);
3583 open_dump_file (DFI_jump2, decl);
3585 jump_optimize (insns, JUMP_CROSS_JUMP, JUMP_NOOP_MOVES,
3586 !JUMP_AFTER_REGSCAN);
3588 /* CFG no longer kept up to date. */
3590 close_dump_file (DFI_jump2, print_rtl_with_bb, insns);
3591 timevar_pop (TV_JUMP);
3594 /* If a machine dependent reorganization is needed, call it. */
3595 #ifdef MACHINE_DEPENDENT_REORG
3596 open_dump_file (DFI_mach, decl);
3598 MACHINE_DEPENDENT_REORG (insns);
3600 close_dump_file (DFI_mach, print_rtl_with_bb, insns);
3605 /* If a scheduling pass for delayed branches is to be done,
3606 call the scheduling code. */
3609 if (optimize > 0 && flag_delayed_branch)
3611 timevar_push (TV_DBR_SCHED);
3612 open_dump_file (DFI_dbr, decl);
3614 dbr_schedule (insns, rtl_dump_file);
3616 close_dump_file (DFI_dbr, print_rtl_with_bb, insns);
3617 timevar_pop (TV_DBR_SCHED);
3623 /* Shorten branches.
3625 Note this must run before reg-stack because of death note (ab)use
3626 in the ia32 backend. */
3627 timevar_push (TV_SHORTEN_BRANCH);
3628 shorten_branches (get_insns ());
3629 timevar_pop (TV_SHORTEN_BRANCH);
3632 timevar_push (TV_REG_STACK);
3633 open_dump_file (DFI_stack, decl);
3635 reg_to_stack (insns, rtl_dump_file);
3637 close_dump_file (DFI_stack, print_rtl_with_bb, insns);
3638 timevar_pop (TV_REG_STACK);
3643 current_function_nothrow = nothrow_function_p ();
3644 if (current_function_nothrow)
3645 /* Now we know that this can't throw; set the flag for the benefit
3646 of other functions later in this translation unit. */
3647 TREE_NOTHROW (current_function_decl) = 1;
3649 /* Now turn the rtl into assembler code. */
3651 timevar_push (TV_FINAL);
3656 /* Get the function's name, as described by its RTL. This may be
3657 different from the DECL_NAME name used in the source file. */
3659 x = DECL_RTL (decl);
3660 if (GET_CODE (x) != MEM)
3663 if (GET_CODE (x) != SYMBOL_REF)
3665 fnname = XSTR (x, 0);
3667 assemble_start_function (decl, fnname);
3668 final_start_function (insns, asm_out_file, optimize);
3669 final (insns, asm_out_file, optimize, 0);
3670 final_end_function (insns, asm_out_file, optimize);
3671 assemble_end_function (decl, fnname);
3673 fflush (asm_out_file);
3675 /* Release all memory allocated by flow. */
3676 free_basic_block_vars (0);
3678 /* Release all memory held by regsets now. */
3679 regset_release_memory ();
3681 timevar_pop (TV_FINAL);
3685 /* Write DBX symbols if requested. */
3687 /* Note that for those inline functions where we don't initially
3688 know for certain that we will be generating an out-of-line copy,
3689 the first invocation of this routine (rest_of_compilation) will
3690 skip over this code by doing a `goto exit_rest_of_compilation;'.
3691 Later on, finish_compilation will call rest_of_compilation again
3692 for those inline functions that need to have out-of-line copies
3693 generated. During that call, we *will* be routed past here. */
3695 timevar_push (TV_SYMOUT);
3696 #ifdef DBX_DEBUGGING_INFO
3697 if (write_symbols == DBX_DEBUG)
3698 dbxout_function (decl);
3701 #ifdef DWARF_DEBUGGING_INFO
3702 if (write_symbols == DWARF_DEBUG)
3703 dwarfout_file_scope_decl (decl, 0);
3706 #ifdef DWARF2_DEBUGGING_INFO
3707 if (write_symbols == DWARF2_DEBUG)
3708 dwarf2out_decl (decl);
3710 timevar_pop (TV_SYMOUT);
3712 exit_rest_of_compilation:
3714 /* In case the function was not output,
3715 don't leave any temporary anonymous types
3716 queued up for sdb output. */
3717 #ifdef SDB_DEBUGGING_INFO
3718 if (write_symbols == SDB_DEBUG)
3719 sdbout_types (NULL_TREE);
3722 reload_completed = 0;
3723 flow2_completed = 0;
3726 timevar_push (TV_FINAL);
3728 /* Clear out the insn_length contents now that they are no
3730 init_insn_lengths ();
3732 /* Clear out the real_constant_chain before some of the rtx's
3733 it runs through become garbage. */
3734 clear_const_double_mem ();
3736 /* Show no temporary slots allocated. */
3739 free_basic_block_vars (0);
3741 timevar_pop (TV_FINAL);
3743 /* Make sure volatile mem refs aren't considered valid operands for
3744 arithmetic insns. We must call this here if this is a nested inline
3745 function, since the above code leaves us in the init_recog state
3746 (from final.c), and the function context push/pop code does not
3747 save/restore volatile_ok.
3749 ??? Maybe it isn't necessary for expand_start_function to call this
3750 anymore if we do it here? */
3752 init_recog_no_volatile ();
3754 /* We're done with this function. Free up memory if we can. */
3755 free_after_parsing (cfun);
3756 if (! DECL_DEFER_OUTPUT (decl))
3757 free_after_compilation (cfun);
3762 timevar_pop (TV_REST_OF_COMPILATION);
3773 printf (_("Usage: %s input [switches]\n"), progname);
3774 printf (_("Switches:\n"));
3776 printf (_(" -ffixed-<register> Mark <register> as being unavailable to the compiler\n"));
3777 printf (_(" -fcall-used-<register> Mark <register> as being corrupted by function calls\n"));
3778 printf (_(" -fcall-saved-<register> Mark <register> as being preserved across functions\n"));
3779 printf (_(" -finline-limit=<number> Limits the size of inlined functions to <number>\n"));
3780 printf (_(" -fmessage-length=<number> Limits diagnostics messages lengths to <number> characters per line. 0 suppresses line-wrapping\n"));
3781 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"));
3783 for (i = ARRAY_SIZE (f_options); i--;)
3785 const char *description = f_options[i].description;
3787 if (description != NULL && * description != 0)
3788 printf (" -f%-21s %s\n",
3789 f_options[i].string, description);
3792 printf (_(" -O[number] Set optimisation level to [number]\n"));
3793 printf (_(" -Os Optimise for space rather than speed\n"));
3794 printf (_(" -pedantic Issue warnings needed by strict compliance to ISO C\n"));
3795 printf (_(" -pedantic-errors Like -pedantic except that errors are produced\n"));
3796 printf (_(" -w Suppress warnings\n"));
3797 printf (_(" -W Enable extra warnings\n"));
3799 for (i = ARRAY_SIZE (W_options); i--;)
3801 const char *description = W_options[i].description;
3803 if (description != NULL && * description != 0)
3804 printf (" -W%-21s %s\n",
3805 W_options[i].string, description);
3808 printf (_(" -Wunused Enable unused warnings\n"));
3809 printf (_(" -Wid-clash-<num> Warn if 2 identifiers have the same first <num> chars\n"));
3810 printf (_(" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n"));
3811 printf (_(" -p Enable function profiling\n"));
3812 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER)
3813 printf (_(" -a Enable block profiling \n"));
3815 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER) || defined FUNCTION_BLOCK_PROFILER_EXIT
3816 printf (_(" -ax Enable jump profiling \n"));
3818 printf (_(" -o <file> Place output into <file> \n"));
3820 -G <number> Put global and static data smaller than <number>\n\
3821 bytes into a special section (on some targets)\n"));
3823 for (i = ARRAY_SIZE (debug_args); i--;)
3825 if (debug_args[i].description != NULL)
3826 printf (" -g%-21s %s\n",
3827 debug_args[i].arg, debug_args[i].description);
3830 printf (_(" -aux-info <file> Emit declaration info into <file>.X\n"));
3831 printf (_(" -quiet Do not display functions compiled or elapsed time\n"));
3832 printf (_(" -version Display the compiler's version\n"));
3833 printf (_(" -d[letters] Enable dumps from specific passes of the compiler\n"));
3834 printf (_(" -dumpbase <file> Base name to be used for dumps from specific passes\n"));
3835 #if defined INSN_SCHEDULING
3836 printf (_(" -fsched-verbose=<number> Set the verbosity level of the scheduler\n"));
3838 printf (_(" --help Display this information\n"));
3843 /* Display descriptions of language specific options.
3844 If there is no description, note that there is an undocumented option.
3845 If the description is empty, do not display anything. (This allows
3846 options to be deliberately undocumented, for whatever reason).
3847 If the option string is missing, then this is a marker, indicating
3848 that the description string is in fact the name of a language, whose
3849 language specific options are to follow. */
3851 if (ARRAY_SIZE (documented_lang_options) > 1)
3853 printf (_("\nLanguage specific options:\n"));
3855 for (i = 0; i < ARRAY_SIZE (documented_lang_options); i++)
3857 const char *description = documented_lang_options[i].description;
3858 const char *option = documented_lang_options[i].option;
3860 if (description == NULL)
3865 printf (_(" %-23.23s [undocumented]\n"), option);
3867 else if (*description == 0)
3869 else if (option == NULL)
3873 (_("\nThere are undocumented %s specific options as well.\n"),
3877 printf (_("\n Options for %s:\n"), description);
3882 printf (" %-23.23s %s\n", option, description);
3887 printf (_("\nThere are undocumented %s specific options as well.\n"),
3890 display_target_options ();
3894 display_target_options ()
3899 if (ARRAY_SIZE (target_switches) > 1
3900 #ifdef TARGET_OPTIONS
3901 || ARRAY_SIZE (target_options) > 1
3909 printf (_("\nTarget specific options:\n"));
3911 for (i = ARRAY_SIZE (target_switches); i--;)
3913 const char *option = target_switches[i].name;
3914 const char *description = target_switches[i].description;
3916 if (option == NULL || *option == 0)
3918 else if (description == NULL)
3923 printf (_(" -m%-23.23s [undocumented]\n"), option);
3925 else if (* description != 0)
3926 doc += printf (" -m%-23.23s %s\n", option, description);
3929 #ifdef TARGET_OPTIONS
3930 for (i = ARRAY_SIZE (target_options); i--;)
3932 const char *option = target_options[i].prefix;
3933 const char *description = target_options[i].description;
3935 if (option == NULL || *option == 0)
3937 else if (description == NULL)
3942 printf (_(" -m%-23.23s [undocumented]\n"), option);
3944 else if (* description != 0)
3945 doc += printf (" -m%-23.23s %s\n", option, description);
3951 printf (_("\nThere are undocumented target specific options as well.\n"));
3953 printf (_(" They exist, but they are not documented.\n"));
3958 /* Parse a -d... comand line switch. */
3961 decode_d_option (arg)
3970 for (i = 0; i < DFI_MAX; ++i)
3971 dump_file[i].enabled = 1;
3980 flag_print_asm_name = 1;
3983 flag_dump_rtl_in_asm = 1;
3984 flag_print_asm_name = 1;
3987 graph_dump_format = vcg;
3990 rtl_dump_and_exit = 1;
3995 case 'D': /* These are handled by the preprocessor. */
4001 for (i = 0; i < DFI_MAX; ++i)
4002 if (c == dump_file[i].debug_switch)
4004 dump_file[i].enabled = 1;
4009 warning ("unrecognized gcc debugging option: %c", c);
4014 /* Parse a -f... comand line switch. ARG is the value after the -f.
4015 It is safe to access 'ARG - 2' to generate the full switch name.
4016 Return the number of strings consumed. */
4019 decode_f_option (arg)
4023 const char *option_value = NULL;
4025 /* Search for the option in the table of binary f options. */
4026 for (j = ARRAY_SIZE (f_options); j--;)
4028 if (!strcmp (arg, f_options[j].string))
4030 *f_options[j].variable = f_options[j].on_value;
4034 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4035 && ! strcmp (arg + 3, f_options[j].string))
4037 *f_options[j].variable = ! f_options[j].on_value;
4042 if ((option_value = skip_leading_substring (arg, "inline-limit-"))
4043 || (option_value = skip_leading_substring (arg, "inline-limit=")))
4045 read_integral_parameter (option_value, arg - 2, inline_max_insns);
4046 #ifdef INSN_SCHEDULING
4047 else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
4048 fix_sched_param ("verbose", option_value);
4050 else if ((option_value = skip_leading_substring (arg, "fixed-")))
4051 fix_register (option_value, 1, 1);
4052 else if ((option_value = skip_leading_substring (arg, "call-used-")))
4053 fix_register (option_value, 0, 1);
4054 else if ((option_value = skip_leading_substring (arg, "call-saved-")))
4055 fix_register (option_value, 0, 0);
4056 else if ((option_value = skip_leading_substring (arg, "align-loops=")))
4057 align_loops = read_integral_parameter (option_value, arg - 2, align_loops);
4058 else if ((option_value = skip_leading_substring (arg, "align-functions=")))
4060 = read_integral_parameter (option_value, arg - 2, align_functions);
4061 else if ((option_value = skip_leading_substring (arg, "align-jumps=")))
4062 align_jumps = read_integral_parameter (option_value, arg - 2, align_jumps);
4063 else if ((option_value = skip_leading_substring (arg, "align-labels=")))
4065 = read_integral_parameter (option_value, arg - 2, align_labels);
4066 else if ((option_value
4067 = skip_leading_substring (arg, "stack-limit-register=")))
4069 int reg = decode_reg_name (option_value);
4071 error ("unrecognized register name `%s'", option_value);
4073 stack_limit_rtx = gen_rtx_REG (Pmode, reg);
4075 else if ((option_value
4076 = skip_leading_substring (arg, "stack-limit-symbol=")))
4079 nm = ggc_strdup (option_value);
4080 stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
4082 else if ((option_value
4083 = skip_leading_substring (arg, "message-length=")))
4084 diagnostic_message_length_per_line =
4085 read_integral_parameter (option_value, arg - 2,
4086 diagnostic_message_length_per_line);
4087 else if ((option_value
4088 = skip_leading_substring (arg, "diagnostics-show-location=")))
4090 if (!strcmp (option_value, "once"))
4091 set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_ONCE);
4092 else if (!strcmp (option_value, "every-line"))
4093 set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE);
4095 error ("Unrecognized option `%s'", arg - 2);
4097 else if (!strcmp (arg, "no-stack-limit"))
4098 stack_limit_rtx = NULL_RTX;
4099 else if (!strcmp (arg, "preprocessed"))
4100 /* Recognise this switch but do nothing. This prevents warnings
4101 about an unrecognized switch if cpplib has not been linked in. */
4109 /* Parse a -W... comand line switch. ARG is the value after the -W.
4110 It is safe to access 'ARG - 2' to generate the full switch name.
4111 Return the number of strings consumed. */
4114 decode_W_option (arg)
4117 const char *option_value = NULL;
4120 /* Search for the option in the table of binary W options. */
4122 for (j = ARRAY_SIZE (W_options); j--;)
4124 if (!strcmp (arg, W_options[j].string))
4126 *W_options[j].variable = W_options[j].on_value;
4130 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4131 && ! strcmp (arg + 3, W_options[j].string))
4133 *W_options[j].variable = ! W_options[j].on_value;
4138 if ((option_value = skip_leading_substring (arg, "id-clash-")))
4140 id_clash_len = read_integral_parameter (option_value, arg - 2, -1);
4142 if (id_clash_len != -1)
4145 else if ((option_value = skip_leading_substring (arg, "larger-than-")))
4147 larger_than_size = read_integral_parameter (option_value, arg - 2, -1);
4149 if (larger_than_size != -1)
4150 warn_larger_than = 1;
4152 else if (!strcmp (arg, "unused"))
4156 else if (!strcmp (arg, "no-unused"))
4166 /* Parse a -g... comand line switch. ARG is the value after the -g.
4167 It is safe to access 'ARG - 2' to generate the full switch name.
4168 Return the number of strings consumed. */
4171 decode_g_option (arg)
4175 /* A lot of code assumes write_symbols == NO_DEBUG if the
4176 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4177 of what debugging type has been selected). This records the
4178 selected type. It is an error to specify more than one
4180 static enum debug_info_type selected_debug_type = NO_DEBUG;
4181 /* Non-zero if debugging format has been explicitly set.
4182 -g and -ggdb don't explicitly set the debugging format so
4183 -gdwarf -g3 is equivalent to -gdwarf3. */
4184 static int type_explicitly_set_p = 0;
4185 /* Indexed by enum debug_info_type. */
4186 static const char *debug_type_names[] =
4188 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4191 /* The maximum admissible debug level value. */
4192 static const unsigned max_debug_level = 3;
4194 /* Look up ARG in the table. */
4195 for (da = debug_args; da->arg; da++)
4197 const int da_len = strlen (da->arg);
4199 if (da_len == 0 || ! strncmp (arg, da->arg, da_len))
4201 enum debug_info_type type = da->debug_type;
4202 const char *p = arg + da_len;
4204 if (*p && (*p < '0' || *p > '9'))
4207 /* A debug flag without a level defaults to level 2.
4208 Note we do not want to call read_integral_parameter
4209 for that case since it will call atoi which
4212 ??? We may want to generalize the interface to
4213 read_integral_parameter to better handle this case
4214 if this case shows up often. */
4216 level = read_integral_parameter (p, 0, max_debug_level + 1);
4220 if (da_len > 1 && *p && !strncmp (arg, "dwarf", da_len))
4222 error ("use -gdwarf -g%d for DWARF v1, level %d",
4225 error ("use -gdwarf-2 for DWARF v2");
4228 if (level > max_debug_level)
4231 ignoring option `%s' due to invalid debug level specification",
4233 level = debug_info_level;
4236 if (type == NO_DEBUG)
4238 type = PREFERRED_DEBUGGING_TYPE;
4240 if (da_len > 1 && strncmp (arg, "gdb", da_len) == 0)
4242 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4243 type = DWARF2_DEBUG;
4245 #ifdef DBX_DEBUGGING_INFO
4252 if (type == NO_DEBUG)
4253 warning ("`%s': unknown or unsupported -g option", arg - 2);
4255 /* Does it conflict with an already selected type? */
4256 if (type_explicitly_set_p
4257 /* -g/-ggdb don't conflict with anything. */
4258 && da->debug_type != NO_DEBUG
4259 && type != selected_debug_type)
4260 warning ("`%s' ignored, conflicts with `-g%s'",
4261 arg - 2, debug_type_names[(int) selected_debug_type]);
4264 /* If the format has already been set, -g/-ggdb
4265 only change the debug level. */
4266 if (type_explicitly_set_p && da->debug_type == NO_DEBUG)
4267 /* Don't change debugging type. */
4271 selected_debug_type = type;
4272 type_explicitly_set_p = da->debug_type != NO_DEBUG;
4275 write_symbols = (level == 0
4277 : selected_debug_type);
4278 use_gnu_debug_info_extensions = da->use_extensions_p;
4279 debug_info_level = (enum debug_info_level) level;
4292 /* Decode the first argument in the argv as a language-independent option.
4293 Return the number of strings consumed. */
4296 independent_decode_option (argc, argv)
4300 char *arg = argv[0];
4302 if (arg[0] != '-' || arg[1] == 0)
4314 if (!strcmp (arg, "-help"))
4320 if (!strcmp (arg, "-target-help"))
4322 display_target_options ();
4335 /* Already been treated in main (). Do nothing. */
4339 set_target_switch (arg + 1);
4343 return decode_f_option (arg + 1);
4346 return decode_g_option (arg + 1);
4349 if (!strcmp (arg, "dumpbase"))
4354 dump_base_name = argv[1];
4358 decode_d_option (arg + 1);
4362 if (!strcmp (arg, "pedantic"))
4364 else if (!strcmp (arg, "pedantic-errors"))
4365 flag_pedantic_errors = pedantic = 1;
4366 else if (arg[1] == 0)
4373 if (!strcmp (arg, "quiet"))
4380 if (!strcmp (arg, "version"))
4388 inhibit_warnings = 1;
4397 /* We save the value of warn_uninitialized, since if they put
4398 -Wuninitialized on the command line, we need to generate a
4399 warning about not using it without also specifying -O. */
4400 if (warn_uninitialized != 1)
4401 warn_uninitialized = 2;
4404 return decode_W_option (arg + 1);
4410 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4411 warning ("`-a' option (basic block profile) not supported");
4413 profile_block_flag = (profile_block_flag < 2) ? 1 : 3;
4416 else if (!strcmp (arg, "ax"))
4418 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4419 warning ("`-ax' option (jump profiling) not supported");
4421 profile_block_flag = (!profile_block_flag
4422 || profile_block_flag == 2) ? 2 : 3;
4425 else if (!strncmp (arg, "aux-info", 8))
4427 flag_gen_aux_info = 1;
4433 aux_info_file_name = argv[1];
4437 aux_info_file_name = arg + 8;
4449 asm_file_name = argv[1];
4464 g_switch_val = read_integral_parameter (argv[1], 0, -1);
4469 g_switch_val = read_integral_parameter (arg + 1, 0, -1);
4473 if (g_switch_val == -1)
4477 g_switch_set = TRUE;
4478 g_switch_value = g_switch_val;
4488 /* Entry point of cc1/c++. Decode command args, then call compile_file.
4489 Exit code is 35 if can't open files, 34 if fatal error,
4490 33 if had nonfatal errors, else success. */
4492 extern int main PARAMS ((int, char **));
4502 /* save in case md file wants to emit args as a comment. */
4506 p = argv[0] + strlen (argv[0]);
4507 while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
4511 #ifdef HAVE_LC_MESSAGES
4512 setlocale (LC_MESSAGES, "");
4514 (void) bindtextdomain (PACKAGE, localedir);
4515 (void) textdomain (PACKAGE);
4517 /* Install handler for SIGFPE, which may be received while we do
4518 compile-time floating point arithmetic. */
4519 signal (SIGFPE, float_signal);
4521 /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */
4523 signal (SIGSEGV, crash_signal);
4526 signal (SIGILL, crash_signal);
4529 signal (SIGBUS, crash_signal);
4532 signal (SIGABRT, crash_signal);
4534 #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
4535 signal (SIGIOT, crash_signal);
4538 decl_printable_name = decl_name;
4539 lang_expand_expr = (lang_expand_expr_t) do_abort;
4541 /* Initialize whether `char' is signed. */
4542 flag_signed_char = DEFAULT_SIGNED_CHAR;
4543 #ifdef DEFAULT_SHORT_ENUMS
4544 /* Initialize how much space enums occupy, by default. */
4545 flag_short_enums = DEFAULT_SHORT_ENUMS;
4548 /* Initialize the garbage-collector. */
4550 ggc_add_root (&input_file_stack, 1, sizeof input_file_stack,
4552 ggc_add_rtx_root (&stack_limit_rtx, 1);
4553 ggc_add_tree_root (¤t_function_decl, 1);
4554 ggc_add_tree_root (¤t_function_func_begin_label, 1);
4556 /* Initialize the diagnostics reporting machinery. */
4557 initialize_diagnostics ();
4559 /* Perform language-specific options intialization. */
4560 lang_init_options ();
4562 /* Scan to see what optimization level has been specified. That will
4563 determine the default value of many flags. */
4564 for (i = 1; i < argc; i++)
4566 if (!strcmp (argv[i], "-O"))
4571 else if (argv[i][0] == '-' && argv[i][1] == 'O')
4573 /* Handle -Os, -O2, -O3, -O69, ... */
4574 char *p = &argv[i][2];
4576 if ((p[0] == 's') && (p[1] == 0))
4580 /* Optimizing for size forces optimize to be 2. */
4585 const int optimize_val = read_integral_parameter (p, p - 2, -1);
4586 if (optimize_val != -1)
4588 optimize = optimize_val;
4598 flag_thread_jumps = 1;
4600 flag_delayed_branch = 1;
4602 #ifdef CAN_DEBUG_WITHOUT_FP
4603 flag_omit_frame_pointer = 1;
4609 flag_optimize_sibling_calls = 1;
4610 flag_cse_follow_jumps = 1;
4611 flag_cse_skip_blocks = 1;
4613 flag_expensive_optimizations = 1;
4614 flag_strength_reduce = 1;
4615 flag_rerun_cse_after_loop = 1;
4616 flag_rerun_loop_opt = 1;
4617 flag_caller_saves = 1;
4620 #ifdef INSN_SCHEDULING
4621 flag_schedule_insns = 1;
4622 flag_schedule_insns_after_reload = 1;
4625 flag_strict_aliasing = 1;
4626 flag_delete_null_pointer_checks = 1;
4627 flag_reorder_blocks = 1;
4632 flag_inline_functions = 1;
4635 if (optimize < 2 || optimize_size)
4640 align_functions = 1;
4643 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
4646 set_target_switch ("");
4648 /* Unwind tables are always present in an ABI-conformant IA-64
4649 object file, so the default should be ON. */
4650 #ifdef IA64_UNWIND_INFO
4651 flag_unwind_tables = IA64_UNWIND_INFO;
4654 #ifdef OPTIMIZATION_OPTIONS
4655 /* Allow default optimizations to be specified on a per-machine basis. */
4656 OPTIMIZATION_OPTIONS (optimize, optimize_size);
4659 /* Initialize register usage now so switches may override. */
4662 /* Perform normal command line switch decoding. */
4663 for (i = 1; i < argc;)
4665 unsigned int lang_processed;
4666 unsigned int indep_processed;
4668 /* Give the language a chance to decode the option for itself. */
4669 lang_processed = lang_decode_option (argc - i, argv + i);
4671 /* Now see if the option also has a language independent meaning.
4672 Some options are both language specific and language independent,
4674 indep_processed = independent_decode_option (argc - i, argv + i);
4676 if (lang_processed || indep_processed)
4677 i += MAX (lang_processed, indep_processed);
4680 const char *option = NULL;
4681 const char *lang = NULL;
4684 /* It is possible that the command line switch is not valid for the
4685 current language, but it is valid for another language. In order
4686 to be compatible with previous versions of the compiler (which
4687 did not issue an error message in this case) we check for this
4688 possibility here. If we do find a match, then if extra_warnings
4689 is set we generate a warning message, otherwise we will just
4690 ignore the option. */
4691 for (j = 0; j < ARRAY_SIZE (documented_lang_options); j++)
4693 option = documented_lang_options[j].option;
4696 lang = documented_lang_options[j].description;
4697 else if (! strncmp (argv[i], option, strlen (option)))
4701 if (j != ARRAY_SIZE (documented_lang_options))
4705 warning ("Ignoring command line option '%s'", argv[i]);
4708 ("(It is valid for %s but not the selected language)",
4712 else if (argv[i][0] == '-' && argv[i][1] == 'g')
4713 warning ("`%s': unknown or unsupported -g option", &argv[i][2]);
4715 error ("Unrecognized option `%s'", argv[i]);
4721 /* Reflect any language-specific diagnostic option setting. */
4722 reshape_diagnostic_buffer ();
4724 /* Checker uses the frame pointer. */
4725 if (flag_check_memory_usage)
4726 flag_omit_frame_pointer = 0;
4730 /* Inlining does not work if not optimizing,
4731 so force it not to be done. */
4735 /* The c_decode_option and lang_decode_option functions set
4736 this to `2' if -Wall is used, so we can avoid giving out
4737 lots of errors for people who don't realize what -Wall does. */
4738 if (warn_uninitialized == 1)
4739 warning ("-Wuninitialized is not supported without -O");
4742 #ifdef OVERRIDE_OPTIONS
4743 /* Some machines may reject certain combinations of options. */
4747 if (exceptions_via_longjmp == 2)
4749 #ifdef DWARF2_UNWIND_INFO
4750 exceptions_via_longjmp = ! DWARF2_UNWIND_INFO;
4752 #ifdef IA64_UNWIND_INFO
4753 exceptions_via_longjmp = ! IA64_UNWIND_INFO;
4755 exceptions_via_longjmp = 1;
4760 /* Since each function gets its own handler data, we can't support the
4761 new model currently, since it depend on a specific rethrow label
4762 which is declared at the front of the table, and we can only
4763 have one such symbol in a file. */
4764 #ifdef IA64_UNWIND_INFO
4765 flag_new_exceptions = 0;
4768 /* Set up the align_*_log variables, defaulting them to 1 if they
4769 were still unset. */
4770 if (align_loops <= 0) align_loops = 1;
4771 align_loops_log = floor_log2 (align_loops * 2 - 1);
4772 if (align_jumps <= 0) align_jumps = 1;
4773 align_jumps_log = floor_log2 (align_jumps * 2 - 1);
4774 if (align_labels <= 0) align_labels = 1;
4775 align_labels_log = floor_log2 (align_labels * 2 - 1);
4776 if (align_functions <= 0) align_functions = 1;
4777 align_functions_log = floor_log2 (align_functions * 2 - 1);
4779 if (profile_block_flag == 3)
4781 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4782 profile_block_flag = 2;
4785 /* Unrolling all loops implies that standard loop unrolling must also
4787 if (flag_unroll_all_loops)
4788 flag_unroll_loops = 1;
4789 /* Loop unrolling requires that strength_reduction be on also. Silently
4790 turn on strength reduction here if it isn't already on. Also, the loop
4791 unrolling code assumes that cse will be run after loop, so that must
4792 be turned on also. */
4793 if (flag_unroll_loops)
4795 flag_strength_reduce = 1;
4796 flag_rerun_cse_after_loop = 1;
4799 /* Warn about options that are not supported on this machine. */
4800 #ifndef INSN_SCHEDULING
4801 if (flag_schedule_insns || flag_schedule_insns_after_reload)
4802 warning ("instruction scheduling not supported on this target machine");
4805 if (flag_delayed_branch)
4806 warning ("this target machine does not have delayed branches");
4809 user_label_prefix = USER_LABEL_PREFIX;
4810 if (flag_leading_underscore != -1)
4812 /* If the default prefix is more complicated than "" or "_",
4813 issue a warning and ignore this option. */
4814 if (user_label_prefix[0] == 0 ||
4815 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
4817 user_label_prefix = flag_leading_underscore ? "_" : "";
4820 warning ("-f%sleading-underscore not supported on this target machine",
4821 flag_leading_underscore ? "" : "no-");
4824 /* If we are in verbose mode, write out the version and maybe all the
4825 option flags in use. */
4828 print_version (stderr, "");
4830 print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
4833 compile_file (filename);
4835 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__)) && !defined(__INTERIX)
4838 char *lim = (char *) sbrk (0);
4840 fnotice (stderr, "Data size %ld.\n", (long) (lim - (char *) &environ));
4845 system ("ps -l 1>&2");
4848 #endif /* not USG */
4851 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX */
4854 return (FATAL_EXIT_CODE);
4856 return (FATAL_EXIT_CODE);
4857 return (SUCCESS_EXIT_CODE);
4860 /* Decode -m switches. */
4861 /* Decode the switch -mNAME. */
4864 set_target_switch (name)
4868 int valid_target_option = 0;
4870 for (j = 0; j < ARRAY_SIZE (target_switches); j++)
4871 if (!strcmp (target_switches[j].name, name))
4873 if (target_switches[j].value < 0)
4874 target_flags &= ~-target_switches[j].value;
4876 target_flags |= target_switches[j].value;
4877 valid_target_option = 1;
4880 #ifdef TARGET_OPTIONS
4881 if (!valid_target_option)
4882 for (j = 0; j < ARRAY_SIZE (target_options); j++)
4884 int len = strlen (target_options[j].prefix);
4885 if (!strncmp (target_options[j].prefix, name, len))
4887 *target_options[j].variable = name + len;
4888 valid_target_option = 1;
4893 if (!valid_target_option)
4894 error ("Invalid option `%s'", name);
4897 /* Print version information to FILE.
4898 Each line begins with INDENT (for the case where FILE is the
4899 assembler output file). */
4902 print_version (file, indent)
4907 #define __VERSION__ "[?]"
4911 "%s%s%s version %s (%s) compiled by GNU C version %s.\n"
4913 "%s%s%s version %s (%s) compiled by CC.\n"
4915 , indent, *indent != 0 ? " " : "",
4916 language_string, version_string, TARGET_NAME, __VERSION__);
4919 /* Print an option value and return the adjusted position in the line.
4920 ??? We don't handle error returns from fprintf (disk full); presumably
4921 other code will catch a disk full though. */
4924 print_single_switch (file, pos, max, indent, sep, term, type, name)
4927 const char *indent, *sep, *term, *type, *name;
4929 /* The ultrix fprintf returns 0 on success, so compute the result we want
4930 here since we need it for the following test. */
4931 int len = strlen (sep) + strlen (type) + strlen (name);
4936 fprintf (file, "%s", term);
4941 fprintf (file, "%s", indent);
4942 pos = strlen (indent);
4944 fprintf (file, "%s%s%s", sep, type, name);
4949 /* Print active target switches to FILE.
4950 POS is the current cursor position and MAX is the size of a "line".
4951 Each line begins with INDENT and ends with TERM.
4952 Each switch is separated from the next by SEP. */
4955 print_switch_values (file, pos, max, indent, sep, term)
4958 const char *indent, *sep, *term;
4963 /* Print the options as passed. */
4965 pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
4966 _("options passed: "), "");
4968 for (p = &save_argv[1]; *p != NULL; p++)
4972 if (strcmp (*p, "-o") == 0)
4978 if (strcmp (*p, "-quiet") == 0)
4980 if (strcmp (*p, "-version") == 0)
4985 pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
4988 fprintf (file, "%s", term);
4990 /* Print the -f and -m options that have been enabled.
4991 We don't handle language specific options but printing argv
4994 pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
4995 _("options enabled: "), "");
4997 for (j = 0; j < ARRAY_SIZE (f_options); j++)
4998 if (*f_options[j].variable == f_options[j].on_value)
4999 pos = print_single_switch (file, pos, max, indent, sep, term,
5000 "-f", f_options[j].string);
5002 /* Print target specific options. */
5004 for (j = 0; j < ARRAY_SIZE (target_switches); j++)
5005 if (target_switches[j].name[0] != '\0'
5006 && target_switches[j].value > 0
5007 && ((target_switches[j].value & target_flags)
5008 == target_switches[j].value))
5010 pos = print_single_switch (file, pos, max, indent, sep, term,
5011 "-m", target_switches[j].name);
5014 #ifdef TARGET_OPTIONS
5015 for (j = 0; j < ARRAY_SIZE (target_options); j++)
5016 if (*target_options[j].variable != NULL)
5019 sprintf (prefix, "-m%s", target_options[j].prefix);
5020 pos = print_single_switch (file, pos, max, indent, sep, term,
5021 prefix, *target_options[j].variable);
5025 fprintf (file, "%s", term);
5028 /* Record the beginning of a new source file, named FILENAME. */
5031 debug_start_source_file (filename)
5032 register const char *filename ATTRIBUTE_UNUSED;
5034 #ifdef DBX_DEBUGGING_INFO
5035 if (write_symbols == DBX_DEBUG)
5036 dbxout_start_new_source_file (filename);
5038 #ifdef DWARF_DEBUGGING_INFO
5039 if (debug_info_level == DINFO_LEVEL_VERBOSE
5040 && write_symbols == DWARF_DEBUG)
5041 dwarfout_start_new_source_file (filename);
5042 #endif /* DWARF_DEBUGGING_INFO */
5043 #ifdef DWARF2_DEBUGGING_INFO
5044 if (write_symbols == DWARF2_DEBUG)
5045 dwarf2out_start_source_file (filename);
5046 #endif /* DWARF2_DEBUGGING_INFO */
5047 #ifdef SDB_DEBUGGING_INFO
5048 if (write_symbols == SDB_DEBUG)
5049 sdbout_start_new_source_file (filename);
5053 /* Record the resumption of a source file. LINENO is the line number in
5054 the source file we are returning to. */
5057 debug_end_source_file (lineno)
5058 register unsigned lineno ATTRIBUTE_UNUSED;
5060 #ifdef DBX_DEBUGGING_INFO
5061 if (write_symbols == DBX_DEBUG)
5062 dbxout_resume_previous_source_file ();
5064 #ifdef DWARF_DEBUGGING_INFO
5065 if (debug_info_level == DINFO_LEVEL_VERBOSE
5066 && write_symbols == DWARF_DEBUG)
5067 dwarfout_resume_previous_source_file (lineno);
5068 #endif /* DWARF_DEBUGGING_INFO */
5069 #ifdef DWARF2_DEBUGGING_INFO
5070 if (write_symbols == DWARF2_DEBUG)
5071 dwarf2out_end_source_file ();
5072 #endif /* DWARF2_DEBUGGING_INFO */
5073 #ifdef SDB_DEBUGGING_INFO
5074 if (write_symbols == SDB_DEBUG)
5075 sdbout_resume_previous_source_file ();
5079 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5080 the tail part of the directive line, i.e. the part which is past the
5081 initial whitespace, #, whitespace, directive-name, whitespace part. */
5084 debug_define (lineno, buffer)
5085 register unsigned lineno ATTRIBUTE_UNUSED;
5086 register char *buffer ATTRIBUTE_UNUSED;
5088 #ifdef DWARF_DEBUGGING_INFO
5089 if (debug_info_level == DINFO_LEVEL_VERBOSE
5090 && write_symbols == DWARF_DEBUG)
5091 dwarfout_define (lineno, buffer);
5092 #endif /* DWARF_DEBUGGING_INFO */
5093 #ifdef DWARF2_DEBUGGING_INFO
5094 if (debug_info_level == DINFO_LEVEL_VERBOSE
5095 && write_symbols == DWARF2_DEBUG)
5096 dwarf2out_define (lineno, buffer);
5097 #endif /* DWARF2_DEBUGGING_INFO */
5100 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5101 the tail part of the directive line, i.e. the part which is past the
5102 initial whitespace, #, whitespace, directive-name, whitespace part. */
5105 debug_undef (lineno, buffer)
5106 register unsigned lineno ATTRIBUTE_UNUSED;
5107 register char *buffer ATTRIBUTE_UNUSED;
5109 #ifdef DWARF_DEBUGGING_INFO
5110 if (debug_info_level == DINFO_LEVEL_VERBOSE
5111 && write_symbols == DWARF_DEBUG)
5112 dwarfout_undef (lineno, buffer);
5113 #endif /* DWARF_DEBUGGING_INFO */
5114 #ifdef DWARF2_DEBUGGING_INFO
5115 if (debug_info_level == DINFO_LEVEL_VERBOSE
5116 && write_symbols == DWARF2_DEBUG)
5117 dwarf2out_undef (lineno, buffer);
5118 #endif /* DWARF2_DEBUGGING_INFO */
5121 /* Returns nonzero if it is appropriate not to emit any debugging
5122 information for BLOCK, because it doesn't contain any instructions.
5123 This may not be the case for blocks containing nested functions, since
5124 we may actually call such a function even though the BLOCK information
5128 debug_ignore_block (block)
5129 tree block ATTRIBUTE_UNUSED;
5131 /* Never delete the BLOCK for the outermost scope
5132 of the function; we can refer to names from
5133 that scope even if the block notes are messed up. */
5134 if (is_body_block (block))
5137 #ifdef DWARF2_DEBUGGING_INFO
5138 if (write_symbols == DWARF2_DEBUG)
5139 return dwarf2out_ignore_block (block);