1 /* Top level of GNU C compiler
2 Copyright (C) 1987, 88, 89, 92, 93, 1994 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, 675 Mass Ave, Cambridge, MA 02139, 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>
41 #include <sys/param.h>
42 /* This is for hpux. It is a real screw. They should change hpux. */
44 #include <sys/times.h>
45 #include <time.h> /* Correct for hpux at least. Is it good on other USG? */
46 #undef FFS /* Some systems define this in param.h. */
50 #include <sys/resource.h>
56 /* #include "c-tree.h" */
59 #include "insn-attr.h"
62 #ifdef XCOFF_DEBUGGING_INFO
70 /* The extra parameters substantially improve the I/O performance. */
72 VMS_fopen (fname, type)
76 if (strcmp (type, "w") == 0)
77 return fopen (fname, type, "mbc=16", "deq=64", "fop=tef", "shr=nil");
78 return fopen (fname, type, "mbc=16");
80 #define fopen VMS_fopen
83 #ifndef DEFAULT_GDB_EXTENSIONS
84 #define DEFAULT_GDB_EXTENSIONS 1
87 extern int rtx_equal_function_value_matters;
89 #if ! (defined (VMS) || defined (OS2))
90 extern char **environ;
92 extern char *version_string, *language_string;
94 /* Carry information from ASM_DECLARE_OBJECT_NAME
95 to ASM_FINISH_DECLARE_OBJECT. */
97 extern int size_directive_output;
98 extern tree last_assemble_variable_decl;
100 extern void init_lex ();
101 extern void init_decl_processing ();
102 extern void init_obstacks ();
103 extern void init_tree_codes ();
104 extern void init_rtl ();
105 extern void init_regs ();
106 extern void init_optabs ();
107 extern void init_stmt ();
108 extern void init_reg_sets ();
109 extern void dump_flow_info ();
110 extern void dump_sched_info ();
111 extern void dump_local_alloc ();
113 void rest_of_decl_compilation ();
114 void error_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
115 void error_with_decl PVPROTO((tree decl, char *s, ...));
116 void error_for_asm PVPROTO((rtx insn, char *s, ...));
117 void error PVPROTO((char *s, ...));
118 void fatal PVPROTO((char *s, ...));
119 void warning_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
120 void warning_with_decl PVPROTO((tree decl, char *s, ...));
121 void warning_for_asm PVPROTO((rtx insn, char *s, ...));
122 void warning PVPROTO((char *s, ...));
123 void pedwarn PVPROTO((char *s, ...));
124 void pedwarn_with_decl PVPROTO((tree decl, char *s, ...));
125 void pedwarn_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
126 void sorry PVPROTO((char *s, ...));
127 void really_sorry PVPROTO((char *s, ...));
132 void set_target_switch ();
133 static void print_switch_values ();
134 static char *decl_name ();
136 /* Name of program invoked, sans directories. */
140 /* Copy of arguments to main. */
144 /* Name of current original source file (what was input to cpp).
145 This comes from each #-command in the actual input. */
147 char *input_filename;
149 /* Name of top-level original source file (what was input to cpp).
150 This comes from the #-command at the beginning of the actual input.
151 If there isn't any there, then this is the cc1 input file name. */
153 char *main_input_filename;
155 /* Stream for reading from the input file. */
159 /* Current line number in real source file. */
163 /* Stack of currently pending input files. */
165 struct file_stack *input_file_stack;
167 /* Incremented on each change to input_file_stack. */
168 int input_file_stack_tick;
170 /* FUNCTION_DECL for function now being parsed or compiled. */
172 extern tree current_function_decl;
174 /* Name to use as base of names for dump output files. */
176 char *dump_base_name;
178 /* Bit flags that specify the machine subtype we are compiling for.
179 Bits are tested using macros TARGET_... defined in the tm.h file
180 and set by `-m...' switches. Must be defined in rtlanal.c. */
182 extern int target_flags;
184 /* Flags saying which kinds of debugging dump have been requested. */
187 int rtl_dump_and_exit = 0;
188 int jump_opt_dump = 0;
193 int combine_dump = 0;
195 int local_reg_dump = 0;
196 int global_reg_dump = 0;
198 int jump2_opt_dump = 0;
199 int dbr_sched_dump = 0;
200 int flag_print_asm_name = 0;
201 int stack_reg_dump = 0;
203 /* Name for output file of assembly code, specified with -o. */
207 /* Value of the -G xx switch, and whether it was passed or not. */
211 /* Type(s) of debugging information we are producing (if any).
212 See flags.h for the definitions of the different possible
213 types of debugging information. */
214 enum debug_info_type write_symbols = NO_DEBUG;
216 /* Level of debugging information we are producing. See flags.h
217 for the definitions of the different possible levels. */
218 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
220 /* Nonzero means use GNU-only extensions in the generated symbolic
221 debugging information. */
222 /* Currently, this only has an effect when write_symbols is set to
223 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
224 int use_gnu_debug_info_extensions = 0;
226 /* Nonzero means do optimizations. -O.
227 Particular numeric values stand for particular amounts of optimization;
228 thus, -O2 stores 2 here. However, the optimizations beyond the basic
229 ones are not controlled directly by this variable. Instead, they are
230 controlled by individual `flag_...' variables that are defaulted
231 based on this variable. */
235 /* Number of error messages and warning messages so far. */
238 int warningcount = 0;
241 /* Flag to output bytecode instead of native assembler */
242 int output_bytecode = 0;
244 /* Pointer to function to compute the name to use to print a declaration. */
246 char *(*decl_printable_name) ();
248 /* Pointer to function to compute rtl for a language-specific tree code. */
250 struct rtx_def *(*lang_expand_expr) ();
252 /* Pointer to function to finish handling an incomplete decl at the
253 end of compilation. */
255 void (*incomplete_decl_finalize_hook) () = 0;
257 /* Pointer to function for interim exception handling implementation.
258 This interface will change, and it is only here until a better interface
261 void (*interim_eh_hook) PROTO((tree));
263 /* Nonzero if generating code to do profiling. */
265 int profile_flag = 0;
267 /* Nonzero if generating code to do profiling on a line-by-line basis. */
269 int profile_block_flag;
271 /* Nonzero for -pedantic switch: warn about anything
272 that standard spec forbids. */
276 /* Temporarily suppress certain warnings.
277 This is set while reading code from a system header file. */
279 int in_system_header = 0;
281 /* Nonzero means do stupid register allocation.
282 Currently, this is 1 if `optimize' is 0. */
284 int obey_regdecls = 0;
286 /* Don't print functions as they are compiled and don't print
287 times taken by the various passes. -quiet. */
293 /* Nonzero means `char' should be signed. */
295 int flag_signed_char;
297 /* Nonzero means give an enum type only as many bytes as it needs. */
299 int flag_short_enums;
301 /* Nonzero for -fcaller-saves: allocate values in regs that need to
302 be saved across function calls, if that produces overall better code.
303 Optional now, so people can test it. */
305 #ifdef DEFAULT_CALLER_SAVES
306 int flag_caller_saves = 1;
308 int flag_caller_saves = 0;
311 /* Nonzero if structures and unions should be returned in memory.
313 This should only be defined if compatibility with another compiler or
314 with an ABI is needed, because it results in slower code. */
316 #ifndef DEFAULT_PCC_STRUCT_RETURN
317 #define DEFAULT_PCC_STRUCT_RETURN 1
320 /* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
322 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
324 /* Nonzero for -fforce-mem: load memory value into a register
325 before arithmetic on it. This makes better cse but slower compilation. */
327 int flag_force_mem = 0;
329 /* Nonzero for -fforce-addr: load memory address into a register before
330 reference to memory. This makes better cse but slower compilation. */
332 int flag_force_addr = 0;
334 /* Nonzero for -fdefer-pop: don't pop args after each function call;
335 instead save them up to pop many calls' args with one insns. */
337 int flag_defer_pop = 0;
339 /* Nonzero for -ffloat-store: don't allocate floats and doubles
340 in extended-precision registers. */
342 int flag_float_store = 0;
344 /* Nonzero for -fcse-follow-jumps:
345 have cse follow jumps to do a more extensive job. */
347 int flag_cse_follow_jumps;
349 /* Nonzero for -fcse-skip-blocks:
350 have cse follow a branch around a block. */
351 int flag_cse_skip_blocks;
353 /* Nonzero for -fexpensive-optimizations:
354 perform miscellaneous relatively-expensive optimizations. */
355 int flag_expensive_optimizations;
357 /* Nonzero for -fthread-jumps:
358 have jump optimize output of loop. */
360 int flag_thread_jumps;
362 /* Nonzero enables strength-reduction in loop.c. */
364 int flag_strength_reduce = 0;
366 /* Nonzero enables loop unrolling in unroll.c. Only loops for which the
367 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
368 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
371 int flag_unroll_loops;
373 /* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
374 This is generally not a win. */
376 int flag_unroll_all_loops;
378 /* Nonzero for -fwritable-strings:
379 store string constants in data segment and don't uniquize them. */
381 int flag_writable_strings = 0;
383 /* Nonzero means don't put addresses of constant functions in registers.
384 Used for compiling the Unix kernel, where strange substitutions are
385 done on the assembly output. */
387 int flag_no_function_cse = 0;
389 /* Nonzero for -fomit-frame-pointer:
390 don't make a frame pointer in simple functions that don't require one. */
392 int flag_omit_frame_pointer = 0;
394 /* Nonzero to inhibit use of define_optimization peephole opts. */
396 int flag_no_peephole = 0;
398 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
399 operations in the interest of optimization. For example it allows
400 GCC to assume arguments to sqrt are nonnegative numbers, allowing
401 faster code for sqrt to be generated. */
403 int flag_fast_math = 0;
405 /* Nonzero means all references through pointers are volatile. */
409 /* Nonzero means treat all global and extern variables as global. */
411 int flag_volatile_global;
413 /* Nonzero means just do syntax checking; don't output anything. */
415 int flag_syntax_only = 0;
417 /* Nonzero means to rerun cse after loop optimization. This increases
418 compilation time about 20% and picks up a few more common expressions. */
420 static int flag_rerun_cse_after_loop;
422 /* Nonzero for -finline-functions: ok to inline functions that look like
423 good inline candidates. */
425 int flag_inline_functions;
427 /* Nonzero for -fkeep-inline-functions: even if we make a function
428 go inline everywhere, keep its definition around for debugging
431 int flag_keep_inline_functions;
433 /* Nonzero means that functions declared `inline' will be treated
434 as `static'. Prevents generation of zillions of copies of unused
435 static inline functions; instead, `inlines' are written out
436 only when actually used. Used in conjunction with -g. Also
437 does the right thing with #pragma interface. */
441 /* Nonzero means we should be saving declaration info into a .X file. */
443 int flag_gen_aux_info = 0;
445 /* Specified name of aux-info file. */
447 static char *aux_info_file_name;
449 /* Nonzero means make the text shared if supported. */
451 int flag_shared_data;
453 /* Nonzero means schedule into delayed branch slots if supported. */
455 int flag_delayed_branch;
457 /* Nonzero means to run cleanups after CALL_EXPRs. */
459 int flag_short_temps;
461 /* Nonzero if we are compiling pure (sharable) code.
462 Value is 1 if we are doing reasonable (i.e. simple
463 offset into offset table) pic. Value is 2 if we can
464 only perform register offsets. */
468 /* Nonzero means place uninitialized global data in the bss section. */
472 /* Nonzero means pretend it is OK to examine bits of target floats,
473 even if that isn't true. The resulting code will have incorrect constants,
474 but the same series of instructions that the native compiler would make. */
476 int flag_pretend_float;
478 /* Nonzero means change certain warnings into errors.
479 Usually these are warnings about failure to conform to some standard. */
481 int flag_pedantic_errors = 0;
483 /* flag_schedule_insns means schedule insns within basic blocks (before
485 flag_schedule_insns_after_reload means schedule insns after
488 int flag_schedule_insns = 0;
489 int flag_schedule_insns_after_reload = 0;
491 /* -finhibit-size-directive inhibits output of .size for ELF.
492 This is used only for compiling crtstuff.c,
493 and it may be extended to other effects
494 needed for crtstuff.c on other systems. */
495 int flag_inhibit_size_directive = 0;
497 /* -fverbose-asm causes extra commentary information to be produced in
498 the generated assembly code (to make it more readable). This option
499 is generally only of use to those who actually need to read the
500 generated assembly code (perhaps while debugging the compiler itself). */
502 int flag_verbose_asm = 0;
504 /* -fgnu-linker specifies use of the GNU linker for initializations.
505 (Or, more generally, a linker that handles initializations.)
506 -fno-gnu-linker says that collect2 will be used. */
508 int flag_gnu_linker = 0;
510 int flag_gnu_linker = 1;
513 /* Table of language-independent -f options.
514 STRING is the option name. VARIABLE is the address of the variable.
515 ON_VALUE is the value to store in VARIABLE
516 if `-fSTRING' is seen as an option.
517 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
519 struct { char *string; int *variable; int on_value;} f_options[] =
521 {"float-store", &flag_float_store, 1},
522 {"volatile", &flag_volatile, 1},
523 {"volatile-global", &flag_volatile_global, 1},
524 {"defer-pop", &flag_defer_pop, 1},
525 {"omit-frame-pointer", &flag_omit_frame_pointer, 1},
526 {"cse-follow-jumps", &flag_cse_follow_jumps, 1},
527 {"cse-skip-blocks", &flag_cse_skip_blocks, 1},
528 {"expensive-optimizations", &flag_expensive_optimizations, 1},
529 {"thread-jumps", &flag_thread_jumps, 1},
530 {"strength-reduce", &flag_strength_reduce, 1},
531 {"unroll-loops", &flag_unroll_loops, 1},
532 {"unroll-all-loops", &flag_unroll_all_loops, 1},
533 {"writable-strings", &flag_writable_strings, 1},
534 {"peephole", &flag_no_peephole, 0},
535 {"force-mem", &flag_force_mem, 1},
536 {"force-addr", &flag_force_addr, 1},
537 {"function-cse", &flag_no_function_cse, 0},
538 {"inline-functions", &flag_inline_functions, 1},
539 {"keep-inline-functions", &flag_keep_inline_functions, 1},
540 {"inline", &flag_no_inline, 0},
541 {"syntax-only", &flag_syntax_only, 1},
542 {"shared-data", &flag_shared_data, 1},
543 {"caller-saves", &flag_caller_saves, 1},
544 {"pcc-struct-return", &flag_pcc_struct_return, 1},
545 {"reg-struct-return", &flag_pcc_struct_return, 0},
546 {"delayed-branch", &flag_delayed_branch, 1},
547 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1},
548 {"pretend-float", &flag_pretend_float, 1},
549 {"schedule-insns", &flag_schedule_insns, 1},
550 {"schedule-insns2", &flag_schedule_insns_after_reload, 1},
551 {"pic", &flag_pic, 1},
552 {"PIC", &flag_pic, 2},
553 {"fast-math", &flag_fast_math, 1},
554 {"common", &flag_no_common, 0},
555 {"inhibit-size-directive", &flag_inhibit_size_directive, 1},
556 {"verbose-asm", &flag_verbose_asm, 1},
557 {"gnu-linker", &flag_gnu_linker, 1},
558 {"bytecode", &output_bytecode, 1}
561 /* Table of language-specific options. */
563 char *lang_options[] =
566 "-fallow-single-precision",
568 "-fsigned-bitfields",
569 "-funsigned-bitfields",
570 "-fno-signed-bitfields",
571 "-fno-unsigned-bitfields",
575 "-fno-unsigned-char",
587 "-fno-cond-mismatch",
588 "-fdollars-in-identifiers",
589 "-fno-dollars-in-identifiers",
598 "-Wbad-function-cast",
599 "-Wno-bad-function-cast",
603 "-Wno-char-subscripts",
617 "-Wno-missing-braces",
618 "-Wmissing-declarations",
619 "-Wno-missing-declarations",
620 "-Wmissing-prototypes",
621 "-Wno-missing-prototypes",
623 "-Wno-nested-externs",
627 "-Wno-pointer-arith",
629 "-Wno-redundant-decls",
630 "-Wstrict-prototypes",
631 "-Wno-strict-prototypes",
637 "-Wno-write-strings",
639 /* These are for C++. */
640 "-+e0", /* gcc.c tacks the `-' on the front. */
645 "-falt-external-templates",
646 "-fno-alt-external-templates",
647 "-fansi-overloading",
648 "-fno-ansi-overloading",
652 "-fno-conserve-space",
654 "-fno-default-inline",
657 "-felide-constructors",
658 "-fno-elide-constructors",
660 "-fno-enum-int-equiv",
661 "-fexternal-templates",
662 "-fno-external-templates",
665 "-fhandle-exceptions",
666 "-fno-handle-exceptions",
667 "-fhandle-signatures",
668 "-fno-handle-signatures",
671 "-fimplement-inlines",
672 "-fno-implement-inlines",
673 "-fimplicit-templates",
674 "-fno-implicit-templates",
678 "-fno-memoize-lookups",
680 "-fno-nonnull-objects",
682 "-fno-save-memoized",
687 "-fstrict-prototype",
688 "-fno-strict-prototype",
689 "-fthis-is-variable",
690 "-fno-this-is-variable",
692 "-fno-vtable-thunks",
698 "-Woverloaded-virtual",
699 "-Wno-overloaded-virtual",
702 "-Wtemplate-debugging",
703 "-Wno-template-debugging",
704 "-Wctor-dtor-privacy",
705 "-Wno-ctor-dtor-privacy",
706 "-Wnon-virtual-dtor",
707 "-Wno-non-virtual-dtor",
709 "-Wno-extern-inline",
715 /* these are for obj c */
727 /* This is for GNAT and is temporary. */
732 /* Options controlling warnings */
734 /* Don't print warning messages. -w. */
736 int inhibit_warnings = 0;
738 /* Print various extra warnings. -W. */
740 int extra_warnings = 0;
742 /* Treat warnings as errors. -Werror. */
744 int warnings_are_errors = 0;
746 /* Nonzero to warn about unused local variables. */
750 /* Nonzero to warn about variables used before they are initialized. */
752 int warn_uninitialized;
754 /* Nonzero means warn about all declarations which shadow others. */
758 /* Warn if a switch on an enum fails to have a case for every enum value. */
762 /* Nonzero means warn about function definitions that default the return type
763 or that use a null return and have a return-type other than void. */
765 int warn_return_type;
767 /* Nonzero means warn about pointer casts that increase the required
768 alignment of the target type (and might therefore lead to a crash
769 due to a misaligned access). */
773 /* Nonzero means warn about any identifiers that match in the first N
774 characters. The value N is in `id_clash_len'. */
777 unsigned id_clash_len;
779 /* Nonzero means warn about any objects definitions whose size is larger
780 than N bytes. Also want about function definitions whose returned
781 values are larger than N bytes. The value N is in `larger_than_size'. */
783 int warn_larger_than;
784 unsigned larger_than_size;
786 /* Nonzero means warn if inline function is too large. */
790 /* Warn if a function returns an aggregate,
791 since there are often incompatible calling conventions for doing this. */
793 int warn_aggregate_return;
795 /* Likewise for -W. */
797 struct { char *string; int *variable; int on_value;} W_options[] =
799 {"unused", &warn_unused, 1},
800 {"error", &warnings_are_errors, 1},
801 {"shadow", &warn_shadow, 1},
802 {"switch", &warn_switch, 1},
803 {"aggregate-return", &warn_aggregate_return, 1},
804 {"cast-align", &warn_cast_align, 1},
805 {"uninitialized", &warn_uninitialized, 1},
806 {"inline", &warn_inline, 1}
809 /* Output files for assembler code (real compiler output)
810 and debugging dumps. */
815 FILE *jump_opt_dump_file;
817 FILE *loop_dump_file;
818 FILE *cse2_dump_file;
819 FILE *flow_dump_file;
820 FILE *combine_dump_file;
821 FILE *sched_dump_file;
822 FILE *local_reg_dump_file;
823 FILE *global_reg_dump_file;
824 FILE *sched2_dump_file;
825 FILE *jump2_opt_dump_file;
826 FILE *dbr_sched_dump_file;
827 FILE *stack_reg_dump_file;
829 /* Time accumulators, to count the total time spent in various passes. */
833 int integration_time;
841 int local_alloc_time;
842 int global_alloc_time;
845 int shorten_branch_time;
851 /* Return time used so far, in microseconds. */
860 struct rusage rusage;
865 int proc_system_time;
867 int child_system_time;
877 return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
880 getrusage (0, &rusage);
881 return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
882 + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
885 return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
890 #define TIMEVAR(VAR, BODY) \
891 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
894 print_time (str, total)
899 "time in %s: %d.%06d\n",
900 str, total / 1000000, total % 1000000);
903 /* Count an error or warning. Return 1 if the message should be printed. */
906 count_error (warningp)
909 if (warningp && inhibit_warnings)
912 if (warningp && !warnings_are_errors)
916 static int warning_message = 0;
918 if (warningp && !warning_message)
920 fprintf (stderr, "%s: warnings being treated as errors\n", progname);
929 /* Print a fatal error message. NAME is the text.
930 Also include a system error message based on `errno'. */
933 pfatal_with_name (name)
936 fprintf (stderr, "%s: ", progname);
942 fatal_io_error (name)
945 fprintf (stderr, "%s: %s: I/O error\n", progname, name);
949 /* Called to give a better error message for a bad insn rather than
950 just calling abort(). */
953 fatal_insn (message, insn)
957 if (!output_bytecode)
963 fflush (asm_out_file);
965 fflush (aux_info_file);
967 fflush (rtl_dump_file);
968 if (jump_opt_dump_file)
969 fflush (jump_opt_dump_file);
971 fflush (cse_dump_file);
973 fflush (loop_dump_file);
975 fflush (cse2_dump_file);
977 fflush (flow_dump_file);
978 if (combine_dump_file)
979 fflush (combine_dump_file);
981 fflush (sched_dump_file);
982 if (local_reg_dump_file)
983 fflush (local_reg_dump_file);
984 if (global_reg_dump_file)
985 fflush (global_reg_dump_file);
986 if (sched2_dump_file)
987 fflush (sched2_dump_file);
988 if (jump2_opt_dump_file)
989 fflush (jump2_opt_dump_file);
990 if (dbr_sched_dump_file)
991 fflush (dbr_sched_dump_file);
992 if (stack_reg_dump_file)
993 fflush (stack_reg_dump_file);
997 /* Called to give a better error message when we don't have an insn to match
998 what we are looking for or if the insn's constraints aren't satisfied,
999 rather than just calling abort(). */
1002 fatal_insn_not_found (insn)
1005 if (INSN_CODE (insn) < 0)
1006 fatal_insn ("internal error--unrecognizable insn:", insn);
1008 fatal_insn ("internal error--insn does not satisfy its constraints:", insn);
1011 /* This is the default decl_printable_name function. */
1014 decl_name (decl, kind)
1018 return IDENTIFIER_POINTER (DECL_NAME (decl));
1021 /* This is the default interim_eh_hook function. */
1024 interim_eh (finalization)
1027 /* Don't do anything by default. */
1030 static int need_error_newline;
1032 /* Function of last error message;
1033 more generally, function such that if next error message is in it
1034 then we don't have to mention the function name. */
1035 static tree last_error_function = NULL;
1037 /* Used to detect when input_file_stack has changed since last described. */
1038 static int last_error_tick;
1040 /* Called when the start of a function definition is parsed,
1041 this function prints on stderr the name of the function. */
1044 announce_function (decl)
1050 if (rtl_dump_and_exit)
1051 fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
1053 fprintf (stderr, " %s", (*decl_printable_name) (decl, &junk));
1055 need_error_newline = 1;
1056 last_error_function = current_function_decl;
1060 /* Prints out, if necessary, the name of the current function
1061 which caused an error. Called from all error and warning functions. */
1064 report_error_function (file)
1067 struct file_stack *p;
1069 if (need_error_newline)
1071 fprintf (stderr, "\n");
1072 need_error_newline = 0;
1075 if (last_error_function != current_function_decl)
1077 char *kind = "function";
1078 if (current_function_decl != 0
1079 && TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
1083 fprintf (stderr, "%s: ", file);
1085 if (current_function_decl == NULL)
1086 fprintf (stderr, "At top level:\n");
1089 char *name = (*decl_printable_name) (current_function_decl, &kind);
1090 fprintf (stderr, "In %s `%s':\n", kind, name);
1093 last_error_function = current_function_decl;
1095 if (input_file_stack && input_file_stack->next != 0
1096 && input_file_stack_tick != last_error_tick)
1098 fprintf (stderr, "In file included");
1099 for (p = input_file_stack->next; p; p = p->next)
1101 fprintf (stderr, " from %s:%d", p->name, p->line);
1103 fprintf (stderr, ",\n ");
1105 fprintf (stderr, ":\n");
1106 last_error_tick = input_file_stack_tick;
1110 /* Print a message. */
1113 vmessage (prefix, s, ap)
1119 fprintf (stderr, "%s: ", prefix);
1122 vfprintf (stderr, s, ap);
1125 HOST_WIDE_INT v1 = va_arg(ap, HOST_WIDE_INT);
1126 HOST_WIDE_INT v2 = va_arg(ap, HOST_WIDE_INT);
1127 HOST_WIDE_INT v3 = va_arg(ap, HOST_WIDE_INT);
1128 fprintf (stderr, s, v1, v2, v3);
1133 /* Print a message relevant to line LINE of file FILE. */
1136 v_message_with_file_and_line (file, line, prefix, s, ap)
1144 fprintf (stderr, "%s:%d: ", file, line);
1146 fprintf (stderr, "%s: ", progname);
1148 vmessage (prefix, s, ap);
1149 fputc ('\n', stderr);
1152 /* Print a message relevant to the given DECL. */
1155 v_message_with_decl (decl, prefix, s, ap)
1163 fprintf (stderr, "%s:%d: ",
1164 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
1167 fprintf (stderr, "%s: ", prefix);
1169 /* Do magic to get around lack of varargs support for insertion
1170 of arguments into existing list. We know that the decl is first;
1171 we ass_u_me that it will be printed with "%s". */
1173 for (p = s; *p; ++p)
1177 if (*(p + 1) == '%')
1184 if (p > s) /* Print the left-hand substring. */
1186 char fmt[sizeof "%.255s"];
1189 if (width > 255L) width = 255L; /* arbitrary */
1190 sprintf (fmt, "%%.%lds", width);
1191 fprintf (stderr, fmt, s);
1194 if (*p == '%') /* Print the name. */
1196 char *n = (DECL_NAME (decl)
1197 ? (*decl_printable_name) (decl, &junk)
1203 if (isalpha (*(p - 1) & 0xFF))
1208 if (*p) /* Print the rest of the message. */
1209 vmessage ((char *)NULL, p, ap);
1211 fputc ('\n', stderr);
1214 /* Figure file and line of the given INSN. */
1217 file_and_line_for_asm (insn, pfile, pline)
1222 rtx body = PATTERN (insn);
1225 /* Find the (or one of the) ASM_OPERANDS in the insn. */
1226 if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
1227 asmop = SET_SRC (body);
1228 else if (GET_CODE (body) == ASM_OPERANDS)
1230 else if (GET_CODE (body) == PARALLEL
1231 && GET_CODE (XVECEXP (body, 0, 0)) == SET)
1232 asmop = SET_SRC (XVECEXP (body, 0, 0));
1233 else if (GET_CODE (body) == PARALLEL
1234 && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
1235 asmop = XVECEXP (body, 0, 0);
1241 *pfile = ASM_OPERANDS_SOURCE_FILE (asmop);
1242 *pline = ASM_OPERANDS_SOURCE_LINE (asmop);
1246 *pfile = input_filename;
1251 /* Report an error at line LINE of file FILE. */
1254 v_error_with_file_and_line (file, line, s, ap)
1261 report_error_function (file);
1262 v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
1266 error_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1278 file = va_arg (ap, char *);
1279 line = va_arg (ap, int);
1280 s = va_arg (ap, char *);
1283 v_error_with_file_and_line (file, line, s, ap);
1287 /* Report an error at the declaration DECL.
1288 S is a format string which uses %s to substitute the declaration
1289 name; subsequent substitutions are a la printf. */
1292 v_error_with_decl (decl, s, ap)
1298 report_error_function (DECL_SOURCE_FILE (decl));
1299 v_message_with_decl (decl, (char *)NULL, s, ap);
1303 error_with_decl VPROTO((tree decl, char *s, ...))
1314 decl = va_arg (ap, tree);
1315 s = va_arg (ap, char *);
1318 v_error_with_decl (decl, s, ap);
1322 /* Report an error at the line number of the insn INSN.
1323 This is used only when INSN is an `asm' with operands,
1324 and each ASM_OPERANDS records its own source file and line. */
1327 v_error_for_asm (insn, s, ap)
1336 file_and_line_for_asm (insn, &file, &line);
1337 report_error_function (file);
1338 v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
1342 error_for_asm VPROTO((rtx insn, char *s, ...))
1353 insn = va_arg (ap, rtx);
1354 s = va_arg (ap, char *);
1357 v_error_for_asm (insn, s, ap);
1361 /* Report an error at the current line number. */
1368 v_error_with_file_and_line (input_filename, lineno, s, ap);
1372 error VPROTO((char *s, ...))
1382 s = va_arg (ap, char *);
1389 /* Report a fatal error at the current line number. */
1401 fatal VPROTO((char *s, ...))
1411 s = va_arg (ap, char *);
1418 /* Report a warning at line LINE of file FILE. */
1421 v_warning_with_file_and_line (file, line, s, ap)
1427 if (count_error (1))
1429 report_error_function (file);
1430 v_message_with_file_and_line (file, line, "warning", s, ap);
1435 warning_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1447 file = va_arg (ap, char *);
1448 line = va_arg (ap, int);
1449 s = va_arg (ap, char *);
1452 v_warning_with_file_and_line (file, line, s, ap);
1456 /* Report a warning at the declaration DECL.
1457 S is a format string which uses %s to substitute the declaration
1458 name; subsequent substitutions are a la printf. */
1461 v_warning_with_decl (decl, s, ap)
1466 if (count_error (1))
1468 report_error_function (DECL_SOURCE_FILE (decl));
1469 v_message_with_decl (decl, "warning", s, ap);
1474 warning_with_decl VPROTO((tree decl, char *s, ...))
1485 decl = va_arg (ap, tree);
1486 s = va_arg (ap, char *);
1489 v_warning_with_decl (decl, s, ap);
1493 /* Report a warning at the line number of the insn INSN.
1494 This is used only when INSN is an `asm' with operands,
1495 and each ASM_OPERANDS records its own source file and line. */
1498 v_warning_for_asm (insn, s, ap)
1503 if (count_error (1))
1508 file_and_line_for_asm (insn, &file, &line);
1509 report_error_function (file);
1510 v_message_with_file_and_line (file, line, "warning", s, ap);
1515 warning_for_asm VPROTO((rtx insn, char *s, ...))
1526 insn = va_arg (ap, rtx);
1527 s = va_arg (ap, char *);
1530 v_warning_for_asm (insn, s, ap);
1534 /* Report a warning at the current line number. */
1541 v_warning_with_file_and_line (input_filename, lineno, s, ap);
1545 warning VPROTO((char *s, ...))
1555 s = va_arg (ap, char *);
1562 /* These functions issue either warnings or errors depending on
1563 -pedantic-errors. */
1570 if (flag_pedantic_errors)
1577 pedwarn VPROTO((char *s, ...))
1587 s = va_arg (ap, char *);
1595 v_pedwarn_with_decl (decl, s, ap)
1600 /* We don't want -pedantic-errors to cause the compilation to fail from
1601 "errors" in system header files. Sometimes fixincludes can't fix what's
1602 broken (eg: unsigned char bitfields - fixing it may change the alignment
1603 which will cause programs to mysteriously fail because the C library
1604 or kernel uses the original layout). There's no point in issuing a
1605 warning either, it's just unnecessary noise. */
1607 if (! DECL_IN_SYSTEM_HEADER (decl))
1609 if (flag_pedantic_errors)
1610 v_error_with_decl (decl, s, ap);
1612 v_warning_with_decl (decl, s, ap);
1617 pedwarn_with_decl VPROTO((tree decl, char *s, ...))
1628 decl = va_arg (ap, tree);
1629 s = va_arg (ap, char *);
1632 v_pedwarn_with_decl (decl, s, ap);
1637 v_pedwarn_with_file_and_line (file, line, s, ap)
1643 if (flag_pedantic_errors)
1644 v_error_with_file_and_line (file, line, s, ap);
1646 v_warning_with_file_and_line (file, line, s, ap);
1650 pedwarn_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1662 file = va_arg (ap, char *);
1663 line = va_arg (ap, int);
1664 s = va_arg (ap, char *);
1667 v_pedwarn_with_file_and_line (file, line, s, ap);
1671 /* Apologize for not implementing some feature. */
1680 fprintf (stderr, "%s:%d: ", input_filename, lineno);
1682 fprintf (stderr, "%s: ", progname);
1683 vmessage ("sorry, not implemented", s, ap);
1684 fputc ('\n', stderr);
1688 sorry VPROTO((char *s, ...))
1698 s = va_arg (ap, char *);
1705 /* Apologize for not implementing some feature, then quit. */
1708 v_really_sorry (s, ap)
1714 fprintf (stderr, "%s:%d: ", input_filename, lineno);
1716 fprintf (stderr, "%s: ", progname);
1717 vmessage ("sorry, not implemented", s, ap);
1718 fatal (" (fatal)\n");
1722 really_sorry VPROTO((char *s, ...))
1732 s = va_arg (ap, char *);
1735 v_really_sorry (s, ap);
1739 /* More 'friendly' abort that prints the line and file.
1740 config.h can #define abort fancy_abort if you like that sort of thing.
1742 I don't think this is actually a good idea.
1743 Other sorts of crashes will look a certain way.
1744 It is a good thing if crashes from calling abort look the same way.
1750 fatal ("internal gcc abort");
1753 /* This calls abort and is used to avoid problems when abort if a macro.
1754 It is used when we need to pass the address of abort. */
1762 /* When `malloc.c' is compiled with `rcheck' defined,
1763 it calls this function to report clobberage. */
1771 /* Same as `malloc' but report error if no memory available. */
1777 register char *value = (char *) malloc (size);
1779 fatal ("virtual memory exhausted");
1783 /* Same as `realloc' but report error if no memory available. */
1786 xrealloc (ptr, size)
1790 char *result = (char *) realloc (ptr, size);
1792 fatal ("virtual memory exhausted");
1796 /* Return the logarithm of X, base 2, considering X unsigned,
1797 if X is a power of 2. Otherwise, returns -1.
1799 This should be used via the `exact_log2' macro. */
1803 register unsigned HOST_WIDE_INT x;
1805 register int log = 0;
1806 /* Test for 0 or a power of 2. */
1807 if (x == 0 || x != (x & -x))
1809 while ((x >>= 1) != 0)
1814 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1815 If X is 0, return -1.
1817 This should be used via the floor_log2 macro. */
1821 register unsigned HOST_WIDE_INT x;
1823 register int log = -1;
1831 jmp_buf float_handler;
1833 /* Specify where to longjmp to when a floating arithmetic error happens.
1834 If HANDLER is 0, it means don't handle the errors any more. */
1837 set_float_handler (handler)
1840 float_handled = (handler != 0);
1842 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1845 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1846 error happens, pushing the previous specification into OLD_HANDLER.
1847 Return an indication of whether there was a previous handler in effect. */
1850 push_float_handler (handler, old_handler)
1851 jmp_buf handler, old_handler;
1853 int was_handled = float_handled;
1857 bcopy ((char *) float_handler, (char *) old_handler,
1858 sizeof (float_handler));
1860 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1864 /* Restore the previous specification of whether and where to longjmp to
1865 when a floating arithmetic error happens. */
1868 pop_float_handler (handled, handler)
1872 float_handled = handled;
1874 bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1877 /* Signals actually come here. */
1880 float_signal (signo)
1881 /* If this is missing, some compilers complain. */
1884 if (float_handled == 0)
1886 #if defined (USG) || defined (hpux)
1887 signal (SIGFPE, float_signal); /* re-enable the signal catcher */
1890 signal (SIGFPE, float_signal);
1891 longjmp (float_handler, 1);
1894 /* Handler for SIGPIPE. */
1898 /* If this is missing, some compilers complain. */
1901 fatal ("output pipe has been closed");
1904 /* Strip off a legitimate source ending from the input string NAME of
1908 strip_off_ending (name, len)
1912 if (len > 2 && ! strcmp (".c", name + len - 2))
1914 else if (len > 2 && ! strcmp (".m", name + len - 2))
1916 else if (len > 2 && ! strcmp (".i", name + len - 2))
1918 else if (len > 3 && ! strcmp (".ii", name + len - 3))
1920 else if (len > 3 && ! strcmp (".co", name + len - 3))
1922 else if (len > 3 && ! strcmp (".cc", name + len - 3))
1924 else if (len > 2 && ! strcmp (".C", name + len - 2))
1926 else if (len > 4 && ! strcmp (".cxx", name + len - 4))
1928 else if (len > 4 && ! strcmp (".cpp", name + len - 4))
1930 else if (len > 2 && ! strcmp (".f", name + len - 2))
1932 /* Ada will use extensions like .ada, .adb, and .ads, so just test
1934 else if (len > 4 && ! strncmp (".ad", name + len - 4, 3))
1936 else if (len > 4 && ! strcmp (".atr", name + len - 4))
1940 /* Output a quoted string. */
1942 output_quoted_string (asm_file, string)
1948 putc ('\"', asm_file);
1949 while ((c = *string++) != 0)
1951 if (c == '\"' || c == '\\')
1952 putc ('\\', asm_file);
1955 putc ('\"', asm_file);
1958 /* Output a file name in the form wanted by System V. */
1961 output_file_directive (asm_file, input_name)
1965 int len = strlen (input_name);
1966 char *na = input_name + len;
1968 /* NA gets INPUT_NAME sans directory names. */
1969 while (na > input_name)
1976 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1977 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1979 #ifdef ASM_OUTPUT_SOURCE_FILENAME
1980 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1982 fprintf (asm_file, "\t.file\t");
1983 output_quoted_string (asm_file, na);
1984 fputc ('\n', asm_file);
1989 /* Routine to build language identifier for object file. */
1991 output_lang_identify (asm_out_file)
1994 int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1995 char *s = (char *) alloca (len);
1996 sprintf (s, "__gnu_compiled_%s", lang_identify ());
1997 ASM_OUTPUT_LABEL (asm_out_file, s);
2000 /* Routine to open a dump file. */
2002 open_dump_file (base_name, suffix)
2007 char *dumpname = (char *) alloca (strlen (base_name) + strlen (suffix) + 1);
2009 strcpy (dumpname, base_name);
2010 strcat (dumpname, suffix);
2011 f = fopen (dumpname, "w");
2013 pfatal_with_name (dumpname);
2017 /* Compile an entire file of output from cpp, named NAME.
2018 Write a file of assembly output and various debugging dumps. */
2027 int name_specified = name != 0;
2029 if (dump_base_name == 0)
2030 dump_base_name = name ? name : "gccdump";
2034 integration_time = 0;
2042 local_alloc_time = 0;
2043 global_alloc_time = 0;
2046 shorten_branch_time = 0;
2052 /* Open input file. */
2054 if (name == 0 || !strcmp (name, "-"))
2060 finput = fopen (name, "r");
2062 pfatal_with_name (name);
2064 #ifdef IO_BUFFER_SIZE
2065 setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
2068 /* Initialize data in various passes. */
2073 /* Some of these really don't need to be called when generating bytecode,
2074 but the options would have to be parsed first to know that. -bson */
2076 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
2077 || debug_info_level == DINFO_LEVEL_VERBOSE);
2079 init_decl_processing ();
2087 if (flag_caller_saves)
2088 init_caller_save ();
2090 /* If auxiliary info generation is desired, open the output file.
2091 This goes in the same directory as the source file--unlike
2092 all the other output files. */
2093 if (flag_gen_aux_info)
2095 aux_info_file = fopen (aux_info_file_name, "w");
2096 if (aux_info_file == 0)
2097 pfatal_with_name (aux_info_file_name);
2100 /* If rtl dump desired, open the output file. */
2102 rtl_dump_file = open_dump_file (dump_base_name, ".rtl");
2104 /* If jump_opt dump desired, open the output file. */
2106 jump_opt_dump_file = open_dump_file (dump_base_name, ".jump");
2108 /* If cse dump desired, open the output file. */
2110 cse_dump_file = open_dump_file (dump_base_name, ".cse");
2112 /* If loop dump desired, open the output file. */
2114 loop_dump_file = open_dump_file (dump_base_name, ".loop");
2116 /* If cse2 dump desired, open the output file. */
2118 cse2_dump_file = open_dump_file (dump_base_name, ".cse2");
2120 /* If flow dump desired, open the output file. */
2122 flow_dump_file = open_dump_file (dump_base_name, ".flow");
2124 /* If combine dump desired, open the output file. */
2126 combine_dump_file = open_dump_file (dump_base_name, ".combine");
2128 /* If scheduling dump desired, open the output file. */
2130 sched_dump_file = open_dump_file (dump_base_name, ".sched");
2132 /* If local_reg dump desired, open the output file. */
2134 local_reg_dump_file = open_dump_file (dump_base_name, ".lreg");
2136 /* If global_reg dump desired, open the output file. */
2137 if (global_reg_dump)
2138 global_reg_dump_file = open_dump_file (dump_base_name, ".greg");
2140 /* If 2nd scheduling dump desired, open the output file. */
2142 sched2_dump_file = open_dump_file (dump_base_name, ".sched2");
2144 /* If jump2_opt dump desired, open the output file. */
2146 jump2_opt_dump_file = open_dump_file (dump_base_name, ".jump2");
2148 /* If dbr_sched dump desired, open the output file. */
2150 dbr_sched_dump_file = open_dump_file (dump_base_name, ".dbr");
2154 /* If stack_reg dump desired, open the output file. */
2156 stack_reg_dump_file = open_dump_file (dump_base_name, ".stack");
2160 /* Open assembler code output file. */
2162 if (! name_specified && asm_file_name == 0)
2163 asm_out_file = stdout;
2166 int len = strlen (dump_base_name);
2167 register char *dumpname = (char *) xmalloc (len + 6);
2168 strcpy (dumpname, dump_base_name);
2169 strip_off_ending (dumpname, len);
2170 strcat (dumpname, ".s");
2171 if (asm_file_name == 0)
2173 asm_file_name = (char *) xmalloc (strlen (dumpname) + 1);
2174 strcpy (asm_file_name, dumpname);
2176 if (!strcmp (asm_file_name, "-"))
2177 asm_out_file = stdout;
2179 asm_out_file = fopen (asm_file_name, "w");
2180 if (asm_out_file == 0)
2181 pfatal_with_name (asm_file_name);
2184 #ifdef IO_BUFFER_SIZE
2185 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
2186 _IOFBF, IO_BUFFER_SIZE);
2189 input_filename = name;
2191 /* Perform language-specific initialization.
2192 This may set main_input_filename. */
2195 /* If the input doesn't start with a #line, use the input name
2196 as the official input file name. */
2197 if (main_input_filename == 0)
2198 main_input_filename = name;
2200 /* Put an entry on the input file stack for the main input file. */
2202 = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2203 input_file_stack->next = 0;
2204 input_file_stack->name = input_filename;
2206 if (!output_bytecode)
2208 ASM_FILE_START (asm_out_file);
2211 /* Output something to inform GDB that this compilation was by GCC. Also
2212 serves to tell GDB file consists of bytecodes. */
2213 if (output_bytecode)
2214 fprintf (asm_out_file, "bc_gcc2_compiled.:\n");
2217 #ifndef ASM_IDENTIFY_GCC
2218 fprintf (asm_out_file, "gcc2_compiled.:\n");
2220 ASM_IDENTIFY_GCC (asm_out_file);
2224 /* Output something to identify which front-end produced this file. */
2225 #ifdef ASM_IDENTIFY_LANGUAGE
2226 ASM_IDENTIFY_LANGUAGE (asm_out_file);
2229 if (output_bytecode)
2231 if (profile_flag || profile_block_flag)
2232 error ("profiling not supported in bytecode compilation");
2236 /* ??? Note: There used to be a conditional here
2237 to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2238 This was to guarantee separation between gcc_compiled. and
2239 the first function, for the sake of dbx on Suns.
2240 However, having the extra zero here confused the Emacs
2241 code for unexec, and might confuse other programs too.
2242 Therefore, I took out that change.
2243 In future versions we should find another way to solve
2244 that dbx problem. -- rms, 23 May 93. */
2246 /* Don't let the first function fall at the same address
2247 as gcc_compiled., if profiling. */
2248 if (profile_flag || profile_block_flag)
2249 assemble_zeros (UNITS_PER_WORD);
2252 /* If dbx symbol table desired, initialize writing it
2253 and output the predefined types. */
2254 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2255 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2256 TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
2259 #ifdef SDB_DEBUGGING_INFO
2260 if (write_symbols == SDB_DEBUG)
2261 TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
2264 #ifdef DWARF_DEBUGGING_INFO
2265 if (write_symbols == DWARF_DEBUG)
2266 TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
2269 /* Initialize yet another pass. */
2271 if (!output_bytecode)
2272 init_final (main_input_filename);
2274 start_time = get_run_time ();
2276 /* Call the parser, which parses the entire file
2277 (calling rest_of_compilation for each function). */
2279 if (yyparse () != 0)
2281 if (errorcount == 0)
2282 fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
2284 /* In case there were missing closebraces,
2285 get us back to the global binding level. */
2286 while (! global_bindings_p ())
2290 /* Compilation is now finished except for writing
2291 what's left of the symbol table output. */
2293 parse_time += get_run_time () - start_time;
2295 parse_time -= integration_time;
2296 parse_time -= varconst_time;
2298 globals = getdecls ();
2300 /* Really define vars that have had only a tentative definition.
2301 Really output inline functions that must actually be callable
2302 and have not been output so far. */
2305 int len = list_length (globals);
2306 tree *vec = (tree *) alloca (sizeof (tree) * len);
2311 /* Process the decls in reverse order--earliest first.
2312 Put them into VEC from back to front, then take out from front. */
2314 for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
2315 vec[len - i - 1] = decl;
2317 for (i = 0; i < len; i++)
2321 /* We're not deferring this any longer. */
2322 DECL_DEFER_OUTPUT (decl) = 0;
2324 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
2325 && incomplete_decl_finalize_hook != 0)
2326 (*incomplete_decl_finalize_hook) (decl);
2329 /* Now emit any global variables or functions that we have been putting
2330 off. We need to loop in case one of the things emitted here
2331 references another one which comes earlier in the list. */
2335 for (i = 0; i < len; i++)
2339 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
2342 /* Don't write out static consts, unless we still need them.
2344 We also keep static consts if not optimizing (for debugging).
2345 ??? They might be better written into the debug information.
2346 This is possible when using DWARF.
2348 A language processor that wants static constants to be always
2349 written out (even if it is not used) is responsible for
2350 calling rest_of_decl_compilation itself. E.g. the C front-end
2351 calls rest_of_decl_compilation from finish_decl.
2352 One motivation for this is that is conventional in some
2353 environments to write things like:
2354 static const char rcsid[] = "... version string ...";
2355 intending to force the string to be in the executable.
2357 A language processor that would prefer to have unneeded
2358 static constants "optimized away" would just defer writing
2359 them out until here. E.g. C++ does this, because static
2360 constants are often defined in header files.
2362 ??? A tempting alternative (for both C and C++) would be
2363 to force a constant to be written if and only if it is
2364 defined in a main file, as opposed to an include file. */
2366 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
2367 && (! TREE_READONLY (decl)
2368 || TREE_PUBLIC (decl)
2370 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
2373 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
2376 if (TREE_CODE (decl) == FUNCTION_DECL
2377 && DECL_INITIAL (decl) != 0
2378 && DECL_SAVED_INSNS (decl) != 0
2379 && (flag_keep_inline_functions
2380 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
2383 temporary_allocation ();
2384 output_inline_function (decl);
2385 permanent_allocation (1);
2390 for (i = 0; i < len; i++)
2394 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
2395 && ! TREE_ASM_WRITTEN (decl))
2396 /* Cancel the RTL for this decl so that, if debugging info
2397 output for global variables is still to come,
2398 this one will be omitted. */
2399 DECL_RTL (decl) = NULL;
2401 /* Warn about any function
2402 declared static but not defined.
2403 We don't warn about variables,
2404 because many programs have static variables
2405 that exist only to get some text into the object file. */
2406 if (TREE_CODE (decl) == FUNCTION_DECL
2408 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2409 && DECL_INITIAL (decl) == 0
2410 && DECL_EXTERNAL (decl)
2411 && ! TREE_PUBLIC (decl))
2413 pedwarn_with_decl (decl,
2414 "`%s' declared `static' but never defined");
2415 /* This symbol is effectively an "extern" declaration now. */
2416 TREE_PUBLIC (decl) = 1;
2417 assemble_external (decl);
2420 /* Warn about static fns or vars defined but not used,
2421 but not about inline functions or static consts
2422 since defining those in header files is normal practice. */
2424 && ((TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
2425 || (TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
2426 && ! DECL_IN_SYSTEM_HEADER (decl)
2427 && ! DECL_EXTERNAL (decl)
2428 && ! TREE_PUBLIC (decl)
2429 && ! TREE_USED (decl)
2430 && ! DECL_REGISTER (decl)
2431 /* The TREE_USED bit for file-scope decls
2432 is kept in the identifier, to handle multiple
2433 external decls in different scopes. */
2434 && ! TREE_USED (DECL_NAME (decl)))
2435 warning_with_decl (decl, "`%s' defined but not used");
2437 #ifdef SDB_DEBUGGING_INFO
2438 /* The COFF linker can move initialized global vars to the end.
2439 And that can screw up the symbol ordering.
2440 By putting the symbols in that order to begin with,
2441 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
2442 if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
2443 && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
2444 && ! DECL_EXTERNAL (decl)
2445 && DECL_RTL (decl) != 0)
2446 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
2448 /* Output COFF information for non-global
2449 file-scope initialized variables. */
2450 if (write_symbols == SDB_DEBUG
2451 && TREE_CODE (decl) == VAR_DECL
2452 && DECL_INITIAL (decl)
2453 && ! DECL_EXTERNAL (decl)
2454 && DECL_RTL (decl) != 0
2455 && GET_CODE (DECL_RTL (decl)) == MEM)
2456 TIMEVAR (symout_time, sdbout_toplevel_data (decl));
2457 #endif /* SDB_DEBUGGING_INFO */
2458 #ifdef DWARF_DEBUGGING_INFO
2459 /* Output DWARF information for file-scope tentative data object
2460 declarations, file-scope (extern) function declarations (which
2461 had no corresponding body) and file-scope tagged type declarations
2462 and definitions which have not yet been forced out. */
2464 if (write_symbols == DWARF_DEBUG
2465 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2466 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
2471 /* Do dbx symbols */
2472 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2473 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2474 TIMEVAR (symout_time,
2476 dbxout_finish (asm_out_file, main_input_filename);
2480 #ifdef DWARF_DEBUGGING_INFO
2481 if (write_symbols == DWARF_DEBUG)
2482 TIMEVAR (symout_time,
2488 /* Output some stuff at end of file if nec. */
2490 if (!output_bytecode)
2492 end_final (main_input_filename);
2495 ASM_FILE_END (asm_out_file);
2499 /* Language-specific end of compilation actions. */
2503 if (output_bytecode)
2504 bc_write_file (asm_out_file);
2506 /* Close the dump files. */
2508 if (flag_gen_aux_info)
2510 fclose (aux_info_file);
2512 unlink (aux_info_file_name);
2516 fclose (rtl_dump_file);
2519 fclose (jump_opt_dump_file);
2522 fclose (cse_dump_file);
2525 fclose (loop_dump_file);
2528 fclose (cse2_dump_file);
2531 fclose (flow_dump_file);
2535 dump_combine_total_stats (combine_dump_file);
2536 fclose (combine_dump_file);
2540 fclose (sched_dump_file);
2543 fclose (local_reg_dump_file);
2545 if (global_reg_dump)
2546 fclose (global_reg_dump_file);
2549 fclose (sched2_dump_file);
2552 fclose (jump2_opt_dump_file);
2555 fclose (dbr_sched_dump_file);
2559 fclose (stack_reg_dump_file);
2562 /* Close non-debugging input and output files. Take special care to note
2563 whether fclose returns an error, since the pages might still be on the
2564 buffer chain while the file is open. */
2567 if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
2568 fatal_io_error (asm_file_name);
2570 /* Print the times. */
2574 fprintf (stderr,"\n");
2575 print_time ("parse", parse_time);
2577 if (!output_bytecode)
2579 print_time ("integration", integration_time);
2580 print_time ("jump", jump_time);
2581 print_time ("cse", cse_time);
2582 print_time ("loop", loop_time);
2583 print_time ("cse2", cse2_time);
2584 print_time ("flow", flow_time);
2585 print_time ("combine", combine_time);
2586 print_time ("sched", sched_time);
2587 print_time ("local-alloc", local_alloc_time);
2588 print_time ("global-alloc", global_alloc_time);
2589 print_time ("sched2", sched2_time);
2590 print_time ("dbranch", dbr_sched_time);
2591 print_time ("shorten-branch", shorten_branch_time);
2592 print_time ("stack-reg", stack_reg_time);
2593 print_time ("final", final_time);
2594 print_time ("varconst", varconst_time);
2595 print_time ("symout", symout_time);
2596 print_time ("dump", dump_time);
2601 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2602 and TYPE_DECL nodes.
2604 This does nothing for local (non-static) variables.
2605 Otherwise, it sets up the RTL and outputs any assembler code
2606 (label definition, storage allocation and initialization).
2608 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2609 the assembler symbol name to be used. TOP_LEVEL is nonzero
2610 if this declaration is not within a function. */
2613 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2619 /* Declarations of variables, and of functions defined elsewhere. */
2621 /* The most obvious approach, to put an #ifndef around where
2622 this macro is used, doesn't work since it's inside a macro call. */
2623 #ifndef ASM_FINISH_DECLARE_OBJECT
2624 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2627 /* Forward declarations for nested functions are not "external",
2628 but we need to treat them as if they were. */
2629 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2630 || TREE_CODE (decl) == FUNCTION_DECL)
2631 TIMEVAR (varconst_time,
2633 make_decl_rtl (decl, asmspec, top_level);
2634 /* Initialized extern variable exists to be replaced
2635 with its value, or represents something that will be
2636 output in another file. */
2637 if (! (TREE_CODE (decl) == VAR_DECL
2638 && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
2639 && DECL_INITIAL (decl) != 0
2640 && DECL_INITIAL (decl) != error_mark_node))
2641 /* Don't output anything
2642 when a tentative file-scope definition is seen.
2643 But at end of compilation, do output code for them. */
2644 if (! (! at_end && top_level
2645 && (DECL_INITIAL (decl) == 0
2646 || DECL_INITIAL (decl) == error_mark_node)))
2647 assemble_variable (decl, top_level, at_end, 0);
2648 if (decl == last_assemble_variable_decl)
2650 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2654 else if (DECL_REGISTER (decl) && asmspec != 0)
2656 if (decode_reg_name (asmspec) >= 0)
2658 DECL_RTL (decl) = 0;
2659 make_decl_rtl (decl, asmspec, top_level);
2662 error ("invalid register name `%s' for register variable", asmspec);
2664 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2665 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2666 && TREE_CODE (decl) == TYPE_DECL)
2667 TIMEVAR (symout_time, dbxout_symbol (decl, 0));
2669 #ifdef SDB_DEBUGGING_INFO
2670 else if (write_symbols == SDB_DEBUG && top_level
2671 && TREE_CODE (decl) == TYPE_DECL)
2672 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
2676 /* Called after finishing a record, union or enumeral type. */
2679 rest_of_type_compilation (type, toplev)
2683 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2684 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2685 TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
2687 #ifdef SDB_DEBUGGING_INFO
2688 if (write_symbols == SDB_DEBUG)
2689 TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
2693 /* This is called from finish_function (within yyparse)
2694 after each top-level definition is parsed.
2695 It is supposed to compile that function or variable
2696 and output the assembler code for it.
2697 After we return, the tree storage is freed. */
2700 rest_of_compilation (decl)
2704 int start_time = get_run_time ();
2706 /* Nonzero if we have saved the original DECL_INITIAL of the function,
2707 to be restored after we finish compiling the function
2708 (for use when compiling inline calls to this function). */
2709 tree saved_block_tree = 0;
2710 /* Likewise, for DECL_ARGUMENTS. */
2711 tree saved_arguments = 0;
2714 if (output_bytecode)
2717 /* If we are reconsidering an inline function
2718 at the end of compilation, skip the stuff for making it inline. */
2720 if (DECL_SAVED_INSNS (decl) == 0)
2722 int specd = DECL_INLINE (decl);
2725 /* If requested, consider whether to make this function inline. */
2726 if (specd || flag_inline_functions)
2727 TIMEVAR (integration_time,
2729 lose = function_cannot_inline_p (decl);
2730 /* If not optimzing, then make sure the DECL_INLINE
2732 if (lose || ! optimize)
2734 if (warn_inline && specd)
2735 warning_with_decl (decl, lose);
2736 DECL_INLINE (decl) = 0;
2737 DECL_ABSTRACT_ORIGIN (decl) = 0;
2738 /* Don't really compile an extern inline function.
2739 If we can't make it inline, pretend
2740 it was only declared. */
2741 if (DECL_EXTERNAL (decl))
2743 DECL_INITIAL (decl) = 0;
2744 goto exit_rest_of_compilation;
2748 DECL_INLINE (decl) = 1;
2751 insns = get_insns ();
2753 /* Dump the rtl code if we are dumping rtl. */
2758 fprintf (rtl_dump_file, "\n;; Function %s\n\n",
2759 IDENTIFIER_POINTER (DECL_NAME (decl)));
2760 if (DECL_SAVED_INSNS (decl))
2761 fprintf (rtl_dump_file, ";; (integrable)\n\n");
2762 print_rtl (rtl_dump_file, insns);
2763 fflush (rtl_dump_file);
2766 /* If function is inline, and we don't yet know whether to
2767 compile it by itself, defer decision till end of compilation.
2768 finish_compilation will call rest_of_compilation again
2769 for those functions that need to be output. Also defer those
2770 functions that were marked inline but weren't inlined; they
2771 may never be used. */
2773 if ((specd || DECL_INLINE (decl))
2774 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2775 && ! flag_keep_inline_functions)
2776 || DECL_DEFER_OUTPUT (decl)
2777 || DECL_EXTERNAL (decl)))
2779 #ifdef DWARF_DEBUGGING_INFO
2780 /* Generate the DWARF info for the "abstract" instance
2781 of a function which we may later generate inlined and/or
2782 out-of-line instances of. */
2783 if (write_symbols == DWARF_DEBUG)
2785 set_decl_abstract_flags (decl, 1);
2786 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
2787 set_decl_abstract_flags (decl, 0);
2790 TIMEVAR (integration_time, save_for_inline_nocopy (decl));
2791 goto exit_rest_of_compilation;
2794 /* If we have to compile the function now, save its rtl and subdecls
2795 so that its compilation will not affect what others get. */
2796 if (DECL_INLINE (decl))
2798 #ifdef DWARF_DEBUGGING_INFO
2799 /* Generate the DWARF info for the "abstract" instance of
2800 a function which we will generate an out-of-line instance
2801 of almost immediately (and which we may also later generate
2802 various inlined instances of). */
2803 if (write_symbols == DWARF_DEBUG)
2805 set_decl_abstract_flags (decl, 1);
2806 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
2807 set_decl_abstract_flags (decl, 0);
2810 saved_block_tree = DECL_INITIAL (decl);
2811 saved_arguments = DECL_ARGUMENTS (decl);
2812 TIMEVAR (integration_time, save_for_inline_copying (decl));
2816 if (DECL_DEFER_OUTPUT (decl))
2817 goto exit_rest_of_compilation;
2819 TREE_ASM_WRITTEN (decl) = 1;
2821 /* Now that integrate will no longer see our rtl, we need not distinguish
2822 between the return value of this function and the return value of called
2824 rtx_equal_function_value_matters = 0;
2826 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
2827 if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
2829 goto exit_rest_of_compilation;
2832 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
2833 Note that that may have been done above, in save_for_inline_copying.
2834 The call to resume_temporary_allocation near the end of this function
2835 goes back to the usual state of affairs. */
2837 rtl_in_current_obstack ();
2840 /* If we are doing position-independent code generation, now
2841 is the time to output special prologues and epilogues.
2842 We do not want to do this earlier, because it just clutters
2843 up inline functions with meaningless insns. */
2848 insns = get_insns ();
2850 /* Copy any shared structure that should not be shared. */
2852 unshare_all_rtl (insns);
2854 /* Instantiate all virtual registers. */
2856 instantiate_virtual_regs (current_function_decl, get_insns ());
2858 /* See if we have allocated stack slots that are not directly addressable.
2859 If so, scan all the insns and create explicit address computation
2860 for all references to such slots. */
2861 /* fixup_stack_slots (); */
2863 /* Do jump optimization the first time, if -opt.
2864 Also do it if -W, but in that case it doesn't change the rtl code,
2865 it only computes whether control can drop off the end of the function. */
2867 if (optimize > 0 || extra_warnings || warn_return_type
2868 /* If function is `noreturn', we should warn if it tries to return. */
2869 || TREE_THIS_VOLATILE (decl))
2871 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
2872 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
2875 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
2876 if (rtl_dump_and_exit || flag_syntax_only)
2877 goto exit_rest_of_compilation;
2879 /* Dump rtl code after jump, if we are doing that. */
2884 fprintf (jump_opt_dump_file, "\n;; Function %s\n\n",
2885 IDENTIFIER_POINTER (DECL_NAME (decl)));
2886 print_rtl (jump_opt_dump_file, insns);
2887 fflush (jump_opt_dump_file);
2890 /* Perform common subexpression elimination.
2891 Nonzero value from `cse_main' means that jumps were simplified
2892 and some code may now be unreachable, so do
2893 jump optimization again. */
2898 fprintf (cse_dump_file, "\n;; Function %s\n\n",
2899 IDENTIFIER_POINTER (DECL_NAME (decl)));
2904 TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
2906 if (flag_thread_jumps)
2907 /* Hacks by tiemann & kenner. */
2908 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 1));
2910 TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
2912 TIMEVAR (cse_time, delete_dead_from_cse (insns, max_reg_num ()));
2915 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
2918 /* Dump rtl code after cse, if we are doing that. */
2923 print_rtl (cse_dump_file, insns);
2924 fflush (cse_dump_file);
2930 fprintf (loop_dump_file, "\n;; Function %s\n\n",
2931 IDENTIFIER_POINTER (DECL_NAME (decl)));
2934 /* Move constant computations out of loops. */
2940 loop_optimize (insns, loop_dump_file);
2944 /* Dump rtl code after loop opt, if we are doing that. */
2949 print_rtl (loop_dump_file, insns);
2950 fflush (loop_dump_file);
2956 fprintf (cse2_dump_file, "\n;; Function %s\n\n",
2957 IDENTIFIER_POINTER (DECL_NAME (decl)));
2960 if (optimize > 0 && flag_rerun_cse_after_loop)
2962 /* Running another jump optimization pass before the second
2963 cse pass sometimes simplifies the RTL enough to allow
2964 the second CSE pass to do a better job. Jump_optimize can change
2965 max_reg_num so we must rerun reg_scan afterwards.
2966 ??? Rework to not call reg_scan so often. */
2967 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
2968 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
2970 TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
2971 TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
2972 1, cse2_dump_file));
2974 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
2977 if (optimize > 0 && flag_thread_jumps)
2978 /* This pass of jump threading straightens out code
2979 that was kinked by loop optimization. */
2980 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
2982 /* Dump rtl code after cse, if we are doing that. */
2987 print_rtl (cse2_dump_file, insns);
2988 fflush (cse2_dump_file);
2991 /* We are no longer anticipating cse in this function, at least. */
2993 cse_not_expected = 1;
2995 /* Now we choose between stupid (pcc-like) register allocation
2996 (if we got the -noreg switch and not -opt)
2997 and smart register allocation. */
2999 if (optimize > 0) /* Stupid allocation probably won't work */
3000 obey_regdecls = 0; /* if optimizations being done. */
3004 /* Print function header into flow dump now
3005 because doing the flow analysis makes some of the dump. */
3010 fprintf (flow_dump_file, "\n;; Function %s\n\n",
3011 IDENTIFIER_POINTER (DECL_NAME (decl)));
3018 regclass (insns, max_reg_num ());
3019 stupid_life_analysis (insns, max_reg_num (),
3025 /* Do control and data flow analysis,
3026 and write some of the results to dump file. */
3028 TIMEVAR (flow_time, flow_analysis (insns, max_reg_num (),
3030 if (warn_uninitialized)
3032 uninitialized_vars_warning (DECL_INITIAL (decl));
3033 setjmp_args_warning ();
3037 /* Dump rtl after flow analysis. */
3042 print_rtl (flow_dump_file, insns);
3043 fflush (flow_dump_file);
3046 /* If -opt, try combining insns through substitution. */
3049 TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
3051 /* Dump rtl code after insn combination. */
3056 fprintf (combine_dump_file, "\n;; Function %s\n\n",
3057 IDENTIFIER_POINTER (DECL_NAME (decl)));
3058 dump_combine_stats (combine_dump_file);
3059 print_rtl (combine_dump_file, insns);
3060 fflush (combine_dump_file);
3063 /* Print function header into sched dump now
3064 because doing the sched analysis makes some of the dump. */
3069 fprintf (sched_dump_file, "\n;; Function %s\n\n",
3070 IDENTIFIER_POINTER (DECL_NAME (decl)));
3073 if (optimize > 0 && flag_schedule_insns)
3075 /* Do control and data sched analysis,
3076 and write some of the results to dump file. */
3078 TIMEVAR (sched_time, schedule_insns (sched_dump_file));
3081 /* Dump rtl after instruction scheduling. */
3086 print_rtl (sched_dump_file, insns);
3087 fflush (sched_dump_file);
3090 /* Unless we did stupid register allocation,
3091 allocate pseudo-regs that are used only within 1 basic block. */
3094 TIMEVAR (local_alloc_time,
3096 regclass (insns, max_reg_num ());
3100 /* Dump rtl code after allocating regs within basic blocks. */
3105 fprintf (local_reg_dump_file, "\n;; Function %s\n\n",
3106 IDENTIFIER_POINTER (DECL_NAME (decl)));
3107 dump_flow_info (local_reg_dump_file);
3108 dump_local_alloc (local_reg_dump_file);
3109 print_rtl (local_reg_dump_file, insns);
3110 fflush (local_reg_dump_file);
3113 if (global_reg_dump)
3115 fprintf (global_reg_dump_file, "\n;; Function %s\n\n",
3116 IDENTIFIER_POINTER (DECL_NAME (decl))));
3118 /* Unless we did stupid register allocation,
3119 allocate remaining pseudo-regs, then do the reload pass
3120 fixing up any insns that are invalid. */
3122 TIMEVAR (global_alloc_time,
3125 failure = global_alloc (global_reg_dump_file);
3127 failure = reload (insns, 0, global_reg_dump_file);
3130 if (global_reg_dump)
3133 dump_global_regs (global_reg_dump_file);
3134 print_rtl (global_reg_dump_file, insns);
3135 fflush (global_reg_dump_file);
3139 goto exit_rest_of_compilation;
3141 reload_completed = 1;
3143 /* On some machines, the prologue and epilogue code, or parts thereof,
3144 can be represented as RTL. Doing so lets us schedule insns between
3145 it and the rest of the code and also allows delayed branch
3146 scheduling to operate in the epilogue. */
3148 thread_prologue_and_epilogue_insns (insns);
3150 if (optimize > 0 && flag_schedule_insns_after_reload)
3155 fprintf (sched2_dump_file, "\n;; Function %s\n\n",
3156 IDENTIFIER_POINTER (DECL_NAME (decl)));
3159 /* Do control and data sched analysis again,
3160 and write some more of the results to dump file. */
3162 TIMEVAR (sched2_time, schedule_insns (sched2_dump_file));
3164 /* Dump rtl after post-reorder instruction scheduling. */
3169 print_rtl (sched2_dump_file, insns);
3170 fflush (sched2_dump_file);
3174 #ifdef LEAF_REGISTERS
3176 if (optimize > 0 && only_leaf_regs_used () && leaf_function_p ())
3180 /* One more attempt to remove jumps to .+1
3181 left by dead-store-elimination.
3182 Also do cross-jumping this time
3183 and delete no-op move insns. */
3187 TIMEVAR (jump_time, jump_optimize (insns, 1, 1, 0));
3190 /* Dump rtl code after jump, if we are doing that. */
3195 fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n",
3196 IDENTIFIER_POINTER (DECL_NAME (decl)));
3197 print_rtl (jump2_opt_dump_file, insns);
3198 fflush (jump2_opt_dump_file);
3201 /* If a machine dependent reorganization is needed, call it. */
3202 #ifdef MACHINE_DEPENDENT_REORG
3203 MACHINE_DEPENDENT_REORG (insns);
3206 /* If a scheduling pass for delayed branches is to be done,
3207 call the scheduling code. */
3210 if (optimize > 0 && flag_delayed_branch)
3212 TIMEVAR (dbr_sched_time, dbr_schedule (insns, dbr_sched_dump_file));
3217 fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n",
3218 IDENTIFIER_POINTER (DECL_NAME (decl)));
3219 print_rtl (dbr_sched_dump_file, insns);
3220 fflush (dbr_sched_dump_file);
3227 /* Shorten branches. */
3228 TIMEVAR (shorten_branch_time,
3230 shorten_branches (get_insns ());
3234 TIMEVAR (stack_reg_time, reg_to_stack (insns, stack_reg_dump_file));
3239 fprintf (stack_reg_dump_file, "\n;; Function %s\n\n",
3240 IDENTIFIER_POINTER (DECL_NAME (decl)));
3241 print_rtl (stack_reg_dump_file, insns);
3242 fflush (stack_reg_dump_file);
3247 /* Now turn the rtl into assembler code. */
3249 TIMEVAR (final_time,
3254 /* Get the function's name, as described by its RTL.
3255 This may be different from the DECL_NAME name used
3256 in the source file. */
3258 x = DECL_RTL (decl);
3259 if (GET_CODE (x) != MEM)
3262 if (GET_CODE (x) != SYMBOL_REF)
3264 fnname = XSTR (x, 0);
3266 assemble_start_function (decl, fnname);
3267 final_start_function (insns, asm_out_file, optimize);
3268 final (insns, asm_out_file, optimize, 0);
3269 final_end_function (insns, asm_out_file, optimize);
3270 assemble_end_function (decl, fnname);
3271 fflush (asm_out_file);
3274 /* Write DBX symbols if requested */
3276 /* Note that for those inline functions where we don't initially
3277 know for certain that we will be generating an out-of-line copy,
3278 the first invocation of this routine (rest_of_compilation) will
3279 skip over this code by doing a `goto exit_rest_of_compilation;'.
3280 Later on, finish_compilation will call rest_of_compilation again
3281 for those inline functions that need to have out-of-line copies
3282 generated. During that call, we *will* be routed past here. */
3284 #ifdef DBX_DEBUGGING_INFO
3285 if (write_symbols == DBX_DEBUG)
3286 TIMEVAR (symout_time, dbxout_function (decl));
3289 #ifdef DWARF_DEBUGGING_INFO
3290 if (write_symbols == DWARF_DEBUG)
3291 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
3294 exit_rest_of_compilation:
3296 /* In case the function was not output,
3297 don't leave any temporary anonymous types
3298 queued up for sdb output. */
3299 #ifdef SDB_DEBUGGING_INFO
3300 if (write_symbols == SDB_DEBUG)
3301 sdbout_types (NULL_TREE);
3304 /* Put back the tree of subblocks and list of arguments
3305 from before we copied them.
3306 Code generation and the output of debugging info may have modified
3307 the copy, but the original is unchanged. */
3309 if (saved_block_tree != 0)
3310 DECL_INITIAL (decl) = saved_block_tree;
3311 if (saved_arguments != 0)
3312 DECL_ARGUMENTS (decl) = saved_arguments;
3314 reload_completed = 0;
3316 /* Clear out the real_constant_chain before some of the rtx's
3317 it runs through become garbage. */
3319 clear_const_double_mem ();
3321 /* Cancel the effect of rtl_in_current_obstack. */
3323 resume_temporary_allocation ();
3325 /* The parsing time is all the time spent in yyparse
3326 *except* what is spent in this function. */
3328 parse_time -= get_run_time () - start_time;
3331 /* Entry point of cc1/c++. Decode command args, then call compile_file.
3332 Exit code is 35 if can't open files, 34 if fatal error,
3333 33 if had nonfatal errors, else success. */
3336 main (argc, argv, envp)
3343 int flag_print_mem = 0;
3344 int version_flag = 0;
3347 /* save in case md file wants to emit args as a comment. */
3351 p = argv[0] + strlen (argv[0]);
3352 while (p != argv[0] && p[-1] != '/') --p;
3356 /* Get rid of any avoidable limit on stack size. */
3360 /* Set the stack limit huge so that alloca does not fail. */
3361 getrlimit (RLIMIT_STACK, &rlim);
3362 rlim.rlim_cur = rlim.rlim_max;
3363 setrlimit (RLIMIT_STACK, &rlim);
3365 #endif /* RLIMIT_STACK */
3367 signal (SIGFPE, float_signal);
3370 signal (SIGPIPE, pipe_closed);
3373 decl_printable_name = decl_name;
3374 lang_expand_expr = (struct rtx_def *(*)()) do_abort;
3375 interim_eh_hook = interim_eh;
3377 /* Initialize whether `char' is signed. */
3378 flag_signed_char = DEFAULT_SIGNED_CHAR;
3379 #ifdef DEFAULT_SHORT_ENUMS
3380 /* Initialize how much space enums occupy, by default. */
3381 flag_short_enums = DEFAULT_SHORT_ENUMS;
3384 /* Scan to see what optimization level has been specified. That will
3385 determine the default value of many flags. */
3386 for (i = 1; i < argc; i++)
3388 if (!strcmp (argv[i], "-O"))
3392 else if (argv[i][0] == '-' && argv[i][1] == 'O')
3394 /* Handle -O2, -O3, -O69, ... */
3395 char *p = &argv[i][2];
3399 if (! (c >= '0' && c <= '9'))
3402 optimize = atoi (&argv[i][2]);
3406 obey_regdecls = (optimize == 0);
3416 flag_thread_jumps = 1;
3418 flag_delayed_branch = 1;
3420 #ifdef CAN_DEBUG_WITHOUT_FP
3421 flag_omit_frame_pointer = 1;
3427 flag_cse_follow_jumps = 1;
3428 flag_cse_skip_blocks = 1;
3429 flag_expensive_optimizations = 1;
3430 flag_strength_reduce = 1;
3431 flag_rerun_cse_after_loop = 1;
3432 flag_caller_saves = 1;
3433 #ifdef INSN_SCHEDULING
3434 flag_schedule_insns = 1;
3435 flag_schedule_insns_after_reload = 1;
3441 flag_inline_functions = 1;
3444 #ifdef OPTIMIZATION_OPTIONS
3445 /* Allow default optimizations to be specified on a per-machine basis. */
3446 OPTIMIZATION_OPTIONS (optimize);
3449 /* Initialize register usage now so switches may override. */
3453 set_target_switch ("");
3455 for (i = 1; i < argc; i++)
3458 /* If this is a language-specific option,
3459 decode it in a language-specific way. */
3460 for (j = 0; lang_options[j] != 0; j++)
3461 if (!strncmp (argv[i], lang_options[j],
3462 strlen (lang_options[j])))
3464 if (lang_options[j] != 0)
3465 /* If the option is valid for *some* language,
3466 treat it as valid even if this language doesn't understand it. */
3467 lang_decode_option (argv[i]);
3468 else if (argv[i][0] == '-' && argv[i][1] != 0)
3470 register char *str = argv[i] + 1;
3475 set_target_switch (&str[1]);
3476 else if (!strcmp (str, "dumpbase"))
3478 dump_base_name = argv[++i];
3480 else if (str[0] == 'd')
3482 register char *p = &str[1];
3490 global_reg_dump = 1;
3496 cse_dump = 1, cse2_dump = 1;
3514 global_reg_dump = 1;
3532 flag_print_asm_name = 1;
3554 rtl_dump_and_exit = 1;
3558 else if (str[0] == 'f')
3560 register char *p = &str[1];
3563 /* Some kind of -f option.
3564 P's value is the option sans `-f'.
3565 Search for it in the table of options. */
3568 !found && j < sizeof (f_options) / sizeof (f_options[0]);
3571 if (!strcmp (p, f_options[j].string))
3573 *f_options[j].variable = f_options[j].on_value;
3574 /* A goto here would be cleaner,
3575 but breaks the vax pcc. */
3578 if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
3579 && ! strcmp (p+3, f_options[j].string))
3581 *f_options[j].variable = ! f_options[j].on_value;
3588 else if (!strncmp (p, "fixed-", 6))
3589 fix_register (&p[6], 1, 1);
3590 else if (!strncmp (p, "call-used-", 10))
3591 fix_register (&p[10], 0, 1);
3592 else if (!strncmp (p, "call-saved-", 11))
3593 fix_register (&p[11], 0, 0);
3595 error ("Invalid option `%s'", argv[i]);
3597 else if (str[0] == 'O')
3599 register char *p = str+1;
3600 while (*p && *p >= '0' && *p <= '9')
3605 error ("Invalid option `%s'", argv[i]);
3607 else if (!strcmp (str, "pedantic"))
3609 else if (!strcmp (str, "pedantic-errors"))
3610 flag_pedantic_errors = pedantic = 1;
3611 else if (!strcmp (str, "quiet"))
3613 else if (!strcmp (str, "version"))
3615 else if (!strcmp (str, "w"))
3616 inhibit_warnings = 1;
3617 else if (!strcmp (str, "W"))
3620 /* We save the value of warn_uninitialized, since if they put
3621 -Wuninitialized on the command line, we need to generate a
3622 warning about not using it without also specifying -O. */
3623 if (warn_uninitialized != 1)
3624 warn_uninitialized = 2;
3626 else if (str[0] == 'W')
3628 register char *p = &str[1];
3631 /* Some kind of -W option.
3632 P's value is the option sans `-W'.
3633 Search for it in the table of options. */
3636 !found && j < sizeof (W_options) / sizeof (W_options[0]);
3639 if (!strcmp (p, W_options[j].string))
3641 *W_options[j].variable = W_options[j].on_value;
3642 /* A goto here would be cleaner,
3643 but breaks the vax pcc. */
3646 if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
3647 && ! strcmp (p+3, W_options[j].string))
3649 *W_options[j].variable = ! W_options[j].on_value;
3656 else if (!strncmp (p, "id-clash-", 9))
3662 if (*endp >= '0' && *endp <= '9')
3666 error ("Invalid option `%s'", argv[i]);
3671 id_clash_len = atoi (str + 10);
3674 else if (!strncmp (p, "larger-than-", 12))
3676 char *endp = p + 12;
3680 if (*endp >= '0' && *endp <= '9')
3684 error ("Invalid option `%s'", argv[i]);
3685 goto larger_than_lose;
3688 warn_larger_than = 1;
3689 larger_than_size = atoi (str + 13);
3693 error ("Invalid option `%s'", argv[i]);
3695 else if (!strcmp (str, "p"))
3697 if (!output_bytecode)
3700 error ("profiling not supported in bytecode compilation");
3702 else if (!strcmp (str, "a"))
3704 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
3705 warning ("`-a' option (basic block profile) not supported");
3707 profile_block_flag = 1;
3710 else if (str[0] == 'g')
3717 while (*p && (*p < '0' || *p > '9'))
3721 while (*q && (*q >= '0' && *q <= '9'))
3726 level = 2; /* default debugging info level */
3727 if (*q || level > 3)
3729 warning ("invalid debug level specification in option: `-%s'",
3731 warning ("no debugging information will be generated");
3735 /* If more than one debugging type is supported,
3736 you must define PREFERRED_DEBUGGING_TYPE
3737 to choose a format in a system-dependent way. */
3738 /* This is one long line cause VAXC can't handle a \-newline. */
3739 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
3740 #ifdef PREFERRED_DEBUGGING_TYPE
3741 if (!strncmp (str, "ggdb", len))
3742 write_symbols = PREFERRED_DEBUGGING_TYPE;
3743 #else /* no PREFERRED_DEBUGGING_TYPE */
3744 You Lose! You must define PREFERRED_DEBUGGING_TYPE!
3745 #endif /* no PREFERRED_DEBUGGING_TYPE */
3746 #endif /* More than one debugger format enabled. */
3747 #ifdef DBX_DEBUGGING_INFO
3748 if (write_symbols != NO_DEBUG)
3750 else if (!strncmp (str, "ggdb", len))
3751 write_symbols = DBX_DEBUG;
3752 else if (!strncmp (str, "gstabs", len))
3753 write_symbols = DBX_DEBUG;
3754 else if (!strncmp (str, "gstabs+", len))
3755 write_symbols = DBX_DEBUG;
3757 /* Always enable extensions for -ggdb or -gstabs+,
3758 always disable for -gstabs.
3759 For plain -g, use system-specific default. */
3760 if (write_symbols == DBX_DEBUG && !strncmp (str, "ggdb", len)
3762 use_gnu_debug_info_extensions = 1;
3763 else if (write_symbols == DBX_DEBUG && !strncmp (str, "gstabs+", len)
3765 use_gnu_debug_info_extensions = 1;
3766 else if (write_symbols == DBX_DEBUG
3767 && !strncmp (str, "gstabs", len) && len >= 2)
3768 use_gnu_debug_info_extensions = 0;
3770 use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
3771 #endif /* DBX_DEBUGGING_INFO */
3772 #ifdef DWARF_DEBUGGING_INFO
3773 if (write_symbols != NO_DEBUG)
3775 else if (!strncmp (str, "g", len))
3776 write_symbols = DWARF_DEBUG;
3777 else if (!strncmp (str, "ggdb", len))
3778 write_symbols = DWARF_DEBUG;
3779 else if (!strncmp (str, "gdwarf", len))
3780 write_symbols = DWARF_DEBUG;
3782 /* Always enable extensions for -ggdb or -gdwarf+,
3783 always disable for -gdwarf.
3784 For plain -g, use system-specific default. */
3785 if (write_symbols == DWARF_DEBUG && !strncmp (str, "ggdb", len)
3787 use_gnu_debug_info_extensions = 1;
3788 else if (write_symbols == DWARF_DEBUG && !strcmp (str, "gdwarf+"))
3789 use_gnu_debug_info_extensions = 1;
3790 else if (write_symbols == DWARF_DEBUG
3791 && !strncmp (str, "gdwarf", len) && len >= 2)
3792 use_gnu_debug_info_extensions = 0;
3794 use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
3796 #ifdef SDB_DEBUGGING_INFO
3797 if (write_symbols != NO_DEBUG)
3799 else if (!strncmp (str, "g", len))
3800 write_symbols = SDB_DEBUG;
3801 else if (!strncmp (str, "gdb", len))
3802 write_symbols = SDB_DEBUG;
3803 else if (!strncmp (str, "gcoff", len))
3804 write_symbols = SDB_DEBUG;
3805 #endif /* SDB_DEBUGGING_INFO */
3806 #ifdef XCOFF_DEBUGGING_INFO
3807 if (write_symbols != NO_DEBUG)
3809 else if (!strncmp (str, "g", len))
3810 write_symbols = XCOFF_DEBUG;
3811 else if (!strncmp (str, "ggdb", len))
3812 write_symbols = XCOFF_DEBUG;
3813 else if (!strncmp (str, "gxcoff", len))
3814 write_symbols = XCOFF_DEBUG;
3816 /* Always enable extensions for -ggdb or -gxcoff+,
3817 always disable for -gxcoff.
3818 For plain -g, use system-specific default. */
3819 if (write_symbols == XCOFF_DEBUG && !strncmp (str, "ggdb", len)
3821 use_gnu_debug_info_extensions = 1;
3822 else if (write_symbols == XCOFF_DEBUG && !strcmp (str, "gxcoff+"))
3823 use_gnu_debug_info_extensions = 1;
3824 else if (write_symbols == XCOFF_DEBUG
3825 && !strncmp (str, "gxcoff", len) && len >= 2)
3826 use_gnu_debug_info_extensions = 0;
3828 use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
3830 if (write_symbols == NO_DEBUG)
3831 warning ("`-%s' option not supported on this version of GCC", str);
3832 else if (level == 0)
3833 write_symbols = NO_DEBUG;
3835 debug_info_level = (enum debug_info_level) level;
3837 else if (!strcmp (str, "o"))
3839 asm_file_name = argv[++i];
3841 else if (str[0] == 'G')
3843 g_switch_set = TRUE;
3844 g_switch_value = atoi ((str[1] != '\0') ? str+1 : argv[++i]);
3846 else if (!strncmp (str, "aux-info", 8))
3848 flag_gen_aux_info = 1;
3849 aux_info_file_name = (str[8] != '\0' ? str+8 : argv[++i]);
3852 error ("Invalid option `%s'", argv[i]);
3854 else if (argv[i][0] == '+')
3855 error ("Invalid option `%s'", argv[i]);
3860 /* Initialize for bytecode output. A good idea to do this as soon as
3861 possible after the "-f" options have been parsed. */
3862 if (output_bytecode)
3864 #ifndef TARGET_SUPPORTS_BYTECODE
3865 /* Just die with a fatal error if not supported */
3866 fatal ("-fbytecode not supporter for this target");
3874 /* Inlining does not work if not optimizing,
3875 so force it not to be done. */
3879 /* The c_decode_option and lang_decode_option functions set
3880 this to `2' if -Wall is used, so we can avoid giving out
3881 lots of errors for people who don't realize what -Wall does. */
3882 if (warn_uninitialized == 1)
3883 warning ("-Wuninitialized is not supported without -O");
3886 #if defined(DWARF_DEBUGGING_INFO)
3887 if (write_symbols == DWARF_DEBUG
3888 && strcmp (language_string, "GNU C++") == 0)
3890 warning ("-g option not supported for C++ on SVR4 systems");
3891 write_symbols = NO_DEBUG;
3893 #endif /* defined(DWARF_DEBUGGING_INFO) */
3895 #ifdef OVERRIDE_OPTIONS
3896 /* Some machines may reject certain combinations of options. */
3900 /* Unrolling all loops implies that standard loop unrolling must also
3902 if (flag_unroll_all_loops)
3903 flag_unroll_loops = 1;
3904 /* Loop unrolling requires that strength_reduction be on also. Silently
3905 turn on strength reduction here if it isn't already on. Also, the loop
3906 unrolling code assumes that cse will be run after loop, so that must
3907 be turned on also. */
3908 if (flag_unroll_loops)
3910 flag_strength_reduce = 1;
3911 flag_rerun_cse_after_loop = 1;
3914 /* Warn about options that are not supported on this machine. */
3915 #ifndef INSN_SCHEDULING
3916 if (flag_schedule_insns || flag_schedule_insns_after_reload)
3917 warning ("instruction scheduling not supported on this target machine");
3920 if (flag_delayed_branch)
3921 warning ("this target machine does not have delayed branches");
3924 /* If we are in verbose mode, write out the version and maybe all the
3925 option flags in use. */
3928 fprintf (stderr, "%s version %s", language_string, version_string);
3929 #ifdef TARGET_VERSION
3934 #define __VERSION__ "[unknown]"
3936 fprintf (stderr, " compiled by GNU C version %s.\n", __VERSION__);
3938 fprintf (stderr, " compiled by CC.\n");
3941 print_switch_values ();
3944 compile_file (filename);
3953 char *lim = (char *) sbrk (0);
3955 fprintf (stderr, "Data size %d.\n",
3956 lim - (char *) &environ);
3960 system ("ps -l 1>&2");
3963 #endif /* not USG */
3965 #endif /* not VMS */
3966 #endif /* not OS2 */
3969 exit (FATAL_EXIT_CODE);
3971 exit (FATAL_EXIT_CODE);
3972 exit (SUCCESS_EXIT_CODE);
3976 /* Decode -m switches. */
3978 /* Here is a table, controlled by the tm.h file, listing each -m switch
3979 and which bits in `target_switches' it should set or clear.
3980 If VALUE is positive, it is bits to set.
3981 If VALUE is negative, -VALUE is bits to clear.
3982 (The sign bit is not used so there is no confusion.) */
3984 struct {char *name; int value;} target_switches []
3987 /* This table is similar, but allows the switch to have a value. */
3989 #ifdef TARGET_OPTIONS
3990 struct {char *prefix; char ** variable;} target_options []
3994 /* Decode the switch -mNAME. */
3997 set_target_switch (name)
4003 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
4004 if (!strcmp (target_switches[j].name, name))
4006 if (target_switches[j].value < 0)
4007 target_flags &= ~-target_switches[j].value;
4009 target_flags |= target_switches[j].value;
4013 #ifdef TARGET_OPTIONS
4015 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
4017 int len = strlen (target_options[j].prefix);
4018 if (!strncmp (target_options[j].prefix, name, len))
4020 *target_options[j].variable = name + len;
4027 error ("Invalid option `%s'", name);
4030 /* Variable used for communication between the following two routines. */
4032 static int line_position;
4034 /* Print an option value and adjust the position in the line. */
4037 print_single_switch (type, name)
4040 fprintf (stderr, " %s%s", type, name);
4042 line_position += strlen (type) + strlen (name) + 1;
4044 if (line_position > 65)
4046 fprintf (stderr, "\n\t");
4051 /* Print default target switches for -version. */
4054 print_switch_values ()
4058 fprintf (stderr, "enabled:");
4061 for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
4062 if (*f_options[j].variable == f_options[j].on_value)
4063 print_single_switch ("-f", f_options[j].string);
4065 for (j = 0; j < sizeof W_options / sizeof W_options[0]; j++)
4066 if (*W_options[j].variable == W_options[j].on_value)
4067 print_single_switch ("-W", W_options[j].string);
4069 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
4070 if (target_switches[j].name[0] != '\0'
4071 && target_switches[j].value > 0
4072 && ((target_switches[j].value & target_flags)
4073 == target_switches[j].value))
4074 print_single_switch ("-m", target_switches[j].name);
4076 fprintf (stderr, "\n");