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 mark_file_stack PARAMS ((void *));
175 static void decode_d_option PARAMS ((const char *));
176 static int decode_f_option PARAMS ((const char *));
177 static int decode_W_option PARAMS ((const char *));
178 static int decode_g_option PARAMS ((const char *));
179 static unsigned int independent_decode_option PARAMS ((int, char **));
181 static void print_version PARAMS ((FILE *, const char *));
182 static int print_single_switch PARAMS ((FILE *, int, int, const char *,
183 const char *, const char *,
184 const char *, const char *));
185 static void print_switch_values PARAMS ((FILE *, int, int, const char *,
186 const char *, const char *));
188 /* Length of line when printing switch values. */
191 /* Name of program invoked, sans directories. */
193 const char *progname;
195 /* Copy of arguments to main. */
199 /* Name of current original source file (what was input to cpp).
200 This comes from each #-command in the actual input. */
202 const char *input_filename;
204 /* Name of top-level original source file (what was input to cpp).
205 This comes from the #-command at the beginning of the actual input.
206 If there isn't any there, then this is the cc1 input file name. */
208 const char *main_input_filename;
210 /* Current line number in real source file. */
214 /* Nonzero if it is unsafe to create any new pseudo registers. */
217 /* Stack of currently pending input files. */
219 struct file_stack *input_file_stack;
221 /* Incremented on each change to input_file_stack. */
222 int input_file_stack_tick;
224 /* Name to use as base of names for dump output files. */
226 const char *dump_base_name;
228 /* Bit flags that specify the machine subtype we are compiling for.
229 Bits are tested using macros TARGET_... defined in the tm.h file
230 and set by `-m...' switches. Must be defined in rtlanal.c. */
232 extern int target_flags;
234 /* Describes a dump file. */
236 struct dump_file_info
238 /* The unique extension to apply, e.g. ".jump". */
239 const char *const extension;
241 /* The -d<c> character that enables this dump file. */
242 char const debug_switch;
244 /* True if there is a corresponding graph dump file. */
245 char const graph_dump_p;
247 /* True if the user selected this dump. */
250 /* True if the files have been initialized (ie truncated). */
254 /* Enumerate the extant dump files. */
291 /* Describes all the dump files. Should be kept in order of the
292 pass and in sync with dump_file_index above.
294 Remaining -d letters:
300 struct dump_file_info dump_file[DFI_MAX] =
302 { "rtl", 'r', 0, 0, 0 },
303 { "sibling", 'i', 0, 0, 0 },
304 { "jump", 'j', 0, 0, 0 },
305 { "cse", 's', 0, 0, 0 },
306 { "addressof", 'F', 0, 0, 0 },
307 { "ssa", 'e', 1, 0, 0 },
308 { "dce", 'X', 1, 0, 0 },
309 { "ussa", 'e', 1, 0, 0 }, /* Yes, duplicate enable switch. */
310 { "gcse", 'G', 1, 0, 0 },
311 { "loop", 'L', 1, 0, 0 },
312 { "cse2", 't', 1, 0, 0 },
313 { "cfg", 'f', 1, 0, 0 },
314 { "bp", 'b', 1, 0, 0 },
315 { "life", 'f', 1, 0, 0 }, /* Yes, duplicate enable switch. */
316 { "combine", 'c', 1, 0, 0 },
317 { "ce", 'C', 1, 0, 0 },
318 { "regmove", 'N', 1, 0, 0 },
319 { "sched", 'S', 1, 0, 0 },
320 { "lreg", 'l', 1, 0, 0 },
321 { "greg", 'g', 1, 0, 0 },
322 { "flow2", 'w', 1, 0, 0 },
323 { "ce2", 'E', 1, 0, 0 },
324 { "peephole2", 'z', 1, 0, 0 },
325 { "rnreg", 'n', 1, 0, 0 },
326 { "sched2", 'R', 1, 0, 0 },
327 { "bbro", 'B', 1, 0, 0 },
328 { "jump2", 'J', 1, 0, 0 },
329 { "mach", 'M', 1, 0, 0 },
330 { "dbr", 'd', 0, 0, 0 },
331 { "stack", 'k', 1, 0, 0 },
334 static int open_dump_file PARAMS ((enum dump_file_index, tree));
335 static void close_dump_file PARAMS ((enum dump_file_index,
336 void (*) (FILE *, rtx), rtx));
338 /* Other flags saying which kinds of debugging dump have been requested. */
340 int rtl_dump_and_exit;
341 int flag_print_asm_name;
342 static int flag_print_mem;
343 static int version_flag;
344 static char *filename;
345 enum graph_dump_types graph_dump_format;
347 /* Name for output file of assembly code, specified with -o. */
351 /* Value of the -G xx switch, and whether it was passed or not. */
355 /* Type(s) of debugging information we are producing (if any).
356 See flags.h for the definitions of the different possible
357 types of debugging information. */
358 enum debug_info_type write_symbols = NO_DEBUG;
360 /* Level of debugging information we are producing. See flags.h
361 for the definitions of the different possible levels. */
362 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
364 /* Nonzero means use GNU-only extensions in the generated symbolic
365 debugging information. */
366 /* Currently, this only has an effect when write_symbols is set to
367 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
368 int use_gnu_debug_info_extensions = 0;
370 /* Nonzero means do optimizations. -O.
371 Particular numeric values stand for particular amounts of optimization;
372 thus, -O2 stores 2 here. However, the optimizations beyond the basic
373 ones are not controlled directly by this variable. Instead, they are
374 controlled by individual `flag_...' variables that are defaulted
375 based on this variable. */
379 /* Nonzero means optimize for size. -Os.
380 The only valid values are zero and non-zero. When optimize_size is
381 non-zero, optimize defaults to 2, but certain individual code
382 bloating optimizations are disabled. */
384 int optimize_size = 0;
386 /* Number of error messages and warning messages so far. */
389 int warningcount = 0;
392 /* The FUNCTION_DECL for the function currently being compiled,
393 or 0 if between functions. */
394 tree current_function_decl;
396 /* Set to the FUNC_BEGIN label of the current function, or NULL_TREE
398 tree current_function_func_begin_label;
400 /* Pointer to function to compute the name to use to print a declaration.
401 DECL is the declaration in question.
402 VERBOSITY determines what information will be printed:
403 0: DECL_NAME, demangled as necessary.
404 1: and scope information.
405 2: and any other information that might be interesting, such as function
406 parameter types in C++. */
408 const char *(*decl_printable_name) PARAMS ((tree, int));
410 /* Pointer to function to compute rtl for a language-specific tree code. */
412 typedef rtx (*lang_expand_expr_t)
413 PARAMS ((union tree_node *, rtx, enum machine_mode,
414 enum expand_modifier modifier));
416 lang_expand_expr_t lang_expand_expr = 0;
418 tree (*lang_expand_constant) PARAMS ((tree)) = 0;
420 /* Pointer to function to finish handling an incomplete decl at the
421 end of compilation. */
423 void (*incomplete_decl_finalize_hook) PARAMS ((tree)) = 0;
425 /* Nonzero if doing dwarf2 duplicate elimination. */
427 int flag_eliminate_dwarf2_dups = 0;
429 /* Nonzero if generating code to do profiling. */
431 int profile_flag = 0;
433 /* Nonzero if generating code to do profiling on a line-by-line basis. */
435 int profile_block_flag;
437 /* Nonzero if generating code to profile program flow graph arcs. */
439 int profile_arc_flag = 0;
441 /* Nonzero if generating info for gcov to calculate line test coverage. */
443 int flag_test_coverage = 0;
445 /* Nonzero indicates that branch taken probabilities should be calculated. */
447 int flag_branch_probabilities = 0;
449 /* Nonzero if basic blocks should be reordered. */
451 int flag_reorder_blocks = 0;
453 /* Nonzero if registers should be renamed. */
455 int flag_rename_registers = 0;
457 /* Nonzero for -pedantic switch: warn about anything
458 that standard spec forbids. */
462 /* Temporarily suppress certain warnings.
463 This is set while reading code from a system header file. */
465 int in_system_header = 0;
467 /* Don't print functions as they are compiled. -quiet. */
471 /* Print times taken by the various passes. -ftime-report. */
475 /* Print memory still in use at end of compilation (which may have little
476 to do with peak memory consumption). -fmem-report. */
483 /* Nonzero means `char' should be signed. */
485 int flag_signed_char;
487 /* Nonzero means give an enum type only as many bytes as it needs. */
489 int flag_short_enums;
491 /* Nonzero for -fcaller-saves: allocate values in regs that need to
492 be saved across function calls, if that produces overall better code.
493 Optional now, so people can test it. */
495 #ifdef DEFAULT_CALLER_SAVES
496 int flag_caller_saves = 1;
498 int flag_caller_saves = 0;
501 /* Nonzero if structures and unions should be returned in memory.
503 This should only be defined if compatibility with another compiler or
504 with an ABI is needed, because it results in slower code. */
506 #ifndef DEFAULT_PCC_STRUCT_RETURN
507 #define DEFAULT_PCC_STRUCT_RETURN 1
510 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
512 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
514 /* Nonzero for -fforce-mem: load memory value into a register
515 before arithmetic on it. This makes better cse but slower compilation. */
517 int flag_force_mem = 0;
519 /* Nonzero for -fforce-addr: load memory address into a register before
520 reference to memory. This makes better cse but slower compilation. */
522 int flag_force_addr = 0;
524 /* Nonzero for -fdefer-pop: don't pop args after each function call;
525 instead save them up to pop many calls' args with one insns. */
527 int flag_defer_pop = 0;
529 /* Nonzero for -ffloat-store: don't allocate floats and doubles
530 in extended-precision registers. */
532 int flag_float_store = 0;
534 /* Nonzero for -fcse-follow-jumps:
535 have cse follow jumps to do a more extensive job. */
537 int flag_cse_follow_jumps;
539 /* Nonzero for -fcse-skip-blocks:
540 have cse follow a branch around a block. */
541 int flag_cse_skip_blocks;
543 /* Nonzero for -fexpensive-optimizations:
544 perform miscellaneous relatively-expensive optimizations. */
545 int flag_expensive_optimizations;
547 /* Nonzero for -fthread-jumps:
548 have jump optimize output of loop. */
550 int flag_thread_jumps;
552 /* Nonzero enables strength-reduction in loop.c. */
554 int flag_strength_reduce = 0;
556 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
557 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
558 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
561 int flag_unroll_loops;
563 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
564 This is generally not a win. */
566 int flag_unroll_all_loops;
568 /* Nonzero forces all invariant computations in loops to be moved
571 int flag_move_all_movables = 0;
573 /* Nonzero forces all general induction variables in loops to be
576 int flag_reduce_all_givs = 0;
578 /* Nonzero to perform full register move optimization passes. This is the
581 int flag_regmove = 0;
583 /* Nonzero for -fwritable-strings:
584 store string constants in data segment and don't uniquize them. */
586 int flag_writable_strings = 0;
588 /* Nonzero means don't put addresses of constant functions in registers.
589 Used for compiling the Unix kernel, where strange substitutions are
590 done on the assembly output. */
592 int flag_no_function_cse = 0;
594 /* Nonzero for -fomit-frame-pointer:
595 don't make a frame pointer in simple functions that don't require one. */
597 int flag_omit_frame_pointer = 0;
599 /* Nonzero means place each function into its own section on those platforms
600 which support arbitrary section names and unlimited numbers of sections. */
602 int flag_function_sections = 0;
604 /* ... and similar for data. */
606 int flag_data_sections = 0;
608 /* Nonzero to inhibit use of define_optimization peephole opts. */
610 int flag_no_peephole = 0;
612 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
613 operations in the interest of optimization. For example it allows
614 GCC to assume arguments to sqrt are nonnegative numbers, allowing
615 faster code for sqrt to be generated. */
617 int flag_fast_math = 0;
619 /* Nonzero allows GCC to optimize sibling and tail recursive calls. */
621 int flag_optimize_sibling_calls = 0;
623 /* Nonzero means the front end generally wants `errno' maintained by math
624 operations, like built-in SQRT, unless overridden by flag_fast_math. */
626 int flag_errno_math = 1;
628 /* 0 means straightforward implementation of complex divide acceptable.
629 1 means wide ranges of inputs must work for complex divide.
630 2 means C9X-like requirements for complex divide (not yet implemented). */
632 int flag_complex_divide_method = 0;
634 /* Nonzero means all references through pointers are volatile. */
638 /* Nonzero means treat all global and extern variables as volatile. */
640 int flag_volatile_global;
642 /* Nonzero means treat all static variables as volatile. */
644 int flag_volatile_static;
646 /* Nonzero means just do syntax checking; don't output anything. */
648 int flag_syntax_only = 0;
650 /* Nonzero means perform global cse. */
652 static int flag_gcse;
654 /* Nonzero means to use global dataflow analysis to eliminate
655 useless null pointer tests. */
657 static int flag_delete_null_pointer_checks;
659 /* Nonzero means to rerun cse after loop optimization. This increases
660 compilation time about 20% and picks up a few more common expressions. */
662 static int flag_rerun_cse_after_loop;
664 /* Nonzero means to run loop optimizations twice. */
666 int flag_rerun_loop_opt;
668 /* Nonzero for -finline-functions: ok to inline functions that look like
669 good inline candidates. */
671 int flag_inline_functions;
673 /* Nonzero for -fkeep-inline-functions: even if we make a function
674 go inline everywhere, keep its definition around for debugging
677 int flag_keep_inline_functions;
679 /* Nonzero means that functions will not be inlined. */
683 /* Nonzero means that we should emit static const variables
684 regardless of whether or not optimization is turned on. */
686 int flag_keep_static_consts = 1;
688 /* Nonzero means we should be saving declaration info into a .X file. */
690 int flag_gen_aux_info = 0;
692 /* Specified name of aux-info file. */
694 static char *aux_info_file_name;
696 /* Nonzero means make the text shared if supported. */
698 int flag_shared_data;
700 /* Nonzero means schedule into delayed branch slots if supported. */
702 int flag_delayed_branch;
704 /* Nonzero if we are compiling pure (sharable) code.
705 Value is 1 if we are doing reasonable (i.e. simple
706 offset into offset table) pic. Value is 2 if we can
707 only perform register offsets. */
711 /* Nonzero means generate extra code for exception handling and enable
712 exception handling. */
716 /* Nonzero means use the new model for exception handling. Replaces
717 -DNEW_EH_MODEL as a compile option. */
719 int flag_new_exceptions = 1;
721 /* Nonzero means generate frame unwind info table when supported. */
723 int flag_unwind_tables = 0;
725 /* Nonzero means don't place uninitialized global data in common storage
730 /* Nonzero means pretend it is OK to examine bits of target floats,
731 even if that isn't true. The resulting code will have incorrect constants,
732 but the same series of instructions that the native compiler would make. */
734 int flag_pretend_float;
736 /* Nonzero means change certain warnings into errors.
737 Usually these are warnings about failure to conform to some standard. */
739 int flag_pedantic_errors = 0;
741 /* flag_schedule_insns means schedule insns within basic blocks (before
743 flag_schedule_insns_after_reload means schedule insns after
746 int flag_schedule_insns = 0;
747 int flag_schedule_insns_after_reload = 0;
749 /* The following flags have effect only for scheduling before register
752 flag_schedule_interblock means schedule insns accross basic blocks.
753 flag_schedule_speculative means allow speculative motion of non-load insns.
754 flag_schedule_speculative_load means allow speculative motion of some
756 flag_schedule_speculative_load_dangerous allows speculative motion of more
759 int flag_schedule_interblock = 1;
760 int flag_schedule_speculative = 1;
761 int flag_schedule_speculative_load = 0;
762 int flag_schedule_speculative_load_dangerous = 0;
764 int flag_single_precision_constant;
766 /* flag_branch_on_count_reg means try to replace add-1,compare,branch tupple
767 by a cheaper branch on a count register. */
768 int flag_branch_on_count_reg = 1;
770 /* -finhibit-size-directive inhibits output of .size for ELF.
771 This is used only for compiling crtstuff.c,
772 and it may be extended to other effects
773 needed for crtstuff.c on other systems. */
774 int flag_inhibit_size_directive = 0;
776 /* -fverbose-asm causes extra commentary information to be produced in
777 the generated assembly code (to make it more readable). This option
778 is generally only of use to those who actually need to read the
779 generated assembly code (perhaps while debugging the compiler itself).
780 -fno-verbose-asm, the default, causes the extra information
781 to be omitted and is useful when comparing two assembler files. */
783 int flag_verbose_asm = 0;
785 /* -dA causes debug commentary information to be produced in
786 the generated assembly code (to make it more readable). This option
787 is generally only of use to those who actually need to read the
788 generated assembly code (perhaps while debugging the compiler itself).
789 Currently, this switch is only used by dwarfout.c; however, it is intended
790 to be a catchall for printing debug information in the assembler file. */
792 int flag_debug_asm = 0;
794 /* -fgnu-linker specifies use of the GNU linker for initializations.
795 (Or, more generally, a linker that handles initializations.)
796 -fno-gnu-linker says that collect2 will be used. */
798 int flag_gnu_linker = 0;
800 int flag_gnu_linker = 1;
806 /* Enable dead code elimination. */
809 /* Tag all structures with __attribute__(packed). */
810 int flag_pack_struct = 0;
812 /* Emit code to check for stack overflow; also may cause large objects
813 to be allocated dynamically. */
814 int flag_stack_check;
816 /* When non-NULL, indicates that whenever space is allocated on the
817 stack, the resulting stack pointer must not pass this
818 address---that is, for stacks that grow downward, the stack pointer
819 must always be greater than or equal to this address; for stacks
820 that grow upward, the stack pointer must be less than this address.
821 At present, the rtx may be either a REG or a SYMBOL_REF, although
822 the support provided depends on the backend. */
825 /* -fcheck-memory-usage causes extra code to be generated in order to check
826 memory accesses. This is used by a detector of bad memory accesses such
828 int flag_check_memory_usage = 0;
830 /* -fprefix-function-name causes function name to be prefixed. This
831 can be used with -fcheck-memory-usage to isolate code compiled with
832 -fcheck-memory-usage. */
833 int flag_prefix_function_name = 0;
835 /* 0 if pointer arguments may alias each other. True in C.
836 1 if pointer arguments may not alias each other but may alias
838 2 if pointer arguments may not alias each other and may not
839 alias global variables. True in Fortran.
840 This defaults to 0 for C. */
841 int flag_argument_noalias = 0;
843 /* Nonzero if we should do (language-dependent) alias analysis.
844 Typically, this analysis will assume that expressions of certain
845 types do not alias expressions of certain other types. Only used
846 if alias analysis (in general) is enabled. */
847 int flag_strict_aliasing = 0;
849 /* Instrument functions with calls at entry and exit, for profiling. */
850 int flag_instrument_function_entry_exit = 0;
852 /* Nonzero means ignore `#ident' directives. 0 means handle them.
853 On SVR4 targets, it also controls whether or not to emit a
854 string identifying the compiler. */
856 int flag_no_ident = 0;
858 /* This will perform a peephole pass before sched2. */
859 int flag_peephole2 = 0;
861 /* -fbounded-pointers causes gcc to compile pointers as composite
862 objects occupying three words: the pointer value, the base address
863 of the referent object, and the address immediately beyond the end
864 of the referent object. The base and extent allow us to perform
865 runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
866 int flag_bounded_pointers = 0;
868 /* -fcheck-bounds causes gcc to generate array bounds checks.
869 For C, C++: defaults to value of flag_bounded_pointers.
870 For ObjC: defaults to off.
871 For Java: defaults to on.
872 For Fortran: defaults to off.
873 For CHILL: defaults to off. */
874 int flag_bounds_check = 0;
876 /* If one, renumber instruction UIDs to reduce the number of
877 unused UIDs if there are a lot of instructions. If greater than
878 one, unconditionally renumber instruction UIDs. */
879 int flag_renumber_insns = 1;
881 /* Values of the -falign-* flags: how much to align labels in code.
882 0 means `use default', 1 means `don't align'.
883 For each variable, there is an _log variant which is the power
884 of two not less than the variable, for .align output. */
891 int align_labels_log;
893 int align_functions_log;
895 /* Table of supported debugging formats. */
899 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
900 constant expression, we use NO_DEBUG in its place. */
901 enum debug_info_type debug_type;
902 int use_extensions_p;
903 const char *description;
907 { "", NO_DEBUG, DEFAULT_GDB_EXTENSIONS,
908 "Generate default debug format output" },
909 { "gdb", NO_DEBUG, 1, "Generate default extended debug format output" },
910 #ifdef DBX_DEBUGGING_INFO
911 { "stabs", DBX_DEBUG, 0, "Generate STABS format debug output" },
912 { "stabs+", DBX_DEBUG, 1, "Generate extended STABS format debug output" },
914 #ifdef DWARF_DEBUGGING_INFO
915 { "dwarf", DWARF_DEBUG, 0, "Generate DWARF-1 format debug output"},
916 { "dwarf+", DWARF_DEBUG, 1,
917 "Generated extended DWARF-1 format debug output" },
919 #ifdef DWARF2_DEBUGGING_INFO
920 { "dwarf-2", DWARF2_DEBUG, 0, "Enable DWARF-2 debug output" },
922 #ifdef XCOFF_DEBUGGING_INFO
923 { "xcoff", XCOFF_DEBUG, 0, "Generate XCOFF format debug output" },
924 { "xcoff+", XCOFF_DEBUG, 1, "Generate extended XCOFF format debug output" },
926 #ifdef SDB_DEBUGGING_INFO
927 { "coff", SDB_DEBUG, 0, "Generate COFF format debug output" },
937 const char *description;
939 lang_independent_options;
941 /* Add or remove a leading underscore from user symbols. */
942 int flag_leading_underscore = -1;
944 /* The user symbol prefix after having resolved same. */
945 const char *user_label_prefix;
947 /* A default for same. */
948 #ifndef USER_LABEL_PREFIX
949 #define USER_LABEL_PREFIX ""
952 /* Table of language-independent -f options.
953 STRING is the option name. VARIABLE is the address of the variable.
954 ON_VALUE is the value to store in VARIABLE
955 if `-fSTRING' is seen as an option.
956 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
958 lang_independent_options f_options[] =
960 {"eliminate-dwarf2-dups", &flag_eliminate_dwarf2_dups, 1,
961 "Perform DWARF2 duplicate elimination"},
962 {"float-store", &flag_float_store, 1,
963 "Do not store floats in registers" },
964 {"volatile", &flag_volatile, 1,
965 "Consider all mem refs through pointers as volatile"},
966 {"volatile-global", &flag_volatile_global, 1,
967 "Consider all mem refs to global data to be volatile" },
968 {"volatile-static", &flag_volatile_static, 1,
969 "Consider all mem refs to static data to be volatile" },
970 {"defer-pop", &flag_defer_pop, 1,
971 "Defer popping functions args from stack until later" },
972 {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
973 "When possible do not generate stack frames"},
974 {"optimize-sibling-calls", &flag_optimize_sibling_calls, 1,
975 "Optimize sibling and tail recursive calls" },
976 {"cse-follow-jumps", &flag_cse_follow_jumps, 1,
977 "When running CSE, follow jumps to their targets" },
978 {"cse-skip-blocks", &flag_cse_skip_blocks, 1,
979 "When running CSE, follow conditional jumps" },
980 {"expensive-optimizations", &flag_expensive_optimizations, 1,
981 "Perform a number of minor, expensive optimisations" },
982 {"thread-jumps", &flag_thread_jumps, 1,
983 "Perform jump threading optimisations"},
984 {"strength-reduce", &flag_strength_reduce, 1,
985 "Perform strength reduction optimisations" },
986 {"unroll-loops", &flag_unroll_loops, 1,
987 "Perform loop unrolling when iteration count is known" },
988 {"unroll-all-loops", &flag_unroll_all_loops, 1,
989 "Perform loop unrolling for all loops" },
990 {"move-all-movables", &flag_move_all_movables, 1,
991 "Force all loop invariant computations out of loops" },
992 {"reduce-all-givs", &flag_reduce_all_givs, 1,
993 "Strength reduce all loop general induction variables" },
994 {"writable-strings", &flag_writable_strings, 1,
995 "Store strings in writable data section" },
996 {"peephole", &flag_no_peephole, 0,
997 "Enable machine specific peephole optimisations" },
998 {"force-mem", &flag_force_mem, 1,
999 "Copy memory operands into registers before using" },
1000 {"force-addr", &flag_force_addr, 1,
1001 "Copy memory address constants into regs before using" },
1002 {"function-cse", &flag_no_function_cse, 0,
1003 "Allow function addresses to be held in registers" },
1004 {"inline-functions", &flag_inline_functions, 1,
1005 "Integrate simple functions into their callers" },
1006 {"keep-inline-functions", &flag_keep_inline_functions, 1,
1007 "Generate code for funcs even if they are fully inlined" },
1008 {"inline", &flag_no_inline, 0,
1009 "Pay attention to the 'inline' keyword"},
1010 {"keep-static-consts", &flag_keep_static_consts, 1,
1011 "Emit static const variables even if they are not used" },
1012 {"syntax-only", &flag_syntax_only, 1,
1013 "Check for syntax errors, then stop" },
1014 {"shared-data", &flag_shared_data, 1,
1015 "Mark data as shared rather than private" },
1016 {"caller-saves", &flag_caller_saves, 1,
1017 "Enable saving registers around function calls" },
1018 {"pcc-struct-return", &flag_pcc_struct_return, 1,
1019 "Return 'short' aggregates in memory, not registers" },
1020 {"reg-struct-return", &flag_pcc_struct_return, 0,
1021 "Return 'short' aggregates in registers" },
1022 {"delayed-branch", &flag_delayed_branch, 1,
1023 "Attempt to fill delay slots of branch instructions" },
1024 {"gcse", &flag_gcse, 1,
1025 "Perform the global common subexpression elimination" },
1026 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
1027 "Run CSE pass after loop optimisations"},
1028 {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
1029 "Run the loop optimiser twice"},
1030 {"delete-null-pointer-checks", &flag_delete_null_pointer_checks, 1,
1031 "Delete useless null pointer checks" },
1032 {"pretend-float", &flag_pretend_float, 1,
1033 "Pretend that host and target use the same FP format"},
1034 {"schedule-insns", &flag_schedule_insns, 1,
1035 "Reschedule instructions to avoid pipeline stalls"},
1036 {"schedule-insns2", &flag_schedule_insns_after_reload, 1,
1037 "Run two passes of the instruction scheduler"},
1038 {"sched-interblock",&flag_schedule_interblock, 1,
1039 "Enable scheduling across basic blocks" },
1040 {"sched-spec",&flag_schedule_speculative, 1,
1041 "Allow speculative motion of non-loads" },
1042 {"sched-spec-load",&flag_schedule_speculative_load, 1,
1043 "Allow speculative motion of some loads" },
1044 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
1045 "Allow speculative motion of more loads" },
1046 {"branch-count-reg",&flag_branch_on_count_reg, 1,
1047 "Replace add,compare,branch with branch on count reg"},
1048 {"pic", &flag_pic, 1,
1049 "Generate position independent code, if possible"},
1050 {"PIC", &flag_pic, 2, ""},
1051 {"exceptions", &flag_exceptions, 1,
1052 "Enable exception handling" },
1053 {"new-exceptions", &flag_new_exceptions, 1,
1054 "Use the new model for exception handling" },
1055 {"unwind-tables", &flag_unwind_tables, 1,
1056 "Just generate unwind tables for exception handling" },
1057 {"sjlj-exceptions", &exceptions_via_longjmp, 1,
1058 "Use setjmp/longjmp to handle exceptions" },
1059 {"asynchronous-exceptions", &asynchronous_exceptions, 1,
1060 "Support asynchronous exceptions" },
1061 {"profile-arcs", &profile_arc_flag, 1,
1062 "Insert arc based program profiling code" },
1063 {"test-coverage", &flag_test_coverage, 1,
1064 "Create data files needed by gcov" },
1065 {"branch-probabilities", &flag_branch_probabilities, 1,
1066 "Use profiling information for branch probabilities" },
1067 {"reorder-blocks", &flag_reorder_blocks, 1,
1068 "Reorder basic blocks to improve code placement" },
1069 {"rename-registers", &flag_rename_registers, 1,
1070 "Do the register renaming optimization pass"},
1071 {"fast-math", &flag_fast_math, 1,
1072 "Improve FP speed by violating ANSI & IEEE rules" },
1073 {"common", &flag_no_common, 0,
1074 "Do not put unitialised globals in the common section" },
1075 {"inhibit-size-directive", &flag_inhibit_size_directive, 1,
1076 "Do not generate .size directives" },
1077 {"function-sections", &flag_function_sections, 1,
1078 "place each function into its own section" },
1079 {"data-sections", &flag_data_sections, 1,
1080 "place data items into their own section" },
1081 {"verbose-asm", &flag_verbose_asm, 1,
1082 "Add extra commentry to assembler output"},
1083 {"gnu-linker", &flag_gnu_linker, 1,
1084 "Output GNU ld formatted global initialisers"},
1085 {"regmove", &flag_regmove, 1,
1086 "Enables a register move optimisation"},
1087 {"optimize-register-move", &flag_regmove, 1,
1088 "Do the full regmove optimization pass"},
1089 {"pack-struct", &flag_pack_struct, 1,
1090 "Pack structure members together without holes" },
1091 {"stack-check", &flag_stack_check, 1,
1092 "Insert stack checking code into the program" },
1093 {"argument-alias", &flag_argument_noalias, 0,
1094 "Specify that arguments may alias each other & globals"},
1095 {"argument-noalias", &flag_argument_noalias, 1,
1096 "Assume arguments may alias globals but not each other"},
1097 {"argument-noalias-global", &flag_argument_noalias, 2,
1098 "Assume arguments do not alias each other or globals" },
1099 {"strict-aliasing", &flag_strict_aliasing, 1,
1100 "Assume strict aliasing rules apply" },
1101 {"align-loops", &align_loops, 0,
1102 "Align the start of loops" },
1103 {"align-jumps", &align_jumps, 0,
1104 "Align labels which are only reached by jumping" },
1105 {"align-labels", &align_labels, 0,
1106 "Align all labels" },
1107 {"align-functions", &align_functions, 0,
1108 "Align the start of functions" },
1109 {"check-memory-usage", &flag_check_memory_usage, 1,
1110 "Generate code to check every memory access" },
1111 {"prefix-function-name", &flag_prefix_function_name, 1,
1112 "Add a prefix to all function names" },
1113 {"dump-unnumbered", &flag_dump_unnumbered, 1,
1114 "Suppress output of instruction numbers and line number notes in debugging dumps"},
1115 {"instrument-functions", &flag_instrument_function_entry_exit, 1,
1116 "Instrument function entry/exit with profiling calls"},
1117 {"ssa", &flag_ssa, 1,
1118 "Enable SSA optimizations" },
1119 {"dce", &flag_dce, 1,
1120 "Enable dead code elimination" },
1121 {"leading-underscore", &flag_leading_underscore, 1,
1122 "External symbols have a leading underscore" },
1123 {"ident", &flag_no_ident, 0,
1124 "Process #ident directives"},
1125 { "peephole2", &flag_peephole2, 1,
1126 "Enables an rtl peephole pass run before sched2" },
1127 {"math-errno", &flag_errno_math, 1,
1128 "Set errno after built-in math functions"},
1129 {"bounded-pointers", &flag_bounded_pointers, 1,
1130 "Compile pointers as triples: value, base & end" },
1131 {"bounds-check", &flag_bounds_check, 1,
1132 "Generate code to check bounds before dereferencing pointers and arrays" },
1133 {"single-precision-constant", &flag_single_precision_constant, 1,
1134 "Convert floating point constant to single precision constant"},
1135 {"time-report", &time_report, 1,
1136 "Report time taken by each compiler pass at end of run"},
1137 {"mem-report", &mem_report, 1,
1138 "Report on permanent memory allocation at end of run"},
1141 /* Table of language-specific options. */
1143 static struct lang_opt
1146 const char *description;
1148 documented_lang_options[] =
1150 /* In order not to overload the --help output, the convention
1151 used here is to only describe those options which are not
1152 enabled by default. */
1154 { "-ansi", "Compile just for ISO C89" },
1155 { "-fallow-single-precision",
1156 "Do not promote floats to double if using -traditional" },
1157 { "-std= ", "Determine language standard"},
1159 { "-fsigned-bitfields", "" },
1160 { "-funsigned-bitfields","Make bitfields by unsigned by default" },
1161 { "-fno-signed-bitfields", "" },
1162 { "-fno-unsigned-bitfields","" },
1163 { "-fsigned-char", "Make 'char' be signed by default"},
1164 { "-funsigned-char", "Make 'char' be unsigned by default"},
1165 { "-fno-signed-char", "" },
1166 { "-fno-unsigned-char", "" },
1168 { "-ftraditional", "" },
1169 { "-traditional", "Attempt to support traditional K&R style C"},
1170 { "-fnotraditional", "" },
1171 { "-fno-traditional", "" },
1174 { "-fno-asm", "Do not recognise the 'asm' keyword" },
1175 { "-fbuiltin", "" },
1176 { "-fno-builtin", "Do not recognise any built in functions" },
1177 { "-fhosted", "Assume normal C execution environment" },
1178 { "-fno-hosted", "" },
1180 "Assume that standard libraries & main might not exist" },
1181 { "-fno-freestanding", "" },
1182 { "-fcond-mismatch", "Allow different types as args of ? operator"},
1183 { "-fno-cond-mismatch", "" },
1184 { "-fdollars-in-identifiers", "Allow the use of $ inside identifiers" },
1185 { "-fno-dollars-in-identifiers", "" },
1186 { "-fpreprocessed", "" },
1187 { "-fno-preprocessed", "" },
1188 { "-fshort-double", "Use the same size for double as for float" },
1189 { "-fno-short-double", "" },
1190 { "-fshort-enums", "Use the smallest fitting integer to hold enums"},
1191 { "-fno-short-enums", "" },
1192 { "-fshort-wchar", "Override the underlying type for wchar_t to `unsigned short'" },
1193 { "-fno-short-wchar", "" },
1195 { "-Wall", "Enable most warning messages" },
1196 { "-Wbad-function-cast",
1197 "Warn about casting functions to incompatible types" },
1198 { "-Wno-bad-function-cast", "" },
1199 { "-Wmissing-noreturn",
1200 "Warn about functions which might be candidates for attribute noreturn" },
1201 { "-Wno-missing-noreturn", "" },
1202 { "-Wcast-qual", "Warn about casts which discard qualifiers"},
1203 { "-Wno-cast-qual", "" },
1204 { "-Wchar-subscripts", "Warn about subscripts whose type is 'char'"},
1205 { "-Wno-char-subscripts", "" },
1206 { "-Wcomment", "Warn if nested comments are detected" },
1207 { "-Wno-comment", "" },
1208 { "-Wcomments", "Warn if nested comments are detected" },
1209 { "-Wno-comments", "" },
1210 { "-Wconversion", "Warn about possibly confusing type conversions" },
1211 { "-Wno-conversion", "" },
1212 { "-Wformat", "Warn about printf format anomalies" },
1213 { "-Wno-format", "" },
1214 { "-Wimplicit-function-declaration",
1215 "Warn about implicit function declarations" },
1216 { "-Wno-implicit-function-declaration", "" },
1217 { "-Werror-implicit-function-declaration", "" },
1218 { "-Wimplicit-int", "Warn when a declaration does not specify a type" },
1219 { "-Wno-implicit-int", "" },
1220 { "-Wimplicit", "" },
1221 { "-Wno-implicit", "" },
1222 { "-Wimport", "Warn about the use of the #import directive" },
1223 { "-Wno-import", "" },
1224 { "-Wlong-long","" },
1225 { "-Wno-long-long", "Do not warn about using 'long long' when -pedantic" },
1226 { "-Wmain", "Warn about suspicious declarations of main" },
1227 { "-Wno-main", "" },
1228 { "-Wmissing-braces",
1229 "Warn about possibly missing braces around initialisers" },
1230 { "-Wno-missing-braces", "" },
1231 { "-Wmissing-declarations",
1232 "Warn about global funcs without previous declarations"},
1233 { "-Wno-missing-declarations", "" },
1234 { "-Wmissing-prototypes", "Warn about global funcs without prototypes" },
1235 { "-Wno-missing-prototypes", "" },
1236 { "-Wmultichar", "Warn about use of multicharacter literals"},
1237 { "-Wno-multichar", "" },
1238 { "-Wnested-externs", "Warn about externs not at file scope level" },
1239 { "-Wno-nested-externs", "" },
1240 { "-Wparentheses", "Warn about possible missing parentheses" },
1241 { "-Wno-parentheses", "" },
1242 { "-Wpointer-arith", "Warn about function pointer arithmetic" },
1243 { "-Wno-pointer-arith", "" },
1244 { "-Wredundant-decls",
1245 "Warn about multiple declarations of the same object" },
1246 { "-Wno-redundant-decls", "" },
1247 { "-Wsign-compare", "Warn about signed/unsigned comparisons" },
1248 { "-Wno-sign-compare", "" },
1249 { "-Wfloat-equal", "Warn about testing equality of floating point numbers" },
1250 { "-Wno-float-equal", "" },
1251 { "-Wunknown-pragmas", "Warn about unrecognized pragmas" },
1252 { "-Wno-unknown-pragmas", "" },
1253 { "-Wstrict-prototypes", "Warn about non-prototyped function decls" },
1254 { "-Wno-strict-prototypes", "" },
1255 { "-Wtraditional", "Warn about constructs whose meaning change in ISO C"},
1256 { "-Wno-traditional", "" },
1257 { "-Wtrigraphs", "Warn when trigraphs are encountered" },
1258 { "-Wno-trigraphs", "" },
1260 { "-Wno-undef", "" },
1261 { "-Wwrite-strings", "Mark strings as 'const char *'"},
1262 { "-Wno-write-strings", "" },
1264 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1266 #include "options.h"
1270 /* Here is a table, controlled by the tm.h file, listing each -m switch
1271 and which bits in `target_switches' it should set or clear.
1272 If VALUE is positive, it is bits to set.
1273 If VALUE is negative, -VALUE is bits to clear.
1274 (The sign bit is not used so there is no confusion.) */
1280 const char *description;
1282 target_switches [] = TARGET_SWITCHES;
1284 /* This table is similar, but allows the switch to have a value. */
1286 #ifdef TARGET_OPTIONS
1290 const char **variable;
1291 const char *description;
1293 target_options [] = TARGET_OPTIONS;
1296 /* Options controlling warnings. */
1298 /* Don't print warning messages. -w. */
1300 int inhibit_warnings = 0;
1302 /* Print various extra warnings. -W. */
1304 int extra_warnings = 0;
1306 /* Treat warnings as errors. -Werror. */
1308 int warnings_are_errors = 0;
1310 /* Nonzero to warn about unused variables, functions et.al. */
1312 int warn_unused_function;
1313 int warn_unused_label;
1314 int warn_unused_parameter;
1315 int warn_unused_variable;
1316 int warn_unused_value;
1319 set_Wunused (setting)
1322 warn_unused_function = setting;
1323 warn_unused_label = setting;
1324 /* Unused function parameter warnings are reported when either ``-W
1325 -Wunused'' or ``-Wunused-parameter'' is specified. Differentiate
1326 -Wunused by setting WARN_UNUSED_PARAMETER to -1. */
1328 warn_unused_parameter = 0;
1329 else if (!warn_unused_parameter)
1330 warn_unused_parameter = -1;
1331 warn_unused_variable = setting;
1332 warn_unused_value = setting;
1335 /* Nonzero to warn about code which is never reached. */
1337 int warn_notreached;
1339 /* Nonzero to warn about variables used before they are initialized. */
1341 int warn_uninitialized;
1343 /* Nonzero means warn about all declarations which shadow others. */
1347 /* Warn if a switch on an enum fails to have a case for every enum value. */
1351 /* Nonzero means warn about function definitions that default the return type
1352 or that use a null return and have a return-type other than void. */
1354 int warn_return_type;
1356 /* Nonzero means warn about pointer casts that increase the required
1357 alignment of the target type (and might therefore lead to a crash
1358 due to a misaligned access). */
1360 int warn_cast_align;
1362 /* Nonzero means warn about any identifiers that match in the first N
1363 characters. The value N is in `id_clash_len'. */
1368 /* Nonzero means warn about any objects definitions whose size is larger
1369 than N bytes. Also want about function definitions whose returned
1370 values are larger than N bytes. The value N is in `larger_than_size'. */
1372 int warn_larger_than;
1373 HOST_WIDE_INT larger_than_size;
1375 /* Nonzero means warn if inline function is too large. */
1379 /* Warn if a function returns an aggregate,
1380 since there are often incompatible calling conventions for doing this. */
1382 int warn_aggregate_return;
1384 /* Warn if packed attribute on struct is unnecessary and inefficient. */
1388 /* Warn when gcc pads a structure to an alignment boundary. */
1392 /* Likewise for -W. */
1394 lang_independent_options W_options[] =
1396 {"unused-function", &warn_unused_function, 1, "Warn when a function is unused" },
1397 {"unused-label", &warn_unused_label, 1, "Warn when a label is unused" },
1398 {"unused-parameter", &warn_unused_parameter, 1, "Warn when a function parameter is unused" },
1399 {"unused-variable", &warn_unused_variable, 1, "Warn when a variable is unused" },
1400 {"unused-value", &warn_unused_value, 1, "Warn when an expression value is unused" },
1401 {"error", &warnings_are_errors, 1, ""},
1402 {"shadow", &warn_shadow, 1, "Warn when one local variable shadows another" },
1403 {"switch", &warn_switch, 1,
1404 "Warn about enumerated switches missing a specific case" },
1405 {"aggregate-return", &warn_aggregate_return, 1,
1406 "Warn about returning structures, unions or arrays" },
1407 {"cast-align", &warn_cast_align, 1,
1408 "Warn about pointer casts which increase alignment" },
1409 {"unreachable-code", &warn_notreached, 1,
1410 "Warn about code that will never be executed" },
1411 {"uninitialized", &warn_uninitialized, 1,
1412 "Warn about unitialized automatic variables"},
1413 {"inline", &warn_inline, 1,
1414 "Warn when an inlined function cannot be inlined"},
1415 {"packed", &warn_packed, 1,
1416 "Warn when the packed attribute has no effect on struct layout"},
1417 {"padded", &warn_padded, 1,
1418 "Warn when padding is required to align struct members"}
1421 /* Output files for assembler code (real compiler output)
1422 and debugging dumps. */
1425 FILE *aux_info_file;
1426 FILE *rtl_dump_file = NULL;
1428 /* Decode the string P as an integral parameter.
1429 If the string is indeed an integer return its numeric value else
1430 issue an Invalid Option error for the option PNAME and return DEFVAL.
1431 If PNAME is zero just return DEFVAL, do not call error. */
1434 read_integral_parameter (p, pname, defval)
1439 const char *endp = p;
1443 if (*endp >= '0' && *endp <= '9')
1452 error ("Invalid option `%s'", pname);
1460 /* This is the default decl_printable_name function. */
1463 decl_name (decl, verbosity)
1465 int verbosity ATTRIBUTE_UNUSED;
1467 return IDENTIFIER_POINTER (DECL_NAME (decl));
1470 /* Mark P for GC. Also mark main_input_filename and input_filename. */
1476 struct file_stack *stack = *(struct file_stack **)p;
1478 /* We're only called for input_file_stack, so we can mark the current
1479 input_filename here as well. */
1480 ggc_mark_string (main_input_filename);
1481 ggc_mark_string (input_filename);
1485 ggc_mark_string (stack->name);
1486 stack = stack->next;
1491 /* This calls abort and is used to avoid problems when abort if a macro.
1492 It is used when we need to pass the address of abort. */
1500 /* When `malloc.c' is compiled with `rcheck' defined,
1501 it calls this function to report clobberage. */
1505 const char *s ATTRIBUTE_UNUSED;
1510 /* Return the logarithm of X, base 2, considering X unsigned,
1511 if X is a power of 2. Otherwise, returns -1.
1513 This should be used via the `exact_log2' macro. */
1517 register unsigned HOST_WIDE_INT x;
1519 register int log = 0;
1520 /* Test for 0 or a power of 2. */
1521 if (x == 0 || x != (x & -x))
1523 while ((x >>= 1) != 0)
1528 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1529 If X is 0, return -1.
1531 This should be used via the floor_log2 macro. */
1535 register unsigned HOST_WIDE_INT x;
1537 register int log = -1;
1544 static int float_handler_set;
1546 jmp_buf float_handler;
1548 /* Signals actually come here. */
1551 float_signal (signo)
1552 /* If this is missing, some compilers complain. */
1553 int signo ATTRIBUTE_UNUSED;
1555 if (float_handled == 0)
1556 crash_signal (signo);
1557 #if defined (USG) || defined (hpux)
1558 /* Re-enable the signal catcher. */
1559 signal (SIGFPE, float_signal);
1562 signal (SIGFPE, float_signal);
1563 longjmp (float_handler, 1);
1566 /* Specify where to longjmp to when a floating arithmetic error happens.
1567 If HANDLER is 0, it means don't handle the errors any more. */
1570 set_float_handler (handler)
1573 float_handled = (handler != 0);
1575 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1577 if (float_handled && ! float_handler_set)
1579 signal (SIGFPE, float_signal);
1580 float_handler_set = 1;
1584 /* This is a wrapper function for code which might elicit an
1585 arithmetic exception. That code should be passed in as a function
1586 pointer FN, and one argument DATA. DATA is usually a struct which
1587 contains the real input and output for function FN. This function
1588 returns 0 (failure) if longjmp was called (i.e. an exception
1589 occured.) It returns 1 (success) otherwise. */
1592 do_float_handler (fn, data)
1593 void (*fn) PARAMS ((PTR));
1600 /* We got here via longjmp () caused by an exception in function
1602 set_float_handler (NULL);
1606 set_float_handler (buf);
1608 set_float_handler (NULL);
1612 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1613 error happens, pushing the previous specification into OLD_HANDLER.
1614 Return an indication of whether there was a previous handler in effect. */
1617 push_float_handler (handler, old_handler)
1618 jmp_buf handler, old_handler;
1620 int was_handled = float_handled;
1624 memcpy ((char *) old_handler, (char *) float_handler,
1625 sizeof (float_handler));
1627 memcpy ((char *) float_handler, (char *) handler, sizeof (float_handler));
1631 /* Restore the previous specification of whether and where to longjmp to
1632 when a floating arithmetic error happens. */
1635 pop_float_handler (handled, handler)
1639 float_handled = handled;
1641 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1644 /* Handler for fatal signals, such as SIGSEGV. These are transformed
1645 into ICE messages, which is much more user friendly. */
1648 crash_signal (signo)
1649 /* If this is missing, some compilers complain. */
1652 fatal ("Internal error: %s.\n\
1653 Please submit a full bug report.\n\
1654 See %s for instructions.", strsignal (signo), GCCBUGURL);
1657 /* Strip off a legitimate source ending from the input string NAME of
1658 length LEN. Rather than having to know the names used by all of
1659 our front ends, we strip off an ending of a period followed by
1660 up to five characters. (Java uses ".class".) */
1663 strip_off_ending (name, len)
1668 for (i = 2; i < 6 && len > i; i++)
1670 if (name[len - i] == '.')
1672 name[len - i] = '\0';
1678 /* Given a file name X, return the nondirectory portion. */
1681 file_name_nondirectory (x)
1684 char *tmp = (char *) rindex (x, '/');
1685 if (DIR_SEPARATOR != '/' && ! tmp)
1686 tmp = (char *) rindex (x, DIR_SEPARATOR);
1688 return (char *) (tmp + 1);
1693 /* Output a quoted string. */
1696 output_quoted_string (asm_file, string)
1700 #ifdef OUTPUT_QUOTED_STRING
1701 OUTPUT_QUOTED_STRING (asm_file, string);
1705 putc ('\"', asm_file);
1706 while ((c = *string++) != 0)
1708 if (c == '\"' || c == '\\')
1709 putc ('\\', asm_file);
1712 putc ('\"', asm_file);
1716 /* Output a file name in the form wanted by System V. */
1719 output_file_directive (asm_file, input_name)
1721 const char *input_name;
1723 int len = strlen (input_name);
1724 const char *na = input_name + len;
1726 /* NA gets INPUT_NAME sans directory names. */
1727 while (na > input_name)
1729 if (IS_DIR_SEPARATOR (na[-1]))
1734 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1735 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1737 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1738 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1740 fprintf (asm_file, "\t.file\t");
1741 output_quoted_string (asm_file, na);
1742 fputc ('\n', asm_file);
1747 #ifdef ASM_IDENTIFY_LANGUAGE
1748 /* Routine to build language identifier for object file. */
1751 output_lang_identify (asm_out_file)
1754 int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1755 char *s = (char *) alloca (len);
1757 sprintf (s, "__gnu_compiled_%s", lang_identify ());
1758 ASM_OUTPUT_LABEL (asm_out_file, s);
1762 /* Routine to open a dump file. Return true if the dump file is enabled. */
1765 open_dump_file (index, decl)
1766 enum dump_file_index index;
1770 const char *open_arg;
1773 if (! dump_file[index].enabled)
1776 timevar_push (TV_DUMP);
1777 if (rtl_dump_file != NULL)
1778 fclose (rtl_dump_file);
1780 sprintf (seq, ".%02d.", index);
1782 if (! dump_file[index].initialized)
1784 /* If we've not initialized the files, do so now. */
1785 if (graph_dump_format != no_graph
1786 && dump_file[index].graph_dump_p)
1788 dump_name = concat (seq, dump_file[index].extension, NULL);
1789 clean_graph_dump_file (dump_base_name, dump_name);
1792 dump_file[index].initialized = 1;
1798 dump_name = concat (dump_base_name, seq,
1799 dump_file[index].extension, NULL);
1801 rtl_dump_file = fopen (dump_name, open_arg);
1802 if (rtl_dump_file == NULL)
1803 pfatal_with_name (dump_name);
1808 fprintf (rtl_dump_file, "\n;; Function %s\n\n",
1809 decl_printable_name (decl, 2));
1811 timevar_pop (TV_DUMP);
1815 /* Routine to close a dump file. */
1818 close_dump_file (index, func, insns)
1819 enum dump_file_index index;
1820 void (*func) PARAMS ((FILE *, rtx));
1823 if (! rtl_dump_file)
1826 timevar_push (TV_DUMP);
1828 && graph_dump_format != no_graph
1829 && dump_file[index].graph_dump_p)
1834 sprintf (seq, ".%02d.", index);
1835 suffix = concat (seq, dump_file[index].extension, NULL);
1836 print_rtl_graph_with_bb (dump_base_name, suffix, insns);
1841 func (rtl_dump_file, insns);
1843 fflush (rtl_dump_file);
1844 fclose (rtl_dump_file);
1846 rtl_dump_file = NULL;
1847 timevar_pop (TV_DUMP);
1850 /* Do any final processing required for the declarations in VEC, of
1851 which there are LEN. We write out inline functions and variables
1852 that have been deferred until this point, but which are required.
1853 Returns non-zero if anything was put out. */
1856 wrapup_global_declarations (vec, len)
1863 int output_something = 0;
1865 for (i = 0; i < len; i++)
1869 /* We're not deferring this any longer. */
1870 DECL_DEFER_OUTPUT (decl) = 0;
1872 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
1873 && incomplete_decl_finalize_hook != 0)
1874 (*incomplete_decl_finalize_hook) (decl);
1877 /* Now emit any global variables or functions that we have been
1878 putting off. We need to loop in case one of the things emitted
1879 here references another one which comes earlier in the list. */
1883 for (i = 0; i < len; i++)
1887 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
1890 /* Don't write out static consts, unless we still need them.
1892 We also keep static consts if not optimizing (for debugging),
1893 unless the user specified -fno-keep-static-consts.
1894 ??? They might be better written into the debug information.
1895 This is possible when using DWARF.
1897 A language processor that wants static constants to be always
1898 written out (even if it is not used) is responsible for
1899 calling rest_of_decl_compilation itself. E.g. the C front-end
1900 calls rest_of_decl_compilation from finish_decl.
1901 One motivation for this is that is conventional in some
1902 environments to write things like:
1903 static const char rcsid[] = "... version string ...";
1904 intending to force the string to be in the executable.
1906 A language processor that would prefer to have unneeded
1907 static constants "optimized away" would just defer writing
1908 them out until here. E.g. C++ does this, because static
1909 constants are often defined in header files.
1911 ??? A tempting alternative (for both C and C++) would be
1912 to force a constant to be written if and only if it is
1913 defined in a main file, as opposed to an include file. */
1915 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1916 && (! TREE_READONLY (decl)
1917 || TREE_PUBLIC (decl)
1918 || (!optimize && flag_keep_static_consts)
1919 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1922 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
1925 if (TREE_CODE (decl) == FUNCTION_DECL
1926 && DECL_INITIAL (decl) != 0
1927 && DECL_SAVED_INSNS (decl) != 0
1928 && (flag_keep_inline_functions
1929 || (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
1930 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1933 temporary_allocation ();
1934 output_inline_function (decl);
1935 permanent_allocation (1);
1940 output_something = 1;
1944 return output_something;
1947 /* Issue appropriate warnings for the global declarations in VEC (of
1948 which there are LEN). Output debugging information for them. */
1951 check_global_declarations (vec, len)
1958 for (i = 0; i < len; i++)
1962 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1963 && ! TREE_ASM_WRITTEN (decl))
1964 /* Cancel the RTL for this decl so that, if debugging info
1965 output for global variables is still to come,
1966 this one will be omitted. */
1967 DECL_RTL (decl) = NULL;
1969 /* Warn about any function
1970 declared static but not defined.
1971 We don't warn about variables,
1972 because many programs have static variables
1973 that exist only to get some text into the object file. */
1974 if (TREE_CODE (decl) == FUNCTION_DECL
1975 && (warn_unused_function
1976 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
1977 && DECL_INITIAL (decl) == 0
1978 && DECL_EXTERNAL (decl)
1979 && ! DECL_ARTIFICIAL (decl)
1980 && ! TREE_PUBLIC (decl))
1982 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
1983 pedwarn_with_decl (decl,
1984 "`%s' used but never defined");
1986 warning_with_decl (decl,
1987 "`%s' declared `static' but never defined");
1988 /* This symbol is effectively an "extern" declaration now. */
1989 TREE_PUBLIC (decl) = 1;
1990 assemble_external (decl);
1993 /* Warn about static fns or vars defined but not used,
1994 but not about inline functions or static consts
1995 since defining those in header files is normal practice. */
1996 if (((warn_unused_function
1997 && TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
1998 || (warn_unused_variable
1999 && TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
2000 && ! DECL_IN_SYSTEM_HEADER (decl)
2001 && ! DECL_EXTERNAL (decl)
2002 && ! TREE_PUBLIC (decl)
2003 && ! TREE_USED (decl)
2004 && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
2005 /* The TREE_USED bit for file-scope decls
2006 is kept in the identifier, to handle multiple
2007 external decls in different scopes. */
2008 && ! TREE_USED (DECL_NAME (decl)))
2009 warning_with_decl (decl, "`%s' defined but not used");
2011 timevar_push (TV_SYMOUT);
2012 #ifdef SDB_DEBUGGING_INFO
2013 /* The COFF linker can move initialized global vars to the end.
2014 And that can screw up the symbol ordering.
2015 By putting the symbols in that order to begin with,
2016 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
2017 if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
2018 && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
2019 && ! DECL_EXTERNAL (decl)
2020 && DECL_RTL (decl) != 0)
2021 sdbout_symbol (decl, 0);
2023 /* Output COFF information for non-global
2024 file-scope initialized variables. */
2025 if (write_symbols == SDB_DEBUG
2026 && TREE_CODE (decl) == VAR_DECL
2027 && DECL_INITIAL (decl)
2028 && ! DECL_EXTERNAL (decl)
2029 && DECL_RTL (decl) != 0
2030 && GET_CODE (DECL_RTL (decl)) == MEM)
2031 sdbout_toplevel_data (decl);
2032 #endif /* SDB_DEBUGGING_INFO */
2033 #ifdef DWARF_DEBUGGING_INFO
2034 /* Output DWARF information for file-scope tentative data object
2035 declarations, file-scope (extern) function declarations (which
2036 had no corresponding body) and file-scope tagged type declarations
2037 and definitions which have not yet been forced out. */
2039 if (write_symbols == DWARF_DEBUG
2040 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2041 dwarfout_file_scope_decl (decl, 1);
2043 #ifdef DWARF2_DEBUGGING_INFO
2044 /* Output DWARF2 information for file-scope tentative data object
2045 declarations, file-scope (extern) function declarations (which
2046 had no corresponding body) and file-scope tagged type declarations
2047 and definitions which have not yet been forced out. */
2049 if (write_symbols == DWARF2_DEBUG
2050 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2051 dwarf2out_decl (decl);
2053 timevar_pop (TV_SYMOUT);
2057 /* Save the current INPUT_FILENAME and LINENO on the top entry in the
2058 INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
2059 INPUT_FILENAME and LINENO accordingly. */
2062 push_srcloc (file, line)
2066 struct file_stack *fs;
2068 if (input_file_stack)
2070 input_file_stack->name = input_filename;
2071 input_file_stack->line = lineno;
2074 fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2075 fs->name = input_filename = file;
2076 fs->line = lineno = line;
2077 fs->indent_level = 0;
2078 fs->next = input_file_stack;
2079 input_file_stack = fs;
2080 input_file_stack_tick++;
2083 /* Pop the top entry off the stack of presently open source files.
2084 Restore the INPUT_FILENAME and LINENO from the new topmost entry on
2090 struct file_stack *fs;
2092 fs = input_file_stack;
2093 input_file_stack = fs->next;
2095 input_file_stack_tick++;
2096 /* The initial souce file is never popped. */
2097 if (!input_file_stack)
2099 input_filename = input_file_stack->name;
2100 lineno = input_file_stack->line;
2103 /* Compile an entire file of output from cpp, named NAME.
2104 Write a file of assembly output and various debugging dumps. */
2112 int name_specified = name != 0;
2114 if (dump_base_name == 0)
2115 dump_base_name = name ? name : "gccdump";
2120 /* Start timing total execution time. */
2123 timevar_start (TV_TOTAL);
2125 /* Initialize data in various passes. */
2129 name = init_parse (name);
2130 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
2131 || debug_info_level == DINFO_LEVEL_VERBOSE
2132 || flag_test_coverage
2133 || warn_notreached);
2136 init_decl_processing ();
2142 init_function_once ();
2143 init_stor_layout_once ();
2144 init_varasm_once ();
2146 /* The following initialization functions need to generate rtl, so
2147 provide a dummy function context for them. */
2148 init_dummy_function_start ();
2151 if (flag_caller_saves)
2152 init_caller_save ();
2153 expand_dummy_function_end ();
2155 /* If auxiliary info generation is desired, open the output file.
2156 This goes in the same directory as the source file--unlike
2157 all the other output files. */
2158 if (flag_gen_aux_info)
2160 aux_info_file = fopen (aux_info_file_name, "w");
2161 if (aux_info_file == 0)
2162 pfatal_with_name (aux_info_file_name);
2165 /* Open assembler code output file. Do this even if -fsyntax-only is on,
2166 because then the driver will have provided the name of a temporary
2167 file or bit bucket for us. */
2169 if (! name_specified && asm_file_name == 0)
2170 asm_out_file = stdout;
2173 if (asm_file_name == 0)
2175 int len = strlen (dump_base_name);
2176 char *dumpname = (char *) xmalloc (len + 6);
2177 memcpy (dumpname, dump_base_name, len + 1);
2178 strip_off_ending (dumpname, len);
2179 strcat (dumpname, ".s");
2180 asm_file_name = dumpname;
2182 if (!strcmp (asm_file_name, "-"))
2183 asm_out_file = stdout;
2185 asm_out_file = fopen (asm_file_name, "w");
2186 if (asm_out_file == 0)
2187 pfatal_with_name (asm_file_name);
2190 #ifdef IO_BUFFER_SIZE
2191 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
2192 _IOFBF, IO_BUFFER_SIZE);
2195 if (ggc_p && name != 0)
2196 name = ggc_alloc_string (name, strlen (name));
2198 input_filename = name;
2200 /* Put an entry on the input file stack for the main input file. */
2201 push_srcloc (input_filename, 0);
2203 /* Perform language-specific initialization.
2204 This may set main_input_filename. */
2207 /* If the input doesn't start with a #line, use the input name
2208 as the official input file name. */
2209 if (main_input_filename == 0)
2210 main_input_filename = name;
2212 if (flag_syntax_only)
2214 write_symbols = NO_DEBUG;
2216 profile_block_flag = 0;
2220 ASM_FILE_START (asm_out_file);
2222 #ifdef ASM_COMMENT_START
2223 if (flag_verbose_asm)
2225 /* Print the list of options in effect. */
2226 print_version (asm_out_file, ASM_COMMENT_START);
2227 print_switch_values (asm_out_file, 0, MAX_LINE,
2228 ASM_COMMENT_START, " ", "\n");
2229 /* Add a blank line here so it appears in assembler output but not
2231 fprintf (asm_out_file, "\n");
2235 /* Output something to inform GDB that this compilation was by GCC. */
2236 #ifndef ASM_IDENTIFY_GCC
2237 fprintf (asm_out_file, "gcc2_compiled.:\n");
2239 ASM_IDENTIFY_GCC (asm_out_file);
2242 /* Output something to identify which front-end produced this file. */
2243 #ifdef ASM_IDENTIFY_LANGUAGE
2244 ASM_IDENTIFY_LANGUAGE (asm_out_file);
2246 } /* ! flag_syntax_only */
2248 #ifndef ASM_OUTPUT_SECTION_NAME
2249 if (flag_function_sections)
2251 warning ("-ffunction-sections not supported for this target.");
2252 flag_function_sections = 0;
2254 if (flag_data_sections)
2256 warning ("-fdata-sections not supported for this target.");
2257 flag_data_sections = 0;
2261 if (flag_function_sections
2262 && (profile_flag || profile_block_flag))
2264 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2265 flag_function_sections = 0;
2268 #ifndef OBJECT_FORMAT_ELF
2269 if (flag_function_sections && write_symbols != NO_DEBUG)
2270 warning ("-ffunction-sections may affect debugging on some targets.");
2273 /* ??? Note: There used to be a conditional here
2274 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2275 This was to guarantee separation between gcc_compiled. and
2276 the first function, for the sake of dbx on Suns.
2277 However, having the extra zero here confused the Emacs
2278 code for unexec, and might confuse other programs too.
2279 Therefore, I took out that change.
2280 In future versions we should find another way to solve
2281 that dbx problem. -- rms, 23 May 93. */
2283 /* Don't let the first function fall at the same address
2284 as gcc_compiled., if profiling. */
2285 if (profile_flag || profile_block_flag)
2287 /* It's best if we can write a nop here since some
2288 assemblers don't tolerate zeros in the text section. */
2289 output_asm_insn (get_insn_template (CODE_FOR_nop, NULL), NULL_PTR);
2292 /* If dbx symbol table desired, initialize writing it
2293 and output the predefined types. */
2294 timevar_push (TV_SYMOUT);
2295 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2296 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2297 dbxout_init (asm_out_file, main_input_filename, getdecls ());
2299 #ifdef SDB_DEBUGGING_INFO
2300 if (write_symbols == SDB_DEBUG)
2301 sdbout_init (asm_out_file, main_input_filename, getdecls ());
2303 #ifdef DWARF_DEBUGGING_INFO
2304 if (write_symbols == DWARF_DEBUG)
2305 dwarfout_init (asm_out_file, main_input_filename);
2307 #ifdef DWARF2_UNWIND_INFO
2308 if (dwarf2out_do_frame ())
2309 dwarf2out_frame_init ();
2311 #ifdef DWARF2_DEBUGGING_INFO
2312 if (write_symbols == DWARF2_DEBUG)
2313 dwarf2out_init (asm_out_file, main_input_filename);
2315 timevar_pop (TV_SYMOUT);
2317 /* Initialize yet another pass. */
2319 init_final (main_input_filename);
2320 init_branch_prob (dump_base_name);
2322 timevar_push (TV_PARSE);
2324 /* Call the parser, which parses the entire file
2325 (calling rest_of_compilation for each function). */
2327 if (yyparse () != 0)
2329 if (errorcount == 0)
2330 fnotice (stderr, "Errors detected in input file (your bison.simple is out of date)\n");
2332 /* In case there were missing closebraces,
2333 get us back to the global binding level. */
2334 while (! global_bindings_p ())
2338 /* Compilation is now finished except for writing
2339 what's left of the symbol table output. */
2341 timevar_pop (TV_PARSE);
2343 if (flag_syntax_only)
2346 globals = getdecls ();
2348 /* Really define vars that have had only a tentative definition.
2349 Really output inline functions that must actually be callable
2350 and have not been output so far. */
2353 int len = list_length (globals);
2354 tree *vec = (tree *) xmalloc (sizeof (tree) * len);
2358 /* Process the decls in reverse order--earliest first.
2359 Put them into VEC from back to front, then take out from front. */
2361 for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
2362 vec[len - i - 1] = decl;
2364 wrapup_global_declarations (vec, len);
2366 /* This must occur after the loop to output deferred functions. Else
2367 the profiler initializer would not be emitted if all the functions
2368 in this compilation unit were deferred.
2370 output_func_start_profiler can not cause any additional functions or
2371 data to need to be output, so it need not be in the deferred function
2373 output_func_start_profiler ();
2375 /* Now that all possible functions have been output, we can dump
2376 the exception table. */
2378 #ifndef IA64_UNWIND_INFO
2379 output_exception_table ();
2381 free_exception_table ();
2383 check_global_declarations (vec, len);
2389 /* Write out any pending weak symbol declarations. */
2393 /* Do dbx symbols. */
2394 timevar_push (TV_SYMOUT);
2395 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2396 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2397 dbxout_finish (asm_out_file, main_input_filename);
2400 #ifdef DWARF_DEBUGGING_INFO
2401 if (write_symbols == DWARF_DEBUG)
2405 #ifdef DWARF2_UNWIND_INFO
2406 if (dwarf2out_do_frame ())
2407 dwarf2out_frame_finish ();
2410 #ifdef DWARF2_DEBUGGING_INFO
2411 if (write_symbols == DWARF2_DEBUG)
2412 dwarf2out_finish ();
2414 timevar_pop (TV_SYMOUT);
2416 /* Output some stuff at end of file if nec. */
2418 end_final (dump_base_name);
2420 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
2422 timevar_push (TV_DUMP);
2423 open_dump_file (DFI_bp, NULL);
2427 close_dump_file (DFI_bp, NULL, NULL_RTX);
2428 timevar_pop (TV_DUMP);
2432 ASM_FILE_END (asm_out_file);
2435 /* Language-specific end of compilation actions. */
2439 /* Close the dump files. */
2441 if (flag_gen_aux_info)
2443 fclose (aux_info_file);
2445 unlink (aux_info_file_name);
2448 if (optimize > 0 && open_dump_file (DFI_combine, NULL))
2450 timevar_push (TV_DUMP);
2451 dump_combine_total_stats (rtl_dump_file);
2452 close_dump_file (DFI_combine, NULL, NULL_RTX);
2453 timevar_pop (TV_DUMP);
2456 /* Close non-debugging input and output files. Take special care to note
2457 whether fclose returns an error, since the pages might still be on the
2458 buffer chain while the file is open. */
2462 if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
2463 fatal_io_error (asm_file_name);
2465 /* Do whatever is necessary to finish printing the graphs. */
2466 if (graph_dump_format != no_graph)
2470 for (i = 0; i < DFI_MAX; ++i)
2471 if (dump_file[i].initialized && dump_file[i].graph_dump_p)
2476 sprintf (seq, ".%02d.", i);
2477 suffix = concat (seq, dump_file[i].extension, NULL);
2478 finish_graph_dump_file (dump_base_name, suffix);
2484 ggc_print_statistics ();
2486 /* Free up memory for the benefit of leak detectors. */
2489 /* Stop timing total execution time. */
2490 timevar_stop (TV_TOTAL);
2492 /* Print the times. */
2494 timevar_print (stderr);
2497 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2498 and TYPE_DECL nodes.
2500 This does nothing for local (non-static) variables, unless the
2501 variable is a register variable with an ASMSPEC. In that case, or
2502 if the variable is not an automatice, it sets up the RTL and
2503 outputs any assembler code (label definition, storage allocation
2504 and initialization).
2506 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2507 the assembler symbol name to be used. TOP_LEVEL is nonzero
2508 if this declaration is not within a function. */
2511 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2513 const char *asmspec;
2517 /* Declarations of variables, and of functions defined elsewhere. */
2519 /* The most obvious approach, to put an #ifndef around where
2520 this macro is used, doesn't work since it's inside a macro call. */
2521 #ifndef ASM_FINISH_DECLARE_OBJECT
2522 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2525 /* Forward declarations for nested functions are not "external",
2526 but we need to treat them as if they were. */
2527 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2528 || TREE_CODE (decl) == FUNCTION_DECL)
2530 timevar_push (TV_VARCONST);
2531 make_decl_rtl (decl, asmspec, top_level);
2532 /* Initialized extern variable exists to be replaced
2533 with its value, or represents something that will be
2534 output in another file. */
2535 if (! (TREE_CODE (decl) == VAR_DECL
2536 && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
2537 && DECL_INITIAL (decl) != 0
2538 && DECL_INITIAL (decl) != error_mark_node))
2539 /* Don't output anything
2540 when a tentative file-scope definition is seen.
2541 But at end of compilation, do output code for them. */
2542 if (! (! at_end && top_level
2543 && (DECL_INITIAL (decl) == 0
2544 || DECL_INITIAL (decl) == error_mark_node)))
2545 assemble_variable (decl, top_level, at_end, 0);
2546 if (decl == last_assemble_variable_decl)
2548 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2551 timevar_pop (TV_VARCONST);
2553 else if (DECL_REGISTER (decl) && asmspec != 0)
2555 if (decode_reg_name (asmspec) >= 0)
2557 DECL_RTL (decl) = 0;
2558 make_decl_rtl (decl, asmspec, top_level);
2561 error ("invalid register name `%s' for register variable", asmspec);
2563 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2564 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2565 && TREE_CODE (decl) == TYPE_DECL)
2567 timevar_push (TV_SYMOUT);
2568 dbxout_symbol (decl, 0);
2569 timevar_pop (TV_SYMOUT);
2572 #ifdef SDB_DEBUGGING_INFO
2573 else if (write_symbols == SDB_DEBUG && top_level
2574 && TREE_CODE (decl) == TYPE_DECL)
2576 timevar_push (TV_SYMOUT);
2577 sdbout_symbol (decl, 0);
2578 timevar_pop (TV_SYMOUT);
2583 /* Called after finishing a record, union or enumeral type. */
2586 rest_of_type_compilation (type, toplev)
2587 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
2591 tree type ATTRIBUTE_UNUSED;
2592 int toplev ATTRIBUTE_UNUSED;
2595 timevar_push (TV_SYMOUT);
2596 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2597 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2598 dbxout_symbol (TYPE_STUB_DECL (type), !toplev);
2600 #ifdef SDB_DEBUGGING_INFO
2601 if (write_symbols == SDB_DEBUG)
2602 sdbout_symbol (TYPE_STUB_DECL (type), !toplev);
2604 #ifdef DWARF2_DEBUGGING_INFO
2605 if (write_symbols == DWARF2_DEBUG && toplev)
2606 dwarf2out_decl (TYPE_STUB_DECL (type));
2608 timevar_pop (TV_SYMOUT);
2611 /* DECL is an inline function, whose body is present, but which is not
2612 being output at this point. (We're putting that off until we need
2613 to do it.) If there are any actions that need to take place,
2614 including the emission of debugging information for the function,
2615 this is where they should go. This function may be called by
2616 language-dependent code for front-ends that do not even generate
2617 RTL for functions that don't need to be put out. */
2620 note_deferral_of_defined_inline_function (decl)
2621 tree decl ATTRIBUTE_UNUSED;
2623 #ifdef DWARF_DEBUGGING_INFO
2624 /* Generate the DWARF info for the "abstract" instance of a function
2625 which we may later generate inlined and/or out-of-line instances
2627 if (write_symbols == DWARF_DEBUG && DECL_INLINE (decl))
2629 /* The front-end may not have set CURRENT_FUNCTION_DECL, but the
2630 DWARF code expects it to be set in this case. Intuitively,
2631 DECL is the function we just finished defining, so setting
2632 CURRENT_FUNCTION_DECL is sensible. */
2633 tree saved_cfd = current_function_decl;
2634 current_function_decl = decl;
2636 /* Let the DWARF code do its work. */
2637 set_decl_abstract_flags (decl, 1);
2638 dwarfout_file_scope_decl (decl, 0);
2639 set_decl_abstract_flags (decl, 0);
2641 /* Reset CURRENT_FUNCTION_DECL. */
2642 current_function_decl = saved_cfd;
2647 /* This is called from finish_function (within yyparse)
2648 after each top-level definition is parsed.
2649 It is supposed to compile that function or variable
2650 and output the assembler code for it.
2651 After we return, the tree storage is freed. */
2654 rest_of_compilation (decl)
2660 int rebuild_label_notes_after_reload;
2661 int register_life_up_to_date;
2663 timevar_push (TV_REST_OF_COMPILATION);
2665 /* Now that we're out of the frontend, we shouldn't have any more
2666 CONCATs anywhere. */
2667 generating_concat_p = 0;
2669 /* When processing delayed functions, prepare_function_start() won't
2670 have been run to re-initialize it. */
2671 cse_not_expected = ! optimize;
2673 /* First, make sure that NOTE_BLOCK is set correctly for each
2674 NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
2675 if (!cfun->x_whole_function_mode_p)
2678 /* Then remove any notes we don't need. That will make iterating
2679 over the instruction sequence faster, and allow the garbage
2680 collector to reclaim the memory used by the notes. */
2681 remove_unnecessary_notes ();
2683 /* In function-at-a-time mode, we do not attempt to keep the BLOCK
2684 tree in sensible shape. So, we just recalculate it here. */
2685 if (cfun->x_whole_function_mode_p)
2688 /* If we are reconsidering an inline function
2689 at the end of compilation, skip the stuff for making it inline. */
2691 if (DECL_SAVED_INSNS (decl) == 0)
2697 /* If this is nested inside an inlined external function, pretend
2698 it was only declared. Since we cannot inline such functions,
2699 generating code for this one is not only not necessary but will
2700 confuse some debugging output writers. */
2701 for (parent = DECL_CONTEXT (current_function_decl);
2702 parent != NULL_TREE;
2703 parent = get_containing_scope (parent))
2704 if (TREE_CODE (parent) == FUNCTION_DECL
2705 && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
2707 DECL_INITIAL (decl) = 0;
2708 goto exit_rest_of_compilation;
2711 /* If requested, consider whether to make this function inline. */
2712 if (DECL_INLINE (decl) || flag_inline_functions)
2714 timevar_push (TV_INTEGRATION);
2715 lose = function_cannot_inline_p (decl);
2716 timevar_pop (TV_INTEGRATION);
2717 if (lose || ! optimize)
2719 if (warn_inline && DECL_INLINE (decl))
2720 warning_with_decl (decl, lose);
2721 DECL_ABSTRACT_ORIGIN (decl) = 0;
2722 /* Don't really compile an extern inline function.
2723 If we can't make it inline, pretend
2724 it was only declared. */
2725 if (DECL_EXTERNAL (decl))
2727 DECL_INITIAL (decl) = 0;
2728 goto exit_rest_of_compilation;
2732 /* ??? Note that this has the effect of making it look
2733 like "inline" was specified for a function if we choose
2734 to inline it. This isn't quite right, but it's
2735 probably not worth the trouble to fix. */
2736 inlinable = DECL_INLINE (decl) = 1;
2739 insns = get_insns ();
2741 /* Dump the rtl code if we are dumping rtl. */
2743 if (open_dump_file (DFI_rtl, decl))
2745 if (DECL_SAVED_INSNS (decl))
2746 fprintf (rtl_dump_file, ";; (integrable)\n\n");
2747 close_dump_file (DFI_rtl, print_rtl, insns);
2750 /* If function is inline, and we don't yet know whether to
2751 compile it by itself, defer decision till end of compilation.
2752 finish_compilation will call rest_of_compilation again
2753 for those functions that need to be output. Also defer those
2754 functions that we are supposed to defer. */
2757 || (DECL_INLINE (decl)
2758 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2759 && ! flag_keep_inline_functions)
2760 || DECL_EXTERNAL (decl))))
2761 DECL_DEFER_OUTPUT (decl) = 1;
2763 if (DECL_INLINE (decl))
2764 /* DWARF wants seperate debugging info for abstract and
2765 concrete instances of all inline functions, including those
2766 declared inline but not inlined, and those inlined even
2767 though they weren't declared inline. Conveniently, that's
2768 what DECL_INLINE means at this point. */
2769 note_deferral_of_defined_inline_function (decl);
2771 if (DECL_DEFER_OUTPUT (decl))
2773 /* If -Wreturn-type, we have to do a bit of compilation.
2774 However, if we just fall through we will call
2775 save_for_inline_copying() which results in excessive
2776 memory use. Instead, we just want to call
2777 jump_optimize() to figure out whether or not we can fall
2778 off the end of the function; we do the minimum amount of
2779 work necessary to make that safe. And, we set optimize
2780 to zero to keep jump_optimize from working too hard. */
2781 if (warn_return_type)
2783 int saved_optimize = optimize;
2785 find_exception_handler_labels ();
2786 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2787 !JUMP_AFTER_REGSCAN);
2788 optimize = saved_optimize;
2791 current_function_nothrow = nothrow_function_p ();
2792 if (current_function_nothrow)
2793 /* Now we know that this can't throw; set the flag for the benefit
2794 of other functions later in this translation unit. */
2795 TREE_NOTHROW (current_function_decl) = 1;
2797 timevar_push (TV_INTEGRATION);
2798 save_for_inline_nocopy (decl);
2799 timevar_pop (TV_INTEGRATION);
2800 DECL_SAVED_INSNS (decl)->inlinable = inlinable;
2801 goto exit_rest_of_compilation;
2804 /* If specified extern inline but we aren't inlining it, we are
2805 done. This goes for anything that gets here with DECL_EXTERNAL
2806 set, not just things with DECL_INLINE. */
2807 if (DECL_EXTERNAL (decl))
2808 goto exit_rest_of_compilation;
2811 init_EXPR_INSN_LIST_cache ();
2816 /* Initialize some variables used by the optimizers. */
2817 init_function_for_compilation ();
2819 if (! DECL_DEFER_OUTPUT (decl))
2820 TREE_ASM_WRITTEN (decl) = 1;
2822 /* Now that integrate will no longer see our rtl, we need not distinguish
2823 between the return value of this function and the return value of called
2825 rtx_equal_function_value_matters = 0;
2827 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
2828 if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
2829 goto exit_rest_of_compilation;
2831 /* Emit code to get eh context, if needed. */
2834 /* We may have potential sibling or tail recursion sites. Select one
2835 (of possibly multiple) methods of performing the call. */
2836 if (flag_optimize_sibling_calls)
2838 timevar_push (TV_JUMP);
2839 open_dump_file (DFI_sibling, decl);
2841 optimize_sibling_and_tail_recursive_calls ();
2843 close_dump_file (DFI_sibling, print_rtl, get_insns ());
2844 timevar_pop (TV_JUMP);
2848 /* If we are doing position-independent code generation, now
2849 is the time to output special prologues and epilogues.
2850 We do not want to do this earlier, because it just clutters
2851 up inline functions with meaningless insns. */
2856 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
2857 Note that that may have been done above, in save_for_inline_copying.
2858 The call to resume_temporary_allocation near the end of this function
2859 goes back to the usual state of affairs. This must be done after
2860 we've built up any unwinders for exception handling, and done
2861 the FINALIZE_PIC work, if necessary. */
2863 rtl_in_current_obstack ();
2865 insns = get_insns ();
2867 /* Copy any shared structure that should not be shared. */
2868 unshare_all_rtl (current_function_decl, insns);
2870 #ifdef SETJMP_VIA_SAVE_AREA
2871 /* This must be performed before virutal register instantiation. */
2872 if (current_function_calls_alloca)
2873 optimize_save_area_alloca (insns);
2876 /* Instantiate all virtual registers. */
2877 instantiate_virtual_regs (current_function_decl, insns);
2879 /* Find all the EH handlers. */
2880 find_exception_handler_labels ();
2882 open_dump_file (DFI_jump, decl);
2884 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
2885 are initialized and to compute whether control can drop off the end
2888 timevar_push (TV_JUMP);
2889 /* Turn NOTE_INSN_EXPECTED_VALUE into REG_BR_PROB. Do this
2890 before jump optimization switches branch directions. */
2891 expected_value_to_br_prob ();
2893 reg_scan (insns, max_reg_num (), 0);
2894 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2895 JUMP_AFTER_REGSCAN);
2897 timevar_pop (TV_JUMP);
2899 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
2900 if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
2902 close_dump_file (DFI_jump, print_rtl, insns);
2903 goto exit_rest_of_compilation;
2906 timevar_push (TV_JUMP);
2910 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2911 cleanup_cfg (insns);
2913 /* ??? Run if-conversion before delete_null_pointer_checks,
2914 since the later does not preserve the CFG. This should
2915 be changed -- no since converting if's that are going to
2917 timevar_push (TV_IFCVT);
2919 timevar_pop (TV_IFCVT);
2921 /* Try to identify useless null pointer tests and delete them. */
2922 if (flag_delete_null_pointer_checks)
2923 delete_null_pointer_checks (insns);
2926 /* Jump optimization, and the removal of NULL pointer checks, may
2927 have reduced the number of instructions substantially. CSE, and
2928 future passes, allocate arrays whose dimensions involve the
2929 maximum instruction UID, so if we can reduce the maximum UID
2930 we'll save big on memory. */
2931 renumber_insns (rtl_dump_file);
2932 timevar_pop (TV_JUMP);
2934 close_dump_file (DFI_jump, print_rtl, insns);
2939 /* Perform common subexpression elimination.
2940 Nonzero value from `cse_main' means that jumps were simplified
2941 and some code may now be unreachable, so do
2942 jump optimization again. */
2946 open_dump_file (DFI_cse, decl);
2947 timevar_push (TV_CSE);
2949 reg_scan (insns, max_reg_num (), 1);
2951 if (flag_thread_jumps)
2953 timevar_push (TV_JUMP);
2954 thread_jumps (insns, max_reg_num (), 1);
2955 timevar_pop (TV_JUMP);
2958 tem = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
2960 /* If we are not running the second CSE pass, then we are no longer
2961 expecting CSE to be run. */
2962 cse_not_expected = !flag_rerun_cse_after_loop;
2964 if (tem || optimize > 1)
2966 timevar_push (TV_JUMP);
2967 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2968 !JUMP_AFTER_REGSCAN);
2969 timevar_pop (TV_JUMP);
2972 /* Run this after jump optmizations remove all the unreachable code
2973 so that unreachable code will not keep values live. */
2974 delete_trivially_dead_insns (insns, max_reg_num ());
2976 /* Try to identify useless null pointer tests and delete them. */
2977 if (flag_delete_null_pointer_checks)
2979 timevar_push (TV_JUMP);
2980 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2982 cleanup_cfg (insns);
2984 delete_null_pointer_checks (insns);
2985 timevar_pop (TV_JUMP);
2988 /* The second pass of jump optimization is likely to have
2989 removed a bunch more instructions. */
2990 renumber_insns (rtl_dump_file);
2992 timevar_pop (TV_CSE);
2993 close_dump_file (DFI_cse, print_rtl, insns);
2996 open_dump_file (DFI_addressof, decl);
2998 purge_addressof (insns);
2999 reg_scan (insns, max_reg_num (), 1);
3001 close_dump_file (DFI_addressof, print_rtl, insns);
3006 if (optimize > 0 && flag_ssa)
3008 /* Convert to SSA form. */
3010 timevar_push (TV_TO_SSA);
3011 open_dump_file (DFI_ssa, decl);
3013 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3014 cleanup_cfg (insns);
3017 close_dump_file (DFI_ssa, print_rtl_with_bb, insns);
3018 timevar_pop (TV_TO_SSA);
3020 /* The SSA implementation uses basic block numbers in its phi
3021 nodes. Thus, changing the control-flow graph or the basic
3022 blocks, e.g., calling find_basic_blocks () or cleanup_cfg (),
3023 may cause problems. */
3027 /* Remove dead code. */
3029 timevar_push (TV_DEAD_CODE_ELIM);
3030 open_dump_file (DFI_dce, decl);
3032 insns = get_insns ();
3033 eliminate_dead_code();
3035 close_dump_file (DFI_dce, print_rtl_with_bb, insns);
3036 timevar_pop (TV_DEAD_CODE_ELIM);
3039 /* Convert from SSA form. */
3041 timevar_push (TV_FROM_SSA);
3042 open_dump_file (DFI_ussa, decl);
3044 convert_from_ssa ();
3045 /* New registers have been created. Rescan their usage. */
3046 reg_scan (insns, max_reg_num (), 1);
3047 /* Life analysis used in SSA adds log_links but these
3048 shouldn't be there until the flow stage, so clear
3050 clear_log_links (insns);
3052 close_dump_file (DFI_ussa, print_rtl_with_bb, insns);
3053 timevar_pop (TV_FROM_SSA);
3059 /* Perform global cse. */
3061 if (optimize > 0 && flag_gcse)
3063 timevar_push (TV_GCSE);
3064 open_dump_file (DFI_gcse, decl);
3066 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3067 cleanup_cfg (insns);
3068 tem = gcse_main (insns, rtl_dump_file);
3070 /* If gcse altered any jumps, rerun jump optimizations to clean
3074 timevar_push (TV_JUMP);
3075 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
3076 !JUMP_AFTER_REGSCAN);
3077 timevar_pop (TV_JUMP);
3080 close_dump_file (DFI_gcse, print_rtl, insns);
3081 timevar_pop (TV_GCSE);
3087 /* Move constant computations out of loops. */
3091 timevar_push (TV_LOOP);
3092 open_dump_file (DFI_loop, decl);
3094 if (flag_rerun_loop_opt)
3096 /* We only want to perform unrolling once. */
3098 loop_optimize (insns, rtl_dump_file, 0);
3100 /* The first call to loop_optimize makes some instructions
3101 trivially dead. We delete those instructions now in the
3102 hope that doing so will make the heuristics in loop work
3103 better and possibly speed up compilation. */
3104 delete_trivially_dead_insns (insns, max_reg_num ());
3106 /* The regscan pass is currently necessary as the alias
3107 analysis code depends on this information. */
3108 reg_scan (insns, max_reg_num (), 1);
3110 loop_optimize (insns, rtl_dump_file,
3111 (flag_unroll_loops ? LOOP_UNROLL : 0) | LOOP_BCT);
3113 close_dump_file (DFI_loop, print_rtl, insns);
3114 timevar_pop (TV_LOOP);
3122 timevar_push (TV_CSE2);
3123 open_dump_file (DFI_cse2, decl);
3125 if (flag_rerun_cse_after_loop)
3127 /* Running another jump optimization pass before the second
3128 cse pass sometimes simplifies the RTL enough to allow
3129 the second CSE pass to do a better job. Jump_optimize can change
3130 max_reg_num so we must rerun reg_scan afterwards.
3131 ??? Rework to not call reg_scan so often. */
3132 timevar_push (TV_JUMP);
3134 reg_scan (insns, max_reg_num (), 0);
3135 jump_optimize (insns, !JUMP_CROSS_JUMP,
3136 !JUMP_NOOP_MOVES, JUMP_AFTER_REGSCAN);
3138 timevar_push (TV_IFCVT);
3140 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3141 cleanup_cfg (insns);
3144 timevar_pop(TV_IFCVT);
3146 timevar_pop (TV_JUMP);
3148 reg_scan (insns, max_reg_num (), 0);
3149 tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
3153 timevar_push (TV_JUMP);
3154 jump_optimize (insns, !JUMP_CROSS_JUMP,
3155 !JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
3156 timevar_pop (TV_JUMP);
3160 if (flag_thread_jumps)
3162 /* This pass of jump threading straightens out code
3163 that was kinked by loop optimization. */
3164 timevar_push (TV_JUMP);
3165 reg_scan (insns, max_reg_num (), 0);
3166 thread_jumps (insns, max_reg_num (), 0);
3167 timevar_pop (TV_JUMP);
3170 close_dump_file (DFI_cse2, print_rtl, insns);
3171 timevar_pop (TV_CSE2);
3177 cse_not_expected = 1;
3181 /* Do control and data flow analysis; wrote some of the results to
3184 timevar_push (TV_FLOW);
3185 open_dump_file (DFI_cfg, decl);
3187 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3188 cleanup_cfg (insns);
3190 close_dump_file (DFI_cfg, print_rtl_with_bb, insns);
3192 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
3194 timevar_push (TV_BRANCH_PROB);
3195 open_dump_file (DFI_bp, decl);
3199 close_dump_file (DFI_bp, print_rtl_with_bb, insns);
3200 timevar_pop (TV_BRANCH_PROB);
3203 open_dump_file (DFI_life, decl);
3208 /* Discover and record the loop depth at the head of each basic
3209 block. The loop infrastructure does the real job for us. */
3210 flow_loops_find (&loops);
3212 /* Estimate using heuristics if no profiling info is available. */
3213 estimate_probability (&loops);
3216 flow_loops_dump (&loops, rtl_dump_file, NULL, 0);
3218 flow_loops_free (&loops);
3220 life_analysis (insns, rtl_dump_file, PROP_FINAL);
3221 mark_constant_function ();
3222 timevar_pop (TV_FLOW);
3224 register_life_up_to_date = 1;
3227 if (warn_uninitialized || extra_warnings)
3229 uninitialized_vars_warning (DECL_INITIAL (decl));
3231 setjmp_args_warning ();
3234 close_dump_file (DFI_life, print_rtl_with_bb, insns);
3239 /* If -opt, try combining insns through substitution. */
3243 int rebuild_jump_labels_after_combine = 0;
3245 timevar_push (TV_COMBINE);
3246 open_dump_file (DFI_combine, decl);
3248 rebuild_jump_labels_after_combine
3249 = combine_instructions (insns, max_reg_num ());
3251 /* Combining insns may have turned an indirect jump into a
3252 direct jump. Rebuid the JUMP_LABEL fields of jumping
3254 if (rebuild_jump_labels_after_combine)
3256 timevar_push (TV_JUMP);
3257 rebuild_jump_labels (insns);
3258 timevar_pop (TV_JUMP);
3260 timevar_push (TV_FLOW);
3261 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3262 cleanup_cfg (insns);
3264 /* Blimey. We've got to have the CFG up to date for the call to
3265 if_convert below. However, the random deletion of blocks
3266 without updating life info can wind up with Wierd Stuff in
3267 global_live_at_end. We then run sched1, which updates things
3268 properly, discovers the wierdness and aborts. */
3269 update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
3270 PROP_DEATH_NOTES | PROP_KILL_DEAD_CODE
3271 | PROP_SCAN_DEAD_CODE);
3273 timevar_pop (TV_FLOW);
3276 close_dump_file (DFI_combine, print_rtl_with_bb, insns);
3277 timevar_pop (TV_COMBINE);
3283 /* Rerun if-conversion, as combine may have simplified things enough to
3284 now meet sequence length restrictions. */
3287 timevar_push (TV_IFCVT);
3288 open_dump_file (DFI_ce, decl);
3294 close_dump_file (DFI_ce, print_rtl_with_bb, insns);
3295 timevar_pop (TV_IFCVT);
3298 /* Register allocation pre-pass, to reduce number of moves
3299 necessary for two-address machines. */
3300 if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
3302 timevar_push (TV_REGMOVE);
3303 open_dump_file (DFI_regmove, decl);
3305 regmove_optimize (insns, max_reg_num (), rtl_dump_file);
3307 close_dump_file (DFI_regmove, print_rtl_with_bb, insns);
3308 timevar_pop (TV_REGMOVE);
3314 /* Any of the several passes since flow1 will have munged register
3315 lifetime data a bit. */
3317 register_life_up_to_date = 0;
3319 #ifdef OPTIMIZE_MODE_SWITCHING
3322 timevar_push (TV_GCSE);
3324 if (optimize_mode_switching (NULL_PTR))
3326 /* We did work, and so had to regenerate global life information.
3327 Take advantage of this and don't re-recompute register life
3328 information below. */
3329 register_life_up_to_date = 1;
3332 timevar_pop (TV_GCSE);
3336 #ifdef INSN_SCHEDULING
3338 /* Print function header into sched dump now
3339 because doing the sched analysis makes some of the dump. */
3340 if (optimize > 0 && flag_schedule_insns)
3342 timevar_push (TV_SCHED);
3343 open_dump_file (DFI_sched, decl);
3345 /* Do control and data sched analysis,
3346 and write some of the results to dump file. */
3348 schedule_insns (rtl_dump_file);
3350 close_dump_file (DFI_sched, print_rtl_with_bb, insns);
3351 timevar_pop (TV_SCHED);
3356 /* Register lifetime information was updated as part of verifying
3358 register_life_up_to_date = 1;
3362 /* Determine if the current function is a leaf before running reload
3363 since this can impact optimizations done by the prologue and
3364 epilogue thus changing register elimination offsets. */
3365 current_function_is_leaf = leaf_function_p ();
3367 timevar_push (TV_LOCAL_ALLOC);
3368 open_dump_file (DFI_lreg, decl);
3370 /* Allocate pseudo-regs that are used only within 1 basic block.
3372 RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
3373 jump optimizer after register allocation and reloading are finished. */
3375 if (! register_life_up_to_date)
3376 recompute_reg_usage (insns, ! optimize_size);
3377 regclass (insns, max_reg_num (), rtl_dump_file);
3378 rebuild_label_notes_after_reload = local_alloc ();
3380 timevar_pop (TV_LOCAL_ALLOC);
3382 if (dump_file[DFI_lreg].enabled)
3384 timevar_push (TV_DUMP);
3386 dump_flow_info (rtl_dump_file);
3387 dump_local_alloc (rtl_dump_file);
3389 close_dump_file (DFI_lreg, print_rtl_with_bb, insns);
3390 timevar_pop (TV_DUMP);
3396 timevar_push (TV_GLOBAL_ALLOC);
3397 open_dump_file (DFI_greg, decl);
3399 /* If optimizing, allocate remaining pseudo-regs. Do the reload
3400 pass fixing up any insns that are invalid. */
3403 failure = global_alloc (rtl_dump_file);
3406 build_insn_chain (insns);
3407 failure = reload (insns, 0);
3410 timevar_pop (TV_GLOBAL_ALLOC);
3413 goto exit_rest_of_compilation;
3418 /* Do a very simple CSE pass over just the hard registers. */
3421 timevar_push (TV_RELOAD_CSE_REGS);
3422 reload_cse_regs (insns);
3423 timevar_pop (TV_RELOAD_CSE_REGS);
3426 /* If optimizing, then go ahead and split insns now since we are about
3427 to recompute flow information anyway. */
3430 int old_labelnum = max_label_num ();
3432 split_all_insns (0);
3433 rebuild_label_notes_after_reload |= old_labelnum != max_label_num ();
3436 /* Register allocation and reloading may have turned an indirect jump into
3437 a direct jump. If so, we must rebuild the JUMP_LABEL fields of
3438 jumping instructions. */
3439 if (rebuild_label_notes_after_reload)
3441 timevar_push (TV_JUMP);
3443 rebuild_jump_labels (insns);
3445 timevar_pop (TV_JUMP);
3448 if (dump_file[DFI_greg].enabled)
3450 timevar_push (TV_DUMP);
3452 dump_global_regs (rtl_dump_file);
3454 close_dump_file (DFI_greg, print_rtl_with_bb, insns);
3455 timevar_pop (TV_DUMP);
3458 /* Re-create the death notes which were deleted during reload. */
3459 timevar_push (TV_FLOW2);
3460 open_dump_file (DFI_flow2, decl);
3462 jump_optimize (insns, !JUMP_CROSS_JUMP,
3463 !JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
3464 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3466 /* On some machines, the prologue and epilogue code, or parts thereof,
3467 can be represented as RTL. Doing so lets us schedule insns between
3468 it and the rest of the code and also allows delayed branch
3469 scheduling to operate in the epilogue. */
3470 thread_prologue_and_epilogue_insns (insns);
3474 cleanup_cfg (insns);
3475 life_analysis (insns, rtl_dump_file, PROP_FINAL);
3477 /* This is kind of a heuristic. We need to run combine_stack_adjustments
3478 even for machines with possibly nonzero RETURN_POPS_ARGS
3479 and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having
3480 push instructions will have popping returns. */
3481 #ifndef PUSH_ROUNDING
3482 if (!ACCUMULATE_OUTGOING_ARGS)
3484 combine_stack_adjustments ();
3490 flow2_completed = 1;
3492 close_dump_file (DFI_flow2, print_rtl_with_bb, insns);
3493 timevar_pop (TV_FLOW2);
3497 timevar_push (TV_IFCVT2);
3498 open_dump_file (DFI_ce2, decl);
3502 close_dump_file (DFI_ce2, print_rtl_with_bb, insns);
3503 timevar_pop (TV_IFCVT2);
3506 #ifdef HAVE_peephole2
3507 if (optimize > 0 && flag_peephole2)
3509 timevar_push (TV_PEEPHOLE2);
3510 open_dump_file (DFI_peephole2, decl);
3512 peephole2_optimize (rtl_dump_file);
3514 close_dump_file (DFI_peephole2, print_rtl_with_bb, insns);
3515 timevar_pop (TV_PEEPHOLE2);
3519 if (optimize > 0 && flag_rename_registers)
3521 timevar_push (TV_RENAME_REGISTERS);
3522 open_dump_file (DFI_rnreg, decl);
3524 regrename_optimize ();
3526 close_dump_file (DFI_rnreg, print_rtl_with_bb, insns);
3527 timevar_pop (TV_RENAME_REGISTERS);
3530 #ifdef INSN_SCHEDULING
3531 if (optimize > 0 && flag_schedule_insns_after_reload)
3533 timevar_push (TV_SCHED2);
3534 open_dump_file (DFI_sched2, decl);
3536 /* Do control and data sched analysis again,
3537 and write some more of the results to dump file. */
3539 schedule_insns (rtl_dump_file);
3541 close_dump_file (DFI_sched2, print_rtl_with_bb, insns);
3542 timevar_pop (TV_SCHED2);
3549 #ifdef LEAF_REGISTERS
3550 current_function_uses_only_leaf_regs
3551 = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
3554 if (optimize > 0 && flag_reorder_blocks)
3556 timevar_push (TV_REORDER_BLOCKS);
3557 open_dump_file (DFI_bbro, decl);
3559 reorder_basic_blocks ();
3561 close_dump_file (DFI_bbro, print_rtl_with_bb, insns);
3562 timevar_pop (TV_REORDER_BLOCKS);
3565 /* One more attempt to remove jumps to .+1 left by dead-store elimination.
3566 Also do cross-jumping this time and delete no-op move insns. */
3570 timevar_push (TV_JUMP);
3571 open_dump_file (DFI_jump2, decl);
3573 jump_optimize (insns, JUMP_CROSS_JUMP, JUMP_NOOP_MOVES,
3574 !JUMP_AFTER_REGSCAN);
3576 /* CFG no longer kept up to date. */
3578 close_dump_file (DFI_jump2, print_rtl_with_bb, insns);
3579 timevar_pop (TV_JUMP);
3582 /* If a machine dependent reorganization is needed, call it. */
3583 #ifdef MACHINE_DEPENDENT_REORG
3584 open_dump_file (DFI_mach, decl);
3586 MACHINE_DEPENDENT_REORG (insns);
3588 close_dump_file (DFI_mach, print_rtl_with_bb, insns);
3594 /* If a scheduling pass for delayed branches is to be done,
3595 call the scheduling code. */
3598 if (optimize > 0 && flag_delayed_branch)
3600 timevar_push (TV_DBR_SCHED);
3601 open_dump_file (DFI_dbr, decl);
3603 dbr_schedule (insns, rtl_dump_file);
3605 close_dump_file (DFI_dbr, print_rtl_with_bb, insns);
3606 timevar_pop (TV_DBR_SCHED);
3613 /* Shorten branches.
3615 Note this must run before reg-stack because of death note (ab)use
3616 in the ia32 backend. */
3617 timevar_push (TV_SHORTEN_BRANCH);
3618 shorten_branches (get_insns ());
3619 timevar_pop (TV_SHORTEN_BRANCH);
3622 timevar_push (TV_REG_STACK);
3623 open_dump_file (DFI_stack, decl);
3625 reg_to_stack (insns, rtl_dump_file);
3627 close_dump_file (DFI_stack, print_rtl_with_bb, insns);
3628 timevar_pop (TV_REG_STACK);
3634 current_function_nothrow = nothrow_function_p ();
3635 if (current_function_nothrow)
3636 /* Now we know that this can't throw; set the flag for the benefit
3637 of other functions later in this translation unit. */
3638 TREE_NOTHROW (current_function_decl) = 1;
3640 /* Now turn the rtl into assembler code. */
3642 timevar_push (TV_FINAL);
3647 /* Get the function's name, as described by its RTL. This may be
3648 different from the DECL_NAME name used in the source file. */
3650 x = DECL_RTL (decl);
3651 if (GET_CODE (x) != MEM)
3654 if (GET_CODE (x) != SYMBOL_REF)
3656 fnname = XSTR (x, 0);
3658 assemble_start_function (decl, fnname);
3659 final_start_function (insns, asm_out_file, optimize);
3660 final (insns, asm_out_file, optimize, 0);
3661 final_end_function (insns, asm_out_file, optimize);
3662 assemble_end_function (decl, fnname);
3664 fflush (asm_out_file);
3666 /* Release all memory allocated by flow. */
3667 free_basic_block_vars (0);
3669 /* Release all memory held by regsets now. */
3670 regset_release_memory ();
3672 timevar_pop (TV_FINAL);
3677 /* Write DBX symbols if requested. */
3679 /* Note that for those inline functions where we don't initially
3680 know for certain that we will be generating an out-of-line copy,
3681 the first invocation of this routine (rest_of_compilation) will
3682 skip over this code by doing a `goto exit_rest_of_compilation;'.
3683 Later on, finish_compilation will call rest_of_compilation again
3684 for those inline functions that need to have out-of-line copies
3685 generated. During that call, we *will* be routed past here. */
3687 timevar_push (TV_SYMOUT);
3688 #ifdef DBX_DEBUGGING_INFO
3689 if (write_symbols == DBX_DEBUG)
3690 dbxout_function (decl);
3693 #ifdef DWARF_DEBUGGING_INFO
3694 if (write_symbols == DWARF_DEBUG)
3695 dwarfout_file_scope_decl (decl, 0);
3698 #ifdef DWARF2_DEBUGGING_INFO
3699 if (write_symbols == DWARF2_DEBUG)
3700 dwarf2out_decl (decl);
3702 timevar_pop (TV_SYMOUT);
3704 exit_rest_of_compilation:
3706 /* In case the function was not output,
3707 don't leave any temporary anonymous types
3708 queued up for sdb output. */
3709 #ifdef SDB_DEBUGGING_INFO
3710 if (write_symbols == SDB_DEBUG)
3711 sdbout_types (NULL_TREE);
3714 reload_completed = 0;
3715 flow2_completed = 0;
3718 timevar_push (TV_FINAL);
3720 /* Clear out the insn_length contents now that they are no
3722 init_insn_lengths ();
3724 /* Clear out the real_constant_chain before some of the rtx's
3725 it runs through become garbage. */
3726 clear_const_double_mem ();
3728 /* Cancel the effect of rtl_in_current_obstack. */
3729 resume_temporary_allocation ();
3731 /* Show no temporary slots allocated. */
3734 free_basic_block_vars (0);
3736 timevar_pop (TV_FINAL);
3738 /* Make sure volatile mem refs aren't considered valid operands for
3739 arithmetic insns. We must call this here if this is a nested inline
3740 function, since the above code leaves us in the init_recog state
3741 (from final.c), and the function context push/pop code does not
3742 save/restore volatile_ok.
3744 ??? Maybe it isn't necessary for expand_start_function to call this
3745 anymore if we do it here? */
3747 init_recog_no_volatile ();
3749 /* We're done with this function. Free up memory if we can. */
3750 free_after_parsing (cfun);
3751 if (! DECL_DEFER_OUTPUT (decl))
3752 free_after_compilation (cfun);
3758 timevar_pop (TV_REST_OF_COMPILATION);
3769 printf (_("Usage: %s input [switches]\n"), progname);
3770 printf (_("Switches:\n"));
3772 printf (_(" -ffixed-<register> Mark <register> as being unavailable to the compiler\n"));
3773 printf (_(" -fcall-used-<register> Mark <register> as being corrupted by function calls\n"));
3774 printf (_(" -fcall-saved-<register> Mark <register> as being preserved across functions\n"));
3775 printf (_(" -finline-limit=<number> Limits the size of inlined functions to <number>\n"));
3776 printf (_(" -fmessage-length=<number> Limits diagnostics messages lengths to <number> characters per line. 0 suppresses line-wrapping\n"));
3777 printf (_(" -fdiagnostics-show-location=[once | never] Indicates how often source location information should be emitted, as prefix, at the beginning of diagnostics when line-wrapping\n"));
3779 for (i = ARRAY_SIZE (f_options); i--;)
3781 const char *description = f_options[i].description;
3783 if (description != NULL && * description != 0)
3784 printf (" -f%-21s %s\n",
3785 f_options[i].string, description);
3788 printf (_(" -O[number] Set optimisation level to [number]\n"));
3789 printf (_(" -Os Optimise for space rather than speed\n"));
3790 printf (_(" -pedantic Issue warnings needed by strict compliance to ISO C\n"));
3791 printf (_(" -pedantic-errors Like -pedantic except that errors are produced\n"));
3792 printf (_(" -w Suppress warnings\n"));
3793 printf (_(" -W Enable extra warnings\n"));
3795 for (i = ARRAY_SIZE (W_options); i--;)
3797 const char *description = W_options[i].description;
3799 if (description != NULL && * description != 0)
3800 printf (" -W%-21s %s\n",
3801 W_options[i].string, description);
3804 printf (_(" -Wunused Enable unused warnings\n"));
3805 printf (_(" -Wid-clash-<num> Warn if 2 identifiers have the same first <num> chars\n"));
3806 printf (_(" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n"));
3807 printf (_(" -p Enable function profiling\n"));
3808 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER)
3809 printf (_(" -a Enable block profiling \n"));
3811 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER) || defined FUNCTION_BLOCK_PROFILER_EXIT
3812 printf (_(" -ax Enable jump profiling \n"));
3814 printf (_(" -o <file> Place output into <file> \n"));
3816 -G <number> Put global and static data smaller than <number>\n\
3817 bytes into a special section (on some targets)\n"));
3819 for (i = ARRAY_SIZE (debug_args); i--;)
3821 if (debug_args[i].description != NULL)
3822 printf (" -g%-21s %s\n",
3823 debug_args[i].arg, debug_args[i].description);
3826 printf (_(" -aux-info <file> Emit declaration info into <file>.X\n"));
3827 printf (_(" -quiet Do not display functions compiled or elapsed time\n"));
3828 printf (_(" -version Display the compiler's version\n"));
3829 printf (_(" -d[letters] Enable dumps from specific passes of the compiler\n"));
3830 printf (_(" -dumpbase <file> Base name to be used for dumps from specific passes\n"));
3831 #if defined INSN_SCHEDULING
3832 printf (_(" -fsched-verbose=<number> Set the verbosity level of the scheduler\n"));
3834 printf (_(" --help Display this information\n"));
3839 /* Display descriptions of language specific options.
3840 If there is no description, note that there is an undocumented option.
3841 If the description is empty, do not display anything. (This allows
3842 options to be deliberately undocumented, for whatever reason).
3843 If the option string is missing, then this is a marker, indicating
3844 that the description string is in fact the name of a language, whose
3845 language specific options are to follow. */
3847 if (ARRAY_SIZE (documented_lang_options) > 1)
3849 printf (_("\nLanguage specific options:\n"));
3851 for (i = 0; i < ARRAY_SIZE (documented_lang_options); i++)
3853 const char *description = documented_lang_options[i].description;
3854 const char *option = documented_lang_options[i].option;
3856 if (description == NULL)
3861 printf (_(" %-23.23s [undocumented]\n"), option);
3863 else if (*description == 0)
3865 else if (option == NULL)
3869 (_("\nThere are undocumented %s specific options as well.\n"),
3873 printf (_("\n Options for %s:\n"), description);
3878 printf (" %-23.23s %s\n", option, description);
3883 printf (_("\nThere are undocumented %s specific options as well.\n"),
3886 if (ARRAY_SIZE (target_switches) > 1
3887 #ifdef TARGET_OPTIONS
3888 || ARRAY_SIZE (target_options) > 1
3896 printf (_("\nTarget specific options:\n"));
3898 for (i = ARRAY_SIZE (target_switches); i--;)
3900 const char *option = target_switches[i].name;
3901 const char *description = target_switches[i].description;
3903 if (option == NULL || *option == 0)
3905 else if (description == NULL)
3910 printf (_(" -m%-21.21s [undocumented]\n"), option);
3912 else if (* description != 0)
3913 doc += printf (" -m%-21.21s %s\n", option, description);
3916 #ifdef TARGET_OPTIONS
3917 for (i = ARRAY_SIZE (target_options); i--;)
3919 const char *option = target_options[i].prefix;
3920 const char *description = target_options[i].description;
3922 if (option == NULL || *option == 0)
3924 else if (description == NULL)
3929 printf (_(" -m%-21.21s [undocumented]\n"), option);
3931 else if (* description != 0)
3932 doc += printf (" -m%-21.21s %s\n", option, description);
3938 printf (_("\nThere are undocumented target specific options as well.\n"));
3940 printf (_(" They exist, but they are not documented.\n"));
3945 /* Parse a -d... comand line switch. */
3948 decode_d_option (arg)
3957 for (i = 0; i < DFI_MAX; ++i)
3958 dump_file[i].enabled = 1;
3967 flag_print_asm_name = 1;
3970 graph_dump_format = vcg;
3973 rtl_dump_and_exit = 1;
3978 case 'D': /* These are handled by the preprocessor. */
3984 for (i = 0; i < DFI_MAX; ++i)
3985 if (c == dump_file[i].debug_switch)
3987 dump_file[i].enabled = 1;
3992 warning ("unrecognized gcc debugging option: %c", c);
3997 /* Parse a -f... comand line switch. ARG is the value after the -f.
3998 It is safe to access 'ARG - 2' to generate the full switch name.
3999 Return the number of strings consumed. */
4002 decode_f_option (arg)
4006 const char *option_value = NULL;
4008 /* Search for the option in the table of binary f options. */
4009 for (j = ARRAY_SIZE (f_options); j--;)
4011 if (!strcmp (arg, f_options[j].string))
4013 *f_options[j].variable = f_options[j].on_value;
4017 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4018 && ! strcmp (arg + 3, f_options[j].string))
4020 *f_options[j].variable = ! f_options[j].on_value;
4025 if ((option_value = skip_leading_substring (arg, "inline-limit-"))
4026 || (option_value = skip_leading_substring (arg, "inline-limit=")))
4028 read_integral_parameter (option_value, arg - 2, inline_max_insns);
4029 #ifdef INSN_SCHEDULING
4030 else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
4031 fix_sched_param ("verbose", option_value);
4033 else if ((option_value = skip_leading_substring (arg, "fixed-")))
4034 fix_register (option_value, 1, 1);
4035 else if ((option_value = skip_leading_substring (arg, "call-used-")))
4036 fix_register (option_value, 0, 1);
4037 else if ((option_value = skip_leading_substring (arg, "call-saved-")))
4038 fix_register (option_value, 0, 0);
4039 else if ((option_value = skip_leading_substring (arg, "align-loops=")))
4040 align_loops = read_integral_parameter (option_value, arg - 2, align_loops);
4041 else if ((option_value = skip_leading_substring (arg, "align-functions=")))
4043 = read_integral_parameter (option_value, arg - 2, align_functions);
4044 else if ((option_value = skip_leading_substring (arg, "align-jumps=")))
4045 align_jumps = read_integral_parameter (option_value, arg - 2, align_jumps);
4046 else if ((option_value = skip_leading_substring (arg, "align-labels=")))
4048 = read_integral_parameter (option_value, arg - 2, align_labels);
4049 else if ((option_value
4050 = skip_leading_substring (arg, "stack-limit-register=")))
4052 int reg = decode_reg_name (option_value);
4054 error ("unrecognized register name `%s'", option_value);
4056 stack_limit_rtx = gen_rtx_REG (Pmode, reg);
4058 else if ((option_value
4059 = skip_leading_substring (arg, "stack-limit-symbol=")))
4063 nm = ggc_alloc_string (option_value, strlen (option_value));
4065 nm = xstrdup (option_value);
4066 stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
4068 else if ((option_value
4069 = skip_leading_substring (arg, "message-length=")))
4070 diagnostic_message_length_per_line =
4071 read_integral_parameter (option_value, arg - 2,
4072 diagnostic_message_length_per_line);
4073 else if ((option_value
4074 = skip_leading_substring (arg, "diagnostics-show-location=")))
4076 if (!strcmp (option_value, "once"))
4077 set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_ONCE);
4078 else if (!strcmp (option_value, "every-line"))
4079 set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE);
4081 error ("Unrecognized option `%s'", arg - 2);
4083 else if (!strcmp (arg, "no-stack-limit"))
4084 stack_limit_rtx = NULL_RTX;
4085 else if (!strcmp (arg, "preprocessed"))
4086 /* Recognise this switch but do nothing. This prevents warnings
4087 about an unrecognized switch if cpplib has not been linked in. */
4095 /* Parse a -W... comand line switch. ARG is the value after the -W.
4096 It is safe to access 'ARG - 2' to generate the full switch name.
4097 Return the number of strings consumed. */
4100 decode_W_option (arg)
4103 const char *option_value = NULL;
4106 /* Search for the option in the table of binary W options. */
4108 for (j = ARRAY_SIZE (W_options); j--;)
4110 if (!strcmp (arg, W_options[j].string))
4112 *W_options[j].variable = W_options[j].on_value;
4116 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4117 && ! strcmp (arg + 3, W_options[j].string))
4119 *W_options[j].variable = ! W_options[j].on_value;
4124 if ((option_value = skip_leading_substring (arg, "id-clash-")))
4126 id_clash_len = read_integral_parameter (option_value, arg - 2, -1);
4128 if (id_clash_len != -1)
4131 else if ((option_value = skip_leading_substring (arg, "larger-than-")))
4133 larger_than_size = read_integral_parameter (option_value, arg - 2, -1);
4135 if (larger_than_size != -1)
4136 warn_larger_than = 1;
4138 else if (!strcmp (arg, "unused"))
4142 else if (!strcmp (arg, "no-unused"))
4152 /* Parse a -g... comand line switch. ARG is the value after the -g.
4153 It is safe to access 'ARG - 2' to generate the full switch name.
4154 Return the number of strings consumed. */
4157 decode_g_option (arg)
4161 /* A lot of code assumes write_symbols == NO_DEBUG if the
4162 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4163 of what debugging type has been selected). This records the
4164 selected type. It is an error to specify more than one
4166 static enum debug_info_type selected_debug_type = NO_DEBUG;
4167 /* Non-zero if debugging format has been explicitly set.
4168 -g and -ggdb don't explicitly set the debugging format so
4169 -gdwarf -g3 is equivalent to -gdwarf3. */
4170 static int type_explicitly_set_p = 0;
4171 /* Indexed by enum debug_info_type. */
4172 static const char *debug_type_names[] =
4174 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4177 /* The maximum admissible debug level value. */
4178 static const unsigned max_debug_level = 3;
4180 /* Look up ARG in the table. */
4181 for (da = debug_args; da->arg; da++)
4183 const int da_len = strlen (da->arg);
4185 if (da_len == 0 || ! strncmp (arg, da->arg, da_len))
4187 enum debug_info_type type = da->debug_type;
4188 const char *p = arg + da_len;
4190 if (*p && (*p < '0' || *p > '9'))
4193 /* A debug flag without a level defaults to level 2.
4194 Note we do not want to call read_integral_parameter
4195 for that case since it will call atoi which
4198 ??? We may want to generalize the interface to
4199 read_integral_parameter to better handle this case
4200 if this case shows up often. */
4202 level = read_integral_parameter (p, 0, max_debug_level + 1);
4206 if (da_len > 1 && *p && !strncmp (arg, "dwarf", da_len))
4208 error ("use -gdwarf -g%d for DWARF v1, level %d",
4211 error ("use -gdwarf-2 for DWARF v2");
4214 if (level > max_debug_level)
4217 ignoring option `%s' due to invalid debug level specification",
4219 level = debug_info_level;
4222 if (type == NO_DEBUG)
4224 type = PREFERRED_DEBUGGING_TYPE;
4226 if (da_len > 1 && strncmp (arg, "gdb", da_len) == 0)
4228 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4229 type = DWARF2_DEBUG;
4231 #ifdef DBX_DEBUGGING_INFO
4238 if (type == NO_DEBUG)
4239 warning ("`%s': unknown or unsupported -g option", arg - 2);
4241 /* Does it conflict with an already selected type? */
4242 if (type_explicitly_set_p
4243 /* -g/-ggdb don't conflict with anything. */
4244 && da->debug_type != NO_DEBUG
4245 && type != selected_debug_type)
4246 warning ("`%s' ignored, conflicts with `-g%s'",
4247 arg - 2, debug_type_names[(int) selected_debug_type]);
4250 /* If the format has already been set, -g/-ggdb
4251 only change the debug level. */
4252 if (type_explicitly_set_p && da->debug_type == NO_DEBUG)
4253 /* Don't change debugging type. */
4257 selected_debug_type = type;
4258 type_explicitly_set_p = da->debug_type != NO_DEBUG;
4261 write_symbols = (level == 0
4263 : selected_debug_type);
4264 use_gnu_debug_info_extensions = da->use_extensions_p;
4265 debug_info_level = (enum debug_info_level) level;
4278 /* Decode the first argument in the argv as a language-independent option.
4279 Return the number of strings consumed. */
4282 independent_decode_option (argc, argv)
4286 char *arg = argv[0];
4288 if (arg[0] != '-' || arg[1] == 0)
4300 if (!strcmp (arg, "-help"))
4315 /* Already been treated in main (). Do nothing. */
4319 set_target_switch (arg + 1);
4323 return decode_f_option (arg + 1);
4326 return decode_g_option (arg + 1);
4329 if (!strcmp (arg, "dumpbase"))
4334 dump_base_name = argv[1];
4338 decode_d_option (arg + 1);
4342 if (!strcmp (arg, "pedantic"))
4344 else if (!strcmp (arg, "pedantic-errors"))
4345 flag_pedantic_errors = pedantic = 1;
4346 else if (arg[1] == 0)
4353 if (!strcmp (arg, "quiet"))
4360 if (!strcmp (arg, "version"))
4368 inhibit_warnings = 1;
4377 /* We save the value of warn_uninitialized, since if they put
4378 -Wuninitialized on the command line, we need to generate a
4379 warning about not using it without also specifying -O. */
4380 if (warn_uninitialized != 1)
4381 warn_uninitialized = 2;
4384 return decode_W_option (arg + 1);
4390 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4391 warning ("`-a' option (basic block profile) not supported");
4393 profile_block_flag = (profile_block_flag < 2) ? 1 : 3;
4396 else if (!strcmp (arg, "ax"))
4398 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4399 warning ("`-ax' option (jump profiling) not supported");
4401 profile_block_flag = (!profile_block_flag
4402 || profile_block_flag == 2) ? 2 : 3;
4405 else if (!strncmp (arg, "aux-info", 8))
4407 flag_gen_aux_info = 1;
4413 aux_info_file_name = argv[1];
4417 aux_info_file_name = arg + 8;
4429 asm_file_name = argv[1];
4444 g_switch_val = read_integral_parameter (argv[1], 0, -1);
4449 g_switch_val = read_integral_parameter (arg + 1, 0, -1);
4453 if (g_switch_val == -1)
4457 g_switch_set = TRUE;
4458 g_switch_value = g_switch_val;
4468 /* Entry point of cc1/c++. Decode command args, then call compile_file.
4469 Exit code is 35 if can't open files, 34 if fatal error,
4470 33 if had nonfatal errors, else success. */
4472 extern int main PARAMS ((int, char **));
4482 /* save in case md file wants to emit args as a comment. */
4486 p = argv[0] + strlen (argv[0]);
4487 while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
4491 #ifdef HAVE_LC_MESSAGES
4492 setlocale (LC_MESSAGES, "");
4494 (void) bindtextdomain (PACKAGE, localedir);
4495 (void) textdomain (PACKAGE);
4497 /* Install handler for SIGFPE, which may be received while we do
4498 compile-time floating point arithmetic. */
4499 signal (SIGFPE, float_signal);
4501 /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */
4503 signal (SIGSEGV, crash_signal);
4506 signal (SIGILL, crash_signal);
4509 signal (SIGBUS, crash_signal);
4512 signal (SIGABRT, crash_signal);
4514 #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
4515 signal (SIGIOT, crash_signal);
4518 decl_printable_name = decl_name;
4519 lang_expand_expr = (lang_expand_expr_t) do_abort;
4521 /* Initialize whether `char' is signed. */
4522 flag_signed_char = DEFAULT_SIGNED_CHAR;
4523 #ifdef DEFAULT_SHORT_ENUMS
4524 /* Initialize how much space enums occupy, by default. */
4525 flag_short_enums = DEFAULT_SHORT_ENUMS;
4528 /* Initialize the garbage-collector. */
4530 ggc_add_root (&input_file_stack, 1, sizeof input_file_stack,
4532 ggc_add_rtx_root (&stack_limit_rtx, 1);
4533 ggc_add_tree_root (¤t_function_decl, 1);
4534 ggc_add_tree_root (¤t_function_func_begin_label, 1);
4536 /* Initialize the diagnostics reporting machinery. */
4537 initialize_diagnostics ();
4539 /* Perform language-specific options intialization. */
4540 lang_init_options ();
4542 /* Scan to see what optimization level has been specified. That will
4543 determine the default value of many flags. */
4544 for (i = 1; i < argc; i++)
4546 if (!strcmp (argv[i], "-O"))
4551 else if (argv[i][0] == '-' && argv[i][1] == 'O')
4553 /* Handle -Os, -O2, -O3, -O69, ... */
4554 char *p = &argv[i][2];
4556 if ((p[0] == 's') && (p[1] == 0))
4560 /* Optimizing for size forces optimize to be 2. */
4565 const int optimize_val = read_integral_parameter (p, p - 2, -1);
4566 if (optimize_val != -1)
4568 optimize = optimize_val;
4578 flag_thread_jumps = 1;
4580 flag_delayed_branch = 1;
4582 #ifdef CAN_DEBUG_WITHOUT_FP
4583 flag_omit_frame_pointer = 1;
4589 flag_optimize_sibling_calls = 1;
4590 flag_cse_follow_jumps = 1;
4591 flag_cse_skip_blocks = 1;
4593 flag_expensive_optimizations = 1;
4594 flag_strength_reduce = 1;
4595 flag_rerun_cse_after_loop = 1;
4596 flag_rerun_loop_opt = 1;
4597 flag_caller_saves = 1;
4600 #ifdef INSN_SCHEDULING
4601 flag_schedule_insns = 1;
4602 flag_schedule_insns_after_reload = 1;
4605 flag_strict_aliasing = 1;
4606 flag_delete_null_pointer_checks = 1;
4607 flag_reorder_blocks = 1;
4612 flag_inline_functions = 1;
4615 if (optimize < 2 || optimize_size)
4620 align_functions = 1;
4623 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
4626 set_target_switch ("");
4628 /* Unwind tables are always present in an ABI-conformant IA-64
4629 object file, so the default should be ON. */
4630 #ifdef IA64_UNWIND_INFO
4631 flag_unwind_tables = IA64_UNWIND_INFO;
4634 #ifdef OPTIMIZATION_OPTIONS
4635 /* Allow default optimizations to be specified on a per-machine basis. */
4636 OPTIMIZATION_OPTIONS (optimize, optimize_size);
4639 /* Initialize register usage now so switches may override. */
4642 /* Perform normal command line switch decoding. */
4643 for (i = 1; i < argc;)
4645 unsigned int lang_processed;
4646 unsigned int indep_processed;
4648 /* Give the language a chance to decode the option for itself. */
4649 lang_processed = lang_decode_option (argc - i, argv + i);
4651 /* Now see if the option also has a language independent meaning.
4652 Some options are both language specific and language independent,
4654 indep_processed = independent_decode_option (argc - i, argv + i);
4656 if (lang_processed || indep_processed)
4657 i += MAX (lang_processed, indep_processed);
4660 const char *option = NULL;
4661 const char *lang = NULL;
4664 /* It is possible that the command line switch is not valid for the
4665 current language, but it is valid for another language. In order
4666 to be compatible with previous versions of the compiler (which
4667 did not issue an error message in this case) we check for this
4668 possibility here. If we do find a match, then if extra_warnings
4669 is set we generate a warning message, otherwise we will just
4670 ignore the option. */
4671 for (j = 0; j < ARRAY_SIZE (documented_lang_options); j++)
4673 option = documented_lang_options[j].option;
4676 lang = documented_lang_options[j].description;
4677 else if (! strncmp (argv[i], option, strlen (option)))
4681 if (j != ARRAY_SIZE (documented_lang_options))
4685 warning ("Ignoring command line option '%s'", argv[i]);
4688 ("(It is valid for %s but not the selected language)",
4692 else if (argv[i][0] == '-' && argv[i][1] == 'g')
4693 warning ("`%s': unknown or unsupported -g option", &argv[i][2]);
4695 error ("Unrecognized option `%s'", argv[i]);
4701 /* Reflect any language-specific diagnostic option setting. */
4702 reshape_diagnostic_buffer ();
4704 /* Checker uses the frame pointer. */
4705 if (flag_check_memory_usage)
4706 flag_omit_frame_pointer = 0;
4710 /* Inlining does not work if not optimizing,
4711 so force it not to be done. */
4715 /* The c_decode_option and lang_decode_option functions set
4716 this to `2' if -Wall is used, so we can avoid giving out
4717 lots of errors for people who don't realize what -Wall does. */
4718 if (warn_uninitialized == 1)
4719 warning ("-Wuninitialized is not supported without -O");
4722 #ifdef OVERRIDE_OPTIONS
4723 /* Some machines may reject certain combinations of options. */
4727 if (exceptions_via_longjmp == 2)
4729 #ifdef DWARF2_UNWIND_INFO
4730 exceptions_via_longjmp = ! DWARF2_UNWIND_INFO;
4732 #ifdef IA64_UNWIND_INFO
4733 exceptions_via_longjmp = ! IA64_UNWIND_INFO;
4735 exceptions_via_longjmp = 1;
4740 /* Since each function gets its own handler data, we can't support the
4741 new model currently, since it depend on a specific rethrow label
4742 which is declared at the front of the table, and we can only
4743 have one such symbol in a file. */
4744 #ifdef IA64_UNWIND_INFO
4745 flag_new_exceptions = 0;
4748 /* Set up the align_*_log variables, defaulting them to 1 if they
4749 were still unset. */
4750 if (align_loops <= 0) align_loops = 1;
4751 align_loops_log = floor_log2 (align_loops * 2 - 1);
4752 if (align_jumps <= 0) align_jumps = 1;
4753 align_jumps_log = floor_log2 (align_jumps * 2 - 1);
4754 if (align_labels <= 0) align_labels = 1;
4755 align_labels_log = floor_log2 (align_labels * 2 - 1);
4756 if (align_functions <= 0) align_functions = 1;
4757 align_functions_log = floor_log2 (align_functions * 2 - 1);
4759 if (profile_block_flag == 3)
4761 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4762 profile_block_flag = 2;
4765 /* Unrolling all loops implies that standard loop unrolling must also
4767 if (flag_unroll_all_loops)
4768 flag_unroll_loops = 1;
4769 /* Loop unrolling requires that strength_reduction be on also. Silently
4770 turn on strength reduction here if it isn't already on. Also, the loop
4771 unrolling code assumes that cse will be run after loop, so that must
4772 be turned on also. */
4773 if (flag_unroll_loops)
4775 flag_strength_reduce = 1;
4776 flag_rerun_cse_after_loop = 1;
4779 /* Warn about options that are not supported on this machine. */
4780 #ifndef INSN_SCHEDULING
4781 if (flag_schedule_insns || flag_schedule_insns_after_reload)
4782 warning ("instruction scheduling not supported on this target machine");
4785 if (flag_delayed_branch)
4786 warning ("this target machine does not have delayed branches");
4789 user_label_prefix = USER_LABEL_PREFIX;
4790 if (flag_leading_underscore != -1)
4792 /* If the default prefix is more complicated than "" or "_",
4793 issue a warning and ignore this option. */
4794 if (user_label_prefix[0] == 0 ||
4795 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
4797 user_label_prefix = flag_leading_underscore ? "_" : "";
4800 warning ("-f%sleading-underscore not supported on this target machine",
4801 flag_leading_underscore ? "" : "no-");
4804 /* If we are in verbose mode, write out the version and maybe all the
4805 option flags in use. */
4808 print_version (stderr, "");
4810 print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
4813 compile_file (filename);
4815 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__)) && !defined(__INTERIX)
4818 char *lim = (char *) sbrk (0);
4820 fnotice (stderr, "Data size %ld.\n", (long) (lim - (char *) &environ));
4825 system ("ps -l 1>&2");
4828 #endif /* not USG */
4831 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX */
4834 return (FATAL_EXIT_CODE);
4836 return (FATAL_EXIT_CODE);
4837 return (SUCCESS_EXIT_CODE);
4840 /* Decode -m switches. */
4841 /* Decode the switch -mNAME. */
4844 set_target_switch (name)
4848 int valid_target_option = 0;
4850 for (j = 0; j < ARRAY_SIZE (target_switches); j++)
4851 if (!strcmp (target_switches[j].name, name))
4853 if (target_switches[j].value < 0)
4854 target_flags &= ~-target_switches[j].value;
4856 target_flags |= target_switches[j].value;
4857 valid_target_option = 1;
4860 #ifdef TARGET_OPTIONS
4861 if (!valid_target_option)
4862 for (j = 0; j < ARRAY_SIZE (target_options); j++)
4864 int len = strlen (target_options[j].prefix);
4865 if (!strncmp (target_options[j].prefix, name, len))
4867 *target_options[j].variable = name + len;
4868 valid_target_option = 1;
4873 if (!valid_target_option)
4874 error ("Invalid option `%s'", name);
4877 /* Print version information to FILE.
4878 Each line begins with INDENT (for the case where FILE is the
4879 assembler output file). */
4882 print_version (file, indent)
4887 #define __VERSION__ "[?]"
4891 "%s%s%s version %s (%s) compiled by GNU C version %s.\n"
4893 "%s%s%s version %s (%s) compiled by CC.\n"
4895 , indent, *indent != 0 ? " " : "",
4896 language_string, version_string, TARGET_NAME, __VERSION__);
4899 /* Print an option value and return the adjusted position in the line.
4900 ??? We don't handle error returns from fprintf (disk full); presumably
4901 other code will catch a disk full though. */
4904 print_single_switch (file, pos, max, indent, sep, term, type, name)
4907 const char *indent, *sep, *term, *type, *name;
4909 /* The ultrix fprintf returns 0 on success, so compute the result we want
4910 here since we need it for the following test. */
4911 int len = strlen (sep) + strlen (type) + strlen (name);
4916 fprintf (file, "%s", term);
4921 fprintf (file, "%s", indent);
4922 pos = strlen (indent);
4924 fprintf (file, "%s%s%s", sep, type, name);
4929 /* Print active target switches to FILE.
4930 POS is the current cursor position and MAX is the size of a "line".
4931 Each line begins with INDENT and ends with TERM.
4932 Each switch is separated from the next by SEP. */
4935 print_switch_values (file, pos, max, indent, sep, term)
4938 const char *indent, *sep, *term;
4943 /* Print the options as passed. */
4945 pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
4946 _("options passed: "), "");
4948 for (p = &save_argv[1]; *p != NULL; p++)
4952 if (strcmp (*p, "-o") == 0)
4958 if (strcmp (*p, "-quiet") == 0)
4960 if (strcmp (*p, "-version") == 0)
4965 pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
4968 fprintf (file, "%s", term);
4970 /* Print the -f and -m options that have been enabled.
4971 We don't handle language specific options but printing argv
4974 pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
4975 _("options enabled: "), "");
4977 for (j = 0; j < ARRAY_SIZE (f_options); j++)
4978 if (*f_options[j].variable == f_options[j].on_value)
4979 pos = print_single_switch (file, pos, max, indent, sep, term,
4980 "-f", f_options[j].string);
4982 /* Print target specific options. */
4984 for (j = 0; j < ARRAY_SIZE (target_switches); j++)
4985 if (target_switches[j].name[0] != '\0'
4986 && target_switches[j].value > 0
4987 && ((target_switches[j].value & target_flags)
4988 == target_switches[j].value))
4990 pos = print_single_switch (file, pos, max, indent, sep, term,
4991 "-m", target_switches[j].name);
4994 #ifdef TARGET_OPTIONS
4995 for (j = 0; j < ARRAY_SIZE (target_options); j++)
4996 if (*target_options[j].variable != NULL)
4999 sprintf (prefix, "-m%s", target_options[j].prefix);
5000 pos = print_single_switch (file, pos, max, indent, sep, term,
5001 prefix, *target_options[j].variable);
5005 fprintf (file, "%s", term);
5008 /* Record the beginning of a new source file, named FILENAME. */
5011 debug_start_source_file (filename)
5012 register const char *filename ATTRIBUTE_UNUSED;
5014 #ifdef DBX_DEBUGGING_INFO
5015 if (write_symbols == DBX_DEBUG)
5016 dbxout_start_new_source_file (filename);
5018 #ifdef DWARF_DEBUGGING_INFO
5019 if (debug_info_level == DINFO_LEVEL_VERBOSE
5020 && write_symbols == DWARF_DEBUG)
5021 dwarfout_start_new_source_file (filename);
5022 #endif /* DWARF_DEBUGGING_INFO */
5023 #ifdef DWARF2_DEBUGGING_INFO
5024 if (write_symbols == DWARF2_DEBUG)
5025 dwarf2out_start_source_file (filename);
5026 #endif /* DWARF2_DEBUGGING_INFO */
5027 #ifdef SDB_DEBUGGING_INFO
5028 if (write_symbols == SDB_DEBUG)
5029 sdbout_start_new_source_file (filename);
5033 /* Record the resumption of a source file. LINENO is the line number in
5034 the source file we are returning to. */
5037 debug_end_source_file (lineno)
5038 register unsigned lineno ATTRIBUTE_UNUSED;
5040 #ifdef DBX_DEBUGGING_INFO
5041 if (write_symbols == DBX_DEBUG)
5042 dbxout_resume_previous_source_file ();
5044 #ifdef DWARF_DEBUGGING_INFO
5045 if (debug_info_level == DINFO_LEVEL_VERBOSE
5046 && write_symbols == DWARF_DEBUG)
5047 dwarfout_resume_previous_source_file (lineno);
5048 #endif /* DWARF_DEBUGGING_INFO */
5049 #ifdef DWARF2_DEBUGGING_INFO
5050 if (write_symbols == DWARF2_DEBUG)
5051 dwarf2out_end_source_file ();
5052 #endif /* DWARF2_DEBUGGING_INFO */
5053 #ifdef SDB_DEBUGGING_INFO
5054 if (write_symbols == SDB_DEBUG)
5055 sdbout_resume_previous_source_file ();
5059 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5060 the tail part of the directive line, i.e. the part which is past the
5061 initial whitespace, #, whitespace, directive-name, whitespace part. */
5064 debug_define (lineno, buffer)
5065 register unsigned lineno ATTRIBUTE_UNUSED;
5066 register char *buffer ATTRIBUTE_UNUSED;
5068 #ifdef DWARF_DEBUGGING_INFO
5069 if (debug_info_level == DINFO_LEVEL_VERBOSE
5070 && write_symbols == DWARF_DEBUG)
5071 dwarfout_define (lineno, buffer);
5072 #endif /* DWARF_DEBUGGING_INFO */
5073 #ifdef DWARF2_DEBUGGING_INFO
5074 if (debug_info_level == DINFO_LEVEL_VERBOSE
5075 && write_symbols == DWARF2_DEBUG)
5076 dwarf2out_define (lineno, buffer);
5077 #endif /* DWARF2_DEBUGGING_INFO */
5080 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5081 the tail part of the directive line, i.e. the part which is past the
5082 initial whitespace, #, whitespace, directive-name, whitespace part. */
5085 debug_undef (lineno, buffer)
5086 register unsigned lineno ATTRIBUTE_UNUSED;
5087 register char *buffer ATTRIBUTE_UNUSED;
5089 #ifdef DWARF_DEBUGGING_INFO
5090 if (debug_info_level == DINFO_LEVEL_VERBOSE
5091 && write_symbols == DWARF_DEBUG)
5092 dwarfout_undef (lineno, buffer);
5093 #endif /* DWARF_DEBUGGING_INFO */
5094 #ifdef DWARF2_DEBUGGING_INFO
5095 if (debug_info_level == DINFO_LEVEL_VERBOSE
5096 && write_symbols == DWARF2_DEBUG)
5097 dwarf2out_undef (lineno, buffer);
5098 #endif /* DWARF2_DEBUGGING_INFO */
5101 /* Returns nonzero if it is appropriate not to emit any debugging
5102 information for BLOCK, because it doesn't contain any instructions.
5103 This may not be the case for blocks containing nested functions, since
5104 we may actually call such a function even though the BLOCK information
5108 debug_ignore_block (block)
5109 tree block ATTRIBUTE_UNUSED;
5111 /* Never delete the BLOCK for the outermost scope
5112 of the function; we can refer to names from
5113 that scope even if the block notes are messed up. */
5114 if (is_body_block (block))
5117 #ifdef DWARF2_DEBUGGING_INFO
5118 if (write_symbols == DWARF2_DEBUG)
5119 return dwarf2out_ignore_block (block);