OSDN Git Service

(main): If PREFERRED_DEBUGGING_TYPE used and set to NO_DEBUG, say
[pf3gnuchains/gcc-fork.git] / gcc / toplev.c
1 /* Top level of GNU C compiler
2    Copyright (C) 1987, 88, 89, 92-6, 1997 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
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)
9 any later version.
10
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.
15
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.  */
20
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.  */
25
26 #include "config.h"
27 #ifdef __STDC__
28 #include <stdarg.h>
29 #else
30 #include <varargs.h>
31 #endif
32 #include <stdio.h>
33 #include <signal.h>
34 #include <setjmp.h>
35 #include <sys/types.h>
36 #include <ctype.h>
37 #include <sys/stat.h>
38
39 #ifndef _WIN32
40 #ifdef USG
41 #undef FLOAT
42 #include <sys/param.h>
43 /* This is for hpux.  It is a real screw.  They should change hpux.  */
44 #undef FLOAT
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.  */
48 #else
49 #ifndef VMS
50 #include <sys/time.h>
51 #include <sys/resource.h>
52 #endif
53 #endif
54 #endif
55
56 #include "input.h"
57 #include "tree.h"
58 #include "rtl.h"
59 #include "flags.h"
60 #include "insn-attr.h"
61 #include "defaults.h"
62 #include "output.h"
63 #include "bytecode.h"
64 #include "bc-emit.h"
65 #include "except.h"
66
67 #ifdef XCOFF_DEBUGGING_INFO
68 #include "xcoffout.h"
69 #endif
70 \f
71 #ifdef VMS
72 /* The extra parameters substantially improve the I/O performance.  */
73 static FILE *
74 vms_fopen (fname, type)
75      char * fname;
76      char * type;
77 {
78   /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
79      fixed arguments, which matches ANSI's specification but not VAXCRTL's
80      pre-ANSI implementation.  This hack circumvents the mismatch problem.  */
81   FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
82
83   if (*type == 'w')
84     return (*vmslib_fopen) (fname, type, "mbc=32",
85                             "deq=64", "fop=tef", "shr=nil");
86   else
87     return (*vmslib_fopen) (fname, type, "mbc=32");
88 }
89 #define fopen vms_fopen
90 #endif  /* VMS */
91
92 #ifndef DEFAULT_GDB_EXTENSIONS
93 #define DEFAULT_GDB_EXTENSIONS 1
94 #endif
95
96 /* If more than one debugging type is supported, you must define
97    PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way. 
98
99    This is one long line cause VAXC can't handle a \-newline.  */
100 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
101 #ifndef PREFERRED_DEBUGGING_TYPE
102 You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
103 #endif /* no PREFERRED_DEBUGGING_TYPE */
104 #else /* Only one debugging format supported.  Define PREFERRED_DEBUGGING_TYPE
105          so the following code needn't care.  */
106 #ifdef DBX_DEBUGGING_INFO
107 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
108 #endif
109 #ifdef SDB_DEBUGGING_INFO
110 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
111 #endif
112 #ifdef DWARF_DEBUGGING_INFO
113 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
114 #endif
115 #ifdef DWARF2_DEBUGGING_INFO
116 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
117 #endif
118 #ifdef XCOFF_DEBUGGING_INFO
119 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
120 #endif
121 #endif /* More than one debugger format enabled.  */
122
123 /* If still not defined, must have been because no debugging formats
124    are supported.  */
125 #ifndef PREFERRED_DEBUGGING_TYPE
126 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
127 #endif
128
129 extern int rtx_equal_function_value_matters;
130
131 #if ! (defined (VMS) || defined (OS2))
132 extern char **environ;
133 #endif
134 extern char *version_string, *language_string;
135
136 /* Carry information from ASM_DECLARE_OBJECT_NAME
137    to ASM_FINISH_DECLARE_OBJECT.  */
138
139 extern int size_directive_output;
140 extern tree last_assemble_variable_decl;
141
142 extern void init_lex ();
143 extern void init_decl_processing ();
144 extern void init_obstacks ();
145 extern void init_tree_codes ();
146 extern void init_rtl ();
147 extern void init_regs ();
148 extern void init_optabs ();
149 extern void init_stmt ();
150 extern void init_reg_sets ();
151 extern void dump_flow_info ();
152 extern void dump_sched_info ();
153 extern void dump_local_alloc ();
154
155 void rest_of_decl_compilation ();
156 void error_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
157 void error_with_decl PVPROTO((tree decl, char *s, ...));
158 void error_for_asm PVPROTO((rtx insn, char *s, ...));
159 void error PVPROTO((char *s, ...));
160 void fatal PVPROTO((char *s, ...));
161 void warning_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
162 void warning_with_decl PVPROTO((tree decl, char *s, ...));
163 void warning_for_asm PVPROTO((rtx insn, char *s, ...));
164 void warning PVPROTO((char *s, ...));
165 void pedwarn PVPROTO((char *s, ...));
166 void pedwarn_with_decl PVPROTO((tree decl, char *s, ...));
167 void pedwarn_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
168 void sorry PVPROTO((char *s, ...));
169 void really_sorry PVPROTO((char *s, ...));
170 void fancy_abort ();
171 #ifndef abort
172 void abort ();
173 #endif
174 void set_target_switch ();
175 static char *decl_name ();
176
177 void print_version ();
178 int print_single_switch ();
179 void print_switch_values ();
180 /* Length of line when printing switch values.  */
181 #define MAX_LINE 75
182
183 #ifdef __alpha
184 extern char *sbrk ();
185 #endif
186
187 /* Name of program invoked, sans directories.  */
188
189 char *progname;
190
191 /* Copy of arguments to main.  */
192 int save_argc;
193 char **save_argv;
194 \f
195 /* Name of current original source file (what was input to cpp).
196    This comes from each #-command in the actual input.  */
197
198 char *input_filename;
199
200 /* Name of top-level original source file (what was input to cpp).
201    This comes from the #-command at the beginning of the actual input.
202    If there isn't any there, then this is the cc1 input file name.  */
203
204 char *main_input_filename;
205
206 /* Stream for reading from the input file.  */
207
208 FILE *finput;
209
210 /* Current line number in real source file.  */
211
212 int lineno;
213
214 /* Stack of currently pending input files.  */
215
216 struct file_stack *input_file_stack;
217
218 /* Incremented on each change to input_file_stack.  */
219 int input_file_stack_tick;
220
221 /* FUNCTION_DECL for function now being parsed or compiled.  */
222
223 extern tree current_function_decl;
224
225 /* Name to use as base of names for dump output files.  */
226
227 char *dump_base_name;
228
229 /* Bit flags that specify the machine subtype we are compiling for.
230    Bits are tested using macros TARGET_... defined in the tm.h file
231    and set by `-m...' switches.  Must be defined in rtlanal.c.  */
232
233 extern int target_flags;
234
235 /* Flags saying which kinds of debugging dump have been requested.  */
236
237 int rtl_dump = 0;
238 int rtl_dump_and_exit = 0;
239 int jump_opt_dump = 0;
240 int cse_dump = 0;
241 int loop_dump = 0;
242 int cse2_dump = 0;
243 int flow_dump = 0;
244 int combine_dump = 0;
245 int sched_dump = 0;
246 int local_reg_dump = 0;
247 int global_reg_dump = 0;
248 int sched2_dump = 0;
249 int jump2_opt_dump = 0;
250 int dbr_sched_dump = 0;
251 int flag_print_asm_name = 0;
252 int stack_reg_dump = 0;
253
254 /* Name for output file of assembly code, specified with -o.  */
255
256 char *asm_file_name;
257
258 /* Value of the -G xx switch, and whether it was passed or not.  */
259 int g_switch_value;
260 int g_switch_set;
261
262 /* Type(s) of debugging information we are producing (if any).
263    See flags.h for the definitions of the different possible
264    types of debugging information.  */
265 enum debug_info_type write_symbols = NO_DEBUG;
266
267 /* Level of debugging information we are producing.  See flags.h
268    for the definitions of the different possible levels.  */
269 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
270
271 /* Nonzero means use GNU-only extensions in the generated symbolic
272    debugging information.  */
273 /* Currently, this only has an effect when write_symbols is set to
274    DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG.  */
275 int use_gnu_debug_info_extensions = 0;
276
277 /* Nonzero means do optimizations.  -O.
278    Particular numeric values stand for particular amounts of optimization;
279    thus, -O2 stores 2 here.  However, the optimizations beyond the basic
280    ones are not controlled directly by this variable.  Instead, they are
281    controlled by individual `flag_...' variables that are defaulted
282    based on this variable.  */
283
284 int optimize = 0;
285
286 /* Number of error messages and warning messages so far.  */
287
288 int errorcount = 0;
289 int warningcount = 0;
290 int sorrycount = 0;
291
292 /* Flag to output bytecode instead of native assembler */
293 int output_bytecode = 0;
294
295 /* Pointer to function to compute the name to use to print a declaration.  */
296
297 char *(*decl_printable_name) ();
298
299 /* Pointer to function to compute rtl for a language-specific tree code.  */
300
301 struct rtx_def *(*lang_expand_expr) ();
302
303 /* Pointer to function to finish handling an incomplete decl at the
304    end of compilation.  */
305
306 void (*incomplete_decl_finalize_hook) () = 0;
307
308 /* Highest label number used at the end of reload.  */
309
310 int max_label_num_after_reload;
311
312 /* Nonzero if generating code to do profiling.  */
313
314 int profile_flag = 0;
315
316 /* Nonzero if generating code to do profiling on a line-by-line basis.  */
317
318 int profile_block_flag;
319
320 /* Nonzero for -pedantic switch: warn about anything
321    that standard spec forbids.  */
322
323 int pedantic = 0;
324
325 /* Temporarily suppress certain warnings.
326    This is set while reading code from a system header file.  */
327
328 int in_system_header = 0;
329
330 /* Nonzero means do stupid register allocation.
331    Currently, this is 1 if `optimize' is 0.  */
332
333 int obey_regdecls = 0;
334
335 /* Don't print functions as they are compiled and don't print
336    times taken by the various passes.  -quiet.  */
337
338 int quiet_flag = 0;
339 \f
340 /* -f flags.  */
341
342 /* Nonzero means `char' should be signed.  */
343
344 int flag_signed_char;
345
346 /* Nonzero means give an enum type only as many bytes as it needs.  */
347
348 int flag_short_enums;
349
350 /* Nonzero for -fcaller-saves: allocate values in regs that need to
351    be saved across function calls, if that produces overall better code.
352    Optional now, so people can test it.  */
353
354 #ifdef DEFAULT_CALLER_SAVES
355 int flag_caller_saves = 1;
356 #else
357 int flag_caller_saves = 0;
358 #endif
359
360 /* Nonzero if structures and unions should be returned in memory.
361
362    This should only be defined if compatibility with another compiler or
363    with an ABI is needed, because it results in slower code.  */
364
365 #ifndef DEFAULT_PCC_STRUCT_RETURN
366 #define DEFAULT_PCC_STRUCT_RETURN 1
367 #endif
368
369 /* Nonzero for -fpcc-struct-return: return values the same way PCC does.  */
370
371 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
372
373 /* Nonzero for -fforce-mem: load memory value into a register
374    before arithmetic on it.  This makes better cse but slower compilation.  */
375
376 int flag_force_mem = 0;
377
378 /* Nonzero for -fforce-addr: load memory address into a register before
379    reference to memory.  This makes better cse but slower compilation.  */
380
381 int flag_force_addr = 0;
382
383 /* Nonzero for -fdefer-pop: don't pop args after each function call;
384    instead save them up to pop many calls' args with one insns.  */
385
386 int flag_defer_pop = 0;
387
388 /* Nonzero for -ffloat-store: don't allocate floats and doubles
389    in extended-precision registers.  */
390
391 int flag_float_store = 0;
392
393 /* Nonzero for -fcse-follow-jumps:
394    have cse follow jumps to do a more extensive job.  */
395
396 int flag_cse_follow_jumps;
397
398 /* Nonzero for -fcse-skip-blocks:
399    have cse follow a branch around a block.  */
400 int flag_cse_skip_blocks;
401
402 /* Nonzero for -fexpensive-optimizations:
403    perform miscellaneous relatively-expensive optimizations.  */
404 int flag_expensive_optimizations;
405
406 /* Nonzero for -fthread-jumps:
407    have jump optimize output of loop.  */
408
409 int flag_thread_jumps;
410
411 /* Nonzero enables strength-reduction in loop.c.  */
412
413 int flag_strength_reduce = 0;
414
415 /* Nonzero enables loop unrolling in unroll.c.  Only loops for which the
416    number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
417    UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
418    unrolled.  */
419
420 int flag_unroll_loops;
421
422 /* Nonzero enables loop unrolling in unroll.c.  All loops are unrolled.
423    This is generally not a win.  */
424
425 int flag_unroll_all_loops;
426
427 /* Nonzero for -fwritable-strings:
428    store string constants in data segment and don't uniquize them.  */
429
430 int flag_writable_strings = 0;
431
432 /* Nonzero means don't put addresses of constant functions in registers.
433    Used for compiling the Unix kernel, where strange substitutions are
434    done on the assembly output.  */
435
436 int flag_no_function_cse = 0;
437
438 /* Nonzero for -fomit-frame-pointer:
439    don't make a frame pointer in simple functions that don't require one.  */
440
441 int flag_omit_frame_pointer = 0;
442
443 /* Nonzero means place each function into its own section on those platforms
444    which support arbitrary section names and unlimited numbers of sections.  */
445
446 int flag_function_sections = 0;
447
448 /* Nonzero to inhibit use of define_optimization peephole opts.  */
449
450 int flag_no_peephole = 0;
451
452 /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
453    operations in the interest of optimization.  For example it allows
454    GCC to assume arguments to sqrt are nonnegative numbers, allowing
455    faster code for sqrt to be generated.  */
456
457 int flag_fast_math = 0;
458
459 /* Nonzero means all references through pointers are volatile.  */
460
461 int flag_volatile;
462
463 /* Nonzero means treat all global and extern variables as global.  */
464
465 int flag_volatile_global;
466
467 /* Nonzero means just do syntax checking; don't output anything.  */
468
469 int flag_syntax_only = 0;
470
471 /* Nonzero means to rerun cse after loop optimization.  This increases
472    compilation time about 20% and picks up a few more common expressions.  */
473
474 static int flag_rerun_cse_after_loop;
475
476 /* Nonzero for -finline-functions: ok to inline functions that look like
477    good inline candidates.  */
478
479 int flag_inline_functions;
480
481 /* Nonzero for -fkeep-inline-functions: even if we make a function
482    go inline everywhere, keep its definition around for debugging
483    purposes.  */
484
485 int flag_keep_inline_functions;
486
487 /* Nonzero means that functions will not be inlined.  */
488
489 int flag_no_inline;
490
491 /* Nonzero means that we should emit static const variables
492    regardless of whether or not optimization is turned on.  */
493
494 int flag_keep_static_consts = 1;
495
496 /* Nonzero means we should be saving declaration info into a .X file.  */
497
498 int flag_gen_aux_info = 0;
499
500 /* Specified name of aux-info file.  */
501
502 static char *aux_info_file_name;
503
504 /* Nonzero means make the text shared if supported.  */
505
506 int flag_shared_data;
507
508 /* Nonzero means schedule into delayed branch slots if supported.  */
509
510 int flag_delayed_branch;
511
512 /* Nonzero means to run cleanups after CALL_EXPRs.  */
513
514 int flag_short_temps;
515
516 /* Nonzero if we are compiling pure (sharable) code.
517    Value is 1 if we are doing reasonable (i.e. simple
518    offset into offset table) pic.  Value is 2 if we can
519    only perform register offsets.  */
520
521 int flag_pic;
522
523 /* Nonzero means generate extra code for exception handling and enable
524    exception handling.  */
525
526 int flag_exceptions = 1;
527
528 /* Nonzero means don't place uninitialized global data in common storage
529    by default.  */
530
531 int flag_no_common;
532
533 /* Nonzero means pretend it is OK to examine bits of target floats,
534    even if that isn't true.  The resulting code will have incorrect constants,
535    but the same series of instructions that the native compiler would make.  */
536
537 int flag_pretend_float;
538
539 /* Nonzero means change certain warnings into errors.
540    Usually these are warnings about failure to conform to some standard.  */
541
542 int flag_pedantic_errors = 0;
543
544 /* flag_schedule_insns means schedule insns within basic blocks (before
545    local_alloc).
546    flag_schedule_insns_after_reload means schedule insns after
547    global_alloc.  */
548
549 int flag_schedule_insns = 0;
550 int flag_schedule_insns_after_reload = 0;
551
552 /* -finhibit-size-directive inhibits output of .size for ELF.
553    This is used only for compiling crtstuff.c, 
554    and it may be extended to other effects
555    needed for crtstuff.c on other systems.  */
556 int flag_inhibit_size_directive = 0;
557
558 /* -fverbose-asm causes extra commentary information to be produced in
559    the generated assembly code (to make it more readable).  This option
560    is generally only of use to those who actually need to read the
561    generated assembly code (perhaps while debugging the compiler itself).
562    -fverbose-asm is the default.  -fno-verbose-asm causes the extra information
563    to be omitted and is useful when comparing two assembler files.  */
564
565 int flag_verbose_asm = 1;
566
567 /* -dA causes debug commentary information to be produced in
568    the generated assembly code (to make it more readable).  This option
569    is generally only of use to those who actually need to read the
570    generated assembly code (perhaps while debugging the compiler itself).
571    Currently, this switch is only used by dwarfout.c; however, it is intended
572    to be a catchall for printing debug information in the assembler file.  */
573
574 int flag_debug_asm = 0;
575
576 /* -fgnu-linker specifies use of the GNU linker for initializations.
577    (Or, more generally, a linker that handles initializations.)
578    -fno-gnu-linker says that collect2 will be used.  */
579 #ifdef USE_COLLECT2
580 int flag_gnu_linker = 0;
581 #else
582 int flag_gnu_linker = 1;
583 #endif
584
585 /* Tag all structures with __attribute__(packed) */
586 int flag_pack_struct = 0;
587
588 /* Table of language-independent -f options.
589    STRING is the option name.  VARIABLE is the address of the variable.
590    ON_VALUE is the value to store in VARIABLE
591     if `-fSTRING' is seen as an option.
592    (If `-fno-STRING' is seen as an option, the opposite value is stored.)  */
593
594 struct { char *string; int *variable; int on_value;} f_options[] =
595 {
596   {"float-store", &flag_float_store, 1},
597   {"volatile", &flag_volatile, 1},
598   {"volatile-global", &flag_volatile_global, 1},
599   {"defer-pop", &flag_defer_pop, 1},
600   {"omit-frame-pointer", &flag_omit_frame_pointer, 1},
601   {"cse-follow-jumps", &flag_cse_follow_jumps, 1},
602   {"cse-skip-blocks", &flag_cse_skip_blocks, 1},
603   {"expensive-optimizations", &flag_expensive_optimizations, 1},
604   {"thread-jumps", &flag_thread_jumps, 1},
605   {"strength-reduce", &flag_strength_reduce, 1},
606   {"unroll-loops", &flag_unroll_loops, 1},
607   {"unroll-all-loops", &flag_unroll_all_loops, 1},
608   {"writable-strings", &flag_writable_strings, 1},
609   {"peephole", &flag_no_peephole, 0},
610   {"force-mem", &flag_force_mem, 1},
611   {"force-addr", &flag_force_addr, 1},
612   {"function-cse", &flag_no_function_cse, 0},
613   {"inline-functions", &flag_inline_functions, 1},
614   {"keep-inline-functions", &flag_keep_inline_functions, 1},
615   {"inline", &flag_no_inline, 0},
616   {"keep-static-consts", &flag_keep_static_consts, 1},
617   {"syntax-only", &flag_syntax_only, 1},
618   {"shared-data", &flag_shared_data, 1},
619   {"caller-saves", &flag_caller_saves, 1},
620   {"pcc-struct-return", &flag_pcc_struct_return, 1},
621   {"reg-struct-return", &flag_pcc_struct_return, 0},
622   {"delayed-branch", &flag_delayed_branch, 1},
623   {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1},
624   {"pretend-float", &flag_pretend_float, 1},
625   {"schedule-insns", &flag_schedule_insns, 1},
626   {"schedule-insns2", &flag_schedule_insns_after_reload, 1},
627   {"pic", &flag_pic, 1},
628   {"PIC", &flag_pic, 2},
629   {"exceptions", &flag_exceptions, 1},
630   {"fast-math", &flag_fast_math, 1},
631   {"common", &flag_no_common, 0},
632   {"inhibit-size-directive", &flag_inhibit_size_directive, 1},
633   {"function-sections", &flag_function_sections, 1},
634   {"verbose-asm", &flag_verbose_asm, 1},
635   {"gnu-linker", &flag_gnu_linker, 1},
636   {"pack-struct", &flag_pack_struct, 1},
637   {"bytecode", &output_bytecode, 1}
638 };
639
640 /* Table of language-specific options.  */
641
642 char *lang_options[] =
643 {
644   "-ansi",
645   "-fallow-single-precision",
646
647   "-fsigned-bitfields",
648   "-funsigned-bitfields",
649   "-fno-signed-bitfields",
650   "-fno-unsigned-bitfields",
651   "-fsigned-char",
652   "-funsigned-char",
653   "-fno-signed-char",
654   "-fno-unsigned-char",
655
656   "-ftraditional",
657   "-traditional",
658   "-fnotraditional",
659   "-fno-traditional",
660
661   "-fasm",
662   "-fno-asm",
663   "-fbuiltin",
664   "-fno-builtin",
665   "-fhosted",
666   "-fno-hosted",
667   "-ffreestanding",
668   "-fno-freestanding",
669   "-fcond-mismatch",
670   "-fno-cond-mismatch",
671   "-fdollars-in-identifiers",
672   "-fno-dollars-in-identifiers",
673   "-fident",
674   "-fno-ident",
675   "-fshort-double",
676   "-fno-short-double",
677   "-fshort-enums",
678   "-fno-short-enums",
679
680   "-Wall",
681   "-Wbad-function-cast",
682   "-Wno-bad-function-cast",
683   "-Wcast-qual",
684   "-Wno-cast-qual",
685   "-Wchar-subscripts",
686   "-Wno-char-subscripts",
687   "-Wcomment",
688   "-Wno-comment",
689   "-Wcomments",
690   "-Wno-comments",
691   "-Wconversion",
692   "-Wno-conversion",
693   "-Wformat",
694   "-Wno-format",
695   "-Wimport",
696   "-Wno-import",
697   "-Wimplicit",
698   "-Wno-implicit",
699   "-Wmain",
700   "-Wno-main",
701   "-Wmissing-braces",
702   "-Wno-missing-braces",
703   "-Wmissing-declarations",
704   "-Wno-missing-declarations",
705   "-Wmissing-prototypes",
706   "-Wno-missing-prototypes",
707   "-Wnested-externs",
708   "-Wno-nested-externs",
709   "-Wparentheses",
710   "-Wno-parentheses",
711   "-Wpointer-arith",
712   "-Wno-pointer-arith",
713   "-Wredundant-decls",
714   "-Wno-redundant-decls",
715   "-Wsign-compare",
716   "-Wno-sign-compare",
717   "-Wstrict-prototypes",
718   "-Wno-strict-prototypes",
719   "-Wtraditional",
720   "-Wno-traditional",
721   "-Wtrigraphs",
722   "-Wno-trigraphs",
723   "-Wwrite-strings",
724   "-Wno-write-strings",
725
726   /* these are for obj c */
727   "-lang-objc",
728   "-gen-decls",
729   "-fgnu-runtime",
730   "-fno-gnu-runtime",
731   "-fnext-runtime",
732   "-fno-next-runtime",
733   "-Wselector",
734   "-Wno-selector",
735   "-Wprotocol",
736   "-Wno-protocol",
737
738 #include "options.h"
739   0
740 };
741 \f
742 /* Options controlling warnings */
743
744 /* Don't print warning messages.  -w.  */
745
746 int inhibit_warnings = 0;
747
748 /* Print various extra warnings.  -W.  */
749
750 int extra_warnings = 0;
751
752 /* Treat warnings as errors.  -Werror.  */
753
754 int warnings_are_errors = 0;
755
756 /* Nonzero to warn about unused local variables.  */
757
758 int warn_unused;
759
760 /* Nonzero to warn about variables used before they are initialized.  */
761
762 int warn_uninitialized;
763
764 /* Nonzero means warn about all declarations which shadow others.   */
765
766 int warn_shadow;
767
768 /* Warn if a switch on an enum fails to have a case for every enum value.  */
769
770 int warn_switch;
771
772 /* Nonzero means warn about function definitions that default the return type
773    or that use a null return and have a return-type other than void.  */
774
775 int warn_return_type;
776
777 /* Nonzero means warn about pointer casts that increase the required
778    alignment of the target type (and might therefore lead to a crash
779    due to a misaligned access).  */
780
781 int warn_cast_align;
782
783 /* Nonzero means warn about any identifiers that match in the first N
784    characters.  The value N is in `id_clash_len'.  */
785
786 int warn_id_clash;
787 unsigned id_clash_len;
788
789 /* Nonzero means warn about any objects definitions whose size is larger
790    than N bytes.  Also want about function definitions whose returned
791    values are larger than N bytes. The value N is in `larger_than_size'.  */
792  
793 int warn_larger_than;
794 unsigned larger_than_size;
795
796 /* Nonzero means warn if inline function is too large.  */
797
798 int warn_inline;
799
800 /* Warn if a function returns an aggregate,
801    since there are often incompatible calling conventions for doing this.  */
802
803 int warn_aggregate_return;
804
805 /* Likewise for -W.  */
806
807 struct { char *string; int *variable; int on_value;} W_options[] =
808 {
809   {"unused", &warn_unused, 1},
810   {"error", &warnings_are_errors, 1},
811   {"shadow", &warn_shadow, 1},
812   {"switch", &warn_switch, 1},
813   {"aggregate-return", &warn_aggregate_return, 1},
814   {"cast-align", &warn_cast_align, 1},
815   {"uninitialized", &warn_uninitialized, 1},
816   {"inline", &warn_inline, 1}
817 };
818 \f
819 /* Output files for assembler code (real compiler output)
820    and debugging dumps.  */
821
822 FILE *asm_out_file;
823 FILE *aux_info_file;
824 FILE *rtl_dump_file;
825 FILE *jump_opt_dump_file;
826 FILE *cse_dump_file;
827 FILE *loop_dump_file;
828 FILE *cse2_dump_file;
829 FILE *flow_dump_file;
830 FILE *combine_dump_file;
831 FILE *sched_dump_file;
832 FILE *local_reg_dump_file;
833 FILE *global_reg_dump_file;
834 FILE *sched2_dump_file;
835 FILE *jump2_opt_dump_file;
836 FILE *dbr_sched_dump_file;
837 FILE *stack_reg_dump_file;
838
839 /* Time accumulators, to count the total time spent in various passes.  */
840
841 int parse_time;
842 int varconst_time;
843 int integration_time;
844 int jump_time;
845 int cse_time;
846 int loop_time;
847 int cse2_time;
848 int flow_time;
849 int combine_time;
850 int sched_time;
851 int local_alloc_time;
852 int global_alloc_time;
853 int sched2_time;
854 int dbr_sched_time;
855 int shorten_branch_time;
856 int stack_reg_time;
857 int final_time;
858 int symout_time;
859 int dump_time;
860 \f
861 /* Return time used so far, in microseconds.  */
862
863 int
864 get_run_time ()
865 {
866 #ifndef _WIN32
867 #ifdef USG
868   struct tms tms;
869 #else
870 #ifndef VMS
871   struct rusage rusage;
872 #else
873   struct
874     {
875       int proc_user_time;
876       int proc_system_time;
877       int child_user_time;
878       int child_system_time;
879     } vms_times;
880 #endif
881 #endif
882 #endif
883
884   if (quiet_flag)
885     return 0;
886 #ifdef _WIN32
887   if (clock() < 0)
888     return 0;
889   else
890     return (clock() * 1000);
891 #else /* not _WIN32 */
892 #ifdef USG
893   times (&tms);
894   return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
895 #else
896 #ifndef VMS
897   getrusage (0, &rusage);
898   return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
899           + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
900 #else /* VMS */
901   times (&vms_times);
902   return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
903 #endif
904 #endif
905 #endif
906 }
907
908 #define TIMEVAR(VAR, BODY)    \
909 do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
910
911 void
912 print_time (str, total)
913      char *str;
914      int total;
915 {
916   fprintf (stderr,
917            "time in %s: %d.%06d\n",
918            str, total / 1000000, total % 1000000);
919 }
920
921 /* Count an error or warning.  Return 1 if the message should be printed.  */
922
923 int
924 count_error (warningp)
925      int warningp;
926 {
927   if (warningp && inhibit_warnings)
928     return 0;
929
930   if (warningp && !warnings_are_errors)
931     warningcount++;
932   else
933     {
934       static int warning_message = 0;
935
936       if (warningp && !warning_message)
937         {
938           fprintf (stderr, "%s: warnings being treated as errors\n", progname);
939           warning_message = 1;
940         }
941       errorcount++;
942     }
943
944   return 1;
945 }
946
947 /* Print a fatal error message.  NAME is the text.
948    Also include a system error message based on `errno'.  */
949
950 void
951 pfatal_with_name (name)
952      char *name;
953 {
954   fprintf (stderr, "%s: ", progname);
955   perror (name);
956   exit (FATAL_EXIT_CODE);
957 }
958
959 void
960 fatal_io_error (name)
961      char *name;
962 {
963   fprintf (stderr, "%s: %s: I/O error\n", progname, name);
964   exit (FATAL_EXIT_CODE);
965 }
966
967 /* Called to give a better error message for a bad insn rather than
968    just calling abort().  */
969
970 void
971 fatal_insn (message, insn)
972      char *message;
973      rtx insn;
974 {
975   if (!output_bytecode)
976     {
977       error (message);
978       debug_rtx (insn);
979     }
980   if (asm_out_file)
981     fflush (asm_out_file);
982   if (aux_info_file)
983     fflush (aux_info_file);
984   if (rtl_dump_file)
985     fflush (rtl_dump_file);
986   if (jump_opt_dump_file)
987     fflush (jump_opt_dump_file);
988   if (cse_dump_file)
989     fflush (cse_dump_file);
990   if (loop_dump_file)
991     fflush (loop_dump_file);
992   if (cse2_dump_file)
993     fflush (cse2_dump_file);
994   if (flow_dump_file)
995     fflush (flow_dump_file);
996   if (combine_dump_file)
997     fflush (combine_dump_file);
998   if (sched_dump_file)
999     fflush (sched_dump_file);
1000   if (local_reg_dump_file)
1001     fflush (local_reg_dump_file);
1002   if (global_reg_dump_file)
1003     fflush (global_reg_dump_file);
1004   if (sched2_dump_file)
1005     fflush (sched2_dump_file);
1006   if (jump2_opt_dump_file)
1007     fflush (jump2_opt_dump_file);
1008   if (dbr_sched_dump_file)
1009     fflush (dbr_sched_dump_file);
1010   if (stack_reg_dump_file)
1011     fflush (stack_reg_dump_file);
1012   fflush (stdout);
1013   fflush (stderr);
1014   abort ();
1015 }
1016
1017 /* Called to give a better error message when we don't have an insn to match
1018    what we are looking for or if the insn's constraints aren't satisfied,
1019    rather than just calling abort().  */
1020
1021 void
1022 fatal_insn_not_found (insn)
1023      rtx insn;
1024 {
1025   if (INSN_CODE (insn) < 0)
1026     fatal_insn ("internal error--unrecognizable insn:", insn);
1027   else
1028     fatal_insn ("internal error--insn does not satisfy its constraints:", insn);
1029 }
1030
1031 /* This is the default decl_printable_name function.  */
1032
1033 static char *
1034 decl_name (decl, kind)
1035      tree decl;
1036      char **kind;
1037 {
1038   return IDENTIFIER_POINTER (DECL_NAME (decl));
1039 }
1040 \f
1041 static int need_error_newline;
1042
1043 /* Function of last error message;
1044    more generally, function such that if next error message is in it
1045    then we don't have to mention the function name.  */
1046 static tree last_error_function = NULL;
1047
1048 /* Used to detect when input_file_stack has changed since last described.  */
1049 static int last_error_tick;
1050
1051 /* Called when the start of a function definition is parsed,
1052    this function prints on stderr the name of the function.  */
1053
1054 void
1055 announce_function (decl)
1056      tree decl;
1057 {
1058   if (! quiet_flag)
1059     {
1060       char *junk;
1061       if (rtl_dump_and_exit)
1062         fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
1063       else
1064         fprintf (stderr, " %s", (*decl_printable_name) (decl, &junk));
1065       fflush (stderr);
1066       need_error_newline = 1;
1067       last_error_function = current_function_decl;
1068     }
1069 }
1070
1071 /* The default function to print out name of current function that caused
1072    an error.  */
1073
1074 void
1075 default_print_error_function (file)
1076      char *file;
1077 {
1078   if (last_error_function != current_function_decl)
1079     {
1080       char *kind = "function";
1081       if (current_function_decl != 0
1082           && TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
1083         kind = "method";
1084
1085       if (file)
1086         fprintf (stderr, "%s: ", file);
1087
1088       if (current_function_decl == NULL)
1089         fprintf (stderr, "At top level:\n");
1090       else
1091         {
1092           char *name = (*decl_printable_name) (current_function_decl, &kind);
1093           fprintf (stderr, "In %s `%s':\n", kind, name);
1094         }
1095
1096       last_error_function = current_function_decl;
1097     }
1098 }
1099
1100 /* Called by report_error_function to print out function name.
1101  * Default may be overridden by language front-ends.  */
1102
1103 void (*print_error_function) PROTO((char *)) = default_print_error_function;
1104
1105 /* Prints out, if necessary, the name of the current function
1106   that caused an error.  Called from all error and warning functions.  */
1107
1108 void
1109 report_error_function (file)
1110      char *file;
1111 {
1112   struct file_stack *p;
1113
1114   if (need_error_newline)
1115     {
1116       fprintf (stderr, "\n");
1117       need_error_newline = 0;
1118     }
1119
1120   (*print_error_function) (file);
1121
1122   if (input_file_stack && input_file_stack->next != 0
1123       && input_file_stack_tick != last_error_tick
1124       && file == input_filename)
1125     {
1126       fprintf (stderr, "In file included");
1127       for (p = input_file_stack->next; p; p = p->next)
1128         {
1129           fprintf (stderr, " from %s:%d", p->name, p->line);
1130           if (p->next)
1131             fprintf (stderr, ",\n                ");
1132         }
1133       fprintf (stderr, ":\n");
1134       last_error_tick = input_file_stack_tick;
1135     }
1136 }
1137 \f
1138 /* Print a message.  */
1139
1140 static void
1141 vmessage (prefix, s, ap)
1142      char *prefix;
1143      char *s;
1144      va_list ap;
1145 {
1146   if (prefix)
1147     fprintf (stderr, "%s: ", prefix);
1148
1149 #ifdef HAVE_VPRINTF
1150   vfprintf (stderr, s, ap);
1151 #else
1152   {
1153     HOST_WIDE_INT v1 = va_arg(ap, HOST_WIDE_INT);
1154     HOST_WIDE_INT v2 = va_arg(ap, HOST_WIDE_INT);
1155     HOST_WIDE_INT v3 = va_arg(ap, HOST_WIDE_INT);
1156     HOST_WIDE_INT v4 = va_arg(ap, HOST_WIDE_INT);
1157     fprintf (stderr, s, v1, v2, v3, v4);
1158   }
1159 #endif
1160 }
1161
1162 /* Print a message relevant to line LINE of file FILE.  */
1163
1164 static void
1165 v_message_with_file_and_line (file, line, prefix, s, ap)
1166      char *file;
1167      int line;
1168      char *prefix;
1169      char *s;
1170      va_list ap;
1171 {
1172   if (file)
1173     fprintf (stderr, "%s:%d: ", file, line);
1174   else
1175     fprintf (stderr, "%s: ", progname);
1176
1177   vmessage (prefix, s, ap);
1178   fputc ('\n', stderr);
1179 }
1180
1181 /* Print a message relevant to the given DECL.  */
1182
1183 static void
1184 v_message_with_decl (decl, prefix, s, ap)
1185      tree decl;
1186      char *prefix;
1187      char *s;
1188      va_list ap;
1189 {
1190   char *n, *p, *junk;
1191
1192   fprintf (stderr, "%s:%d: ",
1193            DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
1194
1195   if (prefix)
1196     fprintf (stderr, "%s: ", prefix);
1197
1198   /* Do magic to get around lack of varargs support for insertion
1199      of arguments into existing list.  We know that the decl is first;
1200      we ass_u_me that it will be printed with "%s".  */
1201
1202   for (p = s; *p; ++p)
1203     {
1204       if (*p == '%')
1205         {
1206           if (*(p + 1) == '%')
1207             ++p;
1208           else
1209             break;
1210         }
1211     }
1212
1213   if (p > s)                    /* Print the left-hand substring.  */
1214     {
1215       char fmt[sizeof "%.255s"];
1216       long width = p - s;
1217              
1218       if (width > 255L) width = 255L;   /* arbitrary */
1219       sprintf (fmt, "%%.%lds", width);
1220       fprintf (stderr, fmt, s);
1221     }
1222
1223   if (*p == '%')                /* Print the name.  */
1224     {
1225       char *n = (DECL_NAME (decl)
1226                  ? (*decl_printable_name) (decl, &junk)
1227                  : "((anonymous))");
1228       fputs (n, stderr);
1229       while (*p)
1230         {
1231           ++p;
1232           if (isalpha (*(p - 1) & 0xFF))
1233             break;
1234         }
1235     }
1236
1237   if (*p)                       /* Print the rest of the message.  */
1238     vmessage ((char *)NULL, p, ap);
1239
1240   fputc ('\n', stderr);
1241 }
1242
1243 /* Figure file and line of the given INSN.  */
1244
1245 static void
1246 file_and_line_for_asm (insn, pfile, pline)
1247      rtx insn;
1248      char **pfile;
1249      int *pline;
1250 {
1251   rtx body = PATTERN (insn);
1252   rtx asmop;
1253
1254   /* Find the (or one of the) ASM_OPERANDS in the insn.  */
1255   if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
1256     asmop = SET_SRC (body);
1257   else if (GET_CODE (body) == ASM_OPERANDS)
1258     asmop = body;
1259   else if (GET_CODE (body) == PARALLEL
1260            && GET_CODE (XVECEXP (body, 0, 0)) == SET)
1261     asmop = SET_SRC (XVECEXP (body, 0, 0));
1262   else if (GET_CODE (body) == PARALLEL
1263            && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
1264     asmop = XVECEXP (body, 0, 0);
1265   else
1266     asmop = NULL;
1267
1268   if (asmop)
1269     {
1270       *pfile = ASM_OPERANDS_SOURCE_FILE (asmop);
1271       *pline = ASM_OPERANDS_SOURCE_LINE (asmop);
1272     }
1273   else
1274     {
1275       *pfile = input_filename;
1276       *pline = lineno;
1277     }
1278 }
1279
1280 /* Report an error at line LINE of file FILE.  */
1281
1282 static void
1283 v_error_with_file_and_line (file, line, s, ap)
1284      char *file;
1285      int line;
1286      char *s;
1287      va_list ap;
1288 {
1289   count_error (0);
1290   report_error_function (file);
1291   v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
1292 }
1293
1294 void
1295 error_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1296 {
1297 #ifndef __STDC__
1298   char *file;
1299   int line;
1300   char *s;
1301 #endif
1302   va_list ap;
1303
1304   VA_START (ap, s);
1305
1306 #ifndef __STDC__
1307   file = va_arg (ap, char *);
1308   line = va_arg (ap, int);
1309   s = va_arg (ap, char *);
1310 #endif
1311
1312   v_error_with_file_and_line (file, line, s, ap);
1313   va_end (ap);
1314 }
1315
1316 /* Report an error at the declaration DECL.
1317    S is a format string which uses %s to substitute the declaration
1318    name; subsequent substitutions are a la printf.  */
1319
1320 static void
1321 v_error_with_decl (decl, s, ap)
1322      tree decl;
1323      char *s;
1324      va_list ap;
1325 {
1326   count_error (0);
1327   report_error_function (DECL_SOURCE_FILE (decl));
1328   v_message_with_decl (decl, (char *)NULL, s, ap);
1329 }
1330
1331 void
1332 error_with_decl VPROTO((tree decl, char *s, ...))
1333 {
1334 #ifndef __STDC__
1335   tree decl;
1336   char *s;
1337 #endif
1338   va_list ap;
1339
1340   VA_START (ap, s);
1341
1342 #ifndef __STDC__
1343   decl = va_arg (ap, tree);
1344   s = va_arg (ap, char *);
1345 #endif
1346
1347   v_error_with_decl (decl, s, ap);
1348   va_end (ap);
1349 }
1350
1351 /* Report an error at the line number of the insn INSN.
1352    This is used only when INSN is an `asm' with operands,
1353    and each ASM_OPERANDS records its own source file and line.  */
1354
1355 static void
1356 v_error_for_asm (insn, s, ap)
1357      rtx insn;
1358      char *s;
1359      va_list ap;
1360 {
1361   char *file;
1362   int line;
1363
1364   count_error (0);
1365   file_and_line_for_asm (insn, &file, &line);
1366   report_error_function (file);
1367   v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
1368 }
1369
1370 void
1371 error_for_asm VPROTO((rtx insn, char *s, ...))
1372 {
1373 #ifndef __STDC__
1374   rtx insn;
1375   char *s;
1376 #endif
1377   va_list ap;
1378
1379   VA_START (ap, s);
1380
1381 #ifndef __STDC__
1382   insn = va_arg (ap, rtx);
1383   s = va_arg (ap, char *);
1384 #endif
1385
1386   v_error_for_asm (insn, s, ap);
1387   va_end (ap);
1388 }
1389
1390 /* Report an error at the current line number.  */
1391
1392 static void
1393 verror (s, ap)
1394      char *s;
1395      va_list ap;
1396 {
1397   v_error_with_file_and_line (input_filename, lineno, s, ap);
1398 }
1399
1400 void
1401 error VPROTO((char *s, ...))
1402 {
1403 #ifndef __STDC__
1404   char *s;
1405 #endif
1406   va_list ap;
1407
1408   VA_START (ap, s);
1409
1410 #ifndef __STDC__
1411   s = va_arg (ap, char *);
1412 #endif
1413
1414   verror (s, ap);
1415   va_end (ap);
1416 }
1417
1418 /* Report a fatal error at the current line number.  */
1419
1420 static void
1421 vfatal (s, ap)
1422      char *s;
1423      va_list ap;
1424 {
1425   verror (s, ap);
1426   exit (FATAL_EXIT_CODE);
1427 }
1428
1429 void
1430 fatal VPROTO((char *s, ...))
1431 {
1432 #ifndef __STDC__
1433   char *s;
1434 #endif
1435   va_list ap;
1436
1437   VA_START (ap, s);
1438
1439 #ifndef __STDC__
1440   s = va_arg (ap, char *);
1441 #endif
1442
1443   vfatal (s, ap);
1444   va_end (ap);
1445 }
1446
1447 /* Report a warning at line LINE of file FILE.  */
1448
1449 static void
1450 v_warning_with_file_and_line (file, line, s, ap)
1451      char *file;
1452      int line;
1453      char *s;
1454      va_list ap;
1455 {
1456   if (count_error (1))
1457     {
1458       report_error_function (file);
1459       v_message_with_file_and_line (file, line, "warning", s, ap);
1460     }
1461 }
1462
1463 void
1464 warning_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1465 {
1466 #ifndef __STDC__
1467   char *file;
1468   int line;
1469   char *s;
1470 #endif
1471   va_list ap;
1472
1473   VA_START (ap, s);
1474
1475 #ifndef __STDC__
1476   file = va_arg (ap, char *);
1477   line = va_arg (ap, int);
1478   s = va_arg (ap, char *);
1479 #endif
1480
1481   v_warning_with_file_and_line (file, line, s, ap);
1482   va_end (ap);
1483 }
1484
1485 /* Report a warning at the declaration DECL.
1486    S is a format string which uses %s to substitute the declaration
1487    name; subsequent substitutions are a la printf.  */
1488
1489 static void
1490 v_warning_with_decl (decl, s, ap)
1491      tree decl;
1492      char *s;
1493      va_list ap;
1494 {
1495   if (count_error (1))
1496     {
1497       report_error_function (DECL_SOURCE_FILE (decl));
1498       v_message_with_decl (decl, "warning", s, ap);
1499     }
1500 }
1501
1502 void
1503 warning_with_decl VPROTO((tree decl, char *s, ...))
1504 {
1505 #ifndef __STDC__
1506   tree decl;
1507   char *s;
1508 #endif
1509   va_list ap;
1510
1511   VA_START (ap, s);
1512
1513 #ifndef __STDC__
1514   decl = va_arg (ap, tree);
1515   s = va_arg (ap, char *);
1516 #endif
1517
1518   v_warning_with_decl (decl, s, ap);
1519   va_end (ap);
1520 }
1521
1522 /* Report a warning at the line number of the insn INSN.
1523    This is used only when INSN is an `asm' with operands,
1524    and each ASM_OPERANDS records its own source file and line.  */
1525
1526 static void
1527 v_warning_for_asm (insn, s, ap)
1528      rtx insn;
1529      char *s;
1530      va_list ap;
1531 {
1532   if (count_error (1))
1533     {
1534       char *file;
1535       int line;
1536
1537       file_and_line_for_asm (insn, &file, &line);
1538       report_error_function (file);
1539       v_message_with_file_and_line (file, line, "warning", s, ap);
1540     }
1541 }
1542
1543 void
1544 warning_for_asm VPROTO((rtx insn, char *s, ...))
1545 {
1546 #ifndef __STDC__
1547   rtx insn;
1548   char *s;
1549 #endif
1550   va_list ap;
1551
1552   VA_START (ap, s);
1553
1554 #ifndef __STDC__
1555   insn = va_arg (ap, rtx);
1556   s = va_arg (ap, char *);
1557 #endif
1558
1559   v_warning_for_asm (insn, s, ap);
1560   va_end (ap);
1561 }
1562
1563 /* Report a warning at the current line number.  */
1564
1565 static void
1566 vwarning (s, ap)
1567      char *s;
1568      va_list ap;
1569 {
1570   v_warning_with_file_and_line (input_filename, lineno, s, ap);
1571 }
1572
1573 void
1574 warning VPROTO((char *s, ...))
1575 {
1576 #ifndef __STDC__
1577   char *s;
1578 #endif
1579   va_list ap;
1580
1581   VA_START (ap, s);
1582
1583 #ifndef __STDC__
1584   s = va_arg (ap, char *);
1585 #endif
1586
1587   vwarning (s, ap);
1588   va_end (ap);
1589 }
1590
1591 /* These functions issue either warnings or errors depending on
1592    -pedantic-errors.  */
1593
1594 static void
1595 vpedwarn (s, ap)
1596      char *s;
1597      va_list ap;
1598 {
1599   if (flag_pedantic_errors)
1600     verror (s, ap);
1601   else
1602     vwarning (s, ap);
1603 }
1604
1605 void
1606 pedwarn VPROTO((char *s, ...))
1607 {
1608 #ifndef __STDC__
1609   char *s;
1610 #endif
1611   va_list ap;
1612
1613   VA_START (ap, s);
1614
1615 #ifndef __STDC__
1616   s = va_arg (ap, char *);
1617 #endif
1618
1619   vpedwarn (s, ap);
1620   va_end (ap);
1621 }
1622
1623 static void
1624 v_pedwarn_with_decl (decl, s, ap)
1625      tree decl;
1626      char *s;
1627      va_list ap;
1628 {
1629   /* We don't want -pedantic-errors to cause the compilation to fail from
1630      "errors" in system header files.  Sometimes fixincludes can't fix what's
1631      broken (eg: unsigned char bitfields - fixing it may change the alignment
1632      which will cause programs to mysteriously fail because the C library
1633      or kernel uses the original layout).  There's no point in issuing a
1634      warning either, it's just unnecessary noise.  */
1635
1636   if (! DECL_IN_SYSTEM_HEADER (decl))
1637     {
1638       if (flag_pedantic_errors)
1639         v_error_with_decl (decl, s, ap);
1640       else
1641         v_warning_with_decl (decl, s, ap);
1642     }
1643 }
1644
1645 void
1646 pedwarn_with_decl VPROTO((tree decl, char *s, ...))
1647 {
1648 #ifndef __STDC__
1649   tree decl;
1650   char *s;
1651 #endif
1652   va_list ap;
1653
1654   VA_START (ap, s);
1655
1656 #ifndef __STDC__
1657   decl = va_arg (ap, tree);
1658   s = va_arg (ap, char *);
1659 #endif
1660
1661   v_pedwarn_with_decl (decl, s, ap);
1662   va_end (ap);
1663 }
1664
1665 static void
1666 v_pedwarn_with_file_and_line (file, line, s, ap)
1667      char *file;
1668      int line;
1669      char *s;
1670      va_list ap;
1671 {
1672   if (flag_pedantic_errors)
1673     v_error_with_file_and_line (file, line, s, ap);
1674   else
1675     v_warning_with_file_and_line (file, line, s, ap);
1676 }
1677
1678 void
1679 pedwarn_with_file_and_line VPROTO((char *file, int line, char *s, ...))
1680 {
1681 #ifndef __STDC__
1682   char *file;
1683   int line;
1684   char *s;
1685 #endif
1686   va_list ap;
1687
1688   VA_START (ap, s);
1689
1690 #ifndef __STDC__
1691   file = va_arg (ap, char *);
1692   line = va_arg (ap, int);
1693   s = va_arg (ap, char *);
1694 #endif
1695
1696   v_pedwarn_with_file_and_line (file, line, s, ap);
1697   va_end (ap);
1698 }
1699
1700 /* Apologize for not implementing some feature.  */
1701
1702 static void
1703 vsorry (s, ap)
1704      char *s;
1705      va_list ap;
1706 {
1707   sorrycount++;
1708   if (input_filename)
1709     fprintf (stderr, "%s:%d: ", input_filename, lineno);
1710   else
1711     fprintf (stderr, "%s: ", progname);
1712   vmessage ("sorry, not implemented", s, ap);
1713   fputc ('\n', stderr);
1714 }
1715
1716 void
1717 sorry VPROTO((char *s, ...))
1718 {
1719 #ifndef __STDC__
1720   char *s;
1721 #endif
1722   va_list ap;
1723
1724   VA_START (ap, s);
1725
1726 #ifndef __STDC__
1727   s = va_arg (ap, char *);
1728 #endif
1729
1730   vsorry (s, ap);
1731   va_end (ap);
1732 }
1733
1734 /* Apologize for not implementing some feature, then quit.  */
1735
1736 static void
1737 v_really_sorry (s, ap)
1738      char *s;
1739      va_list ap;
1740 {
1741   sorrycount++;
1742   if (input_filename)
1743     fprintf (stderr, "%s:%d: ", input_filename, lineno);
1744   else
1745     fprintf (stderr, "%s: ", progname);
1746   vmessage ("sorry, not implemented", s, ap);
1747   fatal (" (fatal)\n");
1748 }
1749
1750 void
1751 really_sorry VPROTO((char *s, ...))
1752 {
1753 #ifndef __STDC__
1754   char *s;
1755 #endif
1756   va_list ap;
1757
1758   VA_START (ap, s);
1759
1760 #ifndef __STDC__
1761   s = va_arg (ap, char *);
1762 #endif
1763
1764   v_really_sorry (s, ap);
1765   va_end (ap);
1766 }
1767 \f
1768 /* More 'friendly' abort that prints the line and file.
1769    config.h can #define abort fancy_abort if you like that sort of thing.
1770
1771    I don't think this is actually a good idea.
1772    Other sorts of crashes will look a certain way.
1773    It is a good thing if crashes from calling abort look the same way.
1774      -- RMS  */
1775
1776 void
1777 fancy_abort ()
1778 {
1779   fatal ("internal gcc abort");
1780 }
1781
1782 /* This calls abort and is used to avoid problems when abort if a macro.
1783    It is used when we need to pass the address of abort.  */
1784
1785 void
1786 do_abort ()
1787 {
1788   abort ();
1789 }
1790
1791 /* When `malloc.c' is compiled with `rcheck' defined,
1792    it calls this function to report clobberage.  */
1793
1794 void
1795 botch (s)
1796 {
1797   abort ();
1798 }
1799
1800 /* Same as `malloc' but report error if no memory available.  */
1801
1802 char *
1803 xmalloc (size)
1804      unsigned size;
1805 {
1806   register char *value = (char *) malloc (size);
1807   if (value == 0)
1808     fatal ("virtual memory exhausted");
1809   return value;
1810 }
1811
1812 /* Same as `realloc' but report error if no memory available.  */
1813
1814 char *
1815 xrealloc (ptr, size)
1816      char *ptr;
1817      int size;
1818 {
1819   char *result = (char *) realloc (ptr, size);
1820   if (!result)
1821     fatal ("virtual memory exhausted");
1822   return result;
1823 }
1824
1825 /* Same as `strdup' but report error if no memory available.  */
1826
1827 char *
1828 xstrdup (s)
1829      register char *s;
1830 {
1831   register char *result = (char *) malloc (strlen (s) + 1);
1832
1833   if (! result)
1834     fatal ("virtual memory exhausted");
1835   strcpy (result, s);
1836   return result;
1837 }
1838 \f
1839 /* Return the logarithm of X, base 2, considering X unsigned,
1840    if X is a power of 2.  Otherwise, returns -1.
1841
1842    This should be used via the `exact_log2' macro.  */
1843
1844 int
1845 exact_log2_wide (x)
1846      register unsigned HOST_WIDE_INT x;
1847 {
1848   register int log = 0;
1849   /* Test for 0 or a power of 2.  */
1850   if (x == 0 || x != (x & -x))
1851     return -1;
1852   while ((x >>= 1) != 0)
1853     log++;
1854   return log;
1855 }
1856
1857 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
1858    If X is 0, return -1.
1859
1860    This should be used via the floor_log2 macro.  */
1861
1862 int
1863 floor_log2_wide (x)
1864      register unsigned HOST_WIDE_INT x;
1865 {
1866   register int log = -1;
1867   while (x != 0)
1868     log++,
1869     x >>= 1;
1870   return log;
1871 }
1872
1873 int float_handled;
1874 jmp_buf float_handler;
1875
1876 /* Specify where to longjmp to when a floating arithmetic error happens.
1877    If HANDLER is 0, it means don't handle the errors any more.  */
1878
1879 void
1880 set_float_handler (handler)
1881      jmp_buf handler;
1882 {
1883   float_handled = (handler != 0);
1884   if (handler)
1885     bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1886 }
1887
1888 /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1889    error happens, pushing the previous specification into OLD_HANDLER.
1890    Return an indication of whether there was a previous handler in effect.  */
1891
1892 int
1893 push_float_handler (handler, old_handler)
1894      jmp_buf handler, old_handler;
1895 {
1896   int was_handled = float_handled;
1897
1898   float_handled = 1;
1899   if (was_handled)
1900     bcopy ((char *) float_handler, (char *) old_handler,
1901            sizeof (float_handler));
1902
1903   bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1904   return was_handled;
1905 }
1906
1907 /* Restore the previous specification of whether and where to longjmp to
1908    when a floating arithmetic error happens.  */
1909
1910 void
1911 pop_float_handler (handled, handler)
1912      int handled;
1913      jmp_buf handler;
1914 {
1915   float_handled = handled;
1916   if (handled)
1917     bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
1918 }
1919
1920 /* Signals actually come here.  */
1921
1922 static void
1923 float_signal (signo)
1924      /* If this is missing, some compilers complain.  */
1925      int signo;
1926 {
1927   if (float_handled == 0)
1928     abort ();
1929 #if defined (USG) || defined (hpux)
1930   signal (SIGFPE, float_signal);  /* re-enable the signal catcher */
1931 #endif
1932   float_handled = 0;
1933   signal (SIGFPE, float_signal);
1934   longjmp (float_handler, 1);
1935 }
1936
1937 /* Handler for SIGPIPE.  */
1938
1939 static void
1940 pipe_closed (signo)
1941      /* If this is missing, some compilers complain.  */
1942      int signo;
1943 {
1944   fatal ("output pipe has been closed");
1945 }
1946
1947 /* Strip off a legitimate source ending from the input string NAME of
1948    length LEN.  Rather than having to know the names used by all of
1949    our front ends, we strip off an ending of a period followed by one,
1950    two, or three characters.  */
1951
1952 void
1953 strip_off_ending (name, len)
1954      char *name;
1955      int len;
1956 {
1957   if (len > 2 && name[len - 2] == '.')
1958     name[len - 2] = '\0';
1959   else if (len > 3 && name[len - 3] == '.')
1960     name[len - 3] = '\0';
1961   else if (len > 4 && name[len - 4] == '.')
1962     name[len - 4] = '\0';
1963 }
1964
1965 /* Output a quoted string.  */
1966
1967 void
1968 output_quoted_string (asm_file, string)
1969      FILE *asm_file;
1970      char *string;
1971 {
1972   char c;
1973
1974   putc ('\"', asm_file);
1975   while ((c = *string++) != 0)
1976     {
1977       if (c == '\"' || c == '\\')
1978         putc ('\\', asm_file);
1979       putc (c, asm_file);
1980     }
1981   putc ('\"', asm_file);
1982 }
1983
1984 /* Output a file name in the form wanted by System V.  */
1985
1986 void
1987 output_file_directive (asm_file, input_name)
1988      FILE *asm_file;
1989      char *input_name;
1990 {
1991   int len = strlen (input_name);
1992   char *na = input_name + len;
1993
1994   /* NA gets INPUT_NAME sans directory names.  */
1995   while (na > input_name)
1996     {
1997       if (na[-1] == '/')
1998         break;
1999       na--;
2000     }
2001
2002 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
2003   ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
2004 #else
2005 #ifdef ASM_OUTPUT_SOURCE_FILENAME
2006   ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
2007 #else
2008   fprintf (asm_file, "\t.file\t");
2009   output_quoted_string (asm_file, na);
2010   fputc ('\n', asm_file);
2011 #endif
2012 #endif
2013 }
2014 \f
2015 /* Routine to build language identifier for object file.  */
2016
2017 static void
2018 output_lang_identify (asm_out_file)
2019      FILE *asm_out_file;
2020 {
2021   int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
2022   char *s = (char *) alloca (len);
2023   sprintf (s, "__gnu_compiled_%s", lang_identify ());
2024   ASM_OUTPUT_LABEL (asm_out_file, s);
2025 }
2026
2027 /* Routine to open a dump file.  */
2028
2029 static FILE *
2030 open_dump_file (base_name, suffix)
2031      char *base_name;
2032      char *suffix;
2033 {
2034   FILE *f;
2035   char *dumpname = (char *) alloca (strlen (base_name) + strlen (suffix) + 1);
2036
2037   strcpy (dumpname, base_name);
2038   strcat (dumpname, suffix);
2039   f = fopen (dumpname, "w");
2040   if (f == 0)
2041     pfatal_with_name (dumpname);
2042   return f;
2043 }
2044
2045 /* Compile an entire file of output from cpp, named NAME.
2046    Write a file of assembly output and various debugging dumps.  */
2047
2048 static void
2049 compile_file (name)
2050      char *name;
2051 {
2052   tree globals;
2053   int start_time;
2054
2055   int name_specified = name != 0;
2056
2057   if (dump_base_name == 0)
2058     dump_base_name = name ? name : "gccdump";
2059
2060   parse_time = 0;
2061   varconst_time = 0;
2062   integration_time = 0;
2063   jump_time = 0;
2064   cse_time = 0;
2065   loop_time = 0;
2066   cse2_time = 0;
2067   flow_time = 0;
2068   combine_time = 0;
2069   sched_time = 0;
2070   local_alloc_time = 0;
2071   global_alloc_time = 0;
2072   sched2_time = 0;
2073   dbr_sched_time = 0;
2074   shorten_branch_time = 0;
2075   stack_reg_time = 0;
2076   final_time = 0;
2077   symout_time = 0;
2078   dump_time = 0;
2079
2080   /* Open input file.  */
2081
2082   if (name == 0 || !strcmp (name, "-"))
2083     {
2084       finput = stdin;
2085       name = "stdin";
2086     }
2087   else
2088     finput = fopen (name, "r");
2089   if (finput == 0)
2090     pfatal_with_name (name);
2091
2092 #ifdef IO_BUFFER_SIZE
2093   setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
2094 #endif
2095
2096   /* Initialize data in various passes.  */
2097
2098   init_obstacks ();
2099   init_tree_codes ();
2100   init_lex ();
2101   /* Some of these really don't need to be called when generating bytecode,
2102      but the options would have to be parsed first to know that. -bson */
2103   init_rtl ();
2104   init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
2105                   || debug_info_level == DINFO_LEVEL_VERBOSE);
2106   init_regs ();
2107   init_decl_processing ();
2108   init_optabs ();
2109   init_stmt ();
2110   init_expmed ();
2111   init_expr_once ();
2112   init_loop ();
2113   init_reload ();
2114
2115   if (flag_caller_saves)
2116     init_caller_save ();
2117
2118   /* If auxiliary info generation is desired, open the output file.
2119      This goes in the same directory as the source file--unlike
2120      all the other output files.  */
2121   if (flag_gen_aux_info)
2122     {
2123       aux_info_file = fopen (aux_info_file_name, "w");
2124       if (aux_info_file == 0)
2125         pfatal_with_name (aux_info_file_name);
2126     }
2127
2128   /* If rtl dump desired, open the output file.  */
2129   if (rtl_dump)
2130     rtl_dump_file = open_dump_file (dump_base_name, ".rtl");
2131
2132   /* If jump_opt dump desired, open the output file.  */
2133   if (jump_opt_dump)
2134     jump_opt_dump_file = open_dump_file (dump_base_name, ".jump");
2135
2136   /* If cse dump desired, open the output file.  */
2137   if (cse_dump)
2138     cse_dump_file = open_dump_file (dump_base_name, ".cse");
2139
2140   /* If loop dump desired, open the output file.  */
2141   if (loop_dump)
2142     loop_dump_file = open_dump_file (dump_base_name, ".loop");
2143
2144   /* If cse2 dump desired, open the output file.  */
2145   if (cse2_dump)
2146     cse2_dump_file = open_dump_file (dump_base_name, ".cse2");
2147
2148   /* If flow dump desired, open the output file.  */
2149   if (flow_dump)
2150     flow_dump_file = open_dump_file (dump_base_name, ".flow");
2151
2152   /* If combine dump desired, open the output file.  */
2153   if (combine_dump)
2154     combine_dump_file = open_dump_file (dump_base_name, ".combine");
2155
2156   /* If scheduling dump desired, open the output file.  */
2157   if (sched_dump)
2158     sched_dump_file = open_dump_file (dump_base_name, ".sched");
2159
2160   /* If local_reg dump desired, open the output file.  */
2161   if (local_reg_dump)
2162     local_reg_dump_file = open_dump_file (dump_base_name, ".lreg");
2163
2164   /* If global_reg dump desired, open the output file.  */
2165   if (global_reg_dump)
2166     global_reg_dump_file = open_dump_file (dump_base_name, ".greg");
2167
2168   /* If 2nd scheduling dump desired, open the output file.  */
2169   if (sched2_dump)
2170     sched2_dump_file = open_dump_file (dump_base_name, ".sched2");
2171
2172   /* If jump2_opt dump desired, open the output file.  */
2173   if (jump2_opt_dump)
2174     jump2_opt_dump_file = open_dump_file (dump_base_name, ".jump2");
2175
2176   /* If dbr_sched dump desired, open the output file.  */
2177   if (dbr_sched_dump)
2178     dbr_sched_dump_file = open_dump_file (dump_base_name, ".dbr");
2179
2180 #ifdef STACK_REGS
2181
2182   /* If stack_reg dump desired, open the output file.  */
2183   if (stack_reg_dump)
2184     stack_reg_dump_file = open_dump_file (dump_base_name, ".stack");
2185
2186 #endif
2187
2188   /* Open assembler code output file.  */
2189
2190   if (! name_specified && asm_file_name == 0)
2191     asm_out_file = stdout;
2192   else
2193     {
2194       int len = strlen (dump_base_name);
2195       register char *dumpname = (char *) xmalloc (len + 6);
2196       strcpy (dumpname, dump_base_name);
2197       strip_off_ending (dumpname, len);
2198       strcat (dumpname, ".s");
2199       if (asm_file_name == 0)
2200         {
2201           asm_file_name = (char *) xmalloc (strlen (dumpname) + 1);
2202           strcpy (asm_file_name, dumpname);
2203         }
2204       if (!strcmp (asm_file_name, "-"))
2205         asm_out_file = stdout;
2206       else
2207         asm_out_file = fopen (asm_file_name, "w");
2208       if (asm_out_file == 0)
2209         pfatal_with_name (asm_file_name);
2210     }
2211
2212 #ifdef IO_BUFFER_SIZE
2213   setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
2214            _IOFBF, IO_BUFFER_SIZE);
2215 #endif
2216
2217   input_filename = name;
2218
2219   /* Put an entry on the input file stack for the main input file.  */
2220   input_file_stack
2221     = (struct file_stack *) xmalloc (sizeof (struct file_stack));
2222   input_file_stack->next = 0;
2223   input_file_stack->name = input_filename;
2224
2225   /* Perform language-specific initialization.
2226      This may set main_input_filename.  */
2227   lang_init ();
2228
2229   /* If the input doesn't start with a #line, use the input name
2230      as the official input file name.  */
2231   if (main_input_filename == 0)
2232     main_input_filename = name;
2233
2234   if (!output_bytecode)
2235     {
2236       ASM_FILE_START (asm_out_file);
2237
2238 #ifdef ASM_COMMENT_START
2239       if (flag_verbose_asm)
2240         {
2241           /* Print the list of options in effect.  */
2242           print_version (asm_out_file, ASM_COMMENT_START);
2243           print_switch_values (asm_out_file, 0, MAX_LINE,
2244                                ASM_COMMENT_START, " ", "\n");
2245           /* Add a blank line here so it appears in assembler output but not
2246              screen output.  */
2247           fprintf (asm_out_file, "\n");
2248         }
2249 #endif
2250     }
2251
2252   /* Output something to inform GDB that this compilation was by GCC.  Also
2253      serves to tell GDB file consists of bytecodes.  */
2254   if (output_bytecode)
2255     fprintf (asm_out_file, "bc_gcc2_compiled.:\n");
2256   else
2257     {
2258 #ifndef ASM_IDENTIFY_GCC
2259       fprintf (asm_out_file, "gcc2_compiled.:\n");
2260 #else
2261       ASM_IDENTIFY_GCC (asm_out_file);
2262 #endif
2263     }
2264
2265   /* Output something to identify which front-end produced this file.  */
2266 #ifdef ASM_IDENTIFY_LANGUAGE
2267   ASM_IDENTIFY_LANGUAGE (asm_out_file);
2268 #endif
2269
2270 #ifndef ASM_OUTPUT_SECTION_NAME
2271   if (flag_function_sections)
2272     {
2273       warning ("-ffunction-sections not supported for this target.");
2274       flag_function_sections = 0;
2275     }
2276 #endif
2277
2278   if (flag_function_sections
2279       && (profile_flag || profile_block_flag))
2280     {
2281       warning ("-ffunction-sections disabled; it makes profiling impossible.");
2282       flag_function_sections = 0;
2283     }
2284
2285   if (flag_function_sections && write_symbols != NO_DEBUG)
2286     warning ("-ffunction-sections may affect debugging on some targets.");
2287
2288   if (output_bytecode)
2289     {
2290       if (profile_flag || profile_block_flag)
2291         error ("profiling not supported in bytecode compilation");
2292     }
2293   else
2294     {
2295       /* ??? Note: There used to be a conditional here
2296          to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
2297          This was to guarantee separation between gcc_compiled. and
2298          the first function, for the sake of dbx on Suns.
2299          However, having the extra zero here confused the Emacs
2300          code for unexec, and might confuse other programs too.
2301          Therefore, I took out that change.
2302          In future versions we should find another way to solve
2303          that dbx problem.  -- rms, 23 May 93.  */
2304       
2305       /* Don't let the first function fall at the same address
2306          as gcc_compiled., if profiling.  */
2307       if (profile_flag || profile_block_flag)
2308         assemble_zeros (UNITS_PER_WORD);
2309     }
2310
2311   /* If dbx symbol table desired, initialize writing it
2312      and output the predefined types.  */
2313 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2314   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2315     TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
2316                                        getdecls ()));
2317 #endif
2318 #ifdef SDB_DEBUGGING_INFO
2319   if (write_symbols == SDB_DEBUG)
2320     TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
2321                                        getdecls ()));
2322 #endif
2323 #ifdef DWARF_DEBUGGING_INFO
2324   if (write_symbols == DWARF_DEBUG)
2325     TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
2326 #endif
2327 #ifdef DWARF2_DEBUGGING_INFO
2328   if (write_symbols == DWARF2_DEBUG)
2329     TIMEVAR (symout_time, dwarf2out_init (asm_out_file, main_input_filename));
2330 #endif
2331
2332   /* Initialize yet another pass.  */
2333
2334   if (!output_bytecode)
2335     init_final (main_input_filename);
2336
2337   start_time = get_run_time ();
2338
2339   /* Call the parser, which parses the entire file
2340      (calling rest_of_compilation for each function).  */
2341
2342   if (yyparse () != 0)
2343     {
2344       if (errorcount == 0)
2345         fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
2346
2347       /* In case there were missing closebraces,
2348          get us back to the global binding level.  */
2349       while (! global_bindings_p ())
2350         poplevel (0, 0, 0);
2351     }
2352
2353   /* Compilation is now finished except for writing
2354      what's left of the symbol table output.  */
2355
2356   parse_time += get_run_time () - start_time;
2357
2358   parse_time -= integration_time;
2359   parse_time -= varconst_time;
2360
2361   globals = getdecls ();
2362
2363   /* Really define vars that have had only a tentative definition.
2364      Really output inline functions that must actually be callable
2365      and have not been output so far.  */
2366
2367   {
2368     int len = list_length (globals);
2369     tree *vec = (tree *) alloca (sizeof (tree) * len);
2370     int i;
2371     tree decl;
2372     int reconsider = 1;
2373
2374     /* Process the decls in reverse order--earliest first.
2375        Put them into VEC from back to front, then take out from front.  */
2376
2377     for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
2378       vec[len - i - 1] = decl;
2379
2380     for (i = 0; i < len; i++)
2381       {
2382         decl = vec[i];
2383
2384         /* We're not deferring this any longer.  */
2385         DECL_DEFER_OUTPUT (decl) = 0;
2386
2387         if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
2388             && incomplete_decl_finalize_hook != 0)
2389           (*incomplete_decl_finalize_hook) (decl);
2390       }
2391
2392     /* Now emit any global variables or functions that we have been putting
2393        off.  We need to loop in case one of the things emitted here
2394        references another one which comes earlier in the list.  */
2395     while (reconsider)
2396       {
2397         reconsider = 0;
2398         for (i = 0; i < len; i++)
2399           {
2400             decl = vec[i];
2401
2402             if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
2403               continue;
2404
2405             /* Don't write out static consts, unless we still need them.
2406
2407                We also keep static consts if not optimizing (for debugging),
2408                unless the user specified -fno-keep-static-consts.
2409                ??? They might be better written into the debug information.
2410                This is possible when using DWARF.
2411
2412                A language processor that wants static constants to be always
2413                written out (even if it is not used) is responsible for
2414                calling rest_of_decl_compilation itself.  E.g. the C front-end
2415                calls rest_of_decl_compilation from finish_decl.
2416                One motivation for this is that is conventional in some
2417                environments to write things like:
2418                    static const char rcsid[] = "... version string ...";
2419                intending to force the string to be in the executable.
2420
2421                A language processor that would prefer to have unneeded
2422                static constants "optimized away" would just defer writing
2423                them out until here.  E.g. C++ does this, because static
2424                constants are often defined in header files.
2425
2426                ??? A tempting alternative (for both C and C++) would be
2427                to force a constant to be written if and only if it is
2428                defined in a main file, as opposed to an include file.  */
2429
2430             if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
2431                 && (! TREE_READONLY (decl)
2432                     || TREE_PUBLIC (decl)
2433                     || (!optimize && flag_keep_static_consts)
2434                     || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
2435               {
2436                 reconsider = 1;
2437                 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
2438               }
2439
2440             if (TREE_CODE (decl) == FUNCTION_DECL
2441                 && DECL_INITIAL (decl) != 0
2442                 && DECL_SAVED_INSNS (decl) != 0
2443                 && (flag_keep_inline_functions
2444                     || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
2445               {
2446                 reconsider = 1;
2447                 temporary_allocation ();
2448                 output_inline_function (decl);
2449                 permanent_allocation (1);
2450               }
2451           }
2452       }
2453
2454     /* Now that all possible functions have been output, we can dump
2455        the exception table.  */
2456
2457     if (exception_table_p ())
2458       output_exception_table ();
2459
2460     for (i = 0; i < len; i++)
2461       {
2462         decl = vec[i];
2463
2464         if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
2465             && ! TREE_ASM_WRITTEN (decl))
2466           /* Cancel the RTL for this decl so that, if debugging info
2467              output for global variables is still to come,
2468              this one will be omitted.  */
2469           DECL_RTL (decl) = NULL;
2470
2471         /* Warn about any function
2472            declared static but not defined.
2473            We don't warn about variables,
2474            because many programs have static variables
2475            that exist only to get some text into the object file.  */
2476         if (TREE_CODE (decl) == FUNCTION_DECL
2477             && (warn_unused
2478                 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
2479             && DECL_INITIAL (decl) == 0
2480             && DECL_EXTERNAL (decl)
2481             && ! DECL_ARTIFICIAL (decl)
2482             && ! TREE_PUBLIC (decl))
2483           {
2484             pedwarn_with_decl (decl, 
2485                                "`%s' declared `static' but never defined");
2486             /* This symbol is effectively an "extern" declaration now.  */
2487             TREE_PUBLIC (decl) = 1;
2488             assemble_external (decl);
2489           }
2490
2491         /* Warn about static fns or vars defined but not used,
2492            but not about inline functions or static consts
2493            since defining those in header files is normal practice.  */
2494         if (warn_unused
2495             && ((TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
2496                 || (TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
2497             && ! DECL_IN_SYSTEM_HEADER (decl)
2498             && ! DECL_EXTERNAL (decl)
2499             && ! TREE_PUBLIC (decl)
2500             && ! TREE_USED (decl)
2501             && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
2502             /* The TREE_USED bit for file-scope decls
2503                is kept in the identifier, to handle multiple
2504                external decls in different scopes.  */
2505             && ! TREE_USED (DECL_NAME (decl)))
2506           warning_with_decl (decl, "`%s' defined but not used");
2507
2508 #ifdef SDB_DEBUGGING_INFO
2509         /* The COFF linker can move initialized global vars to the end.
2510            And that can screw up the symbol ordering.
2511            By putting the symbols in that order to begin with,
2512            we avoid a problem.  mcsun!unido!fauern!tumuc!pes@uunet.uu.net.  */
2513         if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
2514             && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
2515             && ! DECL_EXTERNAL (decl)
2516             && DECL_RTL (decl) != 0)
2517           TIMEVAR (symout_time, sdbout_symbol (decl, 0));
2518
2519         /* Output COFF information for non-global
2520            file-scope initialized variables.  */
2521         if (write_symbols == SDB_DEBUG
2522             && TREE_CODE (decl) == VAR_DECL
2523             && DECL_INITIAL (decl)
2524             && ! DECL_EXTERNAL (decl)
2525             && DECL_RTL (decl) != 0
2526             && GET_CODE (DECL_RTL (decl)) == MEM)
2527           TIMEVAR (symout_time, sdbout_toplevel_data (decl));
2528 #endif /* SDB_DEBUGGING_INFO */
2529 #ifdef DWARF_DEBUGGING_INFO
2530         /* Output DWARF information for file-scope tentative data object
2531            declarations, file-scope (extern) function declarations (which
2532            had no corresponding body) and file-scope tagged type declarations
2533            and definitions which have not yet been forced out.  */
2534
2535         if (write_symbols == DWARF_DEBUG
2536             && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2537           TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
2538 #endif
2539 #ifdef DWARF2_DEBUGGING_INFO
2540         /* Output DWARF2 information for file-scope tentative data object
2541            declarations, file-scope (extern) function declarations (which
2542            had no corresponding body) and file-scope tagged type declarations
2543            and definitions which have not yet been forced out.  */
2544
2545         if (write_symbols == DWARF2_DEBUG
2546             && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
2547           TIMEVAR (symout_time, dwarf2out_decl (decl));
2548 #endif
2549       }
2550   }
2551
2552   /* Write out any pending weak symbol declarations.  */
2553
2554   weak_finish ();
2555
2556   /* Do dbx symbols */
2557 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2558   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2559     TIMEVAR (symout_time,
2560              {
2561                dbxout_finish (asm_out_file, main_input_filename);
2562              });
2563 #endif
2564
2565 #ifdef DWARF_DEBUGGING_INFO
2566   if (write_symbols == DWARF_DEBUG)
2567     TIMEVAR (symout_time,
2568              {
2569                dwarfout_finish ();
2570              });
2571 #endif
2572
2573 #ifdef DWARF2_DEBUGGING_INFO
2574   if (write_symbols == DWARF2_DEBUG)
2575     TIMEVAR (symout_time,
2576              {
2577                dwarf2out_finish ();
2578              });
2579 #endif
2580
2581   /* Output some stuff at end of file if nec.  */
2582
2583   if (!output_bytecode)
2584     {
2585       end_final (main_input_filename);
2586
2587 #ifdef ASM_FILE_END
2588       ASM_FILE_END (asm_out_file);
2589 #endif
2590     }
2591
2592   /* Language-specific end of compilation actions.  */
2593
2594   lang_finish ();
2595
2596   if (output_bytecode)
2597     bc_write_file (asm_out_file);
2598
2599   /* Close the dump files.  */
2600
2601   if (flag_gen_aux_info)
2602     {
2603       fclose (aux_info_file);
2604       if (errorcount)
2605         unlink (aux_info_file_name);
2606     }
2607
2608   if (rtl_dump)
2609     fclose (rtl_dump_file);
2610
2611   if (jump_opt_dump)
2612     fclose (jump_opt_dump_file);
2613
2614   if (cse_dump)
2615     fclose (cse_dump_file);
2616
2617   if (loop_dump)
2618     fclose (loop_dump_file);
2619
2620   if (cse2_dump)
2621     fclose (cse2_dump_file);
2622
2623   if (flow_dump)
2624     fclose (flow_dump_file);
2625
2626   if (combine_dump)
2627     {
2628       dump_combine_total_stats (combine_dump_file);
2629       fclose (combine_dump_file);
2630     }
2631
2632   if (sched_dump)
2633     fclose (sched_dump_file);
2634
2635   if (local_reg_dump)
2636     fclose (local_reg_dump_file);
2637
2638   if (global_reg_dump)
2639     fclose (global_reg_dump_file);
2640
2641   if (sched2_dump)
2642     fclose (sched2_dump_file);
2643
2644   if (jump2_opt_dump)
2645     fclose (jump2_opt_dump_file);
2646
2647   if (dbr_sched_dump)
2648     fclose (dbr_sched_dump_file);
2649
2650 #ifdef STACK_REGS
2651   if (stack_reg_dump)
2652     fclose (stack_reg_dump_file);
2653 #endif
2654
2655   /* Close non-debugging input and output files.  Take special care to note
2656      whether fclose returns an error, since the pages might still be on the
2657      buffer chain while the file is open.  */
2658
2659   fclose (finput);
2660   if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
2661     fatal_io_error (asm_file_name);
2662
2663   /* Print the times.  */
2664
2665   if (! quiet_flag)
2666     {
2667       fprintf (stderr,"\n");
2668       print_time ("parse", parse_time);
2669
2670       if (!output_bytecode)
2671         {
2672           print_time ("integration", integration_time);
2673           print_time ("jump", jump_time);
2674           print_time ("cse", cse_time);
2675           print_time ("loop", loop_time);
2676           print_time ("cse2", cse2_time);
2677           print_time ("flow", flow_time);
2678           print_time ("combine", combine_time);
2679           print_time ("sched", sched_time);
2680           print_time ("local-alloc", local_alloc_time);
2681           print_time ("global-alloc", global_alloc_time);
2682           print_time ("sched2", sched2_time);
2683           print_time ("dbranch", dbr_sched_time);
2684           print_time ("shorten-branch", shorten_branch_time);
2685           print_time ("stack-reg", stack_reg_time);
2686           print_time ("final", final_time);
2687           print_time ("varconst", varconst_time);
2688           print_time ("symout", symout_time);
2689           print_time ("dump", dump_time);
2690         }
2691     }
2692 }
2693 \f
2694 /* This is called from various places for FUNCTION_DECL, VAR_DECL,
2695    and TYPE_DECL nodes.
2696
2697    This does nothing for local (non-static) variables.
2698    Otherwise, it sets up the RTL and outputs any assembler code
2699    (label definition, storage allocation and initialization).
2700
2701    DECL is the declaration.  If ASMSPEC is nonzero, it specifies
2702    the assembler symbol name to be used.  TOP_LEVEL is nonzero
2703    if this declaration is not within a function.  */
2704
2705 void
2706 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2707      tree decl;
2708      char *asmspec;
2709      int top_level;
2710      int at_end;
2711 {
2712   /* Declarations of variables, and of functions defined elsewhere.  */
2713
2714 /* The most obvious approach, to put an #ifndef around where
2715    this macro is used, doesn't work since it's inside a macro call.  */
2716 #ifndef ASM_FINISH_DECLARE_OBJECT
2717 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
2718 #endif
2719
2720   /* Forward declarations for nested functions are not "external",
2721      but we need to treat them as if they were.  */
2722   if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
2723       || TREE_CODE (decl) == FUNCTION_DECL)
2724     TIMEVAR (varconst_time,
2725              {
2726                make_decl_rtl (decl, asmspec, top_level);
2727                /* Initialized extern variable exists to be replaced
2728                   with its value, or represents something that will be
2729                   output in another file.  */
2730                if (! (TREE_CODE (decl) == VAR_DECL
2731                       && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
2732                       && DECL_INITIAL (decl) != 0
2733                       && DECL_INITIAL (decl) != error_mark_node))
2734                  /* Don't output anything
2735                     when a tentative file-scope definition is seen.
2736                     But at end of compilation, do output code for them.  */
2737                  if (! (! at_end && top_level
2738                         && (DECL_INITIAL (decl) == 0
2739                             || DECL_INITIAL (decl) == error_mark_node)))
2740                    assemble_variable (decl, top_level, at_end, 0);
2741                if (!output_bytecode
2742                    && decl == last_assemble_variable_decl)
2743                  {
2744                    ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
2745                                               top_level, at_end);
2746                  }
2747              });
2748   else if (DECL_REGISTER (decl) && asmspec != 0)
2749     {
2750       if (decode_reg_name (asmspec) >= 0)
2751         {
2752           DECL_RTL (decl) = 0;
2753           make_decl_rtl (decl, asmspec, top_level);
2754         }
2755       else
2756         error ("invalid register name `%s' for register variable", asmspec);
2757     }
2758 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2759   else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2760            && TREE_CODE (decl) == TYPE_DECL)
2761     TIMEVAR (symout_time, dbxout_symbol (decl, 0));
2762 #endif
2763 #ifdef SDB_DEBUGGING_INFO
2764   else if (write_symbols == SDB_DEBUG && top_level
2765            && TREE_CODE (decl) == TYPE_DECL)
2766     TIMEVAR (symout_time, sdbout_symbol (decl, 0));
2767 #endif
2768 }
2769
2770 /* Called after finishing a record, union or enumeral type.  */
2771
2772 void
2773 rest_of_type_compilation (type, toplev)
2774      tree type;
2775      int toplev;
2776 {
2777 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2778   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2779     TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
2780 #endif
2781 #ifdef SDB_DEBUGGING_INFO
2782   if (write_symbols == SDB_DEBUG)
2783     TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
2784 #endif
2785 }
2786
2787 /* This is called from finish_function (within yyparse)
2788    after each top-level definition is parsed.
2789    It is supposed to compile that function or variable
2790    and output the assembler code for it.
2791    After we return, the tree storage is freed.  */
2792
2793 void
2794 rest_of_compilation (decl)
2795      tree decl;
2796 {
2797   register rtx insns;
2798   int start_time = get_run_time ();
2799   int tem;
2800   /* Nonzero if we have saved the original DECL_INITIAL of the function,
2801      to be restored after we finish compiling the function
2802      (for use when compiling inline calls to this function).  */
2803   tree saved_block_tree = 0;
2804   /* Likewise, for DECL_ARGUMENTS.  */
2805   tree saved_arguments = 0;
2806   int failure = 0;
2807
2808   if (output_bytecode)
2809     return;
2810
2811   /* If we are reconsidering an inline function
2812      at the end of compilation, skip the stuff for making it inline.  */
2813
2814   if (DECL_SAVED_INSNS (decl) == 0)
2815     {
2816       int inlineable = 0;
2817       char *lose;
2818
2819       /* If requested, consider whether to make this function inline.  */
2820       if (DECL_INLINE (decl) || flag_inline_functions)
2821         TIMEVAR (integration_time,
2822                  {
2823                    lose = function_cannot_inline_p (decl);
2824                    if (lose || ! optimize)
2825                      {
2826                        if (warn_inline && DECL_INLINE (decl))
2827                          warning_with_decl (decl, lose);
2828                        DECL_ABSTRACT_ORIGIN (decl) = 0;
2829                        /* Don't really compile an extern inline function.
2830                           If we can't make it inline, pretend
2831                           it was only declared.  */
2832                        if (DECL_EXTERNAL (decl))
2833                          {
2834                            DECL_INITIAL (decl) = 0;
2835                            goto exit_rest_of_compilation;
2836                          }
2837                      }
2838                    else
2839                      /* ??? Note that this has the effect of making it look
2840                         like "inline" was specified for a function if we choose
2841                         to inline it.  This isn't quite right, but it's
2842                         probably not worth the trouble to fix.  */
2843                      inlineable = DECL_INLINE (decl) = 1;
2844                  });
2845
2846       insns = get_insns ();
2847
2848       /* Dump the rtl code if we are dumping rtl.  */
2849
2850       if (rtl_dump)
2851         TIMEVAR (dump_time,
2852                  {
2853                    fprintf (rtl_dump_file, "\n;; Function %s\n\n",
2854                             IDENTIFIER_POINTER (DECL_NAME (decl)));
2855                    if (DECL_SAVED_INSNS (decl))
2856                      fprintf (rtl_dump_file, ";; (integrable)\n\n");
2857                    print_rtl (rtl_dump_file, insns);
2858                    fflush (rtl_dump_file);
2859                  });
2860
2861       /* If function is inline, and we don't yet know whether to
2862          compile it by itself, defer decision till end of compilation.
2863          finish_compilation will call rest_of_compilation again
2864          for those functions that need to be output.  Also defer those
2865          functions that we are supposed to defer.  We cannot defer
2866          functions containing nested functions since the nested function
2867          data is in our non-saved obstack.  */
2868
2869       if (! current_function_contains_functions
2870           && (DECL_DEFER_OUTPUT (decl)
2871               || (DECL_INLINE (decl)
2872                   && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2873                        && ! flag_keep_inline_functions)
2874                       || DECL_EXTERNAL (decl)))))
2875         {
2876           DECL_DEFER_OUTPUT (decl) = 1;
2877
2878           /* If -Wreturn-type, we have to do a bit of compilation.  */
2879           if (! warn_return_type)
2880             {
2881 #ifdef DWARF_DEBUGGING_INFO
2882               /* Generate the DWARF info for the "abstract" instance
2883                  of a function which we may later generate inlined and/or
2884                  out-of-line instances of.  */
2885               if (write_symbols == DWARF_DEBUG)
2886                 {
2887                   set_decl_abstract_flags (decl, 1);
2888                   TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
2889                   set_decl_abstract_flags (decl, 0);
2890                 }
2891 #endif
2892 #ifdef DWARF2_DEBUGGING_INFO
2893               /* Generate the DWARF2 info for the "abstract" instance
2894                  of a function which we may later generate inlined and/or
2895                  out-of-line instances of.  */
2896               if (write_symbols == DWARF2_DEBUG)
2897                 {
2898                   set_decl_abstract_flags (decl, 1);
2899                   TIMEVAR (symout_time, dwarf2out_decl (decl));
2900                   set_decl_abstract_flags (decl, 0);
2901                 }
2902 #endif
2903               TIMEVAR (integration_time, save_for_inline_nocopy (decl));
2904               RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlineable;
2905               goto exit_rest_of_compilation;
2906             }
2907         }
2908
2909       /* If we have to compile the function now, save its rtl and subdecls
2910          so that its compilation will not affect what others get.  */
2911       if (inlineable || DECL_DEFER_OUTPUT (decl))
2912         {
2913 #ifdef DWARF_DEBUGGING_INFO
2914           /* Generate the DWARF info for the "abstract" instance of
2915              a function which we will generate an out-of-line instance
2916              of almost immediately (and which we may also later generate
2917              various inlined instances of).  */
2918           if (write_symbols == DWARF_DEBUG)
2919             {
2920               set_decl_abstract_flags (decl, 1);
2921               TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
2922               set_decl_abstract_flags (decl, 0);
2923             }
2924 #endif
2925 #ifdef DWARF2_DEBUGGING_INFO
2926           /* Generate the DWARF2 info for the "abstract" instance of
2927              a function which we will generate an out-of-line instance
2928              of almost immediately (and which we may also later generate
2929              various inlined instances of).  */
2930           if (write_symbols == DWARF2_DEBUG)
2931             {
2932               set_decl_abstract_flags (decl, 1);
2933               TIMEVAR (symout_time, dwarf2out_decl (decl));
2934               set_decl_abstract_flags (decl, 0);
2935             }
2936 #endif
2937           saved_block_tree = DECL_INITIAL (decl);
2938           saved_arguments = DECL_ARGUMENTS (decl);
2939           TIMEVAR (integration_time, save_for_inline_copying (decl));
2940           RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlineable;
2941         }
2942
2943       /* If specified extern inline but we aren't inlining it, we are
2944          done.  */
2945       if (DECL_INLINE (decl) && DECL_EXTERNAL (decl))
2946         goto exit_rest_of_compilation;
2947     }
2948
2949   if (! DECL_DEFER_OUTPUT (decl))
2950     TREE_ASM_WRITTEN (decl) = 1;
2951
2952   /* Now that integrate will no longer see our rtl, we need not distinguish
2953      between the return value of this function and the return value of called
2954      functions.  */
2955   rtx_equal_function_value_matters = 0;
2956
2957   /* Don't return yet if -Wreturn-type; we need to do jump_optimize.  */
2958   if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
2959     {
2960       goto exit_rest_of_compilation;
2961     }
2962
2963   /* Add an unwinder for exception handling, if needed.
2964      This must be done before we finalize PIC code.  */
2965   emit_unwinder ();
2966
2967 #ifdef FINALIZE_PIC
2968   /* If we are doing position-independent code generation, now
2969      is the time to output special prologues and epilogues.
2970      We do not want to do this earlier, because it just clutters
2971      up inline functions with meaningless insns.  */
2972   if (flag_pic)
2973     FINALIZE_PIC;
2974 #endif
2975
2976   /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
2977      Note that that may have been done above, in save_for_inline_copying.
2978      The call to resume_temporary_allocation near the end of this function
2979      goes back to the usual state of affairs.  This must be done after
2980      we've built up any unwinders for exception handling, and done
2981      the FINALIZE_PIC work, if necessary.  */
2982
2983   rtl_in_current_obstack ();
2984
2985   insns = get_insns ();
2986
2987   /* Copy any shared structure that should not be shared.  */
2988
2989   unshare_all_rtl (insns);
2990
2991   /* Instantiate all virtual registers.  */
2992
2993   instantiate_virtual_regs (current_function_decl, get_insns ());
2994
2995   /* See if we have allocated stack slots that are not directly addressable.
2996      If so, scan all the insns and create explicit address computation
2997      for all references to such slots.  */
2998 /*   fixup_stack_slots (); */
2999
3000   /* Find all the EH handlers.  */
3001   find_exception_handler_labels ();
3002
3003   /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
3004      are initialized and to compute whether control can drop off the end
3005      of the function.  */
3006   TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3007   TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
3008
3009   /* Now is when we stop if -fsyntax-only and -Wreturn-type.  */
3010   if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
3011     goto exit_rest_of_compilation;
3012
3013   /* Dump rtl code after jump, if we are doing that.  */
3014
3015   if (jump_opt_dump)
3016     TIMEVAR (dump_time,
3017              {
3018                fprintf (jump_opt_dump_file, "\n;; Function %s\n\n",
3019                         IDENTIFIER_POINTER (DECL_NAME (decl)));
3020                print_rtl (jump_opt_dump_file, insns);
3021                fflush (jump_opt_dump_file);
3022              });
3023
3024   /* Perform common subexpression elimination.
3025      Nonzero value from `cse_main' means that jumps were simplified
3026      and some code may now be unreachable, so do
3027      jump optimization again.  */
3028
3029   if (cse_dump)
3030     TIMEVAR (dump_time,
3031              {
3032                fprintf (cse_dump_file, "\n;; Function %s\n\n",
3033                         IDENTIFIER_POINTER (DECL_NAME (decl)));
3034              });
3035
3036   if (optimize > 0)
3037     {
3038       TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
3039
3040       if (flag_thread_jumps)
3041         /* Hacks by tiemann & kenner.  */
3042         TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 1));
3043
3044       TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
3045                                          0, cse_dump_file));
3046       TIMEVAR (cse_time, delete_dead_from_cse (insns, max_reg_num ()));
3047
3048       if (tem || optimize > 1)
3049         TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
3050     }
3051
3052   /* Dump rtl code after cse, if we are doing that.  */
3053
3054   if (cse_dump)
3055     TIMEVAR (dump_time,
3056              {
3057                print_rtl (cse_dump_file, insns);
3058                fflush (cse_dump_file);
3059              });
3060
3061   if (loop_dump)
3062     TIMEVAR (dump_time,
3063              {
3064                fprintf (loop_dump_file, "\n;; Function %s\n\n",
3065                         IDENTIFIER_POINTER (DECL_NAME (decl)));
3066              });
3067
3068   /* Move constant computations out of loops.  */
3069
3070   if (optimize > 0)
3071     {
3072       TIMEVAR (loop_time,
3073                {
3074                  loop_optimize (insns, loop_dump_file);
3075                });
3076     }
3077
3078   /* Dump rtl code after loop opt, if we are doing that.  */
3079
3080   if (loop_dump)
3081     TIMEVAR (dump_time,
3082              {
3083                print_rtl (loop_dump_file, insns);
3084                fflush (loop_dump_file);
3085              });
3086
3087   if (cse2_dump)
3088     TIMEVAR (dump_time,
3089              {
3090                fprintf (cse2_dump_file, "\n;; Function %s\n\n",
3091                         IDENTIFIER_POINTER (DECL_NAME (decl)));
3092              });
3093
3094   if (optimize > 0 && flag_rerun_cse_after_loop)
3095     {
3096       /* Running another jump optimization pass before the second
3097          cse pass sometimes simplifies the RTL enough to allow
3098          the second CSE pass to do a better job.  Jump_optimize can change
3099          max_reg_num so we must rerun reg_scan afterwards.
3100          ??? Rework to not call reg_scan so often.  */
3101       TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3102       TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
3103
3104       TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
3105       TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
3106                                           1, cse2_dump_file));
3107       if (tem)
3108         TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
3109     }
3110
3111   if (optimize > 0 && flag_thread_jumps)
3112     {
3113       /* This pass of jump threading straightens out code
3114          that was kinked by loop optimization.  */
3115       TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
3116       TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
3117     }
3118   /* Dump rtl code after cse, if we are doing that.  */
3119
3120   if (cse2_dump)
3121     TIMEVAR (dump_time,
3122              {
3123                print_rtl (cse2_dump_file, insns);
3124                fflush (cse2_dump_file);
3125              });
3126
3127   /* We are no longer anticipating cse in this function, at least.  */
3128
3129   cse_not_expected = 1;
3130
3131   /* Now we choose between stupid (pcc-like) register allocation
3132      (if we got the -noreg switch and not -opt)
3133      and smart register allocation.  */
3134
3135   if (optimize > 0)                     /* Stupid allocation probably won't work */
3136     obey_regdecls = 0;          /* if optimizations being done.  */
3137
3138   regclass_init ();
3139
3140   /* Print function header into flow dump now
3141      because doing the flow analysis makes some of the dump.  */
3142
3143   if (flow_dump)
3144     TIMEVAR (dump_time,
3145              {
3146                fprintf (flow_dump_file, "\n;; Function %s\n\n",
3147                         IDENTIFIER_POINTER (DECL_NAME (decl)));
3148              });
3149
3150   if (obey_regdecls)
3151     {
3152       TIMEVAR (flow_time,
3153                {
3154                  regclass (insns, max_reg_num ());
3155                  stupid_life_analysis (insns, max_reg_num (),
3156                                        flow_dump_file);
3157                });
3158     }
3159   else
3160     {
3161       /* Do control and data flow analysis,
3162          and write some of the results to dump file.  */
3163
3164       TIMEVAR (flow_time, flow_analysis (insns, max_reg_num (),
3165                                          flow_dump_file));
3166       if (warn_uninitialized)
3167         {
3168           uninitialized_vars_warning (DECL_INITIAL (decl));
3169           setjmp_args_warning ();
3170         }
3171     }
3172
3173   /* Dump rtl after flow analysis.  */
3174
3175   if (flow_dump)
3176     TIMEVAR (dump_time,
3177              {
3178                print_rtl (flow_dump_file, insns);
3179                fflush (flow_dump_file);
3180              });
3181
3182   /* If -opt, try combining insns through substitution.  */
3183
3184   if (optimize > 0)
3185     TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
3186
3187   /* Dump rtl code after insn combination.  */
3188
3189   if (combine_dump)
3190     TIMEVAR (dump_time,
3191              {
3192                fprintf (combine_dump_file, "\n;; Function %s\n\n",
3193                         IDENTIFIER_POINTER (DECL_NAME (decl)));
3194                dump_combine_stats (combine_dump_file);
3195                print_rtl (combine_dump_file, insns);
3196                fflush (combine_dump_file);
3197              });
3198
3199   /* Print function header into sched dump now
3200      because doing the sched analysis makes some of the dump.  */
3201
3202   if (sched_dump)
3203     TIMEVAR (dump_time,
3204              {
3205                fprintf (sched_dump_file, "\n;; Function %s\n\n",
3206                         IDENTIFIER_POINTER (DECL_NAME (decl)));
3207              });
3208
3209   if (optimize > 0 && flag_schedule_insns)
3210     {
3211       /* Do control and data sched analysis,
3212          and write some of the results to dump file.  */
3213
3214       TIMEVAR (sched_time, schedule_insns (sched_dump_file));
3215     }
3216
3217   /* Dump rtl after instruction scheduling.  */
3218
3219   if (sched_dump)
3220     TIMEVAR (dump_time,
3221              {
3222                print_rtl (sched_dump_file, insns);
3223                fflush (sched_dump_file);
3224              });
3225
3226   /* Unless we did stupid register allocation,
3227      allocate pseudo-regs that are used only within 1 basic block.  */
3228
3229   if (!obey_regdecls)
3230     TIMEVAR (local_alloc_time,
3231              {
3232                regclass (insns, max_reg_num ());
3233                local_alloc ();
3234              });
3235
3236   /* Dump rtl code after allocating regs within basic blocks.  */
3237
3238   if (local_reg_dump)
3239     TIMEVAR (dump_time,
3240              {
3241                fprintf (local_reg_dump_file, "\n;; Function %s\n\n",
3242                         IDENTIFIER_POINTER (DECL_NAME (decl)));
3243                dump_flow_info (local_reg_dump_file);
3244                dump_local_alloc (local_reg_dump_file);
3245                print_rtl (local_reg_dump_file, insns);
3246                fflush (local_reg_dump_file);
3247              });
3248
3249   if (global_reg_dump)
3250     TIMEVAR (dump_time,
3251              fprintf (global_reg_dump_file, "\n;; Function %s\n\n",
3252                       IDENTIFIER_POINTER (DECL_NAME (decl))));
3253
3254   /* Save the last label number used so far, so reorg can tell
3255      when it's safe to kill spill regs.  */
3256   max_label_num_after_reload = max_label_num ();
3257
3258   /* Unless we did stupid register allocation,
3259      allocate remaining pseudo-regs, then do the reload pass
3260      fixing up any insns that are invalid.  */
3261
3262   TIMEVAR (global_alloc_time,
3263            {
3264              if (!obey_regdecls)
3265                failure = global_alloc (global_reg_dump_file);
3266              else
3267                failure = reload (insns, 0, global_reg_dump_file);
3268            });
3269
3270   if (global_reg_dump)
3271     TIMEVAR (dump_time,
3272              {
3273                dump_global_regs (global_reg_dump_file);
3274                print_rtl (global_reg_dump_file, insns);
3275                fflush (global_reg_dump_file);
3276              });
3277
3278   if (failure)
3279     goto exit_rest_of_compilation;
3280
3281   reload_completed = 1;
3282
3283   /* On some machines, the prologue and epilogue code, or parts thereof,
3284      can be represented as RTL.  Doing so lets us schedule insns between
3285      it and the rest of the code and also allows delayed branch
3286      scheduling to operate in the epilogue.  */
3287
3288   thread_prologue_and_epilogue_insns (insns);
3289
3290   if (optimize > 0 && flag_schedule_insns_after_reload)
3291     {
3292       if (sched2_dump)
3293         TIMEVAR (dump_time,
3294                  {
3295                    fprintf (sched2_dump_file, "\n;; Function %s\n\n",
3296                             IDENTIFIER_POINTER (DECL_NAME (decl)));
3297                  });
3298
3299       /* Do control and data sched analysis again,
3300          and write some more of the results to dump file.  */
3301
3302       TIMEVAR (sched2_time, schedule_insns (sched2_dump_file));
3303
3304       /* Dump rtl after post-reorder instruction scheduling.  */
3305
3306       if (sched2_dump)
3307         TIMEVAR (dump_time,
3308                  {
3309                    print_rtl (sched2_dump_file, insns);
3310                    fflush (sched2_dump_file);
3311                  });
3312     }
3313
3314 #ifdef LEAF_REGISTERS
3315   leaf_function = 0;
3316   if (optimize > 0 && only_leaf_regs_used () && leaf_function_p ())
3317     leaf_function = 1;
3318 #endif
3319
3320   /* One more attempt to remove jumps to .+1
3321      left by dead-store-elimination.
3322      Also do cross-jumping this time
3323      and delete no-op move insns.  */
3324
3325   if (optimize > 0)
3326     {
3327       TIMEVAR (jump_time, jump_optimize (insns, 1, 1, 0));
3328     }
3329
3330   /* Dump rtl code after jump, if we are doing that.  */
3331
3332   if (jump2_opt_dump)
3333     TIMEVAR (dump_time,
3334              {
3335                fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n",
3336                         IDENTIFIER_POINTER (DECL_NAME (decl)));
3337                print_rtl (jump2_opt_dump_file, insns);
3338                fflush (jump2_opt_dump_file);
3339              });
3340
3341   /* If a machine dependent reorganization is needed, call it.  */
3342 #ifdef MACHINE_DEPENDENT_REORG
3343    MACHINE_DEPENDENT_REORG (insns);
3344 #endif
3345
3346   /* If a scheduling pass for delayed branches is to be done,
3347      call the scheduling code.  */
3348
3349 #ifdef DELAY_SLOTS
3350   if (optimize > 0 && flag_delayed_branch)
3351     {
3352       TIMEVAR (dbr_sched_time, dbr_schedule (insns, dbr_sched_dump_file));
3353       if (dbr_sched_dump)
3354         {
3355           TIMEVAR (dump_time,
3356                  {
3357                    fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n",
3358                             IDENTIFIER_POINTER (DECL_NAME (decl)));
3359                    print_rtl (dbr_sched_dump_file, insns);
3360                    fflush (dbr_sched_dump_file);
3361                  });
3362         }
3363     }
3364 #endif
3365
3366   /* Shorten branches.  */
3367   TIMEVAR (shorten_branch_time,
3368            {
3369              shorten_branches (get_insns ());
3370            });
3371
3372 #ifdef STACK_REGS
3373   TIMEVAR (stack_reg_time, reg_to_stack (insns, stack_reg_dump_file));
3374   if (stack_reg_dump)
3375     {
3376       TIMEVAR (dump_time,
3377                {
3378                  fprintf (stack_reg_dump_file, "\n;; Function %s\n\n",
3379                           IDENTIFIER_POINTER (DECL_NAME (decl)));
3380                  print_rtl (stack_reg_dump_file, insns);
3381                  fflush (stack_reg_dump_file);
3382                });
3383     }
3384 #endif
3385
3386   /* Now turn the rtl into assembler code.  */
3387
3388   TIMEVAR (final_time,
3389            {
3390              rtx x;
3391              char *fnname;
3392
3393              /* Get the function's name, as described by its RTL.
3394                 This may be different from the DECL_NAME name used
3395                 in the source file.  */
3396
3397              x = DECL_RTL (decl);
3398              if (GET_CODE (x) != MEM)
3399                abort ();
3400              x = XEXP (x, 0);
3401              if (GET_CODE (x) != SYMBOL_REF)
3402                abort ();
3403              fnname = XSTR (x, 0);
3404
3405              assemble_start_function (decl, fnname);
3406              final_start_function (insns, asm_out_file, optimize);
3407              final (insns, asm_out_file, optimize, 0);
3408              final_end_function (insns, asm_out_file, optimize);
3409              assemble_end_function (decl, fnname);
3410              fflush (asm_out_file);
3411            });
3412
3413   /* Write DBX symbols if requested */
3414
3415   /* Note that for those inline functions where we don't initially
3416      know for certain that we will be generating an out-of-line copy,
3417      the first invocation of this routine (rest_of_compilation) will
3418      skip over this code by doing a `goto exit_rest_of_compilation;'.
3419      Later on, finish_compilation will call rest_of_compilation again
3420      for those inline functions that need to have out-of-line copies
3421      generated.  During that call, we *will* be routed past here.  */
3422
3423 #ifdef DBX_DEBUGGING_INFO
3424   if (write_symbols == DBX_DEBUG)
3425     TIMEVAR (symout_time, dbxout_function (decl));
3426 #endif
3427
3428 #ifdef DWARF_DEBUGGING_INFO
3429   if (write_symbols == DWARF_DEBUG)
3430     TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
3431 #endif
3432
3433 #ifdef DWARF2_DEBUGGING_INFO
3434   if (write_symbols == DWARF2_DEBUG)
3435     TIMEVAR (symout_time, dwarf2out_decl (decl));
3436 #endif
3437
3438  exit_rest_of_compilation:
3439
3440   /* In case the function was not output,
3441      don't leave any temporary anonymous types
3442      queued up for sdb output.  */
3443 #ifdef SDB_DEBUGGING_INFO
3444   if (write_symbols == SDB_DEBUG)
3445     sdbout_types (NULL_TREE);
3446 #endif
3447
3448   /* Put back the tree of subblocks and list of arguments
3449      from before we copied them.
3450      Code generation and the output of debugging info may have modified
3451      the copy, but the original is unchanged.  */
3452
3453   if (saved_block_tree != 0)
3454     {
3455       DECL_INITIAL (decl) = saved_block_tree;
3456       DECL_ARGUMENTS (decl) = saved_arguments;
3457       DECL_ABSTRACT_ORIGIN (decl) = NULL_TREE;
3458     }
3459
3460   reload_completed = 0;
3461
3462   /* Clear out the insn_length contents now that they are no longer valid.  */
3463   init_insn_lengths ();
3464
3465   /* Clear out the real_constant_chain before some of the rtx's
3466      it runs through become garbage.  */
3467
3468   clear_const_double_mem ();
3469
3470   /* Cancel the effect of rtl_in_current_obstack.  */
3471
3472   resume_temporary_allocation ();
3473
3474   /* Show no temporary slots allocated.  */
3475
3476   init_temp_slots ();
3477
3478   /* The parsing time is all the time spent in yyparse
3479      *except* what is spent in this function.  */
3480
3481   parse_time -= get_run_time () - start_time;
3482 }
3483 \f
3484 /* Entry point of cc1/c++.  Decode command args, then call compile_file.
3485    Exit code is 35 if can't open files, 34 if fatal error,
3486    33 if had nonfatal errors, else success.  */
3487
3488 int
3489 main (argc, argv, envp)
3490      int argc;
3491      char **argv;
3492      char **envp;
3493 {
3494   register int i;
3495   char *filename = 0;
3496   int flag_print_mem = 0;
3497   int version_flag = 0;
3498   char *p;
3499
3500   /* save in case md file wants to emit args as a comment.  */
3501   save_argc = argc;
3502   save_argv = argv;
3503
3504   p = argv[0] + strlen (argv[0]);
3505   while (p != argv[0] && p[-1] != '/'
3506 #ifdef DIR_SEPARATOR
3507          && p[-1] != DIR_SEPARATOR
3508 #endif
3509          )
3510     --p;
3511   progname = p;
3512
3513 #ifdef RLIMIT_STACK
3514   /* Get rid of any avoidable limit on stack size.  */
3515   {
3516     struct rlimit rlim;
3517
3518     /* Set the stack limit huge so that alloca does not fail.  */
3519     getrlimit (RLIMIT_STACK, &rlim);
3520     rlim.rlim_cur = rlim.rlim_max;
3521     setrlimit (RLIMIT_STACK, &rlim);
3522   }
3523 #endif /* RLIMIT_STACK */
3524
3525   signal (SIGFPE, float_signal);
3526
3527 #ifdef SIGPIPE
3528   signal (SIGPIPE, pipe_closed);
3529 #endif
3530
3531   decl_printable_name = decl_name;
3532   lang_expand_expr = (struct rtx_def *(*)()) do_abort;
3533
3534   /* Initialize whether `char' is signed.  */
3535   flag_signed_char = DEFAULT_SIGNED_CHAR;
3536 #ifdef DEFAULT_SHORT_ENUMS
3537   /* Initialize how much space enums occupy, by default.  */
3538   flag_short_enums = DEFAULT_SHORT_ENUMS;
3539 #endif
3540
3541   /* Scan to see what optimization level has been specified.  That will
3542      determine the default value of many flags.  */
3543   for (i = 1; i < argc; i++)
3544     {
3545       if (!strcmp (argv[i], "-O"))
3546         {
3547           optimize = 1;
3548         }
3549       else if (argv[i][0] == '-' && argv[i][1] == 'O')
3550         {
3551           /* Handle -O2, -O3, -O69, ...  */
3552           char *p = &argv[i][2];
3553           int c;
3554
3555           while (c = *p++)
3556             if (! (c >= '0' && c <= '9'))
3557               break;
3558           if (c == 0)
3559             optimize = atoi (&argv[i][2]);
3560         }
3561     }
3562
3563   obey_regdecls = (optimize == 0);
3564   if (optimize == 0)
3565     {
3566       flag_no_inline = 1;
3567       warn_inline = 0;
3568     }
3569
3570   if (optimize >= 1)
3571     {
3572       flag_defer_pop = 1;
3573       flag_thread_jumps = 1;
3574 #ifdef DELAY_SLOTS
3575       flag_delayed_branch = 1;
3576 #endif
3577 #ifdef CAN_DEBUG_WITHOUT_FP
3578       flag_omit_frame_pointer = 1;
3579 #endif
3580     }
3581
3582   if (optimize >= 2)
3583     {
3584       flag_cse_follow_jumps = 1;
3585       flag_cse_skip_blocks = 1;
3586       flag_expensive_optimizations = 1;
3587       flag_strength_reduce = 1;
3588       flag_rerun_cse_after_loop = 1;
3589       flag_caller_saves = 1;
3590       flag_force_mem = 1;
3591 #ifdef INSN_SCHEDULING
3592       flag_schedule_insns = 1;
3593       flag_schedule_insns_after_reload = 1;
3594 #endif
3595     }
3596
3597   if (optimize >= 3)
3598     {
3599       flag_inline_functions = 1;
3600     }
3601
3602   /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
3603      modify it.  */
3604   target_flags = 0;
3605   set_target_switch ("");
3606
3607 #ifdef OPTIMIZATION_OPTIONS
3608   /* Allow default optimizations to be specified on a per-machine basis.  */
3609   OPTIMIZATION_OPTIONS (optimize);
3610 #endif
3611
3612   /* Initialize register usage now so switches may override.  */
3613   init_reg_sets ();
3614
3615   for (i = 1; i < argc; i++)
3616     {
3617       int j;
3618       /* If this is a language-specific option,
3619          decode it in a language-specific way.  */
3620       for (j = 0; lang_options[j] != 0; j++)
3621         if (!strncmp (argv[i], lang_options[j],
3622                       strlen (lang_options[j])))
3623           break;
3624       if (lang_options[j] != 0)
3625         /* If the option is valid for *some* language,
3626            treat it as valid even if this language doesn't understand it.  */
3627         lang_decode_option (argv[i]);
3628       else if (argv[i][0] == '-' && argv[i][1] != 0)
3629         {
3630           register char *str = argv[i] + 1;
3631           if (str[0] == 'Y')
3632             str++;
3633
3634           if (str[0] == 'm')
3635             set_target_switch (&str[1]);
3636           else if (!strcmp (str, "dumpbase"))
3637             {
3638               dump_base_name = argv[++i];
3639             }
3640           else if (str[0] == 'd')
3641             {
3642               register char *p = &str[1];
3643               while (*p)
3644                 switch (*p++)
3645                   {
3646                   case 'a':
3647                     combine_dump = 1;
3648                     dbr_sched_dump = 1;
3649                     flow_dump = 1;
3650                     global_reg_dump = 1;
3651                     jump_opt_dump = 1;
3652                     jump2_opt_dump = 1;
3653                     local_reg_dump = 1;
3654                     loop_dump = 1;
3655                     rtl_dump = 1;
3656                     cse_dump = 1, cse2_dump = 1;
3657                     sched_dump = 1;
3658                     sched2_dump = 1;
3659                     stack_reg_dump = 1;
3660                     break;
3661                   case 'k':
3662                     stack_reg_dump = 1;
3663                     break;
3664                   case 'c':
3665                     combine_dump = 1;
3666                     break;
3667                   case 'd':
3668                     dbr_sched_dump = 1;
3669                     break;
3670                   case 'f':
3671                     flow_dump = 1;
3672                     break;
3673                   case 'g':
3674                     global_reg_dump = 1;
3675                     break;
3676                   case 'j':
3677                     jump_opt_dump = 1;
3678                     break;
3679                   case 'J':
3680                     jump2_opt_dump = 1;
3681                     break;
3682                   case 'l':
3683                     local_reg_dump = 1;
3684                     break;
3685                   case 'L':
3686                     loop_dump = 1;
3687                     break;
3688                   case 'm':
3689                     flag_print_mem = 1;
3690                     break;
3691                   case 'p':
3692                     flag_print_asm_name = 1;
3693                     break;
3694                   case 'r':
3695                     rtl_dump = 1;
3696                     break;
3697                   case 's':
3698                     cse_dump = 1;
3699                     break;
3700                   case 't':
3701                     cse2_dump = 1;
3702                     break;
3703                   case 'S':
3704                     sched_dump = 1;
3705                     break;
3706                   case 'R':
3707                     sched2_dump = 1;
3708                     break;
3709                   case 'y':
3710                     set_yydebug (1);
3711                     break;
3712                   case 'x':
3713                     rtl_dump_and_exit = 1;
3714                     break;
3715                   case 'A':
3716                     flag_debug_asm = 1;
3717                     break;
3718                   }
3719             }
3720           else if (str[0] == 'f')
3721             {
3722               register char *p = &str[1];
3723               int found = 0;
3724
3725               /* Some kind of -f option.
3726                  P's value is the option sans `-f'.
3727                  Search for it in the table of options.  */
3728
3729               for (j = 0;
3730                    !found && j < sizeof (f_options) / sizeof (f_options[0]);
3731                    j++)
3732                 {
3733                   if (!strcmp (p, f_options[j].string))
3734                     {
3735                       *f_options[j].variable = f_options[j].on_value;
3736                       /* A goto here would be cleaner,
3737                          but breaks the vax pcc.  */
3738                       found = 1;
3739                     }
3740                   if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
3741                       && ! strcmp (p+3, f_options[j].string))
3742                     {
3743                       *f_options[j].variable = ! f_options[j].on_value;
3744                       found = 1;
3745                     }
3746                 }
3747
3748               if (found)
3749                 ;
3750               else if (!strncmp (p, "fixed-", 6))
3751                 fix_register (&p[6], 1, 1);
3752               else if (!strncmp (p, "call-used-", 10))
3753                 fix_register (&p[10], 0, 1);
3754               else if (!strncmp (p, "call-saved-", 11))
3755                 fix_register (&p[11], 0, 0);
3756               else
3757                 error ("Invalid option `%s'", argv[i]);
3758             }
3759           else if (str[0] == 'O')
3760             {
3761               register char *p = str+1;
3762               while (*p && *p >= '0' && *p <= '9')
3763                 p++;
3764               if (*p == '\0')
3765                 ;
3766               else
3767                 error ("Invalid option `%s'", argv[i]);
3768             }
3769           else if (!strcmp (str, "pedantic"))
3770             pedantic = 1;
3771           else if (!strcmp (str, "pedantic-errors"))
3772             flag_pedantic_errors = pedantic = 1;
3773           else if (!strcmp (str, "quiet"))
3774             quiet_flag = 1;
3775           else if (!strcmp (str, "version"))
3776             version_flag = 1;
3777           else if (!strcmp (str, "w"))
3778             inhibit_warnings = 1;
3779           else if (!strcmp (str, "W"))
3780             {
3781               extra_warnings = 1;
3782               /* We save the value of warn_uninitialized, since if they put
3783                  -Wuninitialized on the command line, we need to generate a
3784                  warning about not using it without also specifying -O.  */
3785               if (warn_uninitialized != 1)
3786                 warn_uninitialized = 2;
3787             }
3788           else if (str[0] == 'W')
3789             {
3790               register char *p = &str[1];
3791               int found = 0;
3792
3793               /* Some kind of -W option.
3794                  P's value is the option sans `-W'.
3795                  Search for it in the table of options.  */
3796
3797               for (j = 0;
3798                    !found && j < sizeof (W_options) / sizeof (W_options[0]);
3799                    j++)
3800                 {
3801                   if (!strcmp (p, W_options[j].string))
3802                     {
3803                       *W_options[j].variable = W_options[j].on_value;
3804                       /* A goto here would be cleaner,
3805                          but breaks the vax pcc.  */
3806                       found = 1;
3807                     }
3808                   if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
3809                       && ! strcmp (p+3, W_options[j].string))
3810                     {
3811                       *W_options[j].variable = ! W_options[j].on_value;
3812                       found = 1;
3813                     }
3814                 }
3815
3816               if (found)
3817                 ;
3818               else if (!strncmp (p, "id-clash-", 9))
3819                 {
3820                   char *endp = p + 9;
3821
3822                   while (*endp)
3823                     {
3824                       if (*endp >= '0' && *endp <= '9')
3825                         endp++;
3826                       else
3827                         {
3828                           error ("Invalid option `%s'", argv[i]);
3829                           goto id_clash_lose;
3830                         }
3831                     }
3832                   warn_id_clash = 1;
3833                   id_clash_len = atoi (str + 10);
3834                 id_clash_lose: ;
3835                 }
3836               else if (!strncmp (p, "larger-than-", 12))
3837                 {
3838                   char *endp = p + 12;
3839
3840                   while (*endp)
3841                     {
3842                       if (*endp >= '0' && *endp <= '9')
3843                         endp++;
3844                       else
3845                         {
3846                           error ("Invalid option `%s'", argv[i]);
3847                           goto larger_than_lose;
3848                         }
3849                     }
3850                   warn_larger_than = 1;
3851                   larger_than_size = atoi (str + 13);
3852                 larger_than_lose: ;
3853                 }
3854               else
3855                 error ("Invalid option `%s'", argv[i]);
3856             }
3857           else if (!strcmp (str, "p"))
3858             {
3859               profile_flag = 1;
3860             }
3861           else if (!strcmp (str, "a"))
3862             {
3863 #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
3864               warning ("`-a' option (basic block profile) not supported");
3865 #else
3866               profile_block_flag = (profile_block_flag < 2) ? 1 : 3;
3867 #endif
3868             }
3869           else if (!strcmp (str, "ax"))
3870             {
3871 #if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
3872               warning ("`-ax' option (jump profiling) not supported");
3873 #else
3874               profile_block_flag = (!profile_block_flag 
3875                                        || profile_block_flag == 2) ? 2 : 3;
3876 #endif
3877             }
3878           else if (str[0] == 'g')
3879             {
3880               unsigned len;
3881               unsigned level;
3882               /* A lot of code assumes write_symbols == NO_DEBUG if the
3883                  debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
3884                  of what debugging type has been selected).  This records the
3885                  selected type.  It is an error to specify more than one
3886                  debugging type.  */
3887               static enum debug_info_type selected_debug_type = NO_DEBUG;
3888               /* Non-zero if debugging format has been explicitly set.
3889                  -g and -ggdb don't explicitly set the debugging format so
3890                  -gdwarf -g3 is equivalent to -gdwarf3.  */
3891               static int type_explicitly_set_p = 0;
3892               /* Table of supported debugging formats.  */
3893               static struct {
3894                 char *arg;
3895                 /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
3896                    constant expression, we use NO_DEBUG in its place.  */
3897                 enum debug_info_type debug_type;
3898                 int use_extensions_p;
3899               } *da, debug_args[] = {
3900                 { "g", NO_DEBUG, DEFAULT_GDB_EXTENSIONS },
3901                 { "ggdb", NO_DEBUG, 1 },
3902 #ifdef DBX_DEBUGGING_INFO
3903                 { "gstabs", DBX_DEBUG, 0 },
3904                 { "gstabs+", DBX_DEBUG, 1 },
3905 #endif
3906 #ifdef DWARF_DEBUGGING_INFO
3907                 { "gdwarf", DWARF_DEBUG, 0 },
3908                 { "gdwarf+", DWARF_DEBUG, 1 },
3909 #endif
3910 #ifdef DWARF2_DEBUGGING_INFO
3911                 { "gdwarf-2", DWARF2_DEBUG, 0 },
3912 #endif
3913 #ifdef XCOFF_DEBUGGING_INFO
3914                 { "gxcoff", XCOFF_DEBUG, 0 },
3915                 { "gxcoff+", XCOFF_DEBUG, 1 },
3916 #endif
3917 #ifdef SDB_DEBUGGING_INFO
3918                 { "gcoff", SDB_DEBUG, 0 },
3919 #endif
3920                 { 0, 0, 0 }
3921               };
3922               /* Indexed by enum debug_info_type.  */
3923               static char *debug_type_names[] = {
3924                 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
3925               };
3926
3927               /* Look up STR in the table.  */
3928               for (da = debug_args; da->arg; da++)
3929                 {
3930                   if (! strncmp (str, da->arg, strlen (da->arg)))
3931                     {
3932                       enum debug_info_type type = da->debug_type;
3933                       char *p, *q;
3934
3935                       p = str + strlen (da->arg);
3936                       if (*p && (*p < '0' || *p > '9'))
3937                         continue;
3938                       q = p;
3939                       while (*q && (*q >= '0' && *q <= '9'))
3940                         q++;
3941                       if (*p)
3942                         level = atoi (p);
3943                       else
3944                         level = 2;      /* default debugging info level */
3945                       if (*q || level > 3)
3946                         {
3947                           warning ("invalid debug level specification in option: `-%s'",
3948                                    str);
3949                           /* ??? This error message is incorrect in the case of
3950                              -g4 -g.  */
3951                           warning ("no debugging information will be generated");
3952                           level = 0;
3953                         }
3954
3955                       /* ??? A few targets use STR in the
3956                          definition of PREFERRED_DEBUGGING_TYPE!  */
3957                       if (type == NO_DEBUG)
3958                         type = PREFERRED_DEBUGGING_TYPE;
3959
3960                       if (type == NO_DEBUG)
3961                         warning ("`-%s' not supported by this configuration of GCC",
3962                                  str);
3963
3964                       /* Does it conflict with an already selected type?  */
3965                       if (type_explicitly_set_p
3966                           /* -g/-ggdb don't conflict with anything */
3967                           && da->debug_type != NO_DEBUG
3968                           && type != selected_debug_type)
3969                         warning ("`-%s' ignored, conflicts with `-g%s'",
3970                                  str, debug_type_names[(int) selected_debug_type]);
3971                       else
3972                         {
3973                           /* If the format has already been set, -g/-ggdb
3974                              only change the debug level.  */
3975                           if (type_explicitly_set_p
3976                               && da->debug_type == NO_DEBUG)
3977                             ; /* don't change debugging type */
3978                           else
3979                             {
3980                               selected_debug_type = type;
3981                               type_explicitly_set_p = da->debug_type != NO_DEBUG;
3982                             }
3983                           write_symbols = (level == 0
3984                                            ? NO_DEBUG
3985                                            : selected_debug_type);
3986                           use_gnu_debug_info_extensions = da->use_extensions_p;
3987                           debug_info_level = (enum debug_info_level) level;
3988                         }
3989                       break;
3990                     }
3991                 }
3992               if (! da->arg)
3993                 warning ("`-%s' not supported by this configuration of GCC",
3994                          str);
3995             }
3996           else if (!strcmp (str, "o"))
3997             {
3998               asm_file_name = argv[++i];
3999             }
4000           else if (str[0] == 'G')
4001             {
4002               g_switch_set = TRUE;
4003               g_switch_value = atoi ((str[1] != '\0') ? str+1 : argv[++i]);
4004             }
4005           else if (!strncmp (str, "aux-info", 8))
4006             {
4007               flag_gen_aux_info = 1;
4008               aux_info_file_name = (str[8] != '\0' ? str+8 : argv[++i]);
4009             }
4010           else
4011             error ("Invalid option `%s'", argv[i]);
4012         }
4013       else if (argv[i][0] == '+')
4014         error ("Invalid option `%s'", argv[i]);
4015       else
4016         filename = argv[i];
4017     }
4018
4019   /* Initialize for bytecode output.  A good idea to do this as soon as
4020      possible after the "-f" options have been parsed.  */
4021   if (output_bytecode)
4022     {
4023 #ifndef TARGET_SUPPORTS_BYTECODE
4024       /* Just die with a fatal error if not supported */
4025       fatal ("-fbytecode not supported for this target");
4026 #else
4027       bc_initialize ();
4028 #endif
4029     }
4030
4031   if (optimize == 0)
4032     {
4033       /* Inlining does not work if not optimizing,
4034          so force it not to be done.  */
4035       flag_no_inline = 1;
4036       warn_inline = 0;
4037
4038       /* The c_decode_option and lang_decode_option functions set
4039          this to `2' if -Wall is used, so we can avoid giving out
4040          lots of errors for people who don't realize what -Wall does.  */
4041       if (warn_uninitialized == 1)
4042         warning ("-Wuninitialized is not supported without -O");
4043     }
4044
4045 #ifdef OVERRIDE_OPTIONS
4046   /* Some machines may reject certain combinations of options.  */
4047   OVERRIDE_OPTIONS;
4048 #endif
4049
4050   if (profile_block_flag == 3)
4051     {
4052       warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
4053       profile_block_flag = 2;
4054     }
4055
4056   /* Unrolling all loops implies that standard loop unrolling must also
4057      be done.  */
4058   if (flag_unroll_all_loops)
4059     flag_unroll_loops = 1;
4060   /* Loop unrolling requires that strength_reduction be on also.  Silently
4061      turn on strength reduction here if it isn't already on.  Also, the loop
4062      unrolling code assumes that cse will be run after loop, so that must
4063      be turned on also.  */
4064   if (flag_unroll_loops)
4065     {
4066       flag_strength_reduce = 1;
4067       flag_rerun_cse_after_loop = 1;
4068     }
4069
4070   /* Warn about options that are not supported on this machine.  */
4071 #ifndef INSN_SCHEDULING
4072   if (flag_schedule_insns || flag_schedule_insns_after_reload)
4073     warning ("instruction scheduling not supported on this target machine");
4074 #endif
4075 #ifndef DELAY_SLOTS
4076   if (flag_delayed_branch)
4077     warning ("this target machine does not have delayed branches");
4078 #endif
4079
4080   /* If we are in verbose mode, write out the version and maybe all the
4081      option flags in use.  */
4082   if (version_flag)
4083     {
4084       print_version (stderr, "");
4085       if (! quiet_flag)
4086         print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
4087     }
4088
4089   compile_file (filename);
4090
4091 #if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN32__))
4092   if (flag_print_mem)
4093     {
4094       char *lim = (char *) sbrk (0);
4095
4096       fprintf (stderr, "Data size %d.\n",
4097                lim - (char *) &environ);
4098       fflush (stderr);
4099
4100 #ifdef USG
4101       system ("ps -l 1>&2");
4102 #else /* not USG */
4103       system ("ps v");
4104 #endif /* not USG */
4105     }
4106 #endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN32) */
4107
4108   if (errorcount)
4109     exit (FATAL_EXIT_CODE);
4110   if (sorrycount)
4111     exit (FATAL_EXIT_CODE);
4112   exit (SUCCESS_EXIT_CODE);
4113   return 0;
4114 }
4115 \f
4116 /* Decode -m switches.  */
4117
4118 /* Here is a table, controlled by the tm.h file, listing each -m switch
4119    and which bits in `target_switches' it should set or clear.
4120    If VALUE is positive, it is bits to set.
4121    If VALUE is negative, -VALUE is bits to clear.
4122    (The sign bit is not used so there is no confusion.)  */
4123
4124 struct {char *name; int value;} target_switches []
4125   = TARGET_SWITCHES;
4126
4127 /* This table is similar, but allows the switch to have a value.  */
4128
4129 #ifdef TARGET_OPTIONS
4130 struct {char *prefix; char ** variable;} target_options []
4131   = TARGET_OPTIONS;
4132 #endif
4133
4134 /* Decode the switch -mNAME.  */
4135
4136 void
4137 set_target_switch (name)
4138      char *name;
4139 {
4140   register int j;
4141   int valid = 0;
4142
4143   for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
4144     if (!strcmp (target_switches[j].name, name))
4145       {
4146         if (target_switches[j].value < 0)
4147           target_flags &= ~-target_switches[j].value;
4148         else
4149           target_flags |= target_switches[j].value;
4150         valid = 1;
4151       }
4152
4153 #ifdef TARGET_OPTIONS
4154   if (!valid)
4155     for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
4156       {
4157         int len = strlen (target_options[j].prefix);
4158         if (!strncmp (target_options[j].prefix, name, len))
4159           {
4160             *target_options[j].variable = name + len;
4161             valid = 1;
4162           }
4163       }
4164 #endif
4165
4166   if (!valid)
4167     error ("Invalid option `%s'", name);
4168 }
4169 \f
4170 /* Print version information to FILE.
4171    Each line begins with INDENT (for the case where FILE is the
4172    assembler output file).  */
4173
4174 void
4175 print_version (file, indent)
4176      FILE *file;
4177      char *indent;
4178 {
4179   fprintf (file, "%s%s%s version %s", indent, *indent != 0 ? " " : "",
4180            language_string, version_string);
4181   fprintf (file, " (%s)", TARGET_NAME);
4182 #ifdef __GNUC__
4183 #ifndef __VERSION__
4184 #define __VERSION__ "[unknown]"
4185 #endif
4186   fprintf (file, " compiled by GNU C version %s.\n", __VERSION__);
4187 #else
4188   fprintf (file, " compiled by CC.\n");
4189 #endif
4190 }
4191
4192 /* Print an option value and return the adjusted position in the line.
4193    ??? We don't handle error returns from fprintf (disk full); presumably
4194    other code will catch a disk full though.  */
4195
4196 int
4197 print_single_switch (file, pos, max, indent, sep, term, type, name)
4198      FILE *file;
4199      int pos, max;
4200      char *indent, *sep, *term, *type, *name;
4201 {
4202   /* The ultrix fprintf returns 0 on success, so compute the result we want
4203      here since we need it for the following test.  */
4204   int len = strlen (sep) + strlen (type) + strlen (name);
4205
4206   if (pos != 0
4207       && pos + len > max)
4208     {
4209       fprintf (file, "%s", term);
4210       pos = 0;
4211     }
4212   if (pos == 0)
4213     {
4214       fprintf (file, "%s", indent);
4215       pos = strlen (indent);
4216     }
4217   fprintf (file, "%s%s%s", sep, type, name);
4218   pos += len;
4219   return pos;
4220 }
4221      
4222 /* Print active target switches to FILE.
4223    POS is the current cursor position and MAX is the size of a "line".
4224    Each line begins with INDENT and ends with TERM.
4225    Each switch is separated from the next by SEP.  */
4226
4227 void
4228 print_switch_values (file, pos, max, indent, sep, term)
4229      FILE *file;
4230      int pos, max;
4231      char *indent, *sep, *term;
4232 {
4233   int j, flags;
4234   char **p;
4235
4236   /* Print the options as passed.  */
4237
4238   pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
4239                              "options passed: ", "");
4240
4241   for (p = &save_argv[1]; *p != NULL; p++)
4242     if (**p == '-')
4243       {
4244         /* Ignore these.  */
4245         if (strcmp (*p, "-o") == 0)
4246           {
4247             if (p[1] != NULL)
4248               p++;
4249             continue;
4250           }
4251         if (strcmp (*p, "-quiet") == 0)
4252           continue;
4253         if (strcmp (*p, "-version") == 0)
4254           continue;
4255         if ((*p)[1] == 'd')
4256           continue;
4257
4258         pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
4259       }
4260   if (pos > 0)
4261     fprintf (file, "%s", term);
4262
4263   /* Print the -f and -m options that have been enabled.
4264      We don't handle language specific options but printing argv
4265      should suffice.  */
4266
4267   pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
4268                              "options enabled: ", "");
4269
4270   for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
4271     if (*f_options[j].variable == f_options[j].on_value)
4272       pos = print_single_switch (file, pos, max, indent, sep, term,
4273                                  "-f", f_options[j].string);
4274
4275   /* Print target specific options.  */
4276
4277   flags = target_flags;
4278   for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
4279     if (target_switches[j].name[0] != '\0'
4280         && target_switches[j].value > 0
4281         && ((target_switches[j].value & target_flags)
4282             == target_switches[j].value))
4283       {
4284         pos = print_single_switch (file, pos, max, indent, sep, term,
4285                                    "-m", target_switches[j].name);
4286         flags &= ~ target_switches[j].value;
4287       }
4288
4289 #ifdef TARGET_OPTIONS
4290   for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
4291     if (*target_options[j].variable != NULL)
4292       {
4293         char prefix[256];
4294         sprintf (prefix, "-m%s", target_options[j].prefix);
4295         pos = print_single_switch (file, pos, max, indent, sep, term,
4296                                    prefix, *target_options[j].variable);
4297       }
4298 #endif
4299
4300   fprintf (file, "%s", term);
4301 }
4302
4303 /* Record the beginning of a new source file, named FILENAME.  */
4304
4305 void
4306 debug_start_source_file (filename)
4307      register char *filename;
4308 {
4309 #ifdef DBX_DEBUGGING_INFO
4310   if (write_symbols == DBX_DEBUG)
4311     dbxout_start_new_source_file (filename);
4312 #endif
4313 #ifdef DWARF_DEBUGGING_INFO
4314   if (debug_info_level == DINFO_LEVEL_VERBOSE
4315       && write_symbols == DWARF_DEBUG)
4316     dwarfout_start_new_source_file (filename);
4317 #endif /* DWARF_DEBUGGING_INFO */
4318 #ifdef DWARF2_DEBUGGING_INFO
4319   if (debug_info_level == DINFO_LEVEL_VERBOSE
4320       && write_symbols == DWARF2_DEBUG)
4321     dwarf2out_start_source_file (filename);
4322 #endif /* DWARF2_DEBUGGING_INFO */  
4323 #ifdef SDB_DEBUGGING_INFO
4324   if (write_symbols == SDB_DEBUG)
4325     sdbout_start_new_source_file (filename);
4326 #endif
4327 }
4328
4329 /* Record the resumption of a source file.  LINENO is the line number in
4330    the source file we are returning to.  */
4331
4332 void
4333 debug_end_source_file (lineno)
4334      register unsigned lineno;
4335 {
4336 #ifdef DBX_DEBUGGING_INFO
4337   if (write_symbols == DBX_DEBUG)
4338     dbxout_resume_previous_source_file ();
4339 #endif
4340 #ifdef DWARF_DEBUGGING_INFO
4341   if (debug_info_level == DINFO_LEVEL_VERBOSE
4342       && write_symbols == DWARF_DEBUG)
4343     dwarfout_resume_previous_source_file (lineno);
4344 #endif /* DWARF_DEBUGGING_INFO */
4345 #ifdef DWARF2_DEBUGGING_INFO
4346   if (debug_info_level == DINFO_LEVEL_VERBOSE
4347       && write_symbols == DWARF2_DEBUG)
4348     dwarf2out_end_source_file ();
4349 #endif /* DWARF2_DEBUGGING_INFO */
4350 #ifdef SDB_DEBUGGING_INFO
4351   if (write_symbols == SDB_DEBUG)
4352     sdbout_resume_previous_source_file ();
4353 #endif
4354 }
4355
4356 /* Called from check_newline in c-parse.y.  The `buffer' parameter contains
4357    the tail part of the directive line, i.e. the part which is past the
4358    initial whitespace, #, whitespace, directive-name, whitespace part.  */
4359
4360 void
4361 debug_define (lineno, buffer)
4362      register unsigned lineno;
4363      register char *buffer;
4364 {
4365 #ifdef DWARF_DEBUGGING_INFO
4366   if (debug_info_level == DINFO_LEVEL_VERBOSE
4367       && write_symbols == DWARF_DEBUG)
4368     dwarfout_define (lineno, buffer);
4369 #endif /* DWARF_DEBUGGING_INFO */
4370 #ifdef DWARF2_DEBUGGING_INFO
4371   if (debug_info_level == DINFO_LEVEL_VERBOSE
4372       && write_symbols == DWARF2_DEBUG)
4373     dwarf2out_define (lineno, buffer);
4374 #endif /* DWARF2_DEBUGGING_INFO */
4375 }
4376
4377 /* Called from check_newline in c-parse.y.  The `buffer' parameter contains
4378    the tail part of the directive line, i.e. the part which is past the
4379    initial whitespace, #, whitespace, directive-name, whitespace part.  */
4380
4381 void
4382 debug_undef (lineno, buffer)
4383      register unsigned lineno;
4384      register char *buffer;
4385 {
4386 #ifdef DWARF_DEBUGGING_INFO
4387   if (debug_info_level == DINFO_LEVEL_VERBOSE
4388       && write_symbols == DWARF_DEBUG)
4389     dwarfout_undef (lineno, buffer);
4390 #endif /* DWARF_DEBUGGING_INFO */
4391 #ifdef DWARF2_DEBUGGING_INFO
4392   if (debug_info_level == DINFO_LEVEL_VERBOSE
4393       && write_symbols == DWARF2_DEBUG)
4394     dwarf2out_undef (lineno, buffer);
4395 #endif /* DWARF2_DEBUGGING_INFO */
4396 }