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"
60 #ifdef DWARF_DEBUGGING_INFO
64 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
65 #include "dwarf2out.h"
68 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
72 #ifdef SDB_DEBUGGING_INFO
76 #ifdef XCOFF_DEBUGGING_INFO
81 /* The extra parameters substantially improve the I/O performance. */
83 vms_fopen (fname
, type
)
87 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
88 fixed arguments, which matches ANSI's specification but not VAXCRTL's
89 pre-ANSI implementation. This hack circumvents the mismatch problem. */
90 FILE *(*vmslib_fopen
)() = (FILE *(*)()) fopen
;
93 return (*vmslib_fopen
) (fname
, type
, "mbc=32",
94 "deq=64", "fop=tef", "shr=nil");
96 return (*vmslib_fopen
) (fname
, type
, "mbc=32");
98 #define fopen vms_fopen
101 #ifndef DEFAULT_GDB_EXTENSIONS
102 #define DEFAULT_GDB_EXTENSIONS 1
105 /* If more than one debugging type is supported, you must define
106 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
108 This is one long line cause VAXC can't handle a \-newline. */
109 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
110 #ifndef PREFERRED_DEBUGGING_TYPE
111 You Lose
! You must define PREFERRED_DEBUGGING_TYPE
!
112 #endif /* no PREFERRED_DEBUGGING_TYPE */
113 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
114 so the following code needn't care. */
115 #ifdef DBX_DEBUGGING_INFO
116 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
118 #ifdef SDB_DEBUGGING_INFO
119 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
121 #ifdef DWARF_DEBUGGING_INFO
122 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
124 #ifdef DWARF2_DEBUGGING_INFO
125 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
127 #ifdef XCOFF_DEBUGGING_INFO
128 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
130 #endif /* More than one debugger format enabled. */
132 /* If still not defined, must have been because no debugging formats
134 #ifndef PREFERRED_DEBUGGING_TYPE
135 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
138 extern int rtx_equal_function_value_matters
;
140 #if ! (defined (VMS) || defined (OS2))
141 extern char **environ
;
143 extern char *version_string
, *language_string
;
145 /* Carry information from ASM_DECLARE_OBJECT_NAME
146 to ASM_FINISH_DECLARE_OBJECT. */
148 extern int size_directive_output
;
149 extern tree last_assemble_variable_decl
;
151 extern char *init_parse
PVPROTO((char *));
152 extern void finish_parse ();
153 extern void init_decl_processing ();
154 extern void init_obstacks ();
155 extern void init_tree_codes ();
156 extern void init_rtl ();
157 extern void init_regs ();
158 extern void init_optabs ();
159 extern void init_stmt ();
160 extern void init_reg_sets ();
161 extern void dump_flow_info ();
162 extern void dump_sched_info ();
163 extern void dump_local_alloc ();
164 extern void regset_release_memory ();
166 extern void print_rtl ();
167 extern void print_rtl_with_bb ();
169 void rest_of_decl_compilation ();
170 void error_with_file_and_line
PVPROTO((char *file
, int line
, char *s
, ...));
171 void error_with_decl
PVPROTO((tree decl
, char *s
, ...));
172 void error
PVPROTO((char *s
, ...));
173 void fatal
PVPROTO((char *s
, ...));
174 void warning_with_file_and_line
PVPROTO((char *file
, int line
, char *s
, ...));
175 void warning_with_decl
PVPROTO((tree decl
, char *s
, ...));
176 void warning
PVPROTO((char *s
, ...));
177 void pedwarn
PVPROTO((char *s
, ...));
178 void pedwarn_with_decl
PVPROTO((tree decl
, char *s
, ...));
179 void pedwarn_with_file_and_line
PVPROTO((char *file
, int line
, char *s
, ...));
180 void sorry
PVPROTO((char *s
, ...));
181 void really_sorry
PVPROTO((char *s
, ...));
183 void set_target_switch ();
184 static char *decl_name
PROTO((tree
, int));
185 static void vmessage
PROTO((char *, char *, va_list));
186 static void v_message_with_file_and_line
PROTO((char *, int, char *,
188 static void v_message_with_decl
PROTO((tree
, char *, char *, va_list));
189 static void file_and_line_for_asm
PROTO((rtx
, char **, int *));
190 static void v_error_with_file_and_line
PROTO((char *, int, char *, va_list));
191 static void v_error_with_decl
PROTO((tree
, char *, va_list));
192 static void v_error_for_asm
PROTO((rtx
, char *, va_list));
193 static void verror
PROTO((char *, va_list));
194 static void vfatal
PROTO((char *, va_list));
195 static void v_warning_with_file_and_line
PROTO ((char *, int, char *, va_list));
196 static void v_warning_with_decl
PROTO((tree
, char *, va_list));
197 static void v_warning_for_asm
PROTO((rtx
, char *, va_list));
198 static void vwarning
PROTO((char *, va_list));
199 static void vpedwarn
PROTO((char *, va_list));
200 static void v_pedwarn_with_decl
PROTO((tree
, char *, va_list));
201 static void v_pedwarn_with_file_and_line
PROTO((char *, int, char *, va_list));
202 static void vsorry
PROTO((char *, va_list));
203 static void v_really_sorry
PROTO((char *, va_list));
204 static void float_signal
PROTO((int));
205 static void pipe_closed
PROTO((int));
206 static void output_lang_identify
PROTO((FILE *));
207 static void open_dump_file
PROTO((char *, char *));
208 static void close_dump_file
PROTO((void (*) (FILE *, rtx
), rtx
));
209 static void dump_rtl
PROTO((char *, tree
, void (*) (FILE *, rtx
), rtx
));
210 static void clean_dump_file
PROTO((char *));
211 static void compile_file
PROTO((char *));
213 void print_version ();
214 int print_single_switch ();
215 void print_switch_values ();
216 /* Length of line when printing switch values. */
219 /* Name of program invoked, sans directories. */
223 /* Copy of arguments to main. */
227 /* Name of current original source file (what was input to cpp).
228 This comes from each #-command in the actual input. */
230 char *input_filename
;
232 /* Name of top-level original source file (what was input to cpp).
233 This comes from the #-command at the beginning of the actual input.
234 If there isn't any there, then this is the cc1 input file name. */
236 char *main_input_filename
;
238 /* Current line number in real source file. */
242 /* Stack of currently pending input files. */
244 struct file_stack
*input_file_stack
;
246 /* Incremented on each change to input_file_stack. */
247 int input_file_stack_tick
;
249 /* FUNCTION_DECL for function now being parsed or compiled. */
251 extern tree current_function_decl
;
253 /* Name to use as base of names for dump output files. */
255 char *dump_base_name
;
257 /* Bit flags that specify the machine subtype we are compiling for.
258 Bits are tested using macros TARGET_... defined in the tm.h file
259 and set by `-m...' switches. Must be defined in rtlanal.c. */
261 extern int target_flags
;
263 /* Flags saying which kinds of debugging dump have been requested. */
266 int rtl_dump_and_exit
= 0;
267 int jump_opt_dump
= 0;
268 int addressof_dump
= 0;
273 int branch_prob_dump
= 0;
275 int combine_dump
= 0;
276 int regmove_dump
= 0;
278 int local_reg_dump
= 0;
279 int global_reg_dump
= 0;
281 int jump2_opt_dump
= 0;
283 int dbr_sched_dump
= 0;
285 int flag_print_asm_name
= 0;
287 int stack_reg_dump
= 0;
289 #ifdef MACHINE_DEPENDENT_REORG
290 int mach_dep_reorg_dump
= 0;
293 /* Name for output file of assembly code, specified with -o. */
297 /* Value of the -G xx switch, and whether it was passed or not. */
301 /* Type(s) of debugging information we are producing (if any).
302 See flags.h for the definitions of the different possible
303 types of debugging information. */
304 enum debug_info_type write_symbols
= NO_DEBUG
;
306 /* Level of debugging information we are producing. See flags.h
307 for the definitions of the different possible levels. */
308 enum debug_info_level debug_info_level
= DINFO_LEVEL_NONE
;
310 /* Nonzero means use GNU-only extensions in the generated symbolic
311 debugging information. */
312 /* Currently, this only has an effect when write_symbols is set to
313 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
314 int use_gnu_debug_info_extensions
= 0;
316 /* Nonzero means do optimizations. -O.
317 Particular numeric values stand for particular amounts of optimization;
318 thus, -O2 stores 2 here. However, the optimizations beyond the basic
319 ones are not controlled directly by this variable. Instead, they are
320 controlled by individual `flag_...' variables that are defaulted
321 based on this variable. */
325 /* Nonzero means optimize for size. -Os.
326 The only valid values are zero and non-zero. When optimize_size is
327 non-zero, optimize defaults to 2, but certain individual code
328 bloating optimizations are disabled. */
330 int optimize_size
= 0;
332 /* Number of error messages and warning messages so far. */
335 int warningcount
= 0;
338 /* Pointer to function to compute the name to use to print a declaration.
339 DECL is the declaration in question.
340 VERBOSITY determines what information will be printed:
341 0: DECL_NAME, demangled as necessary.
342 1: and scope information.
343 2: and any other information that might be interesting, such as function
344 parameter types in C++. */
346 char *(*decl_printable_name
) (/* tree decl, int verbosity */);
348 /* Pointer to function to compute rtl for a language-specific tree code. */
350 struct rtx_def
*(*lang_expand_expr
) ();
352 /* Pointer to function to finish handling an incomplete decl at the
353 end of compilation. */
355 void (*incomplete_decl_finalize_hook
) () = 0;
357 /* Highest label number used at the end of reload. */
359 int max_label_num_after_reload
;
361 /* Nonzero if generating code to do profiling. */
363 int profile_flag
= 0;
365 /* Nonzero if generating code to do profiling on a line-by-line basis. */
367 int profile_block_flag
;
369 /* Nonzero if generating code to profile program flow graph arcs. */
371 int profile_arc_flag
= 0;
373 /* Nonzero if generating info for gcov to calculate line test coverage. */
375 int flag_test_coverage
= 0;
377 /* Nonzero indicates that branch taken probabilities should be calculated. */
379 int flag_branch_probabilities
= 0;
381 /* Nonzero for -pedantic switch: warn about anything
382 that standard spec forbids. */
386 /* Temporarily suppress certain warnings.
387 This is set while reading code from a system header file. */
389 int in_system_header
= 0;
391 /* Nonzero means do stupid register allocation.
392 Currently, this is 1 if `optimize' is 0. */
394 int obey_regdecls
= 0;
396 /* Don't print functions as they are compiled and don't print
397 times taken by the various passes. -quiet. */
403 /* Nonzero means `char' should be signed. */
405 int flag_signed_char
;
407 /* Nonzero means give an enum type only as many bytes as it needs. */
409 int flag_short_enums
;
411 /* Nonzero for -fcaller-saves: allocate values in regs that need to
412 be saved across function calls, if that produces overall better code.
413 Optional now, so people can test it. */
415 #ifdef DEFAULT_CALLER_SAVES
416 int flag_caller_saves
= 1;
418 int flag_caller_saves
= 0;
421 /* Nonzero if structures and unions should be returned in memory.
423 This should only be defined if compatibility with another compiler or
424 with an ABI is needed, because it results in slower code. */
426 #ifndef DEFAULT_PCC_STRUCT_RETURN
427 #define DEFAULT_PCC_STRUCT_RETURN 1
430 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
432 int flag_pcc_struct_return
= DEFAULT_PCC_STRUCT_RETURN
;
434 /* Nonzero for -fforce-mem: load memory value into a register
435 before arithmetic on it. This makes better cse but slower compilation. */
437 int flag_force_mem
= 0;
439 /* Nonzero for -fforce-addr: load memory address into a register before
440 reference to memory. This makes better cse but slower compilation. */
442 int flag_force_addr
= 0;
444 /* Nonzero for -fdefer-pop: don't pop args after each function call;
445 instead save them up to pop many calls' args with one insns. */
447 int flag_defer_pop
= 0;
449 /* Nonzero for -ffloat-store: don't allocate floats and doubles
450 in extended-precision registers. */
452 int flag_float_store
= 0;
454 /* Nonzero for -fcse-follow-jumps:
455 have cse follow jumps to do a more extensive job. */
457 int flag_cse_follow_jumps
;
459 /* Nonzero for -fcse-skip-blocks:
460 have cse follow a branch around a block. */
461 int flag_cse_skip_blocks
;
463 /* Nonzero for -fexpensive-optimizations:
464 perform miscellaneous relatively-expensive optimizations. */
465 int flag_expensive_optimizations
;
467 /* Nonzero for -fthread-jumps:
468 have jump optimize output of loop. */
470 int flag_thread_jumps
;
472 /* Nonzero enables strength-reduction in loop.c. */
474 int flag_strength_reduce
= 0;
476 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
477 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
478 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
481 int flag_unroll_loops
;
483 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
484 This is generally not a win. */
486 int flag_unroll_all_loops
;
488 /* Nonzero forces all invariant computations in loops to be moved
491 int flag_move_all_movables
= 0;
493 /* Nonzero forces all general induction variables in loops to be
496 int flag_reduce_all_givs
= 0;
498 /* Nonzero to perform full register move optimization passes. This is the
501 int flag_regmove
= 0;
503 /* Nonzero for -fwritable-strings:
504 store string constants in data segment and don't uniquize them. */
506 int flag_writable_strings
= 0;
508 /* Nonzero means don't put addresses of constant functions in registers.
509 Used for compiling the Unix kernel, where strange substitutions are
510 done on the assembly output. */
512 int flag_no_function_cse
= 0;
514 /* Nonzero for -fomit-frame-pointer:
515 don't make a frame pointer in simple functions that don't require one. */
517 int flag_omit_frame_pointer
= 0;
519 /* Nonzero means place each function into its own section on those platforms
520 which support arbitrary section names and unlimited numbers of sections. */
522 int flag_function_sections
= 0;
524 /* Nonzero to inhibit use of define_optimization peephole opts. */
526 int flag_no_peephole
= 0;
528 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
529 operations in the interest of optimization. For example it allows
530 GCC to assume arguments to sqrt are nonnegative numbers, allowing
531 faster code for sqrt to be generated. */
533 int flag_fast_math
= 0;
535 /* Nonzero means all references through pointers are volatile. */
539 /* Nonzero means treat all global and extern variables as global. */
541 int flag_volatile_global
;
543 /* Nonzero means just do syntax checking; don't output anything. */
545 int flag_syntax_only
= 0;
547 /* Nonzero means perform global cse. */
549 static int flag_gcse
;
551 /* Nonzero means to rerun cse after loop optimization. This increases
552 compilation time about 20% and picks up a few more common expressions. */
554 static int flag_rerun_cse_after_loop
;
556 /* Nonzero means to run loop optimizations twice. */
558 int flag_rerun_loop_opt
;
560 /* Nonzero for -finline-functions: ok to inline functions that look like
561 good inline candidates. */
563 int flag_inline_functions
;
565 /* Nonzero for -fkeep-inline-functions: even if we make a function
566 go inline everywhere, keep its definition around for debugging
569 int flag_keep_inline_functions
;
571 /* Nonzero means that functions will not be inlined. */
575 /* Nonzero means that we should emit static const variables
576 regardless of whether or not optimization is turned on. */
578 int flag_keep_static_consts
= 1;
580 /* Nonzero means we should be saving declaration info into a .X file. */
582 int flag_gen_aux_info
= 0;
584 /* Specified name of aux-info file. */
586 static char *aux_info_file_name
;
588 /* Nonzero means make the text shared if supported. */
590 int flag_shared_data
;
592 /* Nonzero means schedule into delayed branch slots if supported. */
594 int flag_delayed_branch
;
596 /* Nonzero if we are compiling pure (sharable) code.
597 Value is 1 if we are doing reasonable (i.e. simple
598 offset into offset table) pic. Value is 2 if we can
599 only perform register offsets. */
603 /* Nonzero means generate extra code for exception handling and enable
604 exception handling. */
608 /* Nonzero means use the new model for exception handling. Replaces
609 -DNEW_EH_MODEL as a compile option. */
611 int flag_new_exceptions
= 0;
613 /* Nonzero means don't place uninitialized global data in common storage
618 /* Nonzero means pretend it is OK to examine bits of target floats,
619 even if that isn't true. The resulting code will have incorrect constants,
620 but the same series of instructions that the native compiler would make. */
622 int flag_pretend_float
;
624 /* Nonzero means change certain warnings into errors.
625 Usually these are warnings about failure to conform to some standard. */
627 int flag_pedantic_errors
= 0;
629 /* flag_schedule_insns means schedule insns within basic blocks (before
631 flag_schedule_insns_after_reload means schedule insns after
634 int flag_schedule_insns
= 0;
635 int flag_schedule_insns_after_reload
= 0;
638 /* The following flags have effect only for scheduling before register
641 flag_schedule_interblock means schedule insns accross basic blocks.
642 flag_schedule_speculative means allow speculative motion of non-load insns.
643 flag_schedule_speculative_load means allow speculative motion of some
645 flag_schedule_speculative_load_dangerous allows speculative motion of more
648 int flag_schedule_interblock
= 1;
649 int flag_schedule_speculative
= 1;
650 int flag_schedule_speculative_load
= 0;
651 int flag_schedule_speculative_load_dangerous
= 0;
653 /* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple
654 by a cheaper branch, on a count register. */
655 int flag_branch_on_count_reg
;
659 /* -finhibit-size-directive inhibits output of .size for ELF.
660 This is used only for compiling crtstuff.c,
661 and it may be extended to other effects
662 needed for crtstuff.c on other systems. */
663 int flag_inhibit_size_directive
= 0;
665 /* -fverbose-asm causes extra commentary information to be produced in
666 the generated assembly code (to make it more readable). This option
667 is generally only of use to those who actually need to read the
668 generated assembly code (perhaps while debugging the compiler itself).
669 -fno-verbose-asm, the default, causes the extra information
670 to be omitted and is useful when comparing two assembler files. */
672 int flag_verbose_asm
= 0;
674 /* -dA causes debug commentary information to be produced in
675 the generated assembly code (to make it more readable). This option
676 is generally only of use to those who actually need to read the
677 generated assembly code (perhaps while debugging the compiler itself).
678 Currently, this switch is only used by dwarfout.c; however, it is intended
679 to be a catchall for printing debug information in the assembler file. */
681 int flag_debug_asm
= 0;
683 /* -fgnu-linker specifies use of the GNU linker for initializations.
684 (Or, more generally, a linker that handles initializations.)
685 -fno-gnu-linker says that collect2 will be used. */
687 int flag_gnu_linker
= 0;
689 int flag_gnu_linker
= 1;
692 /* Tag all structures with __attribute__(packed) */
693 int flag_pack_struct
= 0;
695 /* Emit code to check for stack overflow; also may cause large objects
696 to be allocated dynamically. */
697 int flag_stack_check
;
699 /* -fcheck-memory-usage causes extra code to be generated in order to check
700 memory accesses. This is used by a detector of bad memory accesses such
702 int flag_check_memory_usage
= 0;
704 /* -fprefix-function-name causes function name to be prefixed. This
705 can be used with -fcheck-memory-usage to isolate code compiled with
706 -fcheck-memory-usage. */
707 int flag_prefix_function_name
= 0;
709 /* 0 if pointer arguments may alias each other. True in C.
710 1 if pointer arguments may not alias each other but may alias
712 2 if pointer arguments may not alias each other and may not
713 alias global variables. True in Fortran.
714 This defaults to 0 for C. */
715 int flag_argument_noalias
= 0;
717 /* Nonzero if we should do (language-dependent) alias analysis.
718 Typically, this analysis will assume that expressions of certain
719 types do not alias expressions of certain other types. Only used
720 if alias analysis (in general) is enabled. */
721 int flag_strict_aliasing
= 0;
723 extern int flag_dump_unnumbered
;
725 /* Table of language-independent -f options.
726 STRING is the option name. VARIABLE is the address of the variable.
727 ON_VALUE is the value to store in VARIABLE
728 if `-fSTRING' is seen as an option.
729 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
731 struct { char *string
; int *variable
; int on_value
;} f_options
[] =
733 {"float-store", &flag_float_store
, 1},
734 {"volatile", &flag_volatile
, 1},
735 {"volatile-global", &flag_volatile_global
, 1},
736 {"defer-pop", &flag_defer_pop
, 1},
737 {"omit-frame-pointer", &flag_omit_frame_pointer
, 1},
738 {"cse-follow-jumps", &flag_cse_follow_jumps
, 1},
739 {"cse-skip-blocks", &flag_cse_skip_blocks
, 1},
740 {"expensive-optimizations", &flag_expensive_optimizations
, 1},
741 {"thread-jumps", &flag_thread_jumps
, 1},
742 {"strength-reduce", &flag_strength_reduce
, 1},
743 {"unroll-loops", &flag_unroll_loops
, 1},
744 {"unroll-all-loops", &flag_unroll_all_loops
, 1},
745 {"move-all-movables", &flag_move_all_movables
, 1},
746 {"reduce-all-givs", &flag_reduce_all_givs
, 1},
747 {"writable-strings", &flag_writable_strings
, 1},
748 {"peephole", &flag_no_peephole
, 0},
749 {"force-mem", &flag_force_mem
, 1},
750 {"force-addr", &flag_force_addr
, 1},
751 {"function-cse", &flag_no_function_cse
, 0},
752 {"inline-functions", &flag_inline_functions
, 1},
753 {"keep-inline-functions", &flag_keep_inline_functions
, 1},
754 {"inline", &flag_no_inline
, 0},
755 {"keep-static-consts", &flag_keep_static_consts
, 1},
756 {"syntax-only", &flag_syntax_only
, 1},
757 {"shared-data", &flag_shared_data
, 1},
758 {"caller-saves", &flag_caller_saves
, 1},
759 {"pcc-struct-return", &flag_pcc_struct_return
, 1},
760 {"reg-struct-return", &flag_pcc_struct_return
, 0},
761 {"delayed-branch", &flag_delayed_branch
, 1},
762 {"gcse", &flag_gcse
, 1},
763 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop
, 1},
764 {"rerun-loop-opt", &flag_rerun_loop_opt
, 1},
765 {"pretend-float", &flag_pretend_float
, 1},
766 {"schedule-insns", &flag_schedule_insns
, 1},
767 {"schedule-insns2", &flag_schedule_insns_after_reload
, 1},
769 {"sched-interblock",&flag_schedule_interblock
, 1},
770 {"sched-spec",&flag_schedule_speculative
, 1},
771 {"sched-spec-load",&flag_schedule_speculative_load
, 1},
772 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous
, 1},
773 {"branch-count-reg",&flag_branch_on_count_reg
, 1},
775 {"pic", &flag_pic
, 1},
776 {"PIC", &flag_pic
, 2},
777 {"exceptions", &flag_exceptions
, 1},
778 {"new-exceptions", &flag_new_exceptions
, 1},
779 {"sjlj-exceptions", &exceptions_via_longjmp
, 1},
780 {"asynchronous-exceptions", &asynchronous_exceptions
, 1},
781 {"profile-arcs", &profile_arc_flag
, 1},
782 {"test-coverage", &flag_test_coverage
, 1},
783 {"branch-probabilities", &flag_branch_probabilities
, 1},
784 {"fast-math", &flag_fast_math
, 1},
785 {"common", &flag_no_common
, 0},
786 {"inhibit-size-directive", &flag_inhibit_size_directive
, 1},
787 {"function-sections", &flag_function_sections
, 1},
788 {"verbose-asm", &flag_verbose_asm
, 1},
789 {"gnu-linker", &flag_gnu_linker
, 1},
790 {"regmove", &flag_regmove
, 1},
791 {"optimize-register-move", &flag_regmove
, 1},
792 {"pack-struct", &flag_pack_struct
, 1},
793 {"stack-check", &flag_stack_check
, 1},
794 {"argument-alias", &flag_argument_noalias
, 0},
795 {"argument-noalias", &flag_argument_noalias
, 1},
796 {"argument-noalias-global", &flag_argument_noalias
, 2},
797 {"strict-aliasing", &flag_strict_aliasing
, 1},
798 {"check-memory-usage", &flag_check_memory_usage
, 1},
799 {"prefix-function-name", &flag_prefix_function_name
, 1},
800 {"dump-unnumbered", &flag_dump_unnumbered
, 1}
803 /* Table of language-specific options. */
805 char *lang_options
[] =
808 "-fallow-single-precision",
810 "-fsigned-bitfields",
811 "-funsigned-bitfields",
812 "-fno-signed-bitfields",
813 "-fno-unsigned-bitfields",
817 "-fno-unsigned-char",
833 "-fno-cond-mismatch",
834 "-fdollars-in-identifiers",
835 "-fno-dollars-in-identifiers",
844 "-Wbad-function-cast",
845 "-Wno-bad-function-cast",
849 "-Wno-char-subscripts",
860 "-Wimplicit-function-declaration",
861 "-Wno-implicit-function-declaration",
862 "-Werror-implicit-function-declaration",
872 "-Wno-missing-braces",
873 "-Wmissing-declarations",
874 "-Wno-missing-declarations",
875 "-Wmissing-prototypes",
876 "-Wno-missing-prototypes",
880 "-Wno-nested-externs",
884 "-Wno-pointer-arith",
886 "-Wno-redundant-decls",
890 "-Wno-unknown-pragmas",
891 "-Wstrict-prototypes",
892 "-Wno-strict-prototypes",
900 "-Wno-write-strings",
902 /* these are for obj c */
913 "-print-objc-runtime-info",
915 /* These are for languages with USE_CPPLIB. */
936 /* Options controlling warnings */
938 /* Don't print warning messages. -w. */
940 int inhibit_warnings
= 0;
942 /* Print various extra warnings. -W. */
944 int extra_warnings
= 0;
946 /* Treat warnings as errors. -Werror. */
948 int warnings_are_errors
= 0;
950 /* Nonzero to warn about unused local variables. */
954 /* Nonzero to warn about variables used before they are initialized. */
956 int warn_uninitialized
;
958 /* Nonzero means warn about all declarations which shadow others. */
962 /* Warn if a switch on an enum fails to have a case for every enum value. */
966 /* Nonzero means warn about function definitions that default the return type
967 or that use a null return and have a return-type other than void. */
969 int warn_return_type
;
971 /* Nonzero means warn about pointer casts that increase the required
972 alignment of the target type (and might therefore lead to a crash
973 due to a misaligned access). */
977 /* Nonzero means warn about any identifiers that match in the first N
978 characters. The value N is in `id_clash_len'. */
981 unsigned id_clash_len
;
983 /* Nonzero means warn about any objects definitions whose size is larger
984 than N bytes. Also want about function definitions whose returned
985 values are larger than N bytes. The value N is in `larger_than_size'. */
987 int warn_larger_than
;
988 unsigned larger_than_size
;
990 /* Nonzero means warn if inline function is too large. */
994 /* Warn if a function returns an aggregate,
995 since there are often incompatible calling conventions for doing this. */
997 int warn_aggregate_return
;
999 /* Likewise for -W. */
1001 struct { char *string
; int *variable
; int on_value
;} W_options
[] =
1003 {"unused", &warn_unused
, 1},
1004 {"error", &warnings_are_errors
, 1},
1005 {"shadow", &warn_shadow
, 1},
1006 {"switch", &warn_switch
, 1},
1007 {"aggregate-return", &warn_aggregate_return
, 1},
1008 {"cast-align", &warn_cast_align
, 1},
1009 {"uninitialized", &warn_uninitialized
, 1},
1010 {"inline", &warn_inline
, 1}
1013 /* Output files for assembler code (real compiler output)
1014 and debugging dumps. */
1017 FILE *aux_info_file
;
1018 FILE *rtl_dump_file
= NULL
;
1020 /* Time accumulators, to count the total time spent in various passes. */
1024 int integration_time
;
1030 int branch_prob_time
;
1035 int local_alloc_time
;
1036 int global_alloc_time
;
1041 int shorten_branch_time
;
1047 /* Return time used so far, in microseconds. */
1057 #else /* not BeOS */
1058 #if defined (_WIN32) && !defined (__CYGWIN32__)
1062 return (clock() * 1000);
1063 #else /* not _WIN32 */
1069 tick
= 1000000 / sysconf(_SC_CLK_TCK
);
1071 return (tms
.tms_utime
+ tms
.tms_stime
) * tick
;
1077 # if HAVE_SYSCONF && defined _SC_CLK_TCK
1078 # define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */
1081 # define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */
1083 # define TICKS_PER_SECOND HZ /* traditional UNIX */
1087 return (tms
.tms_utime
+ tms
.tms_stime
) * (1000000 / TICKS_PER_SECOND
);
1092 struct rusage rusage
;
1093 getrusage (0, &rusage
);
1094 return (rusage
.ru_utime
.tv_sec
* 1000000 + rusage
.ru_utime
.tv_usec
1095 + rusage
.ru_stime
.tv_sec
* 1000000 + rusage
.ru_stime
.tv_usec
);
1102 int proc_system_time
;
1103 int child_user_time
;
1104 int child_system_time
;
1106 times ((void *) &vms_times
);
1107 return (vms_times
.proc_user_time
+ vms_times
.proc_system_time
) * 10000;
1111 #endif /* _SC_CLK_TCK */
1113 #endif /* __BEOS__ */
1116 #define TIMEVAR(VAR, BODY) \
1117 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
1120 print_time (str
, total
)
1125 "time in %s: %d.%06d\n",
1126 str
, total
/ 1000000, total
% 1000000);
1129 /* Count an error or warning. Return 1 if the message should be printed. */
1132 count_error (warningp
)
1135 if (warningp
&& inhibit_warnings
)
1138 if (warningp
&& !warnings_are_errors
)
1142 static int warning_message
= 0;
1144 if (warningp
&& !warning_message
)
1146 fprintf (stderr
, "%s: warnings being treated as errors\n", progname
);
1147 warning_message
= 1;
1155 /* Print a fatal error message. NAME is the text.
1156 Also include a system error message based on `errno'. */
1159 pfatal_with_name (name
)
1162 fprintf (stderr
, "%s: ", progname
);
1164 exit (FATAL_EXIT_CODE
);
1168 fatal_io_error (name
)
1171 fprintf (stderr
, "%s: %s: I/O error\n", progname
, name
);
1172 exit (FATAL_EXIT_CODE
);
1175 /* Called to give a better error message for a bad insn rather than
1176 just calling abort(). */
1179 fatal_insn (message
, insn
)
1186 fflush (asm_out_file
);
1188 fflush (aux_info_file
);
1189 if (rtl_dump_file
!= NULL
)
1190 fflush (rtl_dump_file
);
1196 /* Called to give a better error message when we don't have an insn to match
1197 what we are looking for or if the insn's constraints aren't satisfied,
1198 rather than just calling abort(). */
1201 fatal_insn_not_found (insn
)
1204 if (INSN_CODE (insn
) < 0)
1205 fatal_insn ("internal error--unrecognizable insn:", insn
);
1207 fatal_insn ("internal error--insn does not satisfy its constraints:", insn
);
1210 /* This is the default decl_printable_name function. */
1213 decl_name (decl
, verbosity
)
1217 return IDENTIFIER_POINTER (DECL_NAME (decl
));
1220 static int need_error_newline
;
1222 /* Function of last error message;
1223 more generally, function such that if next error message is in it
1224 then we don't have to mention the function name. */
1225 static tree last_error_function
= NULL
;
1227 /* Used to detect when input_file_stack has changed since last described. */
1228 static int last_error_tick
;
1230 /* Called when the start of a function definition is parsed,
1231 this function prints on stderr the name of the function. */
1234 announce_function (decl
)
1239 if (rtl_dump_and_exit
)
1240 fprintf (stderr
, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl
)));
1242 fprintf (stderr
, " %s", (*decl_printable_name
) (decl
, 2));
1244 need_error_newline
= 1;
1245 last_error_function
= current_function_decl
;
1249 /* The default function to print out name of current function that caused
1253 default_print_error_function (file
)
1256 if (last_error_function
!= current_function_decl
)
1258 char *kind
= "function";
1259 if (current_function_decl
!= 0
1260 && TREE_CODE (TREE_TYPE (current_function_decl
)) == METHOD_TYPE
)
1264 fprintf (stderr
, "%s: ", file
);
1266 if (current_function_decl
== NULL
)
1267 fprintf (stderr
, "At top level:\n");
1270 char *name
= (*decl_printable_name
) (current_function_decl
, 2);
1271 fprintf (stderr
, "In %s `%s':\n", kind
, name
);
1274 last_error_function
= current_function_decl
;
1278 /* Called by report_error_function to print out function name.
1279 * Default may be overridden by language front-ends. */
1281 void (*print_error_function
) PROTO((char *)) = default_print_error_function
;
1283 /* Prints out, if necessary, the name of the current function
1284 that caused an error. Called from all error and warning functions. */
1287 report_error_function (file
)
1290 struct file_stack
*p
;
1292 if (need_error_newline
)
1294 fprintf (stderr
, "\n");
1295 need_error_newline
= 0;
1298 (*print_error_function
) (file
);
1300 if (input_file_stack
&& input_file_stack
->next
!= 0
1301 && input_file_stack_tick
!= last_error_tick
1302 && file
== input_filename
)
1304 fprintf (stderr
, "In file included");
1305 for (p
= input_file_stack
->next
; p
; p
= p
->next
)
1307 fprintf (stderr
, " from %s:%d", p
->name
, p
->line
);
1309 fprintf (stderr
, ",\n ");
1311 fprintf (stderr
, ":\n");
1312 last_error_tick
= input_file_stack_tick
;
1316 /* Print a message. */
1319 vmessage (prefix
, s
, ap
)
1325 fprintf (stderr
, "%s: ", prefix
);
1327 vfprintf (stderr
, s
, ap
);
1330 /* Print a message relevant to line LINE of file FILE. */
1333 v_message_with_file_and_line (file
, line
, prefix
, s
, ap
)
1341 fprintf (stderr
, "%s:%d: ", file
, line
);
1343 fprintf (stderr
, "%s: ", progname
);
1345 vmessage (prefix
, s
, ap
);
1346 fputc ('\n', stderr
);
1349 /* Print a message relevant to the given DECL. */
1352 v_message_with_decl (decl
, prefix
, s
, ap
)
1360 fprintf (stderr
, "%s:%d: ",
1361 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
1364 fprintf (stderr
, "%s: ", prefix
);
1366 /* Do magic to get around lack of varargs support for insertion
1367 of arguments into existing list. We know that the decl is first;
1368 we ass_u_me that it will be printed with "%s". */
1370 for (p
= s
; *p
; ++p
)
1374 if (*(p
+ 1) == '%')
1381 if (p
> s
) /* Print the left-hand substring. */
1383 char fmt
[sizeof "%.255s"];
1386 if (width
> 255L) width
= 255L; /* arbitrary */
1387 sprintf (fmt
, "%%.%lds", width
);
1388 fprintf (stderr
, fmt
, s
);
1391 if (*p
== '%') /* Print the name. */
1393 char *n
= (DECL_NAME (decl
)
1394 ? (*decl_printable_name
) (decl
, 2)
1400 if (ISALPHA (*(p
- 1) & 0xFF))
1405 if (*p
) /* Print the rest of the message. */
1406 vmessage ((char *)NULL
, p
, ap
);
1408 fputc ('\n', stderr
);
1411 /* Figure file and line of the given INSN. */
1414 file_and_line_for_asm (insn
, pfile
, pline
)
1419 rtx body
= PATTERN (insn
);
1422 /* Find the (or one of the) ASM_OPERANDS in the insn. */
1423 if (GET_CODE (body
) == SET
&& GET_CODE (SET_SRC (body
)) == ASM_OPERANDS
)
1424 asmop
= SET_SRC (body
);
1425 else if (GET_CODE (body
) == ASM_OPERANDS
)
1427 else if (GET_CODE (body
) == PARALLEL
1428 && GET_CODE (XVECEXP (body
, 0, 0)) == SET
)
1429 asmop
= SET_SRC (XVECEXP (body
, 0, 0));
1430 else if (GET_CODE (body
) == PARALLEL
1431 && GET_CODE (XVECEXP (body
, 0, 0)) == ASM_OPERANDS
)
1432 asmop
= XVECEXP (body
, 0, 0);
1438 *pfile
= ASM_OPERANDS_SOURCE_FILE (asmop
);
1439 *pline
= ASM_OPERANDS_SOURCE_LINE (asmop
);
1443 *pfile
= input_filename
;
1448 /* Report an error at line LINE of file FILE. */
1451 v_error_with_file_and_line (file
, line
, s
, ap
)
1458 report_error_function (file
);
1459 v_message_with_file_and_line (file
, line
, (char *)NULL
, s
, ap
);
1463 error_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1475 file
= va_arg (ap
, char *);
1476 line
= va_arg (ap
, int);
1477 s
= va_arg (ap
, char *);
1480 v_error_with_file_and_line (file
, line
, s
, ap
);
1484 /* Report an error at the declaration DECL.
1485 S is a format string which uses %s to substitute the declaration
1486 name; subsequent substitutions are a la printf. */
1489 v_error_with_decl (decl
, s
, ap
)
1495 report_error_function (DECL_SOURCE_FILE (decl
));
1496 v_message_with_decl (decl
, (char *)NULL
, s
, ap
);
1500 error_with_decl
VPROTO((tree decl
, char *s
, ...))
1511 decl
= va_arg (ap
, tree
);
1512 s
= va_arg (ap
, char *);
1515 v_error_with_decl (decl
, s
, ap
);
1519 /* Report an error at the line number of the insn INSN.
1520 This is used only when INSN is an `asm' with operands,
1521 and each ASM_OPERANDS records its own source file and line. */
1524 v_error_for_asm (insn
, s
, ap
)
1533 file_and_line_for_asm (insn
, &file
, &line
);
1534 report_error_function (file
);
1535 v_message_with_file_and_line (file
, line
, (char *)NULL
, s
, ap
);
1539 error_for_asm
VPROTO((rtx insn
, char *s
, ...))
1550 insn
= va_arg (ap
, rtx
);
1551 s
= va_arg (ap
, char *);
1554 v_error_for_asm (insn
, s
, ap
);
1558 /* Report an error at the current line number. */
1565 v_error_with_file_and_line (input_filename
, lineno
, s
, ap
);
1569 error
VPROTO((char *s
, ...))
1579 s
= va_arg (ap
, char *);
1586 /* Report a fatal error at the current line number. */
1594 exit (FATAL_EXIT_CODE
);
1598 fatal
VPROTO((char *s
, ...))
1608 s
= va_arg (ap
, char *);
1615 /* Report a warning at line LINE of file FILE. */
1618 v_warning_with_file_and_line (file
, line
, s
, ap
)
1624 if (count_error (1))
1626 report_error_function (file
);
1627 v_message_with_file_and_line (file
, line
, "warning", s
, ap
);
1632 warning_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1644 file
= va_arg (ap
, char *);
1645 line
= va_arg (ap
, int);
1646 s
= va_arg (ap
, char *);
1649 v_warning_with_file_and_line (file
, line
, s
, ap
);
1653 /* Report a warning at the declaration DECL.
1654 S is a format string which uses %s to substitute the declaration
1655 name; subsequent substitutions are a la printf. */
1658 v_warning_with_decl (decl
, s
, ap
)
1663 if (count_error (1))
1665 report_error_function (DECL_SOURCE_FILE (decl
));
1666 v_message_with_decl (decl
, "warning", s
, ap
);
1671 warning_with_decl
VPROTO((tree decl
, char *s
, ...))
1682 decl
= va_arg (ap
, tree
);
1683 s
= va_arg (ap
, char *);
1686 v_warning_with_decl (decl
, s
, ap
);
1690 /* Report a warning at the line number of the insn INSN.
1691 This is used only when INSN is an `asm' with operands,
1692 and each ASM_OPERANDS records its own source file and line. */
1695 v_warning_for_asm (insn
, s
, ap
)
1700 if (count_error (1))
1705 file_and_line_for_asm (insn
, &file
, &line
);
1706 report_error_function (file
);
1707 v_message_with_file_and_line (file
, line
, "warning", s
, ap
);
1712 warning_for_asm
VPROTO((rtx insn
, char *s
, ...))
1723 insn
= va_arg (ap
, rtx
);
1724 s
= va_arg (ap
, char *);
1727 v_warning_for_asm (insn
, s
, ap
);
1731 /* Report a warning at the current line number. */
1738 v_warning_with_file_and_line (input_filename
, lineno
, s
, ap
);
1742 warning
VPROTO((char *s
, ...))
1752 s
= va_arg (ap
, char *);
1759 /* These functions issue either warnings or errors depending on
1760 -pedantic-errors. */
1767 if (flag_pedantic_errors
)
1774 pedwarn
VPROTO((char *s
, ...))
1784 s
= va_arg (ap
, char *);
1792 v_pedwarn_with_decl (decl
, s
, ap
)
1797 /* We don't want -pedantic-errors to cause the compilation to fail from
1798 "errors" in system header files. Sometimes fixincludes can't fix what's
1799 broken (eg: unsigned char bitfields - fixing it may change the alignment
1800 which will cause programs to mysteriously fail because the C library
1801 or kernel uses the original layout). There's no point in issuing a
1802 warning either, it's just unnecessary noise. */
1804 if (! DECL_IN_SYSTEM_HEADER (decl
))
1806 if (flag_pedantic_errors
)
1807 v_error_with_decl (decl
, s
, ap
);
1809 v_warning_with_decl (decl
, s
, ap
);
1814 pedwarn_with_decl
VPROTO((tree decl
, char *s
, ...))
1825 decl
= va_arg (ap
, tree
);
1826 s
= va_arg (ap
, char *);
1829 v_pedwarn_with_decl (decl
, s
, ap
);
1834 v_pedwarn_with_file_and_line (file
, line
, s
, ap
)
1840 if (flag_pedantic_errors
)
1841 v_error_with_file_and_line (file
, line
, s
, ap
);
1843 v_warning_with_file_and_line (file
, line
, s
, ap
);
1847 pedwarn_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1859 file
= va_arg (ap
, char *);
1860 line
= va_arg (ap
, int);
1861 s
= va_arg (ap
, char *);
1864 v_pedwarn_with_file_and_line (file
, line
, s
, ap
);
1868 /* Apologize for not implementing some feature. */
1877 fprintf (stderr
, "%s:%d: ", input_filename
, lineno
);
1879 fprintf (stderr
, "%s: ", progname
);
1880 vmessage ("sorry, not implemented", s
, ap
);
1881 fputc ('\n', stderr
);
1885 sorry
VPROTO((char *s
, ...))
1895 s
= va_arg (ap
, char *);
1902 /* Apologize for not implementing some feature, then quit. */
1905 v_really_sorry (s
, ap
)
1911 fprintf (stderr
, "%s:%d: ", input_filename
, lineno
);
1913 fprintf (stderr
, "%s: ", progname
);
1914 vmessage ("sorry, not implemented", s
, ap
);
1915 fatal (" (fatal)\n");
1919 really_sorry
VPROTO((char *s
, ...))
1929 s
= va_arg (ap
, char *);
1932 v_really_sorry (s
, ap
);
1936 /* More 'friendly' abort that prints the line and file.
1937 config.h can #define abort fancy_abort if you like that sort of thing.
1939 I don't think this is actually a good idea.
1940 Other sorts of crashes will look a certain way.
1941 It is a good thing if crashes from calling abort look the same way.
1947 fatal ("internal gcc abort");
1950 /* This calls abort and is used to avoid problems when abort if a macro.
1951 It is used when we need to pass the address of abort. */
1959 /* When `malloc.c' is compiled with `rcheck' defined,
1960 it calls this function to report clobberage. */
1969 /* Same as `malloc' but report error if no memory available. */
1975 register char *value
;
1980 value
= (char *) malloc (size
);
1982 fatal ("virtual memory exhausted");
1986 /* Same as `calloc' but report error if no memory available. */
1989 xcalloc (size1
, size2
)
1990 unsigned size1
, size2
;
1992 register char *value
;
1994 if (size1
== 0 || size2
== 0)
1997 value
= (char *) calloc (size1
, size2
);
1999 fatal ("virtual memory exhausted");
2004 /* Same as `realloc' but report error if no memory available.
2005 Also handle null PTR even if the vendor realloc gets it wrong. */
2008 xrealloc (ptr
, size
)
2018 ? (char *) realloc (ptr
, size
)
2019 : (char *) malloc (size
));
2022 fatal ("virtual memory exhausted");
2027 /* Same as `strdup' but report error if no memory available. */
2033 register char *result
= (char *) malloc (strlen (s
) + 1);
2036 fatal ("virtual memory exhausted");
2041 /* Return the logarithm of X, base 2, considering X unsigned,
2042 if X is a power of 2. Otherwise, returns -1.
2044 This should be used via the `exact_log2' macro. */
2048 register unsigned HOST_WIDE_INT x
;
2050 register int log
= 0;
2051 /* Test for 0 or a power of 2. */
2052 if (x
== 0 || x
!= (x
& -x
))
2054 while ((x
>>= 1) != 0)
2059 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
2060 If X is 0, return -1.
2062 This should be used via the floor_log2 macro. */
2066 register unsigned HOST_WIDE_INT x
;
2068 register int log
= -1;
2075 static int float_handler_set
;
2077 jmp_buf float_handler
;
2079 /* Signals actually come here. */
2082 float_signal (signo
)
2083 /* If this is missing, some compilers complain. */
2084 int signo ATTRIBUTE_UNUSED
;
2086 if (float_handled
== 0)
2088 #if defined (USG) || defined (hpux)
2089 signal (SIGFPE
, float_signal
); /* re-enable the signal catcher */
2092 signal (SIGFPE
, float_signal
);
2093 longjmp (float_handler
, 1);
2096 /* Specify where to longjmp to when a floating arithmetic error happens.
2097 If HANDLER is 0, it means don't handle the errors any more. */
2100 set_float_handler (handler
)
2103 float_handled
= (handler
!= 0);
2105 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2107 if (float_handled
&& ! float_handler_set
)
2109 signal (SIGFPE
, float_signal
);
2110 float_handler_set
= 1;
2114 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
2115 error happens, pushing the previous specification into OLD_HANDLER.
2116 Return an indication of whether there was a previous handler in effect. */
2119 push_float_handler (handler
, old_handler
)
2120 jmp_buf handler
, old_handler
;
2122 int was_handled
= float_handled
;
2126 bcopy ((char *) float_handler
, (char *) old_handler
,
2127 sizeof (float_handler
));
2129 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2133 /* Restore the previous specification of whether and where to longjmp to
2134 when a floating arithmetic error happens. */
2137 pop_float_handler (handled
, handler
)
2141 float_handled
= handled
;
2143 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2146 /* Handler for SIGPIPE. */
2150 /* If this is missing, some compilers complain. */
2151 int signo ATTRIBUTE_UNUSED
;
2153 fatal ("output pipe has been closed");
2156 /* Strip off a legitimate source ending from the input string NAME of
2157 length LEN. Rather than having to know the names used by all of
2158 our front ends, we strip off an ending of a period followed by
2159 up to five characters. (Java uses ".class".) */
2162 strip_off_ending (name
, len
)
2167 for (i
= 2; i
< 6 && len
> i
; i
++)
2169 if (name
[len
- i
] == '.')
2171 name
[len
- i
] = '\0';
2177 /* Output a quoted string. */
2180 output_quoted_string (asm_file
, string
)
2184 #ifdef OUTPUT_QUOTED_STRING
2185 OUTPUT_QUOTED_STRING (asm_file
, string
);
2189 putc ('\"', asm_file
);
2190 while ((c
= *string
++) != 0)
2192 if (c
== '\"' || c
== '\\')
2193 putc ('\\', asm_file
);
2196 putc ('\"', asm_file
);
2200 /* Output a file name in the form wanted by System V. */
2203 output_file_directive (asm_file
, input_name
)
2207 int len
= strlen (input_name
);
2208 char *na
= input_name
+ len
;
2210 /* NA gets INPUT_NAME sans directory names. */
2211 while (na
> input_name
)
2218 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
2219 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file
, na
);
2221 #ifdef ASM_OUTPUT_SOURCE_FILENAME
2222 ASM_OUTPUT_SOURCE_FILENAME (asm_file
, na
);
2224 fprintf (asm_file
, "\t.file\t");
2225 output_quoted_string (asm_file
, na
);
2226 fputc ('\n', asm_file
);
2231 /* Routine to build language identifier for object file. */
2234 output_lang_identify (asm_out_file
)
2237 int len
= strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
2238 char *s
= (char *) alloca (len
);
2239 sprintf (s
, "__gnu_compiled_%s", lang_identify ());
2240 ASM_OUTPUT_LABEL (asm_out_file
, s
);
2243 /* Routine to open a dump file. */
2245 open_dump_file (suffix
, function_name
)
2247 char *function_name
;
2254 dumpname
= (char *) xmalloc (strlen (dump_base_name
) + strlen (suffix
) + 1);
2256 if (rtl_dump_file
!= NULL
)
2257 fclose (rtl_dump_file
);
2259 strcpy (dumpname
, dump_base_name
);
2260 strcat (dumpname
, suffix
);
2262 rtl_dump_file
= fopen (dumpname
, "a");
2264 if (rtl_dump_file
== NULL
)
2265 pfatal_with_name (dumpname
);
2270 fprintf (rtl_dump_file
, "\n;; Function %s\n\n", function_name
);
2276 /* Routine to close a dump file. */
2278 close_dump_file (func
, insns
)
2279 void (*func
) PROTO ((FILE *, rtx
));
2286 func (rtl_dump_file
, insns
);
2288 fflush (rtl_dump_file
);
2289 fclose (rtl_dump_file
);
2291 rtl_dump_file
= NULL
;
2297 /* Routine to dump rtl into a file. */
2299 dump_rtl (suffix
, decl
, func
, insns
)
2302 void (*func
) PROTO ((FILE *, rtx
));
2305 open_dump_file (suffix
, decl_printable_name (decl
, 2));
2306 close_dump_file (func
, insns
);
2309 /* Routine to empty a dump file. */
2311 clean_dump_file (suffix
)
2316 dumpname
= (char *) xmalloc (strlen (dump_base_name
) + strlen (suffix
) + 1);
2318 strcpy (dumpname
, dump_base_name
);
2319 strcat (dumpname
, suffix
);
2321 rtl_dump_file
= fopen (dumpname
, "w");
2323 if (rtl_dump_file
== NULL
)
2324 pfatal_with_name (dumpname
);
2328 fclose (rtl_dump_file
);
2329 rtl_dump_file
= NULL
;
2335 /* Compile an entire file of output from cpp, named NAME.
2336 Write a file of assembly output and various debugging dumps. */
2345 int name_specified
= name
!= 0;
2347 if (dump_base_name
== 0)
2348 dump_base_name
= name
? name
: "gccdump";
2352 integration_time
= 0;
2358 branch_prob_time
= 0;
2363 local_alloc_time
= 0;
2364 global_alloc_time
= 0;
2369 shorten_branch_time
= 0;
2375 /* Initialize data in various passes. */
2379 name
= init_parse (name
);
2381 init_emit_once (debug_info_level
== DINFO_LEVEL_NORMAL
2382 || debug_info_level
== DINFO_LEVEL_VERBOSE
2383 || flag_test_coverage
);
2385 init_decl_processing ();
2394 if (flag_caller_saves
)
2395 init_caller_save ();
2397 /* If auxiliary info generation is desired, open the output file.
2398 This goes in the same directory as the source file--unlike
2399 all the other output files. */
2400 if (flag_gen_aux_info
)
2402 aux_info_file
= fopen (aux_info_file_name
, "w");
2403 if (aux_info_file
== 0)
2404 pfatal_with_name (aux_info_file_name
);
2407 /* Clear the dump files file. */
2409 clean_dump_file (".rtl");
2411 clean_dump_file (".jump");
2413 clean_dump_file (".addressof");
2415 clean_dump_file (".cse");
2417 clean_dump_file (".loop");
2419 clean_dump_file (".cse2");
2420 if (branch_prob_dump
)
2421 clean_dump_file (".bp");
2423 clean_dump_file (".flow");
2425 clean_dump_file (".combine");
2427 clean_dump_file (".regmove");
2429 clean_dump_file (".sched");
2431 clean_dump_file (".lreg");
2432 if (global_reg_dump
)
2433 clean_dump_file (".greg");
2435 clean_dump_file (".sched2");
2437 clean_dump_file (".jump2");
2440 clean_dump_file (".dbr");
2443 clean_dump_file (".gcse");
2446 clean_dump_file (".stack");
2448 #ifdef MACHINE_DEPENDENT_REORG
2449 if (mach_dep_reorg_dump
)
2450 clean_dump_file (".mach");
2453 /* Open assembler code output file. */
2455 if (! name_specified
&& asm_file_name
== 0)
2456 asm_out_file
= stdout
;
2459 int len
= strlen (dump_base_name
);
2460 register char *dumpname
= (char *) xmalloc (len
+ 6);
2461 strcpy (dumpname
, dump_base_name
);
2462 strip_off_ending (dumpname
, len
);
2463 strcat (dumpname
, ".s");
2464 if (asm_file_name
== 0)
2466 asm_file_name
= (char *) xmalloc (strlen (dumpname
) + 1);
2467 strcpy (asm_file_name
, dumpname
);
2469 if (!strcmp (asm_file_name
, "-"))
2470 asm_out_file
= stdout
;
2472 asm_out_file
= fopen (asm_file_name
, "w");
2473 if (asm_out_file
== 0)
2474 pfatal_with_name (asm_file_name
);
2477 #ifdef IO_BUFFER_SIZE
2478 setvbuf (asm_out_file
, (char *) xmalloc (IO_BUFFER_SIZE
),
2479 _IOFBF
, IO_BUFFER_SIZE
);
2482 input_filename
= name
;
2484 /* Put an entry on the input file stack for the main input file. */
2486 = (struct file_stack
*) xmalloc (sizeof (struct file_stack
));
2487 input_file_stack
->next
= 0;
2488 input_file_stack
->name
= input_filename
;
2490 /* Perform language-specific initialization.
2491 This may set main_input_filename. */
2494 /* If the input doesn't start with a #line, use the input name
2495 as the official input file name. */
2496 if (main_input_filename
== 0)
2497 main_input_filename
= name
;
2499 ASM_FILE_START (asm_out_file
);
2501 #ifdef ASM_COMMENT_START
2502 if (flag_verbose_asm
)
2504 /* Print the list of options in effect. */
2505 print_version (asm_out_file
, ASM_COMMENT_START
);
2506 print_switch_values (asm_out_file
, 0, MAX_LINE
,
2507 ASM_COMMENT_START
, " ", "\n");
2508 /* Add a blank line here so it appears in assembler output but not
2510 fprintf (asm_out_file
, "\n");
2514 /* Output something to inform GDB that this compilation was by GCC. */
2515 #ifndef ASM_IDENTIFY_GCC
2516 fprintf (asm_out_file
, "gcc2_compiled.:\n");
2518 ASM_IDENTIFY_GCC (asm_out_file
);
2521 /* Output something to identify which front-end produced this file. */
2522 #ifdef ASM_IDENTIFY_LANGUAGE
2523 ASM_IDENTIFY_LANGUAGE (asm_out_file
);
2526 #ifndef ASM_OUTPUT_SECTION_NAME
2527 if (flag_function_sections
)
2529 warning ("-ffunction-sections not supported for this target.");
2530 flag_function_sections
= 0;
2534 if (flag_function_sections
2535 && (profile_flag
|| profile_block_flag
))
2537 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2538 flag_function_sections
= 0;
2541 if (flag_function_sections
&& write_symbols
!= NO_DEBUG
)
2542 warning ("-ffunction-sections may affect debugging on some targets.");
2544 /* ??? Note: There used to be a conditional here
2545 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2546 This was to guarantee separation between gcc_compiled. and
2547 the first function, for the sake of dbx on Suns.
2548 However, having the extra zero here confused the Emacs
2549 code for unexec, and might confuse other programs too.
2550 Therefore, I took out that change.
2551 In future versions we should find another way to solve
2552 that dbx problem. -- rms, 23 May 93. */
2554 /* Don't let the first function fall at the same address
2555 as gcc_compiled., if profiling. */
2556 if (profile_flag
|| profile_block_flag
)
2558 /* It's best if we can write a nop here since some
2559 assemblers don't tolerate zeros in the text section. */
2560 if (insn_template
[CODE_FOR_nop
] != 0)
2561 output_asm_insn (insn_template
[CODE_FOR_nop
], NULL_PTR
);
2563 assemble_zeros (UNITS_PER_WORD
);
2566 /* If dbx symbol table desired, initialize writing it
2567 and output the predefined types. */
2568 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2569 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2570 TIMEVAR (symout_time
, dbxout_init (asm_out_file
, main_input_filename
,
2573 #ifdef SDB_DEBUGGING_INFO
2574 if (write_symbols
== SDB_DEBUG
)
2575 TIMEVAR (symout_time
, sdbout_init (asm_out_file
, main_input_filename
,
2578 #ifdef DWARF_DEBUGGING_INFO
2579 if (write_symbols
== DWARF_DEBUG
)
2580 TIMEVAR (symout_time
, dwarfout_init (asm_out_file
, main_input_filename
));
2582 #ifdef DWARF2_UNWIND_INFO
2583 if (dwarf2out_do_frame ())
2584 dwarf2out_frame_init ();
2586 #ifdef DWARF2_DEBUGGING_INFO
2587 if (write_symbols
== DWARF2_DEBUG
)
2588 TIMEVAR (symout_time
, dwarf2out_init (asm_out_file
, main_input_filename
));
2591 /* Initialize yet another pass. */
2593 init_final (main_input_filename
);
2594 init_branch_prob (dump_base_name
);
2596 start_time
= get_run_time ();
2598 /* Call the parser, which parses the entire file
2599 (calling rest_of_compilation for each function). */
2601 if (yyparse () != 0)
2603 if (errorcount
== 0)
2604 fprintf (stderr
, "Errors detected in input file (your bison.simple is out of date)");
2606 /* In case there were missing closebraces,
2607 get us back to the global binding level. */
2608 while (! global_bindings_p ())
2612 output_func_start_profiler ();
2614 /* Compilation is now finished except for writing
2615 what's left of the symbol table output. */
2617 parse_time
+= get_run_time () - start_time
;
2619 parse_time
-= integration_time
;
2620 parse_time
-= varconst_time
;
2622 globals
= getdecls ();
2624 /* Really define vars that have had only a tentative definition.
2625 Really output inline functions that must actually be callable
2626 and have not been output so far. */
2629 int len
= list_length (globals
);
2630 tree
*vec
= (tree
*) alloca (sizeof (tree
) * len
);
2635 /* Process the decls in reverse order--earliest first.
2636 Put them into VEC from back to front, then take out from front. */
2638 for (i
= 0, decl
= globals
; i
< len
; i
++, decl
= TREE_CHAIN (decl
))
2639 vec
[len
- i
- 1] = decl
;
2641 for (i
= 0; i
< len
; i
++)
2645 /* We're not deferring this any longer. */
2646 DECL_DEFER_OUTPUT (decl
) = 0;
2648 if (TREE_CODE (decl
) == VAR_DECL
&& DECL_SIZE (decl
) == 0
2649 && incomplete_decl_finalize_hook
!= 0)
2650 (*incomplete_decl_finalize_hook
) (decl
);
2653 /* Now emit any global variables or functions that we have been putting
2654 off. We need to loop in case one of the things emitted here
2655 references another one which comes earlier in the list. */
2659 for (i
= 0; i
< len
; i
++)
2663 if (TREE_ASM_WRITTEN (decl
) || DECL_EXTERNAL (decl
))
2666 /* Don't write out static consts, unless we still need them.
2668 We also keep static consts if not optimizing (for debugging),
2669 unless the user specified -fno-keep-static-consts.
2670 ??? They might be better written into the debug information.
2671 This is possible when using DWARF.
2673 A language processor that wants static constants to be always
2674 written out (even if it is not used) is responsible for
2675 calling rest_of_decl_compilation itself. E.g. the C front-end
2676 calls rest_of_decl_compilation from finish_decl.
2677 One motivation for this is that is conventional in some
2678 environments to write things like:
2679 static const char rcsid[] = "... version string ...";
2680 intending to force the string to be in the executable.
2682 A language processor that would prefer to have unneeded
2683 static constants "optimized away" would just defer writing
2684 them out until here. E.g. C++ does this, because static
2685 constants are often defined in header files.
2687 ??? A tempting alternative (for both C and C++) would be
2688 to force a constant to be written if and only if it is
2689 defined in a main file, as opposed to an include file. */
2691 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
2692 && (! TREE_READONLY (decl
)
2693 || TREE_PUBLIC (decl
)
2694 || (!optimize
&& flag_keep_static_consts
)
2695 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
2698 rest_of_decl_compilation (decl
, NULL_PTR
, 1, 1);
2701 if (TREE_CODE (decl
) == FUNCTION_DECL
2702 && DECL_INITIAL (decl
) != 0
2703 && DECL_SAVED_INSNS (decl
) != 0
2704 && (flag_keep_inline_functions
2705 || TREE_PUBLIC (decl
)
2706 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
2709 temporary_allocation ();
2710 output_inline_function (decl
);
2711 permanent_allocation (1);
2716 /* Now that all possible functions have been output, we can dump
2717 the exception table. */
2719 output_exception_table ();
2721 for (i
= 0; i
< len
; i
++)
2725 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
2726 && ! TREE_ASM_WRITTEN (decl
))
2727 /* Cancel the RTL for this decl so that, if debugging info
2728 output for global variables is still to come,
2729 this one will be omitted. */
2730 DECL_RTL (decl
) = NULL
;
2732 /* Warn about any function
2733 declared static but not defined.
2734 We don't warn about variables,
2735 because many programs have static variables
2736 that exist only to get some text into the object file. */
2737 if (TREE_CODE (decl
) == FUNCTION_DECL
2739 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
)))
2740 && DECL_INITIAL (decl
) == 0
2741 && DECL_EXTERNAL (decl
)
2742 && ! DECL_ARTIFICIAL (decl
)
2743 && ! TREE_PUBLIC (decl
))
2745 pedwarn_with_decl (decl
,
2746 "`%s' declared `static' but never defined");
2747 /* This symbol is effectively an "extern" declaration now. */
2748 TREE_PUBLIC (decl
) = 1;
2749 assemble_external (decl
);
2752 /* Warn about static fns or vars defined but not used,
2753 but not about inline functions or static consts
2754 since defining those in header files is normal practice. */
2756 && ((TREE_CODE (decl
) == FUNCTION_DECL
&& ! DECL_INLINE (decl
))
2757 || (TREE_CODE (decl
) == VAR_DECL
&& ! TREE_READONLY (decl
)))
2758 && ! DECL_IN_SYSTEM_HEADER (decl
)
2759 && ! DECL_EXTERNAL (decl
)
2760 && ! TREE_PUBLIC (decl
)
2761 && ! TREE_USED (decl
)
2762 && (TREE_CODE (decl
) == FUNCTION_DECL
|| ! DECL_REGISTER (decl
))
2763 /* The TREE_USED bit for file-scope decls
2764 is kept in the identifier, to handle multiple
2765 external decls in different scopes. */
2766 && ! TREE_USED (DECL_NAME (decl
)))
2767 warning_with_decl (decl
, "`%s' defined but not used");
2769 #ifdef SDB_DEBUGGING_INFO
2770 /* The COFF linker can move initialized global vars to the end.
2771 And that can screw up the symbol ordering.
2772 By putting the symbols in that order to begin with,
2773 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
2774 if (write_symbols
== SDB_DEBUG
&& TREE_CODE (decl
) == VAR_DECL
2775 && TREE_PUBLIC (decl
) && DECL_INITIAL (decl
)
2776 && ! DECL_EXTERNAL (decl
)
2777 && DECL_RTL (decl
) != 0)
2778 TIMEVAR (symout_time
, sdbout_symbol (decl
, 0));
2780 /* Output COFF information for non-global
2781 file-scope initialized variables. */
2782 if (write_symbols
== SDB_DEBUG
2783 && TREE_CODE (decl
) == VAR_DECL
2784 && DECL_INITIAL (decl
)
2785 && ! DECL_EXTERNAL (decl
)
2786 && DECL_RTL (decl
) != 0
2787 && GET_CODE (DECL_RTL (decl
)) == MEM
)
2788 TIMEVAR (symout_time
, sdbout_toplevel_data (decl
));
2789 #endif /* SDB_DEBUGGING_INFO */
2790 #ifdef DWARF_DEBUGGING_INFO
2791 /* Output DWARF information for file-scope tentative data object
2792 declarations, file-scope (extern) function declarations (which
2793 had no corresponding body) and file-scope tagged type declarations
2794 and definitions which have not yet been forced out. */
2796 if (write_symbols
== DWARF_DEBUG
2797 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
2798 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 1));
2800 #ifdef DWARF2_DEBUGGING_INFO
2801 /* Output DWARF2 information for file-scope tentative data object
2802 declarations, file-scope (extern) function declarations (which
2803 had no corresponding body) and file-scope tagged type declarations
2804 and definitions which have not yet been forced out. */
2806 if (write_symbols
== DWARF2_DEBUG
2807 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
2808 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
2813 /* Write out any pending weak symbol declarations. */
2817 /* Do dbx symbols */
2818 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2819 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2820 TIMEVAR (symout_time
,
2822 dbxout_finish (asm_out_file
, main_input_filename
);
2826 #ifdef DWARF_DEBUGGING_INFO
2827 if (write_symbols
== DWARF_DEBUG
)
2828 TIMEVAR (symout_time
,
2834 #ifdef DWARF2_UNWIND_INFO
2835 if (dwarf2out_do_frame ())
2836 dwarf2out_frame_finish ();
2839 #ifdef DWARF2_DEBUGGING_INFO
2840 if (write_symbols
== DWARF2_DEBUG
)
2841 TIMEVAR (symout_time
,
2843 dwarf2out_finish ();
2847 /* Output some stuff at end of file if nec. */
2849 end_final (dump_base_name
);
2851 if (branch_prob_dump
)
2852 open_dump_file (".bp", NULL
);
2854 TIMEVAR (dump_time
, end_branch_prob (rtl_dump_file
));
2856 if (branch_prob_dump
)
2857 close_dump_file (NULL
, NULL_RTX
);
2860 ASM_FILE_END (asm_out_file
);
2863 /* Language-specific end of compilation actions. */
2867 /* Close the dump files. */
2869 if (flag_gen_aux_info
)
2871 fclose (aux_info_file
);
2873 unlink (aux_info_file_name
);
2878 open_dump_file (".combine", NULL
);
2879 TIMEVAR (dump_time
, dump_combine_total_stats (rtl_dump_file
));
2880 close_dump_file (NULL
, NULL_RTX
);
2883 /* Close non-debugging input and output files. Take special care to note
2884 whether fclose returns an error, since the pages might still be on the
2885 buffer chain while the file is open. */
2889 if (ferror (asm_out_file
) != 0 || fclose (asm_out_file
) != 0)
2890 fatal_io_error (asm_file_name
);
2892 /* Print the times. */
2896 fprintf (stderr
,"\n");
2897 print_time ("parse", parse_time
);
2899 print_time ("integration", integration_time
);
2900 print_time ("jump", jump_time
);
2901 print_time ("cse", cse_time
);
2902 print_time ("gcse", gcse_time
);
2903 print_time ("loop", loop_time
);
2904 print_time ("cse2", cse2_time
);
2905 print_time ("branch-prob", branch_prob_time
);
2906 print_time ("flow", flow_time
);
2907 print_time ("combine", combine_time
);
2908 print_time ("regmove", regmove_time
);
2909 print_time ("sched", sched_time
);
2910 print_time ("local-alloc", local_alloc_time
);
2911 print_time ("global-alloc", global_alloc_time
);
2912 print_time ("sched2", sched2_time
);
2914 print_time ("dbranch", dbr_sched_time
);
2916 print_time ("shorten-branch", shorten_branch_time
);
2917 print_time ("stack-reg", stack_reg_time
);
2918 print_time ("final", final_time
);
2919 print_time ("varconst", varconst_time
);
2920 print_time ("symout", symout_time
);
2921 print_time ("dump", dump_time
);
2925 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2926 and TYPE_DECL nodes.
2928 This does nothing for local (non-static) variables.
2929 Otherwise, it sets up the RTL and outputs any assembler code
2930 (label definition, storage allocation and initialization).
2932 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2933 the assembler symbol name to be used. TOP_LEVEL is nonzero
2934 if this declaration is not within a function. */
2937 rest_of_decl_compilation (decl
, asmspec
, top_level
, at_end
)
2943 /* Declarations of variables, and of functions defined elsewhere. */
2945 /* The most obvious approach, to put an #ifndef around where
2946 this macro is used, doesn't work since it's inside a macro call. */
2947 #ifndef ASM_FINISH_DECLARE_OBJECT
2948 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2951 /* Forward declarations for nested functions are not "external",
2952 but we need to treat them as if they were. */
2953 if (TREE_STATIC (decl
) || DECL_EXTERNAL (decl
)
2954 || TREE_CODE (decl
) == FUNCTION_DECL
)
2955 TIMEVAR (varconst_time
,
2957 make_decl_rtl (decl
, asmspec
, top_level
);
2958 /* Initialized extern variable exists to be replaced
2959 with its value, or represents something that will be
2960 output in another file. */
2961 if (! (TREE_CODE (decl
) == VAR_DECL
2962 && DECL_EXTERNAL (decl
) && TREE_READONLY (decl
)
2963 && DECL_INITIAL (decl
) != 0
2964 && DECL_INITIAL (decl
) != error_mark_node
))
2965 /* Don't output anything
2966 when a tentative file-scope definition is seen.
2967 But at end of compilation, do output code for them. */
2968 if (! (! at_end
&& top_level
2969 && (DECL_INITIAL (decl
) == 0
2970 || DECL_INITIAL (decl
) == error_mark_node
)))
2971 assemble_variable (decl
, top_level
, at_end
, 0);
2972 if (decl
== last_assemble_variable_decl
)
2974 ASM_FINISH_DECLARE_OBJECT (asm_out_file
, decl
,
2978 else if (DECL_REGISTER (decl
) && asmspec
!= 0)
2980 if (decode_reg_name (asmspec
) >= 0)
2982 DECL_RTL (decl
) = 0;
2983 make_decl_rtl (decl
, asmspec
, top_level
);
2986 error ("invalid register name `%s' for register variable", asmspec
);
2988 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2989 else if ((write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2990 && TREE_CODE (decl
) == TYPE_DECL
)
2991 TIMEVAR (symout_time
, dbxout_symbol (decl
, 0));
2993 #ifdef SDB_DEBUGGING_INFO
2994 else if (write_symbols
== SDB_DEBUG
&& top_level
2995 && TREE_CODE (decl
) == TYPE_DECL
)
2996 TIMEVAR (symout_time
, sdbout_symbol (decl
, 0));
3000 /* Called after finishing a record, union or enumeral type. */
3003 rest_of_type_compilation (type
, toplev
)
3007 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
3008 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
3009 TIMEVAR (symout_time
, dbxout_symbol (TYPE_STUB_DECL (type
), !toplev
));
3011 #ifdef SDB_DEBUGGING_INFO
3012 if (write_symbols
== SDB_DEBUG
)
3013 TIMEVAR (symout_time
, sdbout_symbol (TYPE_STUB_DECL (type
), !toplev
));
3017 /* This is called from finish_function (within yyparse)
3018 after each top-level definition is parsed.
3019 It is supposed to compile that function or variable
3020 and output the assembler code for it.
3021 After we return, the tree storage is freed. */
3024 rest_of_compilation (decl
)
3028 int start_time
= get_run_time ();
3030 /* Nonzero if we have saved the original DECL_INITIAL of the function,
3031 to be restored after we finish compiling the function
3032 (for use when compiling inline calls to this function). */
3033 tree saved_block_tree
= 0;
3034 /* Likewise, for DECL_ARGUMENTS. */
3035 tree saved_arguments
= 0;
3038 /* If we are reconsidering an inline function
3039 at the end of compilation, skip the stuff for making it inline. */
3041 if (DECL_SAVED_INSNS (decl
) == 0)
3046 /* If requested, consider whether to make this function inline. */
3047 if (DECL_INLINE (decl
) || flag_inline_functions
)
3048 TIMEVAR (integration_time
,
3050 lose
= function_cannot_inline_p (decl
);
3051 if (lose
|| ! optimize
)
3053 if (warn_inline
&& DECL_INLINE (decl
))
3054 warning_with_decl (decl
, lose
);
3055 DECL_ABSTRACT_ORIGIN (decl
) = 0;
3056 /* Don't really compile an extern inline function.
3057 If we can't make it inline, pretend
3058 it was only declared. */
3059 if (DECL_EXTERNAL (decl
))
3061 DECL_INITIAL (decl
) = 0;
3062 goto exit_rest_of_compilation
;
3066 /* ??? Note that this has the effect of making it look
3067 like "inline" was specified for a function if we choose
3068 to inline it. This isn't quite right, but it's
3069 probably not worth the trouble to fix. */
3070 inlinable
= DECL_INLINE (decl
) = 1;
3073 insns
= get_insns ();
3075 /* Dump the rtl code if we are dumping rtl. */
3079 open_dump_file (".rtl", decl_printable_name (decl
, 2));
3081 if (DECL_SAVED_INSNS (decl
))
3082 fprintf (rtl_dump_file
, ";; (integrable)\n\n");
3084 close_dump_file (print_rtl
, insns
);
3087 /* If we can, defer compiling inlines until EOF.
3088 save_for_inline_copying can be extremely expensive. */
3089 if (inlinable
&& ! decl_function_context (decl
))
3090 DECL_DEFER_OUTPUT (decl
) = 1;
3092 /* If function is inline, and we don't yet know whether to
3093 compile it by itself, defer decision till end of compilation.
3094 finish_compilation will call rest_of_compilation again
3095 for those functions that need to be output. Also defer those
3096 functions that we are supposed to defer. We cannot defer
3097 functions containing nested functions since the nested function
3098 data is in our non-saved obstack. We cannot defer nested
3099 functions for the same reason. */
3101 /* If this is a nested inline, remove ADDRESSOF now so we can
3102 finish compiling ourselves. Otherwise, wait until EOF.
3103 We have to do this because the purge_addressof transformation
3104 changes the DECL_RTL for many variables, which confuses integrate. */
3107 if (decl_function_context (decl
))
3108 purge_addressof (insns
);
3110 DECL_DEFER_OUTPUT (decl
) = 1;
3113 if (! current_function_contains_functions
3114 && (DECL_DEFER_OUTPUT (decl
)
3115 || (DECL_INLINE (decl
)
3116 && ((! TREE_PUBLIC (decl
) && ! TREE_ADDRESSABLE (decl
)
3117 && ! flag_keep_inline_functions
)
3118 || DECL_EXTERNAL (decl
)))))
3120 DECL_DEFER_OUTPUT (decl
) = 1;
3122 /* If -Wreturn-type, we have to do a bit of compilation.
3123 However, if we just fall through we will call
3124 save_for_inline_copying() which results in excessive
3125 memory use. Instead, we just want to call
3126 jump_optimize() to figure out whether or not we can fall
3127 off the end of the function; we do the minimum amount of
3128 work necessary to make that safe. And, we set optimize
3129 to zero to keep jump_optimize from working too hard. */
3130 if (warn_return_type
)
3132 int saved_optimize
= optimize
;
3134 find_exception_handler_labels ();
3135 jump_optimize (get_insns(), !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
3136 !JUMP_AFTER_REGSCAN
);
3137 optimize
= saved_optimize
;
3140 #ifdef DWARF_DEBUGGING_INFO
3141 /* Generate the DWARF info for the "abstract" instance
3142 of a function which we may later generate inlined and/or
3143 out-of-line instances of. */
3144 if (write_symbols
== DWARF_DEBUG
)
3146 set_decl_abstract_flags (decl
, 1);
3147 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3148 set_decl_abstract_flags (decl
, 0);
3151 #ifdef DWARF2_DEBUGGING_INFO
3152 /* Generate the DWARF2 info for the "abstract" instance
3153 of a function which we may later generate inlined and/or
3154 out-of-line instances of. */
3155 if (write_symbols
== DWARF2_DEBUG
)
3157 set_decl_abstract_flags (decl
, 1);
3158 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3159 set_decl_abstract_flags (decl
, 0);
3162 TIMEVAR (integration_time
, save_for_inline_nocopy (decl
));
3163 RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl
)) = inlinable
;
3164 goto exit_rest_of_compilation
;
3167 /* If we have to compile the function now, save its rtl and subdecls
3168 so that its compilation will not affect what others get. */
3169 if (inlinable
|| DECL_DEFER_OUTPUT (decl
))
3171 #ifdef DWARF_DEBUGGING_INFO
3172 /* Generate the DWARF info for the "abstract" instance of
3173 a function which we will generate an out-of-line instance
3174 of almost immediately (and which we may also later generate
3175 various inlined instances of). */
3176 if (write_symbols
== DWARF_DEBUG
)
3178 set_decl_abstract_flags (decl
, 1);
3179 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3180 set_decl_abstract_flags (decl
, 0);
3183 #ifdef DWARF2_DEBUGGING_INFO
3184 /* Generate the DWARF2 info for the "abstract" instance of
3185 a function which we will generate an out-of-line instance
3186 of almost immediately (and which we may also later generate
3187 various inlined instances of). */
3188 if (write_symbols
== DWARF2_DEBUG
)
3190 set_decl_abstract_flags (decl
, 1);
3191 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3192 set_decl_abstract_flags (decl
, 0);
3195 saved_block_tree
= DECL_INITIAL (decl
);
3196 saved_arguments
= DECL_ARGUMENTS (decl
);
3197 TIMEVAR (integration_time
, save_for_inline_copying (decl
));
3198 RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl
)) = inlinable
;
3201 /* If specified extern inline but we aren't inlining it, we are
3203 if (DECL_INLINE (decl
) && DECL_EXTERNAL (decl
))
3204 goto exit_rest_of_compilation
;
3207 if (! DECL_DEFER_OUTPUT (decl
))
3208 TREE_ASM_WRITTEN (decl
) = 1;
3210 /* Now that integrate will no longer see our rtl, we need not distinguish
3211 between the return value of this function and the return value of called
3213 rtx_equal_function_value_matters
= 0;
3215 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
3216 if ((rtl_dump_and_exit
|| flag_syntax_only
) && !warn_return_type
)
3218 goto exit_rest_of_compilation
;
3221 /* Emit code to get eh context, if needed. */
3225 /* If we are doing position-independent code generation, now
3226 is the time to output special prologues and epilogues.
3227 We do not want to do this earlier, because it just clutters
3228 up inline functions with meaningless insns. */
3233 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
3234 Note that that may have been done above, in save_for_inline_copying.
3235 The call to resume_temporary_allocation near the end of this function
3236 goes back to the usual state of affairs. This must be done after
3237 we've built up any unwinders for exception handling, and done
3238 the FINALIZE_PIC work, if necessary. */
3240 rtl_in_current_obstack ();
3242 insns
= get_insns ();
3244 /* Copy any shared structure that should not be shared. */
3246 unshare_all_rtl (insns
);
3248 #ifdef SETJMP_VIA_SAVE_AREA
3249 /* This must be performed before virutal register instantiation. */
3250 if (current_function_calls_alloca
)
3251 optimize_save_area_alloca (insns
);
3254 /* Instantiate all virtual registers. */
3256 instantiate_virtual_regs (current_function_decl
, get_insns ());
3258 /* See if we have allocated stack slots that are not directly addressable.
3259 If so, scan all the insns and create explicit address computation
3260 for all references to such slots. */
3261 /* fixup_stack_slots (); */
3263 /* Find all the EH handlers. */
3264 find_exception_handler_labels ();
3266 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
3267 are initialized and to compute whether control can drop off the end
3269 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3270 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
, !JUMP_NOOP_MOVES
,
3271 JUMP_AFTER_REGSCAN
));
3273 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
3274 if (rtl_dump_and_exit
|| flag_syntax_only
|| DECL_DEFER_OUTPUT (decl
))
3275 goto exit_rest_of_compilation
;
3277 /* Dump rtl code after jump, if we are doing that. */
3280 dump_rtl (".jump", decl
, print_rtl
, insns
);
3282 /* Perform common subexpression elimination.
3283 Nonzero value from `cse_main' means that jumps were simplified
3284 and some code may now be unreachable, so do
3285 jump optimization again. */
3290 open_dump_file (".cse", decl_printable_name (decl
, 2));
3292 TIMEVAR (cse_time
, reg_scan (insns
, max_reg_num (), 1));
3294 if (flag_thread_jumps
)
3295 /* Hacks by tiemann & kenner. */
3296 TIMEVAR (jump_time
, thread_jumps (insns
, max_reg_num (), 1));
3298 TIMEVAR (cse_time
, tem
= cse_main (insns
, max_reg_num (),
3300 TIMEVAR (cse_time
, delete_trivially_dead_insns (insns
, max_reg_num ()));
3302 if (tem
|| optimize
> 1)
3303 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3305 !JUMP_AFTER_REGSCAN
));
3307 /* Dump rtl code after cse, if we are doing that. */
3310 close_dump_file (print_rtl
, insns
);
3313 purge_addressof (insns
);
3314 reg_scan (insns
, max_reg_num (), 1);
3317 dump_rtl (".addressof", decl
, print_rtl
, insns
);
3319 /* Perform global cse. */
3321 if (optimize
> 0 && flag_gcse
)
3324 open_dump_file (".gcse", IDENTIFIER_POINTER (DECL_NAME (decl
)));
3326 TIMEVAR (gcse_time
, gcse_main (insns
, rtl_dump_file
));
3329 close_dump_file (print_rtl
, insns
);
3331 /* Move constant computations out of loops. */
3336 open_dump_file (".loop", decl_printable_name (decl
, 2));
3341 if (flag_rerun_loop_opt
)
3343 /* We only want to perform unrolling once. */
3345 loop_optimize (insns
, rtl_dump_file
, 0);
3348 /* The first call to loop_optimize makes some instructions
3349 trivially dead. We delete those instructions now in the
3350 hope that doing so will make the heuristics in loop work
3351 better and possibly speed up compilation. */
3352 delete_trivially_dead_insns (insns
, max_reg_num ());
3354 /* The regscan pass is currently necessary as the alias
3355 analysis code depends on this information. */
3356 reg_scan (insns
, max_reg_num (), 1);
3358 loop_optimize (insns
, rtl_dump_file
, flag_unroll_loops
);
3361 /* Dump rtl code after loop opt, if we are doing that. */
3364 close_dump_file (print_rtl
, insns
);
3370 open_dump_file (".cse2", decl_printable_name (decl
, 2));
3372 if (flag_rerun_cse_after_loop
)
3374 /* Running another jump optimization pass before the second
3375 cse pass sometimes simplifies the RTL enough to allow
3376 the second CSE pass to do a better job. Jump_optimize can change
3377 max_reg_num so we must rerun reg_scan afterwards.
3378 ??? Rework to not call reg_scan so often. */
3379 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3380 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3382 JUMP_AFTER_REGSCAN
));
3384 TIMEVAR (cse2_time
, reg_scan (insns
, max_reg_num (), 0));
3385 TIMEVAR (cse2_time
, tem
= cse_main (insns
, max_reg_num (),
3388 TIMEVAR (jump_time
, jump_optimize (insns
, !JUMP_CROSS_JUMP
,
3390 !JUMP_AFTER_REGSCAN
));
3393 if (flag_thread_jumps
)
3395 /* This pass of jump threading straightens out code
3396 that was kinked by loop optimization. */
3397 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3398 TIMEVAR (jump_time
, thread_jumps (insns
, max_reg_num (), 0));
3401 /* Dump rtl code after cse, if we are doing that. */
3404 close_dump_file (print_rtl
, insns
);
3407 if (profile_arc_flag
|| flag_test_coverage
|| flag_branch_probabilities
)
3409 if (branch_prob_dump
)
3410 open_dump_file (".bp", decl_printable_name (decl
, 2));
3415 branch_prob (insns
, rtl_dump_file
);
3418 if (branch_prob_dump
)
3419 close_dump_file (print_rtl
, insns
);
3422 /* We are no longer anticipating cse in this function, at least. */
3424 cse_not_expected
= 1;
3426 /* Now we choose between stupid (pcc-like) register allocation
3427 (if we got the -noreg switch and not -opt)
3428 and smart register allocation. */
3430 if (optimize
> 0) /* Stupid allocation probably won't work */
3431 obey_regdecls
= 0; /* if optimizations being done. */
3435 /* Print function header into flow dump now
3436 because doing the flow analysis makes some of the dump. */
3439 open_dump_file (".flow", decl_printable_name (decl
, 2));
3445 regclass (insns
, max_reg_num ());
3446 stupid_life_analysis (insns
, max_reg_num (),
3452 /* Do control and data flow analysis,
3453 and write some of the results to dump file. */
3458 find_basic_blocks (insns
, max_reg_num (), rtl_dump_file
, 1);
3459 life_analysis (insns
, max_reg_num (), rtl_dump_file
);
3462 if (warn_uninitialized
)
3464 uninitialized_vars_warning (DECL_INITIAL (decl
));
3465 setjmp_args_warning ();
3469 /* Dump rtl after flow analysis. */
3472 close_dump_file (print_rtl_with_bb
, insns
);
3474 /* If -opt, try combining insns through substitution. */
3478 TIMEVAR (combine_time
, combine_instructions (insns
, max_reg_num ()));
3480 /* Dump rtl code after insn combination. */
3483 dump_rtl (".combine", decl
, print_rtl_with_bb
, insns
);
3486 /* Register allocation pre-pass, to reduce number of moves
3487 necessary for two-address machines. */
3488 if (optimize
> 0 && (flag_regmove
|| flag_expensive_optimizations
))
3491 open_dump_file (".regmove", decl_printable_name (decl
, 2));
3493 TIMEVAR (regmove_time
, regmove_optimize (insns
, max_reg_num (),
3497 close_dump_file (print_rtl_with_bb
, insns
);
3500 /* Print function header into sched dump now
3501 because doing the sched analysis makes some of the dump. */
3503 if (optimize
> 0 && flag_schedule_insns
)
3506 open_dump_file (".sched", decl_printable_name (decl
, 2));
3508 /* Do control and data sched analysis,
3509 and write some of the results to dump file. */
3511 TIMEVAR (sched_time
, schedule_insns (rtl_dump_file
));
3513 /* Dump rtl after instruction scheduling. */
3516 close_dump_file (print_rtl_with_bb
, insns
);
3519 /* Unless we did stupid register allocation,
3520 allocate pseudo-regs that are used only within 1 basic block. */
3523 TIMEVAR (local_alloc_time
,
3525 recompute_reg_usage (insns
);
3526 regclass (insns
, max_reg_num ());
3530 /* Dump rtl code after allocating regs within basic blocks. */
3534 open_dump_file (".lreg", decl_printable_name (decl
, 2));
3536 TIMEVAR (dump_time
, dump_flow_info (rtl_dump_file
));
3537 TIMEVAR (dump_time
, dump_local_alloc (rtl_dump_file
));
3539 close_dump_file (print_rtl_with_bb
, insns
);
3542 if (global_reg_dump
)
3543 open_dump_file (".greg", decl_printable_name (decl
, 2));
3545 /* Save the last label number used so far, so reorg can tell
3546 when it's safe to kill spill regs. */
3547 max_label_num_after_reload
= max_label_num ();
3549 /* Unless we did stupid register allocation,
3550 allocate remaining pseudo-regs, then do the reload pass
3551 fixing up any insns that are invalid. */
3553 TIMEVAR (global_alloc_time
,
3556 failure
= global_alloc (rtl_dump_file
);
3558 failure
= reload (insns
, 0, rtl_dump_file
);
3563 goto exit_rest_of_compilation
;
3565 reload_completed
= 1;
3567 /* Do a very simple CSE pass over just the hard registers. */
3569 reload_cse_regs (insns
);
3571 /* On some machines, the prologue and epilogue code, or parts thereof,
3572 can be represented as RTL. Doing so lets us schedule insns between
3573 it and the rest of the code and also allows delayed branch
3574 scheduling to operate in the epilogue. */
3576 thread_prologue_and_epilogue_insns (insns
);
3578 if (global_reg_dump
)
3580 TIMEVAR (dump_time
, dump_global_regs (rtl_dump_file
));
3581 close_dump_file (print_rtl_with_bb
, insns
);
3583 if (optimize
> 0 && flag_schedule_insns_after_reload
)
3586 open_dump_file (".sched2", decl_printable_name (decl
, 2));
3588 /* Do control and data sched analysis again,
3589 and write some more of the results to dump file. */
3591 TIMEVAR (sched2_time
, schedule_insns (rtl_dump_file
));
3593 /* Dump rtl after post-reorder instruction scheduling. */
3596 close_dump_file (print_rtl_with_bb
, insns
);
3599 #ifdef LEAF_REGISTERS
3601 if (optimize
> 0 && only_leaf_regs_used () && leaf_function_p ())
3605 /* One more attempt to remove jumps to .+1
3606 left by dead-store-elimination.
3607 Also do cross-jumping this time
3608 and delete no-op move insns. */
3612 TIMEVAR (jump_time
, jump_optimize (insns
, JUMP_CROSS_JUMP
,
3614 !JUMP_AFTER_REGSCAN
));
3616 /* Dump rtl code after jump, if we are doing that. */
3619 dump_rtl (".jump2", decl
, print_rtl_with_bb
, insns
);
3622 /* If a machine dependent reorganization is needed, call it. */
3623 #ifdef MACHINE_DEPENDENT_REORG
3624 MACHINE_DEPENDENT_REORG (insns
);
3626 if (mach_dep_reorg_dump
)
3627 dump_rtl (".mach", decl
, print_rtl_with_bb
, insns
);
3630 /* If a scheduling pass for delayed branches is to be done,
3631 call the scheduling code. */
3634 if (optimize
> 0 && flag_delayed_branch
)
3636 TIMEVAR (dbr_sched_time
, dbr_schedule (insns
, rtl_dump_file
));
3639 dump_rtl (".dbr", decl
, print_rtl_with_bb
, insns
);
3643 /* Shorten branches. */
3644 TIMEVAR (shorten_branch_time
,
3646 shorten_branches (get_insns ());
3650 TIMEVAR (stack_reg_time
, reg_to_stack (insns
, rtl_dump_file
));
3653 dump_rtl (".stack", decl
, print_rtl_with_bb
, insns
);
3656 /* Now turn the rtl into assembler code. */
3658 TIMEVAR (final_time
,
3663 /* Get the function's name, as described by its RTL.
3664 This may be different from the DECL_NAME name used
3665 in the source file. */
3667 x
= DECL_RTL (decl
);
3668 if (GET_CODE (x
) != MEM
)
3671 if (GET_CODE (x
) != SYMBOL_REF
)
3673 fnname
= XSTR (x
, 0);
3675 assemble_start_function (decl
, fnname
);
3676 final_start_function (insns
, asm_out_file
, optimize
);
3677 final (insns
, asm_out_file
, optimize
, 0);
3678 final_end_function (insns
, asm_out_file
, optimize
);
3679 assemble_end_function (decl
, fnname
);
3681 fflush (asm_out_file
);
3683 /* Release all memory held by regsets now */
3684 regset_release_memory ();
3687 /* Write DBX symbols if requested */
3689 /* Note that for those inline functions where we don't initially
3690 know for certain that we will be generating an out-of-line copy,
3691 the first invocation of this routine (rest_of_compilation) will
3692 skip over this code by doing a `goto exit_rest_of_compilation;'.
3693 Later on, finish_compilation will call rest_of_compilation again
3694 for those inline functions that need to have out-of-line copies
3695 generated. During that call, we *will* be routed past here. */
3697 #ifdef DBX_DEBUGGING_INFO
3698 if (write_symbols
== DBX_DEBUG
)
3699 TIMEVAR (symout_time
, dbxout_function (decl
));
3702 #ifdef DWARF_DEBUGGING_INFO
3703 if (write_symbols
== DWARF_DEBUG
)
3704 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3707 #ifdef DWARF2_DEBUGGING_INFO
3708 if (write_symbols
== DWARF2_DEBUG
)
3709 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3712 exit_rest_of_compilation
:
3714 /* In case the function was not output,
3715 don't leave any temporary anonymous types
3716 queued up for sdb output. */
3717 #ifdef SDB_DEBUGGING_INFO
3718 if (write_symbols
== SDB_DEBUG
)
3719 sdbout_types (NULL_TREE
);
3722 /* Put back the tree of subblocks and list of arguments
3723 from before we copied them.
3724 Code generation and the output of debugging info may have modified
3725 the copy, but the original is unchanged. */
3727 if (saved_block_tree
!= 0)
3729 DECL_INITIAL (decl
) = saved_block_tree
;
3730 DECL_ARGUMENTS (decl
) = saved_arguments
;
3731 DECL_ABSTRACT_ORIGIN (decl
) = NULL_TREE
;
3734 reload_completed
= 0;
3736 TIMEVAR (final_time
,
3738 /* Clear out the insn_length contents now that they are no
3740 init_insn_lengths ();
3742 /* Clear out the real_constant_chain before some of the rtx's
3743 it runs through become garbage. */
3744 clear_const_double_mem ();
3746 /* Cancel the effect of rtl_in_current_obstack. */
3747 resume_temporary_allocation ();
3749 /* Show no temporary slots allocated. */
3753 /* Make sure volatile mem refs aren't considered valid operands for
3754 arithmetic insns. We must call this here if this is a nested inline
3755 function, since the above code leaves us in the init_recog state
3756 (from final.c), and the function context push/pop code does not
3757 save/restore volatile_ok.
3759 ??? Maybe it isn't necessary for expand_start_function to call this
3760 anymore if we do it here? */
3762 init_recog_no_volatile ();
3764 /* The parsing time is all the time spent in yyparse
3765 *except* what is spent in this function. */
3767 parse_time
-= get_run_time () - start_time
;
3770 /* Entry point of cc1/c++. Decode command args, then call compile_file.
3771 Exit code is 35 if can't open files, 34 if fatal error,
3772 33 if had nonfatal errors, else success. */
3775 main (argc
, argv
, envp
)
3782 int flag_print_mem
= 0;
3783 int version_flag
= 0;
3786 /* save in case md file wants to emit args as a comment. */
3790 p
= argv
[0] + strlen (argv
[0]);
3791 while (p
!= argv
[0] && p
[-1] != '/'
3792 #ifdef DIR_SEPARATOR
3793 && p
[-1] != DIR_SEPARATOR
3799 #if defined (RLIMIT_STACK) && defined (HAVE_GETRLIMIT) && defined (HAVE_SETRLIMIT)
3800 /* Get rid of any avoidable limit on stack size. */
3804 /* Set the stack limit huge so that alloca does not fail. */
3805 getrlimit (RLIMIT_STACK
, &rlim
);
3806 rlim
.rlim_cur
= rlim
.rlim_max
;
3807 setrlimit (RLIMIT_STACK
, &rlim
);
3811 signal (SIGFPE
, float_signal
);
3814 signal (SIGPIPE
, pipe_closed
);
3817 decl_printable_name
= decl_name
;
3818 lang_expand_expr
= (struct rtx_def
*(*)()) do_abort
;
3820 /* Initialize whether `char' is signed. */
3821 flag_signed_char
= DEFAULT_SIGNED_CHAR
;
3822 #ifdef DEFAULT_SHORT_ENUMS
3823 /* Initialize how much space enums occupy, by default. */
3824 flag_short_enums
= DEFAULT_SHORT_ENUMS
;
3827 /* Perform language-specific options intialization. */
3828 lang_init_options ();
3830 /* Scan to see what optimization level has been specified. That will
3831 determine the default value of many flags. */
3832 for (i
= 1; i
< argc
; i
++)
3834 if (!strcmp (argv
[i
], "-O"))
3838 else if (argv
[i
][0] == '-' && argv
[i
][1] == 'O')
3840 /* Handle -Os, -O2, -O3, -O69, ... */
3841 char *p
= &argv
[i
][2];
3844 if ((p
[0] == 's') && (p
[1] == 0))
3849 if (! (c
>= '0' && c
<= '9'))
3852 optimize
= atoi (&argv
[i
][2]);
3857 /* Optimizing for size forces optimize to be no less than 2. */
3858 if (optimize_size
&& (optimize
< 2))
3861 obey_regdecls
= (optimize
== 0);
3866 flag_thread_jumps
= 1;
3868 flag_delayed_branch
= 1;
3870 #ifdef CAN_DEBUG_WITHOUT_FP
3871 flag_omit_frame_pointer
= 1;
3877 flag_cse_follow_jumps
= 1;
3878 flag_cse_skip_blocks
= 1;
3880 flag_expensive_optimizations
= 1;
3881 flag_strength_reduce
= 1;
3882 flag_rerun_cse_after_loop
= 1;
3883 flag_rerun_loop_opt
= 1;
3884 flag_caller_saves
= 1;
3886 #ifdef INSN_SCHEDULING
3887 flag_schedule_insns
= 1;
3888 flag_schedule_insns_after_reload
= 1;
3891 /* We don't set flag_strict_aliasing here because we're still
3892 testing the functionality. After it has been tested, it
3893 should be turned on here. */
3898 flag_inline_functions
= 1;
3901 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
3904 set_target_switch ("");
3906 #ifdef OPTIMIZATION_OPTIONS
3907 /* Allow default optimizations to be specified on a per-machine basis. */
3908 OPTIMIZATION_OPTIONS (optimize
, optimize_size
);
3911 /* Initialize register usage now so switches may override. */
3914 for (i
= 1; i
< argc
; i
++)
3917 /* If this is a language-specific option,
3918 decode it in a language-specific way. */
3919 for (j
= 0; lang_options
[j
] != 0; j
++)
3920 if (!strncmp (argv
[i
], lang_options
[j
],
3921 strlen (lang_options
[j
])))
3923 if (lang_options
[j
] != 0)
3925 /* If the option is valid for *some* language,
3926 treat it as valid even if this language doesn't understand it. */
3927 int strings_processed
= lang_decode_option (argc
- i
, argv
+ i
);
3928 if (strings_processed
!= 0)
3929 i
+= strings_processed
- 1;
3931 else if (argv
[i
][0] == '-' && argv
[i
][1] != 0)
3933 register char *str
= argv
[i
] + 1;
3938 set_target_switch (&str
[1]);
3939 else if (!strcmp (str
, "dumpbase"))
3941 dump_base_name
= argv
[++i
];
3943 else if (str
[0] == 'd')
3945 register char *p
= &str
[1];
3950 branch_prob_dump
= 1;
3956 global_reg_dump
= 1;
3964 cse_dump
= 1, cse2_dump
= 1;
3971 #ifdef MACHINE_DEPENDENT_REORG
3972 mach_dep_reorg_dump
= 1;
3979 branch_prob_dump
= 1;
3996 global_reg_dump
= 1;
4021 #ifdef MACHINE_DEPENDENT_REORG
4023 mach_dep_reorg_dump
= 1;
4027 flag_print_asm_name
= 1;
4051 rtl_dump_and_exit
= 1;
4054 warning ("unrecognised gcc debugging option: %c", p
[-1]);
4058 else if (str
[0] == 'f')
4060 register char *p
= &str
[1];
4063 /* Some kind of -f option.
4064 P's value is the option sans `-f'.
4065 Search for it in the table of options. */
4068 !found
&& j
< sizeof (f_options
) / sizeof (f_options
[0]);
4071 if (!strcmp (p
, f_options
[j
].string
))
4073 *f_options
[j
].variable
= f_options
[j
].on_value
;
4074 /* A goto here would be cleaner,
4075 but breaks the vax pcc. */
4078 if (p
[0] == 'n' && p
[1] == 'o' && p
[2] == '-'
4079 && ! strcmp (p
+3, f_options
[j
].string
))
4081 *f_options
[j
].variable
= ! f_options
[j
].on_value
;
4089 #ifdef INSN_SCHEDULING
4090 else if (!strncmp (p
, "sched-verbose-",14))
4091 fix_sched_param("verbose",&p
[14]);
4094 else if (!strncmp (p
, "fixed-", 6))
4095 fix_register (&p
[6], 1, 1);
4096 else if (!strncmp (p
, "call-used-", 10))
4097 fix_register (&p
[10], 0, 1);
4098 else if (!strncmp (p
, "call-saved-", 11))
4099 fix_register (&p
[11], 0, 0);
4101 error ("Invalid option `%s'", argv
[i
]);
4103 else if (str
[0] == 'O')
4105 register char *p
= str
+1;
4109 while (*p
&& *p
>= '0' && *p
<= '9')
4114 error ("Invalid option `%s'", argv
[i
]);
4116 else if (!strcmp (str
, "pedantic"))
4118 else if (!strcmp (str
, "pedantic-errors"))
4119 flag_pedantic_errors
= pedantic
= 1;
4120 else if (!strcmp (str
, "quiet"))
4122 else if (!strcmp (str
, "version"))
4124 else if (!strcmp (str
, "w"))
4125 inhibit_warnings
= 1;
4126 else if (!strcmp (str
, "W"))
4129 /* We save the value of warn_uninitialized, since if they put
4130 -Wuninitialized on the command line, we need to generate a
4131 warning about not using it without also specifying -O. */
4132 if (warn_uninitialized
!= 1)
4133 warn_uninitialized
= 2;
4135 else if (str
[0] == 'W')
4137 register char *p
= &str
[1];
4140 /* Some kind of -W option.
4141 P's value is the option sans `-W'.
4142 Search for it in the table of options. */
4145 !found
&& j
< sizeof (W_options
) / sizeof (W_options
[0]);
4148 if (!strcmp (p
, W_options
[j
].string
))
4150 *W_options
[j
].variable
= W_options
[j
].on_value
;
4151 /* A goto here would be cleaner,
4152 but breaks the vax pcc. */
4155 if (p
[0] == 'n' && p
[1] == 'o' && p
[2] == '-'
4156 && ! strcmp (p
+3, W_options
[j
].string
))
4158 *W_options
[j
].variable
= ! W_options
[j
].on_value
;
4165 else if (!strncmp (p
, "id-clash-", 9))
4171 if (*endp
>= '0' && *endp
<= '9')
4175 error ("Invalid option `%s'", argv
[i
]);
4180 id_clash_len
= atoi (str
+ 10);
4183 else if (!strncmp (p
, "larger-than-", 12))
4185 char *endp
= p
+ 12;
4189 if (*endp
>= '0' && *endp
<= '9')
4193 error ("Invalid option `%s'", argv
[i
]);
4194 goto larger_than_lose
;
4197 warn_larger_than
= 1;
4198 larger_than_size
= atoi (str
+ 13);
4202 error ("Invalid option `%s'", argv
[i
]);
4204 else if (!strcmp (str
, "p"))
4208 else if (!strcmp (str
, "a"))
4210 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4211 warning ("`-a' option (basic block profile) not supported");
4213 profile_block_flag
= (profile_block_flag
< 2) ? 1 : 3;
4216 else if (!strcmp (str
, "ax"))
4218 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4219 warning ("`-ax' option (jump profiling) not supported");
4221 profile_block_flag
= (!profile_block_flag
4222 || profile_block_flag
== 2) ? 2 : 3;
4225 else if (str
[0] == 'g')
4229 /* A lot of code assumes write_symbols == NO_DEBUG if the
4230 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4231 of what debugging type has been selected). This records the
4232 selected type. It is an error to specify more than one
4234 static enum debug_info_type selected_debug_type
= NO_DEBUG
;
4235 /* Non-zero if debugging format has been explicitly set.
4236 -g and -ggdb don't explicitly set the debugging format so
4237 -gdwarf -g3 is equivalent to -gdwarf3. */
4238 static int type_explicitly_set_p
= 0;
4239 /* Table of supported debugging formats. */
4242 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
4243 constant expression, we use NO_DEBUG in its place. */
4244 enum debug_info_type debug_type
;
4245 int use_extensions_p
;
4246 } *da
, debug_args
[] = {
4247 { "g", NO_DEBUG
, DEFAULT_GDB_EXTENSIONS
},
4248 { "ggdb", NO_DEBUG
, 1 },
4249 #ifdef DBX_DEBUGGING_INFO
4250 { "gstabs", DBX_DEBUG
, 0 },
4251 { "gstabs+", DBX_DEBUG
, 1 },
4253 #ifdef DWARF_DEBUGGING_INFO
4254 { "gdwarf", DWARF_DEBUG
, 0 },
4255 { "gdwarf+", DWARF_DEBUG
, 1 },
4257 #ifdef DWARF2_DEBUGGING_INFO
4258 { "gdwarf-2", DWARF2_DEBUG
, 0 },
4260 #ifdef XCOFF_DEBUGGING_INFO
4261 { "gxcoff", XCOFF_DEBUG
, 0 },
4262 { "gxcoff+", XCOFF_DEBUG
, 1 },
4264 #ifdef SDB_DEBUGGING_INFO
4265 { "gcoff", SDB_DEBUG
, 0 },
4269 /* Indexed by enum debug_info_type. */
4270 static char *debug_type_names
[] = {
4271 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4274 /* Look up STR in the table. */
4275 for (da
= debug_args
; da
->arg
; da
++)
4277 if (! strncmp (str
, da
->arg
, strlen (da
->arg
)))
4279 enum debug_info_type type
= da
->debug_type
;
4282 p
= str
+ strlen (da
->arg
);
4283 if (*p
&& (*p
< '0' || *p
> '9'))
4287 while (*q
&& (*q
>= '0' && *q
<= '9'))
4292 if (len
> 1 && !strncmp (str
, "gdwarf", len
))
4294 error ("use -gdwarf -g%d for DWARF v1, level %d",
4297 error ("use -gdwarf-2 for DWARF v2");
4301 level
= 2; /* default debugging info level */
4302 if (*q
|| level
> 3)
4304 warning ("invalid debug level specification in option: `-%s'",
4306 /* ??? This error message is incorrect in the case of
4308 warning ("no debugging information will be generated");
4312 if (type
== NO_DEBUG
)
4314 type
= PREFERRED_DEBUGGING_TYPE
;
4315 if (len
> 1 && strncmp (str
, "ggdb", len
) == 0)
4317 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4318 type
= DWARF2_DEBUG
;
4320 #ifdef DBX_DEBUGGING_INFO
4327 if (type
== NO_DEBUG
)
4328 warning ("`-%s' not supported by this configuration of GCC",
4331 /* Does it conflict with an already selected type? */
4332 if (type_explicitly_set_p
4333 /* -g/-ggdb don't conflict with anything */
4334 && da
->debug_type
!= NO_DEBUG
4335 && type
!= selected_debug_type
)
4336 warning ("`-%s' ignored, conflicts with `-g%s'",
4337 str
, debug_type_names
[(int) selected_debug_type
]);
4340 /* If the format has already been set, -g/-ggdb
4341 only change the debug level. */
4342 if (type_explicitly_set_p
4343 && da
->debug_type
== NO_DEBUG
)
4344 ; /* don't change debugging type */
4347 selected_debug_type
= type
;
4348 type_explicitly_set_p
= da
->debug_type
!= NO_DEBUG
;
4350 write_symbols
= (level
== 0
4352 : selected_debug_type
);
4353 use_gnu_debug_info_extensions
= da
->use_extensions_p
;
4354 debug_info_level
= (enum debug_info_level
) level
;
4360 warning ("`-%s' not supported by this configuration of GCC",
4363 else if (!strcmp (str
, "o"))
4365 asm_file_name
= argv
[++i
];
4367 else if (str
[0] == 'G')
4369 g_switch_set
= TRUE
;
4370 g_switch_value
= atoi ((str
[1] != '\0') ? str
+1 : argv
[++i
]);
4372 else if (!strncmp (str
, "aux-info", 8))
4374 flag_gen_aux_info
= 1;
4375 aux_info_file_name
= (str
[8] != '\0' ? str
+8 : argv
[++i
]);
4378 error ("Invalid option `%s'", argv
[i
]);
4380 else if (argv
[i
][0] == '+')
4381 error ("Invalid option `%s'", argv
[i
]);
4386 /* Checker uses the frame pointer. */
4387 if (flag_check_memory_usage
)
4388 flag_omit_frame_pointer
= 0;
4392 /* Inlining does not work if not optimizing,
4393 so force it not to be done. */
4397 /* The c_decode_option and lang_decode_option functions set
4398 this to `2' if -Wall is used, so we can avoid giving out
4399 lots of errors for people who don't realize what -Wall does. */
4400 if (warn_uninitialized
== 1)
4401 warning ("-Wuninitialized is not supported without -O");
4404 #ifdef OVERRIDE_OPTIONS
4405 /* Some machines may reject certain combinations of options. */
4409 if (exceptions_via_longjmp
== 2)
4411 #ifdef DWARF2_UNWIND_INFO
4412 exceptions_via_longjmp
= ! DWARF2_UNWIND_INFO
;
4414 exceptions_via_longjmp
= 1;
4418 if (profile_block_flag
== 3)
4420 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4421 profile_block_flag
= 2;
4424 /* Unrolling all loops implies that standard loop unrolling must also
4426 if (flag_unroll_all_loops
)
4427 flag_unroll_loops
= 1;
4428 /* Loop unrolling requires that strength_reduction be on also. Silently
4429 turn on strength reduction here if it isn't already on. Also, the loop
4430 unrolling code assumes that cse will be run after loop, so that must
4431 be turned on also. */
4432 if (flag_unroll_loops
)
4434 flag_strength_reduce
= 1;
4435 flag_rerun_cse_after_loop
= 1;
4438 /* Warn about options that are not supported on this machine. */
4439 #ifndef INSN_SCHEDULING
4440 if (flag_schedule_insns
|| flag_schedule_insns_after_reload
)
4441 warning ("instruction scheduling not supported on this target machine");
4444 if (flag_delayed_branch
)
4445 warning ("this target machine does not have delayed branches");
4448 /* If we are in verbose mode, write out the version and maybe all the
4449 option flags in use. */
4452 print_version (stderr
, "");
4454 print_switch_values (stderr
, 0, MAX_LINE
, "", " ", "\n");
4457 compile_file (filename
);
4459 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN32__))
4462 char *lim
= (char *) sbrk (0);
4464 fprintf (stderr
, "Data size %ld.\n", (long)(lim
- (char *) &environ
));
4469 system ("ps -l 1>&2");
4472 #endif /* not USG */
4475 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN32) */
4478 exit (FATAL_EXIT_CODE
);
4480 exit (FATAL_EXIT_CODE
);
4481 exit (SUCCESS_EXIT_CODE
);
4485 /* Decode -m switches. */
4487 /* Here is a table, controlled by the tm.h file, listing each -m switch
4488 and which bits in `target_switches' it should set or clear.
4489 If VALUE is positive, it is bits to set.
4490 If VALUE is negative, -VALUE is bits to clear.
4491 (The sign bit is not used so there is no confusion.) */
4493 struct {char *name
; int value
;} target_switches
[]
4496 /* This table is similar, but allows the switch to have a value. */
4498 #ifdef TARGET_OPTIONS
4499 struct {char *prefix
; char ** variable
;} target_options
[]
4503 /* Decode the switch -mNAME. */
4506 set_target_switch (name
)
4512 for (j
= 0; j
< sizeof target_switches
/ sizeof target_switches
[0]; j
++)
4513 if (!strcmp (target_switches
[j
].name
, name
))
4515 if (target_switches
[j
].value
< 0)
4516 target_flags
&= ~-target_switches
[j
].value
;
4518 target_flags
|= target_switches
[j
].value
;
4522 #ifdef TARGET_OPTIONS
4524 for (j
= 0; j
< sizeof target_options
/ sizeof target_options
[0]; j
++)
4526 int len
= strlen (target_options
[j
].prefix
);
4527 if (!strncmp (target_options
[j
].prefix
, name
, len
))
4529 *target_options
[j
].variable
= name
+ len
;
4536 error ("Invalid option `%s'", name
);
4539 /* Print version information to FILE.
4540 Each line begins with INDENT (for the case where FILE is the
4541 assembler output file). */
4544 print_version (file
, indent
)
4548 fprintf (file
, "%s%s%s version %s", indent
, *indent
!= 0 ? " " : "",
4549 language_string
, version_string
);
4550 fprintf (file
, " (%s)", TARGET_NAME
);
4553 #define __VERSION__ "[unknown]"
4555 fprintf (file
, " compiled by GNU C version %s.\n", __VERSION__
);
4557 fprintf (file
, " compiled by CC.\n");
4561 /* Print an option value and return the adjusted position in the line.
4562 ??? We don't handle error returns from fprintf (disk full); presumably
4563 other code will catch a disk full though. */
4566 print_single_switch (file
, pos
, max
, indent
, sep
, term
, type
, name
)
4569 char *indent
, *sep
, *term
, *type
, *name
;
4571 /* The ultrix fprintf returns 0 on success, so compute the result we want
4572 here since we need it for the following test. */
4573 int len
= strlen (sep
) + strlen (type
) + strlen (name
);
4578 fprintf (file
, "%s", term
);
4583 fprintf (file
, "%s", indent
);
4584 pos
= strlen (indent
);
4586 fprintf (file
, "%s%s%s", sep
, type
, name
);
4591 /* Print active target switches to FILE.
4592 POS is the current cursor position and MAX is the size of a "line".
4593 Each line begins with INDENT and ends with TERM.
4594 Each switch is separated from the next by SEP. */
4597 print_switch_values (file
, pos
, max
, indent
, sep
, term
)
4600 char *indent
, *sep
, *term
;
4605 /* Print the options as passed. */
4607 pos
= print_single_switch (file
, pos
, max
, indent
, *indent
? " " : "", term
,
4608 "options passed: ", "");
4610 for (p
= &save_argv
[1]; *p
!= NULL
; p
++)
4614 if (strcmp (*p
, "-o") == 0)
4620 if (strcmp (*p
, "-quiet") == 0)
4622 if (strcmp (*p
, "-version") == 0)
4627 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
, *p
, "");
4630 fprintf (file
, "%s", term
);
4632 /* Print the -f and -m options that have been enabled.
4633 We don't handle language specific options but printing argv
4636 pos
= print_single_switch (file
, 0, max
, indent
, *indent
? " " : "", term
,
4637 "options enabled: ", "");
4639 for (j
= 0; j
< sizeof f_options
/ sizeof f_options
[0]; j
++)
4640 if (*f_options
[j
].variable
== f_options
[j
].on_value
)
4641 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4642 "-f", f_options
[j
].string
);
4644 /* Print target specific options. */
4646 for (j
= 0; j
< sizeof target_switches
/ sizeof target_switches
[0]; j
++)
4647 if (target_switches
[j
].name
[0] != '\0'
4648 && target_switches
[j
].value
> 0
4649 && ((target_switches
[j
].value
& target_flags
)
4650 == target_switches
[j
].value
))
4652 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4653 "-m", target_switches
[j
].name
);
4656 #ifdef TARGET_OPTIONS
4657 for (j
= 0; j
< sizeof target_options
/ sizeof target_options
[0]; j
++)
4658 if (*target_options
[j
].variable
!= NULL
)
4661 sprintf (prefix
, "-m%s", target_options
[j
].prefix
);
4662 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4663 prefix
, *target_options
[j
].variable
);
4667 fprintf (file
, "%s", term
);
4670 /* Record the beginning of a new source file, named FILENAME. */
4673 debug_start_source_file (filename
)
4674 register char *filename
;
4676 #ifdef DBX_DEBUGGING_INFO
4677 if (write_symbols
== DBX_DEBUG
)
4678 dbxout_start_new_source_file (filename
);
4680 #ifdef DWARF_DEBUGGING_INFO
4681 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4682 && write_symbols
== DWARF_DEBUG
)
4683 dwarfout_start_new_source_file (filename
);
4684 #endif /* DWARF_DEBUGGING_INFO */
4685 #ifdef DWARF2_DEBUGGING_INFO
4686 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4687 && write_symbols
== DWARF2_DEBUG
)
4688 dwarf2out_start_source_file (filename
);
4689 #endif /* DWARF2_DEBUGGING_INFO */
4690 #ifdef SDB_DEBUGGING_INFO
4691 if (write_symbols
== SDB_DEBUG
)
4692 sdbout_start_new_source_file (filename
);
4696 /* Record the resumption of a source file. LINENO is the line number in
4697 the source file we are returning to. */
4700 debug_end_source_file (lineno
)
4701 register unsigned lineno
;
4703 #ifdef DBX_DEBUGGING_INFO
4704 if (write_symbols
== DBX_DEBUG
)
4705 dbxout_resume_previous_source_file ();
4707 #ifdef DWARF_DEBUGGING_INFO
4708 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4709 && write_symbols
== DWARF_DEBUG
)
4710 dwarfout_resume_previous_source_file (lineno
);
4711 #endif /* DWARF_DEBUGGING_INFO */
4712 #ifdef DWARF2_DEBUGGING_INFO
4713 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4714 && write_symbols
== DWARF2_DEBUG
)
4715 dwarf2out_end_source_file ();
4716 #endif /* DWARF2_DEBUGGING_INFO */
4717 #ifdef SDB_DEBUGGING_INFO
4718 if (write_symbols
== SDB_DEBUG
)
4719 sdbout_resume_previous_source_file ();
4723 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
4724 the tail part of the directive line, i.e. the part which is past the
4725 initial whitespace, #, whitespace, directive-name, whitespace part. */
4728 debug_define (lineno
, buffer
)
4729 register unsigned lineno
;
4730 register char *buffer
;
4732 #ifdef DWARF_DEBUGGING_INFO
4733 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4734 && write_symbols
== DWARF_DEBUG
)
4735 dwarfout_define (lineno
, buffer
);
4736 #endif /* DWARF_DEBUGGING_INFO */
4737 #ifdef DWARF2_DEBUGGING_INFO
4738 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4739 && write_symbols
== DWARF2_DEBUG
)
4740 dwarf2out_define (lineno
, buffer
);
4741 #endif /* DWARF2_DEBUGGING_INFO */
4744 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
4745 the tail part of the directive line, i.e. the part which is past the
4746 initial whitespace, #, whitespace, directive-name, whitespace part. */
4749 debug_undef (lineno
, buffer
)
4750 register unsigned lineno
;
4751 register char *buffer
;
4753 #ifdef DWARF_DEBUGGING_INFO
4754 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4755 && write_symbols
== DWARF_DEBUG
)
4756 dwarfout_undef (lineno
, buffer
);
4757 #endif /* DWARF_DEBUGGING_INFO */
4758 #ifdef DWARF2_DEBUGGING_INFO
4759 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4760 && write_symbols
== DWARF2_DEBUG
)
4761 dwarf2out_undef (lineno
, buffer
);
4762 #endif /* DWARF2_DEBUGGING_INFO */