1 /* Top level of GNU C compiler
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* This is the top level of cc1/c++.
23 It parses command args, opens files, invokes the various passes
24 in the proper order, and counts the time used by each.
25 Error messages and low-level interface to malloc also handled here. */
28 #undef FLOAT /* This is for hpux. They should change hpux. */
29 #undef FFS /* Some systems define this in param.h. */
34 #ifdef HAVE_SYS_RESOURCE_H
35 # include <sys/resource.h>
38 #ifdef HAVE_SYS_TIMES_H
39 # include <sys/times.h>
47 #include "insn-attr.h"
48 #include "insn-codes.h"
49 #include "insn-config.h"
57 #include "basic-block.h"
64 #ifndef ACCUMULATE_OUTGOING_ARGS
65 #define ACCUMULATE_OUTGOING_ARGS 0
68 #ifdef DWARF_DEBUGGING_INFO
72 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
73 #include "dwarf2out.h"
76 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
80 #ifdef SDB_DEBUGGING_INFO
84 #ifdef XCOFF_DEBUGGING_INFO
89 /* The extra parameters substantially improve the I/O performance. */
91 vms_fopen (fname, type)
95 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
96 fixed arguments, which matches ANSI's specification but not VAXCRTL's
97 pre-ANSI implementation. This hack circumvents the mismatch problem. */
98 FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
101 return (*vmslib_fopen) (fname, type, "mbc=32",
102 "deq=64", "fop=tef", "shr=nil");
104 return (*vmslib_fopen) (fname, type, "mbc=32");
106 #define fopen vms_fopen
109 #ifndef DEFAULT_GDB_EXTENSIONS
110 #define DEFAULT_GDB_EXTENSIONS 1
113 /* If more than one debugging type is supported, you must define
114 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
116 This is one long line cause VAXC can't handle a \-newline. */
117 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
118 #ifndef PREFERRED_DEBUGGING_TYPE
119 You Lose! You must define PREFERRED_DEBUGGING_TYPE!
120 #endif /* no PREFERRED_DEBUGGING_TYPE */
121 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
122 so the following code needn't care. */
123 #ifdef DBX_DEBUGGING_INFO
124 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
126 #ifdef SDB_DEBUGGING_INFO
127 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
129 #ifdef DWARF_DEBUGGING_INFO
130 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
132 #ifdef DWARF2_DEBUGGING_INFO
133 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
135 #ifdef XCOFF_DEBUGGING_INFO
136 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
138 #endif /* More than one debugger format enabled. */
140 /* If still not defined, must have been because no debugging formats
142 #ifndef PREFERRED_DEBUGGING_TYPE
143 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
146 #ifdef NEED_DECLARATION_ENVIRON
147 extern char **environ;
150 /* Carry information from ASM_DECLARE_OBJECT_NAME
151 to ASM_FINISH_DECLARE_OBJECT. */
153 extern int size_directive_output;
154 extern tree last_assemble_variable_decl;
156 static void set_target_switch PARAMS ((const char *));
157 static const char *decl_name PARAMS ((tree, int));
159 static void float_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
160 static void pipe_closed PARAMS ((int)) ATTRIBUTE_NORETURN;
161 #ifdef ASM_IDENTIFY_LANGUAGE
162 /* This might or might not be used in ASM_IDENTIFY_LANGUAGE. */
163 static void output_lang_identify PARAMS ((FILE *)) ATTRIBUTE_UNUSED;
165 static void open_dump_file PARAMS ((const char *, const char *));
166 static void close_dump_file PARAMS ((void (*) (FILE *, rtx), rtx));
167 static void dump_rtl PARAMS ((const char *, tree, void (*) (FILE *, rtx), rtx));
168 static void clean_dump_file PARAMS ((const char *));
169 static void compile_file PARAMS ((char *));
170 static void display_help PARAMS ((void));
171 static void mark_file_stack PARAMS ((void *));
173 static void decode_d_option PARAMS ((const char *));
174 static int decode_f_option PARAMS ((const char *));
175 static int decode_W_option PARAMS ((const char *));
176 static int decode_g_option PARAMS ((const char *));
177 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 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 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 /* Flags saying which kinds of debugging dump have been requested. */
236 int rtl_dump_and_exit = 0;
237 int jump_opt_dump = 0;
238 int addressof_dump = 0;
243 int branch_prob_dump = 0;
245 int combine_dump = 0;
246 int regmove_dump = 0;
248 int local_reg_dump = 0;
249 int global_reg_dump = 0;
251 int peephole2_dump = 0;
253 int jump2_opt_dump = 0;
255 int dbr_sched_dump = 0;
257 int reorder_blocks_dump = 0;
258 int flag_print_asm_name = 0;
260 int stack_reg_dump = 0;
262 #ifdef MACHINE_DEPENDENT_REORG
263 int mach_dep_reorg_dump = 0;
266 static int flag_print_mem = 0;
267 static int version_flag = 0;
268 static char * filename = 0;
269 enum graph_dump_types graph_dump_format;
271 /* Name for output file of assembly code, specified with -o. */
275 /* Value of the -G xx switch, and whether it was passed or not. */
279 /* Type(s) of debugging information we are producing (if any).
280 See flags.h for the definitions of the different possible
281 types of debugging information. */
282 enum debug_info_type write_symbols = NO_DEBUG;
284 /* Level of debugging information we are producing. See flags.h
285 for the definitions of the different possible levels. */
286 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
288 /* Nonzero means use GNU-only extensions in the generated symbolic
289 debugging information. */
290 /* Currently, this only has an effect when write_symbols is set to
291 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
292 int use_gnu_debug_info_extensions = 0;
294 /* Nonzero means do optimizations. -O.
295 Particular numeric values stand for particular amounts of optimization;
296 thus, -O2 stores 2 here. However, the optimizations beyond the basic
297 ones are not controlled directly by this variable. Instead, they are
298 controlled by individual `flag_...' variables that are defaulted
299 based on this variable. */
303 /* Nonzero means optimize for size. -Os.
304 The only valid values are zero and non-zero. When optimize_size is
305 non-zero, optimize defaults to 2, but certain individual code
306 bloating optimizations are disabled. */
308 int optimize_size = 0;
310 /* Number of error messages and warning messages so far. */
313 int warningcount = 0;
316 /* The FUNCTION_DECL for the function currently being compiled,
317 or 0 if between functions. */
318 tree current_function_decl;
320 /* Set to the FUNC_BEGIN label of the current function, or NULL_TREE
322 tree current_function_func_begin_label;
324 /* Pointer to function to compute the name to use to print a declaration.
325 DECL is the declaration in question.
326 VERBOSITY determines what information will be printed:
327 0: DECL_NAME, demangled as necessary.
328 1: and scope information.
329 2: and any other information that might be interesting, such as function
330 parameter types in C++. */
332 const char *(*decl_printable_name) PARAMS ((tree, int));
334 /* Pointer to function to compute rtl for a language-specific tree code. */
336 typedef rtx (*lang_expand_expr_t)
337 PARAMS ((union tree_node *, rtx, enum machine_mode,
338 enum expand_modifier modifier));
340 lang_expand_expr_t lang_expand_expr = 0;
342 tree (*lang_expand_constant) PARAMS ((tree)) = 0;
344 /* Pointer to function to finish handling an incomplete decl at the
345 end of compilation. */
347 void (*incomplete_decl_finalize_hook) PARAMS ((tree)) = 0;
349 /* Nonzero if generating code to do profiling. */
351 int profile_flag = 0;
353 /* Nonzero if generating code to do profiling on a line-by-line basis. */
355 int profile_block_flag;
357 /* Nonzero if generating code to profile program flow graph arcs. */
359 int profile_arc_flag = 0;
361 /* Nonzero if generating info for gcov to calculate line test coverage. */
363 int flag_test_coverage = 0;
365 /* Nonzero indicates that branch taken probabilities should be calculated. */
367 int flag_branch_probabilities = 0;
369 /* Nonzero if basic blocks should be reordered. */
371 int flag_reorder_blocks = 0;
373 /* Nonzero for -pedantic switch: warn about anything
374 that standard spec forbids. */
378 /* Temporarily suppress certain warnings.
379 This is set while reading code from a system header file. */
381 int in_system_header = 0;
383 /* Don't print functions as they are compiled and don't print
384 times taken by the various passes. -quiet. */
390 /* Nonzero means `char' should be signed. */
392 int flag_signed_char;
394 /* Nonzero means give an enum type only as many bytes as it needs. */
396 int flag_short_enums;
398 /* Nonzero for -fcaller-saves: allocate values in regs that need to
399 be saved across function calls, if that produces overall better code.
400 Optional now, so people can test it. */
402 #ifdef DEFAULT_CALLER_SAVES
403 int flag_caller_saves = 1;
405 int flag_caller_saves = 0;
408 /* Nonzero if structures and unions should be returned in memory.
410 This should only be defined if compatibility with another compiler or
411 with an ABI is needed, because it results in slower code. */
413 #ifndef DEFAULT_PCC_STRUCT_RETURN
414 #define DEFAULT_PCC_STRUCT_RETURN 1
417 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
419 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
421 /* Nonzero for -fforce-mem: load memory value into a register
422 before arithmetic on it. This makes better cse but slower compilation. */
424 int flag_force_mem = 0;
426 /* Nonzero for -fforce-addr: load memory address into a register before
427 reference to memory. This makes better cse but slower compilation. */
429 int flag_force_addr = 0;
431 /* Nonzero for -fdefer-pop: don't pop args after each function call;
432 instead save them up to pop many calls' args with one insns. */
434 int flag_defer_pop = 0;
436 /* Nonzero for -ffloat-store: don't allocate floats and doubles
437 in extended-precision registers. */
439 int flag_float_store = 0;
441 /* Nonzero for -fcse-follow-jumps:
442 have cse follow jumps to do a more extensive job. */
444 int flag_cse_follow_jumps;
446 /* Nonzero for -fcse-skip-blocks:
447 have cse follow a branch around a block. */
448 int flag_cse_skip_blocks;
450 /* Nonzero for -fexpensive-optimizations:
451 perform miscellaneous relatively-expensive optimizations. */
452 int flag_expensive_optimizations;
454 /* Nonzero for -fthread-jumps:
455 have jump optimize output of loop. */
457 int flag_thread_jumps;
459 /* Nonzero enables strength-reduction in loop.c. */
461 int flag_strength_reduce = 0;
463 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
464 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
465 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
468 int flag_unroll_loops;
470 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
471 This is generally not a win. */
473 int flag_unroll_all_loops;
475 /* Nonzero forces all invariant computations in loops to be moved
478 int flag_move_all_movables = 0;
480 /* Nonzero forces all general induction variables in loops to be
483 int flag_reduce_all_givs = 0;
485 /* Nonzero to perform full register move optimization passes. This is the
488 int flag_regmove = 0;
490 /* Nonzero for -fwritable-strings:
491 store string constants in data segment and don't uniquize them. */
493 int flag_writable_strings = 0;
495 /* Nonzero means don't put addresses of constant functions in registers.
496 Used for compiling the Unix kernel, where strange substitutions are
497 done on the assembly output. */
499 int flag_no_function_cse = 0;
501 /* Nonzero for -fomit-frame-pointer:
502 don't make a frame pointer in simple functions that don't require one. */
504 int flag_omit_frame_pointer = 0;
506 /* Nonzero means place each function into its own section on those platforms
507 which support arbitrary section names and unlimited numbers of sections. */
509 int flag_function_sections = 0;
511 /* ... and similar for data. */
513 int flag_data_sections = 0;
515 /* Nonzero to inhibit use of define_optimization peephole opts. */
517 int flag_no_peephole = 0;
519 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
520 operations in the interest of optimization. For example it allows
521 GCC to assume arguments to sqrt are nonnegative numbers, allowing
522 faster code for sqrt to be generated. */
524 int flag_fast_math = 0;
526 /* Nonzero allows GCC to optimize sibling and tail recursive calls. */
528 int flag_optimize_sibling_calls = 0;
530 /* Nonzero means the front end generally wants `errno' maintained by math
531 operations, like built-in SQRT, unless overridden by flag_fast_math. */
533 int flag_errno_math = 1;
535 /* 0 means straightforward implementation of complex divide acceptable.
536 1 means wide ranges of inputs must work for complex divide.
537 2 means C9X-like requirements for complex divide (not yet implemented). */
539 int flag_complex_divide_method = 0;
541 /* Nonzero means all references through pointers are volatile. */
545 /* Nonzero means treat all global and extern variables as volatile. */
547 int flag_volatile_global;
549 /* Nonzero means treat all static variables as volatile. */
551 int flag_volatile_static;
553 /* Nonzero means just do syntax checking; don't output anything. */
555 int flag_syntax_only = 0;
557 /* Nonzero means perform global cse. */
559 static int flag_gcse;
561 /* Nonzero means to use global dataflow analysis to eliminate
562 useless null pointer tests. */
564 static int flag_delete_null_pointer_checks;
566 /* Nonzero means to rerun cse after loop optimization. This increases
567 compilation time about 20% and picks up a few more common expressions. */
569 static int flag_rerun_cse_after_loop;
571 /* Nonzero means to run loop optimizations twice. */
573 int flag_rerun_loop_opt;
575 /* Nonzero for -finline-functions: ok to inline functions that look like
576 good inline candidates. */
578 int flag_inline_functions;
580 /* Nonzero for -fkeep-inline-functions: even if we make a function
581 go inline everywhere, keep its definition around for debugging
584 int flag_keep_inline_functions;
586 /* Nonzero means that functions will not be inlined. */
590 /* Nonzero means that we should emit static const variables
591 regardless of whether or not optimization is turned on. */
593 int flag_keep_static_consts = 1;
595 /* Nonzero means we should be saving declaration info into a .X file. */
597 int flag_gen_aux_info = 0;
599 /* Specified name of aux-info file. */
601 static char *aux_info_file_name;
603 /* Nonzero means make the text shared if supported. */
605 int flag_shared_data;
607 /* Nonzero means schedule into delayed branch slots if supported. */
609 int flag_delayed_branch;
611 /* Nonzero if we are compiling pure (sharable) code.
612 Value is 1 if we are doing reasonable (i.e. simple
613 offset into offset table) pic. Value is 2 if we can
614 only perform register offsets. */
618 /* Nonzero means generate extra code for exception handling and enable
619 exception handling. */
623 /* Nonzero means use the new model for exception handling. Replaces
624 -DNEW_EH_MODEL as a compile option. */
626 int flag_new_exceptions = 1;
628 /* Nonzero means generate frame unwind info table when supported */
630 int flag_unwind_tables = 0;
632 /* Nonzero means don't place uninitialized global data in common storage
637 /* Nonzero means pretend it is OK to examine bits of target floats,
638 even if that isn't true. The resulting code will have incorrect constants,
639 but the same series of instructions that the native compiler would make. */
641 int flag_pretend_float;
643 /* Nonzero means change certain warnings into errors.
644 Usually these are warnings about failure to conform to some standard. */
646 int flag_pedantic_errors = 0;
648 /* flag_schedule_insns means schedule insns within basic blocks (before
650 flag_schedule_insns_after_reload means schedule insns after
653 int flag_schedule_insns = 0;
654 int flag_schedule_insns_after_reload = 0;
656 /* The following flags have effect only for scheduling before register
659 flag_schedule_interblock means schedule insns accross basic blocks.
660 flag_schedule_speculative means allow speculative motion of non-load insns.
661 flag_schedule_speculative_load means allow speculative motion of some
663 flag_schedule_speculative_load_dangerous allows speculative motion of more
666 int flag_schedule_interblock = 1;
667 int flag_schedule_speculative = 1;
668 int flag_schedule_speculative_load = 0;
669 int flag_schedule_speculative_load_dangerous = 0;
671 /* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple
672 by a cheaper branch, on a count register. */
673 int flag_branch_on_count_reg;
675 /* -finhibit-size-directive inhibits output of .size for ELF.
676 This is used only for compiling crtstuff.c,
677 and it may be extended to other effects
678 needed for crtstuff.c on other systems. */
679 int flag_inhibit_size_directive = 0;
681 /* -fverbose-asm causes extra commentary information to be produced in
682 the generated assembly code (to make it more readable). This option
683 is generally only of use to those who actually need to read the
684 generated assembly code (perhaps while debugging the compiler itself).
685 -fno-verbose-asm, the default, causes the extra information
686 to be omitted and is useful when comparing two assembler files. */
688 int flag_verbose_asm = 0;
690 /* -dA causes debug commentary information to be produced in
691 the generated assembly code (to make it more readable). This option
692 is generally only of use to those who actually need to read the
693 generated assembly code (perhaps while debugging the compiler itself).
694 Currently, this switch is only used by dwarfout.c; however, it is intended
695 to be a catchall for printing debug information in the assembler file. */
697 int flag_debug_asm = 0;
699 /* -fgnu-linker specifies use of the GNU linker for initializations.
700 (Or, more generally, a linker that handles initializations.)
701 -fno-gnu-linker says that collect2 will be used. */
703 int flag_gnu_linker = 0;
705 int flag_gnu_linker = 1;
711 /* Tag all structures with __attribute__(packed) */
712 int flag_pack_struct = 0;
714 /* Emit code to check for stack overflow; also may cause large objects
715 to be allocated dynamically. */
716 int flag_stack_check;
718 /* When non-NULL, indicates that whenever space is allocated on the
719 stack, the resulting stack pointer must not pass this
720 address---that is, for stacks that grow downward, the stack pointer
721 must always be greater than or equal to this address; for stacks
722 that grow upward, the stack pointer must be less than this address.
723 At present, the rtx may be either a REG or a SYMBOL_REF, although
724 the support provided depends on the backend. */
727 /* -fcheck-memory-usage causes extra code to be generated in order to check
728 memory accesses. This is used by a detector of bad memory accesses such
730 int flag_check_memory_usage = 0;
732 /* -fprefix-function-name causes function name to be prefixed. This
733 can be used with -fcheck-memory-usage to isolate code compiled with
734 -fcheck-memory-usage. */
735 int flag_prefix_function_name = 0;
737 /* 0 if pointer arguments may alias each other. True in C.
738 1 if pointer arguments may not alias each other but may alias
740 2 if pointer arguments may not alias each other and may not
741 alias global variables. True in Fortran.
742 This defaults to 0 for C. */
743 int flag_argument_noalias = 0;
745 /* Nonzero if we should do (language-dependent) alias analysis.
746 Typically, this analysis will assume that expressions of certain
747 types do not alias expressions of certain other types. Only used
748 if alias analysis (in general) is enabled. */
749 int flag_strict_aliasing = 0;
751 /* Instrument functions with calls at entry and exit, for profiling. */
752 int flag_instrument_function_entry_exit = 0;
754 /* Nonzero means ignore `#ident' directives. 0 means handle them.
755 On SVR4 targets, it also controls whether or not to emit a
756 string identifying the compiler. */
758 int flag_no_ident = 0;
760 /* This will perform a peephole pass before sched2. */
761 int flag_peephole2 = 0;
763 /* -fbounded-pointers causes gcc to compile pointers as composite
764 objects occupying three words: the pointer value, the base address
765 of the referent object, and the address immediately beyond the end
766 of the referent object. The base and extent allow us to perform
767 runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
768 int flag_bounded_pointers = 0;
770 /* -fcheck-bounds causes gcc to generate array bounds checks.
771 For C, C++: defaults to value of flag_bounded_pointers.
772 For ObjC: defaults to off.
773 For Java: defaults to on.
774 For Fortran: defaults to off.
775 For CHILL: defaults to off. */
776 int flag_bounds_check = 0;
778 /* If one, renumber instruction UIDs to reduce the number of
779 unused UIDs if there are a lot of instructions. If greater than
780 one, unconditionally renumber instruction UIDs. */
781 int flag_renumber_insns = 1;
783 /* Values of the -falign-* flags: how much to align labels in code.
784 0 means `use default', 1 means `don't align'.
785 For each variable, there is an _log variant which is the power
786 of two not less than the variable, for .align output. */
793 int align_labels_log;
795 int align_functions_log;
797 /* Table of supported debugging formats. */
801 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
802 constant expression, we use NO_DEBUG in its place. */
803 enum debug_info_type debug_type;
804 int use_extensions_p;
805 const char * description;
809 { "", NO_DEBUG, DEFAULT_GDB_EXTENSIONS,
810 "Generate default debug format output" },
811 { "gdb", NO_DEBUG, 1, "Generate default extended debug format output" },
812 #ifdef DBX_DEBUGGING_INFO
813 { "stabs", DBX_DEBUG, 0, "Generate STABS format debug output" },
814 { "stabs+", DBX_DEBUG, 1, "Generate extended STABS format debug output" },
816 #ifdef DWARF_DEBUGGING_INFO
817 { "dwarf", DWARF_DEBUG, 0, "Generate DWARF-1 format debug output"},
818 { "dwarf+", DWARF_DEBUG, 1,
819 "Generated extended DWARF-1 format debug output" },
821 #ifdef DWARF2_DEBUGGING_INFO
822 { "dwarf-2", DWARF2_DEBUG, 0, "Enable DWARF-2 debug output" },
824 #ifdef XCOFF_DEBUGGING_INFO
825 { "xcoff", XCOFF_DEBUG, 0, "Generate XCOFF format debug output" },
826 { "xcoff+", XCOFF_DEBUG, 1, "Generate extended XCOFF format debug output" },
828 #ifdef SDB_DEBUGGING_INFO
829 { "coff", SDB_DEBUG, 0, "Generate COFF format debug output" },
839 const char * description;
841 lang_independent_options;
843 /* Add or remove a leading underscore from user symbols. */
844 int flag_leading_underscore = -1;
846 /* The user symbol prefix after having resolved same. */
847 const char *user_label_prefix;
849 /* A default for same. */
850 #ifndef USER_LABEL_PREFIX
851 #define USER_LABEL_PREFIX ""
854 /* Table of language-independent -f options.
855 STRING is the option name. VARIABLE is the address of the variable.
856 ON_VALUE is the value to store in VARIABLE
857 if `-fSTRING' is seen as an option.
858 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
860 lang_independent_options f_options[] =
862 {"float-store", &flag_float_store, 1,
863 "Do not store floats in registers" },
864 {"volatile", &flag_volatile, 1,
865 "Consider all mem refs through pointers as volatile"},
866 {"volatile-global", &flag_volatile_global, 1,
867 "Consider all mem refs to global data to be volatile" },
868 {"volatile-static", &flag_volatile_static, 1,
869 "Consider all mem refs to static data to be volatile" },
870 {"defer-pop", &flag_defer_pop, 1,
871 "Defer popping functions args from stack until later" },
872 {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
873 "When possible do not generate stack frames"},
874 {"optimize-sibling-calls", &flag_optimize_sibling_calls, 1,
875 "Optimize sibling and tail recursive calls" },
876 {"cse-follow-jumps", &flag_cse_follow_jumps, 1,
877 "When running CSE, follow jumps to their targets" },
878 {"cse-skip-blocks", &flag_cse_skip_blocks, 1,
879 "When running CSE, follow conditional jumps" },
880 {"expensive-optimizations", &flag_expensive_optimizations, 1,
881 "Perform a number of minor, expensive optimisations" },
882 {"thread-jumps", &flag_thread_jumps, 1,
883 "Perform jump threading optimisations"},
884 {"strength-reduce", &flag_strength_reduce, 1,
885 "Perform strength reduction optimisations" },
886 {"unroll-loops", &flag_unroll_loops, 1,
887 "Perform loop unrolling when iteration count is known" },
888 {"unroll-all-loops", &flag_unroll_all_loops, 1,
889 "Perform loop unrolling for all loops" },
890 {"move-all-movables", &flag_move_all_movables, 1,
891 "Force all loop invariant computations out of loops" },
892 {"reduce-all-givs", &flag_reduce_all_givs, 1,
893 "Strength reduce all loop general induction variables" },
894 {"writable-strings", &flag_writable_strings, 1,
895 "Store strings in writable data section" },
896 {"peephole", &flag_no_peephole, 0,
897 "Enable machine specific peephole optimisations" },
898 {"force-mem", &flag_force_mem, 1,
899 "Copy memory operands into registers before using" },
900 {"force-addr", &flag_force_addr, 1,
901 "Copy memory address constants into regs before using" },
902 {"function-cse", &flag_no_function_cse, 0,
903 "Allow function addresses to be held in registers" },
904 {"inline-functions", &flag_inline_functions, 1,
905 "Integrate simple functions into their callers" },
906 {"keep-inline-functions", &flag_keep_inline_functions, 1,
907 "Generate code for funcs even if they are fully inlined" },
908 {"inline", &flag_no_inline, 0,
909 "Pay attention to the 'inline' keyword"},
910 {"keep-static-consts", &flag_keep_static_consts, 1,
911 "Emit static const variables even if they are not used" },
912 {"syntax-only", &flag_syntax_only, 1,
913 "Check for syntax errors, then stop" },
914 {"shared-data", &flag_shared_data, 1,
915 "Mark data as shared rather than private" },
916 {"caller-saves", &flag_caller_saves, 1,
917 "Enable saving registers around function calls" },
918 {"pcc-struct-return", &flag_pcc_struct_return, 1,
919 "Return 'short' aggregates in memory, not registers" },
920 {"reg-struct-return", &flag_pcc_struct_return, 0,
921 "Return 'short' aggregates in registers" },
922 {"delayed-branch", &flag_delayed_branch, 1,
923 "Attempt to fill delay slots of branch instructions" },
924 {"gcse", &flag_gcse, 1,
925 "Perform the global common subexpression elimination" },
926 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
927 "Run CSE pass after loop optimisations"},
928 {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
929 "Run the loop optimiser twice"},
930 {"delete-null-pointer-checks", &flag_delete_null_pointer_checks, 1,
931 "Delete useless null pointer checks" },
932 {"pretend-float", &flag_pretend_float, 1,
933 "Pretend that host and target use the same FP format"},
934 {"schedule-insns", &flag_schedule_insns, 1,
935 "Reschedule instructions to avoid pipeline stalls"},
936 {"schedule-insns2", &flag_schedule_insns_after_reload, 1,
937 "Run two passes of the instruction scheduler"},
938 {"sched-interblock",&flag_schedule_interblock, 1,
939 "Enable scheduling across basic blocks" },
940 {"sched-spec",&flag_schedule_speculative, 1,
941 "Allow speculative motion of non-loads" },
942 {"sched-spec-load",&flag_schedule_speculative_load, 1,
943 "Allow speculative motion of some loads" },
944 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
945 "Allow speculative motion of more loads" },
946 {"branch-count-reg",&flag_branch_on_count_reg, 1,
947 "Replace add,compare,branch with branch on count reg"},
948 {"pic", &flag_pic, 1,
949 "Generate position independent code, if possible"},
950 {"PIC", &flag_pic, 2, ""},
951 {"exceptions", &flag_exceptions, 1,
952 "Enable exception handling" },
953 {"new-exceptions", &flag_new_exceptions, 1,
954 "Use the new model for exception handling" },
955 {"unwind-tables", &flag_unwind_tables, 1,
956 "Just generate unwind tables for exception handling" },
957 {"sjlj-exceptions", &exceptions_via_longjmp, 1,
958 "Use setjmp/longjmp to handle exceptions" },
959 {"asynchronous-exceptions", &asynchronous_exceptions, 1,
960 "Support asynchronous exceptions" },
961 {"profile-arcs", &profile_arc_flag, 1,
962 "Insert arc based program profiling code" },
963 {"test-coverage", &flag_test_coverage, 1,
964 "Create data files needed by gcov" },
965 {"branch-probabilities", &flag_branch_probabilities, 1,
966 "Use profiling information for branch probabilities" },
967 {"reorder-blocks", &flag_reorder_blocks, 1,
968 "Reorder basic blocks to improve code placement" },
969 {"fast-math", &flag_fast_math, 1,
970 "Improve FP speed by violating ANSI & IEEE rules" },
971 {"common", &flag_no_common, 0,
972 "Do not put unitialised globals in the common section" },
973 {"inhibit-size-directive", &flag_inhibit_size_directive, 1,
974 "Do not generate .size directives" },
975 {"function-sections", &flag_function_sections, 1,
976 "place each function into its own section" },
977 {"data-sections", &flag_data_sections, 1,
978 "place data items into their own section" },
979 {"verbose-asm", &flag_verbose_asm, 1,
980 "Add extra commentry to assembler output"},
981 {"gnu-linker", &flag_gnu_linker, 1,
982 "Output GNU ld formatted global initialisers"},
983 {"regmove", &flag_regmove, 1,
984 "Enables a register move optimisation"},
985 {"optimize-register-move", &flag_regmove, 1,
986 "Do the full regmove optimization pass"},
987 {"pack-struct", &flag_pack_struct, 1,
988 "Pack structure members together without holes" },
989 {"stack-check", &flag_stack_check, 1,
990 "Insert stack checking code into the program" },
991 {"argument-alias", &flag_argument_noalias, 0,
992 "Specify that arguments may alias each other & globals"},
993 {"argument-noalias", &flag_argument_noalias, 1,
994 "Assume arguments may alias globals but not each other"},
995 {"argument-noalias-global", &flag_argument_noalias, 2,
996 "Assume arguments do not alias each other or globals" },
997 {"strict-aliasing", &flag_strict_aliasing, 1,
998 "Assume strict aliasing rules apply" },
999 {"align-loops", &align_loops, 0,
1000 "Align the start of loops" },
1001 {"align-jumps", &align_jumps, 0,
1002 "Align labels which are only reached by jumping" },
1003 {"align-labels", &align_labels, 0,
1004 "Align all labels" },
1005 {"align-functions", &align_functions, 0,
1006 "Align the start of functions" },
1007 {"check-memory-usage", &flag_check_memory_usage, 1,
1008 "Generate code to check every memory access" },
1009 {"prefix-function-name", &flag_prefix_function_name, 1,
1010 "Add a prefix to all function names" },
1011 {"dump-unnumbered", &flag_dump_unnumbered, 1,
1012 "Suppress output of instruction numbers and line number notes in debugging dumps"},
1013 {"instrument-functions", &flag_instrument_function_entry_exit, 1,
1014 "Instrument function entry/exit with profiling calls"},
1015 {"ssa", &flag_ssa, 1,
1016 "Enable SSA optimizations" },
1017 {"leading-underscore", &flag_leading_underscore, 1,
1018 "External symbols have a leading underscore" },
1019 {"ident", &flag_no_ident, 0,
1020 "Process #ident directives"},
1021 { "peephole2", &flag_peephole2, 1,
1022 "Enables an rtl peephole pass run before sched2" },
1023 {"math-errno", &flag_errno_math, 1,
1024 "Set errno after built-in math functions"},
1025 {"bounded-pointers", &flag_bounded_pointers, 1,
1026 "Compile pointers as triples: value, base & end" },
1027 {"bounds-check", &flag_bounds_check, 1,
1028 "Generate code to check bounds before dereferencing pointers and arrays" }
1031 #define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0]))
1033 /* Table of language-specific options. */
1035 static struct lang_opt
1037 const char * option;
1038 const char * description;
1040 documented_lang_options[] =
1042 /* In order not to overload the --help output, the convention
1043 used here is to only describe those options which are not
1044 enabled by default. */
1046 { "-ansi", "Compile just for ANSI C" },
1047 { "-fallow-single-precision",
1048 "Do not promote floats to double if using -traditional" },
1049 { "-std= ", "Determine language standard"},
1051 { "-fsigned-bitfields", "" },
1052 { "-funsigned-bitfields","Make bitfields by unsigned by default" },
1053 { "-fno-signed-bitfields", "" },
1054 { "-fno-unsigned-bitfields","" },
1055 { "-fsigned-char", "Make 'char' be signed by default"},
1056 { "-funsigned-char", "Make 'char' be unsigned by default"},
1057 { "-fno-signed-char", "" },
1058 { "-fno-unsigned-char", "" },
1060 { "-ftraditional", "" },
1061 { "-traditional", "Attempt to support traditional K&R style C"},
1062 { "-fnotraditional", "" },
1063 { "-fno-traditional", "" },
1066 { "-fno-asm", "Do not recognise the 'asm' keyword" },
1067 { "-fbuiltin", "" },
1068 { "-fno-builtin", "Do not recognise any built in functions" },
1069 { "-fhosted", "Assume normal C execution environment" },
1070 { "-fno-hosted", "" },
1072 "Assume that standard libraries & main might not exist" },
1073 { "-fno-freestanding", "" },
1074 { "-fcond-mismatch", "Allow different types as args of ? operator"},
1075 { "-fno-cond-mismatch", "" },
1076 { "-fdollars-in-identifiers", "Allow the use of $ inside identifiers" },
1077 { "-fno-dollars-in-identifiers", "" },
1078 { "-fpreprocessed", "" },
1079 { "-fno-preprocessed", "" },
1080 { "-fshort-double", "Use the same size for double as for float" },
1081 { "-fno-short-double", "" },
1082 { "-fshort-enums", "Use the smallest fitting integer to hold enums"},
1083 { "-fno-short-enums", "" },
1084 { "-fshort-wchar", "Override the underlying type for wchar_t to `unsigned short'" },
1085 { "-fno-short-wchar", "" },
1087 { "-Wall", "Enable most warning messages" },
1088 { "-Wbad-function-cast",
1089 "Warn about casting functions to incompatible types" },
1090 { "-Wno-bad-function-cast", "" },
1091 { "-Wmissing-noreturn",
1092 "Warn about functions which might be candidates for attribute noreturn" },
1093 { "-Wno-missing-noreturn", "" },
1094 { "-Wcast-qual", "Warn about casts which discard qualifiers"},
1095 { "-Wno-cast-qual", "" },
1096 { "-Wchar-subscripts", "Warn about subscripts whose type is 'char'"},
1097 { "-Wno-char-subscripts", "" },
1098 { "-Wcomment", "Warn if nested comments are detected" },
1099 { "-Wno-comment", "" },
1100 { "-Wcomments", "Warn if nested comments are detected" },
1101 { "-Wno-comments", "" },
1102 { "-Wconversion", "Warn about possibly confusing type conversions" },
1103 { "-Wno-conversion", "" },
1104 { "-Wformat", "Warn about printf format anomalies" },
1105 { "-Wno-format", "" },
1106 { "-Wimplicit-function-declaration",
1107 "Warn about implicit function declarations" },
1108 { "-Wno-implicit-function-declaration", "" },
1109 { "-Werror-implicit-function-declaration", "" },
1110 { "-Wimplicit-int", "Warn when a declaration does not specify a type" },
1111 { "-Wno-implicit-int", "" },
1112 { "-Wimplicit", "" },
1113 { "-Wno-implicit", "" },
1114 { "-Wimport", "Warn about the use of the #import directive" },
1115 { "-Wno-import", "" },
1116 { "-Wlong-long","" },
1117 { "-Wno-long-long", "Do not warn about using 'long long' when -pedantic" },
1118 { "-Wmain", "Warn about suspicious declarations of main" },
1119 { "-Wno-main", "" },
1120 { "-Wmissing-braces",
1121 "Warn about possibly missing braces around initialisers" },
1122 { "-Wno-missing-braces", "" },
1123 { "-Wmissing-declarations",
1124 "Warn about global funcs without previous declarations"},
1125 { "-Wno-missing-declarations", "" },
1126 { "-Wmissing-prototypes", "Warn about global funcs without prototypes" },
1127 { "-Wno-missing-prototypes", "" },
1128 { "-Wmultichar", "Warn about use of multicharacter literals"},
1129 { "-Wno-multichar", "" },
1130 { "-Wnested-externs", "Warn about externs not at file scope level" },
1131 { "-Wno-nested-externs", "" },
1132 { "-Wparentheses", "Warn about possible missing parentheses" },
1133 { "-Wno-parentheses", "" },
1134 { "-Wpointer-arith", "Warn about function pointer arithmetic" },
1135 { "-Wno-pointer-arith", "" },
1136 { "-Wredundant-decls",
1137 "Warn about multiple declarations of the same object" },
1138 { "-Wno-redundant-decls", "" },
1139 { "-Wsign-compare", "Warn about signed/unsigned comparisons" },
1140 { "-Wno-sign-compare", "" },
1141 { "-Wfloat-equal", "Warn about testing equality of floating point numbers" },
1142 { "-Wno-float-equal", "" },
1143 { "-Wunknown-pragmas", "Warn about unrecognized pragmas" },
1144 { "-Wno-unknown-pragmas", "" },
1145 { "-Wstrict-prototypes", "Warn about non-prototyped function decls" },
1146 { "-Wno-strict-prototypes", "" },
1147 { "-Wtraditional", "Warn about constructs whose meaning change in ANSI C"},
1148 { "-Wno-traditional", "" },
1149 { "-Wtrigraphs", "Warn when trigraphs are encountered" },
1150 { "-Wno-trigraphs", "" },
1152 { "-Wno-undef", "" },
1153 { "-Wwrite-strings", "Mark strings as 'const char *'"},
1154 { "-Wno-write-strings", "" },
1156 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1158 /* These are for Objective C. */
1159 DEFINE_LANG_NAME ("Objective C")
1161 { "-lang-objc", "" },
1162 { "-gen-decls", "Dump decls to a .decl file" },
1163 { "-fgnu-runtime", "Generate code for GNU runtime environment" },
1164 { "-fno-gnu-runtime", "" },
1165 { "-fnext-runtime", "Generate code for NeXT runtime environment" },
1166 { "-fno-next-runtime", "" },
1167 { "-Wselector", "Warn if a selector has multiple methods" },
1168 { "-Wno-selector", "" },
1169 { "-Wprotocol", "" },
1170 { "-Wno-protocol", "Do not warn if inherited methods are unimplemented"},
1171 { "-print-objc-runtime-info",
1172 "Generate C header of platform specific features" },
1174 #include "options.h"
1178 /* Here is a table, controlled by the tm.h file, listing each -m switch
1179 and which bits in `target_switches' it should set or clear.
1180 If VALUE is positive, it is bits to set.
1181 If VALUE is negative, -VALUE is bits to clear.
1182 (The sign bit is not used so there is no confusion.) */
1188 const char * description;
1190 target_switches [] = TARGET_SWITCHES;
1192 /* This table is similar, but allows the switch to have a value. */
1194 #ifdef TARGET_OPTIONS
1197 const char * prefix;
1198 const char ** variable;
1199 const char * description;
1201 target_options [] = TARGET_OPTIONS;
1204 /* Options controlling warnings */
1206 /* Don't print warning messages. -w. */
1208 int inhibit_warnings = 0;
1210 /* Print various extra warnings. -W. */
1212 int extra_warnings = 0;
1214 /* Treat warnings as errors. -Werror. */
1216 int warnings_are_errors = 0;
1218 /* Nonzero to warn about unused local variables. */
1222 /* Nonzero to warn about code which is never reached. */
1224 int warn_notreached;
1226 /* Nonzero to warn about variables used before they are initialized. */
1228 int warn_uninitialized;
1230 /* Nonzero means warn about all declarations which shadow others. */
1234 /* Warn if a switch on an enum fails to have a case for every enum value. */
1238 /* Nonzero means warn about function definitions that default the return type
1239 or that use a null return and have a return-type other than void. */
1241 int warn_return_type;
1243 /* Nonzero means warn about pointer casts that increase the required
1244 alignment of the target type (and might therefore lead to a crash
1245 due to a misaligned access). */
1247 int warn_cast_align;
1249 /* Nonzero means warn about any identifiers that match in the first N
1250 characters. The value N is in `id_clash_len'. */
1255 /* Nonzero means warn about any objects definitions whose size is larger
1256 than N bytes. Also want about function definitions whose returned
1257 values are larger than N bytes. The value N is in `larger_than_size'. */
1259 int warn_larger_than;
1260 HOST_WIDE_INT larger_than_size;
1262 /* Nonzero means warn if inline function is too large. */
1266 /* Warn if a function returns an aggregate,
1267 since there are often incompatible calling conventions for doing this. */
1269 int warn_aggregate_return;
1271 /* Warn if packed attribute on struct is unnecessary and inefficient. */
1275 /* Warn when gcc pads a structure to an alignment boundary. */
1279 /* Likewise for -W. */
1281 lang_independent_options W_options[] =
1283 {"unused", &warn_unused, 1, "Warn when a variable is unused" },
1284 {"error", &warnings_are_errors, 1, ""},
1285 {"shadow", &warn_shadow, 1, "Warn when one local variable shadows another" },
1286 {"switch", &warn_switch, 1,
1287 "Warn about enumerated switches missing a specific case" },
1288 {"aggregate-return", &warn_aggregate_return, 1,
1289 "Warn about returning structures, unions or arrays" },
1290 {"cast-align", &warn_cast_align, 1,
1291 "Warn about pointer casts which increase alignment" },
1292 {"unreachable-code", &warn_notreached, 1,
1293 "Warn about code that will never be executed" },
1294 {"uninitialized", &warn_uninitialized, 1,
1295 "Warn about unitialized automatic variables"},
1296 {"inline", &warn_inline, 1,
1297 "Warn when an inlined function cannot be inlined"},
1298 {"packed", &warn_packed, 1,
1299 "Warn when the packed attribute has no effect on struct layout"},
1300 {"padded", &warn_padded, 1,
1301 "Warn when padding is required to align struct members"}
1304 /* Output files for assembler code (real compiler output)
1305 and debugging dumps. */
1308 FILE *aux_info_file;
1309 FILE *rtl_dump_file = NULL;
1311 /* Decode the string P as an integral parameter.
1312 If the string is indeed an integer return its numeric value else
1313 issue an Invalid Option error for the option PNAME and return DEFVAL.
1314 If PNAME is zero just return DEFVAL, do not call error. */
1317 read_integral_parameter (p, pname, defval)
1322 const char *endp = p;
1326 if (*endp >= '0' && *endp <= '9')
1335 error ("Invalid option `%s'", pname);
1343 /* Time accumulators, to count the total time spent in various passes. */
1347 int integration_time;
1353 int branch_prob_time;
1358 int local_alloc_time;
1359 int global_alloc_time;
1364 int reorder_blocks_time;
1365 int shorten_branch_time;
1373 /* Return time used so far, in microseconds. */
1383 #else /* not BeOS */
1384 #if defined (_WIN32) && !defined (__CYGWIN__)
1388 return (clock() * 1000);
1389 #else /* not _WIN32 */
1395 tick = 1000000 / sysconf(_SC_CLK_TCK);
1397 return (tms.tms_utime + tms.tms_stime) * tick;
1403 # if HAVE_SYSCONF && defined _SC_CLK_TCK
1404 # define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */
1407 # define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */
1409 # define TICKS_PER_SECOND HZ /* traditional UNIX */
1413 return (tms.tms_utime + tms.tms_stime) * (1000000 / TICKS_PER_SECOND);
1418 struct rusage rusage;
1419 getrusage (0, &rusage);
1420 return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
1421 + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
1428 int proc_system_time;
1429 int child_user_time;
1430 int child_system_time;
1432 times ((void *) &vms_times);
1433 return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
1437 #endif /* _SC_CLK_TCK */
1439 #endif /* __BEOS__ */
1442 #define TIMEVAR(VAR, BODY) \
1443 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
1446 print_time (str, total)
1451 "time in %s: %d.%06d (%.0f%%)\n",
1452 str, total / 1000000, total % 1000000,
1453 all_time == 0 ? 0.00 : (double) total / (double) all_time * 100.0);
1456 /* This is the default decl_printable_name function. */
1459 decl_name (decl, verbosity)
1461 int verbosity ATTRIBUTE_UNUSED;
1463 return IDENTIFIER_POINTER (DECL_NAME (decl));
1466 /* Mark P for GC. Also mark main_input_filename and input_filename. */
1471 struct file_stack *stack = *(struct file_stack **)p;
1473 /* We're only called for input_file_stack, so we can mark the current
1474 input_filename here as well. */
1475 ggc_mark_string (main_input_filename);
1476 ggc_mark_string (input_filename);
1480 ggc_mark_string (stack->name);
1481 stack = stack->next;
1486 /* This calls abort and is used to avoid problems when abort if a macro.
1487 It is used when we need to pass the address of abort. */
1495 /* When `malloc.c' is compiled with `rcheck' defined,
1496 it calls this function to report clobberage. */
1500 const char * s ATTRIBUTE_UNUSED;
1505 /* Return the logarithm of X, base 2, considering X unsigned,
1506 if X is a power of 2. Otherwise, returns -1.
1508 This should be used via the `exact_log2' macro. */
1512 register unsigned HOST_WIDE_INT x;
1514 register int log = 0;
1515 /* Test for 0 or a power of 2. */
1516 if (x == 0 || x != (x & -x))
1518 while ((x >>= 1) != 0)
1523 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1524 If X is 0, return -1.
1526 This should be used via the floor_log2 macro. */
1530 register unsigned HOST_WIDE_INT x;
1532 register int log = -1;
1539 static int float_handler_set;
1541 jmp_buf float_handler;
1543 /* Signals actually come here. */
1546 float_signal (signo)
1547 /* If this is missing, some compilers complain. */
1548 int signo ATTRIBUTE_UNUSED;
1550 if (float_handled == 0)
1552 #if defined (USG) || defined (hpux)
1553 signal (SIGFPE, float_signal); /* re-enable the signal catcher */
1556 signal (SIGFPE, float_signal);
1557 longjmp (float_handler, 1);
1560 /* Specify where to longjmp to when a floating arithmetic error happens.
1561 If HANDLER is 0, it means don't handle the errors any more. */
1564 set_float_handler (handler)
1567 float_handled = (handler != 0);
1569 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1571 if (float_handled && ! float_handler_set)
1573 signal (SIGFPE, float_signal);
1574 float_handler_set = 1;
1578 /* This is a wrapper function for code which might elicit an
1579 arithmetic exception. That code should be passed in as a function
1580 pointer FN, and one argument DATA. DATA is usually a struct which
1581 contains the real input and output for function FN. This function
1582 returns 0 (failure) if longjmp was called (i.e. an exception
1583 occured.) It returns 1 (success) otherwise. */
1586 do_float_handler (fn, data)
1587 void (*fn) PARAMS ((PTR));
1594 /* We got here via longjmp() caused by an exception in function fn() */
1595 set_float_handler (NULL);
1599 set_float_handler (buf);
1601 set_float_handler (NULL);
1605 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1606 error happens, pushing the previous specification into OLD_HANDLER.
1607 Return an indication of whether there was a previous handler in effect. */
1610 push_float_handler (handler, old_handler)
1611 jmp_buf handler, old_handler;
1613 int was_handled = float_handled;
1617 memcpy ((char *) old_handler, (char *) float_handler,
1618 sizeof (float_handler));
1620 memcpy ((char *) float_handler, (char *) handler, sizeof (float_handler));
1624 /* Restore the previous specification of whether and where to longjmp to
1625 when a floating arithmetic error happens. */
1628 pop_float_handler (handled, handler)
1632 float_handled = handled;
1634 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1637 /* Handler for SIGPIPE. */
1641 /* If this is missing, some compilers complain. */
1642 int signo ATTRIBUTE_UNUSED;
1644 fatal ("output pipe has been closed");
1647 /* Strip off a legitimate source ending from the input string NAME of
1648 length LEN. Rather than having to know the names used by all of
1649 our front ends, we strip off an ending of a period followed by
1650 up to five characters. (Java uses ".class".) */
1653 strip_off_ending (name, len)
1658 for (i = 2; i < 6 && len > i; i++)
1660 if (name[len - i] == '.')
1662 name[len - i] = '\0';
1668 /* Output a quoted string. */
1671 output_quoted_string (asm_file, string)
1675 #ifdef OUTPUT_QUOTED_STRING
1676 OUTPUT_QUOTED_STRING (asm_file, string);
1680 putc ('\"', asm_file);
1681 while ((c = *string++) != 0)
1683 if (c == '\"' || c == '\\')
1684 putc ('\\', asm_file);
1687 putc ('\"', asm_file);
1691 /* Output a file name in the form wanted by System V. */
1694 output_file_directive (asm_file, input_name)
1696 const char *input_name;
1698 int len = strlen (input_name);
1699 const char *na = input_name + len;
1701 /* NA gets INPUT_NAME sans directory names. */
1702 while (na > input_name)
1706 #ifdef DIR_SEPARATOR
1707 if (na[-1] == DIR_SEPARATOR)
1713 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1714 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1716 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1717 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1719 fprintf (asm_file, "\t.file\t");
1720 output_quoted_string (asm_file, na);
1721 fputc ('\n', asm_file);
1726 #ifdef ASM_IDENTIFY_LANGUAGE
1727 /* Routine to build language identifier for object file. */
1729 output_lang_identify (asm_out_file)
1732 int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1733 char *s = (char *) alloca (len);
1734 sprintf (s, "__gnu_compiled_%s", lang_identify ());
1735 ASM_OUTPUT_LABEL (asm_out_file, s);
1739 /* Routine to open a dump file. */
1741 open_dump_file (suffix, function_name)
1743 const char *function_name;
1750 dumpname = concat (dump_base_name, suffix, NULL);
1752 if (rtl_dump_file != NULL)
1753 fclose (rtl_dump_file);
1755 rtl_dump_file = fopen (dumpname, "a");
1757 if (rtl_dump_file == NULL)
1758 pfatal_with_name (dumpname);
1763 fprintf (rtl_dump_file, "\n;; Function %s\n\n", function_name);
1769 /* Routine to close a dump file. */
1771 close_dump_file (func, insns)
1772 void (*func) PARAMS ((FILE *, rtx));
1779 func (rtl_dump_file, insns);
1781 fflush (rtl_dump_file);
1782 fclose (rtl_dump_file);
1784 rtl_dump_file = NULL;
1790 /* Routine to dump rtl into a file. */
1792 dump_rtl (suffix, decl, func, insns)
1795 void (*func) PARAMS ((FILE *, rtx));
1798 open_dump_file (suffix, decl_printable_name (decl, 2));
1799 close_dump_file (func, insns);
1802 /* Routine to empty a dump file. */
1804 clean_dump_file (suffix)
1807 char * const dumpname = concat (dump_base_name, suffix, NULL);
1809 rtl_dump_file = fopen (dumpname, "w");
1811 if (rtl_dump_file == NULL)
1812 pfatal_with_name (dumpname);
1816 fclose (rtl_dump_file);
1817 rtl_dump_file = NULL;
1822 /* Do any final processing required for the declarations in VEC, of
1823 which there are LEN. We write out inline functions and variables
1824 that have been deferred until this point, but which are required.
1825 Returns non-zero if anything was put out. */
1827 wrapup_global_declarations (vec, len)
1834 int output_something = 0;
1836 for (i = 0; i < len; i++)
1840 /* We're not deferring this any longer. */
1841 DECL_DEFER_OUTPUT (decl) = 0;
1843 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
1844 && incomplete_decl_finalize_hook != 0)
1845 (*incomplete_decl_finalize_hook) (decl);
1848 /* Now emit any global variables or functions that we have been
1849 putting off. We need to loop in case one of the things emitted
1850 here references another one which comes earlier in the list. */
1854 for (i = 0; i < len; i++)
1858 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
1861 /* Don't write out static consts, unless we still need them.
1863 We also keep static consts if not optimizing (for debugging),
1864 unless the user specified -fno-keep-static-consts.
1865 ??? They might be better written into the debug information.
1866 This is possible when using DWARF.
1868 A language processor that wants static constants to be always
1869 written out (even if it is not used) is responsible for
1870 calling rest_of_decl_compilation itself. E.g. the C front-end
1871 calls rest_of_decl_compilation from finish_decl.
1872 One motivation for this is that is conventional in some
1873 environments to write things like:
1874 static const char rcsid[] = "... version string ...";
1875 intending to force the string to be in the executable.
1877 A language processor that would prefer to have unneeded
1878 static constants "optimized away" would just defer writing
1879 them out until here. E.g. C++ does this, because static
1880 constants are often defined in header files.
1882 ??? A tempting alternative (for both C and C++) would be
1883 to force a constant to be written if and only if it is
1884 defined in a main file, as opposed to an include file. */
1886 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1887 && (! TREE_READONLY (decl)
1888 || TREE_PUBLIC (decl)
1889 || (!optimize && flag_keep_static_consts)
1890 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1893 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
1896 if (TREE_CODE (decl) == FUNCTION_DECL
1897 && DECL_INITIAL (decl) != 0
1898 && DECL_SAVED_INSNS (decl) != 0
1899 && (flag_keep_inline_functions
1900 || (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
1901 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1904 temporary_allocation ();
1905 output_inline_function (decl);
1906 permanent_allocation (1);
1911 output_something = 1;
1915 return output_something;
1918 /* Issue appropriate warnings for the global declarations in VEC (of
1919 which there are LEN). Output debugging information for them. */
1921 check_global_declarations (vec, len)
1928 for (i = 0; i < len; i++)
1932 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1933 && ! TREE_ASM_WRITTEN (decl))
1934 /* Cancel the RTL for this decl so that, if debugging info
1935 output for global variables is still to come,
1936 this one will be omitted. */
1937 DECL_RTL (decl) = NULL;
1939 /* Warn about any function
1940 declared static but not defined.
1941 We don't warn about variables,
1942 because many programs have static variables
1943 that exist only to get some text into the object file. */
1944 if (TREE_CODE (decl) == FUNCTION_DECL
1946 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
1947 && DECL_INITIAL (decl) == 0
1948 && DECL_EXTERNAL (decl)
1949 && ! DECL_ARTIFICIAL (decl)
1950 && ! TREE_PUBLIC (decl))
1952 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
1953 pedwarn_with_decl (decl,
1954 "`%s' used but never defined");
1956 warning_with_decl (decl,
1957 "`%s' declared `static' but never defined");
1958 /* This symbol is effectively an "extern" declaration now. */
1959 TREE_PUBLIC (decl) = 1;
1960 assemble_external (decl);
1963 /* Warn about static fns or vars defined but not used,
1964 but not about inline functions or static consts
1965 since defining those in header files is normal practice. */
1967 && ((TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
1968 || (TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
1969 && ! DECL_IN_SYSTEM_HEADER (decl)
1970 && ! DECL_EXTERNAL (decl)
1971 && ! TREE_PUBLIC (decl)
1972 && ! TREE_USED (decl)
1973 && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
1974 /* The TREE_USED bit for file-scope decls
1975 is kept in the identifier, to handle multiple
1976 external decls in different scopes. */
1977 && ! TREE_USED (DECL_NAME (decl)))
1978 warning_with_decl (decl, "`%s' defined but not used");
1980 #ifdef SDB_DEBUGGING_INFO
1981 /* The COFF linker can move initialized global vars to the end.
1982 And that can screw up the symbol ordering.
1983 By putting the symbols in that order to begin with,
1984 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
1985 if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
1986 && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
1987 && ! DECL_EXTERNAL (decl)
1988 && DECL_RTL (decl) != 0)
1989 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
1991 /* Output COFF information for non-global
1992 file-scope initialized variables. */
1993 if (write_symbols == SDB_DEBUG
1994 && TREE_CODE (decl) == VAR_DECL
1995 && DECL_INITIAL (decl)
1996 && ! DECL_EXTERNAL (decl)
1997 && DECL_RTL (decl) != 0
1998 && GET_CODE (DECL_RTL (decl)) == MEM)
1999 TIMEVAR (symout_time, sdbout_toplevel_data (decl));
2000 #endif /* SDB_DEBUGGING_INFO */
2001 #ifdef DWARF_DEBUGGING_INFO
2002 /* Output DWARF information for file-scope tentative data object
2003 declarations, file-scope (extern) function declarations (which
2004 had no corresponding body) and file-scope tagged type declarations
2005 and definitions which have not yet been forced out. */
2007 if (write_symbols == DWARF_DEBUG
2008 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2009 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
2011 #ifdef DWARF2_DEBUGGING_INFO
2012 /* Output DWARF2 information for file-scope tentative data object
2013 declarations, file-scope (extern) function declarations (which
2014 had no corresponding body) and file-scope tagged type declarations
2015 and definitions which have not yet been forced out. */
2017 if (write_symbols == DWARF2_DEBUG
2018 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2019 TIMEVAR (symout_time, dwarf2out_decl (decl));
2024 /* Save the current INPUT_FILENAME and LINENO on the top entry in the
2025 INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
2026 INPUT_FILENAME and LINENO accordingly. */
2029 push_srcloc (file, line)
2033 struct file_stack *fs;
2035 if (input_file_stack)
2037 input_file_stack->name = input_filename;
2038 input_file_stack->line = lineno;
2041 fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2042 fs->name = input_filename = file;
2043 fs->line = lineno = line;
2044 fs->indent_level = 0;
2045 fs->next = input_file_stack;
2046 input_file_stack = fs;
2047 input_file_stack_tick++;
2050 /* Pop the top entry off the stack of presently open source files.
2051 Restore the INPUT_FILENAME and LINENO from the new topmost entry on
2057 struct file_stack *fs;
2059 fs = input_file_stack;
2060 input_file_stack = fs->next;
2062 input_file_stack_tick++;
2063 /* The initial souce file is never popped. */
2064 if (!input_file_stack)
2066 input_filename = input_file_stack->name;
2067 lineno = input_file_stack->line;
2070 /* Compile an entire file of output from cpp, named NAME.
2071 Write a file of assembly output and various debugging dumps. */
2080 int name_specified = name != 0;
2082 if (dump_base_name == 0)
2083 dump_base_name = name ? name : "gccdump";
2087 integration_time = 0;
2093 branch_prob_time = 0;
2098 local_alloc_time = 0;
2099 global_alloc_time = 0;
2104 reorder_blocks_time = 0;
2105 shorten_branch_time = 0;
2111 /* Initialize data in various passes. */
2115 name = init_parse (name);
2116 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
2117 || debug_info_level == DINFO_LEVEL_VERBOSE
2118 || flag_test_coverage
2119 || warn_notreached);
2121 init_decl_processing ();
2128 init_function_once ();
2129 init_stor_layout_once ();
2130 init_varasm_once ();
2132 /* The following initialization functions need to generate rtl, so
2133 provide a dummy function context for them. */
2134 init_dummy_function_start ();
2137 if (flag_caller_saves)
2138 init_caller_save ();
2139 expand_dummy_function_end ();
2141 /* If auxiliary info generation is desired, open the output file.
2142 This goes in the same directory as the source file--unlike
2143 all the other output files. */
2144 if (flag_gen_aux_info)
2146 aux_info_file = fopen (aux_info_file_name, "w");
2147 if (aux_info_file == 0)
2148 pfatal_with_name (aux_info_file_name);
2151 /* Clear the dump files. */
2153 clean_dump_file (".00.rtl");
2156 clean_dump_file (".01.jump");
2157 if (graph_dump_format != no_graph)
2158 clean_graph_dump_file (dump_base_name, ".01.jump");
2162 clean_dump_file (".02.cse");
2163 if (graph_dump_format != no_graph)
2164 clean_graph_dump_file (dump_base_name, ".02.cse");
2168 clean_dump_file (".03.addressof");
2169 if (graph_dump_format != no_graph)
2170 clean_graph_dump_file (dump_base_name, ".03.addressof");
2174 clean_dump_file (".033.ssa");
2175 clean_dump_file (".037.ussa");
2179 clean_dump_file (".04.gcse");
2180 if (graph_dump_format != no_graph)
2181 clean_graph_dump_file (dump_base_name, ".04.gcse");
2185 clean_dump_file (".05.loop");
2186 if (graph_dump_format != no_graph)
2187 clean_graph_dump_file (dump_base_name, ".05.loop");
2191 clean_dump_file (".06.cse2");
2192 if (graph_dump_format != no_graph)
2193 clean_graph_dump_file (dump_base_name, ".06.cse2");
2195 if (branch_prob_dump)
2197 clean_dump_file (".07.bp");
2198 if (graph_dump_format != no_graph)
2199 clean_graph_dump_file (dump_base_name, ".07.bp");
2203 clean_dump_file (".08.flow");
2204 if (graph_dump_format != no_graph)
2205 clean_graph_dump_file (dump_base_name, ".08.flow");
2209 clean_dump_file (".09.combine");
2210 if (graph_dump_format != no_graph)
2211 clean_graph_dump_file (dump_base_name, ".09.combine");
2215 clean_dump_file (".10.regmove");
2216 if (graph_dump_format != no_graph)
2217 clean_graph_dump_file (dump_base_name, ".10.regmove");
2219 #ifdef INSN_SCHEDULING
2222 clean_dump_file (".11.sched");
2223 if (graph_dump_format != no_graph)
2224 clean_graph_dump_file (dump_base_name, ".11.sched");
2229 clean_dump_file (".12.lreg");
2230 if (graph_dump_format != no_graph)
2231 clean_graph_dump_file (dump_base_name, ".12.lreg");
2233 if (global_reg_dump)
2235 clean_dump_file (".13.greg");
2236 if (graph_dump_format != no_graph)
2237 clean_graph_dump_file (dump_base_name, ".13.greg");
2241 clean_dump_file (".14.flow2");
2242 if (graph_dump_format != no_graph)
2243 clean_graph_dump_file (dump_base_name, ".14.flow2");
2245 #ifdef HAVE_peephole2
2248 clean_dump_file (".15.peephole2");
2249 if (graph_dump_format != no_graph)
2250 clean_graph_dump_file (dump_base_name, ".15.peephole2");
2253 #ifdef INSN_SCHEDULING
2256 clean_dump_file (".16.sched2");
2257 if (graph_dump_format != no_graph)
2258 clean_graph_dump_file (dump_base_name, ".16.sched2");
2261 if (reorder_blocks_dump)
2263 clean_dump_file (".bbro");
2264 if (graph_dump_format != no_graph)
2265 clean_graph_dump_file (dump_base_name, ".bbro");
2269 clean_dump_file (".17.jump2");
2270 if (graph_dump_format != no_graph)
2271 clean_graph_dump_file (dump_base_name, ".17.jump2");
2273 #ifdef MACHINE_DEPENDENT_REORG
2274 if (mach_dep_reorg_dump)
2276 clean_dump_file (".18.mach");
2277 if (graph_dump_format != no_graph)
2278 clean_graph_dump_file (dump_base_name, ".18.mach");
2284 clean_dump_file (".19.dbr");
2285 if (graph_dump_format != no_graph)
2286 clean_graph_dump_file (dump_base_name, ".19.dbr");
2292 clean_dump_file (".20.stack");
2293 if (graph_dump_format != no_graph)
2294 clean_graph_dump_file (dump_base_name, ".20.stack");
2298 /* Open assembler code output file. */
2300 if (flag_syntax_only)
2301 asm_out_file = NULL;
2304 if (! name_specified && asm_file_name == 0)
2305 asm_out_file = stdout;
2308 if (asm_file_name == 0)
2310 int len = strlen (dump_base_name);
2311 char *dumpname = (char *) xmalloc (len + 6);
2312 memcpy (dumpname, dump_base_name, len + 1);
2313 strip_off_ending (dumpname, len);
2314 strcat (dumpname, ".s");
2315 asm_file_name = dumpname;
2317 if (!strcmp (asm_file_name, "-"))
2318 asm_out_file = stdout;
2320 asm_out_file = fopen (asm_file_name, "w");
2321 if (asm_out_file == 0)
2322 pfatal_with_name (asm_file_name);
2325 #ifdef IO_BUFFER_SIZE
2326 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
2327 _IOFBF, IO_BUFFER_SIZE);
2332 name = ggc_alloc_string (name, strlen (name));
2333 input_filename = name;
2335 /* Put an entry on the input file stack for the main input file. */
2336 push_srcloc (input_filename, 0);
2338 /* Perform language-specific initialization.
2339 This may set main_input_filename. */
2342 /* If the input doesn't start with a #line, use the input name
2343 as the official input file name. */
2344 if (main_input_filename == 0)
2345 main_input_filename = name;
2347 if (flag_syntax_only)
2349 write_symbols = NO_DEBUG;
2351 profile_block_flag = 0;
2355 ASM_FILE_START (asm_out_file);
2357 #ifdef ASM_COMMENT_START
2358 if (flag_verbose_asm)
2360 /* Print the list of options in effect. */
2361 print_version (asm_out_file, ASM_COMMENT_START);
2362 print_switch_values (asm_out_file, 0, MAX_LINE,
2363 ASM_COMMENT_START, " ", "\n");
2364 /* Add a blank line here so it appears in assembler output but not
2366 fprintf (asm_out_file, "\n");
2370 /* Output something to inform GDB that this compilation was by GCC. */
2371 #ifndef ASM_IDENTIFY_GCC
2372 fprintf (asm_out_file, "gcc2_compiled.:\n");
2374 ASM_IDENTIFY_GCC (asm_out_file);
2377 /* Output something to identify which front-end produced this file. */
2378 #ifdef ASM_IDENTIFY_LANGUAGE
2379 ASM_IDENTIFY_LANGUAGE (asm_out_file);
2381 } /* ! flag_syntax_only */
2383 #ifndef ASM_OUTPUT_SECTION_NAME
2384 if (flag_function_sections)
2386 warning ("-ffunction-sections not supported for this target.");
2387 flag_function_sections = 0;
2389 if (flag_data_sections)
2391 warning ("-fdata-sections not supported for this target.");
2392 flag_data_sections = 0;
2396 if (flag_function_sections
2397 && (profile_flag || profile_block_flag))
2399 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2400 flag_function_sections = 0;
2403 #ifndef OBJECT_FORMAT_ELF
2404 if (flag_function_sections && write_symbols != NO_DEBUG)
2405 warning ("-ffunction-sections may affect debugging on some targets.");
2408 /* ??? Note: There used to be a conditional here
2409 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2410 This was to guarantee separation between gcc_compiled. and
2411 the first function, for the sake of dbx on Suns.
2412 However, having the extra zero here confused the Emacs
2413 code for unexec, and might confuse other programs too.
2414 Therefore, I took out that change.
2415 In future versions we should find another way to solve
2416 that dbx problem. -- rms, 23 May 93. */
2418 /* Don't let the first function fall at the same address
2419 as gcc_compiled., if profiling. */
2420 if (profile_flag || profile_block_flag)
2422 /* It's best if we can write a nop here since some
2423 assemblers don't tolerate zeros in the text section. */
2424 output_asm_insn (get_insn_template (CODE_FOR_nop, NULL), NULL_PTR);
2427 /* If dbx symbol table desired, initialize writing it
2428 and output the predefined types. */
2429 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2430 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2431 TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
2434 #ifdef SDB_DEBUGGING_INFO
2435 if (write_symbols == SDB_DEBUG)
2436 TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
2439 #ifdef DWARF_DEBUGGING_INFO
2440 if (write_symbols == DWARF_DEBUG)
2441 TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
2443 #ifdef DWARF2_UNWIND_INFO
2444 if (dwarf2out_do_frame ())
2445 dwarf2out_frame_init ();
2447 #ifdef DWARF2_DEBUGGING_INFO
2448 if (write_symbols == DWARF2_DEBUG)
2449 TIMEVAR (symout_time, dwarf2out_init (asm_out_file, main_input_filename));
2452 /* Initialize yet another pass. */
2454 init_final (main_input_filename);
2455 init_branch_prob (dump_base_name);
2457 start_time = get_run_time ();
2459 /* Call the parser, which parses the entire file
2460 (calling rest_of_compilation for each function). */
2462 if (yyparse () != 0)
2464 if (errorcount == 0)
2465 fnotice (stderr, "Errors detected in input file (your bison.simple is out of date)\n");
2467 /* In case there were missing closebraces,
2468 get us back to the global binding level. */
2469 while (! global_bindings_p ())
2473 /* Compilation is now finished except for writing
2474 what's left of the symbol table output. */
2476 parse_time += get_run_time () - start_time;
2478 parse_time -= integration_time;
2479 parse_time -= varconst_time;
2481 if (flag_syntax_only)
2484 globals = getdecls ();
2486 /* Really define vars that have had only a tentative definition.
2487 Really output inline functions that must actually be callable
2488 and have not been output so far. */
2491 int len = list_length (globals);
2492 tree *vec = (tree *) xmalloc (sizeof (tree) * len);
2496 /* Process the decls in reverse order--earliest first.
2497 Put them into VEC from back to front, then take out from front. */
2499 for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
2500 vec[len - i - 1] = decl;
2502 wrapup_global_declarations (vec, len);
2504 /* This must occur after the loop to output deferred functions. Else
2505 the profiler initializer would not be emitted if all the functions
2506 in this compilation unit were deferred.
2508 output_func_start_profiler can not cause any additional functions or
2509 data to need to be output, so it need not be in the deferred function
2511 output_func_start_profiler ();
2513 /* Now that all possible functions have been output, we can dump
2514 the exception table. */
2516 output_exception_table ();
2518 check_global_declarations (vec, len);
2524 /* Write out any pending weak symbol declarations. */
2528 /* Do dbx symbols */
2529 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2530 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2531 TIMEVAR (symout_time,
2533 dbxout_finish (asm_out_file, main_input_filename);
2537 #ifdef DWARF_DEBUGGING_INFO
2538 if (write_symbols == DWARF_DEBUG)
2539 TIMEVAR (symout_time,
2545 #ifdef DWARF2_UNWIND_INFO
2546 if (dwarf2out_do_frame ())
2547 dwarf2out_frame_finish ();
2550 #ifdef DWARF2_DEBUGGING_INFO
2551 if (write_symbols == DWARF2_DEBUG)
2552 TIMEVAR (symout_time,
2554 dwarf2out_finish ();
2558 /* Output some stuff at end of file if nec. */
2560 end_final (dump_base_name);
2562 if (branch_prob_dump)
2563 open_dump_file (".07.bp", NULL);
2565 TIMEVAR (dump_time, end_branch_prob (rtl_dump_file));
2567 if (branch_prob_dump)
2568 close_dump_file (NULL, NULL_RTX);
2571 ASM_FILE_END (asm_out_file);
2575 /* Language-specific end of compilation actions. */
2579 /* Close the dump files. */
2581 if (flag_gen_aux_info)
2583 fclose (aux_info_file);
2585 unlink (aux_info_file_name);
2590 open_dump_file (".09.combine", NULL);
2591 TIMEVAR (dump_time, dump_combine_total_stats (rtl_dump_file));
2592 close_dump_file (NULL, NULL_RTX);
2595 /* Close non-debugging input and output files. Take special care to note
2596 whether fclose returns an error, since the pages might still be on the
2597 buffer chain while the file is open. */
2601 if (! flag_syntax_only
2602 && (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0))
2603 fatal_io_error (asm_file_name);
2605 /* Do whatever is necessary to finish printing the graphs. */
2606 if (graph_dump_format != no_graph)
2609 finish_graph_dump_file (dump_base_name, ".01.jump");
2611 finish_graph_dump_file (dump_base_name, ".02.cse");
2613 finish_graph_dump_file (dump_base_name, ".03.addressof");
2615 finish_graph_dump_file (dump_base_name, ".04.gcse");
2617 finish_graph_dump_file (dump_base_name, ".05.loop");
2619 finish_graph_dump_file (dump_base_name, ".06.cse2");
2620 if (branch_prob_dump)
2621 finish_graph_dump_file (dump_base_name, ".07.bp");
2623 finish_graph_dump_file (dump_base_name, ".08.flow");
2625 finish_graph_dump_file (dump_base_name, ".09.combine");
2627 finish_graph_dump_file (dump_base_name, ".10.regmove");
2628 #ifdef INSN_SCHEDULING
2630 finish_graph_dump_file (dump_base_name, ".11.sched");
2633 finish_graph_dump_file (dump_base_name, ".12.lreg");
2634 if (global_reg_dump)
2635 finish_graph_dump_file (dump_base_name, ".13.greg");
2637 finish_graph_dump_file (dump_base_name, ".14.flow2");
2638 #ifdef HAVE_peephole2
2640 finish_graph_dump_file (dump_base_name, ".15.peephole2");
2642 #ifdef INSN_SCHEDULING
2644 finish_graph_dump_file (dump_base_name, ".16.sched2");
2646 if (reorder_blocks_dump)
2647 finish_graph_dump_file (dump_base_name, ".bbro");
2649 finish_graph_dump_file (dump_base_name, ".17.jump2");
2650 #ifdef MACHINE_DEPENDENT_REORG
2651 if (mach_dep_reorg_dump)
2652 finish_graph_dump_file (dump_base_name, ".18.mach");
2656 finish_graph_dump_file (dump_base_name, ".19.dbr");
2660 finish_graph_dump_file (dump_base_name, ".20.stack");
2664 /* Free up memory for the benefit of leak detectors. */
2667 /* Print the times. */
2671 all_time = get_run_time ();
2673 fprintf (stderr,"\n");
2675 print_time ("parse", parse_time);
2676 print_time ("integration", integration_time);
2677 print_time ("jump", jump_time);
2678 print_time ("cse", cse_time);
2679 print_time ("gcse", gcse_time);
2680 print_time ("loop", loop_time);
2681 print_time ("cse2", cse2_time);
2682 print_time ("branch-prob", branch_prob_time);
2683 print_time ("flow", flow_time);
2684 print_time ("combine", combine_time);
2685 print_time ("regmove", regmove_time);
2686 #ifdef INSN_SCHEDULING
2687 print_time ("sched", sched_time);
2689 print_time ("local-alloc", local_alloc_time);
2690 print_time ("global-alloc", global_alloc_time);
2691 print_time ("flow2", flow2_time);
2692 #ifdef HAVE_peephole2
2693 print_time ("peephole2", peephole2_time);
2695 #ifdef INSN_SCHEDULING
2696 print_time ("sched2", sched2_time);
2699 print_time ("dbranch", dbr_sched_time);
2701 print_time ("bbro", reorder_blocks_time);
2702 print_time ("shorten-branch", shorten_branch_time);
2704 print_time ("stack-reg", stack_reg_time);
2706 print_time ("final", final_time);
2707 print_time ("varconst", varconst_time);
2708 print_time ("symout", symout_time);
2709 print_time ("dump", dump_time);
2711 print_time ("gc", gc_time);
2715 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2716 and TYPE_DECL nodes.
2718 This does nothing for local (non-static) variables, unless the
2719 variable is a register variable with an ASMSPEC. In that case, or
2720 if the variable is not an automatice, it sets up the RTL and
2721 outputs any assembler code (label definition, storage allocation
2722 and initialization).
2724 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2725 the assembler symbol name to be used. TOP_LEVEL is nonzero
2726 if this declaration is not within a function. */
2729 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2731 const char *asmspec;
2735 /* Declarations of variables, and of functions defined elsewhere. */
2737 /* The most obvious approach, to put an #ifndef around where
2738 this macro is used, doesn't work since it's inside a macro call. */
2739 #ifndef ASM_FINISH_DECLARE_OBJECT
2740 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2743 /* Forward declarations for nested functions are not "external",
2744 but we need to treat them as if they were. */
2745 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2746 || TREE_CODE (decl) == FUNCTION_DECL)
2747 TIMEVAR (varconst_time,
2749 make_decl_rtl (decl, asmspec, top_level);
2750 /* Initialized extern variable exists to be replaced
2751 with its value, or represents something that will be
2752 output in another file. */
2753 if (! (TREE_CODE (decl) == VAR_DECL
2754 && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
2755 && DECL_INITIAL (decl) != 0
2756 && DECL_INITIAL (decl) != error_mark_node))
2757 /* Don't output anything
2758 when a tentative file-scope definition is seen.
2759 But at end of compilation, do output code for them. */
2760 if (! (! at_end && top_level
2761 && (DECL_INITIAL (decl) == 0
2762 || DECL_INITIAL (decl) == error_mark_node)))
2763 assemble_variable (decl, top_level, at_end, 0);
2764 if (decl == last_assemble_variable_decl)
2766 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2770 else if (DECL_REGISTER (decl) && asmspec != 0)
2772 if (decode_reg_name (asmspec) >= 0)
2774 DECL_RTL (decl) = 0;
2775 make_decl_rtl (decl, asmspec, top_level);
2778 error ("invalid register name `%s' for register variable", asmspec);
2780 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2781 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2782 && TREE_CODE (decl) == TYPE_DECL)
2783 TIMEVAR (symout_time, dbxout_symbol (decl, 0));
2785 #ifdef SDB_DEBUGGING_INFO
2786 else if (write_symbols == SDB_DEBUG && top_level
2787 && TREE_CODE (decl) == TYPE_DECL)
2788 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
2792 /* Called after finishing a record, union or enumeral type. */
2795 rest_of_type_compilation (type, toplev)
2796 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
2800 tree type ATTRIBUTE_UNUSED;
2801 int toplev ATTRIBUTE_UNUSED;
2804 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2805 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2806 TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
2808 #ifdef SDB_DEBUGGING_INFO
2809 if (write_symbols == SDB_DEBUG)
2810 TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
2814 /* DECL is an inline function, whose body is present, but which is not
2815 being output at this point. (We're putting that off until we need
2816 to do it.) If there are any actions that need to take place,
2817 including the emission of debugging information for the function,
2818 this is where they should go. This function may be called by
2819 language-dependent code for front-ends that do not even generate
2820 RTL for functions that don't need to be put out. */
2823 note_deferral_of_defined_inline_function (decl)
2824 tree decl ATTRIBUTE_UNUSED;
2826 #ifdef DWARF_DEBUGGING_INFO
2827 /* Generate the DWARF info for the "abstract" instance of a function
2828 which we may later generate inlined and/or out-of-line instances
2830 if (write_symbols == DWARF_DEBUG)
2832 /* The front-end may not have set CURRENT_FUNCTION_DECL, but the
2833 DWARF code expects it to be set in this case. Intuitively,
2834 DECL is the function we just finished defining, so setting
2835 CURRENT_FUNCTION_DECL is sensible. */
2836 tree saved_cfd = current_function_decl;
2837 current_function_decl = decl;
2839 /* Let the DWARF code do its work. */
2840 set_decl_abstract_flags (decl, 1);
2841 dwarfout_file_scope_decl (decl, 0);
2842 set_decl_abstract_flags (decl, 0);
2844 /* Reset CURRENT_FUNCTION_DECL. */
2845 current_function_decl = saved_cfd;
2850 /* This is called from finish_function (within yyparse)
2851 after each top-level definition is parsed.
2852 It is supposed to compile that function or variable
2853 and output the assembler code for it.
2854 After we return, the tree storage is freed. */
2857 rest_of_compilation (decl)
2861 int start_time = get_run_time ();
2864 int rebuild_label_notes_after_reload;
2866 /* When processing delayed functions, prepare_function_start() won't
2867 have been run to re-initialize it. */
2868 cse_not_expected = ! optimize;
2870 /* First, make sure that NOTE_BLOCK is set correctly for each
2871 NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
2872 if (!cfun->x_whole_function_mode_p)
2875 /* Then remove any notes we don't need. That will make iterating
2876 over the instruction sequence faster, and allow the garbage
2877 collector to reclaim the memory used by the notes. */
2878 remove_unncessary_notes ();
2880 /* In function-at-a-time mode, we do not attempt to keep the BLOCK
2881 tree in sensible shape. So, we just recalculate it here. */
2882 if (cfun->x_whole_function_mode_p)
2885 /* If we are reconsidering an inline function
2886 at the end of compilation, skip the stuff for making it inline. */
2888 if (DECL_SAVED_INSNS (decl) == 0)
2894 /* If this is nested inside an inlined external function, pretend
2895 it was only declared. Since we cannot inline such functions,
2896 generating code for this one is not only not necessary but will
2897 confuse some debugging output writers. */
2898 for (parent = DECL_CONTEXT (current_function_decl);
2899 parent != NULL_TREE;
2900 parent = get_containing_scope (parent))
2901 if (TREE_CODE (parent) == FUNCTION_DECL
2902 && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
2904 DECL_INITIAL (decl) = 0;
2905 goto exit_rest_of_compilation;
2908 /* If requested, consider whether to make this function inline. */
2909 if (DECL_INLINE (decl) || flag_inline_functions)
2910 TIMEVAR (integration_time,
2912 lose = function_cannot_inline_p (decl);
2913 if (lose || ! optimize)
2915 if (warn_inline && DECL_INLINE (decl))
2916 warning_with_decl (decl, lose);
2917 DECL_ABSTRACT_ORIGIN (decl) = 0;
2918 /* Don't really compile an extern inline function.
2919 If we can't make it inline, pretend
2920 it was only declared. */
2921 if (DECL_EXTERNAL (decl))
2923 DECL_INITIAL (decl) = 0;
2924 goto exit_rest_of_compilation;
2928 /* ??? Note that this has the effect of making it look
2929 like "inline" was specified for a function if we choose
2930 to inline it. This isn't quite right, but it's
2931 probably not worth the trouble to fix. */
2932 inlinable = DECL_INLINE (decl) = 1;
2935 insns = get_insns ();
2937 /* Dump the rtl code if we are dumping rtl. */
2941 open_dump_file (".00.rtl", decl_printable_name (decl, 2));
2943 if (DECL_SAVED_INSNS (decl))
2944 fprintf (rtl_dump_file, ";; (integrable)\n\n");
2946 close_dump_file (print_rtl, insns);
2949 /* If function is inline, and we don't yet know whether to
2950 compile it by itself, defer decision till end of compilation.
2951 finish_compilation will call rest_of_compilation again
2952 for those functions that need to be output. Also defer those
2953 functions that we are supposed to defer. */
2956 || (DECL_INLINE (decl)
2957 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2958 && ! flag_keep_inline_functions)
2959 || DECL_EXTERNAL (decl))))
2960 DECL_DEFER_OUTPUT (decl) = 1;
2962 if (DECL_DEFER_OUTPUT (decl))
2964 /* If -Wreturn-type, we have to do a bit of compilation.
2965 However, if we just fall through we will call
2966 save_for_inline_copying() which results in excessive
2967 memory use. Instead, we just want to call
2968 jump_optimize() to figure out whether or not we can fall
2969 off the end of the function; we do the minimum amount of
2970 work necessary to make that safe. And, we set optimize
2971 to zero to keep jump_optimize from working too hard. */
2972 if (warn_return_type)
2974 int saved_optimize = optimize;
2976 find_exception_handler_labels ();
2977 jump_optimize (get_insns(), !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2978 !JUMP_AFTER_REGSCAN);
2979 optimize = saved_optimize;
2982 current_function_nothrow = nothrow_function_p ();
2983 if (current_function_nothrow)
2984 /* Now we know that this can't throw; set the flag for the benefit
2985 of other functions later in this translation unit. */
2986 TREE_NOTHROW (current_function_decl) = 1;
2988 note_deferral_of_defined_inline_function (decl);
2989 TIMEVAR (integration_time, save_for_inline_nocopy (decl));
2990 DECL_SAVED_INSNS (decl)->inlinable = inlinable;
2991 goto exit_rest_of_compilation;
2994 /* If specified extern inline but we aren't inlining it, we are
2995 done. This goes for anything that gets here with DECL_EXTERNAL
2996 set, not just things with DECL_INLINE. */
2997 if (DECL_EXTERNAL (decl))
2998 goto exit_rest_of_compilation;
3001 /* We may have potential sibling or tail recursion sites. Select one
3002 (of possibly multiple) methods of performing the call. */
3003 init_EXPR_INSN_LIST_cache ();
3004 if (flag_optimize_sibling_calls)
3005 optimize_sibling_and_tail_recursive_calls ();
3010 /* Initialize some variables used by the optimizers. */
3011 init_function_for_compilation ();
3013 if (! DECL_DEFER_OUTPUT (decl))
3014 TREE_ASM_WRITTEN (decl) = 1;
3016 /* Now that integrate will no longer see our rtl, we need not distinguish
3017 between the return value of this function and the return value of called
3019 rtx_equal_function_value_matters = 0;
3021 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
3022 if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
3024 goto exit_rest_of_compilation;
3027 /* Emit code to get eh context, if needed. */
3031 /* If we are doing position-independent code generation, now
3032 is the time to output special prologues and epilogues.
3033 We do not want to do this earlier, because it just clutters
3034 up inline functions with meaningless insns. */
3039 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
3040 Note that that may have been done above, in save_for_inline_copying.
3041 The call to resume_temporary_allocation near the end of this function
3042 goes back to the usual state of affairs. This must be done after
3043 we've built up any unwinders for exception handling, and done
3044 the FINALIZE_PIC work, if necessary. */
3046 rtl_in_current_obstack ();
3048 insns = get_insns ();
3050 /* Copy any shared structure that should not be shared. */
3052 unshare_all_rtl (current_function_decl, insns);
3054 #ifdef SETJMP_VIA_SAVE_AREA
3055 /* This must be performed before virutal register instantiation. */
3056 if (current_function_calls_alloca)
3057 optimize_save_area_alloca (insns);
3060 /* Instantiate all virtual registers. */
3062 instantiate_virtual_regs (current_function_decl, get_insns ());
3064 /* See if we have allocated stack slots that are not directly addressable.
3065 If so, scan all the insns and create explicit address computation
3066 for all references to such slots. */
3067 /* fixup_stack_slots (); */
3069 /* Find all the EH handlers. */
3070 find_exception_handler_labels ();
3073 open_dump_file (".01.jump", decl_printable_name (decl, 2));
3075 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
3076 are initialized and to compute whether control can drop off the end
3078 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3079 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
3080 JUMP_AFTER_REGSCAN));
3082 /* Jump optimization, and the removal of NULL pointer checks, may
3083 have reduced the number of instructions substantially. CSE, and
3084 future passes, allocate arrays whose dimensions involve the maximum
3085 instruction UID, so if we can reduce the maximum UID we'll save big on
3087 renumber_insns (rtl_dump_file);
3089 /* Dump rtl code after jump, if we are doing that. */
3091 close_dump_file (print_rtl, insns);
3093 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
3094 if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
3095 goto exit_rest_of_compilation;
3097 /* Try to identify useless null pointer tests and delete them. */
3098 if (flag_delete_null_pointer_checks)
3099 TIMEVAR (jump_time, delete_null_pointer_checks (get_insns ()));
3104 /* Perform common subexpression elimination.
3105 Nonzero value from `cse_main' means that jumps were simplified
3106 and some code may now be unreachable, so do
3107 jump optimization again. */
3112 open_dump_file (".02.cse", decl_printable_name (decl, 2));
3114 TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
3116 if (flag_thread_jumps)
3117 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 1));
3119 TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
3121 /* If we are not running the second CSE pass, then we are no longer
3122 expecting CSE to be run. */
3123 cse_not_expected = !flag_rerun_cse_after_loop;
3125 if (tem || optimize > 1)
3126 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3128 !JUMP_AFTER_REGSCAN));
3130 /* Run this after jump optmizations remove all the unreachable code
3131 so that unreachable code will not keep values live. */
3132 TIMEVAR (cse_time, delete_trivially_dead_insns (insns, max_reg_num ()));
3134 /* Try to identify useless null pointer tests and delete them. */
3135 if (flag_delete_null_pointer_checks)
3136 TIMEVAR (jump_time, delete_null_pointer_checks (get_insns ()));
3138 /* The second pass of jump optimization is likely to have
3139 removed a bunch more instructions. */
3140 renumber_insns (rtl_dump_file);
3142 /* Dump rtl code after cse, if we are doing that. */
3145 close_dump_file (print_rtl, insns);
3146 if (graph_dump_format != no_graph)
3147 print_rtl_graph_with_bb (dump_base_name, ".02.cse", insns);
3151 purge_addressof (insns);
3152 reg_scan (insns, max_reg_num (), 1);
3156 dump_rtl (".03.addressof", decl, print_rtl, insns);
3157 if (graph_dump_format != no_graph)
3158 print_rtl_graph_with_bb (dump_base_name, ".03.addressof", insns);
3167 open_dump_file (".033.ssa", decl_printable_name (decl, 2));
3170 close_dump_file (print_rtl_with_bb, insns);
3173 open_dump_file (".037.ussa", decl_printable_name (decl, 2));
3174 convert_from_ssa ();
3175 /* New registers have been created. Rescan their usage. */
3176 reg_scan (insns, max_reg_num (), 1);
3178 close_dump_file (print_rtl_with_bb, insns);
3180 /* Life analysis used in SSA adds log_links but these shouldn't
3181 be there until the flow stage, so clear them away. */
3182 clear_log_links (insns);
3188 /* Perform global cse. */
3190 if (optimize > 0 && flag_gcse)
3193 open_dump_file (".04.gcse", decl_printable_name (decl, 2));
3195 TIMEVAR (gcse_time, tem = gcse_main (insns, rtl_dump_file));
3197 /* If gcse altered any jumps, rerun jump optimizations to clean
3201 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3203 !JUMP_AFTER_REGSCAN));
3208 close_dump_file (print_rtl, insns);
3209 if (graph_dump_format != no_graph)
3210 print_rtl_graph_with_bb (dump_base_name, ".04.gcse", insns);
3216 /* Move constant computations out of loops. */
3221 open_dump_file (".05.loop", decl_printable_name (decl, 2));
3226 if (flag_rerun_loop_opt)
3228 /* We only want to perform unrolling once. */
3230 loop_optimize (insns, rtl_dump_file, 0, 0);
3233 /* The first call to loop_optimize makes some instructions
3234 trivially dead. We delete those instructions now in the
3235 hope that doing so will make the heuristics in loop work
3236 better and possibly speed up compilation. */
3237 delete_trivially_dead_insns (insns, max_reg_num ());
3239 /* The regscan pass is currently necessary as the alias
3240 analysis code depends on this information. */
3241 reg_scan (insns, max_reg_num (), 1);
3243 loop_optimize (insns, rtl_dump_file, flag_unroll_loops, 1);
3246 /* Dump rtl code after loop opt, if we are doing that. */
3250 close_dump_file (print_rtl, insns);
3251 if (graph_dump_format != no_graph)
3252 print_rtl_graph_with_bb (dump_base_name, ".05.loop", insns);
3259 /* ??? Well, nearly. If HAVE_conditional_arithmetic, jump_optimize
3260 has put off all if-conversion until "after CSE". If we put this
3261 off any longer we may miss out doing if-conversion entirely. */
3262 cse_not_expected = 1;
3267 open_dump_file (".06.cse2", decl_printable_name (decl, 2));
3269 if (flag_rerun_cse_after_loop)
3271 /* Running another jump optimization pass before the second
3272 cse pass sometimes simplifies the RTL enough to allow
3273 the second CSE pass to do a better job. Jump_optimize can change
3274 max_reg_num so we must rerun reg_scan afterwards.
3275 ??? Rework to not call reg_scan so often. */
3276 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3277 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3279 JUMP_AFTER_REGSCAN));
3281 TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
3282 TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
3285 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3287 !JUMP_AFTER_REGSCAN));
3290 if (flag_thread_jumps)
3292 /* This pass of jump threading straightens out code
3293 that was kinked by loop optimization. */
3294 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3295 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
3298 /* Dump rtl code after cse, if we are doing that. */
3301 close_dump_file (print_rtl, insns);
3302 if (graph_dump_format != no_graph)
3303 print_rtl_graph_with_bb (dump_base_name, ".06.cse2", insns);
3310 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
3312 if (branch_prob_dump)
3313 open_dump_file (".07.bp", decl_printable_name (decl, 2));
3318 branch_prob (insns, rtl_dump_file);
3321 if (branch_prob_dump)
3323 close_dump_file (print_rtl, insns);
3324 if (graph_dump_format != no_graph)
3325 print_rtl_graph_with_bb (dump_base_name, ".07.bp", insns);
3334 /* Print function header into flow dump now
3335 because doing the flow analysis makes some of the dump. */
3338 open_dump_file (".08.flow", decl_printable_name (decl, 2));
3340 /* Do control and data flow analysis; wrote some of the results to
3346 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3347 cleanup_cfg (insns);
3349 calculate_loop_depth (rtl_dump_file);
3350 life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
3351 mark_constant_function ();
3354 if (warn_uninitialized || extra_warnings)
3356 uninitialized_vars_warning (DECL_INITIAL (decl));
3358 setjmp_args_warning ();
3361 /* Dump rtl after flow analysis. */
3365 close_dump_file (print_rtl_with_bb, insns);
3366 if (graph_dump_format != no_graph)
3367 print_rtl_graph_with_bb (dump_base_name, ".08.flow", insns);
3373 /* The first life analysis pass has finished. From now on we can not
3374 generate any new pseudos. */
3377 /* If -opt, try combining insns through substitution. */
3381 int rebuild_jump_labels_after_combine = 0;
3383 TIMEVAR (combine_time,
3385 rebuild_jump_labels_after_combine
3386 = combine_instructions (insns, max_reg_num ());
3389 /* Combining insns may have turned an indirect jump into a
3390 direct jump. Rebuid the JUMP_LABEL fields of jumping
3392 if (rebuild_jump_labels_after_combine)
3394 TIMEVAR (jump_time, rebuild_jump_labels (insns));
3397 /* Dump rtl code after insn combination. */
3401 dump_rtl (".09.combine", decl, print_rtl_with_bb, insns);
3402 if (graph_dump_format != no_graph)
3403 print_rtl_graph_with_bb (dump_base_name, ".09.combine", insns);
3410 /* Register allocation pre-pass, to reduce number of moves
3411 necessary for two-address machines. */
3412 if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
3415 open_dump_file (".10.regmove", decl_printable_name (decl, 2));
3417 TIMEVAR (regmove_time, regmove_optimize (insns, max_reg_num (),
3422 close_dump_file (print_rtl_with_bb, insns);
3423 if (graph_dump_format != no_graph)
3424 print_rtl_graph_with_bb (dump_base_name, ".10.regmove", insns);
3431 if (optimize && n_basic_blocks)
3433 TIMEVAR (gcse_time, optimize_mode_switching (NULL_PTR));
3436 #ifdef INSN_SCHEDULING
3438 /* Print function header into sched dump now
3439 because doing the sched analysis makes some of the dump. */
3440 if (optimize > 0 && flag_schedule_insns)
3443 open_dump_file (".11.sched", decl_printable_name (decl, 2));
3445 /* Do control and data sched analysis,
3446 and write some of the results to dump file. */
3448 TIMEVAR (sched_time, schedule_insns (rtl_dump_file));
3450 /* Dump rtl after instruction scheduling. */
3454 close_dump_file (print_rtl_with_bb, insns);
3455 if (graph_dump_format != no_graph)
3456 print_rtl_graph_with_bb (dump_base_name, ".11.sched", insns);
3464 /* Determine if the current function is a leaf before running reload
3465 since this can impact optimizations done by the prologue and
3466 epilogue thus changing register elimination offsets. */
3467 current_function_is_leaf = leaf_function_p ();
3470 open_dump_file (".12.lreg", decl_printable_name (decl, 2));
3472 /* Allocate pseudo-regs that are used only within 1 basic block.
3474 RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
3475 jump optimizer after register allocation and reloading are finished. */
3477 TIMEVAR (local_alloc_time,
3479 /* We recomputed reg usage as part of updating the rest
3480 of life info during sched. */
3481 if (! flag_schedule_insns)
3482 recompute_reg_usage (insns, ! optimize_size);
3483 regclass (insns, max_reg_num (), rtl_dump_file);
3484 rebuild_label_notes_after_reload = local_alloc ();
3487 /* Dump rtl code after allocating regs within basic blocks. */
3491 TIMEVAR (dump_time, dump_flow_info (rtl_dump_file));
3492 TIMEVAR (dump_time, dump_local_alloc (rtl_dump_file));
3494 close_dump_file (print_rtl_with_bb, insns);
3495 if (graph_dump_format != no_graph)
3496 print_rtl_graph_with_bb (dump_base_name, ".12.lreg", insns);
3502 if (global_reg_dump)
3503 open_dump_file (".13.greg", decl_printable_name (decl, 2));
3505 /* If optimizing, allocate remaining pseudo-regs. Do the reload
3506 pass fixing up any insns that are invalid. */
3508 TIMEVAR (global_alloc_time,
3511 failure = global_alloc (rtl_dump_file);
3514 build_insn_chain (insns);
3515 failure = reload (insns, 0, rtl_dump_file);
3520 goto exit_rest_of_compilation;
3525 /* Do a very simple CSE pass over just the hard registers. */
3527 reload_cse_regs (insns);
3529 /* If optimizing and we are performing instruction scheduling after
3530 reload, then go ahead and split insns now since we are about to
3531 recompute flow information anyway.
3533 reload_cse_regs may expose more splitting opportunities, expecially
3534 for double-word operations. */
3535 if (optimize > 0 && flag_schedule_insns_after_reload)
3536 split_all_insns (0);
3538 /* Register allocation and reloading may have turned an indirect jump into
3539 a direct jump. If so, we must rebuild the JUMP_LABEL fields of
3540 jumping instructions. */
3541 if (rebuild_label_notes_after_reload)
3542 TIMEVAR (jump_time, rebuild_jump_labels (insns));
3544 if (global_reg_dump)
3546 TIMEVAR (dump_time, dump_global_regs (rtl_dump_file));
3547 close_dump_file (print_rtl_with_bb, insns);
3548 if (graph_dump_format != no_graph)
3549 print_rtl_graph_with_bb (dump_base_name, ".13.greg", insns);
3552 /* Re-create the death notes which were deleted during reload. */
3554 open_dump_file (".14.flow2", decl_printable_name (decl, 2));
3556 TIMEVAR (flow2_time,
3558 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3561 /* On some machines, the prologue and epilogue code, or parts thereof,
3562 can be represented as RTL. Doing so lets us schedule insns between
3563 it and the rest of the code and also allows delayed branch
3564 scheduling to operate in the epilogue. */
3565 thread_prologue_and_epilogue_insns (insns);
3569 TIMEVAR (flow2_time,
3571 cleanup_cfg (insns);
3572 life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
3575 /* This is kind of heruistics. We need to run combine_stack_adjustments
3576 even for machines with possibly nonzero RETURN_POPS_ARGS
3577 and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having
3578 push instructions will have popping returns. */
3579 #ifndef PUSH_ROUNDING
3580 if (!ACCUMULATE_OUTGOING_ARGS)
3582 TIMEVAR (flow2_time, { combine_stack_adjustments (); });
3588 flow2_completed = 1;
3592 close_dump_file (print_rtl_with_bb, insns);
3593 if (graph_dump_format != no_graph)
3594 print_rtl_graph_with_bb (dump_base_name, ".14.flow2", insns);
3597 #ifdef HAVE_peephole2
3598 if (optimize > 0 && flag_peephole2)
3601 open_dump_file (".15.peephole2", decl_printable_name (decl, 2));
3603 TIMEVAR (peephole2_time, peephole2_optimize (rtl_dump_file));
3607 close_dump_file (print_rtl_with_bb, insns);
3608 if (graph_dump_format != no_graph)
3609 print_rtl_graph_with_bb (dump_base_name, ".15.peephole2", insns);
3614 #ifdef INSN_SCHEDULING
3615 if (optimize > 0 && flag_schedule_insns_after_reload)
3618 open_dump_file (".16.sched2", decl_printable_name (decl, 2));
3620 /* Do control and data sched analysis again,
3621 and write some more of the results to dump file. */
3623 TIMEVAR (sched2_time, schedule_insns (rtl_dump_file));
3625 /* Dump rtl after post-reorder instruction scheduling. */
3629 close_dump_file (print_rtl_with_bb, insns);
3630 if (graph_dump_format != no_graph)
3631 print_rtl_graph_with_bb (dump_base_name, ".16.sched2", insns);
3639 #ifdef LEAF_REGISTERS
3640 current_function_uses_only_leaf_regs
3641 = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
3644 if (optimize > 0 && flag_reorder_blocks)
3646 if (reorder_blocks_dump)
3647 open_dump_file (".bbro", decl_printable_name (decl, 2));
3649 TIMEVAR (reorder_blocks_time, reorder_basic_blocks ());
3651 if (reorder_blocks_dump)
3653 close_dump_file (print_rtl_with_bb, insns);
3654 if (graph_dump_format != no_graph)
3655 print_rtl_graph_with_bb (dump_base_name, ".bbro", insns);
3659 /* One more attempt to remove jumps to .+1 left by dead-store elimination.
3660 Also do cross-jumping this time and delete no-op move insns. */
3664 TIMEVAR (jump_time, jump_optimize (insns, JUMP_CROSS_JUMP,
3666 !JUMP_AFTER_REGSCAN));
3668 /* Dump rtl code after jump, if we are doing that. */
3672 dump_rtl (".17.jump2", decl, print_rtl_with_bb, insns);
3673 if (graph_dump_format != no_graph)
3674 print_rtl_graph_with_bb (dump_base_name, ".17.jump2", insns);
3678 /* If a machine dependent reorganization is needed, call it. */
3679 #ifdef MACHINE_DEPENDENT_REORG
3680 if (mach_dep_reorg_dump)
3681 open_dump_file (".18.mach", decl_printable_name (decl, 2));
3683 MACHINE_DEPENDENT_REORG (insns);
3685 if (mach_dep_reorg_dump)
3687 close_dump_file (print_rtl_with_bb, insns);
3688 if (graph_dump_format != no_graph)
3689 print_rtl_graph_with_bb (dump_base_name, ".18.mach", insns);
3696 /* If a scheduling pass for delayed branches is to be done,
3697 call the scheduling code. */
3700 if (optimize > 0 && flag_delayed_branch)
3703 open_dump_file (".19.dbr", decl_printable_name (decl, 2));
3708 dbr_schedule (insns, rtl_dump_file);
3713 close_dump_file (print_rtl_with_bb, insns);
3714 if (graph_dump_format != no_graph)
3715 print_rtl_graph_with_bb (dump_base_name, ".19.dbr", insns);
3723 /* Shorten branches.
3725 Note this must run before reg-stack because of death note (ab)use
3726 in the ia32 backend. */
3727 TIMEVAR (shorten_branch_time,
3729 shorten_branches (get_insns ());
3734 open_dump_file (".20.stack", decl_printable_name (decl, 2));
3736 TIMEVAR (stack_reg_time, reg_to_stack (insns, rtl_dump_file));
3740 close_dump_file (print_rtl_with_bb, insns);
3741 if (graph_dump_format != no_graph)
3742 print_rtl_graph_with_bb (dump_base_name, ".20.stack", insns);
3749 current_function_nothrow = nothrow_function_p ();
3750 if (current_function_nothrow)
3751 /* Now we know that this can't throw; set the flag for the benefit
3752 of other functions later in this translation unit. */
3753 TREE_NOTHROW (current_function_decl) = 1;
3755 /* Now turn the rtl into assembler code. */
3757 TIMEVAR (final_time,
3762 /* Get the function's name, as described by its RTL.
3763 This may be different from the DECL_NAME name used
3764 in the source file. */
3766 x = DECL_RTL (decl);
3767 if (GET_CODE (x) != MEM)
3770 if (GET_CODE (x) != SYMBOL_REF)
3772 fnname = XSTR (x, 0);
3774 assemble_start_function (decl, fnname);
3775 final_start_function (insns, asm_out_file, optimize);
3776 final (insns, asm_out_file, optimize, 0);
3777 final_end_function (insns, asm_out_file, optimize);
3778 assemble_end_function (decl, fnname);
3780 fflush (asm_out_file);
3782 /* Release all memory allocated by flow. */
3783 free_basic_block_vars (0);
3785 /* Release all memory held by regsets now */
3786 regset_release_memory ();
3792 /* Write DBX symbols if requested */
3794 /* Note that for those inline functions where we don't initially
3795 know for certain that we will be generating an out-of-line copy,
3796 the first invocation of this routine (rest_of_compilation) will
3797 skip over this code by doing a `goto exit_rest_of_compilation;'.
3798 Later on, finish_compilation will call rest_of_compilation again
3799 for those inline functions that need to have out-of-line copies
3800 generated. During that call, we *will* be routed past here. */
3802 #ifdef DBX_DEBUGGING_INFO
3803 if (write_symbols == DBX_DEBUG)
3804 TIMEVAR (symout_time, dbxout_function (decl));
3807 #ifdef DWARF_DEBUGGING_INFO
3808 if (write_symbols == DWARF_DEBUG)
3809 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
3812 #ifdef DWARF2_DEBUGGING_INFO
3813 if (write_symbols == DWARF2_DEBUG)
3814 TIMEVAR (symout_time, dwarf2out_decl (decl));
3817 exit_rest_of_compilation:
3819 /* In case the function was not output,
3820 don't leave any temporary anonymous types
3821 queued up for sdb output. */
3822 #ifdef SDB_DEBUGGING_INFO
3823 if (write_symbols == SDB_DEBUG)
3824 sdbout_types (NULL_TREE);
3827 reload_completed = 0;
3828 flow2_completed = 0;
3831 TIMEVAR (final_time,
3833 /* Clear out the insn_length contents now that they are no
3835 init_insn_lengths ();
3837 /* Clear out the real_constant_chain before some of the rtx's
3838 it runs through become garbage. */
3839 clear_const_double_mem ();
3841 /* Cancel the effect of rtl_in_current_obstack. */
3842 resume_temporary_allocation ();
3844 /* Show no temporary slots allocated. */
3847 free_basic_block_vars (0);
3850 /* Make sure volatile mem refs aren't considered valid operands for
3851 arithmetic insns. We must call this here if this is a nested inline
3852 function, since the above code leaves us in the init_recog state
3853 (from final.c), and the function context push/pop code does not
3854 save/restore volatile_ok.
3856 ??? Maybe it isn't necessary for expand_start_function to call this
3857 anymore if we do it here? */
3859 init_recog_no_volatile ();
3861 /* We're done with this function. Free up memory if we can. */
3862 free_after_parsing (cfun);
3863 if (! DECL_DEFER_OUTPUT (decl))
3864 free_after_compilation (cfun);
3870 /* The parsing time is all the time spent in yyparse
3871 *except* what is spent in this function. */
3873 parse_time -= get_run_time () - start_time;
3884 printf ("Usage: %s input [switches]\n", progname);
3885 printf ("Switches:\n");
3887 printf (" -ffixed-<register> Mark <register> as being unavailable to the compiler\n");
3888 printf (" -fcall-used-<register> Mark <register> as being corrupted by function calls\n");
3889 printf (" -fcall-saved-<register> Mark <register> as being preserved across functions\n");
3890 printf (" -finline-limit=<number> Limits the size of inlined functions to <number>\n");
3892 for (i = NUM_ELEM (f_options); i--;)
3894 const char * description = f_options[i].description;
3896 if (description != NULL && * description != 0)
3897 printf (" -f%-21s %s\n",
3898 f_options[i].string, description);
3901 printf (" -O[number] Set optimisation level to [number]\n");
3902 printf (" -Os Optimise for space rather than speed\n");
3903 printf (" -pedantic Issue warnings needed by strict compliance to ANSI C\n");
3904 printf (" -pedantic-errors Like -pedantic except that errors are produced\n");
3905 printf (" -w Suppress warnings\n");
3906 printf (" -W Enable extra warnings\n");
3908 for (i = NUM_ELEM (W_options); i--;)
3910 const char * description = W_options[i].description;
3912 if (description != NULL && * description != 0)
3913 printf (" -W%-21s %s\n",
3914 W_options[i].string, description);
3917 printf (" -Wid-clash-<num> Warn if 2 identifiers have the same first <num> chars\n");
3918 printf (" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n");
3919 printf (" -p Enable function profiling\n");
3920 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER)
3921 printf (" -a Enable block profiling \n");
3923 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER) || defined FUNCTION_BLOCK_PROFILER_EXIT
3924 printf (" -ax Enable jump profiling \n");
3926 printf (" -o <file> Place output into <file> \n");
3927 printf (" -G <number> Put global and static data smaller than <number>\n");
3928 printf (" bytes into a special section (on some targets)\n");
3930 for (i = NUM_ELEM (debug_args); i--;)
3932 if (debug_args[i].description != NULL)
3933 printf (" -g%-21s %s\n", debug_args[i].arg, debug_args[i].description);
3936 printf (" -aux-info <file> Emit declaration info into <file>.X\n");
3937 printf (" -quiet Do not display functions compiled or elapsed time\n");
3938 printf (" -version Display the compiler's version\n");
3939 printf (" -d[letters] Enable dumps from specific passes of the compiler\n");
3940 printf (" -dumpbase <file> Base name to be used for dumps from specific passes\n");
3941 #if defined INSN_SCHEDULING
3942 printf (" -sched-verbose=<number> Set the verbosity level of the scheduler\n");
3944 printf (" --help Display this information\n");
3949 /* Display descriptions of language specific options.
3950 If there is no description, note that there is an undocumented option.
3951 If the description is empty, do not display anything. (This allows
3952 options to be deliberately undocumented, for whatever reason).
3953 If the option string is missing, then this is a marker, indicating
3954 that the description string is in fact the name of a language, whose
3955 language specific options are to follow. */
3957 if (NUM_ELEM (documented_lang_options) > 1)
3959 printf ("\nLanguage specific options:\n");
3961 for (i = 0; i < NUM_ELEM (documented_lang_options); i++)
3963 const char * description = documented_lang_options[i].description;
3964 const char * option = documented_lang_options[i].option;
3966 if (description == NULL)
3971 printf (" %-23.23s [undocumented]\n", option);
3973 else if (* description == 0)
3975 else if (option == NULL)
3979 ("\nThere are undocumented %s specific options as well.\n",
3983 printf ("\n Options for %s:\n", description);
3988 printf (" %-23.23s %s\n", option, description);
3993 printf ("\nThere are undocumented %s specific options as well.\n", lang);
3995 if (NUM_ELEM (target_switches) > 1
3996 #ifdef TARGET_OPTIONS
3997 || NUM_ELEM (target_options) > 1
4005 printf ("\nTarget specific options:\n");
4007 for (i = NUM_ELEM (target_switches); i--;)
4009 const char * option = target_switches[i].name;
4010 const char * description = target_switches[i].description;
4012 if (option == NULL || * option == 0)
4014 else if (description == NULL)
4019 printf (" -m%-21.21s [undocumented]\n", option);
4021 else if (* description != 0)
4022 doc += printf (" -m%-21.21s %s\n", option, description);
4025 #ifdef TARGET_OPTIONS
4026 for (i = NUM_ELEM (target_options); i--;)
4028 const char * option = target_options[i].prefix;
4029 const char * description = target_options[i].description;
4031 if (option == NULL || * option == 0)
4033 else if (description == NULL)
4038 printf (" -m%-21.21s [undocumented]\n", option);
4040 else if (* description != 0)
4041 doc += printf (" -m%-21.21s %s\n", option, description);
4047 printf ("\nThere are undocumented target specific options as well.\n");
4049 printf (" They exist, but they are not documented.\n");
4054 /* Parse a -d... comand line switch. */
4057 decode_d_option (arg)
4064 branch_prob_dump = 1;
4069 reorder_blocks_dump = 1;
4072 global_reg_dump = 1;
4088 #ifdef MACHINE_DEPENDENT_REORG
4089 mach_dep_reorg_dump = 1;
4098 branch_prob_dump = 1;
4101 reorder_blocks_dump = 1;
4121 global_reg_dump = 1;
4146 #ifdef MACHINE_DEPENDENT_REORG
4148 mach_dep_reorg_dump = 1;
4152 flag_print_asm_name = 1;
4173 graph_dump_format = vcg;
4179 rtl_dump_and_exit = 1;
4187 case 'D': /* These are handled by the preprocessor. */
4191 warning ("unrecognized gcc debugging option: %c", arg[-1]);
4196 /* Parse a -f... comand line switch. ARG is the value after the -f.
4197 It is safe to access 'ARG - 2' to generate the full switch name.
4198 Return the number of strings consumed. */
4201 decode_f_option (arg)
4206 /* Search for the option in the table of binary f options. */
4207 for (j = sizeof (f_options) / sizeof (f_options[0]); j--;)
4209 if (!strcmp (arg, f_options[j].string))
4211 *f_options[j].variable = f_options[j].on_value;
4215 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4216 && ! strcmp (arg + 3, f_options[j].string))
4218 *f_options[j].variable = ! f_options[j].on_value;
4223 if (!strncmp (arg, "inline-limit-", 13)
4224 || !strncmp (arg, "inline-limit=", 13))
4226 read_integral_parameter (arg + 13, arg - 2, inline_max_insns);
4227 #ifdef INSN_SCHEDULING
4228 else if (!strncmp (arg, "sched-verbose=", 14))
4229 fix_sched_param ("verbose", (const char *)(arg + 14));
4231 else if (!strncmp (arg, "fixed-", 6))
4232 fix_register ((const char *)(arg + 6), 1, 1);
4233 else if (!strncmp (arg, "call-used-", 10))
4234 fix_register ((const char *)(arg + 10), 0, 1);
4235 else if (!strncmp (arg, "call-saved-", 11))
4236 fix_register ((const char *)(arg + 11), 0, 0);
4237 else if (!strncmp (arg, "align-loops=", 12))
4238 align_loops = read_integral_parameter (arg + 12, arg - 2, align_loops);
4239 else if (!strncmp (arg, "align-functions=", 16))
4241 = read_integral_parameter (arg + 16, arg - 2, align_functions);
4242 else if (!strncmp (arg, "align-jumps=", 12))
4243 align_jumps = read_integral_parameter (arg + 12, arg - 2, align_jumps);
4244 else if (!strncmp (arg, "align-labels=", 13))
4245 align_labels = read_integral_parameter (arg + 13, arg - 2, align_labels);
4246 else if (!strncmp (arg, "stack-limit-register=", 21))
4248 int reg = decode_reg_name (arg + 21);
4250 error ("unrecognized register name `%s'", arg + 21);
4252 stack_limit_rtx = gen_rtx_REG (Pmode, reg);
4254 else if (!strncmp (arg, "stack-limit-symbol=", 19))
4258 nm = ggc_alloc_string (arg + 19, strlen (arg + 19));
4260 nm = xstrdup (arg + 19);
4261 stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
4263 else if (!strcmp (arg, "no-stack-limit"))
4264 stack_limit_rtx = NULL_RTX;
4265 else if (!strcmp (arg, "preprocessed"))
4266 /* Recognise this switch but do nothing. This prevents warnings
4267 about an unrecognized switch if cpplib has not been linked in. */
4275 /* Parse a -W... comand line switch. ARG is the value after the -W.
4276 It is safe to access 'ARG - 2' to generate the full switch name.
4277 Return the number of strings consumed. */
4280 decode_W_option (arg)
4285 /* Search for the option in the table of binary W options. */
4287 for (j = sizeof (W_options) / sizeof (W_options[0]); j--;)
4289 if (!strcmp (arg, W_options[j].string))
4291 *W_options[j].variable = W_options[j].on_value;
4295 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4296 && ! strcmp (arg + 3, W_options[j].string))
4298 *W_options[j].variable = ! W_options[j].on_value;
4303 if (!strncmp (arg, "id-clash-", 9))
4305 id_clash_len = read_integral_parameter (arg + 9, arg - 2, -1);
4307 if (id_clash_len != -1)
4310 else if (!strncmp (arg, "larger-than-", 12))
4312 larger_than_size = read_integral_parameter (arg + 12, arg - 2, -1);
4314 if (larger_than_size != -1)
4315 warn_larger_than = 1;
4323 /* Parse a -g... comand line switch. ARG is the value after the -g.
4324 It is safe to access 'ARG - 2' to generate the full switch name.
4325 Return the number of strings consumed. */
4328 decode_g_option (arg)
4332 /* A lot of code assumes write_symbols == NO_DEBUG if the
4333 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4334 of what debugging type has been selected). This records the
4335 selected type. It is an error to specify more than one
4337 static enum debug_info_type selected_debug_type = NO_DEBUG;
4338 /* Non-zero if debugging format has been explicitly set.
4339 -g and -ggdb don't explicitly set the debugging format so
4340 -gdwarf -g3 is equivalent to -gdwarf3. */
4341 static int type_explicitly_set_p = 0;
4342 /* Indexed by enum debug_info_type. */
4343 static const char * debug_type_names[] =
4345 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4348 /* The maximum admissible debug level value. */
4349 static const unsigned max_debug_level = 3;
4351 /* Look up ARG in the table. */
4352 for (da = debug_args; da->arg; da++)
4354 const int da_len = strlen (da->arg);
4356 if (da_len == 0 || ! strncmp (arg, da->arg, da_len))
4358 enum debug_info_type type = da->debug_type;
4359 const char * p = arg + da_len;
4361 if (*p && (*p < '0' || *p > '9'))
4364 /* A debug flag without a level defaults to level 2.
4365 Note we do not want to call read_integral_parameter
4366 for that case since it will call atoi which
4369 ??? We may want to generalize the interface to
4370 read_integral_parameter to better handle this case
4371 if this case shows up often. */
4373 level = read_integral_parameter (p, 0, max_debug_level + 1);
4377 if (da_len > 1 && *p && !strncmp (arg, "dwarf", da_len))
4379 error ("use -gdwarf -g%d for DWARF v1, level %d",
4382 error ("use -gdwarf-2 for DWARF v2");
4385 if (level > max_debug_level)
4388 ignoring option `%s' due to invalid debug level specification",
4390 level = debug_info_level;
4393 if (type == NO_DEBUG)
4395 type = PREFERRED_DEBUGGING_TYPE;
4397 if (da_len > 1 && strncmp (arg, "gdb", da_len) == 0)
4399 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4400 type = DWARF2_DEBUG;
4402 #ifdef DBX_DEBUGGING_INFO
4409 if (type == NO_DEBUG)
4410 warning ("`%s': unknown or unsupported -g option", arg - 2);
4412 /* Does it conflict with an already selected type? */
4413 if (type_explicitly_set_p
4414 /* -g/-ggdb don't conflict with anything */
4415 && da->debug_type != NO_DEBUG
4416 && type != selected_debug_type)
4417 warning ("`%s' ignored, conflicts with `-g%s'",
4418 arg - 2, debug_type_names[(int) selected_debug_type]);
4421 /* If the format has already been set, -g/-ggdb
4422 only change the debug level. */
4423 if (type_explicitly_set_p && da->debug_type == NO_DEBUG)
4424 ; /* don't change debugging type */
4427 selected_debug_type = type;
4428 type_explicitly_set_p = da->debug_type != NO_DEBUG;
4431 write_symbols = (level == 0
4433 : selected_debug_type);
4434 use_gnu_debug_info_extensions = da->use_extensions_p;
4435 debug_info_level = (enum debug_info_level) level;
4443 warning ("`%s': unknown or unsupported -g option", arg - 2);
4448 /* Decode the first argument in the argv as a language-independent option.
4449 Return the number of strings consumed. 'strings_processed' is the
4450 number of strings that have already been decoded in a language
4451 specific fashion before this function was invoked. */
4454 independent_decode_option (argc, argv, strings_processed)
4457 unsigned int strings_processed;
4459 char *arg = argv[0];
4461 if (arg[0] != '-' || arg[1] == 0)
4473 if (!strcmp (arg, "-help"))
4488 /* Already been treated in main (). Do nothing. */
4492 set_target_switch (arg + 1);
4496 return decode_f_option (arg + 1);
4499 if (strings_processed == 0)
4500 return decode_g_option (arg + 1);
4502 return strings_processed;
4505 if (!strcmp (arg, "dumpbase"))
4510 dump_base_name = argv[1];
4514 decode_d_option (arg + 1);
4518 if (!strcmp (arg, "pedantic"))
4520 else if (!strcmp (arg, "pedantic-errors"))
4521 flag_pedantic_errors = pedantic = 1;
4522 else if (arg[1] == 0)
4529 if (!strcmp (arg, "quiet"))
4536 if (!strcmp (arg, "version"))
4544 inhibit_warnings = 1;
4553 /* We save the value of warn_uninitialized, since if they put
4554 -Wuninitialized on the command line, we need to generate a
4555 warning about not using it without also specifying -O. */
4556 if (warn_uninitialized != 1)
4557 warn_uninitialized = 2;
4560 return decode_W_option (arg + 1);
4566 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4567 warning ("`-a' option (basic block profile) not supported");
4569 profile_block_flag = (profile_block_flag < 2) ? 1 : 3;
4572 else if (!strcmp (arg, "ax"))
4574 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4575 warning ("`-ax' option (jump profiling) not supported");
4577 profile_block_flag = (!profile_block_flag
4578 || profile_block_flag == 2) ? 2 : 3;
4581 else if (!strncmp (arg, "aux-info", 8))
4583 flag_gen_aux_info = 1;
4589 aux_info_file_name = argv[1];
4593 aux_info_file_name = arg + 8;
4605 asm_file_name = argv[1];
4620 g_switch_val = read_integral_parameter (argv[1], 0, -1);
4625 g_switch_val = read_integral_parameter (arg + 1, 0, -1);
4629 if (g_switch_val == -1)
4633 g_switch_set = TRUE;
4634 g_switch_value = g_switch_val;
4644 /* Entry point of cc1/c++. Decode command args, then call compile_file.
4645 Exit code is 35 if can't open files, 34 if fatal error,
4646 33 if had nonfatal errors, else success. */
4648 extern int main PARAMS ((int, char **));
4658 /* save in case md file wants to emit args as a comment. */
4662 p = argv[0] + strlen (argv[0]);
4663 while (p != argv[0] && p[-1] != '/'
4664 #ifdef DIR_SEPARATOR
4665 && p[-1] != DIR_SEPARATOR
4671 #ifdef HAVE_LC_MESSAGES
4672 setlocale (LC_MESSAGES, "");
4674 (void) bindtextdomain (PACKAGE, localedir);
4675 (void) textdomain (PACKAGE);
4677 signal (SIGFPE, float_signal);
4680 signal (SIGPIPE, pipe_closed);
4683 decl_printable_name = decl_name;
4684 lang_expand_expr = (lang_expand_expr_t) do_abort;
4686 /* Initialize whether `char' is signed. */
4687 flag_signed_char = DEFAULT_SIGNED_CHAR;
4688 #ifdef DEFAULT_SHORT_ENUMS
4689 /* Initialize how much space enums occupy, by default. */
4690 flag_short_enums = DEFAULT_SHORT_ENUMS;
4693 /* Initialize the garbage-collector. */
4695 ggc_add_root (&input_file_stack, 1, sizeof input_file_stack,
4697 ggc_add_rtx_root (&stack_limit_rtx, 1);
4698 ggc_add_tree_root (¤t_function_decl, 1);
4699 ggc_add_tree_root (¤t_function_func_begin_label, 1);
4701 /* Perform language-specific options intialization. */
4702 lang_init_options ();
4704 /* Scan to see what optimization level has been specified. That will
4705 determine the default value of many flags. */
4706 for (i = 1; i < argc; i++)
4708 if (!strcmp (argv[i], "-O"))
4713 else if (argv[i][0] == '-' && argv[i][1] == 'O')
4715 /* Handle -Os, -O2, -O3, -O69, ... */
4716 char *p = &argv[i][2];
4718 if ((p[0] == 's') && (p[1] == 0))
4722 /* Optimizing for size forces optimize to be 2. */
4727 const int optimize_val = read_integral_parameter (p, p - 2, -1);
4728 if (optimize_val != -1)
4730 optimize = optimize_val;
4740 flag_thread_jumps = 1;
4742 flag_delayed_branch = 1;
4744 #ifdef CAN_DEBUG_WITHOUT_FP
4745 flag_omit_frame_pointer = 1;
4751 flag_optimize_sibling_calls = 1;
4752 flag_cse_follow_jumps = 1;
4753 flag_cse_skip_blocks = 1;
4755 flag_expensive_optimizations = 1;
4756 flag_strength_reduce = 1;
4757 flag_rerun_cse_after_loop = 1;
4758 flag_rerun_loop_opt = 1;
4759 flag_caller_saves = 1;
4762 #ifdef INSN_SCHEDULING
4763 flag_schedule_insns = 1;
4764 flag_schedule_insns_after_reload = 1;
4767 flag_strict_aliasing = 1;
4768 flag_delete_null_pointer_checks = 1;
4773 flag_inline_functions = 1;
4776 if (optimize < 2 || optimize_size)
4781 align_functions = 1;
4784 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
4787 set_target_switch ("");
4789 #ifdef OPTIMIZATION_OPTIONS
4790 /* Allow default optimizations to be specified on a per-machine basis. */
4791 OPTIMIZATION_OPTIONS (optimize, optimize_size);
4794 /* Initialize register usage now so switches may override. */
4797 /* Perform normal command line switch decoding. */
4798 for (i = 1; i < argc;)
4800 unsigned int lang_processed;
4801 unsigned int indep_processed;
4803 /* Give the language a chance to decode the option for itself. */
4804 lang_processed = lang_decode_option (argc - i, argv + i);
4806 /* Now see if the option also has a language independent meaning.
4807 Some options are both language specific and language independent,
4808 eg --help. It is possible that there might be options that should
4809 only be decoded in a language independent way if they were not
4810 decoded in a langauge specific way, which is why 'lang_processed'
4812 indep_processed = independent_decode_option (argc - i, argv + i,
4815 if (lang_processed || indep_processed)
4816 i += (lang_processed > indep_processed
4817 ? lang_processed : indep_processed);
4820 const char * option = NULL;
4821 const char * lang = NULL;
4824 /* It is possible that the command line switch is not valid for the
4825 current language, but it is valid for another language. In order
4826 to be compatible with previous versions of the compiler (which
4827 did not issue an error message in this case) we check for this
4828 possibilty here. If we do find a match, then if extra_warnings
4829 is set we generate a warning message, otherwise we will just
4830 ignore the option. */
4831 for (j = 0; j < NUM_ELEM (documented_lang_options); j++)
4833 option = documented_lang_options[j].option;
4836 lang = documented_lang_options[j].description;
4837 else if (! strncmp (argv[i], option, strlen (option)))
4841 if (j != NUM_ELEM (documented_lang_options))
4845 warning ("Ignoring command line option '%s'", argv[i]);
4848 (It is valid for %s but not the selected langauge)", lang);
4852 error ("Unrecognized option `%s'", argv[i]);
4858 /* Checker uses the frame pointer. */
4859 if (flag_check_memory_usage)
4860 flag_omit_frame_pointer = 0;
4864 /* Inlining does not work if not optimizing,
4865 so force it not to be done. */
4869 /* The c_decode_option and lang_decode_option functions set
4870 this to `2' if -Wall is used, so we can avoid giving out
4871 lots of errors for people who don't realize what -Wall does. */
4872 if (warn_uninitialized == 1)
4873 warning ("-Wuninitialized is not supported without -O");
4876 #ifdef OVERRIDE_OPTIONS
4877 /* Some machines may reject certain combinations of options. */
4881 if (exceptions_via_longjmp == 2)
4883 #ifdef DWARF2_UNWIND_INFO
4884 exceptions_via_longjmp = ! DWARF2_UNWIND_INFO;
4886 exceptions_via_longjmp = 1;
4890 /* Set up the align_*_log variables, defaulting them to 1 if they
4891 were still unset. */
4892 if (align_loops <= 0) align_loops = 1;
4893 align_loops_log = floor_log2 (align_loops*2-1);
4894 if (align_jumps <= 0) align_jumps = 1;
4895 align_jumps_log = floor_log2 (align_jumps*2-1);
4896 if (align_labels <= 0) align_labels = 1;
4897 align_labels_log = floor_log2 (align_labels*2-1);
4898 if (align_functions <= 0) align_functions = 1;
4899 align_functions_log = floor_log2 (align_functions*2-1);
4901 if (profile_block_flag == 3)
4903 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4904 profile_block_flag = 2;
4907 /* Unrolling all loops implies that standard loop unrolling must also
4909 if (flag_unroll_all_loops)
4910 flag_unroll_loops = 1;
4911 /* Loop unrolling requires that strength_reduction be on also. Silently
4912 turn on strength reduction here if it isn't already on. Also, the loop
4913 unrolling code assumes that cse will be run after loop, so that must
4914 be turned on also. */
4915 if (flag_unroll_loops)
4917 flag_strength_reduce = 1;
4918 flag_rerun_cse_after_loop = 1;
4921 /* Warn about options that are not supported on this machine. */
4922 #ifndef INSN_SCHEDULING
4923 if (flag_schedule_insns || flag_schedule_insns_after_reload)
4924 warning ("instruction scheduling not supported on this target machine");
4927 if (flag_delayed_branch)
4928 warning ("this target machine does not have delayed branches");
4931 user_label_prefix = USER_LABEL_PREFIX;
4932 if (flag_leading_underscore != -1)
4934 /* If the default prefix is more complicated than "" or "_",
4935 issue a warning and ignore this option. */
4936 if (user_label_prefix[0] == 0 ||
4937 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
4939 user_label_prefix = flag_leading_underscore ? "_" : "";
4942 warning ("-f%sleading-underscore not supported on this target machine",
4943 flag_leading_underscore ? "" : "no-");
4946 /* If we are in verbose mode, write out the version and maybe all the
4947 option flags in use. */
4950 print_version (stderr, "");
4952 print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
4955 compile_file (filename);
4957 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__)) && !defined(__INTERIX)
4960 char *lim = (char *) sbrk (0);
4962 fnotice (stderr, "Data size %ld.\n", (long) (lim - (char *) &environ));
4967 system ("ps -l 1>&2");
4970 #endif /* not USG */
4973 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX */
4976 return (FATAL_EXIT_CODE);
4978 return (FATAL_EXIT_CODE);
4979 return (SUCCESS_EXIT_CODE);
4982 /* Decode -m switches. */
4983 /* Decode the switch -mNAME. */
4986 set_target_switch (name)
4990 int valid_target_option = 0;
4992 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
4993 if (!strcmp (target_switches[j].name, name))
4995 if (target_switches[j].value < 0)
4996 target_flags &= ~-target_switches[j].value;
4998 target_flags |= target_switches[j].value;
4999 valid_target_option = 1;
5002 #ifdef TARGET_OPTIONS
5003 if (!valid_target_option)
5004 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
5006 int len = strlen (target_options[j].prefix);
5007 if (!strncmp (target_options[j].prefix, name, len))
5009 *target_options[j].variable = name + len;
5010 valid_target_option = 1;
5015 if (!valid_target_option)
5016 error ("Invalid option `%s'", name);
5019 /* Print version information to FILE.
5020 Each line begins with INDENT (for the case where FILE is the
5021 assembler output file). */
5024 print_version (file, indent)
5029 #define __VERSION__ "[?]"
5033 "%s%s%s version %s (%s) compiled by GNU C version %s.\n"
5035 "%s%s%s version %s (%s) compiled by CC.\n"
5037 , indent, *indent != 0 ? " " : "",
5038 language_string, version_string, TARGET_NAME, __VERSION__);
5041 /* Print an option value and return the adjusted position in the line.
5042 ??? We don't handle error returns from fprintf (disk full); presumably
5043 other code will catch a disk full though. */
5046 print_single_switch (file, pos, max, indent, sep, term, type, name)
5049 const char *indent, *sep, *term, *type, *name;
5051 /* The ultrix fprintf returns 0 on success, so compute the result we want
5052 here since we need it for the following test. */
5053 int len = strlen (sep) + strlen (type) + strlen (name);
5058 fprintf (file, "%s", term);
5063 fprintf (file, "%s", indent);
5064 pos = strlen (indent);
5066 fprintf (file, "%s%s%s", sep, type, name);
5071 /* Print active target switches to FILE.
5072 POS is the current cursor position and MAX is the size of a "line".
5073 Each line begins with INDENT and ends with TERM.
5074 Each switch is separated from the next by SEP. */
5077 print_switch_values (file, pos, max, indent, sep, term)
5080 const char *indent, *sep, *term;
5085 /* Print the options as passed. */
5087 pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
5088 _("options passed: "), "");
5090 for (p = &save_argv[1]; *p != NULL; p++)
5094 if (strcmp (*p, "-o") == 0)
5100 if (strcmp (*p, "-quiet") == 0)
5102 if (strcmp (*p, "-version") == 0)
5107 pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
5110 fprintf (file, "%s", term);
5112 /* Print the -f and -m options that have been enabled.
5113 We don't handle language specific options but printing argv
5116 pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
5117 _("options enabled: "), "");
5119 for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
5120 if (*f_options[j].variable == f_options[j].on_value)
5121 pos = print_single_switch (file, pos, max, indent, sep, term,
5122 "-f", f_options[j].string);
5124 /* Print target specific options. */
5126 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
5127 if (target_switches[j].name[0] != '\0'
5128 && target_switches[j].value > 0
5129 && ((target_switches[j].value & target_flags)
5130 == target_switches[j].value))
5132 pos = print_single_switch (file, pos, max, indent, sep, term,
5133 "-m", target_switches[j].name);
5136 #ifdef TARGET_OPTIONS
5137 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
5138 if (*target_options[j].variable != NULL)
5141 sprintf (prefix, "-m%s", target_options[j].prefix);
5142 pos = print_single_switch (file, pos, max, indent, sep, term,
5143 prefix, *target_options[j].variable);
5147 fprintf (file, "%s", term);
5150 /* Record the beginning of a new source file, named FILENAME. */
5153 debug_start_source_file (filename)
5154 register char *filename ATTRIBUTE_UNUSED;
5156 #ifdef DBX_DEBUGGING_INFO
5157 if (write_symbols == DBX_DEBUG)
5158 dbxout_start_new_source_file (filename);
5160 #ifdef DWARF_DEBUGGING_INFO
5161 if (debug_info_level == DINFO_LEVEL_VERBOSE
5162 && write_symbols == DWARF_DEBUG)
5163 dwarfout_start_new_source_file (filename);
5164 #endif /* DWARF_DEBUGGING_INFO */
5165 #ifdef DWARF2_DEBUGGING_INFO
5166 if (debug_info_level == DINFO_LEVEL_VERBOSE
5167 && write_symbols == DWARF2_DEBUG)
5168 dwarf2out_start_source_file (filename);
5169 #endif /* DWARF2_DEBUGGING_INFO */
5170 #ifdef SDB_DEBUGGING_INFO
5171 if (write_symbols == SDB_DEBUG)
5172 sdbout_start_new_source_file (filename);
5176 /* Record the resumption of a source file. LINENO is the line number in
5177 the source file we are returning to. */
5180 debug_end_source_file (lineno)
5181 register unsigned lineno ATTRIBUTE_UNUSED;
5183 #ifdef DBX_DEBUGGING_INFO
5184 if (write_symbols == DBX_DEBUG)
5185 dbxout_resume_previous_source_file ();
5187 #ifdef DWARF_DEBUGGING_INFO
5188 if (debug_info_level == DINFO_LEVEL_VERBOSE
5189 && write_symbols == DWARF_DEBUG)
5190 dwarfout_resume_previous_source_file (lineno);
5191 #endif /* DWARF_DEBUGGING_INFO */
5192 #ifdef DWARF2_DEBUGGING_INFO
5193 if (debug_info_level == DINFO_LEVEL_VERBOSE
5194 && write_symbols == DWARF2_DEBUG)
5195 dwarf2out_end_source_file ();
5196 #endif /* DWARF2_DEBUGGING_INFO */
5197 #ifdef SDB_DEBUGGING_INFO
5198 if (write_symbols == SDB_DEBUG)
5199 sdbout_resume_previous_source_file ();
5203 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5204 the tail part of the directive line, i.e. the part which is past the
5205 initial whitespace, #, whitespace, directive-name, whitespace part. */
5208 debug_define (lineno, buffer)
5209 register unsigned lineno ATTRIBUTE_UNUSED;
5210 register char *buffer ATTRIBUTE_UNUSED;
5212 #ifdef DWARF_DEBUGGING_INFO
5213 if (debug_info_level == DINFO_LEVEL_VERBOSE
5214 && write_symbols == DWARF_DEBUG)
5215 dwarfout_define (lineno, buffer);
5216 #endif /* DWARF_DEBUGGING_INFO */
5217 #ifdef DWARF2_DEBUGGING_INFO
5218 if (debug_info_level == DINFO_LEVEL_VERBOSE
5219 && write_symbols == DWARF2_DEBUG)
5220 dwarf2out_define (lineno, buffer);
5221 #endif /* DWARF2_DEBUGGING_INFO */
5224 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5225 the tail part of the directive line, i.e. the part which is past the
5226 initial whitespace, #, whitespace, directive-name, whitespace part. */
5229 debug_undef (lineno, buffer)
5230 register unsigned lineno ATTRIBUTE_UNUSED;
5231 register char *buffer ATTRIBUTE_UNUSED;
5233 #ifdef DWARF_DEBUGGING_INFO
5234 if (debug_info_level == DINFO_LEVEL_VERBOSE
5235 && write_symbols == DWARF_DEBUG)
5236 dwarfout_undef (lineno, buffer);
5237 #endif /* DWARF_DEBUGGING_INFO */
5238 #ifdef DWARF2_DEBUGGING_INFO
5239 if (debug_info_level == DINFO_LEVEL_VERBOSE
5240 && write_symbols == DWARF2_DEBUG)
5241 dwarf2out_undef (lineno, buffer);
5242 #endif /* DWARF2_DEBUGGING_INFO */
5245 /* Tell the debugging backend that we've decided not to emit any
5246 debugging information for BLOCK, so it can clean up after any local
5247 classes or nested functions. */
5250 debug_ignore_block (block)
5251 tree block ATTRIBUTE_UNUSED;
5253 #ifdef DWARF2_DEBUGGING_INFO
5254 if (write_symbols == DWARF2_DEBUG)
5255 dwarf2out_ignore_block (block);