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 /* Name of program invoked, sans directories. */
208 /* Copy of arguments to main. */
212 /* Name of current original source file (what was input to cpp).
213 This comes from each #-command in the actual input. */
215 char *input_filename
;
217 /* Name of top-level original source file (what was input to cpp).
218 This comes from the #-command at the beginning of the actual input.
219 If there isn't any there, then this is the cc1 input file name. */
221 char *main_input_filename
;
223 /* Current line number in real source file. */
227 /* Stack of currently pending input files. */
229 struct file_stack
*input_file_stack
;
231 /* Incremented on each change to input_file_stack. */
232 int input_file_stack_tick
;
234 /* FUNCTION_DECL for function now being parsed or compiled. */
236 extern tree current_function_decl
;
238 /* Name to use as base of names for dump output files. */
240 char *dump_base_name
;
242 /* Bit flags that specify the machine subtype we are compiling for.
243 Bits are tested using macros TARGET_... defined in the tm.h file
244 and set by `-m...' switches. Must be defined in rtlanal.c. */
246 extern int target_flags
;
248 /* Flags saying which kinds of debugging dump have been requested. */
251 int rtl_dump_and_exit
= 0;
252 int jump_opt_dump
= 0;
253 int addressof_dump
= 0;
257 int branch_prob_dump
= 0;
259 int combine_dump
= 0;
260 int regmove_dump
= 0;
262 int local_reg_dump
= 0;
263 int global_reg_dump
= 0;
265 int jump2_opt_dump
= 0;
267 int dbr_sched_dump
= 0;
269 int flag_print_asm_name
= 0;
271 int stack_reg_dump
= 0;
273 #ifdef MACHINE_DEPENDENT_REORG
274 int mach_dep_reorg_dump
= 0;
277 /* Name for output file of assembly code, specified with -o. */
281 /* Value of the -G xx switch, and whether it was passed or not. */
285 /* Type(s) of debugging information we are producing (if any).
286 See flags.h for the definitions of the different possible
287 types of debugging information. */
288 enum debug_info_type write_symbols
= NO_DEBUG
;
290 /* Level of debugging information we are producing. See flags.h
291 for the definitions of the different possible levels. */
292 enum debug_info_level debug_info_level
= DINFO_LEVEL_NONE
;
294 /* Nonzero means use GNU-only extensions in the generated symbolic
295 debugging information. */
296 /* Currently, this only has an effect when write_symbols is set to
297 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
298 int use_gnu_debug_info_extensions
= 0;
300 /* Nonzero means do optimizations. -O.
301 Particular numeric values stand for particular amounts of optimization;
302 thus, -O2 stores 2 here. However, the optimizations beyond the basic
303 ones are not controlled directly by this variable. Instead, they are
304 controlled by individual `flag_...' variables that are defaulted
305 based on this variable. */
309 /* Nonzero means optimize for size. -Os.
310 The only valid values are zero and non-zero. When optimize_size is
311 non-zero, optimize defaults to 2, but certain individual code
312 bloating optimizations are disabled. */
314 int optimize_size
= 0;
316 /* Number of error messages and warning messages so far. */
319 int warningcount
= 0;
322 /* Pointer to function to compute the name to use to print a declaration.
323 DECL is the declaration in question.
324 VERBOSITY determines what information will be printed:
325 0: DECL_NAME, demangled as necessary.
326 1: and scope information.
327 2: and any other information that might be interesting, such as function
328 parameter types in C++. */
330 char *(*decl_printable_name
) (/* tree decl, int verbosity */);
332 /* Pointer to function to compute rtl for a language-specific tree code. */
334 struct rtx_def
*(*lang_expand_expr
) ();
336 /* Pointer to function to finish handling an incomplete decl at the
337 end of compilation. */
339 void (*incomplete_decl_finalize_hook
) () = 0;
341 /* Highest label number used at the end of reload. */
343 int max_label_num_after_reload
;
345 /* Nonzero if generating code to do profiling. */
347 int profile_flag
= 0;
349 /* Nonzero if generating code to do profiling on a line-by-line basis. */
351 int profile_block_flag
;
353 /* Nonzero if generating code to profile program flow graph arcs. */
355 int profile_arc_flag
= 0;
357 /* Nonzero if generating info for gcov to calculate line test coverage. */
359 int flag_test_coverage
= 0;
361 /* Nonzero indicates that branch taken probabilities should be calculated. */
363 int flag_branch_probabilities
= 0;
365 /* Nonzero for -pedantic switch: warn about anything
366 that standard spec forbids. */
370 /* Temporarily suppress certain warnings.
371 This is set while reading code from a system header file. */
373 int in_system_header
= 0;
375 /* Nonzero means do stupid register allocation.
376 Currently, this is 1 if `optimize' is 0. */
378 int obey_regdecls
= 0;
380 /* Don't print functions as they are compiled and don't print
381 times taken by the various passes. -quiet. */
387 /* Nonzero means `char' should be signed. */
389 int flag_signed_char
;
391 /* Nonzero means give an enum type only as many bytes as it needs. */
393 int flag_short_enums
;
395 /* Nonzero for -fcaller-saves: allocate values in regs that need to
396 be saved across function calls, if that produces overall better code.
397 Optional now, so people can test it. */
399 #ifdef DEFAULT_CALLER_SAVES
400 int flag_caller_saves
= 1;
402 int flag_caller_saves
= 0;
405 /* Nonzero if structures and unions should be returned in memory.
407 This should only be defined if compatibility with another compiler or
408 with an ABI is needed, because it results in slower code. */
410 #ifndef DEFAULT_PCC_STRUCT_RETURN
411 #define DEFAULT_PCC_STRUCT_RETURN 1
414 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
416 int flag_pcc_struct_return
= DEFAULT_PCC_STRUCT_RETURN
;
418 /* Nonzero for -fforce-mem: load memory value into a register
419 before arithmetic on it. This makes better cse but slower compilation. */
421 int flag_force_mem
= 0;
423 /* Nonzero for -fforce-addr: load memory address into a register before
424 reference to memory. This makes better cse but slower compilation. */
426 int flag_force_addr
= 0;
428 /* Nonzero for -fdefer-pop: don't pop args after each function call;
429 instead save them up to pop many calls' args with one insns. */
431 int flag_defer_pop
= 0;
433 /* Nonzero for -ffloat-store: don't allocate floats and doubles
434 in extended-precision registers. */
436 int flag_float_store
= 0;
438 /* Nonzero for -fcse-follow-jumps:
439 have cse follow jumps to do a more extensive job. */
441 int flag_cse_follow_jumps
;
443 /* Nonzero for -fcse-skip-blocks:
444 have cse follow a branch around a block. */
445 int flag_cse_skip_blocks
;
447 /* Nonzero for -fexpensive-optimizations:
448 perform miscellaneous relatively-expensive optimizations. */
449 int flag_expensive_optimizations
;
451 /* Nonzero for -fthread-jumps:
452 have jump optimize output of loop. */
454 int flag_thread_jumps
;
456 /* Nonzero enables strength-reduction in loop.c. */
458 int flag_strength_reduce
= 0;
460 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
461 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
462 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
465 int flag_unroll_loops
;
467 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
468 This is generally not a win. */
470 int flag_unroll_all_loops
;
472 /* Nonzero forces all invariant computations in loops to be moved
475 int flag_move_all_movables
= 0;
477 /* Nonzero forces all general induction variables in loops to be
480 int flag_reduce_all_givs
= 0;
482 /* Nonzero for -fwritable-strings:
483 store string constants in data segment and don't uniquize them. */
485 int flag_writable_strings
= 0;
487 /* Nonzero means don't put addresses of constant functions in registers.
488 Used for compiling the Unix kernel, where strange substitutions are
489 done on the assembly output. */
491 int flag_no_function_cse
= 0;
493 /* Nonzero for -fomit-frame-pointer:
494 don't make a frame pointer in simple functions that don't require one. */
496 int flag_omit_frame_pointer
= 0;
498 /* Nonzero means place each function into its own section on those platforms
499 which support arbitrary section names and unlimited numbers of sections. */
501 int flag_function_sections
= 0;
503 /* Nonzero to inhibit use of define_optimization peephole opts. */
505 int flag_no_peephole
= 0;
507 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
508 operations in the interest of optimization. For example it allows
509 GCC to assume arguments to sqrt are nonnegative numbers, allowing
510 faster code for sqrt to be generated. */
512 int flag_fast_math
= 0;
514 /* Nonzero means all references through pointers are volatile. */
518 /* Nonzero means treat all global and extern variables as global. */
520 int flag_volatile_global
;
522 /* Nonzero means just do syntax checking; don't output anything. */
524 int flag_syntax_only
= 0;
526 /* Nonzero means to rerun cse after loop optimization. This increases
527 compilation time about 20% and picks up a few more common expressions. */
529 static int flag_rerun_cse_after_loop
;
531 /* Nonzero means to run loop optimizations twice. */
533 int flag_rerun_loop_opt
;
535 /* Nonzero for -finline-functions: ok to inline functions that look like
536 good inline candidates. */
538 int flag_inline_functions
;
540 /* Nonzero for -fkeep-inline-functions: even if we make a function
541 go inline everywhere, keep its definition around for debugging
544 int flag_keep_inline_functions
;
546 /* Nonzero means that functions will not be inlined. */
550 /* Nonzero means that we should emit static const variables
551 regardless of whether or not optimization is turned on. */
553 int flag_keep_static_consts
= 1;
555 /* Nonzero means we should be saving declaration info into a .X file. */
557 int flag_gen_aux_info
= 0;
559 /* Specified name of aux-info file. */
561 static char *aux_info_file_name
;
563 /* Nonzero means make the text shared if supported. */
565 int flag_shared_data
;
567 /* Nonzero means schedule into delayed branch slots if supported. */
569 int flag_delayed_branch
;
571 /* Nonzero if we are compiling pure (sharable) code.
572 Value is 1 if we are doing reasonable (i.e. simple
573 offset into offset table) pic. Value is 2 if we can
574 only perform register offsets. */
578 /* Nonzero means generate extra code for exception handling and enable
579 exception handling. */
581 int flag_exceptions
= 2;
583 /* Nonzero means don't place uninitialized global data in common storage
588 /* Nonzero means pretend it is OK to examine bits of target floats,
589 even if that isn't true. The resulting code will have incorrect constants,
590 but the same series of instructions that the native compiler would make. */
592 int flag_pretend_float
;
594 /* Nonzero means change certain warnings into errors.
595 Usually these are warnings about failure to conform to some standard. */
597 int flag_pedantic_errors
= 0;
599 /* flag_schedule_insns means schedule insns within basic blocks (before
601 flag_schedule_insns_after_reload means schedule insns after
604 int flag_schedule_insns
= 0;
605 int flag_schedule_insns_after_reload
= 0;
608 /* The following flags have effect only for scheduling before register
611 flag_schedule_interblock means schedule insns accross basic blocks.
612 flag_schedule_speculative means allow speculative motion of non-load insns.
613 flag_schedule_speculative_load means allow speculative motion of some
615 flag_schedule_speculative_load_dangerous allows speculative motion of more
618 int flag_schedule_interblock
= 1;
619 int flag_schedule_speculative
= 1;
620 int flag_schedule_speculative_load
= 0;
621 int flag_schedule_speculative_load_dangerous
= 0;
623 /* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple
624 by a cheaper branch, on a count register. */
625 int flag_branch_on_count_reg
;
629 /* -finhibit-size-directive inhibits output of .size for ELF.
630 This is used only for compiling crtstuff.c,
631 and it may be extended to other effects
632 needed for crtstuff.c on other systems. */
633 int flag_inhibit_size_directive
= 0;
635 /* -fverbose-asm causes extra commentary information to be produced in
636 the generated assembly code (to make it more readable). This option
637 is generally only of use to those who actually need to read the
638 generated assembly code (perhaps while debugging the compiler itself).
639 -fno-verbose-asm, the default, causes the extra information
640 to be omitted and is useful when comparing two assembler files. */
642 int flag_verbose_asm
= 0;
644 /* -dA causes debug commentary information to be produced in
645 the generated assembly code (to make it more readable). This option
646 is generally only of use to those who actually need to read the
647 generated assembly code (perhaps while debugging the compiler itself).
648 Currently, this switch is only used by dwarfout.c; however, it is intended
649 to be a catchall for printing debug information in the assembler file. */
651 int flag_debug_asm
= 0;
653 /* -fgnu-linker specifies use of the GNU linker for initializations.
654 (Or, more generally, a linker that handles initializations.)
655 -fno-gnu-linker says that collect2 will be used. */
657 int flag_gnu_linker
= 0;
659 int flag_gnu_linker
= 1;
662 /* Tag all structures with __attribute__(packed) */
663 int flag_pack_struct
= 0;
665 /* Emit code to check for stack overflow; also may cause large objects
666 to be allocated dynamically. */
667 int flag_stack_check
;
669 /* -fcheck-memory-usage causes extra code to be generated in order to check
670 memory accesses. This is used by a detector of bad memory accesses such
672 int flag_check_memory_usage
= 0;
674 /* -fprefix-function-name causes function name to be prefixed. This
675 can be used with -fcheck-memory-usage to isolate code compiled with
676 -fcheck-memory-usage. */
677 int flag_prefix_function_name
= 0;
679 int flag_regmove
= 0;
681 /* 0 if pointer arguments may alias each other. True in C.
682 1 if pointer arguments may not alias each other but may alias
684 2 if pointer arguments may not alias each other and may not
685 alias global variables. True in Fortran.
686 This defaults to 0 for C. */
687 int flag_argument_noalias
= 0;
689 /* Table of language-independent -f options.
690 STRING is the option name. VARIABLE is the address of the variable.
691 ON_VALUE is the value to store in VARIABLE
692 if `-fSTRING' is seen as an option.
693 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
695 struct { char *string
; int *variable
; int on_value
;} f_options
[] =
697 {"float-store", &flag_float_store
, 1},
698 {"volatile", &flag_volatile
, 1},
699 {"volatile-global", &flag_volatile_global
, 1},
700 {"defer-pop", &flag_defer_pop
, 1},
701 {"omit-frame-pointer", &flag_omit_frame_pointer
, 1},
702 {"cse-follow-jumps", &flag_cse_follow_jumps
, 1},
703 {"cse-skip-blocks", &flag_cse_skip_blocks
, 1},
704 {"expensive-optimizations", &flag_expensive_optimizations
, 1},
705 {"thread-jumps", &flag_thread_jumps
, 1},
706 {"strength-reduce", &flag_strength_reduce
, 1},
707 {"unroll-loops", &flag_unroll_loops
, 1},
708 {"unroll-all-loops", &flag_unroll_all_loops
, 1},
709 {"move-all-movables", &flag_move_all_movables
, 1},
710 {"reduce-all-givs", &flag_reduce_all_givs
, 1},
711 {"writable-strings", &flag_writable_strings
, 1},
712 {"peephole", &flag_no_peephole
, 0},
713 {"force-mem", &flag_force_mem
, 1},
714 {"force-addr", &flag_force_addr
, 1},
715 {"function-cse", &flag_no_function_cse
, 0},
716 {"inline-functions", &flag_inline_functions
, 1},
717 {"keep-inline-functions", &flag_keep_inline_functions
, 1},
718 {"inline", &flag_no_inline
, 0},
719 {"keep-static-consts", &flag_keep_static_consts
, 1},
720 {"syntax-only", &flag_syntax_only
, 1},
721 {"shared-data", &flag_shared_data
, 1},
722 {"caller-saves", &flag_caller_saves
, 1},
723 {"pcc-struct-return", &flag_pcc_struct_return
, 1},
724 {"reg-struct-return", &flag_pcc_struct_return
, 0},
725 {"delayed-branch", &flag_delayed_branch
, 1},
726 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop
, 1},
727 {"rerun-loop-opt", &flag_rerun_loop_opt
, 1},
728 {"pretend-float", &flag_pretend_float
, 1},
729 {"schedule-insns", &flag_schedule_insns
, 1},
730 {"schedule-insns2", &flag_schedule_insns_after_reload
, 1},
732 {"sched-interblock",&flag_schedule_interblock
, 1},
733 {"sched-spec",&flag_schedule_speculative
, 1},
734 {"sched-spec-load",&flag_schedule_speculative_load
, 1},
735 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous
, 1},
736 {"branch-count-reg",&flag_branch_on_count_reg
, 1},
738 {"pic", &flag_pic
, 1},
739 {"PIC", &flag_pic
, 2},
740 {"exceptions", &flag_exceptions
, 1},
741 {"sjlj-exceptions", &exceptions_via_longjmp
, 1},
742 {"asynchronous-exceptions", &asynchronous_exceptions
, 1},
743 {"profile-arcs", &profile_arc_flag
, 1},
744 {"test-coverage", &flag_test_coverage
, 1},
745 {"branch-probabilities", &flag_branch_probabilities
, 1},
746 {"fast-math", &flag_fast_math
, 1},
747 {"common", &flag_no_common
, 0},
748 {"inhibit-size-directive", &flag_inhibit_size_directive
, 1},
749 {"function-sections", &flag_function_sections
, 1},
750 {"verbose-asm", &flag_verbose_asm
, 1},
751 {"gnu-linker", &flag_gnu_linker
, 1},
752 {"regmove", &flag_regmove
, 1},
753 {"pack-struct", &flag_pack_struct
, 1},
754 {"stack-check", &flag_stack_check
, 1},
755 {"argument-alias", &flag_argument_noalias
, 0},
756 {"argument-noalias", &flag_argument_noalias
, 1},
757 {"argument-noalias-global", &flag_argument_noalias
, 2},
758 {"check-memory-usage", &flag_check_memory_usage
, 1},
759 {"prefix-function-name", &flag_prefix_function_name
, 1}
762 /* Table of language-specific options. */
764 char *lang_options
[] =
767 "-fallow-single-precision",
769 "-fsigned-bitfields",
770 "-funsigned-bitfields",
771 "-fno-signed-bitfields",
772 "-fno-unsigned-bitfields",
776 "-fno-unsigned-char",
792 "-fno-cond-mismatch",
793 "-fdollars-in-identifiers",
794 "-fno-dollars-in-identifiers",
803 "-Wbad-function-cast",
804 "-Wno-bad-function-cast",
808 "-Wno-char-subscripts",
819 "-Wimplicit-function-declaration",
820 "-Wno-implicit-function-declaration",
821 "-Werror-implicit-function-declaration",
829 "-Wno-missing-braces",
830 "-Wmissing-declarations",
831 "-Wno-missing-declarations",
832 "-Wmissing-prototypes",
833 "-Wno-missing-prototypes",
835 "-Wno-nested-externs",
839 "-Wno-pointer-arith",
841 "-Wno-redundant-decls",
845 "-Wno-unknown-pragmas",
846 "-Wstrict-prototypes",
847 "-Wno-strict-prototypes",
855 "-Wno-write-strings",
857 /* these are for obj c */
868 "-print-objc-runtime-info",
874 /* Options controlling warnings */
876 /* Don't print warning messages. -w. */
878 int inhibit_warnings
= 0;
880 /* Print various extra warnings. -W. */
882 int extra_warnings
= 0;
884 /* Treat warnings as errors. -Werror. */
886 int warnings_are_errors
= 0;
888 /* Nonzero to warn about unused local variables. */
892 /* Nonzero to warn about variables used before they are initialized. */
894 int warn_uninitialized
;
896 /* Nonzero means warn about all declarations which shadow others. */
900 /* Warn if a switch on an enum fails to have a case for every enum value. */
904 /* Nonzero means warn about function definitions that default the return type
905 or that use a null return and have a return-type other than void. */
907 int warn_return_type
;
909 /* Nonzero means warn about pointer casts that increase the required
910 alignment of the target type (and might therefore lead to a crash
911 due to a misaligned access). */
915 /* Nonzero means warn about any identifiers that match in the first N
916 characters. The value N is in `id_clash_len'. */
919 unsigned id_clash_len
;
921 /* Nonzero means warn about any objects definitions whose size is larger
922 than N bytes. Also want about function definitions whose returned
923 values are larger than N bytes. The value N is in `larger_than_size'. */
925 int warn_larger_than
;
926 unsigned larger_than_size
;
928 /* Nonzero means warn if inline function is too large. */
932 /* Warn if a function returns an aggregate,
933 since there are often incompatible calling conventions for doing this. */
935 int warn_aggregate_return
;
937 /* Likewise for -W. */
939 struct { char *string
; int *variable
; int on_value
;} W_options
[] =
941 {"unused", &warn_unused
, 1},
942 {"error", &warnings_are_errors
, 1},
943 {"shadow", &warn_shadow
, 1},
944 {"switch", &warn_switch
, 1},
945 {"aggregate-return", &warn_aggregate_return
, 1},
946 {"cast-align", &warn_cast_align
, 1},
947 {"uninitialized", &warn_uninitialized
, 1},
948 {"inline", &warn_inline
, 1}
951 /* Output files for assembler code (real compiler output)
952 and debugging dumps. */
956 FILE *rtl_dump_file
= NULL
;
958 /* Time accumulators, to count the total time spent in various passes. */
962 int integration_time
;
967 int branch_prob_time
;
972 int local_alloc_time
;
973 int global_alloc_time
;
978 int shorten_branch_time
;
984 /* Return time used so far, in microseconds. */
995 #if defined (_WIN32) && !defined (__CYGWIN32__)
999 return (clock() * 1000);
1000 #else /* not _WIN32 */
1006 tick
= 1000000 / sysconf(_SC_CLK_TCK
);
1008 return (tms
.tms_utime
+ tms
.tms_stime
) * tick
;
1014 # if HAVE_SYSCONF && defined _SC_CLK_TCK
1015 # define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */
1018 # define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */
1020 # define TICKS_PER_SECOND HZ /* traditional UNIX */
1024 return (tms
.tms_utime
+ tms
.tms_stime
) * (1000000 / TICKS_PER_SECOND
);
1029 struct rusage rusage
;
1030 getrusage (0, &rusage
);
1031 return (rusage
.ru_utime
.tv_sec
* 1000000 + rusage
.ru_utime
.tv_usec
1032 + rusage
.ru_stime
.tv_sec
* 1000000 + rusage
.ru_stime
.tv_usec
);
1039 int proc_system_time
;
1040 int child_user_time
;
1041 int child_system_time
;
1043 times ((void *) &vms_times
);
1044 return (vms_times
.proc_user_time
+ vms_times
.proc_system_time
) * 10000;
1048 #endif /* _SC_CLK_TCK */
1050 #endif /* __BEOS__ */
1053 #define TIMEVAR(VAR, BODY) \
1054 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
1057 print_time (str
, total
)
1062 "time in %s: %d.%06d\n",
1063 str
, total
/ 1000000, total
% 1000000);
1066 /* Count an error or warning. Return 1 if the message should be printed. */
1069 count_error (warningp
)
1072 if (warningp
&& inhibit_warnings
)
1075 if (warningp
&& !warnings_are_errors
)
1079 static int warning_message
= 0;
1081 if (warningp
&& !warning_message
)
1083 fprintf (stderr
, "%s: warnings being treated as errors\n", progname
);
1084 warning_message
= 1;
1092 /* Print a fatal error message. NAME is the text.
1093 Also include a system error message based on `errno'. */
1096 pfatal_with_name (name
)
1099 fprintf (stderr
, "%s: ", progname
);
1101 exit (FATAL_EXIT_CODE
);
1105 fatal_io_error (name
)
1108 fprintf (stderr
, "%s: %s: I/O error\n", progname
, name
);
1109 exit (FATAL_EXIT_CODE
);
1112 /* Called to give a better error message for a bad insn rather than
1113 just calling abort(). */
1116 fatal_insn (message
, insn
)
1123 fflush (asm_out_file
);
1125 fflush (aux_info_file
);
1126 if (rtl_dump_file
!= NULL
)
1127 fflush (rtl_dump_file
);
1133 /* Called to give a better error message when we don't have an insn to match
1134 what we are looking for or if the insn's constraints aren't satisfied,
1135 rather than just calling abort(). */
1138 fatal_insn_not_found (insn
)
1141 if (INSN_CODE (insn
) < 0)
1142 fatal_insn ("internal error--unrecognizable insn:", insn
);
1144 fatal_insn ("internal error--insn does not satisfy its constraints:", insn
);
1147 /* This is the default decl_printable_name function. */
1150 decl_name (decl
, verbosity
)
1154 return IDENTIFIER_POINTER (DECL_NAME (decl
));
1157 static int need_error_newline
;
1159 /* Function of last error message;
1160 more generally, function such that if next error message is in it
1161 then we don't have to mention the function name. */
1162 static tree last_error_function
= NULL
;
1164 /* Used to detect when input_file_stack has changed since last described. */
1165 static int last_error_tick
;
1167 /* Called when the start of a function definition is parsed,
1168 this function prints on stderr the name of the function. */
1171 announce_function (decl
)
1176 if (rtl_dump_and_exit
)
1177 fprintf (stderr
, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl
)));
1179 fprintf (stderr
, " %s", (*decl_printable_name
) (decl
, 2));
1181 need_error_newline
= 1;
1182 last_error_function
= current_function_decl
;
1186 /* The default function to print out name of current function that caused
1190 default_print_error_function (file
)
1193 if (last_error_function
!= current_function_decl
)
1195 char *kind
= "function";
1196 if (current_function_decl
!= 0
1197 && TREE_CODE (TREE_TYPE (current_function_decl
)) == METHOD_TYPE
)
1201 fprintf (stderr
, "%s: ", file
);
1203 if (current_function_decl
== NULL
)
1204 fprintf (stderr
, "At top level:\n");
1207 char *name
= (*decl_printable_name
) (current_function_decl
, 2);
1208 fprintf (stderr
, "In %s `%s':\n", kind
, name
);
1211 last_error_function
= current_function_decl
;
1215 /* Called by report_error_function to print out function name.
1216 * Default may be overridden by language front-ends. */
1218 void (*print_error_function
) PROTO((char *)) = default_print_error_function
;
1220 /* Prints out, if necessary, the name of the current function
1221 that caused an error. Called from all error and warning functions. */
1224 report_error_function (file
)
1227 struct file_stack
*p
;
1229 if (need_error_newline
)
1231 fprintf (stderr
, "\n");
1232 need_error_newline
= 0;
1235 (*print_error_function
) (file
);
1237 if (input_file_stack
&& input_file_stack
->next
!= 0
1238 && input_file_stack_tick
!= last_error_tick
1239 && file
== input_filename
)
1241 fprintf (stderr
, "In file included");
1242 for (p
= input_file_stack
->next
; p
; p
= p
->next
)
1244 fprintf (stderr
, " from %s:%d", p
->name
, p
->line
);
1246 fprintf (stderr
, ",\n ");
1248 fprintf (stderr
, ":\n");
1249 last_error_tick
= input_file_stack_tick
;
1253 /* Print a message. */
1256 vmessage (prefix
, s
, ap
)
1262 fprintf (stderr
, "%s: ", prefix
);
1265 vfprintf (stderr
, s
, ap
);
1268 HOST_WIDE_INT v1
= va_arg(ap
, HOST_WIDE_INT
);
1269 HOST_WIDE_INT v2
= va_arg(ap
, HOST_WIDE_INT
);
1270 HOST_WIDE_INT v3
= va_arg(ap
, HOST_WIDE_INT
);
1271 HOST_WIDE_INT v4
= va_arg(ap
, HOST_WIDE_INT
);
1272 fprintf (stderr
, s
, v1
, v2
, v3
, v4
);
1277 /* Print a message relevant to line LINE of file FILE. */
1280 v_message_with_file_and_line (file
, line
, prefix
, s
, ap
)
1288 fprintf (stderr
, "%s:%d: ", file
, line
);
1290 fprintf (stderr
, "%s: ", progname
);
1292 vmessage (prefix
, s
, ap
);
1293 fputc ('\n', stderr
);
1296 /* Print a message relevant to the given DECL. */
1299 v_message_with_decl (decl
, prefix
, s
, ap
)
1307 fprintf (stderr
, "%s:%d: ",
1308 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
1311 fprintf (stderr
, "%s: ", prefix
);
1313 /* Do magic to get around lack of varargs support for insertion
1314 of arguments into existing list. We know that the decl is first;
1315 we ass_u_me that it will be printed with "%s". */
1317 for (p
= s
; *p
; ++p
)
1321 if (*(p
+ 1) == '%')
1328 if (p
> s
) /* Print the left-hand substring. */
1330 char fmt
[sizeof "%.255s"];
1333 if (width
> 255L) width
= 255L; /* arbitrary */
1334 sprintf (fmt
, "%%.%lds", width
);
1335 fprintf (stderr
, fmt
, s
);
1338 if (*p
== '%') /* Print the name. */
1340 char *n
= (DECL_NAME (decl
)
1341 ? (*decl_printable_name
) (decl
, 2)
1347 if (isalpha (*(p
- 1) & 0xFF))
1352 if (*p
) /* Print the rest of the message. */
1353 vmessage ((char *)NULL
, p
, ap
);
1355 fputc ('\n', stderr
);
1358 /* Figure file and line of the given INSN. */
1361 file_and_line_for_asm (insn
, pfile
, pline
)
1366 rtx body
= PATTERN (insn
);
1369 /* Find the (or one of the) ASM_OPERANDS in the insn. */
1370 if (GET_CODE (body
) == SET
&& GET_CODE (SET_SRC (body
)) == ASM_OPERANDS
)
1371 asmop
= SET_SRC (body
);
1372 else if (GET_CODE (body
) == ASM_OPERANDS
)
1374 else if (GET_CODE (body
) == PARALLEL
1375 && GET_CODE (XVECEXP (body
, 0, 0)) == SET
)
1376 asmop
= SET_SRC (XVECEXP (body
, 0, 0));
1377 else if (GET_CODE (body
) == PARALLEL
1378 && GET_CODE (XVECEXP (body
, 0, 0)) == ASM_OPERANDS
)
1379 asmop
= XVECEXP (body
, 0, 0);
1385 *pfile
= ASM_OPERANDS_SOURCE_FILE (asmop
);
1386 *pline
= ASM_OPERANDS_SOURCE_LINE (asmop
);
1390 *pfile
= input_filename
;
1395 /* Report an error at line LINE of file FILE. */
1398 v_error_with_file_and_line (file
, line
, s
, ap
)
1405 report_error_function (file
);
1406 v_message_with_file_and_line (file
, line
, (char *)NULL
, s
, ap
);
1410 error_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1422 file
= va_arg (ap
, char *);
1423 line
= va_arg (ap
, int);
1424 s
= va_arg (ap
, char *);
1427 v_error_with_file_and_line (file
, line
, s
, ap
);
1431 /* Report an error at the declaration DECL.
1432 S is a format string which uses %s to substitute the declaration
1433 name; subsequent substitutions are a la printf. */
1436 v_error_with_decl (decl
, s
, ap
)
1442 report_error_function (DECL_SOURCE_FILE (decl
));
1443 v_message_with_decl (decl
, (char *)NULL
, s
, ap
);
1447 error_with_decl
VPROTO((tree decl
, char *s
, ...))
1458 decl
= va_arg (ap
, tree
);
1459 s
= va_arg (ap
, char *);
1462 v_error_with_decl (decl
, s
, ap
);
1466 /* Report an error at the line number of the insn INSN.
1467 This is used only when INSN is an `asm' with operands,
1468 and each ASM_OPERANDS records its own source file and line. */
1471 v_error_for_asm (insn
, s
, ap
)
1480 file_and_line_for_asm (insn
, &file
, &line
);
1481 report_error_function (file
);
1482 v_message_with_file_and_line (file
, line
, (char *)NULL
, s
, ap
);
1486 error_for_asm
VPROTO((rtx insn
, char *s
, ...))
1497 insn
= va_arg (ap
, rtx
);
1498 s
= va_arg (ap
, char *);
1501 v_error_for_asm (insn
, s
, ap
);
1505 /* Report an error at the current line number. */
1512 v_error_with_file_and_line (input_filename
, lineno
, s
, ap
);
1516 error
VPROTO((char *s
, ...))
1526 s
= va_arg (ap
, char *);
1533 /* Report a fatal error at the current line number. */
1541 exit (FATAL_EXIT_CODE
);
1545 fatal
VPROTO((char *s
, ...))
1555 s
= va_arg (ap
, char *);
1562 /* Report a warning at line LINE of file FILE. */
1565 v_warning_with_file_and_line (file
, line
, s
, ap
)
1571 if (count_error (1))
1573 report_error_function (file
);
1574 v_message_with_file_and_line (file
, line
, "warning", s
, ap
);
1579 warning_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1591 file
= va_arg (ap
, char *);
1592 line
= va_arg (ap
, int);
1593 s
= va_arg (ap
, char *);
1596 v_warning_with_file_and_line (file
, line
, s
, ap
);
1600 /* Report a warning at the declaration DECL.
1601 S is a format string which uses %s to substitute the declaration
1602 name; subsequent substitutions are a la printf. */
1605 v_warning_with_decl (decl
, s
, ap
)
1610 if (count_error (1))
1612 report_error_function (DECL_SOURCE_FILE (decl
));
1613 v_message_with_decl (decl
, "warning", s
, ap
);
1618 warning_with_decl
VPROTO((tree decl
, char *s
, ...))
1629 decl
= va_arg (ap
, tree
);
1630 s
= va_arg (ap
, char *);
1633 v_warning_with_decl (decl
, s
, ap
);
1637 /* Report a warning at the line number of the insn INSN.
1638 This is used only when INSN is an `asm' with operands,
1639 and each ASM_OPERANDS records its own source file and line. */
1642 v_warning_for_asm (insn
, s
, ap
)
1647 if (count_error (1))
1652 file_and_line_for_asm (insn
, &file
, &line
);
1653 report_error_function (file
);
1654 v_message_with_file_and_line (file
, line
, "warning", s
, ap
);
1659 warning_for_asm
VPROTO((rtx insn
, char *s
, ...))
1670 insn
= va_arg (ap
, rtx
);
1671 s
= va_arg (ap
, char *);
1674 v_warning_for_asm (insn
, s
, ap
);
1678 /* Report a warning at the current line number. */
1685 v_warning_with_file_and_line (input_filename
, lineno
, s
, ap
);
1689 warning
VPROTO((char *s
, ...))
1699 s
= va_arg (ap
, char *);
1706 /* These functions issue either warnings or errors depending on
1707 -pedantic-errors. */
1714 if (flag_pedantic_errors
)
1721 pedwarn
VPROTO((char *s
, ...))
1731 s
= va_arg (ap
, char *);
1739 v_pedwarn_with_decl (decl
, s
, ap
)
1744 /* We don't want -pedantic-errors to cause the compilation to fail from
1745 "errors" in system header files. Sometimes fixincludes can't fix what's
1746 broken (eg: unsigned char bitfields - fixing it may change the alignment
1747 which will cause programs to mysteriously fail because the C library
1748 or kernel uses the original layout). There's no point in issuing a
1749 warning either, it's just unnecessary noise. */
1751 if (! DECL_IN_SYSTEM_HEADER (decl
))
1753 if (flag_pedantic_errors
)
1754 v_error_with_decl (decl
, s
, ap
);
1756 v_warning_with_decl (decl
, s
, ap
);
1761 pedwarn_with_decl
VPROTO((tree decl
, char *s
, ...))
1772 decl
= va_arg (ap
, tree
);
1773 s
= va_arg (ap
, char *);
1776 v_pedwarn_with_decl (decl
, s
, ap
);
1781 v_pedwarn_with_file_and_line (file
, line
, s
, ap
)
1787 if (flag_pedantic_errors
)
1788 v_error_with_file_and_line (file
, line
, s
, ap
);
1790 v_warning_with_file_and_line (file
, line
, s
, ap
);
1794 pedwarn_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1806 file
= va_arg (ap
, char *);
1807 line
= va_arg (ap
, int);
1808 s
= va_arg (ap
, char *);
1811 v_pedwarn_with_file_and_line (file
, line
, s
, ap
);
1815 /* Apologize for not implementing some feature. */
1824 fprintf (stderr
, "%s:%d: ", input_filename
, lineno
);
1826 fprintf (stderr
, "%s: ", progname
);
1827 vmessage ("sorry, not implemented", s
, ap
);
1828 fputc ('\n', stderr
);
1832 sorry
VPROTO((char *s
, ...))
1842 s
= va_arg (ap
, char *);
1849 /* Apologize for not implementing some feature, then quit. */
1852 v_really_sorry (s
, ap
)
1858 fprintf (stderr
, "%s:%d: ", input_filename
, lineno
);
1860 fprintf (stderr
, "%s: ", progname
);
1861 vmessage ("sorry, not implemented", s
, ap
);
1862 fatal (" (fatal)\n");
1866 really_sorry
VPROTO((char *s
, ...))
1876 s
= va_arg (ap
, char *);
1879 v_really_sorry (s
, ap
);
1883 /* More 'friendly' abort that prints the line and file.
1884 config.h can #define abort fancy_abort if you like that sort of thing.
1886 I don't think this is actually a good idea.
1887 Other sorts of crashes will look a certain way.
1888 It is a good thing if crashes from calling abort look the same way.
1894 fatal ("internal gcc abort");
1897 /* This calls abort and is used to avoid problems when abort if a macro.
1898 It is used when we need to pass the address of abort. */
1906 /* When `malloc.c' is compiled with `rcheck' defined,
1907 it calls this function to report clobberage. */
1916 /* Same as `malloc' but report error if no memory available. */
1922 register char *value
= (char *) malloc (size
);
1923 if (value
== 0 && size
!= 0)
1924 fatal ("virtual memory exhausted");
1928 /* Same as `realloc' but report error if no memory available.
1929 Also handle null PTR even if the vendor realloc gets it wrong. */
1932 xrealloc (ptr
, size
)
1937 ? (char *) realloc (ptr
, size
)
1938 : (char *) malloc (size
));
1940 fatal ("virtual memory exhausted");
1944 /* Same as `strdup' but report error if no memory available. */
1950 register char *result
= (char *) malloc (strlen (s
) + 1);
1953 fatal ("virtual memory exhausted");
1958 /* Return the logarithm of X, base 2, considering X unsigned,
1959 if X is a power of 2. Otherwise, returns -1.
1961 This should be used via the `exact_log2' macro. */
1965 register unsigned HOST_WIDE_INT x
;
1967 register int log
= 0;
1968 /* Test for 0 or a power of 2. */
1969 if (x
== 0 || x
!= (x
& -x
))
1971 while ((x
>>= 1) != 0)
1976 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1977 If X is 0, return -1.
1979 This should be used via the floor_log2 macro. */
1983 register unsigned HOST_WIDE_INT x
;
1985 register int log
= -1;
1992 static int float_handler_set
;
1994 jmp_buf float_handler
;
1996 /* Signals actually come here. */
1999 float_signal (signo
)
2000 /* If this is missing, some compilers complain. */
2003 if (float_handled
== 0)
2005 #if defined (USG) || defined (hpux)
2006 signal (SIGFPE
, float_signal
); /* re-enable the signal catcher */
2009 signal (SIGFPE
, float_signal
);
2010 longjmp (float_handler
, 1);
2013 /* Specify where to longjmp to when a floating arithmetic error happens.
2014 If HANDLER is 0, it means don't handle the errors any more. */
2017 set_float_handler (handler
)
2020 float_handled
= (handler
!= 0);
2022 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2024 if (float_handled
&& ! float_handler_set
)
2026 signal (SIGFPE
, float_signal
);
2027 float_handler_set
= 1;
2031 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
2032 error happens, pushing the previous specification into OLD_HANDLER.
2033 Return an indication of whether there was a previous handler in effect. */
2036 push_float_handler (handler
, old_handler
)
2037 jmp_buf handler
, old_handler
;
2039 int was_handled
= float_handled
;
2043 bcopy ((char *) float_handler
, (char *) old_handler
,
2044 sizeof (float_handler
));
2046 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2050 /* Restore the previous specification of whether and where to longjmp to
2051 when a floating arithmetic error happens. */
2054 pop_float_handler (handled
, handler
)
2058 float_handled
= handled
;
2060 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2063 /* Handler for SIGPIPE. */
2067 /* If this is missing, some compilers complain. */
2070 fatal ("output pipe has been closed");
2073 /* Strip off a legitimate source ending from the input string NAME of
2074 length LEN. Rather than having to know the names used by all of
2075 our front ends, we strip off an ending of a period followed by
2076 up to five characters. (Java uses ".class".) */
2079 strip_off_ending (name
, len
)
2084 for (i
= 2; i
< 6 && len
> i
; i
++)
2086 if (name
[len
- i
] == '.')
2088 name
[len
- i
] = '\0';
2094 /* Output a quoted string. */
2097 output_quoted_string (asm_file
, string
)
2101 #ifdef OUTPUT_QUOTED_STRING
2102 OUTPUT_QUOTED_STRING (asm_file
, string
);
2106 putc ('\"', asm_file
);
2107 while ((c
= *string
++) != 0)
2109 if (c
== '\"' || c
== '\\')
2110 putc ('\\', asm_file
);
2113 putc ('\"', asm_file
);
2117 /* Output a file name in the form wanted by System V. */
2120 output_file_directive (asm_file
, input_name
)
2124 int len
= strlen (input_name
);
2125 char *na
= input_name
+ len
;
2127 /* NA gets INPUT_NAME sans directory names. */
2128 while (na
> input_name
)
2135 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
2136 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file
, na
);
2138 #ifdef ASM_OUTPUT_SOURCE_FILENAME
2139 ASM_OUTPUT_SOURCE_FILENAME (asm_file
, na
);
2141 fprintf (asm_file
, "\t.file\t");
2142 output_quoted_string (asm_file
, na
);
2143 fputc ('\n', asm_file
);
2148 /* Routine to build language identifier for object file. */
2151 output_lang_identify (asm_out_file
)
2154 int len
= strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
2155 char *s
= (char *) alloca (len
);
2156 sprintf (s
, "__gnu_compiled_%s", lang_identify ());
2157 ASM_OUTPUT_LABEL (asm_out_file
, s
);
2160 /* Routine to open a dump file. */
2162 open_dump_file (suffix
, function_name
)
2164 char *function_name
;
2171 dumpname
= (char *) xmalloc (strlen (dump_base_name
) + strlen (suffix
) + 1);
2173 if (rtl_dump_file
!= NULL
)
2174 fclose (rtl_dump_file
);
2176 strcpy (dumpname
, dump_base_name
);
2177 strcat (dumpname
, suffix
);
2179 rtl_dump_file
= fopen (dumpname
, "a");
2181 if (rtl_dump_file
== NULL
)
2182 pfatal_with_name (dumpname
);
2187 fprintf (rtl_dump_file
, "\n;; Function %s\n\n", function_name
);
2193 /* Routine to close a dump file. */
2195 close_dump_file (func
, insns
)
2196 void (*func
) PROTO ((FILE *, rtx
));
2203 func (rtl_dump_file
, insns
);
2205 fflush (rtl_dump_file
);
2206 fclose (rtl_dump_file
);
2208 rtl_dump_file
= NULL
;
2214 /* Routine to dump rtl into a file. */
2216 dump_rtl (suffix
, decl
, func
, insns
)
2219 void (*func
) PROTO ((FILE *, rtx
));
2222 open_dump_file (suffix
, decl_printable_name (decl
, 2));
2223 close_dump_file (func
, insns
);
2226 /* Routine to empty a dump file. */
2228 clean_dump_file (suffix
)
2233 dumpname
= (char *) xmalloc (strlen (dump_base_name
) + strlen (suffix
) + 1);
2235 strcpy (dumpname
, dump_base_name
);
2236 strcat (dumpname
, suffix
);
2238 rtl_dump_file
= fopen (dumpname
, "w");
2240 if (rtl_dump_file
== NULL
)
2241 pfatal_with_name (dumpname
);
2245 fclose (rtl_dump_file
);
2246 rtl_dump_file
= NULL
;
2252 /* Compile an entire file of output from cpp, named NAME.
2253 Write a file of assembly output and various debugging dumps. */
2262 int name_specified
= name
!= 0;
2264 if (dump_base_name
== 0)
2265 dump_base_name
= name
? name
: "gccdump";
2269 integration_time
= 0;
2274 branch_prob_time
= 0;
2279 local_alloc_time
= 0;
2280 global_alloc_time
= 0;
2285 shorten_branch_time
= 0;
2291 /* Initialize data in various passes. */
2295 name
= init_parse (name
);
2297 init_emit_once (debug_info_level
== DINFO_LEVEL_NORMAL
2298 || debug_info_level
== DINFO_LEVEL_VERBOSE
2299 || flag_test_coverage
);
2301 init_decl_processing ();
2310 if (flag_caller_saves
)
2311 init_caller_save ();
2313 /* If auxiliary info generation is desired, open the output file.
2314 This goes in the same directory as the source file--unlike
2315 all the other output files. */
2316 if (flag_gen_aux_info
)
2318 aux_info_file
= fopen (aux_info_file_name
, "w");
2319 if (aux_info_file
== 0)
2320 pfatal_with_name (aux_info_file_name
);
2323 /* Clear the dump files file. */
2325 clean_dump_file (".rtl");
2327 clean_dump_file (".jump");
2329 clean_dump_file (".addressof");
2331 clean_dump_file (".cse");
2333 clean_dump_file (".loop");
2335 clean_dump_file (".cse2");
2336 if (branch_prob_dump
)
2337 clean_dump_file (".bp");
2339 clean_dump_file (".flow");
2341 clean_dump_file (".combine");
2343 clean_dump_file (".regmove");
2345 clean_dump_file (".sched");
2347 clean_dump_file (".lreg");
2348 if (global_reg_dump
)
2349 clean_dump_file (".greg");
2351 clean_dump_file (".sched2");
2353 clean_dump_file (".jump2");
2356 clean_dump_file (".dbr");
2360 clean_dump_file (".stack");
2362 #ifdef MACHINE_DEPENDENT_REORG
2363 if (mach_dep_reorg_dump
)
2364 clean_dump_file (".mach");
2367 /* Open assembler code output file. */
2369 if (! name_specified
&& asm_file_name
== 0)
2370 asm_out_file
= stdout
;
2373 int len
= strlen (dump_base_name
);
2374 register char *dumpname
= (char *) xmalloc (len
+ 6);
2375 strcpy (dumpname
, dump_base_name
);
2376 strip_off_ending (dumpname
, len
);
2377 strcat (dumpname
, ".s");
2378 if (asm_file_name
== 0)
2380 asm_file_name
= (char *) xmalloc (strlen (dumpname
) + 1);
2381 strcpy (asm_file_name
, dumpname
);
2383 if (!strcmp (asm_file_name
, "-"))
2384 asm_out_file
= stdout
;
2386 asm_out_file
= fopen (asm_file_name
, "w");
2387 if (asm_out_file
== 0)
2388 pfatal_with_name (asm_file_name
);
2391 #ifdef IO_BUFFER_SIZE
2392 setvbuf (asm_out_file
, (char *) xmalloc (IO_BUFFER_SIZE
),
2393 _IOFBF
, IO_BUFFER_SIZE
);
2396 input_filename
= name
;
2398 /* Put an entry on the input file stack for the main input file. */
2400 = (struct file_stack
*) xmalloc (sizeof (struct file_stack
));
2401 input_file_stack
->next
= 0;
2402 input_file_stack
->name
= input_filename
;
2404 /* Gross. Gross. lang_init is (I think) the first callback into
2405 the language front end, and is thus the first opportunity to
2406 have the selected language override the default value for any
2409 So the default value for flag_exceptions is 2 (uninitialized).
2410 If we encounter -fno-exceptions or -fexceptions, then flag_exceptions
2411 will be set to zero or one respectively.
2413 flag_exceptions can also be set by lang_init to something other
2414 than the default "uninitialized" value of 2.
2416 After lang_init, if the value is still 2, then we default to
2417 -fno-exceptions (value will be reset to zero).
2419 When our EH mechanism is low enough overhead that we can enable
2420 it by default for languages other than C++, then all this braindamage
2423 /* Perform language-specific initialization.
2424 This may set main_input_filename. */
2427 if (flag_exceptions
== 2)
2428 flag_exceptions
= 0;
2430 /* If the input doesn't start with a #line, use the input name
2431 as the official input file name. */
2432 if (main_input_filename
== 0)
2433 main_input_filename
= name
;
2435 ASM_FILE_START (asm_out_file
);
2437 #ifdef ASM_COMMENT_START
2438 if (flag_verbose_asm
)
2440 /* Print the list of options in effect. */
2441 print_version (asm_out_file
, ASM_COMMENT_START
);
2442 print_switch_values (asm_out_file
, 0, MAX_LINE
,
2443 ASM_COMMENT_START
, " ", "\n");
2444 /* Add a blank line here so it appears in assembler output but not
2446 fprintf (asm_out_file
, "\n");
2450 /* Output something to inform GDB that this compilation was by GCC. */
2451 #ifndef ASM_IDENTIFY_GCC
2452 fprintf (asm_out_file
, "gcc2_compiled.:\n");
2454 ASM_IDENTIFY_GCC (asm_out_file
);
2457 /* Output something to identify which front-end produced this file. */
2458 #ifdef ASM_IDENTIFY_LANGUAGE
2459 ASM_IDENTIFY_LANGUAGE (asm_out_file
);
2462 #ifndef ASM_OUTPUT_SECTION_NAME
2463 if (flag_function_sections
)
2465 warning ("-ffunction-sections not supported for this target.");
2466 flag_function_sections
= 0;
2470 if (flag_function_sections
2471 && (profile_flag
|| profile_block_flag
))
2473 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2474 flag_function_sections
= 0;
2477 if (flag_function_sections
&& write_symbols
!= NO_DEBUG
)
2478 warning ("-ffunction-sections may affect debugging on some targets.");
2480 /* ??? Note: There used to be a conditional here
2481 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2482 This was to guarantee separation between gcc_compiled. and
2483 the first function, for the sake of dbx on Suns.
2484 However, having the extra zero here confused the Emacs
2485 code for unexec, and might confuse other programs too.
2486 Therefore, I took out that change.
2487 In future versions we should find another way to solve
2488 that dbx problem. -- rms, 23 May 93. */
2490 /* Don't let the first function fall at the same address
2491 as gcc_compiled., if profiling. */
2492 if (profile_flag
|| profile_block_flag
)
2494 /* It's best if we can write a nop here since some
2495 assemblers don't tolerate zeros in the text section. */
2496 if (insn_template
[CODE_FOR_nop
] != 0)
2497 output_asm_insn (insn_template
[CODE_FOR_nop
], NULL_PTR
);
2499 assemble_zeros (UNITS_PER_WORD
);
2502 /* If dbx symbol table desired, initialize writing it
2503 and output the predefined types. */
2504 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2505 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2506 TIMEVAR (symout_time
, dbxout_init (asm_out_file
, main_input_filename
,
2509 #ifdef SDB_DEBUGGING_INFO
2510 if (write_symbols
== SDB_DEBUG
)
2511 TIMEVAR (symout_time
, sdbout_init (asm_out_file
, main_input_filename
,
2514 #ifdef DWARF_DEBUGGING_INFO
2515 if (write_symbols
== DWARF_DEBUG
)
2516 TIMEVAR (symout_time
, dwarfout_init (asm_out_file
, main_input_filename
));
2518 #ifdef DWARF2_UNWIND_INFO
2519 if (dwarf2out_do_frame ())
2520 dwarf2out_frame_init ();
2522 #ifdef DWARF2_DEBUGGING_INFO
2523 if (write_symbols
== DWARF2_DEBUG
)
2524 TIMEVAR (symout_time
, dwarf2out_init (asm_out_file
, main_input_filename
));
2527 /* Initialize yet another pass. */
2529 init_final (main_input_filename
);
2530 init_branch_prob (dump_base_name
);
2532 start_time
= get_run_time ();
2534 /* Call the parser, which parses the entire file
2535 (calling rest_of_compilation for each function). */
2537 if (yyparse () != 0)
2539 if (errorcount
== 0)
2540 fprintf (stderr
, "Errors detected in input file (your bison.simple is out of date)");
2542 /* In case there were missing closebraces,
2543 get us back to the global binding level. */
2544 while (! global_bindings_p ())
2548 output_func_start_profiler ();
2550 /* Compilation is now finished except for writing
2551 what's left of the symbol table output. */
2553 parse_time
+= get_run_time () - start_time
;
2555 parse_time
-= integration_time
;
2556 parse_time
-= varconst_time
;
2558 globals
= getdecls ();
2560 /* Really define vars that have had only a tentative definition.
2561 Really output inline functions that must actually be callable
2562 and have not been output so far. */
2565 int len
= list_length (globals
);
2566 tree
*vec
= (tree
*) alloca (sizeof (tree
) * len
);
2571 /* Process the decls in reverse order--earliest first.
2572 Put them into VEC from back to front, then take out from front. */
2574 for (i
= 0, decl
= globals
; i
< len
; i
++, decl
= TREE_CHAIN (decl
))
2575 vec
[len
- i
- 1] = decl
;
2577 for (i
= 0; i
< len
; i
++)
2581 /* We're not deferring this any longer. */
2582 DECL_DEFER_OUTPUT (decl
) = 0;
2584 if (TREE_CODE (decl
) == VAR_DECL
&& DECL_SIZE (decl
) == 0
2585 && incomplete_decl_finalize_hook
!= 0)
2586 (*incomplete_decl_finalize_hook
) (decl
);
2589 /* Now emit any global variables or functions that we have been putting
2590 off. We need to loop in case one of the things emitted here
2591 references another one which comes earlier in the list. */
2595 for (i
= 0; i
< len
; i
++)
2599 if (TREE_ASM_WRITTEN (decl
) || DECL_EXTERNAL (decl
))
2602 /* Don't write out static consts, unless we still need them.
2604 We also keep static consts if not optimizing (for debugging),
2605 unless the user specified -fno-keep-static-consts.
2606 ??? They might be better written into the debug information.
2607 This is possible when using DWARF.
2609 A language processor that wants static constants to be always
2610 written out (even if it is not used) is responsible for
2611 calling rest_of_decl_compilation itself. E.g. the C front-end
2612 calls rest_of_decl_compilation from finish_decl.
2613 One motivation for this is that is conventional in some
2614 environments to write things like:
2615 static const char rcsid[] = "... version string ...";
2616 intending to force the string to be in the executable.
2618 A language processor that would prefer to have unneeded
2619 static constants "optimized away" would just defer writing
2620 them out until here. E.g. C++ does this, because static
2621 constants are often defined in header files.
2623 ??? A tempting alternative (for both C and C++) would be
2624 to force a constant to be written if and only if it is
2625 defined in a main file, as opposed to an include file. */
2627 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
2628 && (! TREE_READONLY (decl
)
2629 || TREE_PUBLIC (decl
)
2630 || (!optimize
&& flag_keep_static_consts
)
2631 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
2634 rest_of_decl_compilation (decl
, NULL_PTR
, 1, 1);
2637 if (TREE_CODE (decl
) == FUNCTION_DECL
2638 && DECL_INITIAL (decl
) != 0
2639 && DECL_SAVED_INSNS (decl
) != 0
2640 && (flag_keep_inline_functions
2641 || TREE_PUBLIC (decl
)
2642 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
2645 temporary_allocation ();
2646 output_inline_function (decl
);
2647 permanent_allocation (1);
2652 /* Now that all possible functions have been output, we can dump
2653 the exception table. */
2655 output_exception_table ();
2657 for (i
= 0; i
< len
; i
++)
2661 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
2662 && ! TREE_ASM_WRITTEN (decl
))
2663 /* Cancel the RTL for this decl so that, if debugging info
2664 output for global variables is still to come,
2665 this one will be omitted. */
2666 DECL_RTL (decl
) = NULL
;
2668 /* Warn about any function
2669 declared static but not defined.
2670 We don't warn about variables,
2671 because many programs have static variables
2672 that exist only to get some text into the object file. */
2673 if (TREE_CODE (decl
) == FUNCTION_DECL
2675 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
)))
2676 && DECL_INITIAL (decl
) == 0
2677 && DECL_EXTERNAL (decl
)
2678 && ! DECL_ARTIFICIAL (decl
)
2679 && ! TREE_PUBLIC (decl
))
2681 pedwarn_with_decl (decl
,
2682 "`%s' declared `static' but never defined");
2683 /* This symbol is effectively an "extern" declaration now. */
2684 TREE_PUBLIC (decl
) = 1;
2685 assemble_external (decl
);
2688 /* Warn about static fns or vars defined but not used,
2689 but not about inline functions or static consts
2690 since defining those in header files is normal practice. */
2692 && ((TREE_CODE (decl
) == FUNCTION_DECL
&& ! DECL_INLINE (decl
))
2693 || (TREE_CODE (decl
) == VAR_DECL
&& ! TREE_READONLY (decl
)))
2694 && ! DECL_IN_SYSTEM_HEADER (decl
)
2695 && ! DECL_EXTERNAL (decl
)
2696 && ! TREE_PUBLIC (decl
)
2697 && ! TREE_USED (decl
)
2698 && (TREE_CODE (decl
) == FUNCTION_DECL
|| ! DECL_REGISTER (decl
))
2699 /* The TREE_USED bit for file-scope decls
2700 is kept in the identifier, to handle multiple
2701 external decls in different scopes. */
2702 && ! TREE_USED (DECL_NAME (decl
)))
2703 warning_with_decl (decl
, "`%s' defined but not used");
2705 #ifdef SDB_DEBUGGING_INFO
2706 /* The COFF linker can move initialized global vars to the end.
2707 And that can screw up the symbol ordering.
2708 By putting the symbols in that order to begin with,
2709 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
2710 if (write_symbols
== SDB_DEBUG
&& TREE_CODE (decl
) == VAR_DECL
2711 && TREE_PUBLIC (decl
) && DECL_INITIAL (decl
)
2712 && ! DECL_EXTERNAL (decl
)
2713 && DECL_RTL (decl
) != 0)
2714 TIMEVAR (symout_time
, sdbout_symbol (decl
, 0));
2716 /* Output COFF information for non-global
2717 file-scope initialized variables. */
2718 if (write_symbols
== SDB_DEBUG
2719 && TREE_CODE (decl
) == VAR_DECL
2720 && DECL_INITIAL (decl
)
2721 && ! DECL_EXTERNAL (decl
)
2722 && DECL_RTL (decl
) != 0
2723 && GET_CODE (DECL_RTL (decl
)) == MEM
)
2724 TIMEVAR (symout_time
, sdbout_toplevel_data (decl
));
2725 #endif /* SDB_DEBUGGING_INFO */
2726 #ifdef DWARF_DEBUGGING_INFO
2727 /* Output DWARF information for file-scope tentative data object
2728 declarations, file-scope (extern) function declarations (which
2729 had no corresponding body) and file-scope tagged type declarations
2730 and definitions which have not yet been forced out. */
2732 if (write_symbols
== DWARF_DEBUG
2733 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
2734 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 1));
2736 #ifdef DWARF2_DEBUGGING_INFO
2737 /* Output DWARF2 information for file-scope tentative data object
2738 declarations, file-scope (extern) function declarations (which
2739 had no corresponding body) and file-scope tagged type declarations
2740 and definitions which have not yet been forced out. */
2742 if (write_symbols
== DWARF2_DEBUG
2743 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
2744 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
2749 /* Write out any pending weak symbol declarations. */
2753 /* Do dbx symbols */
2754 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2755 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2756 TIMEVAR (symout_time
,
2758 dbxout_finish (asm_out_file
, main_input_filename
);
2762 #ifdef DWARF_DEBUGGING_INFO
2763 if (write_symbols
== DWARF_DEBUG
)
2764 TIMEVAR (symout_time
,
2770 #ifdef DWARF2_UNWIND_INFO
2771 if (dwarf2out_do_frame ())
2772 dwarf2out_frame_finish ();
2775 #ifdef DWARF2_DEBUGGING_INFO
2776 if (write_symbols
== DWARF2_DEBUG
)
2777 TIMEVAR (symout_time
,
2779 dwarf2out_finish ();
2783 /* Output some stuff at end of file if nec. */
2785 end_final (dump_base_name
);
2787 if (branch_prob_dump
)
2788 open_dump_file (".bp", NULL
);
2790 TIMEVAR (dump_time
, end_branch_prob (rtl_dump_file
));
2792 if (branch_prob_dump
)
2793 close_dump_file (NULL
, NULL_RTX
);
2796 ASM_FILE_END (asm_out_file
);
2799 /* Language-specific end of compilation actions. */
2803 /* Close the dump files. */
2805 if (flag_gen_aux_info
)
2807 fclose (aux_info_file
);
2809 unlink (aux_info_file_name
);
2814 open_dump_file (".combine", NULL
);
2815 TIMEVAR (dump_time
, dump_combine_total_stats (rtl_dump_file
));
2816 close_dump_file (NULL
, NULL_RTX
);
2819 /* Close non-debugging input and output files. Take special care to note
2820 whether fclose returns an error, since the pages might still be on the
2821 buffer chain while the file is open. */
2825 if (ferror (asm_out_file
) != 0 || fclose (asm_out_file
) != 0)
2826 fatal_io_error (asm_file_name
);
2828 /* Print the times. */
2832 fprintf (stderr
,"\n");
2833 print_time ("parse", parse_time
);
2835 print_time ("integration", integration_time
);
2836 print_time ("jump", jump_time
);
2837 print_time ("cse", cse_time
);
2838 print_time ("loop", loop_time
);
2839 print_time ("cse2", cse2_time
);
2840 print_time ("branch-prob", branch_prob_time
);
2841 print_time ("flow", flow_time
);
2842 print_time ("combine", combine_time
);
2843 print_time ("regmove", regmove_time
);
2844 print_time ("sched", sched_time
);
2845 print_time ("local-alloc", local_alloc_time
);
2846 print_time ("global-alloc", global_alloc_time
);
2847 print_time ("sched2", sched2_time
);
2849 print_time ("dbranch", dbr_sched_time
);
2851 print_time ("shorten-branch", shorten_branch_time
);
2852 print_time ("stack-reg", stack_reg_time
);
2853 print_time ("final", final_time
);
2854 print_time ("varconst", varconst_time
);
2855 print_time ("symout", symout_time
);
2856 print_time ("dump", dump_time
);
2860 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2861 and TYPE_DECL nodes.
2863 This does nothing for local (non-static) variables.
2864 Otherwise, it sets up the RTL and outputs any assembler code
2865 (label definition, storage allocation and initialization).
2867 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2868 the assembler symbol name to be used. TOP_LEVEL is nonzero
2869 if this declaration is not within a function. */
2872 rest_of_decl_compilation (decl
, asmspec
, top_level
, at_end
)
2878 /* Declarations of variables, and of functions defined elsewhere. */
2880 /* The most obvious approach, to put an #ifndef around where
2881 this macro is used, doesn't work since it's inside a macro call. */
2882 #ifndef ASM_FINISH_DECLARE_OBJECT
2883 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2886 /* Forward declarations for nested functions are not "external",
2887 but we need to treat them as if they were. */
2888 if (TREE_STATIC (decl
) || DECL_EXTERNAL (decl
)
2889 || TREE_CODE (decl
) == FUNCTION_DECL
)
2890 TIMEVAR (varconst_time
,
2892 make_decl_rtl (decl
, asmspec
, top_level
);
2893 /* Initialized extern variable exists to be replaced
2894 with its value, or represents something that will be
2895 output in another file. */
2896 if (! (TREE_CODE (decl
) == VAR_DECL
2897 && DECL_EXTERNAL (decl
) && TREE_READONLY (decl
)
2898 && DECL_INITIAL (decl
) != 0
2899 && DECL_INITIAL (decl
) != error_mark_node
))
2900 /* Don't output anything
2901 when a tentative file-scope definition is seen.
2902 But at end of compilation, do output code for them. */
2903 if (! (! at_end
&& top_level
2904 && (DECL_INITIAL (decl
) == 0
2905 || DECL_INITIAL (decl
) == error_mark_node
)))
2906 assemble_variable (decl
, top_level
, at_end
, 0);
2907 if (decl
== last_assemble_variable_decl
)
2909 ASM_FINISH_DECLARE_OBJECT (asm_out_file
, decl
,
2913 else if (DECL_REGISTER (decl
) && asmspec
!= 0)
2915 if (decode_reg_name (asmspec
) >= 0)
2917 DECL_RTL (decl
) = 0;
2918 make_decl_rtl (decl
, asmspec
, top_level
);
2921 error ("invalid register name `%s' for register variable", asmspec
);
2923 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2924 else if ((write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2925 && TREE_CODE (decl
) == TYPE_DECL
)
2926 TIMEVAR (symout_time
, dbxout_symbol (decl
, 0));
2928 #ifdef SDB_DEBUGGING_INFO
2929 else if (write_symbols
== SDB_DEBUG
&& top_level
2930 && TREE_CODE (decl
) == TYPE_DECL
)
2931 TIMEVAR (symout_time
, sdbout_symbol (decl
, 0));
2935 /* Called after finishing a record, union or enumeral type. */
2938 rest_of_type_compilation (type
, toplev
)
2942 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2943 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2944 TIMEVAR (symout_time
, dbxout_symbol (TYPE_STUB_DECL (type
), !toplev
));
2946 #ifdef SDB_DEBUGGING_INFO
2947 if (write_symbols
== SDB_DEBUG
)
2948 TIMEVAR (symout_time
, sdbout_symbol (TYPE_STUB_DECL (type
), !toplev
));
2952 /* This is called from finish_function (within yyparse)
2953 after each top-level definition is parsed.
2954 It is supposed to compile that function or variable
2955 and output the assembler code for it.
2956 After we return, the tree storage is freed. */
2959 rest_of_compilation (decl
)
2963 int start_time
= get_run_time ();
2965 /* Nonzero if we have saved the original DECL_INITIAL of the function,
2966 to be restored after we finish compiling the function
2967 (for use when compiling inline calls to this function). */
2968 tree saved_block_tree
= 0;
2969 /* Likewise, for DECL_ARGUMENTS. */
2970 tree saved_arguments
= 0;
2973 /* If we are reconsidering an inline function
2974 at the end of compilation, skip the stuff for making it inline. */
2976 if (DECL_SAVED_INSNS (decl
) == 0)
2981 /* If requested, consider whether to make this function inline. */
2982 if (DECL_INLINE (decl
) || flag_inline_functions
)
2983 TIMEVAR (integration_time
,
2985 lose
= function_cannot_inline_p (decl
);
2986 if (lose
|| ! optimize
)
2988 if (warn_inline
&& DECL_INLINE (decl
))
2989 warning_with_decl (decl
, lose
);
2990 DECL_ABSTRACT_ORIGIN (decl
) = 0;
2991 /* Don't really compile an extern inline function.
2992 If we can't make it inline, pretend
2993 it was only declared. */
2994 if (DECL_EXTERNAL (decl
))
2996 DECL_INITIAL (decl
) = 0;
2997 goto exit_rest_of_compilation
;
3001 /* ??? Note that this has the effect of making it look
3002 like "inline" was specified for a function if we choose
3003 to inline it. This isn't quite right, but it's
3004 probably not worth the trouble to fix. */
3005 inlinable
= DECL_INLINE (decl
) = 1;
3008 insns
= get_insns ();
3010 /* Dump the rtl code if we are dumping rtl. */
3014 open_dump_file (".rtl", decl_printable_name (decl
, 2));
3016 if (DECL_SAVED_INSNS (decl
))
3017 fprintf (rtl_dump_file
, ";; (integrable)\n\n");
3019 close_dump_file (print_rtl
, insns
);
3022 /* If we can, defer compiling inlines until EOF.
3023 save_for_inline_copying can be extremely expensive. */
3024 if (inlinable
&& ! decl_function_context (decl
))
3025 DECL_DEFER_OUTPUT (decl
) = 1;
3027 /* If function is inline, and we don't yet know whether to
3028 compile it by itself, defer decision till end of compilation.
3029 finish_compilation will call rest_of_compilation again
3030 for those functions that need to be output. Also defer those
3031 functions that we are supposed to defer. We cannot defer
3032 functions containing nested functions since the nested function
3033 data is in our non-saved obstack. */
3035 /* If this is a nested inline, remove ADDRESSOF now so we can
3036 finish compiling ourselves. Otherwise, wait until EOF.
3037 We have to do this because the purge_addressof transformation
3038 changes the DECL_RTL for many variables, which confuses integrate. */
3041 if (decl_function_context (decl
))
3042 purge_addressof (insns
);
3044 DECL_DEFER_OUTPUT (decl
) = 1;
3047 if (! current_function_contains_functions
3048 && (DECL_DEFER_OUTPUT (decl
)
3049 || (DECL_INLINE (decl
)
3050 && ((! TREE_PUBLIC (decl
) && ! TREE_ADDRESSABLE (decl
)
3051 && ! flag_keep_inline_functions
)
3052 || DECL_EXTERNAL (decl
)))))
3054 DECL_DEFER_OUTPUT (decl
) = 1;
3056 /* If -Wreturn-type, we have to do a bit of compilation.
3057 However, if we just fall through we will call
3058 save_for_inline_copying() which results in excessive
3059 memory use. Instead, we just want to call
3060 jump_optimize() to figure out whether or not we can fall
3061 off the end of the function; we do the minimum amount of
3062 work necessary to make that safe. And, we set optimize
3063 to zero to keep jump_optimize from working too hard. */
3064 if (warn_return_type
)
3066 int saved_optimize
= optimize
;
3068 find_exception_handler_labels ();
3069 jump_optimize (get_insns(), !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
3070 !JUMP_AFTER_REGSCAN
);
3071 optimize
= saved_optimize
;
3074 #ifdef DWARF_DEBUGGING_INFO
3075 /* Generate the DWARF info for the "abstract" instance
3076 of a function which we may later generate inlined and/or
3077 out-of-line instances of. */
3078 if (write_symbols
== DWARF_DEBUG
)
3080 set_decl_abstract_flags (decl
, 1);
3081 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3082 set_decl_abstract_flags (decl
, 0);
3085 #ifdef DWARF2_DEBUGGING_INFO
3086 /* Generate the DWARF2 info for the "abstract" instance
3087 of a function which we may later generate inlined and/or
3088 out-of-line instances of. */
3089 if (write_symbols
== DWARF2_DEBUG
)
3091 set_decl_abstract_flags (decl
, 1);
3092 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3093 set_decl_abstract_flags (decl
, 0);
3096 TIMEVAR (integration_time
, save_for_inline_nocopy (decl
));
3097 RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl
)) = inlinable
;
3098 goto exit_rest_of_compilation
;
3101 /* If we have to compile the function now, save its rtl and subdecls
3102 so that its compilation will not affect what others get. */
3103 if (inlinable
|| DECL_DEFER_OUTPUT (decl
))
3105 #ifdef DWARF_DEBUGGING_INFO
3106 /* Generate the DWARF info for the "abstract" instance of
3107 a function which we will generate an out-of-line instance
3108 of almost immediately (and which we may also later generate
3109 various inlined instances of). */
3110 if (write_symbols
== DWARF_DEBUG
)
3112 set_decl_abstract_flags (decl
, 1);
3113 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3114 set_decl_abstract_flags (decl
, 0);
3117 #ifdef DWARF2_DEBUGGING_INFO
3118 /* Generate the DWARF2 info for the "abstract" instance of
3119 a function which we will generate an out-of-line instance
3120 of almost immediately (and which we may also later generate
3121 various inlined instances of). */
3122 if (write_symbols
== DWARF2_DEBUG
)
3124 set_decl_abstract_flags (decl
, 1);
3125 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3126 set_decl_abstract_flags (decl
, 0);
3129 saved_block_tree
= DECL_INITIAL (decl
);
3130 saved_arguments
= DECL_ARGUMENTS (decl
);
3131 TIMEVAR (integration_time
, save_for_inline_copying (decl
));
3132 RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl
)) = inlinable
;
3135 /* If specified extern inline but we aren't inlining it, we are
3137 if (DECL_INLINE (decl
) && DECL_EXTERNAL (decl
))
3138 goto exit_rest_of_compilation
;
3141 if (! DECL_DEFER_OUTPUT (decl
))
3142 TREE_ASM_WRITTEN (decl
) = 1;
3144 /* Now that integrate will no longer see our rtl, we need not distinguish
3145 between the return value of this function and the return value of called
3147 rtx_equal_function_value_matters
= 0;
3149 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
3150 if ((rtl_dump_and_exit
|| flag_syntax_only
) && !warn_return_type
)
3152 goto exit_rest_of_compilation
;
3155 /* Emit code to get eh context, if needed. */
3159 /* If we are doing position-independent code generation, now
3160 is the time to output special prologues and epilogues.
3161 We do not want to do this earlier, because it just clutters
3162 up inline functions with meaningless insns. */
3167 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
3168 Note that that may have been done above, in save_for_inline_copying.
3169 The call to resume_temporary_allocation near the end of this function
3170 goes back to the usual state of affairs. This must be done after
3171 we've built up any unwinders for exception handling, and done
3172 the FINALIZE_PIC work, if necessary. */
3174 rtl_in_current_obstack ();
3176 insns
= get_insns ();
3178 /* Copy any shared structure that should not be shared. */
3180 unshare_all_rtl (insns
);
3182 #ifdef SETJMP_VIA_SAVE_AREA
3183 /* This must be performed before virutal register instantiation. */
3184 if (current_function_calls_alloca
)
3185 optimize_save_area_alloca (insns
);
3188 /* Instantiate all virtual registers. */
3190 instantiate_virtual_regs (current_function_decl
, get_insns ());
3192 /* See if we have allocated stack slots that are not directly addressable.
3193 If so, scan all the insns and create explicit address computation
3194 for all references to such slots. */
3195 /* fixup_stack_slots (); */
3197 /* Find all the EH handlers. */
3198 find_exception_handler_labels ();
3200 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
3201 are initialized and to compute whether control can drop off the end
3203 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3204 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
3205 JUMP_AFTER_REGSCAN
));
3207 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
3208 if (rtl_dump_and_exit
|| flag_syntax_only
|| DECL_DEFER_OUTPUT (decl
))
3209 goto exit_rest_of_compilation
;
3211 /* Dump rtl code after jump, if we are doing that. */
3214 dump_rtl (".jump", decl
, print_rtl
, insns
);
3216 /* Perform common subexpression elimination.
3217 Nonzero value from `cse_main' means that jumps were simplified
3218 and some code may now be unreachable, so do
3219 jump optimization again. */
3224 open_dump_file (".cse", decl_printable_name (decl
, 2));
3226 TIMEVAR (cse_time
, reg_scan (insns
, max_reg_num (), 1));
3228 if (flag_thread_jumps
)
3229 /* Hacks by tiemann & kenner. */
3230 TIMEVAR (jump_time
, thread_jumps (insns
, max_reg_num (), 1));
3232 TIMEVAR (cse_time
, tem
= cse_main (insns
, max_reg_num (),
3234 TIMEVAR (cse_time
, delete_trivially_dead_insns (insns
, max_reg_num ()));
3236 if (tem
|| optimize
> 1)
3237 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3239 !JUMP_AFTER_REGSCAN
));
3241 /* Dump rtl code after cse, if we are doing that. */
3244 close_dump_file (print_rtl
, insns
);
3247 purge_addressof (insns
);
3248 reg_scan (insns
, max_reg_num (), 1);
3251 dump_rtl (".addressof", decl
, print_rtl
, insns
);
3253 /* Move constant computations out of loops. */
3258 open_dump_file (".loop", decl_printable_name (decl
, 2));
3263 if (flag_rerun_loop_opt
)
3265 /* We only want to perform unrolling once. */
3267 loop_optimize (insns
, rtl_dump_file
, 0);
3270 /* The first call to loop_optimize makes some instructions
3271 trivially dead. We delete those instructions now in the
3272 hope that doing so will make the heuristics in loop work
3273 better and possibly speed up compilation. */
3274 delete_trivially_dead_insns (insns
, max_reg_num ());
3276 /* The regscan pass is currently necessary as the alias
3277 analysis code depends on this information. */
3278 reg_scan (insns
, max_reg_num (), 1);
3280 loop_optimize (insns
, rtl_dump_file
, flag_unroll_loops
);
3283 /* Dump rtl code after loop opt, if we are doing that. */
3286 close_dump_file (print_rtl
, insns
);
3292 open_dump_file (".cse2", decl_printable_name (decl
, 2));
3294 if (flag_rerun_cse_after_loop
)
3296 /* Running another jump optimization pass before the second
3297 cse pass sometimes simplifies the RTL enough to allow
3298 the second CSE pass to do a better job. Jump_optimize can change
3299 max_reg_num so we must rerun reg_scan afterwards.
3300 ??? Rework to not call reg_scan so often. */
3301 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3302 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3304 JUMP_AFTER_REGSCAN
));
3306 TIMEVAR (cse2_time
, reg_scan (insns
, max_reg_num (), 0));
3307 TIMEVAR (cse2_time
, tem
= cse_main (insns
, max_reg_num (),
3310 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3312 !JUMP_AFTER_REGSCAN
));
3315 if (flag_thread_jumps
)
3317 /* This pass of jump threading straightens out code
3318 that was kinked by loop optimization. */
3319 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3320 TIMEVAR (jump_time
, thread_jumps (insns
, max_reg_num (), 0));
3323 /* Dump rtl code after cse, if we are doing that. */
3326 close_dump_file (print_rtl
, insns
);
3329 if (profile_arc_flag
|| flag_test_coverage
|| flag_branch_probabilities
)
3331 if (branch_prob_dump
)
3332 open_dump_file (".bp", decl_printable_name (decl
, 2));
3337 branch_prob (insns
, rtl_dump_file
);
3340 if (branch_prob_dump
)
3341 close_dump_file (print_rtl
, insns
);
3344 /* We are no longer anticipating cse in this function, at least. */
3346 cse_not_expected
= 1;
3348 /* Now we choose between stupid (pcc-like) register allocation
3349 (if we got the -noreg switch and not -opt)
3350 and smart register allocation. */
3352 if (optimize
> 0) /* Stupid allocation probably won't work */
3353 obey_regdecls
= 0; /* if optimizations being done. */
3357 /* Print function header into flow dump now
3358 because doing the flow analysis makes some of the dump. */
3361 open_dump_file (".flow", decl_printable_name (decl
, 2));
3367 regclass (insns
, max_reg_num ());
3368 stupid_life_analysis (insns
, max_reg_num (),
3374 /* Do control and data flow analysis,
3375 and write some of the results to dump file. */
3380 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
, 1);
3381 life_analysis (insns
, max_reg_num (), rtl_dump_file
);
3384 if (warn_uninitialized
)
3386 uninitialized_vars_warning (DECL_INITIAL (decl
));
3387 setjmp_args_warning ();
3391 /* Dump rtl after flow analysis. */
3394 close_dump_file (print_rtl_with_bb
, insns
);
3396 /* If -opt, try combining insns through substitution. */
3400 TIMEVAR (combine_time
, combine_instructions (insns
, max_reg_num ()));
3402 /* Dump rtl code after insn combination. */
3405 dump_rtl (".combine", decl
, print_rtl_with_bb
, insns
);
3408 /* Register allocation pre-pass, to reduce number of moves
3409 necessary for two-address machines. */
3410 if (optimize
> 0 && (flag_regmove
|| flag_expensive_optimizations
))
3413 open_dump_file (".regmove", decl_printable_name (decl
, 2));
3415 TIMEVAR (regmove_time
, regmove_optimize (insns
, max_reg_num (),
3419 close_dump_file (print_rtl_with_bb
, insns
);
3422 /* Print function header into sched dump now
3423 because doing the sched analysis makes some of the dump. */
3425 if (optimize
> 0 && flag_schedule_insns
)
3428 open_dump_file (".sched", decl_printable_name (decl
, 2));
3430 /* Do control and data sched analysis,
3431 and write some of the results to dump file. */
3433 TIMEVAR (sched_time
, schedule_insns (rtl_dump_file
));
3435 /* Dump rtl after instruction scheduling. */
3438 close_dump_file (print_rtl_with_bb
, insns
);
3441 /* Unless we did stupid register allocation,
3442 allocate pseudo-regs that are used only within 1 basic block. */
3445 TIMEVAR (local_alloc_time
,
3447 regclass (insns
, max_reg_num ());
3451 /* Dump rtl code after allocating regs within basic blocks. */
3455 open_dump_file (".lreg", decl_printable_name (decl
, 2));
3457 TIMEVAR (dump_time
, dump_flow_info (rtl_dump_file
));
3458 TIMEVAR (dump_time
, dump_local_alloc (rtl_dump_file
));
3460 close_dump_file (print_rtl_with_bb
, insns
);
3463 if (global_reg_dump
)
3464 open_dump_file (".greg", decl_printable_name (decl
, 2));
3466 /* Save the last label number used so far, so reorg can tell
3467 when it's safe to kill spill regs. */
3468 max_label_num_after_reload
= max_label_num ();
3470 /* Unless we did stupid register allocation,
3471 allocate remaining pseudo-regs, then do the reload pass
3472 fixing up any insns that are invalid. */
3474 TIMEVAR (global_alloc_time
,
3477 failure
= global_alloc (rtl_dump_file
);
3479 failure
= reload (insns
, 0, rtl_dump_file
);
3482 if (global_reg_dump
)
3484 TIMEVAR (dump_time
, dump_global_regs (rtl_dump_file
));
3485 close_dump_file (print_rtl_with_bb
, insns
);
3489 goto exit_rest_of_compilation
;
3491 reload_completed
= 1;
3493 /* Do a very simple CSE pass over just the hard registers. */
3495 reload_cse_regs (insns
);
3497 /* On some machines, the prologue and epilogue code, or parts thereof,
3498 can be represented as RTL. Doing so lets us schedule insns between
3499 it and the rest of the code and also allows delayed branch
3500 scheduling to operate in the epilogue. */
3502 thread_prologue_and_epilogue_insns (insns
);
3504 if (optimize
> 0 && flag_schedule_insns_after_reload
)
3507 open_dump_file (".sched2", decl_printable_name (decl
, 2));
3509 /* Do control and data sched analysis again,
3510 and write some more of the results to dump file. */
3512 TIMEVAR (sched2_time
, schedule_insns (rtl_dump_file
));
3514 /* Dump rtl after post-reorder instruction scheduling. */
3517 close_dump_file (print_rtl_with_bb
, insns
);
3520 #ifdef LEAF_REGISTERS
3522 if (optimize
> 0 && only_leaf_regs_used () && leaf_function_p ())
3526 /* One more attempt to remove jumps to .+1
3527 left by dead-store-elimination.
3528 Also do cross-jumping this time
3529 and delete no-op move insns. */
3533 TIMEVAR (jump_time
, jump_optimize (insns
, JUMP_CROSS_JUMP
,
3535 !JUMP_AFTER_REGSCAN
));
3537 /* Dump rtl code after jump, if we are doing that. */
3540 dump_rtl (".jump2", decl
, print_rtl_with_bb
, insns
);
3543 /* If a machine dependent reorganization is needed, call it. */
3544 #ifdef MACHINE_DEPENDENT_REORG
3545 MACHINE_DEPENDENT_REORG (insns
);
3547 if (mach_dep_reorg_dump
)
3548 dump_rtl (".mach", decl
, print_rtl_with_bb
, insns
);
3551 /* If a scheduling pass for delayed branches is to be done,
3552 call the scheduling code. */
3555 if (optimize
> 0 && flag_delayed_branch
)
3557 TIMEVAR (dbr_sched_time
, dbr_schedule (insns
, rtl_dump_file
));
3560 dump_rtl (".dbr", decl
, print_rtl_with_bb
, insns
);
3564 /* Shorten branches. */
3565 TIMEVAR (shorten_branch_time
,
3567 shorten_branches (get_insns ());
3571 TIMEVAR (stack_reg_time
, reg_to_stack (insns
, rtl_dump_file
));
3574 dump_rtl (".stack", decl
, print_rtl_with_bb
, insns
);
3577 /* Now turn the rtl into assembler code. */
3579 TIMEVAR (final_time
,
3584 /* Get the function's name, as described by its RTL.
3585 This may be different from the DECL_NAME name used
3586 in the source file. */
3588 x
= DECL_RTL (decl
);
3589 if (GET_CODE (x
) != MEM
)
3592 if (GET_CODE (x
) != SYMBOL_REF
)
3594 fnname
= XSTR (x
, 0);
3596 assemble_start_function (decl
, fnname
);
3597 final_start_function (insns
, asm_out_file
, optimize
);
3598 final (insns
, asm_out_file
, optimize
, 0);
3599 final_end_function (insns
, asm_out_file
, optimize
);
3600 assemble_end_function (decl
, fnname
);
3602 fflush (asm_out_file
);
3604 /* Release all memory held by regsets now */
3605 regset_release_memory ();
3608 /* Write DBX symbols if requested */
3610 /* Note that for those inline functions where we don't initially
3611 know for certain that we will be generating an out-of-line copy,
3612 the first invocation of this routine (rest_of_compilation) will
3613 skip over this code by doing a `goto exit_rest_of_compilation;'.
3614 Later on, finish_compilation will call rest_of_compilation again
3615 for those inline functions that need to have out-of-line copies
3616 generated. During that call, we *will* be routed past here. */
3618 #ifdef DBX_DEBUGGING_INFO
3619 if (write_symbols
== DBX_DEBUG
)
3620 TIMEVAR (symout_time
, dbxout_function (decl
));
3623 #ifdef DWARF_DEBUGGING_INFO
3624 if (write_symbols
== DWARF_DEBUG
)
3625 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3628 #ifdef DWARF2_DEBUGGING_INFO
3629 if (write_symbols
== DWARF2_DEBUG
)
3630 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3633 exit_rest_of_compilation
:
3635 /* In case the function was not output,
3636 don't leave any temporary anonymous types
3637 queued up for sdb output. */
3638 #ifdef SDB_DEBUGGING_INFO
3639 if (write_symbols
== SDB_DEBUG
)
3640 sdbout_types (NULL_TREE
);
3643 /* Put back the tree of subblocks and list of arguments
3644 from before we copied them.
3645 Code generation and the output of debugging info may have modified
3646 the copy, but the original is unchanged. */
3648 if (saved_block_tree
!= 0)
3650 DECL_INITIAL (decl
) = saved_block_tree
;
3651 DECL_ARGUMENTS (decl
) = saved_arguments
;
3652 DECL_ABSTRACT_ORIGIN (decl
) = NULL_TREE
;
3655 reload_completed
= 0;
3657 /* Clear out the insn_length contents now that they are no longer valid. */
3658 init_insn_lengths ();
3660 /* Clear out the real_constant_chain before some of the rtx's
3661 it runs through become garbage. */
3663 clear_const_double_mem ();
3665 /* Cancel the effect of rtl_in_current_obstack. */
3667 resume_temporary_allocation ();
3669 /* Show no temporary slots allocated. */
3673 /* Make sure volatile mem refs aren't considered valid operands for
3674 arithmetic insns. We must call this here if this is a nested inline
3675 function, since the above code leaves us in the init_recog state
3676 (from final.c), and the function context push/pop code does not
3677 save/restore volatile_ok.
3679 ??? Maybe it isn't necessary for expand_start_function to call this
3680 anymore if we do it here? */
3682 init_recog_no_volatile ();
3684 /* The parsing time is all the time spent in yyparse
3685 *except* what is spent in this function. */
3687 parse_time
-= get_run_time () - start_time
;
3690 /* Entry point of cc1/c++. Decode command args, then call compile_file.
3691 Exit code is 35 if can't open files, 34 if fatal error,
3692 33 if had nonfatal errors, else success. */
3695 main (argc
, argv
, envp
)
3702 int flag_print_mem
= 0;
3703 int version_flag
= 0;
3706 /* save in case md file wants to emit args as a comment. */
3710 p
= argv
[0] + strlen (argv
[0]);
3711 while (p
!= argv
[0] && p
[-1] != '/'
3712 #ifdef DIR_SEPARATOR
3713 && p
[-1] != DIR_SEPARATOR
3719 #if defined (RLIMIT_STACK) && defined (HAVE_GETRLIMIT) && defined (HAVE_SETRLIMIT)
3720 /* Get rid of any avoidable limit on stack size. */
3724 /* Set the stack limit huge so that alloca does not fail. */
3725 getrlimit (RLIMIT_STACK
, &rlim
);
3726 rlim
.rlim_cur
= rlim
.rlim_max
;
3727 setrlimit (RLIMIT_STACK
, &rlim
);
3731 signal (SIGFPE
, float_signal
);
3734 signal (SIGPIPE
, pipe_closed
);
3737 decl_printable_name
= decl_name
;
3738 lang_expand_expr
= (struct rtx_def
*(*)()) do_abort
;
3740 /* Initialize whether `char' is signed. */
3741 flag_signed_char
= DEFAULT_SIGNED_CHAR
;
3742 #ifdef DEFAULT_SHORT_ENUMS
3743 /* Initialize how much space enums occupy, by default. */
3744 flag_short_enums
= DEFAULT_SHORT_ENUMS
;
3747 /* Scan to see what optimization level has been specified. That will
3748 determine the default value of many flags. */
3749 for (i
= 1; i
< argc
; i
++)
3751 if (!strcmp (argv
[i
], "-O"))
3755 else if (argv
[i
][0] == '-' && argv
[i
][1] == 'O')
3757 /* Handle -Os, -O2, -O3, -O69, ... */
3758 char *p
= &argv
[i
][2];
3761 if ((p
[0] == 's') && (p
[1] == 0))
3766 if (! (c
>= '0' && c
<= '9'))
3769 optimize
= atoi (&argv
[i
][2]);
3774 /* Optimizing for size forces optimize to be no less than 2. */
3775 if (optimize_size
&& (optimize
< 2))
3778 obey_regdecls
= (optimize
== 0);
3783 flag_thread_jumps
= 1;
3785 flag_delayed_branch
= 1;
3787 #ifdef CAN_DEBUG_WITHOUT_FP
3788 flag_omit_frame_pointer
= 1;
3794 flag_cse_follow_jumps
= 1;
3795 flag_cse_skip_blocks
= 1;
3796 flag_expensive_optimizations
= 1;
3797 flag_strength_reduce
= 1;
3798 flag_rerun_cse_after_loop
= 1;
3799 flag_rerun_loop_opt
= 1;
3800 flag_caller_saves
= 1;
3802 #ifdef INSN_SCHEDULING
3803 flag_schedule_insns
= 1;
3804 flag_schedule_insns_after_reload
= 1;
3811 flag_inline_functions
= 1;
3814 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
3817 set_target_switch ("");
3819 #ifdef OPTIMIZATION_OPTIONS
3820 /* Allow default optimizations to be specified on a per-machine basis. */
3821 OPTIMIZATION_OPTIONS (optimize
, optimize_size
);
3824 /* Initialize register usage now so switches may override. */
3827 for (i
= 1; i
< argc
; i
++)
3830 /* If this is a language-specific option,
3831 decode it in a language-specific way. */
3832 for (j
= 0; lang_options
[j
] != 0; j
++)
3833 if (!strncmp (argv
[i
], lang_options
[j
],
3834 strlen (lang_options
[j
])))
3836 if (lang_options
[j
] != 0)
3837 /* If the option is valid for *some* language,
3838 treat it as valid even if this language doesn't understand it. */
3839 lang_decode_option (argv
[i
]);
3840 else if (argv
[i
][0] == '-' && argv
[i
][1] != 0)
3842 register char *str
= argv
[i
] + 1;
3847 set_target_switch (&str
[1]);
3848 else if (!strcmp (str
, "dumpbase"))
3850 dump_base_name
= argv
[++i
];
3852 else if (str
[0] == 'd')
3854 register char *p
= &str
[1];
3859 branch_prob_dump
= 1;
3865 global_reg_dump
= 1;
3873 cse_dump
= 1, cse2_dump
= 1;
3879 #ifdef MACHINE_DEPENDENT_REORG
3880 mach_dep_reorg_dump
= 1;
3887 branch_prob_dump
= 1;
3904 global_reg_dump
= 1;
3926 #ifdef MACHINE_DEPENDENT_REORG
3928 mach_dep_reorg_dump
= 1;
3932 flag_print_asm_name
= 1;
3956 rtl_dump_and_exit
= 1;
3959 warning ("unrecognised gcc debugging option: %c", p
[-1]);
3963 else if (str
[0] == 'f')
3965 register char *p
= &str
[1];
3968 /* Some kind of -f option.
3969 P's value is the option sans `-f'.
3970 Search for it in the table of options. */
3973 !found
&& j
< sizeof (f_options
) / sizeof (f_options
[0]);
3976 if (!strcmp (p
, f_options
[j
].string
))
3978 *f_options
[j
].variable
= f_options
[j
].on_value
;
3979 /* A goto here would be cleaner,
3980 but breaks the vax pcc. */
3983 if (p
[0] == 'n' && p
[1] == 'o' && p
[2] == '-'
3984 && ! strcmp (p
+3, f_options
[j
].string
))
3986 *f_options
[j
].variable
= ! f_options
[j
].on_value
;
3994 #ifdef INSN_SCHEDULING
3995 else if (!strncmp (p
, "sched-verbose-",14))
3996 fix_sched_param("verbose",&p
[14]);
3997 else if (!strncmp (p
, "sched-max-",10))
3998 fix_sched_param("max",&p
[10]);
3999 else if (!strncmp (p
, "sched-inter-max-b-",18))
4000 fix_sched_param("interblock-max-blocks",&p
[18]);
4001 else if (!strncmp (p
, "sched-inter-max-i-",18))
4002 fix_sched_param("interblock-max-insns",&p
[18]);
4005 else if (!strncmp (p
, "fixed-", 6))
4006 fix_register (&p
[6], 1, 1);
4007 else if (!strncmp (p
, "call-used-", 10))
4008 fix_register (&p
[10], 0, 1);
4009 else if (!strncmp (p
, "call-saved-", 11))
4010 fix_register (&p
[11], 0, 0);
4012 error ("Invalid option `%s'", argv
[i
]);
4014 else if (str
[0] == 'O')
4016 register char *p
= str
+1;
4020 while (*p
&& *p
>= '0' && *p
<= '9')
4025 error ("Invalid option `%s'", argv
[i
]);
4027 else if (!strcmp (str
, "pedantic"))
4029 else if (!strcmp (str
, "pedantic-errors"))
4030 flag_pedantic_errors
= pedantic
= 1;
4031 else if (!strcmp (str
, "quiet"))
4033 else if (!strcmp (str
, "version"))
4035 else if (!strcmp (str
, "w"))
4036 inhibit_warnings
= 1;
4037 else if (!strcmp (str
, "W"))
4040 /* We save the value of warn_uninitialized, since if they put
4041 -Wuninitialized on the command line, we need to generate a
4042 warning about not using it without also specifying -O. */
4043 if (warn_uninitialized
!= 1)
4044 warn_uninitialized
= 2;
4046 else if (str
[0] == 'W')
4048 register char *p
= &str
[1];
4051 /* Some kind of -W option.
4052 P's value is the option sans `-W'.
4053 Search for it in the table of options. */
4056 !found
&& j
< sizeof (W_options
) / sizeof (W_options
[0]);
4059 if (!strcmp (p
, W_options
[j
].string
))
4061 *W_options
[j
].variable
= W_options
[j
].on_value
;
4062 /* A goto here would be cleaner,
4063 but breaks the vax pcc. */
4066 if (p
[0] == 'n' && p
[1] == 'o' && p
[2] == '-'
4067 && ! strcmp (p
+3, W_options
[j
].string
))
4069 *W_options
[j
].variable
= ! W_options
[j
].on_value
;
4076 else if (!strncmp (p
, "id-clash-", 9))
4082 if (*endp
>= '0' && *endp
<= '9')
4086 error ("Invalid option `%s'", argv
[i
]);
4091 id_clash_len
= atoi (str
+ 10);
4094 else if (!strncmp (p
, "larger-than-", 12))
4096 char *endp
= p
+ 12;
4100 if (*endp
>= '0' && *endp
<= '9')
4104 error ("Invalid option `%s'", argv
[i
]);
4105 goto larger_than_lose
;
4108 warn_larger_than
= 1;
4109 larger_than_size
= atoi (str
+ 13);
4113 error ("Invalid option `%s'", argv
[i
]);
4115 else if (!strcmp (str
, "p"))
4119 else if (!strcmp (str
, "a"))
4121 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4122 warning ("`-a' option (basic block profile) not supported");
4124 profile_block_flag
= (profile_block_flag
< 2) ? 1 : 3;
4127 else if (!strcmp (str
, "ax"))
4129 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4130 warning ("`-ax' option (jump profiling) not supported");
4132 profile_block_flag
= (!profile_block_flag
4133 || profile_block_flag
== 2) ? 2 : 3;
4136 else if (str
[0] == 'g')
4140 /* A lot of code assumes write_symbols == NO_DEBUG if the
4141 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4142 of what debugging type has been selected). This records the
4143 selected type. It is an error to specify more than one
4145 static enum debug_info_type selected_debug_type
= NO_DEBUG
;
4146 /* Non-zero if debugging format has been explicitly set.
4147 -g and -ggdb don't explicitly set the debugging format so
4148 -gdwarf -g3 is equivalent to -gdwarf3. */
4149 static int type_explicitly_set_p
= 0;
4150 /* Table of supported debugging formats. */
4153 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
4154 constant expression, we use NO_DEBUG in its place. */
4155 enum debug_info_type debug_type
;
4156 int use_extensions_p
;
4157 } *da
, debug_args
[] = {
4158 { "g", NO_DEBUG
, DEFAULT_GDB_EXTENSIONS
},
4159 { "ggdb", NO_DEBUG
, 1 },
4160 #ifdef DBX_DEBUGGING_INFO
4161 { "gstabs", DBX_DEBUG
, 0 },
4162 { "gstabs+", DBX_DEBUG
, 1 },
4164 #ifdef DWARF_DEBUGGING_INFO
4165 { "gdwarf", DWARF_DEBUG
, 0 },
4166 { "gdwarf+", DWARF_DEBUG
, 1 },
4168 #ifdef DWARF2_DEBUGGING_INFO
4169 { "gdwarf-2", DWARF2_DEBUG
, 0 },
4171 #ifdef XCOFF_DEBUGGING_INFO
4172 { "gxcoff", XCOFF_DEBUG
, 0 },
4173 { "gxcoff+", XCOFF_DEBUG
, 1 },
4175 #ifdef SDB_DEBUGGING_INFO
4176 { "gcoff", SDB_DEBUG
, 0 },
4180 /* Indexed by enum debug_info_type. */
4181 static char *debug_type_names
[] = {
4182 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4185 /* Look up STR in the table. */
4186 for (da
= debug_args
; da
->arg
; da
++)
4188 if (! strncmp (str
, da
->arg
, strlen (da
->arg
)))
4190 enum debug_info_type type
= da
->debug_type
;
4193 p
= str
+ strlen (da
->arg
);
4194 if (*p
&& (*p
< '0' || *p
> '9'))
4198 while (*q
&& (*q
>= '0' && *q
<= '9'))
4203 if (len
> 1 && !strncmp (str
, "gdwarf", len
))
4205 error ("use -gdwarf -g%d for DWARF v1, level %d",
4208 error ("use -gdwarf-2 for DWARF v2");
4212 level
= 2; /* default debugging info level */
4213 if (*q
|| level
> 3)
4215 warning ("invalid debug level specification in option: `-%s'",
4217 /* ??? This error message is incorrect in the case of
4219 warning ("no debugging information will be generated");
4223 if (type
== NO_DEBUG
)
4225 type
= PREFERRED_DEBUGGING_TYPE
;
4226 if (len
> 1 && strncmp (str
, "ggdb", len
) == 0)
4228 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4229 type
= DWARF2_DEBUG
;
4231 #ifdef DBX_DEBUGGING_INFO
4238 if (type
== NO_DEBUG
)
4239 warning ("`-%s' not supported by this configuration of GCC",
4242 /* Does it conflict with an already selected type? */
4243 if (type_explicitly_set_p
4244 /* -g/-ggdb don't conflict with anything */
4245 && da
->debug_type
!= NO_DEBUG
4246 && type
!= selected_debug_type
)
4247 warning ("`-%s' ignored, conflicts with `-g%s'",
4248 str
, debug_type_names
[(int) selected_debug_type
]);
4251 /* If the format has already been set, -g/-ggdb
4252 only change the debug level. */
4253 if (type_explicitly_set_p
4254 && da
->debug_type
== NO_DEBUG
)
4255 ; /* don't change debugging type */
4258 selected_debug_type
= type
;
4259 type_explicitly_set_p
= da
->debug_type
!= NO_DEBUG
;
4261 write_symbols
= (level
== 0
4263 : selected_debug_type
);
4264 use_gnu_debug_info_extensions
= da
->use_extensions_p
;
4265 debug_info_level
= (enum debug_info_level
) level
;
4271 warning ("`-%s' not supported by this configuration of GCC",
4274 else if (!strcmp (str
, "o"))
4276 asm_file_name
= argv
[++i
];
4278 else if (str
[0] == 'G')
4280 g_switch_set
= TRUE
;
4281 g_switch_value
= atoi ((str
[1] != '\0') ? str
+1 : argv
[++i
]);
4283 else if (!strncmp (str
, "aux-info", 8))
4285 flag_gen_aux_info
= 1;
4286 aux_info_file_name
= (str
[8] != '\0' ? str
+8 : argv
[++i
]);
4289 error ("Invalid option `%s'", argv
[i
]);
4291 else if (argv
[i
][0] == '+')
4292 error ("Invalid option `%s'", argv
[i
]);
4297 /* Checker uses the frame pointer. */
4298 if (flag_check_memory_usage
)
4299 flag_omit_frame_pointer
= 0;
4303 /* Inlining does not work if not optimizing,
4304 so force it not to be done. */
4308 /* The c_decode_option and lang_decode_option functions set
4309 this to `2' if -Wall is used, so we can avoid giving out
4310 lots of errors for people who don't realize what -Wall does. */
4311 if (warn_uninitialized
== 1)
4312 warning ("-Wuninitialized is not supported without -O");
4315 #ifdef OVERRIDE_OPTIONS
4316 /* Some machines may reject certain combinations of options. */
4320 if (exceptions_via_longjmp
== 2)
4322 #ifdef DWARF2_UNWIND_INFO
4323 exceptions_via_longjmp
= ! DWARF2_UNWIND_INFO
;
4325 exceptions_via_longjmp
= 1;
4329 if (profile_block_flag
== 3)
4331 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4332 profile_block_flag
= 2;
4335 /* Unrolling all loops implies that standard loop unrolling must also
4337 if (flag_unroll_all_loops
)
4338 flag_unroll_loops
= 1;
4339 /* Loop unrolling requires that strength_reduction be on also. Silently
4340 turn on strength reduction here if it isn't already on. Also, the loop
4341 unrolling code assumes that cse will be run after loop, so that must
4342 be turned on also. */
4343 if (flag_unroll_loops
)
4345 flag_strength_reduce
= 1;
4346 flag_rerun_cse_after_loop
= 1;
4349 /* Warn about options that are not supported on this machine. */
4350 #ifndef INSN_SCHEDULING
4351 if (flag_schedule_insns
|| flag_schedule_insns_after_reload
)
4352 warning ("instruction scheduling not supported on this target machine");
4355 if (flag_delayed_branch
)
4356 warning ("this target machine does not have delayed branches");
4359 /* If we are in verbose mode, write out the version and maybe all the
4360 option flags in use. */
4363 print_version (stderr
, "");
4365 print_switch_values (stderr
, 0, MAX_LINE
, "", " ", "\n");
4368 compile_file (filename
);
4370 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN32__))
4373 char *lim
= (char *) sbrk (0);
4375 fprintf (stderr
, "Data size %d.\n",
4376 lim
- (char *) &environ
);
4381 system ("ps -l 1>&2");
4384 #endif /* not USG */
4387 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN32) */
4390 exit (FATAL_EXIT_CODE
);
4392 exit (FATAL_EXIT_CODE
);
4393 exit (SUCCESS_EXIT_CODE
);
4397 /* Decode -m switches. */
4399 /* Here is a table, controlled by the tm.h file, listing each -m switch
4400 and which bits in `target_switches' it should set or clear.
4401 If VALUE is positive, it is bits to set.
4402 If VALUE is negative, -VALUE is bits to clear.
4403 (The sign bit is not used so there is no confusion.) */
4405 struct {char *name
; int value
;} target_switches
[]
4408 /* This table is similar, but allows the switch to have a value. */
4410 #ifdef TARGET_OPTIONS
4411 struct {char *prefix
; char ** variable
;} target_options
[]
4415 /* Decode the switch -mNAME. */
4418 set_target_switch (name
)
4424 for (j
= 0; j
< sizeof target_switches
/ sizeof target_switches
[0]; j
++)
4425 if (!strcmp (target_switches
[j
].name
, name
))
4427 if (target_switches
[j
].value
< 0)
4428 target_flags
&= ~-target_switches
[j
].value
;
4430 target_flags
|= target_switches
[j
].value
;
4434 #ifdef TARGET_OPTIONS
4436 for (j
= 0; j
< sizeof target_options
/ sizeof target_options
[0]; j
++)
4438 int len
= strlen (target_options
[j
].prefix
);
4439 if (!strncmp (target_options
[j
].prefix
, name
, len
))
4441 *target_options
[j
].variable
= name
+ len
;
4448 error ("Invalid option `%s'", name
);
4451 /* Print version information to FILE.
4452 Each line begins with INDENT (for the case where FILE is the
4453 assembler output file). */
4456 print_version (file
, indent
)
4460 fprintf (file
, "%s%s%s version %s", indent
, *indent
!= 0 ? " " : "",
4461 language_string
, version_string
);
4462 fprintf (file
, " (%s)", TARGET_NAME
);
4465 #define __VERSION__ "[unknown]"
4467 fprintf (file
, " compiled by GNU C version %s.\n", __VERSION__
);
4469 fprintf (file
, " compiled by CC.\n");
4473 /* Print an option value and return the adjusted position in the line.
4474 ??? We don't handle error returns from fprintf (disk full); presumably
4475 other code will catch a disk full though. */
4478 print_single_switch (file
, pos
, max
, indent
, sep
, term
, type
, name
)
4481 char *indent
, *sep
, *term
, *type
, *name
;
4483 /* The ultrix fprintf returns 0 on success, so compute the result we want
4484 here since we need it for the following test. */
4485 int len
= strlen (sep
) + strlen (type
) + strlen (name
);
4490 fprintf (file
, "%s", term
);
4495 fprintf (file
, "%s", indent
);
4496 pos
= strlen (indent
);
4498 fprintf (file
, "%s%s%s", sep
, type
, name
);
4503 /* Print active target switches to FILE.
4504 POS is the current cursor position and MAX is the size of a "line".
4505 Each line begins with INDENT and ends with TERM.
4506 Each switch is separated from the next by SEP. */
4509 print_switch_values (file
, pos
, max
, indent
, sep
, term
)
4512 char *indent
, *sep
, *term
;
4517 /* Print the options as passed. */
4519 pos
= print_single_switch (file
, pos
, max
, indent
, *indent
? " " : "", term
,
4520 "options passed: ", "");
4522 for (p
= &save_argv
[1]; *p
!= NULL
; p
++)
4526 if (strcmp (*p
, "-o") == 0)
4532 if (strcmp (*p
, "-quiet") == 0)
4534 if (strcmp (*p
, "-version") == 0)
4539 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
, *p
, "");
4542 fprintf (file
, "%s", term
);
4544 /* Print the -f and -m options that have been enabled.
4545 We don't handle language specific options but printing argv
4548 pos
= print_single_switch (file
, 0, max
, indent
, *indent
? " " : "", term
,
4549 "options enabled: ", "");
4551 for (j
= 0; j
< sizeof f_options
/ sizeof f_options
[0]; j
++)
4552 if (*f_options
[j
].variable
== f_options
[j
].on_value
)
4553 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4554 "-f", f_options
[j
].string
);
4556 /* Print target specific options. */
4558 for (j
= 0; j
< sizeof target_switches
/ sizeof target_switches
[0]; j
++)
4559 if (target_switches
[j
].name
[0] != '\0'
4560 && target_switches
[j
].value
> 0
4561 && ((target_switches
[j
].value
& target_flags
)
4562 == target_switches
[j
].value
))
4564 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4565 "-m", target_switches
[j
].name
);
4568 #ifdef TARGET_OPTIONS
4569 for (j
= 0; j
< sizeof target_options
/ sizeof target_options
[0]; j
++)
4570 if (*target_options
[j
].variable
!= NULL
)
4573 sprintf (prefix
, "-m%s", target_options
[j
].prefix
);
4574 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4575 prefix
, *target_options
[j
].variable
);
4579 fprintf (file
, "%s", term
);
4582 /* Record the beginning of a new source file, named FILENAME. */
4585 debug_start_source_file (filename
)
4586 register char *filename
;
4588 #ifdef DBX_DEBUGGING_INFO
4589 if (write_symbols
== DBX_DEBUG
)
4590 dbxout_start_new_source_file (filename
);
4592 #ifdef DWARF_DEBUGGING_INFO
4593 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4594 && write_symbols
== DWARF_DEBUG
)
4595 dwarfout_start_new_source_file (filename
);
4596 #endif /* DWARF_DEBUGGING_INFO */
4597 #ifdef DWARF2_DEBUGGING_INFO
4598 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4599 && write_symbols
== DWARF2_DEBUG
)
4600 dwarf2out_start_source_file (filename
);
4601 #endif /* DWARF2_DEBUGGING_INFO */
4602 #ifdef SDB_DEBUGGING_INFO
4603 if (write_symbols
== SDB_DEBUG
)
4604 sdbout_start_new_source_file (filename
);
4608 /* Record the resumption of a source file. LINENO is the line number in
4609 the source file we are returning to. */
4612 debug_end_source_file (lineno
)
4613 register unsigned lineno
;
4615 #ifdef DBX_DEBUGGING_INFO
4616 if (write_symbols
== DBX_DEBUG
)
4617 dbxout_resume_previous_source_file ();
4619 #ifdef DWARF_DEBUGGING_INFO
4620 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4621 && write_symbols
== DWARF_DEBUG
)
4622 dwarfout_resume_previous_source_file (lineno
);
4623 #endif /* DWARF_DEBUGGING_INFO */
4624 #ifdef DWARF2_DEBUGGING_INFO
4625 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4626 && write_symbols
== DWARF2_DEBUG
)
4627 dwarf2out_end_source_file ();
4628 #endif /* DWARF2_DEBUGGING_INFO */
4629 #ifdef SDB_DEBUGGING_INFO
4630 if (write_symbols
== SDB_DEBUG
)
4631 sdbout_resume_previous_source_file ();
4635 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
4636 the tail part of the directive line, i.e. the part which is past the
4637 initial whitespace, #, whitespace, directive-name, whitespace part. */
4640 debug_define (lineno
, buffer
)
4641 register unsigned lineno
;
4642 register char *buffer
;
4644 #ifdef DWARF_DEBUGGING_INFO
4645 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4646 && write_symbols
== DWARF_DEBUG
)
4647 dwarfout_define (lineno
, buffer
);
4648 #endif /* DWARF_DEBUGGING_INFO */
4649 #ifdef DWARF2_DEBUGGING_INFO
4650 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4651 && write_symbols
== DWARF2_DEBUG
)
4652 dwarf2out_define (lineno
, buffer
);
4653 #endif /* DWARF2_DEBUGGING_INFO */
4656 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
4657 the tail part of the directive line, i.e. the part which is past the
4658 initial whitespace, #, whitespace, directive-name, whitespace part. */
4661 debug_undef (lineno
, buffer
)
4662 register unsigned lineno
;
4663 register char *buffer
;
4665 #ifdef DWARF_DEBUGGING_INFO
4666 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4667 && write_symbols
== DWARF_DEBUG
)
4668 dwarfout_undef (lineno
, buffer
);
4669 #endif /* DWARF_DEBUGGING_INFO */
4670 #ifdef DWARF2_DEBUGGING_INFO
4671 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4672 && write_symbols
== DWARF2_DEBUG
)
4673 dwarf2out_undef (lineno
, buffer
);
4674 #endif /* DWARF2_DEBUGGING_INFO */