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. */
293 /* Describes all the dump files. Should be kept in order of the
294 pass and in sync with dump_file_index above.
296 Remaining -d letters:
302 struct dump_file_info dump_file[DFI_MAX] =
304 { "rtl", 'r', 0, 0, 0 },
305 { "sibling", 'i', 0, 0, 0 },
306 { "jump", 'j', 0, 0, 0 },
307 { "cse", 's', 0, 0, 0 },
308 { "addressof", 'F', 0, 0, 0 },
309 { "ssa", 'e', 1, 0, 0 },
310 { "dce", 'X', 1, 0, 0 },
311 { "ussa", 'e', 1, 0, 0 }, /* Yes, duplicate enable switch. */
312 { "gcse", 'G', 1, 0, 0 },
313 { "loop", 'L', 1, 0, 0 },
314 { "cse2", 't', 1, 0, 0 },
315 { "cfg", 'f', 1, 0, 0 },
316 { "bp", 'b', 1, 0, 0 },
317 { "life", 'f', 1, 0, 0 }, /* Yes, duplicate enable switch. */
318 { "combine", 'c', 1, 0, 0 },
319 { "ce", 'C', 1, 0, 0 },
320 { "regmove", 'N', 1, 0, 0 },
321 { "sched", 'S', 1, 0, 0 },
322 { "lreg", 'l', 1, 0, 0 },
323 { "greg", 'g', 1, 0, 0 },
324 { "postreload", 'o', 1, 0, 0 },
325 { "flow2", 'w', 1, 0, 0 },
326 { "peephole2", 'z', 1, 0, 0 },
327 { "rnreg", 'n', 1, 0, 0 },
328 { "ce2", 'E', 1, 0, 0 },
329 { "sched2", 'R', 1, 0, 0 },
330 { "bbro", 'B', 1, 0, 0 },
331 { "jump2", 'J', 1, 0, 0 },
332 { "mach", 'M', 1, 0, 0 },
333 { "dbr", 'd', 0, 0, 0 },
334 { "stack", 'k', 1, 0, 0 },
337 static int open_dump_file PARAMS ((enum dump_file_index, tree));
338 static void close_dump_file PARAMS ((enum dump_file_index,
339 void (*) (FILE *, rtx), rtx));
341 /* Other flags saying which kinds of debugging dump have been requested. */
343 int rtl_dump_and_exit;
344 int flag_print_asm_name;
345 static int flag_print_mem;
346 static int version_flag;
347 static char *filename;
348 enum graph_dump_types graph_dump_format;
350 /* Name for output file of assembly code, specified with -o. */
354 /* Value of the -G xx switch, and whether it was passed or not. */
358 /* Type(s) of debugging information we are producing (if any).
359 See flags.h for the definitions of the different possible
360 types of debugging information. */
361 enum debug_info_type write_symbols = NO_DEBUG;
363 /* Level of debugging information we are producing. See flags.h
364 for the definitions of the different possible levels. */
365 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
367 /* Nonzero means use GNU-only extensions in the generated symbolic
368 debugging information. */
369 /* Currently, this only has an effect when write_symbols is set to
370 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
371 int use_gnu_debug_info_extensions = 0;
373 /* Nonzero means do optimizations. -O.
374 Particular numeric values stand for particular amounts of optimization;
375 thus, -O2 stores 2 here. However, the optimizations beyond the basic
376 ones are not controlled directly by this variable. Instead, they are
377 controlled by individual `flag_...' variables that are defaulted
378 based on this variable. */
382 /* Nonzero means optimize for size. -Os.
383 The only valid values are zero and non-zero. When optimize_size is
384 non-zero, optimize defaults to 2, but certain individual code
385 bloating optimizations are disabled. */
387 int optimize_size = 0;
389 /* Number of error messages and warning messages so far. */
392 int warningcount = 0;
395 /* The FUNCTION_DECL for the function currently being compiled,
396 or 0 if between functions. */
397 tree current_function_decl;
399 /* Set to the FUNC_BEGIN label of the current function, or NULL_TREE
401 tree current_function_func_begin_label;
403 /* Pointer to function to compute the name to use to print a declaration.
404 DECL is the declaration in question.
405 VERBOSITY determines what information will be printed:
406 0: DECL_NAME, demangled as necessary.
407 1: and scope information.
408 2: and any other information that might be interesting, such as function
409 parameter types in C++. */
411 const char *(*decl_printable_name) PARAMS ((tree, int));
413 /* Pointer to function to compute rtl for a language-specific tree code. */
415 typedef rtx (*lang_expand_expr_t)
416 PARAMS ((union tree_node *, rtx, enum machine_mode,
417 enum expand_modifier modifier));
419 lang_expand_expr_t lang_expand_expr = 0;
421 tree (*lang_expand_constant) PARAMS ((tree)) = 0;
423 /* Pointer to function to finish handling an incomplete decl at the
424 end of compilation. */
426 void (*incomplete_decl_finalize_hook) PARAMS ((tree)) = 0;
428 /* Nonzero if doing dwarf2 duplicate elimination. */
430 int flag_eliminate_dwarf2_dups = 0;
432 /* Nonzero if generating code to do profiling. */
434 int profile_flag = 0;
436 /* Nonzero if generating code to do profiling on a line-by-line basis. */
438 int profile_block_flag;
440 /* Nonzero if generating code to profile program flow graph arcs. */
442 int profile_arc_flag = 0;
444 /* Nonzero if generating info for gcov to calculate line test coverage. */
446 int flag_test_coverage = 0;
448 /* Nonzero indicates that branch taken probabilities should be calculated. */
450 int flag_branch_probabilities = 0;
452 /* Nonzero if basic blocks should be reordered. */
454 int flag_reorder_blocks = 0;
456 /* Nonzero if registers should be renamed. */
458 int flag_rename_registers = 0;
460 /* Nonzero for -pedantic switch: warn about anything
461 that standard spec forbids. */
465 /* Temporarily suppress certain warnings.
466 This is set while reading code from a system header file. */
468 int in_system_header = 0;
470 /* Don't print functions as they are compiled. -quiet. */
474 /* Print times taken by the various passes. -ftime-report. */
478 /* Print memory still in use at end of compilation (which may have little
479 to do with peak memory consumption). -fmem-report. */
483 /* Non-zero means to collect statistics which might be expensive
484 and to print them when we are done. */
485 int flag_detailed_statistics = 0;
490 /* Nonzero means `char' should be signed. */
492 int flag_signed_char;
494 /* Nonzero means give an enum type only as many bytes as it needs. */
496 int flag_short_enums;
498 /* Nonzero for -fcaller-saves: allocate values in regs that need to
499 be saved across function calls, if that produces overall better code.
500 Optional now, so people can test it. */
502 #ifdef DEFAULT_CALLER_SAVES
503 int flag_caller_saves = 1;
505 int flag_caller_saves = 0;
508 /* Nonzero if structures and unions should be returned in memory.
510 This should only be defined if compatibility with another compiler or
511 with an ABI is needed, because it results in slower code. */
513 #ifndef DEFAULT_PCC_STRUCT_RETURN
514 #define DEFAULT_PCC_STRUCT_RETURN 1
517 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
519 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
521 /* Nonzero for -fforce-mem: load memory value into a register
522 before arithmetic on it. This makes better cse but slower compilation. */
524 int flag_force_mem = 0;
526 /* Nonzero for -fforce-addr: load memory address into a register before
527 reference to memory. This makes better cse but slower compilation. */
529 int flag_force_addr = 0;
531 /* Nonzero for -fdefer-pop: don't pop args after each function call;
532 instead save them up to pop many calls' args with one insns. */
534 int flag_defer_pop = 0;
536 /* Nonzero for -ffloat-store: don't allocate floats and doubles
537 in extended-precision registers. */
539 int flag_float_store = 0;
541 /* Nonzero for -fcse-follow-jumps:
542 have cse follow jumps to do a more extensive job. */
544 int flag_cse_follow_jumps;
546 /* Nonzero for -fcse-skip-blocks:
547 have cse follow a branch around a block. */
548 int flag_cse_skip_blocks;
550 /* Nonzero for -fexpensive-optimizations:
551 perform miscellaneous relatively-expensive optimizations. */
552 int flag_expensive_optimizations;
554 /* Nonzero for -fthread-jumps:
555 have jump optimize output of loop. */
557 int flag_thread_jumps;
559 /* Nonzero enables strength-reduction in loop.c. */
561 int flag_strength_reduce = 0;
563 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
564 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
565 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
568 int flag_unroll_loops;
570 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
571 This is generally not a win. */
573 int flag_unroll_all_loops;
575 /* Nonzero forces all invariant computations in loops to be moved
578 int flag_move_all_movables = 0;
580 /* Nonzero forces all general induction variables in loops to be
583 int flag_reduce_all_givs = 0;
585 /* Nonzero to perform full register move optimization passes. This is the
588 int flag_regmove = 0;
590 /* Nonzero for -fwritable-strings:
591 store string constants in data segment and don't uniquize them. */
593 int flag_writable_strings = 0;
595 /* Nonzero means don't put addresses of constant functions in registers.
596 Used for compiling the Unix kernel, where strange substitutions are
597 done on the assembly output. */
599 int flag_no_function_cse = 0;
601 /* Nonzero for -fomit-frame-pointer:
602 don't make a frame pointer in simple functions that don't require one. */
604 int flag_omit_frame_pointer = 0;
606 /* Nonzero means place each function into its own section on those platforms
607 which support arbitrary section names and unlimited numbers of sections. */
609 int flag_function_sections = 0;
611 /* ... and similar for data. */
613 int flag_data_sections = 0;
615 /* Nonzero to inhibit use of define_optimization peephole opts. */
617 int flag_no_peephole = 0;
619 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
620 operations in the interest of optimization. For example it allows
621 GCC to assume arguments to sqrt are nonnegative numbers, allowing
622 faster code for sqrt to be generated. */
624 int flag_fast_math = 0;
626 /* Nonzero allows GCC to optimize sibling and tail recursive calls. */
628 int flag_optimize_sibling_calls = 0;
630 /* Nonzero means the front end generally wants `errno' maintained by math
631 operations, like built-in SQRT, unless overridden by flag_fast_math. */
633 int flag_errno_math = 1;
635 /* 0 means straightforward implementation of complex divide acceptable.
636 1 means wide ranges of inputs must work for complex divide.
637 2 means C99-like requirements for complex divide (not yet implemented). */
639 int flag_complex_divide_method = 0;
641 /* Nonzero means all references through pointers are volatile. */
645 /* Nonzero means treat all global and extern variables as volatile. */
647 int flag_volatile_global;
649 /* Nonzero means treat all static variables as volatile. */
651 int flag_volatile_static;
653 /* Nonzero means just do syntax checking; don't output anything. */
655 int flag_syntax_only = 0;
657 /* Nonzero means perform global cse. */
659 static int flag_gcse;
661 /* Nonzero means to use global dataflow analysis to eliminate
662 useless null pointer tests. */
664 static int flag_delete_null_pointer_checks;
666 /* Nonzero means to rerun cse after loop optimization. This increases
667 compilation time about 20% and picks up a few more common expressions. */
669 static int flag_rerun_cse_after_loop;
671 /* Nonzero means to run loop optimizations twice. */
673 int flag_rerun_loop_opt;
675 /* Nonzero for -finline-functions: ok to inline functions that look like
676 good inline candidates. */
678 int flag_inline_functions;
680 /* Nonzero for -fkeep-inline-functions: even if we make a function
681 go inline everywhere, keep its definition around for debugging
684 int flag_keep_inline_functions;
686 /* Nonzero means that functions will not be inlined. */
690 /* Nonzero means that we should emit static const variables
691 regardless of whether or not optimization is turned on. */
693 int flag_keep_static_consts = 1;
695 /* Nonzero means we should be saving declaration info into a .X file. */
697 int flag_gen_aux_info = 0;
699 /* Specified name of aux-info file. */
701 static char *aux_info_file_name;
703 /* Nonzero means make the text shared if supported. */
705 int flag_shared_data;
707 /* Nonzero means schedule into delayed branch slots if supported. */
709 int flag_delayed_branch;
711 /* Nonzero if we are compiling pure (sharable) code.
712 Value is 1 if we are doing reasonable (i.e. simple
713 offset into offset table) pic. Value is 2 if we can
714 only perform register offsets. */
718 /* Nonzero means generate extra code for exception handling and enable
719 exception handling. */
723 /* Nonzero means use the new model for exception handling. Replaces
724 -DNEW_EH_MODEL as a compile option. */
726 int flag_new_exceptions = 1;
728 /* Nonzero means generate frame unwind info table when supported. */
730 int flag_unwind_tables = 0;
732 /* Nonzero means don't place uninitialized global data in common storage
737 /* Nonzero means pretend it is OK to examine bits of target floats,
738 even if that isn't true. The resulting code will have incorrect constants,
739 but the same series of instructions that the native compiler would make. */
741 int flag_pretend_float;
743 /* Nonzero means change certain warnings into errors.
744 Usually these are warnings about failure to conform to some standard. */
746 int flag_pedantic_errors = 0;
748 /* flag_schedule_insns means schedule insns within basic blocks (before
750 flag_schedule_insns_after_reload means schedule insns after
753 int flag_schedule_insns = 0;
754 int flag_schedule_insns_after_reload = 0;
756 /* The following flags have effect only for scheduling before register
759 flag_schedule_interblock means schedule insns accross basic blocks.
760 flag_schedule_speculative means allow speculative motion of non-load insns.
761 flag_schedule_speculative_load means allow speculative motion of some
763 flag_schedule_speculative_load_dangerous allows speculative motion of more
766 int flag_schedule_interblock = 1;
767 int flag_schedule_speculative = 1;
768 int flag_schedule_speculative_load = 0;
769 int flag_schedule_speculative_load_dangerous = 0;
771 int flag_single_precision_constant;
773 /* flag_branch_on_count_reg means try to replace add-1,compare,branch tupple
774 by a cheaper branch on a count register. */
775 int flag_branch_on_count_reg = 1;
777 /* -finhibit-size-directive inhibits output of .size for ELF.
778 This is used only for compiling crtstuff.c,
779 and it may be extended to other effects
780 needed for crtstuff.c on other systems. */
781 int flag_inhibit_size_directive = 0;
783 /* -fverbose-asm causes extra commentary information to be produced in
784 the generated assembly code (to make it more readable). This option
785 is generally only of use to those who actually need to read the
786 generated assembly code (perhaps while debugging the compiler itself).
787 -fno-verbose-asm, the default, causes the extra information
788 to be omitted and is useful when comparing two assembler files. */
790 int flag_verbose_asm = 0;
792 /* -dA causes debug commentary information to be produced in
793 the generated assembly code (to make it more readable). This option
794 is generally only of use to those who actually need to read the
795 generated assembly code (perhaps while debugging the compiler itself).
796 Currently, this switch is only used by dwarfout.c; however, it is intended
797 to be a catchall for printing debug information in the assembler file. */
799 int flag_debug_asm = 0;
801 /* -dP causes the rtl to be emitted as a comment in assembly. */
803 int flag_dump_rtl_in_asm = 0;
805 /* -fgnu-linker specifies use of the GNU linker for initializations.
806 (Or, more generally, a linker that handles initializations.)
807 -fno-gnu-linker says that collect2 will be used. */
809 int flag_gnu_linker = 0;
811 int flag_gnu_linker = 1;
817 /* Enable dead code elimination. */
820 /* Tag all structures with __attribute__(packed). */
821 int flag_pack_struct = 0;
823 /* Emit code to check for stack overflow; also may cause large objects
824 to be allocated dynamically. */
825 int flag_stack_check;
827 /* When non-NULL, indicates that whenever space is allocated on the
828 stack, the resulting stack pointer must not pass this
829 address---that is, for stacks that grow downward, the stack pointer
830 must always be greater than or equal to this address; for stacks
831 that grow upward, the stack pointer must be less than this address.
832 At present, the rtx may be either a REG or a SYMBOL_REF, although
833 the support provided depends on the backend. */
836 /* -fcheck-memory-usage causes extra code to be generated in order to check
837 memory accesses. This is used by a detector of bad memory accesses such
839 int flag_check_memory_usage = 0;
841 /* -fprefix-function-name causes function name to be prefixed. This
842 can be used with -fcheck-memory-usage to isolate code compiled with
843 -fcheck-memory-usage. */
844 int flag_prefix_function_name = 0;
846 /* 0 if pointer arguments may alias each other. True in C.
847 1 if pointer arguments may not alias each other but may alias
849 2 if pointer arguments may not alias each other and may not
850 alias global variables. True in Fortran.
851 This defaults to 0 for C. */
852 int flag_argument_noalias = 0;
854 /* Nonzero if we should do (language-dependent) alias analysis.
855 Typically, this analysis will assume that expressions of certain
856 types do not alias expressions of certain other types. Only used
857 if alias analysis (in general) is enabled. */
858 int flag_strict_aliasing = 0;
860 /* Instrument functions with calls at entry and exit, for profiling. */
861 int flag_instrument_function_entry_exit = 0;
863 /* Nonzero means ignore `#ident' directives. 0 means handle them.
864 On SVR4 targets, it also controls whether or not to emit a
865 string identifying the compiler. */
867 int flag_no_ident = 0;
869 /* This will perform a peephole pass before sched2. */
870 int flag_peephole2 = 0;
872 /* -fbounded-pointers causes gcc to compile pointers as composite
873 objects occupying three words: the pointer value, the base address
874 of the referent object, and the address immediately beyond the end
875 of the referent object. The base and extent allow us to perform
876 runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
877 int flag_bounded_pointers = 0;
879 /* -fcheck-bounds causes gcc to generate array bounds checks.
880 For C, C++: defaults to value of flag_bounded_pointers.
881 For ObjC: defaults to off.
882 For Java: defaults to on.
883 For Fortran: defaults to off.
884 For CHILL: defaults to off. */
885 int flag_bounds_check = 0;
887 /* If one, renumber instruction UIDs to reduce the number of
888 unused UIDs if there are a lot of instructions. If greater than
889 one, unconditionally renumber instruction UIDs. */
890 int flag_renumber_insns = 1;
892 /* Values of the -falign-* flags: how much to align labels in code.
893 0 means `use default', 1 means `don't align'.
894 For each variable, there is an _log variant which is the power
895 of two not less than the variable, for .align output. */
902 int align_labels_log;
904 int align_functions_log;
906 /* Table of supported debugging formats. */
910 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
911 constant expression, we use NO_DEBUG in its place. */
912 enum debug_info_type debug_type;
913 int use_extensions_p;
914 const char *description;
918 { "", NO_DEBUG, DEFAULT_GDB_EXTENSIONS,
919 "Generate default debug format output" },
920 { "gdb", NO_DEBUG, 1, "Generate default extended debug format output" },
921 #ifdef DBX_DEBUGGING_INFO
922 { "stabs", DBX_DEBUG, 0, "Generate STABS format debug output" },
923 { "stabs+", DBX_DEBUG, 1, "Generate extended STABS format debug output" },
925 #ifdef DWARF_DEBUGGING_INFO
926 { "dwarf", DWARF_DEBUG, 0, "Generate DWARF-1 format debug output"},
927 { "dwarf+", DWARF_DEBUG, 1,
928 "Generated extended DWARF-1 format debug output" },
930 #ifdef DWARF2_DEBUGGING_INFO
931 { "dwarf-2", DWARF2_DEBUG, 0, "Enable DWARF-2 debug output" },
933 #ifdef XCOFF_DEBUGGING_INFO
934 { "xcoff", XCOFF_DEBUG, 0, "Generate XCOFF format debug output" },
935 { "xcoff+", XCOFF_DEBUG, 1, "Generate extended XCOFF format debug output" },
937 #ifdef SDB_DEBUGGING_INFO
938 { "coff", SDB_DEBUG, 0, "Generate COFF format debug output" },
948 const char *description;
950 lang_independent_options;
954 /* Add or remove a leading underscore from user symbols. */
955 int flag_leading_underscore = -1;
957 /* The user symbol prefix after having resolved same. */
958 const char *user_label_prefix;
960 /* A default for same. */
961 #ifndef USER_LABEL_PREFIX
962 #define USER_LABEL_PREFIX ""
965 /* Table of language-independent -f options.
966 STRING is the option name. VARIABLE is the address of the variable.
967 ON_VALUE is the value to store in VARIABLE
968 if `-fSTRING' is seen as an option.
969 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
971 lang_independent_options f_options[] =
973 {"eliminate-dwarf2-dups", &flag_eliminate_dwarf2_dups, 1,
974 "Perform DWARF2 duplicate elimination"},
975 {"float-store", &flag_float_store, 1,
976 "Do not store floats in registers" },
977 {"volatile", &flag_volatile, 1,
978 "Consider all mem refs through pointers as volatile"},
979 {"volatile-global", &flag_volatile_global, 1,
980 "Consider all mem refs to global data to be volatile" },
981 {"volatile-static", &flag_volatile_static, 1,
982 "Consider all mem refs to static data to be volatile" },
983 {"defer-pop", &flag_defer_pop, 1,
984 "Defer popping functions args from stack until later" },
985 {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
986 "When possible do not generate stack frames"},
987 {"optimize-sibling-calls", &flag_optimize_sibling_calls, 1,
988 "Optimize sibling and tail recursive calls" },
989 {"cse-follow-jumps", &flag_cse_follow_jumps, 1,
990 "When running CSE, follow jumps to their targets" },
991 {"cse-skip-blocks", &flag_cse_skip_blocks, 1,
992 "When running CSE, follow conditional jumps" },
993 {"expensive-optimizations", &flag_expensive_optimizations, 1,
994 "Perform a number of minor, expensive optimisations" },
995 {"thread-jumps", &flag_thread_jumps, 1,
996 "Perform jump threading optimisations"},
997 {"strength-reduce", &flag_strength_reduce, 1,
998 "Perform strength reduction optimisations" },
999 {"unroll-loops", &flag_unroll_loops, 1,
1000 "Perform loop unrolling when iteration count is known" },
1001 {"unroll-all-loops", &flag_unroll_all_loops, 1,
1002 "Perform loop unrolling for all loops" },
1003 {"move-all-movables", &flag_move_all_movables, 1,
1004 "Force all loop invariant computations out of loops" },
1005 {"reduce-all-givs", &flag_reduce_all_givs, 1,
1006 "Strength reduce all loop general induction variables" },
1007 {"writable-strings", &flag_writable_strings, 1,
1008 "Store strings in writable data section" },
1009 {"peephole", &flag_no_peephole, 0,
1010 "Enable machine specific peephole optimisations" },
1011 {"force-mem", &flag_force_mem, 1,
1012 "Copy memory operands into registers before using" },
1013 {"force-addr", &flag_force_addr, 1,
1014 "Copy memory address constants into regs before using" },
1015 {"function-cse", &flag_no_function_cse, 0,
1016 "Allow function addresses to be held in registers" },
1017 {"inline-functions", &flag_inline_functions, 1,
1018 "Integrate simple functions into their callers" },
1019 {"keep-inline-functions", &flag_keep_inline_functions, 1,
1020 "Generate code for funcs even if they are fully inlined" },
1021 {"inline", &flag_no_inline, 0,
1022 "Pay attention to the 'inline' keyword"},
1023 {"keep-static-consts", &flag_keep_static_consts, 1,
1024 "Emit static const variables even if they are not used" },
1025 {"syntax-only", &flag_syntax_only, 1,
1026 "Check for syntax errors, then stop" },
1027 {"shared-data", &flag_shared_data, 1,
1028 "Mark data as shared rather than private" },
1029 {"caller-saves", &flag_caller_saves, 1,
1030 "Enable saving registers around function calls" },
1031 {"pcc-struct-return", &flag_pcc_struct_return, 1,
1032 "Return 'short' aggregates in memory, not registers" },
1033 {"reg-struct-return", &flag_pcc_struct_return, 0,
1034 "Return 'short' aggregates in registers" },
1035 {"delayed-branch", &flag_delayed_branch, 1,
1036 "Attempt to fill delay slots of branch instructions" },
1037 {"gcse", &flag_gcse, 1,
1038 "Perform the global common subexpression elimination" },
1039 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
1040 "Run CSE pass after loop optimisations"},
1041 {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
1042 "Run the loop optimiser twice"},
1043 {"delete-null-pointer-checks", &flag_delete_null_pointer_checks, 1,
1044 "Delete useless null pointer checks" },
1045 {"pretend-float", &flag_pretend_float, 1,
1046 "Pretend that host and target use the same FP format"},
1047 {"schedule-insns", &flag_schedule_insns, 1,
1048 "Reschedule instructions to avoid pipeline stalls"},
1049 {"schedule-insns2", &flag_schedule_insns_after_reload, 1,
1050 "Run two passes of the instruction scheduler"},
1051 {"sched-interblock",&flag_schedule_interblock, 1,
1052 "Enable scheduling across basic blocks" },
1053 {"sched-spec",&flag_schedule_speculative, 1,
1054 "Allow speculative motion of non-loads" },
1055 {"sched-spec-load",&flag_schedule_speculative_load, 1,
1056 "Allow speculative motion of some loads" },
1057 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
1058 "Allow speculative motion of more loads" },
1059 {"branch-count-reg",&flag_branch_on_count_reg, 1,
1060 "Replace add,compare,branch with branch on count reg"},
1061 {"pic", &flag_pic, 1,
1062 "Generate position independent code, if possible"},
1063 {"PIC", &flag_pic, 2, ""},
1064 {"exceptions", &flag_exceptions, 1,
1065 "Enable exception handling" },
1066 {"new-exceptions", &flag_new_exceptions, 1,
1067 "Use the new model for exception handling" },
1068 {"unwind-tables", &flag_unwind_tables, 1,
1069 "Just generate unwind tables for exception handling" },
1070 {"sjlj-exceptions", &exceptions_via_longjmp, 1,
1071 "Use setjmp/longjmp to handle exceptions" },
1072 {"asynchronous-exceptions", &asynchronous_exceptions, 1,
1073 "Support asynchronous exceptions" },
1074 {"profile-arcs", &profile_arc_flag, 1,
1075 "Insert arc based program profiling code" },
1076 {"test-coverage", &flag_test_coverage, 1,
1077 "Create data files needed by gcov" },
1078 {"branch-probabilities", &flag_branch_probabilities, 1,
1079 "Use profiling information for branch probabilities" },
1080 {"reorder-blocks", &flag_reorder_blocks, 1,
1081 "Reorder basic blocks to improve code placement" },
1082 {"rename-registers", &flag_rename_registers, 1,
1083 "Do the register renaming optimization pass"},
1084 {"fast-math", &flag_fast_math, 1,
1085 "Improve FP speed by violating ANSI & IEEE rules" },
1086 {"common", &flag_no_common, 0,
1087 "Do not put unitialised globals in the common section" },
1088 {"inhibit-size-directive", &flag_inhibit_size_directive, 1,
1089 "Do not generate .size directives" },
1090 {"function-sections", &flag_function_sections, 1,
1091 "place each function into its own section" },
1092 {"data-sections", &flag_data_sections, 1,
1093 "place data items into their own section" },
1094 {"verbose-asm", &flag_verbose_asm, 1,
1095 "Add extra commentry to assembler output"},
1096 {"gnu-linker", &flag_gnu_linker, 1,
1097 "Output GNU ld formatted global initialisers"},
1098 {"regmove", &flag_regmove, 1,
1099 "Enables a register move optimisation"},
1100 {"optimize-register-move", &flag_regmove, 1,
1101 "Do the full regmove optimization pass"},
1102 {"pack-struct", &flag_pack_struct, 1,
1103 "Pack structure members together without holes" },
1104 {"stack-check", &flag_stack_check, 1,
1105 "Insert stack checking code into the program" },
1106 {"argument-alias", &flag_argument_noalias, 0,
1107 "Specify that arguments may alias each other & globals"},
1108 {"argument-noalias", &flag_argument_noalias, 1,
1109 "Assume arguments may alias globals but not each other"},
1110 {"argument-noalias-global", &flag_argument_noalias, 2,
1111 "Assume arguments do not alias each other or globals" },
1112 {"strict-aliasing", &flag_strict_aliasing, 1,
1113 "Assume strict aliasing rules apply" },
1114 {"align-loops", &align_loops, 0,
1115 "Align the start of loops" },
1116 {"align-jumps", &align_jumps, 0,
1117 "Align labels which are only reached by jumping" },
1118 {"align-labels", &align_labels, 0,
1119 "Align all labels" },
1120 {"align-functions", &align_functions, 0,
1121 "Align the start of functions" },
1122 {"check-memory-usage", &flag_check_memory_usage, 1,
1123 "Generate code to check every memory access" },
1124 {"prefix-function-name", &flag_prefix_function_name, 1,
1125 "Add a prefix to all function names" },
1126 {"dump-unnumbered", &flag_dump_unnumbered, 1,
1127 "Suppress output of instruction numbers and line number notes in debugging dumps"},
1128 {"instrument-functions", &flag_instrument_function_entry_exit, 1,
1129 "Instrument function entry/exit with profiling calls"},
1130 {"ssa", &flag_ssa, 1,
1131 "Enable SSA optimizations" },
1132 {"dce", &flag_dce, 1,
1133 "Enable dead code elimination" },
1134 {"leading-underscore", &flag_leading_underscore, 1,
1135 "External symbols have a leading underscore" },
1136 {"ident", &flag_no_ident, 0,
1137 "Process #ident directives"},
1138 { "peephole2", &flag_peephole2, 1,
1139 "Enables an rtl peephole pass run before sched2" },
1140 {"math-errno", &flag_errno_math, 1,
1141 "Set errno after built-in math functions"},
1142 {"bounded-pointers", &flag_bounded_pointers, 1,
1143 "Compile pointers as triples: value, base & end" },
1144 {"bounds-check", &flag_bounds_check, 1,
1145 "Generate code to check bounds before dereferencing pointers and arrays" },
1146 {"single-precision-constant", &flag_single_precision_constant, 1,
1147 "Convert floating point constant to single precision constant"},
1148 {"time-report", &time_report, 1,
1149 "Report time taken by each compiler pass at end of run"},
1150 {"mem-report", &mem_report, 1,
1151 "Report on permanent memory allocation at end of run"},
1152 { "trapv", &flag_trapv, 1,
1153 "Trap for signed overflow in addition / subtraction / multiplication." },
1156 /* Table of language-specific options. */
1158 static struct lang_opt
1161 const char *description;
1163 documented_lang_options[] =
1165 /* In order not to overload the --help output, the convention
1166 used here is to only describe those options which are not
1167 enabled by default. */
1169 { "-ansi", "Compile just for ISO C89" },
1170 { "-fallow-single-precision",
1171 "Do not promote floats to double if using -traditional" },
1172 { "-std= ", "Determine language standard"},
1174 { "-fsigned-bitfields", "" },
1175 { "-funsigned-bitfields","Make bitfields by unsigned by default" },
1176 { "-fno-signed-bitfields", "" },
1177 { "-fno-unsigned-bitfields","" },
1178 { "-fsigned-char", "Make 'char' be signed by default"},
1179 { "-funsigned-char", "Make 'char' be unsigned by default"},
1180 { "-fno-signed-char", "" },
1181 { "-fno-unsigned-char", "" },
1183 { "-ftraditional", "" },
1184 { "-traditional", "Attempt to support traditional K&R style C"},
1185 { "-fnotraditional", "" },
1186 { "-fno-traditional", "" },
1189 { "-fno-asm", "Do not recognise the 'asm' keyword" },
1190 { "-fbuiltin", "" },
1191 { "-fno-builtin", "Do not recognise any built in functions" },
1192 { "-fhosted", "Assume normal C execution environment" },
1193 { "-fno-hosted", "" },
1195 "Assume that standard libraries & main might not exist" },
1196 { "-fno-freestanding", "" },
1197 { "-fcond-mismatch", "Allow different types as args of ? operator"},
1198 { "-fno-cond-mismatch", "" },
1199 { "-fdollars-in-identifiers", "Allow the use of $ inside identifiers" },
1200 { "-fno-dollars-in-identifiers", "" },
1201 { "-fpreprocessed", "" },
1202 { "-fno-preprocessed", "" },
1203 { "-fshort-double", "Use the same size for double as for float" },
1204 { "-fno-short-double", "" },
1205 { "-fshort-enums", "Use the smallest fitting integer to hold enums"},
1206 { "-fno-short-enums", "" },
1207 { "-fshort-wchar", "Override the underlying type for wchar_t to `unsigned short'" },
1208 { "-fno-short-wchar", "" },
1210 { "-Wall", "Enable most warning messages" },
1211 { "-Wbad-function-cast",
1212 "Warn about casting functions to incompatible types" },
1213 { "-Wno-bad-function-cast", "" },
1214 { "-Wmissing-noreturn",
1215 "Warn about functions which might be candidates for attribute noreturn" },
1216 { "-Wno-missing-noreturn", "" },
1217 { "-Wmissing-format-attribute",
1218 "Warn about functions which might be candidates for format attributes" },
1219 { "-Wno-missing-format-attribute", "" },
1220 { "-Wcast-qual", "Warn about casts which discard qualifiers"},
1221 { "-Wno-cast-qual", "" },
1222 { "-Wchar-subscripts", "Warn about subscripts whose type is 'char'"},
1223 { "-Wno-char-subscripts", "" },
1224 { "-Wcomment", "Warn if nested comments are detected" },
1225 { "-Wno-comment", "" },
1226 { "-Wcomments", "Warn if nested comments are detected" },
1227 { "-Wno-comments", "" },
1228 { "-Wconversion", "Warn about possibly confusing type conversions" },
1229 { "-Wno-conversion", "" },
1230 { "-Wformat", "Warn about printf format anomalies" },
1231 { "-Wno-format", "" },
1232 { "-Wimplicit-function-declaration",
1233 "Warn about implicit function declarations" },
1234 { "-Wno-implicit-function-declaration", "" },
1235 { "-Werror-implicit-function-declaration", "" },
1236 { "-Wimplicit-int", "Warn when a declaration does not specify a type" },
1237 { "-Wno-implicit-int", "" },
1238 { "-Wimplicit", "" },
1239 { "-Wno-implicit", "" },
1240 { "-Wimport", "Warn about the use of the #import directive" },
1241 { "-Wno-import", "" },
1242 { "-Wlong-long","" },
1243 { "-Wno-long-long", "Do not warn about using 'long long' when -pedantic" },
1244 { "-Wmain", "Warn about suspicious declarations of main" },
1245 { "-Wno-main", "" },
1246 { "-Wmissing-braces",
1247 "Warn about possibly missing braces around initialisers" },
1248 { "-Wno-missing-braces", "" },
1249 { "-Wmissing-declarations",
1250 "Warn about global funcs without previous declarations"},
1251 { "-Wno-missing-declarations", "" },
1252 { "-Wmissing-prototypes", "Warn about global funcs without prototypes" },
1253 { "-Wno-missing-prototypes", "" },
1254 { "-Wmultichar", "Warn about use of multicharacter literals"},
1255 { "-Wno-multichar", "" },
1256 { "-Wnested-externs", "Warn about externs not at file scope level" },
1257 { "-Wno-nested-externs", "" },
1258 { "-Wparentheses", "Warn about possible missing parentheses" },
1259 { "-Wno-parentheses", "" },
1260 { "-Wsequence-point",
1261 "Warn about possible violations of sequence point rules" },
1262 { "-Wno-sequence-point", "" },
1263 { "-Wpointer-arith", "Warn about function pointer arithmetic" },
1264 { "-Wno-pointer-arith", "" },
1265 { "-Wredundant-decls",
1266 "Warn about multiple declarations of the same object" },
1267 { "-Wno-redundant-decls", "" },
1268 { "-Wsign-compare", "Warn about signed/unsigned comparisons" },
1269 { "-Wno-sign-compare", "" },
1270 { "-Wfloat-equal", "Warn about testing equality of floating point numbers" },
1271 { "-Wno-float-equal", "" },
1272 { "-Wunknown-pragmas", "Warn about unrecognized pragmas" },
1273 { "-Wno-unknown-pragmas", "" },
1274 { "-Wstrict-prototypes", "Warn about non-prototyped function decls" },
1275 { "-Wno-strict-prototypes", "" },
1276 { "-Wtraditional", "Warn about constructs whose meaning change in ISO C"},
1277 { "-Wno-traditional", "" },
1278 { "-Wtrigraphs", "Warn when trigraphs are encountered" },
1279 { "-Wno-trigraphs", "" },
1281 { "-Wno-undef", "" },
1282 { "-Wwrite-strings", "Mark strings as 'const char *'"},
1283 { "-Wno-write-strings", "" },
1285 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1287 #include "options.h"
1291 /* Here is a table, controlled by the tm.h file, listing each -m switch
1292 and which bits in `target_switches' it should set or clear.
1293 If VALUE is positive, it is bits to set.
1294 If VALUE is negative, -VALUE is bits to clear.
1295 (The sign bit is not used so there is no confusion.) */
1301 const char *description;
1303 target_switches [] = TARGET_SWITCHES;
1305 /* This table is similar, but allows the switch to have a value. */
1307 #ifdef TARGET_OPTIONS
1311 const char **variable;
1312 const char *description;
1314 target_options [] = TARGET_OPTIONS;
1317 /* Options controlling warnings. */
1319 /* Don't print warning messages. -w. */
1321 int inhibit_warnings = 0;
1323 /* Don't suppress warnings from system headers. -Wsystem-headers. */
1325 int warn_system_headers = 0;
1327 /* Print various extra warnings. -W. */
1329 int extra_warnings = 0;
1331 /* Treat warnings as errors. -Werror. */
1333 int warnings_are_errors = 0;
1335 /* Nonzero to warn about unused variables, functions et.al. */
1337 int warn_unused_function;
1338 int warn_unused_label;
1339 int warn_unused_parameter;
1340 int warn_unused_variable;
1341 int warn_unused_value;
1344 set_Wunused (setting)
1347 warn_unused_function = setting;
1348 warn_unused_label = setting;
1349 /* Unused function parameter warnings are reported when either ``-W
1350 -Wunused'' or ``-Wunused-parameter'' is specified. Differentiate
1351 -Wunused by setting WARN_UNUSED_PARAMETER to -1. */
1353 warn_unused_parameter = 0;
1354 else if (!warn_unused_parameter)
1355 warn_unused_parameter = -1;
1356 warn_unused_variable = setting;
1357 warn_unused_value = setting;
1360 /* Nonzero to warn about code which is never reached. */
1362 int warn_notreached;
1364 /* Nonzero to warn about variables used before they are initialized. */
1366 int warn_uninitialized;
1368 /* Nonzero means warn about all declarations which shadow others. */
1372 /* Warn if a switch on an enum fails to have a case for every enum value. */
1376 /* Nonzero means warn about function definitions that default the return type
1377 or that use a null return and have a return-type other than void. */
1379 int warn_return_type;
1381 /* Nonzero means warn about pointer casts that increase the required
1382 alignment of the target type (and might therefore lead to a crash
1383 due to a misaligned access). */
1385 int warn_cast_align;
1387 /* Nonzero means warn about any identifiers that match in the first N
1388 characters. The value N is in `id_clash_len'. */
1393 /* Nonzero means warn about any objects definitions whose size is larger
1394 than N bytes. Also want about function definitions whose returned
1395 values are larger than N bytes. The value N is in `larger_than_size'. */
1397 int warn_larger_than;
1398 HOST_WIDE_INT larger_than_size;
1400 /* Nonzero means warn if inline function is too large. */
1404 /* Warn if a function returns an aggregate,
1405 since there are often incompatible calling conventions for doing this. */
1407 int warn_aggregate_return;
1409 /* Warn if packed attribute on struct is unnecessary and inefficient. */
1413 /* Warn when gcc pads a structure to an alignment boundary. */
1417 /* Warn when an optimization pass is disabled. */
1419 int warn_disabled_optimization;
1421 /* Warn about functions which might be candidates for attribute noreturn. */
1423 int warn_missing_noreturn;
1425 /* Likewise for -W. */
1427 lang_independent_options W_options[] =
1429 {"unused-function", &warn_unused_function, 1, "Warn when a function is unused" },
1430 {"unused-label", &warn_unused_label, 1, "Warn when a label is unused" },
1431 {"unused-parameter", &warn_unused_parameter, 1, "Warn when a function parameter is unused" },
1432 {"unused-variable", &warn_unused_variable, 1, "Warn when a variable is unused" },
1433 {"unused-value", &warn_unused_value, 1, "Warn when an expression value is unused" },
1434 {"system-headers", &warn_system_headers, 1, "Do not suppress warnings from system headers"},
1435 {"error", &warnings_are_errors, 1, ""},
1436 {"shadow", &warn_shadow, 1, "Warn when one local variable shadows another" },
1437 {"switch", &warn_switch, 1,
1438 "Warn about enumerated switches missing a specific case" },
1439 {"aggregate-return", &warn_aggregate_return, 1,
1440 "Warn about returning structures, unions or arrays" },
1441 {"cast-align", &warn_cast_align, 1,
1442 "Warn about pointer casts which increase alignment" },
1443 {"unreachable-code", &warn_notreached, 1,
1444 "Warn about code that will never be executed" },
1445 {"uninitialized", &warn_uninitialized, 1,
1446 "Warn about unitialized automatic variables"},
1447 {"inline", &warn_inline, 1,
1448 "Warn when an inlined function cannot be inlined"},
1449 {"packed", &warn_packed, 1,
1450 "Warn when the packed attribute has no effect on struct layout"},
1451 {"padded", &warn_padded, 1,
1452 "Warn when padding is required to align struct members"},
1453 {"disabled-optimization", &warn_disabled_optimization, 1,
1454 "Warn when an optimization pass is disabled"}
1457 /* Output files for assembler code (real compiler output)
1458 and debugging dumps. */
1461 FILE *aux_info_file;
1462 FILE *rtl_dump_file = NULL;
1464 /* Decode the string P as an integral parameter.
1465 If the string is indeed an integer return its numeric value else
1466 issue an Invalid Option error for the option PNAME and return DEFVAL.
1467 If PNAME is zero just return DEFVAL, do not call error. */
1470 read_integral_parameter (p, pname, defval)
1475 const char *endp = p;
1479 if (*endp >= '0' && *endp <= '9')
1488 error ("Invalid option `%s'", pname);
1496 /* This is the default decl_printable_name function. */
1499 decl_name (decl, verbosity)
1501 int verbosity ATTRIBUTE_UNUSED;
1503 return IDENTIFIER_POINTER (DECL_NAME (decl));
1506 /* Mark P for GC. Also mark main_input_filename and input_filename. */
1512 struct file_stack *stack = *(struct file_stack **)p;
1514 /* We're only called for input_file_stack, so we can mark the current
1515 input_filename here as well. */
1516 ggc_mark_string (main_input_filename);
1517 ggc_mark_string (input_filename);
1521 ggc_mark_string (stack->name);
1522 stack = stack->next;
1527 /* This calls abort and is used to avoid problems when abort if a macro.
1528 It is used when we need to pass the address of abort. */
1536 /* When `malloc.c' is compiled with `rcheck' defined,
1537 it calls this function to report clobberage. */
1541 const char *s ATTRIBUTE_UNUSED;
1546 /* Return the logarithm of X, base 2, considering X unsigned,
1547 if X is a power of 2. Otherwise, returns -1.
1549 This should be used via the `exact_log2' macro. */
1553 register unsigned HOST_WIDE_INT x;
1555 register int log = 0;
1556 /* Test for 0 or a power of 2. */
1557 if (x == 0 || x != (x & -x))
1559 while ((x >>= 1) != 0)
1564 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1565 If X is 0, return -1.
1567 This should be used via the floor_log2 macro. */
1571 register unsigned HOST_WIDE_INT x;
1573 register int log = -1;
1580 static int float_handler_set;
1582 jmp_buf float_handler;
1584 /* Signals actually come here. */
1587 float_signal (signo)
1588 /* If this is missing, some compilers complain. */
1589 int signo ATTRIBUTE_UNUSED;
1591 if (float_handled == 0)
1592 crash_signal (signo);
1593 #if defined (USG) || defined (hpux)
1594 /* Re-enable the signal catcher. */
1595 signal (SIGFPE, float_signal);
1598 signal (SIGFPE, float_signal);
1599 longjmp (float_handler, 1);
1602 /* Specify where to longjmp to when a floating arithmetic error happens.
1603 If HANDLER is 0, it means don't handle the errors any more. */
1606 set_float_handler (handler)
1609 float_handled = (handler != 0);
1611 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1613 if (float_handled && ! float_handler_set)
1615 signal (SIGFPE, float_signal);
1616 float_handler_set = 1;
1620 /* This is a wrapper function for code which might elicit an
1621 arithmetic exception. That code should be passed in as a function
1622 pointer FN, and one argument DATA. DATA is usually a struct which
1623 contains the real input and output for function FN. This function
1624 returns 0 (failure) if longjmp was called (i.e. an exception
1625 occured.) It returns 1 (success) otherwise. */
1628 do_float_handler (fn, data)
1629 void (*fn) PARAMS ((PTR));
1636 /* We got here via longjmp () caused by an exception in function
1638 set_float_handler (NULL);
1642 set_float_handler (buf);
1644 set_float_handler (NULL);
1648 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1649 error happens, pushing the previous specification into OLD_HANDLER.
1650 Return an indication of whether there was a previous handler in effect. */
1653 push_float_handler (handler, old_handler)
1654 jmp_buf handler, old_handler;
1656 int was_handled = float_handled;
1660 memcpy ((char *) old_handler, (char *) float_handler,
1661 sizeof (float_handler));
1663 memcpy ((char *) float_handler, (char *) handler, sizeof (float_handler));
1667 /* Restore the previous specification of whether and where to longjmp to
1668 when a floating arithmetic error happens. */
1671 pop_float_handler (handled, handler)
1675 float_handled = handled;
1677 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1680 /* Handler for fatal signals, such as SIGSEGV. These are transformed
1681 into ICE messages, which is much more user friendly. */
1684 crash_signal (signo)
1685 /* If this is missing, some compilers complain. */
1688 error ("Internal error: %s.", strsignal (signo));
1692 /* Strip off a legitimate source ending from the input string NAME of
1693 length LEN. Rather than having to know the names used by all of
1694 our front ends, we strip off an ending of a period followed by
1695 up to five characters. (Java uses ".class".) */
1698 strip_off_ending (name, len)
1703 for (i = 2; i < 6 && len > i; i++)
1705 if (name[len - i] == '.')
1707 name[len - i] = '\0';
1713 /* Given a file name X, return the nondirectory portion. */
1716 file_name_nondirectory (x)
1719 char *tmp = (char *) strrchr (x, '/');
1720 if (DIR_SEPARATOR != '/' && ! tmp)
1721 tmp = (char *) strrchr (x, DIR_SEPARATOR);
1723 return (char *) (tmp + 1);
1728 /* Output a quoted string. */
1731 output_quoted_string (asm_file, string)
1735 #ifdef OUTPUT_QUOTED_STRING
1736 OUTPUT_QUOTED_STRING (asm_file, string);
1740 putc ('\"', asm_file);
1741 while ((c = *string++) != 0)
1743 if (c == '\"' || c == '\\')
1744 putc ('\\', asm_file);
1747 putc ('\"', asm_file);
1751 /* Output a file name in the form wanted by System V. */
1754 output_file_directive (asm_file, input_name)
1756 const char *input_name;
1758 int len = strlen (input_name);
1759 const char *na = input_name + len;
1761 /* NA gets INPUT_NAME sans directory names. */
1762 while (na > input_name)
1764 if (IS_DIR_SEPARATOR (na[-1]))
1769 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1770 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1772 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1773 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1775 fprintf (asm_file, "\t.file\t");
1776 output_quoted_string (asm_file, na);
1777 fputc ('\n', asm_file);
1782 #ifdef ASM_IDENTIFY_LANGUAGE
1783 /* Routine to build language identifier for object file. */
1786 output_lang_identify (asm_out_file)
1789 int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1790 char *s = (char *) alloca (len);
1792 sprintf (s, "__gnu_compiled_%s", lang_identify ());
1793 ASM_OUTPUT_LABEL (asm_out_file, s);
1797 /* Routine to open a dump file. Return true if the dump file is enabled. */
1800 open_dump_file (index, decl)
1801 enum dump_file_index index;
1805 const char *open_arg;
1808 if (! dump_file[index].enabled)
1811 timevar_push (TV_DUMP);
1812 if (rtl_dump_file != NULL)
1813 fclose (rtl_dump_file);
1815 sprintf (seq, ".%02d.", index);
1817 if (! dump_file[index].initialized)
1819 /* If we've not initialized the files, do so now. */
1820 if (graph_dump_format != no_graph
1821 && dump_file[index].graph_dump_p)
1823 dump_name = concat (seq, dump_file[index].extension, NULL);
1824 clean_graph_dump_file (dump_base_name, dump_name);
1827 dump_file[index].initialized = 1;
1833 dump_name = concat (dump_base_name, seq,
1834 dump_file[index].extension, NULL);
1836 rtl_dump_file = fopen (dump_name, open_arg);
1837 if (rtl_dump_file == NULL)
1838 pfatal_with_name (dump_name);
1843 fprintf (rtl_dump_file, "\n;; Function %s\n\n",
1844 decl_printable_name (decl, 2));
1846 timevar_pop (TV_DUMP);
1850 /* Routine to close a dump file. */
1853 close_dump_file (index, func, insns)
1854 enum dump_file_index index;
1855 void (*func) PARAMS ((FILE *, rtx));
1858 if (! rtl_dump_file)
1861 timevar_push (TV_DUMP);
1863 && graph_dump_format != no_graph
1864 && dump_file[index].graph_dump_p)
1869 sprintf (seq, ".%02d.", index);
1870 suffix = concat (seq, dump_file[index].extension, NULL);
1871 print_rtl_graph_with_bb (dump_base_name, suffix, insns);
1876 func (rtl_dump_file, insns);
1878 fflush (rtl_dump_file);
1879 fclose (rtl_dump_file);
1881 rtl_dump_file = NULL;
1882 timevar_pop (TV_DUMP);
1885 /* Do any final processing required for the declarations in VEC, of
1886 which there are LEN. We write out inline functions and variables
1887 that have been deferred until this point, but which are required.
1888 Returns non-zero if anything was put out. */
1891 wrapup_global_declarations (vec, len)
1898 int output_something = 0;
1900 for (i = 0; i < len; i++)
1904 /* We're not deferring this any longer. */
1905 DECL_DEFER_OUTPUT (decl) = 0;
1907 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
1908 && incomplete_decl_finalize_hook != 0)
1909 (*incomplete_decl_finalize_hook) (decl);
1912 /* Now emit any global variables or functions that we have been
1913 putting off. We need to loop in case one of the things emitted
1914 here references another one which comes earlier in the list. */
1918 for (i = 0; i < len; i++)
1922 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
1925 /* Don't write out static consts, unless we still need them.
1927 We also keep static consts if not optimizing (for debugging),
1928 unless the user specified -fno-keep-static-consts.
1929 ??? They might be better written into the debug information.
1930 This is possible when using DWARF.
1932 A language processor that wants static constants to be always
1933 written out (even if it is not used) is responsible for
1934 calling rest_of_decl_compilation itself. E.g. the C front-end
1935 calls rest_of_decl_compilation from finish_decl.
1936 One motivation for this is that is conventional in some
1937 environments to write things like:
1938 static const char rcsid[] = "... version string ...";
1939 intending to force the string to be in the executable.
1941 A language processor that would prefer to have unneeded
1942 static constants "optimized away" would just defer writing
1943 them out until here. E.g. C++ does this, because static
1944 constants are often defined in header files.
1946 ??? A tempting alternative (for both C and C++) would be
1947 to force a constant to be written if and only if it is
1948 defined in a main file, as opposed to an include file. */
1950 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1951 && (! TREE_READONLY (decl)
1952 || TREE_PUBLIC (decl)
1953 || (!optimize && flag_keep_static_consts)
1954 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1957 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
1960 if (TREE_CODE (decl) == FUNCTION_DECL
1961 && DECL_INITIAL (decl) != 0
1962 && DECL_SAVED_INSNS (decl) != 0
1963 && (flag_keep_inline_functions
1964 || (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
1965 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1968 output_inline_function (decl);
1973 output_something = 1;
1977 return output_something;
1980 /* Issue appropriate warnings for the global declarations in VEC (of
1981 which there are LEN). Output debugging information for them. */
1984 check_global_declarations (vec, len)
1991 for (i = 0; i < len; i++)
1995 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1996 && ! TREE_ASM_WRITTEN (decl))
1997 /* Cancel the RTL for this decl so that, if debugging info
1998 output for global variables is still to come,
1999 this one will be omitted. */
2000 DECL_RTL (decl) = NULL;
2002 /* Warn about any function
2003 declared static but not defined.
2004 We don't warn about variables,
2005 because many programs have static variables
2006 that exist only to get some text into the object file. */
2007 if (TREE_CODE (decl) == FUNCTION_DECL
2008 && (warn_unused_function
2009 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2010 && DECL_INITIAL (decl) == 0
2011 && DECL_EXTERNAL (decl)
2012 && ! DECL_ARTIFICIAL (decl)
2013 && ! TREE_PUBLIC (decl))
2015 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2016 pedwarn_with_decl (decl,
2017 "`%s' used but never defined");
2019 warning_with_decl (decl,
2020 "`%s' declared `static' but never defined");
2021 /* This symbol is effectively an "extern" declaration now. */
2022 TREE_PUBLIC (decl) = 1;
2023 assemble_external (decl);
2026 /* Warn about static fns or vars defined but not used,
2027 but not about inline functions or static consts
2028 since defining those in header files is normal practice. */
2029 if (((warn_unused_function
2030 && TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
2031 || (warn_unused_variable
2032 && TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
2033 && ! DECL_IN_SYSTEM_HEADER (decl)
2034 && ! DECL_EXTERNAL (decl)
2035 && ! TREE_PUBLIC (decl)
2036 && ! TREE_USED (decl)
2037 && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
2038 /* The TREE_USED bit for file-scope decls
2039 is kept in the identifier, to handle multiple
2040 external decls in different scopes. */
2041 && ! TREE_USED (DECL_NAME (decl)))
2042 warning_with_decl (decl, "`%s' defined but not used");
2044 timevar_push (TV_SYMOUT);
2045 #ifdef SDB_DEBUGGING_INFO
2046 /* The COFF linker can move initialized global vars to the end.
2047 And that can screw up the symbol ordering.
2048 By putting the symbols in that order to begin with,
2049 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
2050 if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
2051 && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
2052 && ! DECL_EXTERNAL (decl)
2053 && DECL_RTL (decl) != 0)
2054 sdbout_symbol (decl, 0);
2056 /* Output COFF information for non-global
2057 file-scope initialized variables. */
2058 if (write_symbols == SDB_DEBUG
2059 && TREE_CODE (decl) == VAR_DECL
2060 && DECL_INITIAL (decl)
2061 && ! DECL_EXTERNAL (decl)
2062 && DECL_RTL (decl) != 0
2063 && GET_CODE (DECL_RTL (decl)) == MEM)
2064 sdbout_toplevel_data (decl);
2065 #endif /* SDB_DEBUGGING_INFO */
2066 #ifdef DWARF_DEBUGGING_INFO
2067 /* Output DWARF information for file-scope tentative data object
2068 declarations, file-scope (extern) function declarations (which
2069 had no corresponding body) and file-scope tagged type declarations
2070 and definitions which have not yet been forced out. */
2072 if (write_symbols == DWARF_DEBUG
2073 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2074 dwarfout_file_scope_decl (decl, 1);
2076 #ifdef DWARF2_DEBUGGING_INFO
2077 /* Output DWARF2 information for file-scope tentative data object
2078 declarations, file-scope (extern) function declarations (which
2079 had no corresponding body) and file-scope tagged type declarations
2080 and definitions which have not yet been forced out. */
2082 if (write_symbols == DWARF2_DEBUG
2083 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2084 dwarf2out_decl (decl);
2086 timevar_pop (TV_SYMOUT);
2090 /* Save the current INPUT_FILENAME and LINENO on the top entry in the
2091 INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
2092 INPUT_FILENAME and LINENO accordingly. */
2095 push_srcloc (file, line)
2099 struct file_stack *fs;
2101 if (input_file_stack)
2103 input_file_stack->name = input_filename;
2104 input_file_stack->line = lineno;
2107 fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2108 fs->name = input_filename = file;
2109 fs->line = lineno = line;
2110 fs->indent_level = 0;
2111 fs->next = input_file_stack;
2112 input_file_stack = fs;
2113 input_file_stack_tick++;
2116 /* Pop the top entry off the stack of presently open source files.
2117 Restore the INPUT_FILENAME and LINENO from the new topmost entry on
2123 struct file_stack *fs;
2125 fs = input_file_stack;
2126 input_file_stack = fs->next;
2128 input_file_stack_tick++;
2129 /* The initial souce file is never popped. */
2130 if (!input_file_stack)
2132 input_filename = input_file_stack->name;
2133 lineno = input_file_stack->line;
2136 /* Compile an entire file of output from cpp, named NAME.
2137 Write a file of assembly output and various debugging dumps. */
2145 int name_specified = name != 0;
2147 if (dump_base_name == 0)
2148 dump_base_name = name ? name : "gccdump";
2153 /* Start timing total execution time. */
2156 timevar_start (TV_TOTAL);
2158 /* Initialize data in various passes. */
2162 name = init_parse (name);
2163 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
2164 || debug_info_level == DINFO_LEVEL_VERBOSE
2165 || flag_test_coverage
2166 || warn_notreached);
2169 init_decl_processing ();
2175 init_function_once ();
2176 init_stor_layout_once ();
2177 init_varasm_once ();
2179 /* The following initialization functions need to generate rtl, so
2180 provide a dummy function context for them. */
2181 init_dummy_function_start ();
2184 if (flag_caller_saves)
2185 init_caller_save ();
2186 expand_dummy_function_end ();
2188 /* If auxiliary info generation is desired, open the output file.
2189 This goes in the same directory as the source file--unlike
2190 all the other output files. */
2191 if (flag_gen_aux_info)
2193 aux_info_file = fopen (aux_info_file_name, "w");
2194 if (aux_info_file == 0)
2195 pfatal_with_name (aux_info_file_name);
2198 /* Open assembler code output file. Do this even if -fsyntax-only is on,
2199 because then the driver will have provided the name of a temporary
2200 file or bit bucket for us. */
2202 if (! name_specified && asm_file_name == 0)
2203 asm_out_file = stdout;
2206 if (asm_file_name == 0)
2208 int len = strlen (dump_base_name);
2209 char *dumpname = (char *) xmalloc (len + 6);
2210 memcpy (dumpname, dump_base_name, len + 1);
2211 strip_off_ending (dumpname, len);
2212 strcat (dumpname, ".s");
2213 asm_file_name = dumpname;
2215 if (!strcmp (asm_file_name, "-"))
2216 asm_out_file = stdout;
2218 asm_out_file = fopen (asm_file_name, "w");
2219 if (asm_out_file == 0)
2220 pfatal_with_name (asm_file_name);
2223 #ifdef IO_BUFFER_SIZE
2224 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
2225 _IOFBF, IO_BUFFER_SIZE);
2229 name = ggc_alloc_string (name, strlen (name));
2231 input_filename = name;
2233 /* Put an entry on the input file stack for the main input file. */
2234 push_srcloc (input_filename, 0);
2236 /* Perform language-specific initialization.
2237 This may set main_input_filename. */
2240 /* If the input doesn't start with a #line, use the input name
2241 as the official input file name. */
2242 if (main_input_filename == 0)
2243 main_input_filename = name;
2245 if (flag_syntax_only)
2247 write_symbols = NO_DEBUG;
2249 profile_block_flag = 0;
2253 ASM_FILE_START (asm_out_file);
2255 #ifdef ASM_COMMENT_START
2256 if (flag_verbose_asm)
2258 /* Print the list of options in effect. */
2259 print_version (asm_out_file, ASM_COMMENT_START);
2260 print_switch_values (asm_out_file, 0, MAX_LINE,
2261 ASM_COMMENT_START, " ", "\n");
2262 /* Add a blank line here so it appears in assembler output but not
2264 fprintf (asm_out_file, "\n");
2268 /* Output something to inform GDB that this compilation was by GCC. */
2269 #ifndef ASM_IDENTIFY_GCC
2270 fprintf (asm_out_file, "gcc2_compiled.:\n");
2272 ASM_IDENTIFY_GCC (asm_out_file);
2275 /* Output something to identify which front-end produced this file. */
2276 #ifdef ASM_IDENTIFY_LANGUAGE
2277 ASM_IDENTIFY_LANGUAGE (asm_out_file);
2279 } /* ! flag_syntax_only */
2281 #ifndef ASM_OUTPUT_SECTION_NAME
2282 if (flag_function_sections)
2284 warning ("-ffunction-sections not supported for this target.");
2285 flag_function_sections = 0;
2287 if (flag_data_sections)
2289 warning ("-fdata-sections not supported for this target.");
2290 flag_data_sections = 0;
2294 if (flag_function_sections
2295 && (profile_flag || profile_block_flag))
2297 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2298 flag_function_sections = 0;
2301 #ifndef OBJECT_FORMAT_ELF
2302 if (flag_function_sections && write_symbols != NO_DEBUG)
2303 warning ("-ffunction-sections may affect debugging on some targets.");
2306 /* ??? Note: There used to be a conditional here
2307 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2308 This was to guarantee separation between gcc_compiled. and
2309 the first function, for the sake of dbx on Suns.
2310 However, having the extra zero here confused the Emacs
2311 code for unexec, and might confuse other programs too.
2312 Therefore, I took out that change.
2313 In future versions we should find another way to solve
2314 that dbx problem. -- rms, 23 May 93. */
2316 /* Don't let the first function fall at the same address
2317 as gcc_compiled., if profiling. */
2318 if (profile_flag || profile_block_flag)
2320 /* It's best if we can write a nop here since some
2321 assemblers don't tolerate zeros in the text section. */
2322 output_asm_insn (get_insn_template (CODE_FOR_nop, NULL), NULL_PTR);
2325 /* If dbx symbol table desired, initialize writing it
2326 and output the predefined types. */
2327 timevar_push (TV_SYMOUT);
2328 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2329 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2330 dbxout_init (asm_out_file, main_input_filename, getdecls ());
2332 #ifdef SDB_DEBUGGING_INFO
2333 if (write_symbols == SDB_DEBUG)
2334 sdbout_init (asm_out_file, main_input_filename, getdecls ());
2336 #ifdef DWARF_DEBUGGING_INFO
2337 if (write_symbols == DWARF_DEBUG)
2338 dwarfout_init (asm_out_file, main_input_filename);
2340 #ifdef DWARF2_UNWIND_INFO
2341 if (dwarf2out_do_frame ())
2342 dwarf2out_frame_init ();
2344 #ifdef DWARF2_DEBUGGING_INFO
2345 if (write_symbols == DWARF2_DEBUG)
2346 dwarf2out_init (asm_out_file, main_input_filename);
2348 timevar_pop (TV_SYMOUT);
2350 /* Initialize yet another pass. */
2352 init_final (main_input_filename);
2353 init_branch_prob (dump_base_name);
2355 timevar_push (TV_PARSE);
2357 /* Call the parser, which parses the entire file
2358 (calling rest_of_compilation for each function). */
2360 if (yyparse () != 0)
2362 if (errorcount == 0)
2363 fnotice (stderr, "Errors detected in input file (your bison.simple is out of date)\n");
2365 /* In case there were missing closebraces,
2366 get us back to the global binding level. */
2367 while (! global_bindings_p ())
2371 /* Compilation is now finished except for writing
2372 what's left of the symbol table output. */
2374 timevar_pop (TV_PARSE);
2376 if (flag_syntax_only)
2379 globals = getdecls ();
2381 /* Really define vars that have had only a tentative definition.
2382 Really output inline functions that must actually be callable
2383 and have not been output so far. */
2386 int len = list_length (globals);
2387 tree *vec = (tree *) xmalloc (sizeof (tree) * len);
2391 /* Process the decls in reverse order--earliest first.
2392 Put them into VEC from back to front, then take out from front. */
2394 for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
2395 vec[len - i - 1] = decl;
2397 wrapup_global_declarations (vec, len);
2399 /* This must occur after the loop to output deferred functions. Else
2400 the profiler initializer would not be emitted if all the functions
2401 in this compilation unit were deferred.
2403 output_func_start_profiler can not cause any additional functions or
2404 data to need to be output, so it need not be in the deferred function
2406 output_func_start_profiler ();
2408 /* Now that all possible functions have been output, we can dump
2409 the exception table. */
2411 #ifndef IA64_UNWIND_INFO
2412 output_exception_table ();
2414 free_exception_table ();
2416 check_global_declarations (vec, len);
2422 /* Write out any pending weak symbol declarations. */
2426 /* Do dbx symbols. */
2427 timevar_push (TV_SYMOUT);
2428 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2429 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2430 dbxout_finish (asm_out_file, main_input_filename);
2433 #ifdef DWARF_DEBUGGING_INFO
2434 if (write_symbols == DWARF_DEBUG)
2438 #ifdef DWARF2_UNWIND_INFO
2439 if (dwarf2out_do_frame ())
2440 dwarf2out_frame_finish ();
2443 #ifdef DWARF2_DEBUGGING_INFO
2444 if (write_symbols == DWARF2_DEBUG)
2445 dwarf2out_finish ();
2447 timevar_pop (TV_SYMOUT);
2449 /* Output some stuff at end of file if nec. */
2451 end_final (dump_base_name);
2453 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
2455 timevar_push (TV_DUMP);
2456 open_dump_file (DFI_bp, NULL);
2460 close_dump_file (DFI_bp, NULL, NULL_RTX);
2461 timevar_pop (TV_DUMP);
2465 ASM_FILE_END (asm_out_file);
2468 /* Language-specific end of compilation actions. */
2472 /* Close the dump files. */
2474 if (flag_gen_aux_info)
2476 fclose (aux_info_file);
2478 unlink (aux_info_file_name);
2481 if (optimize > 0 && open_dump_file (DFI_combine, NULL))
2483 timevar_push (TV_DUMP);
2484 dump_combine_total_stats (rtl_dump_file);
2485 close_dump_file (DFI_combine, NULL, NULL_RTX);
2486 timevar_pop (TV_DUMP);
2489 /* Close non-debugging input and output files. Take special care to note
2490 whether fclose returns an error, since the pages might still be on the
2491 buffer chain while the file is open. */
2495 if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
2496 fatal_io_error (asm_file_name);
2498 /* Do whatever is necessary to finish printing the graphs. */
2499 if (graph_dump_format != no_graph)
2503 for (i = 0; i < DFI_MAX; ++i)
2504 if (dump_file[i].initialized && dump_file[i].graph_dump_p)
2509 sprintf (seq, ".%02d.", i);
2510 suffix = concat (seq, dump_file[i].extension, NULL);
2511 finish_graph_dump_file (dump_base_name, suffix);
2517 ggc_print_statistics ();
2519 /* Free up memory for the benefit of leak detectors. */
2522 /* Stop timing total execution time. */
2523 timevar_stop (TV_TOTAL);
2525 /* Print the times. */
2527 timevar_print (stderr);
2530 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2531 and TYPE_DECL nodes.
2533 This does nothing for local (non-static) variables, unless the
2534 variable is a register variable with an ASMSPEC. In that case, or
2535 if the variable is not an automatice, it sets up the RTL and
2536 outputs any assembler code (label definition, storage allocation
2537 and initialization).
2539 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2540 the assembler symbol name to be used. TOP_LEVEL is nonzero
2541 if this declaration is not within a function. */
2544 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2546 const char *asmspec;
2550 /* Declarations of variables, and of functions defined elsewhere. */
2552 /* The most obvious approach, to put an #ifndef around where
2553 this macro is used, doesn't work since it's inside a macro call. */
2554 #ifndef ASM_FINISH_DECLARE_OBJECT
2555 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2558 /* Forward declarations for nested functions are not "external",
2559 but we need to treat them as if they were. */
2560 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2561 || TREE_CODE (decl) == FUNCTION_DECL)
2563 timevar_push (TV_VARCONST);
2564 make_decl_rtl (decl, asmspec, top_level);
2565 /* Initialized extern variable exists to be replaced
2566 with its value, or represents something that will be
2567 output in another file. */
2568 if (! (TREE_CODE (decl) == VAR_DECL
2569 && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
2570 && DECL_INITIAL (decl) != 0
2571 && DECL_INITIAL (decl) != error_mark_node))
2572 /* Don't output anything
2573 when a tentative file-scope definition is seen.
2574 But at end of compilation, do output code for them. */
2575 if (! (! at_end && top_level
2576 && (DECL_INITIAL (decl) == 0
2577 || DECL_INITIAL (decl) == error_mark_node)))
2578 assemble_variable (decl, top_level, at_end, 0);
2579 if (decl == last_assemble_variable_decl)
2581 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2584 timevar_pop (TV_VARCONST);
2586 else if (DECL_REGISTER (decl) && asmspec != 0)
2588 if (decode_reg_name (asmspec) >= 0)
2590 DECL_RTL (decl) = 0;
2591 make_decl_rtl (decl, asmspec, top_level);
2595 error ("invalid register name `%s' for register variable", asmspec);
2596 DECL_REGISTER (decl) = 0;
2597 make_decl_rtl (decl, NULL, top_level);
2600 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2601 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2602 && TREE_CODE (decl) == TYPE_DECL)
2604 timevar_push (TV_SYMOUT);
2605 dbxout_symbol (decl, 0);
2606 timevar_pop (TV_SYMOUT);
2609 #ifdef SDB_DEBUGGING_INFO
2610 else if (write_symbols == SDB_DEBUG && top_level
2611 && TREE_CODE (decl) == TYPE_DECL)
2613 timevar_push (TV_SYMOUT);
2614 sdbout_symbol (decl, 0);
2615 timevar_pop (TV_SYMOUT);
2620 /* Called after finishing a record, union or enumeral type. */
2623 rest_of_type_compilation (type, toplev)
2624 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
2628 tree type ATTRIBUTE_UNUSED;
2629 int toplev ATTRIBUTE_UNUSED;
2632 timevar_push (TV_SYMOUT);
2633 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2634 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2635 dbxout_symbol (TYPE_STUB_DECL (type), !toplev);
2637 #ifdef SDB_DEBUGGING_INFO
2638 if (write_symbols == SDB_DEBUG)
2639 sdbout_symbol (TYPE_STUB_DECL (type), !toplev);
2641 #ifdef DWARF2_DEBUGGING_INFO
2642 if (write_symbols == DWARF2_DEBUG && toplev)
2643 dwarf2out_decl (TYPE_STUB_DECL (type));
2645 timevar_pop (TV_SYMOUT);
2648 /* DECL is an inline function, whose body is present, but which is not
2649 being output at this point. (We're putting that off until we need
2650 to do it.) If there are any actions that need to take place,
2651 including the emission of debugging information for the function,
2652 this is where they should go. This function may be called by
2653 language-dependent code for front-ends that do not even generate
2654 RTL for functions that don't need to be put out. */
2657 note_deferral_of_defined_inline_function (decl)
2658 tree decl ATTRIBUTE_UNUSED;
2660 #ifdef DWARF_DEBUGGING_INFO
2661 /* Generate the DWARF info for the "abstract" instance of a function
2662 which we may later generate inlined and/or out-of-line instances
2664 if (write_symbols == DWARF_DEBUG && DECL_INLINE (decl))
2666 /* The front-end may not have set CURRENT_FUNCTION_DECL, but the
2667 DWARF code expects it to be set in this case. Intuitively,
2668 DECL is the function we just finished defining, so setting
2669 CURRENT_FUNCTION_DECL is sensible. */
2670 tree saved_cfd = current_function_decl;
2671 current_function_decl = decl;
2673 /* Let the DWARF code do its work. */
2674 set_decl_abstract_flags (decl, 1);
2675 dwarfout_file_scope_decl (decl, 0);
2676 set_decl_abstract_flags (decl, 0);
2678 /* Reset CURRENT_FUNCTION_DECL. */
2679 current_function_decl = saved_cfd;
2684 /* This is called from finish_function (within yyparse)
2685 after each top-level definition is parsed.
2686 It is supposed to compile that function or variable
2687 and output the assembler code for it.
2688 After we return, the tree storage is freed. */
2691 rest_of_compilation (decl)
2697 int rebuild_label_notes_after_reload;
2698 int register_life_up_to_date;
2700 timevar_push (TV_REST_OF_COMPILATION);
2702 /* Now that we're out of the frontend, we shouldn't have any more
2703 CONCATs anywhere. */
2704 generating_concat_p = 0;
2706 /* When processing delayed functions, prepare_function_start() won't
2707 have been run to re-initialize it. */
2708 cse_not_expected = ! optimize;
2710 /* First, make sure that NOTE_BLOCK is set correctly for each
2711 NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
2712 if (!cfun->x_whole_function_mode_p)
2715 /* Then remove any notes we don't need. That will make iterating
2716 over the instruction sequence faster, and allow the garbage
2717 collector to reclaim the memory used by the notes. */
2718 remove_unnecessary_notes ();
2720 /* In function-at-a-time mode, we do not attempt to keep the BLOCK
2721 tree in sensible shape. So, we just recalculate it here. */
2722 if (cfun->x_whole_function_mode_p)
2727 /* If we are reconsidering an inline function
2728 at the end of compilation, skip the stuff for making it inline. */
2730 if (DECL_SAVED_INSNS (decl) == 0)
2736 /* If this is nested inside an inlined external function, pretend
2737 it was only declared. Since we cannot inline such functions,
2738 generating code for this one is not only not necessary but will
2739 confuse some debugging output writers. */
2740 for (parent = DECL_CONTEXT (current_function_decl);
2741 parent != NULL_TREE;
2742 parent = get_containing_scope (parent))
2743 if (TREE_CODE (parent) == FUNCTION_DECL
2744 && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
2746 DECL_INITIAL (decl) = 0;
2747 goto exit_rest_of_compilation;
2750 /* If requested, consider whether to make this function inline. */
2751 if (DECL_INLINE (decl) || flag_inline_functions)
2753 timevar_push (TV_INTEGRATION);
2754 lose = function_cannot_inline_p (decl);
2755 timevar_pop (TV_INTEGRATION);
2756 if (lose || ! optimize)
2758 if (warn_inline && DECL_INLINE (decl))
2759 warning_with_decl (decl, lose);
2760 DECL_ABSTRACT_ORIGIN (decl) = 0;
2761 /* Don't really compile an extern inline function.
2762 If we can't make it inline, pretend
2763 it was only declared. */
2764 if (DECL_EXTERNAL (decl))
2766 DECL_INITIAL (decl) = 0;
2767 goto exit_rest_of_compilation;
2771 /* ??? Note that this has the effect of making it look
2772 like "inline" was specified for a function if we choose
2773 to inline it. This isn't quite right, but it's
2774 probably not worth the trouble to fix. */
2775 inlinable = DECL_INLINE (decl) = 1;
2778 insns = get_insns ();
2780 /* Dump the rtl code if we are dumping rtl. */
2782 if (open_dump_file (DFI_rtl, decl))
2784 if (DECL_SAVED_INSNS (decl))
2785 fprintf (rtl_dump_file, ";; (integrable)\n\n");
2786 close_dump_file (DFI_rtl, print_rtl, insns);
2789 /* If function is inline, and we don't yet know whether to
2790 compile it by itself, defer decision till end of compilation.
2791 finish_compilation will call rest_of_compilation again
2792 for those functions that need to be output. Also defer those
2793 functions that we are supposed to defer. */
2796 || (DECL_INLINE (decl)
2797 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2798 && ! flag_keep_inline_functions)
2799 || DECL_EXTERNAL (decl))))
2800 DECL_DEFER_OUTPUT (decl) = 1;
2802 if (DECL_INLINE (decl))
2803 /* DWARF wants seperate debugging info for abstract and
2804 concrete instances of all inline functions, including those
2805 declared inline but not inlined, and those inlined even
2806 though they weren't declared inline. Conveniently, that's
2807 what DECL_INLINE means at this point. */
2808 note_deferral_of_defined_inline_function (decl);
2810 if (DECL_DEFER_OUTPUT (decl))
2812 /* If -Wreturn-type, we have to do a bit of compilation. We just
2813 want to call jump_optimize to figure out whether or not we can
2814 fall off the end of the function; we do the minimum amount of
2815 work necessary to make that safe. And, we set optimize to zero
2816 to keep jump_optimize from working too hard. */
2817 if (warn_return_type)
2819 int saved_optimize = optimize;
2822 find_exception_handler_labels ();
2823 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2824 !JUMP_AFTER_REGSCAN);
2825 optimize = saved_optimize;
2828 current_function_nothrow = nothrow_function_p ();
2829 if (current_function_nothrow)
2830 /* Now we know that this can't throw; set the flag for the benefit
2831 of other functions later in this translation unit. */
2832 TREE_NOTHROW (current_function_decl) = 1;
2834 timevar_push (TV_INTEGRATION);
2835 save_for_inline (decl);
2836 timevar_pop (TV_INTEGRATION);
2837 DECL_SAVED_INSNS (decl)->inlinable = inlinable;
2838 goto exit_rest_of_compilation;
2841 /* If specified extern inline but we aren't inlining it, we are
2842 done. This goes for anything that gets here with DECL_EXTERNAL
2843 set, not just things with DECL_INLINE. */
2844 if (DECL_EXTERNAL (decl))
2845 goto exit_rest_of_compilation;
2848 init_EXPR_INSN_LIST_cache ();
2852 /* Initialize some variables used by the optimizers. */
2853 init_function_for_compilation ();
2855 if (! DECL_DEFER_OUTPUT (decl))
2856 TREE_ASM_WRITTEN (decl) = 1;
2858 /* Now that integrate will no longer see our rtl, we need not
2859 distinguish between the return value of this function and the
2860 return value of called functions. Also, we can remove all SETs
2861 of subregs of hard registers; they are only here because of
2863 rtx_equal_function_value_matters = 0;
2864 purge_hard_subreg_sets (get_insns ());
2866 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
2867 if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
2868 goto exit_rest_of_compilation;
2870 /* Emit code to get eh context, if needed. */
2873 /* We may have potential sibling or tail recursion sites. Select one
2874 (of possibly multiple) methods of performing the call. */
2875 if (flag_optimize_sibling_calls)
2877 timevar_push (TV_JUMP);
2878 open_dump_file (DFI_sibling, decl);
2880 optimize_sibling_and_tail_recursive_calls ();
2882 close_dump_file (DFI_sibling, print_rtl, get_insns ());
2883 timevar_pop (TV_JUMP);
2887 /* If we are doing position-independent code generation, now
2888 is the time to output special prologues and epilogues.
2889 We do not want to do this earlier, because it just clutters
2890 up inline functions with meaningless insns. */
2895 insns = get_insns ();
2897 /* Copy any shared structure that should not be shared. */
2898 unshare_all_rtl (current_function_decl, insns);
2900 #ifdef SETJMP_VIA_SAVE_AREA
2901 /* This must be performed before virutal register instantiation. */
2902 if (current_function_calls_alloca)
2903 optimize_save_area_alloca (insns);
2906 /* Instantiate all virtual registers. */
2907 instantiate_virtual_regs (current_function_decl, insns);
2909 /* Find all the EH handlers. */
2910 find_exception_handler_labels ();
2912 open_dump_file (DFI_jump, decl);
2914 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
2915 are initialized and to compute whether control can drop off the end
2918 timevar_push (TV_JUMP);
2919 /* Turn NOTE_INSN_EXPECTED_VALUE into REG_BR_PROB. Do this
2920 before jump optimization switches branch directions. */
2921 expected_value_to_br_prob ();
2923 reg_scan (insns, max_reg_num (), 0);
2924 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2925 JUMP_AFTER_REGSCAN);
2927 timevar_pop (TV_JUMP);
2929 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
2930 if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
2932 close_dump_file (DFI_jump, print_rtl, insns);
2933 goto exit_rest_of_compilation;
2936 timevar_push (TV_JUMP);
2940 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2941 cleanup_cfg (insns);
2943 /* ??? Run if-conversion before delete_null_pointer_checks,
2944 since the later does not preserve the CFG. This should
2945 be changed -- no since converting if's that are going to
2947 timevar_push (TV_IFCVT);
2949 timevar_pop (TV_IFCVT);
2951 /* Try to identify useless null pointer tests and delete them. */
2952 if (flag_delete_null_pointer_checks)
2953 delete_null_pointer_checks (insns);
2956 /* Jump optimization, and the removal of NULL pointer checks, may
2957 have reduced the number of instructions substantially. CSE, and
2958 future passes, allocate arrays whose dimensions involve the
2959 maximum instruction UID, so if we can reduce the maximum UID
2960 we'll save big on memory. */
2961 renumber_insns (rtl_dump_file);
2962 timevar_pop (TV_JUMP);
2964 close_dump_file (DFI_jump, print_rtl, insns);
2968 /* Perform common subexpression elimination.
2969 Nonzero value from `cse_main' means that jumps were simplified
2970 and some code may now be unreachable, so do
2971 jump optimization again. */
2975 open_dump_file (DFI_cse, decl);
2976 timevar_push (TV_CSE);
2978 reg_scan (insns, max_reg_num (), 1);
2980 if (flag_thread_jumps)
2982 timevar_push (TV_JUMP);
2983 thread_jumps (insns, max_reg_num (), 1);
2984 timevar_pop (TV_JUMP);
2987 tem = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
2989 /* If we are not running the second CSE pass, then we are no longer
2990 expecting CSE to be run. */
2991 cse_not_expected = !flag_rerun_cse_after_loop;
2993 if (tem || optimize > 1)
2995 timevar_push (TV_JUMP);
2996 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2997 !JUMP_AFTER_REGSCAN);
2998 timevar_pop (TV_JUMP);
3001 /* Run this after jump optmizations remove all the unreachable code
3002 so that unreachable code will not keep values live. */
3003 delete_trivially_dead_insns (insns, max_reg_num ());
3005 /* Try to identify useless null pointer tests and delete them. */
3006 if (flag_delete_null_pointer_checks)
3008 timevar_push (TV_JUMP);
3009 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3011 cleanup_cfg (insns);
3013 delete_null_pointer_checks (insns);
3014 timevar_pop (TV_JUMP);
3017 /* The second pass of jump optimization is likely to have
3018 removed a bunch more instructions. */
3019 renumber_insns (rtl_dump_file);
3021 timevar_pop (TV_CSE);
3022 close_dump_file (DFI_cse, print_rtl, insns);
3025 open_dump_file (DFI_addressof, decl);
3027 purge_addressof (insns);
3028 reg_scan (insns, max_reg_num (), 1);
3030 close_dump_file (DFI_addressof, print_rtl, insns);
3034 if (optimize > 0 && flag_ssa)
3036 /* Convert to SSA form. */
3038 timevar_push (TV_TO_SSA);
3039 open_dump_file (DFI_ssa, decl);
3041 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3042 cleanup_cfg (insns);
3045 close_dump_file (DFI_ssa, print_rtl_with_bb, insns);
3046 timevar_pop (TV_TO_SSA);
3048 /* The SSA implementation uses basic block numbers in its phi
3049 nodes. Thus, changing the control-flow graph or the basic
3050 blocks, e.g., calling find_basic_blocks () or cleanup_cfg (),
3051 may cause problems. */
3055 /* Remove dead code. */
3057 timevar_push (TV_DEAD_CODE_ELIM);
3058 open_dump_file (DFI_dce, decl);
3060 insns = get_insns ();
3061 eliminate_dead_code();
3063 close_dump_file (DFI_dce, print_rtl_with_bb, insns);
3064 timevar_pop (TV_DEAD_CODE_ELIM);
3067 /* Convert from SSA form. */
3069 timevar_push (TV_FROM_SSA);
3070 open_dump_file (DFI_ussa, decl);
3072 convert_from_ssa ();
3073 /* New registers have been created. Rescan their usage. */
3074 reg_scan (insns, max_reg_num (), 1);
3075 /* Life analysis used in SSA adds log_links but these
3076 shouldn't be there until the flow stage, so clear
3078 clear_log_links (insns);
3080 close_dump_file (DFI_ussa, print_rtl_with_bb, insns);
3081 timevar_pop (TV_FROM_SSA);
3086 /* Perform global cse. */
3088 if (optimize > 0 && flag_gcse)
3090 timevar_push (TV_GCSE);
3091 open_dump_file (DFI_gcse, decl);
3093 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3094 cleanup_cfg (insns);
3095 tem = gcse_main (insns, rtl_dump_file);
3097 /* If gcse altered any jumps, rerun jump optimizations to clean
3101 timevar_push (TV_JUMP);
3102 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
3103 !JUMP_AFTER_REGSCAN);
3104 timevar_pop (TV_JUMP);
3107 close_dump_file (DFI_gcse, print_rtl, insns);
3108 timevar_pop (TV_GCSE);
3113 /* Move constant computations out of loops. */
3117 timevar_push (TV_LOOP);
3118 open_dump_file (DFI_loop, decl);
3120 if (flag_rerun_loop_opt)
3122 /* We only want to perform unrolling once. */
3124 loop_optimize (insns, rtl_dump_file, 0);
3126 /* The first call to loop_optimize makes some instructions
3127 trivially dead. We delete those instructions now in the
3128 hope that doing so will make the heuristics in loop work
3129 better and possibly speed up compilation. */
3130 delete_trivially_dead_insns (insns, max_reg_num ());
3132 /* The regscan pass is currently necessary as the alias
3133 analysis code depends on this information. */
3134 reg_scan (insns, max_reg_num (), 1);
3136 loop_optimize (insns, rtl_dump_file,
3137 (flag_unroll_loops ? LOOP_UNROLL : 0) | LOOP_BCT);
3139 close_dump_file (DFI_loop, print_rtl, insns);
3140 timevar_pop (TV_LOOP);
3147 timevar_push (TV_CSE2);
3148 open_dump_file (DFI_cse2, decl);
3150 if (flag_rerun_cse_after_loop)
3152 /* Running another jump optimization pass before the second
3153 cse pass sometimes simplifies the RTL enough to allow
3154 the second CSE pass to do a better job. Jump_optimize can change
3155 max_reg_num so we must rerun reg_scan afterwards.
3156 ??? Rework to not call reg_scan so often. */
3157 timevar_push (TV_JUMP);
3159 reg_scan (insns, max_reg_num (), 0);
3160 jump_optimize (insns, !JUMP_CROSS_JUMP,
3161 !JUMP_NOOP_MOVES, JUMP_AFTER_REGSCAN);
3163 timevar_push (TV_IFCVT);
3165 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3166 cleanup_cfg (insns);
3169 timevar_pop(TV_IFCVT);
3171 timevar_pop (TV_JUMP);
3173 reg_scan (insns, max_reg_num (), 0);
3174 tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
3178 timevar_push (TV_JUMP);
3179 jump_optimize (insns, !JUMP_CROSS_JUMP,
3180 !JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
3181 timevar_pop (TV_JUMP);
3185 if (flag_thread_jumps)
3187 /* This pass of jump threading straightens out code
3188 that was kinked by loop optimization. */
3189 timevar_push (TV_JUMP);
3190 reg_scan (insns, max_reg_num (), 0);
3191 thread_jumps (insns, max_reg_num (), 0);
3192 timevar_pop (TV_JUMP);
3195 close_dump_file (DFI_cse2, print_rtl, insns);
3196 timevar_pop (TV_CSE2);
3201 cse_not_expected = 1;
3205 /* Do control and data flow analysis; wrote some of the results to
3208 timevar_push (TV_FLOW);
3209 open_dump_file (DFI_cfg, decl);
3211 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3212 cleanup_cfg (insns);
3213 check_function_return_warnings ();
3215 close_dump_file (DFI_cfg, print_rtl_with_bb, insns);
3217 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
3219 timevar_push (TV_BRANCH_PROB);
3220 open_dump_file (DFI_bp, decl);
3224 close_dump_file (DFI_bp, print_rtl_with_bb, insns);
3225 timevar_pop (TV_BRANCH_PROB);
3228 open_dump_file (DFI_life, decl);
3233 /* Discover and record the loop depth at the head of each basic
3234 block. The loop infrastructure does the real job for us. */
3235 flow_loops_find (&loops, LOOP_TREE);
3237 /* Estimate using heuristics if no profiling info is available. */
3238 estimate_probability (&loops);
3241 flow_loops_dump (&loops, rtl_dump_file, NULL, 0);
3243 flow_loops_free (&loops);
3245 life_analysis (insns, rtl_dump_file, PROP_FINAL);
3246 mark_constant_function ();
3247 timevar_pop (TV_FLOW);
3249 register_life_up_to_date = 1;
3252 if (warn_uninitialized || extra_warnings)
3254 uninitialized_vars_warning (DECL_INITIAL (decl));
3256 setjmp_args_warning ();
3259 close_dump_file (DFI_life, print_rtl_with_bb, insns);
3263 /* If -opt, try combining insns through substitution. */
3267 int rebuild_jump_labels_after_combine = 0;
3269 timevar_push (TV_COMBINE);
3270 open_dump_file (DFI_combine, decl);
3272 rebuild_jump_labels_after_combine
3273 = combine_instructions (insns, max_reg_num ());
3275 /* Combining insns may have turned an indirect jump into a
3276 direct jump. Rebuid the JUMP_LABEL fields of jumping
3278 if (rebuild_jump_labels_after_combine)
3280 timevar_push (TV_JUMP);
3281 rebuild_jump_labels (insns);
3282 timevar_pop (TV_JUMP);
3284 timevar_push (TV_FLOW);
3285 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3286 cleanup_cfg (insns);
3288 /* Blimey. We've got to have the CFG up to date for the call to
3289 if_convert below. However, the random deletion of blocks
3290 without updating life info can wind up with Wierd Stuff in
3291 global_live_at_end. We then run sched1, which updates things
3292 properly, discovers the wierdness and aborts. */
3293 update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
3294 PROP_DEATH_NOTES | PROP_KILL_DEAD_CODE
3295 | PROP_SCAN_DEAD_CODE);
3297 timevar_pop (TV_FLOW);
3300 close_dump_file (DFI_combine, print_rtl_with_bb, insns);
3301 timevar_pop (TV_COMBINE);
3306 /* Rerun if-conversion, as combine may have simplified things enough to
3307 now meet sequence length restrictions. */
3310 timevar_push (TV_IFCVT);
3311 open_dump_file (DFI_ce, decl);
3317 close_dump_file (DFI_ce, print_rtl_with_bb, insns);
3318 timevar_pop (TV_IFCVT);
3321 /* Register allocation pre-pass, to reduce number of moves
3322 necessary for two-address machines. */
3323 if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
3325 timevar_push (TV_REGMOVE);
3326 open_dump_file (DFI_regmove, decl);
3328 regmove_optimize (insns, max_reg_num (), rtl_dump_file);
3330 close_dump_file (DFI_regmove, print_rtl_with_bb, insns);
3331 timevar_pop (TV_REGMOVE);
3336 /* Any of the several passes since flow1 will have munged register
3337 lifetime data a bit. */
3339 register_life_up_to_date = 0;
3341 #ifdef OPTIMIZE_MODE_SWITCHING
3344 timevar_push (TV_GCSE);
3346 if (optimize_mode_switching (NULL_PTR))
3348 /* We did work, and so had to regenerate global life information.
3349 Take advantage of this and don't re-recompute register life
3350 information below. */
3351 register_life_up_to_date = 1;
3354 timevar_pop (TV_GCSE);
3358 #ifdef INSN_SCHEDULING
3360 /* Print function header into sched dump now
3361 because doing the sched analysis makes some of the dump. */
3362 if (optimize > 0 && flag_schedule_insns)
3364 timevar_push (TV_SCHED);
3365 open_dump_file (DFI_sched, decl);
3367 /* Do control and data sched analysis,
3368 and write some of the results to dump file. */
3370 schedule_insns (rtl_dump_file);
3372 close_dump_file (DFI_sched, print_rtl_with_bb, insns);
3373 timevar_pop (TV_SCHED);
3377 /* Register lifetime information was updated as part of verifying
3379 register_life_up_to_date = 1;
3383 /* Determine if the current function is a leaf before running reload
3384 since this can impact optimizations done by the prologue and
3385 epilogue thus changing register elimination offsets. */
3386 current_function_is_leaf = leaf_function_p ();
3388 timevar_push (TV_LOCAL_ALLOC);
3389 open_dump_file (DFI_lreg, decl);
3391 /* Allocate pseudo-regs that are used only within 1 basic block.
3393 RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
3394 jump optimizer after register allocation and reloading are finished. */
3396 if (! register_life_up_to_date)
3397 recompute_reg_usage (insns, ! optimize_size);
3398 regclass (insns, max_reg_num (), rtl_dump_file);
3399 rebuild_label_notes_after_reload = local_alloc ();
3401 timevar_pop (TV_LOCAL_ALLOC);
3403 if (dump_file[DFI_lreg].enabled)
3405 timevar_push (TV_DUMP);
3407 dump_flow_info (rtl_dump_file);
3408 dump_local_alloc (rtl_dump_file);
3410 close_dump_file (DFI_lreg, print_rtl_with_bb, insns);
3411 timevar_pop (TV_DUMP);
3416 timevar_push (TV_GLOBAL_ALLOC);
3417 open_dump_file (DFI_greg, decl);
3419 /* If optimizing, allocate remaining pseudo-regs. Do the reload
3420 pass fixing up any insns that are invalid. */
3423 failure = global_alloc (rtl_dump_file);
3426 build_insn_chain (insns);
3427 failure = reload (insns, 0);
3430 timevar_pop (TV_GLOBAL_ALLOC);
3432 if (dump_file[DFI_greg].enabled)
3434 timevar_push (TV_DUMP);
3436 dump_global_regs (rtl_dump_file);
3438 close_dump_file (DFI_greg, print_rtl_with_bb, insns);
3439 timevar_pop (TV_DUMP);
3443 goto exit_rest_of_compilation;
3447 open_dump_file (DFI_postreload, decl);
3449 /* Do a very simple CSE pass over just the hard registers. */
3452 timevar_push (TV_RELOAD_CSE_REGS);
3453 reload_cse_regs (insns);
3454 timevar_pop (TV_RELOAD_CSE_REGS);
3457 /* If optimizing, then go ahead and split insns now since we are about
3458 to recompute flow information anyway. */
3461 int old_labelnum = max_label_num ();
3463 split_all_insns (0);
3464 rebuild_label_notes_after_reload |= old_labelnum != max_label_num ();
3467 /* Register allocation and reloading may have turned an indirect jump into
3468 a direct jump. If so, we must rebuild the JUMP_LABEL fields of
3469 jumping instructions. */
3470 if (rebuild_label_notes_after_reload)
3472 timevar_push (TV_JUMP);
3474 rebuild_jump_labels (insns);
3476 timevar_pop (TV_JUMP);
3479 close_dump_file (DFI_postreload, print_rtl_with_bb, insns);
3481 /* Re-create the death notes which were deleted during reload. */
3482 timevar_push (TV_FLOW2);
3483 open_dump_file (DFI_flow2, decl);
3485 jump_optimize (insns, !JUMP_CROSS_JUMP,
3486 JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
3487 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3489 /* On some machines, the prologue and epilogue code, or parts thereof,
3490 can be represented as RTL. Doing so lets us schedule insns between
3491 it and the rest of the code and also allows delayed branch
3492 scheduling to operate in the epilogue. */
3493 thread_prologue_and_epilogue_insns (insns);
3497 cleanup_cfg (insns);
3498 life_analysis (insns, rtl_dump_file, PROP_FINAL);
3500 /* This is kind of a heuristic. We need to run combine_stack_adjustments
3501 even for machines with possibly nonzero RETURN_POPS_ARGS
3502 and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having
3503 push instructions will have popping returns. */
3504 #ifndef PUSH_ROUNDING
3505 if (!ACCUMULATE_OUTGOING_ARGS)
3507 combine_stack_adjustments ();
3512 flow2_completed = 1;
3514 close_dump_file (DFI_flow2, print_rtl_with_bb, insns);
3515 timevar_pop (TV_FLOW2);
3517 #ifdef HAVE_peephole2
3518 if (optimize > 0 && flag_peephole2)
3520 timevar_push (TV_PEEPHOLE2);
3521 open_dump_file (DFI_peephole2, decl);
3523 peephole2_optimize (rtl_dump_file);
3525 close_dump_file (DFI_peephole2, print_rtl_with_bb, insns);
3526 timevar_pop (TV_PEEPHOLE2);
3530 if (optimize > 0 && flag_rename_registers)
3532 timevar_push (TV_RENAME_REGISTERS);
3533 open_dump_file (DFI_rnreg, decl);
3535 regrename_optimize ();
3537 close_dump_file (DFI_rnreg, print_rtl_with_bb, insns);
3538 timevar_pop (TV_RENAME_REGISTERS);
3543 timevar_push (TV_IFCVT2);
3544 open_dump_file (DFI_ce2, decl);
3548 close_dump_file (DFI_ce2, print_rtl_with_bb, insns);
3549 timevar_pop (TV_IFCVT2);
3552 #ifdef INSN_SCHEDULING
3553 if (optimize > 0 && flag_schedule_insns_after_reload)
3555 timevar_push (TV_SCHED2);
3556 open_dump_file (DFI_sched2, decl);
3558 /* Do control and data sched analysis again,
3559 and write some more of the results to dump file. */
3561 schedule_insns (rtl_dump_file);
3563 close_dump_file (DFI_sched2, print_rtl_with_bb, insns);
3564 timevar_pop (TV_SCHED2);
3570 #ifdef LEAF_REGISTERS
3571 current_function_uses_only_leaf_regs
3572 = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
3575 if (optimize > 0 && flag_reorder_blocks)
3577 timevar_push (TV_REORDER_BLOCKS);
3578 open_dump_file (DFI_bbro, decl);
3580 reorder_basic_blocks ();
3582 close_dump_file (DFI_bbro, print_rtl_with_bb, insns);
3583 timevar_pop (TV_REORDER_BLOCKS);
3586 /* One more attempt to remove jumps to .+1 left by dead-store elimination.
3587 Also do cross-jumping this time and delete no-op move insns. */
3591 timevar_push (TV_JUMP);
3592 open_dump_file (DFI_jump2, decl);
3594 jump_optimize (insns, JUMP_CROSS_JUMP, JUMP_NOOP_MOVES,
3595 !JUMP_AFTER_REGSCAN);
3597 /* CFG no longer kept up to date. */
3599 close_dump_file (DFI_jump2, print_rtl_with_bb, insns);
3600 timevar_pop (TV_JUMP);
3603 /* If a machine dependent reorganization is needed, call it. */
3604 #ifdef MACHINE_DEPENDENT_REORG
3605 open_dump_file (DFI_mach, decl);
3607 MACHINE_DEPENDENT_REORG (insns);
3609 close_dump_file (DFI_mach, print_rtl_with_bb, insns);
3614 /* If a scheduling pass for delayed branches is to be done,
3615 call the scheduling code. */
3618 if (optimize > 0 && flag_delayed_branch)
3620 timevar_push (TV_DBR_SCHED);
3621 open_dump_file (DFI_dbr, decl);
3623 dbr_schedule (insns, rtl_dump_file);
3625 close_dump_file (DFI_dbr, print_rtl_with_bb, insns);
3626 timevar_pop (TV_DBR_SCHED);
3632 /* Shorten branches.
3634 Note this must run before reg-stack because of death note (ab)use
3635 in the ia32 backend. */
3636 timevar_push (TV_SHORTEN_BRANCH);
3637 shorten_branches (get_insns ());
3638 timevar_pop (TV_SHORTEN_BRANCH);
3641 timevar_push (TV_REG_STACK);
3642 open_dump_file (DFI_stack, decl);
3644 reg_to_stack (insns, rtl_dump_file);
3646 close_dump_file (DFI_stack, print_rtl_with_bb, insns);
3647 timevar_pop (TV_REG_STACK);
3652 current_function_nothrow = nothrow_function_p ();
3653 if (current_function_nothrow)
3654 /* Now we know that this can't throw; set the flag for the benefit
3655 of other functions later in this translation unit. */
3656 TREE_NOTHROW (current_function_decl) = 1;
3658 /* Now turn the rtl into assembler code. */
3660 timevar_push (TV_FINAL);
3665 /* Get the function's name, as described by its RTL. This may be
3666 different from the DECL_NAME name used in the source file. */
3668 x = DECL_RTL (decl);
3669 if (GET_CODE (x) != MEM)
3672 if (GET_CODE (x) != SYMBOL_REF)
3674 fnname = XSTR (x, 0);
3676 assemble_start_function (decl, fnname);
3677 final_start_function (insns, asm_out_file, optimize);
3678 final (insns, asm_out_file, optimize, 0);
3679 final_end_function (insns, asm_out_file, optimize);
3680 assemble_end_function (decl, fnname);
3682 fflush (asm_out_file);
3684 /* Release all memory allocated by flow. */
3685 free_basic_block_vars (0);
3687 /* Release all memory held by regsets now. */
3688 regset_release_memory ();
3690 timevar_pop (TV_FINAL);
3694 /* Write DBX symbols if requested. */
3696 /* Note that for those inline functions where we don't initially
3697 know for certain that we will be generating an out-of-line copy,
3698 the first invocation of this routine (rest_of_compilation) will
3699 skip over this code by doing a `goto exit_rest_of_compilation;'.
3700 Later on, finish_compilation will call rest_of_compilation again
3701 for those inline functions that need to have out-of-line copies
3702 generated. During that call, we *will* be routed past here. */
3704 timevar_push (TV_SYMOUT);
3705 #ifdef DBX_DEBUGGING_INFO
3706 if (write_symbols == DBX_DEBUG)
3707 dbxout_function (decl);
3710 #ifdef DWARF_DEBUGGING_INFO
3711 if (write_symbols == DWARF_DEBUG)
3712 dwarfout_file_scope_decl (decl, 0);
3715 #ifdef DWARF2_DEBUGGING_INFO
3716 if (write_symbols == DWARF2_DEBUG)
3717 dwarf2out_decl (decl);
3719 timevar_pop (TV_SYMOUT);
3721 exit_rest_of_compilation:
3723 /* In case the function was not output,
3724 don't leave any temporary anonymous types
3725 queued up for sdb output. */
3726 #ifdef SDB_DEBUGGING_INFO
3727 if (write_symbols == SDB_DEBUG)
3728 sdbout_types (NULL_TREE);
3731 reload_completed = 0;
3732 flow2_completed = 0;
3735 timevar_push (TV_FINAL);
3737 /* Clear out the insn_length contents now that they are no
3739 init_insn_lengths ();
3741 /* Clear out the real_constant_chain before some of the rtx's
3742 it runs through become garbage. */
3743 clear_const_double_mem ();
3745 /* Show no temporary slots allocated. */
3748 free_basic_block_vars (0);
3750 timevar_pop (TV_FINAL);
3752 /* Make sure volatile mem refs aren't considered valid operands for
3753 arithmetic insns. We must call this here if this is a nested inline
3754 function, since the above code leaves us in the init_recog state
3755 (from final.c), and the function context push/pop code does not
3756 save/restore volatile_ok.
3758 ??? Maybe it isn't necessary for expand_start_function to call this
3759 anymore if we do it here? */
3761 init_recog_no_volatile ();
3763 /* We're done with this function. Free up memory if we can. */
3764 free_after_parsing (cfun);
3765 if (! DECL_DEFER_OUTPUT (decl))
3766 free_after_compilation (cfun);
3771 timevar_pop (TV_REST_OF_COMPILATION);
3782 printf (_("Usage: %s input [switches]\n"), progname);
3783 printf (_("Switches:\n"));
3785 printf (_(" -ffixed-<register> Mark <register> as being unavailable to the compiler\n"));
3786 printf (_(" -fcall-used-<register> Mark <register> as being corrupted by function calls\n"));
3787 printf (_(" -fcall-saved-<register> Mark <register> as being preserved across functions\n"));
3788 printf (_(" -finline-limit=<number> Limits the size of inlined functions to <number>\n"));
3789 printf (_(" -fmessage-length=<number> Limits diagnostics messages lengths to <number> characters per line. 0 suppresses line-wrapping\n"));
3790 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"));
3792 for (i = ARRAY_SIZE (f_options); i--;)
3794 const char *description = f_options[i].description;
3796 if (description != NULL && * description != 0)
3797 printf (" -f%-21s %s\n",
3798 f_options[i].string, description);
3801 printf (_(" -O[number] Set optimisation level to [number]\n"));
3802 printf (_(" -Os Optimise for space rather than speed\n"));
3803 printf (_(" -pedantic Issue warnings needed by strict compliance to ISO C\n"));
3804 printf (_(" -pedantic-errors Like -pedantic except that errors are produced\n"));
3805 printf (_(" -w Suppress warnings\n"));
3806 printf (_(" -W Enable extra warnings\n"));
3808 for (i = ARRAY_SIZE (W_options); i--;)
3810 const char *description = W_options[i].description;
3812 if (description != NULL && * description != 0)
3813 printf (" -W%-21s %s\n",
3814 W_options[i].string, description);
3817 printf (_(" -Wunused Enable unused warnings\n"));
3818 printf (_(" -Wid-clash-<num> Warn if 2 identifiers have the same first <num> chars\n"));
3819 printf (_(" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n"));
3820 printf (_(" -p Enable function profiling\n"));
3821 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER)
3822 printf (_(" -a Enable block profiling \n"));
3824 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER) || defined FUNCTION_BLOCK_PROFILER_EXIT
3825 printf (_(" -ax Enable jump profiling \n"));
3827 printf (_(" -o <file> Place output into <file> \n"));
3829 -G <number> Put global and static data smaller than <number>\n\
3830 bytes into a special section (on some targets)\n"));
3832 for (i = ARRAY_SIZE (debug_args); i--;)
3834 if (debug_args[i].description != NULL)
3835 printf (" -g%-21s %s\n",
3836 debug_args[i].arg, debug_args[i].description);
3839 printf (_(" -aux-info <file> Emit declaration info into <file>.X\n"));
3840 printf (_(" -quiet Do not display functions compiled or elapsed time\n"));
3841 printf (_(" -version Display the compiler's version\n"));
3842 printf (_(" -d[letters] Enable dumps from specific passes of the compiler\n"));
3843 printf (_(" -dumpbase <file> Base name to be used for dumps from specific passes\n"));
3844 #if defined INSN_SCHEDULING
3845 printf (_(" -fsched-verbose=<number> Set the verbosity level of the scheduler\n"));
3847 printf (_(" --help Display this information\n"));
3852 /* Display descriptions of language specific options.
3853 If there is no description, note that there is an undocumented option.
3854 If the description is empty, do not display anything. (This allows
3855 options to be deliberately undocumented, for whatever reason).
3856 If the option string is missing, then this is a marker, indicating
3857 that the description string is in fact the name of a language, whose
3858 language specific options are to follow. */
3860 if (ARRAY_SIZE (documented_lang_options) > 1)
3862 printf (_("\nLanguage specific options:\n"));
3864 for (i = 0; i < ARRAY_SIZE (documented_lang_options); i++)
3866 const char *description = documented_lang_options[i].description;
3867 const char *option = documented_lang_options[i].option;
3869 if (description == NULL)
3874 printf (_(" %-23.23s [undocumented]\n"), option);
3876 else if (*description == 0)
3878 else if (option == NULL)
3882 (_("\nThere are undocumented %s specific options as well.\n"),
3886 printf (_("\n Options for %s:\n"), description);
3891 printf (" %-23.23s %s\n", option, description);
3896 printf (_("\nThere are undocumented %s specific options as well.\n"),
3899 display_target_options ();
3903 display_target_options ()
3907 if (ARRAY_SIZE (target_switches) > 1
3908 #ifdef TARGET_OPTIONS
3909 || ARRAY_SIZE (target_options) > 1
3917 printf (_("\nTarget specific options:\n"));
3919 for (i = ARRAY_SIZE (target_switches); i--;)
3921 const char *option = target_switches[i].name;
3922 const char *description = target_switches[i].description;
3924 if (option == NULL || *option == 0)
3926 else if (description == NULL)
3931 printf (_(" -m%-23.23s [undocumented]\n"), option);
3933 else if (* description != 0)
3934 doc += printf (" -m%-23.23s %s\n", option, description);
3937 #ifdef TARGET_OPTIONS
3938 for (i = ARRAY_SIZE (target_options); i--;)
3940 const char *option = target_options[i].prefix;
3941 const char *description = target_options[i].description;
3943 if (option == NULL || *option == 0)
3945 else if (description == NULL)
3950 printf (_(" -m%-23.23s [undocumented]\n"), option);
3952 else if (* description != 0)
3953 doc += printf (" -m%-23.23s %s\n", option, description);
3959 printf (_("\nThere are undocumented target specific options as well.\n"));
3961 printf (_(" They exist, but they are not documented.\n"));
3966 /* Parse a -d... comand line switch. */
3969 decode_d_option (arg)
3978 for (i = 0; i < DFI_MAX; ++i)
3979 dump_file[i].enabled = 1;
3988 flag_print_asm_name = 1;
3991 flag_dump_rtl_in_asm = 1;
3992 flag_print_asm_name = 1;
3995 graph_dump_format = vcg;
3998 rtl_dump_and_exit = 1;
4003 case 'D': /* These are handled by the preprocessor. */
4009 for (i = 0; i < DFI_MAX; ++i)
4010 if (c == dump_file[i].debug_switch)
4012 dump_file[i].enabled = 1;
4017 warning ("unrecognized gcc debugging option: %c", c);
4022 /* Parse a -f... comand line switch. ARG is the value after the -f.
4023 It is safe to access 'ARG - 2' to generate the full switch name.
4024 Return the number of strings consumed. */
4027 decode_f_option (arg)
4031 const char *option_value = NULL;
4033 /* Search for the option in the table of binary f options. */
4034 for (j = ARRAY_SIZE (f_options); j--;)
4036 if (!strcmp (arg, f_options[j].string))
4038 *f_options[j].variable = f_options[j].on_value;
4042 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4043 && ! strcmp (arg + 3, f_options[j].string))
4045 *f_options[j].variable = ! f_options[j].on_value;
4050 if ((option_value = skip_leading_substring (arg, "inline-limit-"))
4051 || (option_value = skip_leading_substring (arg, "inline-limit=")))
4053 read_integral_parameter (option_value, arg - 2, inline_max_insns);
4054 #ifdef INSN_SCHEDULING
4055 else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
4056 fix_sched_param ("verbose", option_value);
4058 else if ((option_value = skip_leading_substring (arg, "fixed-")))
4059 fix_register (option_value, 1, 1);
4060 else if ((option_value = skip_leading_substring (arg, "call-used-")))
4061 fix_register (option_value, 0, 1);
4062 else if ((option_value = skip_leading_substring (arg, "call-saved-")))
4063 fix_register (option_value, 0, 0);
4064 else if ((option_value = skip_leading_substring (arg, "align-loops=")))
4065 align_loops = read_integral_parameter (option_value, arg - 2, align_loops);
4066 else if ((option_value = skip_leading_substring (arg, "align-functions=")))
4068 = read_integral_parameter (option_value, arg - 2, align_functions);
4069 else if ((option_value = skip_leading_substring (arg, "align-jumps=")))
4070 align_jumps = read_integral_parameter (option_value, arg - 2, align_jumps);
4071 else if ((option_value = skip_leading_substring (arg, "align-labels=")))
4073 = read_integral_parameter (option_value, arg - 2, align_labels);
4074 else if ((option_value
4075 = skip_leading_substring (arg, "stack-limit-register=")))
4077 int reg = decode_reg_name (option_value);
4079 error ("unrecognized register name `%s'", option_value);
4081 stack_limit_rtx = gen_rtx_REG (Pmode, reg);
4083 else if ((option_value
4084 = skip_leading_substring (arg, "stack-limit-symbol=")))
4087 nm = ggc_strdup (option_value);
4088 stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
4090 else if ((option_value
4091 = skip_leading_substring (arg, "message-length=")))
4092 diagnostic_message_length_per_line =
4093 read_integral_parameter (option_value, arg - 2,
4094 diagnostic_message_length_per_line);
4095 else if ((option_value
4096 = skip_leading_substring (arg, "diagnostics-show-location=")))
4098 if (!strcmp (option_value, "once"))
4099 set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_ONCE);
4100 else if (!strcmp (option_value, "every-line"))
4101 set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE);
4103 error ("Unrecognized option `%s'", arg - 2);
4105 else if (!strcmp (arg, "no-stack-limit"))
4106 stack_limit_rtx = NULL_RTX;
4107 else if (!strcmp (arg, "preprocessed"))
4108 /* Recognise this switch but do nothing. This prevents warnings
4109 about an unrecognized switch if cpplib has not been linked in. */
4117 /* Parse a -W... comand line switch. ARG is the value after the -W.
4118 It is safe to access 'ARG - 2' to generate the full switch name.
4119 Return the number of strings consumed. */
4122 decode_W_option (arg)
4125 const char *option_value = NULL;
4128 /* Search for the option in the table of binary W options. */
4130 for (j = ARRAY_SIZE (W_options); j--;)
4132 if (!strcmp (arg, W_options[j].string))
4134 *W_options[j].variable = W_options[j].on_value;
4138 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4139 && ! strcmp (arg + 3, W_options[j].string))
4141 *W_options[j].variable = ! W_options[j].on_value;
4146 if ((option_value = skip_leading_substring (arg, "id-clash-")))
4148 id_clash_len = read_integral_parameter (option_value, arg - 2, -1);
4150 if (id_clash_len != -1)
4153 else if ((option_value = skip_leading_substring (arg, "larger-than-")))
4155 larger_than_size = read_integral_parameter (option_value, arg - 2, -1);
4157 if (larger_than_size != -1)
4158 warn_larger_than = 1;
4160 else if (!strcmp (arg, "unused"))
4164 else if (!strcmp (arg, "no-unused"))
4174 /* Parse a -g... comand line switch. ARG is the value after the -g.
4175 It is safe to access 'ARG - 2' to generate the full switch name.
4176 Return the number of strings consumed. */
4179 decode_g_option (arg)
4183 /* A lot of code assumes write_symbols == NO_DEBUG if the
4184 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4185 of what debugging type has been selected). This records the
4186 selected type. It is an error to specify more than one
4188 static enum debug_info_type selected_debug_type = NO_DEBUG;
4189 /* Non-zero if debugging format has been explicitly set.
4190 -g and -ggdb don't explicitly set the debugging format so
4191 -gdwarf -g3 is equivalent to -gdwarf3. */
4192 static int type_explicitly_set_p = 0;
4193 /* Indexed by enum debug_info_type. */
4194 static const char *debug_type_names[] =
4196 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4199 /* The maximum admissible debug level value. */
4200 static const unsigned max_debug_level = 3;
4202 /* Look up ARG in the table. */
4203 for (da = debug_args; da->arg; da++)
4205 const int da_len = strlen (da->arg);
4207 if (da_len == 0 || ! strncmp (arg, da->arg, da_len))
4209 enum debug_info_type type = da->debug_type;
4210 const char *p = arg + da_len;
4212 if (*p && (*p < '0' || *p > '9'))
4215 /* A debug flag without a level defaults to level 2.
4216 Note we do not want to call read_integral_parameter
4217 for that case since it will call atoi which
4220 ??? We may want to generalize the interface to
4221 read_integral_parameter to better handle this case
4222 if this case shows up often. */
4224 level = read_integral_parameter (p, 0, max_debug_level + 1);
4228 if (da_len > 1 && *p && !strncmp (arg, "dwarf", da_len))
4230 error ("use -gdwarf -g%d for DWARF v1, level %d",
4233 error ("use -gdwarf-2 for DWARF v2");
4236 if (level > max_debug_level)
4239 ignoring option `%s' due to invalid debug level specification",
4241 level = debug_info_level;
4244 if (type == NO_DEBUG)
4246 type = PREFERRED_DEBUGGING_TYPE;
4248 if (da_len > 1 && strncmp (arg, "gdb", da_len) == 0)
4250 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4251 type = DWARF2_DEBUG;
4253 #ifdef DBX_DEBUGGING_INFO
4260 if (type == NO_DEBUG)
4261 warning ("`%s': unknown or unsupported -g option", arg - 2);
4263 /* Does it conflict with an already selected type? */
4264 if (type_explicitly_set_p
4265 /* -g/-ggdb don't conflict with anything. */
4266 && da->debug_type != NO_DEBUG
4267 && type != selected_debug_type)
4268 warning ("`%s' ignored, conflicts with `-g%s'",
4269 arg - 2, debug_type_names[(int) selected_debug_type]);
4272 /* If the format has already been set, -g/-ggdb
4273 only change the debug level. */
4274 if (type_explicitly_set_p && da->debug_type == NO_DEBUG)
4275 /* Don't change debugging type. */
4279 selected_debug_type = type;
4280 type_explicitly_set_p = da->debug_type != NO_DEBUG;
4283 write_symbols = (level == 0
4285 : selected_debug_type);
4286 use_gnu_debug_info_extensions = da->use_extensions_p;
4287 debug_info_level = (enum debug_info_level) level;
4300 /* Decode the first argument in the argv as a language-independent option.
4301 Return the number of strings consumed. */
4304 independent_decode_option (argc, argv)
4308 char *arg = argv[0];
4310 if (arg[0] != '-' || arg[1] == 0)
4322 if (!strcmp (arg, "-help"))
4328 if (!strcmp (arg, "-target-help"))
4330 display_target_options ();
4343 /* Already been treated in main (). Do nothing. */
4347 set_target_switch (arg + 1);
4351 return decode_f_option (arg + 1);
4354 return decode_g_option (arg + 1);
4357 if (!strcmp (arg, "dumpbase"))
4362 dump_base_name = argv[1];
4366 decode_d_option (arg + 1);
4370 if (!strcmp (arg, "pedantic"))
4372 else if (!strcmp (arg, "pedantic-errors"))
4373 flag_pedantic_errors = pedantic = 1;
4374 else if (arg[1] == 0)
4381 if (!strcmp (arg, "quiet"))
4388 if (!strcmp (arg, "version"))
4396 inhibit_warnings = 1;
4405 /* We save the value of warn_uninitialized, since if they put
4406 -Wuninitialized on the command line, we need to generate a
4407 warning about not using it without also specifying -O. */
4408 if (warn_uninitialized != 1)
4409 warn_uninitialized = 2;
4412 return decode_W_option (arg + 1);
4418 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4419 warning ("`-a' option (basic block profile) not supported");
4421 profile_block_flag = (profile_block_flag < 2) ? 1 : 3;
4424 else if (!strcmp (arg, "ax"))
4426 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4427 warning ("`-ax' option (jump profiling) not supported");
4429 profile_block_flag = (!profile_block_flag
4430 || profile_block_flag == 2) ? 2 : 3;
4433 else if (!strncmp (arg, "aux-info", 8))
4435 flag_gen_aux_info = 1;
4441 aux_info_file_name = argv[1];
4445 aux_info_file_name = arg + 8;
4457 asm_file_name = argv[1];
4472 g_switch_val = read_integral_parameter (argv[1], 0, -1);
4477 g_switch_val = read_integral_parameter (arg + 1, 0, -1);
4481 if (g_switch_val == -1)
4485 g_switch_set = TRUE;
4486 g_switch_value = g_switch_val;
4496 /* Entry point of cc1/c++. Decode command args, then call compile_file.
4497 Exit code is 35 if can't open files, 34 if fatal error,
4498 33 if had nonfatal errors, else success. */
4500 extern int main PARAMS ((int, char **));
4510 /* save in case md file wants to emit args as a comment. */
4514 p = argv[0] + strlen (argv[0]);
4515 while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
4519 #ifdef HAVE_LC_MESSAGES
4520 setlocale (LC_MESSAGES, "");
4522 (void) bindtextdomain (PACKAGE, localedir);
4523 (void) textdomain (PACKAGE);
4525 /* Install handler for SIGFPE, which may be received while we do
4526 compile-time floating point arithmetic. */
4527 signal (SIGFPE, float_signal);
4529 /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */
4531 signal (SIGSEGV, crash_signal);
4534 signal (SIGILL, crash_signal);
4537 signal (SIGBUS, crash_signal);
4540 signal (SIGABRT, crash_signal);
4542 #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
4543 signal (SIGIOT, crash_signal);
4546 decl_printable_name = decl_name;
4547 lang_expand_expr = (lang_expand_expr_t) do_abort;
4549 /* Initialize whether `char' is signed. */
4550 flag_signed_char = DEFAULT_SIGNED_CHAR;
4551 #ifdef DEFAULT_SHORT_ENUMS
4552 /* Initialize how much space enums occupy, by default. */
4553 flag_short_enums = DEFAULT_SHORT_ENUMS;
4556 /* Initialize the garbage-collector. */
4558 ggc_add_root (&input_file_stack, 1, sizeof input_file_stack,
4560 ggc_add_rtx_root (&stack_limit_rtx, 1);
4561 ggc_add_tree_root (¤t_function_decl, 1);
4562 ggc_add_tree_root (¤t_function_func_begin_label, 1);
4564 /* Initialize the diagnostics reporting machinery. */
4565 initialize_diagnostics ();
4567 /* Perform language-specific options intialization. */
4568 lang_init_options ();
4570 /* Scan to see what optimization level has been specified. That will
4571 determine the default value of many flags. */
4572 for (i = 1; i < argc; i++)
4574 if (!strcmp (argv[i], "-O"))
4579 else if (argv[i][0] == '-' && argv[i][1] == 'O')
4581 /* Handle -Os, -O2, -O3, -O69, ... */
4582 char *p = &argv[i][2];
4584 if ((p[0] == 's') && (p[1] == 0))
4588 /* Optimizing for size forces optimize to be 2. */
4593 const int optimize_val = read_integral_parameter (p, p - 2, -1);
4594 if (optimize_val != -1)
4596 optimize = optimize_val;
4606 flag_thread_jumps = 1;
4608 flag_delayed_branch = 1;
4610 #ifdef CAN_DEBUG_WITHOUT_FP
4611 flag_omit_frame_pointer = 1;
4617 flag_optimize_sibling_calls = 1;
4618 flag_cse_follow_jumps = 1;
4619 flag_cse_skip_blocks = 1;
4621 flag_expensive_optimizations = 1;
4622 flag_strength_reduce = 1;
4623 flag_rerun_cse_after_loop = 1;
4624 flag_rerun_loop_opt = 1;
4625 flag_caller_saves = 1;
4628 #ifdef INSN_SCHEDULING
4629 flag_schedule_insns = 1;
4630 flag_schedule_insns_after_reload = 1;
4633 flag_strict_aliasing = 1;
4634 flag_delete_null_pointer_checks = 1;
4635 flag_reorder_blocks = 1;
4640 flag_inline_functions = 1;
4641 flag_rename_registers = 1;
4644 if (optimize < 2 || optimize_size)
4649 align_functions = 1;
4652 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
4655 set_target_switch ("");
4657 /* Unwind tables are always present in an ABI-conformant IA-64
4658 object file, so the default should be ON. */
4659 #ifdef IA64_UNWIND_INFO
4660 flag_unwind_tables = IA64_UNWIND_INFO;
4663 #ifdef OPTIMIZATION_OPTIONS
4664 /* Allow default optimizations to be specified on a per-machine basis. */
4665 OPTIMIZATION_OPTIONS (optimize, optimize_size);
4668 /* Initialize register usage now so switches may override. */
4671 /* Perform normal command line switch decoding. */
4672 for (i = 1; i < argc;)
4674 unsigned int lang_processed;
4675 unsigned int indep_processed;
4677 /* Give the language a chance to decode the option for itself. */
4678 lang_processed = lang_decode_option (argc - i, argv + i);
4680 /* Now see if the option also has a language independent meaning.
4681 Some options are both language specific and language independent,
4683 indep_processed = independent_decode_option (argc - i, argv + i);
4685 if (lang_processed || indep_processed)
4686 i += MAX (lang_processed, indep_processed);
4689 const char *option = NULL;
4690 const char *lang = NULL;
4693 /* It is possible that the command line switch is not valid for the
4694 current language, but it is valid for another language. In order
4695 to be compatible with previous versions of the compiler (which
4696 did not issue an error message in this case) we check for this
4697 possibility here. If we do find a match, then if extra_warnings
4698 is set we generate a warning message, otherwise we will just
4699 ignore the option. */
4700 for (j = 0; j < ARRAY_SIZE (documented_lang_options); j++)
4702 option = documented_lang_options[j].option;
4705 lang = documented_lang_options[j].description;
4706 else if (! strncmp (argv[i], option, strlen (option)))
4710 if (j != ARRAY_SIZE (documented_lang_options))
4714 warning ("Ignoring command line option '%s'", argv[i]);
4717 ("(It is valid for %s but not the selected language)",
4721 else if (argv[i][0] == '-' && argv[i][1] == 'g')
4722 warning ("`%s': unknown or unsupported -g option", &argv[i][2]);
4724 error ("Unrecognized option `%s'", argv[i]);
4730 /* Reflect any language-specific diagnostic option setting. */
4731 reshape_diagnostic_buffer ();
4733 /* Checker uses the frame pointer. */
4734 if (flag_check_memory_usage)
4735 flag_omit_frame_pointer = 0;
4739 /* Inlining does not work if not optimizing,
4740 so force it not to be done. */
4744 /* The c_decode_option and lang_decode_option functions set
4745 this to `2' if -Wall is used, so we can avoid giving out
4746 lots of errors for people who don't realize what -Wall does. */
4747 if (warn_uninitialized == 1)
4748 warning ("-Wuninitialized is not supported without -O");
4751 #ifdef OVERRIDE_OPTIONS
4752 /* Some machines may reject certain combinations of options. */
4756 if (exceptions_via_longjmp == 2)
4758 #ifdef DWARF2_UNWIND_INFO
4759 exceptions_via_longjmp = ! DWARF2_UNWIND_INFO;
4761 #ifdef IA64_UNWIND_INFO
4762 exceptions_via_longjmp = ! IA64_UNWIND_INFO;
4764 exceptions_via_longjmp = 1;
4769 /* Since each function gets its own handler data, we can't support the
4770 new model currently, since it depend on a specific rethrow label
4771 which is declared at the front of the table, and we can only
4772 have one such symbol in a file. */
4773 #ifdef IA64_UNWIND_INFO
4774 flag_new_exceptions = 0;
4777 /* Set up the align_*_log variables, defaulting them to 1 if they
4778 were still unset. */
4779 if (align_loops <= 0) align_loops = 1;
4780 align_loops_log = floor_log2 (align_loops * 2 - 1);
4781 if (align_jumps <= 0) align_jumps = 1;
4782 align_jumps_log = floor_log2 (align_jumps * 2 - 1);
4783 if (align_labels <= 0) align_labels = 1;
4784 align_labels_log = floor_log2 (align_labels * 2 - 1);
4785 if (align_functions <= 0) align_functions = 1;
4786 align_functions_log = floor_log2 (align_functions * 2 - 1);
4788 if (profile_block_flag == 3)
4790 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4791 profile_block_flag = 2;
4794 /* Unrolling all loops implies that standard loop unrolling must also
4796 if (flag_unroll_all_loops)
4797 flag_unroll_loops = 1;
4798 /* Loop unrolling requires that strength_reduction be on also. Silently
4799 turn on strength reduction here if it isn't already on. Also, the loop
4800 unrolling code assumes that cse will be run after loop, so that must
4801 be turned on also. */
4802 if (flag_unroll_loops)
4804 flag_strength_reduce = 1;
4805 flag_rerun_cse_after_loop = 1;
4808 /* Warn about options that are not supported on this machine. */
4809 #ifndef INSN_SCHEDULING
4810 if (flag_schedule_insns || flag_schedule_insns_after_reload)
4811 warning ("instruction scheduling not supported on this target machine");
4814 if (flag_delayed_branch)
4815 warning ("this target machine does not have delayed branches");
4818 user_label_prefix = USER_LABEL_PREFIX;
4819 if (flag_leading_underscore != -1)
4821 /* If the default prefix is more complicated than "" or "_",
4822 issue a warning and ignore this option. */
4823 if (user_label_prefix[0] == 0 ||
4824 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
4826 user_label_prefix = flag_leading_underscore ? "_" : "";
4829 warning ("-f%sleading-underscore not supported on this target machine",
4830 flag_leading_underscore ? "" : "no-");
4833 /* If we are in verbose mode, write out the version and maybe all the
4834 option flags in use. */
4837 print_version (stderr, "");
4839 print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
4842 compile_file (filename);
4844 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__)) && !defined(__INTERIX)
4847 char *lim = (char *) sbrk (0);
4849 fnotice (stderr, "Data size %ld.\n", (long) (lim - (char *) &environ));
4854 system ("ps -l 1>&2");
4857 #endif /* not USG */
4860 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX */
4863 return (FATAL_EXIT_CODE);
4865 return (FATAL_EXIT_CODE);
4866 return (SUCCESS_EXIT_CODE);
4869 /* Decode -m switches. */
4870 /* Decode the switch -mNAME. */
4873 set_target_switch (name)
4877 int valid_target_option = 0;
4879 for (j = 0; j < ARRAY_SIZE (target_switches); j++)
4880 if (!strcmp (target_switches[j].name, name))
4882 if (target_switches[j].value < 0)
4883 target_flags &= ~-target_switches[j].value;
4885 target_flags |= target_switches[j].value;
4886 valid_target_option = 1;
4889 #ifdef TARGET_OPTIONS
4890 if (!valid_target_option)
4891 for (j = 0; j < ARRAY_SIZE (target_options); j++)
4893 int len = strlen (target_options[j].prefix);
4894 if (!strncmp (target_options[j].prefix, name, len))
4896 *target_options[j].variable = name + len;
4897 valid_target_option = 1;
4902 if (!valid_target_option)
4903 error ("Invalid option `%s'", name);
4906 /* Print version information to FILE.
4907 Each line begins with INDENT (for the case where FILE is the
4908 assembler output file). */
4911 print_version (file, indent)
4916 #define __VERSION__ "[?]"
4920 "%s%s%s version %s (%s) compiled by GNU C version %s.\n"
4922 "%s%s%s version %s (%s) compiled by CC.\n"
4924 , indent, *indent != 0 ? " " : "",
4925 language_string, version_string, TARGET_NAME, __VERSION__);
4928 /* Print an option value and return the adjusted position in the line.
4929 ??? We don't handle error returns from fprintf (disk full); presumably
4930 other code will catch a disk full though. */
4933 print_single_switch (file, pos, max, indent, sep, term, type, name)
4936 const char *indent, *sep, *term, *type, *name;
4938 /* The ultrix fprintf returns 0 on success, so compute the result we want
4939 here since we need it for the following test. */
4940 int len = strlen (sep) + strlen (type) + strlen (name);
4945 fprintf (file, "%s", term);
4950 fprintf (file, "%s", indent);
4951 pos = strlen (indent);
4953 fprintf (file, "%s%s%s", sep, type, name);
4958 /* Print active target switches to FILE.
4959 POS is the current cursor position and MAX is the size of a "line".
4960 Each line begins with INDENT and ends with TERM.
4961 Each switch is separated from the next by SEP. */
4964 print_switch_values (file, pos, max, indent, sep, term)
4967 const char *indent, *sep, *term;
4972 /* Print the options as passed. */
4974 pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
4975 _("options passed: "), "");
4977 for (p = &save_argv[1]; *p != NULL; p++)
4981 if (strcmp (*p, "-o") == 0)
4987 if (strcmp (*p, "-quiet") == 0)
4989 if (strcmp (*p, "-version") == 0)
4994 pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
4997 fprintf (file, "%s", term);
4999 /* Print the -f and -m options that have been enabled.
5000 We don't handle language specific options but printing argv
5003 pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
5004 _("options enabled: "), "");
5006 for (j = 0; j < ARRAY_SIZE (f_options); j++)
5007 if (*f_options[j].variable == f_options[j].on_value)
5008 pos = print_single_switch (file, pos, max, indent, sep, term,
5009 "-f", f_options[j].string);
5011 /* Print target specific options. */
5013 for (j = 0; j < ARRAY_SIZE (target_switches); j++)
5014 if (target_switches[j].name[0] != '\0'
5015 && target_switches[j].value > 0
5016 && ((target_switches[j].value & target_flags)
5017 == target_switches[j].value))
5019 pos = print_single_switch (file, pos, max, indent, sep, term,
5020 "-m", target_switches[j].name);
5023 #ifdef TARGET_OPTIONS
5024 for (j = 0; j < ARRAY_SIZE (target_options); j++)
5025 if (*target_options[j].variable != NULL)
5028 sprintf (prefix, "-m%s", target_options[j].prefix);
5029 pos = print_single_switch (file, pos, max, indent, sep, term,
5030 prefix, *target_options[j].variable);
5034 fprintf (file, "%s", term);
5037 /* Record the beginning of a new source file, named FILENAME. */
5040 debug_start_source_file (filename)
5041 register const char *filename ATTRIBUTE_UNUSED;
5043 #ifdef DBX_DEBUGGING_INFO
5044 if (write_symbols == DBX_DEBUG)
5045 dbxout_start_new_source_file (filename);
5047 #ifdef DWARF_DEBUGGING_INFO
5048 if (debug_info_level == DINFO_LEVEL_VERBOSE
5049 && write_symbols == DWARF_DEBUG)
5050 dwarfout_start_new_source_file (filename);
5051 #endif /* DWARF_DEBUGGING_INFO */
5052 #ifdef DWARF2_DEBUGGING_INFO
5053 if (write_symbols == DWARF2_DEBUG)
5054 dwarf2out_start_source_file (filename);
5055 #endif /* DWARF2_DEBUGGING_INFO */
5056 #ifdef SDB_DEBUGGING_INFO
5057 if (write_symbols == SDB_DEBUG)
5058 sdbout_start_new_source_file (filename);
5062 /* Record the resumption of a source file. LINENO is the line number in
5063 the source file we are returning to. */
5066 debug_end_source_file (lineno)
5067 register unsigned lineno ATTRIBUTE_UNUSED;
5069 #ifdef DBX_DEBUGGING_INFO
5070 if (write_symbols == DBX_DEBUG)
5071 dbxout_resume_previous_source_file ();
5073 #ifdef DWARF_DEBUGGING_INFO
5074 if (debug_info_level == DINFO_LEVEL_VERBOSE
5075 && write_symbols == DWARF_DEBUG)
5076 dwarfout_resume_previous_source_file (lineno);
5077 #endif /* DWARF_DEBUGGING_INFO */
5078 #ifdef DWARF2_DEBUGGING_INFO
5079 if (write_symbols == DWARF2_DEBUG)
5080 dwarf2out_end_source_file ();
5081 #endif /* DWARF2_DEBUGGING_INFO */
5082 #ifdef SDB_DEBUGGING_INFO
5083 if (write_symbols == SDB_DEBUG)
5084 sdbout_resume_previous_source_file ();
5088 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5089 the tail part of the directive line, i.e. the part which is past the
5090 initial whitespace, #, whitespace, directive-name, whitespace part. */
5093 debug_define (lineno, buffer)
5094 register unsigned lineno ATTRIBUTE_UNUSED;
5095 register char *buffer ATTRIBUTE_UNUSED;
5097 #ifdef DWARF_DEBUGGING_INFO
5098 if (debug_info_level == DINFO_LEVEL_VERBOSE
5099 && write_symbols == DWARF_DEBUG)
5100 dwarfout_define (lineno, buffer);
5101 #endif /* DWARF_DEBUGGING_INFO */
5102 #ifdef DWARF2_DEBUGGING_INFO
5103 if (debug_info_level == DINFO_LEVEL_VERBOSE
5104 && write_symbols == DWARF2_DEBUG)
5105 dwarf2out_define (lineno, buffer);
5106 #endif /* DWARF2_DEBUGGING_INFO */
5109 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5110 the tail part of the directive line, i.e. the part which is past the
5111 initial whitespace, #, whitespace, directive-name, whitespace part. */
5114 debug_undef (lineno, buffer)
5115 register unsigned lineno ATTRIBUTE_UNUSED;
5116 register char *buffer ATTRIBUTE_UNUSED;
5118 #ifdef DWARF_DEBUGGING_INFO
5119 if (debug_info_level == DINFO_LEVEL_VERBOSE
5120 && write_symbols == DWARF_DEBUG)
5121 dwarfout_undef (lineno, buffer);
5122 #endif /* DWARF_DEBUGGING_INFO */
5123 #ifdef DWARF2_DEBUGGING_INFO
5124 if (debug_info_level == DINFO_LEVEL_VERBOSE
5125 && write_symbols == DWARF2_DEBUG)
5126 dwarf2out_undef (lineno, buffer);
5127 #endif /* DWARF2_DEBUGGING_INFO */
5130 /* Returns nonzero if it is appropriate not to emit any debugging
5131 information for BLOCK, because it doesn't contain any instructions.
5132 This may not be the case for blocks containing nested functions, since
5133 we may actually call such a function even though the BLOCK information
5137 debug_ignore_block (block)
5138 tree block ATTRIBUTE_UNUSED;
5140 /* Never delete the BLOCK for the outermost scope
5141 of the function; we can refer to names from
5142 that scope even if the block notes are messed up. */
5143 if (is_body_block (block))
5146 #ifdef DWARF2_DEBUGGING_INFO
5147 if (write_symbols == DWARF2_DEBUG)
5148 return dwarf2out_ignore_block (block);