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"
65 #ifndef ACCUMULATE_OUTGOING_ARGS
66 #define ACCUMULATE_OUTGOING_ARGS 0
69 #ifdef DWARF_DEBUGGING_INFO
73 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
74 #include "dwarf2out.h"
77 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
81 #ifdef SDB_DEBUGGING_INFO
85 #ifdef XCOFF_DEBUGGING_INFO
90 /* The extra parameters substantially improve the I/O performance. */
92 vms_fopen (fname, type)
96 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
97 fixed arguments, which matches ANSI's specification but not VAXCRTL's
98 pre-ANSI implementation. This hack circumvents the mismatch problem. */
99 FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
102 return (*vmslib_fopen) (fname, type, "mbc=32",
103 "deq=64", "fop=tef", "shr=nil");
105 return (*vmslib_fopen) (fname, type, "mbc=32");
107 #define fopen vms_fopen
110 #ifndef DEFAULT_GDB_EXTENSIONS
111 #define DEFAULT_GDB_EXTENSIONS 1
114 /* If more than one debugging type is supported, you must define
115 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
117 This is one long line cause VAXC can't handle a \-newline. */
118 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
119 #ifndef PREFERRED_DEBUGGING_TYPE
120 You Lose! You must define PREFERRED_DEBUGGING_TYPE!
121 #endif /* no PREFERRED_DEBUGGING_TYPE */
122 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
123 so the following code needn't care. */
124 #ifdef DBX_DEBUGGING_INFO
125 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
127 #ifdef SDB_DEBUGGING_INFO
128 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
130 #ifdef DWARF_DEBUGGING_INFO
131 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
133 #ifdef DWARF2_DEBUGGING_INFO
134 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
136 #ifdef XCOFF_DEBUGGING_INFO
137 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
139 #endif /* More than one debugger format enabled. */
141 /* If still not defined, must have been because no debugging formats
143 #ifndef PREFERRED_DEBUGGING_TYPE
144 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
147 #ifdef NEED_DECLARATION_ENVIRON
148 extern char **environ;
151 /* Carry information from ASM_DECLARE_OBJECT_NAME
152 to ASM_FINISH_DECLARE_OBJECT. */
154 extern int size_directive_output;
155 extern tree last_assemble_variable_decl;
157 static void set_target_switch PARAMS ((const char *));
158 static const char *decl_name PARAMS ((tree, int));
160 static void float_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
161 static void pipe_closed PARAMS ((int)) ATTRIBUTE_NORETURN;
162 #ifdef ASM_IDENTIFY_LANGUAGE
163 /* This might or might not be used in ASM_IDENTIFY_LANGUAGE. */
164 static void output_lang_identify PARAMS ((FILE *)) ATTRIBUTE_UNUSED;
166 static void compile_file PARAMS ((const char *));
167 static void display_help PARAMS ((void));
168 static void mark_file_stack PARAMS ((void *));
170 static void decode_d_option PARAMS ((const char *));
171 static int decode_f_option PARAMS ((const char *));
172 static int decode_W_option PARAMS ((const char *));
173 static int decode_g_option PARAMS ((const char *));
174 static unsigned int independent_decode_option PARAMS ((int, char **,
177 static void print_version PARAMS ((FILE *, const char *));
178 static int print_single_switch PARAMS ((FILE *, int, int, const char *,
179 const char *, const char *,
180 const char *, const char *));
181 static void print_switch_values PARAMS ((FILE *, int, int, const char *,
182 const char *, const char *));
184 /* Length of line when printing switch values. */
187 /* Name of program invoked, sans directories. */
189 const char *progname;
191 /* Copy of arguments to main. */
195 /* Name of current original source file (what was input to cpp).
196 This comes from each #-command in the actual input. */
198 const char *input_filename;
200 /* Name of top-level original source file (what was input to cpp).
201 This comes from the #-command at the beginning of the actual input.
202 If there isn't any there, then this is the cc1 input file name. */
204 const char *main_input_filename;
206 /* Current line number in real source file. */
210 /* Nonzero if it is unsafe to create any new pseudo registers. */
213 /* Stack of currently pending input files. */
215 struct file_stack *input_file_stack;
217 /* Incremented on each change to input_file_stack. */
218 int input_file_stack_tick;
220 /* Name to use as base of names for dump output files. */
222 const char *dump_base_name;
224 /* Bit flags that specify the machine subtype we are compiling for.
225 Bits are tested using macros TARGET_... defined in the tm.h file
226 and set by `-m...' switches. Must be defined in rtlanal.c. */
228 extern int target_flags;
230 /* Describes a dump file. */
232 struct dump_file_info
234 /* The unique extension to apply, e.g. ".jump". */
235 const char * const extension;
237 /* The -d<c> character that enables this dump file. */
238 char const debug_switch;
240 /* True if there is a corresponding graph dump file. */
241 char const graph_dump_p;
243 /* True if the user selected this dump. */
246 /* True if the files have been initialized (ie truncated). */
250 /* Enumerate the extant dump files. */
285 /* Describes all the dump files. Should be kept in order of the
286 pass and in sync with dump_file_index above.
288 Remaining -d letters:
294 struct dump_file_info dump_file[DFI_MAX] =
296 { "rtl", 'r', 0, 0, 0 },
297 { "sibling", 'i', 0, 0, 0 },
298 { "jump", 'j', 0, 0, 0 },
299 { "cse", 's', 0, 0, 0 },
300 { "addressof", 'F', 0, 0, 0 },
301 { "ssa", 'e', 1, 0, 0 },
302 { "ussa", 'e', 1, 0, 0 }, /* Yes, duplicate enable switch. */
303 { "gcse", 'G', 1, 0, 0 },
304 { "loop", 'L', 1, 0, 0 },
305 { "cse2", 't', 1, 0, 0 },
306 { "bp", 'b', 1, 0, 0 },
307 { "flow", 'f', 1, 0, 0 },
308 { "combine", 'c', 1, 0, 0 },
309 { "ce", 'C', 1, 0, 0 },
310 { "regmove", 'N', 1, 0, 0 },
311 { "sched", 'S', 1, 0, 0 },
312 { "lreg", 'l', 1, 0, 0 },
313 { "greg", 'g', 1, 0, 0 },
314 { "flow2", 'w', 1, 0, 0 },
315 { "ce2", 'E', 1, 0, 0 },
316 { "peephole2", 'z', 1, 0, 0 },
317 { "rnreg", 'n', 1, 0, 0 },
318 { "sched2", 'R', 1, 0, 0 },
319 { "bbro", 'B', 1, 0, 0 },
320 { "jump2", 'J', 1, 0, 0 },
321 { "mach", 'M', 1, 0, 0 },
322 { "dbr", 'd', 0, 0, 0 },
323 { "stack", 'k', 1, 0, 0 },
326 static int open_dump_file PARAMS ((enum dump_file_index, tree));
327 static void close_dump_file PARAMS ((enum dump_file_index,
328 void (*) (FILE *, rtx), rtx));
330 /* Other flags saying which kinds of debugging dump have been requested. */
332 int rtl_dump_and_exit;
333 int flag_print_asm_name;
334 static int flag_print_mem;
335 static int version_flag;
336 static char * filename;
337 enum graph_dump_types graph_dump_format;
339 /* Name for output file of assembly code, specified with -o. */
343 /* Value of the -G xx switch, and whether it was passed or not. */
347 /* Type(s) of debugging information we are producing (if any).
348 See flags.h for the definitions of the different possible
349 types of debugging information. */
350 enum debug_info_type write_symbols = NO_DEBUG;
352 /* Level of debugging information we are producing. See flags.h
353 for the definitions of the different possible levels. */
354 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
356 /* Nonzero means use GNU-only extensions in the generated symbolic
357 debugging information. */
358 /* Currently, this only has an effect when write_symbols is set to
359 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
360 int use_gnu_debug_info_extensions = 0;
362 /* Nonzero means do optimizations. -O.
363 Particular numeric values stand for particular amounts of optimization;
364 thus, -O2 stores 2 here. However, the optimizations beyond the basic
365 ones are not controlled directly by this variable. Instead, they are
366 controlled by individual `flag_...' variables that are defaulted
367 based on this variable. */
371 /* Nonzero means optimize for size. -Os.
372 The only valid values are zero and non-zero. When optimize_size is
373 non-zero, optimize defaults to 2, but certain individual code
374 bloating optimizations are disabled. */
376 int optimize_size = 0;
378 /* Number of error messages and warning messages so far. */
381 int warningcount = 0;
384 /* The FUNCTION_DECL for the function currently being compiled,
385 or 0 if between functions. */
386 tree current_function_decl;
388 /* Set to the FUNC_BEGIN label of the current function, or NULL_TREE
390 tree current_function_func_begin_label;
392 /* Pointer to function to compute the name to use to print a declaration.
393 DECL is the declaration in question.
394 VERBOSITY determines what information will be printed:
395 0: DECL_NAME, demangled as necessary.
396 1: and scope information.
397 2: and any other information that might be interesting, such as function
398 parameter types in C++. */
400 const char *(*decl_printable_name) PARAMS ((tree, int));
402 /* Pointer to function to compute rtl for a language-specific tree code. */
404 typedef rtx (*lang_expand_expr_t)
405 PARAMS ((union tree_node *, rtx, enum machine_mode,
406 enum expand_modifier modifier));
408 lang_expand_expr_t lang_expand_expr = 0;
410 tree (*lang_expand_constant) PARAMS ((tree)) = 0;
412 /* Pointer to function to finish handling an incomplete decl at the
413 end of compilation. */
415 void (*incomplete_decl_finalize_hook) PARAMS ((tree)) = 0;
417 /* Nonzero if generating code to do profiling. */
419 int profile_flag = 0;
421 /* Nonzero if generating code to do profiling on a line-by-line basis. */
423 int profile_block_flag;
425 /* Nonzero if generating code to profile program flow graph arcs. */
427 int profile_arc_flag = 0;
429 /* Nonzero if generating info for gcov to calculate line test coverage. */
431 int flag_test_coverage = 0;
433 /* Nonzero indicates that branch taken probabilities should be calculated. */
435 int flag_branch_probabilities = 0;
437 /* Nonzero if basic blocks should be reordered. */
439 int flag_reorder_blocks = 0;
441 /* Nonzero if registers should be renamed */
443 int flag_rename_registers = 0;
445 /* Nonzero for -pedantic switch: warn about anything
446 that standard spec forbids. */
450 /* Temporarily suppress certain warnings.
451 This is set while reading code from a system header file. */
453 int in_system_header = 0;
455 /* Don't print functions as they are compiled and don't print
456 times taken by the various passes. -quiet. */
462 /* Nonzero means `char' should be signed. */
464 int flag_signed_char;
466 /* Nonzero means give an enum type only as many bytes as it needs. */
468 int flag_short_enums;
470 /* Nonzero for -fcaller-saves: allocate values in regs that need to
471 be saved across function calls, if that produces overall better code.
472 Optional now, so people can test it. */
474 #ifdef DEFAULT_CALLER_SAVES
475 int flag_caller_saves = 1;
477 int flag_caller_saves = 0;
480 /* Nonzero if structures and unions should be returned in memory.
482 This should only be defined if compatibility with another compiler or
483 with an ABI is needed, because it results in slower code. */
485 #ifndef DEFAULT_PCC_STRUCT_RETURN
486 #define DEFAULT_PCC_STRUCT_RETURN 1
489 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
491 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
493 /* Nonzero for -fforce-mem: load memory value into a register
494 before arithmetic on it. This makes better cse but slower compilation. */
496 int flag_force_mem = 0;
498 /* Nonzero for -fforce-addr: load memory address into a register before
499 reference to memory. This makes better cse but slower compilation. */
501 int flag_force_addr = 0;
503 /* Nonzero for -fdefer-pop: don't pop args after each function call;
504 instead save them up to pop many calls' args with one insns. */
506 int flag_defer_pop = 0;
508 /* Nonzero for -ffloat-store: don't allocate floats and doubles
509 in extended-precision registers. */
511 int flag_float_store = 0;
513 /* Nonzero for -fcse-follow-jumps:
514 have cse follow jumps to do a more extensive job. */
516 int flag_cse_follow_jumps;
518 /* Nonzero for -fcse-skip-blocks:
519 have cse follow a branch around a block. */
520 int flag_cse_skip_blocks;
522 /* Nonzero for -fexpensive-optimizations:
523 perform miscellaneous relatively-expensive optimizations. */
524 int flag_expensive_optimizations;
526 /* Nonzero for -fthread-jumps:
527 have jump optimize output of loop. */
529 int flag_thread_jumps;
531 /* Nonzero enables strength-reduction in loop.c. */
533 int flag_strength_reduce = 0;
535 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
536 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
537 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
540 int flag_unroll_loops;
542 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
543 This is generally not a win. */
545 int flag_unroll_all_loops;
547 /* Nonzero forces all invariant computations in loops to be moved
550 int flag_move_all_movables = 0;
552 /* Nonzero forces all general induction variables in loops to be
555 int flag_reduce_all_givs = 0;
557 /* Nonzero to perform full register move optimization passes. This is the
560 int flag_regmove = 0;
562 /* Nonzero for -fwritable-strings:
563 store string constants in data segment and don't uniquize them. */
565 int flag_writable_strings = 0;
567 /* Nonzero means don't put addresses of constant functions in registers.
568 Used for compiling the Unix kernel, where strange substitutions are
569 done on the assembly output. */
571 int flag_no_function_cse = 0;
573 /* Nonzero for -fomit-frame-pointer:
574 don't make a frame pointer in simple functions that don't require one. */
576 int flag_omit_frame_pointer = 0;
578 /* Nonzero means place each function into its own section on those platforms
579 which support arbitrary section names and unlimited numbers of sections. */
581 int flag_function_sections = 0;
583 /* ... and similar for data. */
585 int flag_data_sections = 0;
587 /* Nonzero to inhibit use of define_optimization peephole opts. */
589 int flag_no_peephole = 0;
591 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
592 operations in the interest of optimization. For example it allows
593 GCC to assume arguments to sqrt are nonnegative numbers, allowing
594 faster code for sqrt to be generated. */
596 int flag_fast_math = 0;
598 /* Nonzero allows GCC to optimize sibling and tail recursive calls. */
600 int flag_optimize_sibling_calls = 0;
602 /* Nonzero means the front end generally wants `errno' maintained by math
603 operations, like built-in SQRT, unless overridden by flag_fast_math. */
605 int flag_errno_math = 1;
607 /* 0 means straightforward implementation of complex divide acceptable.
608 1 means wide ranges of inputs must work for complex divide.
609 2 means C9X-like requirements for complex divide (not yet implemented). */
611 int flag_complex_divide_method = 0;
613 /* Nonzero means all references through pointers are volatile. */
617 /* Nonzero means treat all global and extern variables as volatile. */
619 int flag_volatile_global;
621 /* Nonzero means treat all static variables as volatile. */
623 int flag_volatile_static;
625 /* Nonzero means just do syntax checking; don't output anything. */
627 int flag_syntax_only = 0;
629 /* Nonzero means perform global cse. */
631 static int flag_gcse;
633 /* Nonzero means to use global dataflow analysis to eliminate
634 useless null pointer tests. */
636 static int flag_delete_null_pointer_checks;
638 /* Nonzero means to rerun cse after loop optimization. This increases
639 compilation time about 20% and picks up a few more common expressions. */
641 static int flag_rerun_cse_after_loop;
643 /* Nonzero means to run loop optimizations twice. */
645 int flag_rerun_loop_opt;
647 /* Nonzero for -finline-functions: ok to inline functions that look like
648 good inline candidates. */
650 int flag_inline_functions;
652 /* Nonzero for -fkeep-inline-functions: even if we make a function
653 go inline everywhere, keep its definition around for debugging
656 int flag_keep_inline_functions;
658 /* Nonzero means that functions will not be inlined. */
662 /* Nonzero means that we should emit static const variables
663 regardless of whether or not optimization is turned on. */
665 int flag_keep_static_consts = 1;
667 /* Nonzero means we should be saving declaration info into a .X file. */
669 int flag_gen_aux_info = 0;
671 /* Specified name of aux-info file. */
673 static char *aux_info_file_name;
675 /* Nonzero means make the text shared if supported. */
677 int flag_shared_data;
679 /* Nonzero means schedule into delayed branch slots if supported. */
681 int flag_delayed_branch;
683 /* Nonzero if we are compiling pure (sharable) code.
684 Value is 1 if we are doing reasonable (i.e. simple
685 offset into offset table) pic. Value is 2 if we can
686 only perform register offsets. */
690 /* Nonzero means generate extra code for exception handling and enable
691 exception handling. */
695 /* Nonzero means use the new model for exception handling. Replaces
696 -DNEW_EH_MODEL as a compile option. */
698 int flag_new_exceptions = 1;
700 /* Nonzero means generate frame unwind info table when supported */
702 int flag_unwind_tables = 0;
704 /* Nonzero means don't place uninitialized global data in common storage
709 /* Nonzero means pretend it is OK to examine bits of target floats,
710 even if that isn't true. The resulting code will have incorrect constants,
711 but the same series of instructions that the native compiler would make. */
713 int flag_pretend_float;
715 /* Nonzero means change certain warnings into errors.
716 Usually these are warnings about failure to conform to some standard. */
718 int flag_pedantic_errors = 0;
720 /* flag_schedule_insns means schedule insns within basic blocks (before
722 flag_schedule_insns_after_reload means schedule insns after
725 int flag_schedule_insns = 0;
726 int flag_schedule_insns_after_reload = 0;
728 /* The following flags have effect only for scheduling before register
731 flag_schedule_interblock means schedule insns accross basic blocks.
732 flag_schedule_speculative means allow speculative motion of non-load insns.
733 flag_schedule_speculative_load means allow speculative motion of some
735 flag_schedule_speculative_load_dangerous allows speculative motion of more
738 int flag_schedule_interblock = 1;
739 int flag_schedule_speculative = 1;
740 int flag_schedule_speculative_load = 0;
741 int flag_schedule_speculative_load_dangerous = 0;
743 /* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple
744 by a cheaper branch, on a count register. */
745 int flag_branch_on_count_reg;
747 /* -finhibit-size-directive inhibits output of .size for ELF.
748 This is used only for compiling crtstuff.c,
749 and it may be extended to other effects
750 needed for crtstuff.c on other systems. */
751 int flag_inhibit_size_directive = 0;
753 /* -fverbose-asm causes extra commentary information to be produced in
754 the generated assembly code (to make it more readable). This option
755 is generally only of use to those who actually need to read the
756 generated assembly code (perhaps while debugging the compiler itself).
757 -fno-verbose-asm, the default, causes the extra information
758 to be omitted and is useful when comparing two assembler files. */
760 int flag_verbose_asm = 0;
762 /* -dA causes debug commentary information to be produced in
763 the generated assembly code (to make it more readable). This option
764 is generally only of use to those who actually need to read the
765 generated assembly code (perhaps while debugging the compiler itself).
766 Currently, this switch is only used by dwarfout.c; however, it is intended
767 to be a catchall for printing debug information in the assembler file. */
769 int flag_debug_asm = 0;
771 /* -fgnu-linker specifies use of the GNU linker for initializations.
772 (Or, more generally, a linker that handles initializations.)
773 -fno-gnu-linker says that collect2 will be used. */
775 int flag_gnu_linker = 0;
777 int flag_gnu_linker = 1;
783 /* Tag all structures with __attribute__(packed) */
784 int flag_pack_struct = 0;
786 /* Emit code to check for stack overflow; also may cause large objects
787 to be allocated dynamically. */
788 int flag_stack_check;
790 /* When non-NULL, indicates that whenever space is allocated on the
791 stack, the resulting stack pointer must not pass this
792 address---that is, for stacks that grow downward, the stack pointer
793 must always be greater than or equal to this address; for stacks
794 that grow upward, the stack pointer must be less than this address.
795 At present, the rtx may be either a REG or a SYMBOL_REF, although
796 the support provided depends on the backend. */
799 /* -fcheck-memory-usage causes extra code to be generated in order to check
800 memory accesses. This is used by a detector of bad memory accesses such
802 int flag_check_memory_usage = 0;
804 /* -fprefix-function-name causes function name to be prefixed. This
805 can be used with -fcheck-memory-usage to isolate code compiled with
806 -fcheck-memory-usage. */
807 int flag_prefix_function_name = 0;
809 /* 0 if pointer arguments may alias each other. True in C.
810 1 if pointer arguments may not alias each other but may alias
812 2 if pointer arguments may not alias each other and may not
813 alias global variables. True in Fortran.
814 This defaults to 0 for C. */
815 int flag_argument_noalias = 0;
817 /* Nonzero if we should do (language-dependent) alias analysis.
818 Typically, this analysis will assume that expressions of certain
819 types do not alias expressions of certain other types. Only used
820 if alias analysis (in general) is enabled. */
821 int flag_strict_aliasing = 0;
823 /* Instrument functions with calls at entry and exit, for profiling. */
824 int flag_instrument_function_entry_exit = 0;
826 /* Nonzero means ignore `#ident' directives. 0 means handle them.
827 On SVR4 targets, it also controls whether or not to emit a
828 string identifying the compiler. */
830 int flag_no_ident = 0;
832 /* This will perform a peephole pass before sched2. */
833 int flag_peephole2 = 0;
835 /* -fbounded-pointers causes gcc to compile pointers as composite
836 objects occupying three words: the pointer value, the base address
837 of the referent object, and the address immediately beyond the end
838 of the referent object. The base and extent allow us to perform
839 runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
840 int flag_bounded_pointers = 0;
842 /* -fcheck-bounds causes gcc to generate array bounds checks.
843 For C, C++: defaults to value of flag_bounded_pointers.
844 For ObjC: defaults to off.
845 For Java: defaults to on.
846 For Fortran: defaults to off.
847 For CHILL: defaults to off. */
848 int flag_bounds_check = 0;
850 /* If one, renumber instruction UIDs to reduce the number of
851 unused UIDs if there are a lot of instructions. If greater than
852 one, unconditionally renumber instruction UIDs. */
853 int flag_renumber_insns = 1;
855 /* Values of the -falign-* flags: how much to align labels in code.
856 0 means `use default', 1 means `don't align'.
857 For each variable, there is an _log variant which is the power
858 of two not less than the variable, for .align output. */
865 int align_labels_log;
867 int align_functions_log;
869 /* Table of supported debugging formats. */
873 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
874 constant expression, we use NO_DEBUG in its place. */
875 enum debug_info_type debug_type;
876 int use_extensions_p;
877 const char * description;
881 { "", NO_DEBUG, DEFAULT_GDB_EXTENSIONS,
882 "Generate default debug format output" },
883 { "gdb", NO_DEBUG, 1, "Generate default extended debug format output" },
884 #ifdef DBX_DEBUGGING_INFO
885 { "stabs", DBX_DEBUG, 0, "Generate STABS format debug output" },
886 { "stabs+", DBX_DEBUG, 1, "Generate extended STABS format debug output" },
888 #ifdef DWARF_DEBUGGING_INFO
889 { "dwarf", DWARF_DEBUG, 0, "Generate DWARF-1 format debug output"},
890 { "dwarf+", DWARF_DEBUG, 1,
891 "Generated extended DWARF-1 format debug output" },
893 #ifdef DWARF2_DEBUGGING_INFO
894 { "dwarf-2", DWARF2_DEBUG, 0, "Enable DWARF-2 debug output" },
896 #ifdef XCOFF_DEBUGGING_INFO
897 { "xcoff", XCOFF_DEBUG, 0, "Generate XCOFF format debug output" },
898 { "xcoff+", XCOFF_DEBUG, 1, "Generate extended XCOFF format debug output" },
900 #ifdef SDB_DEBUGGING_INFO
901 { "coff", SDB_DEBUG, 0, "Generate COFF format debug output" },
911 const char * description;
913 lang_independent_options;
915 /* Add or remove a leading underscore from user symbols. */
916 int flag_leading_underscore = -1;
918 /* The user symbol prefix after having resolved same. */
919 const char *user_label_prefix;
921 /* A default for same. */
922 #ifndef USER_LABEL_PREFIX
923 #define USER_LABEL_PREFIX ""
926 /* Table of language-independent -f options.
927 STRING is the option name. VARIABLE is the address of the variable.
928 ON_VALUE is the value to store in VARIABLE
929 if `-fSTRING' is seen as an option.
930 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
932 lang_independent_options f_options[] =
934 {"float-store", &flag_float_store, 1,
935 "Do not store floats in registers" },
936 {"volatile", &flag_volatile, 1,
937 "Consider all mem refs through pointers as volatile"},
938 {"volatile-global", &flag_volatile_global, 1,
939 "Consider all mem refs to global data to be volatile" },
940 {"volatile-static", &flag_volatile_static, 1,
941 "Consider all mem refs to static data to be volatile" },
942 {"defer-pop", &flag_defer_pop, 1,
943 "Defer popping functions args from stack until later" },
944 {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
945 "When possible do not generate stack frames"},
946 {"optimize-sibling-calls", &flag_optimize_sibling_calls, 1,
947 "Optimize sibling and tail recursive calls" },
948 {"cse-follow-jumps", &flag_cse_follow_jumps, 1,
949 "When running CSE, follow jumps to their targets" },
950 {"cse-skip-blocks", &flag_cse_skip_blocks, 1,
951 "When running CSE, follow conditional jumps" },
952 {"expensive-optimizations", &flag_expensive_optimizations, 1,
953 "Perform a number of minor, expensive optimisations" },
954 {"thread-jumps", &flag_thread_jumps, 1,
955 "Perform jump threading optimisations"},
956 {"strength-reduce", &flag_strength_reduce, 1,
957 "Perform strength reduction optimisations" },
958 {"unroll-loops", &flag_unroll_loops, 1,
959 "Perform loop unrolling when iteration count is known" },
960 {"unroll-all-loops", &flag_unroll_all_loops, 1,
961 "Perform loop unrolling for all loops" },
962 {"move-all-movables", &flag_move_all_movables, 1,
963 "Force all loop invariant computations out of loops" },
964 {"reduce-all-givs", &flag_reduce_all_givs, 1,
965 "Strength reduce all loop general induction variables" },
966 {"writable-strings", &flag_writable_strings, 1,
967 "Store strings in writable data section" },
968 {"peephole", &flag_no_peephole, 0,
969 "Enable machine specific peephole optimisations" },
970 {"force-mem", &flag_force_mem, 1,
971 "Copy memory operands into registers before using" },
972 {"force-addr", &flag_force_addr, 1,
973 "Copy memory address constants into regs before using" },
974 {"function-cse", &flag_no_function_cse, 0,
975 "Allow function addresses to be held in registers" },
976 {"inline-functions", &flag_inline_functions, 1,
977 "Integrate simple functions into their callers" },
978 {"keep-inline-functions", &flag_keep_inline_functions, 1,
979 "Generate code for funcs even if they are fully inlined" },
980 {"inline", &flag_no_inline, 0,
981 "Pay attention to the 'inline' keyword"},
982 {"keep-static-consts", &flag_keep_static_consts, 1,
983 "Emit static const variables even if they are not used" },
984 {"syntax-only", &flag_syntax_only, 1,
985 "Check for syntax errors, then stop" },
986 {"shared-data", &flag_shared_data, 1,
987 "Mark data as shared rather than private" },
988 {"caller-saves", &flag_caller_saves, 1,
989 "Enable saving registers around function calls" },
990 {"pcc-struct-return", &flag_pcc_struct_return, 1,
991 "Return 'short' aggregates in memory, not registers" },
992 {"reg-struct-return", &flag_pcc_struct_return, 0,
993 "Return 'short' aggregates in registers" },
994 {"delayed-branch", &flag_delayed_branch, 1,
995 "Attempt to fill delay slots of branch instructions" },
996 {"gcse", &flag_gcse, 1,
997 "Perform the global common subexpression elimination" },
998 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
999 "Run CSE pass after loop optimisations"},
1000 {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
1001 "Run the loop optimiser twice"},
1002 {"delete-null-pointer-checks", &flag_delete_null_pointer_checks, 1,
1003 "Delete useless null pointer checks" },
1004 {"pretend-float", &flag_pretend_float, 1,
1005 "Pretend that host and target use the same FP format"},
1006 {"schedule-insns", &flag_schedule_insns, 1,
1007 "Reschedule instructions to avoid pipeline stalls"},
1008 {"schedule-insns2", &flag_schedule_insns_after_reload, 1,
1009 "Run two passes of the instruction scheduler"},
1010 {"sched-interblock",&flag_schedule_interblock, 1,
1011 "Enable scheduling across basic blocks" },
1012 {"sched-spec",&flag_schedule_speculative, 1,
1013 "Allow speculative motion of non-loads" },
1014 {"sched-spec-load",&flag_schedule_speculative_load, 1,
1015 "Allow speculative motion of some loads" },
1016 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
1017 "Allow speculative motion of more loads" },
1018 {"branch-count-reg",&flag_branch_on_count_reg, 1,
1019 "Replace add,compare,branch with branch on count reg"},
1020 {"pic", &flag_pic, 1,
1021 "Generate position independent code, if possible"},
1022 {"PIC", &flag_pic, 2, ""},
1023 {"exceptions", &flag_exceptions, 1,
1024 "Enable exception handling" },
1025 {"new-exceptions", &flag_new_exceptions, 1,
1026 "Use the new model for exception handling" },
1027 {"unwind-tables", &flag_unwind_tables, 1,
1028 "Just generate unwind tables for exception handling" },
1029 {"sjlj-exceptions", &exceptions_via_longjmp, 1,
1030 "Use setjmp/longjmp to handle exceptions" },
1031 {"asynchronous-exceptions", &asynchronous_exceptions, 1,
1032 "Support asynchronous exceptions" },
1033 {"profile-arcs", &profile_arc_flag, 1,
1034 "Insert arc based program profiling code" },
1035 {"test-coverage", &flag_test_coverage, 1,
1036 "Create data files needed by gcov" },
1037 {"branch-probabilities", &flag_branch_probabilities, 1,
1038 "Use profiling information for branch probabilities" },
1039 {"reorder-blocks", &flag_reorder_blocks, 1,
1040 "Reorder basic blocks to improve code placement" },
1041 {"rename-registers", &flag_rename_registers, 1,
1042 "Do the register renaming optimization pass"},
1043 {"fast-math", &flag_fast_math, 1,
1044 "Improve FP speed by violating ANSI & IEEE rules" },
1045 {"common", &flag_no_common, 0,
1046 "Do not put unitialised globals in the common section" },
1047 {"inhibit-size-directive", &flag_inhibit_size_directive, 1,
1048 "Do not generate .size directives" },
1049 {"function-sections", &flag_function_sections, 1,
1050 "place each function into its own section" },
1051 {"data-sections", &flag_data_sections, 1,
1052 "place data items into their own section" },
1053 {"verbose-asm", &flag_verbose_asm, 1,
1054 "Add extra commentry to assembler output"},
1055 {"gnu-linker", &flag_gnu_linker, 1,
1056 "Output GNU ld formatted global initialisers"},
1057 {"regmove", &flag_regmove, 1,
1058 "Enables a register move optimisation"},
1059 {"optimize-register-move", &flag_regmove, 1,
1060 "Do the full regmove optimization pass"},
1061 {"pack-struct", &flag_pack_struct, 1,
1062 "Pack structure members together without holes" },
1063 {"stack-check", &flag_stack_check, 1,
1064 "Insert stack checking code into the program" },
1065 {"argument-alias", &flag_argument_noalias, 0,
1066 "Specify that arguments may alias each other & globals"},
1067 {"argument-noalias", &flag_argument_noalias, 1,
1068 "Assume arguments may alias globals but not each other"},
1069 {"argument-noalias-global", &flag_argument_noalias, 2,
1070 "Assume arguments do not alias each other or globals" },
1071 {"strict-aliasing", &flag_strict_aliasing, 1,
1072 "Assume strict aliasing rules apply" },
1073 {"align-loops", &align_loops, 0,
1074 "Align the start of loops" },
1075 {"align-jumps", &align_jumps, 0,
1076 "Align labels which are only reached by jumping" },
1077 {"align-labels", &align_labels, 0,
1078 "Align all labels" },
1079 {"align-functions", &align_functions, 0,
1080 "Align the start of functions" },
1081 {"check-memory-usage", &flag_check_memory_usage, 1,
1082 "Generate code to check every memory access" },
1083 {"prefix-function-name", &flag_prefix_function_name, 1,
1084 "Add a prefix to all function names" },
1085 {"dump-unnumbered", &flag_dump_unnumbered, 1,
1086 "Suppress output of instruction numbers and line number notes in debugging dumps"},
1087 {"instrument-functions", &flag_instrument_function_entry_exit, 1,
1088 "Instrument function entry/exit with profiling calls"},
1089 {"ssa", &flag_ssa, 1,
1090 "Enable SSA optimizations" },
1091 {"leading-underscore", &flag_leading_underscore, 1,
1092 "External symbols have a leading underscore" },
1093 {"ident", &flag_no_ident, 0,
1094 "Process #ident directives"},
1095 { "peephole2", &flag_peephole2, 1,
1096 "Enables an rtl peephole pass run before sched2" },
1097 {"math-errno", &flag_errno_math, 1,
1098 "Set errno after built-in math functions"},
1099 {"bounded-pointers", &flag_bounded_pointers, 1,
1100 "Compile pointers as triples: value, base & end" },
1101 {"bounds-check", &flag_bounds_check, 1,
1102 "Generate code to check bounds before dereferencing pointers and arrays" }
1105 #define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0]))
1107 /* Table of language-specific options. */
1109 static struct lang_opt
1111 const char * option;
1112 const char * description;
1114 documented_lang_options[] =
1116 /* In order not to overload the --help output, the convention
1117 used here is to only describe those options which are not
1118 enabled by default. */
1120 { "-ansi", "Compile just for ANSI C" },
1121 { "-fallow-single-precision",
1122 "Do not promote floats to double if using -traditional" },
1123 { "-std= ", "Determine language standard"},
1125 { "-fsigned-bitfields", "" },
1126 { "-funsigned-bitfields","Make bitfields by unsigned by default" },
1127 { "-fno-signed-bitfields", "" },
1128 { "-fno-unsigned-bitfields","" },
1129 { "-fsigned-char", "Make 'char' be signed by default"},
1130 { "-funsigned-char", "Make 'char' be unsigned by default"},
1131 { "-fno-signed-char", "" },
1132 { "-fno-unsigned-char", "" },
1134 { "-ftraditional", "" },
1135 { "-traditional", "Attempt to support traditional K&R style C"},
1136 { "-fnotraditional", "" },
1137 { "-fno-traditional", "" },
1140 { "-fno-asm", "Do not recognise the 'asm' keyword" },
1141 { "-fbuiltin", "" },
1142 { "-fno-builtin", "Do not recognise any built in functions" },
1143 { "-fhosted", "Assume normal C execution environment" },
1144 { "-fno-hosted", "" },
1146 "Assume that standard libraries & main might not exist" },
1147 { "-fno-freestanding", "" },
1148 { "-fcond-mismatch", "Allow different types as args of ? operator"},
1149 { "-fno-cond-mismatch", "" },
1150 { "-fdollars-in-identifiers", "Allow the use of $ inside identifiers" },
1151 { "-fno-dollars-in-identifiers", "" },
1152 { "-fpreprocessed", "" },
1153 { "-fno-preprocessed", "" },
1154 { "-fshort-double", "Use the same size for double as for float" },
1155 { "-fno-short-double", "" },
1156 { "-fshort-enums", "Use the smallest fitting integer to hold enums"},
1157 { "-fno-short-enums", "" },
1158 { "-fshort-wchar", "Override the underlying type for wchar_t to `unsigned short'" },
1159 { "-fno-short-wchar", "" },
1161 { "-Wall", "Enable most warning messages" },
1162 { "-Wbad-function-cast",
1163 "Warn about casting functions to incompatible types" },
1164 { "-Wno-bad-function-cast", "" },
1165 { "-Wmissing-noreturn",
1166 "Warn about functions which might be candidates for attribute noreturn" },
1167 { "-Wno-missing-noreturn", "" },
1168 { "-Wcast-qual", "Warn about casts which discard qualifiers"},
1169 { "-Wno-cast-qual", "" },
1170 { "-Wchar-subscripts", "Warn about subscripts whose type is 'char'"},
1171 { "-Wno-char-subscripts", "" },
1172 { "-Wcomment", "Warn if nested comments are detected" },
1173 { "-Wno-comment", "" },
1174 { "-Wcomments", "Warn if nested comments are detected" },
1175 { "-Wno-comments", "" },
1176 { "-Wconversion", "Warn about possibly confusing type conversions" },
1177 { "-Wno-conversion", "" },
1178 { "-Wformat", "Warn about printf format anomalies" },
1179 { "-Wno-format", "" },
1180 { "-Wimplicit-function-declaration",
1181 "Warn about implicit function declarations" },
1182 { "-Wno-implicit-function-declaration", "" },
1183 { "-Werror-implicit-function-declaration", "" },
1184 { "-Wimplicit-int", "Warn when a declaration does not specify a type" },
1185 { "-Wno-implicit-int", "" },
1186 { "-Wimplicit", "" },
1187 { "-Wno-implicit", "" },
1188 { "-Wimport", "Warn about the use of the #import directive" },
1189 { "-Wno-import", "" },
1190 { "-Wlong-long","" },
1191 { "-Wno-long-long", "Do not warn about using 'long long' when -pedantic" },
1192 { "-Wmain", "Warn about suspicious declarations of main" },
1193 { "-Wno-main", "" },
1194 { "-Wmissing-braces",
1195 "Warn about possibly missing braces around initialisers" },
1196 { "-Wno-missing-braces", "" },
1197 { "-Wmissing-declarations",
1198 "Warn about global funcs without previous declarations"},
1199 { "-Wno-missing-declarations", "" },
1200 { "-Wmissing-prototypes", "Warn about global funcs without prototypes" },
1201 { "-Wno-missing-prototypes", "" },
1202 { "-Wmultichar", "Warn about use of multicharacter literals"},
1203 { "-Wno-multichar", "" },
1204 { "-Wnested-externs", "Warn about externs not at file scope level" },
1205 { "-Wno-nested-externs", "" },
1206 { "-Wparentheses", "Warn about possible missing parentheses" },
1207 { "-Wno-parentheses", "" },
1208 { "-Wpointer-arith", "Warn about function pointer arithmetic" },
1209 { "-Wno-pointer-arith", "" },
1210 { "-Wredundant-decls",
1211 "Warn about multiple declarations of the same object" },
1212 { "-Wno-redundant-decls", "" },
1213 { "-Wsign-compare", "Warn about signed/unsigned comparisons" },
1214 { "-Wno-sign-compare", "" },
1215 { "-Wfloat-equal", "Warn about testing equality of floating point numbers" },
1216 { "-Wno-float-equal", "" },
1217 { "-Wunknown-pragmas", "Warn about unrecognized pragmas" },
1218 { "-Wno-unknown-pragmas", "" },
1219 { "-Wstrict-prototypes", "Warn about non-prototyped function decls" },
1220 { "-Wno-strict-prototypes", "" },
1221 { "-Wtraditional", "Warn about constructs whose meaning change in ANSI C"},
1222 { "-Wno-traditional", "" },
1223 { "-Wtrigraphs", "Warn when trigraphs are encountered" },
1224 { "-Wno-trigraphs", "" },
1226 { "-Wno-undef", "" },
1227 { "-Wwrite-strings", "Mark strings as 'const char *'"},
1228 { "-Wno-write-strings", "" },
1230 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1232 /* These are for Objective C. */
1233 DEFINE_LANG_NAME ("Objective C")
1235 { "-lang-objc", "" },
1236 { "-gen-decls", "Dump decls to a .decl file" },
1237 { "-fgnu-runtime", "Generate code for GNU runtime environment" },
1238 { "-fno-gnu-runtime", "" },
1239 { "-fnext-runtime", "Generate code for NeXT runtime environment" },
1240 { "-fno-next-runtime", "" },
1241 { "-Wselector", "Warn if a selector has multiple methods" },
1242 { "-Wno-selector", "" },
1243 { "-Wprotocol", "" },
1244 { "-Wno-protocol", "Do not warn if inherited methods are unimplemented"},
1245 { "-print-objc-runtime-info",
1246 "Generate C header of platform specific features" },
1248 #include "options.h"
1252 /* Here is a table, controlled by the tm.h file, listing each -m switch
1253 and which bits in `target_switches' it should set or clear.
1254 If VALUE is positive, it is bits to set.
1255 If VALUE is negative, -VALUE is bits to clear.
1256 (The sign bit is not used so there is no confusion.) */
1262 const char * description;
1264 target_switches [] = TARGET_SWITCHES;
1266 /* This table is similar, but allows the switch to have a value. */
1268 #ifdef TARGET_OPTIONS
1271 const char * prefix;
1272 const char ** variable;
1273 const char * description;
1275 target_options [] = TARGET_OPTIONS;
1278 /* Options controlling warnings */
1280 /* Don't print warning messages. -w. */
1282 int inhibit_warnings = 0;
1284 /* Print various extra warnings. -W. */
1286 int extra_warnings = 0;
1288 /* Treat warnings as errors. -Werror. */
1290 int warnings_are_errors = 0;
1292 /* Nonzero to warn about unused variables, functions et.al. */
1294 int warn_unused_function;
1295 int warn_unused_label;
1296 int warn_unused_parameter;
1297 int warn_unused_variable;
1298 int warn_unused_value;
1301 set_Wunused (setting)
1304 warn_unused_function = setting;
1305 warn_unused_label = setting;
1306 /* Unused function parameter warnings are reported when either ``-W
1307 -Wunused'' or ``-Wunused-parameter'' is specified. Differentiate
1308 -Wunused by setting WARN_UNUSED_PARAMETER to -1 */
1310 warn_unused_parameter = 0;
1311 else if (!warn_unused_parameter)
1312 warn_unused_parameter = -1;
1313 warn_unused_variable = setting;
1314 warn_unused_value = setting;
1317 /* Nonzero to warn about code which is never reached. */
1319 int warn_notreached;
1321 /* Nonzero to warn about variables used before they are initialized. */
1323 int warn_uninitialized;
1325 /* Nonzero means warn about all declarations which shadow others. */
1329 /* Warn if a switch on an enum fails to have a case for every enum value. */
1333 /* Nonzero means warn about function definitions that default the return type
1334 or that use a null return and have a return-type other than void. */
1336 int warn_return_type;
1338 /* Nonzero means warn about pointer casts that increase the required
1339 alignment of the target type (and might therefore lead to a crash
1340 due to a misaligned access). */
1342 int warn_cast_align;
1344 /* Nonzero means warn about any identifiers that match in the first N
1345 characters. The value N is in `id_clash_len'. */
1350 /* Nonzero means warn about any objects definitions whose size is larger
1351 than N bytes. Also want about function definitions whose returned
1352 values are larger than N bytes. The value N is in `larger_than_size'. */
1354 int warn_larger_than;
1355 HOST_WIDE_INT larger_than_size;
1357 /* Nonzero means warn if inline function is too large. */
1361 /* Warn if a function returns an aggregate,
1362 since there are often incompatible calling conventions for doing this. */
1364 int warn_aggregate_return;
1366 /* Warn if packed attribute on struct is unnecessary and inefficient. */
1370 /* Warn when gcc pads a structure to an alignment boundary. */
1374 /* Likewise for -W. */
1376 lang_independent_options W_options[] =
1378 {"unused-function", &warn_unused_function, 1, "Warn when a function is unused" },
1379 {"unused-label", &warn_unused_label, 1, "Warn when a label is unused" },
1380 {"unused-parameter", &warn_unused_parameter, 1, "Warn when a function parameter is unused" },
1381 {"unused-variable", &warn_unused_variable, 1, "Warn when a variable is unused" },
1382 {"unused-value", &warn_unused_value, 1, "Warn when an expression value is unused" },
1383 {"error", &warnings_are_errors, 1, ""},
1384 {"shadow", &warn_shadow, 1, "Warn when one local variable shadows another" },
1385 {"switch", &warn_switch, 1,
1386 "Warn about enumerated switches missing a specific case" },
1387 {"aggregate-return", &warn_aggregate_return, 1,
1388 "Warn about returning structures, unions or arrays" },
1389 {"cast-align", &warn_cast_align, 1,
1390 "Warn about pointer casts which increase alignment" },
1391 {"unreachable-code", &warn_notreached, 1,
1392 "Warn about code that will never be executed" },
1393 {"uninitialized", &warn_uninitialized, 1,
1394 "Warn about unitialized automatic variables"},
1395 {"inline", &warn_inline, 1,
1396 "Warn when an inlined function cannot be inlined"},
1397 {"packed", &warn_packed, 1,
1398 "Warn when the packed attribute has no effect on struct layout"},
1399 {"padded", &warn_padded, 1,
1400 "Warn when padding is required to align struct members"}
1403 /* Output files for assembler code (real compiler output)
1404 and debugging dumps. */
1407 FILE *aux_info_file;
1408 FILE *rtl_dump_file = NULL;
1410 /* Decode the string P as an integral parameter.
1411 If the string is indeed an integer return its numeric value else
1412 issue an Invalid Option error for the option PNAME and return DEFVAL.
1413 If PNAME is zero just return DEFVAL, do not call error. */
1416 read_integral_parameter (p, pname, defval)
1421 const char *endp = p;
1425 if (*endp >= '0' && *endp <= '9')
1434 error ("Invalid option `%s'", pname);
1442 /* This is the default decl_printable_name function. */
1445 decl_name (decl, verbosity)
1447 int verbosity ATTRIBUTE_UNUSED;
1449 return IDENTIFIER_POINTER (DECL_NAME (decl));
1452 /* Mark P for GC. Also mark main_input_filename and input_filename. */
1458 struct file_stack *stack = *(struct file_stack **)p;
1460 /* We're only called for input_file_stack, so we can mark the current
1461 input_filename here as well. */
1462 ggc_mark_string (main_input_filename);
1463 ggc_mark_string (input_filename);
1467 ggc_mark_string (stack->name);
1468 stack = stack->next;
1473 /* This calls abort and is used to avoid problems when abort if a macro.
1474 It is used when we need to pass the address of abort. */
1482 /* When `malloc.c' is compiled with `rcheck' defined,
1483 it calls this function to report clobberage. */
1487 const char * s ATTRIBUTE_UNUSED;
1492 /* Return the logarithm of X, base 2, considering X unsigned,
1493 if X is a power of 2. Otherwise, returns -1.
1495 This should be used via the `exact_log2' macro. */
1499 register unsigned HOST_WIDE_INT x;
1501 register int log = 0;
1502 /* Test for 0 or a power of 2. */
1503 if (x == 0 || x != (x & -x))
1505 while ((x >>= 1) != 0)
1510 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1511 If X is 0, return -1.
1513 This should be used via the floor_log2 macro. */
1517 register unsigned HOST_WIDE_INT x;
1519 register int log = -1;
1526 static int float_handler_set;
1528 jmp_buf float_handler;
1530 /* Signals actually come here. */
1533 float_signal (signo)
1534 /* If this is missing, some compilers complain. */
1535 int signo ATTRIBUTE_UNUSED;
1537 if (float_handled == 0)
1539 #if defined (USG) || defined (hpux)
1540 signal (SIGFPE, float_signal); /* re-enable the signal catcher */
1543 signal (SIGFPE, float_signal);
1544 longjmp (float_handler, 1);
1547 /* Specify where to longjmp to when a floating arithmetic error happens.
1548 If HANDLER is 0, it means don't handle the errors any more. */
1551 set_float_handler (handler)
1554 float_handled = (handler != 0);
1556 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1558 if (float_handled && ! float_handler_set)
1560 signal (SIGFPE, float_signal);
1561 float_handler_set = 1;
1565 /* This is a wrapper function for code which might elicit an
1566 arithmetic exception. That code should be passed in as a function
1567 pointer FN, and one argument DATA. DATA is usually a struct which
1568 contains the real input and output for function FN. This function
1569 returns 0 (failure) if longjmp was called (i.e. an exception
1570 occured.) It returns 1 (success) otherwise. */
1573 do_float_handler (fn, data)
1574 void (*fn) PARAMS ((PTR));
1581 /* We got here via longjmp() caused by an exception in function fn() */
1582 set_float_handler (NULL);
1586 set_float_handler (buf);
1588 set_float_handler (NULL);
1592 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1593 error happens, pushing the previous specification into OLD_HANDLER.
1594 Return an indication of whether there was a previous handler in effect. */
1597 push_float_handler (handler, old_handler)
1598 jmp_buf handler, old_handler;
1600 int was_handled = float_handled;
1604 memcpy ((char *) old_handler, (char *) float_handler,
1605 sizeof (float_handler));
1607 memcpy ((char *) float_handler, (char *) handler, sizeof (float_handler));
1611 /* Restore the previous specification of whether and where to longjmp to
1612 when a floating arithmetic error happens. */
1615 pop_float_handler (handled, handler)
1619 float_handled = handled;
1621 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1624 /* Handler for SIGPIPE. */
1628 /* If this is missing, some compilers complain. */
1629 int signo ATTRIBUTE_UNUSED;
1631 fatal ("output pipe has been closed");
1634 /* Strip off a legitimate source ending from the input string NAME of
1635 length LEN. Rather than having to know the names used by all of
1636 our front ends, we strip off an ending of a period followed by
1637 up to five characters. (Java uses ".class".) */
1640 strip_off_ending (name, len)
1645 for (i = 2; i < 6 && len > i; i++)
1647 if (name[len - i] == '.')
1649 name[len - i] = '\0';
1655 /* Output a quoted string. */
1658 output_quoted_string (asm_file, string)
1662 #ifdef OUTPUT_QUOTED_STRING
1663 OUTPUT_QUOTED_STRING (asm_file, string);
1667 putc ('\"', asm_file);
1668 while ((c = *string++) != 0)
1670 if (c == '\"' || c == '\\')
1671 putc ('\\', asm_file);
1674 putc ('\"', asm_file);
1678 /* Output a file name in the form wanted by System V. */
1681 output_file_directive (asm_file, input_name)
1683 const char *input_name;
1685 int len = strlen (input_name);
1686 const char *na = input_name + len;
1688 /* NA gets INPUT_NAME sans directory names. */
1689 while (na > input_name)
1691 if (IS_DIR_SEPARATOR (na[-1]))
1696 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1697 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1699 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1700 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1702 fprintf (asm_file, "\t.file\t");
1703 output_quoted_string (asm_file, na);
1704 fputc ('\n', asm_file);
1709 #ifdef ASM_IDENTIFY_LANGUAGE
1710 /* Routine to build language identifier for object file. */
1712 output_lang_identify (asm_out_file)
1715 int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1716 char *s = (char *) alloca (len);
1717 sprintf (s, "__gnu_compiled_%s", lang_identify ());
1718 ASM_OUTPUT_LABEL (asm_out_file, s);
1722 /* Routine to open a dump file. Return true if the dump file is enabled. */
1725 open_dump_file (index, decl)
1726 enum dump_file_index index;
1730 const char *open_arg;
1733 if (! dump_file[index].enabled)
1736 timevar_push (TV_DUMP);
1737 if (rtl_dump_file != NULL)
1738 fclose (rtl_dump_file);
1740 sprintf (seq, ".%02d.", index);
1742 if (! dump_file[index].initialized)
1744 /* If we've not initialized the files, do so now. */
1745 if (graph_dump_format != no_graph
1746 && dump_file[index].graph_dump_p)
1748 dump_name = concat (seq, dump_file[index].extension, NULL);
1749 clean_graph_dump_file (dump_base_name, dump_name);
1752 dump_file[index].initialized = 1;
1758 dump_name = concat (dump_base_name, seq,
1759 dump_file[index].extension, NULL);
1761 rtl_dump_file = fopen (dump_name, open_arg);
1762 if (rtl_dump_file == NULL)
1763 pfatal_with_name (dump_name);
1768 fprintf (rtl_dump_file, "\n;; Function %s\n\n",
1769 decl_printable_name (decl, 2));
1771 timevar_pop (TV_DUMP);
1775 /* Routine to close a dump file. */
1778 close_dump_file (index, func, insns)
1779 enum dump_file_index index;
1780 void (*func) PARAMS ((FILE *, rtx));
1783 if (! rtl_dump_file)
1786 timevar_push (TV_DUMP);
1788 && graph_dump_format != no_graph
1789 && dump_file[index].graph_dump_p)
1794 sprintf (seq, ".%02d.", index);
1795 suffix = concat (seq, dump_file[index].extension, NULL);
1796 print_rtl_graph_with_bb (dump_base_name, suffix, insns);
1801 func (rtl_dump_file, insns);
1803 fflush (rtl_dump_file);
1804 fclose (rtl_dump_file);
1806 rtl_dump_file = NULL;
1807 timevar_pop (TV_DUMP);
1810 /* Do any final processing required for the declarations in VEC, of
1811 which there are LEN. We write out inline functions and variables
1812 that have been deferred until this point, but which are required.
1813 Returns non-zero if anything was put out. */
1815 wrapup_global_declarations (vec, len)
1822 int output_something = 0;
1824 for (i = 0; i < len; i++)
1828 /* We're not deferring this any longer. */
1829 DECL_DEFER_OUTPUT (decl) = 0;
1831 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
1832 && incomplete_decl_finalize_hook != 0)
1833 (*incomplete_decl_finalize_hook) (decl);
1836 /* Now emit any global variables or functions that we have been
1837 putting off. We need to loop in case one of the things emitted
1838 here references another one which comes earlier in the list. */
1842 for (i = 0; i < len; i++)
1846 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
1849 /* Don't write out static consts, unless we still need them.
1851 We also keep static consts if not optimizing (for debugging),
1852 unless the user specified -fno-keep-static-consts.
1853 ??? They might be better written into the debug information.
1854 This is possible when using DWARF.
1856 A language processor that wants static constants to be always
1857 written out (even if it is not used) is responsible for
1858 calling rest_of_decl_compilation itself. E.g. the C front-end
1859 calls rest_of_decl_compilation from finish_decl.
1860 One motivation for this is that is conventional in some
1861 environments to write things like:
1862 static const char rcsid[] = "... version string ...";
1863 intending to force the string to be in the executable.
1865 A language processor that would prefer to have unneeded
1866 static constants "optimized away" would just defer writing
1867 them out until here. E.g. C++ does this, because static
1868 constants are often defined in header files.
1870 ??? A tempting alternative (for both C and C++) would be
1871 to force a constant to be written if and only if it is
1872 defined in a main file, as opposed to an include file. */
1874 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1875 && (! TREE_READONLY (decl)
1876 || TREE_PUBLIC (decl)
1877 || (!optimize && flag_keep_static_consts)
1878 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1881 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
1884 if (TREE_CODE (decl) == FUNCTION_DECL
1885 && DECL_INITIAL (decl) != 0
1886 && DECL_SAVED_INSNS (decl) != 0
1887 && (flag_keep_inline_functions
1888 || (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
1889 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1892 temporary_allocation ();
1893 output_inline_function (decl);
1894 permanent_allocation (1);
1899 output_something = 1;
1903 return output_something;
1906 /* Issue appropriate warnings for the global declarations in VEC (of
1907 which there are LEN). Output debugging information for them. */
1909 check_global_declarations (vec, len)
1916 for (i = 0; i < len; i++)
1920 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1921 && ! TREE_ASM_WRITTEN (decl))
1922 /* Cancel the RTL for this decl so that, if debugging info
1923 output for global variables is still to come,
1924 this one will be omitted. */
1925 DECL_RTL (decl) = NULL;
1927 /* Warn about any function
1928 declared static but not defined.
1929 We don't warn about variables,
1930 because many programs have static variables
1931 that exist only to get some text into the object file. */
1932 if (TREE_CODE (decl) == FUNCTION_DECL
1933 && (warn_unused_function
1934 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
1935 && DECL_INITIAL (decl) == 0
1936 && DECL_EXTERNAL (decl)
1937 && ! DECL_ARTIFICIAL (decl)
1938 && ! TREE_PUBLIC (decl))
1940 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
1941 pedwarn_with_decl (decl,
1942 "`%s' used but never defined");
1944 warning_with_decl (decl,
1945 "`%s' declared `static' but never defined");
1946 /* This symbol is effectively an "extern" declaration now. */
1947 TREE_PUBLIC (decl) = 1;
1948 assemble_external (decl);
1951 /* Warn about static fns or vars defined but not used,
1952 but not about inline functions or static consts
1953 since defining those in header files is normal practice. */
1954 if (((warn_unused_function
1955 && TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
1956 || (warn_unused_variable
1957 && TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
1958 && ! DECL_IN_SYSTEM_HEADER (decl)
1959 && ! DECL_EXTERNAL (decl)
1960 && ! TREE_PUBLIC (decl)
1961 && ! TREE_USED (decl)
1962 && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
1963 /* The TREE_USED bit for file-scope decls
1964 is kept in the identifier, to handle multiple
1965 external decls in different scopes. */
1966 && ! TREE_USED (DECL_NAME (decl)))
1967 warning_with_decl (decl, "`%s' defined but not used");
1969 timevar_push (TV_SYMOUT);
1970 #ifdef SDB_DEBUGGING_INFO
1971 /* The COFF linker can move initialized global vars to the end.
1972 And that can screw up the symbol ordering.
1973 By putting the symbols in that order to begin with,
1974 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
1975 if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
1976 && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
1977 && ! DECL_EXTERNAL (decl)
1978 && DECL_RTL (decl) != 0)
1979 sdbout_symbol (decl, 0);
1981 /* Output COFF information for non-global
1982 file-scope initialized variables. */
1983 if (write_symbols == SDB_DEBUG
1984 && TREE_CODE (decl) == VAR_DECL
1985 && DECL_INITIAL (decl)
1986 && ! DECL_EXTERNAL (decl)
1987 && DECL_RTL (decl) != 0
1988 && GET_CODE (DECL_RTL (decl)) == MEM)
1989 sdbout_toplevel_data (decl);
1990 #endif /* SDB_DEBUGGING_INFO */
1991 #ifdef DWARF_DEBUGGING_INFO
1992 /* Output DWARF information for file-scope tentative data object
1993 declarations, file-scope (extern) function declarations (which
1994 had no corresponding body) and file-scope tagged type declarations
1995 and definitions which have not yet been forced out. */
1997 if (write_symbols == DWARF_DEBUG
1998 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
1999 dwarfout_file_scope_decl (decl, 1);
2001 #ifdef DWARF2_DEBUGGING_INFO
2002 /* Output DWARF2 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 == DWARF2_DEBUG
2008 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2009 dwarf2out_decl (decl);
2011 timevar_pop (TV_SYMOUT);
2015 /* Save the current INPUT_FILENAME and LINENO on the top entry in the
2016 INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
2017 INPUT_FILENAME and LINENO accordingly. */
2020 push_srcloc (file, line)
2024 struct file_stack *fs;
2026 if (input_file_stack)
2028 input_file_stack->name = input_filename;
2029 input_file_stack->line = lineno;
2032 fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2033 fs->name = input_filename = file;
2034 fs->line = lineno = line;
2035 fs->indent_level = 0;
2036 fs->next = input_file_stack;
2037 input_file_stack = fs;
2038 input_file_stack_tick++;
2041 /* Pop the top entry off the stack of presently open source files.
2042 Restore the INPUT_FILENAME and LINENO from the new topmost entry on
2048 struct file_stack *fs;
2050 fs = input_file_stack;
2051 input_file_stack = fs->next;
2053 input_file_stack_tick++;
2054 /* The initial souce file is never popped. */
2055 if (!input_file_stack)
2057 input_filename = input_file_stack->name;
2058 lineno = input_file_stack->line;
2061 /* Compile an entire file of output from cpp, named NAME.
2062 Write a file of assembly output and various debugging dumps. */
2070 int name_specified = name != 0;
2072 if (dump_base_name == 0)
2073 dump_base_name = name ? name : "gccdump";
2075 /* Start timing total execution time. */
2078 timevar_start (TV_TOTAL);
2080 /* Initialize data in various passes. */
2084 name = init_parse (name);
2085 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
2086 || debug_info_level == DINFO_LEVEL_VERBOSE
2087 || flag_test_coverage
2088 || warn_notreached);
2090 init_decl_processing ();
2097 init_function_once ();
2098 init_stor_layout_once ();
2099 init_varasm_once ();
2101 /* The following initialization functions need to generate rtl, so
2102 provide a dummy function context for them. */
2103 init_dummy_function_start ();
2106 if (flag_caller_saves)
2107 init_caller_save ();
2108 expand_dummy_function_end ();
2110 /* If auxiliary info generation is desired, open the output file.
2111 This goes in the same directory as the source file--unlike
2112 all the other output files. */
2113 if (flag_gen_aux_info)
2115 aux_info_file = fopen (aux_info_file_name, "w");
2116 if (aux_info_file == 0)
2117 pfatal_with_name (aux_info_file_name);
2120 /* Open assembler code output file. */
2122 if (flag_syntax_only)
2123 asm_out_file = NULL;
2126 if (! name_specified && asm_file_name == 0)
2127 asm_out_file = stdout;
2130 if (asm_file_name == 0)
2132 int len = strlen (dump_base_name);
2133 char *dumpname = (char *) xmalloc (len + 6);
2134 memcpy (dumpname, dump_base_name, len + 1);
2135 strip_off_ending (dumpname, len);
2136 strcat (dumpname, ".s");
2137 asm_file_name = dumpname;
2139 if (!strcmp (asm_file_name, "-"))
2140 asm_out_file = stdout;
2142 asm_out_file = fopen (asm_file_name, "w");
2143 if (asm_out_file == 0)
2144 pfatal_with_name (asm_file_name);
2147 #ifdef IO_BUFFER_SIZE
2148 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
2149 _IOFBF, IO_BUFFER_SIZE);
2153 if (ggc_p && name != 0)
2154 name = ggc_alloc_string (name, strlen (name));
2156 input_filename = name;
2158 /* Put an entry on the input file stack for the main input file. */
2159 push_srcloc (input_filename, 0);
2161 /* Perform language-specific initialization.
2162 This may set main_input_filename. */
2165 /* If the input doesn't start with a #line, use the input name
2166 as the official input file name. */
2167 if (main_input_filename == 0)
2168 main_input_filename = name;
2170 if (flag_syntax_only)
2172 write_symbols = NO_DEBUG;
2174 profile_block_flag = 0;
2178 ASM_FILE_START (asm_out_file);
2180 #ifdef ASM_COMMENT_START
2181 if (flag_verbose_asm)
2183 /* Print the list of options in effect. */
2184 print_version (asm_out_file, ASM_COMMENT_START);
2185 print_switch_values (asm_out_file, 0, MAX_LINE,
2186 ASM_COMMENT_START, " ", "\n");
2187 /* Add a blank line here so it appears in assembler output but not
2189 fprintf (asm_out_file, "\n");
2193 /* Output something to inform GDB that this compilation was by GCC. */
2194 #ifndef ASM_IDENTIFY_GCC
2195 fprintf (asm_out_file, "gcc2_compiled.:\n");
2197 ASM_IDENTIFY_GCC (asm_out_file);
2200 /* Output something to identify which front-end produced this file. */
2201 #ifdef ASM_IDENTIFY_LANGUAGE
2202 ASM_IDENTIFY_LANGUAGE (asm_out_file);
2204 } /* ! flag_syntax_only */
2206 #ifndef ASM_OUTPUT_SECTION_NAME
2207 if (flag_function_sections)
2209 warning ("-ffunction-sections not supported for this target.");
2210 flag_function_sections = 0;
2212 if (flag_data_sections)
2214 warning ("-fdata-sections not supported for this target.");
2215 flag_data_sections = 0;
2219 if (flag_function_sections
2220 && (profile_flag || profile_block_flag))
2222 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2223 flag_function_sections = 0;
2226 #ifndef OBJECT_FORMAT_ELF
2227 if (flag_function_sections && write_symbols != NO_DEBUG)
2228 warning ("-ffunction-sections may affect debugging on some targets.");
2231 /* ??? Note: There used to be a conditional here
2232 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2233 This was to guarantee separation between gcc_compiled. and
2234 the first function, for the sake of dbx on Suns.
2235 However, having the extra zero here confused the Emacs
2236 code for unexec, and might confuse other programs too.
2237 Therefore, I took out that change.
2238 In future versions we should find another way to solve
2239 that dbx problem. -- rms, 23 May 93. */
2241 /* Don't let the first function fall at the same address
2242 as gcc_compiled., if profiling. */
2243 if (profile_flag || profile_block_flag)
2245 /* It's best if we can write a nop here since some
2246 assemblers don't tolerate zeros in the text section. */
2247 output_asm_insn (get_insn_template (CODE_FOR_nop, NULL), NULL_PTR);
2250 /* If dbx symbol table desired, initialize writing it
2251 and output the predefined types. */
2252 timevar_push (TV_SYMOUT);
2253 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2254 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2255 dbxout_init (asm_out_file, main_input_filename, getdecls ());
2257 #ifdef SDB_DEBUGGING_INFO
2258 if (write_symbols == SDB_DEBUG)
2259 sdbout_init (asm_out_file, main_input_filename, getdecls ());
2261 #ifdef DWARF_DEBUGGING_INFO
2262 if (write_symbols == DWARF_DEBUG)
2263 dwarfout_init (asm_out_file, main_input_filename);
2265 #ifdef DWARF2_UNWIND_INFO
2266 if (dwarf2out_do_frame ())
2267 dwarf2out_frame_init ();
2269 #ifdef DWARF2_DEBUGGING_INFO
2270 if (write_symbols == DWARF2_DEBUG)
2271 dwarf2out_init (asm_out_file, main_input_filename);
2273 timevar_pop (TV_SYMOUT);
2275 /* Initialize yet another pass. */
2277 init_final (main_input_filename);
2278 init_branch_prob (dump_base_name);
2280 timevar_push (TV_PARSE);
2282 /* Call the parser, which parses the entire file
2283 (calling rest_of_compilation for each function). */
2285 if (yyparse () != 0)
2287 if (errorcount == 0)
2288 fnotice (stderr, "Errors detected in input file (your bison.simple is out of date)\n");
2290 /* In case there were missing closebraces,
2291 get us back to the global binding level. */
2292 while (! global_bindings_p ())
2296 /* Compilation is now finished except for writing
2297 what's left of the symbol table output. */
2299 timevar_pop (TV_PARSE);
2301 if (flag_syntax_only)
2304 globals = getdecls ();
2306 /* Really define vars that have had only a tentative definition.
2307 Really output inline functions that must actually be callable
2308 and have not been output so far. */
2311 int len = list_length (globals);
2312 tree *vec = (tree *) xmalloc (sizeof (tree) * len);
2316 /* Process the decls in reverse order--earliest first.
2317 Put them into VEC from back to front, then take out from front. */
2319 for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
2320 vec[len - i - 1] = decl;
2322 wrapup_global_declarations (vec, len);
2324 /* This must occur after the loop to output deferred functions. Else
2325 the profiler initializer would not be emitted if all the functions
2326 in this compilation unit were deferred.
2328 output_func_start_profiler can not cause any additional functions or
2329 data to need to be output, so it need not be in the deferred function
2331 output_func_start_profiler ();
2333 /* Now that all possible functions have been output, we can dump
2334 the exception table. */
2336 output_exception_table ();
2338 check_global_declarations (vec, len);
2344 /* Write out any pending weak symbol declarations. */
2348 /* Do dbx symbols */
2349 timevar_push (TV_SYMOUT);
2350 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2351 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2352 dbxout_finish (asm_out_file, main_input_filename);
2355 #ifdef DWARF_DEBUGGING_INFO
2356 if (write_symbols == DWARF_DEBUG)
2360 #ifdef DWARF2_UNWIND_INFO
2361 if (dwarf2out_do_frame ())
2362 dwarf2out_frame_finish ();
2365 #ifdef DWARF2_DEBUGGING_INFO
2366 if (write_symbols == DWARF2_DEBUG)
2367 dwarf2out_finish ();
2369 timevar_pop (TV_SYMOUT);
2371 /* Output some stuff at end of file if nec. */
2373 end_final (dump_base_name);
2375 if (flag_test_coverage || flag_branch_probabilities)
2377 timevar_push (TV_DUMP);
2378 open_dump_file (DFI_bp, NULL);
2379 end_branch_prob (rtl_dump_file);
2380 close_dump_file (DFI_bp, NULL, NULL_RTX);
2381 timevar_pop (TV_DUMP);
2385 ASM_FILE_END (asm_out_file);
2388 /* Language-specific end of compilation actions. */
2392 /* Close the dump files. */
2394 if (flag_gen_aux_info)
2396 fclose (aux_info_file);
2398 unlink (aux_info_file_name);
2401 if (optimize > 0 && open_dump_file (DFI_combine, NULL))
2403 timevar_push (TV_DUMP);
2404 dump_combine_total_stats (rtl_dump_file);
2405 close_dump_file (DFI_combine, NULL, NULL_RTX);
2406 timevar_pop (TV_DUMP);
2409 /* Close non-debugging input and output files. Take special care to note
2410 whether fclose returns an error, since the pages might still be on the
2411 buffer chain while the file is open. */
2415 if (! flag_syntax_only
2416 && (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0))
2417 fatal_io_error (asm_file_name);
2419 /* Do whatever is necessary to finish printing the graphs. */
2420 if (graph_dump_format != no_graph)
2424 for (i = 0; i < DFI_MAX; ++i)
2425 if (dump_file[i].initialized && dump_file[i].graph_dump_p)
2430 sprintf (seq, ".%02d.", i);
2431 suffix = concat (seq, dump_file[i].extension, NULL);
2432 finish_graph_dump_file (dump_base_name, suffix);
2437 /* Free up memory for the benefit of leak detectors. */
2440 /* Stop timing total execution time. */
2441 timevar_stop (TV_TOTAL);
2443 /* Print the times. */
2446 timevar_print (stderr);
2449 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2450 and TYPE_DECL nodes.
2452 This does nothing for local (non-static) variables, unless the
2453 variable is a register variable with an ASMSPEC. In that case, or
2454 if the variable is not an automatice, it sets up the RTL and
2455 outputs any assembler code (label definition, storage allocation
2456 and initialization).
2458 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2459 the assembler symbol name to be used. TOP_LEVEL is nonzero
2460 if this declaration is not within a function. */
2463 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2465 const char *asmspec;
2469 /* Declarations of variables, and of functions defined elsewhere. */
2471 /* The most obvious approach, to put an #ifndef around where
2472 this macro is used, doesn't work since it's inside a macro call. */
2473 #ifndef ASM_FINISH_DECLARE_OBJECT
2474 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2477 /* Forward declarations for nested functions are not "external",
2478 but we need to treat them as if they were. */
2479 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2480 || TREE_CODE (decl) == FUNCTION_DECL)
2482 timevar_push (TV_VARCONST);
2483 make_decl_rtl (decl, asmspec, top_level);
2484 /* Initialized extern variable exists to be replaced
2485 with its value, or represents something that will be
2486 output in another file. */
2487 if (! (TREE_CODE (decl) == VAR_DECL
2488 && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
2489 && DECL_INITIAL (decl) != 0
2490 && DECL_INITIAL (decl) != error_mark_node))
2491 /* Don't output anything
2492 when a tentative file-scope definition is seen.
2493 But at end of compilation, do output code for them. */
2494 if (! (! at_end && top_level
2495 && (DECL_INITIAL (decl) == 0
2496 || DECL_INITIAL (decl) == error_mark_node)))
2497 assemble_variable (decl, top_level, at_end, 0);
2498 if (decl == last_assemble_variable_decl)
2500 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2503 timevar_pop (TV_VARCONST);
2505 else if (DECL_REGISTER (decl) && asmspec != 0)
2507 if (decode_reg_name (asmspec) >= 0)
2509 DECL_RTL (decl) = 0;
2510 make_decl_rtl (decl, asmspec, top_level);
2513 error ("invalid register name `%s' for register variable", asmspec);
2515 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2516 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2517 && TREE_CODE (decl) == TYPE_DECL)
2519 timevar_push (TV_SYMOUT);
2520 dbxout_symbol (decl, 0);
2521 timevar_pop (TV_SYMOUT);
2524 #ifdef SDB_DEBUGGING_INFO
2525 else if (write_symbols == SDB_DEBUG && top_level
2526 && TREE_CODE (decl) == TYPE_DECL)
2528 timevar_push (TV_SYMOUT);
2529 sdbout_symbol (decl, 0);
2530 timevar_pop (TV_SYMOUT);
2535 /* Called after finishing a record, union or enumeral type. */
2538 rest_of_type_compilation (type, toplev)
2539 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
2543 tree type ATTRIBUTE_UNUSED;
2544 int toplev ATTRIBUTE_UNUSED;
2547 timevar_push (TV_SYMOUT);
2548 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2549 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2550 dbxout_symbol (TYPE_STUB_DECL (type), !toplev);
2552 #ifdef SDB_DEBUGGING_INFO
2553 if (write_symbols == SDB_DEBUG)
2554 sdbout_symbol (TYPE_STUB_DECL (type), !toplev);
2556 timevar_pop (TV_SYMOUT);
2559 /* DECL is an inline function, whose body is present, but which is not
2560 being output at this point. (We're putting that off until we need
2561 to do it.) If there are any actions that need to take place,
2562 including the emission of debugging information for the function,
2563 this is where they should go. This function may be called by
2564 language-dependent code for front-ends that do not even generate
2565 RTL for functions that don't need to be put out. */
2568 note_deferral_of_defined_inline_function (decl)
2569 tree decl ATTRIBUTE_UNUSED;
2571 #ifdef DWARF_DEBUGGING_INFO
2572 /* Generate the DWARF info for the "abstract" instance of a function
2573 which we may later generate inlined and/or out-of-line instances
2575 if (write_symbols == DWARF_DEBUG && DECL_INLINE (decl))
2577 /* The front-end may not have set CURRENT_FUNCTION_DECL, but the
2578 DWARF code expects it to be set in this case. Intuitively,
2579 DECL is the function we just finished defining, so setting
2580 CURRENT_FUNCTION_DECL is sensible. */
2581 tree saved_cfd = current_function_decl;
2582 current_function_decl = decl;
2584 /* Let the DWARF code do its work. */
2585 set_decl_abstract_flags (decl, 1);
2586 dwarfout_file_scope_decl (decl, 0);
2587 set_decl_abstract_flags (decl, 0);
2589 /* Reset CURRENT_FUNCTION_DECL. */
2590 current_function_decl = saved_cfd;
2595 /* This is called from finish_function (within yyparse)
2596 after each top-level definition is parsed.
2597 It is supposed to compile that function or variable
2598 and output the assembler code for it.
2599 After we return, the tree storage is freed. */
2602 rest_of_compilation (decl)
2608 int rebuild_label_notes_after_reload;
2610 timevar_push (TV_REST_OF_COMPILATION);
2612 /* When processing delayed functions, prepare_function_start() won't
2613 have been run to re-initialize it. */
2614 cse_not_expected = ! optimize;
2616 /* First, make sure that NOTE_BLOCK is set correctly for each
2617 NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
2618 if (!cfun->x_whole_function_mode_p)
2621 /* Then remove any notes we don't need. That will make iterating
2622 over the instruction sequence faster, and allow the garbage
2623 collector to reclaim the memory used by the notes. */
2624 remove_unnecessary_notes ();
2626 /* In function-at-a-time mode, we do not attempt to keep the BLOCK
2627 tree in sensible shape. So, we just recalculate it here. */
2628 if (cfun->x_whole_function_mode_p)
2631 /* If we are reconsidering an inline function
2632 at the end of compilation, skip the stuff for making it inline. */
2634 if (DECL_SAVED_INSNS (decl) == 0)
2640 /* If this is nested inside an inlined external function, pretend
2641 it was only declared. Since we cannot inline such functions,
2642 generating code for this one is not only not necessary but will
2643 confuse some debugging output writers. */
2644 for (parent = DECL_CONTEXT (current_function_decl);
2645 parent != NULL_TREE;
2646 parent = get_containing_scope (parent))
2647 if (TREE_CODE (parent) == FUNCTION_DECL
2648 && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
2650 DECL_INITIAL (decl) = 0;
2651 goto exit_rest_of_compilation;
2654 /* If requested, consider whether to make this function inline. */
2655 if (DECL_INLINE (decl) || flag_inline_functions)
2657 timevar_push (TV_INTEGRATION);
2658 lose = function_cannot_inline_p (decl);
2659 timevar_pop (TV_INTEGRATION);
2660 if (lose || ! optimize)
2662 if (warn_inline && DECL_INLINE (decl))
2663 warning_with_decl (decl, lose);
2664 DECL_ABSTRACT_ORIGIN (decl) = 0;
2665 /* Don't really compile an extern inline function.
2666 If we can't make it inline, pretend
2667 it was only declared. */
2668 if (DECL_EXTERNAL (decl))
2670 DECL_INITIAL (decl) = 0;
2671 goto exit_rest_of_compilation;
2675 /* ??? Note that this has the effect of making it look
2676 like "inline" was specified for a function if we choose
2677 to inline it. This isn't quite right, but it's
2678 probably not worth the trouble to fix. */
2679 inlinable = DECL_INLINE (decl) = 1;
2682 insns = get_insns ();
2684 /* Dump the rtl code if we are dumping rtl. */
2686 if (open_dump_file (DFI_rtl, decl))
2688 if (DECL_SAVED_INSNS (decl))
2689 fprintf (rtl_dump_file, ";; (integrable)\n\n");
2690 close_dump_file (DFI_rtl, print_rtl, insns);
2693 /* If function is inline, and we don't yet know whether to
2694 compile it by itself, defer decision till end of compilation.
2695 finish_compilation will call rest_of_compilation again
2696 for those functions that need to be output. Also defer those
2697 functions that we are supposed to defer. */
2700 || (DECL_INLINE (decl)
2701 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2702 && ! flag_keep_inline_functions)
2703 || DECL_EXTERNAL (decl))))
2704 DECL_DEFER_OUTPUT (decl) = 1;
2706 if (DECL_INLINE (decl))
2707 /* DWARF wants seperate debugging info for abstract and
2708 concrete instances of all inline functions, including those
2709 declared inline but not inlined, and those inlined even
2710 though they weren't declared inline. Conveniently, that's
2711 what DECL_INLINE means at this point. */
2712 note_deferral_of_defined_inline_function (decl);
2714 if (DECL_DEFER_OUTPUT (decl))
2716 /* If -Wreturn-type, we have to do a bit of compilation.
2717 However, if we just fall through we will call
2718 save_for_inline_copying() which results in excessive
2719 memory use. Instead, we just want to call
2720 jump_optimize() to figure out whether or not we can fall
2721 off the end of the function; we do the minimum amount of
2722 work necessary to make that safe. And, we set optimize
2723 to zero to keep jump_optimize from working too hard. */
2724 if (warn_return_type)
2726 int saved_optimize = optimize;
2728 find_exception_handler_labels ();
2729 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2730 !JUMP_AFTER_REGSCAN);
2731 optimize = saved_optimize;
2734 current_function_nothrow = nothrow_function_p ();
2735 if (current_function_nothrow)
2736 /* Now we know that this can't throw; set the flag for the benefit
2737 of other functions later in this translation unit. */
2738 TREE_NOTHROW (current_function_decl) = 1;
2740 timevar_push (TV_INTEGRATION);
2741 save_for_inline_nocopy (decl);
2742 timevar_pop (TV_INTEGRATION);
2743 DECL_SAVED_INSNS (decl)->inlinable = inlinable;
2744 goto exit_rest_of_compilation;
2747 /* If specified extern inline but we aren't inlining it, we are
2748 done. This goes for anything that gets here with DECL_EXTERNAL
2749 set, not just things with DECL_INLINE. */
2750 if (DECL_EXTERNAL (decl))
2751 goto exit_rest_of_compilation;
2754 init_EXPR_INSN_LIST_cache ();
2759 /* Initialize some variables used by the optimizers. */
2760 init_function_for_compilation ();
2762 if (! DECL_DEFER_OUTPUT (decl))
2763 TREE_ASM_WRITTEN (decl) = 1;
2765 /* Now that integrate will no longer see our rtl, we need not distinguish
2766 between the return value of this function and the return value of called
2768 rtx_equal_function_value_matters = 0;
2770 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
2771 if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
2772 goto exit_rest_of_compilation;
2774 /* Emit code to get eh context, if needed. */
2777 /* We may have potential sibling or tail recursion sites. Select one
2778 (of possibly multiple) methods of performing the call. */
2779 if (flag_optimize_sibling_calls)
2781 timevar_push (TV_JUMP);
2782 open_dump_file (DFI_sibling, decl);
2784 optimize_sibling_and_tail_recursive_calls ();
2786 close_dump_file (DFI_sibling, print_rtl, get_insns ());
2787 timevar_pop (TV_JUMP);
2791 /* If we are doing position-independent code generation, now
2792 is the time to output special prologues and epilogues.
2793 We do not want to do this earlier, because it just clutters
2794 up inline functions with meaningless insns. */
2799 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
2800 Note that that may have been done above, in save_for_inline_copying.
2801 The call to resume_temporary_allocation near the end of this function
2802 goes back to the usual state of affairs. This must be done after
2803 we've built up any unwinders for exception handling, and done
2804 the FINALIZE_PIC work, if necessary. */
2806 rtl_in_current_obstack ();
2808 insns = get_insns ();
2810 /* Copy any shared structure that should not be shared. */
2811 unshare_all_rtl (current_function_decl, insns);
2813 #ifdef SETJMP_VIA_SAVE_AREA
2814 /* This must be performed before virutal register instantiation. */
2815 if (current_function_calls_alloca)
2816 optimize_save_area_alloca (insns);
2819 /* Instantiate all virtual registers. */
2820 instantiate_virtual_regs (current_function_decl, insns);
2822 /* Find all the EH handlers. */
2823 find_exception_handler_labels ();
2825 open_dump_file (DFI_jump, decl);
2827 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
2828 are initialized and to compute whether control can drop off the end
2831 timevar_push (TV_JUMP);
2832 /* Turn NOTE_INSN_EXPECTED_VALUE into REG_BR_PROB. Do this
2833 before jump optimization switches branch directions. */
2834 expected_value_to_br_prob ();
2836 reg_scan (insns, max_reg_num (), 0);
2837 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2838 JUMP_AFTER_REGSCAN);
2840 timevar_pop (TV_JUMP);
2842 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
2843 if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
2845 close_dump_file (DFI_jump, print_rtl, insns);
2846 goto exit_rest_of_compilation;
2849 timevar_push (TV_JUMP);
2853 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2854 cleanup_cfg (insns);
2856 /* ??? Run if-conversion before delete_null_pointer_checks,
2857 since the later does not preserve the CFG. This should
2858 be changed -- no since converting if's that are going to
2860 timevar_push (TV_IFCVT);
2862 timevar_pop (TV_IFCVT);
2864 /* Try to identify useless null pointer tests and delete them. */
2865 if (flag_delete_null_pointer_checks)
2866 delete_null_pointer_checks (insns);
2869 /* Jump optimization, and the removal of NULL pointer checks, may
2870 have reduced the number of instructions substantially. CSE, and
2871 future passes, allocate arrays whose dimensions involve the
2872 maximum instruction UID, so if we can reduce the maximum UID
2873 we'll save big on memory. */
2874 renumber_insns (rtl_dump_file);
2875 timevar_pop (TV_JUMP);
2877 close_dump_file (DFI_jump, print_rtl, insns);
2882 /* Perform common subexpression elimination.
2883 Nonzero value from `cse_main' means that jumps were simplified
2884 and some code may now be unreachable, so do
2885 jump optimization again. */
2889 open_dump_file (DFI_cse, decl);
2890 timevar_push (TV_CSE);
2892 reg_scan (insns, max_reg_num (), 1);
2894 if (flag_thread_jumps)
2896 timevar_push (TV_JUMP);
2897 thread_jumps (insns, max_reg_num (), 1);
2898 timevar_pop (TV_JUMP);
2901 tem = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
2903 /* If we are not running the second CSE pass, then we are no longer
2904 expecting CSE to be run. */
2905 cse_not_expected = !flag_rerun_cse_after_loop;
2907 if (tem || optimize > 1)
2909 timevar_push (TV_JUMP);
2910 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2911 !JUMP_AFTER_REGSCAN);
2912 timevar_pop (TV_JUMP);
2915 /* Run this after jump optmizations remove all the unreachable code
2916 so that unreachable code will not keep values live. */
2917 delete_trivially_dead_insns (insns, max_reg_num ());
2919 /* Try to identify useless null pointer tests and delete them. */
2920 if (flag_delete_null_pointer_checks)
2922 timevar_push (TV_JUMP);
2923 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
2925 cleanup_cfg (insns);
2927 delete_null_pointer_checks (insns);
2928 timevar_pop (TV_JUMP);
2931 /* The second pass of jump optimization is likely to have
2932 removed a bunch more instructions. */
2933 renumber_insns (rtl_dump_file);
2935 timevar_pop (TV_CSE);
2936 close_dump_file (DFI_cse, print_rtl, insns);
2939 open_dump_file (DFI_addressof, decl);
2941 purge_addressof (insns);
2942 reg_scan (insns, max_reg_num (), 1);
2944 close_dump_file (DFI_addressof, print_rtl, insns);
2949 if (optimize > 0 && flag_ssa)
2951 /* Convert to SSA form. */
2953 timevar_push (TV_TO_SSA);
2954 open_dump_file (DFI_ssa, decl);
2956 find_basic_blocks (insns, max_reg_num(), rtl_dump_file);
2957 cleanup_cfg (insns);
2960 close_dump_file (DFI_ssa, print_rtl_with_bb, insns);
2961 timevar_pop (TV_TO_SSA);
2963 /* Currently, there's nothing to do in SSA form. */
2965 /* Convert from SSA form. */
2967 timevar_push (TV_FROM_SSA);
2968 open_dump_file (DFI_ussa, decl);
2970 convert_from_ssa ();
2971 /* New registers have been created. Rescan their usage. */
2972 reg_scan (insns, max_reg_num (), 1);
2973 /* Life analysis used in SSA adds log_links but these
2974 shouldn't be there until the flow stage, so clear
2976 clear_log_links (insns);
2978 close_dump_file (DFI_ussa, print_rtl_with_bb, insns);
2979 timevar_pop (TV_FROM_SSA);
2985 /* Perform global cse. */
2987 if (optimize > 0 && flag_gcse)
2989 timevar_push (TV_GCSE);
2990 open_dump_file (DFI_gcse, decl);
2992 find_basic_blocks (insns, max_reg_num(), rtl_dump_file);
2993 cleanup_cfg (insns);
2994 tem = gcse_main (insns, rtl_dump_file);
2996 /* If gcse altered any jumps, rerun jump optimizations to clean
3000 timevar_push (TV_JUMP);
3001 jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
3002 !JUMP_AFTER_REGSCAN);
3003 timevar_pop (TV_JUMP);
3006 close_dump_file (DFI_gcse, print_rtl, insns);
3007 timevar_pop (TV_GCSE);
3013 /* Move constant computations out of loops. */
3017 timevar_push (TV_LOOP);
3018 open_dump_file (DFI_loop, decl);
3020 if (flag_rerun_loop_opt)
3022 /* We only want to perform unrolling once. */
3024 loop_optimize (insns, rtl_dump_file, 0);
3026 /* The first call to loop_optimize makes some instructions
3027 trivially dead. We delete those instructions now in the
3028 hope that doing so will make the heuristics in loop work
3029 better and possibly speed up compilation. */
3030 delete_trivially_dead_insns (insns, max_reg_num ());
3032 /* The regscan pass is currently necessary as the alias
3033 analysis code depends on this information. */
3034 reg_scan (insns, max_reg_num (), 1);
3036 loop_optimize (insns, rtl_dump_file, (flag_unroll_loops ? LOOP_UNROLL : 0) | LOOP_BCT);
3038 close_dump_file (DFI_loop, print_rtl, insns);
3039 timevar_pop (TV_LOOP);
3047 timevar_push (TV_CSE2);
3048 open_dump_file (DFI_cse2, decl);
3050 if (flag_rerun_cse_after_loop)
3052 /* Running another jump optimization pass before the second
3053 cse pass sometimes simplifies the RTL enough to allow
3054 the second CSE pass to do a better job. Jump_optimize can change
3055 max_reg_num so we must rerun reg_scan afterwards.
3056 ??? Rework to not call reg_scan so often. */
3057 timevar_push (TV_JUMP);
3059 reg_scan (insns, max_reg_num (), 0);
3060 jump_optimize (insns, !JUMP_CROSS_JUMP,
3061 !JUMP_NOOP_MOVES, JUMP_AFTER_REGSCAN);
3063 timevar_push (TV_IFCVT);
3065 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3066 cleanup_cfg (insns);
3069 timevar_pop(TV_IFCVT);
3071 timevar_pop (TV_JUMP);
3073 reg_scan (insns, max_reg_num (), 0);
3074 tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
3078 timevar_push (TV_JUMP);
3079 jump_optimize (insns, !JUMP_CROSS_JUMP,
3080 !JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
3081 timevar_pop (TV_JUMP);
3085 if (flag_thread_jumps)
3087 /* This pass of jump threading straightens out code
3088 that was kinked by loop optimization. */
3089 timevar_push (TV_JUMP);
3090 reg_scan (insns, max_reg_num (), 0);
3091 thread_jumps (insns, max_reg_num (), 0);
3092 timevar_pop (TV_JUMP);
3095 close_dump_file (DFI_cse2, print_rtl, insns);
3096 timevar_pop (TV_CSE2);
3102 cse_not_expected = 1;
3104 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
3106 timevar_push (TV_BRANCH_PROB);
3107 open_dump_file (DFI_bp, decl);
3109 branch_prob (insns, rtl_dump_file);
3111 close_dump_file (DFI_bp, print_rtl, insns);
3112 timevar_pop (TV_BRANCH_PROB);
3120 /* Print function header into flow dump now
3121 because doing the flow analysis makes some of the dump. */
3123 open_dump_file (DFI_flow, decl);
3125 /* Do control and data flow analysis; wrote some of the results to
3128 timevar_push (TV_FLOW);
3129 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3130 cleanup_cfg (insns);
3135 /* Discover and record the loop depth at the head of each basic
3136 block. The loop infrastructure does the real job for us. */
3137 flow_loops_find (&loops);
3139 /* Estimate using heuristics if no profiling info is available. */
3140 if (! flag_branch_probabilities)
3141 estimate_probability (&loops);
3144 flow_loops_dump (&loops, rtl_dump_file, 0);
3146 flow_loops_free (&loops);
3148 life_analysis (insns, rtl_dump_file, PROP_FINAL);
3149 mark_constant_function ();
3150 timevar_pop (TV_FLOW);
3152 if (warn_uninitialized || extra_warnings)
3154 uninitialized_vars_warning (DECL_INITIAL (decl));
3156 setjmp_args_warning ();
3159 close_dump_file (DFI_flow, print_rtl_with_bb, insns);
3164 /* If -opt, try combining insns through substitution. */
3168 int rebuild_jump_labels_after_combine = 0;
3170 timevar_push (TV_COMBINE);
3171 open_dump_file (DFI_combine, decl);
3173 rebuild_jump_labels_after_combine
3174 = combine_instructions (insns, max_reg_num ());
3176 /* Combining insns may have turned an indirect jump into a
3177 direct jump. Rebuid the JUMP_LABEL fields of jumping
3179 if (rebuild_jump_labels_after_combine)
3181 timevar_push (TV_JUMP);
3182 rebuild_jump_labels (insns);
3183 timevar_pop (TV_JUMP);
3185 timevar_push (TV_FLOW);
3186 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3187 cleanup_cfg (insns);
3189 /* Blimey. We've got to have the CFG up to date for the call to
3190 if_convert below. However, the random deletion of blocks
3191 without updating life info can wind up with Wierd Stuff in
3192 global_live_at_end. We then run sched1, which updates things
3193 properly, discovers the wierdness and aborts. */
3194 update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
3195 PROP_DEATH_NOTES | PROP_KILL_DEAD_CODE
3196 | PROP_SCAN_DEAD_CODE);
3198 timevar_pop (TV_FLOW);
3201 close_dump_file (DFI_combine, print_rtl_with_bb, insns);
3202 timevar_pop (TV_COMBINE);
3208 /* Rerun if-conversion, as combine may have simplified things enough to
3209 now meet sequence length restrictions. */
3212 timevar_push (TV_IFCVT);
3213 open_dump_file (DFI_ce, decl);
3217 close_dump_file (DFI_ce, print_rtl_with_bb, insns);
3218 timevar_pop (TV_IFCVT);
3221 /* Register allocation pre-pass, to reduce number of moves
3222 necessary for two-address machines. */
3223 if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
3225 timevar_push (TV_REGMOVE);
3226 open_dump_file (DFI_regmove, decl);
3228 regmove_optimize (insns, max_reg_num (), rtl_dump_file);
3230 close_dump_file (DFI_regmove, print_rtl_with_bb, insns);
3231 timevar_pop (TV_REGMOVE);
3237 #ifdef OPTIMIZE_MODE_SWITCHING
3240 timevar_push (TV_GCSE);
3242 if (optimize_mode_switching (NULL_PTR))
3244 /* We did work, and so had to regenerate global life information.
3245 Take advantage of this and don't re-recompute register life
3246 information below. */
3250 timevar_pop (TV_GCSE);
3254 #ifdef INSN_SCHEDULING
3256 /* Print function header into sched dump now
3257 because doing the sched analysis makes some of the dump. */
3258 if (optimize > 0 && flag_schedule_insns)
3260 timevar_push (TV_SCHED);
3261 open_dump_file (DFI_sched, decl);
3263 /* Do control and data sched analysis,
3264 and write some of the results to dump file. */
3266 schedule_insns (rtl_dump_file);
3268 close_dump_file (DFI_sched, print_rtl_with_bb, insns);
3269 timevar_pop (TV_SCHED);
3274 /* Register lifetime information is up to date. From now on
3275 we can not generate any new pseudos. */
3280 /* Determine if the current function is a leaf before running reload
3281 since this can impact optimizations done by the prologue and
3282 epilogue thus changing register elimination offsets. */
3283 current_function_is_leaf = leaf_function_p ();
3285 timevar_push (TV_LOCAL_ALLOC);
3286 open_dump_file (DFI_lreg, decl);
3288 /* Allocate pseudo-regs that are used only within 1 basic block.
3290 RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
3291 jump optimizer after register allocation and reloading are finished. */
3293 if (! no_new_pseudos)
3295 recompute_reg_usage (insns, ! optimize_size);
3297 /* Register lifetime information is up to date. From now on
3298 we can not generate any new pseudos. */
3301 regclass (insns, max_reg_num (), rtl_dump_file);
3302 rebuild_label_notes_after_reload = local_alloc ();
3304 timevar_pop (TV_LOCAL_ALLOC);
3306 if (dump_file[DFI_lreg].enabled)
3308 timevar_push (TV_DUMP);
3310 dump_flow_info (rtl_dump_file);
3311 dump_local_alloc (rtl_dump_file);
3313 close_dump_file (DFI_lreg, print_rtl_with_bb, insns);
3314 timevar_pop (TV_DUMP);
3320 timevar_push (TV_GLOBAL_ALLOC);
3321 open_dump_file (DFI_greg, decl);
3323 /* If optimizing, allocate remaining pseudo-regs. Do the reload
3324 pass fixing up any insns that are invalid. */
3327 failure = global_alloc (rtl_dump_file);
3330 build_insn_chain (insns);
3331 failure = reload (insns, 0, rtl_dump_file);
3334 timevar_pop (TV_GLOBAL_ALLOC);
3337 goto exit_rest_of_compilation;
3342 /* Do a very simple CSE pass over just the hard registers. */
3345 timevar_push (TV_RELOAD_CSE_REGS);
3346 reload_cse_regs (insns);
3347 timevar_pop (TV_RELOAD_CSE_REGS);
3350 /* If optimizing, then go ahead and split insns now since we are about
3351 to recompute flow information anyway. */
3353 split_all_insns (0);
3355 /* Register allocation and reloading may have turned an indirect jump into
3356 a direct jump. If so, we must rebuild the JUMP_LABEL fields of
3357 jumping instructions. */
3358 if (rebuild_label_notes_after_reload)
3360 timevar_push (TV_JUMP);
3362 rebuild_jump_labels (insns);
3364 timevar_pop (TV_JUMP);
3367 if (dump_file[DFI_greg].enabled)
3369 timevar_push (TV_DUMP);
3371 dump_global_regs (rtl_dump_file);
3373 close_dump_file (DFI_greg, print_rtl_with_bb, insns);
3374 timevar_pop (TV_DUMP);
3377 /* Re-create the death notes which were deleted during reload. */
3378 timevar_push (TV_FLOW2);
3379 open_dump_file (DFI_flow2, decl);
3381 jump_optimize (insns, !JUMP_CROSS_JUMP,
3382 !JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN);
3383 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3385 /* On some machines, the prologue and epilogue code, or parts thereof,
3386 can be represented as RTL. Doing so lets us schedule insns between
3387 it and the rest of the code and also allows delayed branch
3388 scheduling to operate in the epilogue. */
3389 thread_prologue_and_epilogue_insns (insns);
3393 cleanup_cfg (insns);
3394 life_analysis (insns, rtl_dump_file, PROP_FINAL);
3396 /* This is kind of a heuristic. We need to run combine_stack_adjustments
3397 even for machines with possibly nonzero RETURN_POPS_ARGS
3398 and ACCUMULATE_OUTGOING_ARGS. We expect that only ports having
3399 push instructions will have popping returns. */
3400 #ifndef PUSH_ROUNDING
3401 if (!ACCUMULATE_OUTGOING_ARGS)
3403 combine_stack_adjustments ();
3409 flow2_completed = 1;
3411 close_dump_file (DFI_flow2, print_rtl_with_bb, insns);
3412 timevar_pop (TV_FLOW2);
3416 timevar_push (TV_IFCVT2);
3417 open_dump_file (DFI_ce2, decl);
3421 close_dump_file (DFI_ce2, print_rtl_with_bb, insns);
3422 timevar_pop (TV_IFCVT2);
3425 #ifdef HAVE_peephole2
3426 if (optimize > 0 && flag_peephole2)
3428 timevar_push (TV_PEEPHOLE2);
3429 open_dump_file (DFI_peephole2, decl);
3431 peephole2_optimize (rtl_dump_file);
3433 close_dump_file (DFI_peephole2, print_rtl_with_bb, insns);
3434 timevar_pop (TV_PEEPHOLE2);
3438 if (optimize > 0 && flag_rename_registers)
3440 timevar_push (TV_RENAME_REGISTERS);
3441 open_dump_file (DFI_rnreg, decl);
3443 regrename_optimize ();
3445 close_dump_file (DFI_rnreg, print_rtl_with_bb, insns);
3446 timevar_pop (TV_RENAME_REGISTERS);
3449 #ifdef INSN_SCHEDULING
3450 if (optimize > 0 && flag_schedule_insns_after_reload)
3452 timevar_push (TV_SCHED2);
3453 open_dump_file (DFI_sched2, decl);
3455 /* Do control and data sched analysis again,
3456 and write some more of the results to dump file. */
3458 schedule_insns (rtl_dump_file);
3460 close_dump_file (DFI_sched2, print_rtl_with_bb, insns);
3461 timevar_pop (TV_SCHED2);
3468 #ifdef LEAF_REGISTERS
3469 current_function_uses_only_leaf_regs
3470 = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
3473 if (optimize > 0 && flag_reorder_blocks)
3475 timevar_push (TV_REORDER_BLOCKS);
3476 open_dump_file (DFI_bbro, decl);
3478 reorder_basic_blocks ();
3480 close_dump_file (DFI_bbro, print_rtl_with_bb, insns);
3481 timevar_pop (TV_REORDER_BLOCKS);
3484 /* One more attempt to remove jumps to .+1 left by dead-store elimination.
3485 Also do cross-jumping this time and delete no-op move insns. */
3489 timevar_push (TV_JUMP);
3490 open_dump_file (DFI_jump2, decl);
3492 jump_optimize (insns, JUMP_CROSS_JUMP, JUMP_NOOP_MOVES,
3493 !JUMP_AFTER_REGSCAN);
3495 /* CFG no longer kept up to date. */
3497 close_dump_file (DFI_jump2, print_rtl_with_bb, insns);
3498 timevar_pop (TV_JUMP);
3501 /* If a machine dependent reorganization is needed, call it. */
3502 #ifdef MACHINE_DEPENDENT_REORG
3503 open_dump_file (DFI_mach, decl);
3505 MACHINE_DEPENDENT_REORG (insns);
3507 close_dump_file (DFI_mach, print_rtl_with_bb, insns);
3513 /* If a scheduling pass for delayed branches is to be done,
3514 call the scheduling code. */
3517 if (optimize > 0 && flag_delayed_branch)
3519 timevar_push (TV_DBR_SCHED);
3520 open_dump_file (DFI_dbr, decl);
3522 dbr_schedule (insns, rtl_dump_file);
3524 close_dump_file (DFI_dbr, print_rtl_with_bb, insns);
3525 timevar_pop (TV_DBR_SCHED);
3532 /* Shorten branches.
3534 Note this must run before reg-stack because of death note (ab)use
3535 in the ia32 backend. */
3536 timevar_push (TV_SHORTEN_BRANCH);
3537 shorten_branches (get_insns ());
3538 timevar_pop (TV_SHORTEN_BRANCH);
3541 timevar_push (TV_REG_STACK);
3542 open_dump_file (DFI_stack, decl);
3544 reg_to_stack (insns, rtl_dump_file);
3546 close_dump_file (DFI_stack, print_rtl_with_bb, insns);
3547 timevar_pop (TV_REG_STACK);
3553 current_function_nothrow = nothrow_function_p ();
3554 if (current_function_nothrow)
3555 /* Now we know that this can't throw; set the flag for the benefit
3556 of other functions later in this translation unit. */
3557 TREE_NOTHROW (current_function_decl) = 1;
3559 /* Now turn the rtl into assembler code. */
3561 timevar_push (TV_FINAL);
3566 /* Get the function's name, as described by its RTL.
3567 This may be different from the DECL_NAME name used
3568 in the source file. */
3570 x = DECL_RTL (decl);
3571 if (GET_CODE (x) != MEM)
3574 if (GET_CODE (x) != SYMBOL_REF)
3576 fnname = XSTR (x, 0);
3578 assemble_start_function (decl, fnname);
3579 final_start_function (insns, asm_out_file, optimize);
3580 final (insns, asm_out_file, optimize, 0);
3581 final_end_function (insns, asm_out_file, optimize);
3582 assemble_end_function (decl, fnname);
3584 fflush (asm_out_file);
3586 /* Release all memory allocated by flow. */
3587 free_basic_block_vars (0);
3589 /* Release all memory held by regsets now */
3590 regset_release_memory ();
3592 timevar_pop (TV_FINAL);
3597 /* Write DBX symbols if requested */
3599 /* Note that for those inline functions where we don't initially
3600 know for certain that we will be generating an out-of-line copy,
3601 the first invocation of this routine (rest_of_compilation) will
3602 skip over this code by doing a `goto exit_rest_of_compilation;'.
3603 Later on, finish_compilation will call rest_of_compilation again
3604 for those inline functions that need to have out-of-line copies
3605 generated. During that call, we *will* be routed past here. */
3607 timevar_push (TV_SYMOUT);
3608 #ifdef DBX_DEBUGGING_INFO
3609 if (write_symbols == DBX_DEBUG)
3610 dbxout_function (decl);
3613 #ifdef DWARF_DEBUGGING_INFO
3614 if (write_symbols == DWARF_DEBUG)
3615 dwarfout_file_scope_decl (decl, 0);
3618 #ifdef DWARF2_DEBUGGING_INFO
3619 if (write_symbols == DWARF2_DEBUG)
3620 dwarf2out_decl (decl);
3622 timevar_pop (TV_SYMOUT);
3624 exit_rest_of_compilation:
3626 /* In case the function was not output,
3627 don't leave any temporary anonymous types
3628 queued up for sdb output. */
3629 #ifdef SDB_DEBUGGING_INFO
3630 if (write_symbols == SDB_DEBUG)
3631 sdbout_types (NULL_TREE);
3634 reload_completed = 0;
3635 flow2_completed = 0;
3638 timevar_push (TV_FINAL);
3640 /* Clear out the insn_length contents now that they are no
3642 init_insn_lengths ();
3644 /* Clear out the real_constant_chain before some of the rtx's
3645 it runs through become garbage. */
3646 clear_const_double_mem ();
3648 /* Cancel the effect of rtl_in_current_obstack. */
3649 resume_temporary_allocation ();
3651 /* Show no temporary slots allocated. */
3654 free_basic_block_vars (0);
3656 timevar_pop (TV_FINAL);
3658 /* Make sure volatile mem refs aren't considered valid operands for
3659 arithmetic insns. We must call this here if this is a nested inline
3660 function, since the above code leaves us in the init_recog state
3661 (from final.c), and the function context push/pop code does not
3662 save/restore volatile_ok.
3664 ??? Maybe it isn't necessary for expand_start_function to call this
3665 anymore if we do it here? */
3667 init_recog_no_volatile ();
3669 /* We're done with this function. Free up memory if we can. */
3670 free_after_parsing (cfun);
3671 if (! DECL_DEFER_OUTPUT (decl))
3672 free_after_compilation (cfun);
3678 timevar_pop (TV_REST_OF_COMPILATION);
3689 printf ("Usage: %s input [switches]\n", progname);
3690 printf ("Switches:\n");
3692 printf (" -ffixed-<register> Mark <register> as being unavailable to the compiler\n");
3693 printf (" -fcall-used-<register> Mark <register> as being corrupted by function calls\n");
3694 printf (" -fcall-saved-<register> Mark <register> as being preserved across functions\n");
3695 printf (" -finline-limit=<number> Limits the size of inlined functions to <number>\n");
3697 for (i = NUM_ELEM (f_options); i--;)
3699 const char * description = f_options[i].description;
3701 if (description != NULL && * description != 0)
3702 printf (" -f%-21s %s\n",
3703 f_options[i].string, description);
3706 printf (" -O[number] Set optimisation level to [number]\n");
3707 printf (" -Os Optimise for space rather than speed\n");
3708 printf (" -pedantic Issue warnings needed by strict compliance to ANSI C\n");
3709 printf (" -pedantic-errors Like -pedantic except that errors are produced\n");
3710 printf (" -w Suppress warnings\n");
3711 printf (" -W Enable extra warnings\n");
3713 for (i = NUM_ELEM (W_options); i--;)
3715 const char * description = W_options[i].description;
3717 if (description != NULL && * description != 0)
3718 printf (" -W%-21s %s\n",
3719 W_options[i].string, description);
3722 printf (" -Wunused Enable unused warnings\n");
3723 printf (" -Wid-clash-<num> Warn if 2 identifiers have the same first <num> chars\n");
3724 printf (" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n");
3725 printf (" -p Enable function profiling\n");
3726 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER)
3727 printf (" -a Enable block profiling \n");
3729 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER) || defined FUNCTION_BLOCK_PROFILER_EXIT
3730 printf (" -ax Enable jump profiling \n");
3732 printf (" -o <file> Place output into <file> \n");
3733 printf (" -G <number> Put global and static data smaller than <number>\n");
3734 printf (" bytes into a special section (on some targets)\n");
3736 for (i = NUM_ELEM (debug_args); i--;)
3738 if (debug_args[i].description != NULL)
3739 printf (" -g%-21s %s\n", debug_args[i].arg, debug_args[i].description);
3742 printf (" -aux-info <file> Emit declaration info into <file>.X\n");
3743 printf (" -quiet Do not display functions compiled or elapsed time\n");
3744 printf (" -version Display the compiler's version\n");
3745 printf (" -d[letters] Enable dumps from specific passes of the compiler\n");
3746 printf (" -dumpbase <file> Base name to be used for dumps from specific passes\n");
3747 #if defined INSN_SCHEDULING
3748 printf (" -fsched-verbose=<number> Set the verbosity level of the scheduler\n");
3750 printf (" --help Display this information\n");
3755 /* Display descriptions of language specific options.
3756 If there is no description, note that there is an undocumented option.
3757 If the description is empty, do not display anything. (This allows
3758 options to be deliberately undocumented, for whatever reason).
3759 If the option string is missing, then this is a marker, indicating
3760 that the description string is in fact the name of a language, whose
3761 language specific options are to follow. */
3763 if (NUM_ELEM (documented_lang_options) > 1)
3765 printf ("\nLanguage specific options:\n");
3767 for (i = 0; i < NUM_ELEM (documented_lang_options); i++)
3769 const char * description = documented_lang_options[i].description;
3770 const char * option = documented_lang_options[i].option;
3772 if (description == NULL)
3777 printf (" %-23.23s [undocumented]\n", option);
3779 else if (* description == 0)
3781 else if (option == NULL)
3785 ("\nThere are undocumented %s specific options as well.\n",
3789 printf ("\n Options for %s:\n", description);
3794 printf (" %-23.23s %s\n", option, description);
3799 printf ("\nThere are undocumented %s specific options as well.\n", lang);
3801 if (NUM_ELEM (target_switches) > 1
3802 #ifdef TARGET_OPTIONS
3803 || NUM_ELEM (target_options) > 1
3811 printf ("\nTarget specific options:\n");
3813 for (i = NUM_ELEM (target_switches); i--;)
3815 const char * option = target_switches[i].name;
3816 const char * description = target_switches[i].description;
3818 if (option == NULL || * option == 0)
3820 else if (description == NULL)
3825 printf (" -m%-21.21s [undocumented]\n", option);
3827 else if (* description != 0)
3828 doc += printf (" -m%-21.21s %s\n", option, description);
3831 #ifdef TARGET_OPTIONS
3832 for (i = NUM_ELEM (target_options); i--;)
3834 const char * option = target_options[i].prefix;
3835 const char * description = target_options[i].description;
3837 if (option == NULL || * option == 0)
3839 else if (description == NULL)
3844 printf (" -m%-21.21s [undocumented]\n", option);
3846 else if (* description != 0)
3847 doc += printf (" -m%-21.21s %s\n", option, description);
3853 printf ("\nThere are undocumented target specific options as well.\n");
3855 printf (" They exist, but they are not documented.\n");
3860 /* Parse a -d... comand line switch. */
3863 decode_d_option (arg)
3872 for (i = 0; i < DFI_MAX; ++i)
3873 dump_file[i].enabled = 1;
3882 flag_print_asm_name = 1;
3885 graph_dump_format = vcg;
3888 rtl_dump_and_exit = 1;
3893 case 'D': /* These are handled by the preprocessor. */
3899 for (i = 0; i < DFI_MAX; ++i)
3900 if (c == dump_file[i].debug_switch)
3902 dump_file[i].enabled = 1;
3907 warning ("unrecognized gcc debugging option: %c", c);
3912 /* Parse a -f... comand line switch. ARG is the value after the -f.
3913 It is safe to access 'ARG - 2' to generate the full switch name.
3914 Return the number of strings consumed. */
3917 decode_f_option (arg)
3922 /* Search for the option in the table of binary f options. */
3923 for (j = sizeof (f_options) / sizeof (f_options[0]); j--;)
3925 if (!strcmp (arg, f_options[j].string))
3927 *f_options[j].variable = f_options[j].on_value;
3931 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
3932 && ! strcmp (arg + 3, f_options[j].string))
3934 *f_options[j].variable = ! f_options[j].on_value;
3939 if (!strncmp (arg, "inline-limit-", 13)
3940 || !strncmp (arg, "inline-limit=", 13))
3942 read_integral_parameter (arg + 13, arg - 2, inline_max_insns);
3943 #ifdef INSN_SCHEDULING
3944 else if (!strncmp (arg, "sched-verbose=", 14))
3945 fix_sched_param ("verbose", (const char *)(arg + 14));
3947 else if (!strncmp (arg, "fixed-", 6))
3948 fix_register ((const char *)(arg + 6), 1, 1);
3949 else if (!strncmp (arg, "call-used-", 10))
3950 fix_register ((const char *)(arg + 10), 0, 1);
3951 else if (!strncmp (arg, "call-saved-", 11))
3952 fix_register ((const char *)(arg + 11), 0, 0);
3953 else if (!strncmp (arg, "align-loops=", 12))
3954 align_loops = read_integral_parameter (arg + 12, arg - 2, align_loops);
3955 else if (!strncmp (arg, "align-functions=", 16))
3957 = read_integral_parameter (arg + 16, arg - 2, align_functions);
3958 else if (!strncmp (arg, "align-jumps=", 12))
3959 align_jumps = read_integral_parameter (arg + 12, arg - 2, align_jumps);
3960 else if (!strncmp (arg, "align-labels=", 13))
3961 align_labels = read_integral_parameter (arg + 13, arg - 2, align_labels);
3962 else if (!strncmp (arg, "stack-limit-register=", 21))
3964 int reg = decode_reg_name (arg + 21);
3966 error ("unrecognized register name `%s'", arg + 21);
3968 stack_limit_rtx = gen_rtx_REG (Pmode, reg);
3970 else if (!strncmp (arg, "stack-limit-symbol=", 19))
3974 nm = ggc_alloc_string (arg + 19, strlen (arg + 19));
3976 nm = xstrdup (arg + 19);
3977 stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
3979 else if (!strcmp (arg, "no-stack-limit"))
3980 stack_limit_rtx = NULL_RTX;
3981 else if (!strcmp (arg, "preprocessed"))
3982 /* Recognise this switch but do nothing. This prevents warnings
3983 about an unrecognized switch if cpplib has not been linked in. */
3991 /* Parse a -W... comand line switch. ARG is the value after the -W.
3992 It is safe to access 'ARG - 2' to generate the full switch name.
3993 Return the number of strings consumed. */
3996 decode_W_option (arg)
4001 /* Search for the option in the table of binary W options. */
4003 for (j = sizeof (W_options) / sizeof (W_options[0]); j--;)
4005 if (!strcmp (arg, W_options[j].string))
4007 *W_options[j].variable = W_options[j].on_value;
4011 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4012 && ! strcmp (arg + 3, W_options[j].string))
4014 *W_options[j].variable = ! W_options[j].on_value;
4019 if (!strncmp (arg, "id-clash-", 9))
4021 id_clash_len = read_integral_parameter (arg + 9, arg - 2, -1);
4023 if (id_clash_len != -1)
4026 else if (!strncmp (arg, "larger-than-", 12))
4028 larger_than_size = read_integral_parameter (arg + 12, arg - 2, -1);
4030 if (larger_than_size != -1)
4031 warn_larger_than = 1;
4033 else if (!strcmp (arg, "unused"))
4037 else if (!strcmp (arg, "no-unused"))
4047 /* Parse a -g... comand line switch. ARG is the value after the -g.
4048 It is safe to access 'ARG - 2' to generate the full switch name.
4049 Return the number of strings consumed. */
4052 decode_g_option (arg)
4056 /* A lot of code assumes write_symbols == NO_DEBUG if the
4057 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4058 of what debugging type has been selected). This records the
4059 selected type. It is an error to specify more than one
4061 static enum debug_info_type selected_debug_type = NO_DEBUG;
4062 /* Non-zero if debugging format has been explicitly set.
4063 -g and -ggdb don't explicitly set the debugging format so
4064 -gdwarf -g3 is equivalent to -gdwarf3. */
4065 static int type_explicitly_set_p = 0;
4066 /* Indexed by enum debug_info_type. */
4067 static const char * debug_type_names[] =
4069 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4072 /* The maximum admissible debug level value. */
4073 static const unsigned max_debug_level = 3;
4075 /* Look up ARG in the table. */
4076 for (da = debug_args; da->arg; da++)
4078 const int da_len = strlen (da->arg);
4080 if (da_len == 0 || ! strncmp (arg, da->arg, da_len))
4082 enum debug_info_type type = da->debug_type;
4083 const char * p = arg + da_len;
4085 if (*p && (*p < '0' || *p > '9'))
4088 /* A debug flag without a level defaults to level 2.
4089 Note we do not want to call read_integral_parameter
4090 for that case since it will call atoi which
4093 ??? We may want to generalize the interface to
4094 read_integral_parameter to better handle this case
4095 if this case shows up often. */
4097 level = read_integral_parameter (p, 0, max_debug_level + 1);
4101 if (da_len > 1 && *p && !strncmp (arg, "dwarf", da_len))
4103 error ("use -gdwarf -g%d for DWARF v1, level %d",
4106 error ("use -gdwarf-2 for DWARF v2");
4109 if (level > max_debug_level)
4112 ignoring option `%s' due to invalid debug level specification",
4114 level = debug_info_level;
4117 if (type == NO_DEBUG)
4119 type = PREFERRED_DEBUGGING_TYPE;
4121 if (da_len > 1 && strncmp (arg, "gdb", da_len) == 0)
4123 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4124 type = DWARF2_DEBUG;
4126 #ifdef DBX_DEBUGGING_INFO
4133 if (type == NO_DEBUG)
4134 warning ("`%s': unknown or unsupported -g option", arg - 2);
4136 /* Does it conflict with an already selected type? */
4137 if (type_explicitly_set_p
4138 /* -g/-ggdb don't conflict with anything */
4139 && da->debug_type != NO_DEBUG
4140 && type != selected_debug_type)
4141 warning ("`%s' ignored, conflicts with `-g%s'",
4142 arg - 2, debug_type_names[(int) selected_debug_type]);
4145 /* If the format has already been set, -g/-ggdb
4146 only change the debug level. */
4147 if (type_explicitly_set_p && da->debug_type == NO_DEBUG)
4148 ; /* don't change debugging type */
4151 selected_debug_type = type;
4152 type_explicitly_set_p = da->debug_type != NO_DEBUG;
4155 write_symbols = (level == 0
4157 : selected_debug_type);
4158 use_gnu_debug_info_extensions = da->use_extensions_p;
4159 debug_info_level = (enum debug_info_level) level;
4167 warning ("`%s': unknown or unsupported -g option", arg - 2);
4172 /* Decode the first argument in the argv as a language-independent option.
4173 Return the number of strings consumed. 'strings_processed' is the
4174 number of strings that have already been decoded in a language
4175 specific fashion before this function was invoked. */
4178 independent_decode_option (argc, argv, strings_processed)
4181 unsigned int strings_processed;
4183 char *arg = argv[0];
4185 if (arg[0] != '-' || arg[1] == 0)
4197 if (!strcmp (arg, "-help"))
4212 /* Already been treated in main (). Do nothing. */
4216 set_target_switch (arg + 1);
4220 return decode_f_option (arg + 1);
4223 if (strings_processed == 0)
4224 return decode_g_option (arg + 1);
4226 return strings_processed;
4229 if (!strcmp (arg, "dumpbase"))
4234 dump_base_name = argv[1];
4238 decode_d_option (arg + 1);
4242 if (!strcmp (arg, "pedantic"))
4244 else if (!strcmp (arg, "pedantic-errors"))
4245 flag_pedantic_errors = pedantic = 1;
4246 else if (arg[1] == 0)
4253 if (!strcmp (arg, "quiet"))
4260 if (!strcmp (arg, "version"))
4268 inhibit_warnings = 1;
4277 /* We save the value of warn_uninitialized, since if they put
4278 -Wuninitialized on the command line, we need to generate a
4279 warning about not using it without also specifying -O. */
4280 if (warn_uninitialized != 1)
4281 warn_uninitialized = 2;
4284 return decode_W_option (arg + 1);
4290 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4291 warning ("`-a' option (basic block profile) not supported");
4293 profile_block_flag = (profile_block_flag < 2) ? 1 : 3;
4296 else if (!strcmp (arg, "ax"))
4298 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4299 warning ("`-ax' option (jump profiling) not supported");
4301 profile_block_flag = (!profile_block_flag
4302 || profile_block_flag == 2) ? 2 : 3;
4305 else if (!strncmp (arg, "aux-info", 8))
4307 flag_gen_aux_info = 1;
4313 aux_info_file_name = argv[1];
4317 aux_info_file_name = arg + 8;
4329 asm_file_name = argv[1];
4344 g_switch_val = read_integral_parameter (argv[1], 0, -1);
4349 g_switch_val = read_integral_parameter (arg + 1, 0, -1);
4353 if (g_switch_val == -1)
4357 g_switch_set = TRUE;
4358 g_switch_value = g_switch_val;
4368 /* Entry point of cc1/c++. Decode command args, then call compile_file.
4369 Exit code is 35 if can't open files, 34 if fatal error,
4370 33 if had nonfatal errors, else success. */
4372 extern int main PARAMS ((int, char **));
4382 /* save in case md file wants to emit args as a comment. */
4386 p = argv[0] + strlen (argv[0]);
4387 while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
4391 #ifdef HAVE_LC_MESSAGES
4392 setlocale (LC_MESSAGES, "");
4394 (void) bindtextdomain (PACKAGE, localedir);
4395 (void) textdomain (PACKAGE);
4397 signal (SIGFPE, float_signal);
4400 signal (SIGPIPE, pipe_closed);
4403 decl_printable_name = decl_name;
4404 lang_expand_expr = (lang_expand_expr_t) do_abort;
4406 /* Initialize whether `char' is signed. */
4407 flag_signed_char = DEFAULT_SIGNED_CHAR;
4408 #ifdef DEFAULT_SHORT_ENUMS
4409 /* Initialize how much space enums occupy, by default. */
4410 flag_short_enums = DEFAULT_SHORT_ENUMS;
4413 /* Initialize the garbage-collector. */
4415 ggc_add_root (&input_file_stack, 1, sizeof input_file_stack,
4417 ggc_add_rtx_root (&stack_limit_rtx, 1);
4418 ggc_add_tree_root (¤t_function_decl, 1);
4419 ggc_add_tree_root (¤t_function_func_begin_label, 1);
4421 /* Perform language-specific options intialization. */
4422 lang_init_options ();
4424 /* Scan to see what optimization level has been specified. That will
4425 determine the default value of many flags. */
4426 for (i = 1; i < argc; i++)
4428 if (!strcmp (argv[i], "-O"))
4433 else if (argv[i][0] == '-' && argv[i][1] == 'O')
4435 /* Handle -Os, -O2, -O3, -O69, ... */
4436 char *p = &argv[i][2];
4438 if ((p[0] == 's') && (p[1] == 0))
4442 /* Optimizing for size forces optimize to be 2. */
4447 const int optimize_val = read_integral_parameter (p, p - 2, -1);
4448 if (optimize_val != -1)
4450 optimize = optimize_val;
4460 flag_thread_jumps = 1;
4462 flag_delayed_branch = 1;
4464 #ifdef CAN_DEBUG_WITHOUT_FP
4465 flag_omit_frame_pointer = 1;
4471 flag_optimize_sibling_calls = 1;
4472 flag_cse_follow_jumps = 1;
4473 flag_cse_skip_blocks = 1;
4475 flag_expensive_optimizations = 1;
4476 flag_strength_reduce = 1;
4477 flag_rerun_cse_after_loop = 1;
4478 flag_rerun_loop_opt = 1;
4479 flag_caller_saves = 1;
4482 #ifdef INSN_SCHEDULING
4483 flag_schedule_insns = 1;
4484 flag_schedule_insns_after_reload = 1;
4487 flag_strict_aliasing = 1;
4488 flag_delete_null_pointer_checks = 1;
4493 flag_inline_functions = 1;
4496 if (optimize < 2 || optimize_size)
4501 align_functions = 1;
4504 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
4507 set_target_switch ("");
4509 #ifdef OPTIMIZATION_OPTIONS
4510 /* Allow default optimizations to be specified on a per-machine basis. */
4511 OPTIMIZATION_OPTIONS (optimize, optimize_size);
4514 /* Initialize register usage now so switches may override. */
4517 /* Perform normal command line switch decoding. */
4518 for (i = 1; i < argc;)
4520 unsigned int lang_processed;
4521 unsigned int indep_processed;
4523 /* Give the language a chance to decode the option for itself. */
4524 lang_processed = lang_decode_option (argc - i, argv + i);
4526 /* Now see if the option also has a language independent meaning.
4527 Some options are both language specific and language independent,
4528 eg --help. It is possible that there might be options that should
4529 only be decoded in a language independent way if they were not
4530 decoded in a langauge specific way, which is why 'lang_processed'
4532 indep_processed = independent_decode_option (argc - i, argv + i,
4535 if (lang_processed || indep_processed)
4536 i += (lang_processed > indep_processed
4537 ? lang_processed : indep_processed);
4540 const char * option = NULL;
4541 const char * lang = NULL;
4544 /* It is possible that the command line switch is not valid for the
4545 current language, but it is valid for another language. In order
4546 to be compatible with previous versions of the compiler (which
4547 did not issue an error message in this case) we check for this
4548 possibilty here. If we do find a match, then if extra_warnings
4549 is set we generate a warning message, otherwise we will just
4550 ignore the option. */
4551 for (j = 0; j < NUM_ELEM (documented_lang_options); j++)
4553 option = documented_lang_options[j].option;
4556 lang = documented_lang_options[j].description;
4557 else if (! strncmp (argv[i], option, strlen (option)))
4561 if (j != NUM_ELEM (documented_lang_options))
4565 warning ("Ignoring command line option '%s'", argv[i]);
4568 (It is valid for %s but not the selected langauge)", lang);
4572 error ("Unrecognized option `%s'", argv[i]);
4578 /* Checker uses the frame pointer. */
4579 if (flag_check_memory_usage)
4580 flag_omit_frame_pointer = 0;
4584 /* Inlining does not work if not optimizing,
4585 so force it not to be done. */
4589 /* The c_decode_option and lang_decode_option functions set
4590 this to `2' if -Wall is used, so we can avoid giving out
4591 lots of errors for people who don't realize what -Wall does. */
4592 if (warn_uninitialized == 1)
4593 warning ("-Wuninitialized is not supported without -O");
4596 #ifdef OVERRIDE_OPTIONS
4597 /* Some machines may reject certain combinations of options. */
4601 if (exceptions_via_longjmp == 2)
4603 #ifdef DWARF2_UNWIND_INFO
4604 exceptions_via_longjmp = ! DWARF2_UNWIND_INFO;
4606 exceptions_via_longjmp = 1;
4610 /* Set up the align_*_log variables, defaulting them to 1 if they
4611 were still unset. */
4612 if (align_loops <= 0) align_loops = 1;
4613 align_loops_log = floor_log2 (align_loops*2-1);
4614 if (align_jumps <= 0) align_jumps = 1;
4615 align_jumps_log = floor_log2 (align_jumps*2-1);
4616 if (align_labels <= 0) align_labels = 1;
4617 align_labels_log = floor_log2 (align_labels*2-1);
4618 if (align_functions <= 0) align_functions = 1;
4619 align_functions_log = floor_log2 (align_functions*2-1);
4621 if (profile_block_flag == 3)
4623 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4624 profile_block_flag = 2;
4627 /* Unrolling all loops implies that standard loop unrolling must also
4629 if (flag_unroll_all_loops)
4630 flag_unroll_loops = 1;
4631 /* Loop unrolling requires that strength_reduction be on also. Silently
4632 turn on strength reduction here if it isn't already on. Also, the loop
4633 unrolling code assumes that cse will be run after loop, so that must
4634 be turned on also. */
4635 if (flag_unroll_loops)
4637 flag_strength_reduce = 1;
4638 flag_rerun_cse_after_loop = 1;
4641 /* Warn about options that are not supported on this machine. */
4642 #ifndef INSN_SCHEDULING
4643 if (flag_schedule_insns || flag_schedule_insns_after_reload)
4644 warning ("instruction scheduling not supported on this target machine");
4647 if (flag_delayed_branch)
4648 warning ("this target machine does not have delayed branches");
4651 user_label_prefix = USER_LABEL_PREFIX;
4652 if (flag_leading_underscore != -1)
4654 /* If the default prefix is more complicated than "" or "_",
4655 issue a warning and ignore this option. */
4656 if (user_label_prefix[0] == 0 ||
4657 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
4659 user_label_prefix = flag_leading_underscore ? "_" : "";
4662 warning ("-f%sleading-underscore not supported on this target machine",
4663 flag_leading_underscore ? "" : "no-");
4666 /* If we are in verbose mode, write out the version and maybe all the
4667 option flags in use. */
4670 print_version (stderr, "");
4672 print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
4675 compile_file (filename);
4677 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__)) && !defined(__INTERIX)
4680 char *lim = (char *) sbrk (0);
4682 fnotice (stderr, "Data size %ld.\n", (long) (lim - (char *) &environ));
4687 system ("ps -l 1>&2");
4690 #endif /* not USG */
4693 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX */
4696 return (FATAL_EXIT_CODE);
4698 return (FATAL_EXIT_CODE);
4699 return (SUCCESS_EXIT_CODE);
4702 /* Decode -m switches. */
4703 /* Decode the switch -mNAME. */
4706 set_target_switch (name)
4710 int valid_target_option = 0;
4712 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
4713 if (!strcmp (target_switches[j].name, name))
4715 if (target_switches[j].value < 0)
4716 target_flags &= ~-target_switches[j].value;
4718 target_flags |= target_switches[j].value;
4719 valid_target_option = 1;
4722 #ifdef TARGET_OPTIONS
4723 if (!valid_target_option)
4724 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
4726 int len = strlen (target_options[j].prefix);
4727 if (!strncmp (target_options[j].prefix, name, len))
4729 *target_options[j].variable = name + len;
4730 valid_target_option = 1;
4735 if (!valid_target_option)
4736 error ("Invalid option `%s'", name);
4739 /* Print version information to FILE.
4740 Each line begins with INDENT (for the case where FILE is the
4741 assembler output file). */
4744 print_version (file, indent)
4749 #define __VERSION__ "[?]"
4753 "%s%s%s version %s (%s) compiled by GNU C version %s.\n"
4755 "%s%s%s version %s (%s) compiled by CC.\n"
4757 , indent, *indent != 0 ? " " : "",
4758 language_string, version_string, TARGET_NAME, __VERSION__);
4761 /* Print an option value and return the adjusted position in the line.
4762 ??? We don't handle error returns from fprintf (disk full); presumably
4763 other code will catch a disk full though. */
4766 print_single_switch (file, pos, max, indent, sep, term, type, name)
4769 const char *indent, *sep, *term, *type, *name;
4771 /* The ultrix fprintf returns 0 on success, so compute the result we want
4772 here since we need it for the following test. */
4773 int len = strlen (sep) + strlen (type) + strlen (name);
4778 fprintf (file, "%s", term);
4783 fprintf (file, "%s", indent);
4784 pos = strlen (indent);
4786 fprintf (file, "%s%s%s", sep, type, name);
4791 /* Print active target switches to FILE.
4792 POS is the current cursor position and MAX is the size of a "line".
4793 Each line begins with INDENT and ends with TERM.
4794 Each switch is separated from the next by SEP. */
4797 print_switch_values (file, pos, max, indent, sep, term)
4800 const char *indent, *sep, *term;
4805 /* Print the options as passed. */
4807 pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
4808 _("options passed: "), "");
4810 for (p = &save_argv[1]; *p != NULL; p++)
4814 if (strcmp (*p, "-o") == 0)
4820 if (strcmp (*p, "-quiet") == 0)
4822 if (strcmp (*p, "-version") == 0)
4827 pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
4830 fprintf (file, "%s", term);
4832 /* Print the -f and -m options that have been enabled.
4833 We don't handle language specific options but printing argv
4836 pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
4837 _("options enabled: "), "");
4839 for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
4840 if (*f_options[j].variable == f_options[j].on_value)
4841 pos = print_single_switch (file, pos, max, indent, sep, term,
4842 "-f", f_options[j].string);
4844 /* Print target specific options. */
4846 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
4847 if (target_switches[j].name[0] != '\0'
4848 && target_switches[j].value > 0
4849 && ((target_switches[j].value & target_flags)
4850 == target_switches[j].value))
4852 pos = print_single_switch (file, pos, max, indent, sep, term,
4853 "-m", target_switches[j].name);
4856 #ifdef TARGET_OPTIONS
4857 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
4858 if (*target_options[j].variable != NULL)
4861 sprintf (prefix, "-m%s", target_options[j].prefix);
4862 pos = print_single_switch (file, pos, max, indent, sep, term,
4863 prefix, *target_options[j].variable);
4867 fprintf (file, "%s", term);
4870 /* Record the beginning of a new source file, named FILENAME. */
4873 debug_start_source_file (filename)
4874 register const char *filename ATTRIBUTE_UNUSED;
4876 #ifdef DBX_DEBUGGING_INFO
4877 if (write_symbols == DBX_DEBUG)
4878 dbxout_start_new_source_file (filename);
4880 #ifdef DWARF_DEBUGGING_INFO
4881 if (debug_info_level == DINFO_LEVEL_VERBOSE
4882 && write_symbols == DWARF_DEBUG)
4883 dwarfout_start_new_source_file (filename);
4884 #endif /* DWARF_DEBUGGING_INFO */
4885 #ifdef DWARF2_DEBUGGING_INFO
4886 if (debug_info_level == DINFO_LEVEL_VERBOSE
4887 && write_symbols == DWARF2_DEBUG)
4888 dwarf2out_start_source_file (filename);
4889 #endif /* DWARF2_DEBUGGING_INFO */
4890 #ifdef SDB_DEBUGGING_INFO
4891 if (write_symbols == SDB_DEBUG)
4892 sdbout_start_new_source_file (filename);
4896 /* Record the resumption of a source file. LINENO is the line number in
4897 the source file we are returning to. */
4900 debug_end_source_file (lineno)
4901 register unsigned lineno ATTRIBUTE_UNUSED;
4903 #ifdef DBX_DEBUGGING_INFO
4904 if (write_symbols == DBX_DEBUG)
4905 dbxout_resume_previous_source_file ();
4907 #ifdef DWARF_DEBUGGING_INFO
4908 if (debug_info_level == DINFO_LEVEL_VERBOSE
4909 && write_symbols == DWARF_DEBUG)
4910 dwarfout_resume_previous_source_file (lineno);
4911 #endif /* DWARF_DEBUGGING_INFO */
4912 #ifdef DWARF2_DEBUGGING_INFO
4913 if (debug_info_level == DINFO_LEVEL_VERBOSE
4914 && write_symbols == DWARF2_DEBUG)
4915 dwarf2out_end_source_file ();
4916 #endif /* DWARF2_DEBUGGING_INFO */
4917 #ifdef SDB_DEBUGGING_INFO
4918 if (write_symbols == SDB_DEBUG)
4919 sdbout_resume_previous_source_file ();
4923 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
4924 the tail part of the directive line, i.e. the part which is past the
4925 initial whitespace, #, whitespace, directive-name, whitespace part. */
4928 debug_define (lineno, buffer)
4929 register unsigned lineno ATTRIBUTE_UNUSED;
4930 register char *buffer ATTRIBUTE_UNUSED;
4932 #ifdef DWARF_DEBUGGING_INFO
4933 if (debug_info_level == DINFO_LEVEL_VERBOSE
4934 && write_symbols == DWARF_DEBUG)
4935 dwarfout_define (lineno, buffer);
4936 #endif /* DWARF_DEBUGGING_INFO */
4937 #ifdef DWARF2_DEBUGGING_INFO
4938 if (debug_info_level == DINFO_LEVEL_VERBOSE
4939 && write_symbols == DWARF2_DEBUG)
4940 dwarf2out_define (lineno, buffer);
4941 #endif /* DWARF2_DEBUGGING_INFO */
4944 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
4945 the tail part of the directive line, i.e. the part which is past the
4946 initial whitespace, #, whitespace, directive-name, whitespace part. */
4949 debug_undef (lineno, buffer)
4950 register unsigned lineno ATTRIBUTE_UNUSED;
4951 register char *buffer ATTRIBUTE_UNUSED;
4953 #ifdef DWARF_DEBUGGING_INFO
4954 if (debug_info_level == DINFO_LEVEL_VERBOSE
4955 && write_symbols == DWARF_DEBUG)
4956 dwarfout_undef (lineno, buffer);
4957 #endif /* DWARF_DEBUGGING_INFO */
4958 #ifdef DWARF2_DEBUGGING_INFO
4959 if (debug_info_level == DINFO_LEVEL_VERBOSE
4960 && write_symbols == DWARF2_DEBUG)
4961 dwarf2out_undef (lineno, buffer);
4962 #endif /* DWARF2_DEBUGGING_INFO */
4965 /* Returns nonzero if it is appropriate not to emit any debugging
4966 information for BLOCK, because it doesn't contain any instructions.
4967 This may not be the case for blocks containing nested functions, since
4968 we may actually call such a function even though the BLOCK information
4972 debug_ignore_block (block)
4973 tree block ATTRIBUTE_UNUSED;
4975 /* Never delete the BLOCK for the outermost scope
4976 of the function; we can refer to names from
4977 that scope even if the block notes are messed up. */
4978 if (is_body_block (block))
4981 #ifdef DWARF2_DEBUGGING_INFO
4982 if (write_symbols == DWARF2_DEBUG)
4983 return dwarf2out_ignore_block (block);