* rtl.h (rtunion_def): Constify member `rtstr'.
[official-gcc.git] / gcc / toplev.c
blobf10e1e2f551744bdf7c8eae25809b418aebc541b
1 /* Top level of GNU C compiler
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* This is the top level of cc1/c++.
23 It parses command args, opens files, invokes the various passes
24 in the proper order, and counts the time used by each.
25 Error messages and low-level interface to malloc also handled here. */
27 #include "config.h"
28 #undef FLOAT /* This is for hpux. They should change hpux. */
29 #undef FFS /* Some systems define this in param.h. */
30 #include "system.h"
31 #include <signal.h>
32 #include <setjmp.h>
34 #ifdef HAVE_SYS_RESOURCE_H
35 # include <sys/resource.h>
36 #endif
38 #ifdef HAVE_SYS_TIMES_H
39 # include <sys/times.h>
40 #endif
42 #include "input.h"
43 #include "tree.h"
44 #include "rtl.h"
45 #include "tm_p.h"
46 #include "flags.h"
47 #include "insn-attr.h"
48 #include "insn-codes.h"
49 #include "insn-config.h"
50 #include "recog.h"
51 #include "defaults.h"
52 #include "output.h"
53 #include "except.h"
54 #include "function.h"
55 #include "toplev.h"
56 #include "expr.h"
57 #include "basic-block.h"
58 #include "intl.h"
59 #include "ggc.h"
60 #include "graph.h"
61 #include "loop.h"
62 #include "regs.h"
64 #ifdef DWARF_DEBUGGING_INFO
65 #include "dwarfout.h"
66 #endif
68 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
69 #include "dwarf2out.h"
70 #endif
72 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
73 #include "dbxout.h"
74 #endif
76 #ifdef SDB_DEBUGGING_INFO
77 #include "sdbout.h"
78 #endif
80 #ifdef XCOFF_DEBUGGING_INFO
81 #include "xcoffout.h"
82 #endif
84 #ifdef VMS
85 /* The extra parameters substantially improve the I/O performance. */
86 static FILE *
87 vms_fopen (fname, type)
88 char * fname;
89 char * type;
91 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
92 fixed arguments, which matches ANSI's specification but not VAXCRTL's
93 pre-ANSI implementation. This hack circumvents the mismatch problem. */
94 FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
96 if (*type == 'w')
97 return (*vmslib_fopen) (fname, type, "mbc=32",
98 "deq=64", "fop=tef", "shr=nil");
99 else
100 return (*vmslib_fopen) (fname, type, "mbc=32");
102 #define fopen vms_fopen
103 #endif /* VMS */
105 #ifndef DEFAULT_GDB_EXTENSIONS
106 #define DEFAULT_GDB_EXTENSIONS 1
107 #endif
109 /* If more than one debugging type is supported, you must define
110 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
112 This is one long line cause VAXC can't handle a \-newline. */
113 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
114 #ifndef PREFERRED_DEBUGGING_TYPE
115 You Lose! You must define PREFERRED_DEBUGGING_TYPE!
116 #endif /* no PREFERRED_DEBUGGING_TYPE */
117 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
118 so the following code needn't care. */
119 #ifdef DBX_DEBUGGING_INFO
120 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
121 #endif
122 #ifdef SDB_DEBUGGING_INFO
123 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
124 #endif
125 #ifdef DWARF_DEBUGGING_INFO
126 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
127 #endif
128 #ifdef DWARF2_DEBUGGING_INFO
129 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
130 #endif
131 #ifdef XCOFF_DEBUGGING_INFO
132 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
133 #endif
134 #endif /* More than one debugger format enabled. */
136 /* If still not defined, must have been because no debugging formats
137 are supported. */
138 #ifndef PREFERRED_DEBUGGING_TYPE
139 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
140 #endif
142 #ifdef NEED_DECLARATION_ENVIRON
143 extern char **environ;
144 #endif
146 /* Carry information from ASM_DECLARE_OBJECT_NAME
147 to ASM_FINISH_DECLARE_OBJECT. */
149 extern int size_directive_output;
150 extern tree last_assemble_variable_decl;
152 static void set_target_switch PARAMS ((const char *));
153 static const char *decl_name PARAMS ((tree, int));
155 static void float_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
156 static void pipe_closed PARAMS ((int)) ATTRIBUTE_NORETURN;
157 #ifdef ASM_IDENTIFY_LANGUAGE
158 /* This might or might not be used in ASM_IDENTIFY_LANGUAGE. */
159 static void output_lang_identify PARAMS ((FILE *)) ATTRIBUTE_UNUSED;
160 #endif
161 static void open_dump_file PARAMS ((const char *, const char *));
162 static void close_dump_file PARAMS ((void (*) (FILE *, rtx), rtx));
163 static void dump_rtl PARAMS ((const char *, tree, void (*) (FILE *, rtx), rtx));
164 static void clean_dump_file PARAMS ((const char *));
165 static void compile_file PARAMS ((char *));
166 static void display_help PARAMS ((void));
167 static void mark_file_stack PARAMS ((void *));
169 static void decode_d_option PARAMS ((const char *));
170 static int decode_f_option PARAMS ((const char *));
171 static int decode_W_option PARAMS ((const char *));
172 static int decode_g_option PARAMS ((const char *));
173 static unsigned independent_decode_option PARAMS ((int, char **, unsigned));
175 static void print_version PARAMS ((FILE *, const char *));
176 static int print_single_switch PARAMS ((FILE *, int, int, const char *,
177 const char *, const char *,
178 const char *, const char *));
179 static void print_switch_values PARAMS ((FILE *, int, int, const char *,
180 const char *, const char *));
182 /* Length of line when printing switch values. */
183 #define MAX_LINE 75
185 /* Name of program invoked, sans directories. */
187 const char *progname;
189 /* Copy of arguments to main. */
190 int save_argc;
191 char **save_argv;
193 /* Name of current original source file (what was input to cpp).
194 This comes from each #-command in the actual input. */
196 char *input_filename;
198 /* Name of top-level original source file (what was input to cpp).
199 This comes from the #-command at the beginning of the actual input.
200 If there isn't any there, then this is the cc1 input file name. */
202 char *main_input_filename;
204 /* Current line number in real source file. */
206 int lineno;
208 /* Nonzero if it is unsafe to create any new pseudo registers. */
209 int no_new_pseudos;
211 /* Stack of currently pending input files. */
213 struct file_stack *input_file_stack;
215 /* Incremented on each change to input_file_stack. */
216 int input_file_stack_tick;
218 /* Name to use as base of names for dump output files. */
220 const char *dump_base_name;
222 /* Bit flags that specify the machine subtype we are compiling for.
223 Bits are tested using macros TARGET_... defined in the tm.h file
224 and set by `-m...' switches. Must be defined in rtlanal.c. */
226 extern int target_flags;
228 /* Flags saying which kinds of debugging dump have been requested. */
230 int rtl_dump = 0;
231 int rtl_dump_and_exit = 0;
232 int jump_opt_dump = 0;
233 int addressof_dump = 0;
234 int cse_dump = 0;
235 int gcse_dump = 0;
236 int loop_dump = 0;
237 int cse2_dump = 0;
238 int branch_prob_dump = 0;
239 int flow_dump = 0;
240 int combine_dump = 0;
241 int regmove_dump = 0;
242 int sched_dump = 0;
243 int local_reg_dump = 0;
244 int global_reg_dump = 0;
245 int flow2_dump = 0;
246 int peephole2_dump = 0;
247 int sched2_dump = 0;
248 int jump2_opt_dump = 0;
249 #ifdef DELAY_SLOTS
250 int dbr_sched_dump = 0;
251 #endif
252 int reorder_blocks_dump = 0;
253 int flag_print_asm_name = 0;
254 #ifdef STACK_REGS
255 int stack_reg_dump = 0;
256 #endif
257 #ifdef MACHINE_DEPENDENT_REORG
258 int mach_dep_reorg_dump = 0;
259 #endif
260 static int flag_print_mem = 0;
261 static int version_flag = 0;
262 static char * filename = 0;
263 enum graph_dump_types graph_dump_format;
265 /* Name for output file of assembly code, specified with -o. */
267 char *asm_file_name;
269 /* Value of the -G xx switch, and whether it was passed or not. */
270 int g_switch_value;
271 int g_switch_set;
273 /* Type(s) of debugging information we are producing (if any).
274 See flags.h for the definitions of the different possible
275 types of debugging information. */
276 enum debug_info_type write_symbols = NO_DEBUG;
278 /* Level of debugging information we are producing. See flags.h
279 for the definitions of the different possible levels. */
280 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
282 /* Nonzero means use GNU-only extensions in the generated symbolic
283 debugging information. */
284 /* Currently, this only has an effect when write_symbols is set to
285 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
286 int use_gnu_debug_info_extensions = 0;
288 /* Nonzero means do optimizations. -O.
289 Particular numeric values stand for particular amounts of optimization;
290 thus, -O2 stores 2 here. However, the optimizations beyond the basic
291 ones are not controlled directly by this variable. Instead, they are
292 controlled by individual `flag_...' variables that are defaulted
293 based on this variable. */
295 int optimize = 0;
297 /* Nonzero means optimize for size. -Os.
298 The only valid values are zero and non-zero. When optimize_size is
299 non-zero, optimize defaults to 2, but certain individual code
300 bloating optimizations are disabled. */
302 int optimize_size = 0;
304 /* Number of error messages and warning messages so far. */
306 int errorcount = 0;
307 int warningcount = 0;
308 int sorrycount = 0;
310 /* The FUNCTION_DECL for the function currently being compiled,
311 or 0 if between functions. */
312 tree current_function_decl;
314 /* Set to the FUNC_BEGIN label of the current function, or NULL_TREE
315 if none. */
316 tree current_function_func_begin_label;
318 /* Pointer to function to compute the name to use to print a declaration.
319 DECL is the declaration in question.
320 VERBOSITY determines what information will be printed:
321 0: DECL_NAME, demangled as necessary.
322 1: and scope information.
323 2: and any other information that might be interesting, such as function
324 parameter types in C++. */
326 const char *(*decl_printable_name) PARAMS ((tree, int));
328 /* Pointer to function to compute rtl for a language-specific tree code. */
330 typedef rtx (*lang_expand_expr_t)
331 PARAMS ((union tree_node *, rtx, enum machine_mode,
332 enum expand_modifier modifier));
334 lang_expand_expr_t lang_expand_expr = 0;
336 tree (*lang_expand_constant) PARAMS ((tree)) = 0;
338 /* Pointer to function to finish handling an incomplete decl at the
339 end of compilation. */
341 void (*incomplete_decl_finalize_hook) PARAMS ((tree)) = 0;
343 /* Nonzero if generating code to do profiling. */
345 int profile_flag = 0;
347 /* Nonzero if generating code to do profiling on a line-by-line basis. */
349 int profile_block_flag;
351 /* Nonzero if generating code to profile program flow graph arcs. */
353 int profile_arc_flag = 0;
355 /* Nonzero if generating info for gcov to calculate line test coverage. */
357 int flag_test_coverage = 0;
359 /* Nonzero indicates that branch taken probabilities should be calculated. */
361 int flag_branch_probabilities = 0;
363 /* Nonzero if basic blocks should be reordered. */
365 int flag_reorder_blocks = 0;
367 /* Nonzero for -pedantic switch: warn about anything
368 that standard spec forbids. */
370 int pedantic = 0;
372 /* Temporarily suppress certain warnings.
373 This is set while reading code from a system header file. */
375 int in_system_header = 0;
377 /* Don't print functions as they are compiled and don't print
378 times taken by the various passes. -quiet. */
380 int quiet_flag = 0;
382 /* -f flags. */
384 /* Nonzero means `char' should be signed. */
386 int flag_signed_char;
388 /* Nonzero means give an enum type only as many bytes as it needs. */
390 int flag_short_enums;
392 /* Nonzero for -fcaller-saves: allocate values in regs that need to
393 be saved across function calls, if that produces overall better code.
394 Optional now, so people can test it. */
396 #ifdef DEFAULT_CALLER_SAVES
397 int flag_caller_saves = 1;
398 #else
399 int flag_caller_saves = 0;
400 #endif
402 /* Nonzero if structures and unions should be returned in memory.
404 This should only be defined if compatibility with another compiler or
405 with an ABI is needed, because it results in slower code. */
407 #ifndef DEFAULT_PCC_STRUCT_RETURN
408 #define DEFAULT_PCC_STRUCT_RETURN 1
409 #endif
411 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
413 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
415 /* Nonzero for -fforce-mem: load memory value into a register
416 before arithmetic on it. This makes better cse but slower compilation. */
418 int flag_force_mem = 0;
420 /* Nonzero for -fforce-addr: load memory address into a register before
421 reference to memory. This makes better cse but slower compilation. */
423 int flag_force_addr = 0;
425 /* Nonzero for -fdefer-pop: don't pop args after each function call;
426 instead save them up to pop many calls' args with one insns. */
428 int flag_defer_pop = 0;
430 /* Nonzero for -ffloat-store: don't allocate floats and doubles
431 in extended-precision registers. */
433 int flag_float_store = 0;
435 /* Nonzero for -fcse-follow-jumps:
436 have cse follow jumps to do a more extensive job. */
438 int flag_cse_follow_jumps;
440 /* Nonzero for -fcse-skip-blocks:
441 have cse follow a branch around a block. */
442 int flag_cse_skip_blocks;
444 /* Nonzero for -fexpensive-optimizations:
445 perform miscellaneous relatively-expensive optimizations. */
446 int flag_expensive_optimizations;
448 /* Nonzero for -fthread-jumps:
449 have jump optimize output of loop. */
451 int flag_thread_jumps;
453 /* Nonzero enables strength-reduction in loop.c. */
455 int flag_strength_reduce = 0;
457 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
458 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
459 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
460 unrolled. */
462 int flag_unroll_loops;
464 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
465 This is generally not a win. */
467 int flag_unroll_all_loops;
469 /* Nonzero forces all invariant computations in loops to be moved
470 outside the loop. */
472 int flag_move_all_movables = 0;
474 /* Nonzero forces all general induction variables in loops to be
475 strength reduced. */
477 int flag_reduce_all_givs = 0;
479 /* Nonzero to perform full register move optimization passes. This is the
480 default for -O2. */
482 int flag_regmove = 0;
484 /* Nonzero for -fwritable-strings:
485 store string constants in data segment and don't uniquize them. */
487 int flag_writable_strings = 0;
489 /* Nonzero means don't put addresses of constant functions in registers.
490 Used for compiling the Unix kernel, where strange substitutions are
491 done on the assembly output. */
493 int flag_no_function_cse = 0;
495 /* Nonzero for -fomit-frame-pointer:
496 don't make a frame pointer in simple functions that don't require one. */
498 int flag_omit_frame_pointer = 0;
500 /* Nonzero means place each function into its own section on those platforms
501 which support arbitrary section names and unlimited numbers of sections. */
503 int flag_function_sections = 0;
505 /* ... and similar for data. */
507 int flag_data_sections = 0;
509 /* Nonzero to inhibit use of define_optimization peephole opts. */
511 int flag_no_peephole = 0;
513 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
514 operations in the interest of optimization. For example it allows
515 GCC to assume arguments to sqrt are nonnegative numbers, allowing
516 faster code for sqrt to be generated. */
518 int flag_fast_math = 0;
520 /* Nonzero means the front end generally wants `errno' maintained by math
521 operations, like built-in SQRT, unless overridden by flag_fast_math. */
523 int flag_errno_math = 1;
525 /* 0 means straightforward implementation of complex divide acceptable.
526 1 means wide ranges of inputs must work for complex divide.
527 2 means C9X-like requirements for complex divide (not yet implemented). */
529 int flag_complex_divide_method = 0;
531 /* Nonzero means all references through pointers are volatile. */
533 int flag_volatile;
535 /* Nonzero means treat all global and extern variables as volatile. */
537 int flag_volatile_global;
539 /* Nonzero means treat all static variables as volatile. */
541 int flag_volatile_static;
543 /* Nonzero means just do syntax checking; don't output anything. */
545 int flag_syntax_only = 0;
547 /* Nonzero means perform global cse. */
549 static int flag_gcse;
551 /* Nonzero means to use global dataflow analysis to eliminate
552 useless null pointer tests. */
554 static int flag_delete_null_pointer_checks;
556 /* Nonzero means to rerun cse after loop optimization. This increases
557 compilation time about 20% and picks up a few more common expressions. */
559 static int flag_rerun_cse_after_loop;
561 /* Nonzero means to run loop optimizations twice. */
563 int flag_rerun_loop_opt;
565 /* Nonzero for -finline-functions: ok to inline functions that look like
566 good inline candidates. */
568 int flag_inline_functions;
570 /* Nonzero for -fkeep-inline-functions: even if we make a function
571 go inline everywhere, keep its definition around for debugging
572 purposes. */
574 int flag_keep_inline_functions;
576 /* Nonzero means that functions will not be inlined. */
578 int flag_no_inline;
580 /* Nonzero means that we should emit static const variables
581 regardless of whether or not optimization is turned on. */
583 int flag_keep_static_consts = 1;
585 /* Nonzero means we should be saving declaration info into a .X file. */
587 int flag_gen_aux_info = 0;
589 /* Specified name of aux-info file. */
591 static char *aux_info_file_name;
593 /* Nonzero means make the text shared if supported. */
595 int flag_shared_data;
597 /* Nonzero means schedule into delayed branch slots if supported. */
599 int flag_delayed_branch;
601 /* Nonzero if we are compiling pure (sharable) code.
602 Value is 1 if we are doing reasonable (i.e. simple
603 offset into offset table) pic. Value is 2 if we can
604 only perform register offsets. */
606 int flag_pic;
608 /* Nonzero means generate extra code for exception handling and enable
609 exception handling. */
611 int flag_exceptions;
613 /* Nonzero means use the new model for exception handling. Replaces
614 -DNEW_EH_MODEL as a compile option. */
616 int flag_new_exceptions = 1;
618 /* Nonzero means generate frame unwind info table when supported */
620 int flag_unwind_tables = 0;
622 /* Nonzero means don't place uninitialized global data in common storage
623 by default. */
625 int flag_no_common;
627 /* Nonzero means pretend it is OK to examine bits of target floats,
628 even if that isn't true. The resulting code will have incorrect constants,
629 but the same series of instructions that the native compiler would make. */
631 int flag_pretend_float;
633 /* Nonzero means change certain warnings into errors.
634 Usually these are warnings about failure to conform to some standard. */
636 int flag_pedantic_errors = 0;
638 /* flag_schedule_insns means schedule insns within basic blocks (before
639 local_alloc).
640 flag_schedule_insns_after_reload means schedule insns after
641 global_alloc. */
643 int flag_schedule_insns = 0;
644 int flag_schedule_insns_after_reload = 0;
646 /* The following flags have effect only for scheduling before register
647 allocation:
649 flag_schedule_interblock means schedule insns accross basic blocks.
650 flag_schedule_speculative means allow speculative motion of non-load insns.
651 flag_schedule_speculative_load means allow speculative motion of some
652 load insns.
653 flag_schedule_speculative_load_dangerous allows speculative motion of more
654 load insns. */
656 int flag_schedule_interblock = 1;
657 int flag_schedule_speculative = 1;
658 int flag_schedule_speculative_load = 0;
659 int flag_schedule_speculative_load_dangerous = 0;
661 /* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple
662 by a cheaper branch, on a count register. */
663 int flag_branch_on_count_reg;
665 /* -finhibit-size-directive inhibits output of .size for ELF.
666 This is used only for compiling crtstuff.c,
667 and it may be extended to other effects
668 needed for crtstuff.c on other systems. */
669 int flag_inhibit_size_directive = 0;
671 /* -fverbose-asm causes extra commentary information to be produced in
672 the generated assembly code (to make it more readable). This option
673 is generally only of use to those who actually need to read the
674 generated assembly code (perhaps while debugging the compiler itself).
675 -fno-verbose-asm, the default, causes the extra information
676 to be omitted and is useful when comparing two assembler files. */
678 int flag_verbose_asm = 0;
680 /* -dA causes debug commentary information to be produced in
681 the generated assembly code (to make it more readable). This option
682 is generally only of use to those who actually need to read the
683 generated assembly code (perhaps while debugging the compiler itself).
684 Currently, this switch is only used by dwarfout.c; however, it is intended
685 to be a catchall for printing debug information in the assembler file. */
687 int flag_debug_asm = 0;
689 /* -fgnu-linker specifies use of the GNU linker for initializations.
690 (Or, more generally, a linker that handles initializations.)
691 -fno-gnu-linker says that collect2 will be used. */
692 #ifdef USE_COLLECT2
693 int flag_gnu_linker = 0;
694 #else
695 int flag_gnu_linker = 1;
696 #endif
698 /* Tag all structures with __attribute__(packed) */
699 int flag_pack_struct = 0;
701 /* Emit code to check for stack overflow; also may cause large objects
702 to be allocated dynamically. */
703 int flag_stack_check;
705 /* When non-NULL, indicates that whenever space is allocated on the
706 stack, the resulting stack pointer must not pass this
707 address---that is, for stacks that grow downward, the stack pointer
708 must always be greater than or equal to this address; for stacks
709 that grow upward, the stack pointer must be less than this address.
710 At present, the rtx may be either a REG or a SYMBOL_REF, although
711 the support provided depends on the backend. */
712 rtx stack_limit_rtx;
714 /* -fcheck-memory-usage causes extra code to be generated in order to check
715 memory accesses. This is used by a detector of bad memory accesses such
716 as Checker. */
717 int flag_check_memory_usage = 0;
719 /* -fprefix-function-name causes function name to be prefixed. This
720 can be used with -fcheck-memory-usage to isolate code compiled with
721 -fcheck-memory-usage. */
722 int flag_prefix_function_name = 0;
724 /* 0 if pointer arguments may alias each other. True in C.
725 1 if pointer arguments may not alias each other but may alias
726 global variables.
727 2 if pointer arguments may not alias each other and may not
728 alias global variables. True in Fortran.
729 This defaults to 0 for C. */
730 int flag_argument_noalias = 0;
732 /* Nonzero if we should do (language-dependent) alias analysis.
733 Typically, this analysis will assume that expressions of certain
734 types do not alias expressions of certain other types. Only used
735 if alias analysis (in general) is enabled. */
736 int flag_strict_aliasing = 0;
738 /* Instrument functions with calls at entry and exit, for profiling. */
739 int flag_instrument_function_entry_exit = 0;
741 /* Nonzero means ignore `#ident' directives. 0 means handle them.
742 On SVR4 targets, it also controls whether or not to emit a
743 string identifying the compiler. */
745 int flag_no_ident = 0;
747 /* This will perform a peephole pass before sched2. */
748 int flag_peephole2 = 0;
750 /* -fbounded-pointers causes gcc to compile pointers as composite
751 objects occupying three words: the pointer value, the base address
752 of the referent object, and the address immediately beyond the end
753 of the referent object. The base and extent allow us to perform
754 runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
755 int flag_bounded_pointers = 0;
757 /* -fcheck-bounds causes gcc to generate array bounds checks.
758 For C, C++: defaults to value of flag_bounded_pointers.
759 For ObjC: defaults to off.
760 For Java: defaults to on.
761 For Fortran: defaults to off.
762 For CHILL: defaults to off. */
763 int flag_bounds_check = 0;
765 /* If one, renumber instruction UIDs to reduce the number of
766 unused UIDs if there are a lot of instructions. If greater than
767 one, unconditionally renumber instruction UIDs. */
768 int flag_renumber_insns = 1;
770 /* Values of the -falign-* flags: how much to align labels in code.
771 0 means `use default', 1 means `don't align'.
772 For each variable, there is an _log variant which is the power
773 of two not less than the variable, for .align output. */
775 int align_loops;
776 int align_loops_log;
777 int align_jumps;
778 int align_jumps_log;
779 int align_labels;
780 int align_labels_log;
781 int align_functions;
782 int align_functions_log;
784 /* Table of supported debugging formats. */
785 static struct
787 const char * arg;
788 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
789 constant expression, we use NO_DEBUG in its place. */
790 enum debug_info_type debug_type;
791 int use_extensions_p;
792 const char * description;
793 } *da,
794 debug_args[] =
796 { "", NO_DEBUG, DEFAULT_GDB_EXTENSIONS,
797 "Generate default debug format output" },
798 { "gdb", NO_DEBUG, 1, "Generate default extended debug format output" },
799 #ifdef DBX_DEBUGGING_INFO
800 { "stabs", DBX_DEBUG, 0, "Generate STABS format debug output" },
801 { "stabs+", DBX_DEBUG, 1, "Generate extended STABS format debug output" },
802 #endif
803 #ifdef DWARF_DEBUGGING_INFO
804 { "dwarf", DWARF_DEBUG, 0, "Generate DWARF-1 format debug output"},
805 { "dwarf+", DWARF_DEBUG, 1,
806 "Generated extended DWARF-1 format debug output" },
807 #endif
808 #ifdef DWARF2_DEBUGGING_INFO
809 { "dwarf-2", DWARF2_DEBUG, 0, "Enable DWARF-2 debug output" },
810 #endif
811 #ifdef XCOFF_DEBUGGING_INFO
812 { "xcoff", XCOFF_DEBUG, 0, "Generate XCOFF format debug output" },
813 { "xcoff+", XCOFF_DEBUG, 1, "Generate extended XCOFF format debug output" },
814 #endif
815 #ifdef SDB_DEBUGGING_INFO
816 { "coff", SDB_DEBUG, 0, "Generate COFF format debug output" },
817 #endif
818 { 0, 0, 0, 0 }
821 typedef struct
823 const char * string;
824 int * variable;
825 int on_value;
826 const char * description;
828 lang_independent_options;
830 /* Add or remove a leading underscore from user symbols. */
831 int flag_leading_underscore = -1;
833 /* The user symbol prefix after having resolved same. */
834 const char *user_label_prefix;
836 /* A default for same. */
837 #ifndef USER_LABEL_PREFIX
838 #define USER_LABEL_PREFIX ""
839 #endif
841 /* Table of language-independent -f options.
842 STRING is the option name. VARIABLE is the address of the variable.
843 ON_VALUE is the value to store in VARIABLE
844 if `-fSTRING' is seen as an option.
845 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
847 lang_independent_options f_options[] =
849 {"float-store", &flag_float_store, 1,
850 "Do not store floats in registers" },
851 {"volatile", &flag_volatile, 1,
852 "Consider all mem refs through pointers as volatile"},
853 {"volatile-global", &flag_volatile_global, 1,
854 "Consider all mem refs to global data to be volatile" },
855 {"volatile-static", &flag_volatile_static, 1,
856 "Consider all mem refs to static data to be volatile" },
857 {"defer-pop", &flag_defer_pop, 1,
858 "Defer popping functions args from stack until later" },
859 {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
860 "When possible do not generate stack frames"},
861 {"cse-follow-jumps", &flag_cse_follow_jumps, 1,
862 "When running CSE, follow jumps to their targets" },
863 {"cse-skip-blocks", &flag_cse_skip_blocks, 1,
864 "When running CSE, follow conditional jumps" },
865 {"expensive-optimizations", &flag_expensive_optimizations, 1,
866 "Perform a number of minor, expensive optimisations" },
867 {"thread-jumps", &flag_thread_jumps, 1,
868 "Perform jump threading optimisations"},
869 {"strength-reduce", &flag_strength_reduce, 1,
870 "Perform strength reduction optimisations" },
871 {"unroll-loops", &flag_unroll_loops, 1,
872 "Perform loop unrolling when iteration count is known" },
873 {"unroll-all-loops", &flag_unroll_all_loops, 1,
874 "Perform loop unrolling for all loops" },
875 {"move-all-movables", &flag_move_all_movables, 1,
876 "Force all loop invariant computations out of loops" },
877 {"reduce-all-givs", &flag_reduce_all_givs, 1,
878 "Strength reduce all loop general induction variables" },
879 {"writable-strings", &flag_writable_strings, 1,
880 "Store strings in writable data section" },
881 {"peephole", &flag_no_peephole, 0,
882 "Enable machine specific peephole optimisations" },
883 {"force-mem", &flag_force_mem, 1,
884 "Copy memory operands into registers before using" },
885 {"force-addr", &flag_force_addr, 1,
886 "Copy memory address constants into regs before using" },
887 {"function-cse", &flag_no_function_cse, 0,
888 "Allow function addresses to be held in registers" },
889 {"inline-functions", &flag_inline_functions, 1,
890 "Integrate simple functions into their callers" },
891 {"keep-inline-functions", &flag_keep_inline_functions, 1,
892 "Generate code for funcs even if they are fully inlined" },
893 {"inline", &flag_no_inline, 0,
894 "Pay attention to the 'inline' keyword"},
895 {"keep-static-consts", &flag_keep_static_consts, 1,
896 "Emit static const variables even if they are not used" },
897 {"syntax-only", &flag_syntax_only, 1,
898 "Check for syntax errors, then stop" },
899 {"shared-data", &flag_shared_data, 1,
900 "Mark data as shared rather than private" },
901 {"caller-saves", &flag_caller_saves, 1,
902 "Enable saving registers around function calls" },
903 {"pcc-struct-return", &flag_pcc_struct_return, 1,
904 "Return 'short' aggregates in memory, not registers" },
905 {"reg-struct-return", &flag_pcc_struct_return, 0,
906 "Return 'short' aggregates in registers" },
907 {"delayed-branch", &flag_delayed_branch, 1,
908 "Attempt to fill delay slots of branch instructions" },
909 {"gcse", &flag_gcse, 1,
910 "Perform the global common subexpression elimination" },
911 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
912 "Run CSE pass after loop optimisations"},
913 {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
914 "Run the loop optimiser twice"},
915 {"delete-null-pointer-checks", &flag_delete_null_pointer_checks, 1,
916 "Delete useless null pointer checks" },
917 {"pretend-float", &flag_pretend_float, 1,
918 "Pretend that host and target use the same FP format"},
919 {"schedule-insns", &flag_schedule_insns, 1,
920 "Reschedule instructions to avoid pipeline stalls"},
921 {"schedule-insns2", &flag_schedule_insns_after_reload, 1,
922 "Run two passes of the instruction scheduler"},
923 {"sched-interblock",&flag_schedule_interblock, 1,
924 "Enable scheduling across basic blocks" },
925 {"sched-spec",&flag_schedule_speculative, 1,
926 "Allow speculative motion of non-loads" },
927 {"sched-spec-load",&flag_schedule_speculative_load, 1,
928 "Allow speculative motion of some loads" },
929 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
930 "Allow speculative motion of more loads" },
931 {"branch-count-reg",&flag_branch_on_count_reg, 1,
932 "Replace add,compare,branch with branch on count reg"},
933 {"pic", &flag_pic, 1,
934 "Generate position independent code, if possible"},
935 {"PIC", &flag_pic, 2, ""},
936 {"exceptions", &flag_exceptions, 1,
937 "Enable exception handling" },
938 {"new-exceptions", &flag_new_exceptions, 1,
939 "Use the new model for exception handling" },
940 {"unwind-tables", &flag_unwind_tables, 1,
941 "Just generate unwind tables for exception handling" },
942 {"sjlj-exceptions", &exceptions_via_longjmp, 1,
943 "Use setjmp/longjmp to handle exceptions" },
944 {"asynchronous-exceptions", &asynchronous_exceptions, 1,
945 "Support asynchronous exceptions" },
946 {"profile-arcs", &profile_arc_flag, 1,
947 "Insert arc based program profiling code" },
948 {"test-coverage", &flag_test_coverage, 1,
949 "Create data files needed by gcov" },
950 {"branch-probabilities", &flag_branch_probabilities, 1,
951 "Use profiling information for branch probabilities" },
952 {"reorder-blocks", &flag_reorder_blocks, 1,
953 "Reorder basic blocks to improve code placement" },
954 {"fast-math", &flag_fast_math, 1,
955 "Improve FP speed by violating ANSI & IEEE rules" },
956 {"common", &flag_no_common, 0,
957 "Do not put unitialised globals in the common section" },
958 {"inhibit-size-directive", &flag_inhibit_size_directive, 1,
959 "Do not generate .size directives" },
960 {"function-sections", &flag_function_sections, 1,
961 "place each function into its own section" },
962 {"data-sections", &flag_data_sections, 1,
963 "place data items into their own section" },
964 {"verbose-asm", &flag_verbose_asm, 1,
965 "Add extra commentry to assembler output"},
966 {"gnu-linker", &flag_gnu_linker, 1,
967 "Output GNU ld formatted global initialisers"},
968 {"regmove", &flag_regmove, 1,
969 "Enables a register move optimisation"},
970 {"optimize-register-move", &flag_regmove, 1,
971 "Do the full regmove optimization pass"},
972 {"pack-struct", &flag_pack_struct, 1,
973 "Pack structure members together without holes" },
974 {"stack-check", &flag_stack_check, 1,
975 "Insert stack checking code into the program" },
976 {"argument-alias", &flag_argument_noalias, 0,
977 "Specify that arguments may alias each other & globals"},
978 {"argument-noalias", &flag_argument_noalias, 1,
979 "Assume arguments may alias globals but not each other"},
980 {"argument-noalias-global", &flag_argument_noalias, 2,
981 "Assume arguments do not alias each other or globals" },
982 {"strict-aliasing", &flag_strict_aliasing, 1,
983 "Assume strict aliasing rules apply" },
984 {"align-loops", &align_loops, 0,
985 "Align the start of loops" },
986 {"align-jumps", &align_jumps, 0,
987 "Align labels which are only reached by jumping" },
988 {"align-labels", &align_labels, 0,
989 "Align all labels" },
990 {"align-functions", &align_functions, 0,
991 "Align the start of functions" },
992 {"check-memory-usage", &flag_check_memory_usage, 1,
993 "Generate code to check every memory access" },
994 {"prefix-function-name", &flag_prefix_function_name, 1,
995 "Add a prefix to all function names" },
996 {"dump-unnumbered", &flag_dump_unnumbered, 1,
997 "Suppress output of instruction numbers and line number notes in debugging dumps"},
998 {"instrument-functions", &flag_instrument_function_entry_exit, 1,
999 "Instrument function entry/exit with profiling calls"},
1000 {"leading-underscore", &flag_leading_underscore, 1,
1001 "External symbols have a leading underscore" },
1002 {"ident", &flag_no_ident, 0,
1003 "Process #ident directives"},
1004 { "peephole2", &flag_peephole2, 1,
1005 "Enables an rtl peephole pass run before sched2" },
1006 {"math-errno", &flag_errno_math, 1,
1007 "Set errno after built-in math functions"},
1008 {"bounded-pointers", &flag_bounded_pointers, 1,
1009 "Compile pointers as triples: value, base & end" },
1010 {"bounds-check", &flag_bounds_check, 1,
1011 "Generate code to check bounds before dereferencing pointers and arrays" }
1014 #define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0]))
1016 /* Table of language-specific options. */
1018 static struct lang_opt
1020 const char * option;
1021 const char * description;
1023 documented_lang_options[] =
1025 /* In order not to overload the --help output, the convention
1026 used here is to only describe those options which are not
1027 enabled by default. */
1029 { "-ansi", "Compile just for ANSI C" },
1030 { "-fallow-single-precision",
1031 "Do not promote floats to double if using -traditional" },
1032 { "-std= ", "Determine language standard"},
1034 { "-fsigned-bitfields", "" },
1035 { "-funsigned-bitfields","Make bitfields by unsigned by default" },
1036 { "-fno-signed-bitfields", "" },
1037 { "-fno-unsigned-bitfields","" },
1038 { "-fsigned-char", "Make 'char' be signed by default"},
1039 { "-funsigned-char", "Make 'char' be unsigned by default"},
1040 { "-fno-signed-char", "" },
1041 { "-fno-unsigned-char", "" },
1043 { "-ftraditional", "" },
1044 { "-traditional", "Attempt to support traditional K&R style C"},
1045 { "-fnotraditional", "" },
1046 { "-fno-traditional", "" },
1048 { "-fasm", "" },
1049 { "-fno-asm", "Do not recognise the 'asm' keyword" },
1050 { "-fbuiltin", "" },
1051 { "-fno-builtin", "Do not recognise any built in functions" },
1052 { "-fhosted", "Assume normal C execution environment" },
1053 { "-fno-hosted", "" },
1054 { "-ffreestanding",
1055 "Assume that standard libraries & main might not exist" },
1056 { "-fno-freestanding", "" },
1057 { "-fcond-mismatch", "Allow different types as args of ? operator"},
1058 { "-fno-cond-mismatch", "" },
1059 { "-fdollars-in-identifiers", "Allow the use of $ inside identifiers" },
1060 { "-fno-dollars-in-identifiers", "" },
1061 { "-fpreprocessed", "" },
1062 { "-fno-preprocessed", "" },
1063 { "-fshort-double", "Use the same size for double as for float" },
1064 { "-fno-short-double", "" },
1065 { "-fshort-enums", "Use the smallest fitting integer to hold enums"},
1066 { "-fno-short-enums", "" },
1067 { "-fshort-wchar", "Override the underlying type for wchar_t to `unsigned short'" },
1068 { "-fno-short-wchar", "" },
1070 { "-Wall", "Enable most warning messages" },
1071 { "-Wbad-function-cast",
1072 "Warn about casting functions to incompatible types" },
1073 { "-Wno-bad-function-cast", "" },
1074 { "-Wmissing-noreturn",
1075 "Warn about functions which might be candidates for attribute noreturn" },
1076 { "-Wno-missing-noreturn", "" },
1077 { "-Wcast-qual", "Warn about casts which discard qualifiers"},
1078 { "-Wno-cast-qual", "" },
1079 { "-Wchar-subscripts", "Warn about subscripts whose type is 'char'"},
1080 { "-Wno-char-subscripts", "" },
1081 { "-Wcomment", "Warn if nested comments are detected" },
1082 { "-Wno-comment", "" },
1083 { "-Wcomments", "Warn if nested comments are detected" },
1084 { "-Wno-comments", "" },
1085 { "-Wconversion", "Warn about possibly confusing type conversions" },
1086 { "-Wno-conversion", "" },
1087 { "-Wformat", "Warn about printf format anomalies" },
1088 { "-Wno-format", "" },
1089 { "-Wimplicit-function-declaration",
1090 "Warn about implicit function declarations" },
1091 { "-Wno-implicit-function-declaration", "" },
1092 { "-Werror-implicit-function-declaration", "" },
1093 { "-Wimplicit-int", "Warn when a declaration does not specify a type" },
1094 { "-Wno-implicit-int", "" },
1095 { "-Wimplicit", "" },
1096 { "-Wno-implicit", "" },
1097 { "-Wimport", "Warn about the use of the #import directive" },
1098 { "-Wno-import", "" },
1099 { "-Wlong-long","" },
1100 { "-Wno-long-long", "Do not warn about using 'long long' when -pedantic" },
1101 { "-Wmain", "Warn about suspicious declarations of main" },
1102 { "-Wno-main", "" },
1103 { "-Wmissing-braces",
1104 "Warn about possibly missing braces around initialisers" },
1105 { "-Wno-missing-braces", "" },
1106 { "-Wmissing-declarations",
1107 "Warn about global funcs without previous declarations"},
1108 { "-Wno-missing-declarations", "" },
1109 { "-Wmissing-prototypes", "Warn about global funcs without prototypes" },
1110 { "-Wno-missing-prototypes", "" },
1111 { "-Wmultichar", "Warn about use of multicharacter literals"},
1112 { "-Wno-multichar", "" },
1113 { "-Wnested-externs", "Warn about externs not at file scope level" },
1114 { "-Wno-nested-externs", "" },
1115 { "-Wparentheses", "Warn about possible missing parentheses" },
1116 { "-Wno-parentheses", "" },
1117 { "-Wpointer-arith", "Warn about function pointer arithmetic" },
1118 { "-Wno-pointer-arith", "" },
1119 { "-Wredundant-decls",
1120 "Warn about multiple declarations of the same object" },
1121 { "-Wno-redundant-decls", "" },
1122 { "-Wsign-compare", "Warn about signed/unsigned comparisons" },
1123 { "-Wno-sign-compare", "" },
1124 { "-Wfloat-equal", "Warn about testing equality of floating point numbers" },
1125 { "-Wno-float-equal", "" },
1126 { "-Wunknown-pragmas", "Warn about unrecognized pragmas" },
1127 { "-Wno-unknown-pragmas", "" },
1128 { "-Wstrict-prototypes", "Warn about non-prototyped function decls" },
1129 { "-Wno-strict-prototypes", "" },
1130 { "-Wtraditional", "Warn about constructs whose meaning change in ANSI C"},
1131 { "-Wno-traditional", "" },
1132 { "-Wtrigraphs", "Warn when trigraphs are encountered" },
1133 { "-Wno-trigraphs", "" },
1134 { "-Wundef", "" },
1135 { "-Wno-undef", "" },
1136 { "-Wwrite-strings", "Mark strings as 'const char *'"},
1137 { "-Wno-write-strings", "" },
1139 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
1141 /* These are for Objective C. */
1142 DEFINE_LANG_NAME ("Objective C")
1144 { "-lang-objc", "" },
1145 { "-gen-decls", "Dump decls to a .decl file" },
1146 { "-fgnu-runtime", "Generate code for GNU runtime environment" },
1147 { "-fno-gnu-runtime", "" },
1148 { "-fnext-runtime", "Generate code for NeXT runtime environment" },
1149 { "-fno-next-runtime", "" },
1150 { "-Wselector", "Warn if a selector has multiple methods" },
1151 { "-Wno-selector", "" },
1152 { "-Wprotocol", "" },
1153 { "-Wno-protocol", "Do not warn if inherited methods are unimplemented"},
1154 { "-print-objc-runtime-info",
1155 "Generate C header of platform specific features" },
1157 #include "options.h"
1161 /* Here is a table, controlled by the tm.h file, listing each -m switch
1162 and which bits in `target_switches' it should set or clear.
1163 If VALUE is positive, it is bits to set.
1164 If VALUE is negative, -VALUE is bits to clear.
1165 (The sign bit is not used so there is no confusion.) */
1167 struct
1169 const char * name;
1170 int value;
1171 const char * description;
1173 target_switches [] = TARGET_SWITCHES;
1175 /* This table is similar, but allows the switch to have a value. */
1177 #ifdef TARGET_OPTIONS
1178 struct
1180 const char * prefix;
1181 const char ** variable;
1182 const char * description;
1184 target_options [] = TARGET_OPTIONS;
1185 #endif
1187 /* Options controlling warnings */
1189 /* Don't print warning messages. -w. */
1191 int inhibit_warnings = 0;
1193 /* Print various extra warnings. -W. */
1195 int extra_warnings = 0;
1197 /* Treat warnings as errors. -Werror. */
1199 int warnings_are_errors = 0;
1201 /* Nonzero to warn about unused local variables. */
1203 int warn_unused;
1205 /* Nonzero to warn about code which is never reached. */
1207 int warn_notreached;
1209 /* Nonzero to warn about variables used before they are initialized. */
1211 int warn_uninitialized;
1213 /* Nonzero means warn about all declarations which shadow others. */
1215 int warn_shadow;
1217 /* Warn if a switch on an enum fails to have a case for every enum value. */
1219 int warn_switch;
1221 /* Nonzero means warn about function definitions that default the return type
1222 or that use a null return and have a return-type other than void. */
1224 int warn_return_type;
1226 /* Nonzero means warn about pointer casts that increase the required
1227 alignment of the target type (and might therefore lead to a crash
1228 due to a misaligned access). */
1230 int warn_cast_align;
1232 /* Nonzero means warn about any identifiers that match in the first N
1233 characters. The value N is in `id_clash_len'. */
1235 int warn_id_clash;
1236 int id_clash_len;
1238 /* Nonzero means warn about any objects definitions whose size is larger
1239 than N bytes. Also want about function definitions whose returned
1240 values are larger than N bytes. The value N is in `larger_than_size'. */
1242 int warn_larger_than;
1243 HOST_WIDE_INT larger_than_size;
1245 /* Nonzero means warn if inline function is too large. */
1247 int warn_inline;
1249 /* Warn if a function returns an aggregate,
1250 since there are often incompatible calling conventions for doing this. */
1252 int warn_aggregate_return;
1254 /* Warn if packed attribute on struct is unnecessary and inefficient. */
1256 int warn_packed;
1258 /* Warn when gcc pads a structure to an alignment boundary. */
1260 int warn_padded;
1262 /* Likewise for -W. */
1264 lang_independent_options W_options[] =
1266 {"unused", &warn_unused, 1, "Warn when a variable is unused" },
1267 {"error", &warnings_are_errors, 1, ""},
1268 {"shadow", &warn_shadow, 1, "Warn when one local variable shadows another" },
1269 {"switch", &warn_switch, 1,
1270 "Warn about enumerated switches missing a specific case" },
1271 {"aggregate-return", &warn_aggregate_return, 1,
1272 "Warn about returning structures, unions or arrays" },
1273 {"cast-align", &warn_cast_align, 1,
1274 "Warn about pointer casts which increase alignment" },
1275 {"unreachable-code", &warn_notreached, 1,
1276 "Warn about code that will never be executed" },
1277 {"uninitialized", &warn_uninitialized, 1,
1278 "Warn about unitialized automatic variables"},
1279 {"inline", &warn_inline, 1,
1280 "Warn when an inlined function cannot be inlined"},
1281 {"packed", &warn_packed, 1,
1282 "Warn when the packed attribute has no effect on struct layout"},
1283 {"padded", &warn_padded, 1,
1284 "Warn when padding is required to align struct members"}
1287 /* Output files for assembler code (real compiler output)
1288 and debugging dumps. */
1290 FILE *asm_out_file;
1291 FILE *aux_info_file;
1292 FILE *rtl_dump_file = NULL;
1294 /* Decode the string P as an integral parameter.
1295 If the string is indeed an integer return its numeric value else
1296 issue an Invalid Option error for the option PNAME and return DEFVAL.
1297 If PNAME is zero just return DEFVAL, do not call error. */
1300 read_integral_parameter (p, pname, defval)
1301 const char *p;
1302 const char *pname;
1303 const int defval;
1305 const char *endp = p;
1307 while (*endp)
1309 if (*endp >= '0' && *endp <= '9')
1310 endp++;
1311 else
1312 break;
1315 if (*endp != 0)
1317 if (pname != 0)
1318 error ("Invalid option `%s'", pname);
1319 return defval;
1322 return atoi (p);
1326 /* Time accumulators, to count the total time spent in various passes. */
1328 int parse_time;
1329 int varconst_time;
1330 int integration_time;
1331 int jump_time;
1332 int cse_time;
1333 int gcse_time;
1334 int loop_time;
1335 int cse2_time;
1336 int branch_prob_time;
1337 int flow_time;
1338 int combine_time;
1339 int regmove_time;
1340 int sched_time;
1341 int local_alloc_time;
1342 int global_alloc_time;
1343 int flow2_time;
1344 int peephole2_time;
1345 int sched2_time;
1346 int dbr_sched_time;
1347 int reorder_blocks_time;
1348 int shorten_branch_time;
1349 int stack_reg_time;
1350 int final_time;
1351 int symout_time;
1352 int dump_time;
1353 int gc_time;
1354 int all_time;
1356 /* Return time used so far, in microseconds. */
1358 long
1359 get_run_time ()
1361 if (quiet_flag)
1362 return 0;
1364 #ifdef __BEOS__
1365 return 0;
1366 #else /* not BeOS */
1367 #if defined (_WIN32) && !defined (__CYGWIN__)
1368 if (clock() < 0)
1369 return 0;
1370 else
1371 return (clock() * 1000);
1372 #else /* not _WIN32 */
1373 #ifdef _SC_CLK_TCK
1375 static int tick;
1376 struct tms tms;
1377 if (tick == 0)
1378 tick = 1000000 / sysconf(_SC_CLK_TCK);
1379 times (&tms);
1380 return (tms.tms_utime + tms.tms_stime) * tick;
1382 #else
1383 #ifdef USG
1385 struct tms tms;
1386 # if HAVE_SYSCONF && defined _SC_CLK_TCK
1387 # define TICKS_PER_SECOND sysconf (_SC_CLK_TCK) /* POSIX 1003.1-1996 */
1388 # else
1389 # ifdef CLK_TCK
1390 # define TICKS_PER_SECOND CLK_TCK /* POSIX 1003.1-1988; obsolescent */
1391 # else
1392 # define TICKS_PER_SECOND HZ /* traditional UNIX */
1393 # endif
1394 # endif
1395 times (&tms);
1396 return (tms.tms_utime + tms.tms_stime) * (1000000 / TICKS_PER_SECOND);
1398 #else
1399 #ifndef VMS
1401 struct rusage rusage;
1402 getrusage (0, &rusage);
1403 return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
1404 + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
1406 #else /* VMS */
1408 struct
1410 int proc_user_time;
1411 int proc_system_time;
1412 int child_user_time;
1413 int child_system_time;
1414 } vms_times;
1415 times ((void *) &vms_times);
1416 return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
1418 #endif /* VMS */
1419 #endif /* USG */
1420 #endif /* _SC_CLK_TCK */
1421 #endif /* _WIN32 */
1422 #endif /* __BEOS__ */
1425 #define TIMEVAR(VAR, BODY) \
1426 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
1428 void
1429 print_time (str, total)
1430 const char *str;
1431 int total;
1433 fprintf (stderr,
1434 "time in %s: %d.%06d (%.0f%%)\n",
1435 str, total / 1000000, total % 1000000,
1436 all_time == 0 ? 0.00 : (double) total / (double) all_time * 100.0);
1439 /* This is the default decl_printable_name function. */
1441 static const char *
1442 decl_name (decl, verbosity)
1443 tree decl;
1444 int verbosity ATTRIBUTE_UNUSED;
1446 return IDENTIFIER_POINTER (DECL_NAME (decl));
1449 /* Mark P for GC. Also mark main_input_filename and input_filename. */
1450 static void
1451 mark_file_stack (p)
1452 void *p;
1454 struct file_stack *stack = *(struct file_stack **)p;
1456 /* We're only called for input_file_stack, so we can mark the current
1457 input_filename here as well. */
1458 ggc_mark_string (main_input_filename);
1459 ggc_mark_string (input_filename);
1461 while (stack)
1463 ggc_mark_string (stack->name);
1464 stack = stack->next;
1469 /* This calls abort and is used to avoid problems when abort if a macro.
1470 It is used when we need to pass the address of abort. */
1472 void
1473 do_abort ()
1475 abort ();
1478 /* When `malloc.c' is compiled with `rcheck' defined,
1479 it calls this function to report clobberage. */
1481 void
1482 botch (s)
1483 const char * s ATTRIBUTE_UNUSED;
1485 abort ();
1488 /* Return the logarithm of X, base 2, considering X unsigned,
1489 if X is a power of 2. Otherwise, returns -1.
1491 This should be used via the `exact_log2' macro. */
1494 exact_log2_wide (x)
1495 register unsigned HOST_WIDE_INT x;
1497 register int log = 0;
1498 /* Test for 0 or a power of 2. */
1499 if (x == 0 || x != (x & -x))
1500 return -1;
1501 while ((x >>= 1) != 0)
1502 log++;
1503 return log;
1506 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1507 If X is 0, return -1.
1509 This should be used via the floor_log2 macro. */
1512 floor_log2_wide (x)
1513 register unsigned HOST_WIDE_INT x;
1515 register int log = -1;
1516 while (x != 0)
1517 log++,
1518 x >>= 1;
1519 return log;
1522 static int float_handler_set;
1523 int float_handled;
1524 jmp_buf float_handler;
1526 /* Signals actually come here. */
1528 static void
1529 float_signal (signo)
1530 /* If this is missing, some compilers complain. */
1531 int signo ATTRIBUTE_UNUSED;
1533 if (float_handled == 0)
1534 abort ();
1535 #if defined (USG) || defined (hpux)
1536 signal (SIGFPE, float_signal); /* re-enable the signal catcher */
1537 #endif
1538 float_handled = 0;
1539 signal (SIGFPE, float_signal);
1540 longjmp (float_handler, 1);
1543 /* Specify where to longjmp to when a floating arithmetic error happens.
1544 If HANDLER is 0, it means don't handle the errors any more. */
1546 void
1547 set_float_handler (handler)
1548 jmp_buf handler;
1550 float_handled = (handler != 0);
1551 if (handler)
1552 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1554 if (float_handled && ! float_handler_set)
1556 signal (SIGFPE, float_signal);
1557 float_handler_set = 1;
1561 /* This is a wrapper function for code which might elicit an
1562 arithmetic exception. That code should be passed in as a function
1563 pointer FN, and one argument DATA. DATA is usually a struct which
1564 contains the real input and output for function FN. This function
1565 returns 0 (failure) if longjmp was called (i.e. an exception
1566 occured.) It returns 1 (success) otherwise. */
1569 do_float_handler (fn, data)
1570 void (*fn) PARAMS ((PTR));
1571 PTR data;
1573 jmp_buf buf;
1575 if (setjmp (buf))
1577 /* We got here via longjmp() caused by an exception in function fn() */
1578 set_float_handler (NULL);
1579 return 0;
1582 set_float_handler (buf);
1583 (*fn)(data);
1584 set_float_handler (NULL);
1585 return 1;
1588 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1589 error happens, pushing the previous specification into OLD_HANDLER.
1590 Return an indication of whether there was a previous handler in effect. */
1593 push_float_handler (handler, old_handler)
1594 jmp_buf handler, old_handler;
1596 int was_handled = float_handled;
1598 float_handled = 1;
1599 if (was_handled)
1600 memcpy ((char *) old_handler, (char *) float_handler,
1601 sizeof (float_handler));
1603 memcpy ((char *) float_handler, (char *) handler, sizeof (float_handler));
1604 return was_handled;
1607 /* Restore the previous specification of whether and where to longjmp to
1608 when a floating arithmetic error happens. */
1610 void
1611 pop_float_handler (handled, handler)
1612 int handled;
1613 jmp_buf handler;
1615 float_handled = handled;
1616 if (handled)
1617 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1620 /* Handler for SIGPIPE. */
1622 static void
1623 pipe_closed (signo)
1624 /* If this is missing, some compilers complain. */
1625 int signo ATTRIBUTE_UNUSED;
1627 fatal ("output pipe has been closed");
1630 /* Strip off a legitimate source ending from the input string NAME of
1631 length LEN. Rather than having to know the names used by all of
1632 our front ends, we strip off an ending of a period followed by
1633 up to five characters. (Java uses ".class".) */
1635 void
1636 strip_off_ending (name, len)
1637 char *name;
1638 int len;
1640 int i;
1641 for (i = 2; i < 6 && len > i; i++)
1643 if (name[len - i] == '.')
1645 name[len - i] = '\0';
1646 break;
1651 /* Output a quoted string. */
1653 void
1654 output_quoted_string (asm_file, string)
1655 FILE *asm_file;
1656 const char *string;
1658 #ifdef OUTPUT_QUOTED_STRING
1659 OUTPUT_QUOTED_STRING (asm_file, string);
1660 #else
1661 char c;
1663 putc ('\"', asm_file);
1664 while ((c = *string++) != 0)
1666 if (c == '\"' || c == '\\')
1667 putc ('\\', asm_file);
1668 putc (c, asm_file);
1670 putc ('\"', asm_file);
1671 #endif
1674 /* Output a file name in the form wanted by System V. */
1676 void
1677 output_file_directive (asm_file, input_name)
1678 FILE *asm_file;
1679 const char *input_name;
1681 int len = strlen (input_name);
1682 const char *na = input_name + len;
1684 /* NA gets INPUT_NAME sans directory names. */
1685 while (na > input_name)
1687 if (na[-1] == '/')
1688 break;
1689 #ifdef DIR_SEPARATOR
1690 if (na[-1] == DIR_SEPARATOR)
1691 break;
1692 #endif
1693 na--;
1696 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1697 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1698 #else
1699 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1700 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1701 #else
1702 fprintf (asm_file, "\t.file\t");
1703 output_quoted_string (asm_file, na);
1704 fputc ('\n', asm_file);
1705 #endif
1706 #endif
1709 #ifdef ASM_IDENTIFY_LANGUAGE
1710 /* Routine to build language identifier for object file. */
1711 static void
1712 output_lang_identify (asm_out_file)
1713 FILE *asm_out_file;
1715 int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1716 char *s = (char *) alloca (len);
1717 sprintf (s, "__gnu_compiled_%s", lang_identify ());
1718 ASM_OUTPUT_LABEL (asm_out_file, s);
1720 #endif
1722 /* Routine to open a dump file. */
1723 static void
1724 open_dump_file (suffix, function_name)
1725 const char *suffix;
1726 const char *function_name;
1728 char *dumpname;
1730 TIMEVAR
1731 (dump_time,
1733 dumpname = concat (dump_base_name, suffix, NULL);
1735 if (rtl_dump_file != NULL)
1736 fclose (rtl_dump_file);
1738 rtl_dump_file = fopen (dumpname, "a");
1740 if (rtl_dump_file == NULL)
1741 pfatal_with_name (dumpname);
1743 free (dumpname);
1745 if (function_name)
1746 fprintf (rtl_dump_file, "\n;; Function %s\n\n", function_name);
1749 return;
1752 /* Routine to close a dump file. */
1753 static void
1754 close_dump_file (func, insns)
1755 void (*func) PARAMS ((FILE *, rtx));
1756 rtx insns;
1758 TIMEVAR
1759 (dump_time,
1761 if (func)
1762 func (rtl_dump_file, insns);
1764 fflush (rtl_dump_file);
1765 fclose (rtl_dump_file);
1767 rtl_dump_file = NULL;
1770 return;
1773 /* Routine to dump rtl into a file. */
1774 static void
1775 dump_rtl (suffix, decl, func, insns)
1776 const char *suffix;
1777 tree decl;
1778 void (*func) PARAMS ((FILE *, rtx));
1779 rtx insns;
1781 open_dump_file (suffix, decl_printable_name (decl, 2));
1782 close_dump_file (func, insns);
1785 /* Routine to empty a dump file. */
1786 static void
1787 clean_dump_file (suffix)
1788 const char *suffix;
1790 char * const dumpname = concat (dump_base_name, suffix, NULL);
1792 rtl_dump_file = fopen (dumpname, "w");
1794 if (rtl_dump_file == NULL)
1795 pfatal_with_name (dumpname);
1797 free (dumpname);
1799 fclose (rtl_dump_file);
1800 rtl_dump_file = NULL;
1802 return;
1805 /* Do any final processing required for the declarations in VEC, of
1806 which there are LEN. We write out inline functions and variables
1807 that have been deferred until this point, but which are required.
1808 Returns non-zero if anything was put out. */
1810 wrapup_global_declarations (vec, len)
1811 tree *vec;
1812 int len;
1814 tree decl;
1815 int i;
1816 int reconsider;
1817 int output_something = 0;
1819 for (i = 0; i < len; i++)
1821 decl = vec[i];
1823 /* We're not deferring this any longer. */
1824 DECL_DEFER_OUTPUT (decl) = 0;
1826 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
1827 && incomplete_decl_finalize_hook != 0)
1828 (*incomplete_decl_finalize_hook) (decl);
1831 /* Now emit any global variables or functions that we have been
1832 putting off. We need to loop in case one of the things emitted
1833 here references another one which comes earlier in the list. */
1836 reconsider = 0;
1837 for (i = 0; i < len; i++)
1839 decl = vec[i];
1841 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
1842 continue;
1844 /* Don't write out static consts, unless we still need them.
1846 We also keep static consts if not optimizing (for debugging),
1847 unless the user specified -fno-keep-static-consts.
1848 ??? They might be better written into the debug information.
1849 This is possible when using DWARF.
1851 A language processor that wants static constants to be always
1852 written out (even if it is not used) is responsible for
1853 calling rest_of_decl_compilation itself. E.g. the C front-end
1854 calls rest_of_decl_compilation from finish_decl.
1855 One motivation for this is that is conventional in some
1856 environments to write things like:
1857 static const char rcsid[] = "... version string ...";
1858 intending to force the string to be in the executable.
1860 A language processor that would prefer to have unneeded
1861 static constants "optimized away" would just defer writing
1862 them out until here. E.g. C++ does this, because static
1863 constants are often defined in header files.
1865 ??? A tempting alternative (for both C and C++) would be
1866 to force a constant to be written if and only if it is
1867 defined in a main file, as opposed to an include file. */
1869 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1870 && (! TREE_READONLY (decl)
1871 || TREE_PUBLIC (decl)
1872 || (!optimize && flag_keep_static_consts)
1873 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1875 reconsider = 1;
1876 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
1879 if (TREE_CODE (decl) == FUNCTION_DECL
1880 && DECL_INITIAL (decl) != 0
1881 && DECL_SAVED_INSNS (decl) != 0
1882 && (flag_keep_inline_functions
1883 || (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
1884 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
1886 reconsider = 1;
1887 temporary_allocation ();
1888 output_inline_function (decl);
1889 permanent_allocation (1);
1893 if (reconsider)
1894 output_something = 1;
1896 while (reconsider);
1898 return output_something;
1901 /* Issue appropriate warnings for the global declarations in VEC (of
1902 which there are LEN). Output debugging information for them. */
1903 void
1904 check_global_declarations (vec, len)
1905 tree *vec;
1906 int len;
1908 tree decl;
1909 int i;
1911 for (i = 0; i < len; i++)
1913 decl = vec[i];
1915 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1916 && ! TREE_ASM_WRITTEN (decl))
1917 /* Cancel the RTL for this decl so that, if debugging info
1918 output for global variables is still to come,
1919 this one will be omitted. */
1920 DECL_RTL (decl) = NULL;
1922 /* Warn about any function
1923 declared static but not defined.
1924 We don't warn about variables,
1925 because many programs have static variables
1926 that exist only to get some text into the object file. */
1927 if (TREE_CODE (decl) == FUNCTION_DECL
1928 && (warn_unused
1929 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
1930 && DECL_INITIAL (decl) == 0
1931 && DECL_EXTERNAL (decl)
1932 && ! DECL_ARTIFICIAL (decl)
1933 && ! TREE_PUBLIC (decl))
1935 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
1936 pedwarn_with_decl (decl,
1937 "`%s' used but never defined");
1938 else
1939 warning_with_decl (decl,
1940 "`%s' declared `static' but never defined");
1941 /* This symbol is effectively an "extern" declaration now. */
1942 TREE_PUBLIC (decl) = 1;
1943 assemble_external (decl);
1946 /* Warn about static fns or vars defined but not used,
1947 but not about inline functions or static consts
1948 since defining those in header files is normal practice. */
1949 if (warn_unused
1950 && ((TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
1951 || (TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
1952 && ! DECL_IN_SYSTEM_HEADER (decl)
1953 && ! DECL_EXTERNAL (decl)
1954 && ! TREE_PUBLIC (decl)
1955 && ! TREE_USED (decl)
1956 && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
1957 /* The TREE_USED bit for file-scope decls
1958 is kept in the identifier, to handle multiple
1959 external decls in different scopes. */
1960 && ! TREE_USED (DECL_NAME (decl)))
1961 warning_with_decl (decl, "`%s' defined but not used");
1963 #ifdef SDB_DEBUGGING_INFO
1964 /* The COFF linker can move initialized global vars to the end.
1965 And that can screw up the symbol ordering.
1966 By putting the symbols in that order to begin with,
1967 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
1968 if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
1969 && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
1970 && ! DECL_EXTERNAL (decl)
1971 && DECL_RTL (decl) != 0)
1972 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
1974 /* Output COFF information for non-global
1975 file-scope initialized variables. */
1976 if (write_symbols == SDB_DEBUG
1977 && TREE_CODE (decl) == VAR_DECL
1978 && DECL_INITIAL (decl)
1979 && ! DECL_EXTERNAL (decl)
1980 && DECL_RTL (decl) != 0
1981 && GET_CODE (DECL_RTL (decl)) == MEM)
1982 TIMEVAR (symout_time, sdbout_toplevel_data (decl));
1983 #endif /* SDB_DEBUGGING_INFO */
1984 #ifdef DWARF_DEBUGGING_INFO
1985 /* Output DWARF information for file-scope tentative data object
1986 declarations, file-scope (extern) function declarations (which
1987 had no corresponding body) and file-scope tagged type declarations
1988 and definitions which have not yet been forced out. */
1990 if (write_symbols == DWARF_DEBUG
1991 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
1992 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
1993 #endif
1994 #ifdef DWARF2_DEBUGGING_INFO
1995 /* Output DWARF2 information for file-scope tentative data object
1996 declarations, file-scope (extern) function declarations (which
1997 had no corresponding body) and file-scope tagged type declarations
1998 and definitions which have not yet been forced out. */
2000 if (write_symbols == DWARF2_DEBUG
2001 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2002 TIMEVAR (symout_time, dwarf2out_decl (decl));
2003 #endif
2007 /* Save the current INPUT_FILENAME and LINENO on the top entry in the
2008 INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
2009 INPUT_FILENAME and LINENO accordingly. */
2011 void
2012 push_srcloc (file, line)
2013 char *file;
2014 int line;
2016 struct file_stack *fs;
2018 if (input_file_stack)
2020 input_file_stack->name = input_filename;
2021 input_file_stack->line = lineno;
2024 fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2025 fs->name = input_filename = file;
2026 fs->line = lineno = line;
2027 fs->indent_level = 0;
2028 fs->next = input_file_stack;
2029 input_file_stack = fs;
2030 input_file_stack_tick++;
2033 /* Pop the top entry off the stack of presently open source files.
2034 Restore the INPUT_FILENAME and LINENO from the new topmost entry on
2035 the stack. */
2037 void
2038 pop_srcloc ()
2040 struct file_stack *fs;
2042 fs = input_file_stack;
2043 input_file_stack = fs->next;
2044 free (fs);
2045 input_file_stack_tick++;
2046 /* The initial souce file is never popped. */
2047 if (!input_file_stack)
2048 abort ();
2049 input_filename = input_file_stack->name;
2050 lineno = input_file_stack->line;
2053 /* Compile an entire file of output from cpp, named NAME.
2054 Write a file of assembly output and various debugging dumps. */
2056 static void
2057 compile_file (name)
2058 char *name;
2060 tree globals;
2061 int start_time;
2063 int name_specified = name != 0;
2065 if (dump_base_name == 0)
2066 dump_base_name = name ? name : "gccdump";
2068 parse_time = 0;
2069 varconst_time = 0;
2070 integration_time = 0;
2071 jump_time = 0;
2072 cse_time = 0;
2073 gcse_time = 0;
2074 loop_time = 0;
2075 cse2_time = 0;
2076 branch_prob_time = 0;
2077 flow_time = 0;
2078 combine_time = 0;
2079 regmove_time = 0;
2080 sched_time = 0;
2081 local_alloc_time = 0;
2082 global_alloc_time = 0;
2083 flow2_time = 0;
2084 peephole2_time = 0;
2085 sched2_time = 0;
2086 dbr_sched_time = 0;
2087 reorder_blocks_time = 0;
2088 shorten_branch_time = 0;
2089 stack_reg_time = 0;
2090 final_time = 0;
2091 symout_time = 0;
2092 dump_time = 0;
2094 /* Initialize data in various passes. */
2096 init_obstacks ();
2097 init_tree_codes ();
2098 name = init_parse (name);
2099 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
2100 || debug_info_level == DINFO_LEVEL_VERBOSE
2101 || flag_test_coverage
2102 || warn_notreached);
2103 init_regs ();
2104 init_decl_processing ();
2105 init_optabs ();
2106 init_stmt ();
2107 init_eh ();
2108 init_loop ();
2109 init_reload ();
2110 init_alias_once ();
2111 init_function_once ();
2112 init_stor_layout_once ();
2113 init_varasm_once ();
2115 /* The following initialization functions need to generate rtl, so
2116 provide a dummy function context for them. */
2117 init_dummy_function_start ();
2118 init_expmed ();
2119 init_expr_once ();
2120 if (flag_caller_saves)
2121 init_caller_save ();
2122 expand_dummy_function_end ();
2124 /* If auxiliary info generation is desired, open the output file.
2125 This goes in the same directory as the source file--unlike
2126 all the other output files. */
2127 if (flag_gen_aux_info)
2129 aux_info_file = fopen (aux_info_file_name, "w");
2130 if (aux_info_file == 0)
2131 pfatal_with_name (aux_info_file_name);
2134 /* Clear the dump files. */
2135 if (rtl_dump)
2136 clean_dump_file (".00.rtl");
2137 if (jump_opt_dump)
2139 clean_dump_file (".01.jump");
2140 if (graph_dump_format != no_graph)
2141 clean_graph_dump_file (dump_base_name, ".01.jump");
2143 if (cse_dump)
2145 clean_dump_file (".02.cse");
2146 if (graph_dump_format != no_graph)
2147 clean_graph_dump_file (dump_base_name, ".02.cse");
2149 if (addressof_dump)
2151 clean_dump_file (".03.addressof");
2152 if (graph_dump_format != no_graph)
2153 clean_graph_dump_file (dump_base_name, ".03.addressof");
2155 if (gcse_dump)
2157 clean_dump_file (".04.gcse");
2158 if (graph_dump_format != no_graph)
2159 clean_graph_dump_file (dump_base_name, ".04.gcse");
2161 if (loop_dump)
2163 clean_dump_file (".05.loop");
2164 if (graph_dump_format != no_graph)
2165 clean_graph_dump_file (dump_base_name, ".05.loop");
2167 if (cse2_dump)
2169 clean_dump_file (".06.cse2");
2170 if (graph_dump_format != no_graph)
2171 clean_graph_dump_file (dump_base_name, ".06.cse2");
2173 if (branch_prob_dump)
2175 clean_dump_file (".07.bp");
2176 if (graph_dump_format != no_graph)
2177 clean_graph_dump_file (dump_base_name, ".07.bp");
2179 if (flow_dump)
2181 clean_dump_file (".08.flow");
2182 if (graph_dump_format != no_graph)
2183 clean_graph_dump_file (dump_base_name, ".08.flow");
2185 if (combine_dump)
2187 clean_dump_file (".09.combine");
2188 if (graph_dump_format != no_graph)
2189 clean_graph_dump_file (dump_base_name, ".09.combine");
2191 if (regmove_dump)
2193 clean_dump_file (".10.regmove");
2194 if (graph_dump_format != no_graph)
2195 clean_graph_dump_file (dump_base_name, ".10.regmove");
2197 #ifdef INSN_SCHEDULING
2198 if (sched_dump)
2200 clean_dump_file (".11.sched");
2201 if (graph_dump_format != no_graph)
2202 clean_graph_dump_file (dump_base_name, ".11.sched");
2204 #endif
2205 if (local_reg_dump)
2207 clean_dump_file (".12.lreg");
2208 if (graph_dump_format != no_graph)
2209 clean_graph_dump_file (dump_base_name, ".12.lreg");
2211 if (global_reg_dump)
2213 clean_dump_file (".13.greg");
2214 if (graph_dump_format != no_graph)
2215 clean_graph_dump_file (dump_base_name, ".13.greg");
2217 if (flow2_dump)
2219 clean_dump_file (".14.flow2");
2220 if (graph_dump_format != no_graph)
2221 clean_graph_dump_file (dump_base_name, ".14.flow2");
2223 #ifdef HAVE_peephole2
2224 if (peephole2_dump)
2226 clean_dump_file (".15.peephole2");
2227 if (graph_dump_format != no_graph)
2228 clean_graph_dump_file (dump_base_name, ".15.peephole2");
2230 #endif
2231 #ifdef INSN_SCHEDULING
2232 if (sched2_dump)
2234 clean_dump_file (".16.sched2");
2235 if (graph_dump_format != no_graph)
2236 clean_graph_dump_file (dump_base_name, ".16.sched2");
2238 #endif
2239 if (reorder_blocks_dump)
2241 clean_dump_file (".bbro");
2242 if (graph_dump_format != no_graph)
2243 clean_graph_dump_file (dump_base_name, ".bbro");
2245 if (jump2_opt_dump)
2247 clean_dump_file (".17.jump2");
2248 if (graph_dump_format != no_graph)
2249 clean_graph_dump_file (dump_base_name, ".17.jump2");
2251 #ifdef MACHINE_DEPENDENT_REORG
2252 if (mach_dep_reorg_dump)
2254 clean_dump_file (".18.mach");
2255 if (graph_dump_format != no_graph)
2256 clean_graph_dump_file (dump_base_name, ".18.mach");
2258 #endif
2259 #ifdef DELAY_SLOTS
2260 if (dbr_sched_dump)
2262 clean_dump_file (".19.dbr");
2263 if (graph_dump_format != no_graph)
2264 clean_graph_dump_file (dump_base_name, ".19.dbr");
2266 #endif
2267 #ifdef STACK_REGS
2268 if (stack_reg_dump)
2270 clean_dump_file (".20.stack");
2271 if (graph_dump_format != no_graph)
2272 clean_graph_dump_file (dump_base_name, ".20.stack");
2274 #endif
2276 /* Open assembler code output file. */
2278 if (flag_syntax_only)
2279 asm_out_file = NULL;
2280 else
2282 if (! name_specified && asm_file_name == 0)
2283 asm_out_file = stdout;
2284 else
2286 if (asm_file_name == 0)
2288 int len = strlen (dump_base_name);
2289 char *dumpname = (char *) xmalloc (len + 6);
2290 memcpy (dumpname, dump_base_name, len + 1);
2291 strip_off_ending (dumpname, len);
2292 strcat (dumpname, ".s");
2293 asm_file_name = dumpname;
2295 if (!strcmp (asm_file_name, "-"))
2296 asm_out_file = stdout;
2297 else
2298 asm_out_file = fopen (asm_file_name, "w");
2299 if (asm_out_file == 0)
2300 pfatal_with_name (asm_file_name);
2303 #ifdef IO_BUFFER_SIZE
2304 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
2305 _IOFBF, IO_BUFFER_SIZE);
2306 #endif
2309 if (ggc_p)
2310 name = ggc_alloc_string (name, strlen (name));
2311 input_filename = name;
2313 /* Put an entry on the input file stack for the main input file. */
2314 push_srcloc (input_filename, 0);
2316 /* Perform language-specific initialization.
2317 This may set main_input_filename. */
2318 lang_init ();
2320 /* If the input doesn't start with a #line, use the input name
2321 as the official input file name. */
2322 if (main_input_filename == 0)
2323 main_input_filename = name;
2325 if (flag_syntax_only)
2327 write_symbols = NO_DEBUG;
2328 profile_flag = 0;
2329 profile_block_flag = 0;
2331 else
2333 ASM_FILE_START (asm_out_file);
2335 #ifdef ASM_COMMENT_START
2336 if (flag_verbose_asm)
2338 /* Print the list of options in effect. */
2339 print_version (asm_out_file, ASM_COMMENT_START);
2340 print_switch_values (asm_out_file, 0, MAX_LINE,
2341 ASM_COMMENT_START, " ", "\n");
2342 /* Add a blank line here so it appears in assembler output but not
2343 screen output. */
2344 fprintf (asm_out_file, "\n");
2346 #endif
2348 /* Output something to inform GDB that this compilation was by GCC. */
2349 #ifndef ASM_IDENTIFY_GCC
2350 fprintf (asm_out_file, "gcc2_compiled.:\n");
2351 #else
2352 ASM_IDENTIFY_GCC (asm_out_file);
2353 #endif
2355 /* Output something to identify which front-end produced this file. */
2356 #ifdef ASM_IDENTIFY_LANGUAGE
2357 ASM_IDENTIFY_LANGUAGE (asm_out_file);
2358 #endif
2359 } /* ! flag_syntax_only */
2361 #ifndef ASM_OUTPUT_SECTION_NAME
2362 if (flag_function_sections)
2364 warning ("-ffunction-sections not supported for this target.");
2365 flag_function_sections = 0;
2367 if (flag_data_sections)
2369 warning ("-fdata-sections not supported for this target.");
2370 flag_data_sections = 0;
2372 #endif
2374 if (flag_function_sections
2375 && (profile_flag || profile_block_flag))
2377 warning ("-ffunction-sections disabled; it makes profiling impossible.");
2378 flag_function_sections = 0;
2381 #ifndef OBJECT_FORMAT_ELF
2382 if (flag_function_sections && write_symbols != NO_DEBUG)
2383 warning ("-ffunction-sections may affect debugging on some targets.");
2384 #endif
2386 /* ??? Note: There used to be a conditional here
2387 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2388 This was to guarantee separation between gcc_compiled. and
2389 the first function, for the sake of dbx on Suns.
2390 However, having the extra zero here confused the Emacs
2391 code for unexec, and might confuse other programs too.
2392 Therefore, I took out that change.
2393 In future versions we should find another way to solve
2394 that dbx problem. -- rms, 23 May 93. */
2396 /* Don't let the first function fall at the same address
2397 as gcc_compiled., if profiling. */
2398 if (profile_flag || profile_block_flag)
2400 /* It's best if we can write a nop here since some
2401 assemblers don't tolerate zeros in the text section. */
2402 output_asm_insn (get_insn_template (CODE_FOR_nop, NULL), NULL_PTR);
2405 /* If dbx symbol table desired, initialize writing it
2406 and output the predefined types. */
2407 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2408 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2409 TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
2410 getdecls ()));
2411 #endif
2412 #ifdef SDB_DEBUGGING_INFO
2413 if (write_symbols == SDB_DEBUG)
2414 TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
2415 getdecls ()));
2416 #endif
2417 #ifdef DWARF_DEBUGGING_INFO
2418 if (write_symbols == DWARF_DEBUG)
2419 TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
2420 #endif
2421 #ifdef DWARF2_UNWIND_INFO
2422 if (dwarf2out_do_frame ())
2423 dwarf2out_frame_init ();
2424 #endif
2425 #ifdef DWARF2_DEBUGGING_INFO
2426 if (write_symbols == DWARF2_DEBUG)
2427 TIMEVAR (symout_time, dwarf2out_init (asm_out_file, main_input_filename));
2428 #endif
2430 /* Initialize yet another pass. */
2432 init_final (main_input_filename);
2433 init_branch_prob (dump_base_name);
2435 start_time = get_run_time ();
2437 /* Call the parser, which parses the entire file
2438 (calling rest_of_compilation for each function). */
2440 if (yyparse () != 0)
2442 if (errorcount == 0)
2443 fnotice (stderr, "Errors detected in input file (your bison.simple is out of date)\n");
2445 /* In case there were missing closebraces,
2446 get us back to the global binding level. */
2447 while (! global_bindings_p ())
2448 poplevel (0, 0, 0);
2451 /* Compilation is now finished except for writing
2452 what's left of the symbol table output. */
2454 parse_time += get_run_time () - start_time;
2456 parse_time -= integration_time;
2457 parse_time -= varconst_time;
2459 if (flag_syntax_only)
2460 goto finish_syntax;
2462 globals = getdecls ();
2464 /* Really define vars that have had only a tentative definition.
2465 Really output inline functions that must actually be callable
2466 and have not been output so far. */
2469 int len = list_length (globals);
2470 tree *vec = (tree *) xmalloc (sizeof (tree) * len);
2471 int i;
2472 tree decl;
2474 /* Process the decls in reverse order--earliest first.
2475 Put them into VEC from back to front, then take out from front. */
2477 for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
2478 vec[len - i - 1] = decl;
2480 wrapup_global_declarations (vec, len);
2482 /* This must occur after the loop to output deferred functions. Else
2483 the profiler initializer would not be emitted if all the functions
2484 in this compilation unit were deferred.
2486 output_func_start_profiler can not cause any additional functions or
2487 data to need to be output, so it need not be in the deferred function
2488 loop above. */
2489 output_func_start_profiler ();
2491 /* Now that all possible functions have been output, we can dump
2492 the exception table. */
2494 output_exception_table ();
2496 check_global_declarations (vec, len);
2498 /* Clean up. */
2499 free (vec);
2502 /* Write out any pending weak symbol declarations. */
2504 weak_finish ();
2506 /* Do dbx symbols */
2507 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2508 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2509 TIMEVAR (symout_time,
2511 dbxout_finish (asm_out_file, main_input_filename);
2513 #endif
2515 #ifdef DWARF_DEBUGGING_INFO
2516 if (write_symbols == DWARF_DEBUG)
2517 TIMEVAR (symout_time,
2519 dwarfout_finish ();
2521 #endif
2523 #ifdef DWARF2_UNWIND_INFO
2524 if (dwarf2out_do_frame ())
2525 dwarf2out_frame_finish ();
2526 #endif
2528 #ifdef DWARF2_DEBUGGING_INFO
2529 if (write_symbols == DWARF2_DEBUG)
2530 TIMEVAR (symout_time,
2532 dwarf2out_finish ();
2534 #endif
2536 /* Output some stuff at end of file if nec. */
2538 end_final (dump_base_name);
2540 if (branch_prob_dump)
2541 open_dump_file (".07.bp", NULL);
2543 TIMEVAR (dump_time, end_branch_prob (rtl_dump_file));
2545 if (branch_prob_dump)
2546 close_dump_file (NULL, NULL_RTX);
2548 #ifdef ASM_FILE_END
2549 ASM_FILE_END (asm_out_file);
2550 #endif
2553 /* Language-specific end of compilation actions. */
2554 finish_syntax:
2555 lang_finish ();
2557 /* Close the dump files. */
2559 if (flag_gen_aux_info)
2561 fclose (aux_info_file);
2562 if (errorcount)
2563 unlink (aux_info_file_name);
2566 if (combine_dump)
2568 open_dump_file (".09.combine", NULL);
2569 TIMEVAR (dump_time, dump_combine_total_stats (rtl_dump_file));
2570 close_dump_file (NULL, NULL_RTX);
2573 /* Close non-debugging input and output files. Take special care to note
2574 whether fclose returns an error, since the pages might still be on the
2575 buffer chain while the file is open. */
2577 finish_parse ();
2579 if (! flag_syntax_only
2580 && (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0))
2581 fatal_io_error (asm_file_name);
2583 /* Do whatever is necessary to finish printing the graphs. */
2584 if (graph_dump_format != no_graph)
2586 if (jump_opt_dump)
2587 finish_graph_dump_file (dump_base_name, ".01.jump");
2588 if (cse_dump)
2589 finish_graph_dump_file (dump_base_name, ".02.cse");
2590 if (addressof_dump)
2591 finish_graph_dump_file (dump_base_name, ".03.addressof");
2592 if (gcse_dump)
2593 finish_graph_dump_file (dump_base_name, ".04.gcse");
2594 if (loop_dump)
2595 finish_graph_dump_file (dump_base_name, ".05.loop");
2596 if (cse2_dump)
2597 finish_graph_dump_file (dump_base_name, ".06.cse2");
2598 if (branch_prob_dump)
2599 finish_graph_dump_file (dump_base_name, ".07.bp");
2600 if (flow_dump)
2601 finish_graph_dump_file (dump_base_name, ".08.flow");
2602 if (combine_dump)
2603 finish_graph_dump_file (dump_base_name, ".09.combine");
2604 if (regmove_dump)
2605 finish_graph_dump_file (dump_base_name, ".10.regmove");
2606 #ifdef INSN_SCHEDULING
2607 if (sched_dump)
2608 finish_graph_dump_file (dump_base_name, ".11.sched");
2609 #endif
2610 if (local_reg_dump)
2611 finish_graph_dump_file (dump_base_name, ".12.lreg");
2612 if (global_reg_dump)
2613 finish_graph_dump_file (dump_base_name, ".13.greg");
2614 if (flow2_dump)
2615 finish_graph_dump_file (dump_base_name, ".14.flow2");
2616 #ifdef HAVE_peephole2
2617 if (flow2_dump)
2618 finish_graph_dump_file (dump_base_name, ".15.peephole2");
2619 #endif
2620 #ifdef INSN_SCHEDULING
2621 if (sched2_dump)
2622 finish_graph_dump_file (dump_base_name, ".16.sched2");
2623 #endif
2624 if (reorder_blocks_dump)
2625 finish_graph_dump_file (dump_base_name, ".bbro");
2626 if (jump2_opt_dump)
2627 finish_graph_dump_file (dump_base_name, ".17.jump2");
2628 #ifdef MACHINE_DEPENDENT_REORG
2629 if (mach_dep_reorg_dump)
2630 finish_graph_dump_file (dump_base_name, ".18.mach");
2631 #endif
2632 #ifdef DELAY_SLOTS
2633 if (dbr_sched_dump)
2634 finish_graph_dump_file (dump_base_name, ".19.dbr");
2635 #endif
2636 #ifdef STACK_REGS
2637 if (stack_reg_dump)
2638 finish_graph_dump_file (dump_base_name, ".20.stack");
2639 #endif
2642 /* Free up memory for the benefit of leak detectors. */
2643 free_reg_info ();
2645 /* Print the times. */
2647 if (! quiet_flag)
2649 all_time = get_run_time ();
2651 fprintf (stderr,"\n");
2653 print_time ("parse", parse_time);
2654 print_time ("integration", integration_time);
2655 print_time ("jump", jump_time);
2656 print_time ("cse", cse_time);
2657 print_time ("gcse", gcse_time);
2658 print_time ("loop", loop_time);
2659 print_time ("cse2", cse2_time);
2660 print_time ("branch-prob", branch_prob_time);
2661 print_time ("flow", flow_time);
2662 print_time ("combine", combine_time);
2663 print_time ("regmove", regmove_time);
2664 #ifdef INSN_SCHEDULING
2665 print_time ("sched", sched_time);
2666 #endif
2667 print_time ("local-alloc", local_alloc_time);
2668 print_time ("global-alloc", global_alloc_time);
2669 print_time ("flow2", flow2_time);
2670 #ifdef HAVE_peephole2
2671 print_time ("peephole2", peephole2_time);
2672 #endif
2673 #ifdef INSN_SCHEDULING
2674 print_time ("sched2", sched2_time);
2675 #endif
2676 #ifdef DELAY_SLOTS
2677 print_time ("dbranch", dbr_sched_time);
2678 #endif
2679 print_time ("bbro", reorder_blocks_time);
2680 print_time ("shorten-branch", shorten_branch_time);
2681 #ifdef STACK_REGS
2682 print_time ("stack-reg", stack_reg_time);
2683 #endif
2684 print_time ("final", final_time);
2685 print_time ("varconst", varconst_time);
2686 print_time ("symout", symout_time);
2687 print_time ("dump", dump_time);
2688 if (ggc_p)
2689 print_time ("gc", gc_time);
2693 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2694 and TYPE_DECL nodes.
2696 This does nothing for local (non-static) variables, unless the
2697 variable is a register variable with an ASMSPEC. In that case, or
2698 if the variable is not an automatice, it sets up the RTL and
2699 outputs any assembler code (label definition, storage allocation
2700 and initialization).
2702 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2703 the assembler symbol name to be used. TOP_LEVEL is nonzero
2704 if this declaration is not within a function. */
2706 void
2707 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2708 tree decl;
2709 const char *asmspec;
2710 int top_level;
2711 int at_end;
2713 /* Declarations of variables, and of functions defined elsewhere. */
2715 /* The most obvious approach, to put an #ifndef around where
2716 this macro is used, doesn't work since it's inside a macro call. */
2717 #ifndef ASM_FINISH_DECLARE_OBJECT
2718 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2719 #endif
2721 /* Forward declarations for nested functions are not "external",
2722 but we need to treat them as if they were. */
2723 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2724 || TREE_CODE (decl) == FUNCTION_DECL)
2725 TIMEVAR (varconst_time,
2727 make_decl_rtl (decl, asmspec, top_level);
2728 /* Initialized extern variable exists to be replaced
2729 with its value, or represents something that will be
2730 output in another file. */
2731 if (! (TREE_CODE (decl) == VAR_DECL
2732 && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
2733 && DECL_INITIAL (decl) != 0
2734 && DECL_INITIAL (decl) != error_mark_node))
2735 /* Don't output anything
2736 when a tentative file-scope definition is seen.
2737 But at end of compilation, do output code for them. */
2738 if (! (! at_end && top_level
2739 && (DECL_INITIAL (decl) == 0
2740 || DECL_INITIAL (decl) == error_mark_node)))
2741 assemble_variable (decl, top_level, at_end, 0);
2742 if (decl == last_assemble_variable_decl)
2744 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2745 top_level, at_end);
2748 else if (DECL_REGISTER (decl) && asmspec != 0)
2750 if (decode_reg_name (asmspec) >= 0)
2752 DECL_RTL (decl) = 0;
2753 make_decl_rtl (decl, asmspec, top_level);
2755 else
2756 error ("invalid register name `%s' for register variable", asmspec);
2758 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2759 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2760 && TREE_CODE (decl) == TYPE_DECL)
2761 TIMEVAR (symout_time, dbxout_symbol (decl, 0));
2762 #endif
2763 #ifdef SDB_DEBUGGING_INFO
2764 else if (write_symbols == SDB_DEBUG && top_level
2765 && TREE_CODE (decl) == TYPE_DECL)
2766 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
2767 #endif
2770 /* Called after finishing a record, union or enumeral type. */
2772 void
2773 rest_of_type_compilation (type, toplev)
2774 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
2775 tree type;
2776 int toplev;
2777 #else
2778 tree type ATTRIBUTE_UNUSED;
2779 int toplev ATTRIBUTE_UNUSED;
2780 #endif
2782 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2783 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2784 TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
2785 #endif
2786 #ifdef SDB_DEBUGGING_INFO
2787 if (write_symbols == SDB_DEBUG)
2788 TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
2789 #endif
2792 /* DECL is an inline function, whose body is present, but which is not
2793 being output at this point. (We're putting that off until we need
2794 to do it.) If there are any actions that need to take place,
2795 including the emission of debugging information for the function,
2796 this is where they should go. This function may be called by
2797 language-dependent code for front-ends that do not even generate
2798 RTL for functions that don't need to be put out. */
2800 void
2801 note_deferral_of_defined_inline_function (decl)
2802 tree decl ATTRIBUTE_UNUSED;
2804 #ifdef DWARF_DEBUGGING_INFO
2805 /* Generate the DWARF info for the "abstract" instance of a function
2806 which we may later generate inlined and/or out-of-line instances
2807 of. */
2808 if (write_symbols == DWARF_DEBUG)
2810 /* The front-end may not have set CURRENT_FUNCTION_DECL, but the
2811 DWARF code expects it to be set in this case. Intuitively,
2812 DECL is the function we just finished defining, so setting
2813 CURRENT_FUNCTION_DECL is sensible. */
2814 tree saved_cfd = current_function_decl;
2815 current_function_decl = decl;
2817 /* Let the DWARF code do its work. */
2818 set_decl_abstract_flags (decl, 1);
2819 dwarfout_file_scope_decl (decl, 0);
2820 set_decl_abstract_flags (decl, 0);
2822 /* Reset CURRENT_FUNCTION_DECL. */
2823 current_function_decl = saved_cfd;
2825 #endif
2828 /* This is called from finish_function (within yyparse)
2829 after each top-level definition is parsed.
2830 It is supposed to compile that function or variable
2831 and output the assembler code for it.
2832 After we return, the tree storage is freed. */
2834 void
2835 rest_of_compilation (decl)
2836 tree decl;
2838 register rtx insns;
2839 int start_time = get_run_time ();
2840 int tem;
2841 int failure = 0;
2842 int rebuild_label_notes_after_reload;
2844 /* When processing delayed functions, prepare_function_start() won't
2845 have been run to re-initialize it. */
2846 cse_not_expected = ! optimize;
2848 /* First, make sure that NOTE_BLOCK is set correctly for each
2849 NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note. */
2850 find_loop_tree_blocks ();
2852 /* Then remove any notes we don't need. That will make iterating
2853 over the instruction sequence faster, and allow the garbage
2854 collector to reclaim the memory used by the notes. */
2855 remove_unncessary_notes ();
2857 /* In function-at-a-time mode, we do not attempt to keep the BLOCK
2858 tree in sensible shape. So, we just recalculate it here. */
2859 if (cfun->x_whole_function_mode_p)
2860 unroll_block_trees ();
2862 /* If we are reconsidering an inline function
2863 at the end of compilation, skip the stuff for making it inline. */
2865 if (DECL_SAVED_INSNS (decl) == 0)
2867 int inlinable = 0;
2868 tree parent;
2869 const char *lose;
2871 /* If this is nested inside an inlined external function, pretend
2872 it was only declared. Since we cannot inline such functions,
2873 generating code for this one is not only not necessary but will
2874 confuse some debugging output writers. */
2875 for (parent = DECL_CONTEXT (current_function_decl);
2876 parent != NULL_TREE;
2877 parent = get_containing_scope (parent))
2878 if (TREE_CODE (parent) == FUNCTION_DECL
2879 && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
2881 DECL_INITIAL (decl) = 0;
2882 goto exit_rest_of_compilation;
2885 /* If requested, consider whether to make this function inline. */
2886 if (DECL_INLINE (decl) || flag_inline_functions)
2887 TIMEVAR (integration_time,
2889 lose = function_cannot_inline_p (decl);
2890 if (lose || ! optimize)
2892 if (warn_inline && DECL_INLINE (decl))
2893 warning_with_decl (decl, lose);
2894 DECL_ABSTRACT_ORIGIN (decl) = 0;
2895 /* Don't really compile an extern inline function.
2896 If we can't make it inline, pretend
2897 it was only declared. */
2898 if (DECL_EXTERNAL (decl))
2900 DECL_INITIAL (decl) = 0;
2901 goto exit_rest_of_compilation;
2904 else
2905 /* ??? Note that this has the effect of making it look
2906 like "inline" was specified for a function if we choose
2907 to inline it. This isn't quite right, but it's
2908 probably not worth the trouble to fix. */
2909 inlinable = DECL_INLINE (decl) = 1;
2912 insns = get_insns ();
2914 /* Dump the rtl code if we are dumping rtl. */
2916 if (rtl_dump)
2918 open_dump_file (".00.rtl", decl_printable_name (decl, 2));
2920 if (DECL_SAVED_INSNS (decl))
2921 fprintf (rtl_dump_file, ";; (integrable)\n\n");
2923 close_dump_file (print_rtl, insns);
2926 /* If function is inline, and we don't yet know whether to
2927 compile it by itself, defer decision till end of compilation.
2928 finish_compilation will call rest_of_compilation again
2929 for those functions that need to be output. Also defer those
2930 functions that we are supposed to defer. */
2932 if (inlinable
2933 || (DECL_INLINE (decl)
2934 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2935 && ! flag_keep_inline_functions)
2936 || DECL_EXTERNAL (decl))))
2937 DECL_DEFER_OUTPUT (decl) = 1;
2939 if (DECL_DEFER_OUTPUT (decl))
2941 /* If -Wreturn-type, we have to do a bit of compilation.
2942 However, if we just fall through we will call
2943 save_for_inline_copying() which results in excessive
2944 memory use. Instead, we just want to call
2945 jump_optimize() to figure out whether or not we can fall
2946 off the end of the function; we do the minimum amount of
2947 work necessary to make that safe. And, we set optimize
2948 to zero to keep jump_optimize from working too hard. */
2949 if (warn_return_type)
2951 int saved_optimize = optimize;
2952 optimize = 0;
2953 find_exception_handler_labels ();
2954 jump_optimize (get_insns(), !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
2955 !JUMP_AFTER_REGSCAN);
2956 optimize = saved_optimize;
2959 note_deferral_of_defined_inline_function (decl);
2960 TIMEVAR (integration_time, save_for_inline_nocopy (decl));
2961 DECL_SAVED_INSNS (decl)->inlinable = inlinable;
2962 goto exit_rest_of_compilation;
2965 /* If specified extern inline but we aren't inlining it, we are
2966 done. This goes for anything that gets here with DECL_EXTERNAL
2967 set, not just things with DECL_INLINE. */
2968 if (DECL_EXTERNAL (decl))
2969 goto exit_rest_of_compilation;
2972 /* Initialize some variables used by the optimizers. */
2973 init_function_for_compilation ();
2975 if (! DECL_DEFER_OUTPUT (decl))
2976 TREE_ASM_WRITTEN (decl) = 1;
2978 /* Now that integrate will no longer see our rtl, we need not distinguish
2979 between the return value of this function and the return value of called
2980 functions. */
2981 rtx_equal_function_value_matters = 0;
2983 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
2984 if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
2986 goto exit_rest_of_compilation;
2989 /* Emit code to get eh context, if needed. */
2990 emit_eh_context ();
2992 #ifdef FINALIZE_PIC
2993 /* If we are doing position-independent code generation, now
2994 is the time to output special prologues and epilogues.
2995 We do not want to do this earlier, because it just clutters
2996 up inline functions with meaningless insns. */
2997 if (flag_pic)
2998 FINALIZE_PIC;
2999 #endif
3001 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
3002 Note that that may have been done above, in save_for_inline_copying.
3003 The call to resume_temporary_allocation near the end of this function
3004 goes back to the usual state of affairs. This must be done after
3005 we've built up any unwinders for exception handling, and done
3006 the FINALIZE_PIC work, if necessary. */
3008 rtl_in_current_obstack ();
3010 insns = get_insns ();
3012 /* Copy any shared structure that should not be shared. */
3014 unshare_all_rtl (current_function_decl, insns);
3016 init_EXPR_INSN_LIST_cache ();
3018 #ifdef SETJMP_VIA_SAVE_AREA
3019 /* This must be performed before virutal register instantiation. */
3020 if (current_function_calls_alloca)
3021 optimize_save_area_alloca (insns);
3022 #endif
3024 /* Instantiate all virtual registers. */
3026 instantiate_virtual_regs (current_function_decl, get_insns ());
3028 /* See if we have allocated stack slots that are not directly addressable.
3029 If so, scan all the insns and create explicit address computation
3030 for all references to such slots. */
3031 /* fixup_stack_slots (); */
3033 /* Find all the EH handlers. */
3034 find_exception_handler_labels ();
3036 if (jump_opt_dump)
3037 open_dump_file (".01.jump", decl_printable_name (decl, 2));
3039 /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
3040 are initialized and to compute whether control can drop off the end
3041 of the function. */
3042 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3043 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP, !JUMP_NOOP_MOVES,
3044 JUMP_AFTER_REGSCAN));
3046 /* Jump optimization, and the removal of NULL pointer checks, may
3047 have reduced the number of instructions substantially. CSE, and
3048 future passes, allocate arrays whose dimensions involve the maximum
3049 instruction UID, so if we can reduce the maximum UID we'll save big on
3050 memory. */
3051 renumber_insns (rtl_dump_file);
3053 /* Dump rtl code after jump, if we are doing that. */
3054 if (jump_opt_dump)
3055 close_dump_file (print_rtl, insns);
3057 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
3058 if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
3059 goto exit_rest_of_compilation;
3061 /* Try to identify useless null pointer tests and delete them. */
3062 if (flag_delete_null_pointer_checks)
3063 TIMEVAR (jump_time, delete_null_pointer_checks (get_insns ()));
3065 if (ggc_p)
3066 ggc_collect ();
3068 /* Perform common subexpression elimination.
3069 Nonzero value from `cse_main' means that jumps were simplified
3070 and some code may now be unreachable, so do
3071 jump optimization again. */
3073 if (optimize > 0)
3075 if (cse_dump)
3076 open_dump_file (".02.cse", decl_printable_name (decl, 2));
3078 TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
3080 if (flag_thread_jumps)
3081 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 1));
3083 TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
3084 0, rtl_dump_file));
3085 /* If we are not running the second CSE pass, then we are no longer
3086 expecting CSE to be run. */
3087 cse_not_expected = !flag_rerun_cse_after_loop;
3089 if (tem || optimize > 1)
3090 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3091 !JUMP_NOOP_MOVES,
3092 !JUMP_AFTER_REGSCAN));
3094 /* Run this after jump optmizations remove all the unreachable code
3095 so that unreachable code will not keep values live. */
3096 TIMEVAR (cse_time, delete_trivially_dead_insns (insns, max_reg_num ()));
3098 /* Try to identify useless null pointer tests and delete them. */
3099 if (flag_delete_null_pointer_checks)
3100 TIMEVAR (jump_time, delete_null_pointer_checks (get_insns ()));
3102 /* The second pass of jump optimization is likely to have
3103 removed a bunch more instructions. */
3104 renumber_insns (rtl_dump_file);
3106 /* Dump rtl code after cse, if we are doing that. */
3107 if (cse_dump)
3109 close_dump_file (print_rtl, insns);
3110 if (graph_dump_format != no_graph)
3111 print_rtl_graph_with_bb (dump_base_name, ".02.cse", insns);
3115 purge_addressof (insns);
3116 reg_scan (insns, max_reg_num (), 1);
3118 if (addressof_dump)
3120 dump_rtl (".03.addressof", decl, print_rtl, insns);
3121 if (graph_dump_format != no_graph)
3122 print_rtl_graph_with_bb (dump_base_name, ".03.addressof", insns);
3125 if (ggc_p)
3126 ggc_collect ();
3128 /* Perform global cse. */
3130 if (optimize > 0 && flag_gcse)
3132 if (gcse_dump)
3133 open_dump_file (".04.gcse", decl_printable_name (decl, 2));
3135 TIMEVAR (gcse_time, tem = gcse_main (insns, rtl_dump_file));
3137 /* If gcse altered any jumps, rerun jump optimizations to clean
3138 things up. */
3139 if (tem)
3141 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3142 !JUMP_NOOP_MOVES,
3143 !JUMP_AFTER_REGSCAN));
3146 if (gcse_dump)
3148 close_dump_file (print_rtl, insns);
3149 if (graph_dump_format != no_graph)
3150 print_rtl_graph_with_bb (dump_base_name, ".04.gcse", insns);
3153 if (ggc_p)
3154 ggc_collect ();
3156 /* Move constant computations out of loops. */
3158 if (optimize > 0)
3160 if (loop_dump)
3161 open_dump_file (".05.loop", decl_printable_name (decl, 2));
3163 TIMEVAR
3164 (loop_time,
3166 if (flag_rerun_loop_opt)
3168 /* We only want to perform unrolling once. */
3170 loop_optimize (insns, rtl_dump_file, 0, 0);
3173 /* The first call to loop_optimize makes some instructions
3174 trivially dead. We delete those instructions now in the
3175 hope that doing so will make the heuristics in loop work
3176 better and possibly speed up compilation. */
3177 delete_trivially_dead_insns (insns, max_reg_num ());
3179 /* The regscan pass is currently necessary as the alias
3180 analysis code depends on this information. */
3181 reg_scan (insns, max_reg_num (), 1);
3183 loop_optimize (insns, rtl_dump_file, flag_unroll_loops, 1);
3186 /* Dump rtl code after loop opt, if we are doing that. */
3188 if (loop_dump)
3190 close_dump_file (print_rtl, insns);
3191 if (graph_dump_format != no_graph)
3192 print_rtl_graph_with_bb (dump_base_name, ".05.loop", insns);
3195 if (ggc_p)
3196 ggc_collect ();
3199 /* ??? Well, nearly. If HAVE_conditional_arithmetic, jump_optimize
3200 has put off all if-conversion until "after CSE". If we put this
3201 off any longer we may miss out doing if-conversion entirely. */
3202 cse_not_expected = 1;
3204 if (optimize > 0)
3206 if (cse2_dump)
3207 open_dump_file (".06.cse2", decl_printable_name (decl, 2));
3209 if (flag_rerun_cse_after_loop)
3211 /* Running another jump optimization pass before the second
3212 cse pass sometimes simplifies the RTL enough to allow
3213 the second CSE pass to do a better job. Jump_optimize can change
3214 max_reg_num so we must rerun reg_scan afterwards.
3215 ??? Rework to not call reg_scan so often. */
3216 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3217 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3218 !JUMP_NOOP_MOVES,
3219 JUMP_AFTER_REGSCAN));
3221 TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
3222 TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
3223 1, rtl_dump_file));
3224 if (tem)
3225 TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
3226 !JUMP_NOOP_MOVES,
3227 !JUMP_AFTER_REGSCAN));
3230 if (flag_thread_jumps)
3232 /* This pass of jump threading straightens out code
3233 that was kinked by loop optimization. */
3234 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3235 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
3238 /* Dump rtl code after cse, if we are doing that. */
3239 if (cse2_dump)
3241 close_dump_file (print_rtl, insns);
3242 if (graph_dump_format != no_graph)
3243 print_rtl_graph_with_bb (dump_base_name, ".06.cse2", insns);
3246 if (ggc_p)
3247 ggc_collect ();
3250 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
3252 if (branch_prob_dump)
3253 open_dump_file (".07.bp", decl_printable_name (decl, 2));
3255 TIMEVAR
3256 (branch_prob_time,
3258 branch_prob (insns, rtl_dump_file);
3261 if (branch_prob_dump)
3263 close_dump_file (print_rtl, insns);
3264 if (graph_dump_format != no_graph)
3265 print_rtl_graph_with_bb (dump_base_name, ".07.bp", insns);
3268 if (ggc_p)
3269 ggc_collect ();
3272 regclass_init ();
3274 /* Print function header into flow dump now
3275 because doing the flow analysis makes some of the dump. */
3277 if (flow_dump)
3278 open_dump_file (".08.flow", decl_printable_name (decl, 2));
3280 /* Do control and data flow analysis; wrote some of the results to
3281 the dump file. */
3283 TIMEVAR
3284 (flow_time,
3286 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3287 cleanup_cfg (insns);
3288 if (optimize)
3289 calculate_loop_depth (rtl_dump_file);
3290 life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
3291 mark_constant_function ();
3294 if (warn_uninitialized || extra_warnings)
3296 uninitialized_vars_warning (DECL_INITIAL (decl));
3297 if (extra_warnings)
3298 setjmp_args_warning ();
3301 /* Dump rtl after flow analysis. */
3303 if (flow_dump)
3305 close_dump_file (print_rtl_with_bb, insns);
3306 if (graph_dump_format != no_graph)
3307 print_rtl_graph_with_bb (dump_base_name, ".08.flow", insns);
3310 if (ggc_p)
3311 ggc_collect ();
3313 /* The first life analysis pass has finished. From now on we can not
3314 generate any new pseudos. */
3315 no_new_pseudos = 1;
3317 /* If -opt, try combining insns through substitution. */
3319 if (optimize > 0)
3321 int rebuild_jump_labels_after_combine = 0;
3323 TIMEVAR (combine_time,
3325 rebuild_jump_labels_after_combine
3326 = combine_instructions (insns, max_reg_num ());
3329 /* Combining insns may have turned an indirect jump into a
3330 direct jump. Rebuid the JUMP_LABEL fields of jumping
3331 instructions. */
3332 if (rebuild_jump_labels_after_combine)
3334 TIMEVAR (jump_time, rebuild_jump_labels (insns));
3337 /* Dump rtl code after insn combination. */
3339 if (combine_dump)
3341 dump_rtl (".09.combine", decl, print_rtl_with_bb, insns);
3342 if (graph_dump_format != no_graph)
3343 print_rtl_graph_with_bb (dump_base_name, ".09.combine", insns);
3346 if (ggc_p)
3347 ggc_collect ();
3350 /* Register allocation pre-pass, to reduce number of moves
3351 necessary for two-address machines. */
3352 if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
3354 if (regmove_dump)
3355 open_dump_file (".10.regmove", decl_printable_name (decl, 2));
3357 TIMEVAR (regmove_time, regmove_optimize (insns, max_reg_num (),
3358 rtl_dump_file));
3360 if (regmove_dump)
3362 close_dump_file (print_rtl_with_bb, insns);
3363 if (graph_dump_format != no_graph)
3364 print_rtl_graph_with_bb (dump_base_name, ".10.regmove", insns);
3367 if (ggc_p)
3368 ggc_collect ();
3371 if (optimize && n_basic_blocks)
3373 TIMEVAR (gcse_time, optimize_mode_switching (NULL_PTR));
3376 #ifdef INSN_SCHEDULING
3378 /* Print function header into sched dump now
3379 because doing the sched analysis makes some of the dump. */
3380 if (optimize > 0 && flag_schedule_insns)
3382 if (sched_dump)
3383 open_dump_file (".11.sched", decl_printable_name (decl, 2));
3385 /* Do control and data sched analysis,
3386 and write some of the results to dump file. */
3388 TIMEVAR (sched_time, schedule_insns (rtl_dump_file));
3390 /* Dump rtl after instruction scheduling. */
3392 if (sched_dump)
3394 close_dump_file (print_rtl_with_bb, insns);
3395 if (graph_dump_format != no_graph)
3396 print_rtl_graph_with_bb (dump_base_name, ".11.sched", insns);
3399 if (ggc_p)
3400 ggc_collect ();
3402 #endif
3404 /* Determine if the current function is a leaf before running reload
3405 since this can impact optimizations done by the prologue and
3406 epilogue thus changing register elimination offsets. */
3407 current_function_is_leaf = leaf_function_p ();
3409 if (local_reg_dump)
3410 open_dump_file (".12.lreg", decl_printable_name (decl, 2));
3412 /* Allocate pseudo-regs that are used only within 1 basic block.
3414 RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
3415 jump optimizer after register allocation and reloading are finished. */
3417 TIMEVAR (local_alloc_time,
3419 /* We recomputed reg usage as part of updating the rest
3420 of life info during sched. */
3421 if (! flag_schedule_insns)
3422 recompute_reg_usage (insns, ! optimize_size);
3423 regclass (insns, max_reg_num (), rtl_dump_file);
3424 rebuild_label_notes_after_reload = local_alloc ();
3427 /* Dump rtl code after allocating regs within basic blocks. */
3429 if (local_reg_dump)
3431 TIMEVAR (dump_time, dump_flow_info (rtl_dump_file));
3432 TIMEVAR (dump_time, dump_local_alloc (rtl_dump_file));
3434 close_dump_file (print_rtl_with_bb, insns);
3435 if (graph_dump_format != no_graph)
3436 print_rtl_graph_with_bb (dump_base_name, ".12.lreg", insns);
3439 if (ggc_p)
3440 ggc_collect ();
3442 if (global_reg_dump)
3443 open_dump_file (".13.greg", decl_printable_name (decl, 2));
3445 /* If optimizing, allocate remaining pseudo-regs. Do the reload
3446 pass fixing up any insns that are invalid. */
3448 TIMEVAR (global_alloc_time,
3450 if (optimize)
3451 failure = global_alloc (rtl_dump_file);
3452 else
3454 build_insn_chain (insns);
3455 failure = reload (insns, 0, rtl_dump_file);
3459 if (failure)
3460 goto exit_rest_of_compilation;
3462 if (ggc_p)
3463 ggc_collect ();
3465 /* Do a very simple CSE pass over just the hard registers. */
3466 if (optimize > 0)
3467 reload_cse_regs (insns);
3469 /* If optimizing and we are performing instruction scheduling after
3470 reload, then go ahead and split insns now since we are about to
3471 recompute flow information anyway.
3473 reload_cse_regs may expose more splitting opportunities, expecially
3474 for double-word operations. */
3475 if (optimize > 0 && flag_schedule_insns_after_reload)
3476 split_all_insns (0);
3478 /* Register allocation and reloading may have turned an indirect jump into
3479 a direct jump. If so, we must rebuild the JUMP_LABEL fields of
3480 jumping instructions. */
3481 if (rebuild_label_notes_after_reload)
3482 TIMEVAR (jump_time, rebuild_jump_labels (insns));
3484 if (global_reg_dump)
3486 TIMEVAR (dump_time, dump_global_regs (rtl_dump_file));
3487 close_dump_file (print_rtl_with_bb, insns);
3488 if (graph_dump_format != no_graph)
3489 print_rtl_graph_with_bb (dump_base_name, ".13.greg", insns);
3492 /* Re-create the death notes which were deleted during reload. */
3493 if (flow2_dump)
3494 open_dump_file (".14.flow2", decl_printable_name (decl, 2));
3496 TIMEVAR (flow2_time,
3498 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
3501 /* On some machines, the prologue and epilogue code, or parts thereof,
3502 can be represented as RTL. Doing so lets us schedule insns between
3503 it and the rest of the code and also allows delayed branch
3504 scheduling to operate in the epilogue. */
3505 thread_prologue_and_epilogue_insns (insns);
3507 if (optimize)
3509 TIMEVAR
3510 (flow2_time,
3512 cleanup_cfg (insns);
3513 life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
3516 if (ggc_p)
3517 ggc_collect ();
3520 flow2_completed = 1;
3522 if (flow2_dump)
3524 close_dump_file (print_rtl_with_bb, insns);
3525 if (graph_dump_format != no_graph)
3526 print_rtl_graph_with_bb (dump_base_name, ".14.flow2", insns);
3529 #ifdef HAVE_peephole2
3530 if (optimize > 0 && flag_peephole2)
3532 if (peephole2_dump)
3533 open_dump_file (".15.peephole2", decl_printable_name (decl, 2));
3535 TIMEVAR (peephole2_time, peephole2_optimize (rtl_dump_file));
3537 if (peephole2_dump)
3539 close_dump_file (print_rtl_with_bb, insns);
3540 if (graph_dump_format != no_graph)
3541 print_rtl_graph_with_bb (dump_base_name, ".15.peephole2", insns);
3544 #endif
3546 #ifdef INSN_SCHEDULING
3547 if (optimize > 0 && flag_schedule_insns_after_reload)
3549 if (sched2_dump)
3550 open_dump_file (".16.sched2", decl_printable_name (decl, 2));
3552 /* Do control and data sched analysis again,
3553 and write some more of the results to dump file. */
3555 TIMEVAR (sched2_time, schedule_insns (rtl_dump_file));
3557 /* Dump rtl after post-reorder instruction scheduling. */
3559 if (sched2_dump)
3561 close_dump_file (print_rtl_with_bb, insns);
3562 if (graph_dump_format != no_graph)
3563 print_rtl_graph_with_bb (dump_base_name, ".16.sched2", insns);
3566 if (ggc_p)
3567 ggc_collect ();
3569 #endif
3571 #ifdef LEAF_REGISTERS
3572 current_function_uses_only_leaf_regs
3573 = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
3574 #endif
3576 if (optimize > 0 && flag_reorder_blocks)
3578 if (reorder_blocks_dump)
3579 open_dump_file (".bbro", decl_printable_name (decl, 2));
3581 TIMEVAR (reorder_blocks_time, reorder_basic_blocks ());
3583 if (reorder_blocks_dump)
3585 close_dump_file (print_rtl_with_bb, insns);
3586 if (graph_dump_format != no_graph)
3587 print_rtl_graph_with_bb (dump_base_name, ".bbro", insns);
3591 /* One more attempt to remove jumps to .+1 left by dead-store elimination.
3592 Also do cross-jumping this time and delete no-op move insns. */
3594 if (optimize > 0)
3596 TIMEVAR (jump_time, jump_optimize (insns, JUMP_CROSS_JUMP,
3597 JUMP_NOOP_MOVES,
3598 !JUMP_AFTER_REGSCAN));
3600 /* Dump rtl code after jump, if we are doing that. */
3602 if (jump2_opt_dump)
3604 dump_rtl (".17.jump2", decl, print_rtl_with_bb, insns);
3605 if (graph_dump_format != no_graph)
3606 print_rtl_graph_with_bb (dump_base_name, ".17.jump2", insns);
3610 /* If a machine dependent reorganization is needed, call it. */
3611 #ifdef MACHINE_DEPENDENT_REORG
3612 if (mach_dep_reorg_dump)
3613 open_dump_file (".18.mach", decl_printable_name (decl, 2));
3615 MACHINE_DEPENDENT_REORG (insns);
3617 if (mach_dep_reorg_dump)
3619 close_dump_file (print_rtl_with_bb, insns);
3620 if (graph_dump_format != no_graph)
3621 print_rtl_graph_with_bb (dump_base_name, ".18.mach", insns);
3624 if (ggc_p)
3625 ggc_collect ();
3626 #endif
3628 /* If a scheduling pass for delayed branches is to be done,
3629 call the scheduling code. */
3631 #ifdef DELAY_SLOTS
3632 if (optimize > 0 && flag_delayed_branch)
3634 if (dbr_sched_dump)
3635 open_dump_file (".19.dbr", decl_printable_name (decl, 2));
3637 TIMEVAR
3638 (dbr_sched_time,
3640 dbr_schedule (insns, rtl_dump_file);
3643 if (dbr_sched_dump)
3645 close_dump_file (print_rtl_with_bb, insns);
3646 if (graph_dump_format != no_graph)
3647 print_rtl_graph_with_bb (dump_base_name, ".19.dbr", insns);
3651 if (ggc_p)
3652 ggc_collect ();
3653 #endif
3655 /* Shorten branches.
3657 Note this must run before reg-stack because of death note (ab)use
3658 in the ia32 backend. */
3659 TIMEVAR (shorten_branch_time,
3661 shorten_branches (get_insns ());
3664 #ifdef STACK_REGS
3665 if (stack_reg_dump)
3666 open_dump_file (".20.stack", decl_printable_name (decl, 2));
3668 TIMEVAR (stack_reg_time, reg_to_stack (insns, rtl_dump_file));
3670 if (stack_reg_dump)
3672 close_dump_file (print_rtl_with_bb, insns);
3673 if (graph_dump_format != no_graph)
3674 print_rtl_graph_with_bb (dump_base_name, ".20.stack", insns);
3677 if (ggc_p)
3678 ggc_collect ();
3679 #endif
3681 /* Now turn the rtl into assembler code. */
3683 TIMEVAR (final_time,
3685 rtx x;
3686 const char *fnname;
3688 /* Get the function's name, as described by its RTL.
3689 This may be different from the DECL_NAME name used
3690 in the source file. */
3692 x = DECL_RTL (decl);
3693 if (GET_CODE (x) != MEM)
3694 abort ();
3695 x = XEXP (x, 0);
3696 if (GET_CODE (x) != SYMBOL_REF)
3697 abort ();
3698 fnname = XSTR (x, 0);
3700 assemble_start_function (decl, fnname);
3701 final_start_function (insns, asm_out_file, optimize);
3702 final (insns, asm_out_file, optimize, 0);
3703 final_end_function (insns, asm_out_file, optimize);
3704 assemble_end_function (decl, fnname);
3705 if (! quiet_flag)
3706 fflush (asm_out_file);
3708 /* Release all memory allocated by flow. */
3709 free_basic_block_vars (0);
3711 /* Release all memory held by regsets now */
3712 regset_release_memory ();
3715 if (ggc_p)
3716 ggc_collect ();
3718 /* Write DBX symbols if requested */
3720 /* Note that for those inline functions where we don't initially
3721 know for certain that we will be generating an out-of-line copy,
3722 the first invocation of this routine (rest_of_compilation) will
3723 skip over this code by doing a `goto exit_rest_of_compilation;'.
3724 Later on, finish_compilation will call rest_of_compilation again
3725 for those inline functions that need to have out-of-line copies
3726 generated. During that call, we *will* be routed past here. */
3728 #ifdef DBX_DEBUGGING_INFO
3729 if (write_symbols == DBX_DEBUG)
3730 TIMEVAR (symout_time, dbxout_function (decl));
3731 #endif
3733 #ifdef DWARF_DEBUGGING_INFO
3734 if (write_symbols == DWARF_DEBUG)
3735 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
3736 #endif
3738 #ifdef DWARF2_DEBUGGING_INFO
3739 if (write_symbols == DWARF2_DEBUG)
3740 TIMEVAR (symout_time, dwarf2out_decl (decl));
3741 #endif
3743 exit_rest_of_compilation:
3745 /* In case the function was not output,
3746 don't leave any temporary anonymous types
3747 queued up for sdb output. */
3748 #ifdef SDB_DEBUGGING_INFO
3749 if (write_symbols == SDB_DEBUG)
3750 sdbout_types (NULL_TREE);
3751 #endif
3753 reload_completed = 0;
3754 flow2_completed = 0;
3755 no_new_pseudos = 0;
3757 TIMEVAR (final_time,
3759 /* Clear out the insn_length contents now that they are no
3760 longer valid. */
3761 init_insn_lengths ();
3763 /* Clear out the real_constant_chain before some of the rtx's
3764 it runs through become garbage. */
3765 clear_const_double_mem ();
3767 /* Cancel the effect of rtl_in_current_obstack. */
3768 resume_temporary_allocation ();
3770 /* Show no temporary slots allocated. */
3771 init_temp_slots ();
3773 free_basic_block_vars (0);
3776 /* Make sure volatile mem refs aren't considered valid operands for
3777 arithmetic insns. We must call this here if this is a nested inline
3778 function, since the above code leaves us in the init_recog state
3779 (from final.c), and the function context push/pop code does not
3780 save/restore volatile_ok.
3782 ??? Maybe it isn't necessary for expand_start_function to call this
3783 anymore if we do it here? */
3785 init_recog_no_volatile ();
3787 /* We're done with this function. Free up memory if we can. */
3788 free_after_parsing (cfun);
3789 if (! DECL_DEFER_OUTPUT (decl))
3790 free_after_compilation (cfun);
3791 cfun = 0;
3793 if (ggc_p)
3794 ggc_collect ();
3796 /* The parsing time is all the time spent in yyparse
3797 *except* what is spent in this function. */
3799 parse_time -= get_run_time () - start_time;
3802 static void
3803 display_help ()
3805 int undoc;
3806 unsigned long i;
3807 const char * lang;
3809 #ifndef USE_CPPLIB
3810 printf ("Usage: %s input [switches]\n", progname);
3811 printf ("Switches:\n");
3812 #endif
3813 printf (" -ffixed-<register> Mark <register> as being unavailable to the compiler\n");
3814 printf (" -fcall-used-<register> Mark <register> as being corrupted by function calls\n");
3815 printf (" -fcall-saved-<register> Mark <register> as being preserved across functions\n");
3816 printf (" -finline-limit=<number> Limits the size of inlined functions to <number>\n");
3818 for (i = NUM_ELEM (f_options); i--;)
3820 const char * description = f_options[i].description;
3822 if (description != NULL && * description != 0)
3823 printf (" -f%-21s %s\n",
3824 f_options[i].string, description);
3827 printf (" -O[number] Set optimisation level to [number]\n");
3828 printf (" -Os Optimise for space rather than speed\n");
3829 printf (" -pedantic Issue warnings needed by strict compliance to ANSI C\n");
3830 printf (" -pedantic-errors Like -pedantic except that errors are produced\n");
3831 printf (" -w Suppress warnings\n");
3832 printf (" -W Enable extra warnings\n");
3834 for (i = NUM_ELEM (W_options); i--;)
3836 const char * description = W_options[i].description;
3838 if (description != NULL && * description != 0)
3839 printf (" -W%-21s %s\n",
3840 W_options[i].string, description);
3843 printf (" -Wid-clash-<num> Warn if 2 identifiers have the same first <num> chars\n");
3844 printf (" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n");
3845 printf (" -p Enable function profiling\n");
3846 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER)
3847 printf (" -a Enable block profiling \n");
3848 #endif
3849 #if defined (BLOCK_PROFILER) || defined (FUNCTION_BLOCK_PROFILER) || defined FUNCTION_BLOCK_PROFILER_EXIT
3850 printf (" -ax Enable jump profiling \n");
3851 #endif
3852 printf (" -o <file> Place output into <file> \n");
3853 printf (" -G <number> Put global and static data smaller than <number>\n");
3854 printf (" bytes into a special section (on some targets)\n");
3856 for (i = NUM_ELEM (debug_args); i--;)
3858 if (debug_args[i].description != NULL)
3859 printf (" -g%-21s %s\n", debug_args[i].arg, debug_args[i].description);
3862 printf (" -aux-info <file> Emit declaration info into <file>.X\n");
3863 printf (" -quiet Do not display functions compiled or elapsed time\n");
3864 printf (" -version Display the compiler's version\n");
3865 printf (" -d[letters] Enable dumps from specific passes of the compiler\n");
3866 printf (" -dumpbase <file> Base name to be used for dumps from specific passes\n");
3867 #if defined INSN_SCHEDULING
3868 printf (" -sched-verbose=<number> Set the verbosity level of the scheduler\n");
3869 #endif
3870 printf (" --help Display this information\n");
3872 undoc = 0;
3873 lang = "language";
3875 /* Display descriptions of language specific options.
3876 If there is no description, note that there is an undocumented option.
3877 If the description is empty, do not display anything. (This allows
3878 options to be deliberately undocumented, for whatever reason).
3879 If the option string is missing, then this is a marker, indicating
3880 that the description string is in fact the name of a language, whose
3881 language specific options are to follow. */
3883 if (NUM_ELEM (documented_lang_options) > 1)
3885 printf ("\nLanguage specific options:\n");
3887 for (i = 0; i < NUM_ELEM (documented_lang_options); i++)
3889 const char * description = documented_lang_options[i].description;
3890 const char * option = documented_lang_options[i].option;
3892 if (description == NULL)
3894 undoc = 1;
3896 if (extra_warnings)
3897 printf (" %-23.23s [undocumented]\n", option);
3899 else if (* description == 0)
3900 continue;
3901 else if (option == NULL)
3903 if (undoc)
3904 printf
3905 ("\nThere are undocumented %s specific options as well.\n",
3906 lang);
3907 undoc = 0;
3909 printf ("\n Options for %s:\n", description);
3911 lang = description;
3913 else
3914 printf (" %-23.23s %s\n", option, description);
3918 if (undoc)
3919 printf ("\nThere are undocumented %s specific options as well.\n", lang);
3921 if (NUM_ELEM (target_switches) > 1
3922 #ifdef TARGET_OPTIONS
3923 || NUM_ELEM (target_options) > 1
3924 #endif
3927 int doc = 0;
3929 undoc = 0;
3931 printf ("\nTarget specific options:\n");
3933 for (i = NUM_ELEM (target_switches); i--;)
3935 const char * option = target_switches[i].name;
3936 const char * description = target_switches[i].description;
3938 if (option == NULL || * option == 0)
3939 continue;
3940 else if (description == NULL)
3942 undoc = 1;
3944 if (extra_warnings)
3945 printf (" -m%-21.21s [undocumented]\n", option);
3947 else if (* description != 0)
3948 doc += printf (" -m%-21.21s %s\n", option, description);
3951 #ifdef TARGET_OPTIONS
3952 for (i = NUM_ELEM (target_options); i--;)
3954 const char * option = target_options[i].prefix;
3955 const char * description = target_options[i].description;
3957 if (option == NULL || * option == 0)
3958 continue;
3959 else if (description == NULL)
3961 undoc = 1;
3963 if (extra_warnings)
3964 printf (" -m%-21.21s [undocumented]\n", option);
3966 else if (* description != 0)
3967 doc += printf (" -m%-21.21s %s\n", option, description);
3969 #endif
3970 if (undoc)
3972 if (doc)
3973 printf ("\nThere are undocumented target specific options as well.\n");
3974 else
3975 printf (" They exist, but they are not documented.\n");
3980 /* Parse a -d... comand line switch. */
3982 static void
3983 decode_d_option (arg)
3984 const char * arg;
3986 while (* arg)
3987 switch (* arg ++)
3989 case 'a':
3990 branch_prob_dump = 1;
3991 combine_dump = 1;
3992 #ifdef DELAY_SLOTS
3993 dbr_sched_dump = 1;
3994 #endif
3995 reorder_blocks_dump = 1;
3996 flow_dump = 1;
3997 flow2_dump = 1;
3998 global_reg_dump = 1;
3999 jump_opt_dump = 1;
4000 addressof_dump = 1;
4001 jump2_opt_dump = 1;
4002 local_reg_dump = 1;
4003 loop_dump = 1;
4004 regmove_dump = 1;
4005 rtl_dump = 1;
4006 cse_dump = 1;
4007 cse2_dump = 1;
4008 gcse_dump = 1;
4009 sched_dump = 1;
4010 sched2_dump = 1;
4011 #ifdef STACK_REGS
4012 stack_reg_dump = 1;
4013 #endif
4014 #ifdef MACHINE_DEPENDENT_REORG
4015 mach_dep_reorg_dump = 1;
4016 #endif
4017 peephole2_dump = 1;
4018 break;
4019 case 'A':
4020 flag_debug_asm = 1;
4021 break;
4022 case 'b':
4023 branch_prob_dump = 1;
4024 break;
4025 case 'B':
4026 reorder_blocks_dump = 1;
4027 break;
4028 case 'c':
4029 combine_dump = 1;
4030 break;
4031 #ifdef DELAY_SLOTS
4032 case 'd':
4033 dbr_sched_dump = 1;
4034 break;
4035 #endif
4036 case 'f':
4037 flow_dump = 1;
4038 break;
4039 case 'F':
4040 addressof_dump = 1;
4041 break;
4042 case 'g':
4043 global_reg_dump = 1;
4044 break;
4045 case 'G':
4046 gcse_dump = 1;
4047 break;
4048 case 'j':
4049 jump_opt_dump = 1;
4050 break;
4051 case 'J':
4052 jump2_opt_dump = 1;
4053 break;
4054 #ifdef STACK_REGS
4055 case 'k':
4056 stack_reg_dump = 1;
4057 break;
4058 #endif
4059 case 'l':
4060 local_reg_dump = 1;
4061 break;
4062 case 'L':
4063 loop_dump = 1;
4064 break;
4065 case 'm':
4066 flag_print_mem = 1;
4067 break;
4068 #ifdef MACHINE_DEPENDENT_REORG
4069 case 'M':
4070 mach_dep_reorg_dump = 1;
4071 break;
4072 #endif
4073 case 'p':
4074 flag_print_asm_name = 1;
4075 break;
4076 case 'r':
4077 rtl_dump = 1;
4078 break;
4079 case 'R':
4080 sched2_dump = 1;
4081 break;
4082 case 's':
4083 cse_dump = 1;
4084 break;
4085 case 'S':
4086 sched_dump = 1;
4087 break;
4088 case 't':
4089 cse2_dump = 1;
4090 break;
4091 case 'N':
4092 regmove_dump = 1;
4093 break;
4094 case 'v':
4095 graph_dump_format = vcg;
4096 break;
4097 case 'w':
4098 flow2_dump = 1;
4099 break;
4100 case 'x':
4101 rtl_dump_and_exit = 1;
4102 break;
4103 case 'y':
4104 set_yydebug (1);
4105 break;
4106 case 'z':
4107 peephole2_dump = 1;
4108 break;
4109 case 'D': /* These are handled by the preprocessor. */
4110 case 'I':
4111 break;
4112 default:
4113 warning ("unrecognized gcc debugging option: %c", arg[-1]);
4114 break;
4118 /* Parse a -f... comand line switch. ARG is the value after the -f.
4119 It is safe to access 'ARG - 2' to generate the full switch name.
4120 Return the number of strings consumed. */
4122 static int
4123 decode_f_option (arg)
4124 const char * arg;
4126 int j;
4128 /* Search for the option in the table of binary f options. */
4129 for (j = sizeof (f_options) / sizeof (f_options[0]); j--;)
4131 if (!strcmp (arg, f_options[j].string))
4133 *f_options[j].variable = f_options[j].on_value;
4134 return 1;
4137 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4138 && ! strcmp (arg + 3, f_options[j].string))
4140 *f_options[j].variable = ! f_options[j].on_value;
4141 return 1;
4145 if (!strncmp (arg, "inline-limit-", 13)
4146 || !strncmp (arg, "inline-limit=", 13))
4147 inline_max_insns =
4148 read_integral_parameter (arg + 13, arg - 2, inline_max_insns);
4149 #ifdef INSN_SCHEDULING
4150 else if (!strncmp (arg, "sched-verbose=", 14))
4151 fix_sched_param ("verbose", (const char *)(arg + 14));
4152 #endif
4153 else if (!strncmp (arg, "fixed-", 6))
4154 fix_register ((const char *)(arg + 6), 1, 1);
4155 else if (!strncmp (arg, "call-used-", 10))
4156 fix_register ((const char *)(arg + 10), 0, 1);
4157 else if (!strncmp (arg, "call-saved-", 11))
4158 fix_register ((const char *)(arg + 11), 0, 0);
4159 else if (!strncmp (arg, "align-loops=", 12))
4160 align_loops = read_integral_parameter (arg + 12, arg - 2, align_loops);
4161 else if (!strncmp (arg, "align-functions=", 16))
4162 align_functions
4163 = read_integral_parameter (arg + 16, arg - 2, align_functions);
4164 else if (!strncmp (arg, "align-jumps=", 12))
4165 align_jumps = read_integral_parameter (arg + 12, arg - 2, align_jumps);
4166 else if (!strncmp (arg, "align-labels=", 13))
4167 align_labels = read_integral_parameter (arg + 13, arg - 2, align_labels);
4168 else if (!strncmp (arg, "stack-limit-register=", 21))
4170 int reg = decode_reg_name (arg + 21);
4171 if (reg < 0)
4172 error ("unrecognized register name `%s'", arg + 21);
4173 else
4174 stack_limit_rtx = gen_rtx_REG (Pmode, reg);
4176 else if (!strncmp (arg, "stack-limit-symbol=", 19))
4178 char *nm;
4179 if (ggc_p)
4180 nm = ggc_alloc_string (arg + 19, strlen (arg + 19));
4181 else
4182 nm = xstrdup (arg + 19);
4183 stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
4185 else if (!strcmp (arg, "no-stack-limit"))
4186 stack_limit_rtx = NULL_RTX;
4187 else if (!strcmp (arg, "preprocessed"))
4188 /* Recognise this switch but do nothing. This prevents warnings
4189 about an unrecognized switch if cpplib has not been linked in. */
4191 else
4192 return 0;
4194 return 1;
4197 /* Parse a -W... comand line switch. ARG is the value after the -W.
4198 It is safe to access 'ARG - 2' to generate the full switch name.
4199 Return the number of strings consumed. */
4201 static int
4202 decode_W_option (arg)
4203 const char * arg;
4205 int j;
4207 /* Search for the option in the table of binary W options. */
4209 for (j = sizeof (W_options) / sizeof (W_options[0]); j--;)
4211 if (!strcmp (arg, W_options[j].string))
4213 *W_options[j].variable = W_options[j].on_value;
4214 return 1;
4217 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
4218 && ! strcmp (arg + 3, W_options[j].string))
4220 *W_options[j].variable = ! W_options[j].on_value;
4221 return 1;
4225 if (!strncmp (arg, "id-clash-", 9))
4227 id_clash_len = read_integral_parameter (arg + 9, arg - 2, -1);
4229 if (id_clash_len != -1)
4230 warn_id_clash = 1;
4232 else if (!strncmp (arg, "larger-than-", 12))
4234 larger_than_size = read_integral_parameter (arg + 12, arg - 2, -1);
4236 if (larger_than_size != -1)
4237 warn_larger_than = 1;
4239 else
4240 return 0;
4242 return 1;
4245 /* Parse a -g... comand line switch. ARG is the value after the -g.
4246 It is safe to access 'ARG - 2' to generate the full switch name.
4247 Return the number of strings consumed. */
4249 static int
4250 decode_g_option (arg)
4251 const char * arg;
4253 unsigned level;
4254 /* A lot of code assumes write_symbols == NO_DEBUG if the
4255 debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
4256 of what debugging type has been selected). This records the
4257 selected type. It is an error to specify more than one
4258 debugging type. */
4259 static enum debug_info_type selected_debug_type = NO_DEBUG;
4260 /* Non-zero if debugging format has been explicitly set.
4261 -g and -ggdb don't explicitly set the debugging format so
4262 -gdwarf -g3 is equivalent to -gdwarf3. */
4263 static int type_explicitly_set_p = 0;
4264 /* Indexed by enum debug_info_type. */
4265 static const char * debug_type_names[] =
4267 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
4270 /* The maximum admissible debug level value. */
4271 static const unsigned max_debug_level = 3;
4273 /* Look up ARG in the table. */
4274 for (da = debug_args; da->arg; da++)
4276 const int da_len = strlen (da->arg);
4278 if (da_len == 0 || ! strncmp (arg, da->arg, da_len))
4280 enum debug_info_type type = da->debug_type;
4281 const char * p = arg + da_len;
4283 if (*p && (*p < '0' || *p > '9'))
4284 continue;
4286 /* A debug flag without a level defaults to level 2.
4287 Note we do not want to call read_integral_parameter
4288 for that case since it will call atoi which
4289 will return zero.
4291 ??? We may want to generalize the interface to
4292 read_integral_parameter to better handle this case
4293 if this case shows up often. */
4294 if (*p)
4295 level = read_integral_parameter (p, 0, max_debug_level + 1);
4296 else
4297 level = 2;
4299 if (da_len > 1 && *p && !strncmp (arg, "dwarf", da_len))
4301 error ("use -gdwarf -g%d for DWARF v1, level %d",
4302 level, level);
4303 if (level == 2)
4304 error ("use -gdwarf-2 for DWARF v2");
4307 if (level > max_debug_level)
4309 warning ("\
4310 ignoring option `%s' due to invalid debug level specification",
4311 arg - 2);
4312 level = debug_info_level;
4315 if (type == NO_DEBUG)
4317 type = PREFERRED_DEBUGGING_TYPE;
4319 if (da_len > 1 && strncmp (arg, "gdb", da_len) == 0)
4321 #if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
4322 type = DWARF2_DEBUG;
4323 #else
4324 #ifdef DBX_DEBUGGING_INFO
4325 type = DBX_DEBUG;
4326 #endif
4327 #endif
4331 if (type == NO_DEBUG)
4332 warning ("`%s': unknown or unsupported -g option", arg - 2);
4334 /* Does it conflict with an already selected type? */
4335 if (type_explicitly_set_p
4336 /* -g/-ggdb don't conflict with anything */
4337 && da->debug_type != NO_DEBUG
4338 && type != selected_debug_type)
4339 warning ("`%s' ignored, conflicts with `-g%s'",
4340 arg - 2, debug_type_names[(int) selected_debug_type]);
4341 else
4343 /* If the format has already been set, -g/-ggdb
4344 only change the debug level. */
4345 if (type_explicitly_set_p && da->debug_type == NO_DEBUG)
4346 ; /* don't change debugging type */
4347 else
4349 selected_debug_type = type;
4350 type_explicitly_set_p = da->debug_type != NO_DEBUG;
4353 write_symbols = (level == 0
4354 ? NO_DEBUG
4355 : selected_debug_type);
4356 use_gnu_debug_info_extensions = da->use_extensions_p;
4357 debug_info_level = (enum debug_info_level) level;
4360 break;
4364 if (! da->arg)
4365 warning ("`%s': unknown or unsupported -g option", arg - 2);
4367 return 1;
4370 /* Decode the first argument in the argv as a language-independent option.
4371 Return the number of strings consumed. 'strings_processed' is the
4372 number of strings that have already been decoded in a language
4373 specific fashion before this function was invoked. */
4375 static unsigned
4376 independent_decode_option (argc, argv, strings_processed)
4377 int argc;
4378 char ** argv;
4379 unsigned strings_processed ATTRIBUTE_UNUSED;
4381 char * arg = argv[0];
4383 if (arg[0] != '-' || arg[1] == 0)
4385 if (arg[0] == '+')
4386 return 0;
4388 filename = arg;
4390 return 1;
4393 arg ++;
4395 if (!strcmp (arg, "-help"))
4397 display_help ();
4398 exit (0);
4401 if (* arg == 'Y')
4402 arg ++;
4404 switch (* arg)
4406 default:
4407 return 0;
4409 case 'O':
4410 /* Already been treated in main (). Do nothing. */
4411 break;
4413 case 'm':
4414 set_target_switch (arg + 1);
4415 break;
4417 case 'f':
4418 return decode_f_option (arg + 1);
4420 case 'g':
4421 return decode_g_option (arg + 1);
4423 case 'd':
4424 if (!strcmp (arg, "dumpbase"))
4426 if (argc == 1)
4427 return 0;
4429 dump_base_name = argv[1];
4430 return 2;
4432 else
4433 decode_d_option (arg + 1);
4434 break;
4436 case 'p':
4437 if (!strcmp (arg, "pedantic"))
4438 pedantic = 1;
4439 else if (!strcmp (arg, "pedantic-errors"))
4440 flag_pedantic_errors = pedantic = 1;
4441 else if (arg[1] == 0)
4442 profile_flag = 1;
4443 else
4444 return 0;
4445 break;
4447 case 'q':
4448 if (!strcmp (arg, "quiet"))
4449 quiet_flag = 1;
4450 else
4451 return 0;
4452 break;
4454 case 'v':
4455 if (!strcmp (arg, "version"))
4456 version_flag = 1;
4457 else
4458 return 0;
4459 break;
4461 case 'w':
4462 if (arg[1] == 0)
4463 inhibit_warnings = 1;
4464 else
4465 return 0;
4466 break;
4468 case 'W':
4469 if (arg[1] == 0)
4471 extra_warnings = 1;
4472 /* We save the value of warn_uninitialized, since if they put
4473 -Wuninitialized on the command line, we need to generate a
4474 warning about not using it without also specifying -O. */
4475 if (warn_uninitialized != 1)
4476 warn_uninitialized = 2;
4478 else
4479 return decode_W_option (arg + 1);
4480 break;
4482 case 'a':
4483 if (arg[1] == 0)
4485 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4486 warning ("`-a' option (basic block profile) not supported");
4487 #else
4488 profile_block_flag = (profile_block_flag < 2) ? 1 : 3;
4489 #endif
4491 else if (!strcmp (arg, "ax"))
4493 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
4494 warning ("`-ax' option (jump profiling) not supported");
4495 #else
4496 profile_block_flag = (!profile_block_flag
4497 || profile_block_flag == 2) ? 2 : 3;
4498 #endif
4500 else if (!strncmp (arg, "aux-info", 8))
4502 flag_gen_aux_info = 1;
4503 if (arg[8] == '\0')
4505 if (argc == 1)
4506 return 0;
4508 aux_info_file_name = argv[1];
4509 return 2;
4511 else
4512 aux_info_file_name = arg + 8;
4514 else
4515 return 0;
4516 break;
4518 case 'o':
4519 if (arg[1] == 0)
4521 if (argc == 1)
4522 return 0;
4524 asm_file_name = argv[1];
4525 return 2;
4527 return 0;
4529 case 'G':
4531 int g_switch_val;
4532 int return_val;
4534 if (arg[1] == 0)
4536 if (argc == 1)
4537 return 0;
4539 g_switch_val = read_integral_parameter (argv[1], 0, -1);
4540 return_val = 2;
4542 else
4544 g_switch_val = read_integral_parameter (arg + 1, 0, -1);
4545 return_val = 1;
4548 if (g_switch_val == -1)
4549 return_val = 0;
4550 else
4552 g_switch_set = TRUE;
4553 g_switch_value = g_switch_val;
4556 return return_val;
4560 return 1;
4563 /* Entry point of cc1/c++. Decode command args, then call compile_file.
4564 Exit code is 35 if can't open files, 34 if fatal error,
4565 33 if had nonfatal errors, else success. */
4567 extern int main PARAMS ((int, char **));
4570 main (argc, argv)
4571 int argc;
4572 char **argv;
4574 register int i;
4575 char *p;
4577 /* save in case md file wants to emit args as a comment. */
4578 save_argc = argc;
4579 save_argv = argv;
4581 p = argv[0] + strlen (argv[0]);
4582 while (p != argv[0] && p[-1] != '/'
4583 #ifdef DIR_SEPARATOR
4584 && p[-1] != DIR_SEPARATOR
4585 #endif
4587 --p;
4588 progname = p;
4590 #ifdef HAVE_LC_MESSAGES
4591 setlocale (LC_MESSAGES, "");
4592 #endif
4593 (void) bindtextdomain (PACKAGE, localedir);
4594 (void) textdomain (PACKAGE);
4596 signal (SIGFPE, float_signal);
4598 #ifdef SIGPIPE
4599 signal (SIGPIPE, pipe_closed);
4600 #endif
4602 decl_printable_name = decl_name;
4603 lang_expand_expr = (lang_expand_expr_t) do_abort;
4605 /* Initialize whether `char' is signed. */
4606 flag_signed_char = DEFAULT_SIGNED_CHAR;
4607 #ifdef DEFAULT_SHORT_ENUMS
4608 /* Initialize how much space enums occupy, by default. */
4609 flag_short_enums = DEFAULT_SHORT_ENUMS;
4610 #endif
4612 /* Initialize the garbage-collector. */
4613 init_ggc ();
4614 ggc_add_root (&input_file_stack, 1, sizeof input_file_stack,
4615 mark_file_stack);
4616 ggc_add_rtx_root (&stack_limit_rtx, 1);
4617 ggc_add_tree_root (&current_function_decl, 1);
4618 ggc_add_tree_root (&current_function_func_begin_label, 1);
4620 /* Perform language-specific options intialization. */
4621 lang_init_options ();
4623 /* Scan to see what optimization level has been specified. That will
4624 determine the default value of many flags. */
4625 for (i = 1; i < argc; i++)
4627 if (!strcmp (argv[i], "-O"))
4629 optimize = 1;
4630 optimize_size = 0;
4632 else if (argv[i][0] == '-' && argv[i][1] == 'O')
4634 /* Handle -Os, -O2, -O3, -O69, ... */
4635 char *p = &argv[i][2];
4637 if ((p[0] == 's') && (p[1] == 0))
4639 optimize_size = 1;
4641 /* Optimizing for size forces optimize to be 2. */
4642 optimize = 2;
4644 else
4646 const int optimize_val = read_integral_parameter (p, p - 2, -1);
4647 if (optimize_val != -1)
4649 optimize = optimize_val;
4650 optimize_size = 0;
4656 if (optimize >= 1)
4658 flag_defer_pop = 1;
4659 flag_thread_jumps = 1;
4660 #ifdef DELAY_SLOTS
4661 flag_delayed_branch = 1;
4662 #endif
4663 #ifdef CAN_DEBUG_WITHOUT_FP
4664 flag_omit_frame_pointer = 1;
4665 #endif
4668 if (optimize >= 2)
4670 flag_cse_follow_jumps = 1;
4671 flag_cse_skip_blocks = 1;
4672 flag_gcse = 1;
4673 flag_expensive_optimizations = 1;
4674 flag_strength_reduce = 1;
4675 flag_rerun_cse_after_loop = 1;
4676 flag_rerun_loop_opt = 1;
4677 flag_caller_saves = 1;
4678 flag_force_mem = 1;
4679 flag_peephole2 = 1;
4680 #ifdef INSN_SCHEDULING
4681 flag_schedule_insns = 1;
4682 flag_schedule_insns_after_reload = 1;
4683 #endif
4684 flag_regmove = 1;
4685 flag_strict_aliasing = 1;
4686 flag_delete_null_pointer_checks = 1;
4689 if (optimize >= 3)
4691 flag_inline_functions = 1;
4694 if (optimize < 2 || optimize_size)
4696 align_loops = 1;
4697 align_jumps = 1;
4698 align_labels = 1;
4699 align_functions = 1;
4702 /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
4703 modify it. */
4704 target_flags = 0;
4705 set_target_switch ("");
4707 #ifdef OPTIMIZATION_OPTIONS
4708 /* Allow default optimizations to be specified on a per-machine basis. */
4709 OPTIMIZATION_OPTIONS (optimize, optimize_size);
4710 #endif
4712 /* Initialize register usage now so switches may override. */
4713 init_reg_sets ();
4715 /* Perform normal command line switch decoding. */
4716 for (i = 1; i < argc;)
4718 unsigned lang_processed;
4719 unsigned indep_processed;
4721 /* Give the language a chance to decode the option for itself. */
4722 lang_processed = lang_decode_option (argc - i, argv + i);
4724 /* Now see if the option also has a language independent meaning.
4725 Some options are both language specific and language independent,
4726 eg --help. It is possible that there might be options that should
4727 only be decoded in a language independent way if the were not
4728 decoded in a langauge specific way, which is why 'lang_processed'
4729 is passed in. */
4730 indep_processed = independent_decode_option (argc - i, argv + i,
4731 lang_processed);
4733 if (lang_processed || indep_processed)
4734 i += (lang_processed > indep_processed
4735 ? lang_processed : indep_processed);
4736 else
4738 const char * option = NULL;
4739 const char * lang = NULL;
4740 unsigned int j;
4742 /* It is possible that the command line switch is not valid for the
4743 current language, but it is valid for another language. In order
4744 to be compatible with previous versions of the compiler (which
4745 did not issue an error message in this case) we check for this
4746 possibilty here. If we do find a match, then if extra_warnings
4747 is set we generate a warning message, otherwise we will just
4748 ignore the option. */
4749 for (j = 0; j < NUM_ELEM (documented_lang_options); j++)
4751 option = documented_lang_options[j].option;
4753 if (option == NULL)
4754 lang = documented_lang_options[j].description;
4755 else if (! strncmp (argv[i], option, strlen (option)))
4756 break;
4759 if (j != NUM_ELEM (documented_lang_options))
4761 if (extra_warnings)
4763 warning ("Ignoring command line option '%s'", argv[i]);
4764 if (lang)
4765 warning ("\
4766 (It is valid for %s but not the selected langauge)", lang);
4769 else
4770 error ("Unrecognized option `%s'", argv[i]);
4772 i++;
4776 /* Checker uses the frame pointer. */
4777 if (flag_check_memory_usage)
4778 flag_omit_frame_pointer = 0;
4780 if (optimize == 0)
4782 /* Inlining does not work if not optimizing,
4783 so force it not to be done. */
4784 flag_no_inline = 1;
4785 warn_inline = 0;
4787 /* The c_decode_option and lang_decode_option functions set
4788 this to `2' if -Wall is used, so we can avoid giving out
4789 lots of errors for people who don't realize what -Wall does. */
4790 if (warn_uninitialized == 1)
4791 warning ("-Wuninitialized is not supported without -O");
4794 #ifdef OVERRIDE_OPTIONS
4795 /* Some machines may reject certain combinations of options. */
4796 OVERRIDE_OPTIONS;
4797 #endif
4799 if (exceptions_via_longjmp == 2)
4801 #ifdef DWARF2_UNWIND_INFO
4802 exceptions_via_longjmp = ! DWARF2_UNWIND_INFO;
4803 #else
4804 exceptions_via_longjmp = 1;
4805 #endif
4808 /* Set up the align_*_log variables, defaulting them to 1 if they
4809 were still unset. */
4810 if (align_loops <= 0) align_loops = 1;
4811 align_loops_log = floor_log2 (align_loops*2-1);
4812 if (align_jumps <= 0) align_jumps = 1;
4813 align_jumps_log = floor_log2 (align_jumps*2-1);
4814 if (align_labels <= 0) align_labels = 1;
4815 align_labels_log = floor_log2 (align_labels*2-1);
4816 if (align_functions <= 0) align_functions = 1;
4817 align_functions_log = floor_log2 (align_functions*2-1);
4819 if (profile_block_flag == 3)
4821 warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4822 profile_block_flag = 2;
4825 /* Unrolling all loops implies that standard loop unrolling must also
4826 be done. */
4827 if (flag_unroll_all_loops)
4828 flag_unroll_loops = 1;
4829 /* Loop unrolling requires that strength_reduction be on also. Silently
4830 turn on strength reduction here if it isn't already on. Also, the loop
4831 unrolling code assumes that cse will be run after loop, so that must
4832 be turned on also. */
4833 if (flag_unroll_loops)
4835 flag_strength_reduce = 1;
4836 flag_rerun_cse_after_loop = 1;
4839 /* Warn about options that are not supported on this machine. */
4840 #ifndef INSN_SCHEDULING
4841 if (flag_schedule_insns || flag_schedule_insns_after_reload)
4842 warning ("instruction scheduling not supported on this target machine");
4843 #endif
4844 #ifndef DELAY_SLOTS
4845 if (flag_delayed_branch)
4846 warning ("this target machine does not have delayed branches");
4847 #endif
4849 user_label_prefix = USER_LABEL_PREFIX;
4850 if (flag_leading_underscore != -1)
4852 /* If the default prefix is more complicated than "" or "_",
4853 issue a warning and ignore this option. */
4854 if (user_label_prefix[0] == 0 ||
4855 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
4857 user_label_prefix = flag_leading_underscore ? "_" : "";
4859 else
4860 warning ("-f%sleading-underscore not supported on this target machine",
4861 flag_leading_underscore ? "" : "no-");
4864 /* If we are in verbose mode, write out the version and maybe all the
4865 option flags in use. */
4866 if (version_flag)
4868 print_version (stderr, "");
4869 if (! quiet_flag)
4870 print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
4873 compile_file (filename);
4875 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__)) && !defined(__INTERIX)
4876 if (flag_print_mem)
4878 char *lim = (char *) sbrk (0);
4880 fnotice (stderr, "Data size %ld.\n", (long) (lim - (char *) &environ));
4881 fflush (stderr);
4883 #ifndef __MSDOS__
4884 #ifdef USG
4885 system ("ps -l 1>&2");
4886 #else /* not USG */
4887 system ("ps v");
4888 #endif /* not USG */
4889 #endif
4891 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX */
4893 if (errorcount)
4894 return (FATAL_EXIT_CODE);
4895 if (sorrycount)
4896 return (FATAL_EXIT_CODE);
4897 return (SUCCESS_EXIT_CODE);
4900 /* Decode -m switches. */
4901 /* Decode the switch -mNAME. */
4903 static void
4904 set_target_switch (name)
4905 const char *name;
4907 register size_t j;
4908 int valid_target_option = 0;
4910 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
4911 if (!strcmp (target_switches[j].name, name))
4913 if (target_switches[j].value < 0)
4914 target_flags &= ~-target_switches[j].value;
4915 else
4916 target_flags |= target_switches[j].value;
4917 valid_target_option = 1;
4920 #ifdef TARGET_OPTIONS
4921 if (!valid_target_option)
4922 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
4924 int len = strlen (target_options[j].prefix);
4925 if (!strncmp (target_options[j].prefix, name, len))
4927 *target_options[j].variable = name + len;
4928 valid_target_option = 1;
4931 #endif
4933 if (!valid_target_option)
4934 error ("Invalid option `%s'", name);
4937 /* Print version information to FILE.
4938 Each line begins with INDENT (for the case where FILE is the
4939 assembler output file). */
4941 static void
4942 print_version (file, indent)
4943 FILE *file;
4944 const char *indent;
4946 #ifndef __VERSION__
4947 #define __VERSION__ "[?]"
4948 #endif
4949 fnotice (file,
4950 #ifdef __GNUC__
4951 "%s%s%s version %s (%s) compiled by GNU C version %s.\n"
4952 #else
4953 "%s%s%s version %s (%s) compiled by CC.\n"
4954 #endif
4955 , indent, *indent != 0 ? " " : "",
4956 language_string, version_string, TARGET_NAME, __VERSION__);
4959 /* Print an option value and return the adjusted position in the line.
4960 ??? We don't handle error returns from fprintf (disk full); presumably
4961 other code will catch a disk full though. */
4963 static int
4964 print_single_switch (file, pos, max, indent, sep, term, type, name)
4965 FILE *file;
4966 int pos, max;
4967 const char *indent, *sep, *term, *type, *name;
4969 /* The ultrix fprintf returns 0 on success, so compute the result we want
4970 here since we need it for the following test. */
4971 int len = strlen (sep) + strlen (type) + strlen (name);
4973 if (pos != 0
4974 && pos + len > max)
4976 fprintf (file, "%s", term);
4977 pos = 0;
4979 if (pos == 0)
4981 fprintf (file, "%s", indent);
4982 pos = strlen (indent);
4984 fprintf (file, "%s%s%s", sep, type, name);
4985 pos += len;
4986 return pos;
4989 /* Print active target switches to FILE.
4990 POS is the current cursor position and MAX is the size of a "line".
4991 Each line begins with INDENT and ends with TERM.
4992 Each switch is separated from the next by SEP. */
4994 static void
4995 print_switch_values (file, pos, max, indent, sep, term)
4996 FILE *file;
4997 int pos, max;
4998 const char *indent, *sep, *term;
5000 size_t j;
5001 char **p;
5003 /* Print the options as passed. */
5005 pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
5006 _("options passed: "), "");
5008 for (p = &save_argv[1]; *p != NULL; p++)
5009 if (**p == '-')
5011 /* Ignore these. */
5012 if (strcmp (*p, "-o") == 0)
5014 if (p[1] != NULL)
5015 p++;
5016 continue;
5018 if (strcmp (*p, "-quiet") == 0)
5019 continue;
5020 if (strcmp (*p, "-version") == 0)
5021 continue;
5022 if ((*p)[1] == 'd')
5023 continue;
5025 pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
5027 if (pos > 0)
5028 fprintf (file, "%s", term);
5030 /* Print the -f and -m options that have been enabled.
5031 We don't handle language specific options but printing argv
5032 should suffice. */
5034 pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
5035 _("options enabled: "), "");
5037 for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
5038 if (*f_options[j].variable == f_options[j].on_value)
5039 pos = print_single_switch (file, pos, max, indent, sep, term,
5040 "-f", f_options[j].string);
5042 /* Print target specific options. */
5044 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
5045 if (target_switches[j].name[0] != '\0'
5046 && target_switches[j].value > 0
5047 && ((target_switches[j].value & target_flags)
5048 == target_switches[j].value))
5050 pos = print_single_switch (file, pos, max, indent, sep, term,
5051 "-m", target_switches[j].name);
5054 #ifdef TARGET_OPTIONS
5055 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
5056 if (*target_options[j].variable != NULL)
5058 char prefix[256];
5059 sprintf (prefix, "-m%s", target_options[j].prefix);
5060 pos = print_single_switch (file, pos, max, indent, sep, term,
5061 prefix, *target_options[j].variable);
5063 #endif
5065 fprintf (file, "%s", term);
5068 /* Record the beginning of a new source file, named FILENAME. */
5070 void
5071 debug_start_source_file (filename)
5072 register char *filename ATTRIBUTE_UNUSED;
5074 #ifdef DBX_DEBUGGING_INFO
5075 if (write_symbols == DBX_DEBUG)
5076 dbxout_start_new_source_file (filename);
5077 #endif
5078 #ifdef DWARF_DEBUGGING_INFO
5079 if (debug_info_level == DINFO_LEVEL_VERBOSE
5080 && write_symbols == DWARF_DEBUG)
5081 dwarfout_start_new_source_file (filename);
5082 #endif /* DWARF_DEBUGGING_INFO */
5083 #ifdef DWARF2_DEBUGGING_INFO
5084 if (debug_info_level == DINFO_LEVEL_VERBOSE
5085 && write_symbols == DWARF2_DEBUG)
5086 dwarf2out_start_source_file (filename);
5087 #endif /* DWARF2_DEBUGGING_INFO */
5088 #ifdef SDB_DEBUGGING_INFO
5089 if (write_symbols == SDB_DEBUG)
5090 sdbout_start_new_source_file (filename);
5091 #endif
5094 /* Record the resumption of a source file. LINENO is the line number in
5095 the source file we are returning to. */
5097 void
5098 debug_end_source_file (lineno)
5099 register unsigned lineno ATTRIBUTE_UNUSED;
5101 #ifdef DBX_DEBUGGING_INFO
5102 if (write_symbols == DBX_DEBUG)
5103 dbxout_resume_previous_source_file ();
5104 #endif
5105 #ifdef DWARF_DEBUGGING_INFO
5106 if (debug_info_level == DINFO_LEVEL_VERBOSE
5107 && write_symbols == DWARF_DEBUG)
5108 dwarfout_resume_previous_source_file (lineno);
5109 #endif /* DWARF_DEBUGGING_INFO */
5110 #ifdef DWARF2_DEBUGGING_INFO
5111 if (debug_info_level == DINFO_LEVEL_VERBOSE
5112 && write_symbols == DWARF2_DEBUG)
5113 dwarf2out_end_source_file ();
5114 #endif /* DWARF2_DEBUGGING_INFO */
5115 #ifdef SDB_DEBUGGING_INFO
5116 if (write_symbols == SDB_DEBUG)
5117 sdbout_resume_previous_source_file ();
5118 #endif
5121 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5122 the tail part of the directive line, i.e. the part which is past the
5123 initial whitespace, #, whitespace, directive-name, whitespace part. */
5125 void
5126 debug_define (lineno, buffer)
5127 register unsigned lineno ATTRIBUTE_UNUSED;
5128 register char *buffer ATTRIBUTE_UNUSED;
5130 #ifdef DWARF_DEBUGGING_INFO
5131 if (debug_info_level == DINFO_LEVEL_VERBOSE
5132 && write_symbols == DWARF_DEBUG)
5133 dwarfout_define (lineno, buffer);
5134 #endif /* DWARF_DEBUGGING_INFO */
5135 #ifdef DWARF2_DEBUGGING_INFO
5136 if (debug_info_level == DINFO_LEVEL_VERBOSE
5137 && write_symbols == DWARF2_DEBUG)
5138 dwarf2out_define (lineno, buffer);
5139 #endif /* DWARF2_DEBUGGING_INFO */
5142 /* Called from check_newline in c-parse.y. The `buffer' parameter contains
5143 the tail part of the directive line, i.e. the part which is past the
5144 initial whitespace, #, whitespace, directive-name, whitespace part. */
5146 void
5147 debug_undef (lineno, buffer)
5148 register unsigned lineno ATTRIBUTE_UNUSED;
5149 register char *buffer ATTRIBUTE_UNUSED;
5151 #ifdef DWARF_DEBUGGING_INFO
5152 if (debug_info_level == DINFO_LEVEL_VERBOSE
5153 && write_symbols == DWARF_DEBUG)
5154 dwarfout_undef (lineno, buffer);
5155 #endif /* DWARF_DEBUGGING_INFO */
5156 #ifdef DWARF2_DEBUGGING_INFO
5157 if (debug_info_level == DINFO_LEVEL_VERBOSE
5158 && write_symbols == DWARF2_DEBUG)
5159 dwarf2out_undef (lineno, buffer);
5160 #endif /* DWARF2_DEBUGGING_INFO */
5163 /* Tell the debugging backend that we've decided not to emit any
5164 debugging information for BLOCK, so it can clean up after any local
5165 classes or nested functions. */
5167 void
5168 debug_ignore_block (block)
5169 tree block ATTRIBUTE_UNUSED;
5171 #ifdef DWARF2_DEBUGGING_INFO
5172 if (write_symbols == DWARF2_DEBUG)
5173 dwarf2out_ignore_block (block);
5174 #endif