1 /* Top level of GNU C compiler
2 Copyright (C) 1987, 88, 89, 92-98, 1999, 2000 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* This is the top level of cc1/c++.
22 It parses command args, opens files, invokes the various passes
23 in the proper order, and counts the time used by each.
24 Error messages and low-level interface to malloc also handled here. */
27 #undef FLOAT /* This is for hpux. They should change hpux. */
28 #undef FFS /* Some systems define this in param.h. */
33 #ifdef HAVE_SYS_RESOURCE_H
34 # include <sys/resource.h>
37 #ifdef HAVE_SYS_TIMES_H
38 # include <sys/times.h>
46 #include "insn-attr.h"
47 #include "insn-codes.h"
48 #include "insn-config.h"
56 #include "basic-block.h"
63 #ifdef DWARF_DEBUGGING_INFO
67 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
68 #include "dwarf2out.h"
71 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
75 #ifdef SDB_DEBUGGING_INFO
79 #ifdef XCOFF_DEBUGGING_INFO
84 /* The extra parameters substantially improve the I/O performance. */
86 vms_fopen (fname
, type
)
90 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
91 fixed arguments, which matches ANSI's specification but not VAXCRTL's
92 pre-ANSI implementation. This hack circumvents the mismatch problem. */
93 FILE *(*vmslib_fopen
)() = (FILE *(*)()) fopen
;
96 return (*vmslib_fopen
) (fname
, type
, "mbc=32",
97 "deq=64", "fop=tef", "shr=nil");
99 return (*vmslib_fopen
) (fname
, type
, "mbc=32");
101 #define fopen vms_fopen
104 #ifndef DEFAULT_GDB_EXTENSIONS
105 #define DEFAULT_GDB_EXTENSIONS 1
108 /* If more than one debugging type is supported, you must define
109 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
111 This is one long line cause VAXC can't handle a \-newline. */
112 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
113 #ifndef PREFERRED_DEBUGGING_TYPE
114 You Lose
! You must define PREFERRED_DEBUGGING_TYPE
!
115 #endif /* no PREFERRED_DEBUGGING_TYPE */
116 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
117 so the following code needn't care. */
118 #ifdef DBX_DEBUGGING_INFO
119 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
121 #ifdef SDB_DEBUGGING_INFO
122 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
124 #ifdef DWARF_DEBUGGING_INFO
125 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
127 #ifdef DWARF2_DEBUGGING_INFO
128 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
130 #ifdef XCOFF_DEBUGGING_INFO
131 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
133 #endif /* More than one debugger format enabled. */
135 /* If still not defined, must have been because no debugging formats
137 #ifndef PREFERRED_DEBUGGING_TYPE
138 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
141 #if ! (defined (VMS) || defined (OS2))
142 extern char **environ
;
144 extern char *version_string
;
146 /* Carry information from ASM_DECLARE_OBJECT_NAME
147 to ASM_FINISH_DECLARE_OBJECT. */
149 extern int size_directive_output
;
150 extern tree last_assemble_variable_decl
;
152 static void set_target_switch
PROTO((const char *));
153 static const char *decl_name
PROTO((tree
, int));
155 extern void set_fatal_function
PROTO((void (*)(const char *, va_list)));
156 static void float_signal
PROTO((int)) ATTRIBUTE_NORETURN
;
157 static void pipe_closed
PROTO((int)) ATTRIBUTE_NORETURN
;
158 #ifdef ASM_IDENTIFY_LANGUAGE
159 /* This might or might not be used in ASM_IDENTIFY_LANGUAGE. */
160 static void output_lang_identify
PROTO((FILE *)) ATTRIBUTE_UNUSED
;
162 static void open_dump_file
PROTO((const char *, const char *));
163 static void close_dump_file
PROTO((void (*) (FILE *, rtx
), rtx
));
164 static void dump_rtl
PROTO((const char *, tree
, void (*) (FILE *, rtx
), rtx
));
165 static void clean_dump_file
PROTO((const char *));
166 static void compile_file
PROTO((char *));
167 static void display_help
PROTO ((void));
168 static void mark_file_stack
PROTO ((void *));
170 static void decode_d_option
PROTO ((const char *));
171 static int decode_f_option
PROTO ((const char *));
172 static int decode_W_option
PROTO ((const char *));
173 static int decode_g_option
PROTO ((const char *));
174 static unsigned independent_decode_option
PROTO ((int, char **, unsigned));
176 static void print_version
PROTO((FILE *, const char *));
177 static int print_single_switch
PROTO((FILE *, int, int, const char *,
178 const char *, const char *,
179 const char *, const char *));
180 static void print_switch_values
PROTO((FILE *, int, int, const char *,
181 const char *, const char *));
183 /* Length of line when printing switch values. */
186 /* Name of program invoked, sans directories. */
188 const char *progname
;
190 /* Copy of arguments to main. */
194 /* Name of current original source file (what was input to cpp).
195 This comes from each #-command in the actual input. */
197 char *input_filename
;
199 /* Name of top-level original source file (what was input to cpp).
200 This comes from the #-command at the beginning of the actual input.
201 If there isn't any there, then this is the cc1 input file name. */
203 char *main_input_filename
;
205 /* Current line number in real source file. */
209 /* Nonzero if it is unsafe to create any new pseudo registers. */
212 /* Stack of currently pending input files. */
214 struct file_stack
*input_file_stack
;
216 /* Incremented on each change to input_file_stack. */
217 int input_file_stack_tick
;
219 /* Name to use as base of names for dump output files. */
221 const char *dump_base_name
;
223 /* Bit flags that specify the machine subtype we are compiling for.
224 Bits are tested using macros TARGET_... defined in the tm.h file
225 and set by `-m...' switches. Must be defined in rtlanal.c. */
227 extern int target_flags
;
229 /* Flags saying which kinds of debugging dump have been requested. */
232 int rtl_dump_and_exit
= 0;
233 int jump_opt_dump
= 0;
234 int addressof_dump
= 0;
239 int branch_prob_dump
= 0;
241 int combine_dump
= 0;
242 int regmove_dump
= 0;
244 int local_reg_dump
= 0;
245 int global_reg_dump
= 0;
247 int peephole2_dump
= 0;
249 int jump2_opt_dump
= 0;
251 int dbr_sched_dump
= 0;
253 int flag_print_asm_name
= 0;
255 int stack_reg_dump
= 0;
257 #ifdef MACHINE_DEPENDENT_REORG
258 int mach_dep_reorg_dump
= 0;
260 static int flag_print_mem
= 0;
261 static int version_flag
= 0;
262 static char * filename
= 0;
263 enum graph_dump_types graph_dump_format
;
265 /* Name for output file of assembly code, specified with -o. */
269 /* Value of the -G xx switch, and whether it was passed or not. */
273 /* Type(s) of debugging information we are producing (if any).
274 See flags.h for the definitions of the different possible
275 types of debugging information. */
276 enum debug_info_type write_symbols
= NO_DEBUG
;
278 /* Level of debugging information we are producing. See flags.h
279 for the definitions of the different possible levels. */
280 enum debug_info_level debug_info_level
= DINFO_LEVEL_NONE
;
282 /* Nonzero means use GNU-only extensions in the generated symbolic
283 debugging information. */
284 /* Currently, this only has an effect when write_symbols is set to
285 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
286 int use_gnu_debug_info_extensions
= 0;
288 /* Nonzero means do optimizations. -O.
289 Particular numeric values stand for particular amounts of optimization;
290 thus, -O2 stores 2 here. However, the optimizations beyond the basic
291 ones are not controlled directly by this variable. Instead, they are
292 controlled by individual `flag_...' variables that are defaulted
293 based on this variable. */
297 /* Nonzero means optimize for size. -Os.
298 The only valid values are zero and non-zero. When optimize_size is
299 non-zero, optimize defaults to 2, but certain individual code
300 bloating optimizations are disabled. */
302 int optimize_size
= 0;
304 /* Number of error messages and warning messages so far. */
307 int warningcount
= 0;
310 /* Pointer to function to compute the name to use to print a declaration.
311 DECL is the declaration in question.
312 VERBOSITY determines what information will be printed:
313 0: DECL_NAME, demangled as necessary.
314 1: and scope information.
315 2: and any other information that might be interesting, such as function
316 parameter types in C++. */
318 const char *(*decl_printable_name
) PROTO ((tree
, int));
320 /* Pointer to function to compute rtl for a language-specific tree code. */
322 typedef rtx (*lang_expand_expr_t
)
323 PROTO ((union tree_node
*, rtx
, enum machine_mode
,
324 enum expand_modifier modifier
));
326 lang_expand_expr_t lang_expand_expr
= 0;
328 tree (*lang_expand_constant
) PROTO((tree
)) = 0;
330 /* Pointer to function to finish handling an incomplete decl at the
331 end of compilation. */
333 void (*incomplete_decl_finalize_hook
) PROTO((tree
)) = 0;
335 /* Nonzero if generating code to do profiling. */
337 int profile_flag
= 0;
339 /* Nonzero if generating code to do profiling on a line-by-line basis. */
341 int profile_block_flag
;
343 /* Nonzero if generating code to profile program flow graph arcs. */
345 int profile_arc_flag
= 0;
347 /* Nonzero if generating info for gcov to calculate line test coverage. */
349 int flag_test_coverage
= 0;
351 /* Nonzero indicates that branch taken probabilities should be calculated. */
353 int flag_branch_probabilities
= 0;
355 /* Nonzero for -pedantic switch: warn about anything
356 that standard spec forbids. */
360 /* Temporarily suppress certain warnings.
361 This is set while reading code from a system header file. */
363 int in_system_header
= 0;
365 /* Nonzero means do stupid register allocation.
366 Currently, this is 1 if `optimize' is 0. */
368 int obey_regdecls
= 0;
370 /* Don't print functions as they are compiled and don't print
371 times taken by the various passes. -quiet. */
377 /* Nonzero means `char' should be signed. */
379 int flag_signed_char
;
381 /* Nonzero means give an enum type only as many bytes as it needs. */
383 int flag_short_enums
;
385 /* Nonzero for -fcaller-saves: allocate values in regs that need to
386 be saved across function calls, if that produces overall better code.
387 Optional now, so people can test it. */
389 #ifdef DEFAULT_CALLER_SAVES
390 int flag_caller_saves
= 1;
392 int flag_caller_saves
= 0;
395 /* Nonzero if structures and unions should be returned in memory.
397 This should only be defined if compatibility with another compiler or
398 with an ABI is needed, because it results in slower code. */
400 #ifndef DEFAULT_PCC_STRUCT_RETURN
401 #define DEFAULT_PCC_STRUCT_RETURN 1
404 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
406 int flag_pcc_struct_return
= DEFAULT_PCC_STRUCT_RETURN
;
408 /* Nonzero for -fforce-mem: load memory value into a register
409 before arithmetic on it. This makes better cse but slower compilation. */
411 int flag_force_mem
= 0;
413 /* Nonzero for -fforce-addr: load memory address into a register before
414 reference to memory. This makes better cse but slower compilation. */
416 int flag_force_addr
= 0;
418 /* Nonzero for -fdefer-pop: don't pop args after each function call;
419 instead save them up to pop many calls' args with one insns. */
421 int flag_defer_pop
= 0;
423 /* Nonzero for -ffloat-store: don't allocate floats and doubles
424 in extended-precision registers. */
426 int flag_float_store
= 0;
428 /* Nonzero for -fcse-follow-jumps:
429 have cse follow jumps to do a more extensive job. */
431 int flag_cse_follow_jumps
;
433 /* Nonzero for -fcse-skip-blocks:
434 have cse follow a branch around a block. */
435 int flag_cse_skip_blocks
;
437 /* Nonzero for -fexpensive-optimizations:
438 perform miscellaneous relatively-expensive optimizations. */
439 int flag_expensive_optimizations
;
441 /* Nonzero for -fthread-jumps:
442 have jump optimize output of loop. */
444 int flag_thread_jumps
;
446 /* Nonzero enables strength-reduction in loop.c. */
448 int flag_strength_reduce
= 0;
450 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
451 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
452 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
455 int flag_unroll_loops
;
457 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
458 This is generally not a win. */
460 int flag_unroll_all_loops
;
462 /* Nonzero forces all invariant computations in loops to be moved
465 int flag_move_all_movables
= 0;
467 /* Nonzero forces all general induction variables in loops to be
470 int flag_reduce_all_givs
= 0;
472 /* Nonzero to perform full register move optimization passes. This is the
475 int flag_regmove
= 0;
477 /* Nonzero for -fwritable-strings:
478 store string constants in data segment and don't uniquize them. */
480 int flag_writable_strings
= 0;
482 /* Nonzero means don't put addresses of constant functions in registers.
483 Used for compiling the Unix kernel, where strange substitutions are
484 done on the assembly output. */
486 int flag_no_function_cse
= 0;
488 /* Nonzero for -fomit-frame-pointer:
489 don't make a frame pointer in simple functions that don't require one. */
491 int flag_omit_frame_pointer
= 0;
493 /* Nonzero means place each function into its own section on those platforms
494 which support arbitrary section names and unlimited numbers of sections. */
496 int flag_function_sections
= 0;
498 /* ... and similar for data. */
500 int flag_data_sections
= 0;
502 /* Nonzero to inhibit use of define_optimization peephole opts. */
504 int flag_no_peephole
= 0;
506 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
507 operations in the interest of optimization. For example it allows
508 GCC to assume arguments to sqrt are nonnegative numbers, allowing
509 faster code for sqrt to be generated. */
511 int flag_fast_math
= 0;
513 /* Nonzero means the front end generally wants `errno' maintained by math
514 operations, like built-in SQRT, unless overridden by flag_fast_math. */
516 int flag_errno_math
= 1;
518 /* 0 means straightforward implementation of complex divide acceptable.
519 1 means wide ranges of inputs must work for complex divide.
520 2 means C9X-like requirements for complex divide (not yet implemented). */
522 int flag_complex_divide_method
= 0;
524 /* Nonzero means all references through pointers are volatile. */
528 /* Nonzero means treat all global and extern variables as volatile. */
530 int flag_volatile_global
;
532 /* Nonzero means treat all static variables as volatile. */
534 int flag_volatile_static
;
536 /* Nonzero means just do syntax checking; don't output anything. */
538 int flag_syntax_only
= 0;
540 /* Nonzero means perform global cse. */
542 static int flag_gcse
;
544 /* Nonzero means to use global dataflow analysis to eliminate
545 useless null pointer tests. */
547 static int flag_delete_null_pointer_checks
;
549 /* Nonzero means to rerun cse after loop optimization. This increases
550 compilation time about 20% and picks up a few more common expressions. */
552 static int flag_rerun_cse_after_loop
;
554 /* Nonzero means to run loop optimizations twice. */
556 int flag_rerun_loop_opt
;
558 /* Nonzero for -finline-functions: ok to inline functions that look like
559 good inline candidates. */
561 int flag_inline_functions
;
563 /* Nonzero for -fkeep-inline-functions: even if we make a function
564 go inline everywhere, keep its definition around for debugging
567 int flag_keep_inline_functions
;
569 /* Nonzero means that functions will not be inlined. */
573 /* Nonzero means that we should emit static const variables
574 regardless of whether or not optimization is turned on. */
576 int flag_keep_static_consts
= 1;
578 /* Nonzero means we should be saving declaration info into a .X file. */
580 int flag_gen_aux_info
= 0;
582 /* Specified name of aux-info file. */
584 static char *aux_info_file_name
;
586 /* Nonzero means make the text shared if supported. */
588 int flag_shared_data
;
590 /* Nonzero means schedule into delayed branch slots if supported. */
592 int flag_delayed_branch
;
594 /* Nonzero if we are compiling pure (sharable) code.
595 Value is 1 if we are doing reasonable (i.e. simple
596 offset into offset table) pic. Value is 2 if we can
597 only perform register offsets. */
601 /* Nonzero means generate extra code for exception handling and enable
602 exception handling. */
606 /* Nonzero means use the new model for exception handling. Replaces
607 -DNEW_EH_MODEL as a compile option. */
609 int flag_new_exceptions
= 1;
611 /* Nonzero means generate frame unwind info table when supported */
613 int flag_unwind_tables
= 0;
615 /* Nonzero means don't place uninitialized global data in common storage
620 /* Nonzero means pretend it is OK to examine bits of target floats,
621 even if that isn't true. The resulting code will have incorrect constants,
622 but the same series of instructions that the native compiler would make. */
624 int flag_pretend_float
;
626 /* Nonzero means change certain warnings into errors.
627 Usually these are warnings about failure to conform to some standard. */
629 int flag_pedantic_errors
= 0;
631 /* flag_schedule_insns means schedule insns within basic blocks (before
633 flag_schedule_insns_after_reload means schedule insns after
636 int flag_schedule_insns
= 0;
637 int flag_schedule_insns_after_reload
= 0;
639 /* The following flags have effect only for scheduling before register
642 flag_schedule_interblock means schedule insns accross basic blocks.
643 flag_schedule_speculative means allow speculative motion of non-load insns.
644 flag_schedule_speculative_load means allow speculative motion of some
646 flag_schedule_speculative_load_dangerous allows speculative motion of more
649 int flag_schedule_interblock
= 1;
650 int flag_schedule_speculative
= 1;
651 int flag_schedule_speculative_load
= 0;
652 int flag_schedule_speculative_load_dangerous
= 0;
654 /* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple
655 by a cheaper branch, on a count register. */
656 int flag_branch_on_count_reg
;
658 /* -finhibit-size-directive inhibits output of .size for ELF.
659 This is used only for compiling crtstuff.c,
660 and it may be extended to other effects
661 needed for crtstuff.c on other systems. */
662 int flag_inhibit_size_directive
= 0;
664 /* -fverbose-asm causes extra commentary information to be produced in
665 the generated assembly code (to make it more readable). This option
666 is generally only of use to those who actually need to read the
667 generated assembly code (perhaps while debugging the compiler itself).
668 -fno-verbose-asm, the default, causes the extra information
669 to be omitted and is useful when comparing two assembler files. */
671 int flag_verbose_asm
= 0;
673 /* -dA causes debug commentary information to be produced in
674 the generated assembly code (to make it more readable). This option
675 is generally only of use to those who actually need to read the
676 generated assembly code (perhaps while debugging the compiler itself).
677 Currently, this switch is only used by dwarfout.c; however, it is intended
678 to be a catchall for printing debug information in the assembler file. */
680 int flag_debug_asm
= 0;
682 /* -fgnu-linker specifies use of the GNU linker for initializations.
683 (Or, more generally, a linker that handles initializations.)
684 -fno-gnu-linker says that collect2 will be used. */
686 int flag_gnu_linker
= 0;
688 int flag_gnu_linker
= 1;
691 /* Tag all structures with __attribute__(packed) */
692 int flag_pack_struct
= 0;
694 /* Emit code to check for stack overflow; also may cause large objects
695 to be allocated dynamically. */
696 int flag_stack_check
;
698 /* When non-NULL, indicates that whenever space is allocated on the
699 stack, the resulting stack pointer must not pass this
700 address---that is, for stacks that grow downward, the stack pointer
701 must always be greater than or equal to this address; for stacks
702 that grow upward, the stack pointer must be less than this address.
703 At present, the rtx may be either a REG or a SYMBOL_REF, although
704 the support provided depends on the backend. */
707 /* -fcheck-memory-usage causes extra code to be generated in order to check
708 memory accesses. This is used by a detector of bad memory accesses such
710 int flag_check_memory_usage
= 0;
712 /* -fprefix-function-name causes function name to be prefixed. This
713 can be used with -fcheck-memory-usage to isolate code compiled with
714 -fcheck-memory-usage. */
715 int flag_prefix_function_name
= 0;
717 /* 0 if pointer arguments may alias each other. True in C.
718 1 if pointer arguments may not alias each other but may alias
720 2 if pointer arguments may not alias each other and may not
721 alias global variables. True in Fortran.
722 This defaults to 0 for C. */
723 int flag_argument_noalias
= 0;
725 /* Nonzero if we should do (language-dependent) alias analysis.
726 Typically, this analysis will assume that expressions of certain
727 types do not alias expressions of certain other types. Only used
728 if alias analysis (in general) is enabled. */
729 int flag_strict_aliasing
= 0;
731 /* Instrument functions with calls at entry and exit, for profiling. */
732 int flag_instrument_function_entry_exit
= 0;
734 /* Nonzero means ignore `#ident' directives. 0 means handle them.
735 On SVR4 targets, it also controls whether or not to emit a
736 string identifying the compiler. */
738 int flag_no_ident
= 0;
740 /* This will perform a peephole pass before sched2. */
741 int flag_peephole2
= 0;
743 /* -fbounded-pointers causes gcc to compile pointers as composite
744 objects occupying three words: the pointer value, the base address
745 of the referent object, and the address immediately beyond the end
746 of the referent object. The base and extent allow us to perform
747 runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
748 int flag_bounded_pointers
= 0;
750 /* -fcheck-bounds causes gcc to generate array bounds checks.
751 For C, C++: defaults to value of flag_bounded_pointers.
752 For ObjC: defaults to off.
753 For Java: defaults to on.
754 For Fortran: defaults to off.
755 For CHILL: defaults to off. */
756 int flag_bounds_check
= 0;
758 /* If one, renumber instruction UIDs to reduce the number of
759 unused UIDs if there are a lot of instructions. If greater than
760 one, unconditionally renumber instruction UIDs. */
761 int flag_renumber_insns
= 1;
763 /* Values of the -falign-* flags: how much to align labels in code.
764 0 means `use default', 1 means `don't align'.
765 For each variable, there is an _log variant which is the power
766 of two not less than the variable, for .align output. */
773 int align_labels_log
;
775 int align_functions_log
;
777 /* Table of supported debugging formats. */
781 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
782 constant expression, we use NO_DEBUG in its place. */
783 enum debug_info_type debug_type
;
784 int use_extensions_p
;
785 const char * description
;
789 { "", NO_DEBUG
, DEFAULT_GDB_EXTENSIONS
,
790 "Generate default debug format output" },
791 { "gdb", NO_DEBUG
, 1, "Generate default extended debug format output" },
792 #ifdef DBX_DEBUGGING_INFO
793 { "stabs", DBX_DEBUG
, 0, "Generate STABS format debug output" },
794 { "stabs+", DBX_DEBUG
, 1, "Generate extended STABS format debug output" },
796 #ifdef DWARF_DEBUGGING_INFO
797 { "dwarf", DWARF_DEBUG
, 0, "Generate DWARF-1 format debug output"},
798 { "dwarf+", DWARF_DEBUG
, 1,
799 "Generated extended DWARF-1 format debug output" },
801 #ifdef DWARF2_DEBUGGING_INFO
802 { "dwarf-2", DWARF2_DEBUG
, 0, "Enable DWARF-2 debug output" },
804 #ifdef XCOFF_DEBUGGING_INFO
805 { "xcoff", XCOFF_DEBUG
, 0, "Generate XCOFF format debug output" },
806 { "xcoff+", XCOFF_DEBUG
, 1, "Generate extended XCOFF format debug output" },
808 #ifdef SDB_DEBUGGING_INFO
809 { "coff", SDB_DEBUG
, 0, "Generate COFF format debug output" },
819 const char * description
;
821 lang_independent_options
;
823 /* Add or remove a leading underscore from user symbols. */
824 int flag_leading_underscore
= -1;
826 /* The user symbol prefix after having resolved same. */
827 const char *user_label_prefix
;
829 /* A default for same. */
830 #ifndef USER_LABEL_PREFIX
831 #define USER_LABEL_PREFIX ""
834 /* Table of language-independent -f options.
835 STRING is the option name. VARIABLE is the address of the variable.
836 ON_VALUE is the value to store in VARIABLE
837 if `-fSTRING' is seen as an option.
838 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
840 lang_independent_options f_options
[] =
842 {"float-store", &flag_float_store
, 1,
843 "Do not store floats in registers" },
844 {"volatile", &flag_volatile
, 1,
845 "Consider all mem refs through pointers as volatile"},
846 {"volatile-global", &flag_volatile_global
, 1,
847 "Consider all mem refs to global data to be volatile" },
848 {"volatile-static", &flag_volatile_static
, 1,
849 "Consider all mem refs to static data to be volatile" },
850 {"defer-pop", &flag_defer_pop
, 1,
851 "Defer popping functions args from stack until later" },
852 {"omit-frame-pointer", &flag_omit_frame_pointer
, 1,
853 "When possible do not generate stack frames"},
854 {"cse-follow-jumps", &flag_cse_follow_jumps
, 1,
855 "When running CSE, follow jumps to their targets" },
856 {"cse-skip-blocks", &flag_cse_skip_blocks
, 1,
857 "When running CSE, follow conditional jumps" },
858 {"expensive-optimizations", &flag_expensive_optimizations
, 1,
859 "Perform a number of minor, expensive optimisations" },
860 {"thread-jumps", &flag_thread_jumps
, 1,
861 "Perform jump threading optimisations"},
862 {"strength-reduce", &flag_strength_reduce
, 1,
863 "Perform strength reduction optimisations" },
864 {"unroll-loops", &flag_unroll_loops
, 1,
865 "Perform loop unrolling when iteration count is known" },
866 {"unroll-all-loops", &flag_unroll_all_loops
, 1,
867 "Perform loop unrolling for all loops" },
868 {"move-all-movables", &flag_move_all_movables
, 1,
869 "Force all loop invariant computations out of loops" },
870 {"reduce-all-givs", &flag_reduce_all_givs
, 1,
871 "Strength reduce all loop general induction variables" },
872 {"writable-strings", &flag_writable_strings
, 1,
873 "Store strings in writable data section" },
874 {"peephole", &flag_no_peephole
, 0,
875 "Enable machine specific peephole optimisations" },
876 {"force-mem", &flag_force_mem
, 1,
877 "Copy memory operands into registers before using" },
878 {"force-addr", &flag_force_addr
, 1,
879 "Copy memory address constants into regs before using" },
880 {"function-cse", &flag_no_function_cse
, 0,
881 "Allow function addresses to be held in registers" },
882 {"inline-functions", &flag_inline_functions
, 1,
883 "Integrate simple functions into their callers" },
884 {"keep-inline-functions", &flag_keep_inline_functions
, 1,
885 "Generate code for funcs even if they are fully inlined" },
886 {"inline", &flag_no_inline
, 0,
887 "Pay attention to the 'inline' keyword"},
888 {"keep-static-consts", &flag_keep_static_consts
, 1,
889 "Emit static const variables even if they are not used" },
890 {"syntax-only", &flag_syntax_only
, 1,
891 "Check for syntax errors, then stop" },
892 {"shared-data", &flag_shared_data
, 1,
893 "Mark data as shared rather than private" },
894 {"caller-saves", &flag_caller_saves
, 1,
895 "Enable saving registers around function calls" },
896 {"pcc-struct-return", &flag_pcc_struct_return
, 1,
897 "Return 'short' aggregates in memory, not registers" },
898 {"reg-struct-return", &flag_pcc_struct_return
, 0,
899 "Return 'short' aggregates in registers" },
900 {"delayed-branch", &flag_delayed_branch
, 1,
901 "Attempt to fill delay slots of branch instructions" },
902 {"gcse", &flag_gcse
, 1,
903 "Perform the global common subexpression elimination" },
904 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop
, 1,
905 "Run CSE pass after loop optimisations"},
906 {"rerun-loop-opt", &flag_rerun_loop_opt
, 1,
907 "Run the loop optimiser twice"},
908 {"delete-null-pointer-checks", &flag_delete_null_pointer_checks
, 1,
909 "Delete useless null pointer checks" },
910 {"pretend-float", &flag_pretend_float
, 1,
911 "Pretend that host and target use the same FP format"},
912 {"schedule-insns", &flag_schedule_insns
, 1,
913 "Reschedule instructions to avoid pipeline stalls"},
914 {"schedule-insns2", &flag_schedule_insns_after_reload
, 1,
915 "Run two passes of the instruction scheduler"},
916 {"sched-interblock",&flag_schedule_interblock
, 1,
917 "Enable scheduling across basic blocks" },
918 {"sched-spec",&flag_schedule_speculative
, 1,
919 "Allow speculative motion of non-loads" },
920 {"sched-spec-load",&flag_schedule_speculative_load
, 1,
921 "Allow speculative motion of some loads" },
922 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous
, 1,
923 "Allow speculative motion of more loads" },
924 {"branch-count-reg",&flag_branch_on_count_reg
, 1,
925 "Replace add,compare,branch with branch on count reg"},
926 {"pic", &flag_pic
, 1,
927 "Generate position independent code, if possible"},
928 {"PIC", &flag_pic
, 2, ""},
929 {"exceptions", &flag_exceptions
, 1,
930 "Enable exception handling" },
931 {"new-exceptions", &flag_new_exceptions
, 1,
932 "Use the new model for exception handling" },
933 {"unwind-tables", &flag_unwind_tables
, 1,
934 "Just generate unwind tables for exception handling" },
935 {"sjlj-exceptions", &exceptions_via_longjmp
, 1,
936 "Use setjmp/longjmp to handle exceptions" },
937 {"asynchronous-exceptions", &asynchronous_exceptions
, 1,
938 "Support asynchronous exceptions" },
939 {"profile-arcs", &profile_arc_flag
, 1,
940 "Insert arc based program profiling code" },
941 {"test-coverage", &flag_test_coverage
, 1,
942 "Create data files needed by gcov" },
943 {"branch-probabilities", &flag_branch_probabilities
, 1,
944 "Use profiling information for branch probabilities" },
945 {"fast-math", &flag_fast_math
, 1,
946 "Improve FP speed by violating ANSI & IEEE rules" },
947 {"common", &flag_no_common
, 0,
948 "Do not put unitialised globals in the common section" },
949 {"inhibit-size-directive", &flag_inhibit_size_directive
, 1,
950 "Do not generate .size directives" },
951 {"function-sections", &flag_function_sections
, 1,
952 "place each function into its own section" },
953 {"data-sections", &flag_data_sections
, 1,
954 "place data items into their own section" },
955 {"verbose-asm", &flag_verbose_asm
, 1,
956 "Add extra commentry to assembler output"},
957 {"gnu-linker", &flag_gnu_linker
, 1,
958 "Output GNU ld formatted global initialisers"},
959 {"regmove", &flag_regmove
, 1,
960 "Enables a register move optimisation"},
961 {"optimize-register-move", &flag_regmove
, 1,
962 "Do the full regmove optimization pass"},
963 {"pack-struct", &flag_pack_struct
, 1,
964 "Pack structure members together without holes" },
965 {"stack-check", &flag_stack_check
, 1,
966 "Insert stack checking code into the program" },
967 {"argument-alias", &flag_argument_noalias
, 0,
968 "Specify that arguments may alias each other & globals"},
969 {"argument-noalias", &flag_argument_noalias
, 1,
970 "Assume arguments may alias globals but not each other"},
971 {"argument-noalias-global", &flag_argument_noalias
, 2,
972 "Assume arguments do not alias each other or globals" },
973 {"strict-aliasing", &flag_strict_aliasing
, 1,
974 "Assume strict aliasing rules apply" },
975 {"align-loops", &align_loops
, 0,
976 "Align the start of loops" },
977 {"align-jumps", &align_jumps
, 0,
978 "Align labels which are only reached by jumping" },
979 {"align-labels", &align_labels
, 0,
980 "Align all labels" },
981 {"align-functions", &align_functions
, 0,
982 "Align the start of functions" },
983 {"check-memory-usage", &flag_check_memory_usage
, 1,
984 "Generate code to check every memory access" },
985 {"prefix-function-name", &flag_prefix_function_name
, 1,
986 "Add a prefix to all function names" },
987 {"dump-unnumbered", &flag_dump_unnumbered
, 1,
988 "Suppress output of instruction numbers and line number notes in debugging dumps"},
989 {"instrument-functions", &flag_instrument_function_entry_exit
, 1,
990 "Instrument function entry/exit with profiling calls"},
991 {"leading-underscore", &flag_leading_underscore
, 1,
992 "External symbols have a leading underscore" },
993 {"ident", &flag_no_ident
, 0,
994 "Process #ident directives"},
995 { "peephole2", &flag_peephole2
, 1,
996 "Enables an rtl peephole pass run before sched2" },
997 {"math-errno", &flag_errno_math
, 1,
998 "Set errno after built-in math functions"},
999 {"bounded-pointers", &flag_bounded_pointers
, 1,
1000 "Compile pointers as triples: value, base & end" },
1001 {"bounds-check", &flag_bounds_check
, 1,
1002 "Generate code to check bounds before dereferencing pointers and arrays" }
1005 #define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0]))
1007 /* Table of language-specific options. */
1009 static struct lang_opt
1011 const char * option
;
1012 const char * description
;
1014 documented_lang_options
[] =
1016 /* In order not to overload the --help output, the convention
1017 used here is to only describe those options which are not
1018 enabled by default. */
1020 { "-ansi", "Compile just for ANSI C" },
1021 { "-fallow-single-precision",
1022 "Do not promote floats to double if using -traditional" },
1023 { "-std= ", "Determine language standard"},
1025 { "-fsigned-bitfields", "" },
1026 { "-funsigned-bitfields","Make bitfields by unsigned by default" },
1027 { "-fno-signed-bitfields", "" },
1028 { "-fno-unsigned-bitfields","" },
1029 { "-fsigned-char", "Make 'char' be signed by default"},
1030 { "-funsigned-char", "Make 'char' be unsigned by default"},
1031 { "-fno-signed-char", "" },
1032 { "-fno-unsigned-char", "" },
1034 { "-ftraditional", "" },
1035 { "-traditional", "Attempt to support traditional K&R style C"},
1036 { "-fnotraditional", "" },
1037 { "-fno-traditional", "" },
1040 { "-fno-asm", "Do not recognise the 'asm' keyword" },
1041 { "-fbuiltin", "" },
1042 { "-fno-builtin", "Do not recognise any built in functions" },
1043 { "-fhosted", "Assume normal C execution environment" },
1044 { "-fno-hosted", "" },
1046 "Assume that standard libraries & main might not exist" },
1047 { "-fno-freestanding", "" },
1048 { "-fcond-mismatch", "Allow different types as args of ? operator"},
1049 { "-fno-cond-mismatch", "" },
1050 { "-fdollars-in-identifiers", "Allow the use of $ inside identifiers" },
1051 { "-fno-dollars-in-identifiers", "" },
1052 { "-fpreprocessed", "" },
1053 { "-fno-preprocessed", "" },
1054 { "-fshort-double", "Use the same size for double as for float" },
1055 { "-fno-short-double", "" },
1056 { "-fshort-enums", "Use the smallest fitting integer to hold enums"},
1057 { "-fno-short-enums", "" },
1058 { "-fshort-wchar", "Override the underlying type for wchar_t to `unsigned short'" },
1059 { "-fno-short-wchar", "" },
1061 { "-Wall", "Enable most warning messages" },
1062 { "-Wbad-function-cast",
1063 "Warn about casting functions to incompatible types" },
1064 { "-Wno-bad-function-cast", "" },
1065 { "-Wmissing-noreturn",
1066 "Warn about functions which might be candidates for attribute noreturn" },
1067 { "-Wno-missing-noreturn", "" },
1068 { "-Wcast-qual", "Warn about casts which discard qualifiers"},
1069 { "-Wno-cast-qual", "" },
1070 { "-Wchar-subscripts", "Warn about subscripts whose type is 'char'"},
1071 { "-Wno-char-subscripts", "" },
1072 { "-Wcomment", "Warn if nested comments are detected" },
1073 { "-Wno-comment", "" },
1074 { "-Wcomments", "Warn if nested comments are detected" },
1075 { "-Wno-comments", "" },
1076 { "-Wconversion", "Warn about possibly confusing type conversions" },
1077 { "-Wno-conversion", "" },
1078 { "-Wformat", "Warn about printf format anomalies" },
1079 { "-Wno-format", "" },
1080 { "-Wimplicit-function-declaration",
1081 "Warn about implicit function declarations" },
1082 { "-Wno-implicit-function-declaration", "" },
1083 { "-Werror-implicit-function-declaration", "" },
1084 { "-Wimplicit-int", "Warn when a declaration does not specify a type" },
1085 { "-Wno-implicit-int", "" },
1086 { "-Wimplicit", "" },
1087 { "-Wno-implicit", "" },
1088 { "-Wimport", "Warn about the use of the #import directive" },
1089 { "-Wno-import", "" },
1090 { "-Wlong-long","" },
1091 { "-Wno-long-long", "Do not warn about using 'long long' when -pedantic" },
1092 { "-Wmain", "Warn about suspicious declarations of main" },
1093 { "-Wno-main", "" },
1094 { "-Wmissing-braces",
1095 "Warn about possibly missing braces around initialisers" },
1096 { "-Wno-missing-braces", "" },
1097 { "-Wmissing-declarations",
1098 "Warn about global funcs without previous declarations"},
1099 { "-Wno-missing-declarations", "" },
1100 { "-Wmissing-prototypes", "Warn about global funcs without prototypes" },
1101 { "-Wno-missing-prototypes", "" },
1102 { "-Wmultichar", "Warn about use of multicharacter literals"},
1103 { "-Wno-multichar", "" },
1104 { "-Wnested-externs", "Warn about externs not at file scope level" },
1105 { "-Wno-nested-externs", "" },
1106 { "-Wparentheses", "Warn about possible missing parentheses" },
1107 { "-Wno-parentheses", "" },
1108 { "-Wpointer-arith", "Warn about function pointer arithmetic" },
1109 { "-Wno-pointer-arith", "" },
1110 { "-Wredundant-decls",
1111 "Warn about multiple declarations of the same object" },
1112 { "-Wno-redundant-decls", "" },
1113 { "-Wsign-compare", "Warn about signed/unsigned comparisons" },
1114 { "-Wno-sign-compare", "" },
1115 { "-Wfloat-equal", "Warn about testing equality of floating point numbers" },
1116 { "-Wno-float-equal", "" },
1117 { "-Wunknown-pragmas", "Warn about unrecognised pragmas" },
1118 { "-Wno-unknown-pragmas", "" },
1119 { "-Wstrict-prototypes", "Warn about non-prototyped function decls" },
1120 { "-Wno-strict-prototypes", "" },
1121 { "-Wtraditional", "Warn about constructs whose meaning change in ANSI C"},
1122 { "-Wno-traditional", "" },
1123 { "-Wtrigraphs", "Warn when trigraphs are encountered" },
1124 { "-Wno-trigraphs", "" },
1126 { "-Wno-undef", "" },
1127 { "-Wwrite-strings", "Mark strings as 'const char *'"},
1128 { "-Wno-write-strings", "" },
1130 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1132 /* These are for Objective C. */
1133 DEFINE_LANG_NAME ("Objective C")
1135 { "-lang-objc", "" },
1136 { "-gen-decls", "Dump decls to a .decl file" },
1137 { "-fgnu-runtime", "Generate code for GNU runtime environment" },
1138 { "-fno-gnu-runtime", "" },
1139 { "-fnext-runtime", "Generate code for NeXT runtime environment" },
1140 { "-fno-next-runtime", "" },
1141 { "-Wselector", "Warn if a selector has multiple methods" },
1142 { "-Wno-selector", "" },
1143 { "-Wprotocol", "" },
1144 { "-Wno-protocol", "Do not warn if inherited methods are unimplemented"},
1145 { "-print-objc-runtime-info",
1146 "Generate C header of platform specific features" },
1148 #include "options.h"
1152 /* Here is a table, controlled by the tm.h file, listing each -m switch
1153 and which bits in `target_switches' it should set or clear.
1154 If VALUE is positive, it is bits to set.
1155 If VALUE is negative, -VALUE is bits to clear.
1156 (The sign bit is not used so there is no confusion.) */
1162 const char * description
;
1164 target_switches
[] = TARGET_SWITCHES
;
1166 /* This table is similar, but allows the switch to have a value. */
1168 #ifdef TARGET_OPTIONS
1171 const char * prefix
;
1172 const char ** variable
;
1173 const char * description
;
1175 target_options
[] = TARGET_OPTIONS
;
1178 /* Options controlling warnings */
1180 /* Don't print warning messages. -w. */
1182 int inhibit_warnings
= 0;
1184 /* Print various extra warnings. -W. */
1186 int extra_warnings
= 0;
1188 /* Treat warnings as errors. -Werror. */
1190 int warnings_are_errors
= 0;
1192 /* Nonzero to warn about unused local variables. */
1196 /* Nonzero to warn about code which is never reached. */
1198 int warn_notreached
;
1200 /* Nonzero to warn about variables used before they are initialized. */
1202 int warn_uninitialized
;
1204 /* Nonzero means warn about all declarations which shadow others. */
1208 /* Warn if a switch on an enum fails to have a case for every enum value. */
1212 /* Nonzero means warn about function definitions that default the return type
1213 or that use a null return and have a return-type other than void. */
1215 int warn_return_type
;
1217 /* Nonzero means warn about pointer casts that increase the required
1218 alignment of the target type (and might therefore lead to a crash
1219 due to a misaligned access). */
1221 int warn_cast_align
;
1223 /* Nonzero means warn about any identifiers that match in the first N
1224 characters. The value N is in `id_clash_len'. */
1227 unsigned id_clash_len
;
1229 /* Nonzero means warn about any objects definitions whose size is larger
1230 than N bytes. Also want about function definitions whose returned
1231 values are larger than N bytes. The value N is in `larger_than_size'. */
1233 int warn_larger_than
;
1234 unsigned larger_than_size
;
1236 /* Nonzero means warn if inline function is too large. */
1240 /* Warn if a function returns an aggregate,
1241 since there are often incompatible calling conventions for doing this. */
1243 int warn_aggregate_return
;
1245 /* Warn if packed attribute on struct is unnecessary and inefficient. */
1249 /* Warn when gcc pads a structure to an alignment boundary. */
1253 /* Likewise for -W. */
1255 lang_independent_options W_options
[] =
1257 {"unused", &warn_unused
, 1, "Warn when a variable is unused" },
1258 {"error", &warnings_are_errors
, 1, ""},
1259 {"shadow", &warn_shadow
, 1, "Warn when one local variable shadows another" },
1260 {"switch", &warn_switch
, 1,
1261 "Warn about enumerated switches missing a specific case" },
1262 {"aggregate-return", &warn_aggregate_return
, 1,
1263 "Warn about returning structures, unions or arrays" },
1264 {"cast-align", &warn_cast_align
, 1,
1265 "Warn about pointer casts which increase alignment" },
1266 {"unreachable-code", &warn_notreached
, 1,
1267 "Warn about code that will never be executed" },
1268 {"uninitialized", &warn_uninitialized
, 1,
1269 "Warn about unitialized automatic variables"},
1270 {"inline", &warn_inline
, 1,
1271 "Warn when an inlined function cannot be inlined"},
1272 {"packed", &warn_packed
, 1,
1273 "Warn when the packed attribute has no effect on struct layout"},
1274 {"padded", &warn_padded
, 1,
1275 "Warn when padding is required to align struct members"}
1278 /* Output files for assembler code (real compiler output)
1279 and debugging dumps. */
1282 FILE *aux_info_file
;
1283 FILE *rtl_dump_file
= NULL
;
1285 /* Decode the string P as an integral parameter.
1286 If the string is indeed an integer return its numeric value else
1287 issue an Invalid Option error for the option PNAME and return DEFVAL.
1288 If PNAME is zero just return DEFVAL, do not call error. */
1291 read_integral_parameter (p
, pname
, defval
)
1296 const char *endp
= p
;
1300 if (*endp
>= '0' && *endp
<= '9')
1309 error ("Invalid option `%s'", pname
);
1317 /* Time accumulators, to count the total time spent in various passes. */
1321 int integration_time
;
1327 int branch_prob_time
;
1332 int local_alloc_time
;
1333 int global_alloc_time
;
1338 int shorten_branch_time
;
1346 /* Return time used so far, in microseconds. */
1356 #else /* not BeOS */
1357 #if defined (_WIN32) && !defined (__CYGWIN__)
1361 return (clock() * 1000);
1362 #else /* not _WIN32 */
1368 tick
= 1000000 / sysconf(_SC_CLK_TCK
);
1370 return (tms
.tms_utime
+ tms
.tms_stime
) * tick
;
1376 # if HAVE_SYSCONF && defined _SC_CLK_TCK
1377 # define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */
1380 # define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */
1382 # define TICKS_PER_SECOND HZ /* traditional UNIX */
1386 return (tms
.tms_utime
+ tms
.tms_stime
) * (1000000 / TICKS_PER_SECOND
);
1391 struct rusage rusage
;
1392 getrusage (0, &rusage
);
1393 return (rusage
.ru_utime
.tv_sec
* 1000000 + rusage
.ru_utime
.tv_usec
1394 + rusage
.ru_stime
.tv_sec
* 1000000 + rusage
.ru_stime
.tv_usec
);
1401 int proc_system_time
;
1402 int child_user_time
;
1403 int child_system_time
;
1405 times ((void *) &vms_times
);
1406 return (vms_times
.proc_user_time
+ vms_times
.proc_system_time
) * 10000;
1410 #endif /* _SC_CLK_TCK */
1412 #endif /* __BEOS__ */
1415 #define TIMEVAR(VAR, BODY) \
1416 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
1419 print_time (str
, total
)
1424 "time in %s: %d.%06d (%.0f%%)\n",
1425 str
, total
/ 1000000, total
% 1000000,
1426 (double)total
/ (double)all_time
* 100.0);
1429 /* This is the default decl_printable_name function. */
1432 decl_name (decl
, verbosity
)
1434 int verbosity ATTRIBUTE_UNUSED
;
1436 return IDENTIFIER_POINTER (DECL_NAME (decl
));
1439 /* Mark P for GC. Also mark main_input_filename and input_filename. */
1444 struct file_stack
*stack
= *(struct file_stack
**)p
;
1446 /* We're only called for input_file_stack, so we can mark the current
1447 input_filename here as well. */
1448 ggc_mark_string (main_input_filename
);
1449 ggc_mark_string (input_filename
);
1453 ggc_mark_string (stack
->name
);
1454 stack
= stack
->next
;
1459 /* This calls abort and is used to avoid problems when abort if a macro.
1460 It is used when we need to pass the address of abort. */
1468 /* When `malloc.c' is compiled with `rcheck' defined,
1469 it calls this function to report clobberage. */
1473 const char * s ATTRIBUTE_UNUSED
;
1478 /* Return the logarithm of X, base 2, considering X unsigned,
1479 if X is a power of 2. Otherwise, returns -1.
1481 This should be used via the `exact_log2' macro. */
1485 register unsigned HOST_WIDE_INT x
;
1487 register int log
= 0;
1488 /* Test for 0 or a power of 2. */
1489 if (x
== 0 || x
!= (x
& -x
))
1491 while ((x
>>= 1) != 0)
1496 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1497 If X is 0, return -1.
1499 This should be used via the floor_log2 macro. */
1503 register unsigned HOST_WIDE_INT x
;
1505 register int log
= -1;
1512 static int float_handler_set
;
1514 jmp_buf float_handler
;
1516 /* Signals actually come here. */
1519 float_signal (signo
)
1520 /* If this is missing, some compilers complain. */
1521 int signo ATTRIBUTE_UNUSED
;
1523 if (float_handled
== 0)
1525 #if defined (USG) || defined (hpux)
1526 signal (SIGFPE
, float_signal
); /* re-enable the signal catcher */
1529 signal (SIGFPE
, float_signal
);
1530 longjmp (float_handler
, 1);
1533 /* Specify where to longjmp to when a floating arithmetic error happens.
1534 If HANDLER is 0, it means don't handle the errors any more. */
1537 set_float_handler (handler
)
1540 float_handled
= (handler
!= 0);
1542 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
1544 if (float_handled
&& ! float_handler_set
)
1546 signal (SIGFPE
, float_signal
);
1547 float_handler_set
= 1;
1551 /* This is a wrapper function for code which might elicit an
1552 arithmetic exception. That code should be passed in as a function
1553 pointer FN, and one argument DATA. DATA is usually a struct which
1554 contains the real input and output for function FN. This function
1555 returns 0 (failure) if longjmp was called (i.e. an exception
1556 occured.) It returns 1 (success) otherwise. */
1559 do_float_handler (fn
, data
)
1560 void (*fn
) PROTO ((PTR
));
1567 /* We got here via longjmp() caused by an exception in function fn() */
1568 set_float_handler (NULL
);
1572 set_float_handler (buf
);
1574 set_float_handler (NULL
);
1578 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1579 error happens, pushing the previous specification into OLD_HANDLER.
1580 Return an indication of whether there was a previous handler in effect. */
1583 push_float_handler (handler
, old_handler
)
1584 jmp_buf handler
, old_handler
;
1586 int was_handled
= float_handled
;
1590 memcpy ((char *) old_handler
, (char *) float_handler
,
1591 sizeof (float_handler
));
1593 memcpy ((char *) float_handler
, (char *) handler
, sizeof (float_handler
));
1597 /* Restore the previous specification of whether and where to longjmp to
1598 when a floating arithmetic error happens. */
1601 pop_float_handler (handled
, handler
)
1605 float_handled
= handled
;
1607 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
1610 /* Handler for SIGPIPE. */
1614 /* If this is missing, some compilers complain. */
1615 int signo ATTRIBUTE_UNUSED
;
1617 fatal ("output pipe has been closed");
1620 /* Strip off a legitimate source ending from the input string NAME of
1621 length LEN. Rather than having to know the names used by all of
1622 our front ends, we strip off an ending of a period followed by
1623 up to five characters. (Java uses ".class".) */
1626 strip_off_ending (name
, len
)
1631 for (i
= 2; i
< 6 && len
> i
; i
++)
1633 if (name
[len
- i
] == '.')
1635 name
[len
- i
] = '\0';
1641 /* Output a quoted string. */
1644 output_quoted_string (asm_file
, string
)
1648 #ifdef OUTPUT_QUOTED_STRING
1649 OUTPUT_QUOTED_STRING (asm_file
, string
);
1653 putc ('\"', asm_file
);
1654 while ((c
= *string
++) != 0)
1656 if (c
== '\"' || c
== '\\')
1657 putc ('\\', asm_file
);
1660 putc ('\"', asm_file
);
1664 /* Output a file name in the form wanted by System V. */
1667 output_file_directive (asm_file
, input_name
)
1669 const char *input_name
;
1671 int len
= strlen (input_name
);
1672 const char *na
= input_name
+ len
;
1674 /* NA gets INPUT_NAME sans directory names. */
1675 while (na
> input_name
)
1679 #ifdef DIR_SEPARATOR
1680 if (na
[-1] == DIR_SEPARATOR
)
1686 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1687 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file
, na
);
1689 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1690 ASM_OUTPUT_SOURCE_FILENAME (asm_file
, na
);
1692 fprintf (asm_file
, "\t.file\t");
1693 output_quoted_string (asm_file
, na
);
1694 fputc ('\n', asm_file
);
1699 #ifdef ASM_IDENTIFY_LANGUAGE
1700 /* Routine to build language identifier for object file. */
1702 output_lang_identify (asm_out_file
)
1705 int len
= strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1706 char *s
= (char *) alloca (len
);
1707 sprintf (s
, "__gnu_compiled_%s", lang_identify ());
1708 ASM_OUTPUT_LABEL (asm_out_file
, s
);
1712 /* Routine to open a dump file. */
1714 open_dump_file (suffix
, function_name
)
1716 const char *function_name
;
1723 dumpname
= concat (dump_base_name
, suffix
, NULL
);
1725 if (rtl_dump_file
!= NULL
)
1726 fclose (rtl_dump_file
);
1728 rtl_dump_file
= fopen (dumpname
, "a");
1730 if (rtl_dump_file
== NULL
)
1731 pfatal_with_name (dumpname
);
1736 fprintf (rtl_dump_file
, "\n;; Function %s\n\n", function_name
);
1742 /* Routine to close a dump file. */
1744 close_dump_file (func
, insns
)
1745 void (*func
) PROTO ((FILE *, rtx
));
1752 func (rtl_dump_file
, insns
);
1754 fflush (rtl_dump_file
);
1755 fclose (rtl_dump_file
);
1757 rtl_dump_file
= NULL
;
1763 /* Routine to dump rtl into a file. */
1765 dump_rtl (suffix
, decl
, func
, insns
)
1768 void (*func
) PROTO ((FILE *, rtx
));
1771 open_dump_file (suffix
, decl_printable_name (decl
, 2));
1772 close_dump_file (func
, insns
);
1775 /* Routine to empty a dump file. */
1777 clean_dump_file (suffix
)
1780 char * const dumpname
= concat (dump_base_name
, suffix
, NULL
);
1782 rtl_dump_file
= fopen (dumpname
, "w");
1784 if (rtl_dump_file
== NULL
)
1785 pfatal_with_name (dumpname
);
1789 fclose (rtl_dump_file
);
1790 rtl_dump_file
= NULL
;
1795 /* Do any final processing required for the declarations in VEC, of
1796 which there are LEN. We write out inline functions and variables
1797 that have been deferred until this point, but which are required.
1798 Returns non-zero if anything was put out. */
1800 wrapup_global_declarations (vec
, len
)
1807 int output_something
= 0;
1809 for (i
= 0; i
< len
; i
++)
1813 /* We're not deferring this any longer. */
1814 DECL_DEFER_OUTPUT (decl
) = 0;
1816 if (TREE_CODE (decl
) == VAR_DECL
&& DECL_SIZE (decl
) == 0
1817 && incomplete_decl_finalize_hook
!= 0)
1818 (*incomplete_decl_finalize_hook
) (decl
);
1821 /* Now emit any global variables or functions that we have been
1822 putting off. We need to loop in case one of the things emitted
1823 here references another one which comes earlier in the list. */
1827 for (i
= 0; i
< len
; i
++)
1831 if (TREE_ASM_WRITTEN (decl
) || DECL_EXTERNAL (decl
))
1834 /* Don't write out static consts, unless we still need them.
1836 We also keep static consts if not optimizing (for debugging),
1837 unless the user specified -fno-keep-static-consts.
1838 ??? They might be better written into the debug information.
1839 This is possible when using DWARF.
1841 A language processor that wants static constants to be always
1842 written out (even if it is not used) is responsible for
1843 calling rest_of_decl_compilation itself. E.g. the C front-end
1844 calls rest_of_decl_compilation from finish_decl.
1845 One motivation for this is that is conventional in some
1846 environments to write things like:
1847 static const char rcsid[] = "... version string ...";
1848 intending to force the string to be in the executable.
1850 A language processor that would prefer to have unneeded
1851 static constants "optimized away" would just defer writing
1852 them out until here. E.g. C++ does this, because static
1853 constants are often defined in header files.
1855 ??? A tempting alternative (for both C and C++) would be
1856 to force a constant to be written if and only if it is
1857 defined in a main file, as opposed to an include file. */
1859 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
1860 && (! TREE_READONLY (decl
)
1861 || TREE_PUBLIC (decl
)
1862 || (!optimize
&& flag_keep_static_consts
)
1863 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
1866 rest_of_decl_compilation (decl
, NULL_PTR
, 1, 1);
1869 if (TREE_CODE (decl
) == FUNCTION_DECL
1870 && DECL_INITIAL (decl
) != 0
1871 && DECL_SAVED_INSNS (decl
) != 0
1872 && (flag_keep_inline_functions
1873 || (TREE_PUBLIC (decl
) && !DECL_COMDAT (decl
))
1874 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
1877 temporary_allocation ();
1878 output_inline_function (decl
);
1879 permanent_allocation (1);
1884 output_something
= 1;
1888 return output_something
;
1891 /* Issue appropriate warnings for the global declarations in VEC (of
1892 which there are LEN). Output debugging information for them. */
1894 check_global_declarations (vec
, len
)
1901 for (i
= 0; i
< len
; i
++)
1905 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
1906 && ! TREE_ASM_WRITTEN (decl
))
1907 /* Cancel the RTL for this decl so that, if debugging info
1908 output for global variables is still to come,
1909 this one will be omitted. */
1910 DECL_RTL (decl
) = NULL
;
1912 /* Warn about any function
1913 declared static but not defined.
1914 We don't warn about variables,
1915 because many programs have static variables
1916 that exist only to get some text into the object file. */
1917 if (TREE_CODE (decl
) == FUNCTION_DECL
1919 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
)))
1920 && DECL_INITIAL (decl
) == 0
1921 && DECL_EXTERNAL (decl
)
1922 && ! DECL_ARTIFICIAL (decl
)
1923 && ! TREE_PUBLIC (decl
))
1925 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
)))
1926 pedwarn_with_decl (decl
,
1927 "`%s' used but never defined");
1929 warning_with_decl (decl
,
1930 "`%s' declared `static' but never defined");
1931 /* This symbol is effectively an "extern" declaration now. */
1932 TREE_PUBLIC (decl
) = 1;
1933 assemble_external (decl
);
1936 /* Warn about static fns or vars defined but not used,
1937 but not about inline functions or static consts
1938 since defining those in header files is normal practice. */
1940 && ((TREE_CODE (decl
) == FUNCTION_DECL
&& ! DECL_INLINE (decl
))
1941 || (TREE_CODE (decl
) == VAR_DECL
&& ! TREE_READONLY (decl
)))
1942 && ! DECL_IN_SYSTEM_HEADER (decl
)
1943 && ! DECL_EXTERNAL (decl
)
1944 && ! TREE_PUBLIC (decl
)
1945 && ! TREE_USED (decl
)
1946 && (TREE_CODE (decl
) == FUNCTION_DECL
|| ! DECL_REGISTER (decl
))
1947 /* The TREE_USED bit for file-scope decls
1948 is kept in the identifier, to handle multiple
1949 external decls in different scopes. */
1950 && ! TREE_USED (DECL_NAME (decl
)))
1951 warning_with_decl (decl
, "`%s' defined but not used");
1953 #ifdef SDB_DEBUGGING_INFO
1954 /* The COFF linker can move initialized global vars to the end.
1955 And that can screw up the symbol ordering.
1956 By putting the symbols in that order to begin with,
1957 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
1958 if (write_symbols
== SDB_DEBUG
&& TREE_CODE (decl
) == VAR_DECL
1959 && TREE_PUBLIC (decl
) && DECL_INITIAL (decl
)
1960 && ! DECL_EXTERNAL (decl
)
1961 && DECL_RTL (decl
) != 0)
1962 TIMEVAR (symout_time
, sdbout_symbol (decl
, 0));
1964 /* Output COFF information for non-global
1965 file-scope initialized variables. */
1966 if (write_symbols
== SDB_DEBUG
1967 && TREE_CODE (decl
) == VAR_DECL
1968 && DECL_INITIAL (decl
)
1969 && ! DECL_EXTERNAL (decl
)
1970 && DECL_RTL (decl
) != 0
1971 && GET_CODE (DECL_RTL (decl
)) == MEM
)
1972 TIMEVAR (symout_time
, sdbout_toplevel_data (decl
));
1973 #endif /* SDB_DEBUGGING_INFO */
1974 #ifdef DWARF_DEBUGGING_INFO
1975 /* Output DWARF information for file-scope tentative data object
1976 declarations, file-scope (extern) function declarations (which
1977 had no corresponding body) and file-scope tagged type declarations
1978 and definitions which have not yet been forced out. */
1980 if (write_symbols
== DWARF_DEBUG
1981 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
1982 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 1));
1984 #ifdef DWARF2_DEBUGGING_INFO
1985 /* Output DWARF2 information for file-scope tentative data object
1986 declarations, file-scope (extern) function declarations (which
1987 had no corresponding body) and file-scope tagged type declarations
1988 and definitions which have not yet been forced out. */
1990 if (write_symbols
== DWARF2_DEBUG
1991 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
1992 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
1997 /* Compile an entire file of output from cpp, named NAME.
1998 Write a file of assembly output and various debugging dumps. */
2007 int name_specified
= name
!= 0;
2009 if (dump_base_name
== 0)
2010 dump_base_name
= name
? name
: "gccdump";
2014 integration_time
= 0;
2020 branch_prob_time
= 0;
2025 local_alloc_time
= 0;
2026 global_alloc_time
= 0;
2031 shorten_branch_time
= 0;
2037 /* Initialize data in various passes. */
2041 name
= init_parse (name
);
2042 init_emit_once (debug_info_level
== DINFO_LEVEL_NORMAL
2043 || debug_info_level
== DINFO_LEVEL_VERBOSE
2044 || flag_test_coverage
2045 || warn_notreached
);
2047 init_decl_processing ();
2054 init_function_once ();
2055 init_stor_layout_once ();
2056 init_varasm_once ();
2058 /* The following initialization functions need to generate rtl, so
2059 provide a dummy function context for them. */
2060 init_dummy_function_start ();
2063 if (flag_caller_saves
)
2064 init_caller_save ();
2065 expand_dummy_function_end ();
2067 /* If auxiliary info generation is desired, open the output file.
2068 This goes in the same directory as the source file--unlike
2069 all the other output files. */
2070 if (flag_gen_aux_info
)
2072 aux_info_file
= fopen (aux_info_file_name
, "w");
2073 if (aux_info_file
== 0)
2074 pfatal_with_name (aux_info_file_name
);
2077 /* Clear the dump files. */
2079 clean_dump_file (".00.rtl");
2082 clean_dump_file (".01.jump");
2083 if (graph_dump_format
!= no_graph
)
2084 clean_graph_dump_file (dump_base_name
, ".01.jump");
2088 clean_dump_file (".02.cse");
2089 if (graph_dump_format
!= no_graph
)
2090 clean_graph_dump_file (dump_base_name
, ".02.cse");
2094 clean_dump_file (".03.addressof");
2095 if (graph_dump_format
!= no_graph
)
2096 clean_graph_dump_file (dump_base_name
, ".03.addressof");
2100 clean_dump_file (".04.gcse");
2101 if (graph_dump_format
!= no_graph
)
2102 clean_graph_dump_file (dump_base_name
, ".04.gcse");
2106 clean_dump_file (".05.loop");
2107 if (graph_dump_format
!= no_graph
)
2108 clean_graph_dump_file (dump_base_name
, ".05.loop");
2112 clean_dump_file (".06.cse2");
2113 if (graph_dump_format
!= no_graph
)
2114 clean_graph_dump_file (dump_base_name
, ".06.cse2");
2116 if (branch_prob_dump
)
2118 clean_dump_file (".07.bp");
2119 if (graph_dump_format
!= no_graph
)
2120 clean_graph_dump_file (dump_base_name
, ".07.bp");
2124 clean_dump_file (".08.flow");
2125 if (graph_dump_format
!= no_graph
)
2126 clean_graph_dump_file (dump_base_name
, ".08.flow");
2130 clean_dump_file (".09.combine");
2131 if (graph_dump_format
!= no_graph
)
2132 clean_graph_dump_file (dump_base_name
, ".09.combine");
2136 clean_dump_file (".10.regmove");
2137 if (graph_dump_format
!= no_graph
)
2138 clean_graph_dump_file (dump_base_name
, ".10.regmove");
2140 #ifdef INSN_SCHEDULING
2143 clean_dump_file (".11.sched");
2144 if (graph_dump_format
!= no_graph
)
2145 clean_graph_dump_file (dump_base_name
, ".11.sched");
2150 clean_dump_file (".12.lreg");
2151 if (graph_dump_format
!= no_graph
)
2152 clean_graph_dump_file (dump_base_name
, ".12.lreg");
2154 if (global_reg_dump
)
2156 clean_dump_file (".13.greg");
2157 if (graph_dump_format
!= no_graph
)
2158 clean_graph_dump_file (dump_base_name
, ".13.greg");
2162 clean_dump_file (".14.flow2");
2163 if (graph_dump_format
!= no_graph
)
2164 clean_graph_dump_file (dump_base_name
, ".14.flow2");
2166 #ifdef HAVE_peephole2
2169 clean_dump_file (".15.peephole2");
2170 if (graph_dump_format
!= no_graph
)
2171 clean_graph_dump_file (dump_base_name
, ".15.peephole2");
2174 #ifdef INSN_SCHEDULING
2177 clean_dump_file (".16.sched2");
2178 if (graph_dump_format
!= no_graph
)
2179 clean_graph_dump_file (dump_base_name
, ".16.sched2");
2184 clean_dump_file (".17.jump2");
2185 if (graph_dump_format
!= no_graph
)
2186 clean_graph_dump_file (dump_base_name
, ".17.jump2");
2188 #ifdef MACHINE_DEPENDENT_REORG
2189 if (mach_dep_reorg_dump
)
2191 clean_dump_file (".18.mach");
2192 if (graph_dump_format
!= no_graph
)
2193 clean_graph_dump_file (dump_base_name
, ".18.mach");
2199 clean_dump_file (".19.dbr");
2200 if (graph_dump_format
!= no_graph
)
2201 clean_graph_dump_file (dump_base_name
, ".19.dbr");
2207 clean_dump_file (".20.stack");
2208 if (graph_dump_format
!= no_graph
)
2209 clean_graph_dump_file (dump_base_name
, ".20.stack");
2213 /* Open assembler code output file. */
2215 if (flag_syntax_only
)
2216 asm_out_file
= NULL
;
2219 if (! name_specified
&& asm_file_name
== 0)
2220 asm_out_file
= stdout
;
2223 if (asm_file_name
== 0)
2225 int len
= strlen (dump_base_name
);
2226 char *dumpname
= (char *) xmalloc (len
+ 6);
2227 memcpy (dumpname
, dump_base_name
, len
+ 1);
2228 strip_off_ending (dumpname
, len
);
2229 strcat (dumpname
, ".s");
2230 asm_file_name
= dumpname
;
2232 if (!strcmp (asm_file_name
, "-"))
2233 asm_out_file
= stdout
;
2235 asm_out_file
= fopen (asm_file_name
, "w");
2236 if (asm_out_file
== 0)
2237 pfatal_with_name (asm_file_name
);
2240 #ifdef IO_BUFFER_SIZE
2241 setvbuf (asm_out_file
, (char *) xmalloc (IO_BUFFER_SIZE
),
2242 _IOFBF
, IO_BUFFER_SIZE
);
2247 name
= ggc_alloc_string (name
, strlen (name
));
2248 input_filename
= name
;
2250 /* Put an entry on the input file stack for the main input file. */
2252 = (struct file_stack
*) xmalloc (sizeof (struct file_stack
));
2253 input_file_stack
->next
= 0;
2254 input_file_stack
->name
= input_filename
;
2256 /* Perform language-specific initialization.
2257 This may set main_input_filename. */
2260 /* If the input doesn't start with a #line, use the input name
2261 as the official input file name. */
2262 if (main_input_filename
== 0)
2263 main_input_filename
= name
;
2265 if (flag_syntax_only
)
2267 write_symbols
= NO_DEBUG
;
2269 profile_block_flag
= 0;
2273 ASM_FILE_START (asm_out_file
);
2275 #ifdef ASM_COMMENT_START
2276 if (flag_verbose_asm
)
2278 /* Print the list of options in effect. */
2279 print_version (asm_out_file
, ASM_COMMENT_START
);
2280 print_switch_values (asm_out_file
, 0, MAX_LINE
,
2281 ASM_COMMENT_START
, " ", "\n");
2282 /* Add a blank line here so it appears in assembler output but not
2284 fprintf (asm_out_file
, "\n");
2288 /* Output something to inform GDB that this compilation was by GCC. */
2289 #ifndef ASM_IDENTIFY_GCC
2290 fprintf (asm_out_file
, "gcc2_compiled.:\n");
2292 ASM_IDENTIFY_GCC (asm_out_file
);
2295 /* Output something to identify which front-end produced this file. */
2296 #ifdef ASM_IDENTIFY_LANGUAGE
2297 ASM_IDENTIFY_LANGUAGE (asm_out_file
);
2299 } /* ! flag_syntax_only */
2301 #ifndef ASM_OUTPUT_SECTION_NAME
2302 if (flag_function_sections
)
2304 warning ("-ffunction-sections not supported for this target.");
2305 flag_function_sections
= 0;
2307 if (flag_data_sections
)
2309 warning ("-fdata-sections not supported for this target.");
2310 flag_data_sections
= 0;
2314 if (flag_function_sections
2315 && (profile_flag
|| profile_block_flag
))
2317 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2318 flag_function_sections
= 0;
2321 #ifndef OBJECT_FORMAT_ELF
2322 if (flag_function_sections
&& write_symbols
!= NO_DEBUG
)
2323 warning ("-ffunction-sections may affect debugging on some targets.");
2326 /* ??? Note: There used to be a conditional here
2327 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2328 This was to guarantee separation between gcc_compiled. and
2329 the first function, for the sake of dbx on Suns.
2330 However, having the extra zero here confused the Emacs
2331 code for unexec, and might confuse other programs too.
2332 Therefore, I took out that change.
2333 In future versions we should find another way to solve
2334 that dbx problem. -- rms, 23 May 93. */
2336 /* Don't let the first function fall at the same address
2337 as gcc_compiled., if profiling. */
2338 if (profile_flag
|| profile_block_flag
)
2340 /* It's best if we can write a nop here since some
2341 assemblers don't tolerate zeros in the text section. */
2342 output_asm_insn (get_insn_template (CODE_FOR_nop
, NULL
), NULL_PTR
);
2345 /* If dbx symbol table desired, initialize writing it
2346 and output the predefined types. */
2347 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2348 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2349 TIMEVAR (symout_time
, dbxout_init (asm_out_file
, main_input_filename
,
2352 #ifdef SDB_DEBUGGING_INFO
2353 if (write_symbols
== SDB_DEBUG
)
2354 TIMEVAR (symout_time
, sdbout_init (asm_out_file
, main_input_filename
,
2357 #ifdef DWARF_DEBUGGING_INFO
2358 if (write_symbols
== DWARF_DEBUG
)
2359 TIMEVAR (symout_time
, dwarfout_init (asm_out_file
, main_input_filename
));
2361 #ifdef DWARF2_UNWIND_INFO
2362 if (dwarf2out_do_frame ())
2363 dwarf2out_frame_init ();
2365 #ifdef DWARF2_DEBUGGING_INFO
2366 if (write_symbols
== DWARF2_DEBUG
)
2367 TIMEVAR (symout_time
, dwarf2out_init (asm_out_file
, main_input_filename
));
2370 /* Initialize yet another pass. */
2372 init_final (main_input_filename
);
2373 init_branch_prob (dump_base_name
);
2375 start_time
= get_run_time ();
2377 /* Call the parser, which parses the entire file
2378 (calling rest_of_compilation for each function). */
2380 if (yyparse () != 0)
2382 if (errorcount
== 0)
2383 fnotice (stderr
, "Errors detected in input file (your bison.simple is out of date)\n");
2385 /* In case there were missing closebraces,
2386 get us back to the global binding level. */
2387 while (! global_bindings_p ())
2391 /* Compilation is now finished except for writing
2392 what's left of the symbol table output. */
2394 parse_time
+= get_run_time () - start_time
;
2396 parse_time
-= integration_time
;
2397 parse_time
-= varconst_time
;
2399 if (flag_syntax_only
)
2402 globals
= getdecls ();
2404 /* Really define vars that have had only a tentative definition.
2405 Really output inline functions that must actually be callable
2406 and have not been output so far. */
2409 int len
= list_length (globals
);
2410 tree
*vec
= (tree
*) xmalloc (sizeof (tree
) * len
);
2414 /* Process the decls in reverse order--earliest first.
2415 Put them into VEC from back to front, then take out from front. */
2417 for (i
= 0, decl
= globals
; i
< len
; i
++, decl
= TREE_CHAIN (decl
))
2418 vec
[len
- i
- 1] = decl
;
2420 wrapup_global_declarations (vec
, len
);
2422 /* This must occur after the loop to output deferred functions. Else
2423 the profiler initializer would not be emitted if all the functions
2424 in this compilation unit were deferred.
2426 output_func_start_profiler can not cause any additional functions or
2427 data to need to be output, so it need not be in the deferred function
2429 output_func_start_profiler ();
2431 /* Now that all possible functions have been output, we can dump
2432 the exception table. */
2434 output_exception_table ();
2436 check_global_declarations (vec
, len
);
2442 /* Write out any pending weak symbol declarations. */
2446 /* Do dbx symbols */
2447 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2448 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2449 TIMEVAR (symout_time
,
2451 dbxout_finish (asm_out_file
, main_input_filename
);
2455 #ifdef DWARF_DEBUGGING_INFO
2456 if (write_symbols
== DWARF_DEBUG
)
2457 TIMEVAR (symout_time
,
2463 #ifdef DWARF2_UNWIND_INFO
2464 if (dwarf2out_do_frame ())
2465 dwarf2out_frame_finish ();
2468 #ifdef DWARF2_DEBUGGING_INFO
2469 if (write_symbols
== DWARF2_DEBUG
)
2470 TIMEVAR (symout_time
,
2472 dwarf2out_finish ();
2476 /* Output some stuff at end of file if nec. */
2478 end_final (dump_base_name
);
2480 if (branch_prob_dump
)
2481 open_dump_file (".07.bp", NULL
);
2483 TIMEVAR (dump_time
, end_branch_prob (rtl_dump_file
));
2485 if (branch_prob_dump
)
2486 close_dump_file (NULL
, NULL_RTX
);
2489 ASM_FILE_END (asm_out_file
);
2493 /* Language-specific end of compilation actions. */
2497 /* Close the dump files. */
2499 if (flag_gen_aux_info
)
2501 fclose (aux_info_file
);
2503 unlink (aux_info_file_name
);
2508 open_dump_file (".09.combine", NULL
);
2509 TIMEVAR (dump_time
, dump_combine_total_stats (rtl_dump_file
));
2510 close_dump_file (NULL
, NULL_RTX
);
2513 /* Close non-debugging input and output files. Take special care to note
2514 whether fclose returns an error, since the pages might still be on the
2515 buffer chain while the file is open. */
2519 if (! flag_syntax_only
2520 && (ferror (asm_out_file
) != 0 || fclose (asm_out_file
) != 0))
2521 fatal_io_error (asm_file_name
);
2523 /* Do whatever is necessary to finish printing the graphs. */
2524 if (graph_dump_format
!= no_graph
)
2527 finish_graph_dump_file (dump_base_name
, ".01.jump");
2529 finish_graph_dump_file (dump_base_name
, ".02.cse");
2531 finish_graph_dump_file (dump_base_name
, ".03.addressof");
2533 finish_graph_dump_file (dump_base_name
, ".04.gcse");
2535 finish_graph_dump_file (dump_base_name
, ".05.loop");
2537 finish_graph_dump_file (dump_base_name
, ".06.cse2");
2538 if (branch_prob_dump
)
2539 finish_graph_dump_file (dump_base_name
, ".07.bp");
2541 finish_graph_dump_file (dump_base_name
, ".08.flow");
2543 finish_graph_dump_file (dump_base_name
, ".09.combine");
2545 finish_graph_dump_file (dump_base_name
, ".10.regmove");
2546 #ifdef INSN_SCHEDULING
2548 finish_graph_dump_file (dump_base_name
, ".11.sched");
2551 finish_graph_dump_file (dump_base_name
, ".12.lreg");
2552 if (global_reg_dump
)
2553 finish_graph_dump_file (dump_base_name
, ".13.greg");
2555 finish_graph_dump_file (dump_base_name
, ".14.flow2");
2556 #ifdef HAVE_peephole2
2558 finish_graph_dump_file (dump_base_name
, ".15.peephole2");
2560 #ifdef INSN_SCHEDULING
2562 finish_graph_dump_file (dump_base_name
, ".16.sched2");
2565 finish_graph_dump_file (dump_base_name
, ".17.jump2");
2566 #ifdef MACHINE_DEPENDENT_REORG
2567 if (mach_dep_reorg_dump
)
2568 finish_graph_dump_file (dump_base_name
, ".18.mach");
2572 finish_graph_dump_file (dump_base_name
, ".19.dbr");
2576 finish_graph_dump_file (dump_base_name
, ".20.stack");
2580 /* Free up memory for the benefit of leak detectors. */
2583 /* Print the times. */
2587 all_time
= get_run_time ();
2589 fprintf (stderr
,"\n");
2591 print_time ("parse", parse_time
);
2592 print_time ("integration", integration_time
);
2593 print_time ("jump", jump_time
);
2594 print_time ("cse", cse_time
);
2595 print_time ("gcse", gcse_time
);
2596 print_time ("loop", loop_time
);
2597 print_time ("cse2", cse2_time
);
2598 print_time ("branch-prob", branch_prob_time
);
2599 print_time ("flow", flow_time
);
2600 print_time ("combine", combine_time
);
2601 print_time ("regmove", regmove_time
);
2602 #ifdef INSN_SCHEDULING
2603 print_time ("sched", sched_time
);
2605 print_time ("local-alloc", local_alloc_time
);
2606 print_time ("global-alloc", global_alloc_time
);
2607 print_time ("flow2", flow2_time
);
2608 #ifdef HAVE_peephole2
2609 print_time ("peephole2", peephole2_time
);
2611 #ifdef INSN_SCHEDULING
2612 print_time ("sched2", sched2_time
);
2615 print_time ("dbranch", dbr_sched_time
);
2617 print_time ("shorten-branch", shorten_branch_time
);
2619 print_time ("stack-reg", stack_reg_time
);
2621 print_time ("final", final_time
);
2622 print_time ("varconst", varconst_time
);
2623 print_time ("symout", symout_time
);
2624 print_time ("dump", dump_time
);
2626 print_time ("gc", gc_time
);
2630 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2631 and TYPE_DECL nodes.
2633 This does nothing for local (non-static) variables, unless the
2634 variable is a register variable with an ASMSPEC. In that case, or
2635 if the variable is not an automatice, it sets up the RTL and
2636 outputs any assembler code (label definition, storage allocation
2637 and initialization).
2639 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2640 the assembler symbol name to be used. TOP_LEVEL is nonzero
2641 if this declaration is not within a function. */
2644 rest_of_decl_compilation (decl
, asmspec
, top_level
, at_end
)
2646 const char *asmspec
;
2650 /* Declarations of variables, and of functions defined elsewhere. */
2652 /* The most obvious approach, to put an #ifndef around where
2653 this macro is used, doesn't work since it's inside a macro call. */
2654 #ifndef ASM_FINISH_DECLARE_OBJECT
2655 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2658 /* Forward declarations for nested functions are not "external",
2659 but we need to treat them as if they were. */
2660 if (TREE_STATIC (decl
) || DECL_EXTERNAL (decl
)
2661 || TREE_CODE (decl
) == FUNCTION_DECL
)
2662 TIMEVAR (varconst_time
,
2664 make_decl_rtl (decl
, asmspec
, top_level
);
2665 /* Initialized extern variable exists to be replaced
2666 with its value, or represents something that will be
2667 output in another file. */
2668 if (! (TREE_CODE (decl
) == VAR_DECL
2669 && DECL_EXTERNAL (decl
) && TREE_READONLY (decl
)
2670 && DECL_INITIAL (decl
) != 0
2671 && DECL_INITIAL (decl
) != error_mark_node
))
2672 /* Don't output anything
2673 when a tentative file-scope definition is seen.
2674 But at end of compilation, do output code for them. */
2675 if (! (! at_end
&& top_level
2676 && (DECL_INITIAL (decl
) == 0
2677 || DECL_INITIAL (decl
) == error_mark_node
)))
2678 assemble_variable (decl
, top_level
, at_end
, 0);
2679 if (decl
== last_assemble_variable_decl
)
2681 ASM_FINISH_DECLARE_OBJECT (asm_out_file
, decl
,
2685 else if (DECL_REGISTER (decl
) && asmspec
!= 0)
2687 if (decode_reg_name (asmspec
) >= 0)
2689 DECL_RTL (decl
) = 0;
2690 make_decl_rtl (decl
, asmspec
, top_level
);
2693 error ("invalid register name `%s' for register variable", asmspec
);
2695 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2696 else if ((write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2697 && TREE_CODE (decl
) == TYPE_DECL
)
2698 TIMEVAR (symout_time
, dbxout_symbol (decl
, 0));
2700 #ifdef SDB_DEBUGGING_INFO
2701 else if (write_symbols
== SDB_DEBUG
&& top_level
2702 && TREE_CODE (decl
) == TYPE_DECL
)
2703 TIMEVAR (symout_time
, sdbout_symbol (decl
, 0));
2707 /* Called after finishing a record, union or enumeral type. */
2710 rest_of_type_compilation (type
, toplev
)
2711 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
2715 tree type ATTRIBUTE_UNUSED
;
2716 int toplev ATTRIBUTE_UNUSED
;
2719 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2720 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2721 TIMEVAR (symout_time
, dbxout_symbol (TYPE_STUB_DECL (type
), !toplev
));
2723 #ifdef SDB_DEBUGGING_INFO
2724 if (write_symbols
== SDB_DEBUG
)
2725 TIMEVAR (symout_time
, sdbout_symbol (TYPE_STUB_DECL (type
), !toplev
));
2729 /* DECL is an inline function, whose body is present, but which is not
2730 being output at this point. (We're putting that off until we need
2731 to do it.) If there are any actions that need to take place,
2732 including the emission of debugging information for the function,
2733 this is where they should go. This function may be called by
2734 language-dependent code for front-ends that do not even generate
2735 RTL for functions that don't need to be put out. */
2738 note_deferral_of_defined_inline_function (decl
)
2739 tree decl ATTRIBUTE_UNUSED
;
2741 #ifdef DWARF_DEBUGGING_INFO
2742 /* Generate the DWARF info for the "abstract" instance of a function
2743 which we may later generate inlined and/or out-of-line instances
2745 if (write_symbols
== DWARF_DEBUG
)
2747 /* The front-end may not have set CURRENT_FUNCTION_DECL, but the
2748 DWARF code expects it to be set in this case. Intuitively,
2749 DECL is the function we just finished defining, so setting
2750 CURRENT_FUNCTION_DECL is sensible. */
2751 tree saved_cfd
= current_function_decl
;
2752 current_function_decl
= decl
;
2754 /* Let the DWARF code do its work. */
2755 set_decl_abstract_flags (decl
, 1);
2756 dwarfout_file_scope_decl (decl
, 0);
2757 set_decl_abstract_flags (decl
, 0);
2759 /* Reset CURRENT_FUNCTION_DECL. */
2760 current_function_decl
= saved_cfd
;
2765 /* This is called from finish_function (within yyparse)
2766 after each top-level definition is parsed.
2767 It is supposed to compile that function or variable
2768 and output the assembler code for it.
2769 After we return, the tree storage is freed. */
2772 rest_of_compilation (decl
)
2776 int start_time
= get_run_time ();
2779 int rebuild_label_notes_after_reload
;
2781 /* When processing delayed functions, prepare_function_start() won't
2782 have been run to re-initialize it. */
2783 cse_not_expected
= ! optimize
;
2785 /* First, remove any notes we don't need. That will make iterating
2786 over the instruction sequence faster, and allow the garbage
2787 collector to reclaim the memory used by the notes. */
2788 remove_unncessary_notes ();
2790 /* In function-at-a-time mode, we do not attempt to keep the BLOCK
2791 tree in sensible shape. So, we just recalculate it here. */
2792 if (cfun
->x_whole_function_mode_p
)
2794 find_loop_tree_blocks ();
2795 unroll_block_trees ();
2798 /* If we are reconsidering an inline function
2799 at the end of compilation, skip the stuff for making it inline. */
2801 if (DECL_SAVED_INSNS (decl
) == 0)
2807 /* If this is nested inside an inlined external function, pretend
2808 it was only declared. Since we cannot inline such functions,
2809 generating code for this one is not only not necessary but will
2810 confuse some debugging output writers. */
2811 for (parent
= DECL_CONTEXT (current_function_decl
);
2812 parent
!= NULL_TREE
;
2813 parent
= get_containing_scope (parent
))
2814 if (TREE_CODE (parent
) == FUNCTION_DECL
2815 && DECL_INLINE (parent
) && DECL_EXTERNAL (parent
))
2817 DECL_INITIAL (decl
) = 0;
2818 goto exit_rest_of_compilation
;
2821 /* If requested, consider whether to make this function inline. */
2822 if (DECL_INLINE (decl
) || flag_inline_functions
)
2823 TIMEVAR (integration_time
,
2825 lose
= function_cannot_inline_p (decl
);
2826 if (lose
|| ! optimize
)
2828 if (warn_inline
&& DECL_INLINE (decl
))
2829 warning_with_decl (decl
, lose
);
2830 DECL_ABSTRACT_ORIGIN (decl
) = 0;
2831 /* Don't really compile an extern inline function.
2832 If we can't make it inline, pretend
2833 it was only declared. */
2834 if (DECL_EXTERNAL (decl
))
2836 DECL_INITIAL (decl
) = 0;
2837 goto exit_rest_of_compilation
;
2841 /* ??? Note that this has the effect of making it look
2842 like "inline" was specified for a function if we choose
2843 to inline it. This isn't quite right, but it's
2844 probably not worth the trouble to fix. */
2845 inlinable
= DECL_INLINE (decl
) = 1;
2848 insns
= get_insns ();
2850 /* Dump the rtl code if we are dumping rtl. */
2854 open_dump_file (".00.rtl", decl_printable_name (decl
, 2));
2856 if (DECL_SAVED_INSNS (decl
))
2857 fprintf (rtl_dump_file
, ";; (integrable)\n\n");
2859 close_dump_file (print_rtl
, insns
);
2862 /* If function is inline, and we don't yet know whether to
2863 compile it by itself, defer decision till end of compilation.
2864 finish_compilation will call rest_of_compilation again
2865 for those functions that need to be output. Also defer those
2866 functions that we are supposed to defer. */
2869 DECL_DEFER_OUTPUT (decl
) = 1;
2871 if (DECL_DEFER_OUTPUT (decl
)
2872 || (DECL_INLINE (decl
)
2873 && ((! TREE_PUBLIC (decl
) && ! TREE_ADDRESSABLE (decl
)
2874 && ! flag_keep_inline_functions
)
2875 || DECL_EXTERNAL (decl
))))
2877 DECL_DEFER_OUTPUT (decl
) = 1;
2879 /* If -Wreturn-type, we have to do a bit of compilation.
2880 However, if we just fall through we will call
2881 save_for_inline_copying() which results in excessive
2882 memory use. Instead, we just want to call
2883 jump_optimize() to figure out whether or not we can fall
2884 off the end of the function; we do the minimum amount of
2885 work necessary to make that safe. And, we set optimize
2886 to zero to keep jump_optimize from working too hard. */
2887 if (warn_return_type
)
2889 int saved_optimize
= optimize
;
2891 find_exception_handler_labels ();
2892 jump_optimize (get_insns(), !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
2893 !JUMP_AFTER_REGSCAN
);
2894 optimize
= saved_optimize
;
2897 note_deferral_of_defined_inline_function (decl
);
2898 TIMEVAR (integration_time
, save_for_inline_nocopy (decl
));
2899 DECL_SAVED_INSNS (decl
)->inlinable
= inlinable
;
2900 goto exit_rest_of_compilation
;
2903 /* If specified extern inline but we aren't inlining it, we are
2904 done. This goes for anything that gets here with DECL_EXTERNAL
2905 set, not just things with DECL_INLINE. */
2906 if (DECL_EXTERNAL (decl
))
2907 goto exit_rest_of_compilation
;
2910 /* Initialize some variables used by the optimizers. */
2911 init_function_for_compilation ();
2913 if (! DECL_DEFER_OUTPUT (decl
))
2914 TREE_ASM_WRITTEN (decl
) = 1;
2916 /* Now that integrate will no longer see our rtl, we need not distinguish
2917 between the return value of this function and the return value of called
2919 rtx_equal_function_value_matters
= 0;
2921 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
2922 if ((rtl_dump_and_exit
|| flag_syntax_only
) && !warn_return_type
)
2924 goto exit_rest_of_compilation
;
2927 /* Emit code to get eh context, if needed. */
2931 /* If we are doing position-independent code generation, now
2932 is the time to output special prologues and epilogues.
2933 We do not want to do this earlier, because it just clutters
2934 up inline functions with meaningless insns. */
2939 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
2940 Note that that may have been done above, in save_for_inline_copying.
2941 The call to resume_temporary_allocation near the end of this function
2942 goes back to the usual state of affairs. This must be done after
2943 we've built up any unwinders for exception handling, and done
2944 the FINALIZE_PIC work, if necessary. */
2946 rtl_in_current_obstack ();
2948 insns
= get_insns ();
2950 /* Copy any shared structure that should not be shared. */
2952 unshare_all_rtl (insns
);
2954 init_EXPR_INSN_LIST_cache ();
2956 #ifdef SETJMP_VIA_SAVE_AREA
2957 /* This must be performed before virutal register instantiation. */
2958 if (current_function_calls_alloca
)
2959 optimize_save_area_alloca (insns
);
2962 /* Instantiate all virtual registers. */
2964 instantiate_virtual_regs (current_function_decl
, get_insns ());
2966 /* See if we have allocated stack slots that are not directly addressable.
2967 If so, scan all the insns and create explicit address computation
2968 for all references to such slots. */
2969 /* fixup_stack_slots (); */
2971 /* Find all the EH handlers. */
2972 find_exception_handler_labels ();
2975 open_dump_file (".01.jump", decl_printable_name (decl
, 2));
2977 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
2978 are initialized and to compute whether control can drop off the end
2980 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
2981 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
2982 JUMP_AFTER_REGSCAN
));
2984 /* Jump optimization, and the removal of NULL pointer checks, may
2985 have reduced the number of instructions substantially. CSE, and
2986 future passes, allocate arrays whose dimensions involve the maximum
2987 instruction UID, so if we can reduce the maximum UID we'll save big on
2989 renumber_insns (rtl_dump_file
);
2991 /* Dump rtl code after jump, if we are doing that. */
2993 close_dump_file (print_rtl
, insns
);
2995 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
2996 if (rtl_dump_and_exit
|| flag_syntax_only
|| DECL_DEFER_OUTPUT (decl
))
2997 goto exit_rest_of_compilation
;
2999 /* Try to identify useless null pointer tests and delete them. */
3000 if (flag_delete_null_pointer_checks
)
3001 TIMEVAR (jump_time
, delete_null_pointer_checks (get_insns ()));
3006 /* Perform common subexpression elimination.
3007 Nonzero value from `cse_main' means that jumps were simplified
3008 and some code may now be unreachable, so do
3009 jump optimization again. */
3014 open_dump_file (".02.cse", decl_printable_name (decl
, 2));
3016 TIMEVAR (cse_time
, reg_scan (insns
, max_reg_num (), 1));
3018 if (flag_thread_jumps
)
3019 TIMEVAR (jump_time
, thread_jumps (insns
, max_reg_num (), 1));
3021 TIMEVAR (cse_time
, tem
= cse_main (insns
, max_reg_num (),
3023 /* If we are not running the second CSE pass, then we are no longer
3024 expecting CSE to be run. */
3025 cse_not_expected
= !flag_rerun_cse_after_loop
;
3027 if (tem
|| optimize
> 1)
3028 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3030 !JUMP_AFTER_REGSCAN
));
3032 /* Run this after jump optmizations remove all the unreachable code
3033 so that unreachable code will not keep values live. */
3034 TIMEVAR (cse_time
, delete_trivially_dead_insns (insns
, max_reg_num ()));
3036 /* Try to identify useless null pointer tests and delete them. */
3037 if (flag_delete_null_pointer_checks
)
3038 TIMEVAR (jump_time
, delete_null_pointer_checks (get_insns ()));
3040 /* The second pass of jump optimization is likely to have
3041 removed a bunch more instructions. */
3042 renumber_insns (rtl_dump_file
);
3044 /* Dump rtl code after cse, if we are doing that. */
3047 close_dump_file (print_rtl
, insns
);
3048 if (graph_dump_format
!= no_graph
)
3049 print_rtl_graph_with_bb (dump_base_name
, ".02.cse", insns
);
3053 purge_addressof (insns
);
3054 reg_scan (insns
, max_reg_num (), 1);
3058 dump_rtl (".03.addressof", decl
, print_rtl
, insns
);
3059 if (graph_dump_format
!= no_graph
)
3060 print_rtl_graph_with_bb (dump_base_name
, ".03.addressof", insns
);
3066 /* Perform global cse. */
3068 if (optimize
> 0 && flag_gcse
)
3071 open_dump_file (".04.gcse", decl_printable_name (decl
, 2));
3073 TIMEVAR (gcse_time
, tem
= gcse_main (insns
, rtl_dump_file
));
3075 /* If gcse altered any jumps, rerun jump optimizations to clean
3079 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3081 !JUMP_AFTER_REGSCAN
));
3086 close_dump_file (print_rtl
, insns
);
3087 if (graph_dump_format
!= no_graph
)
3088 print_rtl_graph_with_bb (dump_base_name
, ".04.gcse", insns
);
3094 /* Move constant computations out of loops. */
3099 open_dump_file (".05.loop", decl_printable_name (decl
, 2));
3104 if (flag_rerun_loop_opt
)
3106 /* We only want to perform unrolling once. */
3108 loop_optimize (insns
, rtl_dump_file
, 0, 0);
3111 /* The first call to loop_optimize makes some instructions
3112 trivially dead. We delete those instructions now in the
3113 hope that doing so will make the heuristics in loop work
3114 better and possibly speed up compilation. */
3115 delete_trivially_dead_insns (insns
, max_reg_num ());
3117 /* The regscan pass is currently necessary as the alias
3118 analysis code depends on this information. */
3119 reg_scan (insns
, max_reg_num (), 1);
3121 loop_optimize (insns
, rtl_dump_file
, flag_unroll_loops
, 1);
3124 /* Dump rtl code after loop opt, if we are doing that. */
3128 close_dump_file (print_rtl
, insns
);
3129 if (graph_dump_format
!= no_graph
)
3130 print_rtl_graph_with_bb (dump_base_name
, ".05.loop", insns
);
3137 /* ??? Well, nearly. If HAVE_conditional_arithmetic, jump_optimize
3138 has put off all if-conversion until "after CSE". If we put this
3139 off any longer we may miss out doing if-conversion entirely. */
3140 cse_not_expected
= 1;
3145 open_dump_file (".06.cse2", decl_printable_name (decl
, 2));
3147 if (flag_rerun_cse_after_loop
)
3149 /* Running another jump optimization pass before the second
3150 cse pass sometimes simplifies the RTL enough to allow
3151 the second CSE pass to do a better job. Jump_optimize can change
3152 max_reg_num so we must rerun reg_scan afterwards.
3153 ??? Rework to not call reg_scan so often. */
3154 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3155 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3157 JUMP_AFTER_REGSCAN
));
3159 TIMEVAR (cse2_time
, reg_scan (insns
, max_reg_num (), 0));
3160 TIMEVAR (cse2_time
, tem
= cse_main (insns
, max_reg_num (),
3163 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3165 !JUMP_AFTER_REGSCAN
));
3168 if (flag_thread_jumps
)
3170 /* This pass of jump threading straightens out code
3171 that was kinked by loop optimization. */
3172 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3173 TIMEVAR (jump_time
, thread_jumps (insns
, max_reg_num (), 0));
3176 /* Dump rtl code after cse, if we are doing that. */
3179 close_dump_file (print_rtl
, insns
);
3180 if (graph_dump_format
!= no_graph
)
3181 print_rtl_graph_with_bb (dump_base_name
, ".06.cse2", insns
);
3188 if (profile_arc_flag
|| flag_test_coverage
|| flag_branch_probabilities
)
3190 if (branch_prob_dump
)
3191 open_dump_file (".07.bp", decl_printable_name (decl
, 2));
3196 branch_prob (insns
, rtl_dump_file
);
3199 if (branch_prob_dump
)
3201 close_dump_file (print_rtl
, insns
);
3202 if (graph_dump_format
!= no_graph
)
3203 print_rtl_graph_with_bb (dump_base_name
, ".07.bp", insns
);
3210 /* Now we choose between stupid (pcc-like) register allocation
3211 (if we got the -noreg switch and not -opt)
3212 and smart register allocation. */
3214 if (optimize
> 0) /* Stupid allocation probably won't work */
3215 obey_regdecls
= 0; /* if optimizations being done. */
3219 /* Print function header into flow dump now
3220 because doing the flow analysis makes some of the dump. */
3223 open_dump_file (".08.flow", decl_printable_name (decl
, 2));
3229 regclass (insns
, max_reg_num (), NULL
);
3230 stupid_life_analysis (insns
, max_reg_num (),
3236 /* Do control and data flow analysis,
3237 and write some of the results to dump file. */
3242 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
, 1);
3243 calculate_loop_depth (rtl_dump_file
);
3244 life_analysis (insns
, max_reg_num (), rtl_dump_file
, 1);
3247 if (warn_uninitialized
|| extra_warnings
)
3249 uninitialized_vars_warning (DECL_INITIAL (decl
));
3251 setjmp_args_warning ();
3255 /* Dump rtl after flow analysis. */
3259 close_dump_file (print_rtl_with_bb
, insns
);
3260 if (graph_dump_format
!= no_graph
)
3261 print_rtl_graph_with_bb (dump_base_name
, ".08.flow", insns
);
3267 /* The first life analysis pass has finished. From now on we can not
3268 generate any new pseudos. */
3271 /* If -opt, try combining insns through substitution. */
3275 TIMEVAR (combine_time
, combine_instructions (insns
, max_reg_num ()));
3277 /* Dump rtl code after insn combination. */
3281 dump_rtl (".09.combine", decl
, print_rtl_with_bb
, insns
);
3282 if (graph_dump_format
!= no_graph
)
3283 print_rtl_graph_with_bb (dump_base_name
, ".09.combine", insns
);
3290 /* Register allocation pre-pass, to reduce number of moves
3291 necessary for two-address machines. */
3292 if (optimize
> 0 && (flag_regmove
|| flag_expensive_optimizations
))
3295 open_dump_file (".10.regmove", decl_printable_name (decl
, 2));
3297 TIMEVAR (regmove_time
, regmove_optimize (insns
, max_reg_num (),
3302 close_dump_file (print_rtl_with_bb
, insns
);
3303 if (graph_dump_format
!= no_graph
)
3304 print_rtl_graph_with_bb (dump_base_name
, ".10.regmove", insns
);
3311 /* Print function header into sched dump now
3312 because doing the sched analysis makes some of the dump. */
3314 #ifdef INSN_SCHEDULING
3315 if (optimize
> 0 && flag_schedule_insns
)
3318 open_dump_file (".11.sched", decl_printable_name (decl
, 2));
3320 /* Do control and data sched analysis,
3321 and write some of the results to dump file. */
3323 TIMEVAR (sched_time
, schedule_insns (rtl_dump_file
));
3325 /* Dump rtl after instruction scheduling. */
3329 close_dump_file (print_rtl_with_bb
, insns
);
3330 if (graph_dump_format
!= no_graph
)
3331 print_rtl_graph_with_bb (dump_base_name
, ".11.sched", insns
);
3339 /* Determine if the current function is a leaf before running reload
3340 since this can impact optimizations done by the prologue and
3341 epilogue thus changing register elimination offsets. */
3342 current_function_is_leaf
= leaf_function_p ();
3345 open_dump_file (".12.lreg", decl_printable_name (decl
, 2));
3347 /* Unless we did stupid register allocation,
3348 allocate pseudo-regs that are used only within 1 basic block.
3350 RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
3351 jump optimizer after register allocation and reloading are finished. */
3354 TIMEVAR (local_alloc_time
,
3356 /* We recomputed reg usage as part of updating the rest
3357 of life info during sched. */
3358 if (! flag_schedule_insns
)
3359 recompute_reg_usage (insns
, ! optimize_size
);
3360 regclass (insns
, max_reg_num (), rtl_dump_file
);
3361 rebuild_label_notes_after_reload
= local_alloc ();
3364 rebuild_label_notes_after_reload
= 0;
3366 /* Dump rtl code after allocating regs within basic blocks. */
3370 TIMEVAR (dump_time
, dump_flow_info (rtl_dump_file
));
3371 TIMEVAR (dump_time
, dump_local_alloc (rtl_dump_file
));
3373 close_dump_file (print_rtl_with_bb
, insns
);
3374 if (graph_dump_format
!= no_graph
)
3375 print_rtl_graph_with_bb (dump_base_name
, ".12.lreg", insns
);
3381 if (global_reg_dump
)
3382 open_dump_file (".13.greg", decl_printable_name (decl
, 2));
3384 /* Unless we did stupid register allocation,
3385 allocate remaining pseudo-regs, then do the reload pass
3386 fixing up any insns that are invalid. */
3388 TIMEVAR (global_alloc_time
,
3391 failure
= global_alloc (rtl_dump_file
);
3393 failure
= reload (insns
, 0, rtl_dump_file
);
3398 goto exit_rest_of_compilation
;
3403 /* Do a very simple CSE pass over just the hard registers. */
3405 reload_cse_regs (insns
);
3407 /* Register allocation and reloading may have turned an indirect jump into
3408 a direct jump. If so, we must rebuild the JUMP_LABEL fields of
3409 jumping instructions. */
3410 if (rebuild_label_notes_after_reload
)
3411 TIMEVAR (jump_time
, rebuild_jump_labels (insns
));
3413 /* On some machines, the prologue and epilogue code, or parts thereof,
3414 can be represented as RTL. Doing so lets us schedule insns between
3415 it and the rest of the code and also allows delayed branch
3416 scheduling to operate in the epilogue. */
3418 thread_prologue_and_epilogue_insns (insns
);
3420 /* If optimizing and we are performing instruction scheduling after
3421 reload, then go ahead and split insns now since we are about to
3422 recompute flow information anyway.
3424 reload_cse_regs may expose more splitting opportunities, expecially
3425 for double-word operations. */
3426 if (optimize
> 0 && flag_schedule_insns_after_reload
)
3427 split_all_insns (0);
3429 if (global_reg_dump
)
3431 TIMEVAR (dump_time
, dump_global_regs (rtl_dump_file
));
3432 close_dump_file (print_rtl_with_bb
, insns
);
3433 if (graph_dump_format
!= no_graph
)
3434 print_rtl_graph_with_bb (dump_base_name
, ".13.greg", insns
);
3437 /* Re-create the death notes which were deleted during reload. */
3439 open_dump_file (".14.flow2", decl_printable_name (decl
, 2));
3446 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
, 1);
3447 life_analysis (insns
, max_reg_num (), rtl_dump_file
, 1);
3454 flow2_completed
= 1;
3458 close_dump_file (print_rtl_with_bb
, insns
);
3459 if (graph_dump_format
!= no_graph
)
3460 print_rtl_graph_with_bb (dump_base_name
, ".14.flow2", insns
);
3463 #ifdef HAVE_peephole2
3464 if (optimize
> 0 && flag_peephole2
)
3467 open_dump_file (".15.peephole2", decl_printable_name (decl
, 2));
3469 TIMEVAR (peephole2_time
, peephole2_optimize (rtl_dump_file
));
3473 close_dump_file (print_rtl_with_bb
, insns
);
3474 if (graph_dump_format
!= no_graph
)
3475 print_rtl_graph_with_bb (dump_base_name
, ".15.peephole2", insns
);
3480 #ifdef INSN_SCHEDULING
3481 if (optimize
> 0 && flag_schedule_insns_after_reload
)
3484 open_dump_file (".16.sched2", decl_printable_name (decl
, 2));
3486 /* Do control and data sched analysis again,
3487 and write some more of the results to dump file. */
3489 TIMEVAR (sched2_time
, schedule_insns (rtl_dump_file
));
3491 /* Dump rtl after post-reorder instruction scheduling. */
3495 close_dump_file (print_rtl_with_bb
, insns
);
3496 if (graph_dump_format
!= no_graph
)
3497 print_rtl_graph_with_bb (dump_base_name
, ".16.sched2", insns
);
3505 #ifdef LEAF_REGISTERS
3506 current_function_uses_only_leaf_regs
3507 = optimize
> 0 && only_leaf_regs_used () && leaf_function_p ();
3510 /* One more attempt to remove jumps to .+1
3511 left by dead-store-elimination.
3512 Also do cross-jumping this time
3513 and delete no-op move insns. */
3517 TIMEVAR (jump_time
, jump_optimize (insns
, JUMP_CROSS_JUMP
,
3519 !JUMP_AFTER_REGSCAN
));
3521 /* Dump rtl code after jump, if we are doing that. */
3525 dump_rtl (".17.jump2", decl
, print_rtl_with_bb
, insns
);
3526 if (graph_dump_format
!= no_graph
)
3527 print_rtl_graph_with_bb (dump_base_name
, ".17.jump2", insns
);
3531 /* If a machine dependent reorganization is needed, call it. */
3532 #ifdef MACHINE_DEPENDENT_REORG
3533 if (mach_dep_reorg_dump
)
3534 open_dump_file (".18.mach", decl_printable_name (decl
, 2));
3536 MACHINE_DEPENDENT_REORG (insns
);
3538 if (mach_dep_reorg_dump
)
3540 close_dump_file (print_rtl_with_bb
, insns
);
3541 if (graph_dump_format
!= no_graph
)
3542 print_rtl_graph_with_bb (dump_base_name
, ".18.mach", insns
);
3549 /* If a scheduling pass for delayed branches is to be done,
3550 call the scheduling code. */
3553 if (optimize
> 0 && flag_delayed_branch
)
3556 open_dump_file (".19.dbr", decl_printable_name (decl
, 2));
3561 dbr_schedule (insns
, rtl_dump_file
);
3566 close_dump_file (print_rtl_with_bb
, insns
);
3567 if (graph_dump_format
!= no_graph
)
3568 print_rtl_graph_with_bb (dump_base_name
, ".19.dbr", insns
);
3576 /* Shorten branches.
3578 Note this must run before reg-stack because of death note (ab)use
3579 in the ia32 backend. */
3580 TIMEVAR (shorten_branch_time
,
3582 shorten_branches (get_insns ());
3587 open_dump_file (".20.stack", decl_printable_name (decl
, 2));
3589 TIMEVAR (stack_reg_time
, reg_to_stack (insns
, rtl_dump_file
));
3593 close_dump_file (print_rtl_with_bb
, insns
);
3594 if (graph_dump_format
!= no_graph
)
3595 print_rtl_graph_with_bb (dump_base_name
, ".20.stack", insns
);
3602 /* Now turn the rtl into assembler code. */
3604 TIMEVAR (final_time
,
3609 /* Get the function's name, as described by its RTL.
3610 This may be different from the DECL_NAME name used
3611 in the source file. */
3613 x
= DECL_RTL (decl
);
3614 if (GET_CODE (x
) != MEM
)
3617 if (GET_CODE (x
) != SYMBOL_REF
)
3619 fnname
= XSTR (x
, 0);
3621 assemble_start_function (decl
, fnname
);
3622 final_start_function (insns
, asm_out_file
, optimize
);
3623 final (insns
, asm_out_file
, optimize
, 0);
3624 final_end_function (insns
, asm_out_file
, optimize
);
3625 assemble_end_function (decl
, fnname
);
3627 fflush (asm_out_file
);
3629 /* Release all memory allocated by flow. */
3630 free_basic_block_vars (0);
3632 /* Release all memory held by regsets now */
3633 regset_release_memory ();
3639 /* Write DBX symbols if requested */
3641 /* Note that for those inline functions where we don't initially
3642 know for certain that we will be generating an out-of-line copy,
3643 the first invocation of this routine (rest_of_compilation) will
3644 skip over this code by doing a `goto exit_rest_of_compilation;'.
3645 Later on, finish_compilation will call rest_of_compilation again
3646 for those inline functions that need to have out-of-line copies
3647 generated. During that call, we *will* be routed past here. */
3649 #ifdef DBX_DEBUGGING_INFO
3650 if (write_symbols
== DBX_DEBUG
)
3651 TIMEVAR (symout_time
, dbxout_function (decl
));
3654 #ifdef DWARF_DEBUGGING_INFO
3655 if (write_symbols
== DWARF_DEBUG
)
3656 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3659 #ifdef DWARF2_DEBUGGING_INFO
3660 if (write_symbols
== DWARF2_DEBUG
)
3661 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3664 exit_rest_of_compilation
:
3666 /* In case the function was not output,
3667 don't leave any temporary anonymous types
3668 queued up for sdb output. */
3669 #ifdef SDB_DEBUGGING_INFO
3670 if (write_symbols
== SDB_DEBUG
)
3671 sdbout_types (NULL_TREE
);
3674 reload_completed
= 0;
3675 flow2_completed
= 0;
3678 TIMEVAR (final_time
,
3680 /* Clear out the insn_length contents now that they are no
3682 init_insn_lengths ();
3684 /* Clear out the real_constant_chain before some of the rtx's
3685 it runs through become garbage. */
3686 clear_const_double_mem ();
3688 /* Cancel the effect of rtl_in_current_obstack. */
3689 resume_temporary_allocation ();
3691 /* Show no temporary slots allocated. */
3694 free_basic_block_vars (0);
3697 /* Make sure volatile mem refs aren't considered valid operands for
3698 arithmetic insns. We must call this here if this is a nested inline
3699 function, since the above code leaves us in the init_recog state
3700 (from final.c), and the function context push/pop code does not
3701 save/restore volatile_ok.
3703 ??? Maybe it isn't necessary for expand_start_function to call this
3704 anymore if we do it here? */
3706 init_recog_no_volatile ();
3708 /* We're done with this function. Free up memory if we can. */
3709 free_after_parsing (cfun
);
3710 if (! DECL_DEFER_OUTPUT (decl
))
3711 free_after_compilation (cfun
);
3717 /* The parsing time is all the time spent in yyparse
3718 *except* what is spent in this function. */
3720 parse_time
-= get_run_time () - start_time
;
3731 printf ("Usage: %s input [switches]\n", progname
);
3732 printf ("Switches:\n");
3734 printf (" -ffixed-<register> Mark <register> as being unavailable to the compiler\n");
3735 printf (" -fcall-used-<register> Mark <register> as being corrupted by function calls\n");
3736 printf (" -fcall-saved-<register> Mark <register> as being preserved across functions\n");
3737 printf (" -finline-limit=<number> Limits the size of inlined functions to <number>\n");
3739 for (i
= NUM_ELEM (f_options
); i
--;)
3741 const char * description
= f_options
[i
].description
;
3743 if (description
!= NULL
&& * description
!= 0)
3744 printf (" -f%-21s %s\n",
3745 f_options
[i
].string
, description
);
3748 printf (" -O[number] Set optimisation level to [number]\n");
3749 printf (" -Os Optimise for space rather than speed\n");
3750 printf (" -pedantic Issue warnings needed by strict compliance to ANSI C\n");
3751 printf (" -pedantic-errors Like -pedantic except that errors are produced\n");
3752 printf (" -w Suppress warnings\n");
3753 printf (" -W Enable extra warnings\n");
3755 for (i
= NUM_ELEM (W_options
); i
--;)
3757 const char * description
= W_options
[i
].description
;
3759 if (description
!= NULL
&& * description
!= 0)
3760 printf (" -W%-21s %s\n",
3761 W_options
[i
].string
, description
);
3764 printf (" -Wid-clash-<num> Warn if 2 identifiers have the same first <num> chars\n");
3765 printf (" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n");
3766 printf (" -p Enable function profiling\n");
3767 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER)
3768 printf (" -a Enable block profiling \n");
3770 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER) || defined FUNCTION_BLOCK_PROFILER_EXIT
3771 printf (" -ax Enable jump profiling \n");
3773 printf (" -o <file> Place output into <file> \n");
3774 printf (" -G <number> Put global and static data smaller than <number>\n");
3775 printf (" bytes into a special section (on some targets)\n");
3777 for (i
= NUM_ELEM (debug_args
); i
--;)
3779 if (debug_args
[i
].description
!= NULL
)
3780 printf (" -g%-21s %s\n", debug_args
[i
].arg
, debug_args
[i
].description
);
3783 printf (" -aux-info <file> Emit declaration info into <file>.X\n");
3784 printf (" -quiet Do not display functions compiled or elapsed time\n");
3785 printf (" -version Display the compiler's version\n");
3786 printf (" -d[letters] Enable dumps from specific passes of the compiler\n");
3787 printf (" -dumpbase <file> Base name to be used for dumps from specific passes\n");
3788 #if defined INSN_SCHEDULING
3789 printf (" -sched-verbose=<number> Set the verbosity level of the scheduler\n");
3791 printf (" --help Display this information\n");
3796 /* Display descriptions of language specific options.
3797 If there is no description, note that there is an undocumented option.
3798 If the description is empty, do not display anything. (This allows
3799 options to be deliberately undocumented, for whatever reason).
3800 If the option string is missing, then this is a marker, indicating
3801 that the description string is in fact the name of a language, whose
3802 language specific options are to follow. */
3804 if (NUM_ELEM (documented_lang_options
) > 1)
3806 printf ("\nLanguage specific options:\n");
3808 for (i
= 0; i
< NUM_ELEM (documented_lang_options
); i
++)
3810 const char * description
= documented_lang_options
[i
].description
;
3811 const char * option
= documented_lang_options
[i
].option
;
3813 if (description
== NULL
)
3818 printf (" %-23.23s [undocumented]\n", option
);
3820 else if (* description
== 0)
3822 else if (option
== NULL
)
3826 ("\nThere are undocumented %s specific options as well.\n",
3830 printf ("\n Options for %s:\n", description
);
3835 printf (" %-23.23s %s\n", option
, description
);
3840 printf ("\nThere are undocumented %s specific options as well.\n", lang
);
3842 if (NUM_ELEM (target_switches
) > 1
3843 #ifdef TARGET_OPTIONS
3844 || NUM_ELEM (target_options
) > 1
3852 printf ("\nTarget specific options:\n");
3854 for (i
= NUM_ELEM (target_switches
); i
--;)
3856 const char * option
= target_switches
[i
].name
;
3857 const char * description
= target_switches
[i
].description
;
3859 if (option
== NULL
|| * option
== 0)
3861 else if (description
== NULL
)
3866 printf (" -m%-21.21s [undocumented]\n", option
);
3868 else if (* description
!= 0)
3869 doc
+= printf (" -m%-21.21s %s\n", option
, description
);
3872 #ifdef TARGET_OPTIONS
3873 for (i
= NUM_ELEM (target_options
); i
--;)
3875 const char * option
= target_options
[i
].prefix
;
3876 const char * description
= target_options
[i
].description
;
3878 if (option
== NULL
|| * option
== 0)
3880 else if (description
== NULL
)
3885 printf (" -m%-21.21s [undocumented]\n", option
);
3887 else if (* description
!= 0)
3888 doc
+= printf (" -m%-21.21s %s\n", option
, description
);
3894 printf ("\nThere are undocumented target specific options as well.\n");
3896 printf (" They exist, but they are not documented.\n");
3901 /* Parse a -d... comand line switch. */
3904 decode_d_option (arg
)
3911 branch_prob_dump
= 1;
3918 global_reg_dump
= 1;
3934 #ifdef MACHINE_DEPENDENT_REORG
3935 mach_dep_reorg_dump
= 1;
3943 branch_prob_dump
= 1;
3960 global_reg_dump
= 1;
3985 #ifdef MACHINE_DEPENDENT_REORG
3987 mach_dep_reorg_dump
= 1;
3991 flag_print_asm_name
= 1;
4012 graph_dump_format
= vcg
;
4018 rtl_dump_and_exit
= 1;
4026 case 'D': /* These are handled by the preprocessor. */
4030 warning ("unrecognised gcc debugging option: %c", arg
[-1]);
4035 /* Parse a -f... comand line switch. ARG is the value after the -f.
4036 It is safe to access 'ARG - 2' to generate the full switch name.
4037 Return the number of strings consumed. */
4040 decode_f_option (arg
)
4045 /* Search for the option in the table of binary f options. */
4046 for (j
= sizeof (f_options
) / sizeof (f_options
[0]); j
--;)
4048 if (!strcmp (arg
, f_options
[j
].string
))
4050 *f_options
[j
].variable
= f_options
[j
].on_value
;
4054 if (arg
[0] == 'n' && arg
[1] == 'o' && arg
[2] == '-'
4055 && ! strcmp (arg
+ 3, f_options
[j
].string
))
4057 *f_options
[j
].variable
= ! f_options
[j
].on_value
;
4062 if (!strncmp (arg
, "inline-limit-", 13)
4063 || !strncmp (arg
, "inline-limit=", 13))
4065 read_integral_parameter (arg
+ 13, arg
- 2, inline_max_insns
);
4066 #ifdef INSN_SCHEDULING
4067 else if (!strncmp (arg
, "sched-verbose=", 14))
4068 fix_sched_param ("verbose", (const char *)(arg
+ 14));
4070 else if (!strncmp (arg
, "fixed-", 6))
4071 fix_register ((const char *)(arg
+ 6), 1, 1);
4072 else if (!strncmp (arg
, "call-used-", 10))
4073 fix_register ((const char *)(arg
+ 10), 0, 1);
4074 else if (!strncmp (arg
, "call-saved-", 11))
4075 fix_register ((const char *)(arg
+ 11), 0, 0);
4076 else if (!strncmp (arg
, "align-loops=", 12))
4077 align_loops
= read_integral_parameter (arg
+ 12, arg
- 2, align_loops
);
4078 else if (!strncmp (arg
, "align-functions=", 16))
4080 read_integral_parameter (arg
+ 16, arg
- 2, align_functions
);
4081 else if (!strncmp (arg
, "align-jumps=", 12))
4082 align_jumps
= read_integral_parameter (arg
+ 12, arg
- 2, align_jumps
);
4083 else if (!strncmp (arg
, "align-labels=", 13))
4084 align_labels
= read_integral_parameter (arg
+ 13, arg
- 2, align_labels
);
4085 else if (!strncmp (arg
, "stack-limit-register=", 21))
4087 int reg
= decode_reg_name (arg
+ 21);
4089 error ("unrecognized register name `%s'", arg
+ 21);
4091 stack_limit_rtx
= gen_rtx_REG (Pmode
, reg
);
4093 else if (!strncmp (arg
, "stack-limit-symbol=", 19))
4097 nm
= ggc_alloc_string (arg
+ 19, strlen (arg
+ 19));
4099 nm
= xstrdup (arg
+ 19);
4100 stack_limit_rtx
= gen_rtx_SYMBOL_REF (Pmode
, nm
);
4102 else if (!strcmp (arg
, "no-stack-limit"))
4103 stack_limit_rtx
= NULL_RTX
;
4104 else if (!strcmp (arg
, "preprocessed"))
4105 /* Recognise this switch but do nothing. This prevents warnings
4106 about an unrecognised switch if cpplib has not been linked in. */
4114 /* Parse a -W... comand line switch. ARG is the value after the -W.
4115 It is safe to access 'ARG - 2' to generate the full switch name.
4116 Return the number of strings consumed. */
4118 decode_W_option (arg
)
4123 /* Search for the option in the table of binary W options. */
4125 for (j
= sizeof (W_options
) / sizeof (W_options
[0]); j
--;)
4127 if (!strcmp (arg
, W_options
[j
].string
))
4129 *W_options
[j
].variable
= W_options
[j
].on_value
;
4133 if (arg
[0] == 'n' && arg
[1] == 'o' && arg
[2] == '-'
4134 && ! strcmp (arg
+ 3, W_options
[j
].string
))
4136 *W_options
[j
].variable
= ! W_options
[j
].on_value
;
4141 if (!strncmp (arg
, "id-clash-", 9))
4143 const int id_clash_val
= read_integral_parameter (arg
+ 9, arg
- 2, -1);
4145 if (id_clash_val
!= -1)
4147 id_clash_len
= id_clash_val
;
4151 else if (!strncmp (arg
, "larger-than-", 12))
4153 const int larger_than_val
=
4154 read_integral_parameter (arg
+ 12, arg
- 2, -1);
4155 if (larger_than_val
!= -1)
4157 larger_than_size
= larger_than_val
;
4158 warn_larger_than
= 1;
4167 /* Parse a -g... comand line switch. ARG is the value after the -g.
4168 It is safe to access 'ARG - 2' to generate the full switch name.
4169 Return the number of strings consumed. */
4172 decode_g_option (arg
)
4176 /* A lot of code assumes write_symbols == NO_DEBUG if the
4177 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4178 of what debugging type has been selected). This records the
4179 selected type. It is an error to specify more than one
4181 static enum debug_info_type selected_debug_type
= NO_DEBUG
;
4182 /* Non-zero if debugging format has been explicitly set.
4183 -g and -ggdb don't explicitly set the debugging format so
4184 -gdwarf -g3 is equivalent to -gdwarf3. */
4185 static int type_explicitly_set_p
= 0;
4186 /* Indexed by enum debug_info_type. */
4187 static const char * debug_type_names
[] =
4189 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4192 /* The maximum admissible debug level value. */
4193 static const unsigned max_debug_level
= 3;
4195 /* Look up ARG in the table. */
4196 for (da
= debug_args
; da
->arg
; da
++)
4198 const int da_len
= strlen (da
->arg
);
4200 if (da_len
== 0 || ! strncmp (arg
, da
->arg
, da_len
))
4202 enum debug_info_type type
= da
->debug_type
;
4203 const char * p
= arg
+ da_len
;
4205 if (*p
&& (*p
< '0' || *p
> '9'))
4208 /* A debug flag without a level defaults to level 2.
4209 Note we do not want to call read_integral_parameter
4210 for that case since it will call atoi which
4213 ??? We may want to generalize the interface to
4214 read_integral_parameter to better handle this case
4215 if this case shows up often. */
4217 level
= read_integral_parameter (p
, 0, max_debug_level
+ 1);
4221 if (da_len
> 1 && *p
&& !strncmp (arg
, "dwarf", da_len
))
4223 error ("use -gdwarf -g%d for DWARF v1, level %d",
4226 error ("use -gdwarf-2 for DWARF v2");
4229 if (level
> max_debug_level
)
4232 ignoring option `%s' due to invalid debug level specification",
4234 level
= debug_info_level
;
4237 if (type
== NO_DEBUG
)
4239 type
= PREFERRED_DEBUGGING_TYPE
;
4241 if (da_len
> 1 && strncmp (arg
, "gdb", da_len
) == 0)
4243 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4244 type
= DWARF2_DEBUG
;
4246 #ifdef DBX_DEBUGGING_INFO
4253 if (type
== NO_DEBUG
)
4254 warning ("`%s': unknown or unsupported -g option", arg
- 2);
4256 /* Does it conflict with an already selected type? */
4257 if (type_explicitly_set_p
4258 /* -g/-ggdb don't conflict with anything */
4259 && da
->debug_type
!= NO_DEBUG
4260 && type
!= selected_debug_type
)
4261 warning ("`%s' ignored, conflicts with `-g%s'",
4262 arg
- 2, debug_type_names
[(int) selected_debug_type
]);
4265 /* If the format has already been set, -g/-ggdb
4266 only change the debug level. */
4267 if (type_explicitly_set_p
&& da
->debug_type
== NO_DEBUG
)
4268 ; /* don't change debugging type */
4271 selected_debug_type
= type
;
4272 type_explicitly_set_p
= da
->debug_type
!= NO_DEBUG
;
4275 write_symbols
= (level
== 0
4277 : selected_debug_type
);
4278 use_gnu_debug_info_extensions
= da
->use_extensions_p
;
4279 debug_info_level
= (enum debug_info_level
) level
;
4287 warning ("`%s': unknown or unsupported -g option", arg
- 2);
4292 /* Decode the first argument in the argv as a language-independent option.
4293 Return the number of strings consumed. 'strings_processed' is the
4294 number of strings that have already been decoded in a language
4295 specific fashion before this function was invoked. */
4298 independent_decode_option (argc
, argv
, strings_processed
)
4301 unsigned strings_processed ATTRIBUTE_UNUSED
;
4303 char * arg
= argv
[0];
4305 if (arg
[0] != '-' || arg
[1] == 0)
4317 if (!strcmp (arg
, "-help"))
4332 /* Already been treated in main (). Do nothing. */
4336 set_target_switch (arg
+ 1);
4340 return decode_f_option (arg
+ 1);
4343 return decode_g_option (arg
+ 1);
4346 if (!strcmp (arg
, "dumpbase"))
4351 dump_base_name
= argv
[1];
4355 decode_d_option (arg
+ 1);
4359 if (!strcmp (arg
, "pedantic"))
4361 else if (!strcmp (arg
, "pedantic-errors"))
4362 flag_pedantic_errors
= pedantic
= 1;
4363 else if (arg
[1] == 0)
4370 if (!strcmp (arg
, "quiet"))
4377 if (!strcmp (arg
, "version"))
4385 inhibit_warnings
= 1;
4394 /* We save the value of warn_uninitialized, since if they put
4395 -Wuninitialized on the command line, we need to generate a
4396 warning about not using it without also specifying -O. */
4397 if (warn_uninitialized
!= 1)
4398 warn_uninitialized
= 2;
4401 return decode_W_option (arg
+ 1);
4407 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4408 warning ("`-a' option (basic block profile) not supported");
4410 profile_block_flag
= (profile_block_flag
< 2) ? 1 : 3;
4413 else if (!strcmp (arg
, "ax"))
4415 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4416 warning ("`-ax' option (jump profiling) not supported");
4418 profile_block_flag
= (!profile_block_flag
4419 || profile_block_flag
== 2) ? 2 : 3;
4422 else if (!strncmp (arg
, "aux-info", 8))
4424 flag_gen_aux_info
= 1;
4430 aux_info_file_name
= argv
[1];
4434 aux_info_file_name
= arg
+ 8;
4446 asm_file_name
= argv
[1];
4461 g_switch_val
= read_integral_parameter (argv
[1], 0, -1);
4466 g_switch_val
= read_integral_parameter (arg
+ 1, 0, -1);
4470 if (g_switch_val
== -1)
4474 g_switch_set
= TRUE
;
4475 g_switch_value
= g_switch_val
;
4485 /* Entry point of cc1/c++. Decode command args, then call compile_file.
4486 Exit code is 35 if can't open files, 34 if fatal error,
4487 33 if had nonfatal errors, else success. */
4489 extern int main
PROTO ((int, char **));
4499 /* save in case md file wants to emit args as a comment. */
4503 p
= argv
[0] + strlen (argv
[0]);
4504 while (p
!= argv
[0] && p
[-1] != '/'
4505 #ifdef DIR_SEPARATOR
4506 && p
[-1] != DIR_SEPARATOR
4512 #ifdef HAVE_LC_MESSAGES
4513 setlocale (LC_MESSAGES
, "");
4515 (void) bindtextdomain (PACKAGE
, localedir
);
4516 (void) textdomain (PACKAGE
);
4518 signal (SIGFPE
, float_signal
);
4521 signal (SIGPIPE
, pipe_closed
);
4524 decl_printable_name
= decl_name
;
4525 lang_expand_expr
= (lang_expand_expr_t
) do_abort
;
4527 /* Initialize whether `char' is signed. */
4528 flag_signed_char
= DEFAULT_SIGNED_CHAR
;
4529 #ifdef DEFAULT_SHORT_ENUMS
4530 /* Initialize how much space enums occupy, by default. */
4531 flag_short_enums
= DEFAULT_SHORT_ENUMS
;
4534 /* Initialize the garbage-collector. */
4536 ggc_add_root (&input_file_stack
, 1, sizeof input_file_stack
,
4538 ggc_add_rtx_root (&stack_limit_rtx
, 1);
4540 /* Perform language-specific options intialization. */
4541 lang_init_options ();
4543 /* Scan to see what optimization level has been specified. That will
4544 determine the default value of many flags. */
4545 for (i
= 1; i
< argc
; i
++)
4547 if (!strcmp (argv
[i
], "-O"))
4552 else if (argv
[i
][0] == '-' && argv
[i
][1] == 'O')
4554 /* Handle -Os, -O2, -O3, -O69, ... */
4555 char *p
= &argv
[i
][2];
4557 if ((p
[0] == 's') && (p
[1] == 0))
4561 /* Optimizing for size forces optimize to be 2. */
4566 const int optimize_val
= read_integral_parameter (p
, p
- 2, -1);
4567 if (optimize_val
!= -1)
4569 optimize
= optimize_val
;
4576 obey_regdecls
= (optimize
== 0);
4581 flag_thread_jumps
= 1;
4583 flag_delayed_branch
= 1;
4585 #ifdef CAN_DEBUG_WITHOUT_FP
4586 flag_omit_frame_pointer
= 1;
4592 flag_cse_follow_jumps
= 1;
4593 flag_cse_skip_blocks
= 1;
4595 flag_expensive_optimizations
= 1;
4596 flag_strength_reduce
= 1;
4597 flag_rerun_cse_after_loop
= 1;
4598 flag_rerun_loop_opt
= 1;
4599 flag_caller_saves
= 1;
4602 #ifdef INSN_SCHEDULING
4603 flag_schedule_insns
= 1;
4604 flag_schedule_insns_after_reload
= 1;
4607 flag_strict_aliasing
= 1;
4608 flag_delete_null_pointer_checks
= 1;
4613 flag_inline_functions
= 1;
4616 if (optimize
< 2 || optimize_size
)
4621 align_functions
= 1;
4624 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
4627 set_target_switch ("");
4629 #ifdef OPTIMIZATION_OPTIONS
4630 /* Allow default optimizations to be specified on a per-machine basis. */
4631 OPTIMIZATION_OPTIONS (optimize
, optimize_size
);
4634 /* Initialize register usage now so switches may override. */
4637 /* Perform normal command line switch decoding. */
4638 for (i
= 1; i
< argc
;)
4640 unsigned lang_processed
;
4641 unsigned indep_processed
;
4643 /* Give the language a chance to decode the option for itself. */
4644 lang_processed
= lang_decode_option (argc
- i
, argv
+ i
);
4646 /* Now see if the option also has a language independent meaning.
4647 Some options are both language specific and language independent,
4648 eg --help. It is possible that there might be options that should
4649 only be decoded in a language independent way if the were not
4650 decoded in a langauge specific way, which is why 'lang_processed'
4652 indep_processed
= independent_decode_option (argc
- i
, argv
+ i
,
4655 if (lang_processed
|| indep_processed
)
4656 i
+= (lang_processed
> indep_processed
4657 ? lang_processed
: indep_processed
);
4660 const char * option
= NULL
;
4661 const char * lang
= NULL
;
4664 /* It is possible that the command line switch is not valid for the
4665 current language, but it is valid for another language. In order
4666 to be compatible with previous versions of the compiler (which
4667 did not issue an error message in this case) we check for this
4668 possibilty here. If we do find a match, then if extra_warnings
4669 is set we generate a warning message, otherwise we will just
4670 ignore the option. */
4671 for (j
= 0; j
< NUM_ELEM (documented_lang_options
); j
++)
4673 option
= documented_lang_options
[j
].option
;
4676 lang
= documented_lang_options
[j
].description
;
4677 else if (! strncmp (argv
[i
], option
, strlen (option
)))
4681 if (j
!= NUM_ELEM (documented_lang_options
))
4685 warning ("Ignoring command line option '%s'", argv
[i
]);
4688 (It is valid for %s but not the selected langauge)", lang
);
4692 error ("Unrecognised option `%s'", argv
[i
]);
4698 /* Checker uses the frame pointer. */
4699 if (flag_check_memory_usage
)
4700 flag_omit_frame_pointer
= 0;
4704 /* Inlining does not work if not optimizing,
4705 so force it not to be done. */
4709 /* The c_decode_option and lang_decode_option functions set
4710 this to `2' if -Wall is used, so we can avoid giving out
4711 lots of errors for people who don't realize what -Wall does. */
4712 if (warn_uninitialized
== 1)
4713 warning ("-Wuninitialized is not supported without -O");
4716 #ifdef OVERRIDE_OPTIONS
4717 /* Some machines may reject certain combinations of options. */
4721 if (exceptions_via_longjmp
== 2)
4723 #ifdef DWARF2_UNWIND_INFO
4724 exceptions_via_longjmp
= ! DWARF2_UNWIND_INFO
;
4726 exceptions_via_longjmp
= 1;
4730 /* Set up the align_*_log variables, defaulting them to 1 if they
4731 were still unset. */
4732 if (align_loops
<= 0) align_loops
= 1;
4733 align_loops_log
= floor_log2 (align_loops
*2-1);
4734 if (align_jumps
<= 0) align_jumps
= 1;
4735 align_jumps_log
= floor_log2 (align_jumps
*2-1);
4736 if (align_labels
<= 0) align_labels
= 1;
4737 align_labels_log
= floor_log2 (align_labels
*2-1);
4738 if (align_functions
<= 0) align_functions
= 1;
4739 align_functions_log
= floor_log2 (align_functions
*2-1);
4741 if (profile_block_flag
== 3)
4743 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4744 profile_block_flag
= 2;
4747 /* Unrolling all loops implies that standard loop unrolling must also
4749 if (flag_unroll_all_loops
)
4750 flag_unroll_loops
= 1;
4751 /* Loop unrolling requires that strength_reduction be on also. Silently
4752 turn on strength reduction here if it isn't already on. Also, the loop
4753 unrolling code assumes that cse will be run after loop, so that must
4754 be turned on also. */
4755 if (flag_unroll_loops
)
4757 flag_strength_reduce
= 1;
4758 flag_rerun_cse_after_loop
= 1;
4761 /* Warn about options that are not supported on this machine. */
4762 #ifndef INSN_SCHEDULING
4763 if (flag_schedule_insns
|| flag_schedule_insns_after_reload
)
4764 warning ("instruction scheduling not supported on this target machine");
4767 if (flag_delayed_branch
)
4768 warning ("this target machine does not have delayed branches");
4771 user_label_prefix
= USER_LABEL_PREFIX
;
4772 if (flag_leading_underscore
!= -1)
4774 /* If the default prefix is more complicated than "" or "_",
4775 issue a warning and ignore this option. */
4776 if (user_label_prefix
[0] == 0 ||
4777 (user_label_prefix
[0] == '_' && user_label_prefix
[1] == 0))
4779 user_label_prefix
= flag_leading_underscore
? "_" : "";
4782 warning ("-f%sleading-underscore not supported on this target machine",
4783 flag_leading_underscore
? "" : "no-");
4786 /* If we are in verbose mode, write out the version and maybe all the
4787 option flags in use. */
4790 print_version (stderr
, "");
4792 print_switch_values (stderr
, 0, MAX_LINE
, "", " ", "\n");
4795 compile_file (filename
);
4797 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__)) && !defined(__INTERIX)
4800 char *lim
= (char *) sbrk (0);
4802 fnotice (stderr
, "Data size %ld.\n", (long) (lim
- (char *) &environ
));
4807 system ("ps -l 1>&2");
4810 #endif /* not USG */
4813 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX */
4816 return (FATAL_EXIT_CODE
);
4818 return (FATAL_EXIT_CODE
);
4819 return (SUCCESS_EXIT_CODE
);
4822 /* Decode -m switches. */
4823 /* Decode the switch -mNAME. */
4826 set_target_switch (name
)
4830 int valid_target_option
= 0;
4832 for (j
= 0; j
< sizeof target_switches
/ sizeof target_switches
[0]; j
++)
4833 if (!strcmp (target_switches
[j
].name
, name
))
4835 if (target_switches
[j
].value
< 0)
4836 target_flags
&= ~-target_switches
[j
].value
;
4838 target_flags
|= target_switches
[j
].value
;
4839 valid_target_option
= 1;
4842 #ifdef TARGET_OPTIONS
4843 if (!valid_target_option
)
4844 for (j
= 0; j
< sizeof target_options
/ sizeof target_options
[0]; j
++)
4846 int len
= strlen (target_options
[j
].prefix
);
4847 if (!strncmp (target_options
[j
].prefix
, name
, len
))
4849 *target_options
[j
].variable
= name
+ len
;
4850 valid_target_option
= 1;
4855 if (!valid_target_option
)
4856 error ("Invalid option `%s'", name
);
4859 /* Print version information to FILE.
4860 Each line begins with INDENT (for the case where FILE is the
4861 assembler output file). */
4864 print_version (file
, indent
)
4869 #define __VERSION__ "[?]"
4873 "%s%s%s version %s (%s) compiled by GNU C version %s.\n"
4875 "%s%s%s version %s (%s) compiled by CC.\n"
4877 , indent
, *indent
!= 0 ? " " : "",
4878 language_string
, version_string
, TARGET_NAME
, __VERSION__
);
4881 /* Print an option value and return the adjusted position in the line.
4882 ??? We don't handle error returns from fprintf (disk full); presumably
4883 other code will catch a disk full though. */
4886 print_single_switch (file
, pos
, max
, indent
, sep
, term
, type
, name
)
4889 const char *indent
, *sep
, *term
, *type
, *name
;
4891 /* The ultrix fprintf returns 0 on success, so compute the result we want
4892 here since we need it for the following test. */
4893 int len
= strlen (sep
) + strlen (type
) + strlen (name
);
4898 fprintf (file
, "%s", term
);
4903 fprintf (file
, "%s", indent
);
4904 pos
= strlen (indent
);
4906 fprintf (file
, "%s%s%s", sep
, type
, name
);
4911 /* Print active target switches to FILE.
4912 POS is the current cursor position and MAX is the size of a "line".
4913 Each line begins with INDENT and ends with TERM.
4914 Each switch is separated from the next by SEP. */
4917 print_switch_values (file
, pos
, max
, indent
, sep
, term
)
4920 const char *indent
, *sep
, *term
;
4925 /* Print the options as passed. */
4927 pos
= print_single_switch (file
, pos
, max
, indent
, *indent
? " " : "", term
,
4928 _("options passed: "), "");
4930 for (p
= &save_argv
[1]; *p
!= NULL
; p
++)
4934 if (strcmp (*p
, "-o") == 0)
4940 if (strcmp (*p
, "-quiet") == 0)
4942 if (strcmp (*p
, "-version") == 0)
4947 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
, *p
, "");
4950 fprintf (file
, "%s", term
);
4952 /* Print the -f and -m options that have been enabled.
4953 We don't handle language specific options but printing argv
4956 pos
= print_single_switch (file
, 0, max
, indent
, *indent
? " " : "", term
,
4957 _("options enabled: "), "");
4959 for (j
= 0; j
< sizeof f_options
/ sizeof f_options
[0]; j
++)
4960 if (*f_options
[j
].variable
== f_options
[j
].on_value
)
4961 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4962 "-f", f_options
[j
].string
);
4964 /* Print target specific options. */
4966 for (j
= 0; j
< sizeof target_switches
/ sizeof target_switches
[0]; j
++)
4967 if (target_switches
[j
].name
[0] != '\0'
4968 && target_switches
[j
].value
> 0
4969 && ((target_switches
[j
].value
& target_flags
)
4970 == target_switches
[j
].value
))
4972 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4973 "-m", target_switches
[j
].name
);
4976 #ifdef TARGET_OPTIONS
4977 for (j
= 0; j
< sizeof target_options
/ sizeof target_options
[0]; j
++)
4978 if (*target_options
[j
].variable
!= NULL
)
4981 sprintf (prefix
, "-m%s", target_options
[j
].prefix
);
4982 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4983 prefix
, *target_options
[j
].variable
);
4987 fprintf (file
, "%s", term
);
4990 /* Record the beginning of a new source file, named FILENAME. */
4993 debug_start_source_file (filename
)
4994 register char *filename ATTRIBUTE_UNUSED
;
4996 #ifdef DBX_DEBUGGING_INFO
4997 if (write_symbols
== DBX_DEBUG
)
4998 dbxout_start_new_source_file (filename
);
5000 #ifdef DWARF_DEBUGGING_INFO
5001 if (debug_info_level
== DINFO_LEVEL_VERBOSE
5002 && write_symbols
== DWARF_DEBUG
)
5003 dwarfout_start_new_source_file (filename
);
5004 #endif /* DWARF_DEBUGGING_INFO */
5005 #ifdef DWARF2_DEBUGGING_INFO
5006 if (debug_info_level
== DINFO_LEVEL_VERBOSE
5007 && write_symbols
== DWARF2_DEBUG
)
5008 dwarf2out_start_source_file (filename
);
5009 #endif /* DWARF2_DEBUGGING_INFO */
5010 #ifdef SDB_DEBUGGING_INFO
5011 if (write_symbols
== SDB_DEBUG
)
5012 sdbout_start_new_source_file (filename
);
5016 /* Record the resumption of a source file. LINENO is the line number in
5017 the source file we are returning to. */
5020 debug_end_source_file (lineno
)
5021 register unsigned lineno ATTRIBUTE_UNUSED
;
5023 #ifdef DBX_DEBUGGING_INFO
5024 if (write_symbols
== DBX_DEBUG
)
5025 dbxout_resume_previous_source_file ();
5027 #ifdef DWARF_DEBUGGING_INFO
5028 if (debug_info_level
== DINFO_LEVEL_VERBOSE
5029 && write_symbols
== DWARF_DEBUG
)
5030 dwarfout_resume_previous_source_file (lineno
);
5031 #endif /* DWARF_DEBUGGING_INFO */
5032 #ifdef DWARF2_DEBUGGING_INFO
5033 if (debug_info_level
== DINFO_LEVEL_VERBOSE
5034 && write_symbols
== DWARF2_DEBUG
)
5035 dwarf2out_end_source_file ();
5036 #endif /* DWARF2_DEBUGGING_INFO */
5037 #ifdef SDB_DEBUGGING_INFO
5038 if (write_symbols
== SDB_DEBUG
)
5039 sdbout_resume_previous_source_file ();
5043 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5044 the tail part of the directive line, i.e. the part which is past the
5045 initial whitespace, #, whitespace, directive-name, whitespace part. */
5048 debug_define (lineno
, buffer
)
5049 register unsigned lineno ATTRIBUTE_UNUSED
;
5050 register char *buffer ATTRIBUTE_UNUSED
;
5052 #ifdef DWARF_DEBUGGING_INFO
5053 if (debug_info_level
== DINFO_LEVEL_VERBOSE
5054 && write_symbols
== DWARF_DEBUG
)
5055 dwarfout_define (lineno
, buffer
);
5056 #endif /* DWARF_DEBUGGING_INFO */
5057 #ifdef DWARF2_DEBUGGING_INFO
5058 if (debug_info_level
== DINFO_LEVEL_VERBOSE
5059 && write_symbols
== DWARF2_DEBUG
)
5060 dwarf2out_define (lineno
, buffer
);
5061 #endif /* DWARF2_DEBUGGING_INFO */
5064 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5065 the tail part of the directive line, i.e. the part which is past the
5066 initial whitespace, #, whitespace, directive-name, whitespace part. */
5069 debug_undef (lineno
, buffer
)
5070 register unsigned lineno ATTRIBUTE_UNUSED
;
5071 register char *buffer ATTRIBUTE_UNUSED
;
5073 #ifdef DWARF_DEBUGGING_INFO
5074 if (debug_info_level
== DINFO_LEVEL_VERBOSE
5075 && write_symbols
== DWARF_DEBUG
)
5076 dwarfout_undef (lineno
, buffer
);
5077 #endif /* DWARF_DEBUGGING_INFO */
5078 #ifdef DWARF2_DEBUGGING_INFO
5079 if (debug_info_level
== DINFO_LEVEL_VERBOSE
5080 && write_symbols
== DWARF2_DEBUG
)
5081 dwarf2out_undef (lineno
, buffer
);
5082 #endif /* DWARF2_DEBUGGING_INFO */