Annotation of gcc/toplev.c, revision 1.1.1.15

1.1       root        1: /* Top level of GNU C compiler
1.1.1.14  root        2:    Copyright (C) 1987, 1988, 1989 Free Software Foundation, Inc.
1.1       root        3: 
                      4: This file is part of GNU CC.
                      5: 
1.1.1.14  root        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 1, or (at your option)
                      9: any later version.
                     10: 
1.1       root       11: GNU CC is distributed in the hope that it will be useful,
1.1.1.14  root       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.  */
1.1       root       19: 
                     20: 
                     21: /* This is the top level of cc1.
                     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: #include <stdio.h>
                     28: #include <signal.h>
1.1.1.10  root       29: #include <setjmp.h>
1.1.1.2   root       30: 
1.1.1.4   root       31: #include <sys/types.h>
                     32: #include <sys/stat.h>
                     33: 
1.1.1.2   root       34: #ifdef USG
                     35: #include <sys/param.h>
                     36: #include <sys/times.h>
                     37: #include <time.h>   /* Correct for hpux at least.  Is it good on other USG?  */
                     38: #else
                     39: #ifndef VMS
1.1       root       40: #include <sys/time.h>
                     41: #include <sys/resource.h>
1.1.1.2   root       42: #endif
                     43: #endif
                     44: 
1.1       root       45: #include "tree.h"
                     46: #include "c-tree.h"
                     47: #include "rtl.h"
1.1.1.2   root       48: #include "flags.h"
1.1       root       49: 
                     50: extern int yydebug;
                     51: 
                     52: extern FILE *finput;
                     53: 
1.1.1.11  root       54: extern int reload_completed;
1.1.1.12  root       55: extern int rtx_equal_function_value_matters;
1.1.1.11  root       56: 
1.1       root       57: extern void init_lex ();
                     58: extern void init_decl_processing ();
                     59: extern void init_tree ();
                     60: extern void init_rtl ();
                     61: extern void init_optabs ();
1.1.1.2   root       62: extern void init_reg_sets ();
1.1       root       63: extern void dump_flow_info ();
                     64: extern void dump_local_alloc ();
                     65: 
1.1.1.2   root       66: void rest_of_decl_compilation ();
                     67: void error ();
                     68: void error_with_file_and_line ();
                     69: void set_target_switch ();
                     70: 
1.1       root       71: /* Bit flags that specify the machine subtype we are compiling for.
                     72:    Bits are tested using macros TARGET_... defined in the tm-...h file
                     73:    and set by `-m...' switches.  */
                     74: 
                     75: int target_flags;
                     76: 
1.1.1.2   root       77: /* Name of current original source file (what was input to cpp).
                     78:    This comes from each #-command in the actual input.  */
1.1       root       79: 
1.1.1.2   root       80: char *input_filename;
                     81: 
                     82: /* Name of top-level original source file (what was input to cpp).
1.1.1.8   root       83:    This comes from the #-command at the beginning of the actual input.
                     84:    If there isn't any there, then this is the cc1 input file name.  */
1.1.1.2   root       85: 
                     86: char *main_input_filename;
1.1       root       87: 
                     88: /* Current line number in real source file.  */
                     89: 
                     90: extern int lineno;
                     91: 
                     92: /* FUNCTION_DECL for function now being parsed or compiled.  */
                     93: 
                     94: extern tree current_function_decl;
                     95: 
                     96: /* Name to use as base of names for dump output files.  */
                     97: 
                     98: char *dump_base_name;
                     99: 
                    100: /* Flags saying which kinds of debugging dump have been requested.  */
                    101: 
                    102: int rtl_dump = 0;
                    103: int rtl_dump_and_exit = 0;
                    104: int jump_opt_dump = 0;
                    105: int cse_dump = 0;
                    106: int loop_dump = 0;
                    107: int flow_dump = 0;
                    108: int combine_dump = 0;
                    109: int local_reg_dump = 0;
                    110: int global_reg_dump = 0;
1.1.1.2   root      111: int jump2_opt_dump = 0;
1.1       root      112: 
                    113: /* 1 => write gdb debugging output (using symout.c).  -g
1.1.1.6   root      114:    2 => write dbx debugging output (using dbxout.c).  -G
                    115:    3 => write sdb debugging output (using sdbout.c).  -g.  */
1.1       root      116: 
1.1.1.4   root      117: enum debugger write_symbols = NO_DEBUG;
1.1       root      118: 
1.1.1.6   root      119: /* Nonzero means can use our own extensions to DBX format.
                    120:    Relevant only with write_symbols == DBX_DEBUG.  */
                    121: 
                    122: int use_gdb_dbx_extensions;
                    123: 
1.1       root      124: /* Nonzero means do optimizations.  -opt.  */
                    125: 
                    126: int optimize = 0;
                    127: 
1.1.1.14  root      128: /* Nonzero for -fcaller-saves: allocate values in regs that need to
                    129:    be saved across function calls, if that produces overall better code.
                    130:    Optional now, so people can test it.  */
                    131: 
                    132: #ifdef DEFAULT_CALLER_SAVES
                    133: int flag_caller_saves = 1;
                    134: #else
                    135: int flag_caller_saves = 0;
                    136: #endif
                    137: 
                    138: /* Nonzero for -fpcc-struct-return: return values the same way PCC does.  */
                    139: 
                    140: int flag_pcc_struct_return = 0;
                    141: 
1.1.1.2   root      142: /* Nonzero for -fforce-mem: load memory value into a register
1.1       root      143:    before arithmetic on it.  This makes better cse but slower compilation.  */
                    144: 
1.1.1.2   root      145: int flag_force_mem = 0;
1.1       root      146: 
1.1.1.2   root      147: /* Nonzero for -fforce-addr: load memory address into a register before
1.1       root      148:    reference to memory.  This makes better cse but slower compilation.  */
                    149: 
1.1.1.2   root      150: int flag_force_addr = 0;
                    151: 
                    152: /* Nonzero for -fdefer-pop: don't pop args after each function call;
                    153:    instead save them up to pop many calls' args with one insns.  */
                    154: 
                    155: int flag_defer_pop = 1;
                    156: 
                    157: /* Nonzero for -ffloat-store: don't allocate floats and doubles
                    158:    in extended-precision registers.  */
                    159: 
                    160: int flag_float_store = 0;
                    161: 
                    162: /* Nonzero for -fcombine-regs:
                    163:    allow instruction combiner to combine an insn
                    164:    that just copies one reg to another.  */
                    165: 
                    166: int flag_combine_regs = 0;
                    167: 
1.1.1.9   root      168: /* Nonzero enables strength-reduction in loop.c.  */
                    169: 
                    170: int flag_strength_reduce = 0;
                    171: 
1.1.1.2   root      172: /* Nonzero for -fwritable-strings:
                    173:    store string constants in data segment and don't uniquize them.  */
                    174: 
                    175: int flag_writable_strings = 0;
                    176: 
                    177: /* Nonzero means don't put addresses of constant functions in registers.
                    178:    Used for compiling the Unix kernel, where strange substitutions are
                    179:    done on the assembly output.  */
                    180: 
                    181: int flag_no_function_cse = 0;
                    182: 
                    183: /* Nonzero for -fomit-frame-pointer:
                    184:    don't make a frame pointer in simple functions that don't require one.  */
                    185: 
                    186: int flag_omit_frame_pointer = 0;
                    187: 
                    188: /* Nonzero to inhibit use of define_optimization peephole opts.  */
                    189: 
                    190: int flag_no_peephole = 0;
                    191: 
                    192: /* Nonzero means all references through pointers are volatile.  */
                    193: 
                    194: int flag_volatile;
1.1       root      195: 
                    196: /* Nonzero means do stupid register allocation.  -noreg.
1.1.1.2   root      197:    This and `optimize' are controlled by different switches in cc1,
1.1       root      198:    but normally cc controls them both with the -O switch.  */
                    199: 
                    200: int obey_regdecls = 0;
                    201: 
                    202: /* Don't print functions as they are compiled and don't print
                    203:    times taken by the various passes.  -quiet.  */
                    204: 
                    205: int quiet_flag = 0;
                    206: 
                    207: /* Don't print warning messages.  -w.  */
                    208: 
                    209: int inhibit_warnings = 0;
                    210: 
1.1.1.2   root      211: /* Do print extra warnings (such as for uninitialized variables).  -W.  */
                    212: 
                    213: int extra_warnings = 0;
                    214: 
1.1.1.9   root      215: /* Nonzero to warn about unused local variables.  */
                    216: 
                    217: int warn_unused;
                    218: 
1.1.1.15! root      219: /* Nonzero means warn about all declarations which shadow others.   */
        !           220: 
        !           221: int warn_shadow;
        !           222: 
        !           223: /* Warn if a switch on an enum fails to have a case for every enum value.  */
        !           224: 
        !           225: int warn_switch;
        !           226: 
        !           227: /* Nonzero means warn about any identifiers that match in the first N
        !           228:    characters.  The value N is in `id_clash_len'.  */
        !           229: 
        !           230: int warn_id_clash;
        !           231: int id_clash_len;
        !           232: 
1.1       root      233: /* Number of error messages and warning messages so far.  */
                    234: 
                    235: int errorcount = 0;
                    236: int warningcount = 0;
1.1.1.7   root      237: int sorrycount = 0;
1.1       root      238: 
1.1.1.2   root      239: /* Nonzero if generating code to do profiling.  */
                    240: 
                    241: int profile_flag = 0;
                    242: 
1.1.1.14  root      243: /* Nonzero if generating code to do profiling on a line-by-line basis.  */
                    244: 
                    245: int profile_block_flag;
                    246: 
1.1       root      247: /* Nonzero for -pedantic switch: warn about anything
1.1.1.7   root      248:    that standard spec forbids.  */
1.1       root      249: 
                    250: int pedantic = 0;
                    251: 
1.1.1.2   root      252: /* Nonzero for -finline-functions: ok to inline functions that look like
                    253:    good inline candidates.  */
                    254: 
                    255: int flag_inline_functions;
                    256: 
                    257: /* Nonzero for -fkeep-inline-functions: even if we make a function
                    258:    go inline everywhere, keep its defintion around for debugging
                    259:    purposes.  */
                    260: 
                    261: int flag_keep_inline_functions;
                    262: 
1.1.1.12  root      263: /* Nonzero if we are only using compiler to check syntax errors.  */
                    264: 
                    265: int flag_syntax_only;
                    266: 
                    267: /* Nonzero means make the text shared if supported.  */
                    268: 
                    269: int flag_shared_data;
                    270: 
1.1       root      271: /* Name for output file of assembly code, specified with -o.  */
                    272: 
                    273: char *asm_file_name;
                    274: 
                    275: /* Name for output file of GDB symbol segment, specified with -symout.  */
                    276: 
                    277: char *sym_file_name;
                    278: 
1.1.1.12  root      279: /* Table of language-independent -f options.
                    280:    STRING is the option name.  VARIABLE is the address of the variable.
                    281:    ON_VALUE is the value to store in VARIABLE
                    282:     if `-fSTRING' is seen as an option.
                    283:    (If `-fno-STRING' is seen as an option, the opposite value is stored.)  */
                    284: 
                    285: struct { char *string; int *variable; int on_value;} f_options[] =
                    286: {
                    287:   {"float-store", &flag_float_store, 1},
                    288:   {"volatile", &flag_volatile, 1},
                    289:   {"defer-pop", &flag_defer_pop, 1},
                    290:   {"omit-frame-pointer", &flag_omit_frame_pointer, 1},
                    291:   {"strength-reduce", &flag_strength_reduce, 1},
                    292:   {"writable-strings", &flag_writable_strings, 1},
                    293:   {"peephole", &flag_no_peephole, 0},
                    294:   {"force-mem", &flag_force_mem, 1},
                    295:   {"force-addr", &flag_force_addr, 1},
                    296:   {"combine-regs", &flag_combine_regs, 1},
                    297:   {"function-cse", &flag_no_function_cse, 0},
                    298:   {"inline-functions", &flag_inline_functions, 1},
                    299:   {"keep-inline-functions", &flag_keep_inline_functions, 1},
                    300:   {"syntax-only", &flag_syntax_only, 1},
1.1.1.14  root      301:   {"shared-data", &flag_shared_data, 1},
                    302:   {"caller-saves", &flag_caller_saves, 1},
                    303:   {"pcc-struct-return", &flag_pcc_struct_return, 1}
1.1.1.12  root      304: };
                    305: 
1.1       root      306: /* Output files for assembler code (real compiler output)
                    307:    and debugging dumps.  */
                    308: 
                    309: FILE *asm_out_file;
                    310: FILE *rtl_dump_file;
                    311: FILE *jump_opt_dump_file;
                    312: FILE *cse_dump_file;
                    313: FILE *loop_dump_file;
                    314: FILE *flow_dump_file;
                    315: FILE *combine_dump_file;
                    316: FILE *local_reg_dump_file;
                    317: FILE *global_reg_dump_file;
1.1.1.2   root      318: FILE *jump2_opt_dump_file;
1.1       root      319: 
                    320: /* Time accumulators, to count the total time spent in various passes.  */
                    321: 
                    322: int parse_time;
                    323: int varconst_time;
1.1.1.2   root      324: int integration_time;
1.1       root      325: int jump_time;
                    326: int cse_time;
                    327: int loop_time;
                    328: int flow_time;
                    329: int combine_time;
                    330: int local_alloc_time;
                    331: int global_alloc_time;
                    332: int final_time;
                    333: int symout_time;
                    334: int dump_time;
                    335: 
                    336: /* Return time used so far, in microseconds.  */
                    337: 
1.1.1.2   root      338: int
1.1       root      339: gettime ()
                    340: {
1.1.1.2   root      341: #ifdef USG
                    342:   struct tms tms;
                    343: #else
                    344: #ifndef VMS
1.1       root      345:   struct rusage rusage;
1.1.1.2   root      346: #else /* VMS */
                    347:   struct
                    348:     {
                    349:       int proc_user_time;
                    350:       int proc_system_time;
                    351:       int child_user_time;
                    352:       int child_system_time;
                    353:     } vms_times;
                    354: #endif
                    355: #endif
                    356: 
1.1       root      357:   if (quiet_flag)
                    358:     return 0;
1.1.1.2   root      359: 
                    360: #ifdef USG
                    361:   times (&tms);
                    362:   return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
                    363: #else
                    364: #ifndef VMS
1.1       root      365:   getrusage (0, &rusage);
                    366:   return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
                    367:          + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
1.1.1.2   root      368: #else /* VMS */
                    369:   times (&vms_times);
                    370:   return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
                    371: #endif
                    372: #endif
1.1       root      373: }
                    374: 
                    375: #define TIMEVAR(VAR, BODY)    \
1.1.1.3   root      376: do { int otime = gettime (); BODY; VAR += gettime () - otime; } while (0)
1.1       root      377: 
1.1.1.2   root      378: void
1.1       root      379: print_time (str, total)
                    380:      char *str;
                    381:      int total;
                    382: {
1.1.1.2   root      383:   fprintf (stderr,
                    384:           "time in %s: %d.%06d\n",
                    385:           str, total / 1000000, total % 1000000);
1.1       root      386: }
                    387: 
                    388: /* Count an error or warning.  Return 1 if the message should be printed.  */
                    389: 
                    390: int
                    391: count_error (warningp)
                    392:      int warningp;
                    393: {
                    394:   if (warningp && inhibit_warnings)
                    395:     return 0;
                    396: 
                    397:   if (warningp)
                    398:     warningcount++;
                    399:   else
                    400:     errorcount++;
                    401: 
                    402:   return 1;
                    403: }
                    404: 
                    405: /* Print a fatal error message.  NAME is the text.
                    406:    Also include a system error message based on `errno'.  */
                    407: 
1.1.1.2   root      408: void
1.1       root      409: pfatal_with_name (name)
1.1.1.2   root      410:      char *name;
1.1       root      411: {
                    412:   fprintf (stderr, "cc1: ");
                    413:   perror (name);
                    414:   exit (35);
                    415: }
                    416: 
                    417: void
1.1.1.2   root      418: fatal_io_error (name)
                    419:      char *name;
                    420: {
                    421:   fprintf (stderr, "cc1:%s: I/O error\n", name);
                    422:   exit (35);
                    423: }
                    424: 
                    425: void
1.1.1.7   root      426: fatal (s, v)
1.1       root      427:      char *s;
                    428: {
1.1.1.7   root      429:   error (s, v);
1.1       root      430:   exit (34);
                    431: }
1.1.1.8   root      432: 
                    433: static int need_error_newline;
                    434: 
                    435: /* Function of last error message;
                    436:    more generally, function such that if next error message is in it
                    437:    then we don't have to mention the function name.  */
                    438: static tree last_error_function = NULL;
1.1       root      439: 
                    440: /* Called when the start of a function definition is parsed,
                    441:    this function prints on stderr the name of the function.  */
                    442: 
                    443: void
                    444: announce_function (decl)
                    445:      tree decl;
                    446: {
                    447:   if (! quiet_flag)
                    448:     {
                    449:       fprintf (stderr, " %s", IDENTIFIER_POINTER (DECL_NAME (decl)));
                    450:       fflush (stderr);
1.1.1.9   root      451:       need_error_newline = 1;
                    452:       last_error_function = current_function_decl;
1.1       root      453:     }
                    454: }
1.1.1.8   root      455: 
1.1.1.2   root      456: /* Prints out, if necessary, the name of the current function
                    457:    which caused an error.  Called from all error and warning functions.  */
                    458: 
1.1.1.9   root      459: static void
                    460: report_error_function (file)
                    461:      char *file;
1.1.1.2   root      462: {
1.1.1.8   root      463:   if (need_error_newline)
                    464:     {
                    465:       fprintf (stderr, "\n");
                    466:       need_error_newline = 0;
                    467:     }
1.1.1.2   root      468: 
                    469:   if (last_error_function != current_function_decl)
                    470:     {
1.1.1.9   root      471:       if (file)
                    472:        fprintf (stderr, "%s: ", file);
                    473: 
1.1.1.2   root      474:       if (current_function_decl == NULL)
1.1.1.8   root      475:        fprintf (stderr, "At top level:\n");
1.1.1.2   root      476:       else
1.1.1.8   root      477:        fprintf (stderr, "In function %s:\n",
                    478:                 IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
                    479: 
1.1.1.2   root      480:       last_error_function = current_function_decl;
                    481:     }
                    482: }
1.1       root      483: 
                    484: /* Report an error at the current line number.
                    485:    S and V are a string and an arg for `printf'.  */
                    486: 
                    487: void
1.1.1.7   root      488: error (s, v, v2)
1.1       root      489:      char *s;
                    490:      int v;                    /* @@also used as pointer */
1.1.1.7   root      491:      int v2;                   /* @@also used as pointer */
1.1       root      492: {
1.1.1.7   root      493:   error_with_file_and_line (input_filename, lineno, s, v, v2);
1.1       root      494: }
                    495: 
1.1.1.2   root      496: /* Report an error at line LINE of file FILE.
1.1       root      497:    S and V are a string and an arg for `printf'.  */
                    498: 
1.1.1.2   root      499: void
1.1.1.7   root      500: error_with_file_and_line (file, line, s, v, v2)
1.1.1.2   root      501:      char *file;
1.1       root      502:      int line;
                    503:      char *s;
                    504:      int v;
1.1.1.7   root      505:      int v2;
1.1       root      506: {
                    507:   count_error (0);
                    508: 
1.1.1.9   root      509:   report_error_function (file);
1.1.1.2   root      510: 
                    511:   if (file)
                    512:     fprintf (stderr, "%s:%d: ", file, line);
                    513:   else
                    514:     fprintf (stderr, "cc1: ");
1.1.1.7   root      515:   fprintf (stderr, s, v, v2);
1.1       root      516:   fprintf (stderr, "\n");
                    517: }
                    518: 
1.1.1.2   root      519: /* Report an error at the declaration DECL.
1.1.1.12  root      520:    S and V are a string and an arg which uses %s to substitute the declaration name.  */
1.1       root      521: 
                    522: void
1.1.1.12  root      523: error_with_decl (decl, s, v)
1.1.1.2   root      524:      tree decl;
1.1       root      525:      char *s;
1.1.1.12  root      526:      int v;
1.1       root      527: {
1.1.1.2   root      528:   count_error (0);
                    529: 
1.1.1.9   root      530:   report_error_function (DECL_SOURCE_FILE (decl));
1.1.1.2   root      531: 
                    532:   fprintf (stderr, "%s:%d: ",
                    533:           DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
                    534: 
                    535:   if (DECL_NAME (decl))
1.1.1.12  root      536:     fprintf (stderr, s, IDENTIFIER_POINTER (DECL_NAME (decl)), v);
1.1.1.2   root      537:   else
1.1.1.12  root      538:     fprintf (stderr, s, "((anonymous))", v);
1.1.1.2   root      539:   fprintf (stderr, "\n");
1.1       root      540: }
                    541: 
1.1.1.11  root      542: /* Report an error at the line number of the insn INSN.
                    543:    S and V are a string and an arg for `printf'.
                    544:    This is used only when INSN is an `asm' with operands,
1.1.1.15! root      545:    and each ASM_OPERANDS records its own source file and line.  */
1.1.1.11  root      546: 
                    547: void
                    548: error_for_asm (insn, s, v, v2)
                    549:      rtx insn;
                    550:      char *s;
                    551:      int v;                    /* @@also used as pointer */
                    552:      int v2;                   /* @@also used as pointer */
                    553: {
1.1.1.12  root      554:   rtx temp;
                    555:   char *filename;
                    556:   int line;
1.1.1.15! root      557:   rtx body = PATTERN (insn);
        !           558:   rtx asmop;
1.1.1.12  root      559: 
1.1.1.15! root      560:   /* Find the (or one of the) ASM_OPERANDS in the insn.  */
        !           561:   if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
        !           562:     asmop = SET_SRC (body);
        !           563:   else if (GET_CODE (body) == ASM_OPERANDS)
        !           564:     asmop = body;
        !           565:   else if (GET_CODE (body) == PARALLEL
        !           566:           && GET_CODE (XVECEXP (body, 0, 0)) == SET)
        !           567:     asmop = SET_SRC (XVECEXP (body, 0, 0));
        !           568:   else if (GET_CODE (body) == PARALLEL
        !           569:           && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
        !           570:     asmop = XVECEXP (body, 0, 0);
        !           571: 
        !           572:   filename = ASM_OPERANDS_SOURCE_FILE (asmop);
        !           573:   line = ASM_OPERANDS_SOURCE_LINE (asmop);
1.1.1.12  root      574:   
                    575:   error_with_file_and_line (filename, line, s, v, v2);
1.1.1.11  root      576: }
                    577: 
1.1       root      578: /* Report a warning at line LINE.
                    579:    S and V are a string and an arg for `printf'.  */
                    580: 
1.1.1.2   root      581: void
1.1.1.11  root      582: warning_with_file_and_line (file, line, s, v, v2)
                    583:      char *file;
1.1       root      584:      int line;
                    585:      char *s;
                    586:      int v;
1.1.1.7   root      587:      int v2;
1.1       root      588: {
                    589:   if (count_error (1) == 0)
                    590:     return;
                    591: 
1.1.1.11  root      592:   report_error_function (file);
1.1.1.2   root      593: 
1.1.1.11  root      594:   if (file)
                    595:     fprintf (stderr, "%s:%d: ", file, line);
1.1.1.2   root      596:   else
                    597:     fprintf (stderr, "cc1: ");
1.1       root      598: 
                    599:   fprintf (stderr, "warning: ");
1.1.1.7   root      600:   fprintf (stderr, s, v, v2);
1.1       root      601:   fprintf (stderr, "\n");
                    602: }
1.1.1.2   root      603: 
                    604: /* Report a warning at the current line number.
                    605:    S and V are a string and an arg for `printf'.  */
                    606: 
                    607: void
1.1.1.7   root      608: warning (s, v, v2)
1.1.1.2   root      609:      char *s;
                    610:      int v;                    /* @@also used as pointer */
1.1.1.7   root      611:      int v2;
1.1.1.2   root      612: {
1.1.1.11  root      613:   warning_with_file_and_line (input_filename, lineno, s, v, v2);
1.1.1.2   root      614: }
                    615: 
                    616: /* Report a warning at the declaration DECL.
                    617:    S is string which uses %s to substitute the declaration name.  */
                    618: 
                    619: void
1.1.1.12  root      620: warning_with_decl (decl, s, v)
1.1.1.2   root      621:      tree decl;
                    622:      char *s;
1.1.1.12  root      623:      int v;
1.1.1.2   root      624: {
                    625:   if (count_error (1) == 0)
                    626:     return;
                    627: 
1.1.1.9   root      628:   report_error_function (DECL_SOURCE_FILE (decl));
1.1.1.2   root      629: 
                    630:   fprintf (stderr, "%s:%d: ",
                    631:           DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
                    632: 
                    633:   fprintf (stderr, "warning: ");
                    634:   if (DECL_NAME (decl))
1.1.1.12  root      635:     fprintf (stderr, s, IDENTIFIER_POINTER (DECL_NAME (decl)), v);
1.1.1.2   root      636:   else
1.1.1.12  root      637:     fprintf (stderr, s, "((anonymous))", v);
1.1.1.2   root      638:   fprintf (stderr, "\n");
                    639: }
1.1.1.7   root      640: 
                    641: /* Apologize for not implementing some feature.
                    642:    S, V, and V2 are a string and args for `printf'.  */
                    643: 
                    644: void
                    645: sorry (s, v, v2)
                    646:      char *s;
                    647:      int v, v2;
                    648: {
                    649:   sorrycount++;
                    650:   if (input_filename)
                    651:     fprintf (stderr, "%s:%d: ", input_filename, lineno);
                    652:   else
                    653:     fprintf (stderr, "cc1: ");
                    654: 
                    655:   fprintf (stderr, "sorry, not implemented: ");
                    656:   fprintf (stderr, s, v, v2);
                    657:   fprintf (stderr, "\n");
                    658: }
                    659: 
                    660: /* Apologize for not implementing some feature, then quit.
                    661:    S, V, and V2 are a string and args for `printf'.  */
                    662: 
                    663: void
                    664: really_sorry (s, v, v2)
                    665:      char *s;
                    666:      int v, v2;
                    667: {
                    668:   if (input_filename)
                    669:     fprintf (stderr, "%s:%d: ", input_filename, lineno);
                    670:   else
                    671:     fprintf (stderr, "c++: ");
                    672: 
                    673:   fprintf (stderr, "sorry, not implemented: ");
                    674:   fprintf (stderr, s, v, v2);
                    675:   fatal (" (fatal)\n");
                    676: }
1.1       root      677: 
                    678: /* When `malloc.c' is compiled with `rcheck' defined,
                    679:    it calls this function to report clobberage.  */
                    680: 
1.1.1.2   root      681: void
1.1       root      682: botch (s)
                    683: {
                    684:   abort ();
                    685: }
                    686: 
                    687: /* Same as `malloc' but report error if no memory available.  */
                    688: 
1.1.1.2   root      689: int
1.1       root      690: xmalloc (size)
                    691:      unsigned size;
                    692: {
                    693:   register int value = (int) malloc (size);
                    694:   if (value == 0)
                    695:     fatal ("Virtual memory exhausted.");
                    696:   return value;
                    697: }
                    698: 
                    699: /* Same as `realloc' but report error if no memory available.  */
                    700: 
                    701: int
                    702: xrealloc (ptr, size)
                    703:      char *ptr;
                    704:      int size;
                    705: {
                    706:   int result = realloc (ptr, size);
                    707:   if (!result)
1.1.1.2   root      708:     fatal ("Virtual memory exhausted.");
1.1       root      709:   return result;
                    710: }
                    711: 
                    712: /* Return the logarithm of X, base 2, considering X unsigned,
                    713:    if X is a power of 2.  Otherwise, returns -1.  */
                    714: 
                    715: int
                    716: exact_log2 (x)
                    717:      register unsigned int x;
                    718: {
                    719:   register int log = 0;
                    720:   for (log = 0; log < HOST_BITS_PER_INT; log++)
                    721:     if (x == (1 << log))
                    722:       return log;
                    723:   return -1;
                    724: }
                    725: 
                    726: /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
                    727:    If X is 0, return -1.  */
                    728: 
                    729: int
                    730: floor_log2 (x)
                    731:      register unsigned int x;
                    732: {
                    733:   register int log = 0;
                    734:   for (log = 0; log < HOST_BITS_PER_INT; log++)
                    735:     if ((x & ((-1) << log)) == 0)
                    736:       return log - 1;
                    737:   return HOST_BITS_PER_INT - 1;
                    738: }
1.1.1.10  root      739: 
                    740: int float_handled;
                    741: jmp_buf float_handler;
                    742: 
                    743: /* Specify where to longjmp to when a floating arithmetic error happens.
                    744:    If HANDLER is 0, it means don't handle the errors any more.  */
                    745: 
                    746: void
                    747: set_float_handler (handler)
                    748:      jmp_buf handler;
                    749: {
                    750:   float_handled = (handler != 0);
                    751:   if (handler)
                    752:     bcopy (handler, float_handler, sizeof (float_handler));
                    753: }
                    754: 
                    755: /* Signals actually come here.  */
                    756: 
                    757: static void
                    758: float_signal ()
                    759: {
                    760:   if (float_handled == 0)
                    761:     abort ();
                    762:   warning ("floating overflow in constant folding");
                    763:   float_handled = 0;
                    764:   longjmp (float_handler, 1);
                    765: }
1.1.1.13  root      766: 
                    767: /* Handler for SIGPIPE.  */
                    768: 
                    769: static void
                    770: pipe_closed ()
                    771: {
                    772:   fatal ("output pipe has been closed");
                    773: }
1.1       root      774: 
                    775: /* Compile an entire file of output from cpp, named NAME.
                    776:    Write a file of assembly output and various debugging dumps.  */
                    777: 
                    778: static void
                    779: compile_file (name)
                    780:      char *name;
                    781: {
                    782:   tree globals;
                    783:   int start_time;
1.1.1.9   root      784:   int dump_base_name_length;
                    785: 
                    786:   int name_specified = name != 0;
                    787: 
                    788:   if (dump_base_name == 0)
                    789:     dump_base_name = name ? name : "gccdump";
                    790:   dump_base_name_length = strlen (dump_base_name);
1.1       root      791: 
                    792:   parse_time = 0;
                    793:   varconst_time = 0;
1.1.1.2   root      794:   integration_time = 0;
1.1       root      795:   jump_time = 0;
                    796:   cse_time = 0;
                    797:   loop_time = 0;
                    798:   flow_time = 0;
                    799:   combine_time = 0;
                    800:   local_alloc_time = 0;
                    801:   global_alloc_time = 0;
                    802:   final_time = 0;
                    803:   symout_time = 0;
1.1.1.2   root      804:   dump_time = 0;
1.1       root      805: 
                    806:   /* Open input file.  */
                    807: 
1.1.1.9   root      808:   if (name == 0 || !strcmp (name, "-"))
                    809:     {
                    810:       finput = stdin;
                    811:       name = "stdin";
                    812:     }
                    813:   else
                    814:     finput = fopen (name, "r");
1.1       root      815:   if (finput == 0)
                    816:     pfatal_with_name (name);
                    817: 
                    818:   /* Initialize data in various passes.  */
                    819: 
                    820:   init_tree ();
                    821:   init_lex ();
                    822:   init_rtl ();
1.1.1.2   root      823:   init_emit_once ();
1.1       root      824:   init_decl_processing ();
                    825:   init_optabs ();
                    826: 
                    827:   /* If rtl dump desired, open the output file.  */
                    828:   if (rtl_dump)
                    829:     {
                    830:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
                    831:       strcpy (dumpname, dump_base_name);
                    832:       strcat (dumpname, ".rtl");
                    833:       rtl_dump_file = fopen (dumpname, "w");
                    834:       if (rtl_dump_file == 0)
                    835:        pfatal_with_name (dumpname);
                    836:     }
                    837: 
                    838:   /* If jump_opt dump desired, open the output file.  */
                    839:   if (jump_opt_dump)
                    840:     {
                    841:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
                    842:       strcpy (dumpname, dump_base_name);
                    843:       strcat (dumpname, ".jump");
                    844:       jump_opt_dump_file = fopen (dumpname, "w");
                    845:       if (jump_opt_dump_file == 0)
                    846:        pfatal_with_name (dumpname);
                    847:     }
                    848: 
                    849:   /* If cse dump desired, open the output file.  */
                    850:   if (cse_dump)
                    851:     {
                    852:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
                    853:       strcpy (dumpname, dump_base_name);
                    854:       strcat (dumpname, ".cse");
                    855:       cse_dump_file = fopen (dumpname, "w");
                    856:       if (cse_dump_file == 0)
                    857:        pfatal_with_name (dumpname);
                    858:     }
                    859: 
                    860:   /* If loop dump desired, open the output file.  */
                    861:   if (loop_dump)
                    862:     {
                    863:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
                    864:       strcpy (dumpname, dump_base_name);
                    865:       strcat (dumpname, ".loop");
                    866:       loop_dump_file = fopen (dumpname, "w");
                    867:       if (loop_dump_file == 0)
                    868:        pfatal_with_name (dumpname);
                    869:     }
                    870: 
                    871:   /* If flow dump desired, open the output file.  */
                    872:   if (flow_dump)
                    873:     {
                    874:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
                    875:       strcpy (dumpname, dump_base_name);
                    876:       strcat (dumpname, ".flow");
                    877:       flow_dump_file = fopen (dumpname, "w");
                    878:       if (flow_dump_file == 0)
                    879:        pfatal_with_name (dumpname);
                    880:     }
                    881: 
                    882:   /* If combine dump desired, open the output file.  */
                    883:   if (combine_dump)
                    884:     {
                    885:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
                    886:       strcpy (dumpname, dump_base_name);
                    887:       strcat (dumpname, ".combine");
                    888:       combine_dump_file = fopen (dumpname, "w");
                    889:       if (combine_dump_file == 0)
                    890:        pfatal_with_name (dumpname);
                    891:     }
                    892: 
                    893:   /* If local_reg dump desired, open the output file.  */
                    894:   if (local_reg_dump)
                    895:     {
                    896:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
                    897:       strcpy (dumpname, dump_base_name);
                    898:       strcat (dumpname, ".lreg");
                    899:       local_reg_dump_file = fopen (dumpname, "w");
                    900:       if (local_reg_dump_file == 0)
                    901:        pfatal_with_name (dumpname);
                    902:     }
                    903: 
                    904:   /* If global_reg dump desired, open the output file.  */
                    905:   if (global_reg_dump)
                    906:     {
                    907:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
                    908:       strcpy (dumpname, dump_base_name);
                    909:       strcat (dumpname, ".greg");
                    910:       global_reg_dump_file = fopen (dumpname, "w");
                    911:       if (global_reg_dump_file == 0)
                    912:        pfatal_with_name (dumpname);
                    913:     }
                    914: 
1.1.1.2   root      915:   /* If jump2_opt dump desired, open the output file.  */
                    916:   if (jump2_opt_dump)
                    917:     {
                    918:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
                    919:       strcpy (dumpname, dump_base_name);
                    920:       strcat (dumpname, ".jump2");
                    921:       jump2_opt_dump_file = fopen (dumpname, "w");
                    922:       if (jump2_opt_dump_file == 0)
                    923:        pfatal_with_name (dumpname);
                    924:     }
                    925: 
1.1       root      926:   /* Open assembler code output file.  */
                    927:  
1.1.1.9   root      928:   if (! name_specified && asm_file_name == 0)
                    929:     asm_out_file = stdout;
                    930:   else
                    931:     {
                    932:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
                    933:       int len = strlen (dump_base_name);
                    934:       strcpy (dumpname, dump_base_name);
                    935:       if (len > 2 && ! strcmp (".c", dumpname + len - 2))
                    936:        dumpname[len - 2] = 0;
                    937:       else if (len > 2 && ! strcmp (".i", dumpname + len - 2))
                    938:        dumpname[len - 2] = 0;
                    939:       else if (len > 3 && ! strcmp (".co", dumpname + len - 3))
                    940:        dumpname[len - 3] = 0;
                    941:       strcat (dumpname, ".s");
                    942:       if (asm_file_name == 0)
                    943:        {
                    944:          asm_file_name = (char *) malloc (strlen (dumpname) + 1);
                    945:          strcpy (asm_file_name, dumpname);
                    946:        }
                    947:       if (!strcmp (asm_file_name, "-"))
                    948:        asm_out_file = stdout;
                    949:       else
                    950:        asm_out_file = fopen (asm_file_name, "w");
                    951:       if (asm_out_file == 0)
                    952:        pfatal_with_name (asm_file_name);
                    953:     }
1.1       root      954: 
                    955:   input_filename = name;
                    956: 
                    957:   /* the beginning of the file is a new line; check for # */
                    958:   /* With luck, we discover the real source file's name from that
                    959:      and put it in input_filename.  */
1.1.1.4   root      960:   ungetc (check_newline (), finput);
                    961: 
1.1.1.8   root      962:   /* If the input doesn't start with a #line, use the input name
                    963:      as the official input file name.  */
                    964:   if (main_input_filename == 0)
                    965:     main_input_filename = name;
                    966: 
1.1.1.4   root      967:   ASM_FILE_START (asm_out_file);
1.1       root      968: 
1.1.1.12  root      969:   /* Output something to inform GDB that this compilation was by GCC.  */
                    970: #ifndef ASM_IDENTIFY_GCC
                    971:   fprintf (asm_out_file, "gcc_compiled.:\n");
                    972: #else
                    973:   ASM_IDENTIFY_GCC (asm_out_file);
                    974: #endif
                    975: 
1.1       root      976:   /* If GDB symbol table desired, open the GDB symbol output file.  */
1.1.1.4   root      977:   if (write_symbols == GDB_DEBUG)
1.1       root      978:     {
                    979:       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
1.1.1.2   root      980:       int len = strlen (dump_base_name);
1.1       root      981:       strcpy (dumpname, dump_base_name);
1.1.1.2   root      982:       if (len > 2 && ! strcmp (".c", dumpname + len - 2))
                    983:        dumpname[len - 2] = 0;
1.1.1.7   root      984:       else if (len > 2 && ! strcmp (".i", dumpname + len - 2))
                    985:        dumpname[len - 2] = 0;
1.1.1.2   root      986:       else if (len > 3 && ! strcmp (".co", dumpname + len - 3))
                    987:        dumpname[len - 3] = 0;
1.1       root      988:       strcat (dumpname, ".sym");
                    989:       if (sym_file_name == 0)
                    990:        sym_file_name = dumpname;
1.1.1.4   root      991:       symout_init (sym_file_name, asm_out_file, main_input_filename);
1.1       root      992:     }
                    993: 
                    994:   /* If dbx symbol table desired, initialize writing it
                    995:      and output the predefined types.  */
1.1.1.4   root      996: #ifdef DBX_DEBUGGING_INFO
                    997:   if (write_symbols == DBX_DEBUG)
1.1.1.2   root      998:     dbxout_init (asm_out_file, main_input_filename);
1.1.1.4   root      999: #endif
                   1000: #ifdef SDB_DEBUGGING_INFO
                   1001:   if (write_symbols == SDB_DEBUG)
                   1002:     sdbout_init (asm_out_file, main_input_filename);
                   1003: #endif
1.1       root     1004: 
                   1005:   /* Initialize yet another pass.  */
                   1006: 
1.1.1.2   root     1007:   init_final (main_input_filename);
1.1       root     1008: 
                   1009:   start_time = gettime ();
                   1010: 
                   1011:   /* Call the parser, which parses the entire file
                   1012:      (calling rest_of_compilation for each function).  */
                   1013: 
                   1014:   yyparse ();
                   1015: 
                   1016:   /* Compilation is now finished except for writing
                   1017:      what's left of the symbol table output.  */
                   1018: 
                   1019:   parse_time += gettime () - start_time;
                   1020: 
1.1.1.2   root     1021:   parse_time -= varconst_time;
                   1022: 
1.1       root     1023:   globals = getdecls ();
                   1024: 
1.1.1.2   root     1025:   /* Really define vars that have had only a tentative definition.
                   1026:      Really output inline functions that must actually be callable
                   1027:      and have not been output so far.  */
                   1028: 
                   1029:   {
                   1030:     tree decl;
                   1031:     for (decl = globals; decl; decl = TREE_CHAIN (decl))
                   1032:       {
                   1033:        if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
                   1034:            && ! TREE_ASM_WRITTEN (decl))
                   1035:          rest_of_decl_compilation (decl, 0, 1, 1);
                   1036:        if (TREE_CODE (decl) == FUNCTION_DECL
                   1037:            && ! TREE_ASM_WRITTEN (decl)
                   1038:            && DECL_INITIAL (decl) != 0
                   1039:            && TREE_ADDRESSABLE (decl))
                   1040:          output_inline_function (decl);
1.1.1.15! root     1041: 
        !          1042:        /* Warn about any function declared static but not defined.  */
1.1.1.13  root     1043:        if (warn_unused
                   1044:            && TREE_CODE (decl) == FUNCTION_DECL
                   1045:            && DECL_INITIAL (decl) == 0
                   1046:            && TREE_EXTERNAL (decl)
                   1047:            && ! TREE_PUBLIC (decl))
                   1048:          warning_with_decl (decl, "`%s' declared but never defined");
1.1.1.15! root     1049:        /* Warn about statics fns or vars defined but not used,
        !          1050:           but not about inline functions
        !          1051:           since unused inline statics is normal practice.  */
        !          1052:        if (warn_unused
        !          1053:            && (TREE_CODE (decl) == FUNCTION_DECL
        !          1054:                || TREE_CODE (decl) == VAR_DECL)
        !          1055:            && ! TREE_EXTERNAL (decl)
        !          1056:            && ! TREE_PUBLIC (decl)
        !          1057:            && ! TREE_USED (decl)
        !          1058:            && ! TREE_INLINE (decl))
        !          1059:          warning_with_decl (decl, "`%s' defined but not used");
1.1.1.2   root     1060:       }
                   1061:   }
                   1062: 
1.1       root     1063:   /* Do dbx symbols */
1.1.1.4   root     1064: #ifdef DBX_DEBUGGING_INFO
                   1065:   if (write_symbols == DBX_DEBUG)
1.1       root     1066:     TIMEVAR (symout_time,
                   1067:             {
                   1068:               dbxout_tags (gettags ());
                   1069:               dbxout_types (get_permanent_types ());
                   1070:             });
1.1.1.4   root     1071: #endif
                   1072: 
                   1073: #ifdef SDB_DEBUGGING_INFO
                   1074:   if (write_symbols == SDB_DEBUG)
                   1075:     TIMEVAR (symout_time,
                   1076:             {
                   1077:               sdbout_tags (gettags ());
                   1078:               sdbout_types (get_permanent_types ());
                   1079:             });
                   1080: #endif
1.1       root     1081: 
                   1082:   /* Do gdb symbols */
1.1.1.4   root     1083:   if (write_symbols == GDB_DEBUG)
1.1       root     1084:     TIMEVAR (symout_time,
                   1085:             {
                   1086:               struct stat statbuf;
                   1087:               fstat (fileno (finput), &statbuf);
                   1088:               symout_types (get_permanent_types ());
                   1089:               symout_top_blocks (globals, gettags ());
                   1090:               symout_finish (name, statbuf.st_ctime);
                   1091:             });
                   1092: 
1.1.1.14  root     1093:   /* Output some stuff at end of file if nec.  */
                   1094: 
                   1095:   end_final (main_input_filename);
                   1096: 
1.1.1.2   root     1097:   /* Close the dump files.  */
1.1       root     1098: 
                   1099:   if (rtl_dump)
                   1100:     fclose (rtl_dump_file);
                   1101: 
                   1102:   if (jump_opt_dump)
                   1103:     fclose (jump_opt_dump_file);
                   1104: 
                   1105:   if (cse_dump)
                   1106:     fclose (cse_dump_file);
                   1107: 
                   1108:   if (loop_dump)
                   1109:     fclose (loop_dump_file);
                   1110: 
                   1111:   if (flow_dump)
                   1112:     fclose (flow_dump_file);
                   1113: 
                   1114:   if (combine_dump)
                   1115:     {
                   1116:       dump_combine_total_stats (combine_dump_file);
                   1117:       fclose (combine_dump_file);
                   1118:     }
                   1119: 
                   1120:   if (local_reg_dump)
                   1121:     fclose (local_reg_dump_file);
                   1122: 
                   1123:   if (global_reg_dump)
                   1124:     fclose (global_reg_dump_file);
                   1125: 
1.1.1.2   root     1126:   if (jump2_opt_dump)
                   1127:     fclose (jump2_opt_dump_file);
                   1128: 
                   1129:   /* Close non-debugging input and output files.  */
                   1130: 
                   1131:   fclose (finput);
                   1132:   if (ferror (asm_out_file) != 0)
                   1133:     fatal_io_error (asm_file_name);
                   1134:   fclose (asm_out_file);
                   1135: 
1.1       root     1136:   /* Print the times.  */
                   1137: 
                   1138:   if (! quiet_flag)
                   1139:     {
1.1.1.2   root     1140:       fprintf (stderr,"\n");
1.1       root     1141:       print_time ("parse", parse_time);
1.1.1.2   root     1142:       print_time ("integration", integration_time);
1.1       root     1143:       print_time ("jump", jump_time);
                   1144:       print_time ("cse", cse_time);
                   1145:       print_time ("loop", loop_time);
                   1146:       print_time ("flow", flow_time);
                   1147:       print_time ("combine", combine_time);
                   1148:       print_time ("local-alloc", local_alloc_time);
                   1149:       print_time ("global-alloc", global_alloc_time);
                   1150:       print_time ("final", final_time);
                   1151:       print_time ("varconst", varconst_time);
                   1152:       print_time ("symout", symout_time);
                   1153:       print_time ("dump", dump_time);
                   1154:     }
                   1155: }
                   1156: 
1.1.1.2   root     1157: /* This is called from finish_decl (within yyparse)
                   1158:    for each declaration of a function or variable.
                   1159:    This does nothing for automatic variables.
                   1160:    Otherwise, it sets up the RTL and outputs any assembler code
                   1161:    (label definition, storage allocation and initialization).
                   1162: 
                   1163:    DECL is the declaration.  If ASMSPEC is nonzero, it specifies
                   1164:    the assembler symbol name to be used.  TOP_LEVEL is nonzero
                   1165:    if this declaration is not within a function.  */
                   1166: 
                   1167: void
                   1168: rest_of_decl_compilation (decl, asmspec, top_level, at_end)
                   1169:      tree decl;
                   1170:      tree asmspec;
                   1171:      int top_level;
                   1172:      int at_end;
                   1173: {
                   1174:   /* Declarations of variables, and of functions defined elsewhere.  */
                   1175: 
                   1176:   if (TREE_STATIC (decl) || TREE_EXTERNAL (decl))
                   1177:     TIMEVAR (varconst_time,
                   1178:             {
1.1.1.12  root     1179:               make_decl_rtl (decl, asmspec, top_level);
                   1180:               /* Don't output anything
                   1181:                  when a tentative file-scope definition is seen.
                   1182:                  But at end of compilation, do output code for them.  */
                   1183:               if (! (! at_end && top_level
                   1184:                      && (DECL_INITIAL (decl) == 0
                   1185:                          || DECL_INITIAL (decl) == error_mark_node)))
                   1186:                 assemble_variable (decl, top_level, write_symbols, at_end);
1.1.1.2   root     1187:             });
1.1.1.4   root     1188: #ifdef DBX_DEBUGGING_INFO
                   1189:   else if (write_symbols == DBX_DEBUG && TREE_CODE (decl) == TYPE_DECL)
1.1.1.3   root     1190:     TIMEVAR (varconst_time, dbxout_symbol (decl, 0));
1.1.1.4   root     1191: #endif
                   1192: #ifdef SDB_DEBUGGING_INFO
                   1193:   else if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == TYPE_DECL)
                   1194:     TIMEVAR (varconst_time, sdbout_symbol (decl, 0));
                   1195: #endif
1.1.1.2   root     1196: 
                   1197:   if (top_level)
                   1198:     {
1.1.1.4   root     1199:       if (write_symbols == GDB_DEBUG)
1.1.1.2   root     1200:        {
                   1201:          TIMEVAR (symout_time,
                   1202:                   {
                   1203:                     /* The initizations make types when they contain
                   1204:                        string constants.  The types are on the temporary
                   1205:                        obstack, so output them now before they go away.  */
                   1206:                     symout_types (get_temporary_types ());
                   1207:                   });
                   1208:        }
                   1209:       else
                   1210:        /* Clean out the temporary type list, since the types will go away.  */
                   1211:        get_temporary_types ();
                   1212:     }
                   1213: }
                   1214: 
1.1       root     1215: /* This is called from finish_function (within yyparse)
1.1.1.2   root     1216:    after each top-level definition is parsed.
1.1       root     1217:    It is supposed to compile that function or variable
                   1218:    and output the assembler code for it.
                   1219:    After we return, the tree storage is freed.  */
                   1220: 
                   1221: void
1.1.1.2   root     1222: rest_of_compilation (decl)
1.1       root     1223:      tree decl;
                   1224: {
                   1225:   register rtx insns;
                   1226:   int start_time = gettime ();
                   1227:   int tem;
                   1228: 
1.1.1.2   root     1229:   /* If we are reconsidering an inline function
                   1230:      at the end of compilation, skip the stuff for making it inline.  */
1.1       root     1231: 
1.1.1.2   root     1232:   if (DECL_SAVED_INSNS (decl) == 0)
1.1       root     1233:     {
                   1234: 
1.1.1.2   root     1235:       /* If requested, consider whether to make this function inline.  */
                   1236:       if (flag_inline_functions || TREE_INLINE (decl))
                   1237:        {
                   1238:          TIMEVAR (integration_time,
                   1239:                   {
                   1240:                     int specd = TREE_INLINE (decl);
                   1241:                     char *lose = function_cannot_inline_p (decl);
                   1242:                     if (lose != 0 && specd)
                   1243:                       warning_with_decl (decl, lose);
                   1244:                     if (lose == 0)
                   1245:                       save_for_inline (decl);
                   1246:                     else
                   1247:                       TREE_INLINE (decl) = 0;
                   1248:                   });
                   1249:        }
1.1       root     1250: 
1.1.1.2   root     1251:       insns = get_insns ();
1.1       root     1252: 
                   1253:       /* Dump the rtl code if we are dumping rtl.  */
                   1254: 
                   1255:       if (rtl_dump)
                   1256:        TIMEVAR (dump_time,
                   1257:                 {
                   1258:                   fprintf (rtl_dump_file, "\n;; Function %s\n\n",
                   1259:                            IDENTIFIER_POINTER (DECL_NAME (decl)));
1.1.1.2   root     1260:                   if (DECL_SAVED_INSNS (decl))
                   1261:                     fprintf (rtl_dump_file, ";; (integrable)\n\n");
1.1       root     1262:                   print_rtl (rtl_dump_file, insns);
                   1263:                   fflush (rtl_dump_file);
                   1264:                 });
                   1265: 
1.1.1.2   root     1266:       /* If function is inline, and we don't yet know whether to
                   1267:         compile it by itself, defer decision till end of compilation.
                   1268:         finish_compilation will call rest_of_compilation again
                   1269:         for those functions that need to be output.  */
                   1270: 
                   1271:       if (TREE_PUBLIC (decl) == 0
                   1272:          && TREE_INLINE (decl)
                   1273:          && ! flag_keep_inline_functions)
1.1       root     1274:        goto exit_rest_of_compilation;
1.1.1.2   root     1275:     }
1.1       root     1276: 
1.1.1.2   root     1277:   if (rtl_dump_and_exit)
                   1278:     goto exit_rest_of_compilation;
1.1       root     1279: 
1.1.1.2   root     1280:   TREE_ASM_WRITTEN (decl) = 1;
1.1       root     1281: 
1.1.1.2   root     1282:   insns = get_insns ();
1.1       root     1283: 
1.1.1.2   root     1284:   /* Copy any shared structure that should not be shared.  */
1.1       root     1285: 
1.1.1.2   root     1286:   unshare_all_rtl (insns);
1.1       root     1287: 
1.1.1.2   root     1288:   /* See if we have allocated stack slots that are not directly addressable.
                   1289:      If so, scan all the insns and create explicit address computation
                   1290:      for all references to such slots.  */
                   1291: /*   fixup_stack_slots (); */
1.1       root     1292: 
1.1.1.2   root     1293:   /* Do jump optimization the first time, if -opt.
                   1294:      Also do it if -W, but in that case it doesn't change the rtl code,
                   1295:      it only computes whether control can drop off the end of the function.  */
1.1       root     1296: 
1.1.1.13  root     1297:   if (optimize || extra_warnings || warn_return_type
                   1298:       /* If function is `volatile', we should warn if it tries to return.  */
                   1299:       || TREE_THIS_VOLATILE (decl))
1.1.1.2   root     1300:     TIMEVAR (jump_time, jump_optimize (insns, 0, 0));
1.1       root     1301: 
1.1.1.2   root     1302:   /* Dump rtl code after jump, if we are doing that.  */
1.1       root     1303: 
1.1.1.2   root     1304:   if (jump_opt_dump)
                   1305:     TIMEVAR (dump_time,
                   1306:             {
                   1307:               fprintf (jump_opt_dump_file, "\n;; Function %s\n\n",
                   1308:                        IDENTIFIER_POINTER (DECL_NAME (decl)));
                   1309:               print_rtl (jump_opt_dump_file, insns);
                   1310:               fflush (jump_opt_dump_file);
                   1311:             });
1.1       root     1312: 
1.1.1.2   root     1313:   /* Perform common subexpression elimination.
                   1314:      Nonzero value from `cse_main' means that jumps were simplified
                   1315:      and some code may now be unreachable, so do
                   1316:      jump optimization again.  */
1.1       root     1317: 
1.1.1.2   root     1318:   if (optimize)
                   1319:     {
                   1320:       TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 0));
1.1       root     1321: 
1.1.1.2   root     1322:       TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num ()));
1.1       root     1323: 
1.1.1.2   root     1324:       if (tem)
                   1325:        TIMEVAR (jump_time, jump_optimize (insns, 0, 0));
                   1326:     }
1.1       root     1327: 
1.1.1.2   root     1328:   /* Dump rtl code after cse, if we are doing that.  */
1.1       root     1329: 
1.1.1.2   root     1330:   if (cse_dump)
                   1331:     TIMEVAR (dump_time,
                   1332:             {
                   1333:               fprintf (cse_dump_file, "\n;; Function %s\n\n",
                   1334:                        IDENTIFIER_POINTER (DECL_NAME (decl)));
                   1335:               print_rtl (cse_dump_file, insns);
                   1336:               fflush (cse_dump_file);
                   1337:             });
1.1       root     1338: 
1.1.1.2   root     1339:   if (loop_dump)
                   1340:     TIMEVAR (dump_time,
                   1341:             {
                   1342:               fprintf (loop_dump_file, "\n;; Function %s\n\n",
                   1343:                        IDENTIFIER_POINTER (DECL_NAME (decl)));
                   1344:             });
1.1       root     1345: 
1.1.1.2   root     1346:   /* Move constant computations out of loops.  */
1.1       root     1347: 
1.1.1.2   root     1348:   if (optimize)
                   1349:     {
                   1350:       TIMEVAR (loop_time,
                   1351:               {
                   1352:                 reg_scan (insns, max_reg_num (), 1);
1.1.1.9   root     1353:                 loop_optimize (insns, loop_dump ? loop_dump_file : 0);
1.1.1.2   root     1354:               });
                   1355:     }
1.1       root     1356: 
1.1.1.2   root     1357:   /* Dump rtl code after loop opt, if we are doing that.  */
1.1       root     1358: 
1.1.1.2   root     1359:   if (loop_dump)
                   1360:     TIMEVAR (dump_time,
                   1361:             {
                   1362:               print_rtl (loop_dump_file, insns);
                   1363:               fflush (loop_dump_file);
                   1364:             });
1.1       root     1365: 
1.1.1.2   root     1366:   /* Now we choose between stupid (pcc-like) register allocation
                   1367:      (if we got the -noreg switch and not -opt)
                   1368:      and smart register allocation.  */
1.1       root     1369: 
1.1.1.2   root     1370:   if (optimize)                /* Stupid allocation probably won't work */
                   1371:     obey_regdecls = 0; /* if optimizations being done.  */
1.1       root     1372: 
1.1.1.2   root     1373:   regclass_init ();
1.1       root     1374: 
1.1.1.2   root     1375:   /* Print function header into flow dump now
                   1376:      because doing the flow analysis makes some of the dump.  */
1.1       root     1377: 
1.1.1.2   root     1378:   if (flow_dump)
                   1379:     TIMEVAR (dump_time,
                   1380:             {
                   1381:               fprintf (flow_dump_file, "\n;; Function %s\n\n",
                   1382:                        IDENTIFIER_POINTER (DECL_NAME (decl)));
                   1383:             });
                   1384: 
                   1385:   if (obey_regdecls)
                   1386:     {
                   1387:       TIMEVAR (flow_time,
                   1388:               {
                   1389:                 regclass (insns, max_reg_num ());
                   1390:                 stupid_life_analysis (insns, max_reg_num (),
                   1391:                                       flow_dump_file);
                   1392:               });
                   1393:     }
                   1394:   else
                   1395:     {
                   1396:       /* Do control and data flow analysis,
                   1397:         and write some of the results to dump file.  */
1.1       root     1398: 
1.1.1.2   root     1399:       TIMEVAR (flow_time, flow_analysis (insns, max_reg_num (),
                   1400:                                         flow_dump_file));
                   1401:       if (extra_warnings)
                   1402:        uninitialized_vars_warning (DECL_INITIAL (decl));
                   1403:     }
1.1       root     1404: 
1.1.1.2   root     1405:   /* Dump rtl after flow analysis.  */
1.1       root     1406: 
1.1.1.2   root     1407:   if (flow_dump)
                   1408:     TIMEVAR (dump_time,
                   1409:             {
                   1410:               print_rtl (flow_dump_file, insns);
                   1411:               fflush (flow_dump_file);
                   1412:             });
1.1       root     1413: 
1.1.1.2   root     1414:   /* If -opt, try combining insns through substitution.  */
1.1       root     1415: 
1.1.1.2   root     1416:   if (optimize)
                   1417:     TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
1.1       root     1418: 
1.1.1.2   root     1419:   /* Dump rtl code after insn combination.  */
1.1       root     1420: 
1.1.1.2   root     1421:   if (combine_dump)
                   1422:     TIMEVAR (dump_time,
                   1423:             {
                   1424:               fprintf (combine_dump_file, "\n;; Function %s\n\n",
                   1425:                        IDENTIFIER_POINTER (DECL_NAME (decl)));
                   1426:               dump_combine_stats (combine_dump_file);
                   1427:               print_rtl (combine_dump_file, insns);
                   1428:               fflush (combine_dump_file);
                   1429:             });
1.1       root     1430: 
1.1.1.2   root     1431:   /* Unless we did stupid register allocation,
                   1432:      allocate pseudo-regs that are used only within 1 basic block.  */
1.1       root     1433: 
1.1.1.2   root     1434:   if (!obey_regdecls)
                   1435:     TIMEVAR (local_alloc_time,
                   1436:             {
                   1437:               regclass (insns, max_reg_num ());
                   1438:               local_alloc ();
                   1439:             });
1.1       root     1440: 
1.1.1.2   root     1441:   /* Dump rtl code after allocating regs within basic blocks.  */
1.1       root     1442: 
1.1.1.2   root     1443:   if (local_reg_dump)
                   1444:     TIMEVAR (dump_time,
                   1445:             {
                   1446:               fprintf (local_reg_dump_file, "\n;; Function %s\n\n",
                   1447:                        IDENTIFIER_POINTER (DECL_NAME (decl)));
                   1448:               dump_flow_info (local_reg_dump_file);
                   1449:               dump_local_alloc (local_reg_dump_file);
                   1450:               print_rtl (local_reg_dump_file, insns);
                   1451:               fflush (local_reg_dump_file);
                   1452:             });
1.1       root     1453: 
1.1.1.2   root     1454:   if (global_reg_dump)
                   1455:     TIMEVAR (dump_time,
                   1456:             fprintf (global_reg_dump_file, "\n;; Function %s\n\n",
                   1457:                      IDENTIFIER_POINTER (DECL_NAME (decl))));
                   1458: 
                   1459:   /* Unless we did stupid register allocation,
                   1460:      allocate remaining pseudo-regs, then do the reload pass
                   1461:      fixing up any insns that are invalid.  */
                   1462: 
                   1463:   TIMEVAR (global_alloc_time,
                   1464:           {
                   1465:             if (!obey_regdecls)
                   1466:               global_alloc (global_reg_dump ? global_reg_dump_file : 0);
                   1467:             else
                   1468:               reload (insns, 0,
                   1469:                       global_reg_dump ? global_reg_dump_file : 0);
                   1470:           });
                   1471: 
                   1472:   if (global_reg_dump)
                   1473:     TIMEVAR (dump_time,
                   1474:             {
                   1475:               dump_global_regs (global_reg_dump_file);
                   1476:               print_rtl (global_reg_dump_file, insns);
                   1477:               fflush (global_reg_dump_file);
                   1478:             });
1.1       root     1479: 
1.1.1.12  root     1480:   rtx_equal_function_value_matters = 1;
1.1.1.11  root     1481:   reload_completed = 1;
                   1482: 
1.1.1.2   root     1483:   /* One more attempt to remove jumps to .+1
                   1484:      left by dead-store-elimination.
                   1485:      Also do cross-jumping this time
                   1486:      and delete no-op move insns.  */
1.1       root     1487: 
1.1.1.2   root     1488:   if (optimize)
                   1489:     {
                   1490:       TIMEVAR (jump_time, jump_optimize (insns, 1, 1));
                   1491:     }
1.1       root     1492: 
1.1.1.2   root     1493:   /* Dump rtl code after jump, if we are doing that.  */
                   1494: 
                   1495:   if (jump2_opt_dump)
                   1496:     TIMEVAR (dump_time,
                   1497:             {
                   1498:               fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n",
                   1499:                        IDENTIFIER_POINTER (DECL_NAME (decl)));
                   1500:               print_rtl (jump2_opt_dump_file, insns);
                   1501:               fflush (jump2_opt_dump_file);
                   1502:             });
                   1503: 
                   1504:   /* Now turn the rtl into assembler code.  */
                   1505: 
                   1506:   TIMEVAR (final_time,
                   1507:           {
                   1508:             assemble_function (decl);
                   1509:             final_start_function (insns, asm_out_file,
                   1510:                                   write_symbols, optimize);
                   1511:             final (insns, asm_out_file,
1.1.1.9   root     1512:                    write_symbols, optimize, 0);
1.1.1.2   root     1513:             final_end_function (insns, asm_out_file,
                   1514:                                 write_symbols, optimize);
                   1515:             fflush (asm_out_file);
                   1516:           });
1.1       root     1517: 
1.1.1.2   root     1518:   /* Write GDB symbols if requested */
1.1       root     1519: 
1.1.1.4   root     1520:   if (write_symbols == GDB_DEBUG)
1.1.1.2   root     1521:     {
                   1522:       TIMEVAR (symout_time,
                   1523:               {
                   1524:                 symout_types (get_permanent_types ());
                   1525:                 symout_types (get_temporary_types ());
                   1526: 
                   1527:                 DECL_BLOCK_SYMTAB_ADDRESS (decl)
                   1528:                   = symout_function (DECL_INITIAL (decl),
                   1529:                                      DECL_ARGUMENTS (decl), 0);
1.1.1.6   root     1530:                 symout_function_end ();
1.1.1.2   root     1531:               });
1.1       root     1532:     }
1.1.1.2   root     1533:   else
                   1534:     get_temporary_types ();
                   1535: 
                   1536:   /* Write DBX symbols if requested */
                   1537: 
1.1.1.4   root     1538: #ifdef DBX_DEBUGGING_INFO
                   1539:   if (write_symbols == DBX_DEBUG)
1.1.1.2   root     1540:     TIMEVAR (symout_time, dbxout_function (decl));
1.1.1.4   root     1541: #endif
1.1       root     1542: 
                   1543:  exit_rest_of_compilation:
                   1544: 
1.1.1.12  root     1545:   rtx_equal_function_value_matters = 0;
1.1.1.11  root     1546:   reload_completed = 0;
                   1547: 
1.1.1.8   root     1548:   /* Clear out the real_constant_chain before some of the rtx's
                   1549:      it runs through become garbage.  */
                   1550: 
                   1551:   clear_const_double_mem ();
                   1552: 
1.1       root     1553:   /* The parsing time is all the time spent in yyparse
                   1554:      *except* what is spent in this function.  */
                   1555: 
                   1556:   parse_time -= gettime () - start_time;
                   1557: }
                   1558: 
                   1559: /* Entry point of cc1.  Decode command args, then call compile_file.
1.1.1.2   root     1560:    Exit code is 35 if can't open files, 34 if fatal error,
                   1561:    33 if had nonfatal errors, else success.  */
1.1       root     1562: 
                   1563: int
                   1564: main (argc, argv, envp)
                   1565:      int argc;
                   1566:      char **argv;
                   1567:      char **envp;
                   1568: {
                   1569:   register int i;
1.1.1.2   root     1570:   char *filename = 0;
                   1571:   int print_mem_flag = 0;
                   1572: 
                   1573: #ifdef RLIMIT_STACK
                   1574:   /* Get rid of any avoidable limit on stack size.  */
                   1575:   {
                   1576:     struct rlimit rlim;
                   1577: 
                   1578:     /* Set the stack limit huge so that alloca does not fail. */
                   1579:     getrlimit (RLIMIT_STACK, &rlim);
                   1580:     rlim.rlim_cur = rlim.rlim_max;
                   1581:     setrlimit (RLIMIT_STACK, &rlim);
                   1582:   }
                   1583: #endif /* RLIMIT_STACK */
                   1584: 
1.1.1.10  root     1585:   signal (SIGFPE, float_signal);
                   1586: 
1.1.1.13  root     1587:   signal (SIGPIPE, pipe_closed);
                   1588: 
1.1.1.2   root     1589:   /* Initialize whether `char' is signed.  */
                   1590:   flag_signed_char = DEFAULT_SIGNED_CHAR;
                   1591: 
1.1.1.4   root     1592:   /* This is zeroed by -O.  */
                   1593:   obey_regdecls = 1;
                   1594: 
                   1595:   /* Initialize register usage now so switches may override.  */
1.1.1.2   root     1596:   init_reg_sets ();
1.1       root     1597: 
                   1598:   target_flags = 0;
                   1599:   set_target_switch ("");
                   1600: 
                   1601:   for (i = 1; i < argc; i++)
1.1.1.13  root     1602:     if (argv[i][0] == '-' && argv[i][1] != 0)
1.1       root     1603:       {
                   1604:        register char *str = argv[i] + 1;
                   1605:        if (str[0] == 'Y')
                   1606:          str++;
                   1607: 
                   1608:        if (str[0] == 'm')
                   1609:          set_target_switch (&str[1]);
                   1610:        else if (!strcmp (str, "dumpbase"))
                   1611:          {
                   1612:            dump_base_name = argv[++i];
                   1613:          }
                   1614:        else if (str[0] == 'd')
                   1615:          {
                   1616:            register char *p = &str[1];
                   1617:            while (*p)
                   1618:              switch (*p++)
                   1619:                {
                   1620:                case 'c':
                   1621:                  combine_dump = 1;
                   1622:                  break;
                   1623:                case 'f':
                   1624:                  flow_dump = 1;
                   1625:                  break;
                   1626:                case 'g':
                   1627:                  global_reg_dump = 1;
                   1628:                  break;
                   1629:                case 'j':
                   1630:                  jump_opt_dump = 1;
                   1631:                  break;
1.1.1.2   root     1632:                case 'J':
                   1633:                  jump2_opt_dump = 1;
                   1634:                  break;
1.1       root     1635:                case 'l':
                   1636:                  local_reg_dump = 1;
                   1637:                  break;
                   1638:                case 'L':
                   1639:                  loop_dump = 1;
                   1640:                  break;
1.1.1.2   root     1641:                case 'm':
                   1642:                  print_mem_flag = 1;
                   1643:                  break;
1.1       root     1644:                case 'r':
                   1645:                  rtl_dump = 1;
                   1646:                  break;
                   1647:                case 's':
                   1648:                  cse_dump = 1;
                   1649:                  break;
                   1650:                case 'y':
                   1651:                  yydebug = 1;
                   1652:                  break;
                   1653:                }
                   1654:          }
1.1.1.2   root     1655:        else if (str[0] == 'f')
                   1656:          {
1.1.1.12  root     1657:            int j;
1.1.1.2   root     1658:            register char *p = &str[1];
1.1.1.12  root     1659:            int found = 0;
                   1660: 
                   1661:            /* Some kind of -f option.
                   1662:               P's value is the option sans `-f'.
                   1663:               Search for it in the table of options.  */
                   1664: 
                   1665:            for (j = 0;
                   1666:                 !found && j < sizeof (f_options) / sizeof (f_options[0]);
                   1667:                 j++)
                   1668:              {
                   1669:                if (!strcmp (p, f_options[j].string))
                   1670:                  {
                   1671:                    *f_options[j].variable = f_options[j].on_value;
                   1672:                    /* A goto here would be cleaner,
                   1673:                       but breaks the vax pcc.  */
                   1674:                    found = 1;
                   1675:                  }
1.1.1.13  root     1676:                if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
1.1.1.12  root     1677:                    && ! strcmp (p+3, f_options[j].string))
                   1678:                  {
                   1679:                    *f_options[j].variable = ! f_options[j].on_value;
                   1680:                    found = 1;
                   1681:                  }
                   1682:              }
                   1683: 
                   1684:            if (found)
                   1685:              ;
1.1.1.2   root     1686:            else if (!strncmp (p, "fixed-", 6))
                   1687:              fix_register (&p[6], 1, 1);
                   1688:            else if (!strncmp (p, "call-used-", 10))
                   1689:              fix_register (&p[10], 0, 1);
                   1690:            else if (!strncmp (p, "call-saved-", 11))
                   1691:              fix_register (&p[11], 0, 0);
1.1.1.7   root     1692:            else if (! lang_decode_option (argv[i]))
                   1693:              error ("Invalid option `%s'", argv[i]);         
1.1.1.2   root     1694:          }
1.1       root     1695:        else if (!strcmp (str, "noreg"))
1.1.1.4   root     1696:          ;
1.1.1.2   root     1697:        else if (!strcmp (str, "opt"))
1.1.1.4   root     1698:          optimize = 1, obey_regdecls = 0;
                   1699:        else if (!strcmp (str, "O"))
                   1700:          optimize = 1, obey_regdecls = 0;
1.1.1.2   root     1701:        else if (!strcmp (str, "pedantic"))
                   1702:          pedantic = 1;
1.1.1.7   root     1703:        else if (lang_decode_option (argv[i]))
                   1704:          ;
1.1.1.2   root     1705:        else if (!strcmp (str, "quiet"))
                   1706:          quiet_flag = 1;
                   1707:        else if (!strcmp (str, "version"))
                   1708:          {
1.1.1.7   root     1709:            extern char *version_string, *language_string;
1.1.1.12  root     1710:            fprintf (stderr, "%s version %s", language_string, version_string);
1.1.1.2   root     1711: #ifdef TARGET_VERSION
                   1712:            TARGET_VERSION;
                   1713: #endif
                   1714: #ifdef __GNUC__
                   1715: #ifndef __VERSION__
                   1716: #define __VERSION__ "[unknown]"
                   1717: #endif
1.1.1.12  root     1718:            fprintf (stderr, " compiled by GNU C version %s.\n", __VERSION__);
1.1.1.2   root     1719: #else
1.1.1.12  root     1720:            fprintf (stderr, " compiled by CC.\n");
1.1.1.2   root     1721: #endif
                   1722:          }
1.1       root     1723:        else if (!strcmp (str, "w"))
                   1724:          inhibit_warnings = 1;
1.1.1.2   root     1725:        else if (!strcmp (str, "W"))
                   1726:          extra_warnings = 1;
1.1.1.9   root     1727:        else if (!strcmp (str, "Wunused"))
                   1728:          warn_unused = 1;
1.1.1.15! root     1729:        else if (!strcmp (str, "Wshadow"))
        !          1730:          warn_shadow = 1;
        !          1731:        else if (!strcmp (str, "Wswitch"))
        !          1732:          warn_switch = 1;
        !          1733:        else if (!strncmp (str, "Wid-clash-", 10))
        !          1734:          {
        !          1735:            char *endp = str + 10;
        !          1736: 
        !          1737:            while (*endp)
        !          1738:              {
        !          1739:                if (*endp >= '0' && *endp <= '9')
        !          1740:                  endp++;
        !          1741:                else
        !          1742:                  error ("Invalid option `%s'", argv[i]);
        !          1743:              }
        !          1744:            warn_id_clash = 1;
        !          1745:            id_clash_len = atoi (str + 10);
        !          1746:          }
1.1.1.2   root     1747:        else if (!strcmp (str, "p"))
                   1748:          profile_flag = 1;
1.1.1.14  root     1749:        else if (!strcmp (str, "a"))
                   1750:          {
                   1751: #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
                   1752:            warning ("`-a' option (basic block profile) not supported");
                   1753: #else
                   1754:            profile_block_flag = 1;
                   1755: #endif
                   1756:          }
1.1.1.4   root     1757:        else if (!strcmp (str, "gg"))
                   1758:          write_symbols = GDB_DEBUG;
                   1759: #ifdef DBX_DEBUGGING_INFO
1.1       root     1760:        else if (!strcmp (str, "g"))
1.1.1.4   root     1761:          write_symbols = DBX_DEBUG;
1.1       root     1762:        else if (!strcmp (str, "G"))
1.1.1.4   root     1763:          write_symbols = DBX_DEBUG;
                   1764: #endif
                   1765: #ifdef SDB_DEBUGGING_INFO
                   1766:        else if (!strcmp (str, "g"))
                   1767:          write_symbols = SDB_DEBUG;
                   1768:        else if (!strcmp (str, "G"))
                   1769:          write_symbols = SDB_DEBUG;
                   1770: #endif
1.1       root     1771:        else if (!strcmp (str, "symout"))
                   1772:          {
1.1.1.4   root     1773:            if (write_symbols == NO_DEBUG)
                   1774:              write_symbols = GDB_DEBUG;
1.1       root     1775:            sym_file_name = argv[++i];
                   1776:          }
                   1777:        else if (!strcmp (str, "o"))
                   1778:          {
                   1779:            asm_file_name = argv[++i];
                   1780:          }
                   1781:        else
1.1.1.7   root     1782:          error ("Invalid option `%s'", argv[i]);
1.1       root     1783:       }
                   1784:     else
                   1785:       filename = argv[i];
                   1786: 
1.1.1.2   root     1787: #ifdef OVERRIDE_OPTIONS
                   1788:   /* Some machines may reject certain combinations of options.  */
                   1789:   OVERRIDE_OPTIONS;
                   1790: #endif
                   1791: 
1.1.1.4   root     1792:   /* Now that register usage is specified, convert it to HARD_REG_SETs.  */
                   1793:   init_reg_sets_1 ();
                   1794: 
1.1       root     1795:   compile_file (filename);
                   1796: 
1.1.1.2   root     1797: #ifndef USG
                   1798: #ifndef VMS
                   1799:   if (print_mem_flag)
                   1800:     {
                   1801:       extern char **environ;
                   1802:       caddr_t lim = (caddr_t) sbrk (0);
                   1803:       
                   1804:       fprintf (stderr, "Data size %d.\n",
                   1805:               (int) lim - (int) &environ);
                   1806:       fflush (stderr);
                   1807: 
                   1808:       system ("ps v");
                   1809:     }
                   1810: #endif /* not VMS */
                   1811: #endif /* not USG */
                   1812: 
1.1       root     1813:   if (errorcount)
1.1.1.2   root     1814:     exit (FATAL_EXIT_CODE);
1.1.1.7   root     1815:   if (sorrycount)
                   1816:     exit (FATAL_EXIT_CODE);
1.1.1.2   root     1817:   exit (SUCCESS_EXIT_CODE);
                   1818:   return 34;
1.1       root     1819: }
                   1820: 
                   1821: /* Decode -m switches.  */
                   1822: 
                   1823: /* Here is a table, controlled by the tm-...h file, listing each -m switch
                   1824:    and which bits in `target_switches' it should set or clear.
                   1825:    If VALUE is positive, it is bits to set.
                   1826:    If VALUE is negative, -VALUE is bits to clear.
                   1827:    (The sign bit is not used so there is no confusion.)  */
                   1828: 
                   1829: struct {char *name; int value;} target_switches []
                   1830:   = TARGET_SWITCHES;
                   1831: 
                   1832: /* Decode the switch -mNAME.  */
                   1833: 
1.1.1.2   root     1834: void
1.1       root     1835: set_target_switch (name)
                   1836:      char *name;
                   1837: {
1.1.1.2   root     1838:   register int j;
1.1       root     1839:   for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
                   1840:     if (!strcmp (target_switches[j].name, name))
                   1841:       {
                   1842:        if (target_switches[j].value < 0)
                   1843:          target_flags &= ~-target_switches[j].value;
                   1844:        else
                   1845:          target_flags |= target_switches[j].value;
1.1.1.7   root     1846:        return;
1.1       root     1847:       }
1.1.1.7   root     1848:   error ("Invalid option `%s'", name);
1.1       root     1849: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.