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