1 /* Top level of GNU C compiler
2 Copyright (C) 1987, 88, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* This is the top level of cc1/c++.
22 It parses command args, opens files, invokes the various passes
23 in the proper order, and counts the time used by each.
24 Error messages and low-level interface to malloc also handled here. */
35 #include <sys/types.h>
42 #include <sys/param.h>
43 /* This is for hpux. It is a real screw. They should change hpux. */
45 #include <sys/times.h>
46 #include <time.h> /* Correct for hpux at least. Is it good on other USG? */
47 #undef FFS /* Some systems define this in param.h. */
51 #include <sys/resource.h>
60 #include "insn-attr.h"
66 #ifdef XCOFF_DEBUGGING_INFO
71 /* The extra parameters substantially improve the I/O performance. */
73 vms_fopen (fname, type)
77 /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
78 fixed arguments, which matches ANSI's specification but not VAXCRTL's
79 pre-ANSI implementation. This hack circumvents the mismatch problem. */
80 FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
83 return (*vmslib_fopen) (fname, type, "mbc=32",
84 "deq=64", "fop=tef", "shr=nil");
86 return (*vmslib_fopen) (fname, type, "mbc=32");
88 #define fopen vms_fopen
91 #ifndef DEFAULT_GDB_EXTENSIONS
92 #define DEFAULT_GDB_EXTENSIONS 1
95 extern int rtx_equal_function_value_matters;
97 #if ! (defined (VMS) || defined (OS2))
98 extern char **environ;
100 extern char *version_string, *language_string;
102 /* Carry information from ASM_DECLARE_OBJECT_NAME
103 to ASM_FINISH_DECLARE_OBJECT. */
105 extern int size_directive_output;
106 extern tree last_assemble_variable_decl;
108 extern void init_lex ();
109 extern void init_decl_processing ();
110 extern void init_obstacks ();
111 extern void init_tree_codes ();
112 extern void init_rtl ();
113 extern void init_regs ();
114 extern void init_optabs ();
115 extern void init_stmt ();
116 extern void init_reg_sets ();
117 extern void dump_flow_info ();
118 extern void dump_sched_info ();
119 extern void dump_local_alloc ();
121 void rest_of_decl_compilation ();
122 void error_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
123 void error_with_decl PVPROTO((tree decl, char *s, ...));
124 void error_for_asm PVPROTO((rtx insn, char *s, ...));
125 void error PVPROTO((char *s, ...));
126 void fatal PVPROTO((char *s, ...));
127 void warning_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
128 void warning_with_decl PVPROTO((tree decl, char *s, ...));
129 void warning_for_asm PVPROTO((rtx insn, char *s, ...));
130 void warning PVPROTO((char *s, ...));
131 void pedwarn PVPROTO((char *s, ...));
132 void pedwarn_with_decl PVPROTO((tree decl, char *s, ...));
133 void pedwarn_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
134 void sorry PVPROTO((char *s, ...));
135 void really_sorry PVPROTO((char *s, ...));
140 void set_target_switch ();
141 static void print_switch_values ();
142 static char *decl_name ();
144 /* Name of program invoked, sans directories. */
148 /* Copy of arguments to main. */
152 /* Name of current original source file (what was input to cpp).
153 This comes from each #-command in the actual input. */
155 char *input_filename;
157 /* Name of top-level original source file (what was input to cpp).
158 This comes from the #-command at the beginning of the actual input.
159 If there isn't any there, then this is the cc1 input file name. */
161 char *main_input_filename;
163 /* Stream for reading from the input file. */
167 /* Current line number in real source file. */
171 /* Stack of currently pending input files. */
173 struct file_stack *input_file_stack;
175 /* Incremented on each change to input_file_stack. */
176 int input_file_stack_tick;
178 /* FUNCTION_DECL for function now being parsed or compiled. */
180 extern tree current_function_decl;
182 /* Name to use as base of names for dump output files. */
184 char *dump_base_name;
186 /* Bit flags that specify the machine subtype we are compiling for.
187 Bits are tested using macros TARGET_... defined in the tm.h file
188 and set by `-m...' switches. Must be defined in rtlanal.c. */
190 extern int target_flags;
192 /* Flags saying which kinds of debugging dump have been requested. */
195 int rtl_dump_and_exit = 0;
196 int jump_opt_dump = 0;
201 int combine_dump = 0;
203 int local_reg_dump = 0;
204 int global_reg_dump = 0;
206 int jump2_opt_dump = 0;
207 int dbr_sched_dump = 0;
208 int flag_print_asm_name = 0;
209 int stack_reg_dump = 0;
211 /* Name for output file of assembly code, specified with -o. */
215 /* Value of the -G xx switch, and whether it was passed or not. */
219 /* Type(s) of debugging information we are producing (if any).
220 See flags.h for the definitions of the different possible
221 types of debugging information. */
222 enum debug_info_type write_symbols = NO_DEBUG;
224 /* Level of debugging information we are producing. See flags.h
225 for the definitions of the different possible levels. */
226 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
228 /* Nonzero means use GNU-only extensions in the generated symbolic
229 debugging information. */
230 /* Currently, this only has an effect when write_symbols is set to
231 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
232 int use_gnu_debug_info_extensions = 0;
234 /* Nonzero means do optimizations. -O.
235 Particular numeric values stand for particular amounts of optimization;
236 thus, -O2 stores 2 here. However, the optimizations beyond the basic
237 ones are not controlled directly by this variable. Instead, they are
238 controlled by individual `flag_...' variables that are defaulted
239 based on this variable. */
243 /* Number of error messages and warning messages so far. */
246 int warningcount = 0;
249 /* Flag to output bytecode instead of native assembler */
250 int output_bytecode = 0;
252 /* Pointer to function to compute the name to use to print a declaration. */
254 char *(*decl_printable_name) ();
256 /* Pointer to function to compute rtl for a language-specific tree code. */
258 struct rtx_def *(*lang_expand_expr) ();
260 /* Pointer to function to finish handling an incomplete decl at the
261 end of compilation. */
263 void (*incomplete_decl_finalize_hook) () = 0;
265 /* Pointer to function for interim exception handling implementation.
266 This interface will change, and it is only here until a better interface
269 void (*interim_eh_hook) PROTO((tree));
271 /* Nonzero if generating code to do profiling. */
273 int profile_flag = 0;
275 /* Nonzero if generating code to do profiling on a line-by-line basis. */
277 int profile_block_flag;
279 /* Nonzero for -pedantic switch: warn about anything
280 that standard spec forbids. */
284 /* Temporarily suppress certain warnings.
285 This is set while reading code from a system header file. */
287 int in_system_header = 0;
289 /* Nonzero means do stupid register allocation.
290 Currently, this is 1 if `optimize' is 0. */
292 int obey_regdecls = 0;
294 /* Don't print functions as they are compiled and don't print
295 times taken by the various passes. -quiet. */
301 /* Nonzero means `char' should be signed. */
303 int flag_signed_char;
305 /* Nonzero means give an enum type only as many bytes as it needs. */
307 int flag_short_enums;
309 /* Nonzero for -fcaller-saves: allocate values in regs that need to
310 be saved across function calls, if that produces overall better code.
311 Optional now, so people can test it. */
313 #ifdef DEFAULT_CALLER_SAVES
314 int flag_caller_saves = 1;
316 int flag_caller_saves = 0;
319 /* Nonzero if structures and unions should be returned in memory.
321 This should only be defined if compatibility with another compiler or
322 with an ABI is needed, because it results in slower code. */
324 #ifndef DEFAULT_PCC_STRUCT_RETURN
325 #define DEFAULT_PCC_STRUCT_RETURN 1
328 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
330 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
332 /* Nonzero for -fforce-mem: load memory value into a register
333 before arithmetic on it. This makes better cse but slower compilation. */
335 int flag_force_mem = 0;
337 /* Nonzero for -fforce-addr: load memory address into a register before
338 reference to memory. This makes better cse but slower compilation. */
340 int flag_force_addr = 0;
342 /* Nonzero for -fdefer-pop: don't pop args after each function call;
343 instead save them up to pop many calls' args with one insns. */
345 int flag_defer_pop = 0;
347 /* Nonzero for -ffloat-store: don't allocate floats and doubles
348 in extended-precision registers. */
350 int flag_float_store = 0;
352 /* Nonzero for -fcse-follow-jumps:
353 have cse follow jumps to do a more extensive job. */
355 int flag_cse_follow_jumps;
357 /* Nonzero for -fcse-skip-blocks:
358 have cse follow a branch around a block. */
359 int flag_cse_skip_blocks;
361 /* Nonzero for -fexpensive-optimizations:
362 perform miscellaneous relatively-expensive optimizations. */
363 int flag_expensive_optimizations;
365 /* Nonzero for -fthread-jumps:
366 have jump optimize output of loop. */
368 int flag_thread_jumps;
370 /* Nonzero enables strength-reduction in loop.c. */
372 int flag_strength_reduce = 0;
374 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
375 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
376 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
379 int flag_unroll_loops;
381 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
382 This is generally not a win. */
384 int flag_unroll_all_loops;
386 /* Nonzero for -fwritable-strings:
387 store string constants in data segment and don't uniquize them. */
389 int flag_writable_strings = 0;
391 /* Nonzero means don't put addresses of constant functions in registers.
392 Used for compiling the Unix kernel, where strange substitutions are
393 done on the assembly output. */
395 int flag_no_function_cse = 0;
397 /* Nonzero for -fomit-frame-pointer:
398 don't make a frame pointer in simple functions that don't require one. */
400 int flag_omit_frame_pointer = 0;
402 /* Nonzero to inhibit use of define_optimization peephole opts. */
404 int flag_no_peephole = 0;
406 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
407 operations in the interest of optimization. For example it allows
408 GCC to assume arguments to sqrt are nonnegative numbers, allowing
409 faster code for sqrt to be generated. */
411 int flag_fast_math = 0;
413 /* Nonzero means all references through pointers are volatile. */
417 /* Nonzero means treat all global and extern variables as global. */
419 int flag_volatile_global;
421 /* Nonzero means just do syntax checking; don't output anything. */
423 int flag_syntax_only = 0;
425 /* Nonzero means to rerun cse after loop optimization. This increases
426 compilation time about 20% and picks up a few more common expressions. */
428 static int flag_rerun_cse_after_loop;
430 /* Nonzero for -finline-functions: ok to inline functions that look like
431 good inline candidates. */
433 int flag_inline_functions;
435 /* Nonzero for -fkeep-inline-functions: even if we make a function
436 go inline everywhere, keep its definition around for debugging
439 int flag_keep_inline_functions;
441 /* Nonzero means that functions will not be inlined. */
445 /* Nonzero means we should be saving declaration info into a .X file. */
447 int flag_gen_aux_info = 0;
449 /* Specified name of aux-info file. */
451 static char *aux_info_file_name;
453 /* Nonzero means make the text shared if supported. */
455 int flag_shared_data;
457 /* Nonzero means schedule into delayed branch slots if supported. */
459 int flag_delayed_branch;
461 /* Nonzero means to run cleanups after CALL_EXPRs. */
463 int flag_short_temps;
465 /* Nonzero if we are compiling pure (sharable) code.
466 Value is 1 if we are doing reasonable (i.e. simple
467 offset into offset table) pic. Value is 2 if we can
468 only perform register offsets. */
472 /* Nonzero means place uninitialized global data in the bss section. */
476 /* Nonzero means pretend it is OK to examine bits of target floats,
477 even if that isn't true. The resulting code will have incorrect constants,
478 but the same series of instructions that the native compiler would make. */
480 int flag_pretend_float;
482 /* Nonzero means change certain warnings into errors.
483 Usually these are warnings about failure to conform to some standard. */
485 int flag_pedantic_errors = 0;
487 /* flag_schedule_insns means schedule insns within basic blocks (before
489 flag_schedule_insns_after_reload means schedule insns after
492 int flag_schedule_insns = 0;
493 int flag_schedule_insns_after_reload = 0;
495 /* -finhibit-size-directive inhibits output of .size for ELF.
496 This is used only for compiling crtstuff.c,
497 and it may be extended to other effects
498 needed for crtstuff.c on other systems. */
499 int flag_inhibit_size_directive = 0;
501 /* -fverbose-asm causes extra commentary information to be produced in
502 the generated assembly code (to make it more readable). This option
503 is generally only of use to those who actually need to read the
504 generated assembly code (perhaps while debugging the compiler itself). */
506 int flag_verbose_asm = 0;
508 /* -fgnu-linker specifies use of the GNU linker for initializations.
509 (Or, more generally, a linker that handles initializations.)
510 -fno-gnu-linker says that collect2 will be used. */
512 int flag_gnu_linker = 0;
514 int flag_gnu_linker = 1;
517 /* Tag all structures with __attribute__(packed) */
518 int flag_pack_struct = 0;
520 /* Table of language-independent -f options.
521 STRING is the option name. VARIABLE is the address of the variable.
522 ON_VALUE is the value to store in VARIABLE
523 if `-fSTRING' is seen as an option.
524 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
526 struct { char *string; int *variable; int on_value;} f_options[] =
528 {"float-store", &flag_float_store, 1},
529 {"volatile", &flag_volatile, 1},
530 {"volatile-global", &flag_volatile_global, 1},
531 {"defer-pop", &flag_defer_pop, 1},
532 {"omit-frame-pointer", &flag_omit_frame_pointer, 1},
533 {"cse-follow-jumps", &flag_cse_follow_jumps, 1},
534 {"cse-skip-blocks", &flag_cse_skip_blocks, 1},
535 {"expensive-optimizations", &flag_expensive_optimizations, 1},
536 {"thread-jumps", &flag_thread_jumps, 1},
537 {"strength-reduce", &flag_strength_reduce, 1},
538 {"unroll-loops", &flag_unroll_loops, 1},
539 {"unroll-all-loops", &flag_unroll_all_loops, 1},
540 {"writable-strings", &flag_writable_strings, 1},
541 {"peephole", &flag_no_peephole, 0},
542 {"force-mem", &flag_force_mem, 1},
543 {"force-addr", &flag_force_addr, 1},
544 {"function-cse", &flag_no_function_cse, 0},
545 {"inline-functions", &flag_inline_functions, 1},
546 {"keep-inline-functions", &flag_keep_inline_functions, 1},
547 {"inline", &flag_no_inline, 0},
548 {"syntax-only", &flag_syntax_only, 1},
549 {"shared-data", &flag_shared_data, 1},
550 {"caller-saves", &flag_caller_saves, 1},
551 {"pcc-struct-return", &flag_pcc_struct_return, 1},
552 {"reg-struct-return", &flag_pcc_struct_return, 0},
553 {"delayed-branch", &flag_delayed_branch, 1},
554 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1},
555 {"pretend-float", &flag_pretend_float, 1},
556 {"schedule-insns", &flag_schedule_insns, 1},
557 {"schedule-insns2", &flag_schedule_insns_after_reload, 1},
558 {"pic", &flag_pic, 1},
559 {"PIC", &flag_pic, 2},
560 {"fast-math", &flag_fast_math, 1},
561 {"common", &flag_no_common, 0},
562 {"inhibit-size-directive", &flag_inhibit_size_directive, 1},
563 {"verbose-asm", &flag_verbose_asm, 1},
564 {"gnu-linker", &flag_gnu_linker, 1},
565 {"pack-struct", &flag_pack_struct, 1},
566 {"bytecode", &output_bytecode, 1}
569 /* Table of language-specific options. */
571 char *lang_options[] =
574 "-fallow-single-precision",
576 "-fsigned-bitfields",
577 "-funsigned-bitfields",
578 "-fno-signed-bitfields",
579 "-fno-unsigned-bitfields",
583 "-fno-unsigned-char",
595 "-fno-cond-mismatch",
596 "-fdollars-in-identifiers",
597 "-fno-dollars-in-identifiers",
606 "-Wbad-function-cast",
607 "-Wno-bad-function-cast",
611 "-Wno-char-subscripts",
625 "-Wno-missing-braces",
626 "-Wmissing-declarations",
627 "-Wno-missing-declarations",
628 "-Wmissing-prototypes",
629 "-Wno-missing-prototypes",
631 "-Wno-nested-externs",
635 "-Wno-pointer-arith",
637 "-Wno-redundant-decls",
638 "-Wstrict-prototypes",
639 "-Wno-strict-prototypes",
645 "-Wno-write-strings",
647 /* these are for obj c */
663 /* Options controlling warnings */
665 /* Don't print warning messages. -w. */
667 int inhibit_warnings = 0;
669 /* Print various extra warnings. -W. */
671 int extra_warnings = 0;
673 /* Treat warnings as errors. -Werror. */
675 int warnings_are_errors = 0;
677 /* Nonzero to warn about unused local variables. */
681 /* Nonzero to warn about variables used before they are initialized. */
683 int warn_uninitialized;
685 /* Nonzero means warn about all declarations which shadow others. */
689 /* Warn if a switch on an enum fails to have a case for every enum value. */
693 /* Nonzero means warn about function definitions that default the return type
694 or that use a null return and have a return-type other than void. */
696 int warn_return_type;
698 /* Nonzero means warn about pointer casts that increase the required
699 alignment of the target type (and might therefore lead to a crash
700 due to a misaligned access). */
704 /* Nonzero means warn about any identifiers that match in the first N
705 characters. The value N is in `id_clash_len'. */
708 unsigned id_clash_len;
710 /* Nonzero means warn about any objects definitions whose size is larger
711 than N bytes. Also want about function definitions whose returned
712 values are larger than N bytes. The value N is in `larger_than_size'. */
714 int warn_larger_than;
715 unsigned larger_than_size;
717 /* Nonzero means warn if inline function is too large. */
721 /* Warn if a function returns an aggregate,
722 since there are often incompatible calling conventions for doing this. */
724 int warn_aggregate_return;
726 /* Likewise for -W. */
728 struct { char *string; int *variable; int on_value;} W_options[] =
730 {"unused", &warn_unused, 1},
731 {"error", &warnings_are_errors, 1},
732 {"shadow", &warn_shadow, 1},
733 {"switch", &warn_switch, 1},
734 {"aggregate-return", &warn_aggregate_return, 1},
735 {"cast-align", &warn_cast_align, 1},
736 {"uninitialized", &warn_uninitialized, 1},
737 {"inline", &warn_inline, 1}
740 /* Output files for assembler code (real compiler output)
741 and debugging dumps. */
746 FILE *jump_opt_dump_file;
748 FILE *loop_dump_file;
749 FILE *cse2_dump_file;
750 FILE *flow_dump_file;
751 FILE *combine_dump_file;
752 FILE *sched_dump_file;
753 FILE *local_reg_dump_file;
754 FILE *global_reg_dump_file;
755 FILE *sched2_dump_file;
756 FILE *jump2_opt_dump_file;
757 FILE *dbr_sched_dump_file;
758 FILE *stack_reg_dump_file;
760 /* Time accumulators, to count the total time spent in various passes. */
764 int integration_time;
772 int local_alloc_time;
773 int global_alloc_time;
776 int shorten_branch_time;
782 /* Return time used so far, in microseconds. */
792 struct rusage rusage;
797 int proc_system_time;
799 int child_system_time;
811 return (clock() * 1000);
812 #else /* not _WIN32 */
815 return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
818 getrusage (0, &rusage);
819 return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
820 + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
823 return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
829 #define TIMEVAR(VAR, BODY) \
830 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
833 print_time (str, total)
838 "time in %s: %d.%06d\n",
839 str, total / 1000000, total % 1000000);
842 /* Count an error or warning. Return 1 if the message should be printed. */
845 count_error (warningp)
848 if (warningp && inhibit_warnings)
851 if (warningp && !warnings_are_errors)
855 static int warning_message = 0;
857 if (warningp && !warning_message)
859 fprintf (stderr, "%s: warnings being treated as errors\n", progname);
868 /* Print a fatal error message. NAME is the text.
869 Also include a system error message based on `errno'. */
872 pfatal_with_name (name)
875 fprintf (stderr, "%s: ", progname);
877 exit (FATAL_EXIT_CODE);
881 fatal_io_error (name)
884 fprintf (stderr, "%s: %s: I/O error\n", progname, name);
885 exit (FATAL_EXIT_CODE);
888 /* Called to give a better error message for a bad insn rather than
889 just calling abort(). */
892 fatal_insn (message, insn)
896 if (!output_bytecode)
902 fflush (asm_out_file);
904 fflush (aux_info_file);
906 fflush (rtl_dump_file);
907 if (jump_opt_dump_file)
908 fflush (jump_opt_dump_file);
910 fflush (cse_dump_file);
912 fflush (loop_dump_file);
914 fflush (cse2_dump_file);
916 fflush (flow_dump_file);
917 if (combine_dump_file)
918 fflush (combine_dump_file);
920 fflush (sched_dump_file);
921 if (local_reg_dump_file)
922 fflush (local_reg_dump_file);
923 if (global_reg_dump_file)
924 fflush (global_reg_dump_file);
925 if (sched2_dump_file)
926 fflush (sched2_dump_file);
927 if (jump2_opt_dump_file)
928 fflush (jump2_opt_dump_file);
929 if (dbr_sched_dump_file)
930 fflush (dbr_sched_dump_file);
931 if (stack_reg_dump_file)
932 fflush (stack_reg_dump_file);
936 /* Called to give a better error message when we don't have an insn to match
937 what we are looking for or if the insn's constraints aren't satisfied,
938 rather than just calling abort(). */
941 fatal_insn_not_found (insn)
944 if (INSN_CODE (insn) < 0)
945 fatal_insn ("internal error--unrecognizable insn:", insn);
947 fatal_insn ("internal error--insn does not satisfy its constraints:", insn);
950 /* This is the default decl_printable_name function. */
953 decl_name (decl, kind)
957 return IDENTIFIER_POINTER (DECL_NAME (decl));
960 /* This is the default interim_eh_hook function. */
963 interim_eh (finalization)
966 /* Don't do anything by default. */
969 static int need_error_newline;
971 /* Function of last error message;
972 more generally, function such that if next error message is in it
973 then we don't have to mention the function name. */
974 static tree last_error_function = NULL;
976 /* Used to detect when input_file_stack has changed since last described. */
977 static int last_error_tick;
979 /* Called when the start of a function definition is parsed,
980 this function prints on stderr the name of the function. */
983 announce_function (decl)
989 if (rtl_dump_and_exit)
990 fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
992 fprintf (stderr, " %s", (*decl_printable_name) (decl, &junk));
994 need_error_newline = 1;
995 last_error_function = current_function_decl;
999 /* The default function to print out name of current function that caused
1003 default_print_error_function (file)
1006 if (last_error_function != current_function_decl)
1008 char *kind = "function";
1009 if (current_function_decl != 0
1010 && TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
1014 fprintf (stderr, "%s: ", file);
1016 if (current_function_decl == NULL)
1017 fprintf (stderr, "At top level:\n");
1020 char *name = (*decl_printable_name) (current_function_decl, &kind);
1021 fprintf (stderr, "In %s `%s':\n", kind, name);
1024 last_error_function = current_function_decl;
1028 /* Called by report_error_function to print out function name.
1029 * Default may be overridden by language front-ends. */
1031 void (*print_error_function) PROTO((char*)) = default_print_error_function;
1033 /* Prints out, if necessary, the name of the current function
1034 that caused an error. Called from all error and warning functions. */
1037 report_error_function (file)
1040 struct file_stack *p;
1042 if (need_error_newline)
1044 fprintf (stderr, "\n");
1045 need_error_newline = 0;
1048 (*print_error_function) (file);
1050 if (input_file_stack && input_file_stack->next != 0
1051 && input_file_stack_tick != last_error_tick)
1053 fprintf (stderr, "In file included");
1054 for (p = input_file_stack->next; p; p = p->next)
1056 fprintf (stderr, " from %s:%d", p->name, p->line);
1058 fprintf (stderr, ",\n ");
1060 fprintf (stderr, ":\n");
1061 last_error_tick = input_file_stack_tick;
1065 /* Print a message. */
1068 vmessage (prefix, s, ap)
1074 fprintf (stderr, "%s: ", prefix);
1077 vfprintf (stderr, s, ap);
1080 HOST_WIDE_INT v1 = va_arg(ap, HOST_WIDE_INT);
1081 HOST_WIDE_INT v2 = va_arg(ap, HOST_WIDE_INT);
1082 HOST_WIDE_INT v3 = va_arg(ap, HOST_WIDE_INT);
1083 HOST_WIDE_INT v4 = va_arg(ap, HOST_WIDE_INT);
1084 fprintf (stderr, s, v1, v2, v3, v4);
1089 /* Print a message relevant to line LINE of file FILE. */
1092 v_message_with_file_and_line (file, line, prefix, s, ap)
1100 fprintf (stderr, "%s:%d: ", file, line);
1102 fprintf (stderr, "%s: ", progname);
1104 vmessage (prefix, s, ap);
1105 fputc ('\n', stderr);
1108 /* Print a message relevant to the given DECL. */
1111 v_message_with_decl (decl, prefix, s, ap)
1119 fprintf (stderr, "%s:%d: ",
1120 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
1123 fprintf (stderr, "%s: ", prefix);
1125 /* Do magic to get around lack of varargs support for insertion
1126 of arguments into existing list. We know that the decl is first;
1127 we ass_u_me that it will be printed with "%s". */
1129 for (p = s; *p; ++p)
1133 if (*(p + 1) == '%')
1140 if (p > s) /* Print the left-hand substring. */
1142 char fmt[sizeof "%.255s"];
1145 if (width > 255L) width = 255L; /* arbitrary */
1146 sprintf (fmt, "%%.%lds", width);
1147 fprintf (stderr, fmt, s);
1150 if (*p == '%') /* Print the name. */
1152 char *n = (DECL_NAME (decl)
1153 ? (*decl_printable_name) (decl, &junk)
1159 if (isalpha (*(p - 1) & 0xFF))
1164 if (*p) /* Print the rest of the message. */
1165 vmessage ((char *)NULL, p, ap);
1167 fputc ('\n', stderr);
1170 /* Figure file and line of the given INSN. */
1173 file_and_line_for_asm (insn, pfile, pline)
1178 rtx body = PATTERN (insn);
1181 /* Find the (or one of the) ASM_OPERANDS in the insn. */
1182 if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
1183 asmop = SET_SRC (body);
1184 else if (GET_CODE (body) == ASM_OPERANDS)
1186 else if (GET_CODE (body) == PARALLEL
1187 && GET_CODE (XVECEXP (body, 0, 0)) == SET)
1188 asmop = SET_SRC (XVECEXP (body, 0, 0));
1189 else if (GET_CODE (body) == PARALLEL
1190 && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
1191 asmop = XVECEXP (body, 0, 0);
1197 *pfile = ASM_OPERANDS_SOURCE_FILE (asmop);
1198 *pline = ASM_OPERANDS_SOURCE_LINE (asmop);
1202 *pfile = input_filename;
1207 /* Report an error at line LINE of file FILE. */
1210 v_error_with_file_and_line (file, line, s, ap)
1217 report_error_function (file);
1218 v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
1222 error_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1234 file = va_arg (ap, char *);
1235 line = va_arg (ap, int);
1236 s = va_arg (ap, char *);
1239 v_error_with_file_and_line (file, line, s, ap);
1243 /* Report an error at the declaration DECL.
1244 S is a format string which uses %s to substitute the declaration
1245 name; subsequent substitutions are a la printf. */
1248 v_error_with_decl (decl, s, ap)
1254 report_error_function (DECL_SOURCE_FILE (decl));
1255 v_message_with_decl (decl, (char *)NULL, s, ap);
1259 error_with_decl VPROTO((tree decl, char *s, ...))
1270 decl = va_arg (ap, tree);
1271 s = va_arg (ap, char *);
1274 v_error_with_decl (decl, s, ap);
1278 /* Report an error at the line number of the insn INSN.
1279 This is used only when INSN is an `asm' with operands,
1280 and each ASM_OPERANDS records its own source file and line. */
1283 v_error_for_asm (insn, s, ap)
1292 file_and_line_for_asm (insn, &file, &line);
1293 report_error_function (file);
1294 v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
1298 error_for_asm VPROTO((rtx insn, char *s, ...))
1309 insn = va_arg (ap, rtx);
1310 s = va_arg (ap, char *);
1313 v_error_for_asm (insn, s, ap);
1317 /* Report an error at the current line number. */
1324 v_error_with_file_and_line (input_filename, lineno, s, ap);
1328 error VPROTO((char *s, ...))
1338 s = va_arg (ap, char *);
1345 /* Report a fatal error at the current line number. */
1353 exit (FATAL_EXIT_CODE);
1357 fatal VPROTO((char *s, ...))
1367 s = va_arg (ap, char *);
1374 /* Report a warning at line LINE of file FILE. */
1377 v_warning_with_file_and_line (file, line, s, ap)
1383 if (count_error (1))
1385 report_error_function (file);
1386 v_message_with_file_and_line (file, line, "warning", s, ap);
1391 warning_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1403 file = va_arg (ap, char *);
1404 line = va_arg (ap, int);
1405 s = va_arg (ap, char *);
1408 v_warning_with_file_and_line (file, line, s, ap);
1412 /* Report a warning at the declaration DECL.
1413 S is a format string which uses %s to substitute the declaration
1414 name; subsequent substitutions are a la printf. */
1417 v_warning_with_decl (decl, s, ap)
1422 if (count_error (1))
1424 report_error_function (DECL_SOURCE_FILE (decl));
1425 v_message_with_decl (decl, "warning", s, ap);
1430 warning_with_decl VPROTO((tree decl, char *s, ...))
1441 decl = va_arg (ap, tree);
1442 s = va_arg (ap, char *);
1445 v_warning_with_decl (decl, s, ap);
1449 /* Report a warning at the line number of the insn INSN.
1450 This is used only when INSN is an `asm' with operands,
1451 and each ASM_OPERANDS records its own source file and line. */
1454 v_warning_for_asm (insn, s, ap)
1459 if (count_error (1))
1464 file_and_line_for_asm (insn, &file, &line);
1465 report_error_function (file);
1466 v_message_with_file_and_line (file, line, "warning", s, ap);
1471 warning_for_asm VPROTO((rtx insn, char *s, ...))
1482 insn = va_arg (ap, rtx);
1483 s = va_arg (ap, char *);
1486 v_warning_for_asm (insn, s, ap);
1490 /* Report a warning at the current line number. */
1497 v_warning_with_file_and_line (input_filename, lineno, s, ap);
1501 warning VPROTO((char *s, ...))
1511 s = va_arg (ap, char *);
1518 /* These functions issue either warnings or errors depending on
1519 -pedantic-errors. */
1526 if (flag_pedantic_errors)
1533 pedwarn VPROTO((char *s, ...))
1543 s = va_arg (ap, char *);
1551 v_pedwarn_with_decl (decl, s, ap)
1556 /* We don't want -pedantic-errors to cause the compilation to fail from
1557 "errors" in system header files. Sometimes fixincludes can't fix what's
1558 broken (eg: unsigned char bitfields - fixing it may change the alignment
1559 which will cause programs to mysteriously fail because the C library
1560 or kernel uses the original layout). There's no point in issuing a
1561 warning either, it's just unnecessary noise. */
1563 if (! DECL_IN_SYSTEM_HEADER (decl))
1565 if (flag_pedantic_errors)
1566 v_error_with_decl (decl, s, ap);
1568 v_warning_with_decl (decl, s, ap);
1573 pedwarn_with_decl VPROTO((tree decl, char *s, ...))
1584 decl = va_arg (ap, tree);
1585 s = va_arg (ap, char *);
1588 v_pedwarn_with_decl (decl, s, ap);
1593 v_pedwarn_with_file_and_line (file, line, s, ap)
1599 if (flag_pedantic_errors)
1600 v_error_with_file_and_line (file, line, s, ap);
1602 v_warning_with_file_and_line (file, line, s, ap);
1606 pedwarn_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1618 file = va_arg (ap, char *);
1619 line = va_arg (ap, int);
1620 s = va_arg (ap, char *);
1623 v_pedwarn_with_file_and_line (file, line, s, ap);
1627 /* Apologize for not implementing some feature. */
1636 fprintf (stderr, "%s:%d: ", input_filename, lineno);
1638 fprintf (stderr, "%s: ", progname);
1639 vmessage ("sorry, not implemented", s, ap);
1640 fputc ('\n', stderr);
1644 sorry VPROTO((char *s, ...))
1654 s = va_arg (ap, char *);
1661 /* Apologize for not implementing some feature, then quit. */
1664 v_really_sorry (s, ap)
1670 fprintf (stderr, "%s:%d: ", input_filename, lineno);
1672 fprintf (stderr, "%s: ", progname);
1673 vmessage ("sorry, not implemented", s, ap);
1674 fatal (" (fatal)\n");
1678 really_sorry VPROTO((char *s, ...))
1688 s = va_arg (ap, char *);
1691 v_really_sorry (s, ap);
1695 /* More 'friendly' abort that prints the line and file.
1696 config.h can #define abort fancy_abort if you like that sort of thing.
1698 I don't think this is actually a good idea.
1699 Other sorts of crashes will look a certain way.
1700 It is a good thing if crashes from calling abort look the same way.
1706 fatal ("internal gcc abort");
1709 /* This calls abort and is used to avoid problems when abort if a macro.
1710 It is used when we need to pass the address of abort. */
1718 /* When `malloc.c' is compiled with `rcheck' defined,
1719 it calls this function to report clobberage. */
1727 /* Same as `malloc' but report error if no memory available. */
1733 register char *value = (char *) malloc (size);
1735 fatal ("virtual memory exhausted");
1739 /* Same as `realloc' but report error if no memory available. */
1742 xrealloc (ptr, size)
1746 char *result = (char *) realloc (ptr, size);
1748 fatal ("virtual memory exhausted");
1752 /* Return the logarithm of X, base 2, considering X unsigned,
1753 if X is a power of 2. Otherwise, returns -1.
1755 This should be used via the `exact_log2' macro. */
1759 register unsigned HOST_WIDE_INT x;
1761 register int log = 0;
1762 /* Test for 0 or a power of 2. */
1763 if (x == 0 || x != (x & -x))
1765 while ((x >>= 1) != 0)
1770 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1771 If X is 0, return -1.
1773 This should be used via the floor_log2 macro. */
1777 register unsigned HOST_WIDE_INT x;
1779 register int log = -1;
1787 jmp_buf float_handler;
1789 /* Specify where to longjmp to when a floating arithmetic error happens.
1790 If HANDLER is 0, it means don't handle the errors any more. */
1793 set_float_handler (handler)
1796 float_handled = (handler != 0);
1798 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1801 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1802 error happens, pushing the previous specification into OLD_HANDLER.
1803 Return an indication of whether there was a previous handler in effect. */
1806 push_float_handler (handler, old_handler)
1807 jmp_buf handler, old_handler;
1809 int was_handled = float_handled;
1813 bcopy ((char *) float_handler, (char *) old_handler,
1814 sizeof (float_handler));
1816 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1820 /* Restore the previous specification of whether and where to longjmp to
1821 when a floating arithmetic error happens. */
1824 pop_float_handler (handled, handler)
1828 float_handled = handled;
1830 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1833 /* Signals actually come here. */
1836 float_signal (signo)
1837 /* If this is missing, some compilers complain. */
1840 if (float_handled == 0)
1842 #if defined (USG) || defined (hpux)
1843 signal (SIGFPE, float_signal); /* re-enable the signal catcher */
1846 signal (SIGFPE, float_signal);
1847 longjmp (float_handler, 1);
1850 /* Handler for SIGPIPE. */
1854 /* If this is missing, some compilers complain. */
1857 fatal ("output pipe has been closed");
1860 /* Strip off a legitimate source ending from the input string NAME of
1861 length LEN. Rather than having to know the names used by all of
1862 our front ends, we strip off an ending of a period followed by one,
1863 two, or three characters. */
1866 strip_off_ending (name, len)
1870 if (len > 2 && name[len - 2] == '.')
1871 name[len - 2] = '\0';
1872 else if (len > 3 && name[len - 3] == '.')
1873 name[len - 3] = '\0';
1874 else if (len > 4 && name[len - 4] == '.')
1875 name[len - 4] = '\0';
1878 /* Output a quoted string. */
1880 output_quoted_string (asm_file, string)
1886 putc ('\"', asm_file);
1887 while ((c = *string++) != 0)
1889 if (c == '\"' || c == '\\')
1890 putc ('\\', asm_file);
1893 putc ('\"', asm_file);
1896 /* Output a file name in the form wanted by System V. */
1899 output_file_directive (asm_file, input_name)
1903 int len = strlen (input_name);
1904 char *na = input_name + len;
1906 /* NA gets INPUT_NAME sans directory names. */
1907 while (na > input_name)
1914 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1915 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1917 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1918 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1920 fprintf (asm_file, "\t.file\t");
1921 output_quoted_string (asm_file, na);
1922 fputc ('\n', asm_file);
1927 /* Routine to build language identifier for object file. */
1929 output_lang_identify (asm_out_file)
1932 int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1933 char *s = (char *) alloca (len);
1934 sprintf (s, "__gnu_compiled_%s", lang_identify ());
1935 ASM_OUTPUT_LABEL (asm_out_file, s);
1938 /* Routine to open a dump file. */
1940 open_dump_file (base_name, suffix)
1945 char *dumpname = (char *) alloca (strlen (base_name) + strlen (suffix) + 1);
1947 strcpy (dumpname, base_name);
1948 strcat (dumpname, suffix);
1949 f = fopen (dumpname, "w");
1951 pfatal_with_name (dumpname);
1955 /* Compile an entire file of output from cpp, named NAME.
1956 Write a file of assembly output and various debugging dumps. */
1965 int name_specified = name != 0;
1967 if (dump_base_name == 0)
1968 dump_base_name = name ? name : "gccdump";
1972 integration_time = 0;
1980 local_alloc_time = 0;
1981 global_alloc_time = 0;
1984 shorten_branch_time = 0;
1990 /* Open input file. */
1992 if (name == 0 || !strcmp (name, "-"))
1998 finput = fopen (name, "r");
2000 pfatal_with_name (name);
2002 #ifdef IO_BUFFER_SIZE
2003 setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
2006 /* Initialize data in various passes. */
2011 /* Some of these really don't need to be called when generating bytecode,
2012 but the options would have to be parsed first to know that. -bson */
2014 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
2015 || debug_info_level == DINFO_LEVEL_VERBOSE);
2017 init_decl_processing ();
2025 if (flag_caller_saves)
2026 init_caller_save ();
2028 /* If auxiliary info generation is desired, open the output file.
2029 This goes in the same directory as the source file--unlike
2030 all the other output files. */
2031 if (flag_gen_aux_info)
2033 aux_info_file = fopen (aux_info_file_name, "w");
2034 if (aux_info_file == 0)
2035 pfatal_with_name (aux_info_file_name);
2038 /* If rtl dump desired, open the output file. */
2040 rtl_dump_file = open_dump_file (dump_base_name, ".rtl");
2042 /* If jump_opt dump desired, open the output file. */
2044 jump_opt_dump_file = open_dump_file (dump_base_name, ".jump");
2046 /* If cse dump desired, open the output file. */
2048 cse_dump_file = open_dump_file (dump_base_name, ".cse");
2050 /* If loop dump desired, open the output file. */
2052 loop_dump_file = open_dump_file (dump_base_name, ".loop");
2054 /* If cse2 dump desired, open the output file. */
2056 cse2_dump_file = open_dump_file (dump_base_name, ".cse2");
2058 /* If flow dump desired, open the output file. */
2060 flow_dump_file = open_dump_file (dump_base_name, ".flow");
2062 /* If combine dump desired, open the output file. */
2064 combine_dump_file = open_dump_file (dump_base_name, ".combine");
2066 /* If scheduling dump desired, open the output file. */
2068 sched_dump_file = open_dump_file (dump_base_name, ".sched");
2070 /* If local_reg dump desired, open the output file. */
2072 local_reg_dump_file = open_dump_file (dump_base_name, ".lreg");
2074 /* If global_reg dump desired, open the output file. */
2075 if (global_reg_dump)
2076 global_reg_dump_file = open_dump_file (dump_base_name, ".greg");
2078 /* If 2nd scheduling dump desired, open the output file. */
2080 sched2_dump_file = open_dump_file (dump_base_name, ".sched2");
2082 /* If jump2_opt dump desired, open the output file. */
2084 jump2_opt_dump_file = open_dump_file (dump_base_name, ".jump2");
2086 /* If dbr_sched dump desired, open the output file. */
2088 dbr_sched_dump_file = open_dump_file (dump_base_name, ".dbr");
2092 /* If stack_reg dump desired, open the output file. */
2094 stack_reg_dump_file = open_dump_file (dump_base_name, ".stack");
2098 /* Open assembler code output file. */
2100 if (! name_specified && asm_file_name == 0)
2101 asm_out_file = stdout;
2104 int len = strlen (dump_base_name);
2105 register char *dumpname = (char *) xmalloc (len + 6);
2106 strcpy (dumpname, dump_base_name);
2107 strip_off_ending (dumpname, len);
2108 strcat (dumpname, ".s");
2109 if (asm_file_name == 0)
2111 asm_file_name = (char *) xmalloc (strlen (dumpname) + 1);
2112 strcpy (asm_file_name, dumpname);
2114 if (!strcmp (asm_file_name, "-"))
2115 asm_out_file = stdout;
2117 asm_out_file = fopen (asm_file_name, "w");
2118 if (asm_out_file == 0)
2119 pfatal_with_name (asm_file_name);
2122 #ifdef IO_BUFFER_SIZE
2123 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
2124 _IOFBF, IO_BUFFER_SIZE);
2127 input_filename = name;
2129 /* Put an entry on the input file stack for the main input file. */
2131 = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2132 input_file_stack->next = 0;
2133 input_file_stack->name = input_filename;
2135 /* Perform language-specific initialization.
2136 This may set main_input_filename. */
2139 /* If the input doesn't start with a #line, use the input name
2140 as the official input file name. */
2141 if (main_input_filename == 0)
2142 main_input_filename = name;
2144 if (!output_bytecode)
2146 ASM_FILE_START (asm_out_file);
2149 /* Output something to inform GDB that this compilation was by GCC. Also
2150 serves to tell GDB file consists of bytecodes. */
2151 if (output_bytecode)
2152 fprintf (asm_out_file, "bc_gcc2_compiled.:\n");
2155 #ifndef ASM_IDENTIFY_GCC
2156 fprintf (asm_out_file, "gcc2_compiled.:\n");
2158 ASM_IDENTIFY_GCC (asm_out_file);
2162 /* Output something to identify which front-end produced this file. */
2163 #ifdef ASM_IDENTIFY_LANGUAGE
2164 ASM_IDENTIFY_LANGUAGE (asm_out_file);
2167 if (output_bytecode)
2169 if (profile_flag || profile_block_flag)
2170 error ("profiling not supported in bytecode compilation");
2174 /* ??? Note: There used to be a conditional here
2175 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2176 This was to guarantee separation between gcc_compiled. and
2177 the first function, for the sake of dbx on Suns.
2178 However, having the extra zero here confused the Emacs
2179 code for unexec, and might confuse other programs too.
2180 Therefore, I took out that change.
2181 In future versions we should find another way to solve
2182 that dbx problem. -- rms, 23 May 93. */
2184 /* Don't let the first function fall at the same address
2185 as gcc_compiled., if profiling. */
2186 if (profile_flag || profile_block_flag)
2187 assemble_zeros (UNITS_PER_WORD);
2190 /* If dbx symbol table desired, initialize writing it
2191 and output the predefined types. */
2192 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2193 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2194 TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
2197 #ifdef SDB_DEBUGGING_INFO
2198 if (write_symbols == SDB_DEBUG)
2199 TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
2202 #ifdef DWARF_DEBUGGING_INFO
2203 if (write_symbols == DWARF_DEBUG)
2204 TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
2207 /* Initialize yet another pass. */
2209 if (!output_bytecode)
2210 init_final (main_input_filename);
2212 start_time = get_run_time ();
2214 /* Call the parser, which parses the entire file
2215 (calling rest_of_compilation for each function). */
2217 if (yyparse () != 0)
2219 if (errorcount == 0)
2220 fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
2222 /* In case there were missing closebraces,
2223 get us back to the global binding level. */
2224 while (! global_bindings_p ())
2228 /* Compilation is now finished except for writing
2229 what's left of the symbol table output. */
2231 parse_time += get_run_time () - start_time;
2233 parse_time -= integration_time;
2234 parse_time -= varconst_time;
2236 globals = getdecls ();
2238 /* Really define vars that have had only a tentative definition.
2239 Really output inline functions that must actually be callable
2240 and have not been output so far. */
2243 int len = list_length (globals);
2244 tree *vec = (tree *) alloca (sizeof (tree) * len);
2249 /* Process the decls in reverse order--earliest first.
2250 Put them into VEC from back to front, then take out from front. */
2252 for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
2253 vec[len - i - 1] = decl;
2255 for (i = 0; i < len; i++)
2259 /* We're not deferring this any longer. */
2260 DECL_DEFER_OUTPUT (decl) = 0;
2262 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
2263 && incomplete_decl_finalize_hook != 0)
2264 (*incomplete_decl_finalize_hook) (decl);
2267 /* Now emit any global variables or functions that we have been putting
2268 off. We need to loop in case one of the things emitted here
2269 references another one which comes earlier in the list. */
2273 for (i = 0; i < len; i++)
2277 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
2280 /* Don't write out static consts, unless we still need them.
2282 We also keep static consts if not optimizing (for debugging).
2283 ??? They might be better written into the debug information.
2284 This is possible when using DWARF.
2286 A language processor that wants static constants to be always
2287 written out (even if it is not used) is responsible for
2288 calling rest_of_decl_compilation itself. E.g. the C front-end
2289 calls rest_of_decl_compilation from finish_decl.
2290 One motivation for this is that is conventional in some
2291 environments to write things like:
2292 static const char rcsid[] = "... version string ...";
2293 intending to force the string to be in the executable.
2295 A language processor that would prefer to have unneeded
2296 static constants "optimized away" would just defer writing
2297 them out until here. E.g. C++ does this, because static
2298 constants are often defined in header files.
2300 ??? A tempting alternative (for both C and C++) would be
2301 to force a constant to be written if and only if it is
2302 defined in a main file, as opposed to an include file. */
2304 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
2305 && (! TREE_READONLY (decl)
2306 || TREE_PUBLIC (decl)
2308 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
2311 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
2314 if (TREE_CODE (decl) == FUNCTION_DECL
2315 && DECL_INITIAL (decl) != 0
2316 && DECL_SAVED_INSNS (decl) != 0
2317 && (flag_keep_inline_functions
2318 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
2321 temporary_allocation ();
2322 output_inline_function (decl);
2323 permanent_allocation (1);
2328 for (i = 0; i < len; i++)
2332 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
2333 && ! TREE_ASM_WRITTEN (decl))
2334 /* Cancel the RTL for this decl so that, if debugging info
2335 output for global variables is still to come,
2336 this one will be omitted. */
2337 DECL_RTL (decl) = NULL;
2339 /* Warn about any function
2340 declared static but not defined.
2341 We don't warn about variables,
2342 because many programs have static variables
2343 that exist only to get some text into the object file. */
2344 if (TREE_CODE (decl) == FUNCTION_DECL
2346 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2347 && DECL_INITIAL (decl) == 0
2348 && DECL_EXTERNAL (decl)
2349 && ! TREE_PUBLIC (decl))
2351 pedwarn_with_decl (decl,
2352 "`%s' declared `static' but never defined");
2353 /* This symbol is effectively an "extern" declaration now. */
2354 TREE_PUBLIC (decl) = 1;
2355 assemble_external (decl);
2358 /* Warn about static fns or vars defined but not used,
2359 but not about inline functions or static consts
2360 since defining those in header files is normal practice. */
2362 && ((TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
2363 || (TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
2364 && ! DECL_IN_SYSTEM_HEADER (decl)
2365 && ! DECL_EXTERNAL (decl)
2366 && ! TREE_PUBLIC (decl)
2367 && ! TREE_USED (decl)
2368 && ! DECL_REGISTER (decl)
2369 /* The TREE_USED bit for file-scope decls
2370 is kept in the identifier, to handle multiple
2371 external decls in different scopes. */
2372 && ! TREE_USED (DECL_NAME (decl)))
2373 warning_with_decl (decl, "`%s' defined but not used");
2375 #ifdef SDB_DEBUGGING_INFO
2376 /* The COFF linker can move initialized global vars to the end.
2377 And that can screw up the symbol ordering.
2378 By putting the symbols in that order to begin with,
2379 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
2380 if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
2381 && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
2382 && ! DECL_EXTERNAL (decl)
2383 && DECL_RTL (decl) != 0)
2384 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
2386 /* Output COFF information for non-global
2387 file-scope initialized variables. */
2388 if (write_symbols == SDB_DEBUG
2389 && TREE_CODE (decl) == VAR_DECL
2390 && DECL_INITIAL (decl)
2391 && ! DECL_EXTERNAL (decl)
2392 && DECL_RTL (decl) != 0
2393 && GET_CODE (DECL_RTL (decl)) == MEM)
2394 TIMEVAR (symout_time, sdbout_toplevel_data (decl));
2395 #endif /* SDB_DEBUGGING_INFO */
2396 #ifdef DWARF_DEBUGGING_INFO
2397 /* Output DWARF information for file-scope tentative data object
2398 declarations, file-scope (extern) function declarations (which
2399 had no corresponding body) and file-scope tagged type declarations
2400 and definitions which have not yet been forced out. */
2402 if (write_symbols == DWARF_DEBUG
2403 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2404 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
2409 /* Write out any pending weak symbol declarations. */
2413 /* Do dbx symbols */
2414 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2415 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2416 TIMEVAR (symout_time,
2418 dbxout_finish (asm_out_file, main_input_filename);
2422 #ifdef DWARF_DEBUGGING_INFO
2423 if (write_symbols == DWARF_DEBUG)
2424 TIMEVAR (symout_time,
2430 /* Output some stuff at end of file if nec. */
2432 if (!output_bytecode)
2434 end_final (main_input_filename);
2437 ASM_FILE_END (asm_out_file);
2441 /* Language-specific end of compilation actions. */
2445 if (output_bytecode)
2446 bc_write_file (asm_out_file);
2448 /* Close the dump files. */
2450 if (flag_gen_aux_info)
2452 fclose (aux_info_file);
2454 unlink (aux_info_file_name);
2458 fclose (rtl_dump_file);
2461 fclose (jump_opt_dump_file);
2464 fclose (cse_dump_file);
2467 fclose (loop_dump_file);
2470 fclose (cse2_dump_file);
2473 fclose (flow_dump_file);
2477 dump_combine_total_stats (combine_dump_file);
2478 fclose (combine_dump_file);
2482 fclose (sched_dump_file);
2485 fclose (local_reg_dump_file);
2487 if (global_reg_dump)
2488 fclose (global_reg_dump_file);
2491 fclose (sched2_dump_file);
2494 fclose (jump2_opt_dump_file);
2497 fclose (dbr_sched_dump_file);
2501 fclose (stack_reg_dump_file);
2504 /* Close non-debugging input and output files. Take special care to note
2505 whether fclose returns an error, since the pages might still be on the
2506 buffer chain while the file is open. */
2509 if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
2510 fatal_io_error (asm_file_name);
2512 /* Print the times. */
2516 fprintf (stderr,"\n");
2517 print_time ("parse", parse_time);
2519 if (!output_bytecode)
2521 print_time ("integration", integration_time);
2522 print_time ("jump", jump_time);
2523 print_time ("cse", cse_time);
2524 print_time ("loop", loop_time);
2525 print_time ("cse2", cse2_time);
2526 print_time ("flow", flow_time);
2527 print_time ("combine", combine_time);
2528 print_time ("sched", sched_time);
2529 print_time ("local-alloc", local_alloc_time);
2530 print_time ("global-alloc", global_alloc_time);
2531 print_time ("sched2", sched2_time);
2532 print_time ("dbranch", dbr_sched_time);
2533 print_time ("shorten-branch", shorten_branch_time);
2534 print_time ("stack-reg", stack_reg_time);
2535 print_time ("final", final_time);
2536 print_time ("varconst", varconst_time);
2537 print_time ("symout", symout_time);
2538 print_time ("dump", dump_time);
2543 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2544 and TYPE_DECL nodes.
2546 This does nothing for local (non-static) variables.
2547 Otherwise, it sets up the RTL and outputs any assembler code
2548 (label definition, storage allocation and initialization).
2550 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2551 the assembler symbol name to be used. TOP_LEVEL is nonzero
2552 if this declaration is not within a function. */
2555 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2561 /* Declarations of variables, and of functions defined elsewhere. */
2563 /* The most obvious approach, to put an #ifndef around where
2564 this macro is used, doesn't work since it's inside a macro call. */
2565 #ifndef ASM_FINISH_DECLARE_OBJECT
2566 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2569 /* Forward declarations for nested functions are not "external",
2570 but we need to treat them as if they were. */
2571 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2572 || TREE_CODE (decl) == FUNCTION_DECL)
2573 TIMEVAR (varconst_time,
2575 make_decl_rtl (decl, asmspec, top_level);
2576 /* Initialized extern variable exists to be replaced
2577 with its value, or represents something that will be
2578 output in another file. */
2579 if (! (TREE_CODE (decl) == VAR_DECL
2580 && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
2581 && DECL_INITIAL (decl) != 0
2582 && DECL_INITIAL (decl) != error_mark_node))
2583 /* Don't output anything
2584 when a tentative file-scope definition is seen.
2585 But at end of compilation, do output code for them. */
2586 if (! (! at_end && top_level
2587 && (DECL_INITIAL (decl) == 0
2588 || DECL_INITIAL (decl) == error_mark_node)))
2589 assemble_variable (decl, top_level, at_end, 0);
2590 if (decl == last_assemble_variable_decl)
2592 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2596 else if (DECL_REGISTER (decl) && asmspec != 0)
2598 if (decode_reg_name (asmspec) >= 0)
2600 DECL_RTL (decl) = 0;
2601 make_decl_rtl (decl, asmspec, top_level);
2604 error ("invalid register name `%s' for register variable", asmspec);
2606 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2607 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2608 && TREE_CODE (decl) == TYPE_DECL)
2609 TIMEVAR (symout_time, dbxout_symbol (decl, 0));
2611 #ifdef SDB_DEBUGGING_INFO
2612 else if (write_symbols == SDB_DEBUG && top_level
2613 && TREE_CODE (decl) == TYPE_DECL)
2614 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
2618 /* Called after finishing a record, union or enumeral type. */
2621 rest_of_type_compilation (type, toplev)
2625 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2626 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2627 TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
2629 #ifdef SDB_DEBUGGING_INFO
2630 if (write_symbols == SDB_DEBUG)
2631 TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
2635 /* This is called from finish_function (within yyparse)
2636 after each top-level definition is parsed.
2637 It is supposed to compile that function or variable
2638 and output the assembler code for it.
2639 After we return, the tree storage is freed. */
2642 rest_of_compilation (decl)
2646 int start_time = get_run_time ();
2648 /* Nonzero if we have saved the original DECL_INITIAL of the function,
2649 to be restored after we finish compiling the function
2650 (for use when compiling inline calls to this function). */
2651 tree saved_block_tree = 0;
2652 /* Likewise, for DECL_ARGUMENTS. */
2653 tree saved_arguments = 0;
2656 if (output_bytecode)
2659 /* If we are reconsidering an inline function
2660 at the end of compilation, skip the stuff for making it inline. */
2662 if (DECL_SAVED_INSNS (decl) == 0)
2664 int specd = DECL_INLINE (decl);
2667 /* If requested, consider whether to make this function inline. */
2668 if (specd || flag_inline_functions)
2669 TIMEVAR (integration_time,
2671 lose = function_cannot_inline_p (decl);
2672 /* If not optimizing, then make sure the DECL_INLINE
2674 if (lose || ! optimize)
2676 if (warn_inline && specd)
2677 warning_with_decl (decl, lose);
2678 DECL_INLINE (decl) = 0;
2679 DECL_ABSTRACT_ORIGIN (decl) = 0;
2680 /* Don't really compile an extern inline function.
2681 If we can't make it inline, pretend
2682 it was only declared. */
2683 if (DECL_EXTERNAL (decl))
2685 DECL_INITIAL (decl) = 0;
2686 goto exit_rest_of_compilation;
2690 DECL_INLINE (decl) = 1;
2693 insns = get_insns ();
2695 /* Dump the rtl code if we are dumping rtl. */
2700 fprintf (rtl_dump_file, "\n;; Function %s\n\n",
2701 IDENTIFIER_POINTER (DECL_NAME (decl)));
2702 if (DECL_SAVED_INSNS (decl))
2703 fprintf (rtl_dump_file, ";; (integrable)\n\n");
2704 print_rtl (rtl_dump_file, insns);
2705 fflush (rtl_dump_file);
2708 /* If function is inline, and we don't yet know whether to
2709 compile it by itself, defer decision till end of compilation.
2710 finish_compilation will call rest_of_compilation again
2711 for those functions that need to be output. Also defer those
2712 functions that we are supposed to defer. */
2714 if (DECL_DEFER_OUTPUT (decl)
2715 || ((specd || DECL_INLINE (decl))
2716 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2717 && ! flag_keep_inline_functions)
2718 || DECL_EXTERNAL (decl))))
2720 DECL_DEFER_OUTPUT (decl) = 1;
2722 /* If -Wreturn-type, we have to do a bit of compilation. */
2723 if (! warn_return_type)
2725 #ifdef DWARF_DEBUGGING_INFO
2726 /* Generate the DWARF info for the "abstract" instance
2727 of a function which we may later generate inlined and/or
2728 out-of-line instances of. */
2729 if (write_symbols == DWARF_DEBUG)
2731 set_decl_abstract_flags (decl, 1);
2732 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
2733 set_decl_abstract_flags (decl, 0);
2736 TIMEVAR (integration_time, save_for_inline_nocopy (decl));
2737 goto exit_rest_of_compilation;
2741 /* If we have to compile the function now, save its rtl and subdecls
2742 so that its compilation will not affect what others get. */
2743 if (DECL_INLINE (decl) || DECL_DEFER_OUTPUT (decl))
2745 #ifdef DWARF_DEBUGGING_INFO
2746 /* Generate the DWARF info for the "abstract" instance of
2747 a function which we will generate an out-of-line instance
2748 of almost immediately (and which we may also later generate
2749 various inlined instances of). */
2750 if (write_symbols == DWARF_DEBUG)
2752 set_decl_abstract_flags (decl, 1);
2753 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
2754 set_decl_abstract_flags (decl, 0);
2757 saved_block_tree = DECL_INITIAL (decl);
2758 saved_arguments = DECL_ARGUMENTS (decl);
2759 TIMEVAR (integration_time, save_for_inline_copying (decl));
2762 /* If specified extern inline but we aren't inlining it, we are
2764 if (specd && DECL_EXTERNAL (decl))
2765 goto exit_rest_of_compilation;
2768 if (! DECL_DEFER_OUTPUT (decl))
2769 TREE_ASM_WRITTEN (decl) = 1;
2771 /* Now that integrate will no longer see our rtl, we need not distinguish
2772 between the return value of this function and the return value of called
2774 rtx_equal_function_value_matters = 0;
2776 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
2777 if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
2779 goto exit_rest_of_compilation;
2782 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
2783 Note that that may have been done above, in save_for_inline_copying.
2784 The call to resume_temporary_allocation near the end of this function
2785 goes back to the usual state of affairs. */
2787 rtl_in_current_obstack ();
2790 /* If we are doing position-independent code generation, now
2791 is the time to output special prologues and epilogues.
2792 We do not want to do this earlier, because it just clutters
2793 up inline functions with meaningless insns. */
2798 insns = get_insns ();
2800 /* Copy any shared structure that should not be shared. */
2802 unshare_all_rtl (insns);
2804 /* Instantiate all virtual registers. */
2806 instantiate_virtual_regs (current_function_decl, get_insns ());
2808 /* See if we have allocated stack slots that are not directly addressable.
2809 If so, scan all the insns and create explicit address computation
2810 for all references to such slots. */
2811 /* fixup_stack_slots (); */
2813 /* Do jump optimization the first time, if -opt.
2814 Also do it if -W, but in that case it doesn't change the rtl code,
2815 it only computes whether control can drop off the end of the function. */
2817 if (optimize > 0 || extra_warnings || warn_return_type
2818 /* If function is `noreturn', we should warn if it tries to return. */
2819 || TREE_THIS_VOLATILE (decl))
2821 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
2822 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
2825 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
2826 if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
2827 goto exit_rest_of_compilation;
2829 /* Dump rtl code after jump, if we are doing that. */
2834 fprintf (jump_opt_dump_file, "\n;; Function %s\n\n",
2835 IDENTIFIER_POINTER (DECL_NAME (decl)));
2836 print_rtl (jump_opt_dump_file, insns);
2837 fflush (jump_opt_dump_file);
2840 /* Perform common subexpression elimination.
2841 Nonzero value from `cse_main' means that jumps were simplified
2842 and some code may now be unreachable, so do
2843 jump optimization again. */
2848 fprintf (cse_dump_file, "\n;; Function %s\n\n",
2849 IDENTIFIER_POINTER (DECL_NAME (decl)));
2854 TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
2856 if (flag_thread_jumps)
2857 /* Hacks by tiemann & kenner. */
2858 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 1));
2860 TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
2862 TIMEVAR (cse_time, delete_dead_from_cse (insns, max_reg_num ()));
2864 if (tem || optimize > 1)
2865 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
2868 /* Dump rtl code after cse, if we are doing that. */
2873 print_rtl (cse_dump_file, insns);
2874 fflush (cse_dump_file);
2880 fprintf (loop_dump_file, "\n;; Function %s\n\n",
2881 IDENTIFIER_POINTER (DECL_NAME (decl)));
2884 /* Move constant computations out of loops. */
2890 loop_optimize (insns, loop_dump_file);
2894 /* Dump rtl code after loop opt, if we are doing that. */
2899 print_rtl (loop_dump_file, insns);
2900 fflush (loop_dump_file);
2906 fprintf (cse2_dump_file, "\n;; Function %s\n\n",
2907 IDENTIFIER_POINTER (DECL_NAME (decl)));
2910 if (optimize > 0 && flag_rerun_cse_after_loop)
2912 /* Running another jump optimization pass before the second
2913 cse pass sometimes simplifies the RTL enough to allow
2914 the second CSE pass to do a better job. Jump_optimize can change
2915 max_reg_num so we must rerun reg_scan afterwards.
2916 ??? Rework to not call reg_scan so often. */
2917 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
2918 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
2920 TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
2921 TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
2922 1, cse2_dump_file));
2924 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
2927 if (optimize > 0 && flag_thread_jumps)
2928 /* This pass of jump threading straightens out code
2929 that was kinked by loop optimization. */
2930 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
2932 /* Dump rtl code after cse, if we are doing that. */
2937 print_rtl (cse2_dump_file, insns);
2938 fflush (cse2_dump_file);
2941 /* We are no longer anticipating cse in this function, at least. */
2943 cse_not_expected = 1;
2945 /* Now we choose between stupid (pcc-like) register allocation
2946 (if we got the -noreg switch and not -opt)
2947 and smart register allocation. */
2949 if (optimize > 0) /* Stupid allocation probably won't work */
2950 obey_regdecls = 0; /* if optimizations being done. */
2954 /* Print function header into flow dump now
2955 because doing the flow analysis makes some of the dump. */
2960 fprintf (flow_dump_file, "\n;; Function %s\n\n",
2961 IDENTIFIER_POINTER (DECL_NAME (decl)));
2968 regclass (insns, max_reg_num ());
2969 stupid_life_analysis (insns, max_reg_num (),
2975 /* Do control and data flow analysis,
2976 and write some of the results to dump file. */
2978 TIMEVAR (flow_time, flow_analysis (insns, max_reg_num (),
2980 if (warn_uninitialized)
2982 uninitialized_vars_warning (DECL_INITIAL (decl));
2983 setjmp_args_warning ();
2987 /* Dump rtl after flow analysis. */
2992 print_rtl (flow_dump_file, insns);
2993 fflush (flow_dump_file);
2996 /* If -opt, try combining insns through substitution. */
2999 TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
3001 /* Dump rtl code after insn combination. */
3006 fprintf (combine_dump_file, "\n;; Function %s\n\n",
3007 IDENTIFIER_POINTER (DECL_NAME (decl)));
3008 dump_combine_stats (combine_dump_file);
3009 print_rtl (combine_dump_file, insns);
3010 fflush (combine_dump_file);
3013 /* Print function header into sched dump now
3014 because doing the sched analysis makes some of the dump. */
3019 fprintf (sched_dump_file, "\n;; Function %s\n\n",
3020 IDENTIFIER_POINTER (DECL_NAME (decl)));
3023 if (optimize > 0 && flag_schedule_insns)
3025 /* Do control and data sched analysis,
3026 and write some of the results to dump file. */
3028 TIMEVAR (sched_time, schedule_insns (sched_dump_file));
3031 /* Dump rtl after instruction scheduling. */
3036 print_rtl (sched_dump_file, insns);
3037 fflush (sched_dump_file);
3040 /* Unless we did stupid register allocation,
3041 allocate pseudo-regs that are used only within 1 basic block. */
3044 TIMEVAR (local_alloc_time,
3046 regclass (insns, max_reg_num ());
3050 /* Dump rtl code after allocating regs within basic blocks. */
3055 fprintf (local_reg_dump_file, "\n;; Function %s\n\n",
3056 IDENTIFIER_POINTER (DECL_NAME (decl)));
3057 dump_flow_info (local_reg_dump_file);
3058 dump_local_alloc (local_reg_dump_file);
3059 print_rtl (local_reg_dump_file, insns);
3060 fflush (local_reg_dump_file);
3063 if (global_reg_dump)
3065 fprintf (global_reg_dump_file, "\n;; Function %s\n\n",
3066 IDENTIFIER_POINTER (DECL_NAME (decl))));
3068 /* Unless we did stupid register allocation,
3069 allocate remaining pseudo-regs, then do the reload pass
3070 fixing up any insns that are invalid. */
3072 TIMEVAR (global_alloc_time,
3075 failure = global_alloc (global_reg_dump_file);
3077 failure = reload (insns, 0, global_reg_dump_file);
3080 if (global_reg_dump)
3083 dump_global_regs (global_reg_dump_file);
3084 print_rtl (global_reg_dump_file, insns);
3085 fflush (global_reg_dump_file);
3089 goto exit_rest_of_compilation;
3091 reload_completed = 1;
3093 /* On some machines, the prologue and epilogue code, or parts thereof,
3094 can be represented as RTL. Doing so lets us schedule insns between
3095 it and the rest of the code and also allows delayed branch
3096 scheduling to operate in the epilogue. */
3098 thread_prologue_and_epilogue_insns (insns);
3100 if (optimize > 0 && flag_schedule_insns_after_reload)
3105 fprintf (sched2_dump_file, "\n;; Function %s\n\n",
3106 IDENTIFIER_POINTER (DECL_NAME (decl)));
3109 /* Do control and data sched analysis again,
3110 and write some more of the results to dump file. */
3112 TIMEVAR (sched2_time, schedule_insns (sched2_dump_file));
3114 /* Dump rtl after post-reorder instruction scheduling. */
3119 print_rtl (sched2_dump_file, insns);
3120 fflush (sched2_dump_file);
3124 #ifdef LEAF_REGISTERS
3126 if (optimize > 0 && only_leaf_regs_used () && leaf_function_p ())
3130 /* One more attempt to remove jumps to .+1
3131 left by dead-store-elimination.
3132 Also do cross-jumping this time
3133 and delete no-op move insns. */
3137 TIMEVAR (jump_time, jump_optimize (insns, 1, 1, 0));
3140 /* Dump rtl code after jump, if we are doing that. */
3145 fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n",
3146 IDENTIFIER_POINTER (DECL_NAME (decl)));
3147 print_rtl (jump2_opt_dump_file, insns);
3148 fflush (jump2_opt_dump_file);
3151 /* If a machine dependent reorganization is needed, call it. */
3152 #ifdef MACHINE_DEPENDENT_REORG
3153 MACHINE_DEPENDENT_REORG (insns);
3156 /* If a scheduling pass for delayed branches is to be done,
3157 call the scheduling code. */
3160 if (optimize > 0 && flag_delayed_branch)
3162 TIMEVAR (dbr_sched_time, dbr_schedule (insns, dbr_sched_dump_file));
3167 fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n",
3168 IDENTIFIER_POINTER (DECL_NAME (decl)));
3169 print_rtl (dbr_sched_dump_file, insns);
3170 fflush (dbr_sched_dump_file);
3176 /* Shorten branches. */
3177 TIMEVAR (shorten_branch_time,
3179 shorten_branches (get_insns ());
3183 TIMEVAR (stack_reg_time, reg_to_stack (insns, stack_reg_dump_file));
3188 fprintf (stack_reg_dump_file, "\n;; Function %s\n\n",
3189 IDENTIFIER_POINTER (DECL_NAME (decl)));
3190 print_rtl (stack_reg_dump_file, insns);
3191 fflush (stack_reg_dump_file);
3196 /* Now turn the rtl into assembler code. */
3198 TIMEVAR (final_time,
3203 /* Get the function's name, as described by its RTL.
3204 This may be different from the DECL_NAME name used
3205 in the source file. */
3207 x = DECL_RTL (decl);
3208 if (GET_CODE (x) != MEM)
3211 if (GET_CODE (x) != SYMBOL_REF)
3213 fnname = XSTR (x, 0);
3215 assemble_start_function (decl, fnname);
3216 final_start_function (insns, asm_out_file, optimize);
3217 final (insns, asm_out_file, optimize, 0);
3218 final_end_function (insns, asm_out_file, optimize);
3219 assemble_end_function (decl, fnname);
3220 fflush (asm_out_file);
3223 /* Write DBX symbols if requested */
3225 /* Note that for those inline functions where we don't initially
3226 know for certain that we will be generating an out-of-line copy,
3227 the first invocation of this routine (rest_of_compilation) will
3228 skip over this code by doing a `goto exit_rest_of_compilation;'.
3229 Later on, finish_compilation will call rest_of_compilation again
3230 for those inline functions that need to have out-of-line copies
3231 generated. During that call, we *will* be routed past here. */
3233 #ifdef DBX_DEBUGGING_INFO
3234 if (write_symbols == DBX_DEBUG)
3235 TIMEVAR (symout_time, dbxout_function (decl));
3238 #ifdef DWARF_DEBUGGING_INFO
3239 if (write_symbols == DWARF_DEBUG)
3240 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
3243 exit_rest_of_compilation:
3245 /* In case the function was not output,
3246 don't leave any temporary anonymous types
3247 queued up for sdb output. */
3248 #ifdef SDB_DEBUGGING_INFO
3249 if (write_symbols == SDB_DEBUG)
3250 sdbout_types (NULL_TREE);
3253 /* Put back the tree of subblocks and list of arguments
3254 from before we copied them.
3255 Code generation and the output of debugging info may have modified
3256 the copy, but the original is unchanged. */
3258 if (saved_block_tree != 0)
3259 DECL_INITIAL (decl) = saved_block_tree;
3260 if (saved_arguments != 0)
3261 DECL_ARGUMENTS (decl) = saved_arguments;
3263 reload_completed = 0;
3265 /* Clear out the real_constant_chain before some of the rtx's
3266 it runs through become garbage. */
3268 clear_const_double_mem ();
3270 /* Cancel the effect of rtl_in_current_obstack. */
3272 resume_temporary_allocation ();
3274 /* The parsing time is all the time spent in yyparse
3275 *except* what is spent in this function. */
3277 parse_time -= get_run_time () - start_time;
3280 /* Entry point of cc1/c++. Decode command args, then call compile_file.
3281 Exit code is 35 if can't open files, 34 if fatal error,
3282 33 if had nonfatal errors, else success. */
3285 main (argc, argv, envp)
3292 int flag_print_mem = 0;
3293 int version_flag = 0;
3296 /* save in case md file wants to emit args as a comment. */
3300 p = argv[0] + strlen (argv[0]);
3301 while (p != argv[0] && p[-1] != '/'
3302 #ifdef DIR_SEPARATOR
3303 && p[-1] != DIR_SEPARATOR
3310 /* Get rid of any avoidable limit on stack size. */
3314 /* Set the stack limit huge so that alloca does not fail. */
3315 getrlimit (RLIMIT_STACK, &rlim);
3316 rlim.rlim_cur = rlim.rlim_max;
3317 setrlimit (RLIMIT_STACK, &rlim);
3319 #endif /* RLIMIT_STACK */
3321 signal (SIGFPE, float_signal);
3324 signal (SIGPIPE, pipe_closed);
3327 decl_printable_name = decl_name;
3328 lang_expand_expr = (struct rtx_def *(*)()) do_abort;
3329 interim_eh_hook = interim_eh;
3331 /* Initialize whether `char' is signed. */
3332 flag_signed_char = DEFAULT_SIGNED_CHAR;
3333 #ifdef DEFAULT_SHORT_ENUMS
3334 /* Initialize how much space enums occupy, by default. */
3335 flag_short_enums = DEFAULT_SHORT_ENUMS;
3338 /* Scan to see what optimization level has been specified. That will
3339 determine the default value of many flags. */
3340 for (i = 1; i < argc; i++)
3342 if (!strcmp (argv[i], "-O"))
3346 else if (argv[i][0] == '-' && argv[i][1] == 'O')
3348 /* Handle -O2, -O3, -O69, ... */
3349 char *p = &argv[i][2];
3353 if (! (c >= '0' && c <= '9'))
3356 optimize = atoi (&argv[i][2]);
3360 obey_regdecls = (optimize == 0);
3370 flag_thread_jumps = 1;
3372 flag_delayed_branch = 1;
3374 #ifdef CAN_DEBUG_WITHOUT_FP
3375 flag_omit_frame_pointer = 1;
3381 flag_cse_follow_jumps = 1;
3382 flag_cse_skip_blocks = 1;
3383 flag_expensive_optimizations = 1;
3384 flag_strength_reduce = 1;
3385 flag_rerun_cse_after_loop = 1;
3386 flag_caller_saves = 1;
3388 #ifdef INSN_SCHEDULING
3389 flag_schedule_insns = 1;
3390 flag_schedule_insns_after_reload = 1;
3396 flag_inline_functions = 1;
3399 #ifdef OPTIMIZATION_OPTIONS
3400 /* Allow default optimizations to be specified on a per-machine basis. */
3401 OPTIMIZATION_OPTIONS (optimize);
3404 /* Initialize register usage now so switches may override. */
3408 set_target_switch ("");
3410 for (i = 1; i < argc; i++)
3413 /* If this is a language-specific option,
3414 decode it in a language-specific way. */
3415 for (j = 0; lang_options[j] != 0; j++)
3416 if (!strncmp (argv[i], lang_options[j],
3417 strlen (lang_options[j])))
3419 if (lang_options[j] != 0)
3420 /* If the option is valid for *some* language,
3421 treat it as valid even if this language doesn't understand it. */
3422 lang_decode_option (argv[i]);
3423 else if (argv[i][0] == '-' && argv[i][1] != 0)
3425 register char *str = argv[i] + 1;
3430 set_target_switch (&str[1]);
3431 else if (!strcmp (str, "dumpbase"))
3433 dump_base_name = argv[++i];
3435 else if (str[0] == 'd')
3437 register char *p = &str[1];
3445 global_reg_dump = 1;
3451 cse_dump = 1, cse2_dump = 1;
3469 global_reg_dump = 1;
3487 flag_print_asm_name = 1;
3509 rtl_dump_and_exit = 1;
3513 else if (str[0] == 'f')
3515 register char *p = &str[1];
3518 /* Some kind of -f option.
3519 P's value is the option sans `-f'.
3520 Search for it in the table of options. */
3523 !found && j < sizeof (f_options) / sizeof (f_options[0]);
3526 if (!strcmp (p, f_options[j].string))
3528 *f_options[j].variable = f_options[j].on_value;
3529 /* A goto here would be cleaner,
3530 but breaks the vax pcc. */
3533 if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
3534 && ! strcmp (p+3, f_options[j].string))
3536 *f_options[j].variable = ! f_options[j].on_value;
3543 else if (!strncmp (p, "fixed-", 6))
3544 fix_register (&p[6], 1, 1);
3545 else if (!strncmp (p, "call-used-", 10))
3546 fix_register (&p[10], 0, 1);
3547 else if (!strncmp (p, "call-saved-", 11))
3548 fix_register (&p[11], 0, 0);
3550 error ("Invalid option `%s'", argv[i]);
3552 else if (str[0] == 'O')
3554 register char *p = str+1;
3555 while (*p && *p >= '0' && *p <= '9')
3560 error ("Invalid option `%s'", argv[i]);
3562 else if (!strcmp (str, "pedantic"))
3564 else if (!strcmp (str, "pedantic-errors"))
3565 flag_pedantic_errors = pedantic = 1;
3566 else if (!strcmp (str, "quiet"))
3568 else if (!strcmp (str, "version"))
3570 else if (!strcmp (str, "w"))
3571 inhibit_warnings = 1;
3572 else if (!strcmp (str, "W"))
3575 /* We save the value of warn_uninitialized, since if they put
3576 -Wuninitialized on the command line, we need to generate a
3577 warning about not using it without also specifying -O. */
3578 if (warn_uninitialized != 1)
3579 warn_uninitialized = 2;
3581 else if (str[0] == 'W')
3583 register char *p = &str[1];
3586 /* Some kind of -W option.
3587 P's value is the option sans `-W'.
3588 Search for it in the table of options. */
3591 !found && j < sizeof (W_options) / sizeof (W_options[0]);
3594 if (!strcmp (p, W_options[j].string))
3596 *W_options[j].variable = W_options[j].on_value;
3597 /* A goto here would be cleaner,
3598 but breaks the vax pcc. */
3601 if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
3602 && ! strcmp (p+3, W_options[j].string))
3604 *W_options[j].variable = ! W_options[j].on_value;
3611 else if (!strncmp (p, "id-clash-", 9))
3617 if (*endp >= '0' && *endp <= '9')
3621 error ("Invalid option `%s'", argv[i]);
3626 id_clash_len = atoi (str + 10);
3629 else if (!strncmp (p, "larger-than-", 12))
3631 char *endp = p + 12;
3635 if (*endp >= '0' && *endp <= '9')
3639 error ("Invalid option `%s'", argv[i]);
3640 goto larger_than_lose;
3643 warn_larger_than = 1;
3644 larger_than_size = atoi (str + 13);
3648 error ("Invalid option `%s'", argv[i]);
3650 else if (!strcmp (str, "p"))
3652 if (!output_bytecode)
3655 error ("profiling not supported in bytecode compilation");
3657 else if (!strcmp (str, "a"))
3659 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
3660 warning ("`-a' option (basic block profile) not supported");
3662 profile_block_flag = 1;
3665 else if (str[0] == 'g')
3672 while (*p && (*p < '0' || *p > '9'))
3676 while (*q && (*q >= '0' && *q <= '9'))
3681 level = 2; /* default debugging info level */
3682 if (*q || level > 3)
3684 warning ("invalid debug level specification in option: `-%s'",
3686 warning ("no debugging information will be generated");
3690 /* If more than one debugging type is supported,
3691 you must define PREFERRED_DEBUGGING_TYPE
3692 to choose a format in a system-dependent way. */
3693 /* This is one long line cause VAXC can't handle a \-newline. */
3694 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
3695 #ifdef PREFERRED_DEBUGGING_TYPE
3696 if (!strncmp (str, "ggdb", len))
3697 write_symbols = PREFERRED_DEBUGGING_TYPE;
3698 #else /* no PREFERRED_DEBUGGING_TYPE */
3699 You Lose! You must define PREFERRED_DEBUGGING_TYPE!
3700 #endif /* no PREFERRED_DEBUGGING_TYPE */
3701 #endif /* More than one debugger format enabled. */
3702 #ifdef DBX_DEBUGGING_INFO
3703 if (write_symbols != NO_DEBUG)
3705 else if (!strncmp (str, "ggdb", len))
3706 write_symbols = DBX_DEBUG;
3707 else if (!strncmp (str, "gstabs", len))
3708 write_symbols = DBX_DEBUG;
3709 else if (!strncmp (str, "gstabs+", len))
3710 write_symbols = DBX_DEBUG;
3712 /* Always enable extensions for -ggdb or -gstabs+,
3713 always disable for -gstabs.
3714 For plain -g, use system-specific default. */
3715 if (write_symbols == DBX_DEBUG && !strncmp (str, "ggdb", len)
3717 use_gnu_debug_info_extensions = 1;
3718 else if (write_symbols == DBX_DEBUG && !strncmp (str, "gstabs+", len)
3720 use_gnu_debug_info_extensions = 1;
3721 else if (write_symbols == DBX_DEBUG
3722 && !strncmp (str, "gstabs", len) && len >= 2)
3723 use_gnu_debug_info_extensions = 0;
3725 use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
3726 #endif /* DBX_DEBUGGING_INFO */
3727 #ifdef DWARF_DEBUGGING_INFO
3728 if (write_symbols != NO_DEBUG)
3730 else if (!strncmp (str, "g", len))
3731 write_symbols = DWARF_DEBUG;
3732 else if (!strncmp (str, "ggdb", len))
3733 write_symbols = DWARF_DEBUG;
3734 else if (!strncmp (str, "gdwarf", len))
3735 write_symbols = DWARF_DEBUG;
3737 /* Always enable extensions for -ggdb or -gdwarf+,
3738 always disable for -gdwarf.
3739 For plain -g, use system-specific default. */
3740 if (write_symbols == DWARF_DEBUG && !strncmp (str, "ggdb", len)
3742 use_gnu_debug_info_extensions = 1;
3743 else if (write_symbols == DWARF_DEBUG && !strcmp (str, "gdwarf+"))
3744 use_gnu_debug_info_extensions = 1;
3745 else if (write_symbols == DWARF_DEBUG
3746 && !strncmp (str, "gdwarf", len) && len >= 2)
3747 use_gnu_debug_info_extensions = 0;
3749 use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
3751 #ifdef SDB_DEBUGGING_INFO
3752 if (write_symbols != NO_DEBUG)
3754 else if (!strncmp (str, "g", len))
3755 write_symbols = SDB_DEBUG;
3756 else if (!strncmp (str, "gdb", len))
3757 write_symbols = SDB_DEBUG;
3758 else if (!strncmp (str, "gcoff", len))
3759 write_symbols = SDB_DEBUG;
3760 #endif /* SDB_DEBUGGING_INFO */
3761 #ifdef XCOFF_DEBUGGING_INFO
3762 if (write_symbols != NO_DEBUG)
3764 else if (!strncmp (str, "g", len))
3765 write_symbols = XCOFF_DEBUG;
3766 else if (!strncmp (str, "ggdb", len))
3767 write_symbols = XCOFF_DEBUG;
3768 else if (!strncmp (str, "gxcoff", len))
3769 write_symbols = XCOFF_DEBUG;
3771 /* Always enable extensions for -ggdb or -gxcoff+,
3772 always disable for -gxcoff.
3773 For plain -g, use system-specific default. */
3774 if (write_symbols == XCOFF_DEBUG && !strncmp (str, "ggdb", len)
3776 use_gnu_debug_info_extensions = 1;
3777 else if (write_symbols == XCOFF_DEBUG && !strcmp (str, "gxcoff+"))
3778 use_gnu_debug_info_extensions = 1;
3779 else if (write_symbols == XCOFF_DEBUG
3780 && !strncmp (str, "gxcoff", len) && len >= 2)
3781 use_gnu_debug_info_extensions = 0;
3783 use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
3785 if (write_symbols == NO_DEBUG)
3786 warning ("`-%s' not supported by this configuration of GCC",
3788 else if (level == 0)
3789 write_symbols = NO_DEBUG;
3791 debug_info_level = (enum debug_info_level) level;
3793 else if (!strcmp (str, "o"))
3795 asm_file_name = argv[++i];
3797 else if (str[0] == 'G')
3799 g_switch_set = TRUE;
3800 g_switch_value = atoi ((str[1] != '\0') ? str+1 : argv[++i]);
3802 else if (!strncmp (str, "aux-info", 8))
3804 flag_gen_aux_info = 1;
3805 aux_info_file_name = (str[8] != '\0' ? str+8 : argv[++i]);
3808 error ("Invalid option `%s'", argv[i]);
3810 else if (argv[i][0] == '+')
3811 error ("Invalid option `%s'", argv[i]);
3816 /* Initialize for bytecode output. A good idea to do this as soon as
3817 possible after the "-f" options have been parsed. */
3818 if (output_bytecode)
3820 #ifndef TARGET_SUPPORTS_BYTECODE
3821 /* Just die with a fatal error if not supported */
3822 fatal ("-fbytecode not supporter for this target");
3830 /* Inlining does not work if not optimizing,
3831 so force it not to be done. */
3835 /* The c_decode_option and lang_decode_option functions set
3836 this to `2' if -Wall is used, so we can avoid giving out
3837 lots of errors for people who don't realize what -Wall does. */
3838 if (warn_uninitialized == 1)
3839 warning ("-Wuninitialized is not supported without -O");
3842 #if defined(DWARF_DEBUGGING_INFO)
3843 if (write_symbols == DWARF_DEBUG
3844 && strcmp (language_string, "GNU C++") == 0)
3846 warning ("-g option not supported for C++ on systems using the DWARF debugging format");
3847 write_symbols = NO_DEBUG;
3849 #endif /* defined(DWARF_DEBUGGING_INFO) */
3851 #ifdef OVERRIDE_OPTIONS
3852 /* Some machines may reject certain combinations of options. */
3856 /* Unrolling all loops implies that standard loop unrolling must also
3858 if (flag_unroll_all_loops)
3859 flag_unroll_loops = 1;
3860 /* Loop unrolling requires that strength_reduction be on also. Silently
3861 turn on strength reduction here if it isn't already on. Also, the loop
3862 unrolling code assumes that cse will be run after loop, so that must
3863 be turned on also. */
3864 if (flag_unroll_loops)
3866 flag_strength_reduce = 1;
3867 flag_rerun_cse_after_loop = 1;
3870 /* Warn about options that are not supported on this machine. */
3871 #ifndef INSN_SCHEDULING
3872 if (flag_schedule_insns || flag_schedule_insns_after_reload)
3873 warning ("instruction scheduling not supported on this target machine");
3876 if (flag_delayed_branch)
3877 warning ("this target machine does not have delayed branches");
3880 /* If we are in verbose mode, write out the version and maybe all the
3881 option flags in use. */
3884 fprintf (stderr, "%s version %s", language_string, version_string);
3885 #ifdef TARGET_VERSION
3890 #define __VERSION__ "[unknown]"
3892 fprintf (stderr, " compiled by GNU C version %s.\n", __VERSION__);
3894 fprintf (stderr, " compiled by CC.\n");
3897 print_switch_values ();
3900 compile_file (filename);
3902 #if !defined(OS2) && !defined(VMS) && !defined(_WIN32)
3905 char *lim = (char *) sbrk (0);
3907 fprintf (stderr, "Data size %d.\n",
3908 lim - (char *) &environ);
3912 system ("ps -l 1>&2");
3915 #endif /* not USG */
3917 #endif /* not OS2 and not VMS and not _WIN32 */
3920 exit (FATAL_EXIT_CODE);
3922 exit (FATAL_EXIT_CODE);
3923 exit (SUCCESS_EXIT_CODE);
3927 /* Decode -m switches. */
3929 /* Here is a table, controlled by the tm.h file, listing each -m switch
3930 and which bits in `target_switches' it should set or clear.
3931 If VALUE is positive, it is bits to set.
3932 If VALUE is negative, -VALUE is bits to clear.
3933 (The sign bit is not used so there is no confusion.) */
3935 struct {char *name; int value;} target_switches []
3938 /* This table is similar, but allows the switch to have a value. */
3940 #ifdef TARGET_OPTIONS
3941 struct {char *prefix; char ** variable;} target_options []
3945 /* Decode the switch -mNAME. */
3948 set_target_switch (name)
3954 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
3955 if (!strcmp (target_switches[j].name, name))
3957 if (target_switches[j].value < 0)
3958 target_flags &= ~-target_switches[j].value;
3960 target_flags |= target_switches[j].value;
3964 #ifdef TARGET_OPTIONS
3966 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
3968 int len = strlen (target_options[j].prefix);
3969 if (!strncmp (target_options[j].prefix, name, len))
3971 *target_options[j].variable = name + len;
3978 error ("Invalid option `%s'", name);
3981 /* Variable used for communication between the following two routines. */
3983 static int line_position;
3985 /* Print an option value and adjust the position in the line. */
3988 print_single_switch (type, name)
3991 fprintf (stderr, " %s%s", type, name);
3993 line_position += strlen (type) + strlen (name) + 1;
3995 if (line_position > 65)
3997 fprintf (stderr, "\n\t");
4002 /* Print default target switches for -version. */
4005 print_switch_values ()
4009 fprintf (stderr, "enabled:");
4012 for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
4013 if (*f_options[j].variable == f_options[j].on_value)
4014 print_single_switch ("-f", f_options[j].string);
4016 for (j = 0; j < sizeof W_options / sizeof W_options[0]; j++)
4017 if (*W_options[j].variable == W_options[j].on_value)
4018 print_single_switch ("-W", W_options[j].string);
4020 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
4021 if (target_switches[j].name[0] != '\0'
4022 && target_switches[j].value > 0
4023 && ((target_switches[j].value & target_flags)
4024 == target_switches[j].value))
4025 print_single_switch ("-m", target_switches[j].name);
4027 fprintf (stderr, "\n");