home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / gcc-2.6.0-src.lha / GNU / src / amiga / gcc-2.6.0 / toplev.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-29  |  103.0 KB  |  4,070 lines

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