1 /* Top level of GNU C compiler
2 Copyright (C) 1987, 88, 89, 92-6, 1997 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. */
35 #include <sys/types.h>
42 #include <sys/param.h>
43 /* This is for hpux. It is a real screw. They should change hpux. */
45 #include <sys/times.h>
46 #include <time.h> /* Correct for hpux at least. Is it good on other USG? */
47 #undef FFS /* Some systems define this in param.h. */
51 #include <sys/resource.h>
60 #include "insn-attr.h"
67 #ifdef XCOFF_DEBUGGING_INFO
72 /* The extra parameters substantially improve the I/O performance. */
74 vms_fopen (fname
, type
)
78 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
79 fixed arguments, which matches ANSI's specification but not VAXCRTL's
80 pre-ANSI implementation. This hack circumvents the mismatch problem. */
81 FILE *(*vmslib_fopen
)() = (FILE *(*)()) fopen
;
84 return (*vmslib_fopen
) (fname
, type
, "mbc=32",
85 "deq=64", "fop=tef", "shr=nil");
87 return (*vmslib_fopen
) (fname
, type
, "mbc=32");
89 #define fopen vms_fopen
92 #ifndef DEFAULT_GDB_EXTENSIONS
93 #define DEFAULT_GDB_EXTENSIONS 1
96 /* If more than one debugging type is supported, you must define
97 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
99 This is one long line cause VAXC can't handle a \-newline. */
100 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
101 #ifndef PREFERRED_DEBUGGING_TYPE
102 You Lose
! You must define PREFERRED_DEBUGGING_TYPE
!
103 #endif /* no PREFERRED_DEBUGGING_TYPE */
104 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
105 so the following code needn't care. */
106 #ifdef DBX_DEBUGGING_INFO
107 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
109 #ifdef SDB_DEBUGGING_INFO
110 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
112 #ifdef DWARF_DEBUGGING_INFO
113 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
115 #ifdef DWARF2_DEBUGGING_INFO
116 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
118 #ifdef XCOFF_DEBUGGING_INFO
119 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
121 #endif /* More than one debugger format enabled. */
123 /* If still not defined, must have been because no debugging formats
125 #ifndef PREFERRED_DEBUGGING_TYPE
126 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
129 extern int rtx_equal_function_value_matters
;
131 #if ! (defined (VMS) || defined (OS2))
132 extern char **environ
;
134 extern char *version_string
, *language_string
;
136 /* Carry information from ASM_DECLARE_OBJECT_NAME
137 to ASM_FINISH_DECLARE_OBJECT. */
139 extern int size_directive_output
;
140 extern tree last_assemble_variable_decl
;
142 extern void init_lex ();
143 extern void init_decl_processing ();
144 extern void init_obstacks ();
145 extern void init_tree_codes ();
146 extern void init_rtl ();
147 extern void init_regs ();
148 extern void init_optabs ();
149 extern void init_stmt ();
150 extern void init_reg_sets ();
151 extern void dump_flow_info ();
152 extern void dump_sched_info ();
153 extern void dump_local_alloc ();
154 extern void regset_release_memory ();
156 void rest_of_decl_compilation ();
157 void error_with_file_and_line
PVPROTO((char *file
, int line
, char *s
, ...));
158 void error_with_decl
PVPROTO((tree decl
, char *s
, ...));
159 void error_for_asm
PVPROTO((rtx insn
, char *s
, ...));
160 void error
PVPROTO((char *s
, ...));
161 void fatal
PVPROTO((char *s
, ...));
162 void warning_with_file_and_line
PVPROTO((char *file
, int line
, char *s
, ...));
163 void warning_with_decl
PVPROTO((tree decl
, char *s
, ...));
164 void warning_for_asm
PVPROTO((rtx insn
, char *s
, ...));
165 void warning
PVPROTO((char *s
, ...));
166 void pedwarn
PVPROTO((char *s
, ...));
167 void pedwarn_with_decl
PVPROTO((tree decl
, char *s
, ...));
168 void pedwarn_with_file_and_line
PVPROTO((char *file
, int line
, char *s
, ...));
169 void sorry
PVPROTO((char *s
, ...));
170 void really_sorry
PVPROTO((char *s
, ...));
175 void set_target_switch ();
176 static char *decl_name ();
178 void print_version ();
179 int print_single_switch ();
180 void print_switch_values ();
181 /* Length of line when printing switch values. */
185 extern char *sbrk ();
188 /* Name of program invoked, sans directories. */
192 /* Copy of arguments to main. */
196 /* Name of current original source file (what was input to cpp).
197 This comes from each #-command in the actual input. */
199 char *input_filename
;
201 /* Name of top-level original source file (what was input to cpp).
202 This comes from the #-command at the beginning of the actual input.
203 If there isn't any there, then this is the cc1 input file name. */
205 char *main_input_filename
;
208 /* Stream for reading from the input file. */
212 /* Current line number in real source file. */
216 /* Stack of currently pending input files. */
218 struct file_stack
*input_file_stack
;
220 /* Incremented on each change to input_file_stack. */
221 int input_file_stack_tick
;
223 /* FUNCTION_DECL for function now being parsed or compiled. */
225 extern tree current_function_decl
;
227 /* Name to use as base of names for dump output files. */
229 char *dump_base_name
;
231 /* Bit flags that specify the machine subtype we are compiling for.
232 Bits are tested using macros TARGET_... defined in the tm.h file
233 and set by `-m...' switches. Must be defined in rtlanal.c. */
235 extern int target_flags
;
237 /* Flags saying which kinds of debugging dump have been requested. */
240 int rtl_dump_and_exit
= 0;
241 int jump_opt_dump
= 0;
245 int branch_prob_dump
= 0;
247 int combine_dump
= 0;
248 int regmove_dump
= 0;
250 int local_reg_dump
= 0;
251 int global_reg_dump
= 0;
253 int jump2_opt_dump
= 0;
254 int dbr_sched_dump
= 0;
255 int flag_print_asm_name
= 0;
256 int stack_reg_dump
= 0;
258 /* Name for output file of assembly code, specified with -o. */
262 /* Value of the -G xx switch, and whether it was passed or not. */
266 /* Type(s) of debugging information we are producing (if any).
267 See flags.h for the definitions of the different possible
268 types of debugging information. */
269 enum debug_info_type write_symbols
= NO_DEBUG
;
271 /* Level of debugging information we are producing. See flags.h
272 for the definitions of the different possible levels. */
273 enum debug_info_level debug_info_level
= DINFO_LEVEL_NONE
;
275 /* Nonzero means use GNU-only extensions in the generated symbolic
276 debugging information. */
277 /* Currently, this only has an effect when write_symbols is set to
278 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
279 int use_gnu_debug_info_extensions
= 0;
281 /* Nonzero means do optimizations. -O.
282 Particular numeric values stand for particular amounts of optimization;
283 thus, -O2 stores 2 here. However, the optimizations beyond the basic
284 ones are not controlled directly by this variable. Instead, they are
285 controlled by individual `flag_...' variables that are defaulted
286 based on this variable. */
290 /* Number of error messages and warning messages so far. */
293 int warningcount
= 0;
296 /* Flag to output bytecode instead of native assembler */
297 int output_bytecode
= 0;
299 /* Pointer to function to compute the name to use to print a declaration.
300 DECL is the declaration in question.
301 VERBOSITY determines what information will be printed:
302 0: DECL_NAME, demangled as necessary.
303 1: and scope information.
304 2: and any other information that might be interesting, such as function
305 parameter types in C++. */
307 char *(*decl_printable_name
) (/* tree decl, int verbosity */);
309 /* Pointer to function to compute rtl for a language-specific tree code. */
311 struct rtx_def
*(*lang_expand_expr
) ();
313 /* Pointer to function to finish handling an incomplete decl at the
314 end of compilation. */
316 void (*incomplete_decl_finalize_hook
) () = 0;
318 /* Highest label number used at the end of reload. */
320 int max_label_num_after_reload
;
322 /* Nonzero if generating code to do profiling. */
324 int profile_flag
= 0;
326 /* Nonzero if generating code to do profiling on a line-by-line basis. */
328 int profile_block_flag
;
330 /* Nonzero if generating code to profile program flow graph arcs. */
332 int profile_arc_flag
= 0;
334 /* Nonzero if generating info for gcov to calculate line test coverage. */
336 int flag_test_coverage
= 0;
338 /* Nonzero indicates that branch taken probabilities should be calculated. */
340 int flag_branch_probabilities
= 0;
342 /* Nonzero for -pedantic switch: warn about anything
343 that standard spec forbids. */
347 /* Temporarily suppress certain warnings.
348 This is set while reading code from a system header file. */
350 int in_system_header
= 0;
352 /* Nonzero means do stupid register allocation.
353 Currently, this is 1 if `optimize' is 0. */
355 int obey_regdecls
= 0;
357 /* Don't print functions as they are compiled and don't print
358 times taken by the various passes. -quiet. */
364 /* Nonzero means `char' should be signed. */
366 int flag_signed_char
;
368 /* Nonzero means give an enum type only as many bytes as it needs. */
370 int flag_short_enums
;
372 /* Nonzero for -fcaller-saves: allocate values in regs that need to
373 be saved across function calls, if that produces overall better code.
374 Optional now, so people can test it. */
376 #ifdef DEFAULT_CALLER_SAVES
377 int flag_caller_saves
= 1;
379 int flag_caller_saves
= 0;
382 /* Nonzero if structures and unions should be returned in memory.
384 This should only be defined if compatibility with another compiler or
385 with an ABI is needed, because it results in slower code. */
387 #ifndef DEFAULT_PCC_STRUCT_RETURN
388 #define DEFAULT_PCC_STRUCT_RETURN 1
391 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
393 int flag_pcc_struct_return
= DEFAULT_PCC_STRUCT_RETURN
;
395 /* Nonzero for -fforce-mem: load memory value into a register
396 before arithmetic on it. This makes better cse but slower compilation. */
398 int flag_force_mem
= 0;
400 /* Nonzero for -fforce-addr: load memory address into a register before
401 reference to memory. This makes better cse but slower compilation. */
403 int flag_force_addr
= 0;
405 /* Nonzero for -fdefer-pop: don't pop args after each function call;
406 instead save them up to pop many calls' args with one insns. */
408 int flag_defer_pop
= 0;
410 /* Nonzero for -ffloat-store: don't allocate floats and doubles
411 in extended-precision registers. */
413 int flag_float_store
= 0;
415 /* Nonzero for -fcse-follow-jumps:
416 have cse follow jumps to do a more extensive job. */
418 int flag_cse_follow_jumps
;
420 /* Nonzero for -fcse-skip-blocks:
421 have cse follow a branch around a block. */
422 int flag_cse_skip_blocks
;
424 /* Nonzero for -fexpensive-optimizations:
425 perform miscellaneous relatively-expensive optimizations. */
426 int flag_expensive_optimizations
;
428 /* Nonzero for -fthread-jumps:
429 have jump optimize output of loop. */
431 int flag_thread_jumps
;
433 /* Nonzero enables strength-reduction in loop.c. */
435 int flag_strength_reduce
= 0;
437 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
438 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
439 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
442 int flag_unroll_loops
;
444 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
445 This is generally not a win. */
447 int flag_unroll_all_loops
;
449 /* Nonzero forces all invariant computations in loops to be moved
452 int flag_move_all_movables
= 0;
454 /* Nonzero forces all general induction variables in loops to be
457 int flag_reduce_all_givs
= 0;
459 /* Nonzero for -fwritable-strings:
460 store string constants in data segment and don't uniquize them. */
462 int flag_writable_strings
= 0;
464 /* Nonzero means don't put addresses of constant functions in registers.
465 Used for compiling the Unix kernel, where strange substitutions are
466 done on the assembly output. */
468 int flag_no_function_cse
= 0;
470 /* Nonzero for -fomit-frame-pointer:
471 don't make a frame pointer in simple functions that don't require one. */
473 int flag_omit_frame_pointer
= 0;
475 /* Nonzero means place each function into its own section on those platforms
476 which support arbitrary section names and unlimited numbers of sections. */
478 int flag_function_sections
= 0;
480 /* Nonzero to inhibit use of define_optimization peephole opts. */
482 int flag_no_peephole
= 0;
484 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
485 operations in the interest of optimization. For example it allows
486 GCC to assume arguments to sqrt are nonnegative numbers, allowing
487 faster code for sqrt to be generated. */
489 int flag_fast_math
= 0;
491 /* Nonzero means all references through pointers are volatile. */
495 /* Nonzero means treat all global and extern variables as global. */
497 int flag_volatile_global
;
499 /* Nonzero means just do syntax checking; don't output anything. */
501 int flag_syntax_only
= 0;
503 /* Nonzero means to rerun cse after loop optimization. This increases
504 compilation time about 20% and picks up a few more common expressions. */
506 static int flag_rerun_cse_after_loop
;
508 /* Nonzero for -finline-functions: ok to inline functions that look like
509 good inline candidates. */
511 int flag_inline_functions
;
513 /* Nonzero for -fkeep-inline-functions: even if we make a function
514 go inline everywhere, keep its definition around for debugging
517 int flag_keep_inline_functions
;
519 /* Nonzero means that functions will not be inlined. */
523 /* Nonzero means that we should emit static const variables
524 regardless of whether or not optimization is turned on. */
526 int flag_keep_static_consts
= 1;
528 /* Nonzero means we should be saving declaration info into a .X file. */
530 int flag_gen_aux_info
= 0;
532 /* Specified name of aux-info file. */
534 static char *aux_info_file_name
;
536 /* Nonzero means make the text shared if supported. */
538 int flag_shared_data
;
540 /* Nonzero means schedule into delayed branch slots if supported. */
542 int flag_delayed_branch
;
544 /* Nonzero if we are compiling pure (sharable) code.
545 Value is 1 if we are doing reasonable (i.e. simple
546 offset into offset table) pic. Value is 2 if we can
547 only perform register offsets. */
551 /* Nonzero means generate extra code for exception handling and enable
552 exception handling. */
554 int flag_exceptions
= 1;
556 /* Nonzero means don't place uninitialized global data in common storage
561 /* Nonzero means pretend it is OK to examine bits of target floats,
562 even if that isn't true. The resulting code will have incorrect constants,
563 but the same series of instructions that the native compiler would make. */
565 int flag_pretend_float
;
567 /* Nonzero means change certain warnings into errors.
568 Usually these are warnings about failure to conform to some standard. */
570 int flag_pedantic_errors
= 0;
572 /* flag_schedule_insns means schedule insns within basic blocks (before
574 flag_schedule_insns_after_reload means schedule insns after
577 int flag_schedule_insns
= 0;
578 int flag_schedule_insns_after_reload
= 0;
581 /* The following flags have effect only for scheduling before register
584 flag_schedule_interblock means schedule insns accross basic blocks.
585 flag_schedule_speculative means allow speculative motion of non-load insns.
586 flag_schedule_speculative_load means allow speculative motion of some
588 flag_schedule_speculative_load_dangerous allows speculative motion of more
590 flag_schedule_reverse_before_reload means try to reverse original order
592 flag_schedule_reverse_after_reload means try to reverse original order
595 int flag_schedule_interblock
= 1;
596 int flag_schedule_speculative
= 1;
597 int flag_schedule_speculative_load
= 0;
598 int flag_schedule_speculative_load_dangerous
= 0;
599 int flag_schedule_reverse_before_reload
= 0;
600 int flag_schedule_reverse_after_reload
= 0;
603 /* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple
604 by a cheaper branch, on a count register. */
605 int flag_branch_on_count_reg
;
609 /* -finhibit-size-directive inhibits output of .size for ELF.
610 This is used only for compiling crtstuff.c,
611 and it may be extended to other effects
612 needed for crtstuff.c on other systems. */
613 int flag_inhibit_size_directive
= 0;
615 /* -fverbose-asm causes extra commentary information to be produced in
616 the generated assembly code (to make it more readable). This option
617 is generally only of use to those who actually need to read the
618 generated assembly code (perhaps while debugging the compiler itself).
619 -fverbose-asm is the default. -fno-verbose-asm causes the extra information
620 to be omitted and is useful when comparing two assembler files. */
622 int flag_verbose_asm
= 1;
624 /* -dA causes debug commentary information to be produced in
625 the generated assembly code (to make it more readable). This option
626 is generally only of use to those who actually need to read the
627 generated assembly code (perhaps while debugging the compiler itself).
628 Currently, this switch is only used by dwarfout.c; however, it is intended
629 to be a catchall for printing debug information in the assembler file. */
631 int flag_debug_asm
= 0;
633 /* -fgnu-linker specifies use of the GNU linker for initializations.
634 (Or, more generally, a linker that handles initializations.)
635 -fno-gnu-linker says that collect2 will be used. */
637 int flag_gnu_linker
= 0;
639 int flag_gnu_linker
= 1;
642 /* Tag all structures with __attribute__(packed) */
643 int flag_pack_struct
= 0;
645 /* Emit code to check for stack overflow; also may cause large objects
646 to be allocated dynamically. */
647 int flag_stack_check
;
649 /* -fcheck-memory-usage causes extra code to be generated in order to check
650 memory accesses. This is used by a detector of bad memory accesses such
652 int flag_check_memory_usage
= 0;
654 /* -fprefix-function-name causes function name to be prefixed. This
655 can be used with -fcheck-memory-usage to isolate code compiled with
656 -fcheck-memory-usage. */
657 int flag_prefix_function_name
= 0;
659 int flag_regmove
= 0;
661 /* 1 if alias checking is on (by default, when -O). */
662 int flag_alias_check
= 0;
664 /* 0 if pointer arguments may alias each other. True in C.
665 1 if pointer arguments may not alias each other but may alias
667 2 if pointer arguments may not alias each other and may not
668 alias global variables. True in Fortran.
669 This defaults to 0 for C. */
670 int flag_argument_noalias
= 0;
672 /* Table of language-independent -f options.
673 STRING is the option name. VARIABLE is the address of the variable.
674 ON_VALUE is the value to store in VARIABLE
675 if `-fSTRING' is seen as an option.
676 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
678 struct { char *string
; int *variable
; int on_value
;} f_options
[] =
680 {"float-store", &flag_float_store
, 1},
681 {"volatile", &flag_volatile
, 1},
682 {"volatile-global", &flag_volatile_global
, 1},
683 {"defer-pop", &flag_defer_pop
, 1},
684 {"omit-frame-pointer", &flag_omit_frame_pointer
, 1},
685 {"cse-follow-jumps", &flag_cse_follow_jumps
, 1},
686 {"cse-skip-blocks", &flag_cse_skip_blocks
, 1},
687 {"expensive-optimizations", &flag_expensive_optimizations
, 1},
688 {"thread-jumps", &flag_thread_jumps
, 1},
689 {"strength-reduce", &flag_strength_reduce
, 1},
690 {"unroll-loops", &flag_unroll_loops
, 1},
691 {"unroll-all-loops", &flag_unroll_all_loops
, 1},
692 {"move-all-movables", &flag_move_all_movables
, 1},
693 {"reduce-all-givs", &flag_reduce_all_givs
, 1},
694 {"writable-strings", &flag_writable_strings
, 1},
695 {"peephole", &flag_no_peephole
, 0},
696 {"force-mem", &flag_force_mem
, 1},
697 {"force-addr", &flag_force_addr
, 1},
698 {"function-cse", &flag_no_function_cse
, 0},
699 {"inline-functions", &flag_inline_functions
, 1},
700 {"keep-inline-functions", &flag_keep_inline_functions
, 1},
701 {"inline", &flag_no_inline
, 0},
702 {"keep-static-consts", &flag_keep_static_consts
, 1},
703 {"syntax-only", &flag_syntax_only
, 1},
704 {"shared-data", &flag_shared_data
, 1},
705 {"caller-saves", &flag_caller_saves
, 1},
706 {"pcc-struct-return", &flag_pcc_struct_return
, 1},
707 {"reg-struct-return", &flag_pcc_struct_return
, 0},
708 {"delayed-branch", &flag_delayed_branch
, 1},
709 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop
, 1},
710 {"pretend-float", &flag_pretend_float
, 1},
711 {"schedule-insns", &flag_schedule_insns
, 1},
712 {"schedule-insns2", &flag_schedule_insns_after_reload
, 1},
714 {"sched-interblock",&flag_schedule_interblock
, 1},
715 {"sched-spec",&flag_schedule_speculative
, 1},
716 {"sched-spec-load",&flag_schedule_speculative_load
, 1},
717 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous
, 1},
718 {"sched-reverse-S",&flag_schedule_reverse_before_reload
, 1},
719 {"sched-reverse-R",&flag_schedule_reverse_after_reload
, 1},
720 {"branch-count-reg",&flag_branch_on_count_reg
, 1},
722 {"pic", &flag_pic
, 1},
723 {"PIC", &flag_pic
, 2},
724 {"exceptions", &flag_exceptions
, 1},
725 {"sjlj-exceptions", &exceptions_via_longjmp
, 1},
726 {"asynchronous-exceptions", &asynchronous_exceptions
, 1},
727 {"profile-arcs", &profile_arc_flag
, 1},
728 {"test-coverage", &flag_test_coverage
, 1},
729 {"branch-probabilities", &flag_branch_probabilities
, 1},
730 {"fast-math", &flag_fast_math
, 1},
731 {"common", &flag_no_common
, 0},
732 {"inhibit-size-directive", &flag_inhibit_size_directive
, 1},
733 {"function-sections", &flag_function_sections
, 1},
734 {"verbose-asm", &flag_verbose_asm
, 1},
735 {"gnu-linker", &flag_gnu_linker
, 1},
736 {"regmove", &flag_regmove
, 1},
737 {"pack-struct", &flag_pack_struct
, 1},
738 {"stack-check", &flag_stack_check
, 1},
739 {"bytecode", &output_bytecode
, 1},
740 {"alias-check", &flag_alias_check
, 1},
741 {"argument-alias", &flag_argument_noalias
, 0},
742 {"argument-noalias", &flag_argument_noalias
, 1},
743 {"argument-noalias-global", &flag_argument_noalias
, 2},
744 {"check-memory-usage", &flag_check_memory_usage
, 1},
745 {"prefix-function-name", &flag_prefix_function_name
, 1}
748 /* Table of language-specific options. */
750 char *lang_options
[] =
753 "-fallow-single-precision",
755 "-fsigned-bitfields",
756 "-funsigned-bitfields",
757 "-fno-signed-bitfields",
758 "-fno-unsigned-bitfields",
762 "-fno-unsigned-char",
778 "-fno-cond-mismatch",
779 "-fdollars-in-identifiers",
780 "-fno-dollars-in-identifiers",
789 "-Wbad-function-cast",
790 "-Wno-bad-function-cast",
794 "-Wno-char-subscripts",
810 "-Wno-missing-braces",
811 "-Wmissing-declarations",
812 "-Wno-missing-declarations",
813 "-Wmissing-prototypes",
814 "-Wno-missing-prototypes",
816 "-Wno-nested-externs",
820 "-Wno-pointer-arith",
822 "-Wno-redundant-decls",
825 "-Wstrict-prototypes",
826 "-Wno-strict-prototypes",
834 "-Wno-write-strings",
836 /* these are for obj c */
852 /* Options controlling warnings */
854 /* Don't print warning messages. -w. */
856 int inhibit_warnings
= 0;
858 /* Print various extra warnings. -W. */
860 int extra_warnings
= 0;
862 /* Treat warnings as errors. -Werror. */
864 int warnings_are_errors
= 0;
866 /* Nonzero to warn about unused local variables. */
870 /* Nonzero to warn about variables used before they are initialized. */
872 int warn_uninitialized
;
874 /* Nonzero means warn about all declarations which shadow others. */
878 /* Warn if a switch on an enum fails to have a case for every enum value. */
882 /* Nonzero means warn about function definitions that default the return type
883 or that use a null return and have a return-type other than void. */
885 int warn_return_type
;
887 /* Nonzero means warn about pointer casts that increase the required
888 alignment of the target type (and might therefore lead to a crash
889 due to a misaligned access). */
893 /* Nonzero means warn about any identifiers that match in the first N
894 characters. The value N is in `id_clash_len'. */
897 unsigned id_clash_len
;
899 /* Nonzero means warn about any objects definitions whose size is larger
900 than N bytes. Also want about function definitions whose returned
901 values are larger than N bytes. The value N is in `larger_than_size'. */
903 int warn_larger_than
;
904 unsigned larger_than_size
;
906 /* Nonzero means warn if inline function is too large. */
910 /* Warn if a function returns an aggregate,
911 since there are often incompatible calling conventions for doing this. */
913 int warn_aggregate_return
;
915 /* Likewise for -W. */
917 struct { char *string
; int *variable
; int on_value
;} W_options
[] =
919 {"unused", &warn_unused
, 1},
920 {"error", &warnings_are_errors
, 1},
921 {"shadow", &warn_shadow
, 1},
922 {"switch", &warn_switch
, 1},
923 {"aggregate-return", &warn_aggregate_return
, 1},
924 {"cast-align", &warn_cast_align
, 1},
925 {"uninitialized", &warn_uninitialized
, 1},
926 {"inline", &warn_inline
, 1}
929 /* Output files for assembler code (real compiler output)
930 and debugging dumps. */
935 FILE *jump_opt_dump_file
;
937 FILE *loop_dump_file
;
938 FILE *cse2_dump_file
;
939 FILE *branch_prob_dump_file
;
940 FILE *flow_dump_file
;
941 FILE *combine_dump_file
;
942 FILE *regmove_dump_file
;
943 FILE *sched_dump_file
;
944 FILE *local_reg_dump_file
;
945 FILE *global_reg_dump_file
;
946 FILE *sched2_dump_file
;
947 FILE *jump2_opt_dump_file
;
948 FILE *dbr_sched_dump_file
;
949 FILE *stack_reg_dump_file
;
951 /* Time accumulators, to count the total time spent in various passes. */
955 int integration_time
;
960 int branch_prob_time
;
965 int local_alloc_time
;
966 int global_alloc_time
;
969 int shorten_branch_time
;
975 /* Return time used so far, in microseconds. */
985 struct rusage rusage
;
990 int proc_system_time
;
992 int child_system_time
;
1004 return (clock() * 1000);
1005 #else /* not _WIN32 */
1008 return (tms
.tms_utime
+ tms
.tms_stime
) * (1000000 / HZ
);
1011 getrusage (0, &rusage
);
1012 return (rusage
.ru_utime
.tv_sec
* 1000000 + rusage
.ru_utime
.tv_usec
1013 + rusage
.ru_stime
.tv_sec
* 1000000 + rusage
.ru_stime
.tv_usec
);
1016 return (vms_times
.proc_user_time
+ vms_times
.proc_system_time
) * 10000;
1022 #define TIMEVAR(VAR, BODY) \
1023 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
1026 print_time (str
, total
)
1031 "time in %s: %d.%06d\n",
1032 str
, total
/ 1000000, total
% 1000000);
1035 /* Count an error or warning. Return 1 if the message should be printed. */
1038 count_error (warningp
)
1041 if (warningp
&& inhibit_warnings
)
1044 if (warningp
&& !warnings_are_errors
)
1048 static int warning_message
= 0;
1050 if (warningp
&& !warning_message
)
1052 fprintf (stderr
, "%s: warnings being treated as errors\n", progname
);
1053 warning_message
= 1;
1061 /* Print a fatal error message. NAME is the text.
1062 Also include a system error message based on `errno'. */
1065 pfatal_with_name (name
)
1068 fprintf (stderr
, "%s: ", progname
);
1070 exit (FATAL_EXIT_CODE
);
1074 fatal_io_error (name
)
1077 fprintf (stderr
, "%s: %s: I/O error\n", progname
, name
);
1078 exit (FATAL_EXIT_CODE
);
1081 /* Called to give a better error message for a bad insn rather than
1082 just calling abort(). */
1085 fatal_insn (message
, insn
)
1089 if (!output_bytecode
)
1095 fflush (asm_out_file
);
1097 fflush (aux_info_file
);
1099 fflush (rtl_dump_file
);
1100 if (jump_opt_dump_file
)
1101 fflush (jump_opt_dump_file
);
1103 fflush (cse_dump_file
);
1105 fflush (loop_dump_file
);
1107 fflush (cse2_dump_file
);
1109 fflush (flow_dump_file
);
1110 if (combine_dump_file
)
1111 fflush (combine_dump_file
);
1112 if (regmove_dump_file
)
1113 fflush (regmove_dump_file
);
1114 if (sched_dump_file
)
1115 fflush (sched_dump_file
);
1116 if (local_reg_dump_file
)
1117 fflush (local_reg_dump_file
);
1118 if (global_reg_dump_file
)
1119 fflush (global_reg_dump_file
);
1120 if (sched2_dump_file
)
1121 fflush (sched2_dump_file
);
1122 if (jump2_opt_dump_file
)
1123 fflush (jump2_opt_dump_file
);
1124 if (dbr_sched_dump_file
)
1125 fflush (dbr_sched_dump_file
);
1126 if (stack_reg_dump_file
)
1127 fflush (stack_reg_dump_file
);
1133 /* Called to give a better error message when we don't have an insn to match
1134 what we are looking for or if the insn's constraints aren't satisfied,
1135 rather than just calling abort(). */
1138 fatal_insn_not_found (insn
)
1141 if (INSN_CODE (insn
) < 0)
1142 fatal_insn ("internal error--unrecognizable insn:", insn
);
1144 fatal_insn ("internal error--insn does not satisfy its constraints:", insn
);
1147 /* This is the default decl_printable_name function. */
1150 decl_name (decl
, verbosity
)
1154 return IDENTIFIER_POINTER (DECL_NAME (decl
));
1157 static int need_error_newline
;
1159 /* Function of last error message;
1160 more generally, function such that if next error message is in it
1161 then we don't have to mention the function name. */
1162 static tree last_error_function
= NULL
;
1164 /* Used to detect when input_file_stack has changed since last described. */
1165 static int last_error_tick
;
1167 /* Called when the start of a function definition is parsed,
1168 this function prints on stderr the name of the function. */
1171 announce_function (decl
)
1176 if (rtl_dump_and_exit
)
1177 fprintf (stderr
, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl
)));
1179 fprintf (stderr
, " %s", (*decl_printable_name
) (decl
, 2));
1181 need_error_newline
= 1;
1182 last_error_function
= current_function_decl
;
1186 /* The default function to print out name of current function that caused
1190 default_print_error_function (file
)
1193 if (last_error_function
!= current_function_decl
)
1195 char *kind
= "function";
1196 if (current_function_decl
!= 0
1197 && TREE_CODE (TREE_TYPE (current_function_decl
)) == METHOD_TYPE
)
1201 fprintf (stderr
, "%s: ", file
);
1203 if (current_function_decl
== NULL
)
1204 fprintf (stderr
, "At top level:\n");
1207 char *name
= (*decl_printable_name
) (current_function_decl
, 2);
1208 fprintf (stderr
, "In %s `%s':\n", kind
, name
);
1211 last_error_function
= current_function_decl
;
1215 /* Called by report_error_function to print out function name.
1216 * Default may be overridden by language front-ends. */
1218 void (*print_error_function
) PROTO((char *)) = default_print_error_function
;
1220 /* Prints out, if necessary, the name of the current function
1221 that caused an error. Called from all error and warning functions. */
1224 report_error_function (file
)
1227 struct file_stack
*p
;
1229 if (need_error_newline
)
1231 fprintf (stderr
, "\n");
1232 need_error_newline
= 0;
1235 (*print_error_function
) (file
);
1237 if (input_file_stack
&& input_file_stack
->next
!= 0
1238 && input_file_stack_tick
!= last_error_tick
1239 && file
== input_filename
)
1241 fprintf (stderr
, "In file included");
1242 for (p
= input_file_stack
->next
; p
; p
= p
->next
)
1244 fprintf (stderr
, " from %s:%d", p
->name
, p
->line
);
1246 fprintf (stderr
, ",\n ");
1248 fprintf (stderr
, ":\n");
1249 last_error_tick
= input_file_stack_tick
;
1253 /* Print a message. */
1256 vmessage (prefix
, s
, ap
)
1262 fprintf (stderr
, "%s: ", prefix
);
1265 vfprintf (stderr
, s
, ap
);
1268 HOST_WIDE_INT v1
= va_arg(ap
, HOST_WIDE_INT
);
1269 HOST_WIDE_INT v2
= va_arg(ap
, HOST_WIDE_INT
);
1270 HOST_WIDE_INT v3
= va_arg(ap
, HOST_WIDE_INT
);
1271 HOST_WIDE_INT v4
= va_arg(ap
, HOST_WIDE_INT
);
1272 fprintf (stderr
, s
, v1
, v2
, v3
, v4
);
1277 /* Print a message relevant to line LINE of file FILE. */
1280 v_message_with_file_and_line (file
, line
, prefix
, s
, ap
)
1288 fprintf (stderr
, "%s:%d: ", file
, line
);
1290 fprintf (stderr
, "%s: ", progname
);
1292 vmessage (prefix
, s
, ap
);
1293 fputc ('\n', stderr
);
1296 /* Print a message relevant to the given DECL. */
1299 v_message_with_decl (decl
, prefix
, s
, ap
)
1307 fprintf (stderr
, "%s:%d: ",
1308 DECL_SOURCE_FILE (decl
), DECL_SOURCE_LINE (decl
));
1311 fprintf (stderr
, "%s: ", prefix
);
1313 /* Do magic to get around lack of varargs support for insertion
1314 of arguments into existing list. We know that the decl is first;
1315 we ass_u_me that it will be printed with "%s". */
1317 for (p
= s
; *p
; ++p
)
1321 if (*(p
+ 1) == '%')
1328 if (p
> s
) /* Print the left-hand substring. */
1330 char fmt
[sizeof "%.255s"];
1333 if (width
> 255L) width
= 255L; /* arbitrary */
1334 sprintf (fmt
, "%%.%lds", width
);
1335 fprintf (stderr
, fmt
, s
);
1338 if (*p
== '%') /* Print the name. */
1340 char *n
= (DECL_NAME (decl
)
1341 ? (*decl_printable_name
) (decl
, 2)
1347 if (isalpha (*(p
- 1) & 0xFF))
1352 if (*p
) /* Print the rest of the message. */
1353 vmessage ((char *)NULL
, p
, ap
);
1355 fputc ('\n', stderr
);
1358 /* Figure file and line of the given INSN. */
1361 file_and_line_for_asm (insn
, pfile
, pline
)
1366 rtx body
= PATTERN (insn
);
1369 /* Find the (or one of the) ASM_OPERANDS in the insn. */
1370 if (GET_CODE (body
) == SET
&& GET_CODE (SET_SRC (body
)) == ASM_OPERANDS
)
1371 asmop
= SET_SRC (body
);
1372 else if (GET_CODE (body
) == ASM_OPERANDS
)
1374 else if (GET_CODE (body
) == PARALLEL
1375 && GET_CODE (XVECEXP (body
, 0, 0)) == SET
)
1376 asmop
= SET_SRC (XVECEXP (body
, 0, 0));
1377 else if (GET_CODE (body
) == PARALLEL
1378 && GET_CODE (XVECEXP (body
, 0, 0)) == ASM_OPERANDS
)
1379 asmop
= XVECEXP (body
, 0, 0);
1385 *pfile
= ASM_OPERANDS_SOURCE_FILE (asmop
);
1386 *pline
= ASM_OPERANDS_SOURCE_LINE (asmop
);
1390 *pfile
= input_filename
;
1395 /* Report an error at line LINE of file FILE. */
1398 v_error_with_file_and_line (file
, line
, s
, ap
)
1405 report_error_function (file
);
1406 v_message_with_file_and_line (file
, line
, (char *)NULL
, s
, ap
);
1410 error_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1422 file
= va_arg (ap
, char *);
1423 line
= va_arg (ap
, int);
1424 s
= va_arg (ap
, char *);
1427 v_error_with_file_and_line (file
, line
, s
, ap
);
1431 /* Report an error at the declaration DECL.
1432 S is a format string which uses %s to substitute the declaration
1433 name; subsequent substitutions are a la printf. */
1436 v_error_with_decl (decl
, s
, ap
)
1442 report_error_function (DECL_SOURCE_FILE (decl
));
1443 v_message_with_decl (decl
, (char *)NULL
, s
, ap
);
1447 error_with_decl
VPROTO((tree decl
, char *s
, ...))
1458 decl
= va_arg (ap
, tree
);
1459 s
= va_arg (ap
, char *);
1462 v_error_with_decl (decl
, s
, ap
);
1466 /* Report an error at the line number of the insn INSN.
1467 This is used only when INSN is an `asm' with operands,
1468 and each ASM_OPERANDS records its own source file and line. */
1471 v_error_for_asm (insn
, s
, ap
)
1480 file_and_line_for_asm (insn
, &file
, &line
);
1481 report_error_function (file
);
1482 v_message_with_file_and_line (file
, line
, (char *)NULL
, s
, ap
);
1486 error_for_asm
VPROTO((rtx insn
, char *s
, ...))
1497 insn
= va_arg (ap
, rtx
);
1498 s
= va_arg (ap
, char *);
1501 v_error_for_asm (insn
, s
, ap
);
1505 /* Report an error at the current line number. */
1512 v_error_with_file_and_line (input_filename
, lineno
, s
, ap
);
1516 error
VPROTO((char *s
, ...))
1526 s
= va_arg (ap
, char *);
1533 /* Report a fatal error at the current line number. */
1541 exit (FATAL_EXIT_CODE
);
1545 fatal
VPROTO((char *s
, ...))
1555 s
= va_arg (ap
, char *);
1562 /* Report a warning at line LINE of file FILE. */
1565 v_warning_with_file_and_line (file
, line
, s
, ap
)
1571 if (count_error (1))
1573 report_error_function (file
);
1574 v_message_with_file_and_line (file
, line
, "warning", s
, ap
);
1579 warning_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1591 file
= va_arg (ap
, char *);
1592 line
= va_arg (ap
, int);
1593 s
= va_arg (ap
, char *);
1596 v_warning_with_file_and_line (file
, line
, s
, ap
);
1600 /* Report a warning at the declaration DECL.
1601 S is a format string which uses %s to substitute the declaration
1602 name; subsequent substitutions are a la printf. */
1605 v_warning_with_decl (decl
, s
, ap
)
1610 if (count_error (1))
1612 report_error_function (DECL_SOURCE_FILE (decl
));
1613 v_message_with_decl (decl
, "warning", s
, ap
);
1618 warning_with_decl
VPROTO((tree decl
, char *s
, ...))
1629 decl
= va_arg (ap
, tree
);
1630 s
= va_arg (ap
, char *);
1633 v_warning_with_decl (decl
, s
, ap
);
1637 /* Report a warning at the line number of the insn INSN.
1638 This is used only when INSN is an `asm' with operands,
1639 and each ASM_OPERANDS records its own source file and line. */
1642 v_warning_for_asm (insn
, s
, ap
)
1647 if (count_error (1))
1652 file_and_line_for_asm (insn
, &file
, &line
);
1653 report_error_function (file
);
1654 v_message_with_file_and_line (file
, line
, "warning", s
, ap
);
1659 warning_for_asm
VPROTO((rtx insn
, char *s
, ...))
1670 insn
= va_arg (ap
, rtx
);
1671 s
= va_arg (ap
, char *);
1674 v_warning_for_asm (insn
, s
, ap
);
1678 /* Report a warning at the current line number. */
1685 v_warning_with_file_and_line (input_filename
, lineno
, s
, ap
);
1689 warning
VPROTO((char *s
, ...))
1699 s
= va_arg (ap
, char *);
1706 /* These functions issue either warnings or errors depending on
1707 -pedantic-errors. */
1714 if (flag_pedantic_errors
)
1721 pedwarn
VPROTO((char *s
, ...))
1731 s
= va_arg (ap
, char *);
1739 v_pedwarn_with_decl (decl
, s
, ap
)
1744 /* We don't want -pedantic-errors to cause the compilation to fail from
1745 "errors" in system header files. Sometimes fixincludes can't fix what's
1746 broken (eg: unsigned char bitfields - fixing it may change the alignment
1747 which will cause programs to mysteriously fail because the C library
1748 or kernel uses the original layout). There's no point in issuing a
1749 warning either, it's just unnecessary noise. */
1751 if (! DECL_IN_SYSTEM_HEADER (decl
))
1753 if (flag_pedantic_errors
)
1754 v_error_with_decl (decl
, s
, ap
);
1756 v_warning_with_decl (decl
, s
, ap
);
1761 pedwarn_with_decl
VPROTO((tree decl
, char *s
, ...))
1772 decl
= va_arg (ap
, tree
);
1773 s
= va_arg (ap
, char *);
1776 v_pedwarn_with_decl (decl
, s
, ap
);
1781 v_pedwarn_with_file_and_line (file
, line
, s
, ap
)
1787 if (flag_pedantic_errors
)
1788 v_error_with_file_and_line (file
, line
, s
, ap
);
1790 v_warning_with_file_and_line (file
, line
, s
, ap
);
1794 pedwarn_with_file_and_line
VPROTO((char *file
, int line
, char *s
, ...))
1806 file
= va_arg (ap
, char *);
1807 line
= va_arg (ap
, int);
1808 s
= va_arg (ap
, char *);
1811 v_pedwarn_with_file_and_line (file
, line
, s
, ap
);
1815 /* Apologize for not implementing some feature. */
1824 fprintf (stderr
, "%s:%d: ", input_filename
, lineno
);
1826 fprintf (stderr
, "%s: ", progname
);
1827 vmessage ("sorry, not implemented", s
, ap
);
1828 fputc ('\n', stderr
);
1832 sorry
VPROTO((char *s
, ...))
1842 s
= va_arg (ap
, char *);
1849 /* Apologize for not implementing some feature, then quit. */
1852 v_really_sorry (s
, ap
)
1858 fprintf (stderr
, "%s:%d: ", input_filename
, lineno
);
1860 fprintf (stderr
, "%s: ", progname
);
1861 vmessage ("sorry, not implemented", s
, ap
);
1862 fatal (" (fatal)\n");
1866 really_sorry
VPROTO((char *s
, ...))
1876 s
= va_arg (ap
, char *);
1879 v_really_sorry (s
, ap
);
1883 /* More 'friendly' abort that prints the line and file.
1884 config.h can #define abort fancy_abort if you like that sort of thing.
1886 I don't think this is actually a good idea.
1887 Other sorts of crashes will look a certain way.
1888 It is a good thing if crashes from calling abort look the same way.
1894 fatal ("internal gcc abort");
1897 /* This calls abort and is used to avoid problems when abort if a macro.
1898 It is used when we need to pass the address of abort. */
1906 /* When `malloc.c' is compiled with `rcheck' defined,
1907 it calls this function to report clobberage. */
1915 /* Same as `malloc' but report error if no memory available. */
1921 register char *value
= (char *) malloc (size
);
1922 if (value
== 0 && size
!= 0)
1923 fatal ("virtual memory exhausted");
1927 /* Same as `realloc' but report error if no memory available. */
1930 xrealloc (ptr
, size
)
1934 char *result
= (char *) realloc (ptr
, size
);
1936 fatal ("virtual memory exhausted");
1940 /* Same as `strdup' but report error if no memory available. */
1946 register char *result
= (char *) malloc (strlen (s
) + 1);
1949 fatal ("virtual memory exhausted");
1954 /* Return the logarithm of X, base 2, considering X unsigned,
1955 if X is a power of 2. Otherwise, returns -1.
1957 This should be used via the `exact_log2' macro. */
1961 register unsigned HOST_WIDE_INT x
;
1963 register int log
= 0;
1964 /* Test for 0 or a power of 2. */
1965 if (x
== 0 || x
!= (x
& -x
))
1967 while ((x
>>= 1) != 0)
1972 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1973 If X is 0, return -1.
1975 This should be used via the floor_log2 macro. */
1979 register unsigned HOST_WIDE_INT x
;
1981 register int log
= -1;
1988 static int float_handler_set
;
1990 jmp_buf float_handler
;
1992 /* Signals actually come here. */
1995 float_signal (signo
)
1996 /* If this is missing, some compilers complain. */
1999 if (float_handled
== 0)
2001 #if defined (USG) || defined (hpux)
2002 signal (SIGFPE
, float_signal
); /* re-enable the signal catcher */
2005 signal (SIGFPE
, float_signal
);
2006 longjmp (float_handler
, 1);
2009 /* Specify where to longjmp to when a floating arithmetic error happens.
2010 If HANDLER is 0, it means don't handle the errors any more. */
2013 set_float_handler (handler
)
2016 float_handled
= (handler
!= 0);
2018 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2020 if (float_handled
&& ! float_handler_set
)
2022 signal (SIGFPE
, float_signal
);
2023 float_handler_set
= 1;
2027 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
2028 error happens, pushing the previous specification into OLD_HANDLER.
2029 Return an indication of whether there was a previous handler in effect. */
2032 push_float_handler (handler
, old_handler
)
2033 jmp_buf handler
, old_handler
;
2035 int was_handled
= float_handled
;
2039 bcopy ((char *) float_handler
, (char *) old_handler
,
2040 sizeof (float_handler
));
2042 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2046 /* Restore the previous specification of whether and where to longjmp to
2047 when a floating arithmetic error happens. */
2050 pop_float_handler (handled
, handler
)
2054 float_handled
= handled
;
2056 bcopy ((char *) handler
, (char *) float_handler
, sizeof (float_handler
));
2059 /* Handler for SIGPIPE. */
2063 /* If this is missing, some compilers complain. */
2066 fatal ("output pipe has been closed");
2069 /* Strip off a legitimate source ending from the input string NAME of
2070 length LEN. Rather than having to know the names used by all of
2071 our front ends, we strip off an ending of a period followed by one,
2072 two, or three characters. */
2075 strip_off_ending (name
, len
)
2079 if (len
> 2 && name
[len
- 2] == '.')
2080 name
[len
- 2] = '\0';
2081 else if (len
> 3 && name
[len
- 3] == '.')
2082 name
[len
- 3] = '\0';
2083 else if (len
> 4 && name
[len
- 4] == '.')
2084 name
[len
- 4] = '\0';
2087 /* Output a quoted string. */
2090 output_quoted_string (asm_file
, string
)
2096 putc ('\"', asm_file
);
2097 while ((c
= *string
++) != 0)
2099 if (c
== '\"' || c
== '\\')
2100 putc ('\\', asm_file
);
2103 putc ('\"', asm_file
);
2106 /* Output a file name in the form wanted by System V. */
2109 output_file_directive (asm_file
, input_name
)
2113 int len
= strlen (input_name
);
2114 char *na
= input_name
+ len
;
2116 /* NA gets INPUT_NAME sans directory names. */
2117 while (na
> input_name
)
2124 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
2125 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file
, na
);
2127 #ifdef ASM_OUTPUT_SOURCE_FILENAME
2128 ASM_OUTPUT_SOURCE_FILENAME (asm_file
, na
);
2130 fprintf (asm_file
, "\t.file\t");
2131 output_quoted_string (asm_file
, na
);
2132 fputc ('\n', asm_file
);
2137 /* Routine to build language identifier for object file. */
2140 output_lang_identify (asm_out_file
)
2143 int len
= strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
2144 char *s
= (char *) alloca (len
);
2145 sprintf (s
, "__gnu_compiled_%s", lang_identify ());
2146 ASM_OUTPUT_LABEL (asm_out_file
, s
);
2149 /* Routine to open a dump file. */
2152 open_dump_file (base_name
, suffix
)
2157 char *dumpname
= (char *) alloca (strlen (base_name
) + strlen (suffix
) + 1);
2159 strcpy (dumpname
, base_name
);
2160 strcat (dumpname
, suffix
);
2161 f
= fopen (dumpname
, "w");
2163 pfatal_with_name (dumpname
);
2167 /* Compile an entire file of output from cpp, named NAME.
2168 Write a file of assembly output and various debugging dumps. */
2177 int name_specified
= name
!= 0;
2179 if (dump_base_name
== 0)
2180 dump_base_name
= name
? name
: "gccdump";
2184 integration_time
= 0;
2189 branch_prob_time
= 0;
2194 local_alloc_time
= 0;
2195 global_alloc_time
= 0;
2198 shorten_branch_time
= 0;
2205 /* Open input file. */
2207 if (name
== 0 || !strcmp (name
, "-"))
2213 finput
= fopen (name
, "r");
2215 pfatal_with_name (name
);
2217 #ifdef IO_BUFFER_SIZE
2218 setvbuf (finput
, (char *) xmalloc (IO_BUFFER_SIZE
), _IOFBF
, IO_BUFFER_SIZE
);
2220 #endif /* !USE_CPPLIB */
2222 /* Initialize data in various passes. */
2231 /* Some of these really don't need to be called when generating bytecode,
2232 but the options would have to be parsed first to know that. -bson */
2234 init_emit_once (debug_info_level
== DINFO_LEVEL_NORMAL
2235 || debug_info_level
== DINFO_LEVEL_VERBOSE
2236 || flag_test_coverage
);
2238 init_decl_processing ();
2246 if (flag_caller_saves
)
2247 init_caller_save ();
2249 /* If auxiliary info generation is desired, open the output file.
2250 This goes in the same directory as the source file--unlike
2251 all the other output files. */
2252 if (flag_gen_aux_info
)
2254 aux_info_file
= fopen (aux_info_file_name
, "w");
2255 if (aux_info_file
== 0)
2256 pfatal_with_name (aux_info_file_name
);
2259 /* If rtl dump desired, open the output file. */
2261 rtl_dump_file
= open_dump_file (dump_base_name
, ".rtl");
2263 /* If jump_opt dump desired, open the output file. */
2265 jump_opt_dump_file
= open_dump_file (dump_base_name
, ".jump");
2267 /* If cse dump desired, open the output file. */
2269 cse_dump_file
= open_dump_file (dump_base_name
, ".cse");
2271 /* If loop dump desired, open the output file. */
2273 loop_dump_file
= open_dump_file (dump_base_name
, ".loop");
2275 /* If cse2 dump desired, open the output file. */
2277 cse2_dump_file
= open_dump_file (dump_base_name
, ".cse2");
2279 /* If branch_prob dump desired, open the output file. */
2280 if (branch_prob_dump
)
2281 branch_prob_dump_file
= open_dump_file (dump_base_name
, ".bp");
2283 /* If flow dump desired, open the output file. */
2285 flow_dump_file
= open_dump_file (dump_base_name
, ".flow");
2287 /* If combine dump desired, open the output file. */
2289 combine_dump_file
= open_dump_file (dump_base_name
, ".combine");
2291 /* If regmove dump desired, open the output file. */
2293 regmove_dump_file
= open_dump_file (dump_base_name
, ".regmove");
2295 /* If scheduling dump desired, open the output file. */
2297 sched_dump_file
= open_dump_file (dump_base_name
, ".sched");
2299 /* If local_reg dump desired, open the output file. */
2301 local_reg_dump_file
= open_dump_file (dump_base_name
, ".lreg");
2303 /* If global_reg dump desired, open the output file. */
2304 if (global_reg_dump
)
2305 global_reg_dump_file
= open_dump_file (dump_base_name
, ".greg");
2307 /* If 2nd scheduling dump desired, open the output file. */
2309 sched2_dump_file
= open_dump_file (dump_base_name
, ".sched2");
2311 /* If jump2_opt dump desired, open the output file. */
2313 jump2_opt_dump_file
= open_dump_file (dump_base_name
, ".jump2");
2315 /* If dbr_sched dump desired, open the output file. */
2317 dbr_sched_dump_file
= open_dump_file (dump_base_name
, ".dbr");
2321 /* If stack_reg dump desired, open the output file. */
2323 stack_reg_dump_file
= open_dump_file (dump_base_name
, ".stack");
2327 /* Open assembler code output file. */
2329 if (! name_specified
&& asm_file_name
== 0)
2330 asm_out_file
= stdout
;
2333 int len
= strlen (dump_base_name
);
2334 register char *dumpname
= (char *) xmalloc (len
+ 6);
2335 strcpy (dumpname
, dump_base_name
);
2336 strip_off_ending (dumpname
, len
);
2337 strcat (dumpname
, ".s");
2338 if (asm_file_name
== 0)
2340 asm_file_name
= (char *) xmalloc (strlen (dumpname
) + 1);
2341 strcpy (asm_file_name
, dumpname
);
2343 if (!strcmp (asm_file_name
, "-"))
2344 asm_out_file
= stdout
;
2346 asm_out_file
= fopen (asm_file_name
, "w");
2347 if (asm_out_file
== 0)
2348 pfatal_with_name (asm_file_name
);
2351 #ifdef IO_BUFFER_SIZE
2352 setvbuf (asm_out_file
, (char *) xmalloc (IO_BUFFER_SIZE
),
2353 _IOFBF
, IO_BUFFER_SIZE
);
2356 input_filename
= name
;
2358 /* Put an entry on the input file stack for the main input file. */
2360 = (struct file_stack
*) xmalloc (sizeof (struct file_stack
));
2361 input_file_stack
->next
= 0;
2362 input_file_stack
->name
= input_filename
;
2364 /* Perform language-specific initialization.
2365 This may set main_input_filename. */
2368 /* If the input doesn't start with a #line, use the input name
2369 as the official input file name. */
2370 if (main_input_filename
== 0)
2371 main_input_filename
= name
;
2373 if (!output_bytecode
)
2375 ASM_FILE_START (asm_out_file
);
2377 #ifdef ASM_COMMENT_START
2378 if (flag_verbose_asm
)
2380 /* Print the list of options in effect. */
2381 print_version (asm_out_file
, ASM_COMMENT_START
);
2382 print_switch_values (asm_out_file
, 0, MAX_LINE
,
2383 ASM_COMMENT_START
, " ", "\n");
2384 /* Add a blank line here so it appears in assembler output but not
2386 fprintf (asm_out_file
, "\n");
2391 /* Output something to inform GDB that this compilation was by GCC. Also
2392 serves to tell GDB file consists of bytecodes. */
2393 if (output_bytecode
)
2394 fprintf (asm_out_file
, "bc_gcc2_compiled.:\n");
2397 #ifndef ASM_IDENTIFY_GCC
2398 fprintf (asm_out_file
, "gcc2_compiled.:\n");
2400 ASM_IDENTIFY_GCC (asm_out_file
);
2404 /* Output something to identify which front-end produced this file. */
2405 #ifdef ASM_IDENTIFY_LANGUAGE
2406 ASM_IDENTIFY_LANGUAGE (asm_out_file
);
2409 #ifndef ASM_OUTPUT_SECTION_NAME
2410 if (flag_function_sections
)
2412 warning ("-ffunction-sections not supported for this target.");
2413 flag_function_sections
= 0;
2417 if (flag_function_sections
2418 && (profile_flag
|| profile_block_flag
))
2420 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2421 flag_function_sections
= 0;
2424 if (flag_function_sections
&& write_symbols
!= NO_DEBUG
)
2425 warning ("-ffunction-sections may affect debugging on some targets.");
2427 if (output_bytecode
)
2429 if (profile_flag
|| profile_block_flag
)
2430 error ("profiling not supported in bytecode compilation");
2434 /* ??? Note: There used to be a conditional here
2435 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2436 This was to guarantee separation between gcc_compiled. and
2437 the first function, for the sake of dbx on Suns.
2438 However, having the extra zero here confused the Emacs
2439 code for unexec, and might confuse other programs too.
2440 Therefore, I took out that change.
2441 In future versions we should find another way to solve
2442 that dbx problem. -- rms, 23 May 93. */
2444 /* Don't let the first function fall at the same address
2445 as gcc_compiled., if profiling. */
2446 if (profile_flag
|| profile_block_flag
)
2447 assemble_zeros (UNITS_PER_WORD
);
2450 /* If dbx symbol table desired, initialize writing it
2451 and output the predefined types. */
2452 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2453 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2454 TIMEVAR (symout_time
, dbxout_init (asm_out_file
, main_input_filename
,
2457 #ifdef SDB_DEBUGGING_INFO
2458 if (write_symbols
== SDB_DEBUG
)
2459 TIMEVAR (symout_time
, sdbout_init (asm_out_file
, main_input_filename
,
2462 #ifdef DWARF_DEBUGGING_INFO
2463 if (write_symbols
== DWARF_DEBUG
)
2464 TIMEVAR (symout_time
, dwarfout_init (asm_out_file
, main_input_filename
));
2466 #ifdef DWARF2_UNWIND_INFO
2467 if (dwarf2out_do_frame ())
2468 dwarf2out_frame_init ();
2470 #ifdef DWARF2_DEBUGGING_INFO
2471 if (write_symbols
== DWARF2_DEBUG
)
2472 TIMEVAR (symout_time
, dwarf2out_init (asm_out_file
, main_input_filename
));
2475 /* Initialize yet another pass. */
2477 if (!output_bytecode
)
2478 init_final (main_input_filename
);
2479 init_branch_prob (dump_base_name
);
2481 start_time
= get_run_time ();
2483 /* Call the parser, which parses the entire file
2484 (calling rest_of_compilation for each function). */
2486 if (yyparse () != 0)
2488 if (errorcount
== 0)
2489 fprintf (stderr
, "Errors detected in input file (your bison.simple is out of date)");
2491 /* In case there were missing closebraces,
2492 get us back to the global binding level. */
2493 while (! global_bindings_p ())
2497 output_func_start_profiler ();
2499 /* Compilation is now finished except for writing
2500 what's left of the symbol table output. */
2502 parse_time
+= get_run_time () - start_time
;
2504 parse_time
-= integration_time
;
2505 parse_time
-= varconst_time
;
2507 globals
= getdecls ();
2509 /* Really define vars that have had only a tentative definition.
2510 Really output inline functions that must actually be callable
2511 and have not been output so far. */
2514 int len
= list_length (globals
);
2515 tree
*vec
= (tree
*) alloca (sizeof (tree
) * len
);
2520 /* Process the decls in reverse order--earliest first.
2521 Put them into VEC from back to front, then take out from front. */
2523 for (i
= 0, decl
= globals
; i
< len
; i
++, decl
= TREE_CHAIN (decl
))
2524 vec
[len
- i
- 1] = decl
;
2526 for (i
= 0; i
< len
; i
++)
2530 /* We're not deferring this any longer. */
2531 DECL_DEFER_OUTPUT (decl
) = 0;
2533 if (TREE_CODE (decl
) == VAR_DECL
&& DECL_SIZE (decl
) == 0
2534 && incomplete_decl_finalize_hook
!= 0)
2535 (*incomplete_decl_finalize_hook
) (decl
);
2538 /* Now emit any global variables or functions that we have been putting
2539 off. We need to loop in case one of the things emitted here
2540 references another one which comes earlier in the list. */
2544 for (i
= 0; i
< len
; i
++)
2548 if (TREE_ASM_WRITTEN (decl
) || DECL_EXTERNAL (decl
))
2551 /* Don't write out static consts, unless we still need them.
2553 We also keep static consts if not optimizing (for debugging),
2554 unless the user specified -fno-keep-static-consts.
2555 ??? They might be better written into the debug information.
2556 This is possible when using DWARF.
2558 A language processor that wants static constants to be always
2559 written out (even if it is not used) is responsible for
2560 calling rest_of_decl_compilation itself. E.g. the C front-end
2561 calls rest_of_decl_compilation from finish_decl.
2562 One motivation for this is that is conventional in some
2563 environments to write things like:
2564 static const char rcsid[] = "... version string ...";
2565 intending to force the string to be in the executable.
2567 A language processor that would prefer to have unneeded
2568 static constants "optimized away" would just defer writing
2569 them out until here. E.g. C++ does this, because static
2570 constants are often defined in header files.
2572 ??? A tempting alternative (for both C and C++) would be
2573 to force a constant to be written if and only if it is
2574 defined in a main file, as opposed to an include file. */
2576 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
2577 && (! TREE_READONLY (decl
)
2578 || TREE_PUBLIC (decl
)
2579 || (!optimize
&& flag_keep_static_consts
)
2580 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
2583 rest_of_decl_compilation (decl
, NULL_PTR
, 1, 1);
2586 if (TREE_CODE (decl
) == FUNCTION_DECL
2587 && DECL_INITIAL (decl
) != 0
2588 && DECL_SAVED_INSNS (decl
) != 0
2589 && (flag_keep_inline_functions
2590 || TREE_PUBLIC (decl
)
2591 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
))))
2594 temporary_allocation ();
2595 output_inline_function (decl
);
2596 permanent_allocation (1);
2601 /* Now that all possible functions have been output, we can dump
2602 the exception table. */
2604 output_exception_table ();
2606 for (i
= 0; i
< len
; i
++)
2610 if (TREE_CODE (decl
) == VAR_DECL
&& TREE_STATIC (decl
)
2611 && ! TREE_ASM_WRITTEN (decl
))
2612 /* Cancel the RTL for this decl so that, if debugging info
2613 output for global variables is still to come,
2614 this one will be omitted. */
2615 DECL_RTL (decl
) = NULL
;
2617 /* Warn about any function
2618 declared static but not defined.
2619 We don't warn about variables,
2620 because many programs have static variables
2621 that exist only to get some text into the object file. */
2622 if (TREE_CODE (decl
) == FUNCTION_DECL
2624 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
)))
2625 && DECL_INITIAL (decl
) == 0
2626 && DECL_EXTERNAL (decl
)
2627 && ! DECL_ARTIFICIAL (decl
)
2628 && ! TREE_PUBLIC (decl
))
2630 pedwarn_with_decl (decl
,
2631 "`%s' declared `static' but never defined");
2632 /* This symbol is effectively an "extern" declaration now. */
2633 TREE_PUBLIC (decl
) = 1;
2634 assemble_external (decl
);
2637 /* Warn about static fns or vars defined but not used,
2638 but not about inline functions or static consts
2639 since defining those in header files is normal practice. */
2641 && ((TREE_CODE (decl
) == FUNCTION_DECL
&& ! DECL_INLINE (decl
))
2642 || (TREE_CODE (decl
) == VAR_DECL
&& ! TREE_READONLY (decl
)))
2643 && ! DECL_IN_SYSTEM_HEADER (decl
)
2644 && ! DECL_EXTERNAL (decl
)
2645 && ! TREE_PUBLIC (decl
)
2646 && ! TREE_USED (decl
)
2647 && (TREE_CODE (decl
) == FUNCTION_DECL
|| ! DECL_REGISTER (decl
))
2648 /* The TREE_USED bit for file-scope decls
2649 is kept in the identifier, to handle multiple
2650 external decls in different scopes. */
2651 && ! TREE_USED (DECL_NAME (decl
)))
2652 warning_with_decl (decl
, "`%s' defined but not used");
2654 #ifdef SDB_DEBUGGING_INFO
2655 /* The COFF linker can move initialized global vars to the end.
2656 And that can screw up the symbol ordering.
2657 By putting the symbols in that order to begin with,
2658 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
2659 if (write_symbols
== SDB_DEBUG
&& TREE_CODE (decl
) == VAR_DECL
2660 && TREE_PUBLIC (decl
) && DECL_INITIAL (decl
)
2661 && ! DECL_EXTERNAL (decl
)
2662 && DECL_RTL (decl
) != 0)
2663 TIMEVAR (symout_time
, sdbout_symbol (decl
, 0));
2665 /* Output COFF information for non-global
2666 file-scope initialized variables. */
2667 if (write_symbols
== SDB_DEBUG
2668 && TREE_CODE (decl
) == VAR_DECL
2669 && DECL_INITIAL (decl
)
2670 && ! DECL_EXTERNAL (decl
)
2671 && DECL_RTL (decl
) != 0
2672 && GET_CODE (DECL_RTL (decl
)) == MEM
)
2673 TIMEVAR (symout_time
, sdbout_toplevel_data (decl
));
2674 #endif /* SDB_DEBUGGING_INFO */
2675 #ifdef DWARF_DEBUGGING_INFO
2676 /* Output DWARF information for file-scope tentative data object
2677 declarations, file-scope (extern) function declarations (which
2678 had no corresponding body) and file-scope tagged type declarations
2679 and definitions which have not yet been forced out. */
2681 if (write_symbols
== DWARF_DEBUG
2682 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
2683 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 1));
2685 #ifdef DWARF2_DEBUGGING_INFO
2686 /* Output DWARF2 information for file-scope tentative data object
2687 declarations, file-scope (extern) function declarations (which
2688 had no corresponding body) and file-scope tagged type declarations
2689 and definitions which have not yet been forced out. */
2691 if (write_symbols
== DWARF2_DEBUG
2692 && (TREE_CODE (decl
) != FUNCTION_DECL
|| !DECL_INITIAL (decl
)))
2693 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
2698 /* Write out any pending weak symbol declarations. */
2702 /* Do dbx symbols */
2703 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2704 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2705 TIMEVAR (symout_time
,
2707 dbxout_finish (asm_out_file
, main_input_filename
);
2711 #ifdef DWARF_DEBUGGING_INFO
2712 if (write_symbols
== DWARF_DEBUG
)
2713 TIMEVAR (symout_time
,
2719 #ifdef DWARF2_UNWIND_INFO
2720 if (dwarf2out_do_frame ())
2721 dwarf2out_frame_finish ();
2724 #ifdef DWARF2_DEBUGGING_INFO
2725 if (write_symbols
== DWARF2_DEBUG
)
2726 TIMEVAR (symout_time
,
2728 dwarf2out_finish ();
2732 /* Output some stuff at end of file if nec. */
2734 if (!output_bytecode
)
2736 end_final (dump_base_name
);
2737 end_branch_prob (branch_prob_dump_file
);
2740 ASM_FILE_END (asm_out_file
);
2744 /* Language-specific end of compilation actions. */
2748 if (output_bytecode
)
2749 bc_write_file (asm_out_file
);
2751 /* Close the dump files. */
2753 if (flag_gen_aux_info
)
2755 fclose (aux_info_file
);
2757 unlink (aux_info_file_name
);
2761 fclose (rtl_dump_file
);
2764 fclose (jump_opt_dump_file
);
2767 fclose (cse_dump_file
);
2770 fclose (loop_dump_file
);
2773 fclose (cse2_dump_file
);
2775 if (branch_prob_dump
)
2776 fclose (branch_prob_dump_file
);
2779 fclose (flow_dump_file
);
2783 dump_combine_total_stats (combine_dump_file
);
2784 fclose (combine_dump_file
);
2788 fclose (regmove_dump_file
);
2791 fclose (sched_dump_file
);
2794 fclose (local_reg_dump_file
);
2796 if (global_reg_dump
)
2797 fclose (global_reg_dump_file
);
2800 fclose (sched2_dump_file
);
2803 fclose (jump2_opt_dump_file
);
2806 fclose (dbr_sched_dump_file
);
2810 fclose (stack_reg_dump_file
);
2813 /* Close non-debugging input and output files. Take special care to note
2814 whether fclose returns an error, since the pages might still be on the
2815 buffer chain while the file is open. */
2822 if (ferror (asm_out_file
) != 0 || fclose (asm_out_file
) != 0)
2823 fatal_io_error (asm_file_name
);
2825 /* Print the times. */
2829 fprintf (stderr
,"\n");
2830 print_time ("parse", parse_time
);
2832 if (!output_bytecode
)
2834 print_time ("integration", integration_time
);
2835 print_time ("jump", jump_time
);
2836 print_time ("cse", cse_time
);
2837 print_time ("loop", loop_time
);
2838 print_time ("cse2", cse2_time
);
2839 print_time ("branch-prob", branch_prob_time
);
2840 print_time ("flow", flow_time
);
2841 print_time ("combine", combine_time
);
2842 print_time ("regmove", regmove_time
);
2843 print_time ("sched", sched_time
);
2844 print_time ("local-alloc", local_alloc_time
);
2845 print_time ("global-alloc", global_alloc_time
);
2846 print_time ("sched2", sched2_time
);
2847 print_time ("dbranch", dbr_sched_time
);
2848 print_time ("shorten-branch", shorten_branch_time
);
2849 print_time ("stack-reg", stack_reg_time
);
2850 print_time ("final", final_time
);
2851 print_time ("varconst", varconst_time
);
2852 print_time ("symout", symout_time
);
2853 print_time ("dump", dump_time
);
2858 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2859 and TYPE_DECL nodes.
2861 This does nothing for local (non-static) variables.
2862 Otherwise, it sets up the RTL and outputs any assembler code
2863 (label definition, storage allocation and initialization).
2865 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2866 the assembler symbol name to be used. TOP_LEVEL is nonzero
2867 if this declaration is not within a function. */
2870 rest_of_decl_compilation (decl
, asmspec
, top_level
, at_end
)
2876 /* Declarations of variables, and of functions defined elsewhere. */
2878 /* The most obvious approach, to put an #ifndef around where
2879 this macro is used, doesn't work since it's inside a macro call. */
2880 #ifndef ASM_FINISH_DECLARE_OBJECT
2881 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2884 /* Forward declarations for nested functions are not "external",
2885 but we need to treat them as if they were. */
2886 if (TREE_STATIC (decl
) || DECL_EXTERNAL (decl
)
2887 || TREE_CODE (decl
) == FUNCTION_DECL
)
2888 TIMEVAR (varconst_time
,
2890 make_decl_rtl (decl
, asmspec
, top_level
);
2891 /* Initialized extern variable exists to be replaced
2892 with its value, or represents something that will be
2893 output in another file. */
2894 if (! (TREE_CODE (decl
) == VAR_DECL
2895 && DECL_EXTERNAL (decl
) && TREE_READONLY (decl
)
2896 && DECL_INITIAL (decl
) != 0
2897 && DECL_INITIAL (decl
) != error_mark_node
))
2898 /* Don't output anything
2899 when a tentative file-scope definition is seen.
2900 But at end of compilation, do output code for them. */
2901 if (! (! at_end
&& top_level
2902 && (DECL_INITIAL (decl
) == 0
2903 || DECL_INITIAL (decl
) == error_mark_node
)))
2904 assemble_variable (decl
, top_level
, at_end
, 0);
2905 if (!output_bytecode
2906 && decl
== last_assemble_variable_decl
)
2908 ASM_FINISH_DECLARE_OBJECT (asm_out_file
, decl
,
2912 else if (DECL_REGISTER (decl
) && asmspec
!= 0)
2914 if (decode_reg_name (asmspec
) >= 0)
2916 DECL_RTL (decl
) = 0;
2917 make_decl_rtl (decl
, asmspec
, top_level
);
2920 error ("invalid register name `%s' for register variable", asmspec
);
2922 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2923 else if ((write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2924 && TREE_CODE (decl
) == TYPE_DECL
)
2925 TIMEVAR (symout_time
, dbxout_symbol (decl
, 0));
2927 #ifdef SDB_DEBUGGING_INFO
2928 else if (write_symbols
== SDB_DEBUG
&& top_level
2929 && TREE_CODE (decl
) == TYPE_DECL
)
2930 TIMEVAR (symout_time
, sdbout_symbol (decl
, 0));
2934 /* Called after finishing a record, union or enumeral type. */
2937 rest_of_type_compilation (type
, toplev
)
2941 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2942 if (write_symbols
== DBX_DEBUG
|| write_symbols
== XCOFF_DEBUG
)
2943 TIMEVAR (symout_time
, dbxout_symbol (TYPE_STUB_DECL (type
), !toplev
));
2945 #ifdef SDB_DEBUGGING_INFO
2946 if (write_symbols
== SDB_DEBUG
)
2947 TIMEVAR (symout_time
, sdbout_symbol (TYPE_STUB_DECL (type
), !toplev
));
2951 /* This is called from finish_function (within yyparse)
2952 after each top-level definition is parsed.
2953 It is supposed to compile that function or variable
2954 and output the assembler code for it.
2955 After we return, the tree storage is freed. */
2958 rest_of_compilation (decl
)
2962 int start_time
= get_run_time ();
2964 /* Nonzero if we have saved the original DECL_INITIAL of the function,
2965 to be restored after we finish compiling the function
2966 (for use when compiling inline calls to this function). */
2967 tree saved_block_tree
= 0;
2968 /* Likewise, for DECL_ARGUMENTS. */
2969 tree saved_arguments
= 0;
2972 if (output_bytecode
)
2975 /* If we are reconsidering an inline function
2976 at the end of compilation, skip the stuff for making it inline. */
2978 if (DECL_SAVED_INSNS (decl
) == 0)
2983 /* If requested, consider whether to make this function inline. */
2984 if (DECL_INLINE (decl
) || flag_inline_functions
)
2985 TIMEVAR (integration_time
,
2987 lose
= function_cannot_inline_p (decl
);
2988 if (lose
|| ! optimize
)
2990 if (warn_inline
&& DECL_INLINE (decl
))
2991 warning_with_decl (decl
, lose
);
2992 DECL_ABSTRACT_ORIGIN (decl
) = 0;
2993 /* Don't really compile an extern inline function.
2994 If we can't make it inline, pretend
2995 it was only declared. */
2996 if (DECL_EXTERNAL (decl
))
2998 DECL_INITIAL (decl
) = 0;
2999 goto exit_rest_of_compilation
;
3003 /* ??? Note that this has the effect of making it look
3004 like "inline" was specified for a function if we choose
3005 to inline it. This isn't quite right, but it's
3006 probably not worth the trouble to fix. */
3007 inlineable
= DECL_INLINE (decl
) = 1;
3010 insns
= get_insns ();
3012 /* Dump the rtl code if we are dumping rtl. */
3017 fprintf (rtl_dump_file
, "\n;; Function %s\n\n",
3018 (*decl_printable_name
) (decl
, 2));
3019 if (DECL_SAVED_INSNS (decl
))
3020 fprintf (rtl_dump_file
, ";; (integrable)\n\n");
3021 print_rtl (rtl_dump_file
, insns
);
3022 fflush (rtl_dump_file
);
3025 /* If we can, defer compiling inlines until EOF.
3026 save_for_inline_copying can be extremely expensive. */
3027 if (inlineable
&& ! decl_function_context (decl
))
3028 DECL_DEFER_OUTPUT (decl
) = 1;
3030 /* If function is inline, and we don't yet know whether to
3031 compile it by itself, defer decision till end of compilation.
3032 finish_compilation will call rest_of_compilation again
3033 for those functions that need to be output. Also defer those
3034 functions that we are supposed to defer. We cannot defer
3035 functions containing nested functions since the nested function
3036 data is in our non-saved obstack. */
3038 if (! current_function_contains_functions
3039 && (DECL_DEFER_OUTPUT (decl
)
3040 || (DECL_INLINE (decl
)
3041 && ((! TREE_PUBLIC (decl
) && ! TREE_ADDRESSABLE (decl
)
3042 && ! flag_keep_inline_functions
)
3043 || DECL_EXTERNAL (decl
)))))
3045 DECL_DEFER_OUTPUT (decl
) = 1;
3047 /* If -Wreturn-type, we have to do a bit of compilation. */
3048 if (! warn_return_type
)
3050 #ifdef DWARF_DEBUGGING_INFO
3051 /* Generate the DWARF info for the "abstract" instance
3052 of a function which we may later generate inlined and/or
3053 out-of-line instances of. */
3054 if (write_symbols
== DWARF_DEBUG
)
3056 set_decl_abstract_flags (decl
, 1);
3057 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3058 set_decl_abstract_flags (decl
, 0);
3061 #ifdef DWARF2_DEBUGGING_INFO
3062 /* Generate the DWARF2 info for the "abstract" instance
3063 of a function which we may later generate inlined and/or
3064 out-of-line instances of. */
3065 if (write_symbols
== DWARF2_DEBUG
)
3067 set_decl_abstract_flags (decl
, 1);
3068 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3069 set_decl_abstract_flags (decl
, 0);
3072 TIMEVAR (integration_time
, save_for_inline_nocopy (decl
));
3073 RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl
)) = inlineable
;
3074 goto exit_rest_of_compilation
;
3078 /* If we have to compile the function now, save its rtl and subdecls
3079 so that its compilation will not affect what others get. */
3080 if (inlineable
|| DECL_DEFER_OUTPUT (decl
))
3082 #ifdef DWARF_DEBUGGING_INFO
3083 /* Generate the DWARF info for the "abstract" instance of
3084 a function which we will generate an out-of-line instance
3085 of almost immediately (and which we may also later generate
3086 various inlined instances of). */
3087 if (write_symbols
== DWARF_DEBUG
)
3089 set_decl_abstract_flags (decl
, 1);
3090 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3091 set_decl_abstract_flags (decl
, 0);
3094 #ifdef DWARF2_DEBUGGING_INFO
3095 /* Generate the DWARF2 info for the "abstract" instance of
3096 a function which we will generate an out-of-line instance
3097 of almost immediately (and which we may also later generate
3098 various inlined instances of). */
3099 if (write_symbols
== DWARF2_DEBUG
)
3101 set_decl_abstract_flags (decl
, 1);
3102 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3103 set_decl_abstract_flags (decl
, 0);
3106 saved_block_tree
= DECL_INITIAL (decl
);
3107 saved_arguments
= DECL_ARGUMENTS (decl
);
3108 TIMEVAR (integration_time
, save_for_inline_copying (decl
));
3109 RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl
)) = inlineable
;
3112 /* If specified extern inline but we aren't inlining it, we are
3114 if (DECL_INLINE (decl
) && DECL_EXTERNAL (decl
))
3115 goto exit_rest_of_compilation
;
3118 if (! DECL_DEFER_OUTPUT (decl
))
3119 TREE_ASM_WRITTEN (decl
) = 1;
3121 /* Now that integrate will no longer see our rtl, we need not distinguish
3122 between the return value of this function and the return value of called
3124 rtx_equal_function_value_matters
= 0;
3126 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
3127 if ((rtl_dump_and_exit
|| flag_syntax_only
) && !warn_return_type
)
3129 goto exit_rest_of_compilation
;
3132 /* Add an unwinder for exception handling, if needed.
3133 This must be done before we finalize PIC code. */
3137 /* If we are doing position-independent code generation, now
3138 is the time to output special prologues and epilogues.
3139 We do not want to do this earlier, because it just clutters
3140 up inline functions with meaningless insns. */
3145 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
3146 Note that that may have been done above, in save_for_inline_copying.
3147 The call to resume_temporary_allocation near the end of this function
3148 goes back to the usual state of affairs. This must be done after
3149 we've built up any unwinders for exception handling, and done
3150 the FINALIZE_PIC work, if necessary. */
3152 rtl_in_current_obstack ();
3154 insns
= get_insns ();
3156 /* Copy any shared structure that should not be shared. */
3158 unshare_all_rtl (insns
);
3160 /* Instantiate all virtual registers. */
3162 instantiate_virtual_regs (current_function_decl
, get_insns ());
3164 /* See if we have allocated stack slots that are not directly addressable.
3165 If so, scan all the insns and create explicit address computation
3166 for all references to such slots. */
3167 /* fixup_stack_slots (); */
3169 /* Find all the EH handlers. */
3170 find_exception_handler_labels ();
3172 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
3173 are initialized and to compute whether control can drop off the end
3175 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3176 TIMEVAR (jump_time
, jump_optimize (insns
, 0, 0, 1));
3178 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
3179 if (rtl_dump_and_exit
|| flag_syntax_only
|| DECL_DEFER_OUTPUT (decl
))
3180 goto exit_rest_of_compilation
;
3182 /* Dump rtl code after jump, if we are doing that. */
3187 fprintf (jump_opt_dump_file
, "\n;; Function %s\n\n",
3188 (*decl_printable_name
) (decl
, 2));
3189 print_rtl (jump_opt_dump_file
, insns
);
3190 fflush (jump_opt_dump_file
);
3193 /* Perform common subexpression elimination.
3194 Nonzero value from `cse_main' means that jumps were simplified
3195 and some code may now be unreachable, so do
3196 jump optimization again. */
3201 fprintf (cse_dump_file
, "\n;; Function %s\n\n",
3202 (*decl_printable_name
) (decl
, 2));
3207 TIMEVAR (cse_time
, reg_scan (insns
, max_reg_num (), 1));
3209 if (flag_thread_jumps
)
3210 /* Hacks by tiemann & kenner. */
3211 TIMEVAR (jump_time
, thread_jumps (insns
, max_reg_num (), 1));
3213 TIMEVAR (cse_time
, tem
= cse_main (insns
, max_reg_num (),
3215 TIMEVAR (cse_time
, delete_dead_from_cse (insns
, max_reg_num ()));
3217 if (tem
|| optimize
> 1)
3218 TIMEVAR (jump_time
, jump_optimize (insns
, 0, 0, 0));
3221 /* Dump rtl code after cse, if we are doing that. */
3226 print_rtl (cse_dump_file
, insns
);
3227 fflush (cse_dump_file
);
3233 fprintf (loop_dump_file
, "\n;; Function %s\n\n",
3234 (*decl_printable_name
) (decl
, 2));
3237 /* Move constant computations out of loops. */
3243 loop_optimize (insns
, loop_dump_file
);
3247 /* Dump rtl code after loop opt, if we are doing that. */
3252 print_rtl (loop_dump_file
, insns
);
3253 fflush (loop_dump_file
);
3259 fprintf (cse2_dump_file
, "\n;; Function %s\n\n",
3260 (*decl_printable_name
) (decl
, 2));
3263 if (optimize
> 0 && flag_rerun_cse_after_loop
)
3265 /* Running another jump optimization pass before the second
3266 cse pass sometimes simplifies the RTL enough to allow
3267 the second CSE pass to do a better job. Jump_optimize can change
3268 max_reg_num so we must rerun reg_scan afterwards.
3269 ??? Rework to not call reg_scan so often. */
3270 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3271 TIMEVAR (jump_time
, jump_optimize (insns
, 0, 0, 1));
3273 TIMEVAR (cse2_time
, reg_scan (insns
, max_reg_num (), 0));
3274 TIMEVAR (cse2_time
, tem
= cse_main (insns
, max_reg_num (),
3275 1, cse2_dump_file
));
3277 TIMEVAR (jump_time
, jump_optimize (insns
, 0, 0, 0));
3280 if (optimize
> 0 && flag_thread_jumps
)
3282 /* This pass of jump threading straightens out code
3283 that was kinked by loop optimization. */
3284 TIMEVAR (jump_time
, reg_scan (insns
, max_reg_num (), 0));
3285 TIMEVAR (jump_time
, thread_jumps (insns
, max_reg_num (), 0));
3287 /* Dump rtl code after cse, if we are doing that. */
3292 print_rtl (cse2_dump_file
, insns
);
3293 fflush (cse2_dump_file
);
3296 if (branch_prob_dump
)
3299 fprintf (branch_prob_dump_file
, "\n;; Function %s\n\n",
3300 (*decl_printable_name
) (decl
, 2));
3303 if (profile_arc_flag
|| flag_test_coverage
|| flag_branch_probabilities
)
3304 TIMEVAR (branch_prob_time
,
3306 branch_prob (insns
, branch_prob_dump_file
);
3309 if (branch_prob_dump
)
3312 print_rtl (branch_prob_dump_file
, insns
);
3313 fflush (branch_prob_dump_file
);
3315 /* We are no longer anticipating cse in this function, at least. */
3317 cse_not_expected
= 1;
3319 /* Now we choose between stupid (pcc-like) register allocation
3320 (if we got the -noreg switch and not -opt)
3321 and smart register allocation. */
3323 if (optimize
> 0) /* Stupid allocation probably won't work */
3324 obey_regdecls
= 0; /* if optimizations being done. */
3328 /* Print function header into flow dump now
3329 because doing the flow analysis makes some of the dump. */
3334 fprintf (flow_dump_file
, "\n;; Function %s\n\n",
3335 (*decl_printable_name
) (decl
, 2));
3342 regclass (insns
, max_reg_num ());
3343 stupid_life_analysis (insns
, max_reg_num (),
3349 /* Do control and data flow analysis,
3350 and write some of the results to dump file. */
3352 TIMEVAR (flow_time
, flow_analysis (insns
, max_reg_num (),
3354 if (warn_uninitialized
)
3356 uninitialized_vars_warning (DECL_INITIAL (decl
));
3357 setjmp_args_warning ();
3361 /* Dump rtl after flow analysis. */
3366 print_rtl_with_bb (flow_dump_file
, insns
);
3367 fflush (flow_dump_file
);
3370 /* If -opt, try combining insns through substitution. */
3373 TIMEVAR (combine_time
, combine_instructions (insns
, max_reg_num ()));
3375 /* Dump rtl code after insn combination. */
3380 fprintf (combine_dump_file
, "\n;; Function %s\n\n",
3381 (*decl_printable_name
) (decl
, 2));
3382 dump_combine_stats (combine_dump_file
);
3383 print_rtl_with_bb (combine_dump_file
, insns
);
3384 fflush (combine_dump_file
);
3390 fprintf (regmove_dump_file
, "\n;; Function %s\n\n",
3391 (*decl_printable_name
) (decl
, 2));
3394 /* Register allocation pre-pass, to reduce number of moves
3395 necessary for two-address machines. */
3396 if (optimize
> 0 && flag_regmove
)
3397 TIMEVAR (regmove_time
, regmove_optimize (insns
, max_reg_num (),
3398 regmove_dump_file
));
3403 print_rtl_with_bb (regmove_dump_file
, insns
);
3404 fflush (regmove_dump_file
);
3407 /* Print function header into sched dump now
3408 because doing the sched analysis makes some of the dump. */
3413 fprintf (sched_dump_file
, "\n;; Function %s\n\n",
3414 (*decl_printable_name
) (decl
, 2));
3417 if (optimize
> 0 && flag_schedule_insns
)
3419 /* Do control and data sched analysis,
3420 and write some of the results to dump file. */
3422 TIMEVAR (sched_time
, schedule_insns (sched_dump_file
));
3425 /* Dump rtl after instruction scheduling. */
3430 print_rtl_with_bb (sched_dump_file
, insns
);
3431 fflush (sched_dump_file
);
3434 /* Unless we did stupid register allocation,
3435 allocate pseudo-regs that are used only within 1 basic block. */
3438 TIMEVAR (local_alloc_time
,
3440 regclass (insns
, max_reg_num ());
3444 /* Dump rtl code after allocating regs within basic blocks. */
3449 fprintf (local_reg_dump_file
, "\n;; Function %s\n\n",
3450 (*decl_printable_name
) (decl
, 2));
3451 dump_flow_info (local_reg_dump_file
);
3452 dump_local_alloc (local_reg_dump_file
);
3453 print_rtl_with_bb (local_reg_dump_file
, insns
);
3454 fflush (local_reg_dump_file
);
3457 if (global_reg_dump
)
3459 fprintf (global_reg_dump_file
, "\n;; Function %s\n\n",
3460 (*decl_printable_name
) (decl
, 2)));
3462 /* Save the last label number used so far, so reorg can tell
3463 when it's safe to kill spill regs. */
3464 max_label_num_after_reload
= max_label_num ();
3466 /* Unless we did stupid register allocation,
3467 allocate remaining pseudo-regs, then do the reload pass
3468 fixing up any insns that are invalid. */
3470 TIMEVAR (global_alloc_time
,
3473 failure
= global_alloc (global_reg_dump_file
);
3475 failure
= reload (insns
, 0, global_reg_dump_file
);
3478 if (global_reg_dump
)
3481 dump_global_regs (global_reg_dump_file
);
3482 print_rtl_with_bb (global_reg_dump_file
, insns
);
3483 fflush (global_reg_dump_file
);
3487 goto exit_rest_of_compilation
;
3489 reload_completed
= 1;
3491 /* Do a very simple CSE pass over just the hard registers. */
3493 reload_cse_regs (insns
);
3495 /* On some machines, the prologue and epilogue code, or parts thereof,
3496 can be represented as RTL. Doing so lets us schedule insns between
3497 it and the rest of the code and also allows delayed branch
3498 scheduling to operate in the epilogue. */
3500 thread_prologue_and_epilogue_insns (insns
);
3502 if (optimize
> 0 && flag_schedule_insns_after_reload
)
3507 fprintf (sched2_dump_file
, "\n;; Function %s\n\n",
3508 (*decl_printable_name
) (decl
, 2));
3511 /* Do control and data sched analysis again,
3512 and write some more of the results to dump file. */
3514 TIMEVAR (sched2_time
, schedule_insns (sched2_dump_file
));
3516 /* Dump rtl after post-reorder instruction scheduling. */
3521 print_rtl_with_bb (sched2_dump_file
, insns
);
3522 fflush (sched2_dump_file
);
3526 #ifdef LEAF_REGISTERS
3528 if (optimize
> 0 && only_leaf_regs_used () && leaf_function_p ())
3532 /* One more attempt to remove jumps to .+1
3533 left by dead-store-elimination.
3534 Also do cross-jumping this time
3535 and delete no-op move insns. */
3539 TIMEVAR (jump_time
, jump_optimize (insns
, 1, 1, 0));
3542 /* Dump rtl code after jump, if we are doing that. */
3547 fprintf (jump2_opt_dump_file
, "\n;; Function %s\n\n",
3548 (*decl_printable_name
) (decl
, 2));
3549 print_rtl_with_bb (jump2_opt_dump_file
, insns
);
3550 fflush (jump2_opt_dump_file
);
3553 /* If a machine dependent reorganization is needed, call it. */
3554 #ifdef MACHINE_DEPENDENT_REORG
3555 MACHINE_DEPENDENT_REORG (insns
);
3558 /* If a scheduling pass for delayed branches is to be done,
3559 call the scheduling code. */
3562 if (optimize
> 0 && flag_delayed_branch
)
3564 TIMEVAR (dbr_sched_time
, dbr_schedule (insns
, dbr_sched_dump_file
));
3569 fprintf (dbr_sched_dump_file
, "\n;; Function %s\n\n",
3570 (*decl_printable_name
) (decl
, 2));
3571 print_rtl_with_bb (dbr_sched_dump_file
, insns
);
3572 fflush (dbr_sched_dump_file
);
3578 /* Shorten branches. */
3579 TIMEVAR (shorten_branch_time
,
3581 shorten_branches (get_insns ());
3585 TIMEVAR (stack_reg_time
, reg_to_stack (insns
, stack_reg_dump_file
));
3590 fprintf (stack_reg_dump_file
, "\n;; Function %s\n\n",
3591 (*decl_printable_name
) (decl
, 2));
3592 print_rtl_with_bb (stack_reg_dump_file
, insns
);
3593 fflush (stack_reg_dump_file
);
3598 /* Now turn the rtl into assembler code. */
3600 TIMEVAR (final_time
,
3605 /* Get the function's name, as described by its RTL.
3606 This may be different from the DECL_NAME name used
3607 in the source file. */
3609 x
= DECL_RTL (decl
);
3610 if (GET_CODE (x
) != MEM
)
3613 if (GET_CODE (x
) != SYMBOL_REF
)
3615 fnname
= XSTR (x
, 0);
3617 assemble_start_function (decl
, fnname
);
3618 final_start_function (insns
, asm_out_file
, optimize
);
3619 final (insns
, asm_out_file
, optimize
, 0);
3620 final_end_function (insns
, asm_out_file
, optimize
);
3621 assemble_end_function (decl
, fnname
);
3622 fflush (asm_out_file
);
3624 /* Release all memory held by regsets now */
3625 regset_release_memory ();
3628 /* Write DBX symbols if requested */
3630 /* Note that for those inline functions where we don't initially
3631 know for certain that we will be generating an out-of-line copy,
3632 the first invocation of this routine (rest_of_compilation) will
3633 skip over this code by doing a `goto exit_rest_of_compilation;'.
3634 Later on, finish_compilation will call rest_of_compilation again
3635 for those inline functions that need to have out-of-line copies
3636 generated. During that call, we *will* be routed past here. */
3638 #ifdef DBX_DEBUGGING_INFO
3639 if (write_symbols
== DBX_DEBUG
)
3640 TIMEVAR (symout_time
, dbxout_function (decl
));
3643 #ifdef DWARF_DEBUGGING_INFO
3644 if (write_symbols
== DWARF_DEBUG
)
3645 TIMEVAR (symout_time
, dwarfout_file_scope_decl (decl
, 0));
3648 #ifdef DWARF2_DEBUGGING_INFO
3649 if (write_symbols
== DWARF2_DEBUG
)
3650 TIMEVAR (symout_time
, dwarf2out_decl (decl
));
3653 exit_rest_of_compilation
:
3655 /* In case the function was not output,
3656 don't leave any temporary anonymous types
3657 queued up for sdb output. */
3658 #ifdef SDB_DEBUGGING_INFO
3659 if (write_symbols
== SDB_DEBUG
)
3660 sdbout_types (NULL_TREE
);
3663 /* Put back the tree of subblocks and list of arguments
3664 from before we copied them.
3665 Code generation and the output of debugging info may have modified
3666 the copy, but the original is unchanged. */
3668 if (saved_block_tree
!= 0)
3670 DECL_INITIAL (decl
) = saved_block_tree
;
3671 DECL_ARGUMENTS (decl
) = saved_arguments
;
3672 DECL_ABSTRACT_ORIGIN (decl
) = NULL_TREE
;
3675 reload_completed
= 0;
3677 /* Clear out the insn_length contents now that they are no longer valid. */
3678 init_insn_lengths ();
3680 /* Clear out the real_constant_chain before some of the rtx's
3681 it runs through become garbage. */
3683 clear_const_double_mem ();
3685 /* Cancel the effect of rtl_in_current_obstack. */
3687 resume_temporary_allocation ();
3689 /* Show no temporary slots allocated. */
3693 /* The parsing time is all the time spent in yyparse
3694 *except* what is spent in this function. */
3696 parse_time
-= get_run_time () - start_time
;
3699 /* Entry point of cc1/c++. Decode command args, then call compile_file.
3700 Exit code is 35 if can't open files, 34 if fatal error,
3701 33 if had nonfatal errors, else success. */
3704 main (argc
, argv
, envp
)
3711 int flag_print_mem
= 0;
3712 int version_flag
= 0;
3715 /* save in case md file wants to emit args as a comment. */
3719 p
= argv
[0] + strlen (argv
[0]);
3720 while (p
!= argv
[0] && p
[-1] != '/'
3721 #ifdef DIR_SEPARATOR
3722 && p
[-1] != DIR_SEPARATOR
3729 /* Get rid of any avoidable limit on stack size. */
3733 /* Set the stack limit huge so that alloca does not fail. */
3734 getrlimit (RLIMIT_STACK
, &rlim
);
3735 rlim
.rlim_cur
= rlim
.rlim_max
;
3736 setrlimit (RLIMIT_STACK
, &rlim
);
3738 #endif /* RLIMIT_STACK */
3740 signal (SIGFPE
, float_signal
);
3743 signal (SIGPIPE
, pipe_closed
);
3746 decl_printable_name
= decl_name
;
3747 lang_expand_expr
= (struct rtx_def
*(*)()) do_abort
;
3749 /* Initialize whether `char' is signed. */
3750 flag_signed_char
= DEFAULT_SIGNED_CHAR
;
3751 #ifdef DEFAULT_SHORT_ENUMS
3752 /* Initialize how much space enums occupy, by default. */
3753 flag_short_enums
= DEFAULT_SHORT_ENUMS
;
3756 /* Scan to see what optimization level has been specified. That will
3757 determine the default value of many flags. */
3758 for (i
= 1; i
< argc
; i
++)
3760 if (!strcmp (argv
[i
], "-O"))
3764 else if (argv
[i
][0] == '-' && argv
[i
][1] == 'O')
3766 /* Handle -O2, -O3, -O69, ... */
3767 char *p
= &argv
[i
][2];
3771 if (! (c
>= '0' && c
<= '9'))
3774 optimize
= atoi (&argv
[i
][2]);
3778 obey_regdecls
= (optimize
== 0);
3783 flag_thread_jumps
= 1;
3785 flag_delayed_branch
= 1;
3787 #ifdef CAN_DEBUG_WITHOUT_FP
3788 flag_omit_frame_pointer
= 1;
3790 flag_alias_check
= 1;
3795 flag_cse_follow_jumps
= 1;
3796 flag_cse_skip_blocks
= 1;
3797 flag_expensive_optimizations
= 1;
3798 flag_strength_reduce
= 1;
3799 flag_rerun_cse_after_loop
= 1;
3800 flag_caller_saves
= 1;
3802 #ifdef INSN_SCHEDULING
3803 flag_schedule_insns
= 1;
3804 flag_schedule_insns_after_reload
= 1;
3811 flag_inline_functions
= 1;
3814 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
3817 set_target_switch ("");
3819 #ifdef OPTIMIZATION_OPTIONS
3820 /* Allow default optimizations to be specified on a per-machine basis. */
3821 OPTIMIZATION_OPTIONS (optimize
);
3824 /* Initialize register usage now so switches may override. */
3827 for (i
= 1; i
< argc
; i
++)
3830 /* If this is a language-specific option,
3831 decode it in a language-specific way. */
3832 for (j
= 0; lang_options
[j
] != 0; j
++)
3833 if (!strncmp (argv
[i
], lang_options
[j
],
3834 strlen (lang_options
[j
])))
3836 if (lang_options
[j
] != 0)
3837 /* If the option is valid for *some* language,
3838 treat it as valid even if this language doesn't understand it. */
3839 lang_decode_option (argv
[i
]);
3840 else if (argv
[i
][0] == '-' && argv
[i
][1] != 0)
3842 register char *str
= argv
[i
] + 1;
3847 set_target_switch (&str
[1]);
3848 else if (!strcmp (str
, "dumpbase"))
3850 dump_base_name
= argv
[++i
];
3852 else if (str
[0] == 'd')
3854 register char *p
= &str
[1];
3859 branch_prob_dump
= 1;
3863 global_reg_dump
= 1;
3870 cse_dump
= 1, cse2_dump
= 1;
3876 branch_prob_dump
= 1;
3891 global_reg_dump
= 1;
3909 flag_print_asm_name
= 1;
3933 rtl_dump_and_exit
= 1;
3940 else if (str
[0] == 'f')
3942 register char *p
= &str
[1];
3945 /* Some kind of -f option.
3946 P's value is the option sans `-f'.
3947 Search for it in the table of options. */
3950 !found
&& j
< sizeof (f_options
) / sizeof (f_options
[0]);
3953 if (!strcmp (p
, f_options
[j
].string
))
3955 *f_options
[j
].variable
= f_options
[j
].on_value
;
3956 /* A goto here would be cleaner,
3957 but breaks the vax pcc. */
3960 if (p
[0] == 'n' && p
[1] == 'o' && p
[2] == '-'
3961 && ! strcmp (p
+3, f_options
[j
].string
))
3963 *f_options
[j
].variable
= ! f_options
[j
].on_value
;
3971 #ifdef INSN_SCHEDULING
3972 else if (!strncmp (p
, "sched-verbose-",14))
3973 fix_sched_param("verbose",&p
[14]);
3974 else if (!strncmp (p
, "sched-max-",10))
3975 fix_sched_param("max",&p
[10]);
3976 else if (!strncmp (p
, "sched-inter-max-b-",18))
3977 fix_sched_param("interblock-max-blocks",&p
[18]);
3978 else if (!strncmp (p
, "sched-inter-max-i-",18))
3979 fix_sched_param("interblock-max-insns",&p
[18]);
3982 else if (!strncmp (p
, "fixed-", 6))
3983 fix_register (&p
[6], 1, 1);
3984 else if (!strncmp (p
, "call-used-", 10))
3985 fix_register (&p
[10], 0, 1);
3986 else if (!strncmp (p
, "call-saved-", 11))
3987 fix_register (&p
[11], 0, 0);
3989 error ("Invalid option `%s'", argv
[i
]);
3991 else if (str
[0] == 'O')
3993 register char *p
= str
+1;
3994 while (*p
&& *p
>= '0' && *p
<= '9')
3999 error ("Invalid option `%s'", argv
[i
]);
4001 else if (!strcmp (str
, "pedantic"))
4003 else if (!strcmp (str
, "pedantic-errors"))
4004 flag_pedantic_errors
= pedantic
= 1;
4005 else if (!strcmp (str
, "quiet"))
4007 else if (!strcmp (str
, "version"))
4009 else if (!strcmp (str
, "w"))
4010 inhibit_warnings
= 1;
4011 else if (!strcmp (str
, "W"))
4014 /* We save the value of warn_uninitialized, since if they put
4015 -Wuninitialized on the command line, we need to generate a
4016 warning about not using it without also specifying -O. */
4017 if (warn_uninitialized
!= 1)
4018 warn_uninitialized
= 2;
4020 else if (str
[0] == 'W')
4022 register char *p
= &str
[1];
4025 /* Some kind of -W option.
4026 P's value is the option sans `-W'.
4027 Search for it in the table of options. */
4030 !found
&& j
< sizeof (W_options
) / sizeof (W_options
[0]);
4033 if (!strcmp (p
, W_options
[j
].string
))
4035 *W_options
[j
].variable
= W_options
[j
].on_value
;
4036 /* A goto here would be cleaner,
4037 but breaks the vax pcc. */
4040 if (p
[0] == 'n' && p
[1] == 'o' && p
[2] == '-'
4041 && ! strcmp (p
+3, W_options
[j
].string
))
4043 *W_options
[j
].variable
= ! W_options
[j
].on_value
;
4050 else if (!strncmp (p
, "id-clash-", 9))
4056 if (*endp
>= '0' && *endp
<= '9')
4060 error ("Invalid option `%s'", argv
[i
]);
4065 id_clash_len
= atoi (str
+ 10);
4068 else if (!strncmp (p
, "larger-than-", 12))
4070 char *endp
= p
+ 12;
4074 if (*endp
>= '0' && *endp
<= '9')
4078 error ("Invalid option `%s'", argv
[i
]);
4079 goto larger_than_lose
;
4082 warn_larger_than
= 1;
4083 larger_than_size
= atoi (str
+ 13);
4087 error ("Invalid option `%s'", argv
[i
]);
4089 else if (!strcmp (str
, "p"))
4093 else if (!strcmp (str
, "a"))
4095 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4096 warning ("`-a' option (basic block profile) not supported");
4098 profile_block_flag
= (profile_block_flag
< 2) ? 1 : 3;
4101 else if (!strcmp (str
, "ax"))
4103 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4104 warning ("`-ax' option (jump profiling) not supported");
4106 profile_block_flag
= (!profile_block_flag
4107 || profile_block_flag
== 2) ? 2 : 3;
4110 else if (str
[0] == 'g')
4114 /* A lot of code assumes write_symbols == NO_DEBUG if the
4115 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4116 of what debugging type has been selected). This records the
4117 selected type. It is an error to specify more than one
4119 static enum debug_info_type selected_debug_type
= NO_DEBUG
;
4120 /* Non-zero if debugging format has been explicitly set.
4121 -g and -ggdb don't explicitly set the debugging format so
4122 -gdwarf -g3 is equivalent to -gdwarf3. */
4123 static int type_explicitly_set_p
= 0;
4124 /* Table of supported debugging formats. */
4127 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
4128 constant expression, we use NO_DEBUG in its place. */
4129 enum debug_info_type debug_type
;
4130 int use_extensions_p
;
4131 } *da
, debug_args
[] = {
4132 { "g", NO_DEBUG
, DEFAULT_GDB_EXTENSIONS
},
4133 { "ggdb", NO_DEBUG
, 1 },
4134 #ifdef DBX_DEBUGGING_INFO
4135 { "gstabs", DBX_DEBUG
, 0 },
4136 { "gstabs+", DBX_DEBUG
, 1 },
4138 #ifdef DWARF_DEBUGGING_INFO
4139 { "gdwarf", DWARF_DEBUG
, 0 },
4140 { "gdwarf+", DWARF_DEBUG
, 1 },
4142 #ifdef DWARF2_DEBUGGING_INFO
4143 { "gdwarf-2", DWARF2_DEBUG
, 0 },
4145 #ifdef XCOFF_DEBUGGING_INFO
4146 { "gxcoff", XCOFF_DEBUG
, 0 },
4147 { "gxcoff+", XCOFF_DEBUG
, 1 },
4149 #ifdef SDB_DEBUGGING_INFO
4150 { "gcoff", SDB_DEBUG
, 0 },
4154 /* Indexed by enum debug_info_type. */
4155 static char *debug_type_names
[] = {
4156 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4159 /* Look up STR in the table. */
4160 for (da
= debug_args
; da
->arg
; da
++)
4162 if (! strncmp (str
, da
->arg
, strlen (da
->arg
)))
4164 enum debug_info_type type
= da
->debug_type
;
4167 p
= str
+ strlen (da
->arg
);
4168 if (*p
&& (*p
< '0' || *p
> '9'))
4172 while (*q
&& (*q
>= '0' && *q
<= '9'))
4177 level
= 2; /* default debugging info level */
4178 if (*q
|| level
> 3)
4180 warning ("invalid debug level specification in option: `-%s'",
4182 /* ??? This error message is incorrect in the case of
4184 warning ("no debugging information will be generated");
4188 if (type
== NO_DEBUG
)
4190 type
= PREFERRED_DEBUGGING_TYPE
;
4191 if (len
> 1 && strncmp (str
, "ggdb", len
) == 0)
4193 #ifdef DWARF2_DEBUGGING_INFO
4194 type
= DWARF2_DEBUG
;
4196 #ifdef DBX_DEBUGGING_INFO
4203 if (type
== NO_DEBUG
)
4204 warning ("`-%s' not supported by this configuration of GCC",
4207 /* Does it conflict with an already selected type? */
4208 if (type_explicitly_set_p
4209 /* -g/-ggdb don't conflict with anything */
4210 && da
->debug_type
!= NO_DEBUG
4211 && type
!= selected_debug_type
)
4212 warning ("`-%s' ignored, conflicts with `-g%s'",
4213 str
, debug_type_names
[(int) selected_debug_type
]);
4216 /* If the format has already been set, -g/-ggdb
4217 only change the debug level. */
4218 if (type_explicitly_set_p
4219 && da
->debug_type
== NO_DEBUG
)
4220 ; /* don't change debugging type */
4223 selected_debug_type
= type
;
4224 type_explicitly_set_p
= da
->debug_type
!= NO_DEBUG
;
4226 write_symbols
= (level
== 0
4228 : selected_debug_type
);
4229 use_gnu_debug_info_extensions
= da
->use_extensions_p
;
4230 debug_info_level
= (enum debug_info_level
) level
;
4236 warning ("`-%s' not supported by this configuration of GCC",
4239 else if (!strcmp (str
, "o"))
4241 asm_file_name
= argv
[++i
];
4243 else if (str
[0] == 'G')
4245 g_switch_set
= TRUE
;
4246 g_switch_value
= atoi ((str
[1] != '\0') ? str
+1 : argv
[++i
]);
4248 else if (!strncmp (str
, "aux-info", 8))
4250 flag_gen_aux_info
= 1;
4251 aux_info_file_name
= (str
[8] != '\0' ? str
+8 : argv
[++i
]);
4254 error ("Invalid option `%s'", argv
[i
]);
4256 else if (argv
[i
][0] == '+')
4257 error ("Invalid option `%s'", argv
[i
]);
4262 /* Checker uses the frame pointer. */
4263 if (flag_check_memory_usage
)
4264 flag_omit_frame_pointer
= 0;
4266 /* Initialize for bytecode output. A good idea to do this as soon as
4267 possible after the "-f" options have been parsed. */
4268 if (output_bytecode
)
4270 #ifndef TARGET_SUPPORTS_BYTECODE
4271 /* Just die with a fatal error if not supported */
4272 fatal ("-fbytecode not supported for this target");
4280 /* Inlining does not work if not optimizing,
4281 so force it not to be done. */
4285 /* The c_decode_option and lang_decode_option functions set
4286 this to `2' if -Wall is used, so we can avoid giving out
4287 lots of errors for people who don't realize what -Wall does. */
4288 if (warn_uninitialized
== 1)
4289 warning ("-Wuninitialized is not supported without -O");
4292 #ifdef OVERRIDE_OPTIONS
4293 /* Some machines may reject certain combinations of options. */
4297 if (exceptions_via_longjmp
== 2)
4299 #ifdef DWARF2_UNWIND_INFO
4300 exceptions_via_longjmp
= ! DWARF2_UNWIND_INFO
;
4302 exceptions_via_longjmp
= 1;
4306 if (profile_block_flag
== 3)
4308 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4309 profile_block_flag
= 2;
4312 /* Unrolling all loops implies that standard loop unrolling must also
4314 if (flag_unroll_all_loops
)
4315 flag_unroll_loops
= 1;
4316 /* Loop unrolling requires that strength_reduction be on also. Silently
4317 turn on strength reduction here if it isn't already on. Also, the loop
4318 unrolling code assumes that cse will be run after loop, so that must
4319 be turned on also. */
4320 if (flag_unroll_loops
)
4322 flag_strength_reduce
= 1;
4323 flag_rerun_cse_after_loop
= 1;
4326 /* Warn about options that are not supported on this machine. */
4327 #ifndef INSN_SCHEDULING
4328 if (flag_schedule_insns
|| flag_schedule_insns_after_reload
)
4329 warning ("instruction scheduling not supported on this target machine");
4332 if (flag_delayed_branch
)
4333 warning ("this target machine does not have delayed branches");
4336 /* If we are in verbose mode, write out the version and maybe all the
4337 option flags in use. */
4340 print_version (stderr
, "");
4342 print_switch_values (stderr
, 0, MAX_LINE
, "", " ", "\n");
4345 compile_file (filename
);
4347 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN32__))
4350 char *lim
= (char *) sbrk (0);
4352 fprintf (stderr
, "Data size %d.\n",
4353 lim
- (char *) &environ
);
4357 system ("ps -l 1>&2");
4360 #endif /* not USG */
4362 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN32) */
4365 exit (FATAL_EXIT_CODE
);
4367 exit (FATAL_EXIT_CODE
);
4368 exit (SUCCESS_EXIT_CODE
);
4372 /* Decode -m switches. */
4374 /* Here is a table, controlled by the tm.h file, listing each -m switch
4375 and which bits in `target_switches' it should set or clear.
4376 If VALUE is positive, it is bits to set.
4377 If VALUE is negative, -VALUE is bits to clear.
4378 (The sign bit is not used so there is no confusion.) */
4380 struct {char *name
; int value
;} target_switches
[]
4383 /* This table is similar, but allows the switch to have a value. */
4385 #ifdef TARGET_OPTIONS
4386 struct {char *prefix
; char ** variable
;} target_options
[]
4390 /* Decode the switch -mNAME. */
4393 set_target_switch (name
)
4399 for (j
= 0; j
< sizeof target_switches
/ sizeof target_switches
[0]; j
++)
4400 if (!strcmp (target_switches
[j
].name
, name
))
4402 if (target_switches
[j
].value
< 0)
4403 target_flags
&= ~-target_switches
[j
].value
;
4405 target_flags
|= target_switches
[j
].value
;
4409 #ifdef TARGET_OPTIONS
4411 for (j
= 0; j
< sizeof target_options
/ sizeof target_options
[0]; j
++)
4413 int len
= strlen (target_options
[j
].prefix
);
4414 if (!strncmp (target_options
[j
].prefix
, name
, len
))
4416 *target_options
[j
].variable
= name
+ len
;
4423 error ("Invalid option `%s'", name
);
4426 /* Print version information to FILE.
4427 Each line begins with INDENT (for the case where FILE is the
4428 assembler output file). */
4431 print_version (file
, indent
)
4435 fprintf (file
, "%s%s%s version %s", indent
, *indent
!= 0 ? " " : "",
4436 language_string
, version_string
);
4437 fprintf (file
, " (%s)", TARGET_NAME
);
4440 #define __VERSION__ "[unknown]"
4442 fprintf (file
, " compiled by GNU C version %s.\n", __VERSION__
);
4444 fprintf (file
, " compiled by CC.\n");
4448 /* Print an option value and return the adjusted position in the line.
4449 ??? We don't handle error returns from fprintf (disk full); presumably
4450 other code will catch a disk full though. */
4453 print_single_switch (file
, pos
, max
, indent
, sep
, term
, type
, name
)
4456 char *indent
, *sep
, *term
, *type
, *name
;
4458 /* The ultrix fprintf returns 0 on success, so compute the result we want
4459 here since we need it for the following test. */
4460 int len
= strlen (sep
) + strlen (type
) + strlen (name
);
4465 fprintf (file
, "%s", term
);
4470 fprintf (file
, "%s", indent
);
4471 pos
= strlen (indent
);
4473 fprintf (file
, "%s%s%s", sep
, type
, name
);
4478 /* Print active target switches to FILE.
4479 POS is the current cursor position and MAX is the size of a "line".
4480 Each line begins with INDENT and ends with TERM.
4481 Each switch is separated from the next by SEP. */
4484 print_switch_values (file
, pos
, max
, indent
, sep
, term
)
4487 char *indent
, *sep
, *term
;
4492 /* Print the options as passed. */
4494 pos
= print_single_switch (file
, pos
, max
, indent
, *indent
? " " : "", term
,
4495 "options passed: ", "");
4497 for (p
= &save_argv
[1]; *p
!= NULL
; p
++)
4501 if (strcmp (*p
, "-o") == 0)
4507 if (strcmp (*p
, "-quiet") == 0)
4509 if (strcmp (*p
, "-version") == 0)
4514 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
, *p
, "");
4517 fprintf (file
, "%s", term
);
4519 /* Print the -f and -m options that have been enabled.
4520 We don't handle language specific options but printing argv
4523 pos
= print_single_switch (file
, 0, max
, indent
, *indent
? " " : "", term
,
4524 "options enabled: ", "");
4526 for (j
= 0; j
< sizeof f_options
/ sizeof f_options
[0]; j
++)
4527 if (*f_options
[j
].variable
== f_options
[j
].on_value
)
4528 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4529 "-f", f_options
[j
].string
);
4531 /* Print target specific options. */
4533 flags
= target_flags
;
4534 for (j
= 0; j
< sizeof target_switches
/ sizeof target_switches
[0]; j
++)
4535 if (target_switches
[j
].name
[0] != '\0'
4536 && target_switches
[j
].value
> 0
4537 && ((target_switches
[j
].value
& target_flags
)
4538 == target_switches
[j
].value
))
4540 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4541 "-m", target_switches
[j
].name
);
4542 flags
&= ~ target_switches
[j
].value
;
4545 #ifdef TARGET_OPTIONS
4546 for (j
= 0; j
< sizeof target_options
/ sizeof target_options
[0]; j
++)
4547 if (*target_options
[j
].variable
!= NULL
)
4550 sprintf (prefix
, "-m%s", target_options
[j
].prefix
);
4551 pos
= print_single_switch (file
, pos
, max
, indent
, sep
, term
,
4552 prefix
, *target_options
[j
].variable
);
4556 fprintf (file
, "%s", term
);
4559 /* Record the beginning of a new source file, named FILENAME. */
4562 debug_start_source_file (filename
)
4563 register char *filename
;
4565 #ifdef DBX_DEBUGGING_INFO
4566 if (write_symbols
== DBX_DEBUG
)
4567 dbxout_start_new_source_file (filename
);
4569 #ifdef DWARF_DEBUGGING_INFO
4570 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4571 && write_symbols
== DWARF_DEBUG
)
4572 dwarfout_start_new_source_file (filename
);
4573 #endif /* DWARF_DEBUGGING_INFO */
4574 #ifdef DWARF2_DEBUGGING_INFO
4575 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4576 && write_symbols
== DWARF2_DEBUG
)
4577 dwarf2out_start_source_file (filename
);
4578 #endif /* DWARF2_DEBUGGING_INFO */
4579 #ifdef SDB_DEBUGGING_INFO
4580 if (write_symbols
== SDB_DEBUG
)
4581 sdbout_start_new_source_file (filename
);
4585 /* Record the resumption of a source file. LINENO is the line number in
4586 the source file we are returning to. */
4589 debug_end_source_file (lineno
)
4590 register unsigned lineno
;
4592 #ifdef DBX_DEBUGGING_INFO
4593 if (write_symbols
== DBX_DEBUG
)
4594 dbxout_resume_previous_source_file ();
4596 #ifdef DWARF_DEBUGGING_INFO
4597 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4598 && write_symbols
== DWARF_DEBUG
)
4599 dwarfout_resume_previous_source_file (lineno
);
4600 #endif /* DWARF_DEBUGGING_INFO */
4601 #ifdef DWARF2_DEBUGGING_INFO
4602 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4603 && write_symbols
== DWARF2_DEBUG
)
4604 dwarf2out_end_source_file ();
4605 #endif /* DWARF2_DEBUGGING_INFO */
4606 #ifdef SDB_DEBUGGING_INFO
4607 if (write_symbols
== SDB_DEBUG
)
4608 sdbout_resume_previous_source_file ();
4612 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
4613 the tail part of the directive line, i.e. the part which is past the
4614 initial whitespace, #, whitespace, directive-name, whitespace part. */
4617 debug_define (lineno
, buffer
)
4618 register unsigned lineno
;
4619 register char *buffer
;
4621 #ifdef DWARF_DEBUGGING_INFO
4622 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4623 && write_symbols
== DWARF_DEBUG
)
4624 dwarfout_define (lineno
, buffer
);
4625 #endif /* DWARF_DEBUGGING_INFO */
4626 #ifdef DWARF2_DEBUGGING_INFO
4627 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4628 && write_symbols
== DWARF2_DEBUG
)
4629 dwarf2out_define (lineno
, buffer
);
4630 #endif /* DWARF2_DEBUGGING_INFO */
4633 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
4634 the tail part of the directive line, i.e. the part which is past the
4635 initial whitespace, #, whitespace, directive-name, whitespace part. */
4638 debug_undef (lineno
, buffer
)
4639 register unsigned lineno
;
4640 register char *buffer
;
4642 #ifdef DWARF_DEBUGGING_INFO
4643 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4644 && write_symbols
== DWARF_DEBUG
)
4645 dwarfout_undef (lineno
, buffer
);
4646 #endif /* DWARF_DEBUGGING_INFO */
4647 #ifdef DWARF2_DEBUGGING_INFO
4648 if (debug_info_level
== DINFO_LEVEL_VERBOSE
4649 && write_symbols
== DWARF2_DEBUG
)
4650 dwarf2out_undef (lineno
, buffer
);
4651 #endif /* DWARF2_DEBUGGING_INFO */