home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / toplev.c < prev    next >
C/C++ Source or Header  |  1997-01-20  |  116KB  |  4,518 lines

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