1 /* Top level of GNU C compiler
2 Copyright (C) 1987, 88, 89, 92-7, 1998 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* This is the top level of cc1/c++.
22 It parses command args, opens files, invokes the various passes
23 in the proper order, and counts the time used by each.
24 Error messages and low-level interface to malloc also handled here. */
27 #undef FLOAT /* This is for hpux. They should change hpux. */
28 #undef FFS /* Some systems define this in param.h. */
33 #ifdef HAVE_SYS_RESOURCE_H
34 # include <sys/resource.h>
37 #ifdef HAVE_SYS_TIMES_H
38 # include <sys/times.h>
45 #include "insn-attr.h"
46 #include "insn-codes.h"
47 #include "insn-config.h"
55 #ifdef DWARF_DEBUGGING_INFO
59 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
60 #include "dwarf2out.h"
63 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
67 #ifdef SDB_DEBUGGING_INFO
71 #ifdef XCOFF_DEBUGGING_INFO
76 /* The extra parameters substantially improve the I/O performance. */
78 vms_fopen (fname, type)
82 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
83 fixed arguments, which matches ANSI's specification but not VAXCRTL's
84 pre-ANSI implementation. This hack circumvents the mismatch problem. */
85 FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
88 return (*vmslib_fopen) (fname, type, "mbc=32",
89 "deq=64", "fop=tef", "shr=nil");
91 return (*vmslib_fopen) (fname, type, "mbc=32");
93 #define fopen vms_fopen
96 #ifndef DEFAULT_GDB_EXTENSIONS
97 #define DEFAULT_GDB_EXTENSIONS 1
100 /* If more than one debugging type is supported, you must define
101 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
103 This is one long line cause VAXC can't handle a \-newline. */
104 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
105 #ifndef PREFERRED_DEBUGGING_TYPE
106 You Lose! You must define PREFERRED_DEBUGGING_TYPE!
107 #endif /* no PREFERRED_DEBUGGING_TYPE */
108 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
109 so the following code needn't care. */
110 #ifdef DBX_DEBUGGING_INFO
111 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
113 #ifdef SDB_DEBUGGING_INFO
114 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
116 #ifdef DWARF_DEBUGGING_INFO
117 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
119 #ifdef DWARF2_DEBUGGING_INFO
120 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
122 #ifdef XCOFF_DEBUGGING_INFO
123 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
125 #endif /* More than one debugger format enabled. */
127 /* If still not defined, must have been because no debugging formats
129 #ifndef PREFERRED_DEBUGGING_TYPE
130 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
133 extern int rtx_equal_function_value_matters;
135 #if ! (defined (VMS) || defined (OS2))
136 extern char **environ;
138 extern char *version_string, *language_string;
140 /* Carry information from ASM_DECLARE_OBJECT_NAME
141 to ASM_FINISH_DECLARE_OBJECT. */
143 extern int size_directive_output;
144 extern tree last_assemble_variable_decl;
146 extern char *init_parse PVPROTO((char *));
147 extern void finish_parse ();
148 extern void init_decl_processing ();
149 extern void init_obstacks ();
150 extern void init_tree_codes ();
151 extern void init_rtl ();
152 extern void init_regs ();
153 extern void init_optabs ();
154 extern void init_stmt ();
155 extern void init_reg_sets ();
156 extern void dump_flow_info ();
157 extern void dump_sched_info ();
158 extern void dump_local_alloc ();
159 extern void regset_release_memory ();
161 extern void print_rtl ();
162 extern void print_rtl_with_bb ();
164 void rest_of_decl_compilation ();
165 void error_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
166 void error_with_decl PVPROTO((tree decl, char *s, ...));
167 void error PVPROTO((char *s, ...));
168 void fatal PVPROTO((char *s, ...));
169 void warning_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
170 void warning_with_decl PVPROTO((tree decl, char *s, ...));
171 void warning PVPROTO((char *s, ...));
172 void pedwarn PVPROTO((char *s, ...));
173 void pedwarn_with_decl PVPROTO((tree decl, char *s, ...));
174 void pedwarn_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
175 void sorry PVPROTO((char *s, ...));
176 static void set_target_switch PROTO((char *));
177 static char *decl_name PROTO((tree, int));
178 static void vmessage PROTO((char *, char *, va_list));
179 static void v_message_with_file_and_line PROTO((char *, int, char *,
181 static void v_message_with_decl PROTO((tree, char *, char *, va_list));
182 static void file_and_line_for_asm PROTO((rtx, char **, int *));
183 static void v_error_with_file_and_line PROTO((char *, int, char *, va_list));
184 static void v_error_with_decl PROTO((tree, char *, va_list));
185 static void v_error_for_asm PROTO((rtx, char *, va_list));
186 static void verror PROTO((char *, va_list));
187 static void vfatal PROTO((char *, va_list)) ATTRIBUTE_NORETURN;
188 static void v_warning_with_file_and_line PROTO ((char *, int, char *, va_list));
189 static void v_warning_with_decl PROTO((tree, char *, va_list));
190 static void v_warning_for_asm PROTO((rtx, char *, va_list));
191 static void vwarning PROTO((char *, va_list));
192 static void vpedwarn PROTO((char *, va_list));
193 static void v_pedwarn_with_decl PROTO((tree, char *, va_list));
194 static void v_pedwarn_with_file_and_line PROTO((char *, int, char *, va_list));
195 static void vsorry PROTO((char *, va_list));
196 static void v_really_sorry PROTO((char *, va_list)) ATTRIBUTE_NORETURN;
197 static void float_signal PROTO((int)) ATTRIBUTE_NORETURN;
198 static void pipe_closed PROTO((int)) ATTRIBUTE_NORETURN;
199 #ifdef ASM_IDENTIFY_LANGUAGE
200 static void output_lang_identify PROTO((FILE *));
202 static void open_dump_file PROTO((char *, char *));
203 static void close_dump_file PROTO((void (*) (FILE *, rtx), rtx));
204 static void dump_rtl PROTO((char *, tree, void (*) (FILE *, rtx), rtx));
205 static void clean_dump_file PROTO((char *));
206 static void compile_file PROTO((char *));
207 static void display_help PROTO ((void));
209 static void print_version PROTO((FILE *, char *));
210 static int print_single_switch PROTO((FILE *, int, int, char *, char *, char *,
212 static void print_switch_values PROTO((FILE *, int, int, char *, char *,
215 void print_rtl_graph_with_bb PROTO ((const char *, const char *, rtx));
216 void clean_graph_dump_file PROTO ((const char *, const char *));
217 void finish_graph_dump_file PROTO ((const char *, const char *));
218 /* Length of line when printing switch values. */
221 /* Name of program invoked, sans directories. */
225 /* Copy of arguments to main. */
229 /* Name of current original source file (what was input to cpp).
230 This comes from each #-command in the actual input. */
232 char *input_filename;
234 /* Name of top-level original source file (what was input to cpp).
235 This comes from the #-command at the beginning of the actual input.
236 If there isn't any there, then this is the cc1 input file name. */
238 char *main_input_filename;
240 /* Current line number in real source file. */
244 /* Nonzero if it is unsafe to create any new pseudo registers. */
247 /* Stack of currently pending input files. */
249 struct file_stack *input_file_stack;
251 /* Incremented on each change to input_file_stack. */
252 int input_file_stack_tick;
254 /* FUNCTION_DECL for function now being parsed or compiled. */
256 extern tree current_function_decl;
258 /* Name to use as base of names for dump output files. */
260 char *dump_base_name;
262 /* Bit flags that specify the machine subtype we are compiling for.
263 Bits are tested using macros TARGET_... defined in the tm.h file
264 and set by `-m...' switches. Must be defined in rtlanal.c. */
266 extern int target_flags;
268 /* Flags saying which kinds of debugging dump have been requested. */
271 int rtl_dump_and_exit = 0;
272 int jump_opt_dump = 0;
273 int addressof_dump = 0;
278 int branch_prob_dump = 0;
280 int combine_dump = 0;
281 int regmove_dump = 0;
283 int local_reg_dump = 0;
284 int global_reg_dump = 0;
286 int jump2_opt_dump = 0;
288 int dbr_sched_dump = 0;
290 int flag_print_asm_name = 0;
292 int stack_reg_dump = 0;
294 #ifdef MACHINE_DEPENDENT_REORG
295 int mach_dep_reorg_dump = 0;
297 enum graph_dump_types graph_dump_format;
299 /* Name for output file of assembly code, specified with -o. */
303 /* Value of the -G xx switch, and whether it was passed or not. */
307 /* Type(s) of debugging information we are producing (if any).
308 See flags.h for the definitions of the different possible
309 types of debugging information. */
310 enum debug_info_type write_symbols = NO_DEBUG;
312 /* Level of debugging information we are producing. See flags.h
313 for the definitions of the different possible levels. */
314 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
316 /* Nonzero means use GNU-only extensions in the generated symbolic
317 debugging information. */
318 /* Currently, this only has an effect when write_symbols is set to
319 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
320 int use_gnu_debug_info_extensions = 0;
322 /* Nonzero means do optimizations. -O.
323 Particular numeric values stand for particular amounts of optimization;
324 thus, -O2 stores 2 here. However, the optimizations beyond the basic
325 ones are not controlled directly by this variable. Instead, they are
326 controlled by individual `flag_...' variables that are defaulted
327 based on this variable. */
331 /* Nonzero means optimize for size. -Os.
332 The only valid values are zero and non-zero. When optimize_size is
333 non-zero, optimize defaults to 2, but certain individual code
334 bloating optimizations are disabled. */
336 int optimize_size = 0;
338 /* Number of error messages and warning messages so far. */
341 int warningcount = 0;
344 /* Pointer to function to compute the name to use to print a declaration.
345 DECL is the declaration in question.
346 VERBOSITY determines what information will be printed:
347 0: DECL_NAME, demangled as necessary.
348 1: and scope information.
349 2: and any other information that might be interesting, such as function
350 parameter types in C++. */
352 char *(*decl_printable_name) PROTO ((tree, int));
354 /* Pointer to function to compute rtl for a language-specific tree code. */
356 typedef rtx (*lang_expand_expr_t)
357 PROTO ((union tree_node *, rtx, enum machine_mode,
358 enum expand_modifier modifier));
360 lang_expand_expr_t lang_expand_expr = 0;
362 /* Pointer to function to finish handling an incomplete decl at the
363 end of compilation. */
365 void (*incomplete_decl_finalize_hook) PROTO((tree)) = 0;
367 /* Nonzero if generating code to do profiling. */
369 int profile_flag = 0;
371 /* Nonzero if generating code to do profiling on a line-by-line basis. */
373 int profile_block_flag;
375 /* Nonzero if generating code to profile program flow graph arcs. */
377 int profile_arc_flag = 0;
379 /* Nonzero if generating info for gcov to calculate line test coverage. */
381 int flag_test_coverage = 0;
383 /* Nonzero indicates that branch taken probabilities should be calculated. */
385 int flag_branch_probabilities = 0;
387 /* Nonzero for -pedantic switch: warn about anything
388 that standard spec forbids. */
392 /* Temporarily suppress certain warnings.
393 This is set while reading code from a system header file. */
395 int in_system_header = 0;
397 /* Nonzero means do stupid register allocation.
398 Currently, this is 1 if `optimize' is 0. */
400 int obey_regdecls = 0;
402 /* Don't print functions as they are compiled and don't print
403 times taken by the various passes. -quiet. */
409 /* Nonzero means `char' should be signed. */
411 int flag_signed_char;
413 /* Nonzero means give an enum type only as many bytes as it needs. */
415 int flag_short_enums;
417 /* Nonzero for -fcaller-saves: allocate values in regs that need to
418 be saved across function calls, if that produces overall better code.
419 Optional now, so people can test it. */
421 #ifdef DEFAULT_CALLER_SAVES
422 int flag_caller_saves = 1;
424 int flag_caller_saves = 0;
427 /* Nonzero if structures and unions should be returned in memory.
429 This should only be defined if compatibility with another compiler or
430 with an ABI is needed, because it results in slower code. */
432 #ifndef DEFAULT_PCC_STRUCT_RETURN
433 #define DEFAULT_PCC_STRUCT_RETURN 1
436 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
438 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
440 /* Nonzero for -fforce-mem: load memory value into a register
441 before arithmetic on it. This makes better cse but slower compilation. */
443 int flag_force_mem = 0;
445 /* Nonzero for -fforce-addr: load memory address into a register before
446 reference to memory. This makes better cse but slower compilation. */
448 int flag_force_addr = 0;
450 /* Nonzero for -fdefer-pop: don't pop args after each function call;
451 instead save them up to pop many calls' args with one insns. */
453 int flag_defer_pop = 0;
455 /* Nonzero for -ffloat-store: don't allocate floats and doubles
456 in extended-precision registers. */
458 int flag_float_store = 0;
460 /* Nonzero for -fcse-follow-jumps:
461 have cse follow jumps to do a more extensive job. */
463 int flag_cse_follow_jumps;
465 /* Nonzero for -fcse-skip-blocks:
466 have cse follow a branch around a block. */
467 int flag_cse_skip_blocks;
469 /* Nonzero for -fexpensive-optimizations:
470 perform miscellaneous relatively-expensive optimizations. */
471 int flag_expensive_optimizations;
473 /* Nonzero for -fthread-jumps:
474 have jump optimize output of loop. */
476 int flag_thread_jumps;
478 /* Nonzero enables strength-reduction in loop.c. */
480 int flag_strength_reduce = 0;
482 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
483 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
484 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
487 int flag_unroll_loops;
489 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
490 This is generally not a win. */
492 int flag_unroll_all_loops;
494 /* Nonzero forces all invariant computations in loops to be moved
497 int flag_move_all_movables = 0;
499 /* Nonzero forces all general induction variables in loops to be
502 int flag_reduce_all_givs = 0;
504 /* Nonzero to perform full register move optimization passes. This is the
507 int flag_regmove = 0;
509 /* Nonzero for -fwritable-strings:
510 store string constants in data segment and don't uniquize them. */
512 int flag_writable_strings = 0;
514 /* Nonzero means don't put addresses of constant functions in registers.
515 Used for compiling the Unix kernel, where strange substitutions are
516 done on the assembly output. */
518 int flag_no_function_cse = 0;
520 /* Nonzero for -fomit-frame-pointer:
521 don't make a frame pointer in simple functions that don't require one. */
523 int flag_omit_frame_pointer = 0;
525 /* Nonzero means place each function into its own section on those platforms
526 which support arbitrary section names and unlimited numbers of sections. */
528 int flag_function_sections = 0;
530 /* ... and similar for data. */
532 int flag_data_sections = 0;
534 /* Nonzero to inhibit use of define_optimization peephole opts. */
536 int flag_no_peephole = 0;
538 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
539 operations in the interest of optimization. For example it allows
540 GCC to assume arguments to sqrt are nonnegative numbers, allowing
541 faster code for sqrt to be generated. */
543 int flag_fast_math = 0;
545 /* Nonzero means all references through pointers are volatile. */
549 /* Nonzero means treat all global and extern variables as global. */
551 int flag_volatile_global;
553 /* Nonzero means just do syntax checking; don't output anything. */
555 int flag_syntax_only = 0;
557 /* Nonzero means perform global cse. */
559 static int flag_gcse;
561 /* Nonzero means to rerun cse after loop optimization. This increases
562 compilation time about 20% and picks up a few more common expressions. */
564 static int flag_rerun_cse_after_loop;
566 /* Nonzero means to run loop optimizations twice. */
568 int flag_rerun_loop_opt;
570 /* Nonzero for -finline-functions: ok to inline functions that look like
571 good inline candidates. */
573 int flag_inline_functions;
575 /* Nonzero for -fkeep-inline-functions: even if we make a function
576 go inline everywhere, keep its definition around for debugging
579 int flag_keep_inline_functions;
581 /* Nonzero means that functions will not be inlined. */
585 /* Nonzero means that we should emit static const variables
586 regardless of whether or not optimization is turned on. */
588 int flag_keep_static_consts = 1;
590 /* Nonzero means we should be saving declaration info into a .X file. */
592 int flag_gen_aux_info = 0;
594 /* Specified name of aux-info file. */
596 static char *aux_info_file_name;
598 /* Nonzero means make the text shared if supported. */
600 int flag_shared_data;
602 /* Nonzero means schedule into delayed branch slots if supported. */
604 int flag_delayed_branch;
606 /* Nonzero if we are compiling pure (sharable) code.
607 Value is 1 if we are doing reasonable (i.e. simple
608 offset into offset table) pic. Value is 2 if we can
609 only perform register offsets. */
613 /* Nonzero means generate extra code for exception handling and enable
614 exception handling. */
618 /* Nonzero means use the new model for exception handling. Replaces
619 -DNEW_EH_MODEL as a compile option. */
621 int flag_new_exceptions = 0;
623 /* Nonzero means don't place uninitialized global data in common storage
628 /* Nonzero means pretend it is OK to examine bits of target floats,
629 even if that isn't true. The resulting code will have incorrect constants,
630 but the same series of instructions that the native compiler would make. */
632 int flag_pretend_float;
634 /* Nonzero means change certain warnings into errors.
635 Usually these are warnings about failure to conform to some standard. */
637 int flag_pedantic_errors = 0;
639 /* flag_schedule_insns means schedule insns within basic blocks (before
641 flag_schedule_insns_after_reload means schedule insns after
644 int flag_schedule_insns = 0;
645 int flag_schedule_insns_after_reload = 0;
648 /* The following flags have effect only for scheduling before register
651 flag_schedule_interblock means schedule insns accross basic blocks.
652 flag_schedule_speculative means allow speculative motion of non-load insns.
653 flag_schedule_speculative_load means allow speculative motion of some
655 flag_schedule_speculative_load_dangerous allows speculative motion of more
658 int flag_schedule_interblock = 1;
659 int flag_schedule_speculative = 1;
660 int flag_schedule_speculative_load = 0;
661 int flag_schedule_speculative_load_dangerous = 0;
664 /* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple
665 by a cheaper branch, on a count register. */
666 int flag_branch_on_count_reg;
668 /* -finhibit-size-directive inhibits output of .size for ELF.
669 This is used only for compiling crtstuff.c,
670 and it may be extended to other effects
671 needed for crtstuff.c on other systems. */
672 int flag_inhibit_size_directive = 0;
674 /* -fverbose-asm causes extra commentary information to be produced in
675 the generated assembly code (to make it more readable). This option
676 is generally only of use to those who actually need to read the
677 generated assembly code (perhaps while debugging the compiler itself).
678 -fno-verbose-asm, the default, causes the extra information
679 to be omitted and is useful when comparing two assembler files. */
681 int flag_verbose_asm = 0;
683 /* -dA causes debug commentary information to be produced in
684 the generated assembly code (to make it more readable). This option
685 is generally only of use to those who actually need to read the
686 generated assembly code (perhaps while debugging the compiler itself).
687 Currently, this switch is only used by dwarfout.c; however, it is intended
688 to be a catchall for printing debug information in the assembler file. */
690 int flag_debug_asm = 0;
692 /* -fgnu-linker specifies use of the GNU linker for initializations.
693 (Or, more generally, a linker that handles initializations.)
694 -fno-gnu-linker says that collect2 will be used. */
696 int flag_gnu_linker = 0;
698 int flag_gnu_linker = 1;
701 /* Tag all structures with __attribute__(packed) */
702 int flag_pack_struct = 0;
704 /* Emit code to check for stack overflow; also may cause large objects
705 to be allocated dynamically. */
706 int flag_stack_check;
708 /* -fcheck-memory-usage causes extra code to be generated in order to check
709 memory accesses. This is used by a detector of bad memory accesses such
711 int flag_check_memory_usage = 0;
713 /* -fprefix-function-name causes function name to be prefixed. This
714 can be used with -fcheck-memory-usage to isolate code compiled with
715 -fcheck-memory-usage. */
716 int flag_prefix_function_name = 0;
718 /* 0 if pointer arguments may alias each other. True in C.
719 1 if pointer arguments may not alias each other but may alias
721 2 if pointer arguments may not alias each other and may not
722 alias global variables. True in Fortran.
723 This defaults to 0 for C. */
724 int flag_argument_noalias = 0;
726 /* Nonzero if we should do (language-dependent) alias analysis.
727 Typically, this analysis will assume that expressions of certain
728 types do not alias expressions of certain other types. Only used
729 if alias analysis (in general) is enabled. */
730 int flag_strict_aliasing = 0;
732 /* Instrument functions with calls at entry and exit, for profiling. */
733 int flag_instrument_function_entry_exit = 0;
736 /* Table of supported debugging formats. */
740 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
741 constant expression, we use NO_DEBUG in its place. */
742 enum debug_info_type debug_type;
743 int use_extensions_p;
748 { "g", NO_DEBUG, DEFAULT_GDB_EXTENSIONS,
749 "Generate default debug format output" },
750 { "ggdb", NO_DEBUG, 1, "Generate default extended debug format output" },
751 #ifdef DBX_DEBUGGING_INFO
752 { "gstabs", DBX_DEBUG, 0, "Generate STABS format debug output" },
753 { "gstabs+", DBX_DEBUG, 1, "Generate extended STABS format debug output" },
755 #ifdef DWARF_DEBUGGING_INFO
756 { "gdwarf", DWARF_DEBUG, 0, "Generate DWARF-1 format debug output"},
757 { "gdwarf+", DWARF_DEBUG, 1,
758 "Generated extended DWARF-1 format debug output" },
760 #ifdef DWARF2_DEBUGGING_INFO
761 { "gdwarf-2", DWARF2_DEBUG, 0, "Enable DWARF-2 debug output" },
763 #ifdef XCOFF_DEBUGGING_INFO
764 { "gxcoff", XCOFF_DEBUG, 0, "Generate XCOFF format debug output" },
765 { "gxcoff+", XCOFF_DEBUG, 1, "Generate extended XCOFF format debug output" },
767 #ifdef SDB_DEBUGGING_INFO
768 { "gcoff", SDB_DEBUG, 0, "Generate COFF format debug output" },
780 lang_independent_options;
782 /* Add or remove a leading underscore from user symbols. */
783 int flag_leading_underscore = -1;
785 /* The user symbol prefix after having resolved same. */
786 char *user_label_prefix;
788 /* A default for same. */
789 #ifndef USER_LABEL_PREFIX
790 #define USER_LABEL_PREFIX ""
793 /* Table of language-independent -f options.
794 STRING is the option name. VARIABLE is the address of the variable.
795 ON_VALUE is the value to store in VARIABLE
796 if `-fSTRING' is seen as an option.
797 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
799 lang_independent_options f_options[] =
801 {"float-store", &flag_float_store, 1,
802 "Do not store floats in registers" },
803 {"volatile", &flag_volatile, 1,
804 "Consider all mem refs through pointers as volatile"},
805 {"volatile-global", &flag_volatile_global, 1,
806 "Consider all mem refs to global data to be volatile" },
807 {"defer-pop", &flag_defer_pop, 1,
808 "Defer popping functions args from stack until later" },
809 {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
810 "When possible do not generate stack frames"},
811 {"cse-follow-jumps", &flag_cse_follow_jumps, 1,
812 "When running CSE, follow jumps to their targets" },
813 {"cse-skip-blocks", &flag_cse_skip_blocks, 1,
814 "When running CSE, follow conditional jumps" },
815 {"expensive-optimizations", &flag_expensive_optimizations, 1,
816 "Perform a number of minor, expensive optimisations" },
817 {"thread-jumps", &flag_thread_jumps, 1,
818 "Perform jump threading optimisations"},
819 {"strength-reduce", &flag_strength_reduce, 1,
820 "Perform strength reduction optimisations" },
821 {"unroll-loops", &flag_unroll_loops, 1,
822 "Perform loop unrolling when interation count is known" },
823 {"unroll-all-loops", &flag_unroll_all_loops, 1,
824 "Perform loop unrolling for all loops" },
825 {"move-all-movables", &flag_move_all_movables, 1,
826 "Force all loop invariant computations out of loops" },
827 {"reduce-all-givs", &flag_reduce_all_givs, 1,
828 "Strength reduce all loop general induction variables" },
829 {"writable-strings", &flag_writable_strings, 1,
830 "Store strings in writable data section" },
831 {"peephole", &flag_no_peephole, 0,
832 "Enable machine specific peephole optimisations" },
833 {"force-mem", &flag_force_mem, 1,
834 "Copy memory operands into registers before using" },
835 {"force-addr", &flag_force_addr, 1,
836 "Copy memory address constants into regs before using" },
837 {"function-cse", &flag_no_function_cse, 0,
838 "Allow function addresses to be held in registers" },
839 {"inline-functions", &flag_inline_functions, 1,
840 "Integrate simple functions into their callers" },
841 {"keep-inline-functions", &flag_keep_inline_functions, 1,
842 "Generate code for funcs even if they are fully inlined" },
843 {"inline", &flag_no_inline, 0,
844 "Pay attention to the 'inline' keyword"},
845 {"keep-static-consts", &flag_keep_static_consts, 1,
846 "Emit static const variables even if they are not used" },
847 {"syntax-only", &flag_syntax_only, 1,
848 "Check for syntax errors, then stop" },
849 {"shared-data", &flag_shared_data, 1,
850 "Mark data as shared rather than private" },
851 {"caller-saves", &flag_caller_saves, 1,
852 "Enable saving registers around function calls" },
853 {"pcc-struct-return", &flag_pcc_struct_return, 1,
854 "Return 'short' aggregates in memory, not registers" },
855 {"reg-struct-return", &flag_pcc_struct_return, 0,
856 "Return 'short' aggregates in registers" },
857 {"delayed-branch", &flag_delayed_branch, 1,
858 "Attempt to fill delay slots of branch instructions" },
859 {"gcse", &flag_gcse, 1,
860 "Perform the global common subexpression elimination" },
861 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
862 "Run CSE pass after loop optimisations"},
863 {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
864 "Run the loop optimiser twice"},
865 {"pretend-float", &flag_pretend_float, 1,
866 "Pretend that host and target use the same FP format"},
867 {"schedule-insns", &flag_schedule_insns, 1,
868 "Reschedule instructions to avoid pipeline stalls"},
869 {"schedule-insns2", &flag_schedule_insns_after_reload, 1,
870 "Run two passes of the instruction scheduler"},
872 {"sched-interblock",&flag_schedule_interblock, 1,
873 "Enable scheduling across basic blocks" },
874 {"sched-spec",&flag_schedule_speculative, 1,
875 "Allow speculative motion of non-loads" },
876 {"sched-spec-load",&flag_schedule_speculative_load, 1,
877 "Allow speculative motion of some loads" },
878 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
879 "Allow speculative motion of more loads" },
881 {"branch-count-reg",&flag_branch_on_count_reg, 1,
882 "Replace add,compare,branch with branch on count reg"},
883 {"pic", &flag_pic, 1,
884 "Generate position independent code, if possible"},
885 {"PIC", &flag_pic, 2, ""},
886 {"exceptions", &flag_exceptions, 1,
887 "Enable exception handling" },
888 {"new-exceptions", &flag_new_exceptions, 1,
889 "Use the new model for exception handling" },
890 {"sjlj-exceptions", &exceptions_via_longjmp, 1,
891 "Use setjmp/longjmp to handle exceptions" },
892 {"asynchronous-exceptions", &asynchronous_exceptions, 1,
893 "Support asynchronous exceptions" },
894 {"profile-arcs", &profile_arc_flag, 1,
895 "Insert arc based program profiling code" },
896 {"test-coverage", &flag_test_coverage, 1,
897 "Create data files needed by gcov" },
898 {"branch-probabilities", &flag_branch_probabilities, 1,
899 "Use profiling information for branch porbabilities" },
900 {"fast-math", &flag_fast_math, 1,
901 "Improve FP speed by violating ANSI & IEEE rules" },
902 {"common", &flag_no_common, 0,
903 "Do not put unitialised globals in the common section" },
904 {"inhibit-size-directive", &flag_inhibit_size_directive, 1,
905 "Do not generate .size directives" },
906 {"function-sections", &flag_function_sections, 1,
907 "place each function into its own section" },
908 {"data-sections", &flag_data_sections, 1,
909 "place data items into their own section" },
910 {"verbose-asm", &flag_verbose_asm, 1,
911 "Add extra commentry to assembler output"},
912 {"gnu-linker", &flag_gnu_linker, 1,
913 "Output GNU ld formatted global initialisers"},
914 {"regmove", &flag_regmove, 1,
915 "Enables a register move optimisation"},
916 {"optimize-register-move", &flag_regmove, 1,
917 "Do the full regmove optimization pass"},
918 {"pack-struct", &flag_pack_struct, 1,
919 "Pack structure members together without holes" },
920 {"stack-check", &flag_stack_check, 1,
921 "Insert stack checking code into the program" },
922 {"argument-alias", &flag_argument_noalias, 0,
923 "Specify that arguments may alias each other & globals"},
924 {"argument-noalias", &flag_argument_noalias, 1,
925 "Assume arguments may alias globals but not each other"},
926 {"argument-noalias-global", &flag_argument_noalias, 2,
927 "Assume arguments do not alias each other or globals" },
928 {"strict-aliasing", &flag_strict_aliasing, 1,
929 "Assume strict aliasing rules apply" },
930 {"check-memory-usage", &flag_check_memory_usage, 1,
931 "Generate code to check every memory access" },
932 {"prefix-function-name", &flag_prefix_function_name, 1,
933 "Add a prefix to all function names" },
934 {"dump-unnumbered", &flag_dump_unnumbered, 1,
935 "Suppress output of instruction numbers and line number notes in debugging dumps"},
936 {"instrument-functions", &flag_instrument_function_entry_exit, 1,
937 "Instrument function entry/exit with profiling calls"},
938 {"leading-underscore", &flag_leading_underscore, 1,
939 "External symbols have a leading underscore" }
942 #define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0]))
944 /* Table of language-specific options. */
946 static struct lang_opt
951 documented_lang_options[] =
953 /* In order not to overload the --help output, the convention
954 used here is to only describe those options which are not
955 enabled by default. */
957 { "-ansi", "Compile just for ANSI C" },
958 { "-fallow-single-precision",
959 "Do not promote floats to double if using -traditional" },
960 { "-std= ", "Determine language standard"},
962 { "-fsigned-bitfields", "" },
963 { "-funsigned-bitfields","Make bitfields by unsigned by default" },
964 { "-fno-signed-bitfields", "" },
965 { "-fno-unsigned-bitfields","" },
966 { "-fsigned-char", "Make 'char' be signed by default"},
967 { "-funsigned-char", "Make 'char' be unsigned by default"},
968 { "-fno-signed-char", "" },
969 { "-fno-unsigned-char", "" },
971 { "-ftraditional", "" },
972 { "-traditional", "Attempt to support traditional K&R style C"},
973 { "-fnotraditional", "" },
974 { "-fno-traditional", "" },
977 { "-fno-asm", "Do not recognise the 'asm' keyword" },
979 { "-fno-builtin", "Do not recognise any built in functions" },
980 { "-fhosted", "Assume normal C execution environment" },
981 { "-fno-hosted", "" },
983 "Assume that standard libraries & main might not exist" },
984 { "-fno-freestanding", "" },
985 { "-fcond-mismatch", "Allow different types as args of ? operator"},
986 { "-fno-cond-mismatch", "" },
987 { "-fdollars-in-identifiers", "Allow the use of $ inside indentifiers" },
988 { "-fno-dollars-in-identifiers", "" },
990 { "-fno-ident", "Ignore #ident directives" },
991 { "-fshort-double", "Use the same size for double as for float" },
992 { "-fno-short-double", "" },
993 { "-fshort-enums", "Use the smallest fitting integer to hold enums"},
994 { "-fno-short-enums", "" },
996 { "-Wall", "Enable most warning messages" },
997 { "-Wbad-function-cast",
998 "Warn about casting functions to incompatible types" },
999 { "-Wno-bad-function-cast", "" },
1000 { "-Wmissing-noreturn",
1001 "Warn about functions which might be candidates for attribute noreturn" },
1002 { "-Wno-missing-noreturn", "" },
1003 { "-Wcast-qual", "Warn about casts which discard qualifiers"},
1004 { "-Wno-cast-qual", "" },
1005 { "-Wchar-subscripts", "Warn about subscripts whose type is 'char'"},
1006 { "-Wno-char-subscripts", "" },
1007 { "-Wcomment", "Warn if nested comments are detected" },
1008 { "-Wno-comment", "" },
1009 { "-Wcomments", "Warn if nested comments are detected" },
1010 { "-Wno-comments", "" },
1011 { "-Wconversion", "Warn about possibly confusing type conversions" },
1012 { "-Wno-conversion", "" },
1013 { "-Wformat", "Warn about printf format anomalies" },
1014 { "-Wno-format", "" },
1015 { "-Wimplicit-function-declaration",
1016 "Warn about implicit function declarations" },
1017 { "-Wno-implicit-function-declaration", "" },
1018 { "-Werror-implicit-function-declaration", "" },
1019 { "-Wimplicit-int", "Warn when a declaration does not specify a type" },
1020 { "-Wno-implicit-int", "" },
1021 { "-Wimplicit", "" },
1022 { "-Wno-implicit", "" },
1023 { "-Wimport", "Warn about the use of the #import directive" },
1024 { "-Wno-import", "" },
1025 { "-Wlong-long","" },
1026 { "-Wno-long-long", "Do not warn about using 'long long' when -pedantic" },
1027 { "-Wmain", "Warn about suspicious declarations of main" },
1028 { "-Wno-main", "" },
1029 { "-Wmissing-braces",
1030 "Warn about possibly missing braces around initialisers" },
1031 { "-Wno-missing-braces", "" },
1032 { "-Wmissing-declarations",
1033 "Warn about global funcs without previous declarations"},
1034 { "-Wno-missing-declarations", "" },
1035 { "-Wmissing-prototypes", "Warn about global funcs without prototypes" },
1036 { "-Wno-missing-prototypes", "" },
1037 { "-Wmultichar", "Warn about use of multicharacter literals"},
1038 { "-Wno-multichar", "" },
1039 { "-Wnested-externs", "Warn about externs not at file scope level" },
1040 { "-Wno-nested-externs", "" },
1041 { "-Wparentheses", "Warn about possible missing parentheses" },
1042 { "-Wno-parentheses", "" },
1043 { "-Wpointer-arith", "Warn about function pointer arithmetic" },
1044 { "-Wno-pointer-arith", "" },
1045 { "-Wredundant-decls",
1046 "Warn about multiple declarations of the same object" },
1047 { "-Wno-redundant-decls", "" },
1048 { "-Wsign-compare", "Warn about signed/unsigned comparisons" },
1049 { "-Wno-sign-compare", "" },
1050 { "-Wunknown-pragmas", "Warn about unrecognised pragmas" },
1051 { "-Wno-unknown-pragmas", "" },
1052 { "-Wstrict-prototypes", "Warn about non-prototyped function decls" },
1053 { "-Wno-strict-prototypes", "" },
1054 { "-Wtraditional", "Warn about constructs whose meaning change in ANSI C"},
1055 { "-Wno-traditional", "" },
1056 { "-Wtrigraphs", "Warn when trigraphs are encountered" },
1057 { "-Wno-trigraphs", "" },
1059 { "-Wno-undef", "" },
1060 { "-Wwrite-strings", "Mark strings as 'const char *'"},
1061 { "-Wno-write-strings", "" },
1063 /* These are for languages with USE_CPPLIB. */
1064 /* These options are already documented in cpplib.c */
1071 { "-idirafter", "" },
1076 { "-iwithprefix", "" },
1077 { "-iwithprefixbefore", "" },
1079 { "-lang-c89", "" },
1080 { "-lang-c++", "" },
1082 { "-nostdinc", "" },
1083 { "-nostdinc++", "" },
1084 { "-trigraphs", "" },
1087 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1089 /* These are for obj c. */
1090 DEFINE_LANG_NAME ("Objective C")
1092 { "-lang-objc", "" },
1093 { "-gen-decls", "Dump decls to a .decl file" },
1094 { "-fgnu-runtime", "Generate code for GNU runtime envrionment" },
1095 { "-fno-gnu-runtime", "" },
1096 { "-fnext-runtime", "Generate code for NeXT runtime environment" },
1097 { "-fno-next-runtime", "" },
1098 { "-Wselector", "Warn if a selector has multiple methods" },
1099 { "-Wno-selector", "" },
1100 { "-Wprotocol", "" },
1101 { "-Wno-protocol", "Do not warn if inherited methods are unimplemented"},
1102 { "-print-objc-runtime-info",
1103 "Generate C header of platform specific features" },
1105 #include "options.h"
1109 /* Here is a table, controlled by the tm.h file, listing each -m switch
1110 and which bits in `target_switches' it should set or clear.
1111 If VALUE is positive, it is bits to set.
1112 If VALUE is negative, -VALUE is bits to clear.
1113 (The sign bit is not used so there is no confusion.) */
1121 target_switches [] = TARGET_SWITCHES;
1123 /* This table is similar, but allows the switch to have a value. */
1125 #ifdef TARGET_OPTIONS
1132 target_options [] = TARGET_OPTIONS;
1135 /* Options controlling warnings */
1137 /* Don't print warning messages. -w. */
1139 int inhibit_warnings = 0;
1141 /* Print various extra warnings. -W. */
1143 int extra_warnings = 0;
1145 /* Treat warnings as errors. -Werror. */
1147 int warnings_are_errors = 0;
1149 /* Nonzero to warn about unused local variables. */
1153 /* Nonzero to warn about variables used before they are initialized. */
1155 int warn_uninitialized;
1157 /* Nonzero means warn about all declarations which shadow others. */
1161 /* Warn if a switch on an enum fails to have a case for every enum value. */
1165 /* Nonzero means warn about function definitions that default the return type
1166 or that use a null return and have a return-type other than void. */
1168 int warn_return_type;
1170 /* Nonzero means warn about pointer casts that increase the required
1171 alignment of the target type (and might therefore lead to a crash
1172 due to a misaligned access). */
1174 int warn_cast_align;
1176 /* Nonzero means warn about any identifiers that match in the first N
1177 characters. The value N is in `id_clash_len'. */
1180 unsigned id_clash_len;
1182 /* Nonzero means warn about any objects definitions whose size is larger
1183 than N bytes. Also want about function definitions whose returned
1184 values are larger than N bytes. The value N is in `larger_than_size'. */
1186 int warn_larger_than;
1187 unsigned larger_than_size;
1189 /* Nonzero means warn if inline function is too large. */
1193 /* Warn if a function returns an aggregate,
1194 since there are often incompatible calling conventions for doing this. */
1196 int warn_aggregate_return;
1198 /* Likewise for -W. */
1200 lang_independent_options W_options[] =
1202 {"unused", &warn_unused, 1, "Warn when a variable is unused" },
1203 {"error", &warnings_are_errors, 1, ""},
1204 {"shadow", &warn_shadow, 1, "Warn when one local variable shadows another" },
1205 {"switch", &warn_switch, 1,
1206 "Warn about enumerated switches missing a specific case" },
1207 {"aggregate-return", &warn_aggregate_return, 1,
1208 "Warn about returning structures, unions or arrays" },
1209 {"cast-align", &warn_cast_align, 1,
1210 "Warn about pointer casts which increase alignment" },
1211 {"uninitialized", &warn_uninitialized, 1,
1212 "Warn about unitialized automatic variables"},
1213 {"inline", &warn_inline, 1,
1214 "Warn when an inlined function cannot be inlined"}
1217 /* Output files for assembler code (real compiler output)
1218 and debugging dumps. */
1221 FILE *aux_info_file;
1222 FILE *rtl_dump_file = NULL;
1224 /* Time accumulators, to count the total time spent in various passes. */
1228 int integration_time;
1234 int branch_prob_time;
1239 int local_alloc_time;
1240 int global_alloc_time;
1245 int shorten_branch_time;
1251 /* Return time used so far, in microseconds. */
1261 #else /* not BeOS */
1262 #if defined (_WIN32) && !defined (__CYGWIN__)
1266 return (clock() * 1000);
1267 #else /* not _WIN32 */
1273 tick = 1000000 / sysconf(_SC_CLK_TCK);
1275 return (tms.tms_utime + tms.tms_stime) * tick;
1281 # if HAVE_SYSCONF && defined _SC_CLK_TCK
1282 # define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */
1285 # define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */
1287 # define TICKS_PER_SECOND HZ /* traditional UNIX */
1291 return (tms.tms_utime + tms.tms_stime) * (1000000 / TICKS_PER_SECOND);
1296 struct rusage rusage;
1297 getrusage (0, &rusage);
1298 return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
1299 + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
1306 int proc_system_time;
1307 int child_user_time;
1308 int child_system_time;
1310 times ((void *) &vms_times);
1311 return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
1315 #endif /* _SC_CLK_TCK */
1317 #endif /* __BEOS__ */
1320 #define TIMEVAR(VAR, BODY) \
1321 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
1324 print_time (str, total)
1329 "time in %s: %d.%06d\n",
1330 str, total / 1000000, total % 1000000);
1333 /* Count an error or warning. Return 1 if the message should be printed. */
1336 count_error (warningp)
1339 if (warningp && inhibit_warnings)
1342 if (warningp && !warnings_are_errors)
1346 static int warning_message = 0;
1348 if (warningp && !warning_message)
1350 fprintf (stderr, "%s: warnings being treated as errors\n", progname);
1351 warning_message = 1;
1359 /* Print a fatal error message. NAME is the text.
1360 Also include a system error message based on `errno'. */
1363 pfatal_with_name (name)
1366 fprintf (stderr, "%s: ", progname);
1368 exit (FATAL_EXIT_CODE);
1372 fatal_io_error (name)
1375 fprintf (stderr, "%s: %s: I/O error\n", progname, name);
1376 exit (FATAL_EXIT_CODE);
1379 /* Called to give a better error message for a bad insn rather than
1380 just calling abort(). */
1383 fatal_insn (message, insn)
1390 fflush (asm_out_file);
1392 fflush (aux_info_file);
1393 if (rtl_dump_file != NULL)
1394 fflush (rtl_dump_file);
1400 /* Called to give a better error message when we don't have an insn to match
1401 what we are looking for or if the insn's constraints aren't satisfied,
1402 rather than just calling abort(). */
1405 fatal_insn_not_found (insn)
1408 if (INSN_CODE (insn) < 0)
1409 fatal_insn ("internal error--unrecognizable insn:", insn);
1411 fatal_insn ("internal error--insn does not satisfy its constraints:", insn);
1414 /* This is the default decl_printable_name function. */
1417 decl_name (decl, verbosity)
1419 int verbosity ATTRIBUTE_UNUSED;
1421 return IDENTIFIER_POINTER (DECL_NAME (decl));
1424 static int need_error_newline;
1426 /* Function of last error message;
1427 more generally, function such that if next error message is in it
1428 then we don't have to mention the function name. */
1429 static tree last_error_function = NULL;
1431 /* Used to detect when input_file_stack has changed since last described. */
1432 static int last_error_tick;
1434 /* Called when the start of a function definition is parsed,
1435 this function prints on stderr the name of the function. */
1438 announce_function (decl)
1443 if (rtl_dump_and_exit)
1444 fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
1446 fprintf (stderr, " %s", (*decl_printable_name) (decl, 2));
1448 need_error_newline = 1;
1449 last_error_function = current_function_decl;
1453 /* The default function to print out name of current function that caused
1457 default_print_error_function (file)
1460 if (last_error_function != current_function_decl)
1462 char *kind = "function";
1463 if (current_function_decl != 0
1464 && TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
1468 fprintf (stderr, "%s: ", file);
1470 if (current_function_decl == NULL)
1471 fprintf (stderr, "At top level:\n");
1474 char *name = (*decl_printable_name) (current_function_decl, 2);
1475 fprintf (stderr, "In %s `%s':\n", kind, name);
1478 last_error_function = current_function_decl;
1482 /* Called by report_error_function to print out function name.
1483 * Default may be overridden by language front-ends. */
1485 void (*print_error_function) PROTO((char *)) = default_print_error_function;
1487 /* Prints out, if necessary, the name of the current function
1488 that caused an error. Called from all error and warning functions. */
1491 report_error_function (file)
1494 struct file_stack *p;
1496 if (need_error_newline)
1498 fprintf (stderr, "\n");
1499 need_error_newline = 0;
1502 (*print_error_function) (file);
1504 if (input_file_stack && input_file_stack->next != 0
1505 && input_file_stack_tick != last_error_tick
1506 && file == input_filename)
1508 fprintf (stderr, "In file included");
1509 for (p = input_file_stack->next; p; p = p->next)
1511 fprintf (stderr, " from %s:%d", p->name, p->line);
1513 fprintf (stderr, ",\n ");
1515 fprintf (stderr, ":\n");
1516 last_error_tick = input_file_stack_tick;
1520 /* Print a message. */
1523 vmessage (prefix, s, ap)
1529 fprintf (stderr, "%s: ", prefix);
1531 vfprintf (stderr, s, ap);
1534 /* Print a message relevant to line LINE of file FILE. */
1537 v_message_with_file_and_line (file, line, prefix, s, ap)
1545 fprintf (stderr, "%s:%d: ", file, line);
1547 fprintf (stderr, "%s: ", progname);
1549 vmessage (prefix, s, ap);
1550 fputc ('\n', stderr);
1553 /* Print a message relevant to the given DECL. */
1556 v_message_with_decl (decl, prefix, s, ap)
1564 fprintf (stderr, "%s:%d: ",
1565 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
1568 fprintf (stderr, "%s: ", prefix);
1570 /* Do magic to get around lack of varargs support for insertion
1571 of arguments into existing list. We know that the decl is first;
1572 we ass_u_me that it will be printed with "%s". */
1574 for (p = s; *p; ++p)
1578 if (*(p + 1) == '%')
1585 if (p > s) /* Print the left-hand substring. */
1587 char fmt[sizeof "%.255s"];
1590 if (width > 255L) width = 255L; /* arbitrary */
1591 sprintf (fmt, "%%.%lds", width);
1592 fprintf (stderr, fmt, s);
1595 if (*p == '%') /* Print the name. */
1597 char *n = (DECL_NAME (decl)
1598 ? (*decl_printable_name) (decl, 2)
1604 if (ISALPHA (*(p - 1) & 0xFF))
1609 if (*p) /* Print the rest of the message. */
1610 vmessage ((char *)NULL, p, ap);
1612 fputc ('\n', stderr);
1615 /* Figure file and line of the given INSN. */
1618 file_and_line_for_asm (insn, pfile, pline)
1623 rtx body = PATTERN (insn);
1626 /* Find the (or one of the) ASM_OPERANDS in the insn. */
1627 if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
1628 asmop = SET_SRC (body);
1629 else if (GET_CODE (body) == ASM_OPERANDS)
1631 else if (GET_CODE (body) == PARALLEL
1632 && GET_CODE (XVECEXP (body, 0, 0)) == SET)
1633 asmop = SET_SRC (XVECEXP (body, 0, 0));
1634 else if (GET_CODE (body) == PARALLEL
1635 && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
1636 asmop = XVECEXP (body, 0, 0);
1642 *pfile = ASM_OPERANDS_SOURCE_FILE (asmop);
1643 *pline = ASM_OPERANDS_SOURCE_LINE (asmop);
1647 *pfile = input_filename;
1652 /* Report an error at line LINE of file FILE. */
1655 v_error_with_file_and_line (file, line, s, ap)
1662 report_error_function (file);
1663 v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
1667 error_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1669 #ifndef ANSI_PROTOTYPES
1678 #ifndef ANSI_PROTOTYPES
1679 file = va_arg (ap, char *);
1680 line = va_arg (ap, int);
1681 s = va_arg (ap, char *);
1684 v_error_with_file_and_line (file, line, s, ap);
1688 /* Report an error at the declaration DECL.
1689 S is a format string which uses %s to substitute the declaration
1690 name; subsequent substitutions are a la printf. */
1693 v_error_with_decl (decl, s, ap)
1699 report_error_function (DECL_SOURCE_FILE (decl));
1700 v_message_with_decl (decl, (char *)NULL, s, ap);
1704 error_with_decl VPROTO((tree decl, char *s, ...))
1706 #ifndef ANSI_PROTOTYPES
1714 #ifndef ANSI_PROTOTYPES
1715 decl = va_arg (ap, tree);
1716 s = va_arg (ap, char *);
1719 v_error_with_decl (decl, s, ap);
1723 /* Report an error at the line number of the insn INSN.
1724 This is used only when INSN is an `asm' with operands,
1725 and each ASM_OPERANDS records its own source file and line. */
1728 v_error_for_asm (insn, s, ap)
1737 file_and_line_for_asm (insn, &file, &line);
1738 report_error_function (file);
1739 v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
1743 error_for_asm VPROTO((rtx insn, char *s, ...))
1745 #ifndef ANSI_PROTOTYPES
1753 #ifndef ANSI_PROTOTYPES
1754 insn = va_arg (ap, rtx);
1755 s = va_arg (ap, char *);
1758 v_error_for_asm (insn, s, ap);
1762 /* Report an error at the current line number. */
1769 v_error_with_file_and_line (input_filename, lineno, s, ap);
1773 error VPROTO((char *s, ...))
1775 #ifndef ANSI_PROTOTYPES
1782 #ifndef ANSI_PROTOTYPES
1783 s = va_arg (ap, char *);
1790 /* Report a fatal error at the current line number. */
1798 exit (FATAL_EXIT_CODE);
1802 fatal VPROTO((char *s, ...))
1804 #ifndef ANSI_PROTOTYPES
1811 #ifndef ANSI_PROTOTYPES
1812 s = va_arg (ap, char *);
1819 /* Report a warning at line LINE of file FILE. */
1822 v_warning_with_file_and_line (file, line, s, ap)
1828 if (count_error (1))
1830 report_error_function (file);
1831 v_message_with_file_and_line (file, line, "warning", s, ap);
1836 warning_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1838 #ifndef ANSI_PROTOTYPES
1847 #ifndef ANSI_PROTOTYPES
1848 file = va_arg (ap, char *);
1849 line = va_arg (ap, int);
1850 s = va_arg (ap, char *);
1853 v_warning_with_file_and_line (file, line, s, ap);
1857 /* Report a warning at the declaration DECL.
1858 S is a format string which uses %s to substitute the declaration
1859 name; subsequent substitutions are a la printf. */
1862 v_warning_with_decl (decl, s, ap)
1867 if (count_error (1))
1869 report_error_function (DECL_SOURCE_FILE (decl));
1870 v_message_with_decl (decl, "warning", s, ap);
1875 warning_with_decl VPROTO((tree decl, char *s, ...))
1877 #ifndef ANSI_PROTOTYPES
1885 #ifndef ANSI_PROTOTYPES
1886 decl = va_arg (ap, tree);
1887 s = va_arg (ap, char *);
1890 v_warning_with_decl (decl, s, ap);
1894 /* Report a warning at the line number of the insn INSN.
1895 This is used only when INSN is an `asm' with operands,
1896 and each ASM_OPERANDS records its own source file and line. */
1899 v_warning_for_asm (insn, s, ap)
1904 if (count_error (1))
1909 file_and_line_for_asm (insn, &file, &line);
1910 report_error_function (file);
1911 v_message_with_file_and_line (file, line, "warning", s, ap);
1916 warning_for_asm VPROTO((rtx insn, char *s, ...))
1918 #ifndef ANSI_PROTOTYPES
1926 #ifndef ANSI_PROTOTYPES
1927 insn = va_arg (ap, rtx);
1928 s = va_arg (ap, char *);
1931 v_warning_for_asm (insn, s, ap);
1935 /* Report a warning at the current line number. */
1942 v_warning_with_file_and_line (input_filename, lineno, s, ap);
1946 warning VPROTO((char *s, ...))
1948 #ifndef ANSI_PROTOTYPES
1955 #ifndef ANSI_PROTOTYPES
1956 s = va_arg (ap, char *);
1963 /* These functions issue either warnings or errors depending on
1964 -pedantic-errors. */
1971 if (flag_pedantic_errors)
1978 pedwarn VPROTO((char *s, ...))
1980 #ifndef ANSI_PROTOTYPES
1987 #ifndef ANSI_PROTOTYPES
1988 s = va_arg (ap, char *);
1996 v_pedwarn_with_decl (decl, s, ap)
2001 /* We don't want -pedantic-errors to cause the compilation to fail from
2002 "errors" in system header files. Sometimes fixincludes can't fix what's
2003 broken (eg: unsigned char bitfields - fixing it may change the alignment
2004 which will cause programs to mysteriously fail because the C library
2005 or kernel uses the original layout). There's no point in issuing a
2006 warning either, it's just unnecessary noise. */
2008 if (! DECL_IN_SYSTEM_HEADER (decl))
2010 if (flag_pedantic_errors)
2011 v_error_with_decl (decl, s, ap);
2013 v_warning_with_decl (decl, s, ap);
2018 pedwarn_with_decl VPROTO((tree decl, char *s, ...))
2020 #ifndef ANSI_PROTOTYPES
2028 #ifndef ANSI_PROTOTYPES
2029 decl = va_arg (ap, tree);
2030 s = va_arg (ap, char *);
2033 v_pedwarn_with_decl (decl, s, ap);
2038 v_pedwarn_with_file_and_line (file, line, s, ap)
2044 if (flag_pedantic_errors)
2045 v_error_with_file_and_line (file, line, s, ap);
2047 v_warning_with_file_and_line (file, line, s, ap);
2051 pedwarn_with_file_and_line VPROTO((char *file, int line, char *s, ...))
2053 #ifndef ANSI_PROTOTYPES
2062 #ifndef ANSI_PROTOTYPES
2063 file = va_arg (ap, char *);
2064 line = va_arg (ap, int);
2065 s = va_arg (ap, char *);
2068 v_pedwarn_with_file_and_line (file, line, s, ap);
2072 /* Apologize for not implementing some feature. */
2081 fprintf (stderr, "%s:%d: ", input_filename, lineno);
2083 fprintf (stderr, "%s: ", progname);
2084 vmessage ("sorry, not implemented", s, ap);
2085 fputc ('\n', stderr);
2089 sorry VPROTO((char *s, ...))
2091 #ifndef ANSI_PROTOTYPES
2098 #ifndef ANSI_PROTOTYPES
2099 s = va_arg (ap, char *);
2106 /* Apologize for not implementing some feature, then quit. */
2109 v_really_sorry (s, ap)
2115 fprintf (stderr, "%s:%d: ", input_filename, lineno);
2117 fprintf (stderr, "%s: ", progname);
2118 vmessage ("sorry, not implemented", s, ap);
2119 fatal (" (fatal)\n");
2123 really_sorry VPROTO((char *s, ...))
2125 #ifndef ANSI_PROTOTYPES
2132 #ifndef ANSI_PROTOTYPES
2133 s = va_arg (ap, char *);
2136 v_really_sorry (s, ap);
2140 /* More 'friendly' abort that prints the line and file.
2141 config.h can #define abort fancy_abort if you like that sort of thing.
2143 I don't think this is actually a good idea.
2144 Other sorts of crashes will look a certain way.
2145 It is a good thing if crashes from calling abort look the same way.
2151 fatal ("internal gcc abort");
2154 /* This calls abort and is used to avoid problems when abort if a macro.
2155 It is used when we need to pass the address of abort. */
2163 /* When `malloc.c' is compiled with `rcheck' defined,
2164 it calls this function to report clobberage. */
2168 char * s ATTRIBUTE_UNUSED;
2173 /* Same as `malloc' but report error if no memory available. */
2184 value = (PTR) malloc (size);
2186 fatal ("virtual memory exhausted");
2190 /* Same as `calloc' but report error if no memory available. */
2193 xcalloc (size1, size2)
2194 size_t size1, size2;
2198 if (size1 == 0 || size2 == 0)
2201 value = (PTR) calloc (size1, size2);
2203 fatal ("virtual memory exhausted");
2208 /* Same as `realloc' but report error if no memory available.
2209 Also handle null PTR even if the vendor realloc gets it wrong. */
2212 xrealloc (ptr, size)
2216 register PTR result;
2221 result = (ptr ? (PTR) realloc (ptr, size) : (PTR) malloc (size));
2224 fatal ("virtual memory exhausted");
2229 /* Same as `strdup' but report error if no memory available. */
2233 register const char *s;
2235 register char *result = (char *) malloc (strlen (s) + 1);
2238 fatal ("virtual memory exhausted");
2243 /* Return the logarithm of X, base 2, considering X unsigned,
2244 if X is a power of 2. Otherwise, returns -1.
2246 This should be used via the `exact_log2' macro. */
2250 register unsigned HOST_WIDE_INT x;
2252 register int log = 0;
2253 /* Test for 0 or a power of 2. */
2254 if (x == 0 || x != (x & -x))
2256 while ((x >>= 1) != 0)
2261 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
2262 If X is 0, return -1.
2264 This should be used via the floor_log2 macro. */
2268 register unsigned HOST_WIDE_INT x;
2270 register int log = -1;
2277 static int float_handler_set;
2279 jmp_buf float_handler;
2281 /* Signals actually come here. */
2284 float_signal (signo)
2285 /* If this is missing, some compilers complain. */
2286 int signo ATTRIBUTE_UNUSED;
2288 if (float_handled == 0)
2290 #if defined (USG) || defined (hpux)
2291 signal (SIGFPE, float_signal); /* re-enable the signal catcher */
2294 signal (SIGFPE, float_signal);
2295 longjmp (float_handler, 1);
2298 /* Specify where to longjmp to when a floating arithmetic error happens.
2299 If HANDLER is 0, it means don't handle the errors any more. */
2302 set_float_handler (handler)
2305 float_handled = (handler != 0);
2307 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
2309 if (float_handled && ! float_handler_set)
2311 signal (SIGFPE, float_signal);
2312 float_handler_set = 1;
2316 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
2317 error happens, pushing the previous specification into OLD_HANDLER.
2318 Return an indication of whether there was a previous handler in effect. */
2321 push_float_handler (handler, old_handler)
2322 jmp_buf handler, old_handler;
2324 int was_handled = float_handled;
2328 memcpy ((char *) old_handler, (char *) float_handler,
2329 sizeof (float_handler));
2331 memcpy ((char *) float_handler, (char *) handler, sizeof (float_handler));
2335 /* Restore the previous specification of whether and where to longjmp to
2336 when a floating arithmetic error happens. */
2339 pop_float_handler (handled, handler)
2343 float_handled = handled;
2345 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
2348 /* Handler for SIGPIPE. */
2352 /* If this is missing, some compilers complain. */
2353 int signo ATTRIBUTE_UNUSED;
2355 fatal ("output pipe has been closed");
2358 /* Strip off a legitimate source ending from the input string NAME of
2359 length LEN. Rather than having to know the names used by all of
2360 our front ends, we strip off an ending of a period followed by
2361 up to five characters. (Java uses ".class".) */
2364 strip_off_ending (name, len)
2369 for (i = 2; i < 6 && len > i; i++)
2371 if (name[len - i] == '.')
2373 name[len - i] = '\0';
2379 /* Output a quoted string. */
2382 output_quoted_string (asm_file, string)
2386 #ifdef OUTPUT_QUOTED_STRING
2387 OUTPUT_QUOTED_STRING (asm_file, string);
2391 putc ('\"', asm_file);
2392 while ((c = *string++) != 0)
2394 if (c == '\"' || c == '\\')
2395 putc ('\\', asm_file);
2398 putc ('\"', asm_file);
2402 /* Output a file name in the form wanted by System V. */
2405 output_file_directive (asm_file, input_name)
2409 int len = strlen (input_name);
2410 char *na = input_name + len;
2412 /* NA gets INPUT_NAME sans directory names. */
2413 while (na > input_name)
2417 #ifdef DIR_SEPARATOR
2418 if (na[-1] == DIR_SEPARATOR)
2424 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
2425 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
2427 #ifdef ASM_OUTPUT_SOURCE_FILENAME
2428 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
2430 fprintf (asm_file, "\t.file\t");
2431 output_quoted_string (asm_file, na);
2432 fputc ('\n', asm_file);
2437 #ifdef ASM_IDENTIFY_LANGUAGE
2438 /* Routine to build language identifier for object file. */
2440 output_lang_identify (asm_out_file)
2443 int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
2444 char *s = (char *) alloca (len);
2445 sprintf (s, "__gnu_compiled_%s", lang_identify ());
2446 ASM_OUTPUT_LABEL (asm_out_file, s);
2450 /* Routine to open a dump file. */
2452 open_dump_file (suffix, function_name)
2454 char *function_name;
2461 dumpname = (char *) xmalloc (strlen (dump_base_name) + strlen (suffix) + 1);
2463 if (rtl_dump_file != NULL)
2464 fclose (rtl_dump_file);
2466 strcpy (dumpname, dump_base_name);
2467 strcat (dumpname, suffix);
2469 rtl_dump_file = fopen (dumpname, "a");
2471 if (rtl_dump_file == NULL)
2472 pfatal_with_name (dumpname);
2477 fprintf (rtl_dump_file, "\n;; Function %s\n\n", function_name);
2483 /* Routine to close a dump file. */
2485 close_dump_file (func, insns)
2486 void (*func) PROTO ((FILE *, rtx));
2493 func (rtl_dump_file, insns);
2495 fflush (rtl_dump_file);
2496 fclose (rtl_dump_file);
2498 rtl_dump_file = NULL;
2504 /* Routine to dump rtl into a file. */
2506 dump_rtl (suffix, decl, func, insns)
2509 void (*func) PROTO ((FILE *, rtx));
2512 open_dump_file (suffix, decl_printable_name (decl, 2));
2513 close_dump_file (func, insns);
2516 /* Routine to empty a dump file. */
2518 clean_dump_file (suffix)
2523 dumpname = (char *) xmalloc (strlen (dump_base_name) + strlen (suffix) + 1);
2525 strcpy (dumpname, dump_base_name);
2526 strcat (dumpname, suffix);
2528 rtl_dump_file = fopen (dumpname, "w");
2530 if (rtl_dump_file == NULL)
2531 pfatal_with_name (dumpname);
2535 fclose (rtl_dump_file);
2536 rtl_dump_file = NULL;
2542 /* Compile an entire file of output from cpp, named NAME.
2543 Write a file of assembly output and various debugging dumps. */
2552 int name_specified = name != 0;
2554 if (dump_base_name == 0)
2555 dump_base_name = name ? name : "gccdump";
2559 integration_time = 0;
2565 branch_prob_time = 0;
2570 local_alloc_time = 0;
2571 global_alloc_time = 0;
2576 shorten_branch_time = 0;
2582 /* Initialize data in various passes. */
2586 name = init_parse (name);
2588 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
2589 || debug_info_level == DINFO_LEVEL_VERBOSE
2590 || flag_test_coverage);
2592 init_decl_processing ();
2601 if (flag_caller_saves)
2602 init_caller_save ();
2604 /* If auxiliary info generation is desired, open the output file.
2605 This goes in the same directory as the source file--unlike
2606 all the other output files. */
2607 if (flag_gen_aux_info)
2609 aux_info_file = fopen (aux_info_file_name, "w");
2610 if (aux_info_file == 0)
2611 pfatal_with_name (aux_info_file_name);
2614 /* Clear the dump files. */
2616 clean_dump_file (".rtl");
2619 clean_dump_file (".jump");
2620 if (graph_dump_format != no_graph)
2621 clean_graph_dump_file (dump_base_name, ".jump");
2625 clean_dump_file (".addressof");
2626 if (graph_dump_format != no_graph)
2627 clean_graph_dump_file (dump_base_name, ".addressof");
2631 clean_dump_file (".cse");
2632 if (graph_dump_format != no_graph)
2633 clean_graph_dump_file (dump_base_name, ".cse");
2637 clean_dump_file (".loop");
2638 if (graph_dump_format != no_graph)
2639 clean_graph_dump_file (dump_base_name, ".loop");
2643 clean_dump_file (".cse2");
2644 if (graph_dump_format != no_graph)
2645 clean_graph_dump_file (dump_base_name, ".cse2");
2647 if (branch_prob_dump)
2649 clean_dump_file (".bp");
2650 if (graph_dump_format != no_graph)
2651 clean_graph_dump_file (dump_base_name, ".bp");
2655 clean_dump_file (".flow");
2656 if (graph_dump_format != no_graph)
2657 clean_graph_dump_file (dump_base_name, ".flow");
2661 clean_dump_file (".combine");
2662 if (graph_dump_format != no_graph)
2663 clean_graph_dump_file (dump_base_name, ".combine");
2667 clean_dump_file (".regmove");
2668 if (graph_dump_format != no_graph)
2669 clean_graph_dump_file (dump_base_name, ".regmove");
2673 clean_dump_file (".sched");
2674 if (graph_dump_format != no_graph)
2675 clean_graph_dump_file (dump_base_name, ".sched");
2679 clean_dump_file (".lreg");
2680 if (graph_dump_format != no_graph)
2681 clean_graph_dump_file (dump_base_name, ".lreg");
2683 if (global_reg_dump)
2685 clean_dump_file (".greg");
2686 if (graph_dump_format != no_graph)
2687 clean_graph_dump_file (dump_base_name, ".greg");
2691 clean_dump_file (".sched2");
2692 if (graph_dump_format != no_graph)
2693 clean_graph_dump_file (dump_base_name, ".sched2");
2697 clean_dump_file (".jump2");
2698 if (graph_dump_format != no_graph)
2699 clean_graph_dump_file (dump_base_name, ".jump2");
2704 clean_dump_file (".dbr");
2705 if (graph_dump_format != no_graph)
2706 clean_graph_dump_file (dump_base_name, ".dbr");
2711 clean_dump_file (".gcse");
2712 if (graph_dump_format != no_graph)
2713 clean_graph_dump_file (dump_base_name, ".gcse");
2718 clean_dump_file (".stack");
2719 if (graph_dump_format != no_graph)
2720 clean_graph_dump_file (dump_base_name, ".stack");
2723 #ifdef MACHINE_DEPENDENT_REORG
2724 if (mach_dep_reorg_dump)
2726 clean_dump_file (".mach");
2727 if (graph_dump_format != no_graph)
2728 clean_graph_dump_file (dump_base_name, ".mach");
2732 /* Open assembler code output file. */
2734 if (flag_syntax_only)
2735 asm_out_file = NULL;
2738 if (! name_specified && asm_file_name == 0)
2739 asm_out_file = stdout;
2742 int len = strlen (dump_base_name);
2743 register char *dumpname = (char *) xmalloc (len + 6);
2744 strcpy (dumpname, dump_base_name);
2745 strip_off_ending (dumpname, len);
2746 strcat (dumpname, ".s");
2747 if (asm_file_name == 0)
2749 asm_file_name = (char *) xmalloc (strlen (dumpname) + 1);
2750 strcpy (asm_file_name, dumpname);
2752 if (!strcmp (asm_file_name, "-"))
2753 asm_out_file = stdout;
2755 asm_out_file = fopen (asm_file_name, "w");
2756 if (asm_out_file == 0)
2757 pfatal_with_name (asm_file_name);
2760 #ifdef IO_BUFFER_SIZE
2761 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
2762 _IOFBF, IO_BUFFER_SIZE);
2766 input_filename = name;
2768 /* Put an entry on the input file stack for the main input file. */
2770 = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2771 input_file_stack->next = 0;
2772 input_file_stack->name = input_filename;
2774 /* Perform language-specific initialization.
2775 This may set main_input_filename. */
2778 /* If the input doesn't start with a #line, use the input name
2779 as the official input file name. */
2780 if (main_input_filename == 0)
2781 main_input_filename = name;
2783 if (flag_syntax_only)
2785 write_symbols = NO_DEBUG;
2787 profile_block_flag = 0;
2791 ASM_FILE_START (asm_out_file);
2793 #ifdef ASM_COMMENT_START
2794 if (flag_verbose_asm)
2796 /* Print the list of options in effect. */
2797 print_version (asm_out_file, ASM_COMMENT_START);
2798 print_switch_values (asm_out_file, 0, MAX_LINE,
2799 ASM_COMMENT_START, " ", "\n");
2800 /* Add a blank line here so it appears in assembler output but not
2802 fprintf (asm_out_file, "\n");
2806 /* Output something to inform GDB that this compilation was by GCC. */
2807 #ifndef ASM_IDENTIFY_GCC
2808 fprintf (asm_out_file, "gcc2_compiled.:\n");
2810 ASM_IDENTIFY_GCC (asm_out_file);
2813 /* Output something to identify which front-end produced this file. */
2814 #ifdef ASM_IDENTIFY_LANGUAGE
2815 ASM_IDENTIFY_LANGUAGE (asm_out_file);
2817 } /* ! flag_syntax_only */
2819 #ifndef ASM_OUTPUT_SECTION_NAME
2820 if (flag_function_sections)
2822 warning ("-ffunction-sections not supported for this target.");
2823 flag_function_sections = 0;
2825 if (flag_data_sections)
2827 warning ("-fdata-sections not supported for this target.");
2828 flag_data_sections = 0;
2832 if (flag_function_sections
2833 && (profile_flag || profile_block_flag))
2835 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2836 flag_function_sections = 0;
2839 if (flag_function_sections && write_symbols != NO_DEBUG)
2840 warning ("-ffunction-sections may affect debugging on some targets.");
2842 /* ??? Note: There used to be a conditional here
2843 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2844 This was to guarantee separation between gcc_compiled. and
2845 the first function, for the sake of dbx on Suns.
2846 However, having the extra zero here confused the Emacs
2847 code for unexec, and might confuse other programs too.
2848 Therefore, I took out that change.
2849 In future versions we should find another way to solve
2850 that dbx problem. -- rms, 23 May 93. */
2852 /* Don't let the first function fall at the same address
2853 as gcc_compiled., if profiling. */
2854 if (profile_flag || profile_block_flag)
2856 /* It's best if we can write a nop here since some
2857 assemblers don't tolerate zeros in the text section. */
2858 if (insn_template[CODE_FOR_nop] != 0)
2859 output_asm_insn (insn_template[CODE_FOR_nop], NULL_PTR);
2861 assemble_zeros (UNITS_PER_WORD);
2864 /* If dbx symbol table desired, initialize writing it
2865 and output the predefined types. */
2866 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2867 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2868 TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
2871 #ifdef SDB_DEBUGGING_INFO
2872 if (write_symbols == SDB_DEBUG)
2873 TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
2876 #ifdef DWARF_DEBUGGING_INFO
2877 if (write_symbols == DWARF_DEBUG)
2878 TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
2880 #ifdef DWARF2_UNWIND_INFO
2881 if (dwarf2out_do_frame ())
2882 dwarf2out_frame_init ();
2884 #ifdef DWARF2_DEBUGGING_INFO
2885 if (write_symbols == DWARF2_DEBUG)
2886 TIMEVAR (symout_time, dwarf2out_init (asm_out_file, main_input_filename));
2889 /* Initialize yet another pass. */
2891 init_final (main_input_filename);
2892 init_branch_prob (dump_base_name);
2894 start_time = get_run_time ();
2896 /* Call the parser, which parses the entire file
2897 (calling rest_of_compilation for each function). */
2899 if (yyparse () != 0)
2901 if (errorcount == 0)
2902 fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
2904 /* In case there were missing closebraces,
2905 get us back to the global binding level. */
2906 while (! global_bindings_p ())
2910 output_func_start_profiler ();
2912 /* Compilation is now finished except for writing
2913 what's left of the symbol table output. */
2915 parse_time += get_run_time () - start_time;
2917 parse_time -= integration_time;
2918 parse_time -= varconst_time;
2920 if (flag_syntax_only)
2923 globals = getdecls ();
2925 /* Really define vars that have had only a tentative definition.
2926 Really output inline functions that must actually be callable
2927 and have not been output so far. */
2930 int len = list_length (globals);
2931 tree *vec = (tree *) alloca (sizeof (tree) * len);
2936 /* Process the decls in reverse order--earliest first.
2937 Put them into VEC from back to front, then take out from front. */
2939 for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
2940 vec[len - i - 1] = decl;
2942 for (i = 0; i < len; i++)
2946 /* We're not deferring this any longer. */
2947 DECL_DEFER_OUTPUT (decl) = 0;
2949 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
2950 && incomplete_decl_finalize_hook != 0)
2951 (*incomplete_decl_finalize_hook) (decl);
2954 /* Now emit any global variables or functions that we have been putting
2955 off. We need to loop in case one of the things emitted here
2956 references another one which comes earlier in the list. */
2960 for (i = 0; i < len; i++)
2964 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
2967 /* Don't write out static consts, unless we still need them.
2969 We also keep static consts if not optimizing (for debugging),
2970 unless the user specified -fno-keep-static-consts.
2971 ??? They might be better written into the debug information.
2972 This is possible when using DWARF.
2974 A language processor that wants static constants to be always
2975 written out (even if it is not used) is responsible for
2976 calling rest_of_decl_compilation itself. E.g. the C front-end
2977 calls rest_of_decl_compilation from finish_decl.
2978 One motivation for this is that is conventional in some
2979 environments to write things like:
2980 static const char rcsid[] = "... version string ...";
2981 intending to force the string to be in the executable.
2983 A language processor that would prefer to have unneeded
2984 static constants "optimized away" would just defer writing
2985 them out until here. E.g. C++ does this, because static
2986 constants are often defined in header files.
2988 ??? A tempting alternative (for both C and C++) would be
2989 to force a constant to be written if and only if it is
2990 defined in a main file, as opposed to an include file. */
2992 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
2993 && (! TREE_READONLY (decl)
2994 || TREE_PUBLIC (decl)
2995 || (!optimize && flag_keep_static_consts)
2996 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
2999 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
3002 if (TREE_CODE (decl) == FUNCTION_DECL
3003 && DECL_INITIAL (decl) != 0
3004 && DECL_SAVED_INSNS (decl) != 0
3005 && (flag_keep_inline_functions
3006 || TREE_PUBLIC (decl)
3007 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
3010 temporary_allocation ();
3011 output_inline_function (decl);
3012 permanent_allocation (1);
3017 /* Now that all possible functions have been output, we can dump
3018 the exception table. */
3020 output_exception_table ();
3022 for (i = 0; i < len; i++)
3026 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
3027 && ! TREE_ASM_WRITTEN (decl))
3028 /* Cancel the RTL for this decl so that, if debugging info
3029 output for global variables is still to come,
3030 this one will be omitted. */
3031 DECL_RTL (decl) = NULL;
3033 /* Warn about any function
3034 declared static but not defined.
3035 We don't warn about variables,
3036 because many programs have static variables
3037 that exist only to get some text into the object file. */
3038 if (TREE_CODE (decl) == FUNCTION_DECL
3040 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
3041 && DECL_INITIAL (decl) == 0
3042 && DECL_EXTERNAL (decl)
3043 && ! DECL_ARTIFICIAL (decl)
3044 && ! TREE_PUBLIC (decl))
3046 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
3047 pedwarn_with_decl (decl,
3048 "`%s' used but never defined");
3050 warning_with_decl (decl,
3051 "`%s' declared `static' but never defined");
3052 /* This symbol is effectively an "extern" declaration now. */
3053 TREE_PUBLIC (decl) = 1;
3054 assemble_external (decl);
3057 /* Warn about static fns or vars defined but not used,
3058 but not about inline functions or static consts
3059 since defining those in header files is normal practice. */
3061 && ((TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
3062 || (TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
3063 && ! DECL_IN_SYSTEM_HEADER (decl)
3064 && ! DECL_EXTERNAL (decl)
3065 && ! TREE_PUBLIC (decl)
3066 && ! TREE_USED (decl)
3067 && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
3068 /* The TREE_USED bit for file-scope decls
3069 is kept in the identifier, to handle multiple
3070 external decls in different scopes. */
3071 && ! TREE_USED (DECL_NAME (decl)))
3072 warning_with_decl (decl, "`%s' defined but not used");
3074 #ifdef SDB_DEBUGGING_INFO
3075 /* The COFF linker can move initialized global vars to the end.
3076 And that can screw up the symbol ordering.
3077 By putting the symbols in that order to begin with,
3078 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
3079 if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
3080 && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
3081 && ! DECL_EXTERNAL (decl)
3082 && DECL_RTL (decl) != 0)
3083 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
3085 /* Output COFF information for non-global
3086 file-scope initialized variables. */
3087 if (write_symbols == SDB_DEBUG
3088 && TREE_CODE (decl) == VAR_DECL
3089 && DECL_INITIAL (decl)
3090 && ! DECL_EXTERNAL (decl)
3091 && DECL_RTL (decl) != 0
3092 && GET_CODE (DECL_RTL (decl)) == MEM)
3093 TIMEVAR (symout_time, sdbout_toplevel_data (decl));
3094 #endif /* SDB_DEBUGGING_INFO */
3095 #ifdef DWARF_DEBUGGING_INFO
3096 /* Output DWARF information for file-scope tentative data object
3097 declarations, file-scope (extern) function declarations (which
3098 had no corresponding body) and file-scope tagged type declarations
3099 and definitions which have not yet been forced out. */
3101 if (write_symbols == DWARF_DEBUG
3102 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
3103 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
3105 #ifdef DWARF2_DEBUGGING_INFO
3106 /* Output DWARF2 information for file-scope tentative data object
3107 declarations, file-scope (extern) function declarations (which
3108 had no corresponding body) and file-scope tagged type declarations
3109 and definitions which have not yet been forced out. */
3111 if (write_symbols == DWARF2_DEBUG
3112 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
3113 TIMEVAR (symout_time, dwarf2out_decl (decl));
3118 /* Write out any pending weak symbol declarations. */
3122 /* Do dbx symbols */
3123 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
3124 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
3125 TIMEVAR (symout_time,
3127 dbxout_finish (asm_out_file, main_input_filename);
3131 #ifdef DWARF_DEBUGGING_INFO
3132 if (write_symbols == DWARF_DEBUG)
3133 TIMEVAR (symout_time,
3139 #ifdef DWARF2_UNWIND_INFO
3140 if (dwarf2out_do_frame ())
3141 dwarf2out_frame_finish ();
3144 #ifdef DWARF2_DEBUGGING_INFO
3145 if (write_symbols == DWARF2_DEBUG)
3146 TIMEVAR (symout_time,
3148 dwarf2out_finish ();
3152 /* Output some stuff at end of file if nec. */
3154 end_final (dump_base_name);
3156 if (branch_prob_dump)
3157 open_dump_file (".bp", NULL);
3159 TIMEVAR (dump_time, end_branch_prob (rtl_dump_file));
3161 if (branch_prob_dump)
3162 close_dump_file (NULL, NULL_RTX);
3165 ASM_FILE_END (asm_out_file);
3169 /* Language-specific end of compilation actions. */
3173 /* Close the dump files. */
3175 if (flag_gen_aux_info)
3177 fclose (aux_info_file);
3179 unlink (aux_info_file_name);
3184 open_dump_file (".combine", NULL);
3185 TIMEVAR (dump_time, dump_combine_total_stats (rtl_dump_file));
3186 close_dump_file (NULL, NULL_RTX);
3189 /* Close non-debugging input and output files. Take special care to note
3190 whether fclose returns an error, since the pages might still be on the
3191 buffer chain while the file is open. */
3195 if (! flag_syntax_only
3196 && (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0))
3197 fatal_io_error (asm_file_name);
3199 /* Do whatever is necessary to finish printing the graphs. */
3200 if (graph_dump_format != no_graph)
3203 finish_graph_dump_file (dump_base_name, ".jump");
3205 finish_graph_dump_file (dump_base_name, ".addressof");
3207 finish_graph_dump_file (dump_base_name, ".cse");
3209 finish_graph_dump_file (dump_base_name, ".loop");
3211 finish_graph_dump_file (dump_base_name, ".cse2");
3212 if (branch_prob_dump)
3213 finish_graph_dump_file (dump_base_name, ".bp");
3215 finish_graph_dump_file (dump_base_name, ".flow");
3217 finish_graph_dump_file (dump_base_name, ".combine");
3219 finish_graph_dump_file (dump_base_name, ".regmove");
3221 finish_graph_dump_file (dump_base_name, ".sched");
3223 finish_graph_dump_file (dump_base_name, ".lreg");
3224 if (global_reg_dump)
3225 finish_graph_dump_file (dump_base_name, ".greg");
3227 finish_graph_dump_file (dump_base_name, ".sched2");
3229 finish_graph_dump_file (dump_base_name, ".jump2");
3232 finish_graph_dump_file (dump_base_name, ".dbr");
3235 finish_graph_dump_file (dump_base_name, ".gcse");
3238 finish_graph_dump_file (dump_base_name, ".stack");
3240 #ifdef MACHINE_DEPENDENT_REORG
3241 if (mach_dep_reorg_dump)
3242 finish_graph_dump_file (dump_base_name, ".mach");
3246 /* Free up memory for the benefit of leak detectors. */
3249 /* Print the times. */
3253 fprintf (stderr,"\n");
3254 print_time ("parse", parse_time);
3256 print_time ("integration", integration_time);
3257 print_time ("jump", jump_time);
3258 print_time ("cse", cse_time);
3259 print_time ("gcse", gcse_time);
3260 print_time ("loop", loop_time);
3261 print_time ("cse2", cse2_time);
3262 print_time ("branch-prob", branch_prob_time);
3263 print_time ("flow", flow_time);
3264 print_time ("combine", combine_time);
3265 print_time ("regmove", regmove_time);
3266 print_time ("sched", sched_time);
3267 print_time ("local-alloc", local_alloc_time);
3268 print_time ("global-alloc", global_alloc_time);
3269 print_time ("sched2", sched2_time);
3271 print_time ("dbranch", dbr_sched_time);
3273 print_time ("shorten-branch", shorten_branch_time);
3274 print_time ("stack-reg", stack_reg_time);
3275 print_time ("final", final_time);
3276 print_time ("varconst", varconst_time);
3277 print_time ("symout", symout_time);
3278 print_time ("dump", dump_time);
3282 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
3283 and TYPE_DECL nodes.
3285 This does nothing for local (non-static) variables.
3286 Otherwise, it sets up the RTL and outputs any assembler code
3287 (label definition, storage allocation and initialization).
3289 DECL is the declaration. If ASMSPEC is nonzero, it specifies
3290 the assembler symbol name to be used. TOP_LEVEL is nonzero
3291 if this declaration is not within a function. */
3294 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
3300 /* Declarations of variables, and of functions defined elsewhere. */
3302 /* The most obvious approach, to put an #ifndef around where
3303 this macro is used, doesn't work since it's inside a macro call. */
3304 #ifndef ASM_FINISH_DECLARE_OBJECT
3305 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
3308 /* Forward declarations for nested functions are not "external",
3309 but we need to treat them as if they were. */
3310 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
3311 || TREE_CODE (decl) == FUNCTION_DECL)
3312 TIMEVAR (varconst_time,
3314 make_decl_rtl (decl, asmspec, top_level);
3315 /* Initialized extern variable exists to be replaced
3316 with its value, or represents something that will be
3317 output in another file. */
3318 if (! (TREE_CODE (decl) == VAR_DECL
3319 && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
3320 && DECL_INITIAL (decl) != 0
3321 && DECL_INITIAL (decl) != error_mark_node))
3322 /* Don't output anything
3323 when a tentative file-scope definition is seen.
3324 But at end of compilation, do output code for them. */
3325 if (! (! at_end && top_level
3326 && (DECL_INITIAL (decl) == 0
3327 || DECL_INITIAL (decl) == error_mark_node)))
3328 assemble_variable (decl, top_level, at_end, 0);
3329 if (decl == last_assemble_variable_decl)
3331 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
3335 else if (DECL_REGISTER (decl) && asmspec != 0)
3337 if (decode_reg_name (asmspec) >= 0)
3339 DECL_RTL (decl) = 0;
3340 make_decl_rtl (decl, asmspec, top_level);
3343 error ("invalid register name `%s' for register variable", asmspec);
3345 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
3346 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
3347 && TREE_CODE (decl) == TYPE_DECL)
3348 TIMEVAR (symout_time, dbxout_symbol (decl, 0));
3350 #ifdef SDB_DEBUGGING_INFO
3351 else if (write_symbols == SDB_DEBUG && top_level
3352 && TREE_CODE (decl) == TYPE_DECL)
3353 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
3357 /* Called after finishing a record, union or enumeral type. */
3360 rest_of_type_compilation (type, toplev)
3361 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
3365 tree type ATTRIBUTE_UNUSED;
3366 int toplev ATTRIBUTE_UNUSED;
3369 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
3370 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
3371 TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
3373 #ifdef SDB_DEBUGGING_INFO
3374 if (write_symbols == SDB_DEBUG)
3375 TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
3379 /* This is called from finish_function (within yyparse)
3380 after each top-level definition is parsed.
3381 It is supposed to compile that function or variable
3382 and output the assembler code for it.
3383 After we return, the tree storage is freed. */
3386 rest_of_compilation (decl)
3390 int start_time = get_run_time ();
3392 /* Nonzero if we have saved the original DECL_INITIAL of the function,
3393 to be restored after we finish compiling the function
3394 (for use when compiling inline calls to this function). */
3395 tree saved_block_tree = 0;
3396 /* Likewise, for DECL_ARGUMENTS. */
3397 tree saved_arguments = 0;
3400 /* If we are reconsidering an inline function
3401 at the end of compilation, skip the stuff for making it inline. */
3403 if (DECL_SAVED_INSNS (decl) == 0)
3408 /* If requested, consider whether to make this function inline. */
3409 if (DECL_INLINE (decl) || flag_inline_functions)
3410 TIMEVAR (integration_time,
3412 lose = function_cannot_inline_p (decl);
3413 if (lose || ! optimize)
3415 if (warn_inline && DECL_INLINE (decl))
3416 warning_with_decl (decl, lose);
3417 DECL_ABSTRACT_ORIGIN (decl) = 0;
3418 /* Don't really compile an extern inline function.
3419 If we can't make it inline, pretend
3420 it was only declared. */
3421 if (DECL_EXTERNAL (decl))
3423 DECL_INITIAL (decl) = 0;
3424 goto exit_rest_of_compilation;
3428 /* ??? Note that this has the effect of making it look
3429 like "inline" was specified for a function if we choose
3430 to inline it. This isn't quite right, but it's
3431 probably not worth the trouble to fix. */
3432 inlinable = DECL_INLINE (decl) = 1;
3435 insns = get_insns ();
3437 /* Dump the rtl code if we are dumping rtl. */
3441 open_dump_file (".rtl", decl_printable_name (decl, 2));
3443 if (DECL_SAVED_INSNS (decl))
3444 fprintf (rtl_dump_file, ";; (integrable)\n\n");
3446 close_dump_file (print_rtl, insns);
3449 /* If we can, defer compiling inlines until EOF.
3450 save_for_inline_copying can be extremely expensive. */
3451 if (inlinable && ! decl_function_context (decl))
3452 DECL_DEFER_OUTPUT (decl) = 1;
3454 /* If function is inline, and we don't yet know whether to
3455 compile it by itself, defer decision till end of compilation.
3456 finish_compilation will call rest_of_compilation again
3457 for those functions that need to be output. Also defer those
3458 functions that we are supposed to defer. We cannot defer
3459 functions containing nested functions since the nested function
3460 data is in our non-saved obstack. We cannot defer nested
3461 functions for the same reason. */
3463 /* If this is a nested inline, remove ADDRESSOF now so we can
3464 finish compiling ourselves. Otherwise, wait until EOF.
3465 We have to do this because the purge_addressof transformation
3466 changes the DECL_RTL for many variables, which confuses integrate. */
3469 if (decl_function_context (decl))
3470 purge_addressof (insns);
3472 DECL_DEFER_OUTPUT (decl) = 1;
3475 if (! current_function_contains_functions
3476 && (DECL_DEFER_OUTPUT (decl)
3477 || (DECL_INLINE (decl)
3478 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
3479 && ! flag_keep_inline_functions)
3480 || DECL_EXTERNAL (decl)))))
3482 DECL_DEFER_OUTPUT (decl) = 1;
3484 /* If -Wreturn-type, we have to do a bit of compilation.
3485 However, if we just fall through we will call
3486 save_for_inline_copying() which results in excessive
3487 memory use. Instead, we just want to call
3488 jump_optimize() to figure out whether or not we can fall
3489 off the end of the function; we do the minimum amount of
3490 work necessary to make that safe. And, we set optimize
3491 to zero to keep jump_optimize from working too hard. */
3492 if (warn_return_type)
3494 int saved_optimize = optimize;
3496 find_exception_handler_labels ();
3497 jump_optimize (get_insns(), !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
3498 !JUMP_AFTER_REGSCAN);
3499 optimize = saved_optimize;
3502 #ifdef DWARF_DEBUGGING_INFO
3503 /* Generate the DWARF info for the "abstract" instance
3504 of a function which we may later generate inlined and/or
3505 out-of-line instances of. */
3506 if (write_symbols == DWARF_DEBUG)
3508 set_decl_abstract_flags (decl, 1);
3509 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
3510 set_decl_abstract_flags (decl, 0);
3513 #ifdef DWARF2_DEBUGGING_INFO
3514 /* Generate the DWARF2 info for the "abstract" instance
3515 of a function which we may later generate inlined and/or
3516 out-of-line instances of. */
3517 if (write_symbols == DWARF2_DEBUG)
3519 set_decl_abstract_flags (decl, 1);
3520 TIMEVAR (symout_time, dwarf2out_decl (decl));
3521 set_decl_abstract_flags (decl, 0);
3524 TIMEVAR (integration_time, save_for_inline_nocopy (decl));
3525 RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlinable;
3526 goto exit_rest_of_compilation;
3529 /* If we have to compile the function now, save its rtl and subdecls
3530 so that its compilation will not affect what others get. */
3531 if (inlinable || DECL_DEFER_OUTPUT (decl))
3533 #ifdef DWARF_DEBUGGING_INFO
3534 /* Generate the DWARF info for the "abstract" instance of
3535 a function which we will generate an out-of-line instance
3536 of almost immediately (and which we may also later generate
3537 various inlined instances of). */
3538 if (write_symbols == DWARF_DEBUG)
3540 set_decl_abstract_flags (decl, 1);
3541 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
3542 set_decl_abstract_flags (decl, 0);
3545 #ifdef DWARF2_DEBUGGING_INFO
3546 /* Generate the DWARF2 info for the "abstract" instance of
3547 a function which we will generate an out-of-line instance
3548 of almost immediately (and which we may also later generate
3549 various inlined instances of). */
3550 if (write_symbols == DWARF2_DEBUG)
3552 set_decl_abstract_flags (decl, 1);
3553 TIMEVAR (symout_time, dwarf2out_decl (decl));
3554 set_decl_abstract_flags (decl, 0);
3557 saved_block_tree = DECL_INITIAL (decl);
3558 saved_arguments = DECL_ARGUMENTS (decl);
3559 TIMEVAR (integration_time, save_for_inline_copying (decl));
3560 RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlinable;
3563 /* If specified extern inline but we aren't inlining it, we are
3564 done. This goes for anything that gets here with DECL_EXTERNAL
3565 set, not just things with DECL_INLINE. */
3566 if (DECL_EXTERNAL (decl))
3567 goto exit_rest_of_compilation;
3570 if (! DECL_DEFER_OUTPUT (decl))
3571 TREE_ASM_WRITTEN (decl) = 1;
3573 /* Now that integrate will no longer see our rtl, we need not distinguish
3574 between the return value of this function and the return value of called
3576 rtx_equal_function_value_matters = 0;
3578 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
3579 if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
3581 goto exit_rest_of_compilation;
3584 /* Emit code to get eh context, if needed. */
3588 /* If we are doing position-independent code generation, now
3589 is the time to output special prologues and epilogues.
3590 We do not want to do this earlier, because it just clutters
3591 up inline functions with meaningless insns. */
3596 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
3597 Note that that may have been done above, in save_for_inline_copying.
3598 The call to resume_temporary_allocation near the end of this function
3599 goes back to the usual state of affairs. This must be done after
3600 we've built up any unwinders for exception handling, and done
3601 the FINALIZE_PIC work, if necessary. */
3603 rtl_in_current_obstack ();
3605 insns = get_insns ();
3607 /* Copy any shared structure that should not be shared. */
3609 unshare_all_rtl (insns);
3611 #ifdef SETJMP_VIA_SAVE_AREA
3612 /* This must be performed before virutal register instantiation. */
3613 if (current_function_calls_alloca)
3614 optimize_save_area_alloca (insns);
3617 /* Instantiate all virtual registers. */
3619 instantiate_virtual_regs (current_function_decl, get_insns ());
3621 /* See if we have allocated stack slots that are not directly addressable.
3622 If so, scan all the insns and create explicit address computation
3623 for all references to such slots. */
3624 /* fixup_stack_slots (); */
3626 /* Find all the EH handlers. */
3627 find_exception_handler_labels ();
3629 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
3630 are initialized and to compute whether control can drop off the end
3632 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3633 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
3634 JUMP_AFTER_REGSCAN));
3636 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
3637 if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
3638 goto exit_rest_of_compilation;
3640 /* Dump rtl code after jump, if we are doing that. */
3643 dump_rtl (".jump", decl, print_rtl, insns);
3645 /* Perform common subexpression elimination.
3646 Nonzero value from `cse_main' means that jumps were simplified
3647 and some code may now be unreachable, so do
3648 jump optimization again. */
3653 open_dump_file (".cse", decl_printable_name (decl, 2));
3655 TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
3657 if (flag_thread_jumps)
3658 /* Hacks by tiemann & kenner. */
3659 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 1));
3661 TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
3663 TIMEVAR (cse_time, delete_trivially_dead_insns (insns, max_reg_num ()));
3665 if (tem || optimize > 1)
3666 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3668 !JUMP_AFTER_REGSCAN));
3670 /* Dump rtl code after cse, if we are doing that. */
3674 close_dump_file (print_rtl, insns);
3675 if (graph_dump_format != no_graph)
3676 print_rtl_graph_with_bb (dump_base_name, ".cse", insns);
3680 purge_addressof (insns);
3681 reg_scan (insns, max_reg_num (), 1);
3685 dump_rtl (".addressof", decl, print_rtl, insns);
3686 if (graph_dump_format != no_graph)
3687 print_rtl_graph_with_bb (dump_base_name, ".addressof", insns);
3690 /* Perform global cse. */
3692 if (optimize > 0 && flag_gcse)
3695 open_dump_file (".gcse", IDENTIFIER_POINTER (DECL_NAME (decl)));
3697 TIMEVAR (gcse_time, gcse_main (insns, rtl_dump_file));
3701 close_dump_file (print_rtl, insns);
3702 if (graph_dump_format != no_graph)
3703 print_rtl_graph_with_bb (dump_base_name, ".gcse", insns);
3706 /* Move constant computations out of loops. */
3711 open_dump_file (".loop", decl_printable_name (decl, 2));
3716 if (flag_rerun_loop_opt)
3718 /* We only want to perform unrolling once. */
3720 loop_optimize (insns, rtl_dump_file, 0, 0);
3723 /* The first call to loop_optimize makes some instructions
3724 trivially dead. We delete those instructions now in the
3725 hope that doing so will make the heuristics in loop work
3726 better and possibly speed up compilation. */
3727 delete_trivially_dead_insns (insns, max_reg_num ());
3729 /* The regscan pass is currently necessary as the alias
3730 analysis code depends on this information. */
3731 reg_scan (insns, max_reg_num (), 1);
3733 loop_optimize (insns, rtl_dump_file, flag_unroll_loops, 1);
3736 /* Dump rtl code after loop opt, if we are doing that. */
3740 close_dump_file (print_rtl, insns);
3741 if (graph_dump_format != no_graph)
3742 print_rtl_graph_with_bb (dump_base_name, ".loop", insns);
3749 open_dump_file (".cse2", decl_printable_name (decl, 2));
3751 if (flag_rerun_cse_after_loop)
3753 /* Running another jump optimization pass before the second
3754 cse pass sometimes simplifies the RTL enough to allow
3755 the second CSE pass to do a better job. Jump_optimize can change
3756 max_reg_num so we must rerun reg_scan afterwards.
3757 ??? Rework to not call reg_scan so often. */
3758 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3759 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3761 JUMP_AFTER_REGSCAN));
3763 TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
3764 TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
3767 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3769 !JUMP_AFTER_REGSCAN));
3772 if (flag_thread_jumps)
3774 /* This pass of jump threading straightens out code
3775 that was kinked by loop optimization. */
3776 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3777 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
3780 /* Dump rtl code after cse, if we are doing that. */
3784 close_dump_file (print_rtl, insns);
3785 if (graph_dump_format != no_graph)
3786 print_rtl_graph_with_bb (dump_base_name, ".cse2", insns);
3790 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
3792 if (branch_prob_dump)
3793 open_dump_file (".bp", decl_printable_name (decl, 2));
3798 branch_prob (insns, rtl_dump_file);
3801 if (branch_prob_dump)
3803 close_dump_file (print_rtl, insns);
3804 if (graph_dump_format != no_graph)
3805 print_rtl_graph_with_bb (dump_base_name, ".bp", insns);
3809 /* We are no longer anticipating cse in this function, at least. */
3811 cse_not_expected = 1;
3813 /* Now we choose between stupid (pcc-like) register allocation
3814 (if we got the -noreg switch and not -opt)
3815 and smart register allocation. */
3817 if (optimize > 0) /* Stupid allocation probably won't work */
3818 obey_regdecls = 0; /* if optimizations being done. */
3822 /* Print function header into flow dump now
3823 because doing the flow analysis makes some of the dump. */
3826 open_dump_file (".flow", decl_printable_name (decl, 2));
3832 regclass (insns, max_reg_num ());
3833 stupid_life_analysis (insns, max_reg_num (),
3839 /* Do control and data flow analysis,
3840 and write some of the results to dump file. */
3845 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3846 life_analysis (insns, max_reg_num (), rtl_dump_file);
3849 if (warn_uninitialized)
3851 uninitialized_vars_warning (DECL_INITIAL (decl));
3852 setjmp_args_warning ();
3856 /* Dump rtl after flow analysis. */
3860 close_dump_file (print_rtl_with_bb, insns);
3861 if (graph_dump_format != no_graph)
3862 print_rtl_graph_with_bb (dump_base_name, ".flow", insns);
3865 /* The first life analysis pass has finished. From now on we can not
3866 generate any new pseudos. */
3869 /* If -opt, try combining insns through substitution. */
3873 TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
3875 /* Dump rtl code after insn combination. */
3879 dump_rtl (".combine", decl, print_rtl_with_bb, insns);
3880 if (graph_dump_format != no_graph)
3881 print_rtl_graph_with_bb (dump_base_name, ".combine", insns);
3885 /* Register allocation pre-pass, to reduce number of moves
3886 necessary for two-address machines. */
3887 if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
3890 open_dump_file (".regmove", decl_printable_name (decl, 2));
3892 TIMEVAR (regmove_time, regmove_optimize (insns, max_reg_num (),
3897 close_dump_file (print_rtl_with_bb, insns);
3898 if (graph_dump_format != no_graph)
3899 print_rtl_graph_with_bb (dump_base_name, ".regmove", insns);
3903 /* Print function header into sched dump now
3904 because doing the sched analysis makes some of the dump. */
3906 if (optimize > 0 && flag_schedule_insns)
3909 open_dump_file (".sched", decl_printable_name (decl, 2));
3911 /* Do control and data sched analysis,
3912 and write some of the results to dump file. */
3914 TIMEVAR (sched_time, schedule_insns (rtl_dump_file));
3916 /* Dump rtl after instruction scheduling. */
3920 close_dump_file (print_rtl_with_bb, insns);
3921 if (graph_dump_format != no_graph)
3922 print_rtl_graph_with_bb (dump_base_name, ".sched", insns);
3926 /* Unless we did stupid register allocation,
3927 allocate pseudo-regs that are used only within 1 basic block. */
3930 TIMEVAR (local_alloc_time,
3932 recompute_reg_usage (insns, ! optimize_size);
3933 regclass (insns, max_reg_num ());
3937 /* Dump rtl code after allocating regs within basic blocks. */
3941 open_dump_file (".lreg", decl_printable_name (decl, 2));
3943 TIMEVAR (dump_time, dump_flow_info (rtl_dump_file));
3944 TIMEVAR (dump_time, dump_local_alloc (rtl_dump_file));
3946 close_dump_file (print_rtl_with_bb, insns);
3947 if (graph_dump_format != no_graph)
3948 print_rtl_graph_with_bb (dump_base_name, ".lreg", insns);
3951 if (global_reg_dump)
3952 open_dump_file (".greg", decl_printable_name (decl, 2));
3954 /* Unless we did stupid register allocation,
3955 allocate remaining pseudo-regs, then do the reload pass
3956 fixing up any insns that are invalid. */
3958 TIMEVAR (global_alloc_time,
3961 failure = global_alloc (rtl_dump_file);
3963 failure = reload (insns, 0, rtl_dump_file);
3968 goto exit_rest_of_compilation;
3970 reload_completed = 1;
3972 /* Do a very simple CSE pass over just the hard registers. */
3974 reload_cse_regs (insns);
3976 /* If optimizing and we are performing instruction scheduling after
3977 reload, then go ahead and split insns now since we are about to
3978 recompute flow information anyway.
3980 reload_cse_regs may expose more splitting opportunities, expecially
3981 for double-word operations. */
3982 if (optimize > 0 && flag_schedule_insns_after_reload)
3986 for (insn = insns; insn; insn = NEXT_INSN (insn))
3990 if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
3993 last = try_split (PATTERN (insn), insn, 1);
3997 PUT_CODE (insn, NOTE);
3998 NOTE_SOURCE_FILE (insn) = 0;
3999 NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
4004 /* Re-create the death notes which were deleted during reload. */
4009 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
4010 life_analysis (insns, max_reg_num (), rtl_dump_file);
4013 flow2_completed = 1;
4015 /* On some machines, the prologue and epilogue code, or parts thereof,
4016 can be represented as RTL. Doing so lets us schedule insns between
4017 it and the rest of the code and also allows delayed branch
4018 scheduling to operate in the epilogue. */
4020 thread_prologue_and_epilogue_insns (insns);
4022 if (global_reg_dump)
4024 TIMEVAR (dump_time, dump_global_regs (rtl_dump_file));
4025 close_dump_file (print_rtl_with_bb, insns);
4026 if (graph_dump_format != no_graph)
4027 print_rtl_graph_with_bb (dump_base_name, ".greg", insns);
4029 if (optimize > 0 && flag_schedule_insns_after_reload)
4032 open_dump_file (".sched2", decl_printable_name (decl, 2));
4034 /* Do control and data sched analysis again,
4035 and write some more of the results to dump file. */
4037 TIMEVAR (sched2_time, schedule_insns (rtl_dump_file));
4039 /* Dump rtl after post-reorder instruction scheduling. */
4043 close_dump_file (print_rtl_with_bb, insns);
4044 if (graph_dump_format != no_graph)
4045 print_rtl_graph_with_bb (dump_base_name, ".sched2", insns);
4049 #ifdef LEAF_REGISTERS
4051 if (optimize > 0 && only_leaf_regs_used () && leaf_function_p ())
4055 /* One more attempt to remove jumps to .+1
4056 left by dead-store-elimination.
4057 Also do cross-jumping this time
4058 and delete no-op move insns. */
4062 TIMEVAR (jump_time, jump_optimize (insns, JUMP_CROSS_JUMP,
4064 !JUMP_AFTER_REGSCAN));
4066 /* Dump rtl code after jump, if we are doing that. */
4070 dump_rtl (".jump2", decl, print_rtl_with_bb, insns);
4071 if (graph_dump_format != no_graph)
4072 print_rtl_graph_with_bb (dump_base_name, ".jump2", insns);
4076 /* If a machine dependent reorganization is needed, call it. */
4077 #ifdef MACHINE_DEPENDENT_REORG
4078 MACHINE_DEPENDENT_REORG (insns);
4080 if (mach_dep_reorg_dump)
4082 dump_rtl (".mach", decl, print_rtl_with_bb, insns);
4083 if (graph_dump_format != no_graph)
4084 print_rtl_graph_with_bb (dump_base_name, ".mach", insns);
4088 /* If a scheduling pass for delayed branches is to be done,
4089 call the scheduling code. */
4092 if (optimize > 0 && flag_delayed_branch)
4094 TIMEVAR (dbr_sched_time, dbr_schedule (insns, rtl_dump_file));
4098 dump_rtl (".dbr", decl, print_rtl_with_bb, insns);
4099 if (graph_dump_format != no_graph)
4100 print_rtl_graph_with_bb (dump_base_name, ".dbr", insns);
4105 /* Shorten branches. */
4106 TIMEVAR (shorten_branch_time,
4108 shorten_branches (get_insns ());
4113 open_dump_file (".stack", decl_printable_name (decl, 2));
4115 TIMEVAR (stack_reg_time, reg_to_stack (insns, rtl_dump_file));
4119 dump_rtl (".stack", decl, print_rtl_with_bb, insns);
4120 if (graph_dump_format != no_graph)
4121 print_rtl_graph_with_bb (dump_base_name, ".stack", insns);
4125 /* Now turn the rtl into assembler code. */
4127 TIMEVAR (final_time,
4132 /* Get the function's name, as described by its RTL.
4133 This may be different from the DECL_NAME name used
4134 in the source file. */
4136 x = DECL_RTL (decl);
4137 if (GET_CODE (x) != MEM)
4140 if (GET_CODE (x) != SYMBOL_REF)
4142 fnname = XSTR (x, 0);
4144 assemble_start_function (decl, fnname);
4145 final_start_function (insns, asm_out_file, optimize);
4146 final (insns, asm_out_file, optimize, 0);
4147 final_end_function (insns, asm_out_file, optimize);
4148 assemble_end_function (decl, fnname);
4150 fflush (asm_out_file);
4152 /* Release all memory held by regsets now */
4153 regset_release_memory ();
4156 /* Write DBX symbols if requested */
4158 /* Note that for those inline functions where we don't initially
4159 know for certain that we will be generating an out-of-line copy,
4160 the first invocation of this routine (rest_of_compilation) will
4161 skip over this code by doing a `goto exit_rest_of_compilation;'.
4162 Later on, finish_compilation will call rest_of_compilation again
4163 for those inline functions that need to have out-of-line copies
4164 generated. During that call, we *will* be routed past here. */
4166 #ifdef DBX_DEBUGGING_INFO
4167 if (write_symbols == DBX_DEBUG)
4168 TIMEVAR (symout_time, dbxout_function (decl));
4171 #ifdef DWARF_DEBUGGING_INFO
4172 if (write_symbols == DWARF_DEBUG)
4173 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
4176 #ifdef DWARF2_DEBUGGING_INFO
4177 if (write_symbols == DWARF2_DEBUG)
4178 TIMEVAR (symout_time, dwarf2out_decl (decl));
4181 exit_rest_of_compilation:
4185 /* In case the function was not output,
4186 don't leave any temporary anonymous types
4187 queued up for sdb output. */
4188 #ifdef SDB_DEBUGGING_INFO
4189 if (write_symbols == SDB_DEBUG)
4190 sdbout_types (NULL_TREE);
4193 /* Put back the tree of subblocks and list of arguments
4194 from before we copied them.
4195 Code generation and the output of debugging info may have modified
4196 the copy, but the original is unchanged. */
4198 if (saved_block_tree != 0)
4200 DECL_INITIAL (decl) = saved_block_tree;
4201 DECL_ARGUMENTS (decl) = saved_arguments;
4202 DECL_ABSTRACT_ORIGIN (decl) = NULL_TREE;
4205 reload_completed = 0;
4206 flow2_completed = 0;
4209 TIMEVAR (final_time,
4211 /* Clear out the insn_length contents now that they are no
4213 init_insn_lengths ();
4215 /* Clear out the real_constant_chain before some of the rtx's
4216 it runs through become garbage. */
4217 clear_const_double_mem ();
4219 /* Cancel the effect of rtl_in_current_obstack. */
4220 resume_temporary_allocation ();
4222 /* Show no temporary slots allocated. */
4226 /* Make sure volatile mem refs aren't considered valid operands for
4227 arithmetic insns. We must call this here if this is a nested inline
4228 function, since the above code leaves us in the init_recog state
4229 (from final.c), and the function context push/pop code does not
4230 save/restore volatile_ok.
4232 ??? Maybe it isn't necessary for expand_start_function to call this
4233 anymore if we do it here? */
4235 init_recog_no_volatile ();
4237 /* The parsing time is all the time spent in yyparse
4238 *except* what is spent in this function. */
4240 parse_time -= get_run_time () - start_time;
4242 /* Reset global variables. */
4243 free_basic_block_vars (0);
4254 printf ("Usage: %s input [switches]\n", progname);
4255 printf ("Switches:\n");
4257 printf (" -ffixed-<register> Mark <register> as being unavailable to the compiler\n");
4258 printf (" -fcall-used-<register> Mark <register> as being corrupted by function calls\n");
4259 printf (" -fcall-saved-<register> Mark <register> as being preserved across functions\n");
4261 for (i = NUM_ELEM (f_options); i--;)
4263 char * description = f_options[i].description;
4265 if (description != NULL && * description != 0)
4266 printf (" -f%-21s %s\n",
4267 f_options[i].string, description);
4270 printf (" -O[number] Set optimisation level to [number]\n");
4271 printf (" -Os Optimise for space rather than speed\n");
4272 printf (" -pedantic Issue warnings needed by strict compliance to ANSI C\n");
4273 printf (" -pedantic-errors Like -pedantic except that errors are produced\n");
4274 printf (" -w Suppress warnings\n");
4275 printf (" -W Enable extra warnings\n");
4277 for (i = NUM_ELEM (W_options); i--;)
4279 char * description = W_options[i].description;
4281 if (description != NULL && * description != 0)
4282 printf (" -W%-21s %s\n",
4283 W_options[i].string, description);
4286 printf (" -Wid-clash-<num> Warn if 2 identifiers have the same first <num> chars\n");
4287 printf (" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n");
4288 printf (" -p Enable function profiling\n");
4289 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER)
4290 printf (" -a Enable block profiling \n");
4292 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER) || defined FUNCTION_BLOCK_PROFILER_EXIT
4293 printf (" -ax Enable jump profiling \n");
4295 printf (" -o <file> Place output into <file> \n");
4296 printf (" -G <number> Put global and static data smaller than <number>\n");
4297 printf (" bytes into a special section (on some targets)\n");
4299 for (i = NUM_ELEM (debug_args); i--;)
4301 if (debug_args[i].description != NULL)
4302 printf (" -%-22s %s\n", debug_args[i].arg, debug_args[i].description);
4305 printf (" -aux-info <file> Emit declaration info into <file>.X\n");
4306 printf (" -quiet Do not display functions compiled or elapsed time\n");
4307 printf (" -version Display the compiler's version\n");
4308 printf (" -d[letters] Enable dumps from specific passes of the compiler\n");
4309 printf (" -dumpbase <file> Base name to be used for dumps from specific passes\n");
4310 #if defined HAIFA || defined INSN_SCHEDULING
4311 printf (" -sched-verbose-<number> Set the verbosity level of the scheduler\n");
4313 printf (" --help Display this information\n");
4318 /* Display descriptions of language specific options.
4319 If there is no description, note that there is an undocumented option.
4320 If the description is empty, do not display anything. (This allows
4321 options to be deliberately undocumented, for whatever reason).
4322 If the option string is missing, then this is a marker, indicating
4323 that the description string is in fact the name of a language, whose
4324 language specific options are to follow. */
4326 if (NUM_ELEM (documented_lang_options) > 1)
4328 printf ("\nLanguage specific options:\n");
4330 for (i = 0; i < NUM_ELEM (documented_lang_options); i++)
4332 char * description = documented_lang_options[i].description;
4333 char * option = documented_lang_options[i].option;
4335 if (description == NULL)
4340 printf (" %-23.23s [undocumented]\n", option);
4342 else if (* description == 0)
4344 else if (option == NULL)
4348 ("\nThere are undocumented %s specific options as well.\n",
4352 printf ("\n Options for %s:\n", description);
4357 printf (" %-23.23s %s\n", option, description);
4362 printf ("\nThere are undocumented %s specific options as well.\n", lang);
4364 if (NUM_ELEM (target_switches) > 1
4365 #ifdef TARGET_OPTIONS
4366 || NUM_ELEM (target_options) > 1
4374 printf ("\nTarget specific options:\n");
4376 for (i = NUM_ELEM (target_switches); i--;)
4378 char * option = target_switches[i].name;
4379 char * description = target_switches[i].description;
4381 if (option == NULL || * option == 0)
4383 else if (description == NULL)
4388 printf (" -m%-21.21s [undocumented]\n", option);
4390 else if (* description != 0)
4391 doc += printf (" -m%-21.21s %s\n", option, description);
4394 #ifdef TARGET_OPTIONS
4395 for (i = NUM_ELEM (target_options); i--;)
4397 char * option = target_options[i].prefix;
4398 char * description = target_options[i].description;
4400 if (option == NULL || * option == 0)
4402 else if (description == NULL)
4407 printf (" -m%-21.21s [undocumented]\n", option);
4409 else if (* description != 0)
4410 doc += printf (" -m%-21.21s %s\n", option, description);
4416 printf ("\nThere are undocumented target specific options as well.\n");
4418 printf (" They exist, but they are not documented.\n");
4423 /* Compare the user specified 'option' with the language
4424 specific 'lang_option'. Return true if they match, or
4425 if 'option' is a viable prefix of 'lang_option'. */
4428 check_lang_option (option, lang_option)
4432 lang_independent_options * indep_options;
4437 /* Ignore NULL entries. */
4438 if (option == NULL || lang_option == NULL)
4441 if ((space = strchr (lang_option, ' ')) != NULL)
4442 len = space - lang_option;
4444 len = strlen (lang_option);
4446 /* If they do not match to the first n characters then fail. */
4447 if (strncmp (option, lang_option, len) != 0)
4450 /* Do not accept a lang option, if it matches a normal -f or -W
4451 option. Chill defines a -fpack, but we want to support
4454 /* An exact match is OK */
4455 if ((int) strlen (option) == len)
4458 /* If it is not an -f or -W option allow the match */
4459 if (option[0] != '-')
4464 case 'f': indep_options = f_options; break;
4465 case 'W': indep_options = W_options; break;
4469 /* The option is a -f or -W option.
4470 Skip past the prefix and search for the remainder in the
4471 appropriate table of options. */
4474 if (option[0] == 'n' && option[1] == 'o' && option[2] == '-')
4477 for (k = NUM_ELEM (indep_options); k--;)
4479 if (!strcmp (option, indep_options[k].string))
4481 /* The option matched a language independent option,
4482 do not allow the language specific match. */
4488 /* The option matches the start of the langauge specific option
4489 and it is not an exact match for a language independent option. */
4493 /* Entry point of cc1/c++. Decode command args, then call compile_file.
4494 Exit code is 35 if can't open files, 34 if fatal error,
4495 33 if had nonfatal errors, else success. */
4504 int flag_print_mem = 0;
4505 int version_flag = 0;
4508 /* save in case md file wants to emit args as a comment. */
4512 p = argv[0] + strlen (argv[0]);
4513 while (p != argv[0] && p[-1] != '/'
4514 #ifdef DIR_SEPARATOR
4515 && p[-1] != DIR_SEPARATOR
4521 #if defined (RLIMIT_STACK) && defined (HAVE_GETRLIMIT) && defined (HAVE_SETRLIMIT)
4522 /* Get rid of any avoidable limit on stack size. */
4526 /* Set the stack limit huge so that alloca does not fail. */
4527 getrlimit (RLIMIT_STACK, &rlim);
4528 rlim.rlim_cur = rlim.rlim_max;
4529 setrlimit (RLIMIT_STACK, &rlim);
4533 signal (SIGFPE, float_signal);
4536 signal (SIGPIPE, pipe_closed);
4539 decl_printable_name = decl_name;
4540 lang_expand_expr = (lang_expand_expr_t) do_abort;
4542 /* Initialize whether `char' is signed. */
4543 flag_signed_char = DEFAULT_SIGNED_CHAR;
4544 #ifdef DEFAULT_SHORT_ENUMS
4545 /* Initialize how much space enums occupy, by default. */
4546 flag_short_enums = DEFAULT_SHORT_ENUMS;
4549 /* Perform language-specific options intialization. */
4550 lang_init_options ();
4552 /* Scan to see what optimization level has been specified. That will
4553 determine the default value of many flags. */
4554 for (i = 1; i < argc; i++)
4556 if (!strcmp (argv[i], "-O"))
4561 else if (argv[i][0] == '-' && argv[i][1] == 'O')
4563 /* Handle -Os, -O2, -O3, -O69, ... */
4564 char *p = &argv[i][2];
4567 if ((p[0] == 's') && (p[1] == 0))
4571 /* Optimizing for size forces optimize to be 2. */
4577 if (! (c >= '0' && c <= '9'))
4581 optimize = atoi (&argv[i][2]);
4588 obey_regdecls = (optimize == 0);
4593 flag_thread_jumps = 1;
4595 flag_delayed_branch = 1;
4597 #ifdef CAN_DEBUG_WITHOUT_FP
4598 flag_omit_frame_pointer = 1;
4604 flag_cse_follow_jumps = 1;
4605 flag_cse_skip_blocks = 1;
4607 flag_expensive_optimizations = 1;
4608 flag_strength_reduce = 1;
4609 flag_rerun_cse_after_loop = 1;
4610 flag_rerun_loop_opt = 1;
4611 flag_caller_saves = 1;
4613 #ifdef INSN_SCHEDULING
4614 flag_schedule_insns = 1;
4615 flag_schedule_insns_after_reload = 1;
4618 flag_strict_aliasing = 1;
4623 flag_inline_functions = 1;
4626 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
4629 set_target_switch ("");
4631 #ifdef OPTIMIZATION_OPTIONS
4632 /* Allow default optimizations to be specified on a per-machine basis. */
4633 OPTIMIZATION_OPTIONS (optimize, optimize_size);
4636 /* Initialize register usage now so switches may override. */
4639 for (i = 1; i < argc; i++)
4643 /* If this is a language-specific option,
4644 decode it in a language-specific way. */
4645 for (j = NUM_ELEM (documented_lang_options); j--;)
4646 if (check_lang_option (argv[i], documented_lang_options[j].option))
4649 if (j != (size_t)-1)
4651 /* If the option is valid for *some* language,
4652 treat it as valid even if this language doesn't understand it. */
4653 int strings_processed = lang_decode_option (argc - i, argv + i);
4655 if (!strcmp (argv[i], "--help"))
4661 if (strings_processed != 0)
4662 i += strings_processed - 1;
4664 else if (argv[i][0] == '-' && argv[i][1] != 0)
4666 register char *str = argv[i] + 1;
4671 set_target_switch (&str[1]);
4672 else if (!strcmp (str, "dumpbase"))
4674 dump_base_name = argv[++i];
4676 else if (str[0] == 'd')
4678 register char *p = &str[1];
4683 branch_prob_dump = 1;
4689 global_reg_dump = 1;
4697 cse_dump = 1, cse2_dump = 1;
4704 #ifdef MACHINE_DEPENDENT_REORG
4705 mach_dep_reorg_dump = 1;
4712 branch_prob_dump = 1;
4729 global_reg_dump = 1;
4754 #ifdef MACHINE_DEPENDENT_REORG
4756 mach_dep_reorg_dump = 1;
4760 flag_print_asm_name = 1;
4781 graph_dump_format = vcg;
4787 rtl_dump_and_exit = 1;
4789 case 'D': /* these are handled by the preprocessor */
4793 warning ("unrecognised gcc debugging option: %c", p[-1]);
4797 else if (str[0] == 'f')
4799 register char *p = &str[1];
4802 /* Some kind of -f option.
4803 P's value is the option sans `-f'.
4804 Search for it in the table of options. */
4807 !found && j < sizeof (f_options) / sizeof (f_options[0]);
4810 if (!strcmp (p, f_options[j].string))
4812 *f_options[j].variable = f_options[j].on_value;
4813 /* A goto here would be cleaner,
4814 but breaks the vax pcc. */
4817 if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
4818 && ! strcmp (p+3, f_options[j].string))
4820 *f_options[j].variable = ! f_options[j].on_value;
4828 #ifdef INSN_SCHEDULING
4829 else if (!strncmp (p, "sched-verbose-",14))
4830 fix_sched_param("verbose",&p[14]);
4833 else if (!strncmp (p, "fixed-", 6))
4834 fix_register (&p[6], 1, 1);
4835 else if (!strncmp (p, "call-used-", 10))
4836 fix_register (&p[10], 0, 1);
4837 else if (!strncmp (p, "call-saved-", 11))
4838 fix_register (&p[11], 0, 0);
4840 error ("Invalid option `%s'", argv[i]);
4842 else if (str[0] == 'O')
4844 register char *p = str+1;
4848 while (*p && *p >= '0' && *p <= '9')
4853 error ("Invalid option `%s'", argv[i]);
4855 else if (!strcmp (str, "pedantic"))
4857 else if (!strcmp (str, "pedantic-errors"))
4858 flag_pedantic_errors = pedantic = 1;
4859 else if (!strcmp (str, "quiet"))
4861 else if (!strcmp (str, "version"))
4863 else if (!strcmp (str, "w"))
4864 inhibit_warnings = 1;
4865 else if (!strcmp (str, "W"))
4868 /* We save the value of warn_uninitialized, since if they put
4869 -Wuninitialized on the command line, we need to generate a
4870 warning about not using it without also specifying -O. */
4871 if (warn_uninitialized != 1)
4872 warn_uninitialized = 2;
4874 else if (str[0] == 'W')
4876 register char *p = &str[1];
4879 /* Some kind of -W option.
4880 P's value is the option sans `-W'.
4881 Search for it in the table of options. */
4884 !found && j < sizeof (W_options) / sizeof (W_options[0]);
4887 if (!strcmp (p, W_options[j].string))
4889 *W_options[j].variable = W_options[j].on_value;
4890 /* A goto here would be cleaner,
4891 but breaks the vax pcc. */
4894 if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
4895 && ! strcmp (p+3, W_options[j].string))
4897 *W_options[j].variable = ! W_options[j].on_value;
4904 else if (!strncmp (p, "id-clash-", 9))
4910 if (*endp >= '0' && *endp <= '9')
4914 error ("Invalid option `%s'", argv[i]);
4919 id_clash_len = atoi (str + 10);
4922 else if (!strncmp (p, "larger-than-", 12))
4924 char *endp = p + 12;
4928 if (*endp >= '0' && *endp <= '9')
4932 error ("Invalid option `%s'", argv[i]);
4933 goto larger_than_lose;
4936 warn_larger_than = 1;
4937 larger_than_size = atoi (str + 13);
4941 error ("Invalid option `%s'", argv[i]);
4943 else if (!strcmp (str, "p"))
4947 else if (!strcmp (str, "a"))
4949 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4950 warning ("`-a' option (basic block profile) not supported");
4952 profile_block_flag = (profile_block_flag < 2) ? 1 : 3;
4955 else if (!strcmp (str, "ax"))
4957 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4958 warning ("`-ax' option (jump profiling) not supported");
4960 profile_block_flag = (!profile_block_flag
4961 || profile_block_flag == 2) ? 2 : 3;
4964 else if (str[0] == 'g')
4968 /* A lot of code assumes write_symbols == NO_DEBUG if the
4969 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4970 of what debugging type has been selected). This records the
4971 selected type. It is an error to specify more than one
4973 static enum debug_info_type selected_debug_type = NO_DEBUG;
4974 /* Non-zero if debugging format has been explicitly set.
4975 -g and -ggdb don't explicitly set the debugging format so
4976 -gdwarf -g3 is equivalent to -gdwarf3. */
4977 static int type_explicitly_set_p = 0;
4978 /* Indexed by enum debug_info_type. */
4979 static char *debug_type_names[] =
4981 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4984 /* Look up STR in the table. */
4985 for (da = debug_args; da->arg; da++)
4987 if (! strncmp (str, da->arg, strlen (da->arg)))
4989 enum debug_info_type type = da->debug_type;
4992 p = str + strlen (da->arg);
4993 if (*p && (*p < '0' || *p > '9'))
4997 while (*q && (*q >= '0' && *q <= '9'))
5002 if (len > 1 && !strncmp (str, "gdwarf", len))
5004 error ("use -gdwarf -g%d for DWARF v1, level %d",
5007 error ("use -gdwarf-2 for DWARF v2");
5011 level = 2; /* default debugging info level */
5012 if (*q || level > 3)
5014 warning ("invalid debug level specification in option: `-%s'",
5016 /* ??? This error message is incorrect in the case of
5018 warning ("no debugging information will be generated");
5022 if (type == NO_DEBUG)
5024 type = PREFERRED_DEBUGGING_TYPE;
5025 if (len > 1 && strncmp (str, "ggdb", len) == 0)
5027 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
5028 type = DWARF2_DEBUG;
5030 #ifdef DBX_DEBUGGING_INFO
5037 if (type == NO_DEBUG)
5038 warning ("`-%s' not supported by this configuration of GCC",
5041 /* Does it conflict with an already selected type? */
5042 if (type_explicitly_set_p
5043 /* -g/-ggdb don't conflict with anything */
5044 && da->debug_type != NO_DEBUG
5045 && type != selected_debug_type)
5046 warning ("`-%s' ignored, conflicts with `-g%s'",
5047 str, debug_type_names[(int) selected_debug_type]);
5050 /* If the format has already been set, -g/-ggdb
5051 only change the debug level. */
5052 if (type_explicitly_set_p
5053 && da->debug_type == NO_DEBUG)
5054 ; /* don't change debugging type */
5057 selected_debug_type = type;
5058 type_explicitly_set_p = da->debug_type != NO_DEBUG;
5060 write_symbols = (level == 0
5062 : selected_debug_type);
5063 use_gnu_debug_info_extensions = da->use_extensions_p;
5064 debug_info_level = (enum debug_info_level) level;
5070 warning ("`-%s' not supported by this configuration of GCC",
5073 else if (!strcmp (str, "o"))
5075 asm_file_name = argv[++i];
5077 else if (str[0] == 'G')
5079 g_switch_set = TRUE;
5080 g_switch_value = atoi ((str[1] != '\0') ? str+1 : argv[++i]);
5082 else if (!strncmp (str, "aux-info", 8))
5084 flag_gen_aux_info = 1;
5085 aux_info_file_name = (str[8] != '\0' ? str+8 : argv[++i]);
5087 else if (!strcmp (str, "-help"))
5093 error ("Invalid option `%s'", argv[i]);
5095 else if (argv[i][0] == '+')
5096 error ("Invalid option `%s'", argv[i]);
5101 /* Checker uses the frame pointer. */
5102 if (flag_check_memory_usage)
5103 flag_omit_frame_pointer = 0;
5107 /* Inlining does not work if not optimizing,
5108 so force it not to be done. */
5112 /* The c_decode_option and lang_decode_option functions set
5113 this to `2' if -Wall is used, so we can avoid giving out
5114 lots of errors for people who don't realize what -Wall does. */
5115 if (warn_uninitialized == 1)
5116 warning ("-Wuninitialized is not supported without -O");
5119 #ifdef OVERRIDE_OPTIONS
5120 /* Some machines may reject certain combinations of options. */
5124 if (exceptions_via_longjmp == 2)
5126 #ifdef DWARF2_UNWIND_INFO
5127 exceptions_via_longjmp = ! DWARF2_UNWIND_INFO;
5129 exceptions_via_longjmp = 1;
5133 if (profile_block_flag == 3)
5135 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
5136 profile_block_flag = 2;
5139 /* Unrolling all loops implies that standard loop unrolling must also
5141 if (flag_unroll_all_loops)
5142 flag_unroll_loops = 1;
5143 /* Loop unrolling requires that strength_reduction be on also. Silently
5144 turn on strength reduction here if it isn't already on. Also, the loop
5145 unrolling code assumes that cse will be run after loop, so that must
5146 be turned on also. */
5147 if (flag_unroll_loops)
5149 flag_strength_reduce = 1;
5150 flag_rerun_cse_after_loop = 1;
5153 /* Warn about options that are not supported on this machine. */
5154 #ifndef INSN_SCHEDULING
5155 if (flag_schedule_insns || flag_schedule_insns_after_reload)
5156 warning ("instruction scheduling not supported on this target machine");
5159 if (flag_delayed_branch)
5160 warning ("this target machine does not have delayed branches");
5163 user_label_prefix = USER_LABEL_PREFIX;
5164 if (flag_leading_underscore != -1)
5166 /* If the default prefix is more complicated than "" or "_",
5167 issue a warning and ignore this option. */
5168 if (user_label_prefix[0] == 0 ||
5169 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
5171 user_label_prefix = flag_leading_underscore ? "_" : "";
5174 warning ("-f%sleading-underscore not supported on this target machine",
5175 flag_leading_underscore ? "" : "no-");
5178 /* If we are in verbose mode, write out the version and maybe all the
5179 option flags in use. */
5182 print_version (stderr, "");
5184 print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
5187 compile_file (filename);
5189 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__))
5192 char *lim = (char *) sbrk (0);
5194 fprintf (stderr, "Data size %ld.\n", (long)(lim - (char *) &environ));
5199 system ("ps -l 1>&2");
5202 #endif /* not USG */
5205 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) */
5208 exit (FATAL_EXIT_CODE);
5210 exit (FATAL_EXIT_CODE);
5211 exit (SUCCESS_EXIT_CODE);
5215 /* Decode -m switches. */
5216 /* Decode the switch -mNAME. */
5219 set_target_switch (name)
5225 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
5226 if (!strcmp (target_switches[j].name, name))
5228 if (target_switches[j].value < 0)
5229 target_flags &= ~-target_switches[j].value;
5231 target_flags |= target_switches[j].value;
5235 #ifdef TARGET_OPTIONS
5237 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
5239 int len = strlen (target_options[j].prefix);
5240 if (!strncmp (target_options[j].prefix, name, len))
5242 *target_options[j].variable = name + len;
5249 error ("Invalid option `%s'", name);
5252 /* Print version information to FILE.
5253 Each line begins with INDENT (for the case where FILE is the
5254 assembler output file). */
5257 print_version (file, indent)
5261 fprintf (file, "%s%s%s version %s", indent, *indent != 0 ? " " : "",
5262 language_string, version_string);
5263 fprintf (file, " (%s)", TARGET_NAME);
5266 #define __VERSION__ "[unknown]"
5268 fprintf (file, " compiled by GNU C version %s.\n", __VERSION__);
5270 fprintf (file, " compiled by CC.\n");
5274 /* Print an option value and return the adjusted position in the line.
5275 ??? We don't handle error returns from fprintf (disk full); presumably
5276 other code will catch a disk full though. */
5279 print_single_switch (file, pos, max, indent, sep, term, type, name)
5282 char *indent, *sep, *term, *type, *name;
5284 /* The ultrix fprintf returns 0 on success, so compute the result we want
5285 here since we need it for the following test. */
5286 int len = strlen (sep) + strlen (type) + strlen (name);
5291 fprintf (file, "%s", term);
5296 fprintf (file, "%s", indent);
5297 pos = strlen (indent);
5299 fprintf (file, "%s%s%s", sep, type, name);
5304 /* Print active target switches to FILE.
5305 POS is the current cursor position and MAX is the size of a "line".
5306 Each line begins with INDENT and ends with TERM.
5307 Each switch is separated from the next by SEP. */
5310 print_switch_values (file, pos, max, indent, sep, term)
5313 char *indent, *sep, *term;
5318 /* Print the options as passed. */
5320 pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
5321 "options passed: ", "");
5323 for (p = &save_argv[1]; *p != NULL; p++)
5327 if (strcmp (*p, "-o") == 0)
5333 if (strcmp (*p, "-quiet") == 0)
5335 if (strcmp (*p, "-version") == 0)
5340 pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
5343 fprintf (file, "%s", term);
5345 /* Print the -f and -m options that have been enabled.
5346 We don't handle language specific options but printing argv
5349 pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
5350 "options enabled: ", "");
5352 for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
5353 if (*f_options[j].variable == f_options[j].on_value)
5354 pos = print_single_switch (file, pos, max, indent, sep, term,
5355 "-f", f_options[j].string);
5357 /* Print target specific options. */
5359 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
5360 if (target_switches[j].name[0] != '\0'
5361 && target_switches[j].value > 0
5362 && ((target_switches[j].value & target_flags)
5363 == target_switches[j].value))
5365 pos = print_single_switch (file, pos, max, indent, sep, term,
5366 "-m", target_switches[j].name);
5369 #ifdef TARGET_OPTIONS
5370 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
5371 if (*target_options[j].variable != NULL)
5374 sprintf (prefix, "-m%s", target_options[j].prefix);
5375 pos = print_single_switch (file, pos, max, indent, sep, term,
5376 prefix, *target_options[j].variable);
5380 fprintf (file, "%s", term);
5383 /* Record the beginning of a new source file, named FILENAME. */
5386 debug_start_source_file (filename)
5387 register char *filename;
5389 #ifdef DBX_DEBUGGING_INFO
5390 if (write_symbols == DBX_DEBUG)
5391 dbxout_start_new_source_file (filename);
5393 #ifdef DWARF_DEBUGGING_INFO
5394 if (debug_info_level == DINFO_LEVEL_VERBOSE
5395 && write_symbols == DWARF_DEBUG)
5396 dwarfout_start_new_source_file (filename);
5397 #endif /* DWARF_DEBUGGING_INFO */
5398 #ifdef DWARF2_DEBUGGING_INFO
5399 if (debug_info_level == DINFO_LEVEL_VERBOSE
5400 && write_symbols == DWARF2_DEBUG)
5401 dwarf2out_start_source_file (filename);
5402 #endif /* DWARF2_DEBUGGING_INFO */
5403 #ifdef SDB_DEBUGGING_INFO
5404 if (write_symbols == SDB_DEBUG)
5405 sdbout_start_new_source_file (filename);
5409 /* Record the resumption of a source file. LINENO is the line number in
5410 the source file we are returning to. */
5413 debug_end_source_file (lineno)
5414 register unsigned lineno ATTRIBUTE_UNUSED;
5416 #ifdef DBX_DEBUGGING_INFO
5417 if (write_symbols == DBX_DEBUG)
5418 dbxout_resume_previous_source_file ();
5420 #ifdef DWARF_DEBUGGING_INFO
5421 if (debug_info_level == DINFO_LEVEL_VERBOSE
5422 && write_symbols == DWARF_DEBUG)
5423 dwarfout_resume_previous_source_file (lineno);
5424 #endif /* DWARF_DEBUGGING_INFO */
5425 #ifdef DWARF2_DEBUGGING_INFO
5426 if (debug_info_level == DINFO_LEVEL_VERBOSE
5427 && write_symbols == DWARF2_DEBUG)
5428 dwarf2out_end_source_file ();
5429 #endif /* DWARF2_DEBUGGING_INFO */
5430 #ifdef SDB_DEBUGGING_INFO
5431 if (write_symbols == SDB_DEBUG)
5432 sdbout_resume_previous_source_file ();
5436 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5437 the tail part of the directive line, i.e. the part which is past the
5438 initial whitespace, #, whitespace, directive-name, whitespace part. */
5441 debug_define (lineno, buffer)
5442 register unsigned lineno;
5443 register char *buffer;
5445 #ifdef DWARF_DEBUGGING_INFO
5446 if (debug_info_level == DINFO_LEVEL_VERBOSE
5447 && write_symbols == DWARF_DEBUG)
5448 dwarfout_define (lineno, buffer);
5449 #endif /* DWARF_DEBUGGING_INFO */
5450 #ifdef DWARF2_DEBUGGING_INFO
5451 if (debug_info_level == DINFO_LEVEL_VERBOSE
5452 && write_symbols == DWARF2_DEBUG)
5453 dwarf2out_define (lineno, buffer);
5454 #endif /* DWARF2_DEBUGGING_INFO */
5457 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5458 the tail part of the directive line, i.e. the part which is past the
5459 initial whitespace, #, whitespace, directive-name, whitespace part. */
5462 debug_undef (lineno, buffer)
5463 register unsigned lineno;
5464 register char *buffer;
5466 #ifdef DWARF_DEBUGGING_INFO
5467 if (debug_info_level == DINFO_LEVEL_VERBOSE
5468 && write_symbols == DWARF_DEBUG)
5469 dwarfout_undef (lineno, buffer);
5470 #endif /* DWARF_DEBUGGING_INFO */
5471 #ifdef DWARF2_DEBUGGING_INFO
5472 if (debug_info_level == DINFO_LEVEL_VERBOSE
5473 && write_symbols == DWARF2_DEBUG)
5474 dwarf2out_undef (lineno, buffer);
5475 #endif /* DWARF2_DEBUGGING_INFO */