1 /* Top level of GNU C compiler
2 Copyright (C) 1987, 88, 89, 92-7, 1998 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. */
32 #undef FLOAT /* This is for hpux. They should change hpux. */
33 #undef FFS /* Some systems define this in param.h. */
39 #ifdef HAVE_SYS_RESOURCE_H
40 # include <sys/resource.h>
43 #ifdef HAVE_SYS_TIMES_H
44 # include <sys/times.h>
51 #include "insn-attr.h"
52 #include "insn-codes.h"
53 #include "insn-config.h"
59 #ifdef XCOFF_DEBUGGING_INFO
64 /* The extra parameters substantially improve the I/O performance. */
66 vms_fopen (fname
, type
)
70 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
71 fixed arguments, which matches ANSI's specification but not VAXCRTL's
72 pre-ANSI implementation. This hack circumvents the mismatch problem. */
73 FILE *(*vmslib_fopen
)() = (FILE *(*)()) fopen
;
76 return (*vmslib_fopen
) (fname
, type
, "mbc=32",
77 "deq=64", "fop=tef", "shr=nil");
79 return (*vmslib_fopen
) (fname
, type
, "mbc=32");
81 #define fopen vms_fopen
84 #ifndef DEFAULT_GDB_EXTENSIONS
85 #define DEFAULT_GDB_EXTENSIONS 1
88 /* If more than one debugging type is supported, you must define
89 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
91 This is one long line cause VAXC can't handle a \-newline. */
92 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
93 #ifndef PREFERRED_DEBUGGING_TYPE
94 You Lose
! You must define PREFERRED_DEBUGGING_TYPE
!
95 #endif /* no PREFERRED_DEBUGGING_TYPE */
96 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
97 so the following code needn't care. */
98 #ifdef DBX_DEBUGGING_INFO
99 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
101 #ifdef SDB_DEBUGGING_INFO
102 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
104 #ifdef DWARF_DEBUGGING_INFO
105 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
107 #ifdef DWARF2_DEBUGGING_INFO
108 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
110 #ifdef XCOFF_DEBUGGING_INFO
111 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
113 #endif /* More than one debugger format enabled. */
115 /* If still not defined, must have been because no debugging formats
117 #ifndef PREFERRED_DEBUGGING_TYPE
118 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
121 extern int rtx_equal_function_value_matters
;
123 #if ! (defined (VMS) || defined (OS2))
124 extern char **environ
;
126 extern char *version_string
, *language_string
;
128 /* Carry information from ASM_DECLARE_OBJECT_NAME
129 to ASM_FINISH_DECLARE_OBJECT. */
131 extern int size_directive_output
;
132 extern tree last_assemble_variable_decl
;
134 extern char *init_parse
PVPROTO((char *));
135 extern void finish_parse ();
136 extern void init_decl_processing ();
137 extern void init_obstacks ();
138 extern void init_tree_codes ();
139 extern void init_rtl ();
140 extern void init_regs ();
141 extern void init_optabs ();
142 extern void init_stmt ();
143 extern void init_reg_sets ();
144 extern void dump_flow_info ();
145 extern void dump_sched_info ();
146 extern void dump_local_alloc ();
147 extern void regset_release_memory ();
149 extern void print_rtl ();
150 extern void print_rtl_with_bb ();
152 void rest_of_decl_compilation ();
153 void error_with_file_and_line
PVPROTO((char *file
, int line
, char *s
, ...));
154 void error_with_decl
PVPROTO((tree decl
, char *s
, ...));
155 void error_for_asm
PVPROTO((rtx insn
, char *s
, ...));
156 void error
PVPROTO((char *s
, ...));
157 void fatal
PVPROTO((char *s
, ...));
158 void warning_with_file_and_line
PVPROTO((char *file
, int line
, char *s
, ...));
159 void warning_with_decl
PVPROTO((tree decl
, char *s
, ...));
160 void warning_for_asm
PVPROTO((rtx insn
, char *s
, ...));
161 void warning
PVPROTO((char *s
, ...));
162 void pedwarn
PVPROTO((char *s
, ...));
163 void pedwarn_with_decl
PVPROTO((tree decl
, char *s
, ...));
164 void pedwarn_with_file_and_line
PVPROTO((char *file
, int line
, char *s
, ...));
165 void sorry
PVPROTO((char *s
, ...));
166 void really_sorry
PVPROTO((char *s
, ...));
168 void set_target_switch ();
169 static char *decl_name
PROTO((tree
, int));
170 static void vmessage
PROTO((char *, char *, va_list));
171 static void v_message_with_file_and_line
PROTO((char *, int, char *,
173 static void v_message_with_decl
PROTO((tree
, char *, char *, va_list));
174 static void file_and_line_for_asm
PROTO((rtx
, char **, int *));
175 static void v_error_with_file_and_line
PROTO((char *, int, char *, va_list));
176 static void v_error_with_decl
PROTO((tree
, char *, va_list));
177 static void v_error_for_asm
PROTO((rtx
, char *, va_list));
178 static void verror
PROTO((char *, va_list));
179 static void vfatal
PROTO((char *, va_list));
180 static void v_warning_with_file_and_line
PROTO ((char *, int, char *, va_list));
181 static void v_warning_with_decl
PROTO((tree
, char *, va_list));
182 static void v_warning_for_asm
PROTO((rtx
, char *, va_list));
183 static void vwarning
PROTO((char *, va_list));
184 static void vpedwarn
PROTO((char *, va_list));
185 static void v_pedwarn_with_decl
PROTO((tree
, char *, va_list));
186 static void v_pedwarn_with_file_and_line
PROTO((char *, int, char *, va_list));
187 static void vsorry
PROTO((char *, va_list));
188 static void v_really_sorry
PROTO((char *, va_list));
189 static void float_signal
PROTO((int));
190 static void pipe_closed
PROTO((int));
191 static void output_lang_identify
PROTO((FILE *));
192 static void open_dump_file
PROTO((char *, char *));
193 static void close_dump_file
PROTO((void (*) (FILE *, rtx
), rtx
));
194 static void dump_rtl
PROTO((char *, tree
, void (*) (FILE *, rtx
), rtx
));
195 static void clean_dump_file
PROTO((char *));
196 static void compile_file
PROTO((char *));
198 void print_version ();
199 int print_single_switch ();
200 void print_switch_values ();
201 /* Length of line when printing switch values. */
204 #ifdef NEED_DECLARATION_ABORT
208 #ifdef NEED_DECLARATION_SBRK
209 extern char *sbrk ();
212 /* Name of program invoked, sans directories. */
216 /* Copy of arguments to main. */
220 /* Name of current original source file (what was input to cpp).
221 This comes from each #-command in the actual input. */
223 char *input_filename
;
225 /* Name of top-level original source file (what was input to cpp).
226 This comes from the #-command at the beginning of the actual input.
227 If there isn't any there, then this is the cc1 input file name. */
229 char *main_input_filename
;
231 /* Current line number in real source file. */
235 /* Stack of currently pending input files. */
237 struct file_stack
*input_file_stack
;
239 /* Incremented on each change to input_file_stack. */
240 int input_file_stack_tick
;
242 /* FUNCTION_DECL for function now being parsed or compiled. */
244 extern tree current_function_decl
;
246 /* Name to use as base of names for dump output files. */
248 char *dump_base_name
;
250 /* Bit flags that specify the machine subtype we are compiling for.
251 Bits are tested using macros TARGET_... defined in the tm.h file
252 and set by `-m...' switches. Must be defined in rtlanal.c. */
254 extern int target_flags
;
256 /* Flags saying which kinds of debugging dump have been requested. */
259 int rtl_dump_and_exit
= 0;
260 int jump_opt_dump
= 0;
261 int addressof_dump
= 0;
265 int branch_prob_dump
= 0;
267 int combine_dump
= 0;
268 int regmove_dump
= 0;
270 int local_reg_dump
= 0;
271 int global_reg_dump
= 0;
273 int jump2_opt_dump
= 0;
275 int dbr_sched_dump
= 0;
277 int flag_print_asm_name
= 0;
279 int stack_reg_dump
= 0;
281 #ifdef MACHINE_DEPENDENT_REORG
282 int mach_dep_reorg_dump
= 0;
285 /* Name for output file of assembly code, specified with -o. */
289 /* Value of the -G xx switch, and whether it was passed or not. */
293 /* Type(s) of debugging information we are producing (if any).
294 See flags.h for the definitions of the different possible
295 types of debugging information. */
296 enum debug_info_type write_symbols
= NO_DEBUG
;
298 /* Level of debugging information we are producing. See flags.h
299 for the definitions of the different possible levels. */
300 enum debug_info_level debug_info_level
= DINFO_LEVEL_NONE
;
302 /* Nonzero means use GNU-only extensions in the generated symbolic
303 debugging information. */
304 /* Currently, this only has an effect when write_symbols is set to
305 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
306 int use_gnu_debug_info_extensions
= 0;
308 /* Nonzero means do optimizations. -O.
309 Particular numeric values stand for particular amounts of optimization;
310 thus, -O2 stores 2 here. However, the optimizations beyond the basic
311 ones are not controlled directly by this variable. Instead, they are
312 controlled by individual `flag_...' variables that are defaulted
313 based on this variable. */
317 /* Nonzero means optimize for size. -Os.
318 The only valid values are zero and non-zero. When optimize_size is
319 non-zero, optimize defaults to 2, but certain individual code
320 bloating optimizations are disabled. */
322 int optimize_size
= 0;
324 /* Number of error messages and warning messages so far. */
327 int warningcount
= 0;
330 /* Pointer to function to compute the name to use to print a declaration.
331 DECL is the declaration in question.
332 VERBOSITY determines what information will be printed:
333 0: DECL_NAME, demangled as necessary.
334 1: and scope information.
335 2: and any other information that might be interesting, such as function
336 parameter types in C++. */
338 char *(*decl_printable_name
) (/* tree decl, int verbosity */);
340 /* Pointer to function to compute rtl for a language-specific tree code. */
342 struct rtx_def
*(*lang_expand_expr
) ();
344 /* Pointer to function to finish handling an incomplete decl at the
345 end of compilation. */
347 void (*incomplete_decl_finalize_hook
) () = 0;
349 /* Highest label number used at the end of reload. */
351 int max_label_num_after_reload
;
353 /* Nonzero if generating code to do profiling. */
355 int profile_flag
= 0;
357 /* Nonzero if generating code to do profiling on a line-by-line basis. */
359 int profile_block_flag
;
361 /* Nonzero if generating code to profile program flow graph arcs. */
363 int profile_arc_flag
= 0;
365 /* Nonzero if generating info for gcov to calculate line test coverage. */
367 int flag_test_coverage
= 0;
369 /* Nonzero indicates that branch taken probabilities should be calculated. */
371 int flag_branch_probabilities
= 0;
373 /* Nonzero for -pedantic switch: warn about anything
374 that standard spec forbids. */
378 /* Temporarily suppress certain warnings.
379 This is set while reading code from a system header file. */
381 int in_system_header
= 0;
383 /* Nonzero means do stupid register allocation.
384 Currently, this is 1 if `optimize' is 0. */
386 int obey_regdecls
= 0;
388 /* Don't print functions as they are compiled and don't print
389 times taken by the various passes. -quiet. */
395 /* Nonzero means `char' should be signed. */
397 int flag_signed_char
;
399 /* Nonzero means give an enum type only as many bytes as it needs. */
401 int flag_short_enums
;
403 /* Nonzero for -fcaller-saves: allocate values in regs that need to
404 be saved across function calls, if that produces overall better code.
405 Optional now, so people can test it. */
407 #ifdef DEFAULT_CALLER_SAVES
408 int flag_caller_saves
= 1;
410 int flag_caller_saves
= 0;
413 /* Nonzero if structures and unions should be returned in memory.
415 This should only be defined if compatibility with another compiler or
416 with an ABI is needed, because it results in slower code. */
418 #ifndef DEFAULT_PCC_STRUCT_RETURN
419 #define DEFAULT_PCC_STRUCT_RETURN 1
422 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
424 int flag_pcc_struct_return
= DEFAULT_PCC_STRUCT_RETURN
;
426 /* Nonzero for -fforce-mem: load memory value into a register
427 before arithmetic on it. This makes better cse but slower compilation. */
429 int flag_force_mem
= 0;
431 /* Nonzero for -fforce-addr: load memory address into a register before
432 reference to memory. This makes better cse but slower compilation. */
434 int flag_force_addr
= 0;
436 /* Nonzero for -fdefer-pop: don't pop args after each function call;
437 instead save them up to pop many calls' args with one insns. */
439 int flag_defer_pop
= 0;
441 /* Nonzero for -ffloat-store: don't allocate floats and doubles
442 in extended-precision registers. */
444 int flag_float_store
= 0;
446 /* Nonzero for -fcse-follow-jumps:
447 have cse follow jumps to do a more extensive job. */
449 int flag_cse_follow_jumps
;
451 /* Nonzero for -fcse-skip-blocks:
452 have cse follow a branch around a block. */
453 int flag_cse_skip_blocks
;
455 /* Nonzero for -fexpensive-optimizations:
456 perform miscellaneous relatively-expensive optimizations. */
457 int flag_expensive_optimizations
;
459 /* Nonzero for -fthread-jumps:
460 have jump optimize output of loop. */
462 int flag_thread_jumps
;
464 /* Nonzero enables strength-reduction in loop.c. */
466 int flag_strength_reduce
= 0;
468 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
469 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
470 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
473 int flag_unroll_loops
;
475 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
476 This is generally not a win. */
478 int flag_unroll_all_loops
;
480 /* Nonzero forces all invariant computations in loops to be moved
483 int flag_move_all_movables
= 0;
485 /* Nonzero forces all general induction variables in loops to be
488 int flag_reduce_all_givs
= 0;
490 /* Nonzero for -fwritable-strings:
491 store string constants in data segment and don't uniquize them. */
493 int flag_writable_strings
= 0;
495 /* Nonzero means don't put addresses of constant functions in registers.
496 Used for compiling the Unix kernel, where strange substitutions are
497 done on the assembly output. */
499 int flag_no_function_cse
= 0;
501 /* Nonzero for -fomit-frame-pointer:
502 don't make a frame pointer in simple functions that don't require one. */
504 int flag_omit_frame_pointer
= 0;
506 /* Nonzero means place each function into its own section on those platforms
507 which support arbitrary section names and unlimited numbers of sections. */
509 int flag_function_sections
= 0;
511 /* Nonzero to inhibit use of define_optimization peephole opts. */
513 int flag_no_peephole
= 0;
515 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
516 operations in the interest of optimization. For example it allows
517 GCC to assume arguments to sqrt are nonnegative numbers, allowing
518 faster code for sqrt to be generated. */
520 int flag_fast_math
= 0;
522 /* Nonzero means all references through pointers are volatile. */
526 /* Nonzero means treat all global and extern variables as global. */
528 int flag_volatile_global
;
530 /* Nonzero means just do syntax checking; don't output anything. */
532 int flag_syntax_only
= 0;
534 /* Nonzero means to rerun cse after loop optimization. This increases
535 compilation time about 20% and picks up a few more common expressions. */
537 static int flag_rerun_cse_after_loop
;
539 /* Nonzero means to run loop optimizations twice. */
541 int flag_rerun_loop_opt
;
543 /* Nonzero for -finline-functions: ok to inline functions that look like
544 good inline candidates. */
546 int flag_inline_functions
;
548 /* Nonzero for -fkeep-inline-functions: even if we make a function
549 go inline everywhere, keep its definition around for debugging
552 int flag_keep_inline_functions
;
554 /* Nonzero means that functions will not be inlined. */
558 /* Nonzero means that we should emit static const variables
559 regardless of whether or not optimization is turned on. */
561 int flag_keep_static_consts
= 1;
563 /* Nonzero means we should be saving declaration info into a .X file. */
565 int flag_gen_aux_info
= 0;
567 /* Specified name of aux-info file. */
569 static char *aux_info_file_name
;
571 /* Nonzero means make the text shared if supported. */
573 int flag_shared_data
;
575 /* Nonzero means schedule into delayed branch slots if supported. */
577 int flag_delayed_branch
;
579 /* Nonzero if we are compiling pure (sharable) code.
580 Value is 1 if we are doing reasonable (i.e. simple
581 offset into offset table) pic. Value is 2 if we can
582 only perform register offsets. */
586 /* Nonzero means generate extra code for exception handling and enable
587 exception handling. */
589 int flag_exceptions
= 2;
591 /* Nonzero means don't place uninitialized global data in common storage
596 /* Nonzero means pretend it is OK to examine bits of target floats,
597 even if that isn't true. The resulting code will have incorrect constants,
598 but the same series of instructions that the native compiler would make. */
600 int flag_pretend_float
;
602 /* Nonzero means change certain warnings into errors.
603 Usually these are warnings about failure to conform to some standard. */
605 int flag_pedantic_errors
= 0;
607 /* flag_schedule_insns means schedule insns within basic blocks (before
609 flag_schedule_insns_after_reload means schedule insns after
612 int flag_schedule_insns
= 0;
613 int flag_schedule_insns_after_reload
= 0;
616 /* The following flags have effect only for scheduling before register
619 flag_schedule_interblock means schedule insns accross basic blocks.
620 flag_schedule_speculative means allow speculative motion of non-load insns.
621 flag_schedule_speculative_load means allow speculative motion of some
623 flag_schedule_speculative_load_dangerous allows speculative motion of more
626 int flag_schedule_interblock
= 1;
627 int flag_schedule_speculative
= 1;
628 int flag_schedule_speculative_load
= 0;
629 int flag_schedule_speculative_load_dangerous
= 0;
631 /* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple
632 by a cheaper branch, on a count register. */
633 int flag_branch_on_count_reg
;
637 /* -finhibit-size-directive inhibits output of .size for ELF.
638 This is used only for compiling crtstuff.c,
639 and it may be extended to other effects
640 needed for crtstuff.c on other systems. */
641 int flag_inhibit_size_directive
= 0;
643 /* -fverbose-asm causes extra commentary information to be produced in
644 the generated assembly code (to make it more readable). This option
645 is generally only of use to those who actually need to read the
646 generated assembly code (perhaps while debugging the compiler itself).
647 -fno-verbose-asm, the default, causes the extra information
648 to be omitted and is useful when comparing two assembler files. */
650 int flag_verbose_asm
= 0;
652 /* -dA causes debug commentary information to be produced in
653 the generated assembly code (to make it more readable). This option
654 is generally only of use to those who actually need to read the
655 generated assembly code (perhaps while debugging the compiler itself).
656 Currently, this switch is only used by dwarfout.c; however, it is intended
657 to be a catchall for printing debug information in the assembler file. */
659 int flag_debug_asm
= 0;
661 /* -fgnu-linker specifies use of the GNU linker for initializations.
662 (Or, more generally, a linker that handles initializations.)
663 -fno-gnu-linker says that collect2 will be used. */
665 int flag_gnu_linker
= 0;
667 int flag_gnu_linker
= 1;
670 /* Tag all structures with __attribute__(packed) */
671 int flag_pack_struct
= 0;
673 /* Emit code to check for stack overflow; also may cause large objects
674 to be allocated dynamically. */
675 int flag_stack_check
;
677 /* -fcheck-memory-usage causes extra code to be generated in order to check
678 memory accesses. This is used by a detector of bad memory accesses such
680 int flag_check_memory_usage
= 0;
682 /* -fprefix-function-name causes function name to be prefixed. This
683 can be used with -fcheck-memory-usage to isolate code compiled with
684 -fcheck-memory-usage. */
685 int flag_prefix_function_name
= 0;
687 int flag_regmove
= 0;
689 /* 0 if pointer arguments may alias each other. True in C.
690 1 if pointer arguments may not alias each other but may alias
692 2 if pointer arguments may not alias each other and may not
693 alias global variables. True in Fortran.
694 This defaults to 0 for C. */
695 int flag_argument_noalias
= 0;
697 /* Table of language-independent -f options.
698 STRING is the option name. VARIABLE is the address of the variable.
699 ON_VALUE is the value to store in VARIABLE
700 if `-fSTRING' is seen as an option.
701 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
703 struct { char *string
; int *variable
; int on_value
;} f_options
[] =
705 {"float-store", &flag_float_store
, 1},
706 {"volatile", &flag_volatile
, 1},
707 {"volatile-global", &flag_volatile_global
, 1},
708 {"defer-pop", &flag_defer_pop
, 1},
709 {"omit-frame-pointer", &flag_omit_frame_pointer
, 1},
710 {"cse-follow-jumps", &flag_cse_follow_jumps
, 1},
711 {"cse-skip-blocks", &flag_cse_skip_blocks
, 1},
712 {"expensive-optimizations", &flag_expensive_optimizations
, 1},
713 {"thread-jumps", &flag_thread_jumps
, 1},
714 {"strength-reduce", &flag_strength_reduce
, 1},
715 {"unroll-loops", &flag_unroll_loops
, 1},
716 {"unroll-all-loops", &flag_unroll_all_loops
, 1},
717 {"move-all-movables", &flag_move_all_movables
, 1},
718 {"reduce-all-givs", &flag_reduce_all_givs
, 1},
719 {"writable-strings", &flag_writable_strings
, 1},
720 {"peephole", &flag_no_peephole
, 0},
721 {"force-mem", &flag_force_mem
, 1},
722 {"force-addr", &flag_force_addr
, 1},
723 {"function-cse", &flag_no_function_cse
, 0},
724 {"inline-functions", &flag_inline_functions
, 1},
725 {"keep-inline-functions", &flag_keep_inline_functions
, 1},
726 {"inline", &flag_no_inline
, 0},
727 {"keep-static-consts", &flag_keep_static_consts
, 1},
728 {"syntax-only", &flag_syntax_only
, 1},
729 {"shared-data", &flag_shared_data
, 1},
730 {"caller-saves", &flag_caller_saves
, 1},
731 {"pcc-struct-return", &flag_pcc_struct_return
, 1},
732 {"reg-struct-return", &flag_pcc_struct_return
, 0},
733 {"delayed-branch", &flag_delayed_branch
, 1},
734 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop
, 1},
735 {"rerun-loop-opt", &flag_rerun_loop_opt
, 1},
736 {"pretend-float", &flag_pretend_float
, 1},
737 {"schedule-insns", &flag_schedule_insns
, 1},
738 {"schedule-insns2", &flag_schedule_insns_after_reload
, 1},
740 {"sched-interblock",&flag_schedule_interblock
, 1},
741 {"sched-spec",&flag_schedule_speculative
, 1},
742 {"sched-spec-load",&flag_schedule_speculative_load
, 1},
743 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous
, 1},
744 {"branch-count-reg",&flag_branch_on_count_reg
, 1},
746 {"pic", &flag_pic
, 1},
747 {"PIC", &flag_pic
, 2},
748 {"exceptions", &flag_exceptions
, 1},
749 {"sjlj-exceptions", &exceptions_via_longjmp
, 1},
750 {"asynchronous-exceptions", &asynchronous_exceptions
, 1},
751 {"profile-arcs", &profile_arc_flag
, 1},
752 {"test-coverage", &flag_test_coverage
, 1},
753 {"branch-probabilities", &flag_branch_probabilities
, 1},
754 {"fast-math", &flag_fast_math
, 1},
755 {"common", &flag_no_common
, 0},
756 {"inhibit-size-directive", &flag_inhibit_size_directive
, 1},
757 {"function-sections", &flag_function_sections
, 1},
758 {"verbose-asm", &flag_verbose_asm
, 1},
759 {"gnu-linker", &flag_gnu_linker
, 1},
760 {"regmove", &flag_regmove
, 1},
761 {"pack-struct", &flag_pack_struct
, 1},
762 {"stack-check", &flag_stack_check
, 1},
763 {"argument-alias", &flag_argument_noalias
, 0},
764 {"argument-noalias", &flag_argument_noalias
, 1},
765 {"argument-noalias-global", &flag_argument_noalias
, 2},
766 {"check-memory-usage", &flag_check_memory_usage
, 1},
767 {"prefix-function-name", &flag_prefix_function_name
, 1}
770 /* Table of language-specific options. */
772 char *lang_options
[] =
775 "-fallow-single-precision",
777 "-fsigned-bitfields",
778 "-funsigned-bitfields",
779 "-fno-signed-bitfields",
780 "-fno-unsigned-bitfields",
784 "-fno-unsigned-char",
800 "-fno-cond-mismatch",
801 "-fdollars-in-identifiers",
802 "-fno-dollars-in-identifiers",
811 "-Wbad-function-cast",
812 "-Wno-bad-function-cast",
816 "-Wno-char-subscripts",
827 "-Wimplicit-function-declaration",
828 "-Wno-implicit-function-declaration",
829 "-Werror-implicit-function-declaration",
837 "-Wno-missing-braces",
838 "-Wmissing-declarations",
839 "-Wno-missing-declarations",
840 "-Wmissing-prototypes",
841 "-Wno-missing-prototypes",
843 "-Wno-nested-externs",
847 "-Wno-pointer-arith",
849 "-Wno-redundant-decls",
853 "-Wno-unknown-pragmas",
854 "-Wstrict-prototypes",
855 "-Wno-strict-prototypes",
863 "-Wno-write-strings",
865 /* these are for obj c */
876 "-print-objc-runtime-info",
882 /* Options controlling warnings */
884 /* Don't print warning messages. -w. */
886 int inhibit_warnings
= 0;
888 /* Print various extra warnings. -W. */
890 int extra_warnings
= 0;
892 /* Treat warnings as errors. -Werror. */
894 int warnings_are_errors
= 0;
896 /* Nonzero to warn about unused local variables. */
900 /* Nonzero to warn about variables used before they are initialized. */
902 int warn_uninitialized
;
904 /* Nonzero means warn about all declarations which shadow others. */
908 /* Warn if a switch on an enum fails to have a case for every enum value. */
912 /* Nonzero means warn about function definitions that default the return type
913 or that use a null return and have a return-type other than void. */
915 int warn_return_type
;
917 /* Nonzero means warn about pointer casts that increase the required
918 alignment of the target type (and might therefore lead to a crash
919 due to a misaligned access). */
923 /* Nonzero means warn about any identifiers that match in the first N
924 characters. The value N is in `id_clash_len'. */
927 unsigned id_clash_len
;
929 /* Nonzero means warn about any objects definitions whose size is larger
930 than N bytes. Also want about function definitions whose returned
931 values are larger than N bytes. The value N is in `larger_than_size'. */
933 int warn_larger_than
;
934 unsigned larger_than_size
;
936 /* Nonzero means warn if inline function is too large. */
940 /* Warn if a function returns an aggregate,
941 since there are often incompatible calling conventions for doing this. */
943 int warn_aggregate_return
;
945 /* Likewise for -W. */
947 struct { char *string
; int *variable
; int on_value
;} W_options
[] =
949 {"unused", &warn_unused
, 1},
950 {"error", &warnings_are_errors
, 1},
951 {"shadow", &warn_shadow
, 1},
952 {"switch", &warn_switch
, 1},
953 {"aggregate-return", &warn_aggregate_return
, 1},
954 {"cast-align", &warn_cast_align
, 1},
955 {"uninitialized", &warn_uninitialized
, 1},
956 {"inline", &warn_inline
, 1}
959 /* Output files for assembler code (real compiler output)
960 and debugging dumps. */
964 FILE *rtl_dump_file
= NULL
;
966 /* Time accumulators, to count the total time spent in various passes. */
970 int integration_time
;
975 int branch_prob_time
;
980 int local_alloc_time
;
981 int global_alloc_time
;
986 int shorten_branch_time
;
992 /* Return time used so far, in microseconds. */
1002 #else /* not BeOS */
1003 #if defined (_WIN32) && !defined (__CYGWIN32__)
1007 return (clock() * 1000);
1008 #else /* not _WIN32 */
1014 tick
= 1000000 / sysconf(_SC_CLK_TCK
);
1016 return (tms
.tms_utime
+ tms
.tms_stime
) * tick
;
1022 # if HAVE_SYSCONF && defined _SC_CLK_TCK
1023 # define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */
1026 # define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */
1028 # define TICKS_PER_SECOND HZ /* traditional UNIX */
1032 return (tms
.tms_utime
+ tms
.tms_stime
) * (1000000 / TICKS_PER_SECOND
);
1037 struct rusage rusage
;
1038 getrusage (0, &rusage
);
1039 return (rusage
.ru_utime
.tv_sec
* 1000000 + rusage
.ru_utime
.tv_usec
1040 + rusage
.ru_stime
.tv_sec
* 1000000 + rusage
.ru_stime
.tv_usec
);
1047 int proc_system_time
;
1048 int child_user_time
;
1049 int child_system_time
;
1051 times ((void *) &vms_times
);
1052 return (vms_times
.proc_user_time
+ vms_times
.proc_system_time
) * 10000;
1056 #endif /* _SC_CLK_TCK */
1058 #endif /* __BEOS__ */
1061 #define TIMEVAR(VAR, BODY) \
1062 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
1065 print_time (str
, total
)
1070 "time in %s: %d.%06d\n",
1071 str
, total
/ 1000000, total
% 1000000);
1074 /* Count an error or warning. Return 1 if the message should be printed. */
1077 count_error (warningp
)
1080 if (warningp
&& inhibit_warnings
)
1083 if (warningp
&& !warnings_are_errors
)
1087 static int warning_message
= 0;
1089 if (warningp
&& !warning_message
)
1091 fprintf (stderr
, "%s: warnings being treated as errors\n", progname
);
1092 warning_message
= 1;
1100 /* Print a fatal error message. NAME is the text.
1101 Also include a system error message based on `errno'. */
1104 pfatal_with_name (name
)
1107 fprintf (stderr
, "%s: ", progname
);
1109 exit (FATAL_EXIT_CODE
);
1113 fatal_io_error (name
)
1116 fprintf (stderr
, "%s: %s: I/O error\n", progname
, name
);
1117 exit (FATAL_EXIT_CODE
);
1120 /* Called to give a better error message for a bad insn rather than
1121 just calling abort(). */
1124 fatal_insn (message
, insn
)
1131 fflush (asm_out_file
);
1133 fflush (aux_info_file
);
1134 if (rtl_dump_file
!= NULL
)
1135 fflush (rtl_dump_file
);
1141 /* Called to give a better error message when we don't have an insn to match
1142 what we are looking for or if the insn's constraints aren't satisfied,
1143 rather than just calling abort(). */
1146 fatal_insn_not_found (insn
)
1149 if (INSN_CODE (insn
) < 0)
1150 fatal_insn ("internal error--unrecognizable insn:", insn
);
1152 fatal_insn ("internal error--insn does not satisfy its constraints:", insn
);
1155 /* This is the default decl_printable_name function. */
1158 decl_name (decl
, verbosity
)
1162 return IDENTIFIER_POINTER (DECL_NAME (decl
));
1165 static int need_error_newline
;
1167 /* Function of last error message;
1168 more generally, function such that if next error message is in it
1169 then we don't have to mention the function name. */
1170 static tree last_error_function
= NULL
;
1172 /* Used to detect when input_file_stack has changed since last described. */
1173 static int last_error_tick
;
1175 /* Called when the start of a function definition is parsed,
1176 this function prints on stderr the name of the function. */
1179 announce_function (decl
)
1184 if (rtl_dump_and_exit
)
1185 fprintf (stderr
, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl
)));
1187 fprintf (stderr
, " %s", (*decl_printable_name
) (decl
, 2));
1189 need_error_newline
= 1;
1190 last_error_function
= current_function_decl
;
1194 /* The default function to print out name of current function that caused
1198 default_print_error_function (file
)
1201 if (last_error_function
!= current_function_decl
)
1203 char *kind
= "function";
1204 if (current_function_decl
!= 0
1205 && TREE_CODE (TREE_TYPE (current_function_decl
)) == METHOD_TYPE
)
1209 fprintf (stderr
, "%s: ", file
);
1211 if (current_function_decl
== NULL
)
1212 fprintf (stderr
, "At top level:\n");
1215 char *name
= (*decl_printable_name
) (current_function_decl
, 2);
1216 fprintf (stderr
, "In %s `%s':\n", kind
, name
);
1219 last_error_function
= current_function_decl
;
1223 /* Called by report_error_function to print out function name.
1224 * Default may be overridden by language front-ends. */
1226 void (*print_error_function
) PROTO((char *)) = default_print_error_function
;
1228 /* Prints out, if necessary, the name of the current function
1229 that caused an error. Called from all error and warning functions. */
1232 report_error_function (file
)
1235 struct file_stack
*p
;
1237 if (need_error_newline
)
1239 fprintf (stderr
, "\n");
1240 need_error_newline
= 0;
1243 (*print_error_function
) (file
);
1245 if (input_file_stack
&& input_file_stack
->next
!= 0
1246 && input_file_stack_tick
!= last_error_tick
1247 && file
== input_filename
)
1249 fprintf (stderr
, "In file included");
1250 for (p
= input_file_stack
->next
; p
; p
= p
->next
)
1252 fprintf (stderr
, " from %s:%d", p
->name
, p
->line
);
1254 fprintf (stderr
, ",\n ");
1256 fprintf (stderr
, ":\n");
1257 last_error_tick
= input_file_stack_tick
;
1261 /* Print a message. */
1264 vmessage (prefix
, s
, ap
)
1270 fprintf (stderr
, "%s: ", prefix
);
1273 vfprintf (stderr
, s
, ap
);
1276 HOST_WIDE_INT v1
= va_arg(ap
, HOST_WIDE_INT
);
1277 HOST_WIDE_INT v2
= va_arg(ap
, HOST_WIDE_INT
);
1278 HOST_WIDE_INT v3
= va_arg(ap
, HOST_WIDE_INT
);
1279 HOST_WIDE_INT v4
= va_arg(ap
, HOST_WIDE_INT
);
1280 fprintf (stderr
, s
, v1
, v2
, v3
, v4
);
1285 /* Print a message relevant to line LINE of file FILE. */
1288 v_message_with_file_and_line (file
, line
, prefix
, s
, ap
)
1296 fprintf (stderr
, "%s:%d: ", file
, line
);
1298 fprintf (stderr
, "%s: ", progname
);
1300 vmessage (prefix
, s
, ap
);
1301 fputc ('\n', stderr
);
1304 /* Print a message relevant to the given DECL. */
1307 v_message_with_decl (decl
, prefix
, s
, ap
)
1315 fprintf (stderr
, "%s:%d: ",
1316 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
1319 fprintf (stderr
, "%s: ", prefix
);
1321 /* Do magic to get around lack of varargs support for insertion
1322 of arguments into existing list. We know that the decl is first;
1323 we ass_u_me that it will be printed with "%s". */
1325 for (p
= s
; *p
; ++p
)
1329 if (*(p
+ 1) == '%')
1336 if (p
> s
) /* Print the left-hand substring. */
1338 char fmt
[sizeof "%.255s"];
1341 if (width
> 255L) width
= 255L; /* arbitrary */
1342 sprintf (fmt
, "%%.%lds", width
);
1343 fprintf (stderr
, fmt
, s
);
1346 if (*p
== '%') /* Print the name. */
1348 char *n
= (DECL_NAME (decl
)
1349 ? (*decl_printable_name
) (decl
, 2)
1355 if (isalpha (*(p
- 1) & 0xFF))
1360 if (*p
) /* Print the rest of the message. */
1361 vmessage ((char *)NULL
, p
, ap
);
1363 fputc ('\n', stderr
);
1366 /* Figure file and line of the given INSN. */
1369 file_and_line_for_asm (insn
, pfile
, pline
)
1374 rtx body
= PATTERN (insn
);
1377 /* Find the (or one of the) ASM_OPERANDS in the insn. */
1378 if (GET_CODE (body
) == SET
&& GET_CODE (SET_SRC (body
)) == ASM_OPERANDS
)
1379 asmop
= SET_SRC (body
);
1380 else if (GET_CODE (body
) == ASM_OPERANDS
)
1382 else if (GET_CODE (body
) == PARALLEL
1383 && GET_CODE (XVECEXP (body
, 0, 0)) == SET
)
1384 asmop
= SET_SRC (XVECEXP (body
, 0, 0));
1385 else if (GET_CODE (body
) == PARALLEL
1386 && GET_CODE (XVECEXP (body
, 0, 0)) == ASM_OPERANDS
)
1387 asmop
= XVECEXP (body
, 0, 0);
1393 *pfile
= ASM_OPERANDS_SOURCE_FILE (asmop
);
1394 *pline
= ASM_OPERANDS_SOURCE_LINE (asmop
);
1398 *pfile
= input_filename
;
1403 /* Report an error at line LINE of file FILE. */
1406 v_error_with_file_and_line (file
, line
, s
, ap
)
1413 report_error_function (file
);
1414 v_message_with_file_and_line (file
, line
, (char *)NULL
, s
, ap
);
1418 error_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1430 file
= va_arg (ap
, char *);
1431 line
= va_arg (ap
, int);
1432 s
= va_arg (ap
, char *);
1435 v_error_with_file_and_line (file
, line
, s
, ap
);
1439 /* Report an error at the declaration DECL.
1440 S is a format string which uses %s to substitute the declaration
1441 name; subsequent substitutions are a la printf. */
1444 v_error_with_decl (decl
, s
, ap
)
1450 report_error_function (DECL_SOURCE_FILE (decl
));
1451 v_message_with_decl (decl
, (char *)NULL
, s
, ap
);
1455 error_with_decl
VPROTO((tree decl
, char *s
, ...))
1466 decl
= va_arg (ap
, tree
);
1467 s
= va_arg (ap
, char *);
1470 v_error_with_decl (decl
, s
, ap
);
1474 /* Report an error at the line number of the insn INSN.
1475 This is used only when INSN is an `asm' with operands,
1476 and each ASM_OPERANDS records its own source file and line. */
1479 v_error_for_asm (insn
, s
, ap
)
1488 file_and_line_for_asm (insn
, &file
, &line
);
1489 report_error_function (file
);
1490 v_message_with_file_and_line (file
, line
, (char *)NULL
, s
, ap
);
1494 error_for_asm
VPROTO((rtx insn
, char *s
, ...))
1505 insn
= va_arg (ap
, rtx
);
1506 s
= va_arg (ap
, char *);
1509 v_error_for_asm (insn
, s
, ap
);
1513 /* Report an error at the current line number. */
1520 v_error_with_file_and_line (input_filename
, lineno
, s
, ap
);
1524 error
VPROTO((char *s
, ...))
1534 s
= va_arg (ap
, char *);
1541 /* Report a fatal error at the current line number. */
1549 exit (FATAL_EXIT_CODE
);
1553 fatal
VPROTO((char *s
, ...))
1563 s
= va_arg (ap
, char *);
1570 /* Report a warning at line LINE of file FILE. */
1573 v_warning_with_file_and_line (file
, line
, s
, ap
)
1579 if (count_error (1))
1581 report_error_function (file
);
1582 v_message_with_file_and_line (file
, line
, "warning", s
, ap
);
1587 warning_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1599 file
= va_arg (ap
, char *);
1600 line
= va_arg (ap
, int);
1601 s
= va_arg (ap
, char *);
1604 v_warning_with_file_and_line (file
, line
, s
, ap
);
1608 /* Report a warning at the declaration DECL.
1609 S is a format string which uses %s to substitute the declaration
1610 name; subsequent substitutions are a la printf. */
1613 v_warning_with_decl (decl
, s
, ap
)
1618 if (count_error (1))
1620 report_error_function (DECL_SOURCE_FILE (decl
));
1621 v_message_with_decl (decl
, "warning", s
, ap
);
1626 warning_with_decl
VPROTO((tree decl
, char *s
, ...))
1637 decl
= va_arg (ap
, tree
);
1638 s
= va_arg (ap
, char *);
1641 v_warning_with_decl (decl
, s
, ap
);
1645 /* Report a warning at the line number of the insn INSN.
1646 This is used only when INSN is an `asm' with operands,
1647 and each ASM_OPERANDS records its own source file and line. */
1650 v_warning_for_asm (insn
, s
, ap
)
1655 if (count_error (1))
1660 file_and_line_for_asm (insn
, &file
, &line
);
1661 report_error_function (file
);
1662 v_message_with_file_and_line (file
, line
, "warning", s
, ap
);
1667 warning_for_asm
VPROTO((rtx insn
, char *s
, ...))
1678 insn
= va_arg (ap
, rtx
);
1679 s
= va_arg (ap
, char *);
1682 v_warning_for_asm (insn
, s
, ap
);
1686 /* Report a warning at the current line number. */
1693 v_warning_with_file_and_line (input_filename
, lineno
, s
, ap
);
1697 warning
VPROTO((char *s
, ...))
1707 s
= va_arg (ap
, char *);
1714 /* These functions issue either warnings or errors depending on
1715 -pedantic-errors. */
1722 if (flag_pedantic_errors
)
1729 pedwarn
VPROTO((char *s
, ...))
1739 s
= va_arg (ap
, char *);
1747 v_pedwarn_with_decl (decl
, s
, ap
)
1752 /* We don't want -pedantic-errors to cause the compilation to fail from
1753 "errors" in system header files. Sometimes fixincludes can't fix what's
1754 broken (eg: unsigned char bitfields - fixing it may change the alignment
1755 which will cause programs to mysteriously fail because the C library
1756 or kernel uses the original layout). There's no point in issuing a
1757 warning either, it's just unnecessary noise. */
1759 if (! DECL_IN_SYSTEM_HEADER (decl
))
1761 if (flag_pedantic_errors
)
1762 v_error_with_decl (decl
, s
, ap
);
1764 v_warning_with_decl (decl
, s
, ap
);
1769 pedwarn_with_decl
VPROTO((tree decl
, char *s
, ...))
1780 decl
= va_arg (ap
, tree
);
1781 s
= va_arg (ap
, char *);
1784 v_pedwarn_with_decl (decl
, s
, ap
);
1789 v_pedwarn_with_file_and_line (file
, line
, s
, ap
)
1795 if (flag_pedantic_errors
)
1796 v_error_with_file_and_line (file
, line
, s
, ap
);
1798 v_warning_with_file_and_line (file
, line
, s
, ap
);
1802 pedwarn_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1814 file
= va_arg (ap
, char *);
1815 line
= va_arg (ap
, int);
1816 s
= va_arg (ap
, char *);
1819 v_pedwarn_with_file_and_line (file
, line
, s
, ap
);
1823 /* Apologize for not implementing some feature. */
1832 fprintf (stderr
, "%s:%d: ", input_filename
, lineno
);
1834 fprintf (stderr
, "%s: ", progname
);
1835 vmessage ("sorry, not implemented", s
, ap
);
1836 fputc ('\n', stderr
);
1840 sorry
VPROTO((char *s
, ...))
1850 s
= va_arg (ap
, char *);
1857 /* Apologize for not implementing some feature, then quit. */
1860 v_really_sorry (s
, ap
)
1866 fprintf (stderr
, "%s:%d: ", input_filename
, lineno
);
1868 fprintf (stderr
, "%s: ", progname
);
1869 vmessage ("sorry, not implemented", s
, ap
);
1870 fatal (" (fatal)\n");
1874 really_sorry
VPROTO((char *s
, ...))
1884 s
= va_arg (ap
, char *);
1887 v_really_sorry (s
, ap
);
1891 /* More 'friendly' abort that prints the line and file.
1892 config.h can #define abort fancy_abort if you like that sort of thing.
1894 I don't think this is actually a good idea.
1895 Other sorts of crashes will look a certain way.
1896 It is a good thing if crashes from calling abort look the same way.
1902 fatal ("internal gcc abort");
1905 /* This calls abort and is used to avoid problems when abort if a macro.
1906 It is used when we need to pass the address of abort. */
1914 /* When `malloc.c' is compiled with `rcheck' defined,
1915 it calls this function to report clobberage. */
1924 /* Same as `malloc' but report error if no memory available. */
1930 register char *value
= (char *) malloc (size
);
1931 if (value
== 0 && size
!= 0)
1932 fatal ("virtual memory exhausted");
1936 /* Same as `realloc' but report error if no memory available.
1937 Also handle null PTR even if the vendor realloc gets it wrong. */
1940 xrealloc (ptr
, size
)
1945 ? (char *) realloc (ptr
, size
)
1946 : (char *) malloc (size
));
1948 fatal ("virtual memory exhausted");
1952 /* Same as `strdup' but report error if no memory available. */
1958 register char *result
= (char *) malloc (strlen (s
) + 1);
1961 fatal ("virtual memory exhausted");
1966 /* Return the logarithm of X, base 2, considering X unsigned,
1967 if X is a power of 2. Otherwise, returns -1.
1969 This should be used via the `exact_log2' macro. */
1973 register unsigned HOST_WIDE_INT x
;
1975 register int log
= 0;
1976 /* Test for 0 or a power of 2. */
1977 if (x
== 0 || x
!= (x
& -x
))
1979 while ((x
>>= 1) != 0)
1984 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1985 If X is 0, return -1.
1987 This should be used via the floor_log2 macro. */
1991 register unsigned HOST_WIDE_INT x
;
1993 register int log
= -1;
2000 static int float_handler_set
;
2002 jmp_buf float_handler
;
2004 /* Signals actually come here. */
2007 float_signal (signo
)
2008 /* If this is missing, some compilers complain. */
2011 if (float_handled
== 0)
2013 #if defined (USG) || defined (hpux)
2014 signal (SIGFPE
, float_signal
); /* re-enable the signal catcher */
2017 signal (SIGFPE
, float_signal
);
2018 longjmp (float_handler
, 1);
2021 /* Specify where to longjmp to when a floating arithmetic error happens.
2022 If HANDLER is 0, it means don't handle the errors any more. */
2025 set_float_handler (handler
)
2028 float_handled
= (handler
!= 0);
2030 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2032 if (float_handled
&& ! float_handler_set
)
2034 signal (SIGFPE
, float_signal
);
2035 float_handler_set
= 1;
2039 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
2040 error happens, pushing the previous specification into OLD_HANDLER.
2041 Return an indication of whether there was a previous handler in effect. */
2044 push_float_handler (handler
, old_handler
)
2045 jmp_buf handler
, old_handler
;
2047 int was_handled
= float_handled
;
2051 bcopy ((char *) float_handler
, (char *) old_handler
,
2052 sizeof (float_handler
));
2054 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2058 /* Restore the previous specification of whether and where to longjmp to
2059 when a floating arithmetic error happens. */
2062 pop_float_handler (handled
, handler
)
2066 float_handled
= handled
;
2068 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2071 /* Handler for SIGPIPE. */
2075 /* If this is missing, some compilers complain. */
2078 fatal ("output pipe has been closed");
2081 /* Strip off a legitimate source ending from the input string NAME of
2082 length LEN. Rather than having to know the names used by all of
2083 our front ends, we strip off an ending of a period followed by
2084 up to five characters. (Java uses ".class".) */
2087 strip_off_ending (name
, len
)
2092 for (i
= 2; i
< 6 && len
> i
; i
++)
2094 if (name
[len
- i
] == '.')
2096 name
[len
- i
] = '\0';
2102 /* Output a quoted string. */
2105 output_quoted_string (asm_file
, string
)
2109 #ifdef OUTPUT_QUOTED_STRING
2110 OUTPUT_QUOTED_STRING (asm_file
, string
);
2114 putc ('\"', asm_file
);
2115 while ((c
= *string
++) != 0)
2117 if (c
== '\"' || c
== '\\')
2118 putc ('\\', asm_file
);
2121 putc ('\"', asm_file
);
2125 /* Output a file name in the form wanted by System V. */
2128 output_file_directive (asm_file
, input_name
)
2132 int len
= strlen (input_name
);
2133 char *na
= input_name
+ len
;
2135 /* NA gets INPUT_NAME sans directory names. */
2136 while (na
> input_name
)
2143 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
2144 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file
, na
);
2146 #ifdef ASM_OUTPUT_SOURCE_FILENAME
2147 ASM_OUTPUT_SOURCE_FILENAME (asm_file
, na
);
2149 fprintf (asm_file
, "\t.file\t");
2150 output_quoted_string (asm_file
, na
);
2151 fputc ('\n', asm_file
);
2156 /* Routine to build language identifier for object file. */
2159 output_lang_identify (asm_out_file
)
2162 int len
= strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
2163 char *s
= (char *) alloca (len
);
2164 sprintf (s
, "__gnu_compiled_%s", lang_identify ());
2165 ASM_OUTPUT_LABEL (asm_out_file
, s
);
2168 /* Routine to open a dump file. */
2170 open_dump_file (suffix
, function_name
)
2172 char *function_name
;
2179 dumpname
= (char *) xmalloc (strlen (dump_base_name
) + strlen (suffix
) + 1);
2181 if (rtl_dump_file
!= NULL
)
2182 fclose (rtl_dump_file
);
2184 strcpy (dumpname
, dump_base_name
);
2185 strcat (dumpname
, suffix
);
2187 rtl_dump_file
= fopen (dumpname
, "a");
2189 if (rtl_dump_file
== NULL
)
2190 pfatal_with_name (dumpname
);
2195 fprintf (rtl_dump_file
, "\n;; Function %s\n\n", function_name
);
2201 /* Routine to close a dump file. */
2203 close_dump_file (func
, insns
)
2204 void (*func
) PROTO ((FILE *, rtx
));
2211 func (rtl_dump_file
, insns
);
2213 fflush (rtl_dump_file
);
2214 fclose (rtl_dump_file
);
2216 rtl_dump_file
= NULL
;
2222 /* Routine to dump rtl into a file. */
2224 dump_rtl (suffix
, decl
, func
, insns
)
2227 void (*func
) PROTO ((FILE *, rtx
));
2230 open_dump_file (suffix
, decl_printable_name (decl
, 2));
2231 close_dump_file (func
, insns
);
2234 /* Routine to empty a dump file. */
2236 clean_dump_file (suffix
)
2241 dumpname
= (char *) xmalloc (strlen (dump_base_name
) + strlen (suffix
) + 1);
2243 strcpy (dumpname
, dump_base_name
);
2244 strcat (dumpname
, suffix
);
2246 rtl_dump_file
= fopen (dumpname
, "w");
2248 if (rtl_dump_file
== NULL
)
2249 pfatal_with_name (dumpname
);
2253 fclose (rtl_dump_file
);
2254 rtl_dump_file
= NULL
;
2260 /* Compile an entire file of output from cpp, named NAME.
2261 Write a file of assembly output and various debugging dumps. */
2270 int name_specified
= name
!= 0;
2272 if (dump_base_name
== 0)
2273 dump_base_name
= name
? name
: "gccdump";
2277 integration_time
= 0;
2282 branch_prob_time
= 0;
2287 local_alloc_time
= 0;
2288 global_alloc_time
= 0;
2293 shorten_branch_time
= 0;
2299 /* Initialize data in various passes. */
2303 name
= init_parse (name
);
2305 init_emit_once (debug_info_level
== DINFO_LEVEL_NORMAL
2306 || debug_info_level
== DINFO_LEVEL_VERBOSE
2307 || flag_test_coverage
);
2309 init_decl_processing ();
2318 if (flag_caller_saves
)
2319 init_caller_save ();
2321 /* If auxiliary info generation is desired, open the output file.
2322 This goes in the same directory as the source file--unlike
2323 all the other output files. */
2324 if (flag_gen_aux_info
)
2326 aux_info_file
= fopen (aux_info_file_name
, "w");
2327 if (aux_info_file
== 0)
2328 pfatal_with_name (aux_info_file_name
);
2331 /* Clear the dump files file. */
2333 clean_dump_file (".rtl");
2335 clean_dump_file (".jump");
2337 clean_dump_file (".addressof");
2339 clean_dump_file (".cse");
2341 clean_dump_file (".loop");
2343 clean_dump_file (".cse2");
2344 if (branch_prob_dump
)
2345 clean_dump_file (".bp");
2347 clean_dump_file (".flow");
2349 clean_dump_file (".combine");
2351 clean_dump_file (".regmove");
2353 clean_dump_file (".sched");
2355 clean_dump_file (".lreg");
2356 if (global_reg_dump
)
2357 clean_dump_file (".greg");
2359 clean_dump_file (".sched2");
2361 clean_dump_file (".jump2");
2364 clean_dump_file (".dbr");
2368 clean_dump_file (".stack");
2370 #ifdef MACHINE_DEPENDENT_REORG
2371 if (mach_dep_reorg_dump
)
2372 clean_dump_file (".mach");
2375 /* Open assembler code output file. */
2377 if (! name_specified
&& asm_file_name
== 0)
2378 asm_out_file
= stdout
;
2381 int len
= strlen (dump_base_name
);
2382 register char *dumpname
= (char *) xmalloc (len
+ 6);
2383 strcpy (dumpname
, dump_base_name
);
2384 strip_off_ending (dumpname
, len
);
2385 strcat (dumpname
, ".s");
2386 if (asm_file_name
== 0)
2388 asm_file_name
= (char *) xmalloc (strlen (dumpname
) + 1);
2389 strcpy (asm_file_name
, dumpname
);
2391 if (!strcmp (asm_file_name
, "-"))
2392 asm_out_file
= stdout
;
2394 asm_out_file
= fopen (asm_file_name
, "w");
2395 if (asm_out_file
== 0)
2396 pfatal_with_name (asm_file_name
);
2399 #ifdef IO_BUFFER_SIZE
2400 setvbuf (asm_out_file
, (char *) xmalloc (IO_BUFFER_SIZE
),
2401 _IOFBF
, IO_BUFFER_SIZE
);
2404 input_filename
= name
;
2406 /* Put an entry on the input file stack for the main input file. */
2408 = (struct file_stack
*) xmalloc (sizeof (struct file_stack
));
2409 input_file_stack
->next
= 0;
2410 input_file_stack
->name
= input_filename
;
2412 /* Gross. Gross. lang_init is (I think) the first callback into
2413 the language front end, and is thus the first opportunity to
2414 have the selected language override the default value for any
2417 So the default value for flag_exceptions is 2 (uninitialized).
2418 If we encounter -fno-exceptions or -fexceptions, then flag_exceptions
2419 will be set to zero or one respectively.
2421 flag_exceptions can also be set by lang_init to something other
2422 than the default "uninitialized" value of 2.
2424 After lang_init, if the value is still 2, then we default to
2425 -fno-exceptions (value will be reset to zero).
2427 When our EH mechanism is low enough overhead that we can enable
2428 it by default for languages other than C++, then all this braindamage
2431 /* Perform language-specific initialization.
2432 This may set main_input_filename. */
2435 if (flag_exceptions
== 2)
2436 flag_exceptions
= 0;
2438 /* If the input doesn't start with a #line, use the input name
2439 as the official input file name. */
2440 if (main_input_filename
== 0)
2441 main_input_filename
= name
;
2443 ASM_FILE_START (asm_out_file
);
2445 #ifdef ASM_COMMENT_START
2446 if (flag_verbose_asm
)
2448 /* Print the list of options in effect. */
2449 print_version (asm_out_file
, ASM_COMMENT_START
);
2450 print_switch_values (asm_out_file
, 0, MAX_LINE
,
2451 ASM_COMMENT_START
, " ", "\n");
2452 /* Add a blank line here so it appears in assembler output but not
2454 fprintf (asm_out_file
, "\n");
2458 /* Output something to inform GDB that this compilation was by GCC. */
2459 #ifndef ASM_IDENTIFY_GCC
2460 fprintf (asm_out_file
, "gcc2_compiled.:\n");
2462 ASM_IDENTIFY_GCC (asm_out_file
);
2465 /* Output something to identify which front-end produced this file. */
2466 #ifdef ASM_IDENTIFY_LANGUAGE
2467 ASM_IDENTIFY_LANGUAGE (asm_out_file
);
2470 #ifndef ASM_OUTPUT_SECTION_NAME
2471 if (flag_function_sections
)
2473 warning ("-ffunction-sections not supported for this target.");
2474 flag_function_sections
= 0;
2478 if (flag_function_sections
2479 && (profile_flag
|| profile_block_flag
))
2481 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2482 flag_function_sections
= 0;
2485 if (flag_function_sections
&& write_symbols
!= NO_DEBUG
)
2486 warning ("-ffunction-sections may affect debugging on some targets.");
2488 /* ??? Note: There used to be a conditional here
2489 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2490 This was to guarantee separation between gcc_compiled. and
2491 the first function, for the sake of dbx on Suns.
2492 However, having the extra zero here confused the Emacs
2493 code for unexec, and might confuse other programs too.
2494 Therefore, I took out that change.
2495 In future versions we should find another way to solve
2496 that dbx problem. -- rms, 23 May 93. */
2498 /* Don't let the first function fall at the same address
2499 as gcc_compiled., if profiling. */
2500 if (profile_flag
|| profile_block_flag
)
2502 /* It's best if we can write a nop here since some
2503 assemblers don't tolerate zeros in the text section. */
2504 if (insn_template
[CODE_FOR_nop
] != 0)
2505 output_asm_insn (insn_template
[CODE_FOR_nop
], NULL_PTR
);
2507 assemble_zeros (UNITS_PER_WORD
);
2510 /* If dbx symbol table desired, initialize writing it
2511 and output the predefined types. */
2512 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2513 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2514 TIMEVAR (symout_time
, dbxout_init (asm_out_file
, main_input_filename
,
2517 #ifdef SDB_DEBUGGING_INFO
2518 if (write_symbols
== SDB_DEBUG
)
2519 TIMEVAR (symout_time
, sdbout_init (asm_out_file
, main_input_filename
,
2522 #ifdef DWARF_DEBUGGING_INFO
2523 if (write_symbols
== DWARF_DEBUG
)
2524 TIMEVAR (symout_time
, dwarfout_init (asm_out_file
, main_input_filename
));
2526 #ifdef DWARF2_UNWIND_INFO
2527 if (dwarf2out_do_frame ())
2528 dwarf2out_frame_init ();
2530 #ifdef DWARF2_DEBUGGING_INFO
2531 if (write_symbols
== DWARF2_DEBUG
)
2532 TIMEVAR (symout_time
, dwarf2out_init (asm_out_file
, main_input_filename
));
2535 /* Initialize yet another pass. */
2537 init_final (main_input_filename
);
2538 init_branch_prob (dump_base_name
);
2540 start_time
= get_run_time ();
2542 /* Call the parser, which parses the entire file
2543 (calling rest_of_compilation for each function). */
2545 if (yyparse () != 0)
2547 if (errorcount
== 0)
2548 fprintf (stderr
, "Errors detected in input file (your bison.simple is out of date)");
2550 /* In case there were missing closebraces,
2551 get us back to the global binding level. */
2552 while (! global_bindings_p ())
2556 output_func_start_profiler ();
2558 /* Compilation is now finished except for writing
2559 what's left of the symbol table output. */
2561 parse_time
+= get_run_time () - start_time
;
2563 parse_time
-= integration_time
;
2564 parse_time
-= varconst_time
;
2566 globals
= getdecls ();
2568 /* Really define vars that have had only a tentative definition.
2569 Really output inline functions that must actually be callable
2570 and have not been output so far. */
2573 int len
= list_length (globals
);
2574 tree
*vec
= (tree
*) alloca (sizeof (tree
) * len
);
2579 /* Process the decls in reverse order--earliest first.
2580 Put them into VEC from back to front, then take out from front. */
2582 for (i
= 0, decl
= globals
; i
< len
; i
++, decl
= TREE_CHAIN (decl
))
2583 vec
[len
- i
- 1] = decl
;
2585 for (i
= 0; i
< len
; i
++)
2589 /* We're not deferring this any longer. */
2590 DECL_DEFER_OUTPUT (decl
) = 0;
2592 if (TREE_CODE (decl
) == VAR_DECL
&& DECL_SIZE (decl
) == 0
2593 && incomplete_decl_finalize_hook
!= 0)
2594 (*incomplete_decl_finalize_hook
) (decl
);
2597 /* Now emit any global variables or functions that we have been putting
2598 off. We need to loop in case one of the things emitted here
2599 references another one which comes earlier in the list. */
2603 for (i
= 0; i
< len
; i
++)
2607 if (TREE_ASM_WRITTEN (decl
) || DECL_EXTERNAL (decl
))
2610 /* Don't write out static consts, unless we still need them.
2612 We also keep static consts if not optimizing (for debugging),
2613 unless the user specified -fno-keep-static-consts.
2614 ??? They might be better written into the debug information.
2615 This is possible when using DWARF.
2617 A language processor that wants static constants to be always
2618 written out (even if it is not used) is responsible for
2619 calling rest_of_decl_compilation itself. E.g. the C front-end
2620 calls rest_of_decl_compilation from finish_decl.
2621 One motivation for this is that is conventional in some
2622 environments to write things like:
2623 static const char rcsid[] = "... version string ...";
2624 intending to force the string to be in the executable.
2626 A language processor that would prefer to have unneeded
2627 static constants "optimized away" would just defer writing
2628 them out until here. E.g. C++ does this, because static
2629 constants are often defined in header files.
2631 ??? A tempting alternative (for both C and C++) would be
2632 to force a constant to be written if and only if it is
2633 defined in a main file, as opposed to an include file. */
2635 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
2636 && (! TREE_READONLY (decl
)
2637 || TREE_PUBLIC (decl
)
2638 || (!optimize
&& flag_keep_static_consts
)
2639 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
2642 rest_of_decl_compilation (decl
, NULL_PTR
, 1, 1);
2645 if (TREE_CODE (decl
) == FUNCTION_DECL
2646 && DECL_INITIAL (decl
) != 0
2647 && DECL_SAVED_INSNS (decl
) != 0
2648 && (flag_keep_inline_functions
2649 || TREE_PUBLIC (decl
)
2650 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
2653 temporary_allocation ();
2654 output_inline_function (decl
);
2655 permanent_allocation (1);
2660 /* Now that all possible functions have been output, we can dump
2661 the exception table. */
2663 output_exception_table ();
2665 for (i
= 0; i
< len
; i
++)
2669 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
2670 && ! TREE_ASM_WRITTEN (decl
))
2671 /* Cancel the RTL for this decl so that, if debugging info
2672 output for global variables is still to come,
2673 this one will be omitted. */
2674 DECL_RTL (decl
) = NULL
;
2676 /* Warn about any function
2677 declared static but not defined.
2678 We don't warn about variables,
2679 because many programs have static variables
2680 that exist only to get some text into the object file. */
2681 if (TREE_CODE (decl
) == FUNCTION_DECL
2683 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
)))
2684 && DECL_INITIAL (decl
) == 0
2685 && DECL_EXTERNAL (decl
)
2686 && ! DECL_ARTIFICIAL (decl
)
2687 && ! TREE_PUBLIC (decl
))
2689 pedwarn_with_decl (decl
,
2690 "`%s' declared `static' but never defined");
2691 /* This symbol is effectively an "extern" declaration now. */
2692 TREE_PUBLIC (decl
) = 1;
2693 assemble_external (decl
);
2696 /* Warn about static fns or vars defined but not used,
2697 but not about inline functions or static consts
2698 since defining those in header files is normal practice. */
2700 && ((TREE_CODE (decl
) == FUNCTION_DECL
&& ! DECL_INLINE (decl
))
2701 || (TREE_CODE (decl
) == VAR_DECL
&& ! TREE_READONLY (decl
)))
2702 && ! DECL_IN_SYSTEM_HEADER (decl
)
2703 && ! DECL_EXTERNAL (decl
)
2704 && ! TREE_PUBLIC (decl
)
2705 && ! TREE_USED (decl
)
2706 && (TREE_CODE (decl
) == FUNCTION_DECL
|| ! DECL_REGISTER (decl
))
2707 /* The TREE_USED bit for file-scope decls
2708 is kept in the identifier, to handle multiple
2709 external decls in different scopes. */
2710 && ! TREE_USED (DECL_NAME (decl
)))
2711 warning_with_decl (decl
, "`%s' defined but not used");
2713 #ifdef SDB_DEBUGGING_INFO
2714 /* The COFF linker can move initialized global vars to the end.
2715 And that can screw up the symbol ordering.
2716 By putting the symbols in that order to begin with,
2717 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
2718 if (write_symbols
== SDB_DEBUG
&& TREE_CODE (decl
) == VAR_DECL
2719 && TREE_PUBLIC (decl
) && DECL_INITIAL (decl
)
2720 && ! DECL_EXTERNAL (decl
)
2721 && DECL_RTL (decl
) != 0)
2722 TIMEVAR (symout_time
, sdbout_symbol (decl
, 0));
2724 /* Output COFF information for non-global
2725 file-scope initialized variables. */
2726 if (write_symbols
== SDB_DEBUG
2727 && TREE_CODE (decl
) == VAR_DECL
2728 && DECL_INITIAL (decl
)
2729 && ! DECL_EXTERNAL (decl
)
2730 && DECL_RTL (decl
) != 0
2731 && GET_CODE (DECL_RTL (decl
)) == MEM
)
2732 TIMEVAR (symout_time
, sdbout_toplevel_data (decl
));
2733 #endif /* SDB_DEBUGGING_INFO */
2734 #ifdef DWARF_DEBUGGING_INFO
2735 /* Output DWARF information for file-scope tentative data object
2736 declarations, file-scope (extern) function declarations (which
2737 had no corresponding body) and file-scope tagged type declarations
2738 and definitions which have not yet been forced out. */
2740 if (write_symbols
== DWARF_DEBUG
2741 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
2742 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 1));
2744 #ifdef DWARF2_DEBUGGING_INFO
2745 /* Output DWARF2 information for file-scope tentative data object
2746 declarations, file-scope (extern) function declarations (which
2747 had no corresponding body) and file-scope tagged type declarations
2748 and definitions which have not yet been forced out. */
2750 if (write_symbols
== DWARF2_DEBUG
2751 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
2752 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
2757 /* Write out any pending weak symbol declarations. */
2761 /* Do dbx symbols */
2762 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2763 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2764 TIMEVAR (symout_time
,
2766 dbxout_finish (asm_out_file
, main_input_filename
);
2770 #ifdef DWARF_DEBUGGING_INFO
2771 if (write_symbols
== DWARF_DEBUG
)
2772 TIMEVAR (symout_time
,
2778 #ifdef DWARF2_UNWIND_INFO
2779 if (dwarf2out_do_frame ())
2780 dwarf2out_frame_finish ();
2783 #ifdef DWARF2_DEBUGGING_INFO
2784 if (write_symbols
== DWARF2_DEBUG
)
2785 TIMEVAR (symout_time
,
2787 dwarf2out_finish ();
2791 /* Output some stuff at end of file if nec. */
2793 end_final (dump_base_name
);
2795 if (branch_prob_dump
)
2796 open_dump_file (".bp", NULL
);
2798 TIMEVAR (dump_time
, end_branch_prob (rtl_dump_file
));
2800 if (branch_prob_dump
)
2801 close_dump_file (NULL
, NULL_RTX
);
2804 ASM_FILE_END (asm_out_file
);
2807 /* Language-specific end of compilation actions. */
2811 /* Close the dump files. */
2813 if (flag_gen_aux_info
)
2815 fclose (aux_info_file
);
2817 unlink (aux_info_file_name
);
2822 open_dump_file (".combine", NULL
);
2823 TIMEVAR (dump_time
, dump_combine_total_stats (rtl_dump_file
));
2824 close_dump_file (NULL
, NULL_RTX
);
2827 /* Close non-debugging input and output files. Take special care to note
2828 whether fclose returns an error, since the pages might still be on the
2829 buffer chain while the file is open. */
2833 if (ferror (asm_out_file
) != 0 || fclose (asm_out_file
) != 0)
2834 fatal_io_error (asm_file_name
);
2836 /* Print the times. */
2840 fprintf (stderr
,"\n");
2841 print_time ("parse", parse_time
);
2843 print_time ("integration", integration_time
);
2844 print_time ("jump", jump_time
);
2845 print_time ("cse", cse_time
);
2846 print_time ("loop", loop_time
);
2847 print_time ("cse2", cse2_time
);
2848 print_time ("branch-prob", branch_prob_time
);
2849 print_time ("flow", flow_time
);
2850 print_time ("combine", combine_time
);
2851 print_time ("regmove", regmove_time
);
2852 print_time ("sched", sched_time
);
2853 print_time ("local-alloc", local_alloc_time
);
2854 print_time ("global-alloc", global_alloc_time
);
2855 print_time ("sched2", sched2_time
);
2857 print_time ("dbranch", dbr_sched_time
);
2859 print_time ("shorten-branch", shorten_branch_time
);
2860 print_time ("stack-reg", stack_reg_time
);
2861 print_time ("final", final_time
);
2862 print_time ("varconst", varconst_time
);
2863 print_time ("symout", symout_time
);
2864 print_time ("dump", dump_time
);
2868 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2869 and TYPE_DECL nodes.
2871 This does nothing for local (non-static) variables.
2872 Otherwise, it sets up the RTL and outputs any assembler code
2873 (label definition, storage allocation and initialization).
2875 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2876 the assembler symbol name to be used. TOP_LEVEL is nonzero
2877 if this declaration is not within a function. */
2880 rest_of_decl_compilation (decl
, asmspec
, top_level
, at_end
)
2886 /* Declarations of variables, and of functions defined elsewhere. */
2888 /* The most obvious approach, to put an #ifndef around where
2889 this macro is used, doesn't work since it's inside a macro call. */
2890 #ifndef ASM_FINISH_DECLARE_OBJECT
2891 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2894 /* Forward declarations for nested functions are not "external",
2895 but we need to treat them as if they were. */
2896 if (TREE_STATIC (decl
) || DECL_EXTERNAL (decl
)
2897 || TREE_CODE (decl
) == FUNCTION_DECL
)
2898 TIMEVAR (varconst_time
,
2900 make_decl_rtl (decl
, asmspec
, top_level
);
2901 /* Initialized extern variable exists to be replaced
2902 with its value, or represents something that will be
2903 output in another file. */
2904 if (! (TREE_CODE (decl
) == VAR_DECL
2905 && DECL_EXTERNAL (decl
) && TREE_READONLY (decl
)
2906 && DECL_INITIAL (decl
) != 0
2907 && DECL_INITIAL (decl
) != error_mark_node
))
2908 /* Don't output anything
2909 when a tentative file-scope definition is seen.
2910 But at end of compilation, do output code for them. */
2911 if (! (! at_end
&& top_level
2912 && (DECL_INITIAL (decl
) == 0
2913 || DECL_INITIAL (decl
) == error_mark_node
)))
2914 assemble_variable (decl
, top_level
, at_end
, 0);
2915 if (decl
== last_assemble_variable_decl
)
2917 ASM_FINISH_DECLARE_OBJECT (asm_out_file
, decl
,
2921 else if (DECL_REGISTER (decl
) && asmspec
!= 0)
2923 if (decode_reg_name (asmspec
) >= 0)
2925 DECL_RTL (decl
) = 0;
2926 make_decl_rtl (decl
, asmspec
, top_level
);
2929 error ("invalid register name `%s' for register variable", asmspec
);
2931 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2932 else if ((write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2933 && TREE_CODE (decl
) == TYPE_DECL
)
2934 TIMEVAR (symout_time
, dbxout_symbol (decl
, 0));
2936 #ifdef SDB_DEBUGGING_INFO
2937 else if (write_symbols
== SDB_DEBUG
&& top_level
2938 && TREE_CODE (decl
) == TYPE_DECL
)
2939 TIMEVAR (symout_time
, sdbout_symbol (decl
, 0));
2943 /* Called after finishing a record, union or enumeral type. */
2946 rest_of_type_compilation (type
, toplev
)
2950 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2951 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2952 TIMEVAR (symout_time
, dbxout_symbol (TYPE_STUB_DECL (type
), !toplev
));
2954 #ifdef SDB_DEBUGGING_INFO
2955 if (write_symbols
== SDB_DEBUG
)
2956 TIMEVAR (symout_time
, sdbout_symbol (TYPE_STUB_DECL (type
), !toplev
));
2960 /* This is called from finish_function (within yyparse)
2961 after each top-level definition is parsed.
2962 It is supposed to compile that function or variable
2963 and output the assembler code for it.
2964 After we return, the tree storage is freed. */
2967 rest_of_compilation (decl
)
2971 int start_time
= get_run_time ();
2973 /* Nonzero if we have saved the original DECL_INITIAL of the function,
2974 to be restored after we finish compiling the function
2975 (for use when compiling inline calls to this function). */
2976 tree saved_block_tree
= 0;
2977 /* Likewise, for DECL_ARGUMENTS. */
2978 tree saved_arguments
= 0;
2981 /* If we are reconsidering an inline function
2982 at the end of compilation, skip the stuff for making it inline. */
2984 if (DECL_SAVED_INSNS (decl
) == 0)
2989 /* If requested, consider whether to make this function inline. */
2990 if (DECL_INLINE (decl
) || flag_inline_functions
)
2991 TIMEVAR (integration_time
,
2993 lose
= function_cannot_inline_p (decl
);
2994 if (lose
|| ! optimize
)
2996 if (warn_inline
&& DECL_INLINE (decl
))
2997 warning_with_decl (decl
, lose
);
2998 DECL_ABSTRACT_ORIGIN (decl
) = 0;
2999 /* Don't really compile an extern inline function.
3000 If we can't make it inline, pretend
3001 it was only declared. */
3002 if (DECL_EXTERNAL (decl
))
3004 DECL_INITIAL (decl
) = 0;
3005 goto exit_rest_of_compilation
;
3009 /* ??? Note that this has the effect of making it look
3010 like "inline" was specified for a function if we choose
3011 to inline it. This isn't quite right, but it's
3012 probably not worth the trouble to fix. */
3013 inlinable
= DECL_INLINE (decl
) = 1;
3016 insns
= get_insns ();
3018 /* Dump the rtl code if we are dumping rtl. */
3022 open_dump_file (".rtl", decl_printable_name (decl
, 2));
3024 if (DECL_SAVED_INSNS (decl
))
3025 fprintf (rtl_dump_file
, ";; (integrable)\n\n");
3027 close_dump_file (print_rtl
, insns
);
3030 /* If we can, defer compiling inlines until EOF.
3031 save_for_inline_copying can be extremely expensive. */
3032 if (inlinable
&& ! decl_function_context (decl
))
3033 DECL_DEFER_OUTPUT (decl
) = 1;
3035 /* If function is inline, and we don't yet know whether to
3036 compile it by itself, defer decision till end of compilation.
3037 finish_compilation will call rest_of_compilation again
3038 for those functions that need to be output. Also defer those
3039 functions that we are supposed to defer. We cannot defer
3040 functions containing nested functions since the nested function
3041 data is in our non-saved obstack. */
3043 /* If this is a nested inline, remove ADDRESSOF now so we can
3044 finish compiling ourselves. Otherwise, wait until EOF.
3045 We have to do this because the purge_addressof transformation
3046 changes the DECL_RTL for many variables, which confuses integrate. */
3049 if (decl_function_context (decl
))
3050 purge_addressof (insns
);
3052 DECL_DEFER_OUTPUT (decl
) = 1;
3055 if (! current_function_contains_functions
3056 && (DECL_DEFER_OUTPUT (decl
)
3057 || (DECL_INLINE (decl
)
3058 && ((! TREE_PUBLIC (decl
) && ! TREE_ADDRESSABLE (decl
)
3059 && ! flag_keep_inline_functions
)
3060 || DECL_EXTERNAL (decl
)))))
3062 DECL_DEFER_OUTPUT (decl
) = 1;
3064 /* If -Wreturn-type, we have to do a bit of compilation.
3065 However, if we just fall through we will call
3066 save_for_inline_copying() which results in excessive
3067 memory use. Instead, we just want to call
3068 jump_optimize() to figure out whether or not we can fall
3069 off the end of the function; we do the minimum amount of
3070 work necessary to make that safe. And, we set optimize
3071 to zero to keep jump_optimize from working too hard. */
3072 if (warn_return_type
)
3074 int saved_optimize
= optimize
;
3076 find_exception_handler_labels ();
3077 jump_optimize (get_insns(), !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
3078 !JUMP_AFTER_REGSCAN
);
3079 optimize
= saved_optimize
;
3082 #ifdef DWARF_DEBUGGING_INFO
3083 /* Generate the DWARF info for the "abstract" instance
3084 of a function which we may later generate inlined and/or
3085 out-of-line instances of. */
3086 if (write_symbols
== DWARF_DEBUG
)
3088 set_decl_abstract_flags (decl
, 1);
3089 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3090 set_decl_abstract_flags (decl
, 0);
3093 #ifdef DWARF2_DEBUGGING_INFO
3094 /* Generate the DWARF2 info for the "abstract" instance
3095 of a function which we may later generate inlined and/or
3096 out-of-line instances of. */
3097 if (write_symbols
== DWARF2_DEBUG
)
3099 set_decl_abstract_flags (decl
, 1);
3100 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3101 set_decl_abstract_flags (decl
, 0);
3104 TIMEVAR (integration_time
, save_for_inline_nocopy (decl
));
3105 RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl
)) = inlinable
;
3106 goto exit_rest_of_compilation
;
3109 /* If we have to compile the function now, save its rtl and subdecls
3110 so that its compilation will not affect what others get. */
3111 if (inlinable
|| DECL_DEFER_OUTPUT (decl
))
3113 #ifdef DWARF_DEBUGGING_INFO
3114 /* Generate the DWARF info for the "abstract" instance of
3115 a function which we will generate an out-of-line instance
3116 of almost immediately (and which we may also later generate
3117 various inlined instances of). */
3118 if (write_symbols
== DWARF_DEBUG
)
3120 set_decl_abstract_flags (decl
, 1);
3121 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3122 set_decl_abstract_flags (decl
, 0);
3125 #ifdef DWARF2_DEBUGGING_INFO
3126 /* Generate the DWARF2 info for the "abstract" instance of
3127 a function which we will generate an out-of-line instance
3128 of almost immediately (and which we may also later generate
3129 various inlined instances of). */
3130 if (write_symbols
== DWARF2_DEBUG
)
3132 set_decl_abstract_flags (decl
, 1);
3133 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3134 set_decl_abstract_flags (decl
, 0);
3137 saved_block_tree
= DECL_INITIAL (decl
);
3138 saved_arguments
= DECL_ARGUMENTS (decl
);
3139 TIMEVAR (integration_time
, save_for_inline_copying (decl
));
3140 RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl
)) = inlinable
;
3143 /* If specified extern inline but we aren't inlining it, we are
3145 if (DECL_INLINE (decl
) && DECL_EXTERNAL (decl
))
3146 goto exit_rest_of_compilation
;
3149 if (! DECL_DEFER_OUTPUT (decl
))
3150 TREE_ASM_WRITTEN (decl
) = 1;
3152 /* Now that integrate will no longer see our rtl, we need not distinguish
3153 between the return value of this function and the return value of called
3155 rtx_equal_function_value_matters
= 0;
3157 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
3158 if ((rtl_dump_and_exit
|| flag_syntax_only
) && !warn_return_type
)
3160 goto exit_rest_of_compilation
;
3163 /* Emit code to get eh context, if needed. */
3167 /* If we are doing position-independent code generation, now
3168 is the time to output special prologues and epilogues.
3169 We do not want to do this earlier, because it just clutters
3170 up inline functions with meaningless insns. */
3175 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
3176 Note that that may have been done above, in save_for_inline_copying.
3177 The call to resume_temporary_allocation near the end of this function
3178 goes back to the usual state of affairs. This must be done after
3179 we've built up any unwinders for exception handling, and done
3180 the FINALIZE_PIC work, if necessary. */
3182 rtl_in_current_obstack ();
3184 insns
= get_insns ();
3186 /* Copy any shared structure that should not be shared. */
3188 unshare_all_rtl (insns
);
3190 #ifdef SETJMP_VIA_SAVE_AREA
3191 /* This must be performed before virutal register instantiation. */
3192 if (current_function_calls_alloca
)
3193 optimize_save_area_alloca (insns
);
3196 /* Instantiate all virtual registers. */
3198 instantiate_virtual_regs (current_function_decl
, get_insns ());
3200 /* See if we have allocated stack slots that are not directly addressable.
3201 If so, scan all the insns and create explicit address computation
3202 for all references to such slots. */
3203 /* fixup_stack_slots (); */
3205 /* Find all the EH handlers. */
3206 find_exception_handler_labels ();
3208 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
3209 are initialized and to compute whether control can drop off the end
3211 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3212 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
3213 JUMP_AFTER_REGSCAN
));
3215 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
3216 if (rtl_dump_and_exit
|| flag_syntax_only
|| DECL_DEFER_OUTPUT (decl
))
3217 goto exit_rest_of_compilation
;
3219 /* Dump rtl code after jump, if we are doing that. */
3222 dump_rtl (".jump", decl
, print_rtl
, insns
);
3224 /* Perform common subexpression elimination.
3225 Nonzero value from `cse_main' means that jumps were simplified
3226 and some code may now be unreachable, so do
3227 jump optimization again. */
3232 open_dump_file (".cse", decl_printable_name (decl
, 2));
3234 TIMEVAR (cse_time
, reg_scan (insns
, max_reg_num (), 1));
3236 if (flag_thread_jumps
)
3237 /* Hacks by tiemann & kenner. */
3238 TIMEVAR (jump_time
, thread_jumps (insns
, max_reg_num (), 1));
3240 TIMEVAR (cse_time
, tem
= cse_main (insns
, max_reg_num (),
3242 TIMEVAR (cse_time
, delete_trivially_dead_insns (insns
, max_reg_num ()));
3244 if (tem
|| optimize
> 1)
3245 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3247 !JUMP_AFTER_REGSCAN
));
3249 /* Dump rtl code after cse, if we are doing that. */
3252 close_dump_file (print_rtl
, insns
);
3255 purge_addressof (insns
);
3256 reg_scan (insns
, max_reg_num (), 1);
3259 dump_rtl (".addressof", decl
, print_rtl
, insns
);
3261 /* Move constant computations out of loops. */
3266 open_dump_file (".loop", decl_printable_name (decl
, 2));
3271 if (flag_rerun_loop_opt
)
3273 /* We only want to perform unrolling once. */
3275 loop_optimize (insns
, rtl_dump_file
, 0);
3278 /* The first call to loop_optimize makes some instructions
3279 trivially dead. We delete those instructions now in the
3280 hope that doing so will make the heuristics in loop work
3281 better and possibly speed up compilation. */
3282 delete_trivially_dead_insns (insns
, max_reg_num ());
3284 /* The regscan pass is currently necessary as the alias
3285 analysis code depends on this information. */
3286 reg_scan (insns
, max_reg_num (), 1);
3288 loop_optimize (insns
, rtl_dump_file
, flag_unroll_loops
);
3291 /* Dump rtl code after loop opt, if we are doing that. */
3294 close_dump_file (print_rtl
, insns
);
3300 open_dump_file (".cse2", decl_printable_name (decl
, 2));
3302 if (flag_rerun_cse_after_loop
)
3304 /* Running another jump optimization pass before the second
3305 cse pass sometimes simplifies the RTL enough to allow
3306 the second CSE pass to do a better job. Jump_optimize can change
3307 max_reg_num so we must rerun reg_scan afterwards.
3308 ??? Rework to not call reg_scan so often. */
3309 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3310 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3312 JUMP_AFTER_REGSCAN
));
3314 TIMEVAR (cse2_time
, reg_scan (insns
, max_reg_num (), 0));
3315 TIMEVAR (cse2_time
, tem
= cse_main (insns
, max_reg_num (),
3318 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3320 !JUMP_AFTER_REGSCAN
));
3323 if (flag_thread_jumps
)
3325 /* This pass of jump threading straightens out code
3326 that was kinked by loop optimization. */
3327 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3328 TIMEVAR (jump_time
, thread_jumps (insns
, max_reg_num (), 0));
3331 /* Dump rtl code after cse, if we are doing that. */
3334 close_dump_file (print_rtl
, insns
);
3337 if (profile_arc_flag
|| flag_test_coverage
|| flag_branch_probabilities
)
3339 if (branch_prob_dump
)
3340 open_dump_file (".bp", decl_printable_name (decl
, 2));
3345 branch_prob (insns
, rtl_dump_file
);
3348 if (branch_prob_dump
)
3349 close_dump_file (print_rtl
, insns
);
3352 /* We are no longer anticipating cse in this function, at least. */
3354 cse_not_expected
= 1;
3356 /* Now we choose between stupid (pcc-like) register allocation
3357 (if we got the -noreg switch and not -opt)
3358 and smart register allocation. */
3360 if (optimize
> 0) /* Stupid allocation probably won't work */
3361 obey_regdecls
= 0; /* if optimizations being done. */
3365 /* Print function header into flow dump now
3366 because doing the flow analysis makes some of the dump. */
3369 open_dump_file (".flow", decl_printable_name (decl
, 2));
3375 regclass (insns
, max_reg_num ());
3376 stupid_life_analysis (insns
, max_reg_num (),
3382 /* Do control and data flow analysis,
3383 and write some of the results to dump file. */
3388 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
, 1);
3389 life_analysis (insns
, max_reg_num (), rtl_dump_file
);
3392 if (warn_uninitialized
)
3394 uninitialized_vars_warning (DECL_INITIAL (decl
));
3395 setjmp_args_warning ();
3399 /* Dump rtl after flow analysis. */
3402 close_dump_file (print_rtl_with_bb
, insns
);
3404 /* If -opt, try combining insns through substitution. */
3408 TIMEVAR (combine_time
, combine_instructions (insns
, max_reg_num ()));
3410 /* Dump rtl code after insn combination. */
3413 dump_rtl (".combine", decl
, print_rtl_with_bb
, insns
);
3416 /* Register allocation pre-pass, to reduce number of moves
3417 necessary for two-address machines. */
3418 if (optimize
> 0 && (flag_regmove
|| flag_expensive_optimizations
))
3421 open_dump_file (".regmove", decl_printable_name (decl
, 2));
3423 TIMEVAR (regmove_time
, regmove_optimize (insns
, max_reg_num (),
3427 close_dump_file (print_rtl_with_bb
, insns
);
3430 /* Print function header into sched dump now
3431 because doing the sched analysis makes some of the dump. */
3433 if (optimize
> 0 && flag_schedule_insns
)
3436 open_dump_file (".sched", decl_printable_name (decl
, 2));
3438 /* Do control and data sched analysis,
3439 and write some of the results to dump file. */
3441 TIMEVAR (sched_time
, schedule_insns (rtl_dump_file
));
3443 /* Dump rtl after instruction scheduling. */
3446 close_dump_file (print_rtl_with_bb
, insns
);
3449 /* Unless we did stupid register allocation,
3450 allocate pseudo-regs that are used only within 1 basic block. */
3453 TIMEVAR (local_alloc_time
,
3455 regclass (insns
, max_reg_num ());
3459 /* Dump rtl code after allocating regs within basic blocks. */
3463 open_dump_file (".lreg", decl_printable_name (decl
, 2));
3465 TIMEVAR (dump_time
, dump_flow_info (rtl_dump_file
));
3466 TIMEVAR (dump_time
, dump_local_alloc (rtl_dump_file
));
3468 close_dump_file (print_rtl_with_bb
, insns
);
3471 if (global_reg_dump
)
3472 open_dump_file (".greg", decl_printable_name (decl
, 2));
3474 /* Save the last label number used so far, so reorg can tell
3475 when it's safe to kill spill regs. */
3476 max_label_num_after_reload
= max_label_num ();
3478 /* Unless we did stupid register allocation,
3479 allocate remaining pseudo-regs, then do the reload pass
3480 fixing up any insns that are invalid. */
3482 TIMEVAR (global_alloc_time
,
3485 failure
= global_alloc (rtl_dump_file
);
3487 failure
= reload (insns
, 0, rtl_dump_file
);
3490 if (global_reg_dump
)
3492 TIMEVAR (dump_time
, dump_global_regs (rtl_dump_file
));
3493 close_dump_file (print_rtl_with_bb
, insns
);
3497 goto exit_rest_of_compilation
;
3499 reload_completed
= 1;
3501 /* Do a very simple CSE pass over just the hard registers. */
3503 reload_cse_regs (insns
);
3505 /* On some machines, the prologue and epilogue code, or parts thereof,
3506 can be represented as RTL. Doing so lets us schedule insns between
3507 it and the rest of the code and also allows delayed branch
3508 scheduling to operate in the epilogue. */
3510 thread_prologue_and_epilogue_insns (insns
);
3512 if (optimize
> 0 && flag_schedule_insns_after_reload
)
3515 open_dump_file (".sched2", decl_printable_name (decl
, 2));
3517 /* Do control and data sched analysis again,
3518 and write some more of the results to dump file. */
3520 TIMEVAR (sched2_time
, schedule_insns (rtl_dump_file
));
3522 /* Dump rtl after post-reorder instruction scheduling. */
3525 close_dump_file (print_rtl_with_bb
, insns
);
3528 #ifdef LEAF_REGISTERS
3530 if (optimize
> 0 && only_leaf_regs_used () && leaf_function_p ())
3534 /* One more attempt to remove jumps to .+1
3535 left by dead-store-elimination.
3536 Also do cross-jumping this time
3537 and delete no-op move insns. */
3541 TIMEVAR (jump_time
, jump_optimize (insns
, JUMP_CROSS_JUMP
,
3543 !JUMP_AFTER_REGSCAN
));
3545 /* Dump rtl code after jump, if we are doing that. */
3548 dump_rtl (".jump2", decl
, print_rtl_with_bb
, insns
);
3551 /* If a machine dependent reorganization is needed, call it. */
3552 #ifdef MACHINE_DEPENDENT_REORG
3553 MACHINE_DEPENDENT_REORG (insns
);
3555 if (mach_dep_reorg_dump
)
3556 dump_rtl (".mach", decl
, print_rtl_with_bb
, insns
);
3559 /* If a scheduling pass for delayed branches is to be done,
3560 call the scheduling code. */
3563 if (optimize
> 0 && flag_delayed_branch
)
3565 TIMEVAR (dbr_sched_time
, dbr_schedule (insns
, rtl_dump_file
));
3568 dump_rtl (".dbr", decl
, print_rtl_with_bb
, insns
);
3572 /* Shorten branches. */
3573 TIMEVAR (shorten_branch_time
,
3575 shorten_branches (get_insns ());
3579 TIMEVAR (stack_reg_time
, reg_to_stack (insns
, rtl_dump_file
));
3582 dump_rtl (".stack", decl
, print_rtl_with_bb
, insns
);
3585 /* Now turn the rtl into assembler code. */
3587 TIMEVAR (final_time
,
3592 /* Get the function's name, as described by its RTL.
3593 This may be different from the DECL_NAME name used
3594 in the source file. */
3596 x
= DECL_RTL (decl
);
3597 if (GET_CODE (x
) != MEM
)
3600 if (GET_CODE (x
) != SYMBOL_REF
)
3602 fnname
= XSTR (x
, 0);
3604 assemble_start_function (decl
, fnname
);
3605 final_start_function (insns
, asm_out_file
, optimize
);
3606 final (insns
, asm_out_file
, optimize
, 0);
3607 final_end_function (insns
, asm_out_file
, optimize
);
3608 assemble_end_function (decl
, fnname
);
3610 fflush (asm_out_file
);
3612 /* Release all memory held by regsets now */
3613 regset_release_memory ();
3616 /* Write DBX symbols if requested */
3618 /* Note that for those inline functions where we don't initially
3619 know for certain that we will be generating an out-of-line copy,
3620 the first invocation of this routine (rest_of_compilation) will
3621 skip over this code by doing a `goto exit_rest_of_compilation;'.
3622 Later on, finish_compilation will call rest_of_compilation again
3623 for those inline functions that need to have out-of-line copies
3624 generated. During that call, we *will* be routed past here. */
3626 #ifdef DBX_DEBUGGING_INFO
3627 if (write_symbols
== DBX_DEBUG
)
3628 TIMEVAR (symout_time
, dbxout_function (decl
));
3631 #ifdef DWARF_DEBUGGING_INFO
3632 if (write_symbols
== DWARF_DEBUG
)
3633 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3636 #ifdef DWARF2_DEBUGGING_INFO
3637 if (write_symbols
== DWARF2_DEBUG
)
3638 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3641 exit_rest_of_compilation
:
3643 /* In case the function was not output,
3644 don't leave any temporary anonymous types
3645 queued up for sdb output. */
3646 #ifdef SDB_DEBUGGING_INFO
3647 if (write_symbols
== SDB_DEBUG
)
3648 sdbout_types (NULL_TREE
);
3651 /* Put back the tree of subblocks and list of arguments
3652 from before we copied them.
3653 Code generation and the output of debugging info may have modified
3654 the copy, but the original is unchanged. */
3656 if (saved_block_tree
!= 0)
3658 DECL_INITIAL (decl
) = saved_block_tree
;
3659 DECL_ARGUMENTS (decl
) = saved_arguments
;
3660 DECL_ABSTRACT_ORIGIN (decl
) = NULL_TREE
;
3663 reload_completed
= 0;
3665 /* Clear out the insn_length contents now that they are no longer valid. */
3666 init_insn_lengths ();
3668 /* Clear out the real_constant_chain before some of the rtx's
3669 it runs through become garbage. */
3671 clear_const_double_mem ();
3673 /* Cancel the effect of rtl_in_current_obstack. */
3675 resume_temporary_allocation ();
3677 /* Show no temporary slots allocated. */
3681 /* Make sure volatile mem refs aren't considered valid operands for
3682 arithmetic insns. We must call this here if this is a nested inline
3683 function, since the above code leaves us in the init_recog state
3684 (from final.c), and the function context push/pop code does not
3685 save/restore volatile_ok.
3687 ??? Maybe it isn't necessary for expand_start_function to call this
3688 anymore if we do it here? */
3690 init_recog_no_volatile ();
3692 /* The parsing time is all the time spent in yyparse
3693 *except* what is spent in this function. */
3695 parse_time
-= get_run_time () - start_time
;
3698 /* Entry point of cc1/c++. Decode command args, then call compile_file.
3699 Exit code is 35 if can't open files, 34 if fatal error,
3700 33 if had nonfatal errors, else success. */
3703 main (argc
, argv
, envp
)
3710 int flag_print_mem
= 0;
3711 int version_flag
= 0;
3714 /* save in case md file wants to emit args as a comment. */
3718 p
= argv
[0] + strlen (argv
[0]);
3719 while (p
!= argv
[0] && p
[-1] != '/'
3720 #ifdef DIR_SEPARATOR
3721 && p
[-1] != DIR_SEPARATOR
3727 #if defined (RLIMIT_STACK) && defined (HAVE_GETRLIMIT) && defined (HAVE_SETRLIMIT)
3728 /* Get rid of any avoidable limit on stack size. */
3732 /* Set the stack limit huge so that alloca does not fail. */
3733 getrlimit (RLIMIT_STACK
, &rlim
);
3734 rlim
.rlim_cur
= rlim
.rlim_max
;
3735 setrlimit (RLIMIT_STACK
, &rlim
);
3739 signal (SIGFPE
, float_signal
);
3742 signal (SIGPIPE
, pipe_closed
);
3745 decl_printable_name
= decl_name
;
3746 lang_expand_expr
= (struct rtx_def
*(*)()) do_abort
;
3748 /* Initialize whether `char' is signed. */
3749 flag_signed_char
= DEFAULT_SIGNED_CHAR
;
3750 #ifdef DEFAULT_SHORT_ENUMS
3751 /* Initialize how much space enums occupy, by default. */
3752 flag_short_enums
= DEFAULT_SHORT_ENUMS
;
3755 /* Scan to see what optimization level has been specified. That will
3756 determine the default value of many flags. */
3757 for (i
= 1; i
< argc
; i
++)
3759 if (!strcmp (argv
[i
], "-O"))
3763 else if (argv
[i
][0] == '-' && argv
[i
][1] == 'O')
3765 /* Handle -Os, -O2, -O3, -O69, ... */
3766 char *p
= &argv
[i
][2];
3769 if ((p
[0] == 's') && (p
[1] == 0))
3774 if (! (c
>= '0' && c
<= '9'))
3777 optimize
= atoi (&argv
[i
][2]);
3782 /* Optimizing for size forces optimize to be no less than 2. */
3783 if (optimize_size
&& (optimize
< 2))
3786 obey_regdecls
= (optimize
== 0);
3791 flag_thread_jumps
= 1;
3793 flag_delayed_branch
= 1;
3795 #ifdef CAN_DEBUG_WITHOUT_FP
3796 flag_omit_frame_pointer
= 1;
3802 flag_cse_follow_jumps
= 1;
3803 flag_cse_skip_blocks
= 1;
3804 flag_expensive_optimizations
= 1;
3805 flag_strength_reduce
= 1;
3806 flag_rerun_cse_after_loop
= 1;
3807 flag_rerun_loop_opt
= 1;
3808 flag_caller_saves
= 1;
3810 #ifdef INSN_SCHEDULING
3811 flag_schedule_insns
= 1;
3812 flag_schedule_insns_after_reload
= 1;
3819 flag_inline_functions
= 1;
3822 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
3825 set_target_switch ("");
3827 #ifdef OPTIMIZATION_OPTIONS
3828 /* Allow default optimizations to be specified on a per-machine basis. */
3829 OPTIMIZATION_OPTIONS (optimize
, optimize_size
);
3832 /* Initialize register usage now so switches may override. */
3835 for (i
= 1; i
< argc
; i
++)
3838 /* If this is a language-specific option,
3839 decode it in a language-specific way. */
3840 for (j
= 0; lang_options
[j
] != 0; j
++)
3841 if (!strncmp (argv
[i
], lang_options
[j
],
3842 strlen (lang_options
[j
])))
3844 if (lang_options
[j
] != 0)
3845 /* If the option is valid for *some* language,
3846 treat it as valid even if this language doesn't understand it. */
3847 lang_decode_option (argv
[i
]);
3848 else if (argv
[i
][0] == '-' && argv
[i
][1] != 0)
3850 register char *str
= argv
[i
] + 1;
3855 set_target_switch (&str
[1]);
3856 else if (!strcmp (str
, "dumpbase"))
3858 dump_base_name
= argv
[++i
];
3860 else if (str
[0] == 'd')
3862 register char *p
= &str
[1];
3867 branch_prob_dump
= 1;
3873 global_reg_dump
= 1;
3881 cse_dump
= 1, cse2_dump
= 1;
3887 #ifdef MACHINE_DEPENDENT_REORG
3888 mach_dep_reorg_dump
= 1;
3895 branch_prob_dump
= 1;
3912 global_reg_dump
= 1;
3934 #ifdef MACHINE_DEPENDENT_REORG
3936 mach_dep_reorg_dump
= 1;
3940 flag_print_asm_name
= 1;
3964 rtl_dump_and_exit
= 1;
3967 warning ("unrecognised gcc debugging option: %c", p
[-1]);
3971 else if (str
[0] == 'f')
3973 register char *p
= &str
[1];
3976 /* Some kind of -f option.
3977 P's value is the option sans `-f'.
3978 Search for it in the table of options. */
3981 !found
&& j
< sizeof (f_options
) / sizeof (f_options
[0]);
3984 if (!strcmp (p
, f_options
[j
].string
))
3986 *f_options
[j
].variable
= f_options
[j
].on_value
;
3987 /* A goto here would be cleaner,
3988 but breaks the vax pcc. */
3991 if (p
[0] == 'n' && p
[1] == 'o' && p
[2] == '-'
3992 && ! strcmp (p
+3, f_options
[j
].string
))
3994 *f_options
[j
].variable
= ! f_options
[j
].on_value
;
4002 #ifdef INSN_SCHEDULING
4003 else if (!strncmp (p
, "sched-verbose-",14))
4004 fix_sched_param("verbose",&p
[14]);
4005 else if (!strncmp (p
, "sched-max-",10))
4006 fix_sched_param("max",&p
[10]);
4007 else if (!strncmp (p
, "sched-inter-max-b-",18))
4008 fix_sched_param("interblock-max-blocks",&p
[18]);
4009 else if (!strncmp (p
, "sched-inter-max-i-",18))
4010 fix_sched_param("interblock-max-insns",&p
[18]);
4013 else if (!strncmp (p
, "fixed-", 6))
4014 fix_register (&p
[6], 1, 1);
4015 else if (!strncmp (p
, "call-used-", 10))
4016 fix_register (&p
[10], 0, 1);
4017 else if (!strncmp (p
, "call-saved-", 11))
4018 fix_register (&p
[11], 0, 0);
4020 error ("Invalid option `%s'", argv
[i
]);
4022 else if (str
[0] == 'O')
4024 register char *p
= str
+1;
4028 while (*p
&& *p
>= '0' && *p
<= '9')
4033 error ("Invalid option `%s'", argv
[i
]);
4035 else if (!strcmp (str
, "pedantic"))
4037 else if (!strcmp (str
, "pedantic-errors"))
4038 flag_pedantic_errors
= pedantic
= 1;
4039 else if (!strcmp (str
, "quiet"))
4041 else if (!strcmp (str
, "version"))
4043 else if (!strcmp (str
, "w"))
4044 inhibit_warnings
= 1;
4045 else if (!strcmp (str
, "W"))
4048 /* We save the value of warn_uninitialized, since if they put
4049 -Wuninitialized on the command line, we need to generate a
4050 warning about not using it without also specifying -O. */
4051 if (warn_uninitialized
!= 1)
4052 warn_uninitialized
= 2;
4054 else if (str
[0] == 'W')
4056 register char *p
= &str
[1];
4059 /* Some kind of -W option.
4060 P's value is the option sans `-W'.
4061 Search for it in the table of options. */
4064 !found
&& j
< sizeof (W_options
) / sizeof (W_options
[0]);
4067 if (!strcmp (p
, W_options
[j
].string
))
4069 *W_options
[j
].variable
= W_options
[j
].on_value
;
4070 /* A goto here would be cleaner,
4071 but breaks the vax pcc. */
4074 if (p
[0] == 'n' && p
[1] == 'o' && p
[2] == '-'
4075 && ! strcmp (p
+3, W_options
[j
].string
))
4077 *W_options
[j
].variable
= ! W_options
[j
].on_value
;
4084 else if (!strncmp (p
, "id-clash-", 9))
4090 if (*endp
>= '0' && *endp
<= '9')
4094 error ("Invalid option `%s'", argv
[i
]);
4099 id_clash_len
= atoi (str
+ 10);
4102 else if (!strncmp (p
, "larger-than-", 12))
4104 char *endp
= p
+ 12;
4108 if (*endp
>= '0' && *endp
<= '9')
4112 error ("Invalid option `%s'", argv
[i
]);
4113 goto larger_than_lose
;
4116 warn_larger_than
= 1;
4117 larger_than_size
= atoi (str
+ 13);
4121 error ("Invalid option `%s'", argv
[i
]);
4123 else if (!strcmp (str
, "p"))
4127 else if (!strcmp (str
, "a"))
4129 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4130 warning ("`-a' option (basic block profile) not supported");
4132 profile_block_flag
= (profile_block_flag
< 2) ? 1 : 3;
4135 else if (!strcmp (str
, "ax"))
4137 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4138 warning ("`-ax' option (jump profiling) not supported");
4140 profile_block_flag
= (!profile_block_flag
4141 || profile_block_flag
== 2) ? 2 : 3;
4144 else if (str
[0] == 'g')
4148 /* A lot of code assumes write_symbols == NO_DEBUG if the
4149 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4150 of what debugging type has been selected). This records the
4151 selected type. It is an error to specify more than one
4153 static enum debug_info_type selected_debug_type
= NO_DEBUG
;
4154 /* Non-zero if debugging format has been explicitly set.
4155 -g and -ggdb don't explicitly set the debugging format so
4156 -gdwarf -g3 is equivalent to -gdwarf3. */
4157 static int type_explicitly_set_p
= 0;
4158 /* Table of supported debugging formats. */
4161 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
4162 constant expression, we use NO_DEBUG in its place. */
4163 enum debug_info_type debug_type
;
4164 int use_extensions_p
;
4165 } *da
, debug_args
[] = {
4166 { "g", NO_DEBUG
, DEFAULT_GDB_EXTENSIONS
},
4167 { "ggdb", NO_DEBUG
, 1 },
4168 #ifdef DBX_DEBUGGING_INFO
4169 { "gstabs", DBX_DEBUG
, 0 },
4170 { "gstabs+", DBX_DEBUG
, 1 },
4172 #ifdef DWARF_DEBUGGING_INFO
4173 { "gdwarf", DWARF_DEBUG
, 0 },
4174 { "gdwarf+", DWARF_DEBUG
, 1 },
4176 #ifdef DWARF2_DEBUGGING_INFO
4177 { "gdwarf-2", DWARF2_DEBUG
, 0 },
4179 #ifdef XCOFF_DEBUGGING_INFO
4180 { "gxcoff", XCOFF_DEBUG
, 0 },
4181 { "gxcoff+", XCOFF_DEBUG
, 1 },
4183 #ifdef SDB_DEBUGGING_INFO
4184 { "gcoff", SDB_DEBUG
, 0 },
4188 /* Indexed by enum debug_info_type. */
4189 static char *debug_type_names
[] = {
4190 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4193 /* Look up STR in the table. */
4194 for (da
= debug_args
; da
->arg
; da
++)
4196 if (! strncmp (str
, da
->arg
, strlen (da
->arg
)))
4198 enum debug_info_type type
= da
->debug_type
;
4201 p
= str
+ strlen (da
->arg
);
4202 if (*p
&& (*p
< '0' || *p
> '9'))
4206 while (*q
&& (*q
>= '0' && *q
<= '9'))
4211 if (len
> 1 && !strncmp (str
, "gdwarf", len
))
4213 error ("use -gdwarf -g%d for DWARF v1, level %d",
4216 error ("use -gdwarf-2 for DWARF v2");
4220 level
= 2; /* default debugging info level */
4221 if (*q
|| level
> 3)
4223 warning ("invalid debug level specification in option: `-%s'",
4225 /* ??? This error message is incorrect in the case of
4227 warning ("no debugging information will be generated");
4231 if (type
== NO_DEBUG
)
4233 type
= PREFERRED_DEBUGGING_TYPE
;
4234 if (len
> 1 && strncmp (str
, "ggdb", len
) == 0)
4236 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4237 type
= DWARF2_DEBUG
;
4239 #ifdef DBX_DEBUGGING_INFO
4246 if (type
== NO_DEBUG
)
4247 warning ("`-%s' not supported by this configuration of GCC",
4250 /* Does it conflict with an already selected type? */
4251 if (type_explicitly_set_p
4252 /* -g/-ggdb don't conflict with anything */
4253 && da
->debug_type
!= NO_DEBUG
4254 && type
!= selected_debug_type
)
4255 warning ("`-%s' ignored, conflicts with `-g%s'",
4256 str
, debug_type_names
[(int) selected_debug_type
]);
4259 /* If the format has already been set, -g/-ggdb
4260 only change the debug level. */
4261 if (type_explicitly_set_p
4262 && da
->debug_type
== NO_DEBUG
)
4263 ; /* don't change debugging type */
4266 selected_debug_type
= type
;
4267 type_explicitly_set_p
= da
->debug_type
!= NO_DEBUG
;
4269 write_symbols
= (level
== 0
4271 : selected_debug_type
);
4272 use_gnu_debug_info_extensions
= da
->use_extensions_p
;
4273 debug_info_level
= (enum debug_info_level
) level
;
4279 warning ("`-%s' not supported by this configuration of GCC",
4282 else if (!strcmp (str
, "o"))
4284 asm_file_name
= argv
[++i
];
4286 else if (str
[0] == 'G')
4288 g_switch_set
= TRUE
;
4289 g_switch_value
= atoi ((str
[1] != '\0') ? str
+1 : argv
[++i
]);
4291 else if (!strncmp (str
, "aux-info", 8))
4293 flag_gen_aux_info
= 1;
4294 aux_info_file_name
= (str
[8] != '\0' ? str
+8 : argv
[++i
]);
4297 error ("Invalid option `%s'", argv
[i
]);
4299 else if (argv
[i
][0] == '+')
4300 error ("Invalid option `%s'", argv
[i
]);
4305 /* Checker uses the frame pointer. */
4306 if (flag_check_memory_usage
)
4307 flag_omit_frame_pointer
= 0;
4311 /* Inlining does not work if not optimizing,
4312 so force it not to be done. */
4316 /* The c_decode_option and lang_decode_option functions set
4317 this to `2' if -Wall is used, so we can avoid giving out
4318 lots of errors for people who don't realize what -Wall does. */
4319 if (warn_uninitialized
== 1)
4320 warning ("-Wuninitialized is not supported without -O");
4323 #ifdef OVERRIDE_OPTIONS
4324 /* Some machines may reject certain combinations of options. */
4328 if (exceptions_via_longjmp
== 2)
4330 #ifdef DWARF2_UNWIND_INFO
4331 exceptions_via_longjmp
= ! DWARF2_UNWIND_INFO
;
4333 exceptions_via_longjmp
= 1;
4337 if (profile_block_flag
== 3)
4339 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4340 profile_block_flag
= 2;
4343 /* Unrolling all loops implies that standard loop unrolling must also
4345 if (flag_unroll_all_loops
)
4346 flag_unroll_loops
= 1;
4347 /* Loop unrolling requires that strength_reduction be on also. Silently
4348 turn on strength reduction here if it isn't already on. Also, the loop
4349 unrolling code assumes that cse will be run after loop, so that must
4350 be turned on also. */
4351 if (flag_unroll_loops
)
4353 flag_strength_reduce
= 1;
4354 flag_rerun_cse_after_loop
= 1;
4357 /* Warn about options that are not supported on this machine. */
4358 #ifndef INSN_SCHEDULING
4359 if (flag_schedule_insns
|| flag_schedule_insns_after_reload
)
4360 warning ("instruction scheduling not supported on this target machine");
4363 if (flag_delayed_branch
)
4364 warning ("this target machine does not have delayed branches");
4367 /* If we are in verbose mode, write out the version and maybe all the
4368 option flags in use. */
4371 print_version (stderr
, "");
4373 print_switch_values (stderr
, 0, MAX_LINE
, "", " ", "\n");
4376 compile_file (filename
);
4378 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN32__))
4381 char *lim
= (char *) sbrk (0);
4383 fprintf (stderr
, "Data size %d.\n",
4384 lim
- (char *) &environ
);
4389 system ("ps -l 1>&2");
4392 #endif /* not USG */
4395 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN32) */
4398 exit (FATAL_EXIT_CODE
);
4400 exit (FATAL_EXIT_CODE
);
4401 exit (SUCCESS_EXIT_CODE
);
4405 /* Decode -m switches. */
4407 /* Here is a table, controlled by the tm.h file, listing each -m switch
4408 and which bits in `target_switches' it should set or clear.
4409 If VALUE is positive, it is bits to set.
4410 If VALUE is negative, -VALUE is bits to clear.
4411 (The sign bit is not used so there is no confusion.) */
4413 struct {char *name
; int value
;} target_switches
[]
4416 /* This table is similar, but allows the switch to have a value. */
4418 #ifdef TARGET_OPTIONS
4419 struct {char *prefix
; char ** variable
;} target_options
[]
4423 /* Decode the switch -mNAME. */
4426 set_target_switch (name
)
4432 for (j
= 0; j
< sizeof target_switches
/ sizeof target_switches
[0]; j
++)
4433 if (!strcmp (target_switches
[j
].name
, name
))
4435 if (target_switches
[j
].value
< 0)
4436 target_flags
&= ~-target_switches
[j
].value
;
4438 target_flags
|= target_switches
[j
].value
;
4442 #ifdef TARGET_OPTIONS
4444 for (j
= 0; j
< sizeof target_options
/ sizeof target_options
[0]; j
++)
4446 int len
= strlen (target_options
[j
].prefix
);
4447 if (!strncmp (target_options
[j
].prefix
, name
, len
))
4449 *target_options
[j
].variable
= name
+ len
;
4456 error ("Invalid option `%s'", name
);
4459 /* Print version information to FILE.
4460 Each line begins with INDENT (for the case where FILE is the
4461 assembler output file). */
4464 print_version (file
, indent
)
4468 fprintf (file
, "%s%s%s version %s", indent
, *indent
!= 0 ? " " : "",
4469 language_string
, version_string
);
4470 fprintf (file
, " (%s)", TARGET_NAME
);
4473 #define __VERSION__ "[unknown]"
4475 fprintf (file
, " compiled by GNU C version %s.\n", __VERSION__
);
4477 fprintf (file
, " compiled by CC.\n");
4481 /* Print an option value and return the adjusted position in the line.
4482 ??? We don't handle error returns from fprintf (disk full); presumably
4483 other code will catch a disk full though. */
4486 print_single_switch (file
, pos
, max
, indent
, sep
, term
, type
, name
)
4489 char *indent
, *sep
, *term
, *type
, *name
;
4491 /* The ultrix fprintf returns 0 on success, so compute the result we want
4492 here since we need it for the following test. */
4493 int len
= strlen (sep
) + strlen (type
) + strlen (name
);
4498 fprintf (file
, "%s", term
);
4503 fprintf (file
, "%s", indent
);
4504 pos
= strlen (indent
);
4506 fprintf (file
, "%s%s%s", sep
, type
, name
);
4511 /* Print active target switches to FILE.
4512 POS is the current cursor position and MAX is the size of a "line".
4513 Each line begins with INDENT and ends with TERM.
4514 Each switch is separated from the next by SEP. */
4517 print_switch_values (file
, pos
, max
, indent
, sep
, term
)
4520 char *indent
, *sep
, *term
;
4525 /* Print the options as passed. */
4527 pos
= print_single_switch (file
, pos
, max
, indent
, *indent
? " " : "", term
,
4528 "options passed: ", "");
4530 for (p
= &save_argv
[1]; *p
!= NULL
; p
++)
4534 if (strcmp (*p
, "-o") == 0)
4540 if (strcmp (*p
, "-quiet") == 0)
4542 if (strcmp (*p
, "-version") == 0)
4547 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
, *p
, "");
4550 fprintf (file
, "%s", term
);
4552 /* Print the -f and -m options that have been enabled.
4553 We don't handle language specific options but printing argv
4556 pos
= print_single_switch (file
, 0, max
, indent
, *indent
? " " : "", term
,
4557 "options enabled: ", "");
4559 for (j
= 0; j
< sizeof f_options
/ sizeof f_options
[0]; j
++)
4560 if (*f_options
[j
].variable
== f_options
[j
].on_value
)
4561 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4562 "-f", f_options
[j
].string
);
4564 /* Print target specific options. */
4566 for (j
= 0; j
< sizeof target_switches
/ sizeof target_switches
[0]; j
++)
4567 if (target_switches
[j
].name
[0] != '\0'
4568 && target_switches
[j
].value
> 0
4569 && ((target_switches
[j
].value
& target_flags
)
4570 == target_switches
[j
].value
))
4572 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4573 "-m", target_switches
[j
].name
);
4576 #ifdef TARGET_OPTIONS
4577 for (j
= 0; j
< sizeof target_options
/ sizeof target_options
[0]; j
++)
4578 if (*target_options
[j
].variable
!= NULL
)
4581 sprintf (prefix
, "-m%s", target_options
[j
].prefix
);
4582 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4583 prefix
, *target_options
[j
].variable
);
4587 fprintf (file
, "%s", term
);
4590 /* Record the beginning of a new source file, named FILENAME. */
4593 debug_start_source_file (filename
)
4594 register char *filename
;
4596 #ifdef DBX_DEBUGGING_INFO
4597 if (write_symbols
== DBX_DEBUG
)
4598 dbxout_start_new_source_file (filename
);
4600 #ifdef DWARF_DEBUGGING_INFO
4601 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4602 && write_symbols
== DWARF_DEBUG
)
4603 dwarfout_start_new_source_file (filename
);
4604 #endif /* DWARF_DEBUGGING_INFO */
4605 #ifdef DWARF2_DEBUGGING_INFO
4606 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4607 && write_symbols
== DWARF2_DEBUG
)
4608 dwarf2out_start_source_file (filename
);
4609 #endif /* DWARF2_DEBUGGING_INFO */
4610 #ifdef SDB_DEBUGGING_INFO
4611 if (write_symbols
== SDB_DEBUG
)
4612 sdbout_start_new_source_file (filename
);
4616 /* Record the resumption of a source file. LINENO is the line number in
4617 the source file we are returning to. */
4620 debug_end_source_file (lineno
)
4621 register unsigned lineno
;
4623 #ifdef DBX_DEBUGGING_INFO
4624 if (write_symbols
== DBX_DEBUG
)
4625 dbxout_resume_previous_source_file ();
4627 #ifdef DWARF_DEBUGGING_INFO
4628 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4629 && write_symbols
== DWARF_DEBUG
)
4630 dwarfout_resume_previous_source_file (lineno
);
4631 #endif /* DWARF_DEBUGGING_INFO */
4632 #ifdef DWARF2_DEBUGGING_INFO
4633 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4634 && write_symbols
== DWARF2_DEBUG
)
4635 dwarf2out_end_source_file ();
4636 #endif /* DWARF2_DEBUGGING_INFO */
4637 #ifdef SDB_DEBUGGING_INFO
4638 if (write_symbols
== SDB_DEBUG
)
4639 sdbout_resume_previous_source_file ();
4643 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
4644 the tail part of the directive line, i.e. the part which is past the
4645 initial whitespace, #, whitespace, directive-name, whitespace part. */
4648 debug_define (lineno
, buffer
)
4649 register unsigned lineno
;
4650 register char *buffer
;
4652 #ifdef DWARF_DEBUGGING_INFO
4653 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4654 && write_symbols
== DWARF_DEBUG
)
4655 dwarfout_define (lineno
, buffer
);
4656 #endif /* DWARF_DEBUGGING_INFO */
4657 #ifdef DWARF2_DEBUGGING_INFO
4658 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4659 && write_symbols
== DWARF2_DEBUG
)
4660 dwarf2out_define (lineno
, buffer
);
4661 #endif /* DWARF2_DEBUGGING_INFO */
4664 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
4665 the tail part of the directive line, i.e. the part which is past the
4666 initial whitespace, #, whitespace, directive-name, whitespace part. */
4669 debug_undef (lineno
, buffer
)
4670 register unsigned lineno
;
4671 register char *buffer
;
4673 #ifdef DWARF_DEBUGGING_INFO
4674 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4675 && write_symbols
== DWARF_DEBUG
)
4676 dwarfout_undef (lineno
, buffer
);
4677 #endif /* DWARF_DEBUGGING_INFO */
4678 #ifdef DWARF2_DEBUGGING_INFO
4679 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4680 && write_symbols
== DWARF2_DEBUG
)
4681 dwarf2out_undef (lineno
, buffer
);
4682 #endif /* DWARF2_DEBUGGING_INFO */