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