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