1 /* Top level of GNU C compiler
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001 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"
57 #include "basic-block.h"
64 #include "diagnostic.h"
67 #ifndef ACCUMULATE_OUTGOING_ARGS
68 #define ACCUMULATE_OUTGOING_ARGS 0
71 #ifdef DWARF_DEBUGGING_INFO
75 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
76 #include "dwarf2out.h"
79 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
83 #ifdef SDB_DEBUGGING_INFO
87 #ifdef XCOFF_DEBUGGING_INFO
92 /* The extra parameters substantially improve the I/O performance. */
95 vms_fopen (fname
, type
)
99 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
100 fixed arguments, which matches ANSI's specification but not VAXCRTL's
101 pre-ANSI implementation. This hack circumvents the mismatch problem. */
102 FILE *(*vmslib_fopen
)() = (FILE *(*)()) fopen
;
105 return (*vmslib_fopen
) (fname
, type
, "mbc=32",
106 "deq=64", "fop=tef", "shr=nil");
108 return (*vmslib_fopen
) (fname
, type
, "mbc=32");
111 #define fopen vms_fopen
114 #ifndef DEFAULT_GDB_EXTENSIONS
115 #define DEFAULT_GDB_EXTENSIONS 1
118 /* If more than one debugging type is supported, you must define
119 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
121 This is one long line cause VAXC can't handle a \-newline. */
122 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
123 #ifndef PREFERRED_DEBUGGING_TYPE
124 You Lose
! You must define PREFERRED_DEBUGGING_TYPE
!
125 #endif /* no PREFERRED_DEBUGGING_TYPE */
126 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
127 so the following code needn't care. */
128 #ifdef DBX_DEBUGGING_INFO
129 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
131 #ifdef SDB_DEBUGGING_INFO
132 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
134 #ifdef DWARF_DEBUGGING_INFO
135 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
137 #ifdef DWARF2_DEBUGGING_INFO
138 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
140 #ifdef XCOFF_DEBUGGING_INFO
141 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
143 #endif /* More than one debugger format enabled. */
145 /* If still not defined, must have been because no debugging formats
147 #ifndef PREFERRED_DEBUGGING_TYPE
148 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
151 #if defined (HAVE_DECL_ENVIRON) && !HAVE_DECL_ENVIRON
152 extern char **environ
;
155 /* Carry information from ASM_DECLARE_OBJECT_NAME
156 to ASM_FINISH_DECLARE_OBJECT. */
158 extern int size_directive_output
;
159 extern tree last_assemble_variable_decl
;
161 static void set_target_switch
PARAMS ((const char *));
162 static const char *decl_name
PARAMS ((tree
, int));
164 static void float_signal
PARAMS ((int)) ATTRIBUTE_NORETURN
;
165 static void crash_signal
PARAMS ((int)) ATTRIBUTE_NORETURN
;
166 #ifdef ASM_IDENTIFY_LANGUAGE
167 /* This might or might not be used in ASM_IDENTIFY_LANGUAGE. */
168 static void output_lang_identify
PARAMS ((FILE *)) ATTRIBUTE_UNUSED
;
170 static void compile_file
PARAMS ((const char *));
171 static void display_help
PARAMS ((void));
172 static void display_target_options
PARAMS ((void));
174 static void decode_d_option
PARAMS ((const char *));
175 static int decode_f_option
PARAMS ((const char *));
176 static int decode_W_option
PARAMS ((const char *));
177 static int decode_g_option
PARAMS ((const char *));
178 static unsigned int independent_decode_option
PARAMS ((int, char **));
180 static void print_version
PARAMS ((FILE *, const char *));
181 static int print_single_switch
PARAMS ((FILE *, int, int, const char *,
182 const char *, const char *,
183 const char *, const char *));
184 static void print_switch_values
PARAMS ((FILE *, int, int, const char *,
185 const char *, const char *));
187 /* Length of line when printing switch values. */
190 /* Name of program invoked, sans directories. */
192 const char *progname
;
194 /* Copy of arguments to main. */
198 /* Name of current original source file (what was input to cpp).
199 This comes from each #-command in the actual input. */
201 const char *input_filename
;
203 /* Name of top-level original source file (what was input to cpp).
204 This comes from the #-command at the beginning of the actual input.
205 If there isn't any there, then this is the cc1 input file name. */
207 const char *main_input_filename
;
209 /* Current line number in real source file. */
213 /* Nonzero if it is unsafe to create any new pseudo registers. */
216 /* Stack of currently pending input files. */
218 struct file_stack
*input_file_stack
;
220 /* Incremented on each change to input_file_stack. */
221 int input_file_stack_tick
;
223 /* Name to use as base of names for dump output files. */
225 const char *dump_base_name
;
227 /* Bit flags that specify the machine subtype we are compiling for.
228 Bits are tested using macros TARGET_... defined in the tm.h file
229 and set by `-m...' switches. Must be defined in rtlanal.c. */
231 extern int target_flags
;
233 /* Describes a dump file. */
235 struct dump_file_info
237 /* The unique extension to apply, e.g. ".jump". */
238 const char *const extension
;
240 /* The -d<c> character that enables this dump file. */
241 char const debug_switch
;
243 /* True if there is a corresponding graph dump file. */
244 char const graph_dump_p
;
246 /* True if the user selected this dump. */
249 /* True if the files have been initialized (ie truncated). */
253 /* 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 { "postreload", 'o', 1, 0, 0 },
323 { "flow2", 'w', 1, 0, 0 },
324 { "peephole2", 'z', 1, 0, 0 },
325 { "rnreg", 'n', 1, 0, 0 },
326 { "ce2", 'E', 1, 0, 0 },
327 { "sched2", 'R', 1, 0, 0 },
328 { "bbro", 'B', 1, 0, 0 },
329 { "jump2", 'J', 1, 0, 0 },
330 { "mach", 'M', 1, 0, 0 },
331 { "dbr", 'd', 0, 0, 0 },
332 { "stack", 'k', 1, 0, 0 },
335 static int open_dump_file
PARAMS ((enum dump_file_index
, tree
));
336 static void close_dump_file
PARAMS ((enum dump_file_index
,
337 void (*) (FILE *, rtx
), rtx
));
339 /* Other flags saying which kinds of debugging dump have been requested. */
341 int rtl_dump_and_exit
;
342 int flag_print_asm_name
;
343 static int flag_print_mem
;
344 static int version_flag
;
345 static char *filename
;
346 enum graph_dump_types graph_dump_format
;
348 /* Name for output file of assembly code, specified with -o. */
352 /* Value of the -G xx switch, and whether it was passed or not. */
356 /* Type(s) of debugging information we are producing (if any).
357 See flags.h for the definitions of the different possible
358 types of debugging information. */
359 enum debug_info_type write_symbols
= NO_DEBUG
;
361 /* Level of debugging information we are producing. See flags.h
362 for the definitions of the different possible levels. */
363 enum debug_info_level debug_info_level
= DINFO_LEVEL_NONE
;
365 /* Nonzero means use GNU-only extensions in the generated symbolic
366 debugging information. */
367 /* Currently, this only has an effect when write_symbols is set to
368 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
369 int use_gnu_debug_info_extensions
= 0;
371 /* Nonzero means do optimizations. -O.
372 Particular numeric values stand for particular amounts of optimization;
373 thus, -O2 stores 2 here. However, the optimizations beyond the basic
374 ones are not controlled directly by this variable. Instead, they are
375 controlled by individual `flag_...' variables that are defaulted
376 based on this variable. */
380 /* Nonzero means optimize for size. -Os.
381 The only valid values are zero and non-zero. When optimize_size is
382 non-zero, optimize defaults to 2, but certain individual code
383 bloating optimizations are disabled. */
385 int optimize_size
= 0;
387 /* Number of error messages and warning messages so far. */
390 int warningcount
= 0;
393 /* The FUNCTION_DECL for the function currently being compiled,
394 or 0 if between functions. */
395 tree current_function_decl
;
397 /* Set to the FUNC_BEGIN label of the current function, or NULL_TREE
399 tree current_function_func_begin_label
;
401 /* Pointer to function to compute the name to use to print a declaration.
402 DECL is the declaration in question.
403 VERBOSITY determines what information will be printed:
404 0: DECL_NAME, demangled as necessary.
405 1: and scope information.
406 2: and any other information that might be interesting, such as function
407 parameter types in C++. */
409 const char *(*decl_printable_name
) PARAMS ((tree
, int));
411 /* Pointer to function to compute rtl for a language-specific tree code. */
413 typedef rtx (*lang_expand_expr_t
)
414 PARAMS ((union tree_node
*, rtx
, enum machine_mode
,
415 enum expand_modifier modifier
));
417 lang_expand_expr_t lang_expand_expr
= 0;
419 tree (*lang_expand_constant
) PARAMS ((tree
)) = 0;
421 /* Pointer to function to finish handling an incomplete decl at the
422 end of compilation. */
424 void (*incomplete_decl_finalize_hook
) PARAMS ((tree
)) = 0;
426 /* Nonzero if doing dwarf2 duplicate elimination. */
428 int flag_eliminate_dwarf2_dups
= 0;
430 /* Nonzero if generating code to do profiling. */
432 int profile_flag
= 0;
434 /* Nonzero if generating code to do profiling on a line-by-line basis. */
436 int profile_block_flag
;
438 /* Nonzero if generating code to profile program flow graph arcs. */
440 int profile_arc_flag
= 0;
442 /* Nonzero if generating info for gcov to calculate line test coverage. */
444 int flag_test_coverage
= 0;
446 /* Nonzero indicates that branch taken probabilities should be calculated. */
448 int flag_branch_probabilities
= 0;
450 /* Nonzero if basic blocks should be reordered. */
452 int flag_reorder_blocks
= 0;
454 /* Nonzero if registers should be renamed. */
456 int flag_rename_registers
= 0;
458 /* Nonzero for -pedantic switch: warn about anything
459 that standard spec forbids. */
463 /* Temporarily suppress certain warnings.
464 This is set while reading code from a system header file. */
466 int in_system_header
= 0;
468 /* Don't print functions as they are compiled. -quiet. */
472 /* Print times taken by the various passes. -ftime-report. */
476 /* Print memory still in use at end of compilation (which may have little
477 to do with peak memory consumption). -fmem-report. */
481 /* Non-zero means to collect statistics which might be expensive
482 and to print them when we are done. */
483 int flag_detailed_statistics
= 0;
488 /* Nonzero means `char' should be signed. */
490 int flag_signed_char
;
492 /* Nonzero means give an enum type only as many bytes as it needs. */
494 int flag_short_enums
;
496 /* Nonzero for -fcaller-saves: allocate values in regs that need to
497 be saved across function calls, if that produces overall better code.
498 Optional now, so people can test it. */
500 #ifdef DEFAULT_CALLER_SAVES
501 int flag_caller_saves
= 1;
503 int flag_caller_saves
= 0;
506 /* Nonzero if structures and unions should be returned in memory.
508 This should only be defined if compatibility with another compiler or
509 with an ABI is needed, because it results in slower code. */
511 #ifndef DEFAULT_PCC_STRUCT_RETURN
512 #define DEFAULT_PCC_STRUCT_RETURN 1
515 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
517 int flag_pcc_struct_return
= DEFAULT_PCC_STRUCT_RETURN
;
519 /* Nonzero for -fforce-mem: load memory value into a register
520 before arithmetic on it. This makes better cse but slower compilation. */
522 int flag_force_mem
= 0;
524 /* Nonzero for -fforce-addr: load memory address into a register before
525 reference to memory. This makes better cse but slower compilation. */
527 int flag_force_addr
= 0;
529 /* Nonzero for -fdefer-pop: don't pop args after each function call;
530 instead save them up to pop many calls' args with one insns. */
532 int flag_defer_pop
= 0;
534 /* Nonzero for -ffloat-store: don't allocate floats and doubles
535 in extended-precision registers. */
537 int flag_float_store
= 0;
539 /* Nonzero for -fcse-follow-jumps:
540 have cse follow jumps to do a more extensive job. */
542 int flag_cse_follow_jumps
;
544 /* Nonzero for -fcse-skip-blocks:
545 have cse follow a branch around a block. */
546 int flag_cse_skip_blocks
;
548 /* Nonzero for -fexpensive-optimizations:
549 perform miscellaneous relatively-expensive optimizations. */
550 int flag_expensive_optimizations
;
552 /* Nonzero for -fthread-jumps:
553 have jump optimize output of loop. */
555 int flag_thread_jumps
;
557 /* Nonzero enables strength-reduction in loop.c. */
559 int flag_strength_reduce
= 0;
561 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
562 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
563 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
566 int flag_unroll_loops
;
568 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
569 This is generally not a win. */
571 int flag_unroll_all_loops
;
573 /* Nonzero forces all invariant computations in loops to be moved
576 int flag_move_all_movables
= 0;
578 /* Nonzero forces all general induction variables in loops to be
581 int flag_reduce_all_givs
= 0;
583 /* Nonzero to perform full register move optimization passes. This is the
586 int flag_regmove
= 0;
588 /* Nonzero for -fwritable-strings:
589 store string constants in data segment and don't uniquize them. */
591 int flag_writable_strings
= 0;
593 /* Nonzero means don't put addresses of constant functions in registers.
594 Used for compiling the Unix kernel, where strange substitutions are
595 done on the assembly output. */
597 int flag_no_function_cse
= 0;
599 /* Nonzero for -fomit-frame-pointer:
600 don't make a frame pointer in simple functions that don't require one. */
602 int flag_omit_frame_pointer
= 0;
604 /* Nonzero means place each function into its own section on those platforms
605 which support arbitrary section names and unlimited numbers of sections. */
607 int flag_function_sections
= 0;
609 /* ... and similar for data. */
611 int flag_data_sections
= 0;
613 /* Nonzero to inhibit use of define_optimization peephole opts. */
615 int flag_no_peephole
= 0;
617 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
618 operations in the interest of optimization. For example it allows
619 GCC to assume arguments to sqrt are nonnegative numbers, allowing
620 faster code for sqrt to be generated. */
622 int flag_fast_math
= 0;
624 /* Nonzero allows GCC to optimize sibling and tail recursive calls. */
626 int flag_optimize_sibling_calls
= 0;
628 /* Nonzero means the front end generally wants `errno' maintained by math
629 operations, like built-in SQRT, unless overridden by flag_fast_math. */
631 int flag_errno_math
= 1;
633 /* 0 means straightforward implementation of complex divide acceptable.
634 1 means wide ranges of inputs must work for complex divide.
635 2 means C99-like requirements for complex divide (not yet implemented). */
637 int flag_complex_divide_method
= 0;
639 /* Nonzero means all references through pointers are volatile. */
643 /* Nonzero means treat all global and extern variables as volatile. */
645 int flag_volatile_global
;
647 /* Nonzero means treat all static variables as volatile. */
649 int flag_volatile_static
;
651 /* Nonzero means just do syntax checking; don't output anything. */
653 int flag_syntax_only
= 0;
655 /* Nonzero means perform global cse. */
657 static int flag_gcse
;
659 /* Nonzero means to use global dataflow analysis to eliminate
660 useless null pointer tests. */
662 static int flag_delete_null_pointer_checks
;
664 /* Nonzero means to rerun cse after loop optimization. This increases
665 compilation time about 20% and picks up a few more common expressions. */
667 static int flag_rerun_cse_after_loop
;
669 /* Nonzero means to run loop optimizations twice. */
671 int flag_rerun_loop_opt
;
673 /* Nonzero for -finline-functions: ok to inline functions that look like
674 good inline candidates. */
676 int flag_inline_functions
;
678 /* Nonzero for -fkeep-inline-functions: even if we make a function
679 go inline everywhere, keep its definition around for debugging
682 int flag_keep_inline_functions
;
684 /* Nonzero means that functions will not be inlined. */
688 /* Nonzero means that we should emit static const variables
689 regardless of whether or not optimization is turned on. */
691 int flag_keep_static_consts
= 1;
693 /* Nonzero means we should be saving declaration info into a .X file. */
695 int flag_gen_aux_info
= 0;
697 /* Specified name of aux-info file. */
699 static char *aux_info_file_name
;
701 /* Nonzero means make the text shared if supported. */
703 int flag_shared_data
;
705 /* Nonzero means schedule into delayed branch slots if supported. */
707 int flag_delayed_branch
;
709 /* Nonzero if we are compiling pure (sharable) code.
710 Value is 1 if we are doing reasonable (i.e. simple
711 offset into offset table) pic. Value is 2 if we can
712 only perform register offsets. */
716 /* Nonzero means generate extra code for exception handling and enable
717 exception handling. */
721 /* Nonzero means use the new model for exception handling. Replaces
722 -DNEW_EH_MODEL as a compile option. */
724 int flag_new_exceptions
= 1;
726 /* Nonzero means generate frame unwind info table when supported. */
728 int flag_unwind_tables
= 0;
730 /* Nonzero means don't place uninitialized global data in common storage
735 /* Nonzero means pretend it is OK to examine bits of target floats,
736 even if that isn't true. The resulting code will have incorrect constants,
737 but the same series of instructions that the native compiler would make. */
739 int flag_pretend_float
;
741 /* Nonzero means change certain warnings into errors.
742 Usually these are warnings about failure to conform to some standard. */
744 int flag_pedantic_errors
= 0;
746 /* flag_schedule_insns means schedule insns within basic blocks (before
748 flag_schedule_insns_after_reload means schedule insns after
751 int flag_schedule_insns
= 0;
752 int flag_schedule_insns_after_reload
= 0;
754 /* The following flags have effect only for scheduling before register
757 flag_schedule_interblock means schedule insns accross basic blocks.
758 flag_schedule_speculative means allow speculative motion of non-load insns.
759 flag_schedule_speculative_load means allow speculative motion of some
761 flag_schedule_speculative_load_dangerous allows speculative motion of more
764 int flag_schedule_interblock
= 1;
765 int flag_schedule_speculative
= 1;
766 int flag_schedule_speculative_load
= 0;
767 int flag_schedule_speculative_load_dangerous
= 0;
769 int flag_single_precision_constant
;
771 /* flag_branch_on_count_reg means try to replace add-1,compare,branch tupple
772 by a cheaper branch on a count register. */
773 int flag_branch_on_count_reg
= 1;
775 /* -finhibit-size-directive inhibits output of .size for ELF.
776 This is used only for compiling crtstuff.c,
777 and it may be extended to other effects
778 needed for crtstuff.c on other systems. */
779 int flag_inhibit_size_directive
= 0;
781 /* -fverbose-asm causes extra commentary information to be produced in
782 the generated assembly code (to make it more readable). This option
783 is generally only of use to those who actually need to read the
784 generated assembly code (perhaps while debugging the compiler itself).
785 -fno-verbose-asm, the default, causes the extra information
786 to be omitted and is useful when comparing two assembler files. */
788 int flag_verbose_asm
= 0;
790 /* -dA causes debug commentary information to be produced in
791 the generated assembly code (to make it more readable). This option
792 is generally only of use to those who actually need to read the
793 generated assembly code (perhaps while debugging the compiler itself).
794 Currently, this switch is only used by dwarfout.c; however, it is intended
795 to be a catchall for printing debug information in the assembler file. */
797 int flag_debug_asm
= 0;
799 /* -dP causes the rtl to be emitted as a comment in assembly. */
801 int flag_dump_rtl_in_asm
= 0;
803 /* -fgnu-linker specifies use of the GNU linker for initializations.
804 (Or, more generally, a linker that handles initializations.)
805 -fno-gnu-linker says that collect2 will be used. */
807 int flag_gnu_linker
= 0;
809 int flag_gnu_linker
= 1;
815 /* Enable dead code elimination. */
818 /* Tag all structures with __attribute__(packed). */
819 int flag_pack_struct
= 0;
821 /* Emit code to check for stack overflow; also may cause large objects
822 to be allocated dynamically. */
823 int flag_stack_check
;
825 /* When non-NULL, indicates that whenever space is allocated on the
826 stack, the resulting stack pointer must not pass this
827 address---that is, for stacks that grow downward, the stack pointer
828 must always be greater than or equal to this address; for stacks
829 that grow upward, the stack pointer must be less than this address.
830 At present, the rtx may be either a REG or a SYMBOL_REF, although
831 the support provided depends on the backend. */
834 /* -fcheck-memory-usage causes extra code to be generated in order to check
835 memory accesses. This is used by a detector of bad memory accesses such
837 int flag_check_memory_usage
= 0;
839 /* -fprefix-function-name causes function name to be prefixed. This
840 can be used with -fcheck-memory-usage to isolate code compiled with
841 -fcheck-memory-usage. */
842 int flag_prefix_function_name
= 0;
844 /* 0 if pointer arguments may alias each other. True in C.
845 1 if pointer arguments may not alias each other but may alias
847 2 if pointer arguments may not alias each other and may not
848 alias global variables. True in Fortran.
849 This defaults to 0 for C. */
850 int flag_argument_noalias
= 0;
852 /* Nonzero if we should do (language-dependent) alias analysis.
853 Typically, this analysis will assume that expressions of certain
854 types do not alias expressions of certain other types. Only used
855 if alias analysis (in general) is enabled. */
856 int flag_strict_aliasing
= 0;
858 /* Instrument functions with calls at entry and exit, for profiling. */
859 int flag_instrument_function_entry_exit
= 0;
861 /* Nonzero means ignore `#ident' directives. 0 means handle them.
862 On SVR4 targets, it also controls whether or not to emit a
863 string identifying the compiler. */
865 int flag_no_ident
= 0;
867 /* This will perform a peephole pass before sched2. */
868 int flag_peephole2
= 0;
870 /* This will try to guess branch probabilities. */
871 int flag_guess_branch_prob
= 0;
873 /* -fbounded-pointers causes gcc to compile pointers as composite
874 objects occupying three words: the pointer value, the base address
875 of the referent object, and the address immediately beyond the end
876 of the referent object. The base and extent allow us to perform
877 runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
878 int flag_bounded_pointers
= 0;
880 /* -fcheck-bounds causes gcc to generate array bounds checks.
881 For C, C++: defaults to value of flag_bounded_pointers.
882 For ObjC: defaults to off.
883 For Java: defaults to on.
884 For Fortran: defaults to off.
885 For CHILL: defaults to off. */
886 int flag_bounds_check
= 0;
888 /* If one, renumber instruction UIDs to reduce the number of
889 unused UIDs if there are a lot of instructions. If greater than
890 one, unconditionally renumber instruction UIDs. */
891 int flag_renumber_insns
= 1;
893 /* Values of the -falign-* flags: how much to align labels in code.
894 0 means `use default', 1 means `don't align'.
895 For each variable, there is an _log variant which is the power
896 of two not less than the variable, for .align output. */
903 int align_labels_log
;
905 int align_functions_log
;
907 /* Table of supported debugging formats. */
911 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
912 constant expression, we use NO_DEBUG in its place. */
913 enum debug_info_type debug_type
;
914 int use_extensions_p
;
915 const char *description
;
919 { "", NO_DEBUG
, DEFAULT_GDB_EXTENSIONS
,
920 "Generate default debug format output" },
921 { "gdb", NO_DEBUG
, 1, "Generate default extended debug format output" },
922 #ifdef DBX_DEBUGGING_INFO
923 { "stabs", DBX_DEBUG
, 0, "Generate STABS format debug output" },
924 { "stabs+", DBX_DEBUG
, 1, "Generate extended STABS format debug output" },
926 #ifdef DWARF_DEBUGGING_INFO
927 { "dwarf", DWARF_DEBUG
, 0, "Generate DWARF-1 format debug output"},
928 { "dwarf+", DWARF_DEBUG
, 1,
929 "Generated extended DWARF-1 format debug output" },
931 #ifdef DWARF2_DEBUGGING_INFO
932 { "dwarf-2", DWARF2_DEBUG
, 0, "Enable DWARF-2 debug output" },
934 #ifdef XCOFF_DEBUGGING_INFO
935 { "xcoff", XCOFF_DEBUG
, 0, "Generate XCOFF format debug output" },
936 { "xcoff+", XCOFF_DEBUG
, 1, "Generate extended XCOFF format debug output" },
938 #ifdef SDB_DEBUGGING_INFO
939 { "coff", SDB_DEBUG
, 0, "Generate COFF format debug output" },
949 const char *description
;
951 lang_independent_options
;
955 /* Add or remove a leading underscore from user symbols. */
956 int flag_leading_underscore
= -1;
958 /* The user symbol prefix after having resolved same. */
959 const char *user_label_prefix
;
961 /* A default for same. */
962 #ifndef USER_LABEL_PREFIX
963 #define USER_LABEL_PREFIX ""
966 /* Table of language-independent -f options.
967 STRING is the option name. VARIABLE is the address of the variable.
968 ON_VALUE is the value to store in VARIABLE
969 if `-fSTRING' is seen as an option.
970 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
972 lang_independent_options f_options
[] =
974 {"eliminate-dwarf2-dups", &flag_eliminate_dwarf2_dups
, 1,
975 "Perform DWARF2 duplicate elimination"},
976 {"float-store", &flag_float_store
, 1,
977 "Do not store floats in registers" },
978 {"volatile", &flag_volatile
, 1,
979 "Consider all mem refs through pointers as volatile"},
980 {"volatile-global", &flag_volatile_global
, 1,
981 "Consider all mem refs to global data to be volatile" },
982 {"volatile-static", &flag_volatile_static
, 1,
983 "Consider all mem refs to static data to be volatile" },
984 {"defer-pop", &flag_defer_pop
, 1,
985 "Defer popping functions args from stack until later" },
986 {"omit-frame-pointer", &flag_omit_frame_pointer
, 1,
987 "When possible do not generate stack frames"},
988 {"optimize-sibling-calls", &flag_optimize_sibling_calls
, 1,
989 "Optimize sibling and tail recursive calls" },
990 {"cse-follow-jumps", &flag_cse_follow_jumps
, 1,
991 "When running CSE, follow jumps to their targets" },
992 {"cse-skip-blocks", &flag_cse_skip_blocks
, 1,
993 "When running CSE, follow conditional jumps" },
994 {"expensive-optimizations", &flag_expensive_optimizations
, 1,
995 "Perform a number of minor, expensive optimisations" },
996 {"thread-jumps", &flag_thread_jumps
, 1,
997 "Perform jump threading optimisations"},
998 {"strength-reduce", &flag_strength_reduce
, 1,
999 "Perform strength reduction optimisations" },
1000 {"unroll-loops", &flag_unroll_loops
, 1,
1001 "Perform loop unrolling when iteration count is known" },
1002 {"unroll-all-loops", &flag_unroll_all_loops
, 1,
1003 "Perform loop unrolling for all loops" },
1004 {"move-all-movables", &flag_move_all_movables
, 1,
1005 "Force all loop invariant computations out of loops" },
1006 {"reduce-all-givs", &flag_reduce_all_givs
, 1,
1007 "Strength reduce all loop general induction variables" },
1008 {"writable-strings", &flag_writable_strings
, 1,
1009 "Store strings in writable data section" },
1010 {"peephole", &flag_no_peephole
, 0,
1011 "Enable machine specific peephole optimisations" },
1012 {"force-mem", &flag_force_mem
, 1,
1013 "Copy memory operands into registers before using" },
1014 {"force-addr", &flag_force_addr
, 1,
1015 "Copy memory address constants into regs before using" },
1016 {"function-cse", &flag_no_function_cse
, 0,
1017 "Allow function addresses to be held in registers" },
1018 {"inline-functions", &flag_inline_functions
, 1,
1019 "Integrate simple functions into their callers" },
1020 {"keep-inline-functions", &flag_keep_inline_functions
, 1,
1021 "Generate code for funcs even if they are fully inlined" },
1022 {"inline", &flag_no_inline
, 0,
1023 "Pay attention to the 'inline' keyword"},
1024 {"keep-static-consts", &flag_keep_static_consts
, 1,
1025 "Emit static const variables even if they are not used" },
1026 {"syntax-only", &flag_syntax_only
, 1,
1027 "Check for syntax errors, then stop" },
1028 {"shared-data", &flag_shared_data
, 1,
1029 "Mark data as shared rather than private" },
1030 {"caller-saves", &flag_caller_saves
, 1,
1031 "Enable saving registers around function calls" },
1032 {"pcc-struct-return", &flag_pcc_struct_return
, 1,
1033 "Return 'short' aggregates in memory, not registers" },
1034 {"reg-struct-return", &flag_pcc_struct_return
, 0,
1035 "Return 'short' aggregates in registers" },
1036 {"delayed-branch", &flag_delayed_branch
, 1,
1037 "Attempt to fill delay slots of branch instructions" },
1038 {"gcse", &flag_gcse
, 1,
1039 "Perform the global common subexpression elimination" },
1040 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop
, 1,
1041 "Run CSE pass after loop optimisations"},
1042 {"rerun-loop-opt", &flag_rerun_loop_opt
, 1,
1043 "Run the loop optimiser twice"},
1044 {"delete-null-pointer-checks", &flag_delete_null_pointer_checks
, 1,
1045 "Delete useless null pointer checks" },
1046 {"pretend-float", &flag_pretend_float
, 1,
1047 "Pretend that host and target use the same FP format"},
1048 {"schedule-insns", &flag_schedule_insns
, 1,
1049 "Reschedule instructions to avoid pipeline stalls"},
1050 {"schedule-insns2", &flag_schedule_insns_after_reload
, 1,
1051 "Run two passes of the instruction scheduler"},
1052 {"sched-interblock",&flag_schedule_interblock
, 1,
1053 "Enable scheduling across basic blocks" },
1054 {"sched-spec",&flag_schedule_speculative
, 1,
1055 "Allow speculative motion of non-loads" },
1056 {"sched-spec-load",&flag_schedule_speculative_load
, 1,
1057 "Allow speculative motion of some loads" },
1058 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous
, 1,
1059 "Allow speculative motion of more loads" },
1060 {"branch-count-reg",&flag_branch_on_count_reg
, 1,
1061 "Replace add,compare,branch with branch on count reg"},
1062 {"pic", &flag_pic
, 1,
1063 "Generate position independent code, if possible"},
1064 {"PIC", &flag_pic
, 2, ""},
1065 {"exceptions", &flag_exceptions
, 1,
1066 "Enable exception handling" },
1067 {"new-exceptions", &flag_new_exceptions
, 1,
1068 "Use the new model for exception handling" },
1069 {"unwind-tables", &flag_unwind_tables
, 1,
1070 "Just generate unwind tables for exception handling" },
1071 {"sjlj-exceptions", &exceptions_via_longjmp
, 1,
1072 "Use setjmp/longjmp to handle exceptions" },
1073 {"asynchronous-exceptions", &asynchronous_exceptions
, 1,
1074 "Support asynchronous exceptions" },
1075 {"profile-arcs", &profile_arc_flag
, 1,
1076 "Insert arc based program profiling code" },
1077 {"test-coverage", &flag_test_coverage
, 1,
1078 "Create data files needed by gcov" },
1079 {"branch-probabilities", &flag_branch_probabilities
, 1,
1080 "Use profiling information for branch probabilities" },
1081 {"reorder-blocks", &flag_reorder_blocks
, 1,
1082 "Reorder basic blocks to improve code placement" },
1083 {"rename-registers", &flag_rename_registers
, 1,
1084 "Do the register renaming optimization pass"},
1085 {"fast-math", &flag_fast_math
, 1,
1086 "Improve FP speed by violating ANSI & IEEE rules" },
1087 {"common", &flag_no_common
, 0,
1088 "Do not put unitialised globals in the common section" },
1089 {"inhibit-size-directive", &flag_inhibit_size_directive
, 1,
1090 "Do not generate .size directives" },
1091 {"function-sections", &flag_function_sections
, 1,
1092 "place each function into its own section" },
1093 {"data-sections", &flag_data_sections
, 1,
1094 "place data items into their own section" },
1095 {"verbose-asm", &flag_verbose_asm
, 1,
1096 "Add extra commentry to assembler output"},
1097 {"gnu-linker", &flag_gnu_linker
, 1,
1098 "Output GNU ld formatted global initialisers"},
1099 {"regmove", &flag_regmove
, 1,
1100 "Enables a register move optimisation"},
1101 {"optimize-register-move", &flag_regmove
, 1,
1102 "Do the full regmove optimization pass"},
1103 {"pack-struct", &flag_pack_struct
, 1,
1104 "Pack structure members together without holes" },
1105 {"stack-check", &flag_stack_check
, 1,
1106 "Insert stack checking code into the program" },
1107 {"argument-alias", &flag_argument_noalias
, 0,
1108 "Specify that arguments may alias each other & globals"},
1109 {"argument-noalias", &flag_argument_noalias
, 1,
1110 "Assume arguments may alias globals but not each other"},
1111 {"argument-noalias-global", &flag_argument_noalias
, 2,
1112 "Assume arguments do not alias each other or globals" },
1113 {"strict-aliasing", &flag_strict_aliasing
, 1,
1114 "Assume strict aliasing rules apply" },
1115 {"align-loops", &align_loops
, 0,
1116 "Align the start of loops" },
1117 {"align-jumps", &align_jumps
, 0,
1118 "Align labels which are only reached by jumping" },
1119 {"align-labels", &align_labels
, 0,
1120 "Align all labels" },
1121 {"align-functions", &align_functions
, 0,
1122 "Align the start of functions" },
1123 {"check-memory-usage", &flag_check_memory_usage
, 1,
1124 "Generate code to check every memory access" },
1125 {"prefix-function-name", &flag_prefix_function_name
, 1,
1126 "Add a prefix to all function names" },
1127 {"dump-unnumbered", &flag_dump_unnumbered
, 1,
1128 "Suppress output of instruction numbers and line number notes in debugging dumps"},
1129 {"instrument-functions", &flag_instrument_function_entry_exit
, 1,
1130 "Instrument function entry/exit with profiling calls"},
1131 {"ssa", &flag_ssa
, 1,
1132 "Enable SSA optimizations" },
1133 {"dce", &flag_dce
, 1,
1134 "Enable dead code elimination" },
1135 {"leading-underscore", &flag_leading_underscore
, 1,
1136 "External symbols have a leading underscore" },
1137 {"ident", &flag_no_ident
, 0,
1138 "Process #ident directives"},
1139 { "peephole2", &flag_peephole2
, 1,
1140 "Enables an rtl peephole pass run before sched2" },
1141 { "guess-branch-probability", &flag_guess_branch_prob
, 1,
1142 "Enables guessing of branch probabilities" },
1143 {"math-errno", &flag_errno_math
, 1,
1144 "Set errno after built-in math functions"},
1145 {"bounded-pointers", &flag_bounded_pointers
, 1,
1146 "Compile pointers as triples: value, base & end" },
1147 {"bounds-check", &flag_bounds_check
, 1,
1148 "Generate code to check bounds before dereferencing pointers and arrays" },
1149 {"single-precision-constant", &flag_single_precision_constant
, 1,
1150 "Convert floating point constant to single precision constant"},
1151 {"time-report", &time_report
, 1,
1152 "Report time taken by each compiler pass at end of run"},
1153 {"mem-report", &mem_report
, 1,
1154 "Report on permanent memory allocation at end of run"},
1155 { "trapv", &flag_trapv
, 1,
1156 "Trap for signed overflow in addition / subtraction / multiplication." },
1159 /* Table of language-specific options. */
1161 static struct lang_opt
1164 const char *description
;
1166 documented_lang_options
[] =
1168 /* In order not to overload the --help output, the convention
1169 used here is to only describe those options which are not
1170 enabled by default. */
1172 { "-ansi", "Compile just for ISO C89" },
1173 { "-fallow-single-precision",
1174 "Do not promote floats to double if using -traditional" },
1175 { "-std= ", "Determine language standard"},
1177 { "-fsigned-bitfields", "" },
1178 { "-funsigned-bitfields","Make bitfields by unsigned by default" },
1179 { "-fno-signed-bitfields", "" },
1180 { "-fno-unsigned-bitfields","" },
1181 { "-fsigned-char", "Make 'char' be signed by default"},
1182 { "-funsigned-char", "Make 'char' be unsigned by default"},
1183 { "-fno-signed-char", "" },
1184 { "-fno-unsigned-char", "" },
1186 { "-ftraditional", "" },
1187 { "-traditional", "Attempt to support traditional K&R style C"},
1188 { "-fnotraditional", "" },
1189 { "-fno-traditional", "" },
1192 { "-fno-asm", "Do not recognise the 'asm' keyword" },
1193 { "-fbuiltin", "" },
1194 { "-fno-builtin", "Do not recognise any built in functions" },
1195 { "-fhosted", "Assume normal C execution environment" },
1196 { "-fno-hosted", "" },
1198 "Assume that standard libraries & main might not exist" },
1199 { "-fno-freestanding", "" },
1200 { "-fcond-mismatch", "Allow different types as args of ? operator"},
1201 { "-fno-cond-mismatch", "" },
1202 { "-fdollars-in-identifiers", "Allow the use of $ inside identifiers" },
1203 { "-fno-dollars-in-identifiers", "" },
1204 { "-fpreprocessed", "" },
1205 { "-fno-preprocessed", "" },
1206 { "-fshort-double", "Use the same size for double as for float" },
1207 { "-fno-short-double", "" },
1208 { "-fshort-enums", "Use the smallest fitting integer to hold enums"},
1209 { "-fno-short-enums", "" },
1210 { "-fshort-wchar", "Override the underlying type for wchar_t to `unsigned short'" },
1211 { "-fno-short-wchar", "" },
1213 { "-Wall", "Enable most warning messages" },
1214 { "-Wbad-function-cast",
1215 "Warn about casting functions to incompatible types" },
1216 { "-Wno-bad-function-cast", "" },
1217 { "-Wno-missing-noreturn", "" },
1218 { "-Wmissing-format-attribute",
1219 "Warn about functions which might be candidates for format attributes" },
1220 { "-Wno-missing-format-attribute", "" },
1221 { "-Wcast-qual", "Warn about casts which discard qualifiers"},
1222 { "-Wno-cast-qual", "" },
1223 { "-Wchar-subscripts", "Warn about subscripts whose type is 'char'"},
1224 { "-Wno-char-subscripts", "" },
1225 { "-Wcomment", "Warn if nested comments are detected" },
1226 { "-Wno-comment", "" },
1227 { "-Wcomments", "Warn if nested comments are detected" },
1228 { "-Wno-comments", "" },
1229 { "-Wconversion", "Warn about possibly confusing type conversions" },
1230 { "-Wno-conversion", "" },
1231 { "-Wformat", "Warn about printf/scanf/strftime/strfmon format anomalies" },
1232 { "-Wno-format", "" },
1233 { "-Wformat-y2k", "" },
1234 { "-Wno-format-y2k",
1235 "Don't warn about strftime formats yielding 2 digit years" },
1236 { "-Wformat-extra-args", "" },
1237 { "-Wno-format-extra-args",
1238 "Don't warn about too many arguments to format functions" },
1239 { "-Wformat-nonliteral", "Warn about non-string-literal format strings" },
1240 { "-Wno-format-nonliteral", "" },
1241 { "-Wformat-security",
1242 "Warn about possible security problems with format functions" },
1243 { "-Wno-format-security", "" },
1244 { "-Wimplicit-function-declaration",
1245 "Warn about implicit function declarations" },
1246 { "-Wno-implicit-function-declaration", "" },
1247 { "-Werror-implicit-function-declaration", "" },
1248 { "-Wimplicit-int", "Warn when a declaration does not specify a type" },
1249 { "-Wno-implicit-int", "" },
1250 { "-Wimplicit", "" },
1251 { "-Wno-implicit", "" },
1252 { "-Wimport", "Warn about the use of the #import directive" },
1253 { "-Wno-import", "" },
1254 { "-Wlong-long","" },
1255 { "-Wno-long-long", "Do not warn about using 'long long' when -pedantic" },
1256 { "-Wmain", "Warn about suspicious declarations of main" },
1257 { "-Wno-main", "" },
1258 { "-Wmissing-braces",
1259 "Warn about possibly missing braces around initialisers" },
1260 { "-Wno-missing-braces", "" },
1261 { "-Wmissing-declarations",
1262 "Warn about global funcs without previous declarations"},
1263 { "-Wno-missing-declarations", "" },
1264 { "-Wmissing-prototypes", "Warn about global funcs without prototypes" },
1265 { "-Wno-missing-prototypes", "" },
1266 { "-Wmultichar", "Warn about use of multicharacter literals"},
1267 { "-Wno-multichar", "" },
1268 { "-Wnested-externs", "Warn about externs not at file scope level" },
1269 { "-Wno-nested-externs", "" },
1270 { "-Wparentheses", "Warn about possible missing parentheses" },
1271 { "-Wno-parentheses", "" },
1272 { "-Wsequence-point",
1273 "Warn about possible violations of sequence point rules" },
1274 { "-Wno-sequence-point", "" },
1275 { "-Wpointer-arith", "Warn about function pointer arithmetic" },
1276 { "-Wno-pointer-arith", "" },
1277 { "-Wredundant-decls",
1278 "Warn about multiple declarations of the same object" },
1279 { "-Wno-redundant-decls", "" },
1280 { "-Wsign-compare", "Warn about signed/unsigned comparisons" },
1281 { "-Wno-sign-compare", "" },
1282 { "-Wfloat-equal", "Warn about testing equality of floating point numbers" },
1283 { "-Wno-float-equal", "" },
1284 { "-Wunknown-pragmas", "Warn about unrecognized pragmas" },
1285 { "-Wno-unknown-pragmas", "" },
1286 { "-Wstrict-prototypes", "Warn about non-prototyped function decls" },
1287 { "-Wno-strict-prototypes", "" },
1288 { "-Wtraditional", "Warn about constructs whose meaning change in ISO C"},
1289 { "-Wno-traditional", "" },
1290 { "-Wtrigraphs", "Warn when trigraphs are encountered" },
1291 { "-Wno-trigraphs", "" },
1293 { "-Wno-undef", "" },
1294 { "-Wwrite-strings", "Mark strings as 'const char *'"},
1295 { "-Wno-write-strings", "" },
1297 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1299 #include "options.h"
1303 /* Here is a table, controlled by the tm.h file, listing each -m switch
1304 and which bits in `target_switches' it should set or clear.
1305 If VALUE is positive, it is bits to set.
1306 If VALUE is negative, -VALUE is bits to clear.
1307 (The sign bit is not used so there is no confusion.) */
1313 const char *description
;
1315 target_switches
[] = TARGET_SWITCHES
;
1317 /* This table is similar, but allows the switch to have a value. */
1319 #ifdef TARGET_OPTIONS
1323 const char **variable
;
1324 const char *description
;
1326 target_options
[] = TARGET_OPTIONS
;
1329 /* Options controlling warnings. */
1331 /* Don't print warning messages. -w. */
1333 int inhibit_warnings
= 0;
1335 /* Don't suppress warnings from system headers. -Wsystem-headers. */
1337 int warn_system_headers
= 0;
1339 /* Print various extra warnings. -W. */
1341 int extra_warnings
= 0;
1343 /* Treat warnings as errors. -Werror. */
1345 int warnings_are_errors
= 0;
1347 /* Nonzero to warn about unused variables, functions et.al. */
1349 int warn_unused_function
;
1350 int warn_unused_label
;
1351 int warn_unused_parameter
;
1352 int warn_unused_variable
;
1353 int warn_unused_value
;
1356 set_Wunused (setting
)
1359 warn_unused_function
= setting
;
1360 warn_unused_label
= setting
;
1361 /* Unused function parameter warnings are reported when either ``-W
1362 -Wunused'' or ``-Wunused-parameter'' is specified. Differentiate
1363 -Wunused by setting WARN_UNUSED_PARAMETER to -1. */
1365 warn_unused_parameter
= 0;
1366 else if (!warn_unused_parameter
)
1367 warn_unused_parameter
= -1;
1368 warn_unused_variable
= setting
;
1369 warn_unused_value
= setting
;
1372 /* Nonzero to warn about code which is never reached. */
1374 int warn_notreached
;
1376 /* Nonzero to warn about variables used before they are initialized. */
1378 int warn_uninitialized
;
1380 /* Nonzero means warn about all declarations which shadow others. */
1384 /* Warn if a switch on an enum fails to have a case for every enum value. */
1388 /* Nonzero means warn about function definitions that default the return type
1389 or that use a null return and have a return-type other than void. */
1391 int warn_return_type
;
1393 /* Nonzero means warn about pointer casts that increase the required
1394 alignment of the target type (and might therefore lead to a crash
1395 due to a misaligned access). */
1397 int warn_cast_align
;
1399 /* Nonzero means warn about any identifiers that match in the first N
1400 characters. The value N is in `id_clash_len'. */
1405 /* Nonzero means warn about any objects definitions whose size is larger
1406 than N bytes. Also want about function definitions whose returned
1407 values are larger than N bytes. The value N is in `larger_than_size'. */
1409 int warn_larger_than
;
1410 HOST_WIDE_INT larger_than_size
;
1412 /* Nonzero means warn if inline function is too large. */
1416 /* Warn if a function returns an aggregate,
1417 since there are often incompatible calling conventions for doing this. */
1419 int warn_aggregate_return
;
1421 /* Warn if packed attribute on struct is unnecessary and inefficient. */
1425 /* Warn when gcc pads a structure to an alignment boundary. */
1429 /* Warn when an optimization pass is disabled. */
1431 int warn_disabled_optimization
;
1433 /* Warn about functions which might be candidates for attribute noreturn. */
1435 int warn_missing_noreturn
;
1437 /* Likewise for -W. */
1439 lang_independent_options W_options
[] =
1441 {"unused-function", &warn_unused_function
, 1, "Warn when a function is unused" },
1442 {"unused-label", &warn_unused_label
, 1, "Warn when a label is unused" },
1443 {"unused-parameter", &warn_unused_parameter
, 1, "Warn when a function parameter is unused" },
1444 {"unused-variable", &warn_unused_variable
, 1, "Warn when a variable is unused" },
1445 {"unused-value", &warn_unused_value
, 1, "Warn when an expression value is unused" },
1446 {"system-headers", &warn_system_headers
, 1, "Do not suppress warnings from system headers"},
1447 {"error", &warnings_are_errors
, 1, ""},
1448 {"shadow", &warn_shadow
, 1, "Warn when one local variable shadows another" },
1449 {"switch", &warn_switch
, 1,
1450 "Warn about enumerated switches missing a specific case" },
1451 {"aggregate-return", &warn_aggregate_return
, 1,
1452 "Warn about returning structures, unions or arrays" },
1453 {"cast-align", &warn_cast_align
, 1,
1454 "Warn about pointer casts which increase alignment" },
1455 {"unreachable-code", &warn_notreached
, 1,
1456 "Warn about code that will never be executed" },
1457 {"uninitialized", &warn_uninitialized
, 1,
1458 "Warn about unitialized automatic variables"},
1459 {"inline", &warn_inline
, 1,
1460 "Warn when an inlined function cannot be inlined"},
1461 {"packed", &warn_packed
, 1,
1462 "Warn when the packed attribute has no effect on struct layout"},
1463 {"padded", &warn_padded
, 1,
1464 "Warn when padding is required to align struct members"},
1465 {"disabled-optimization", &warn_disabled_optimization
, 1,
1466 "Warn when an optimization pass is disabled"},
1467 {"missing-noreturn", &warn_missing_noreturn
, 1,
1468 "Warn about functions which might be candidates for attribute noreturn"}
1471 /* Output files for assembler code (real compiler output)
1472 and debugging dumps. */
1475 FILE *aux_info_file
;
1476 FILE *rtl_dump_file
= NULL
;
1478 /* Decode the string P as an integral parameter.
1479 If the string is indeed an integer return its numeric value else
1480 issue an Invalid Option error for the option PNAME and return DEFVAL.
1481 If PNAME is zero just return DEFVAL, do not call error. */
1484 read_integral_parameter (p
, pname
, defval
)
1489 const char *endp
= p
;
1493 if (*endp
>= '0' && *endp
<= '9')
1502 error ("Invalid option `%s'", pname
);
1510 /* This is the default decl_printable_name function. */
1513 decl_name (decl
, verbosity
)
1515 int verbosity ATTRIBUTE_UNUSED
;
1517 return IDENTIFIER_POINTER (DECL_NAME (decl
));
1521 /* This calls abort and is used to avoid problems when abort if a macro.
1522 It is used when we need to pass the address of abort. */
1530 /* When `malloc.c' is compiled with `rcheck' defined,
1531 it calls this function to report clobberage. */
1535 const char *s ATTRIBUTE_UNUSED
;
1540 /* Return the logarithm of X, base 2, considering X unsigned,
1541 if X is a power of 2. Otherwise, returns -1.
1543 This should be used via the `exact_log2' macro. */
1547 register unsigned HOST_WIDE_INT x
;
1549 register int log
= 0;
1550 /* Test for 0 or a power of 2. */
1551 if (x
== 0 || x
!= (x
& -x
))
1553 while ((x
>>= 1) != 0)
1558 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1559 If X is 0, return -1.
1561 This should be used via the floor_log2 macro. */
1565 register unsigned HOST_WIDE_INT x
;
1567 register int log
= -1;
1574 /* Return the approximate positive square root of a number N. This is for
1575 statistical reports, not code generation. */
1590 d
= (s
* s
- x
) / (2 * s
);
1597 static int float_handler_set
;
1599 jmp_buf float_handler
;
1601 /* Signals actually come here. */
1604 float_signal (signo
)
1605 /* If this is missing, some compilers complain. */
1606 int signo ATTRIBUTE_UNUSED
;
1608 if (float_handled
== 0)
1609 crash_signal (signo
);
1610 #if defined (USG) || defined (hpux)
1611 /* Re-enable the signal catcher. */
1612 signal (SIGFPE
, float_signal
);
1615 signal (SIGFPE
, float_signal
);
1616 longjmp (float_handler
, 1);
1619 /* Specify where to longjmp to when a floating arithmetic error happens.
1620 If HANDLER is 0, it means don't handle the errors any more. */
1623 set_float_handler (handler
)
1626 float_handled
= (handler
!= 0);
1628 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
1630 if (float_handled
&& ! float_handler_set
)
1632 signal (SIGFPE
, float_signal
);
1633 float_handler_set
= 1;
1637 /* This is a wrapper function for code which might elicit an
1638 arithmetic exception. That code should be passed in as a function
1639 pointer FN, and one argument DATA. DATA is usually a struct which
1640 contains the real input and output for function FN. This function
1641 returns 0 (failure) if longjmp was called (i.e. an exception
1642 occured.) It returns 1 (success) otherwise. */
1645 do_float_handler (fn
, data
)
1646 void (*fn
) PARAMS ((PTR
));
1653 /* We got here via longjmp () caused by an exception in function
1655 set_float_handler (NULL
);
1659 set_float_handler (buf
);
1661 set_float_handler (NULL
);
1665 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1666 error happens, pushing the previous specification into OLD_HANDLER.
1667 Return an indication of whether there was a previous handler in effect. */
1670 push_float_handler (handler
, old_handler
)
1671 jmp_buf handler
, old_handler
;
1673 int was_handled
= float_handled
;
1677 memcpy ((char *) old_handler
, (char *) float_handler
,
1678 sizeof (float_handler
));
1680 memcpy ((char *) float_handler
, (char *) handler
, sizeof (float_handler
));
1684 /* Restore the previous specification of whether and where to longjmp to
1685 when a floating arithmetic error happens. */
1688 pop_float_handler (handled
, handler
)
1692 float_handled
= handled
;
1694 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
1697 /* Handler for fatal signals, such as SIGSEGV. These are transformed
1698 into ICE messages, which is much more user friendly. */
1701 crash_signal (signo
)
1702 /* If this is missing, some compilers complain. */
1705 fatal ("Internal error: %s.", strsignal (signo
));
1708 /* Strip off a legitimate source ending from the input string NAME of
1709 length LEN. Rather than having to know the names used by all of
1710 our front ends, we strip off an ending of a period followed by
1711 up to five characters. (Java uses ".class".) */
1714 strip_off_ending (name
, len
)
1719 for (i
= 2; i
< 6 && len
> i
; i
++)
1721 if (name
[len
- i
] == '.')
1723 name
[len
- i
] = '\0';
1729 /* Given a file name X, return the nondirectory portion. */
1732 file_name_nondirectory (x
)
1735 char *tmp
= (char *) strrchr (x
, '/');
1736 if (DIR_SEPARATOR
!= '/' && ! tmp
)
1737 tmp
= (char *) strrchr (x
, DIR_SEPARATOR
);
1739 return (char *) (tmp
+ 1);
1744 /* Output a quoted string. */
1747 output_quoted_string (asm_file
, string
)
1751 #ifdef OUTPUT_QUOTED_STRING
1752 OUTPUT_QUOTED_STRING (asm_file
, string
);
1756 putc ('\"', asm_file
);
1757 while ((c
= *string
++) != 0)
1759 if (c
== '\"' || c
== '\\')
1760 putc ('\\', asm_file
);
1763 putc ('\"', asm_file
);
1767 /* Output a file name in the form wanted by System V. */
1770 output_file_directive (asm_file
, input_name
)
1772 const char *input_name
;
1774 int len
= strlen (input_name
);
1775 const char *na
= input_name
+ len
;
1777 /* NA gets INPUT_NAME sans directory names. */
1778 while (na
> input_name
)
1780 if (IS_DIR_SEPARATOR (na
[-1]))
1785 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1786 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file
, na
);
1788 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1789 ASM_OUTPUT_SOURCE_FILENAME (asm_file
, na
);
1791 fprintf (asm_file
, "\t.file\t");
1792 output_quoted_string (asm_file
, na
);
1793 fputc ('\n', asm_file
);
1798 #ifdef ASM_IDENTIFY_LANGUAGE
1799 /* Routine to build language identifier for object file. */
1802 output_lang_identify (asm_out_file
)
1805 int len
= strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1806 char *s
= (char *) alloca (len
);
1808 sprintf (s
, "__gnu_compiled_%s", lang_identify ());
1809 ASM_OUTPUT_LABEL (asm_out_file
, s
);
1813 /* Routine to open a dump file. Return true if the dump file is enabled. */
1816 open_dump_file (index
, decl
)
1817 enum dump_file_index index
;
1821 const char *open_arg
;
1824 if (! dump_file
[index
].enabled
)
1827 timevar_push (TV_DUMP
);
1828 if (rtl_dump_file
!= NULL
)
1829 fclose (rtl_dump_file
);
1831 sprintf (seq
, ".%02d.", index
);
1833 if (! dump_file
[index
].initialized
)
1835 /* If we've not initialized the files, do so now. */
1836 if (graph_dump_format
!= no_graph
1837 && dump_file
[index
].graph_dump_p
)
1839 dump_name
= concat (seq
, dump_file
[index
].extension
, NULL
);
1840 clean_graph_dump_file (dump_base_name
, dump_name
);
1843 dump_file
[index
].initialized
= 1;
1849 dump_name
= concat (dump_base_name
, seq
,
1850 dump_file
[index
].extension
, NULL
);
1852 rtl_dump_file
= fopen (dump_name
, open_arg
);
1853 if (rtl_dump_file
== NULL
)
1854 pfatal_with_name (dump_name
);
1859 fprintf (rtl_dump_file
, "\n;; Function %s\n\n",
1860 decl_printable_name (decl
, 2));
1862 timevar_pop (TV_DUMP
);
1866 /* Routine to close a dump file. */
1869 close_dump_file (index
, func
, insns
)
1870 enum dump_file_index index
;
1871 void (*func
) PARAMS ((FILE *, rtx
));
1874 if (! rtl_dump_file
)
1877 timevar_push (TV_DUMP
);
1879 && graph_dump_format
!= no_graph
1880 && dump_file
[index
].graph_dump_p
)
1885 sprintf (seq
, ".%02d.", index
);
1886 suffix
= concat (seq
, dump_file
[index
].extension
, NULL
);
1887 print_rtl_graph_with_bb (dump_base_name
, suffix
, insns
);
1892 func (rtl_dump_file
, insns
);
1894 fflush (rtl_dump_file
);
1895 fclose (rtl_dump_file
);
1897 rtl_dump_file
= NULL
;
1898 timevar_pop (TV_DUMP
);
1901 /* Do any final processing required for the declarations in VEC, of
1902 which there are LEN. We write out inline functions and variables
1903 that have been deferred until this point, but which are required.
1904 Returns non-zero if anything was put out. */
1907 wrapup_global_declarations (vec
, len
)
1914 int output_something
= 0;
1916 for (i
= 0; i
< len
; i
++)
1920 /* We're not deferring this any longer. */
1921 DECL_DEFER_OUTPUT (decl
) = 0;
1923 if (TREE_CODE (decl
) == VAR_DECL
&& DECL_SIZE (decl
) == 0
1924 && incomplete_decl_finalize_hook
!= 0)
1925 (*incomplete_decl_finalize_hook
) (decl
);
1928 /* Now emit any global variables or functions that we have been
1929 putting off. We need to loop in case one of the things emitted
1930 here references another one which comes earlier in the list. */
1934 for (i
= 0; i
< len
; i
++)
1938 if (TREE_ASM_WRITTEN (decl
) || DECL_EXTERNAL (decl
))
1941 /* Don't write out static consts, unless we still need them.
1943 We also keep static consts if not optimizing (for debugging),
1944 unless the user specified -fno-keep-static-consts.
1945 ??? They might be better written into the debug information.
1946 This is possible when using DWARF.
1948 A language processor that wants static constants to be always
1949 written out (even if it is not used) is responsible for
1950 calling rest_of_decl_compilation itself. E.g. the C front-end
1951 calls rest_of_decl_compilation from finish_decl.
1952 One motivation for this is that is conventional in some
1953 environments to write things like:
1954 static const char rcsid[] = "... version string ...";
1955 intending to force the string to be in the executable.
1957 A language processor that would prefer to have unneeded
1958 static constants "optimized away" would just defer writing
1959 them out until here. E.g. C++ does this, because static
1960 constants are often defined in header files.
1962 ??? A tempting alternative (for both C and C++) would be
1963 to force a constant to be written if and only if it is
1964 defined in a main file, as opposed to an include file. */
1966 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
1967 && (! TREE_READONLY (decl
)
1968 || TREE_PUBLIC (decl
)
1970 && flag_keep_static_consts
1971 && !DECL_ARTIFICIAL (decl
))
1972 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
1975 rest_of_decl_compilation (decl
, NULL_PTR
, 1, 1);
1978 if (TREE_CODE (decl
) == FUNCTION_DECL
1979 && DECL_INITIAL (decl
) != 0
1980 && DECL_SAVED_INSNS (decl
) != 0
1981 && (flag_keep_inline_functions
1982 || (TREE_PUBLIC (decl
) && !DECL_COMDAT (decl
))
1983 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
1986 output_inline_function (decl
);
1991 output_something
= 1;
1995 return output_something
;
1998 /* Issue appropriate warnings for the global declarations in VEC (of
1999 which there are LEN). Output debugging information for them. */
2002 check_global_declarations (vec
, len
)
2009 for (i
= 0; i
< len
; i
++)
2013 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
2014 && ! TREE_ASM_WRITTEN (decl
))
2015 /* Cancel the RTL for this decl so that, if debugging info
2016 output for global variables is still to come,
2017 this one will be omitted. */
2018 DECL_RTL (decl
) = NULL
;
2020 /* Warn about any function
2021 declared static but not defined.
2022 We don't warn about variables,
2023 because many programs have static variables
2024 that exist only to get some text into the object file. */
2025 if (TREE_CODE (decl
) == FUNCTION_DECL
2026 && (warn_unused_function
2027 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
)))
2028 && DECL_INITIAL (decl
) == 0
2029 && DECL_EXTERNAL (decl
)
2030 && ! DECL_ARTIFICIAL (decl
)
2031 && ! TREE_PUBLIC (decl
))
2033 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
)))
2034 pedwarn_with_decl (decl
,
2035 "`%s' used but never defined");
2037 warning_with_decl (decl
,
2038 "`%s' declared `static' but never defined");
2039 /* This symbol is effectively an "extern" declaration now. */
2040 TREE_PUBLIC (decl
) = 1;
2041 assemble_external (decl
);
2044 /* Warn about static fns or vars defined but not used,
2045 but not about inline functions or static consts
2046 since defining those in header files is normal practice. */
2047 if (((warn_unused_function
2048 && TREE_CODE (decl
) == FUNCTION_DECL
&& ! DECL_INLINE (decl
))
2049 || (warn_unused_variable
2050 && TREE_CODE (decl
) == VAR_DECL
&& ! TREE_READONLY (decl
)))
2051 && ! DECL_IN_SYSTEM_HEADER (decl
)
2052 && ! DECL_EXTERNAL (decl
)
2053 && ! TREE_PUBLIC (decl
)
2054 && ! TREE_USED (decl
)
2055 && (TREE_CODE (decl
) == FUNCTION_DECL
|| ! DECL_REGISTER (decl
))
2056 /* The TREE_USED bit for file-scope decls
2057 is kept in the identifier, to handle multiple
2058 external decls in different scopes. */
2059 && ! TREE_USED (DECL_NAME (decl
)))
2060 warning_with_decl (decl
, "`%s' defined but not used");
2062 timevar_push (TV_SYMOUT
);
2063 #ifdef SDB_DEBUGGING_INFO
2064 /* The COFF linker can move initialized global vars to the end.
2065 And that can screw up the symbol ordering.
2066 By putting the symbols in that order to begin with,
2067 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
2068 if (write_symbols
== SDB_DEBUG
&& TREE_CODE (decl
) == VAR_DECL
2069 && TREE_PUBLIC (decl
) && DECL_INITIAL (decl
)
2070 && ! DECL_EXTERNAL (decl
)
2071 && DECL_RTL (decl
) != 0)
2072 sdbout_symbol (decl
, 0);
2074 /* Output COFF information for non-global
2075 file-scope initialized variables. */
2076 if (write_symbols
== SDB_DEBUG
2077 && TREE_CODE (decl
) == VAR_DECL
2078 && DECL_INITIAL (decl
)
2079 && ! DECL_EXTERNAL (decl
)
2080 && DECL_RTL (decl
) != 0
2081 && GET_CODE (DECL_RTL (decl
)) == MEM
)
2082 sdbout_toplevel_data (decl
);
2083 #endif /* SDB_DEBUGGING_INFO */
2084 #ifdef DWARF_DEBUGGING_INFO
2085 /* Output DWARF information for file-scope tentative data object
2086 declarations, file-scope (extern) function declarations (which
2087 had no corresponding body) and file-scope tagged type declarations
2088 and definitions which have not yet been forced out. */
2090 if (write_symbols
== DWARF_DEBUG
2091 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
2092 dwarfout_file_scope_decl (decl
, 1);
2094 #ifdef DWARF2_DEBUGGING_INFO
2095 /* Output DWARF2 information for file-scope tentative data object
2096 declarations, file-scope (extern) function declarations (which
2097 had no corresponding body) and file-scope tagged type declarations
2098 and definitions which have not yet been forced out. */
2100 if (write_symbols
== DWARF2_DEBUG
2101 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
2102 dwarf2out_decl (decl
);
2104 timevar_pop (TV_SYMOUT
);
2108 /* Save the current INPUT_FILENAME and LINENO on the top entry in the
2109 INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
2110 INPUT_FILENAME and LINENO accordingly. */
2113 push_srcloc (file
, line
)
2117 struct file_stack
*fs
;
2119 if (input_file_stack
)
2121 input_file_stack
->name
= input_filename
;
2122 input_file_stack
->line
= lineno
;
2125 fs
= (struct file_stack
*) xmalloc (sizeof (struct file_stack
));
2126 fs
->name
= input_filename
= file
;
2127 fs
->line
= lineno
= line
;
2128 fs
->indent_level
= 0;
2129 fs
->next
= input_file_stack
;
2130 input_file_stack
= fs
;
2131 input_file_stack_tick
++;
2134 /* Pop the top entry off the stack of presently open source files.
2135 Restore the INPUT_FILENAME and LINENO from the new topmost entry on
2141 struct file_stack
*fs
;
2143 fs
= input_file_stack
;
2144 input_file_stack
= fs
->next
;
2146 input_file_stack_tick
++;
2147 /* The initial source file is never popped. */
2148 if (!input_file_stack
)
2150 input_filename
= input_file_stack
->name
;
2151 lineno
= input_file_stack
->line
;
2154 /* Compile an entire file of output from cpp, named NAME.
2155 Write a file of assembly output and various debugging dumps. */
2163 int name_specified
= name
!= 0;
2165 if (dump_base_name
== 0)
2166 dump_base_name
= name
? name
: "gccdump";
2171 /* Start timing total execution time. */
2174 timevar_start (TV_TOTAL
);
2176 /* Initialize data in various passes. */
2179 name
= init_parse (name
);
2180 init_emit_once (debug_info_level
== DINFO_LEVEL_NORMAL
2181 || debug_info_level
== DINFO_LEVEL_VERBOSE
2182 || flag_test_coverage
2183 || warn_notreached
);
2186 init_decl_processing ();
2192 init_function_once ();
2193 init_stor_layout_once ();
2194 init_varasm_once ();
2196 /* The following initialization functions need to generate rtl, so
2197 provide a dummy function context for them. */
2198 init_dummy_function_start ();
2201 if (flag_caller_saves
)
2202 init_caller_save ();
2203 expand_dummy_function_end ();
2205 /* If auxiliary info generation is desired, open the output file.
2206 This goes in the same directory as the source file--unlike
2207 all the other output files. */
2208 if (flag_gen_aux_info
)
2210 aux_info_file
= fopen (aux_info_file_name
, "w");
2211 if (aux_info_file
== 0)
2212 pfatal_with_name (aux_info_file_name
);
2215 /* Open assembler code output file. Do this even if -fsyntax-only is on,
2216 because then the driver will have provided the name of a temporary
2217 file or bit bucket for us. */
2219 if (! name_specified
&& asm_file_name
== 0)
2220 asm_out_file
= stdout
;
2223 if (asm_file_name
== 0)
2225 int len
= strlen (dump_base_name
);
2226 char *dumpname
= (char *) xmalloc (len
+ 6);
2227 memcpy (dumpname
, dump_base_name
, len
+ 1);
2228 strip_off_ending (dumpname
, len
);
2229 strcat (dumpname
, ".s");
2230 asm_file_name
= dumpname
;
2232 if (!strcmp (asm_file_name
, "-"))
2233 asm_out_file
= stdout
;
2235 asm_out_file
= fopen (asm_file_name
, "w");
2236 if (asm_out_file
== 0)
2237 pfatal_with_name (asm_file_name
);
2240 #ifdef IO_BUFFER_SIZE
2241 setvbuf (asm_out_file
, (char *) xmalloc (IO_BUFFER_SIZE
),
2242 _IOFBF
, IO_BUFFER_SIZE
);
2246 name
= ggc_strdup (name
);
2248 input_filename
= name
;
2250 /* Put an entry on the input file stack for the main input file. */
2251 push_srcloc (input_filename
, 0);
2253 /* Perform language-specific initialization.
2254 This may set main_input_filename. */
2255 if (lang_hooks
.init
)
2256 (*lang_hooks
.init
) ();
2258 /* If the input doesn't start with a #line, use the input name
2259 as the official input file name. */
2260 if (main_input_filename
== 0)
2261 main_input_filename
= name
;
2263 if (flag_syntax_only
)
2265 write_symbols
= NO_DEBUG
;
2267 profile_block_flag
= 0;
2271 ASM_FILE_START (asm_out_file
);
2273 #ifdef ASM_COMMENT_START
2274 if (flag_verbose_asm
)
2276 /* Print the list of options in effect. */
2277 print_version (asm_out_file
, ASM_COMMENT_START
);
2278 print_switch_values (asm_out_file
, 0, MAX_LINE
,
2279 ASM_COMMENT_START
, " ", "\n");
2280 /* Add a blank line here so it appears in assembler output but not
2282 fprintf (asm_out_file
, "\n");
2286 /* Output something to inform GDB that this compilation was by GCC. */
2287 #ifndef ASM_IDENTIFY_GCC
2288 fprintf (asm_out_file
, "gcc2_compiled.:\n");
2290 ASM_IDENTIFY_GCC (asm_out_file
);
2293 /* Output something to identify which front-end produced this file. */
2294 #ifdef ASM_IDENTIFY_LANGUAGE
2295 ASM_IDENTIFY_LANGUAGE (asm_out_file
);
2297 } /* ! flag_syntax_only */
2299 #ifndef ASM_OUTPUT_SECTION_NAME
2300 if (flag_function_sections
)
2302 warning ("-ffunction-sections not supported for this target.");
2303 flag_function_sections
= 0;
2305 if (flag_data_sections
)
2307 warning ("-fdata-sections not supported for this target.");
2308 flag_data_sections
= 0;
2312 if (flag_function_sections
2313 && (profile_flag
|| profile_block_flag
))
2315 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2316 flag_function_sections
= 0;
2319 #ifndef OBJECT_FORMAT_ELF
2320 if (flag_function_sections
&& write_symbols
!= NO_DEBUG
)
2321 warning ("-ffunction-sections may affect debugging on some targets.");
2324 /* ??? Note: There used to be a conditional here
2325 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2326 This was to guarantee separation between gcc_compiled. and
2327 the first function, for the sake of dbx on Suns.
2328 However, having the extra zero here confused the Emacs
2329 code for unexec, and might confuse other programs too.
2330 Therefore, I took out that change.
2331 In future versions we should find another way to solve
2332 that dbx problem. -- rms, 23 May 93. */
2334 /* Don't let the first function fall at the same address
2335 as gcc_compiled., if profiling. */
2336 if (profile_flag
|| profile_block_flag
)
2338 /* It's best if we can write a nop here since some
2339 assemblers don't tolerate zeros in the text section. */
2340 output_asm_insn (get_insn_template (CODE_FOR_nop
, NULL
), NULL_PTR
);
2343 /* If dbx symbol table desired, initialize writing it
2344 and output the predefined types. */
2345 timevar_push (TV_SYMOUT
);
2346 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2347 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2348 dbxout_init (asm_out_file
, main_input_filename
, getdecls ());
2350 #ifdef SDB_DEBUGGING_INFO
2351 if (write_symbols
== SDB_DEBUG
)
2352 sdbout_init (asm_out_file
, main_input_filename
, getdecls ());
2354 #ifdef DWARF_DEBUGGING_INFO
2355 if (write_symbols
== DWARF_DEBUG
)
2356 dwarfout_init (asm_out_file
, main_input_filename
);
2358 #ifdef DWARF2_UNWIND_INFO
2359 if (dwarf2out_do_frame ())
2360 dwarf2out_frame_init ();
2362 #ifdef DWARF2_DEBUGGING_INFO
2363 if (write_symbols
== DWARF2_DEBUG
)
2364 dwarf2out_init (asm_out_file
, main_input_filename
);
2366 timevar_pop (TV_SYMOUT
);
2368 /* Initialize yet another pass. */
2370 init_final (main_input_filename
);
2371 init_branch_prob (dump_base_name
);
2373 timevar_push (TV_PARSE
);
2375 /* Call the parser, which parses the entire file
2376 (calling rest_of_compilation for each function). */
2378 if (yyparse () != 0)
2380 if (errorcount
== 0)
2381 fnotice (stderr
, "Errors detected in input file (your bison.simple is out of date)\n");
2383 /* In case there were missing closebraces,
2384 get us back to the global binding level. */
2385 while (! global_bindings_p ())
2389 /* Compilation is now finished except for writing
2390 what's left of the symbol table output. */
2392 timevar_pop (TV_PARSE
);
2394 if (flag_syntax_only
)
2397 globals
= getdecls ();
2399 /* Really define vars that have had only a tentative definition.
2400 Really output inline functions that must actually be callable
2401 and have not been output so far. */
2404 int len
= list_length (globals
);
2405 tree
*vec
= (tree
*) xmalloc (sizeof (tree
) * len
);
2409 /* Process the decls in reverse order--earliest first.
2410 Put them into VEC from back to front, then take out from front. */
2412 for (i
= 0, decl
= globals
; i
< len
; i
++, decl
= TREE_CHAIN (decl
))
2413 vec
[len
- i
- 1] = decl
;
2415 wrapup_global_declarations (vec
, len
);
2417 /* This must occur after the loop to output deferred functions. Else
2418 the profiler initializer would not be emitted if all the functions
2419 in this compilation unit were deferred.
2421 output_func_start_profiler can not cause any additional functions or
2422 data to need to be output, so it need not be in the deferred function
2424 output_func_start_profiler ();
2426 /* Now that all possible functions have been output, we can dump
2427 the exception table. */
2429 #ifndef IA64_UNWIND_INFO
2430 output_exception_table ();
2432 free_exception_table ();
2434 check_global_declarations (vec
, len
);
2440 /* Write out any pending weak symbol declarations. */
2444 /* Do dbx symbols. */
2445 timevar_push (TV_SYMOUT
);
2446 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2447 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2448 dbxout_finish (asm_out_file
, main_input_filename
);
2451 #ifdef DWARF_DEBUGGING_INFO
2452 if (write_symbols
== DWARF_DEBUG
)
2456 #ifdef DWARF2_UNWIND_INFO
2457 if (dwarf2out_do_frame ())
2458 dwarf2out_frame_finish ();
2461 #ifdef DWARF2_DEBUGGING_INFO
2462 if (write_symbols
== DWARF2_DEBUG
)
2463 dwarf2out_finish ();
2465 timevar_pop (TV_SYMOUT
);
2467 /* Output some stuff at end of file if nec. */
2469 end_final (dump_base_name
);
2471 if (profile_arc_flag
|| flag_test_coverage
|| flag_branch_probabilities
)
2473 timevar_push (TV_DUMP
);
2474 open_dump_file (DFI_bp
, NULL
);
2478 close_dump_file (DFI_bp
, NULL
, NULL_RTX
);
2479 timevar_pop (TV_DUMP
);
2483 ASM_FILE_END (asm_out_file
);
2486 /* Language-specific end of compilation actions. */
2488 if (lang_hooks
.finish
)
2489 (*lang_hooks
.finish
) ();
2491 /* Close the dump files. */
2493 if (flag_gen_aux_info
)
2495 fclose (aux_info_file
);
2497 unlink (aux_info_file_name
);
2500 if (optimize
> 0 && open_dump_file (DFI_combine
, NULL
))
2502 timevar_push (TV_DUMP
);
2503 dump_combine_total_stats (rtl_dump_file
);
2504 close_dump_file (DFI_combine
, NULL
, NULL_RTX
);
2505 timevar_pop (TV_DUMP
);
2508 /* Close non-debugging input and output files. Take special care to note
2509 whether fclose returns an error, since the pages might still be on the
2510 buffer chain while the file is open. */
2514 if (ferror (asm_out_file
) != 0 || fclose (asm_out_file
) != 0)
2515 fatal_io_error (asm_file_name
);
2517 /* Do whatever is necessary to finish printing the graphs. */
2518 if (graph_dump_format
!= no_graph
)
2522 for (i
= 0; i
< DFI_MAX
; ++i
)
2523 if (dump_file
[i
].initialized
&& dump_file
[i
].graph_dump_p
)
2528 sprintf (seq
, ".%02d.", i
);
2529 suffix
= concat (seq
, dump_file
[i
].extension
, NULL
);
2530 finish_graph_dump_file (dump_base_name
, suffix
);
2537 ggc_print_statistics ();
2538 stringpool_statistics ();
2541 /* Free up memory for the benefit of leak detectors. */
2544 /* Stop timing total execution time. */
2545 timevar_stop (TV_TOTAL
);
2547 /* Print the times. */
2549 timevar_print (stderr
);
2552 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2553 and TYPE_DECL nodes.
2555 This does nothing for local (non-static) variables, unless the
2556 variable is a register variable with an ASMSPEC. In that case, or
2557 if the variable is not an automatice, it sets up the RTL and
2558 outputs any assembler code (label definition, storage allocation
2559 and initialization).
2561 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2562 the assembler symbol name to be used. TOP_LEVEL is nonzero
2563 if this declaration is not within a function. */
2566 rest_of_decl_compilation (decl
, asmspec
, top_level
, at_end
)
2568 const char *asmspec
;
2572 /* Declarations of variables, and of functions defined elsewhere. */
2574 /* The most obvious approach, to put an #ifndef around where
2575 this macro is used, doesn't work since it's inside a macro call. */
2576 #ifndef ASM_FINISH_DECLARE_OBJECT
2577 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2580 /* Forward declarations for nested functions are not "external",
2581 but we need to treat them as if they were. */
2582 if (TREE_STATIC (decl
) || DECL_EXTERNAL (decl
)
2583 || TREE_CODE (decl
) == FUNCTION_DECL
)
2585 timevar_push (TV_VARCONST
);
2586 make_decl_rtl (decl
, asmspec
);
2587 /* Initialized extern variable exists to be replaced
2588 with its value, or represents something that will be
2589 output in another file. */
2590 if (! (TREE_CODE (decl
) == VAR_DECL
2591 && DECL_EXTERNAL (decl
) && TREE_READONLY (decl
)
2592 && DECL_INITIAL (decl
) != 0
2593 && DECL_INITIAL (decl
) != error_mark_node
))
2594 /* Don't output anything
2595 when a tentative file-scope definition is seen.
2596 But at end of compilation, do output code for them. */
2597 if (! (! at_end
&& top_level
2598 && (DECL_INITIAL (decl
) == 0
2599 || DECL_INITIAL (decl
) == error_mark_node
)))
2600 assemble_variable (decl
, top_level
, at_end
, 0);
2601 if (decl
== last_assemble_variable_decl
)
2603 ASM_FINISH_DECLARE_OBJECT (asm_out_file
, decl
,
2606 timevar_pop (TV_VARCONST
);
2608 else if (DECL_REGISTER (decl
) && asmspec
!= 0)
2610 if (decode_reg_name (asmspec
) >= 0)
2612 DECL_RTL (decl
) = 0;
2613 make_decl_rtl (decl
, asmspec
);
2617 error ("invalid register name `%s' for register variable", asmspec
);
2618 DECL_REGISTER (decl
) = 0;
2619 make_decl_rtl (decl
, NULL
);
2622 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2623 else if ((write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2624 && TREE_CODE (decl
) == TYPE_DECL
)
2626 timevar_push (TV_SYMOUT
);
2627 dbxout_symbol (decl
, 0);
2628 timevar_pop (TV_SYMOUT
);
2631 #ifdef SDB_DEBUGGING_INFO
2632 else if (write_symbols
== SDB_DEBUG
&& top_level
2633 && TREE_CODE (decl
) == TYPE_DECL
)
2635 timevar_push (TV_SYMOUT
);
2636 sdbout_symbol (decl
, 0);
2637 timevar_pop (TV_SYMOUT
);
2642 /* Called after finishing a record, union or enumeral type. */
2645 rest_of_type_compilation (type
, toplev
)
2646 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
2650 tree type ATTRIBUTE_UNUSED
;
2651 int toplev ATTRIBUTE_UNUSED
;
2654 timevar_push (TV_SYMOUT
);
2655 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2656 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2657 dbxout_symbol (TYPE_STUB_DECL (type
), !toplev
);
2659 #ifdef SDB_DEBUGGING_INFO
2660 if (write_symbols
== SDB_DEBUG
)
2661 sdbout_symbol (TYPE_STUB_DECL (type
), !toplev
);
2663 #ifdef DWARF2_DEBUGGING_INFO
2664 if (write_symbols
== DWARF2_DEBUG
&& toplev
)
2665 dwarf2out_decl (TYPE_STUB_DECL (type
));
2667 timevar_pop (TV_SYMOUT
);
2670 /* DECL is an inline function, whose body is present, but which is not
2671 being output at this point. (We're putting that off until we need
2672 to do it.) If there are any actions that need to take place,
2673 including the emission of debugging information for the function,
2674 this is where they should go. This function may be called by
2675 language-dependent code for front-ends that do not even generate
2676 RTL for functions that don't need to be put out. */
2679 note_deferral_of_defined_inline_function (decl
)
2680 tree decl ATTRIBUTE_UNUSED
;
2682 #ifdef DWARF_DEBUGGING_INFO
2683 /* Generate the DWARF info for the "abstract" instance of a function
2684 which we may later generate inlined and/or out-of-line instances
2686 if (write_symbols
== DWARF_DEBUG
&& DECL_INLINE (decl
))
2688 /* The front-end may not have set CURRENT_FUNCTION_DECL, but the
2689 DWARF code expects it to be set in this case. Intuitively,
2690 DECL is the function we just finished defining, so setting
2691 CURRENT_FUNCTION_DECL is sensible. */
2692 tree saved_cfd
= current_function_decl
;
2693 current_function_decl
= decl
;
2695 /* Let the DWARF code do its work. */
2696 set_decl_abstract_flags (decl
, 1);
2697 dwarfout_file_scope_decl (decl
, 0);
2698 set_decl_abstract_flags (decl
, 0);
2700 /* Reset CURRENT_FUNCTION_DECL. */
2701 current_function_decl
= saved_cfd
;
2706 /* This is called from finish_function (within yyparse)
2707 after each top-level definition is parsed.
2708 It is supposed to compile that function or variable
2709 and output the assembler code for it.
2710 After we return, the tree storage is freed. */
2713 rest_of_compilation (decl
)
2719 int rebuild_label_notes_after_reload
;
2720 int register_life_up_to_date
;
2722 timevar_push (TV_REST_OF_COMPILATION
);
2724 /* Now that we're out of the frontend, we shouldn't have any more
2725 CONCATs anywhere. */
2726 generating_concat_p
= 0;
2728 /* When processing delayed functions, prepare_function_start() won't
2729 have been run to re-initialize it. */
2730 cse_not_expected
= ! optimize
;
2732 /* First, make sure that NOTE_BLOCK is set correctly for each
2733 NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
2734 if (!cfun
->x_whole_function_mode_p
)
2737 /* Then remove any notes we don't need. That will make iterating
2738 over the instruction sequence faster, and allow the garbage
2739 collector to reclaim the memory used by the notes. */
2740 remove_unnecessary_notes ();
2742 /* In function-at-a-time mode, we do not attempt to keep the BLOCK
2743 tree in sensible shape. So, we just recalculate it here. */
2744 if (cfun
->x_whole_function_mode_p
)
2749 /* If we are reconsidering an inline function
2750 at the end of compilation, skip the stuff for making it inline. */
2752 if (DECL_SAVED_INSNS (decl
) == 0)
2758 /* If this is nested inside an inlined external function, pretend
2759 it was only declared. Since we cannot inline such functions,
2760 generating code for this one is not only not necessary but will
2761 confuse some debugging output writers. */
2762 for (parent
= DECL_CONTEXT (current_function_decl
);
2763 parent
!= NULL_TREE
;
2764 parent
= get_containing_scope (parent
))
2765 if (TREE_CODE (parent
) == FUNCTION_DECL
2766 && DECL_INLINE (parent
) && DECL_EXTERNAL (parent
))
2768 DECL_INITIAL (decl
) = 0;
2769 goto exit_rest_of_compilation
;
2772 /* If requested, consider whether to make this function inline. */
2773 if (DECL_INLINE (decl
) || flag_inline_functions
)
2775 timevar_push (TV_INTEGRATION
);
2776 lose
= function_cannot_inline_p (decl
);
2777 timevar_pop (TV_INTEGRATION
);
2778 if (lose
|| ! optimize
)
2780 if (warn_inline
&& DECL_INLINE (decl
))
2781 warning_with_decl (decl
, lose
);
2782 DECL_ABSTRACT_ORIGIN (decl
) = 0;
2783 /* Don't really compile an extern inline function.
2784 If we can't make it inline, pretend
2785 it was only declared. */
2786 if (DECL_EXTERNAL (decl
))
2788 DECL_INITIAL (decl
) = 0;
2789 goto exit_rest_of_compilation
;
2793 /* ??? Note that this has the effect of making it look
2794 like "inline" was specified for a function if we choose
2795 to inline it. This isn't quite right, but it's
2796 probably not worth the trouble to fix. */
2797 inlinable
= DECL_INLINE (decl
) = 1;
2800 insns
= get_insns ();
2802 /* Dump the rtl code if we are dumping rtl. */
2804 if (open_dump_file (DFI_rtl
, decl
))
2806 if (DECL_SAVED_INSNS (decl
))
2807 fprintf (rtl_dump_file
, ";; (integrable)\n\n");
2808 close_dump_file (DFI_rtl
, print_rtl
, insns
);
2811 /* If function is inline, and we don't yet know whether to
2812 compile it by itself, defer decision till end of compilation.
2813 finish_compilation will call rest_of_compilation again
2814 for those functions that need to be output. Also defer those
2815 functions that we are supposed to defer. */
2818 || (DECL_INLINE (decl
)
2819 && ((! TREE_PUBLIC (decl
) && ! TREE_ADDRESSABLE (decl
)
2820 && ! flag_keep_inline_functions
)
2821 || DECL_EXTERNAL (decl
))))
2822 DECL_DEFER_OUTPUT (decl
) = 1;
2824 if (DECL_INLINE (decl
))
2825 /* DWARF wants seperate debugging info for abstract and
2826 concrete instances of all inline functions, including those
2827 declared inline but not inlined, and those inlined even
2828 though they weren't declared inline. Conveniently, that's
2829 what DECL_INLINE means at this point. */
2830 note_deferral_of_defined_inline_function (decl
);
2832 if (DECL_DEFER_OUTPUT (decl
))
2834 /* If -Wreturn-type, we have to do a bit of compilation. We just
2835 want to call jump_optimize to figure out whether or not we can
2836 fall off the end of the function; we do the minimum amount of
2837 work necessary to make that safe. And, we set optimize to zero
2838 to keep jump_optimize from working too hard. */
2839 if (warn_return_type
)
2841 int saved_optimize
= optimize
;
2844 find_exception_handler_labels ();
2845 jump_optimize (insns
, !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
2846 !JUMP_AFTER_REGSCAN
);
2847 optimize
= saved_optimize
;
2850 current_function_nothrow
= nothrow_function_p ();
2851 if (current_function_nothrow
)
2852 /* Now we know that this can't throw; set the flag for the benefit
2853 of other functions later in this translation unit. */
2854 TREE_NOTHROW (current_function_decl
) = 1;
2856 timevar_push (TV_INTEGRATION
);
2857 save_for_inline (decl
);
2858 timevar_pop (TV_INTEGRATION
);
2859 DECL_SAVED_INSNS (decl
)->inlinable
= inlinable
;
2860 goto exit_rest_of_compilation
;
2863 /* If specified extern inline but we aren't inlining it, we are
2864 done. This goes for anything that gets here with DECL_EXTERNAL
2865 set, not just things with DECL_INLINE. */
2866 if (DECL_EXTERNAL (decl
))
2867 goto exit_rest_of_compilation
;
2870 init_EXPR_INSN_LIST_cache ();
2874 /* Initialize some variables used by the optimizers. */
2875 init_function_for_compilation ();
2877 if (! DECL_DEFER_OUTPUT (decl
))
2878 TREE_ASM_WRITTEN (decl
) = 1;
2880 /* Now that integrate will no longer see our rtl, we need not
2881 distinguish between the return value of this function and the
2882 return value of called functions. Also, we can remove all SETs
2883 of subregs of hard registers; they are only here because of
2885 rtx_equal_function_value_matters
= 0;
2886 purge_hard_subreg_sets (get_insns ());
2888 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
2889 if ((rtl_dump_and_exit
|| flag_syntax_only
) && !warn_return_type
)
2890 goto exit_rest_of_compilation
;
2892 /* Emit code to get eh context, if needed. */
2895 /* We may have potential sibling or tail recursion sites. Select one
2896 (of possibly multiple) methods of performing the call. */
2897 if (flag_optimize_sibling_calls
)
2899 timevar_push (TV_JUMP
);
2900 open_dump_file (DFI_sibling
, decl
);
2902 optimize_sibling_and_tail_recursive_calls ();
2904 close_dump_file (DFI_sibling
, print_rtl
, get_insns ());
2905 timevar_pop (TV_JUMP
);
2909 /* If we are doing position-independent code generation, now
2910 is the time to output special prologues and epilogues.
2911 We do not want to do this earlier, because it just clutters
2912 up inline functions with meaningless insns. */
2917 insns
= get_insns ();
2919 /* Copy any shared structure that should not be shared. */
2920 unshare_all_rtl (current_function_decl
, insns
);
2922 #ifdef SETJMP_VIA_SAVE_AREA
2923 /* This must be performed before virutal register instantiation. */
2924 if (current_function_calls_alloca
)
2925 optimize_save_area_alloca (insns
);
2928 /* Instantiate all virtual registers. */
2929 instantiate_virtual_regs (current_function_decl
, insns
);
2931 /* Find all the EH handlers. */
2932 find_exception_handler_labels ();
2934 open_dump_file (DFI_jump
, decl
);
2936 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
2937 are initialized and to compute whether control can drop off the end
2940 timevar_push (TV_JUMP
);
2941 /* Turn NOTE_INSN_EXPECTED_VALUE into REG_BR_PROB. Do this
2942 before jump optimization switches branch directions. */
2943 expected_value_to_br_prob ();
2945 reg_scan (insns
, max_reg_num (), 0);
2946 jump_optimize (insns
, !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
2947 JUMP_AFTER_REGSCAN
);
2949 timevar_pop (TV_JUMP
);
2951 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
2952 if (rtl_dump_and_exit
|| flag_syntax_only
|| DECL_DEFER_OUTPUT (decl
))
2954 close_dump_file (DFI_jump
, print_rtl
, insns
);
2955 goto exit_rest_of_compilation
;
2958 timevar_push (TV_JUMP
);
2962 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
);
2963 cleanup_cfg (insns
);
2965 /* ??? Run if-conversion before delete_null_pointer_checks,
2966 since the later does not preserve the CFG. This should
2967 be changed -- no since converting if's that are going to
2969 timevar_push (TV_IFCVT
);
2971 timevar_pop (TV_IFCVT
);
2973 /* Try to identify useless null pointer tests and delete them. */
2974 if (flag_delete_null_pointer_checks
)
2975 delete_null_pointer_checks (insns
);
2978 /* Jump optimization, and the removal of NULL pointer checks, may
2979 have reduced the number of instructions substantially. CSE, and
2980 future passes, allocate arrays whose dimensions involve the
2981 maximum instruction UID, so if we can reduce the maximum UID
2982 we'll save big on memory. */
2983 renumber_insns (rtl_dump_file
);
2984 timevar_pop (TV_JUMP
);
2986 close_dump_file (DFI_jump
, print_rtl
, insns
);
2990 /* Perform common subexpression elimination.
2991 Nonzero value from `cse_main' means that jumps were simplified
2992 and some code may now be unreachable, so do
2993 jump optimization again. */
2997 open_dump_file (DFI_cse
, decl
);
2998 timevar_push (TV_CSE
);
3000 reg_scan (insns
, max_reg_num (), 1);
3002 if (flag_thread_jumps
)
3004 timevar_push (TV_JUMP
);
3005 thread_jumps (insns
, max_reg_num (), 1);
3006 timevar_pop (TV_JUMP
);
3009 tem
= cse_main (insns
, max_reg_num (), 0, rtl_dump_file
);
3011 /* If we are not running the second CSE pass, then we are no longer
3012 expecting CSE to be run. */
3013 cse_not_expected
= !flag_rerun_cse_after_loop
;
3015 if (tem
|| optimize
> 1)
3017 timevar_push (TV_JUMP
);
3018 jump_optimize (insns
, !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
3019 !JUMP_AFTER_REGSCAN
);
3020 timevar_pop (TV_JUMP
);
3023 /* Run this after jump optmizations remove all the unreachable code
3024 so that unreachable code will not keep values live. */
3025 delete_trivially_dead_insns (insns
, max_reg_num ());
3027 /* Try to identify useless null pointer tests and delete them. */
3028 if (flag_delete_null_pointer_checks
)
3030 timevar_push (TV_JUMP
);
3031 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
);
3033 cleanup_cfg (insns
);
3035 delete_null_pointer_checks (insns
);
3036 timevar_pop (TV_JUMP
);
3039 /* The second pass of jump optimization is likely to have
3040 removed a bunch more instructions. */
3041 renumber_insns (rtl_dump_file
);
3043 timevar_pop (TV_CSE
);
3044 close_dump_file (DFI_cse
, print_rtl
, insns
);
3047 open_dump_file (DFI_addressof
, decl
);
3049 purge_addressof (insns
);
3050 reg_scan (insns
, max_reg_num (), 1);
3052 close_dump_file (DFI_addressof
, print_rtl
, insns
);
3056 if (optimize
> 0 && flag_ssa
)
3058 /* Convert to SSA form. */
3060 timevar_push (TV_TO_SSA
);
3061 open_dump_file (DFI_ssa
, decl
);
3063 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
);
3064 cleanup_cfg (insns
);
3067 close_dump_file (DFI_ssa
, print_rtl_with_bb
, insns
);
3068 timevar_pop (TV_TO_SSA
);
3070 /* The SSA implementation uses basic block numbers in its phi
3071 nodes. Thus, changing the control-flow graph or the basic
3072 blocks, e.g., calling find_basic_blocks () or cleanup_cfg (),
3073 may cause problems. */
3077 /* Remove dead code. */
3079 timevar_push (TV_DEAD_CODE_ELIM
);
3080 open_dump_file (DFI_dce
, decl
);
3082 insns
= get_insns ();
3083 eliminate_dead_code();
3085 close_dump_file (DFI_dce
, print_rtl_with_bb
, insns
);
3086 timevar_pop (TV_DEAD_CODE_ELIM
);
3089 /* Convert from SSA form. */
3091 timevar_push (TV_FROM_SSA
);
3092 open_dump_file (DFI_ussa
, decl
);
3094 convert_from_ssa ();
3095 /* New registers have been created. Rescan their usage. */
3096 reg_scan (insns
, max_reg_num (), 1);
3097 /* Life analysis used in SSA adds log_links but these
3098 shouldn't be there until the flow stage, so clear
3100 clear_log_links (insns
);
3102 close_dump_file (DFI_ussa
, print_rtl_with_bb
, insns
);
3103 timevar_pop (TV_FROM_SSA
);
3108 /* Perform global cse. */
3110 if (optimize
> 0 && flag_gcse
)
3112 timevar_push (TV_GCSE
);
3113 open_dump_file (DFI_gcse
, decl
);
3115 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
);
3116 cleanup_cfg (insns
);
3117 tem
= gcse_main (insns
, rtl_dump_file
);
3119 /* If gcse altered any jumps, rerun jump optimizations to clean
3123 timevar_push (TV_JUMP
);
3124 jump_optimize (insns
, !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
3125 !JUMP_AFTER_REGSCAN
);
3126 timevar_pop (TV_JUMP
);
3129 close_dump_file (DFI_gcse
, print_rtl
, insns
);
3130 timevar_pop (TV_GCSE
);
3135 /* Move constant computations out of loops. */
3139 timevar_push (TV_LOOP
);
3140 open_dump_file (DFI_loop
, decl
);
3142 if (flag_rerun_loop_opt
)
3144 /* We only want to perform unrolling once. */
3146 loop_optimize (insns
, rtl_dump_file
, 0);
3148 /* The first call to loop_optimize makes some instructions
3149 trivially dead. We delete those instructions now in the
3150 hope that doing so will make the heuristics in loop work
3151 better and possibly speed up compilation. */
3152 delete_trivially_dead_insns (insns
, max_reg_num ());
3154 /* The regscan pass is currently necessary as the alias
3155 analysis code depends on this information. */
3156 reg_scan (insns
, max_reg_num (), 1);
3158 loop_optimize (insns
, rtl_dump_file
,
3159 (flag_unroll_loops
? LOOP_UNROLL
: 0) | LOOP_BCT
);
3161 close_dump_file (DFI_loop
, print_rtl
, insns
);
3162 timevar_pop (TV_LOOP
);
3169 timevar_push (TV_CSE2
);
3170 open_dump_file (DFI_cse2
, decl
);
3172 if (flag_rerun_cse_after_loop
)
3174 /* Running another jump optimization pass before the second
3175 cse pass sometimes simplifies the RTL enough to allow
3176 the second CSE pass to do a better job. Jump_optimize can change
3177 max_reg_num so we must rerun reg_scan afterwards.
3178 ??? Rework to not call reg_scan so often. */
3179 timevar_push (TV_JUMP
);
3181 reg_scan (insns
, max_reg_num (), 0);
3182 jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3183 !JUMP_NOOP_MOVES
, JUMP_AFTER_REGSCAN
);
3185 timevar_push (TV_IFCVT
);
3187 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
);
3188 cleanup_cfg (insns
);
3191 timevar_pop(TV_IFCVT
);
3193 timevar_pop (TV_JUMP
);
3195 reg_scan (insns
, max_reg_num (), 0);
3196 tem
= cse_main (insns
, max_reg_num (), 1, rtl_dump_file
);
3200 timevar_push (TV_JUMP
);
3201 jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3202 !JUMP_NOOP_MOVES
, !JUMP_AFTER_REGSCAN
);
3203 timevar_pop (TV_JUMP
);
3207 if (flag_thread_jumps
)
3209 /* This pass of jump threading straightens out code
3210 that was kinked by loop optimization. */
3211 timevar_push (TV_JUMP
);
3212 reg_scan (insns
, max_reg_num (), 0);
3213 thread_jumps (insns
, max_reg_num (), 0);
3214 timevar_pop (TV_JUMP
);
3217 close_dump_file (DFI_cse2
, print_rtl
, insns
);
3218 timevar_pop (TV_CSE2
);
3223 cse_not_expected
= 1;
3227 /* Do control and data flow analysis; wrote some of the results to
3230 timevar_push (TV_FLOW
);
3231 open_dump_file (DFI_cfg
, decl
);
3233 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
);
3234 cleanup_cfg (insns
);
3235 check_function_return_warnings ();
3237 close_dump_file (DFI_cfg
, print_rtl_with_bb
, insns
);
3239 if (profile_arc_flag
|| flag_test_coverage
|| flag_branch_probabilities
)
3241 timevar_push (TV_BRANCH_PROB
);
3242 open_dump_file (DFI_bp
, decl
);
3246 close_dump_file (DFI_bp
, print_rtl_with_bb
, insns
);
3247 timevar_pop (TV_BRANCH_PROB
);
3250 open_dump_file (DFI_life
, decl
);
3255 /* Discover and record the loop depth at the head of each basic
3256 block. The loop infrastructure does the real job for us. */
3257 flow_loops_find (&loops
, LOOP_TREE
);
3259 /* Estimate using heuristics if no profiling info is available. */
3260 if (flag_guess_branch_prob
)
3261 estimate_probability (&loops
);
3264 flow_loops_dump (&loops
, rtl_dump_file
, NULL
, 0);
3266 flow_loops_free (&loops
);
3268 life_analysis (insns
, rtl_dump_file
, PROP_FINAL
);
3269 mark_constant_function ();
3270 timevar_pop (TV_FLOW
);
3272 register_life_up_to_date
= 1;
3275 if (warn_uninitialized
|| extra_warnings
)
3277 uninitialized_vars_warning (DECL_INITIAL (decl
));
3279 setjmp_args_warning ();
3282 close_dump_file (DFI_life
, print_rtl_with_bb
, insns
);
3286 /* If -opt, try combining insns through substitution. */
3290 int rebuild_jump_labels_after_combine
= 0;
3292 timevar_push (TV_COMBINE
);
3293 open_dump_file (DFI_combine
, decl
);
3295 rebuild_jump_labels_after_combine
3296 = combine_instructions (insns
, max_reg_num ());
3298 /* Combining insns may have turned an indirect jump into a
3299 direct jump. Rebuid the JUMP_LABEL fields of jumping
3301 if (rebuild_jump_labels_after_combine
)
3303 timevar_push (TV_JUMP
);
3304 rebuild_jump_labels (insns
);
3305 timevar_pop (TV_JUMP
);
3307 timevar_push (TV_FLOW
);
3308 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
);
3309 cleanup_cfg (insns
);
3311 /* Blimey. We've got to have the CFG up to date for the call to
3312 if_convert below. However, the random deletion of blocks
3313 without updating life info can wind up with Wierd Stuff in
3314 global_live_at_end. We then run sched1, which updates things
3315 properly, discovers the wierdness and aborts. */
3316 update_life_info (NULL
, UPDATE_LIFE_GLOBAL_RM_NOTES
,
3317 PROP_DEATH_NOTES
| PROP_KILL_DEAD_CODE
3318 | PROP_SCAN_DEAD_CODE
);
3320 timevar_pop (TV_FLOW
);
3323 close_dump_file (DFI_combine
, print_rtl_with_bb
, insns
);
3324 timevar_pop (TV_COMBINE
);
3329 /* Rerun if-conversion, as combine may have simplified things enough to
3330 now meet sequence length restrictions. */
3333 timevar_push (TV_IFCVT
);
3334 open_dump_file (DFI_ce
, decl
);
3340 close_dump_file (DFI_ce
, print_rtl_with_bb
, insns
);
3341 timevar_pop (TV_IFCVT
);
3344 /* Register allocation pre-pass, to reduce number of moves
3345 necessary for two-address machines. */
3346 if (optimize
> 0 && (flag_regmove
|| flag_expensive_optimizations
))
3348 timevar_push (TV_REGMOVE
);
3349 open_dump_file (DFI_regmove
, decl
);
3351 regmove_optimize (insns
, max_reg_num (), rtl_dump_file
);
3353 close_dump_file (DFI_regmove
, print_rtl_with_bb
, insns
);
3354 timevar_pop (TV_REGMOVE
);
3359 /* Any of the several passes since flow1 will have munged register
3360 lifetime data a bit. */
3362 register_life_up_to_date
= 0;
3364 #ifdef OPTIMIZE_MODE_SWITCHING
3365 timevar_push (TV_GCSE
);
3367 if (optimize_mode_switching (NULL_PTR
))
3369 /* We did work, and so had to regenerate global life information.
3370 Take advantage of this and don't re-recompute register life
3371 information below. */
3372 register_life_up_to_date
= 1;
3375 timevar_pop (TV_GCSE
);
3378 #ifdef INSN_SCHEDULING
3380 /* Print function header into sched dump now
3381 because doing the sched analysis makes some of the dump. */
3382 if (optimize
> 0 && flag_schedule_insns
)
3384 timevar_push (TV_SCHED
);
3385 open_dump_file (DFI_sched
, decl
);
3387 /* Do control and data sched analysis,
3388 and write some of the results to dump file. */
3390 schedule_insns (rtl_dump_file
);
3392 close_dump_file (DFI_sched
, print_rtl_with_bb
, insns
);
3393 timevar_pop (TV_SCHED
);
3397 /* Register lifetime information was updated as part of verifying
3399 register_life_up_to_date
= 1;
3403 /* Determine if the current function is a leaf before running reload
3404 since this can impact optimizations done by the prologue and
3405 epilogue thus changing register elimination offsets. */
3406 current_function_is_leaf
= leaf_function_p ();
3408 timevar_push (TV_LOCAL_ALLOC
);
3409 open_dump_file (DFI_lreg
, decl
);
3411 /* Allocate pseudo-regs that are used only within 1 basic block.
3413 RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
3414 jump optimizer after register allocation and reloading are finished. */
3416 if (! register_life_up_to_date
)
3417 recompute_reg_usage (insns
, ! optimize_size
);
3418 regclass (insns
, max_reg_num (), rtl_dump_file
);
3419 rebuild_label_notes_after_reload
= local_alloc ();
3421 timevar_pop (TV_LOCAL_ALLOC
);
3423 if (dump_file
[DFI_lreg
].enabled
)
3425 timevar_push (TV_DUMP
);
3427 dump_flow_info (rtl_dump_file
);
3428 dump_local_alloc (rtl_dump_file
);
3430 close_dump_file (DFI_lreg
, print_rtl_with_bb
, insns
);
3431 timevar_pop (TV_DUMP
);
3436 timevar_push (TV_GLOBAL_ALLOC
);
3437 open_dump_file (DFI_greg
, decl
);
3439 /* If optimizing, allocate remaining pseudo-regs. Do the reload
3440 pass fixing up any insns that are invalid. */
3443 failure
= global_alloc (rtl_dump_file
);
3446 build_insn_chain (insns
);
3447 failure
= reload (insns
, 0);
3450 timevar_pop (TV_GLOBAL_ALLOC
);
3452 if (dump_file
[DFI_greg
].enabled
)
3454 timevar_push (TV_DUMP
);
3456 dump_global_regs (rtl_dump_file
);
3458 close_dump_file (DFI_greg
, print_rtl_with_bb
, insns
);
3459 timevar_pop (TV_DUMP
);
3463 goto exit_rest_of_compilation
;
3467 open_dump_file (DFI_postreload
, decl
);
3469 /* Do a very simple CSE pass over just the hard registers. */
3472 timevar_push (TV_RELOAD_CSE_REGS
);
3473 reload_cse_regs (insns
);
3474 timevar_pop (TV_RELOAD_CSE_REGS
);
3477 /* If optimizing, then go ahead and split insns now since we are about
3478 to recompute flow information anyway. */
3481 int old_labelnum
= max_label_num ();
3483 split_all_insns (0);
3484 rebuild_label_notes_after_reload
|= old_labelnum
!= max_label_num ();
3487 /* Register allocation and reloading may have turned an indirect jump into
3488 a direct jump. If so, we must rebuild the JUMP_LABEL fields of
3489 jumping instructions. */
3490 if (rebuild_label_notes_after_reload
)
3492 timevar_push (TV_JUMP
);
3494 rebuild_jump_labels (insns
);
3496 timevar_pop (TV_JUMP
);
3499 close_dump_file (DFI_postreload
, print_rtl_with_bb
, insns
);
3501 /* Re-create the death notes which were deleted during reload. */
3502 timevar_push (TV_FLOW2
);
3503 open_dump_file (DFI_flow2
, decl
);
3505 jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3506 JUMP_NOOP_MOVES
, !JUMP_AFTER_REGSCAN
);
3507 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
);
3509 /* On some machines, the prologue and epilogue code, or parts thereof,
3510 can be represented as RTL. Doing so lets us schedule insns between
3511 it and the rest of the code and also allows delayed branch
3512 scheduling to operate in the epilogue. */
3513 thread_prologue_and_epilogue_insns (insns
);
3517 cleanup_cfg (insns
);
3518 life_analysis (insns
, rtl_dump_file
, PROP_FINAL
);
3520 /* This is kind of a heuristic. We need to run combine_stack_adjustments
3521 even for machines with possibly nonzero RETURN_POPS_ARGS
3522 and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having
3523 push instructions will have popping returns. */
3524 #ifndef PUSH_ROUNDING
3525 if (!ACCUMULATE_OUTGOING_ARGS
)
3527 combine_stack_adjustments ();
3532 flow2_completed
= 1;
3534 close_dump_file (DFI_flow2
, print_rtl_with_bb
, insns
);
3535 timevar_pop (TV_FLOW2
);
3537 #ifdef HAVE_peephole2
3538 if (optimize
> 0 && flag_peephole2
)
3540 timevar_push (TV_PEEPHOLE2
);
3541 open_dump_file (DFI_peephole2
, decl
);
3543 peephole2_optimize (rtl_dump_file
);
3545 close_dump_file (DFI_peephole2
, print_rtl_with_bb
, insns
);
3546 timevar_pop (TV_PEEPHOLE2
);
3550 if (optimize
> 0 && flag_rename_registers
)
3552 timevar_push (TV_RENAME_REGISTERS
);
3553 open_dump_file (DFI_rnreg
, decl
);
3555 regrename_optimize ();
3557 close_dump_file (DFI_rnreg
, print_rtl_with_bb
, insns
);
3558 timevar_pop (TV_RENAME_REGISTERS
);
3563 timevar_push (TV_IFCVT2
);
3564 open_dump_file (DFI_ce2
, decl
);
3568 close_dump_file (DFI_ce2
, print_rtl_with_bb
, insns
);
3569 timevar_pop (TV_IFCVT2
);
3572 #ifdef INSN_SCHEDULING
3573 if (optimize
> 0 && flag_schedule_insns_after_reload
)
3575 timevar_push (TV_SCHED2
);
3576 open_dump_file (DFI_sched2
, decl
);
3578 /* Do control and data sched analysis again,
3579 and write some more of the results to dump file. */
3581 schedule_insns (rtl_dump_file
);
3583 close_dump_file (DFI_sched2
, print_rtl_with_bb
, insns
);
3584 timevar_pop (TV_SCHED2
);
3590 #ifdef LEAF_REGISTERS
3591 current_function_uses_only_leaf_regs
3592 = optimize
> 0 && only_leaf_regs_used () && leaf_function_p ();
3595 if (optimize
> 0 && flag_reorder_blocks
)
3597 timevar_push (TV_REORDER_BLOCKS
);
3598 open_dump_file (DFI_bbro
, decl
);
3600 reorder_basic_blocks ();
3602 close_dump_file (DFI_bbro
, print_rtl_with_bb
, insns
);
3603 timevar_pop (TV_REORDER_BLOCKS
);
3606 /* One more attempt to remove jumps to .+1 left by dead-store elimination.
3607 Also do cross-jumping this time and delete no-op move insns. */
3611 timevar_push (TV_JUMP
);
3612 open_dump_file (DFI_jump2
, decl
);
3614 jump_optimize (insns
, JUMP_CROSS_JUMP
, JUMP_NOOP_MOVES
,
3615 !JUMP_AFTER_REGSCAN
);
3617 /* CFG no longer kept up to date. */
3619 close_dump_file (DFI_jump2
, print_rtl
, insns
);
3620 timevar_pop (TV_JUMP
);
3623 /* If a machine dependent reorganization is needed, call it. */
3624 #ifdef MACHINE_DEPENDENT_REORG
3625 open_dump_file (DFI_mach
, decl
);
3627 MACHINE_DEPENDENT_REORG (insns
);
3629 close_dump_file (DFI_mach
, print_rtl
, insns
);
3634 /* If a scheduling pass for delayed branches is to be done,
3635 call the scheduling code. */
3638 if (optimize
> 0 && flag_delayed_branch
)
3640 timevar_push (TV_DBR_SCHED
);
3641 open_dump_file (DFI_dbr
, decl
);
3643 dbr_schedule (insns
, rtl_dump_file
);
3645 close_dump_file (DFI_dbr
, print_rtl
, insns
);
3646 timevar_pop (TV_DBR_SCHED
);
3652 /* Shorten branches.
3654 Note this must run before reg-stack because of death note (ab)use
3655 in the ia32 backend. */
3656 timevar_push (TV_SHORTEN_BRANCH
);
3657 shorten_branches (get_insns ());
3658 timevar_pop (TV_SHORTEN_BRANCH
);
3661 timevar_push (TV_REG_STACK
);
3662 open_dump_file (DFI_stack
, decl
);
3664 reg_to_stack (insns
, rtl_dump_file
);
3666 close_dump_file (DFI_stack
, print_rtl
, insns
);
3667 timevar_pop (TV_REG_STACK
);
3672 current_function_nothrow
= nothrow_function_p ();
3673 if (current_function_nothrow
)
3674 /* Now we know that this can't throw; set the flag for the benefit
3675 of other functions later in this translation unit. */
3676 TREE_NOTHROW (current_function_decl
) = 1;
3678 /* Now turn the rtl into assembler code. */
3680 timevar_push (TV_FINAL
);
3685 /* Get the function's name, as described by its RTL. This may be
3686 different from the DECL_NAME name used in the source file. */
3688 x
= DECL_RTL (decl
);
3689 if (GET_CODE (x
) != MEM
)
3692 if (GET_CODE (x
) != SYMBOL_REF
)
3694 fnname
= XSTR (x
, 0);
3696 assemble_start_function (decl
, fnname
);
3697 final_start_function (insns
, asm_out_file
, optimize
);
3698 final (insns
, asm_out_file
, optimize
, 0);
3699 final_end_function (insns
, asm_out_file
, optimize
);
3700 assemble_end_function (decl
, fnname
);
3702 fflush (asm_out_file
);
3704 /* Release all memory allocated by flow. */
3705 free_basic_block_vars (0);
3707 /* Release all memory held by regsets now. */
3708 regset_release_memory ();
3710 timevar_pop (TV_FINAL
);
3714 /* Write DBX symbols if requested. */
3716 /* Note that for those inline functions where we don't initially
3717 know for certain that we will be generating an out-of-line copy,
3718 the first invocation of this routine (rest_of_compilation) will
3719 skip over this code by doing a `goto exit_rest_of_compilation;'.
3720 Later on, finish_compilation will call rest_of_compilation again
3721 for those inline functions that need to have out-of-line copies
3722 generated. During that call, we *will* be routed past here. */
3724 timevar_push (TV_SYMOUT
);
3725 #ifdef DBX_DEBUGGING_INFO
3726 if (write_symbols
== DBX_DEBUG
)
3727 dbxout_function (decl
);
3730 #ifdef DWARF_DEBUGGING_INFO
3731 if (write_symbols
== DWARF_DEBUG
)
3732 dwarfout_file_scope_decl (decl
, 0);
3735 #ifdef DWARF2_DEBUGGING_INFO
3736 if (write_symbols
== DWARF2_DEBUG
)
3737 dwarf2out_decl (decl
);
3739 timevar_pop (TV_SYMOUT
);
3741 exit_rest_of_compilation
:
3743 /* In case the function was not output,
3744 don't leave any temporary anonymous types
3745 queued up for sdb output. */
3746 #ifdef SDB_DEBUGGING_INFO
3747 if (write_symbols
== SDB_DEBUG
)
3748 sdbout_types (NULL_TREE
);
3751 reload_completed
= 0;
3752 flow2_completed
= 0;
3755 timevar_push (TV_FINAL
);
3757 /* Clear out the insn_length contents now that they are no
3759 init_insn_lengths ();
3761 /* Clear out the real_constant_chain before some of the rtx's
3762 it runs through become garbage. */
3763 clear_const_double_mem ();
3765 /* Show no temporary slots allocated. */
3768 free_basic_block_vars (0);
3770 timevar_pop (TV_FINAL
);
3772 /* Make sure volatile mem refs aren't considered valid operands for
3773 arithmetic insns. We must call this here if this is a nested inline
3774 function, since the above code leaves us in the init_recog state
3775 (from final.c), and the function context push/pop code does not
3776 save/restore volatile_ok.
3778 ??? Maybe it isn't necessary for expand_start_function to call this
3779 anymore if we do it here? */
3781 init_recog_no_volatile ();
3783 /* We're done with this function. Free up memory if we can. */
3784 free_after_parsing (cfun
);
3785 if (! DECL_DEFER_OUTPUT (decl
))
3786 free_after_compilation (cfun
);
3791 timevar_pop (TV_REST_OF_COMPILATION
);
3801 printf (_(" -ffixed-<register> Mark <register> as being unavailable to the compiler\n"));
3802 printf (_(" -fcall-used-<register> Mark <register> as being corrupted by function calls\n"));
3803 printf (_(" -fcall-saved-<register> Mark <register> as being preserved across functions\n"));
3804 printf (_(" -finline-limit=<number> Limits the size of inlined functions to <number>\n"));
3805 printf (_(" -fmessage-length=<number> Limits diagnostics messages lengths to <number> characters per line. 0 suppresses line-wrapping\n"));
3806 printf (_(" -fdiagnostics-show-location=[once | every-line] Indicates how often source location information should be emitted, as prefix, at the beginning of diagnostics when line-wrapping\n"));
3808 for (i
= ARRAY_SIZE (f_options
); i
--;)
3810 const char *description
= f_options
[i
].description
;
3812 if (description
!= NULL
&& * description
!= 0)
3813 printf (" -f%-21s %s\n",
3814 f_options
[i
].string
, description
);
3817 printf (_(" -O[number] Set optimisation level to [number]\n"));
3818 printf (_(" -Os Optimise for space rather than speed\n"));
3819 printf (_(" -pedantic Issue warnings needed by strict compliance to ISO C\n"));
3820 printf (_(" -pedantic-errors Like -pedantic except that errors are produced\n"));
3821 printf (_(" -w Suppress warnings\n"));
3822 printf (_(" -W Enable extra warnings\n"));
3824 for (i
= ARRAY_SIZE (W_options
); i
--;)
3826 const char *description
= W_options
[i
].description
;
3828 if (description
!= NULL
&& * description
!= 0)
3829 printf (" -W%-21s %s\n",
3830 W_options
[i
].string
, description
);
3833 printf (_(" -Wunused Enable unused warnings\n"));
3834 printf (_(" -Wid-clash-<num> Warn if 2 identifiers have the same first <num> chars\n"));
3835 printf (_(" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n"));
3836 printf (_(" -p Enable function profiling\n"));
3837 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER)
3838 printf (_(" -a Enable block profiling \n"));
3840 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER) || defined FUNCTION_BLOCK_PROFILER_EXIT
3841 printf (_(" -ax Enable jump profiling \n"));
3843 printf (_(" -o <file> Place output into <file> \n"));
3845 -G <number> Put global and static data smaller than <number>\n\
3846 bytes into a special section (on some targets)\n"));
3848 for (i
= ARRAY_SIZE (debug_args
); i
--;)
3850 if (debug_args
[i
].description
!= NULL
)
3851 printf (" -g%-21s %s\n",
3852 debug_args
[i
].arg
, debug_args
[i
].description
);
3855 printf (_(" -aux-info <file> Emit declaration info into <file>.X\n"));
3856 printf (_(" -quiet Do not display functions compiled or elapsed time\n"));
3857 printf (_(" -version Display the compiler's version\n"));
3858 printf (_(" -d[letters] Enable dumps from specific passes of the compiler\n"));
3859 printf (_(" -dumpbase <file> Base name to be used for dumps from specific passes\n"));
3860 #if defined INSN_SCHEDULING
3861 printf (_(" -fsched-verbose=<number> Set the verbosity level of the scheduler\n"));
3863 printf (_(" --help Display this information\n"));
3868 /* Display descriptions of language specific options.
3869 If there is no description, note that there is an undocumented option.
3870 If the description is empty, do not display anything. (This allows
3871 options to be deliberately undocumented, for whatever reason).
3872 If the option string is missing, then this is a marker, indicating
3873 that the description string is in fact the name of a language, whose
3874 language specific options are to follow. */
3876 if (ARRAY_SIZE (documented_lang_options
) > 1)
3878 printf (_("\nLanguage specific options:\n"));
3880 for (i
= 0; i
< ARRAY_SIZE (documented_lang_options
); i
++)
3882 const char *description
= documented_lang_options
[i
].description
;
3883 const char *option
= documented_lang_options
[i
].option
;
3885 if (description
== NULL
)
3890 printf (_(" %-23.23s [undocumented]\n"), option
);
3892 else if (*description
== 0)
3894 else if (option
== NULL
)
3898 (_("\nThere are undocumented %s specific options as well.\n"),
3902 printf (_("\n Options for %s:\n"), description
);
3907 printf (" %-23.23s %s\n", option
, description
);
3912 printf (_("\nThere are undocumented %s specific options as well.\n"),
3915 display_target_options ();
3919 display_target_options ()
3923 if (ARRAY_SIZE (target_switches
) > 1
3924 #ifdef TARGET_OPTIONS
3925 || ARRAY_SIZE (target_options
) > 1
3933 printf (_("\nTarget specific options:\n"));
3935 for (i
= ARRAY_SIZE (target_switches
); i
--;)
3937 const char *option
= target_switches
[i
].name
;
3938 const char *description
= target_switches
[i
].description
;
3940 if (option
== NULL
|| *option
== 0)
3942 else if (description
== NULL
)
3947 printf (_(" -m%-23.23s [undocumented]\n"), option
);
3949 else if (* description
!= 0)
3950 doc
+= printf (" -m%-23.23s %s\n", option
, description
);
3953 #ifdef TARGET_OPTIONS
3954 for (i
= ARRAY_SIZE (target_options
); i
--;)
3956 const char *option
= target_options
[i
].prefix
;
3957 const char *description
= target_options
[i
].description
;
3959 if (option
== NULL
|| *option
== 0)
3961 else if (description
== NULL
)
3966 printf (_(" -m%-23.23s [undocumented]\n"), option
);
3968 else if (* description
!= 0)
3969 doc
+= printf (" -m%-23.23s %s\n", option
, description
);
3975 printf (_("\nThere are undocumented target specific options as well.\n"));
3977 printf (_(" They exist, but they are not documented.\n"));
3982 /* Parse a -d... comand line switch. */
3985 decode_d_option (arg
)
3994 for (i
= 0; i
< DFI_MAX
; ++i
)
3995 dump_file
[i
].enabled
= 1;
4004 flag_print_asm_name
= 1;
4007 flag_dump_rtl_in_asm
= 1;
4008 flag_print_asm_name
= 1;
4011 graph_dump_format
= vcg
;
4014 rtl_dump_and_exit
= 1;
4019 case 'D': /* These are handled by the preprocessor. */
4025 for (i
= 0; i
< DFI_MAX
; ++i
)
4026 if (c
== dump_file
[i
].debug_switch
)
4028 dump_file
[i
].enabled
= 1;
4033 warning ("unrecognized gcc debugging option: %c", c
);
4038 /* Parse a -f... comand line switch. ARG is the value after the -f.
4039 It is safe to access 'ARG - 2' to generate the full switch name.
4040 Return the number of strings consumed. */
4043 decode_f_option (arg
)
4047 const char *option_value
= NULL
;
4049 /* Search for the option in the table of binary f options. */
4050 for (j
= ARRAY_SIZE (f_options
); j
--;)
4052 if (!strcmp (arg
, f_options
[j
].string
))
4054 *f_options
[j
].variable
= f_options
[j
].on_value
;
4058 if (arg
[0] == 'n' && arg
[1] == 'o' && arg
[2] == '-'
4059 && ! strcmp (arg
+ 3, f_options
[j
].string
))
4061 *f_options
[j
].variable
= ! f_options
[j
].on_value
;
4066 if ((option_value
= skip_leading_substring (arg
, "inline-limit-"))
4067 || (option_value
= skip_leading_substring (arg
, "inline-limit=")))
4069 read_integral_parameter (option_value
, arg
- 2, inline_max_insns
);
4070 #ifdef INSN_SCHEDULING
4071 else if ((option_value
= skip_leading_substring (arg
, "sched-verbose=")))
4072 fix_sched_param ("verbose", option_value
);
4074 else if ((option_value
= skip_leading_substring (arg
, "fixed-")))
4075 fix_register (option_value
, 1, 1);
4076 else if ((option_value
= skip_leading_substring (arg
, "call-used-")))
4077 fix_register (option_value
, 0, 1);
4078 else if ((option_value
= skip_leading_substring (arg
, "call-saved-")))
4079 fix_register (option_value
, 0, 0);
4080 else if ((option_value
= skip_leading_substring (arg
, "align-loops=")))
4081 align_loops
= read_integral_parameter (option_value
, arg
- 2, align_loops
);
4082 else if ((option_value
= skip_leading_substring (arg
, "align-functions=")))
4084 = read_integral_parameter (option_value
, arg
- 2, align_functions
);
4085 else if ((option_value
= skip_leading_substring (arg
, "align-jumps=")))
4086 align_jumps
= read_integral_parameter (option_value
, arg
- 2, align_jumps
);
4087 else if ((option_value
= skip_leading_substring (arg
, "align-labels=")))
4089 = read_integral_parameter (option_value
, arg
- 2, align_labels
);
4090 else if ((option_value
4091 = skip_leading_substring (arg
, "stack-limit-register=")))
4093 int reg
= decode_reg_name (option_value
);
4095 error ("unrecognized register name `%s'", option_value
);
4097 stack_limit_rtx
= gen_rtx_REG (Pmode
, reg
);
4099 else if ((option_value
4100 = skip_leading_substring (arg
, "stack-limit-symbol=")))
4103 nm
= ggc_strdup (option_value
);
4104 stack_limit_rtx
= gen_rtx_SYMBOL_REF (Pmode
, nm
);
4106 else if ((option_value
4107 = skip_leading_substring (arg
, "message-length=")))
4108 diagnostic_message_length_per_line
=
4109 read_integral_parameter (option_value
, arg
- 2,
4110 diagnostic_message_length_per_line
);
4111 else if ((option_value
4112 = skip_leading_substring (arg
, "diagnostics-show-location=")))
4114 if (!strcmp (option_value
, "once"))
4115 set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_ONCE
);
4116 else if (!strcmp (option_value
, "every-line"))
4117 set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE
);
4119 error ("Unrecognized option `%s'", arg
- 2);
4121 else if (!strcmp (arg
, "no-stack-limit"))
4122 stack_limit_rtx
= NULL_RTX
;
4123 else if (!strcmp (arg
, "preprocessed"))
4124 /* Recognise this switch but do nothing. This prevents warnings
4125 about an unrecognized switch if cpplib has not been linked in. */
4133 /* Parse a -W... comand line switch. ARG is the value after the -W.
4134 It is safe to access 'ARG - 2' to generate the full switch name.
4135 Return the number of strings consumed. */
4138 decode_W_option (arg
)
4141 const char *option_value
= NULL
;
4144 /* Search for the option in the table of binary W options. */
4146 for (j
= ARRAY_SIZE (W_options
); j
--;)
4148 if (!strcmp (arg
, W_options
[j
].string
))
4150 *W_options
[j
].variable
= W_options
[j
].on_value
;
4154 if (arg
[0] == 'n' && arg
[1] == 'o' && arg
[2] == '-'
4155 && ! strcmp (arg
+ 3, W_options
[j
].string
))
4157 *W_options
[j
].variable
= ! W_options
[j
].on_value
;
4162 if ((option_value
= skip_leading_substring (arg
, "id-clash-")))
4164 id_clash_len
= read_integral_parameter (option_value
, arg
- 2, -1);
4166 if (id_clash_len
!= -1)
4169 else if ((option_value
= skip_leading_substring (arg
, "larger-than-")))
4171 larger_than_size
= read_integral_parameter (option_value
, arg
- 2, -1);
4173 if (larger_than_size
!= -1)
4174 warn_larger_than
= 1;
4176 else if (!strcmp (arg
, "unused"))
4180 else if (!strcmp (arg
, "no-unused"))
4190 /* Parse a -g... comand line switch. ARG is the value after the -g.
4191 It is safe to access 'ARG - 2' to generate the full switch name.
4192 Return the number of strings consumed. */
4195 decode_g_option (arg
)
4199 /* A lot of code assumes write_symbols == NO_DEBUG if the
4200 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4201 of what debugging type has been selected). This records the
4202 selected type. It is an error to specify more than one
4204 static enum debug_info_type selected_debug_type
= NO_DEBUG
;
4205 /* Non-zero if debugging format has been explicitly set.
4206 -g and -ggdb don't explicitly set the debugging format so
4207 -gdwarf -g3 is equivalent to -gdwarf3. */
4208 static int type_explicitly_set_p
= 0;
4209 /* Indexed by enum debug_info_type. */
4210 static const char *debug_type_names
[] =
4212 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4215 /* The maximum admissible debug level value. */
4216 static const unsigned max_debug_level
= 3;
4218 /* Look up ARG in the table. */
4219 for (da
= debug_args
; da
->arg
; da
++)
4221 const int da_len
= strlen (da
->arg
);
4223 if (da_len
== 0 || ! strncmp (arg
, da
->arg
, da_len
))
4225 enum debug_info_type type
= da
->debug_type
;
4226 const char *p
= arg
+ da_len
;
4228 if (*p
&& (*p
< '0' || *p
> '9'))
4231 /* A debug flag without a level defaults to level 2.
4232 Note we do not want to call read_integral_parameter
4233 for that case since it will call atoi which
4236 ??? We may want to generalize the interface to
4237 read_integral_parameter to better handle this case
4238 if this case shows up often. */
4240 level
= read_integral_parameter (p
, 0, max_debug_level
+ 1);
4244 if (da_len
> 1 && *p
&& !strncmp (arg
, "dwarf", da_len
))
4246 error ("use -gdwarf -g%d for DWARF v1, level %d",
4249 error ("use -gdwarf-2 for DWARF v2");
4252 if (level
> max_debug_level
)
4255 ignoring option `%s' due to invalid debug level specification",
4257 level
= debug_info_level
;
4260 if (type
== NO_DEBUG
)
4262 type
= PREFERRED_DEBUGGING_TYPE
;
4264 if (da_len
> 1 && strncmp (arg
, "gdb", da_len
) == 0)
4266 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4267 type
= DWARF2_DEBUG
;
4269 #ifdef DBX_DEBUGGING_INFO
4276 if (type
== NO_DEBUG
)
4277 warning ("`%s': unknown or unsupported -g option", arg
- 2);
4279 /* Does it conflict with an already selected type? */
4280 if (type_explicitly_set_p
4281 /* -g/-ggdb don't conflict with anything. */
4282 && da
->debug_type
!= NO_DEBUG
4283 && type
!= selected_debug_type
)
4284 warning ("`%s' ignored, conflicts with `-g%s'",
4285 arg
- 2, debug_type_names
[(int) selected_debug_type
]);
4288 /* If the format has already been set, -g/-ggdb
4289 only change the debug level. */
4290 if (type_explicitly_set_p
&& da
->debug_type
== NO_DEBUG
)
4291 /* Don't change debugging type. */
4295 selected_debug_type
= type
;
4296 type_explicitly_set_p
= da
->debug_type
!= NO_DEBUG
;
4299 write_symbols
= (level
== 0
4301 : selected_debug_type
);
4302 use_gnu_debug_info_extensions
= da
->use_extensions_p
;
4303 debug_info_level
= (enum debug_info_level
) level
;
4316 /* Decode the first argument in the argv as a language-independent option.
4317 Return the number of strings consumed. */
4320 independent_decode_option (argc
, argv
)
4324 char *arg
= argv
[0];
4326 if (arg
[0] != '-' || arg
[1] == 0)
4338 if (!strcmp (arg
, "-help"))
4344 if (!strcmp (arg
, "-target-help"))
4346 display_target_options ();
4350 if (!strcmp (arg
, "-version"))
4352 print_version (stderr
, "");
4365 /* Already been treated in main (). Do nothing. */
4369 set_target_switch (arg
+ 1);
4373 return decode_f_option (arg
+ 1);
4376 return decode_g_option (arg
+ 1);
4379 if (!strcmp (arg
, "dumpbase"))
4384 dump_base_name
= argv
[1];
4388 decode_d_option (arg
+ 1);
4392 if (!strcmp (arg
, "pedantic"))
4394 else if (!strcmp (arg
, "pedantic-errors"))
4395 flag_pedantic_errors
= pedantic
= 1;
4396 else if (arg
[1] == 0)
4403 if (!strcmp (arg
, "quiet"))
4410 if (!strcmp (arg
, "version"))
4418 inhibit_warnings
= 1;
4427 /* We save the value of warn_uninitialized, since if they put
4428 -Wuninitialized on the command line, we need to generate a
4429 warning about not using it without also specifying -O. */
4430 if (warn_uninitialized
!= 1)
4431 warn_uninitialized
= 2;
4434 return decode_W_option (arg
+ 1);
4440 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4441 warning ("`-a' option (basic block profile) not supported");
4443 profile_block_flag
= (profile_block_flag
< 2) ? 1 : 3;
4446 else if (!strcmp (arg
, "ax"))
4448 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4449 warning ("`-ax' option (jump profiling) not supported");
4451 profile_block_flag
= (!profile_block_flag
4452 || profile_block_flag
== 2) ? 2 : 3;
4455 else if (!strncmp (arg
, "aux-info", 8))
4457 flag_gen_aux_info
= 1;
4463 aux_info_file_name
= argv
[1];
4467 aux_info_file_name
= arg
+ 8;
4479 asm_file_name
= argv
[1];
4494 g_switch_val
= read_integral_parameter (argv
[1], 0, -1);
4499 g_switch_val
= read_integral_parameter (arg
+ 1, 0, -1);
4503 if (g_switch_val
== -1)
4507 g_switch_set
= TRUE
;
4508 g_switch_value
= g_switch_val
;
4518 /* Entry point of cc1/c++. Decode command args, then call compile_file.
4519 Exit code is 35 if can't open files, 34 if fatal error,
4520 33 if had nonfatal errors, else success. */
4522 extern int main
PARAMS ((int, char **));
4532 /* save in case md file wants to emit args as a comment. */
4536 p
= argv
[0] + strlen (argv
[0]);
4537 while (p
!= argv
[0] && !IS_DIR_SEPARATOR (p
[-1]))
4541 xmalloc_set_program_name (progname
);
4543 /* LC_CTYPE determines the character set used by the terminal so it has be set
4544 to output messages correctly. */
4546 #ifdef HAVE_LC_MESSAGES
4547 setlocale (LC_CTYPE
, "");
4548 setlocale (LC_MESSAGES
, "");
4550 setlocale (LC_ALL
, "");
4553 (void) bindtextdomain (PACKAGE
, localedir
);
4554 (void) textdomain (PACKAGE
);
4556 /* Install handler for SIGFPE, which may be received while we do
4557 compile-time floating point arithmetic. */
4558 signal (SIGFPE
, float_signal
);
4560 /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */
4562 signal (SIGSEGV
, crash_signal
);
4565 signal (SIGILL
, crash_signal
);
4568 signal (SIGBUS
, crash_signal
);
4571 signal (SIGABRT
, crash_signal
);
4573 #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
4574 signal (SIGIOT
, crash_signal
);
4577 decl_printable_name
= decl_name
;
4578 lang_expand_expr
= (lang_expand_expr_t
) do_abort
;
4580 /* Initialize whether `char' is signed. */
4581 flag_signed_char
= DEFAULT_SIGNED_CHAR
;
4582 #ifdef DEFAULT_SHORT_ENUMS
4583 /* Initialize how much space enums occupy, by default. */
4584 flag_short_enums
= DEFAULT_SHORT_ENUMS
;
4587 /* Initialize the garbage-collector. */
4590 ggc_add_rtx_root (&stack_limit_rtx
, 1);
4591 ggc_add_tree_root (¤t_function_decl
, 1);
4592 ggc_add_tree_root (¤t_function_func_begin_label
, 1);
4594 /* Initialize the diagnostics reporting machinery. */
4595 initialize_diagnostics ();
4597 /* Perform language-specific options intialization. */
4598 if (lang_hooks
.init_options
)
4599 (*lang_hooks
.init_options
) ();
4601 /* Scan to see what optimization level has been specified. That will
4602 determine the default value of many flags. */
4603 for (i
= 1; i
< argc
; i
++)
4605 if (!strcmp (argv
[i
], "-O"))
4610 else if (argv
[i
][0] == '-' && argv
[i
][1] == 'O')
4612 /* Handle -Os, -O2, -O3, -O69, ... */
4613 char *p
= &argv
[i
][2];
4615 if ((p
[0] == 's') && (p
[1] == 0))
4619 /* Optimizing for size forces optimize to be 2. */
4624 const int optimize_val
= read_integral_parameter (p
, p
- 2, -1);
4625 if (optimize_val
!= -1)
4627 optimize
= optimize_val
;
4637 flag_thread_jumps
= 1;
4639 flag_delayed_branch
= 1;
4641 #ifdef CAN_DEBUG_WITHOUT_FP
4642 flag_omit_frame_pointer
= 1;
4644 flag_guess_branch_prob
= 1;
4649 flag_optimize_sibling_calls
= 1;
4650 flag_cse_follow_jumps
= 1;
4651 flag_cse_skip_blocks
= 1;
4653 flag_expensive_optimizations
= 1;
4654 flag_strength_reduce
= 1;
4655 flag_rerun_cse_after_loop
= 1;
4656 flag_rerun_loop_opt
= 1;
4657 flag_caller_saves
= 1;
4660 #ifdef INSN_SCHEDULING
4661 flag_schedule_insns
= 1;
4662 flag_schedule_insns_after_reload
= 1;
4665 flag_strict_aliasing
= 1;
4666 flag_delete_null_pointer_checks
= 1;
4667 flag_reorder_blocks
= 1;
4672 flag_inline_functions
= 1;
4673 flag_rename_registers
= 1;
4676 if (optimize
< 2 || optimize_size
)
4681 align_functions
= 1;
4684 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
4687 set_target_switch ("");
4689 /* Unwind tables are always present in an ABI-conformant IA-64
4690 object file, so the default should be ON. */
4691 #ifdef IA64_UNWIND_INFO
4692 flag_unwind_tables
= IA64_UNWIND_INFO
;
4695 #ifdef OPTIMIZATION_OPTIONS
4696 /* Allow default optimizations to be specified on a per-machine basis. */
4697 OPTIMIZATION_OPTIONS (optimize
, optimize_size
);
4700 /* Initialize register usage now so switches may override. */
4703 /* Perform normal command line switch decoding. */
4704 for (i
= 1; i
< argc
;)
4706 unsigned int lang_processed
;
4707 unsigned int indep_processed
;
4709 /* Give the language a chance to decode the option for itself. */
4710 lang_processed
= (*lang_hooks
.decode_option
) (argc
- i
, argv
+ i
);
4712 /* Now see if the option also has a language independent meaning.
4713 Some options are both language specific and language independent,
4715 indep_processed
= independent_decode_option (argc
- i
, argv
+ i
);
4717 if (lang_processed
|| indep_processed
)
4718 i
+= MAX (lang_processed
, indep_processed
);
4721 const char *option
= NULL
;
4722 const char *lang
= NULL
;
4725 /* It is possible that the command line switch is not valid for the
4726 current language, but it is valid for another language. In order
4727 to be compatible with previous versions of the compiler (which
4728 did not issue an error message in this case) we check for this
4729 possibility here. If we do find a match, then if extra_warnings
4730 is set we generate a warning message, otherwise we will just
4731 ignore the option. */
4732 for (j
= 0; j
< ARRAY_SIZE (documented_lang_options
); j
++)
4734 option
= documented_lang_options
[j
].option
;
4737 lang
= documented_lang_options
[j
].description
;
4738 else if (! strncmp (argv
[i
], option
, strlen (option
)))
4742 if (j
!= ARRAY_SIZE (documented_lang_options
))
4746 warning ("Ignoring command line option '%s'", argv
[i
]);
4749 ("(It is valid for %s but not the selected language)",
4753 else if (argv
[i
][0] == '-' && argv
[i
][1] == 'g')
4754 warning ("`%s': unknown or unsupported -g option", &argv
[i
][2]);
4756 error ("Unrecognized option `%s'", argv
[i
]);
4762 /* All command line options have been processed. */
4763 if (lang_hooks
.post_options
)
4764 (*lang_hooks
.post_options
) ();
4766 /* Reflect any language-specific diagnostic option setting. */
4767 reshape_diagnostic_buffer ();
4769 /* Checker uses the frame pointer. */
4770 if (flag_check_memory_usage
)
4771 flag_omit_frame_pointer
= 0;
4775 /* Inlining does not work if not optimizing,
4776 so force it not to be done. */
4780 /* The c_decode_option function and decode_option hook set
4781 this to `2' if -Wall is used, so we can avoid giving out
4782 lots of errors for people who don't realize what -Wall does. */
4783 if (warn_uninitialized
== 1)
4784 warning ("-Wuninitialized is not supported without -O");
4787 #ifdef OVERRIDE_OPTIONS
4788 /* Some machines may reject certain combinations of options. */
4792 if (exceptions_via_longjmp
== 2)
4794 #ifdef DWARF2_UNWIND_INFO
4795 exceptions_via_longjmp
= ! DWARF2_UNWIND_INFO
;
4797 #ifdef IA64_UNWIND_INFO
4798 exceptions_via_longjmp
= ! IA64_UNWIND_INFO
;
4800 exceptions_via_longjmp
= 1;
4805 /* Since each function gets its own handler data, we can't support the
4806 new model currently, since it depend on a specific rethrow label
4807 which is declared at the front of the table, and we can only
4808 have one such symbol in a file. */
4809 #ifdef IA64_UNWIND_INFO
4810 flag_new_exceptions
= 0;
4813 /* Set up the align_*_log variables, defaulting them to 1 if they
4814 were still unset. */
4815 if (align_loops
<= 0) align_loops
= 1;
4816 align_loops_log
= floor_log2 (align_loops
* 2 - 1);
4817 if (align_jumps
<= 0) align_jumps
= 1;
4818 align_jumps_log
= floor_log2 (align_jumps
* 2 - 1);
4819 if (align_labels
<= 0) align_labels
= 1;
4820 align_labels_log
= floor_log2 (align_labels
* 2 - 1);
4821 if (align_functions
<= 0) align_functions
= 1;
4822 align_functions_log
= floor_log2 (align_functions
* 2 - 1);
4824 if (profile_block_flag
== 3)
4826 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4827 profile_block_flag
= 2;
4830 /* Unrolling all loops implies that standard loop unrolling must also
4832 if (flag_unroll_all_loops
)
4833 flag_unroll_loops
= 1;
4834 /* Loop unrolling requires that strength_reduction be on also. Silently
4835 turn on strength reduction here if it isn't already on. Also, the loop
4836 unrolling code assumes that cse will be run after loop, so that must
4837 be turned on also. */
4838 if (flag_unroll_loops
)
4840 flag_strength_reduce
= 1;
4841 flag_rerun_cse_after_loop
= 1;
4844 /* Warn about options that are not supported on this machine. */
4845 #ifndef INSN_SCHEDULING
4846 if (flag_schedule_insns
|| flag_schedule_insns_after_reload
)
4847 warning ("instruction scheduling not supported on this target machine");
4850 if (flag_delayed_branch
)
4851 warning ("this target machine does not have delayed branches");
4854 user_label_prefix
= USER_LABEL_PREFIX
;
4855 if (flag_leading_underscore
!= -1)
4857 /* If the default prefix is more complicated than "" or "_",
4858 issue a warning and ignore this option. */
4859 if (user_label_prefix
[0] == 0 ||
4860 (user_label_prefix
[0] == '_' && user_label_prefix
[1] == 0))
4862 user_label_prefix
= flag_leading_underscore
? "_" : "";
4865 warning ("-f%sleading-underscore not supported on this target machine",
4866 flag_leading_underscore
? "" : "no-");
4869 /* If we are in verbose mode, write out the version and maybe all the
4870 option flags in use. */
4873 print_version (stderr
, "");
4875 print_switch_values (stderr
, 0, MAX_LINE
, "", " ", "\n");
4878 compile_file (filename
);
4880 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__)) && !defined(__INTERIX)
4883 char *lim
= (char *) sbrk (0);
4885 fnotice (stderr
, "Data size %ld.\n", (long) (lim
- (char *) &environ
));
4890 system ("ps -l 1>&2");
4893 #endif /* not USG */
4896 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX */
4899 return (FATAL_EXIT_CODE
);
4901 return (FATAL_EXIT_CODE
);
4902 return (SUCCESS_EXIT_CODE
);
4905 /* Decode -m switches. */
4906 /* Decode the switch -mNAME. */
4909 set_target_switch (name
)
4913 int valid_target_option
= 0;
4915 for (j
= 0; j
< ARRAY_SIZE (target_switches
); j
++)
4916 if (!strcmp (target_switches
[j
].name
, name
))
4918 if (target_switches
[j
].value
< 0)
4919 target_flags
&= ~-target_switches
[j
].value
;
4921 target_flags
|= target_switches
[j
].value
;
4922 valid_target_option
= 1;
4925 #ifdef TARGET_OPTIONS
4926 if (!valid_target_option
)
4927 for (j
= 0; j
< ARRAY_SIZE (target_options
); j
++)
4929 int len
= strlen (target_options
[j
].prefix
);
4930 if (!strncmp (target_options
[j
].prefix
, name
, len
))
4932 *target_options
[j
].variable
= name
+ len
;
4933 valid_target_option
= 1;
4938 if (!valid_target_option
)
4939 error ("Invalid option `%s'", name
);
4942 /* Print version information to FILE.
4943 Each line begins with INDENT (for the case where FILE is the
4944 assembler output file). */
4947 print_version (file
, indent
)
4952 #define __VERSION__ "[?]"
4956 "%s%s%s version %s (%s)\n%s\tcompiled by GNU C version %s.\n"
4958 "%s%s%s version %s (%s) compiled by CC.\n"
4960 , indent
, *indent
!= 0 ? " " : "",
4961 language_string
, version_string
, TARGET_NAME
,
4962 indent
, __VERSION__
);
4965 /* Print an option value and return the adjusted position in the line.
4966 ??? We don't handle error returns from fprintf (disk full); presumably
4967 other code will catch a disk full though. */
4970 print_single_switch (file
, pos
, max
, indent
, sep
, term
, type
, name
)
4973 const char *indent
, *sep
, *term
, *type
, *name
;
4975 /* The ultrix fprintf returns 0 on success, so compute the result we want
4976 here since we need it for the following test. */
4977 int len
= strlen (sep
) + strlen (type
) + strlen (name
);
4982 fprintf (file
, "%s", term
);
4987 fprintf (file
, "%s", indent
);
4988 pos
= strlen (indent
);
4990 fprintf (file
, "%s%s%s", sep
, type
, name
);
4995 /* Print active target switches to FILE.
4996 POS is the current cursor position and MAX is the size of a "line".
4997 Each line begins with INDENT and ends with TERM.
4998 Each switch is separated from the next by SEP. */
5001 print_switch_values (file
, pos
, max
, indent
, sep
, term
)
5004 const char *indent
, *sep
, *term
;
5009 /* Print the options as passed. */
5011 pos
= print_single_switch (file
, pos
, max
, indent
, *indent
? " " : "", term
,
5012 _("options passed: "), "");
5014 for (p
= &save_argv
[1]; *p
!= NULL
; p
++)
5018 if (strcmp (*p
, "-o") == 0)
5024 if (strcmp (*p
, "-quiet") == 0)
5026 if (strcmp (*p
, "-version") == 0)
5031 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
, *p
, "");
5034 fprintf (file
, "%s", term
);
5036 /* Print the -f and -m options that have been enabled.
5037 We don't handle language specific options but printing argv
5040 pos
= print_single_switch (file
, 0, max
, indent
, *indent
? " " : "", term
,
5041 _("options enabled: "), "");
5043 for (j
= 0; j
< ARRAY_SIZE (f_options
); j
++)
5044 if (*f_options
[j
].variable
== f_options
[j
].on_value
)
5045 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
5046 "-f", f_options
[j
].string
);
5048 /* Print target specific options. */
5050 for (j
= 0; j
< ARRAY_SIZE (target_switches
); j
++)
5051 if (target_switches
[j
].name
[0] != '\0'
5052 && target_switches
[j
].value
> 0
5053 && ((target_switches
[j
].value
& target_flags
)
5054 == target_switches
[j
].value
))
5056 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
5057 "-m", target_switches
[j
].name
);
5060 #ifdef TARGET_OPTIONS
5061 for (j
= 0; j
< ARRAY_SIZE (target_options
); j
++)
5062 if (*target_options
[j
].variable
!= NULL
)
5065 sprintf (prefix
, "-m%s", target_options
[j
].prefix
);
5066 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
5067 prefix
, *target_options
[j
].variable
);
5071 fprintf (file
, "%s", term
);
5074 /* Record the beginning of a new source file, named FILENAME. */
5077 debug_start_source_file (filename
)
5078 register const char *filename ATTRIBUTE_UNUSED
;
5080 #ifdef DBX_DEBUGGING_INFO
5081 if (write_symbols
== DBX_DEBUG
)
5082 dbxout_start_new_source_file (filename
);
5084 #ifdef DWARF_DEBUGGING_INFO
5085 if (debug_info_level
== DINFO_LEVEL_VERBOSE
5086 && write_symbols
== DWARF_DEBUG
)
5087 dwarfout_start_new_source_file (filename
);
5088 #endif /* DWARF_DEBUGGING_INFO */
5089 #ifdef DWARF2_DEBUGGING_INFO
5090 if (write_symbols
== DWARF2_DEBUG
)
5091 dwarf2out_start_source_file (filename
);
5092 #endif /* DWARF2_DEBUGGING_INFO */
5093 #ifdef SDB_DEBUGGING_INFO
5094 if (write_symbols
== SDB_DEBUG
)
5095 sdbout_start_new_source_file (filename
);
5099 /* Record the resumption of a source file. LINENO is the line number in
5100 the source file we are returning to. */
5103 debug_end_source_file (lineno
)
5104 register unsigned lineno ATTRIBUTE_UNUSED
;
5106 #ifdef DBX_DEBUGGING_INFO
5107 if (write_symbols
== DBX_DEBUG
)
5108 dbxout_resume_previous_source_file ();
5110 #ifdef DWARF_DEBUGGING_INFO
5111 if (debug_info_level
== DINFO_LEVEL_VERBOSE
5112 && write_symbols
== DWARF_DEBUG
)
5113 dwarfout_resume_previous_source_file (lineno
);
5114 #endif /* DWARF_DEBUGGING_INFO */
5115 #ifdef DWARF2_DEBUGGING_INFO
5116 if (write_symbols
== DWARF2_DEBUG
)
5117 dwarf2out_end_source_file ();
5118 #endif /* DWARF2_DEBUGGING_INFO */
5119 #ifdef SDB_DEBUGGING_INFO
5120 if (write_symbols
== SDB_DEBUG
)
5121 sdbout_resume_previous_source_file ();
5125 /* Called from cb_define in c-lex.c. The `buffer' parameter contains
5126 the tail part of the directive line, i.e. the part which is past the
5127 initial whitespace, #, whitespace, directive-name, whitespace part. */
5130 debug_define (lineno
, buffer
)
5131 register unsigned lineno ATTRIBUTE_UNUSED
;
5132 register const char *buffer ATTRIBUTE_UNUSED
;
5134 #ifdef DWARF_DEBUGGING_INFO
5135 if (write_symbols
== DWARF_DEBUG
)
5136 dwarfout_define (lineno
, buffer
);
5137 #endif /* DWARF_DEBUGGING_INFO */
5138 #ifdef DWARF2_DEBUGGING_INFO
5139 if (write_symbols
== DWARF2_DEBUG
)
5140 dwarf2out_define (lineno
, buffer
);
5141 #endif /* DWARF2_DEBUGGING_INFO */
5144 /* Called from cb_undef in c-lex.c. The `buffer' parameter contains
5145 the tail part of the directive line, i.e. the part which is past the
5146 initial whitespace, #, whitespace, directive-name, whitespace part. */
5149 debug_undef (lineno
, buffer
)
5150 register unsigned lineno ATTRIBUTE_UNUSED
;
5151 register const char *buffer ATTRIBUTE_UNUSED
;
5153 #ifdef DWARF_DEBUGGING_INFO
5154 if (write_symbols
== DWARF_DEBUG
)
5155 dwarfout_undef (lineno
, buffer
);
5156 #endif /* DWARF_DEBUGGING_INFO */
5157 #ifdef DWARF2_DEBUGGING_INFO
5158 if (write_symbols
== DWARF2_DEBUG
)
5159 dwarf2out_undef (lineno
, buffer
);
5160 #endif /* DWARF2_DEBUGGING_INFO */
5163 /* Returns nonzero if it is appropriate not to emit any debugging
5164 information for BLOCK, because it doesn't contain any instructions.
5165 This may not be the case for blocks containing nested functions, since
5166 we may actually call such a function even though the BLOCK information
5170 debug_ignore_block (block
)
5171 tree block ATTRIBUTE_UNUSED
;
5173 /* Never delete the BLOCK for the outermost scope
5174 of the function; we can refer to names from
5175 that scope even if the block notes are messed up. */
5176 if (is_body_block (block
))
5179 #ifdef DWARF2_DEBUGGING_INFO
5180 if (write_symbols
== DWARF2_DEBUG
)
5181 return dwarf2out_ignore_block (block
);