Annotation of gcc/toplev.c, revision 1.1.1.14

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

unix.superglobalmegacorp.com

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