]> gcc.gnu.org Git - gcc.git/blame - gcc/toplev.c
(do_include): For "..." case, leave fend pointing at terminating 0.
[gcc.git] / gcc / toplev.c
CommitLineData
4291d9c8
RS
1/* Top level of GNU C compiler
2 Copyright (C) 1987, 1988, 1989, 1992 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
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#include <sys/types.h>
28#include <stdio.h>
29#include <signal.h>
30#include <setjmp.h>
31
32#include <sys/stat.h>
33
34#ifdef USG
35#undef FLOAT
36#include <sys/param.h>
37/* This is for hpux. It is a real screw. They should change hpux. */
38#undef FLOAT
39#include <sys/times.h>
40#include <time.h> /* Correct for hpux at least. Is it good on other USG? */
41#undef FFS /* Some systems define this in param.h. */
42#else
43#ifndef VMS
44#include <sys/time.h>
45#include <sys/resource.h>
46#endif
47#endif
48
49#include "input.h"
50#include "tree.h"
51/* #include "c-tree.h" */
52#include "rtl.h"
53#include "flags.h"
54#include "insn-attr.h"
d0d4af87 55#include "defaults.h"
f246a305
RS
56
57#ifdef XCOFF_DEBUGGING_INFO
58#include "xcoffout.h"
59#endif
4291d9c8
RS
60\f
61#ifdef VMS
62/* The extra parameters substantially improve the I/O performance. */
63static FILE *
64VMS_fopen (fname, type)
65 char * fname;
66 char * type;
67{
68 if (strcmp (type, "w") == 0)
69 return fopen (fname, type, "mbc=16", "deq=64", "fop=tef", "shr=nil");
70 return fopen (fname, type, "mbc=16");
71}
72#define fopen VMS_fopen
73#endif
74
75#ifndef DEFAULT_GDB_EXTENSIONS
76#define DEFAULT_GDB_EXTENSIONS 1
77#endif
78
79extern int rtx_equal_function_value_matters;
80
72c8bb7f 81#if ! (defined (VMS) || defined (OS2))
4291d9c8 82extern char **environ;
4d7e336b 83#endif
4291d9c8
RS
84extern char *version_string, *language_string;
85
86extern void init_lex ();
87extern void init_decl_processing ();
88extern void init_obstacks ();
89extern void init_tree_codes ();
90extern void init_rtl ();
91extern void init_optabs ();
92extern void init_stmt ();
93extern void init_reg_sets ();
94extern void dump_flow_info ();
95extern void dump_sched_info ();
96extern void dump_local_alloc ();
97
98void rest_of_decl_compilation ();
99void error ();
100void error_with_file_and_line ();
101void fancy_abort ();
102#ifndef abort
103void abort ();
104#endif
105void set_target_switch ();
106static void print_switch_values ();
107static char *decl_name ();
108
109/* Name of program invoked, sans directories. */
110
111char *progname;
112
113/* Copy of arguments to main. */
114int save_argc;
115char **save_argv;
116\f
117/* Name of current original source file (what was input to cpp).
118 This comes from each #-command in the actual input. */
119
120char *input_filename;
121
122/* Name of top-level original source file (what was input to cpp).
123 This comes from the #-command at the beginning of the actual input.
124 If there isn't any there, then this is the cc1 input file name. */
125
126char *main_input_filename;
127
128/* Stream for reading from the input file. */
129
130FILE *finput;
131
132/* Current line number in real source file. */
133
134int lineno;
135
136/* Stack of currently pending input files. */
137
138struct file_stack *input_file_stack;
139
140/* Incremented on each change to input_file_stack. */
141int input_file_stack_tick;
142
143/* FUNCTION_DECL for function now being parsed or compiled. */
144
145extern tree current_function_decl;
146
147/* Name to use as base of names for dump output files. */
148
149char *dump_base_name;
150
151/* Bit flags that specify the machine subtype we are compiling for.
152 Bits are tested using macros TARGET_... defined in the tm.h file
153 and set by `-m...' switches. Must be defined in rtlanal.c. */
154
155extern int target_flags;
156
157/* Flags saying which kinds of debugging dump have been requested. */
158
159int rtl_dump = 0;
160int rtl_dump_and_exit = 0;
161int jump_opt_dump = 0;
162int cse_dump = 0;
163int loop_dump = 0;
164int cse2_dump = 0;
165int flow_dump = 0;
166int combine_dump = 0;
167int sched_dump = 0;
168int local_reg_dump = 0;
169int global_reg_dump = 0;
170int sched2_dump = 0;
171int jump2_opt_dump = 0;
172int dbr_sched_dump = 0;
173int flag_print_asm_name = 0;
174int stack_reg_dump = 0;
175
176/* Name for output file of assembly code, specified with -o. */
177
178char *asm_file_name;
179
180/* Value of the -G xx switch, and whether it was passed or not. */
181int g_switch_value;
182int g_switch_set;
183
184/* Type(s) of debugging information we are producing (if any).
185 See flags.h for the definitions of the different possible
186 types of debugging information. */
187enum debug_info_type write_symbols = NO_DEBUG;
188
189/* Level of debugging information we are producing. See flags.h
190 for the definitions of the different possible levels. */
191enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
192
a53d0bcc
RS
193/* Nonzero means use GNU-only extensions in the generated symbolic
194 debugging information. */
195/* Currently, this only has an effect when write_symbols is set to
196 DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
197int use_gnu_debug_info_extensions = 0;
4291d9c8
RS
198
199/* Nonzero means do optimizations. -O.
200 Particular numeric values stand for particular amounts of optimization;
201 thus, -O2 stores 2 here. However, the optimizations beyond the basic
202 ones are not controlled directly by this variable. Instead, they are
203 controlled by individual `flag_...' variables that are defaulted
204 based on this variable. */
205
206int optimize = 0;
207
208/* Number of error messages and warning messages so far. */
209
210int errorcount = 0;
211int warningcount = 0;
212int sorrycount = 0;
213
214/* Pointer to function to compute the name to use to print a declaration. */
215
216char *(*decl_printable_name) ();
217
218/* Pointer to function to compute rtl for a language-specific tree code. */
219
220struct rtx_def *(*lang_expand_expr) ();
221
2b599527
RS
222/* Pointer to function to finish handling an incomplete decl at the
223 end of compilation. */
224
225void (*incomplete_decl_finalize_hook) () = 0;
226
4291d9c8
RS
227/* Nonzero if generating code to do profiling. */
228
229int profile_flag = 0;
230
231/* Nonzero if generating code to do profiling on a line-by-line basis. */
232
233int profile_block_flag;
234
235/* Nonzero for -pedantic switch: warn about anything
236 that standard spec forbids. */
237
238int pedantic = 0;
239
240/* Temporarily suppress certain warnings.
241 This is set while reading code from a system header file. */
242
243int in_system_header = 0;
244
245/* Nonzero means do stupid register allocation.
246 Currently, this is 1 if `optimize' is 0. */
247
248int obey_regdecls = 0;
249
250/* Don't print functions as they are compiled and don't print
251 times taken by the various passes. -quiet. */
252
253int quiet_flag = 0;
254\f
255/* -f flags. */
256
257/* Nonzero means `char' should be signed. */
258
259int flag_signed_char;
260
261/* Nonzero means give an enum type only as many bytes as it needs. */
262
263int flag_short_enums;
264
265/* Nonzero for -fcaller-saves: allocate values in regs that need to
266 be saved across function calls, if that produces overall better code.
267 Optional now, so people can test it. */
268
269#ifdef DEFAULT_CALLER_SAVES
270int flag_caller_saves = 1;
271#else
272int flag_caller_saves = 0;
273#endif
274
958ec8ca
JW
275/* Nonzero if structures and unions should be returned in memory.
276
277 This should only be defined if compatibility with another compiler or
278 with an ABI is needed, because it results in slower code. */
279
280#ifndef DEFAULT_PCC_STRUCT_RETURN
281#define DEFAULT_PCC_STRUCT_RETURN 1
282#endif
283
4291d9c8
RS
284/* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
285
958ec8ca 286int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
4291d9c8
RS
287
288/* Nonzero for -fforce-mem: load memory value into a register
289 before arithmetic on it. This makes better cse but slower compilation. */
290
291int flag_force_mem = 0;
292
293/* Nonzero for -fforce-addr: load memory address into a register before
294 reference to memory. This makes better cse but slower compilation. */
295
296int flag_force_addr = 0;
297
298/* Nonzero for -fdefer-pop: don't pop args after each function call;
299 instead save them up to pop many calls' args with one insns. */
300
301int flag_defer_pop = 1;
302
303/* Nonzero for -ffloat-store: don't allocate floats and doubles
304 in extended-precision registers. */
305
306int flag_float_store = 0;
307
308/* Nonzero for -fcse-follow-jumps:
309 have cse follow jumps to do a more extensive job. */
310
311int flag_cse_follow_jumps;
312
8b3686ed
RK
313/* Nonzero for -fcse-skip-blocks:
314 have cse follow a branch around a block. */
315int flag_cse_skip_blocks;
316
4291d9c8
RS
317/* Nonzero for -fexpensive-optimizations:
318 perform miscellaneous relatively-expensive optimizations. */
319int flag_expensive_optimizations;
320
321/* Nonzero for -fthread-jumps:
322 have jump optimize output of loop. */
323
324int flag_thread_jumps;
325
326/* Nonzero enables strength-reduction in loop.c. */
327
328int flag_strength_reduce = 0;
329
330/* Nonzero enables loop unrolling in unroll.c. Only loops for which the
331 number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
332 UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
333 unrolled. */
334
335int flag_unroll_loops;
336
337/* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
338 This is generally not a win. */
339
340int flag_unroll_all_loops;
341
342/* Nonzero for -fwritable-strings:
343 store string constants in data segment and don't uniquize them. */
344
345int flag_writable_strings = 0;
346
347/* Nonzero means don't put addresses of constant functions in registers.
348 Used for compiling the Unix kernel, where strange substitutions are
349 done on the assembly output. */
350
351int flag_no_function_cse = 0;
352
353/* Nonzero for -fomit-frame-pointer:
354 don't make a frame pointer in simple functions that don't require one. */
355
356int flag_omit_frame_pointer = 0;
357
358/* Nonzero to inhibit use of define_optimization peephole opts. */
359
360int flag_no_peephole = 0;
361
43855b28
JL
362/* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
363 operations in the interest of optimization. For example it allows
364 GCC to assume arguments to sqrt are nonnegative numbers, allowing
365 faster code for sqrt to be generated. */
366
367int flag_fast_math = 0;
368
4291d9c8
RS
369/* Nonzero means all references through pointers are volatile. */
370
371int flag_volatile;
c6e75897
RS
372
373/* Nonzero means treat all global and extern variables as global. */
374
38d4d0c2 375int flag_volatile_global;
4291d9c8
RS
376
377/* Nonzero means just do syntax checking; don't output anything. */
378
379int flag_syntax_only = 0;
380
381/* Nonzero means to rerun cse after loop optimization. This increases
382 compilation time about 20% and picks up a few more common expressions. */
383
384static int flag_rerun_cse_after_loop;
385
386/* Nonzero for -finline-functions: ok to inline functions that look like
387 good inline candidates. */
388
389int flag_inline_functions;
390
391/* Nonzero for -fkeep-inline-functions: even if we make a function
ac2a9454 392 go inline everywhere, keep its definition around for debugging
4291d9c8
RS
393 purposes. */
394
395int flag_keep_inline_functions;
396
397/* Nonzero means that functions declared `inline' will be treated
398 as `static'. Prevents generation of zillions of copies of unused
399 static inline functions; instead, `inlines' are written out
400 only when actually used. Used in conjunction with -g. Also
401 does the right thing with #pragma interface. */
402
403int flag_no_inline;
404
405/* Nonzero means we should be saving declaration info into a .X file. */
406
407int flag_gen_aux_info = 0;
408
f246a305
RS
409/* Specified name of aux-info file. */
410
411static char *aux_info_file_name;
412
4291d9c8
RS
413/* Nonzero means make the text shared if supported. */
414
415int flag_shared_data;
416
417/* Nonzero means schedule into delayed branch slots if supported. */
418
419int flag_delayed_branch;
420
421/* Nonzero if we are compiling pure (sharable) code.
422 Value is 1 if we are doing reasonable (i.e. simple
423 offset into offset table) pic. Value is 2 if we can
424 only perform register offsets. */
425
426int flag_pic;
427
0382002b 428/* Nonzero means place uninitialized global data in the bss section. */
4291d9c8
RS
429
430int flag_no_common;
431
432/* Nonzero means pretend it is OK to examine bits of target floats,
433 even if that isn't true. The resulting code will have incorrect constants,
434 but the same series of instructions that the native compiler would make. */
435
436int flag_pretend_float;
437
438/* Nonzero means change certain warnings into errors.
439 Usually these are warnings about failure to conform to some standard. */
440
441int flag_pedantic_errors = 0;
442
443/* flag_schedule_insns means schedule insns within basic blocks (before
444 local_alloc).
445 flag_schedule_insns_after_reload means schedule insns after
446 global_alloc. */
447
448int flag_schedule_insns = 0;
449int flag_schedule_insns_after_reload = 0;
450
451/* -finhibit-size-directive inhibits output of .size for ELF.
452 This is used only for compiling crtstuff.c,
453 and it may be extended to other effects
454 needed for crtstuff.c on other systems. */
455int flag_inhibit_size_directive = 0;
456
9a631e8e
RS
457/* -fverbose-asm causes extra commentary information to be produced in
458 the generated assembly code (to make it more readable). This option
459 is generally only of use to those who actually need to read the
460 generated assembly code (perhaps while debugging the compiler itself). */
461
462int flag_verbose_asm = 0;
463
4291d9c8 464/* -fgnu-linker specifies use of the GNU linker for initializations.
d68c507d
RS
465 (Or, more generally, a linker that handles initializations.)
466 -fno-gnu-linker says that collect2 will be used. */
467#ifdef USE_COLLECT2
468int flag_gnu_linker = 0;
469#else
4291d9c8 470int flag_gnu_linker = 1;
d68c507d 471#endif
4291d9c8
RS
472
473/* Table of language-independent -f options.
474 STRING is the option name. VARIABLE is the address of the variable.
475 ON_VALUE is the value to store in VARIABLE
476 if `-fSTRING' is seen as an option.
477 (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
478
479struct { char *string; int *variable; int on_value;} f_options[] =
480{
481 {"float-store", &flag_float_store, 1},
482 {"volatile", &flag_volatile, 1},
38d4d0c2 483 {"volatile-global", &flag_volatile_global, 1},
4291d9c8
RS
484 {"defer-pop", &flag_defer_pop, 1},
485 {"omit-frame-pointer", &flag_omit_frame_pointer, 1},
486 {"cse-follow-jumps", &flag_cse_follow_jumps, 1},
8b3686ed 487 {"cse-skip-blocks", &flag_cse_skip_blocks, 1},
4291d9c8
RS
488 {"expensive-optimizations", &flag_expensive_optimizations, 1},
489 {"thread-jumps", &flag_thread_jumps, 1},
490 {"strength-reduce", &flag_strength_reduce, 1},
491 {"unroll-loops", &flag_unroll_loops, 1},
492 {"unroll-all-loops", &flag_unroll_all_loops, 1},
493 {"writable-strings", &flag_writable_strings, 1},
494 {"peephole", &flag_no_peephole, 0},
495 {"force-mem", &flag_force_mem, 1},
496 {"force-addr", &flag_force_addr, 1},
497 {"function-cse", &flag_no_function_cse, 0},
498 {"inline-functions", &flag_inline_functions, 1},
499 {"keep-inline-functions", &flag_keep_inline_functions, 1},
500 {"inline", &flag_no_inline, 0},
501 {"syntax-only", &flag_syntax_only, 1},
4291d9c8
RS
502 {"shared-data", &flag_shared_data, 1},
503 {"caller-saves", &flag_caller_saves, 1},
504 {"pcc-struct-return", &flag_pcc_struct_return, 1},
958ec8ca 505 {"reg-struct-return", &flag_pcc_struct_return, 0},
4291d9c8
RS
506 {"delayed-branch", &flag_delayed_branch, 1},
507 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1},
508 {"pretend-float", &flag_pretend_float, 1},
509 {"schedule-insns", &flag_schedule_insns, 1},
510 {"schedule-insns2", &flag_schedule_insns_after_reload, 1},
511 {"pic", &flag_pic, 1},
512 {"PIC", &flag_pic, 2},
43855b28 513 {"fast-math", &flag_fast_math, 1},
4291d9c8
RS
514 {"common", &flag_no_common, 0},
515 {"inhibit-size-directive", &flag_inhibit_size_directive, 1},
9a631e8e 516 {"verbose-asm", &flag_verbose_asm, 1},
4291d9c8
RS
517 {"gnu-linker", &flag_gnu_linker, 1}
518};
b99933c7
RS
519
520/* Table of language-specific options. */
521
522char *lang_options[] =
523{
524 "-ftraditional",
525 "-traditional",
526 "-fnotraditional",
527 "-fno-traditional",
528 "-fsigned-char",
529 "-funsigned-char",
530 "-fno-signed-char",
531 "-fno-unsigned-char",
532 "-fsigned-bitfields",
533 "-funsigned-bitfields",
534 "-fno-signed-bitfields",
535 "-fno-unsigned-bitfields",
536 "-fshort-enums",
537 "-fno-short-enums",
538 "-fcond-mismatch",
539 "-fno-cond-mismatch",
540 "-fshort-double",
541 "-fno-short-double",
542 "-fasm",
543 "-fno-asm",
544 "-fbuiltin",
545 "-fno-builtin",
546 "-fno-ident",
547 "-fident",
548 "-ansi",
549 "-Wimplicit",
550 "-Wno-implicit",
551 "-Wwrite-strings",
552 "-Wno-write-strings",
553 "-Wcast-qual",
554 "-Wno-cast-qual",
555 "-Wpointer-arith",
556 "-Wno-pointer-arith",
557 "-Wstrict-prototypes",
558 "-Wno-strict-prototypes",
559 "-Wmissing-prototypes",
560 "-Wno-missing-prototypes",
561 "-Wredundant-decls",
562 "-Wno-redundant-decls",
563 "-Wnested-externs",
564 "-Wno-nested-externs",
565 "-Wtraditional",
566 "-Wno-traditional",
567 "-Wformat",
568 "-Wno-format",
569 "-Wchar-subscripts",
570 "-Wno-char-subscripts",
571 "-Wconversion",
572 "-Wno-conversion",
573 "-Wparentheses",
574 "-Wno-parentheses",
575 "-Wcomment",
576 "-Wno-comment",
577 "-Wcomments",
578 "-Wno-comments",
579 "-Wtrigraphs",
580 "-Wno-trigraphs",
581 "-Wimport",
582 "-Wno-import",
583 "-Wall",
584
585 /* These are for C++. */
6419d860
RS
586 "-+e0", /* gcc.c tacks the `-' on the front. */
587 "-+e1",
588 "-+e2",
b99933c7
RS
589 "-fsave-memoized",
590 "-fno-save-memoized",
b99933c7
RS
591 "-fcadillac",
592 "-fno-cadillac",
593 "-fgc",
594 "-fno-gc",
595 "-flabels-ok",
596 "-fno-labels-ok",
597 "-fstats",
598 "-fno-stats",
599 "-fthis-is-variable",
600 "-fno-this-is-variable",
601 "-fstrict-prototype",
602 "-fno-strict-prototype",
603 "-fall-virtual",
604 "-fno-all-virtual",
605 "-fmemoize-lookups",
606 "-fno-memoize-lookups",
607 "-felide-constructors",
608 "-fno-elide-constructors",
609 "-finline-debug",
610 "-fno-inline-debug",
611 "-fhandle-exceptions",
612 "-fno-handle-exceptions",
613 "-fansi-exceptions",
614 "-fno-ansi-exceptions",
615 "-fspring-exceptions",
616 "-fno-spring-exceptions",
617 "-fdefault-inline",
618 "-fno-default-inline",
619 "-fenum-int-equiv",
620 "-fno-enum-int-equiv",
621 "-fdossier",
622 "-fno-dossier",
623 "-fxref",
624 "-fno-xref",
625 "-fnonnull-objects",
626 "-fno-nonnull-objects",
627
628 "-Wreturn-type",
629 "-Wno-return-type",
630 "-Woverloaded-virtual",
631 "-Wno-overloaded-virtual",
632 "-Wenum-clash",
633 "-Wno-enum-clash",
a2468e45
BK
634 "-Wtemplate-debugging",
635 "-Wno-template-debugging",
65faa6a4
RS
636
637 /* these are for obj c */
638 "-lang-objc",
639 "-gen-decls",
640 "-Wselector",
641 "-Wno-selector",
b99933c7
RS
642 0
643};
4291d9c8
RS
644\f
645/* Options controlling warnings */
646
647/* Don't print warning messages. -w. */
648
649int inhibit_warnings = 0;
650
651/* Print various extra warnings. -W. */
652
653int extra_warnings = 0;
654
655/* Treat warnings as errors. -Werror. */
656
657int warnings_are_errors = 0;
658
659/* Nonzero to warn about unused local variables. */
660
661int warn_unused;
662
663/* Nonzero to warn about variables used before they are initialized. */
664
665int warn_uninitialized;
666
667/* Nonzero means warn about all declarations which shadow others. */
668
669int warn_shadow;
670
671/* Warn if a switch on an enum fails to have a case for every enum value. */
672
673int warn_switch;
674
675/* Nonzero means warn about function definitions that default the return type
676 or that use a null return and have a return-type other than void. */
677
678int warn_return_type;
679
680/* Nonzero means warn about pointer casts that increase the required
681 alignment of the target type (and might therefore lead to a crash
682 due to a misaligned access). */
683
684int warn_cast_align;
685
686/* Nonzero means warn about any identifiers that match in the first N
687 characters. The value N is in `id_clash_len'. */
688
689int warn_id_clash;
690int id_clash_len;
691
692/* Nonzero means warn if inline function is too large. */
693
694int warn_inline;
695
696/* Warn if a function returns an aggregate,
697 since there are often incompatible calling conventions for doing this. */
698
699int warn_aggregate_return;
700
701/* Likewise for -W. */
702
703struct { char *string; int *variable; int on_value;} W_options[] =
704{
705 {"unused", &warn_unused, 1},
706 {"error", &warnings_are_errors, 1},
707 {"shadow", &warn_shadow, 1},
708 {"switch", &warn_switch, 1},
4291d9c8
RS
709 {"aggregate-return", &warn_aggregate_return, 1},
710 {"cast-align", &warn_cast_align, 1},
f246a305
RS
711 {"uninitialized", &warn_uninitialized, 1},
712 {"inline", &warn_inline, 1}
4291d9c8
RS
713};
714\f
715/* Output files for assembler code (real compiler output)
716 and debugging dumps. */
717
718FILE *asm_out_file;
719FILE *aux_info_file;
720FILE *rtl_dump_file;
721FILE *jump_opt_dump_file;
722FILE *cse_dump_file;
723FILE *loop_dump_file;
724FILE *cse2_dump_file;
725FILE *flow_dump_file;
726FILE *combine_dump_file;
727FILE *sched_dump_file;
728FILE *local_reg_dump_file;
729FILE *global_reg_dump_file;
730FILE *sched2_dump_file;
731FILE *jump2_opt_dump_file;
732FILE *dbr_sched_dump_file;
733FILE *stack_reg_dump_file;
734
735/* Time accumulators, to count the total time spent in various passes. */
736
737int parse_time;
738int varconst_time;
739int integration_time;
740int jump_time;
741int cse_time;
742int loop_time;
743int cse2_time;
744int flow_time;
745int combine_time;
746int sched_time;
747int local_alloc_time;
748int global_alloc_time;
749int sched2_time;
750int dbr_sched_time;
751int shorten_branch_time;
752int stack_reg_time;
753int final_time;
754int symout_time;
755int dump_time;
756\f
757/* Return time used so far, in microseconds. */
758
759int
760get_run_time ()
761{
762#ifdef USG
763 struct tms tms;
764#else
765#ifndef VMS
766 struct rusage rusage;
767#else /* VMS */
768 struct
769 {
770 int proc_user_time;
771 int proc_system_time;
772 int child_user_time;
773 int child_system_time;
774 } vms_times;
775#endif
776#endif
777
778 if (quiet_flag)
779 return 0;
780
781#ifdef USG
782 times (&tms);
783 return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
784#else
785#ifndef VMS
786 getrusage (0, &rusage);
787 return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
788 + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
789#else /* VMS */
790 times (&vms_times);
791 return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
792#endif
793#endif
794}
795
796#define TIMEVAR(VAR, BODY) \
797do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
798
799void
800print_time (str, total)
801 char *str;
802 int total;
803{
804 fprintf (stderr,
805 "time in %s: %d.%06d\n",
806 str, total / 1000000, total % 1000000);
807}
808
809/* Count an error or warning. Return 1 if the message should be printed. */
810
811int
812count_error (warningp)
813 int warningp;
814{
815 if (warningp && inhibit_warnings)
816 return 0;
817
818 if (warningp && !warnings_are_errors)
819 warningcount++;
820 else
821 {
822 static int warning_message = 0;
823
824 if (warningp && !warning_message)
825 {
826 fprintf (stderr, "%s: warnings being treated as errors\n", progname);
827 warning_message = 1;
828 }
829 errorcount++;
830 }
831
832 return 1;
833}
834
835/* Print a fatal error message. NAME is the text.
836 Also include a system error message based on `errno'. */
837
838void
839pfatal_with_name (name)
840 char *name;
841{
842 fprintf (stderr, "%s: ", progname);
843 perror (name);
844 exit (35);
845}
846
847void
848fatal_io_error (name)
849 char *name;
850{
851 fprintf (stderr, "%s: %s: I/O error\n", progname, name);
852 exit (35);
853}
854
855void
856fatal (s, v)
857 char *s;
858 int v;
859{
860 error (s, v);
861 exit (34);
862}
863
864/* Called to give a better error message when we don't have an insn to match
865 what we are looking for or if the insn's constraints aren't satisfied,
866 rather than just calling abort(). */
867
868void
869fatal_insn_not_found (insn)
870 rtx insn;
871{
872 if (INSN_CODE (insn) < 0)
873 error ("internal error--unrecognizable insn:", 0);
874 else
875 error ("internal error--insn does not satisfy its constraints:", 0);
876 debug_rtx (insn);
877 if (asm_out_file)
878 fflush (asm_out_file);
879 if (aux_info_file)
880 fflush (aux_info_file);
881 if (rtl_dump_file)
882 fflush (rtl_dump_file);
883 if (jump_opt_dump_file)
884 fflush (jump_opt_dump_file);
885 if (cse_dump_file)
886 fflush (cse_dump_file);
887 if (loop_dump_file)
888 fflush (loop_dump_file);
889 if (cse2_dump_file)
890 fflush (cse2_dump_file);
891 if (flow_dump_file)
892 fflush (flow_dump_file);
893 if (combine_dump_file)
894 fflush (combine_dump_file);
895 if (sched_dump_file)
896 fflush (sched_dump_file);
897 if (local_reg_dump_file)
898 fflush (local_reg_dump_file);
899 if (global_reg_dump_file)
900 fflush (global_reg_dump_file);
901 if (sched2_dump_file)
902 fflush (sched2_dump_file);
903 if (jump2_opt_dump_file)
904 fflush (jump2_opt_dump_file);
905 if (dbr_sched_dump_file)
906 fflush (dbr_sched_dump_file);
907 if (stack_reg_dump_file)
908 fflush (stack_reg_dump_file);
909 abort ();
910}
911
912/* This is the default decl_printable_name function. */
913
914static char *
915decl_name (decl, kind)
916 tree decl;
917 char **kind;
918{
919 return IDENTIFIER_POINTER (DECL_NAME (decl));
920}
921\f
922static int need_error_newline;
923
924/* Function of last error message;
925 more generally, function such that if next error message is in it
926 then we don't have to mention the function name. */
927static tree last_error_function = NULL;
928
929/* Used to detect when input_file_stack has changed since last described. */
930static int last_error_tick;
931
932/* Called when the start of a function definition is parsed,
933 this function prints on stderr the name of the function. */
934
935void
936announce_function (decl)
937 tree decl;
938{
939 if (! quiet_flag)
940 {
941 char *junk;
942 if (rtl_dump_and_exit)
943 fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
944 else
945 fprintf (stderr, " %s", (*decl_printable_name) (decl, &junk));
946 fflush (stderr);
947 need_error_newline = 1;
948 last_error_function = current_function_decl;
949 }
950}
951
952/* Prints out, if necessary, the name of the current function
953 which caused an error. Called from all error and warning functions. */
954
955void
956report_error_function (file)
957 char *file;
958{
959 struct file_stack *p;
960
961 if (need_error_newline)
962 {
963 fprintf (stderr, "\n");
964 need_error_newline = 0;
965 }
966
967 if (last_error_function != current_function_decl)
968 {
969 char *kind = "function";
970 if (current_function_decl != 0
971 && TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
972 kind = "method";
973
974 if (file)
975 fprintf (stderr, "%s: ", file);
976
977 if (current_function_decl == NULL)
978 fprintf (stderr, "At top level:\n");
979 else
980 {
981 char *name = (*decl_printable_name) (current_function_decl, &kind);
982 fprintf (stderr, "In %s `%s':\n", kind, name);
983 }
984
985 last_error_function = current_function_decl;
986 }
987 if (input_file_stack && input_file_stack->next != 0
988 && input_file_stack_tick != last_error_tick)
989 {
990 fprintf (stderr, "In file included");
991 for (p = input_file_stack->next; p; p = p->next)
992 {
993 fprintf (stderr, " from %s:%d", p->name, p->line);
994 if (p->next)
995 fprintf (stderr, ",");
996 }
997 fprintf (stderr, ":\n");
998 last_error_tick = input_file_stack_tick;
999 }
1000}
1001
1002/* Report an error at the current line number.
37366632
RK
1003 S is a string and V and V2 are args for `printf'. We use HOST_WIDE_INT
1004 as the type for these args assuming it is wide enough to hold a
1005 pointer. This isn't terribly portable, but is the best we can do
1006 without vprintf universally available. */
4291d9c8
RS
1007
1008void
1009error (s, v, v2)
1010 char *s;
37366632
RK
1011 HOST_WIDE_INT v; /* Also used as pointer */
1012 HOST_WIDE_INT v2; /* Also used as pointer */
4291d9c8
RS
1013{
1014 error_with_file_and_line (input_filename, lineno, s, v, v2);
1015}
1016
1017/* Report an error at line LINE of file FILE.
1018 S and V are a string and an arg for `printf'. */
1019
1020void
1021error_with_file_and_line (file, line, s, v, v2)
1022 char *file;
1023 int line;
1024 char *s;
37366632
RK
1025 HOST_WIDE_INT v;
1026 HOST_WIDE_INT v2;
4291d9c8
RS
1027{
1028 count_error (0);
1029
1030 report_error_function (file);
1031
1032 if (file)
1033 fprintf (stderr, "%s:%d: ", file, line);
1034 else
1035 fprintf (stderr, "%s: ", progname);
1036 fprintf (stderr, s, v, v2);
1037 fprintf (stderr, "\n");
1038}
1039
1040/* Report an error at the declaration DECL.
37366632
RK
1041 S and V are a string and an arg which uses %s to substitute
1042 the declaration name. */
4291d9c8
RS
1043
1044void
1045error_with_decl (decl, s, v)
1046 tree decl;
1047 char *s;
37366632 1048 HOST_WIDE_INT v;
4291d9c8
RS
1049{
1050 char *junk;
1051 count_error (0);
1052
1053 report_error_function (DECL_SOURCE_FILE (decl));
1054
1055 fprintf (stderr, "%s:%d: ",
1056 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
1057
1058 if (DECL_NAME (decl))
1059 fprintf (stderr, s, (*decl_printable_name) (decl, &junk), v);
1060 else
1061 fprintf (stderr, s, "((anonymous))", v);
1062 fprintf (stderr, "\n");
1063}
1064
1065/* Report an error at the line number of the insn INSN.
1066 S and V are a string and an arg for `printf'.
1067 This is used only when INSN is an `asm' with operands,
1068 and each ASM_OPERANDS records its own source file and line. */
1069
1070void
1071error_for_asm (insn, s, v, v2)
1072 rtx insn;
1073 char *s;
37366632
RK
1074 HOST_WIDE_INT v; /* Also used as pointer */
1075 HOST_WIDE_INT v2; /* Also used as pointer */
4291d9c8
RS
1076{
1077 char *filename;
1078 int line;
1079 rtx body = PATTERN (insn);
1080 rtx asmop;
1081
1082 /* Find the (or one of the) ASM_OPERANDS in the insn. */
1083 if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
1084 asmop = SET_SRC (body);
1085 else if (GET_CODE (body) == ASM_OPERANDS)
1086 asmop = body;
1087 else if (GET_CODE (body) == PARALLEL
1088 && GET_CODE (XVECEXP (body, 0, 0)) == SET)
1089 asmop = SET_SRC (XVECEXP (body, 0, 0));
1090 else if (GET_CODE (body) == PARALLEL
1091 && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
1092 asmop = XVECEXP (body, 0, 0);
1093
1094 filename = ASM_OPERANDS_SOURCE_FILE (asmop);
1095 line = ASM_OPERANDS_SOURCE_LINE (asmop);
1096
1097 error_with_file_and_line (filename, line, s, v, v2);
1098}
1099
1100/* Report a warning at line LINE.
1101 S and V are a string and an arg for `printf'. */
1102
1103void
1104warning_with_file_and_line (file, line, s, v, v2, v3)
1105 char *file;
1106 int line;
1107 char *s;
37366632 1108 HOST_WIDE_INT v, v2, v3;
4291d9c8
RS
1109{
1110 if (count_error (1) == 0)
1111 return;
1112
1113 report_error_function (file);
1114
1115 if (file)
1116 fprintf (stderr, "%s:%d: ", file, line);
1117 else
1118 fprintf (stderr, "%s: ", progname);
1119
1120 fprintf (stderr, "warning: ");
1121 fprintf (stderr, s, v, v2, v3);
1122 fprintf (stderr, "\n");
1123}
1124
1125/* Report a warning at the current line number.
1126 S and V are a string and an arg for `printf'. */
1127
1128void
1129warning (s, v, v2, v3)
1130 char *s;
37366632 1131 HOST_WIDE_INT v, v2, v3; /* Also used as pointer */
4291d9c8
RS
1132{
1133 warning_with_file_and_line (input_filename, lineno, s, v, v2, v3);
1134}
1135
1136/* Report a warning at the declaration DECL.
1137 S is string which uses %s to substitute the declaration name.
1138 V is a second parameter that S can refer to. */
1139
1140void
1141warning_with_decl (decl, s, v)
1142 tree decl;
1143 char *s;
37366632 1144 HOST_WIDE_INT v;
4291d9c8
RS
1145{
1146 char *junk;
1147
1148 if (count_error (1) == 0)
1149 return;
1150
1151 report_error_function (DECL_SOURCE_FILE (decl));
1152
1153 fprintf (stderr, "%s:%d: ",
1154 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
1155
1156 fprintf (stderr, "warning: ");
1157 if (DECL_NAME (decl))
1158 fprintf (stderr, s, (*decl_printable_name) (decl, &junk), v);
1159 else
1160 fprintf (stderr, s, "((anonymous))", v);
1161 fprintf (stderr, "\n");
1162}
1163
1164/* Report a warning at the line number of the insn INSN.
1165 S and V are a string and an arg for `printf'.
1166 This is used only when INSN is an `asm' with operands,
1167 and each ASM_OPERANDS records its own source file and line. */
1168
1169void
1170warning_for_asm (insn, s, v, v2)
1171 rtx insn;
1172 char *s;
37366632
RK
1173 HOST_WIDE_INT v; /* Also used as pointer */
1174 HOST_WIDE_INT v2; /* Also used as pointer */
4291d9c8
RS
1175{
1176 char *filename;
1177 int line;
1178 rtx body = PATTERN (insn);
1179 rtx asmop;
1180
1181 /* Find the (or one of the) ASM_OPERANDS in the insn. */
1182 if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
1183 asmop = SET_SRC (body);
1184 else if (GET_CODE (body) == ASM_OPERANDS)
1185 asmop = body;
1186 else if (GET_CODE (body) == PARALLEL
1187 && GET_CODE (XVECEXP (body, 0, 0)) == SET)
1188 asmop = SET_SRC (XVECEXP (body, 0, 0));
1189 else if (GET_CODE (body) == PARALLEL
1190 && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
1191 asmop = XVECEXP (body, 0, 0);
1192
1193 filename = ASM_OPERANDS_SOURCE_FILE (asmop);
1194 line = ASM_OPERANDS_SOURCE_LINE (asmop);
1195
1196 warning_with_file_and_line (filename, line, s, v, v2);
1197}
1198\f
1199/* These functions issue either warnings or errors depending on
1200 -pedantic-errors. */
1201
1202void
1203pedwarn (s, v, v2)
1204 char *s;
37366632
RK
1205 HOST_WIDE_INT v; /* Also used as pointer */
1206 HOST_WIDE_INT v2;
4291d9c8
RS
1207{
1208 if (flag_pedantic_errors)
1209 error (s, v, v2);
1210 else
1211 warning (s, v, v2);
1212}
1213
1214void
1215pedwarn_with_decl (decl, s, v)
1216 tree decl;
1217 char *s;
37366632 1218 HOST_WIDE_INT v;
4291d9c8
RS
1219{
1220 if (flag_pedantic_errors)
1221 error_with_decl (decl, s, v);
1222 else
1223 warning_with_decl (decl, s, v);
1224}
1225
1226void
1227pedwarn_with_file_and_line (file, line, s, v, v2)
1228 char *file;
1229 int line;
1230 char *s;
37366632
RK
1231 HOST_WIDE_INT v;
1232 HOST_WIDE_INT v2;
4291d9c8
RS
1233{
1234 if (flag_pedantic_errors)
1235 error_with_file_and_line (file, line, s, v, v2);
1236 else
1237 warning_with_file_and_line (file, line, s, v, v2);
1238}
1239
1240/* Apologize for not implementing some feature.
1241 S, V, and V2 are a string and args for `printf'. */
1242
1243void
1244sorry (s, v, v2)
1245 char *s;
37366632 1246 HOST_WIDE_INT v, v2;
4291d9c8
RS
1247{
1248 sorrycount++;
1249 if (input_filename)
1250 fprintf (stderr, "%s:%d: ", input_filename, lineno);
1251 else
1252 fprintf (stderr, "%s: ", progname);
1253
1254 fprintf (stderr, "sorry, not implemented: ");
1255 fprintf (stderr, s, v, v2);
1256 fprintf (stderr, "\n");
1257}
1258
1259/* Apologize for not implementing some feature, then quit.
1260 S, V, and V2 are a string and args for `printf'. */
1261
1262void
1263really_sorry (s, v, v2)
1264 char *s;
37366632 1265 HOST_WIDE_INT v, v2;
4291d9c8
RS
1266{
1267 if (input_filename)
1268 fprintf (stderr, "%s:%d: ", input_filename, lineno);
1269 else
c10afc44 1270 fprintf (stderr, "%s: ", progname);
4291d9c8
RS
1271
1272 fprintf (stderr, "sorry, not implemented: ");
1273 fprintf (stderr, s, v, v2);
1274 fatal (" (fatal)\n");
1275}
1276\f
1277/* More 'friendly' abort that prints the line and file.
1278 config.h can #define abort fancy_abort if you like that sort of thing.
1279
1280 I don't think this is actually a good idea.
1281 Other sorts of crashes will look a certain way.
1282 It is a good thing if crashes from calling abort look the same way.
1283 -- RMS */
1284
1285void
1286fancy_abort ()
1287{
1288 fatal ("internal gcc abort");
1289}
1290
1291/* This calls abort and is used to avoid problems when abort if a macro.
1292 It is used when we need to pass the address of abort. */
1293
1294void
1295do_abort ()
1296{
1297 abort ();
1298}
1299
1300/* When `malloc.c' is compiled with `rcheck' defined,
1301 it calls this function to report clobberage. */
1302
1303void
1304botch (s)
1305{
1306 abort ();
1307}
1308
1309/* Same as `malloc' but report error if no memory available. */
1310
4b980e20 1311char *
4291d9c8
RS
1312xmalloc (size)
1313 unsigned size;
1314{
4b980e20 1315 register char *value = (char *) malloc (size);
4291d9c8
RS
1316 if (value == 0)
1317 fatal ("virtual memory exhausted");
1318 return value;
1319}
1320
1321/* Same as `realloc' but report error if no memory available. */
1322
4b980e20 1323char *
4291d9c8
RS
1324xrealloc (ptr, size)
1325 char *ptr;
1326 int size;
1327{
4b980e20 1328 char *result = (char *) realloc (ptr, size);
4291d9c8
RS
1329 if (!result)
1330 fatal ("virtual memory exhausted");
1331 return result;
1332}
1333\f
1334/* Return the logarithm of X, base 2, considering X unsigned,
37366632
RK
1335 if X is a power of 2. Otherwise, returns -1.
1336
1337 This should be used via the `exact_log2' macro. */
4291d9c8
RS
1338
1339int
37366632
RK
1340exact_log2_wide (x)
1341 register unsigned HOST_WIDE_INT x;
4291d9c8
RS
1342{
1343 register int log = 0;
1344 /* Test for 0 or a power of 2. */
1345 if (x == 0 || x != (x & -x))
1346 return -1;
1347 while ((x >>= 1) != 0)
1348 log++;
1349 return log;
1350}
1351
1352/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
37366632
RK
1353 If X is 0, return -1.
1354
1355 This should be used via the floor_log2 macro. */
4291d9c8
RS
1356
1357int
37366632
RK
1358floor_log2_wide (x)
1359 register unsigned HOST_WIDE_INT x;
4291d9c8
RS
1360{
1361 register int log = -1;
1362 while (x != 0)
1363 log++,
1364 x >>= 1;
1365 return log;
1366}
1367
1368int float_handled;
1369jmp_buf float_handler;
1370
1371/* Specify where to longjmp to when a floating arithmetic error happens.
1372 If HANDLER is 0, it means don't handle the errors any more. */
1373
1374void
1375set_float_handler (handler)
1376 jmp_buf handler;
1377{
1378 float_handled = (handler != 0);
1379 if (handler)
1380 bcopy (handler, float_handler, sizeof (float_handler));
1381}
1382
bff4b641
RS
1383/* Specify, in HANDLER, where to longjmp to when a floating arithmetic
1384 error happens, pushing the previous specification into OLD_HANDLER.
1385 Return an indication of whether there was a previous handler in effect. */
1386
1387int
1388push_float_handler (handler, old_handler)
dc2b15dc 1389 jmp_buf handler, old_handler;
bff4b641
RS
1390{
1391 int was_handled = float_handled;
1392
1393 float_handled = 1;
1394 if (was_handled)
1395 bcopy (float_handler, old_handler, sizeof (float_handler));
1396 bcopy (handler, float_handler, sizeof (float_handler));
1397 return was_handled;
1398}
1399
1400/* Restore the previous specification of whether and where to longjmp to
1401 when a floating arithmetic error happens. */
1402
1403void
1404pop_float_handler (handled, handler)
1405 int handled;
1406 jmp_buf handler;
1407{
1408 float_handled = handled;
1409 if (handled)
1410 bcopy (handler, float_handler, sizeof (float_handler));
1411}
1412
4291d9c8
RS
1413/* Signals actually come here. */
1414
1415static void
1416float_signal (signo)
1417 /* If this is missing, some compilers complain. */
1418 int signo;
1419{
1420 if (float_handled == 0)
1421 abort ();
1422#if defined (USG) || defined (hpux)
1423 signal (SIGFPE, float_signal); /* re-enable the signal catcher */
1424#endif
1425 float_handled = 0;
1426 signal (SIGFPE, float_signal);
1427 longjmp (float_handler, 1);
1428}
1429
1430/* Handler for SIGPIPE. */
1431
1432static void
1433pipe_closed (signo)
1434 /* If this is missing, some compilers complain. */
1435 int signo;
1436{
1437 fatal ("output pipe has been closed");
1438}
1439
1440/* Strip off a legitimate source ending from the input string NAME of
1441 length LEN. */
1442
1443void
1444strip_off_ending (name, len)
1445 char *name;
1446 int len;
1447{
1448 if (len > 2 && ! strcmp (".c", name + len - 2))
1449 name[len - 2] = 0;
1450 else if (len > 2 && ! strcmp (".m", name + len - 2))
1451 name[len - 2] = 0;
1452 else if (len > 2 && ! strcmp (".i", name + len - 2))
1453 name[len - 2] = 0;
1454 else if (len > 3 && ! strcmp (".ii", name + len - 3))
1455 name[len - 3] = 0;
1456 else if (len > 3 && ! strcmp (".co", name + len - 3))
1457 name[len - 3] = 0;
1458 else if (len > 3 && ! strcmp (".cc", name + len - 3))
1459 name[len - 3] = 0;
9cc00e36
RS
1460 else if (len > 2 && ! strcmp (".C", name + len - 2))
1461 name[len - 2] = 0;
1462 else if (len > 4 && ! strcmp (".cxx", name + len - 4))
1463 name[len - 4] = 0;
4291d9c8
RS
1464 else if (len > 2 && ! strcmp (".f", name + len - 2))
1465 name[len - 2] = 0;
1466 else if (len > 4 && ! strcmp (".ada", name + len - 4))
1467 name[len - 4] = 0;
1468}
1469
1470/* Output a file name in the form wanted by System V. */
1471
1472void
1473output_file_directive (asm_file, input_name)
1474 FILE *asm_file;
1475 char *input_name;
1476{
1477 int len = strlen (input_name);
1478 char *na = input_name + len;
1479
1480 /* NA gets INPUT_NAME sans directory names. */
1481 while (na > input_name)
1482 {
1483 if (na[-1] == '/')
1484 break;
1485 na--;
1486 }
1487
1488#ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
1489 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
1490#else
1491#ifdef ASM_OUTPUT_SOURCE_FILENAME
1492 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
1493#else
1494 fprintf (asm_file, "\t.file\t\"%s\"\n", na);
1495#endif
1496#endif
1497}
1498\f
d0d4af87
MS
1499/* Routine to build language identifier for object file. */
1500static void
1501output_lang_identify (asm_out_file)
1502 FILE *asm_out_file;
1503{
1504 int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
1505 char *s = (char *) alloca (len);
1506 sprintf (s, "__gnu_compiled_%s", lang_identify ());
1507 ASM_OUTPUT_LABEL (asm_out_file, s);
1508}
1509
4291d9c8
RS
1510/* Compile an entire file of output from cpp, named NAME.
1511 Write a file of assembly output and various debugging dumps. */
1512
1513static void
1514compile_file (name)
1515 char *name;
1516{
1517 tree globals;
1518 int start_time;
1519 int dump_base_name_length;
4291d9c8
RS
1520
1521 int name_specified = name != 0;
1522
1523 if (dump_base_name == 0)
1524 dump_base_name = name ? name : "gccdump";
1525 dump_base_name_length = strlen (dump_base_name);
1526
1527 parse_time = 0;
1528 varconst_time = 0;
1529 integration_time = 0;
1530 jump_time = 0;
1531 cse_time = 0;
1532 loop_time = 0;
1533 cse2_time = 0;
1534 flow_time = 0;
1535 combine_time = 0;
1536 sched_time = 0;
1537 local_alloc_time = 0;
1538 global_alloc_time = 0;
1539 sched2_time = 0;
1540 dbr_sched_time = 0;
1541 shorten_branch_time = 0;
1542 stack_reg_time = 0;
1543 final_time = 0;
1544 symout_time = 0;
1545 dump_time = 0;
1546
1547 /* Open input file. */
1548
1549 if (name == 0 || !strcmp (name, "-"))
1550 {
1551 finput = stdin;
1552 name = "stdin";
1553 }
1554 else
1555 finput = fopen (name, "r");
1556 if (finput == 0)
1557 pfatal_with_name (name);
1558
282ea52a 1559#ifdef IO_BUFFER_SIZE
d7cedf4b 1560 setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
282ea52a
RS
1561#endif
1562
4291d9c8
RS
1563 /* Initialize data in various passes. */
1564
1565 init_obstacks ();
1566 init_tree_codes ();
1567 init_lex ();
1568 init_rtl ();
1569 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
1570 || debug_info_level == DINFO_LEVEL_VERBOSE);
1571 init_decl_processing ();
1572 init_optabs ();
1573 init_stmt ();
1574 init_expmed ();
4fa52007 1575 init_expr_once ();
4291d9c8
RS
1576 init_loop ();
1577 init_reload ();
1578
1579 if (flag_caller_saves)
1580 init_caller_save ();
1581
f246a305
RS
1582 /* If auxiliary info generation is desired, open the output file.
1583 This goes in the same directory as the source file--unlike
1584 all the other output files. */
4291d9c8
RS
1585 if (flag_gen_aux_info)
1586 {
4291d9c8
RS
1587 aux_info_file = fopen (aux_info_file_name, "w");
1588 if (aux_info_file == 0)
1589 pfatal_with_name (aux_info_file_name);
1590 }
1591
1592 /* If rtl dump desired, open the output file. */
1593 if (rtl_dump)
1594 {
1595 register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
1596 strcpy (dumpname, dump_base_name);
1597 strcat (dumpname, ".rtl");
1598 rtl_dump_file = fopen (dumpname, "w");
1599 if (rtl_dump_file == 0)
1600 pfatal_with_name (dumpname);
1601 }
1602
1603 /* If jump_opt dump desired, open the output file. */
1604 if (jump_opt_dump)
1605 {
1606 register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
1607 strcpy (dumpname, dump_base_name);
1608 strcat (dumpname, ".jump");
1609 jump_opt_dump_file = fopen (dumpname, "w");
1610 if (jump_opt_dump_file == 0)
1611 pfatal_with_name (dumpname);
1612 }
1613
1614 /* If cse dump desired, open the output file. */
1615 if (cse_dump)
1616 {
1617 register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
1618 strcpy (dumpname, dump_base_name);
1619 strcat (dumpname, ".cse");
1620 cse_dump_file = fopen (dumpname, "w");
1621 if (cse_dump_file == 0)
1622 pfatal_with_name (dumpname);
1623 }
1624
1625 /* If loop dump desired, open the output file. */
1626 if (loop_dump)
1627 {
1628 register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
1629 strcpy (dumpname, dump_base_name);
1630 strcat (dumpname, ".loop");
1631 loop_dump_file = fopen (dumpname, "w");
1632 if (loop_dump_file == 0)
1633 pfatal_with_name (dumpname);
1634 }
1635
1636 /* If cse2 dump desired, open the output file. */
1637 if (cse2_dump)
1638 {
1639 register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
1640 strcpy (dumpname, dump_base_name);
1641 strcat (dumpname, ".cse2");
1642 cse2_dump_file = fopen (dumpname, "w");
1643 if (cse2_dump_file == 0)
1644 pfatal_with_name (dumpname);
1645 }
1646
1647 /* If flow dump desired, open the output file. */
1648 if (flow_dump)
1649 {
1650 register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
1651 strcpy (dumpname, dump_base_name);
1652 strcat (dumpname, ".flow");
1653 flow_dump_file = fopen (dumpname, "w");
1654 if (flow_dump_file == 0)
1655 pfatal_with_name (dumpname);
1656 }
1657
1658 /* If combine dump desired, open the output file. */
1659 if (combine_dump)
1660 {
1661 register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
1662 strcpy (dumpname, dump_base_name);
1663 strcat (dumpname, ".combine");
1664 combine_dump_file = fopen (dumpname, "w");
1665 if (combine_dump_file == 0)
1666 pfatal_with_name (dumpname);
1667 }
1668
1669 /* If scheduling dump desired, open the output file. */
1670 if (sched_dump)
1671 {
1672 register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
1673 strcpy (dumpname, dump_base_name);
1674 strcat (dumpname, ".sched");
1675 sched_dump_file = fopen (dumpname, "w");
1676 if (sched_dump_file == 0)
1677 pfatal_with_name (dumpname);
1678 }
1679
1680 /* If local_reg dump desired, open the output file. */
1681 if (local_reg_dump)
1682 {
1683 register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
1684 strcpy (dumpname, dump_base_name);
1685 strcat (dumpname, ".lreg");
1686 local_reg_dump_file = fopen (dumpname, "w");
1687 if (local_reg_dump_file == 0)
1688 pfatal_with_name (dumpname);
1689 }
1690
1691 /* If global_reg dump desired, open the output file. */
1692 if (global_reg_dump)
1693 {
1694 register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
1695 strcpy (dumpname, dump_base_name);
1696 strcat (dumpname, ".greg");
1697 global_reg_dump_file = fopen (dumpname, "w");
1698 if (global_reg_dump_file == 0)
1699 pfatal_with_name (dumpname);
1700 }
1701
1702 /* If 2nd scheduling dump desired, open the output file. */
1703 if (sched2_dump)
1704 {
1705 register char *dumpname = (char *) xmalloc (dump_base_name_length + 8);
1706 strcpy (dumpname, dump_base_name);
1707 strcat (dumpname, ".sched2");
1708 sched2_dump_file = fopen (dumpname, "w");
1709 if (sched2_dump_file == 0)
1710 pfatal_with_name (dumpname);
1711 }
1712
1713 /* If jump2_opt dump desired, open the output file. */
1714 if (jump2_opt_dump)
1715 {
1716 register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
1717 strcpy (dumpname, dump_base_name);
1718 strcat (dumpname, ".jump2");
1719 jump2_opt_dump_file = fopen (dumpname, "w");
1720 if (jump2_opt_dump_file == 0)
1721 pfatal_with_name (dumpname);
1722 }
1723
1724 /* If dbr_sched dump desired, open the output file. */
1725 if (dbr_sched_dump)
1726 {
1727 register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
1728 strcpy (dumpname, dump_base_name);
1729 strcat (dumpname, ".dbr");
1730 dbr_sched_dump_file = fopen (dumpname, "w");
1731 if (dbr_sched_dump_file == 0)
1732 pfatal_with_name (dumpname);
1733 }
1734
1735#ifdef STACK_REGS
1736
1737 /* If stack_reg dump desired, open the output file. */
1738 if (stack_reg_dump)
1739 {
1740 register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
1741 strcpy (dumpname, dump_base_name);
1742 strcat (dumpname, ".stack");
1743 stack_reg_dump_file = fopen (dumpname, "w");
1744 if (stack_reg_dump_file == 0)
1745 pfatal_with_name (dumpname);
1746 }
1747
1748#endif
1749
1750 /* Open assembler code output file. */
1751
1752 if (! name_specified && asm_file_name == 0)
1753 asm_out_file = stdout;
1754 else
1755 {
1756 register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
1757 int len = strlen (dump_base_name);
1758 strcpy (dumpname, dump_base_name);
1759 strip_off_ending (dumpname, len);
1760 strcat (dumpname, ".s");
1761 if (asm_file_name == 0)
1762 {
1763 asm_file_name = (char *) xmalloc (strlen (dumpname) + 1);
1764 strcpy (asm_file_name, dumpname);
1765 }
1766 if (!strcmp (asm_file_name, "-"))
1767 asm_out_file = stdout;
1768 else
1769 asm_out_file = fopen (asm_file_name, "w");
1770 if (asm_out_file == 0)
1771 pfatal_with_name (asm_file_name);
1772 }
1773
f246a305 1774#ifdef IO_BUFFER_SIZE
d7cedf4b
RS
1775 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
1776 _IOFBF, IO_BUFFER_SIZE);
f246a305
RS
1777#endif
1778
4291d9c8
RS
1779 input_filename = name;
1780
1781 /* Perform language-specific initialization.
1782 This may set main_input_filename. */
1783 lang_init ();
1784
1785 /* If the input doesn't start with a #line, use the input name
1786 as the official input file name. */
1787 if (main_input_filename == 0)
1788 main_input_filename = name;
1789
1790 /* Put an entry on the input file stack for the main input file. */
1791 input_file_stack
1792 = (struct file_stack *) xmalloc (sizeof (struct file_stack));
1793 input_file_stack->next = 0;
1794 input_file_stack->name = input_filename;
1795
1796 ASM_FILE_START (asm_out_file);
1797
1798 /* Output something to inform GDB that this compilation was by GCC. */
1799#ifndef ASM_IDENTIFY_GCC
1800 fprintf (asm_out_file, "gcc2_compiled.:\n");
1801#else
1802 ASM_IDENTIFY_GCC (asm_out_file);
1803#endif
d0d4af87
MS
1804
1805 /* Output something to identify which front-end produced this file. */
1806#ifdef ASM_IDENTIFY_LANGUAGE
1807 ASM_IDENTIFY_LANGUAGE (asm_out_file);
1808#endif
1809
4291d9c8
RS
1810 /* Don't let the first function fall at the same address
1811 as gcc_compiled., if profiling. */
1812 if (profile_flag || profile_block_flag)
1813 assemble_zeros (UNITS_PER_WORD);
1814
1815 /* If dbx symbol table desired, initialize writing it
1816 and output the predefined types. */
f246a305
RS
1817#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
1818 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
4291d9c8
RS
1819 TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
1820 getdecls ()));
1821#endif
1822#ifdef SDB_DEBUGGING_INFO
1823 if (write_symbols == SDB_DEBUG)
1824 TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
1825 getdecls ()));
1826#endif
1827#ifdef DWARF_DEBUGGING_INFO
1828 if (write_symbols == DWARF_DEBUG)
1829 TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
1830#endif
1831
1832 /* Initialize yet another pass. */
1833
1834 init_final (main_input_filename);
1835
1836 start_time = get_run_time ();
1837
1838 /* Call the parser, which parses the entire file
1839 (calling rest_of_compilation for each function). */
1840
1841 if (yyparse () != 0)
1842 if (errorcount == 0)
1843 fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
1844
1845 /* Compilation is now finished except for writing
1846 what's left of the symbol table output. */
1847
1848 parse_time += get_run_time () - start_time;
1849
1850 parse_time -= integration_time;
1851 parse_time -= varconst_time;
1852
1853 globals = getdecls ();
1854
1855 /* Really define vars that have had only a tentative definition.
1856 Really output inline functions that must actually be callable
1857 and have not been output so far. */
1858
1859 {
1860 int len = list_length (globals);
1861 tree *vec = (tree *) alloca (sizeof (tree) * len);
1862 int i;
1863 tree decl;
1864
1865 /* Process the decls in reverse order--earliest first.
1866 Put them into VEC from back to front, then take out from front. */
1867
1868 for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
1869 vec[len - i - 1] = decl;
1870
1871 for (i = 0; i < len; i++)
1872 {
1873 decl = vec[i];
2b599527
RS
1874 if (DECL_SIZE (decl) == 0)
1875 (*incomplete_decl_finalize_hook) (decl);
1876
4291d9c8
RS
1877 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
1878 && ! TREE_ASM_WRITTEN (decl))
1879 {
1880 /* Don't write out static consts, unless we used them.
1881 (This used to write them out only if the address was
1882 taken, but that was wrong; if the variable was simply
1883 referred to, it still needs to exist or else it will
1884 be undefined in the linker.) */
1885 if (! TREE_READONLY (decl)
1886 || TREE_PUBLIC (decl)
1887 || TREE_USED (decl)
1888 || TREE_ADDRESSABLE (decl)
1889 || TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (decl)))
37366632 1890 rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
4291d9c8
RS
1891 else
1892 /* Cancel the RTL for this decl so that, if debugging info
1893 output for global variables is still to come,
1894 this one will be omitted. */
1895 DECL_RTL (decl) = NULL;
1896 }
1897
1898 if (TREE_CODE (decl) == FUNCTION_DECL
1899 && ! TREE_ASM_WRITTEN (decl)
1900 && DECL_INITIAL (decl) != 0
1901 && (TREE_ADDRESSABLE (decl)
1902 || TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (decl)))
216d5cdd 1903 && ! DECL_EXTERNAL (decl))
4291d9c8
RS
1904 output_inline_function (decl);
1905
ac266247
RS
1906 /* Warn about any function
1907 declared static but not defined.
1908 We don't warn about variables,
1909 because many programs have static variables
1910 that exist only to get some text into the object file. */
4291d9c8
RS
1911 if ((warn_unused
1912 || TREE_USED (decl)
1913 || (DECL_NAME (decl) && TREE_USED (DECL_NAME (decl))))
ac266247 1914 && TREE_CODE (decl) == FUNCTION_DECL
4291d9c8 1915 && DECL_INITIAL (decl) == 0
216d5cdd 1916 && DECL_EXTERNAL (decl)
4291d9c8 1917 && ! TREE_PUBLIC (decl))
7d429c41
RS
1918 {
1919 pedwarn_with_decl (decl,
1920 "`%s' declared `static' but never defined");
1921 /* This symbol is effectively an "extern" declaration now. */
1922 TREE_PUBLIC (decl) = 1;
1923 assemble_external (decl);
1924
1925 }
4291d9c8
RS
1926 /* Warn about static fns or vars defined but not used,
1927 but not about inline functions
1928 since unused inline statics is normal practice. */
1929 if (warn_unused
1930 && (TREE_CODE (decl) == FUNCTION_DECL
1931 || TREE_CODE (decl) == VAR_DECL)
0c20aabf 1932 && ! DECL_IN_SYSTEM_HEADER (decl)
216d5cdd 1933 && ! DECL_EXTERNAL (decl)
4291d9c8
RS
1934 && ! TREE_PUBLIC (decl)
1935 && ! TREE_USED (decl)
216d5cdd 1936 && ! DECL_INLINE (decl)
f2dabd38 1937 && ! DECL_REGISTER (decl)
4291d9c8
RS
1938 /* The TREE_USED bit for file-scope decls
1939 is kept in the identifier, to handle multiple
1940 external decls in different scopes. */
1941 && ! TREE_USED (DECL_NAME (decl)))
1942 warning_with_decl (decl, "`%s' defined but not used");
1943
1944#ifdef SDB_DEBUGGING_INFO
1945 /* The COFF linker can move initialized global vars to the end.
1946 And that can screw up the symbol ordering.
1947 By putting the symbols in that order to begin with,
1948 we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
1949 if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
1950 && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
1951 && DECL_RTL (decl) != 0)
1952 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
1953
1954 /* Output COFF information for non-global
1955 file-scope initialized variables. */
1956 if (write_symbols == SDB_DEBUG
1957 && TREE_CODE (decl) == VAR_DECL
1958 && DECL_INITIAL (decl)
1959 && DECL_RTL (decl) != 0
1960 && GET_CODE (DECL_RTL (decl)) == MEM)
1961 TIMEVAR (symout_time, sdbout_toplevel_data (decl));
1962#endif /* SDB_DEBUGGING_INFO */
1963#ifdef DWARF_DEBUGGING_INFO
6dc42e49 1964 /* Output DWARF information for file-scope tentative data object
4291d9c8
RS
1965 declarations, file-scope (extern) function declarations (which
1966 had no corresponding body) and file-scope tagged type declarations
1967 and definitions which have not yet been forced out. */
1968
1969 if (write_symbols == DWARF_DEBUG
1970 && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
1971 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
1972#endif
1973 }
1974 }
1975
1976 /* Do dbx symbols */
f246a305
RS
1977#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
1978 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
4291d9c8
RS
1979 TIMEVAR (symout_time,
1980 {
1981 dbxout_finish (asm_out_file, main_input_filename);
1982 });
1983#endif
1984
1985#ifdef DWARF_DEBUGGING_INFO
1986 if (write_symbols == DWARF_DEBUG)
1987 TIMEVAR (symout_time,
1988 {
1989 dwarfout_finish ();
1990 });
1991#endif
1992
1993 /* Output some stuff at end of file if nec. */
1994
1995 end_final (main_input_filename);
1996
1997#ifdef ASM_FILE_END
1998 ASM_FILE_END (asm_out_file);
1999#endif
2000
2001 after_finish_compilation:
2002
2003 /* Language-specific end of compilation actions. */
2004
2005 lang_finish ();
2006
2007 /* Close the dump files. */
2008
2009 if (flag_gen_aux_info)
2010 {
2011 fclose (aux_info_file);
2012 if (errorcount)
2013 unlink (aux_info_file_name);
2014 }
2015
2016 if (rtl_dump)
2017 fclose (rtl_dump_file);
2018
2019 if (jump_opt_dump)
2020 fclose (jump_opt_dump_file);
2021
2022 if (cse_dump)
2023 fclose (cse_dump_file);
2024
2025 if (loop_dump)
2026 fclose (loop_dump_file);
2027
2028 if (cse2_dump)
2029 fclose (cse2_dump_file);
2030
2031 if (flow_dump)
2032 fclose (flow_dump_file);
2033
2034 if (combine_dump)
2035 {
2036 dump_combine_total_stats (combine_dump_file);
2037 fclose (combine_dump_file);
2038 }
2039
2040 if (sched_dump)
2041 fclose (sched_dump_file);
2042
2043 if (local_reg_dump)
2044 fclose (local_reg_dump_file);
2045
2046 if (global_reg_dump)
2047 fclose (global_reg_dump_file);
2048
2049 if (sched2_dump)
2050 fclose (sched2_dump_file);
2051
2052 if (jump2_opt_dump)
2053 fclose (jump2_opt_dump_file);
2054
2055 if (dbr_sched_dump)
2056 fclose (dbr_sched_dump_file);
2057
2058#ifdef STACK_REGS
2059 if (stack_reg_dump)
2060 fclose (stack_reg_dump_file);
2061#endif
2062
2063 /* Close non-debugging input and output files. Take special care to note
2064 whether fclose returns an error, since the pages might still be on the
2065 buffer chain while the file is open. */
2066
2067 fclose (finput);
2068 if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
2069 fatal_io_error (asm_file_name);
2070
2071 /* Print the times. */
2072
2073 if (! quiet_flag)
2074 {
2075 fprintf (stderr,"\n");
2076 print_time ("parse", parse_time);
2077 print_time ("integration", integration_time);
2078 print_time ("jump", jump_time);
2079 print_time ("cse", cse_time);
2080 print_time ("loop", loop_time);
2081 print_time ("cse2", cse2_time);
2082 print_time ("flow", flow_time);
2083 print_time ("combine", combine_time);
2084 print_time ("sched", sched_time);
2085 print_time ("local-alloc", local_alloc_time);
2086 print_time ("global-alloc", global_alloc_time);
2087 print_time ("sched2", sched2_time);
2088 print_time ("dbranch", dbr_sched_time);
2089 print_time ("shorten-branch", shorten_branch_time);
2090 print_time ("stack-reg", stack_reg_time);
2091 print_time ("final", final_time);
2092 print_time ("varconst", varconst_time);
2093 print_time ("symout", symout_time);
2094 print_time ("dump", dump_time);
2095 }
2096}
2097\f
2098/* This is called from various places for FUNCTION_DECL, VAR_DECL,
2099 and TYPE_DECL nodes.
2100
2101 This does nothing for local (non-static) variables.
2102 Otherwise, it sets up the RTL and outputs any assembler code
2103 (label definition, storage allocation and initialization).
2104
2105 DECL is the declaration. If ASMSPEC is nonzero, it specifies
2106 the assembler symbol name to be used. TOP_LEVEL is nonzero
2107 if this declaration is not within a function. */
2108
2109void
2110rest_of_decl_compilation (decl, asmspec, top_level, at_end)
2111 tree decl;
2112 char *asmspec;
2113 int top_level;
2114 int at_end;
2115{
2116 /* Declarations of variables, and of functions defined elsewhere. */
2117
2118 /* Forward declarations for nested functions are not "external",
2119 but we need to treat them as if they were. */
216d5cdd 2120 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
4291d9c8
RS
2121 || TREE_CODE (decl) == FUNCTION_DECL)
2122 TIMEVAR (varconst_time,
2123 {
2124 make_decl_rtl (decl, asmspec, top_level);
6dbf678a
RS
2125 /* For a user-invisible decl that should be replaced
2126 by its value when used, don't output anything. */
2127 if (! (TREE_CODE (decl) == VAR_DECL
2128 && DECL_IGNORED_P (decl) && TREE_READONLY (decl)
2129 && DECL_INITIAL (decl) != 0))
2130 /* Don't output anything
2131 when a tentative file-scope definition is seen.
2132 But at end of compilation, do output code for them. */
2133 if (! (! at_end && top_level
2134 && (DECL_INITIAL (decl) == 0
2135 || DECL_INITIAL (decl) == error_mark_node
2136 || DECL_IGNORED_P (decl))))
2137 assemble_variable (decl, top_level, at_end);
4291d9c8 2138 });
216d5cdd 2139 else if (DECL_REGISTER (decl) && asmspec != 0)
4291d9c8
RS
2140 {
2141 if (decode_reg_name (asmspec) >= 0)
2142 {
2143 DECL_RTL (decl) = 0;
2144 make_decl_rtl (decl, asmspec, top_level);
2145 }
2146 else
2147 error ("invalid register name `%s' for register variable", asmspec);
2148 }
f246a305
RS
2149#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2150 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
2151 && TREE_CODE (decl) == TYPE_DECL)
4291d9c8
RS
2152 TIMEVAR (symout_time, dbxout_symbol (decl, 0));
2153#endif
2154#ifdef SDB_DEBUGGING_INFO
2155 else if (write_symbols == SDB_DEBUG && top_level
2156 && TREE_CODE (decl) == TYPE_DECL)
2157 TIMEVAR (symout_time, sdbout_symbol (decl, 0));
2158#endif
2159}
2160
2161/* Called after finishing a record, union or enumeral type. */
2162
2163void
2164rest_of_type_compilation (type, toplev)
2165 tree type;
2166 int toplev;
2167{
f246a305
RS
2168#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
2169 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
4291d9c8
RS
2170 TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
2171#endif
2172#ifdef SDB_DEBUGGING_INFO
2173 if (write_symbols == SDB_DEBUG)
2174 TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
2175#endif
2176}
2177
2178/* This is called from finish_function (within yyparse)
2179 after each top-level definition is parsed.
2180 It is supposed to compile that function or variable
2181 and output the assembler code for it.
2182 After we return, the tree storage is freed. */
2183
2184void
2185rest_of_compilation (decl)
2186 tree decl;
2187{
2188 register rtx insns;
2189 int start_time = get_run_time ();
2190 int tem;
2191 /* Nonzero if we have saved the original DECL_INITIAL of the function,
2192 to be restored after we finish compiling the function
2193 (for use when compiling inline calls to this function). */
2194 tree saved_block_tree = 0;
8a958768
RS
2195 /* Likewise, for DECL_ARGUMENTS. */
2196 tree saved_arguments = 0;
ab40ad2b 2197 int failure = 0;
4291d9c8
RS
2198
2199 /* If we are reconsidering an inline function
2200 at the end of compilation, skip the stuff for making it inline. */
2201
2202 if (DECL_SAVED_INSNS (decl) == 0)
2203 {
216d5cdd 2204 int specd = DECL_INLINE (decl);
4291d9c8
RS
2205 char *lose;
2206
2207 /* If requested, consider whether to make this function inline. */
2208 if (specd || flag_inline_functions)
2209 TIMEVAR (integration_time,
2210 {
2211 lose = function_cannot_inline_p (decl);
2212 if (lose)
2213 {
2214 if (warn_inline && specd)
2215 warning_with_decl (decl, lose);
216d5cdd 2216 DECL_INLINE (decl) = 0;
4291d9c8
RS
2217 }
2218 else
216d5cdd 2219 DECL_INLINE (decl) = 1;
4291d9c8
RS
2220 });
2221
2222 insns = get_insns ();
2223
2224 /* Dump the rtl code if we are dumping rtl. */
2225
2226 if (rtl_dump)
2227 TIMEVAR (dump_time,
2228 {
2229 fprintf (rtl_dump_file, "\n;; Function %s\n\n",
2230 IDENTIFIER_POINTER (DECL_NAME (decl)));
2231 if (DECL_SAVED_INSNS (decl))
2232 fprintf (rtl_dump_file, ";; (integrable)\n\n");
2233 print_rtl (rtl_dump_file, insns);
2234 fflush (rtl_dump_file);
2235 });
2236
2237 /* If function is inline, and we don't yet know whether to
2238 compile it by itself, defer decision till end of compilation.
2239 finish_compilation will call rest_of_compilation again
2240 for those functions that need to be output. */
2241
216d5cdd 2242 if (DECL_INLINE (decl)
4291d9c8
RS
2243 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
2244 && ! flag_keep_inline_functions)
216d5cdd 2245 || DECL_EXTERNAL (decl)))
4291d9c8 2246 {
937522b5
RS
2247#ifdef DWARF_DEBUGGING_INFO
2248 /* Generate the DWARF info for the "abstract" instance
2249 of a function which we may later generate inlined and/or
2250 out-of-line instances of. */
2251 if (write_symbols == DWARF_DEBUG)
2252 {
2253 set_decl_abstract_flags (decl, 1);
2254 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
2255 set_decl_abstract_flags (decl, 0);
2256 }
2257#endif
4291d9c8
RS
2258 TIMEVAR (integration_time, save_for_inline_nocopy (decl));
2259 goto exit_rest_of_compilation;
2260 }
2261
8a958768 2262 /* If we have to compile the function now, save its rtl and subdecls
4291d9c8 2263 so that its compilation will not affect what others get. */
216d5cdd 2264 if (DECL_INLINE (decl))
4291d9c8 2265 {
937522b5
RS
2266#ifdef DWARF_DEBUGGING_INFO
2267 /* Generate the DWARF info for the "abstract" instance of
2268 a function which we will generate an out-of-line instance
2269 of almost immediately (and which we may also later generate
2270 various inlined instances of). */
2271 if (write_symbols == DWARF_DEBUG)
2272 {
2273 set_decl_abstract_flags (decl, 1);
2274 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
2275 set_decl_abstract_flags (decl, 0);
2276 }
2277#endif
4291d9c8 2278 saved_block_tree = DECL_INITIAL (decl);
8a958768 2279 saved_arguments = DECL_ARGUMENTS (decl);
4291d9c8
RS
2280 TIMEVAR (integration_time, save_for_inline_copying (decl));
2281 }
2282 }
2283
4291d9c8
RS
2284 TREE_ASM_WRITTEN (decl) = 1;
2285
2286 /* Now that integrate will no longer see our rtl, we need not distinguish
2287 between the return value of this function and the return value of called
2288 functions. */
2289 rtx_equal_function_value_matters = 0;
2290
32235b30
RS
2291 /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
2292 if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
4291d9c8
RS
2293 {
2294 goto exit_rest_of_compilation;
2295 }
2296
2297 /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
2298 Note that that may have been done above, in save_for_inline_copying.
2299 The call to resume_temporary_allocation near the end of this function
2300 goes back to the usual state of affairs. */
2301
2302 rtl_in_current_obstack ();
2303
2304#ifdef FINALIZE_PIC
2305 /* If we are doing position-independent code generation, now
2306 is the time to output special prologues and epilogues.
2307 We do not want to do this earlier, because it just clutters
2308 up inline functions with meaningless insns. */
2309 if (flag_pic)
2310 FINALIZE_PIC;
2311#endif
2312
2313 insns = get_insns ();
2314
2315 /* Copy any shared structure that should not be shared. */
2316
2317 unshare_all_rtl (insns);
2318
2319 /* Instantiate all virtual registers. */
2320
2321 instantiate_virtual_regs (current_function_decl, get_insns ());
2322
2323 /* See if we have allocated stack slots that are not directly addressable.
2324 If so, scan all the insns and create explicit address computation
2325 for all references to such slots. */
2326/* fixup_stack_slots (); */
2327
2328 /* Do jump optimization the first time, if -opt.
2329 Also do it if -W, but in that case it doesn't change the rtl code,
2330 it only computes whether control can drop off the end of the function. */
2331
2332 if (optimize > 0 || extra_warnings || warn_return_type
2333 /* If function is `volatile', we should warn if it tries to return. */
2334 || TREE_THIS_VOLATILE (decl))
2335 {
2336 TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
2337 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
2338 }
2339
32235b30
RS
2340 /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
2341 if (rtl_dump_and_exit || flag_syntax_only)
2342 goto exit_rest_of_compilation;
2343
4291d9c8
RS
2344 /* Dump rtl code after jump, if we are doing that. */
2345
2346 if (jump_opt_dump)
2347 TIMEVAR (dump_time,
2348 {
2349 fprintf (jump_opt_dump_file, "\n;; Function %s\n\n",
2350 IDENTIFIER_POINTER (DECL_NAME (decl)));
2351 print_rtl (jump_opt_dump_file, insns);
2352 fflush (jump_opt_dump_file);
2353 });
2354
2355 /* Perform common subexpression elimination.
2356 Nonzero value from `cse_main' means that jumps were simplified
2357 and some code may now be unreachable, so do
2358 jump optimization again. */
2359
2360 if (cse_dump)
2361 TIMEVAR (dump_time,
2362 {
2363 fprintf (cse_dump_file, "\n;; Function %s\n\n",
2364 IDENTIFIER_POINTER (DECL_NAME (decl)));
2365 });
2366
2367 if (optimize > 0)
2368 {
2369 TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
2370
2371 if (flag_thread_jumps)
2372 /* Hacks by tiemann & kenner. */
2373 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
2374
2375 TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
2376 0, cse_dump_file));
2377 TIMEVAR (cse_time, delete_dead_from_cse (insns, max_reg_num ()));
2378
2379 if (tem)
2380 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
2381 }
2382
2383 /* Dump rtl code after cse, if we are doing that. */
2384
2385 if (cse_dump)
2386 TIMEVAR (dump_time,
2387 {
2388 print_rtl (cse_dump_file, insns);
2389 fflush (cse_dump_file);
2390 });
2391
2392 if (loop_dump)
2393 TIMEVAR (dump_time,
2394 {
2395 fprintf (loop_dump_file, "\n;; Function %s\n\n",
2396 IDENTIFIER_POINTER (DECL_NAME (decl)));
2397 });
2398
2399 /* Move constant computations out of loops. */
2400
2401 if (optimize > 0)
2402 {
2403 TIMEVAR (loop_time,
2404 {
37366632 2405 loop_optimize (insns, loop_dump_file);
4291d9c8
RS
2406 });
2407 }
2408
2409 /* Dump rtl code after loop opt, if we are doing that. */
2410
2411 if (loop_dump)
2412 TIMEVAR (dump_time,
2413 {
2414 print_rtl (loop_dump_file, insns);
2415 fflush (loop_dump_file);
2416 });
2417
2418 if (cse2_dump)
2419 TIMEVAR (dump_time,
2420 {
2421 fprintf (cse2_dump_file, "\n;; Function %s\n\n",
2422 IDENTIFIER_POINTER (DECL_NAME (decl)));
2423 });
2424
2425 if (optimize > 0 && flag_rerun_cse_after_loop)
2426 {
2427 TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
2428
2429 TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
2430 1, cse2_dump_file));
2431 if (tem)
2432 TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
2433 }
2434
2435 if (optimize > 0 && flag_thread_jumps)
2436 /* This pass of jump threading straightens out code
2437 that was kinked by loop optimization. */
2438 TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
2439
2440 /* Dump rtl code after cse, if we are doing that. */
2441
2442 if (cse2_dump)
2443 TIMEVAR (dump_time,
2444 {
2445 print_rtl (cse2_dump_file, insns);
2446 fflush (cse2_dump_file);
2447 });
2448
2449 /* We are no longer anticipating cse in this function, at least. */
2450
2451 cse_not_expected = 1;
2452
2453 /* Now we choose between stupid (pcc-like) register allocation
2454 (if we got the -noreg switch and not -opt)
2455 and smart register allocation. */
2456
2457 if (optimize > 0) /* Stupid allocation probably won't work */
2458 obey_regdecls = 0; /* if optimizations being done. */
2459
2460 regclass_init ();
2461
2462 /* Print function header into flow dump now
2463 because doing the flow analysis makes some of the dump. */
2464
2465 if (flow_dump)
2466 TIMEVAR (dump_time,
2467 {
2468 fprintf (flow_dump_file, "\n;; Function %s\n\n",
2469 IDENTIFIER_POINTER (DECL_NAME (decl)));
2470 });
2471
2472 if (obey_regdecls)
2473 {
2474 TIMEVAR (flow_time,
2475 {
2476 regclass (insns, max_reg_num ());
2477 stupid_life_analysis (insns, max_reg_num (),
2478 flow_dump_file);
2479 });
2480 }
2481 else
2482 {
2483 /* Do control and data flow analysis,
2484 and write some of the results to dump file. */
2485
2486 TIMEVAR (flow_time, flow_analysis (insns, max_reg_num (),
2487 flow_dump_file));
2488 if (warn_uninitialized)
2489 {
2490 uninitialized_vars_warning (DECL_INITIAL (decl));
2491 setjmp_args_warning ();
2492 }
2493 }
2494
2495 /* Dump rtl after flow analysis. */
2496
2497 if (flow_dump)
2498 TIMEVAR (dump_time,
2499 {
2500 print_rtl (flow_dump_file, insns);
2501 fflush (flow_dump_file);
2502 });
2503
2504 /* If -opt, try combining insns through substitution. */
2505
2506 if (optimize > 0)
2507 TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
2508
2509 /* Dump rtl code after insn combination. */
2510
2511 if (combine_dump)
2512 TIMEVAR (dump_time,
2513 {
2514 fprintf (combine_dump_file, "\n;; Function %s\n\n",
2515 IDENTIFIER_POINTER (DECL_NAME (decl)));
2516 dump_combine_stats (combine_dump_file);
2517 print_rtl (combine_dump_file, insns);
2518 fflush (combine_dump_file);
2519 });
2520
2521 /* Print function header into sched dump now
2522 because doing the sched analysis makes some of the dump. */
2523
2524 if (sched_dump)
2525 TIMEVAR (dump_time,
2526 {
2527 fprintf (sched_dump_file, "\n;; Function %s\n\n",
2528 IDENTIFIER_POINTER (DECL_NAME (decl)));
2529 });
2530
2531 if (optimize > 0 && flag_schedule_insns)
2532 {
2533 /* Do control and data sched analysis,
2534 and write some of the results to dump file. */
2535
2536 TIMEVAR (sched_time, schedule_insns (sched_dump_file));
2537 }
2538
2539 /* Dump rtl after instruction scheduling. */
2540
2541 if (sched_dump)
2542 TIMEVAR (dump_time,
2543 {
2544 print_rtl (sched_dump_file, insns);
2545 fflush (sched_dump_file);
2546 });
2547
2548 /* Unless we did stupid register allocation,
2549 allocate pseudo-regs that are used only within 1 basic block. */
2550
2551 if (!obey_regdecls)
2552 TIMEVAR (local_alloc_time,
2553 {
2554 regclass (insns, max_reg_num ());
2555 local_alloc ();
2556 });
2557
2558 /* Dump rtl code after allocating regs within basic blocks. */
2559
2560 if (local_reg_dump)
2561 TIMEVAR (dump_time,
2562 {
2563 fprintf (local_reg_dump_file, "\n;; Function %s\n\n",
2564 IDENTIFIER_POINTER (DECL_NAME (decl)));
2565 dump_flow_info (local_reg_dump_file);
2566 dump_local_alloc (local_reg_dump_file);
2567 print_rtl (local_reg_dump_file, insns);
2568 fflush (local_reg_dump_file);
2569 });
2570
2571 if (global_reg_dump)
2572 TIMEVAR (dump_time,
2573 fprintf (global_reg_dump_file, "\n;; Function %s\n\n",
2574 IDENTIFIER_POINTER (DECL_NAME (decl))));
2575
2576 /* Unless we did stupid register allocation,
2577 allocate remaining pseudo-regs, then do the reload pass
2578 fixing up any insns that are invalid. */
2579
2580 TIMEVAR (global_alloc_time,
2581 {
2582 if (!obey_regdecls)
37366632 2583 failure = global_alloc (global_reg_dump_file);
4291d9c8 2584 else
37366632 2585 failure = reload (insns, 0, global_reg_dump_file);
4291d9c8
RS
2586 });
2587
2588 if (global_reg_dump)
2589 TIMEVAR (dump_time,
2590 {
2591 dump_global_regs (global_reg_dump_file);
2592 print_rtl (global_reg_dump_file, insns);
2593 fflush (global_reg_dump_file);
2594 });
2595
ab40ad2b
RS
2596 if (failure)
2597 goto exit_rest_of_compilation;
2598
4291d9c8
RS
2599 reload_completed = 1;
2600
bdac5f58
TW
2601 /* On some machines, the prologue and epilogue code, or parts thereof,
2602 can be represented as RTL. Doing so lets us schedule insns between
2603 it and the rest of the code and also allows delayed branch
2604 scheduling to operate in the epilogue. */
2605
2606 thread_prologue_and_epilogue_insns (insns);
2607
4291d9c8
RS
2608 if (optimize > 0 && flag_schedule_insns_after_reload)
2609 {
2610 if (sched2_dump)
2611 TIMEVAR (dump_time,
2612 {
2613 fprintf (sched2_dump_file, "\n;; Function %s\n\n",
2614 IDENTIFIER_POINTER (DECL_NAME (decl)));
2615 });
2616
2617 /* Do control and data sched analysis again,
2618 and write some more of the results to dump file. */
2619
2620 TIMEVAR (sched2_time, schedule_insns (sched2_dump_file));
2621
2622 /* Dump rtl after post-reorder instruction scheduling. */
2623
2624 if (sched2_dump)
2625 TIMEVAR (dump_time,
2626 {
2627 print_rtl (sched2_dump_file, insns);
2628 fflush (sched2_dump_file);
2629 });
2630 }
2631
2632#ifdef LEAF_REGISTERS
2633 leaf_function = 0;
2634 if (optimize > 0 && only_leaf_regs_used () && leaf_function_p ())
ab40ad2b 2635 leaf_function = 1;
4291d9c8
RS
2636#endif
2637
2638 /* One more attempt to remove jumps to .+1
2639 left by dead-store-elimination.
2640 Also do cross-jumping this time
2641 and delete no-op move insns. */
2642
2643 if (optimize > 0)
2644 {
2645 TIMEVAR (jump_time, jump_optimize (insns, 1, 1, 0));
2646 }
2647
2648 /* Dump rtl code after jump, if we are doing that. */
2649
2650 if (jump2_opt_dump)
2651 TIMEVAR (dump_time,
2652 {
2653 fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n",
2654 IDENTIFIER_POINTER (DECL_NAME (decl)));
2655 print_rtl (jump2_opt_dump_file, insns);
2656 fflush (jump2_opt_dump_file);
2657 });
2658
2659 /* If a scheduling pass for delayed branches is to be done,
2660 call the scheduling code. */
2661
2662#ifdef DELAY_SLOTS
2663 if (optimize > 0 && flag_delayed_branch)
2664 {
2665 TIMEVAR (dbr_sched_time, dbr_schedule (insns, dbr_sched_dump_file));
2666 if (dbr_sched_dump)
2667 {
2668 TIMEVAR (dump_time,
2669 {
2670 fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n",
2671 IDENTIFIER_POINTER (DECL_NAME (decl)));
2672 print_rtl (dbr_sched_dump_file, insns);
2673 fflush (dbr_sched_dump_file);
2674 });
2675 }
2676 }
2677#endif
2678
2679 if (optimize > 0)
2680 /* Shorten branches. */
2681 TIMEVAR (shorten_branch_time,
2682 {
2683 shorten_branches (get_insns ());
2684 });
2685
2686#ifdef STACK_REGS
2687 TIMEVAR (stack_reg_time, reg_to_stack (insns, stack_reg_dump_file));
2688 if (stack_reg_dump)
2689 {
2690 TIMEVAR (dump_time,
2691 {
2692 fprintf (stack_reg_dump_file, "\n;; Function %s\n\n",
2693 IDENTIFIER_POINTER (DECL_NAME (decl)));
2694 print_rtl (stack_reg_dump_file, insns);
2695 fflush (stack_reg_dump_file);
2696 });
2697 }
2698#endif
2699
2700 /* Now turn the rtl into assembler code. */
2701
2702 TIMEVAR (final_time,
2703 {
2704 rtx x;
2705 char *fnname;
2706
2707 /* Get the function's name, as described by its RTL.
2708 This may be different from the DECL_NAME name used
2709 in the source file. */
2710
2711 x = DECL_RTL (decl);
2712 if (GET_CODE (x) != MEM)
2713 abort ();
2714 x = XEXP (x, 0);
2715 if (GET_CODE (x) != SYMBOL_REF)
2716 abort ();
2717 fnname = XSTR (x, 0);
2718
2719 assemble_start_function (decl, fnname);
2720 final_start_function (insns, asm_out_file, optimize);
2721 final (insns, asm_out_file, optimize, 0);
2722 final_end_function (insns, asm_out_file, optimize);
2723 assemble_end_function (decl, fnname);
2724 fflush (asm_out_file);
2725 });
2726
2727 /* Write DBX symbols if requested */
2728
2729 /* Note that for those inline functions where we don't initially
2730 know for certain that we will be generating an out-of-line copy,
2731 the first invocation of this routine (rest_of_compilation) will
2732 skip over this code by doing a `goto exit_rest_of_compilation;'.
2733 Later on, finish_compilation will call rest_of_compilation again
2734 for those inline functions that need to have out-of-line copies
2735 generated. During that call, we *will* be routed past here. */
2736
2737#ifdef DBX_DEBUGGING_INFO
2738 if (write_symbols == DBX_DEBUG)
2739 TIMEVAR (symout_time, dbxout_function (decl));
2740#endif
2741
2742#ifdef DWARF_DEBUGGING_INFO
2743 if (write_symbols == DWARF_DEBUG)
2744 TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
2745#endif
2746
2747 exit_rest_of_compilation:
2748
f246a305
RS
2749 /* In case the function was not output,
2750 don't leave any temporary anonymous types
2751 queued up for sdb output. */
2752#ifdef SDB_DEBUGGING_INFO
2753 if (write_symbols == SDB_DEBUG)
37366632 2754 sdbout_types (NULL_TREE);
f246a305
RS
2755#endif
2756
8a958768
RS
2757 /* Put back the tree of subblocks and list of arguments
2758 from before we copied them.
4291d9c8
RS
2759 Code generation and the output of debugging info may have modified
2760 the copy, but the original is unchanged. */
2761
2762 if (saved_block_tree != 0)
2763 DECL_INITIAL (decl) = saved_block_tree;
8a958768
RS
2764 if (saved_arguments != 0)
2765 DECL_ARGUMENTS (decl) = saved_arguments;
4291d9c8
RS
2766
2767 reload_completed = 0;
2768
2769 /* Clear out the real_constant_chain before some of the rtx's
2770 it runs through become garbage. */
2771
2772 clear_const_double_mem ();
2773
2774 /* Cancel the effect of rtl_in_current_obstack. */
2775
2776 resume_temporary_allocation ();
2777
2778 /* The parsing time is all the time spent in yyparse
2779 *except* what is spent in this function. */
2780
2781 parse_time -= get_run_time () - start_time;
2782}
2783\f
2784/* Entry point of cc1/c++. Decode command args, then call compile_file.
2785 Exit code is 35 if can't open files, 34 if fatal error,
2786 33 if had nonfatal errors, else success. */
2787
2788int
2789main (argc, argv, envp)
2790 int argc;
2791 char **argv;
2792 char **envp;
2793{
2794 register int i;
2795 char *filename = 0;
2796 int flag_print_mem = 0;
2797 int version_flag = 0;
2798 char *p;
2799
2800 /* save in case md file wants to emit args as a comment. */
2801 save_argc = argc;
2802 save_argv = argv;
2803
2804 p = argv[0] + strlen (argv[0]);
2805 while (p != argv[0] && p[-1] != '/') --p;
2806 progname = p;
2807
2808#ifdef RLIMIT_STACK
2809 /* Get rid of any avoidable limit on stack size. */
2810 {
2811 struct rlimit rlim;
2812
2813 /* Set the stack limit huge so that alloca does not fail. */
2814 getrlimit (RLIMIT_STACK, &rlim);
2815 rlim.rlim_cur = rlim.rlim_max;
2816 setrlimit (RLIMIT_STACK, &rlim);
2817 }
2818#endif /* RLIMIT_STACK */
2819
2820 signal (SIGFPE, float_signal);
2821
2822 signal (SIGPIPE, pipe_closed);
2823
2824 decl_printable_name = decl_name;
2825 lang_expand_expr = (struct rtx_def *(*)()) do_abort;
2826
2827 /* Initialize whether `char' is signed. */
2828 flag_signed_char = DEFAULT_SIGNED_CHAR;
2829#ifdef DEFAULT_SHORT_ENUMS
2830 /* Initialize how much space enums occupy, by default. */
2831 flag_short_enums = DEFAULT_SHORT_ENUMS;
2832#endif
2833
2834 /* Scan to see what optimization level has been specified. That will
2835 determine the default value of many flags. */
2836 for (i = 1; i < argc; i++)
2837 {
2838 if (!strcmp (argv[i], "-O"))
2839 {
2840 optimize = 1;
2841 }
2842 else if (argv[i][0] == '-' && argv[i][1] == 'O')
2843 {
2844 /* Handle -O2, -O3, -O69, ... */
2845 char *p = &argv[i][2];
2846 int c;
2847
2848 while (c = *p++)
2849 if (! (c >= '0' && c <= '9'))
2850 break;
2851 if (c == 0)
2852 optimize = atoi (&argv[i][2]);
2853 }
2854 }
2855
2856 obey_regdecls = (optimize == 0);
f246a305
RS
2857 if (optimize == 0)
2858 {
2859 flag_no_inline = 1;
2860 warn_inline = 0;
2861 }
4291d9c8
RS
2862
2863 if (optimize >= 1)
2864 {
2865 flag_thread_jumps = 1;
2866#ifdef DELAY_SLOTS
2867 flag_delayed_branch = 1;
2868#endif
2869 }
2870
2871 if (optimize >= 2)
2872 {
2873 flag_cse_follow_jumps = 1;
8b3686ed 2874 flag_cse_skip_blocks = 1;
4291d9c8
RS
2875 flag_expensive_optimizations = 1;
2876 flag_strength_reduce = 1;
2877 flag_rerun_cse_after_loop = 1;
ac266247 2878 flag_caller_saves = 1;
4291d9c8
RS
2879#ifdef INSN_SCHEDULING
2880 flag_schedule_insns = 1;
2881 flag_schedule_insns_after_reload = 1;
2882#endif
2883 }
2884
2885#ifdef OPTIMIZATION_OPTIONS
2886 /* Allow default optimizations to be specified on a per-machine basis. */
2887 OPTIMIZATION_OPTIONS (optimize);
2888#endif
2889
2890 /* Initialize register usage now so switches may override. */
2891 init_reg_sets ();
2892
2893 target_flags = 0;
2894 set_target_switch ("");
2895
2896 for (i = 1; i < argc; i++)
2897 {
b99933c7
RS
2898 int j;
2899 /* If this is a language-specific option,
2900 decode it in a language-specific way. */
2901 for (j = 0; lang_options[j] != 0; j++)
2902 if (!strncmp (argv[i], lang_options[j],
2903 strlen (lang_options[j])))
2904 break;
2905 if (lang_options[j] != 0)
2906 /* If the option is valid for *some* language,
2907 treat it as valid even if this language doesn't understand it. */
2908 lang_decode_option (argv[i]);
2909 else if (argv[i][0] == '-' && argv[i][1] != 0)
4291d9c8
RS
2910 {
2911 register char *str = argv[i] + 1;
2912 if (str[0] == 'Y')
2913 str++;
2914
2915 if (str[0] == 'm')
2916 set_target_switch (&str[1]);
2917 else if (!strcmp (str, "dumpbase"))
2918 {
2919 dump_base_name = argv[++i];
2920 }
2921 else if (str[0] == 'd')
2922 {
2923 register char *p = &str[1];
2924 while (*p)
2925 switch (*p++)
2926 {
2927 case 'a':
2928 combine_dump = 1;
2929 dbr_sched_dump = 1;
2930 flow_dump = 1;
2931 global_reg_dump = 1;
2932 jump_opt_dump = 1;
2933 jump2_opt_dump = 1;
2934 local_reg_dump = 1;
2935 loop_dump = 1;
2936 rtl_dump = 1;
2937 cse_dump = 1, cse2_dump = 1;
2938 sched_dump = 1;
2939 sched2_dump = 1;
2940 stack_reg_dump = 1;
2941 break;
2942 case 'k':
2943 stack_reg_dump = 1;
2944 break;
2945 case 'c':
2946 combine_dump = 1;
2947 break;
2948 case 'd':
2949 dbr_sched_dump = 1;
2950 break;
2951 case 'f':
2952 flow_dump = 1;
2953 break;
2954 case 'g':
2955 global_reg_dump = 1;
2956 break;
2957 case 'j':
2958 jump_opt_dump = 1;
2959 break;
2960 case 'J':
2961 jump2_opt_dump = 1;
2962 break;
2963 case 'l':
2964 local_reg_dump = 1;
2965 break;
2966 case 'L':
2967 loop_dump = 1;
2968 break;
2969 case 'm':
2970 flag_print_mem = 1;
2971 break;
2972 case 'p':
2973 flag_print_asm_name = 1;
2974 break;
2975 case 'r':
2976 rtl_dump = 1;
2977 break;
2978 case 's':
2979 cse_dump = 1;
2980 break;
2981 case 't':
2982 cse2_dump = 1;
2983 break;
2984 case 'S':
2985 sched_dump = 1;
2986 break;
2987 case 'R':
2988 sched2_dump = 1;
2989 break;
2990 case 'y':
2991 set_yydebug (1);
2992 break;
2993
2994 case 'x':
2995 rtl_dump_and_exit = 1;
2996 break;
2997 }
2998 }
2999 else if (str[0] == 'f')
3000 {
4291d9c8
RS
3001 register char *p = &str[1];
3002 int found = 0;
3003
3004 /* Some kind of -f option.
3005 P's value is the option sans `-f'.
3006 Search for it in the table of options. */
3007
3008 for (j = 0;
3009 !found && j < sizeof (f_options) / sizeof (f_options[0]);
3010 j++)
3011 {
3012 if (!strcmp (p, f_options[j].string))
3013 {
3014 *f_options[j].variable = f_options[j].on_value;
3015 /* A goto here would be cleaner,
3016 but breaks the vax pcc. */
3017 found = 1;
3018 }
3019 if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
3020 && ! strcmp (p+3, f_options[j].string))
3021 {
3022 *f_options[j].variable = ! f_options[j].on_value;
3023 found = 1;
3024 }
3025 }
3026
3027 if (found)
3028 ;
3029 else if (!strncmp (p, "fixed-", 6))
3030 fix_register (&p[6], 1, 1);
3031 else if (!strncmp (p, "call-used-", 10))
3032 fix_register (&p[10], 0, 1);
3033 else if (!strncmp (p, "call-saved-", 11))
3034 fix_register (&p[11], 0, 0);
b99933c7 3035 else
4291d9c8
RS
3036 error ("Invalid option `%s'", argv[i]);
3037 }
3038 else if (str[0] == 'O')
3039 {
3040 register char *p = str+1;
3041 while (*p && *p >= '0' && *p <= '9')
3042 p++;
3043 if (*p == '\0')
3044 ;
3045 else
3046 error ("Invalid option `%s'", argv[i]);
3047 }
3048 else if (!strcmp (str, "pedantic"))
3049 pedantic = 1;
3050 else if (!strcmp (str, "pedantic-errors"))
3051 flag_pedantic_errors = pedantic = 1;
4291d9c8
RS
3052 else if (!strcmp (str, "quiet"))
3053 quiet_flag = 1;
3054 else if (!strcmp (str, "version"))
3055 version_flag = 1;
3056 else if (!strcmp (str, "w"))
3057 inhibit_warnings = 1;
3058 else if (!strcmp (str, "W"))
3059 {
3060 extra_warnings = 1;
3061 warn_uninitialized = 1;
3062 }
3063 else if (str[0] == 'W')
3064 {
4291d9c8
RS
3065 register char *p = &str[1];
3066 int found = 0;
3067
3068 /* Some kind of -W option.
3069 P's value is the option sans `-W'.
3070 Search for it in the table of options. */
3071
3072 for (j = 0;
3073 !found && j < sizeof (W_options) / sizeof (W_options[0]);
3074 j++)
3075 {
3076 if (!strcmp (p, W_options[j].string))
3077 {
3078 *W_options[j].variable = W_options[j].on_value;
3079 /* A goto here would be cleaner,
3080 but breaks the vax pcc. */
3081 found = 1;
3082 }
3083 if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
3084 && ! strcmp (p+3, W_options[j].string))
3085 {
3086 *W_options[j].variable = ! W_options[j].on_value;
3087 found = 1;
3088 }
3089 }
3090
3091 if (found)
3092 ;
3093 else if (!strncmp (p, "id-clash-", 9))
3094 {
3095 char *endp = p + 9;
3096
3097 while (*endp)
3098 {
3099 if (*endp >= '0' && *endp <= '9')
3100 endp++;
3101 else
7085b873
RS
3102 {
3103 error ("Invalid option `%s'", argv[i]);
3104 goto id_clash_lose;
3105 }
4291d9c8
RS
3106 }
3107 warn_id_clash = 1;
3108 id_clash_len = atoi (str + 10);
7085b873 3109 id_clash_lose: ;
4291d9c8
RS
3110 }
3111 else
3112 error ("Invalid option `%s'", argv[i]);
3113 }
3114 else if (!strcmp (str, "p"))
3115 profile_flag = 1;
3116 else if (!strcmp (str, "a"))
3117 {
3118#if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
3119 warning ("`-a' option (basic block profile) not supported");
3120#else
3121 profile_block_flag = 1;
3122#endif
3123 }
3124 else if (str[0] == 'g')
3125 {
3126 char *p = str + 1;
3127 char *q;
3128 unsigned len;
3129 unsigned level;
3130
3131 while (*p && (*p < '0' || *p > '9'))
3132 p++;
3133 len = p - str;
3134 q = p;
3135 while (*q && (*q >= '0' && *q <= '9'))
3136 q++;
3137 if (*p)
3138 level = atoi (p);
3139 else
3140 level = 2; /* default debugging info level */
3141 if (*q || level > 3)
3142 {
3143 warning ("invalid debug level specification in option: `-%s'",
3144 str);
3145 warning ("no debugging information will be generated");
3146 level = 0;
3147 }
3148
3149 /* If more than one debugging type is supported,
3150 you must define PREFERRED_DEBUGGING_TYPE
3151 to choose a format in a system-dependent way. */
4d7e336b
RS
3152 /* This is one long line cause VAXC can't handle a \-newline. */
3153#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
4291d9c8
RS
3154#ifdef PREFERRED_DEBUGGING_TYPE
3155 if (!strncmp (str, "ggdb", len))
3156 write_symbols = PREFERRED_DEBUGGING_TYPE;
3157#else /* no PREFERRED_DEBUGGING_TYPE */
3158You Lose! You must define PREFERRED_DEBUGGING_TYPE!
3159#endif /* no PREFERRED_DEBUGGING_TYPE */
3160#endif /* More than one debugger format enabled. */
3161#ifdef DBX_DEBUGGING_INFO
3162 if (write_symbols != NO_DEBUG)
3163 ;
3164 else if (!strncmp (str, "ggdb", len))
3165 write_symbols = DBX_DEBUG;
3166 else if (!strncmp (str, "gstabs", len))
3167 write_symbols = DBX_DEBUG;
efa89fb3
RS
3168 else if (!strncmp (str, "gstabs+", len))
3169 write_symbols = DBX_DEBUG;
4291d9c8
RS
3170
3171 /* Always enable extensions for -ggdb or -gstabs+,
3172 always disable for -gstabs.
3173 For plain -g, use system-specific default. */
3174 if (write_symbols == DBX_DEBUG && !strncmp (str, "ggdb", len)
3175 && len >= 2)
a53d0bcc 3176 use_gnu_debug_info_extensions = 1;
166792f0
RS
3177 else if (write_symbols == DBX_DEBUG && !strncmp (str, "gstabs+", len)
3178 && len >= 7)
a53d0bcc 3179 use_gnu_debug_info_extensions = 1;
4291d9c8
RS
3180 else if (write_symbols == DBX_DEBUG
3181 && !strncmp (str, "gstabs", len) && len >= 2)
a53d0bcc 3182 use_gnu_debug_info_extensions = 0;
4291d9c8 3183 else
a53d0bcc 3184 use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
4291d9c8
RS
3185#endif /* DBX_DEBUGGING_INFO */
3186#ifdef DWARF_DEBUGGING_INFO
3187 if (write_symbols != NO_DEBUG)
3188 ;
a53d0bcc
RS
3189 else if (!strncmp (str, "g", len))
3190 write_symbols = DWARF_DEBUG;
4291d9c8
RS
3191 else if (!strncmp (str, "ggdb", len))
3192 write_symbols = DWARF_DEBUG;
4291d9c8
RS
3193 else if (!strncmp (str, "gdwarf", len))
3194 write_symbols = DWARF_DEBUG;
a53d0bcc
RS
3195
3196 /* Always enable extensions for -ggdb or -gdwarf+,
3197 always disable for -gdwarf.
3198 For plain -g, use system-specific default. */
3199 if (write_symbols == DWARF_DEBUG && !strncmp (str, "ggdb", len)
3200 && len >= 2)
3201 use_gnu_debug_info_extensions = 1;
3202 else if (write_symbols == DWARF_DEBUG && !strcmp (str, "gdwarf+"))
3203 use_gnu_debug_info_extensions = 1;
3204 else if (write_symbols == DWARF_DEBUG
3205 && !strncmp (str, "gdwarf", len) && len >= 2)
3206 use_gnu_debug_info_extensions = 0;
3207 else
3208 use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
4291d9c8
RS
3209#endif
3210#ifdef SDB_DEBUGGING_INFO
3211 if (write_symbols != NO_DEBUG)
3212 ;
a53d0bcc
RS
3213 else if (!strncmp (str, "g", len))
3214 write_symbols = SDB_DEBUG;
3215 else if (!strncmp (str, "gdb", len))
4291d9c8
RS
3216 write_symbols = SDB_DEBUG;
3217 else if (!strncmp (str, "gcoff", len))
3218 write_symbols = SDB_DEBUG;
3219#endif /* SDB_DEBUGGING_INFO */
f246a305
RS
3220#ifdef XCOFF_DEBUGGING_INFO
3221 if (write_symbols != NO_DEBUG)
3222 ;
a53d0bcc
RS
3223 else if (!strncmp (str, "g", len))
3224 write_symbols = XCOFF_DEBUG;
f246a305
RS
3225 else if (!strncmp (str, "ggdb", len))
3226 write_symbols = XCOFF_DEBUG;
3227 else if (!strncmp (str, "gxcoff", len))
3228 write_symbols = XCOFF_DEBUG;
3229
a53d0bcc 3230 /* Always enable extensions for -ggdb or -gxcoff+,
f246a305
RS
3231 always disable for -gxcoff.
3232 For plain -g, use system-specific default. */
3233 if (write_symbols == XCOFF_DEBUG && !strncmp (str, "ggdb", len)
3234 && len >= 2)
a53d0bcc
RS
3235 use_gnu_debug_info_extensions = 1;
3236 else if (write_symbols == XCOFF_DEBUG && !strcmp (str, "gxcoff+"))
3237 use_gnu_debug_info_extensions = 1;
a56addeb 3238 else if (write_symbols == XCOFF_DEBUG
f246a305 3239 && !strncmp (str, "gxcoff", len) && len >= 2)
a53d0bcc 3240 use_gnu_debug_info_extensions = 0;
f246a305 3241 else
a53d0bcc 3242 use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
f246a305 3243#endif
4291d9c8
RS
3244 if (write_symbols == NO_DEBUG)
3245 warning ("`-%s' option not supported on this version of GCC", str);
3246 else if (level == 0)
3247 write_symbols = NO_DEBUG;
3248 else
d68c507d 3249 debug_info_level = (enum debug_info_level) level;
4291d9c8
RS
3250 }
3251 else if (!strcmp (str, "o"))
3252 {
3253 asm_file_name = argv[++i];
3254 }
3255 else if (str[0] == 'G')
3256 {
3257 g_switch_set = TRUE;
3258 g_switch_value = atoi ((str[1] != '\0') ? str+1 : argv[++i]);
3259 }
f246a305
RS
3260 else if (!strncmp (str, "aux-info", 8))
3261 {
3262 flag_gen_aux_info = 1;
3263 aux_info_file_name = (str[8] != '\0' ? str+8 : argv[++i]);
3264 }
4291d9c8
RS
3265 else
3266 error ("Invalid option `%s'", argv[i]);
3267 }
3268 else if (argv[i][0] == '+')
b99933c7 3269 error ("Invalid option `%s'", argv[i]);
4291d9c8
RS
3270 else
3271 filename = argv[i];
3272 }
3273
f246a305
RS
3274 if (optimize == 0)
3275 {
a2468e45
BK
3276 /* Inlining does not work if not optimizing,
3277 so force it not to be done. */
f246a305
RS
3278 flag_no_inline = 1;
3279 warn_inline = 0;
a2468e45
BK
3280
3281 /* The c_decode_option and lang_decode_option functions set
3282 this to `2' if -Wall is used, so we can avoid giving out
3283 lots of errors for people who don't realize what -Wall does. */
3284 if (warn_uninitialized == 1)
3285 warning ("-Wuninitialized is not supported without -O");
f246a305
RS
3286 }
3287
4291d9c8
RS
3288#ifdef OVERRIDE_OPTIONS
3289 /* Some machines may reject certain combinations of options. */
3290 OVERRIDE_OPTIONS;
3291#endif
3292
3293 /* Unrolling all loops implies that standard loop unrolling must also
3294 be done. */
3295 if (flag_unroll_all_loops)
3296 flag_unroll_loops = 1;
3297 /* Loop unrolling requires that strength_reduction be on also. Silently
3298 turn on strength reduction here if it isn't already on. Also, the loop
3299 unrolling code assumes that cse will be run after loop, so that must
3300 be turned on also. */
3301 if (flag_unroll_loops)
3302 {
3303 flag_strength_reduce = 1;
3304 flag_rerun_cse_after_loop = 1;
3305 }
3306
3307 /* Warn about options that are not supported on this machine. */
3308#ifndef INSN_SCHEDULING
3309 if (flag_schedule_insns || flag_schedule_insns_after_reload)
3310 warning ("instruction scheduling not supported on this target machine");
3311#endif
3312#ifndef DELAY_SLOTS
3313 if (flag_delayed_branch)
3314 warning ("this target machine does not have delayed branches");
3315#endif
3316
3317 /* If we are in verbose mode, write out the version and maybe all the
3318 option flags in use. */
3319 if (version_flag)
3320 {
3321 fprintf (stderr, "%s version %s", language_string, version_string);
3322#ifdef TARGET_VERSION
3323 TARGET_VERSION;
3324#endif
3325#ifdef __GNUC__
3326#ifndef __VERSION__
3327#define __VERSION__ "[unknown]"
3328#endif
3329 fprintf (stderr, " compiled by GNU C version %s.\n", __VERSION__);
3330#else
3331 fprintf (stderr, " compiled by CC.\n");
3332#endif
3333 if (! quiet_flag)
3334 print_switch_values ();
3335 }
3336
3337 /* Now that register usage is specified, convert it to HARD_REG_SETs. */
3338 init_reg_sets_1 ();
3339
3340 compile_file (filename);
3341
a56addeb 3342#ifndef OS2
4291d9c8
RS
3343#ifndef VMS
3344 if (flag_print_mem)
3345 {
3346 char *lim = (char *) sbrk (0);
3347
3348 fprintf (stderr, "Data size %d.\n",
b61b1c91 3349 lim - (char *) &environ);
4291d9c8
RS
3350 fflush (stderr);
3351
3352#ifdef USG
3353 system ("ps -l 1>&2");
3354#else /* not USG */
3355 system ("ps v");
3356#endif /* not USG */
3357 }
3358#endif /* not VMS */
a56addeb 3359#endif /* not OS2 */
4291d9c8
RS
3360
3361 if (errorcount)
3362 exit (FATAL_EXIT_CODE);
3363 if (sorrycount)
3364 exit (FATAL_EXIT_CODE);
3365 exit (SUCCESS_EXIT_CODE);
3366 return 34;
3367}
3368\f
3369/* Decode -m switches. */
3370
3371/* Here is a table, controlled by the tm.h file, listing each -m switch
3372 and which bits in `target_switches' it should set or clear.
3373 If VALUE is positive, it is bits to set.
3374 If VALUE is negative, -VALUE is bits to clear.
3375 (The sign bit is not used so there is no confusion.) */
3376
3377struct {char *name; int value;} target_switches []
3378 = TARGET_SWITCHES;
3379
3380/* This table is similar, but allows the switch to have a value. */
3381
3382#ifdef TARGET_OPTIONS
3383struct {char *prefix; char ** variable;} target_options []
3384 = TARGET_OPTIONS;
3385#endif
3386
3387/* Decode the switch -mNAME. */
3388
3389void
3390set_target_switch (name)
3391 char *name;
3392{
3393 register int j;
3394 int valid = 0;
3395
3396 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
3397 if (!strcmp (target_switches[j].name, name))
3398 {
3399 if (target_switches[j].value < 0)
3400 target_flags &= ~-target_switches[j].value;
3401 else
3402 target_flags |= target_switches[j].value;
3403 valid = 1;
3404 }
3405
3406#ifdef TARGET_OPTIONS
3407 if (!valid)
3408 for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
3409 {
3410 int len = strlen (target_options[j].prefix);
3411 if (!strncmp (target_options[j].prefix, name, len))
3412 {
3413 *target_options[j].variable = name + len;
3414 valid = 1;
3415 }
3416 }
3417#endif
3418
3419 if (!valid)
3420 error ("Invalid option `%s'", name);
3421}
3422\f
3423/* Variable used for communication between the following two routines. */
3424
3425static int line_position;
3426
3427/* Print an option value and adjust the position in the line. */
3428
3429static void
3430print_single_switch (type, name)
3431 char *type, *name;
3432{
3433 fprintf (stderr, " %s%s", type, name);
3434
3435 line_position += strlen (type) + strlen (name) + 1;
3436
3437 if (line_position > 65)
3438 {
3439 fprintf (stderr, "\n\t");
3440 line_position = 8;
3441 }
3442}
3443
3444/* Print default target switches for -version. */
3445
3446static void
3447print_switch_values ()
3448{
3449 register int j;
3450
3451 fprintf (stderr, "enabled:");
3452 line_position = 8;
3453
3454 for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
3455 if (*f_options[j].variable == f_options[j].on_value)
3456 print_single_switch ("-f", f_options[j].string);
3457
3458 for (j = 0; j < sizeof W_options / sizeof W_options[0]; j++)
3459 if (*W_options[j].variable == W_options[j].on_value)
3460 print_single_switch ("-W", W_options[j].string);
3461
3462 for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
3463 if (target_switches[j].name[0] != '\0'
3464 && target_switches[j].value > 0
3465 && ((target_switches[j].value & target_flags)
3466 == target_switches[j].value))
3467 print_single_switch ("-m", target_switches[j].name);
3468
3469 fprintf (stderr, "\n");
3470}
This page took 0.47818 seconds and 5 git commands to generate.