📄 toplev.c
字号:
and write some of the results to dump file. */ TIMEVAR (flow_time, flow_analysis (insns, max_reg_num (), flow_dump_file)); if (extra_warnings) uninitialized_vars_warning (DECL_INITIAL (decl)); } /* Dump rtl after flow analysis. */ if (flow_dump) TIMEVAR (dump_time, { print_rtl (flow_dump_file, insns); fflush (flow_dump_file); }); /* If -opt, try combining insns through substitution. */ if (optimize) TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ())); /* Dump rtl code after insn combination. */ if (combine_dump) TIMEVAR (dump_time, { fprintf (combine_dump_file, "\n;; Function %s\n\n", IDENTIFIER_POINTER (DECL_NAME (decl))); dump_combine_stats (combine_dump_file); print_rtl (combine_dump_file, insns); fflush (combine_dump_file); }); /* Unless we did stupid register allocation, allocate pseudo-regs that are used only within 1 basic block. */ if (!obey_regdecls) TIMEVAR (local_alloc_time, { regclass (insns, max_reg_num ()); local_alloc (); }); /* Dump rtl code after allocating regs within basic blocks. */ if (local_reg_dump) TIMEVAR (dump_time, { fprintf (local_reg_dump_file, "\n;; Function %s\n\n", IDENTIFIER_POINTER (DECL_NAME (decl))); dump_flow_info (local_reg_dump_file); dump_local_alloc (local_reg_dump_file); print_rtl (local_reg_dump_file, insns); fflush (local_reg_dump_file); }); if (global_reg_dump) TIMEVAR (dump_time, fprintf (global_reg_dump_file, "\n;; Function %s\n\n", IDENTIFIER_POINTER (DECL_NAME (decl)))); /* Unless we did stupid register allocation, allocate remaining pseudo-regs, then do the reload pass fixing up any insns that are invalid. */ TIMEVAR (global_alloc_time, { if (!obey_regdecls) global_alloc (global_reg_dump ? global_reg_dump_file : 0); else reload (insns, 0, global_reg_dump ? global_reg_dump_file : 0); }); if (global_reg_dump) TIMEVAR (dump_time, { dump_global_regs (global_reg_dump_file); print_rtl (global_reg_dump_file, insns); fflush (global_reg_dump_file); }); rtx_equal_function_value_matters = 1; reload_completed = 1; /* One more attempt to remove jumps to .+1 left by dead-store-elimination. Also do cross-jumping this time and delete no-op move insns. */ if (optimize) { TIMEVAR (jump_time, jump_optimize (insns, 1, 1)); } /* Dump rtl code after jump, if we are doing that. */ if (jump2_opt_dump) TIMEVAR (dump_time, { fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n", IDENTIFIER_POINTER (DECL_NAME (decl))); print_rtl (jump2_opt_dump_file, insns); fflush (jump2_opt_dump_file); }); /* If a scheduling pass for delayed branches is to be done, call the scheduling code. */#ifdef HAVE_DELAYED_BRANCH if (optimize && flag_delayed_branch) { TIMEVAR (dbr_sched_time, dbr_schedule (insns, dbr_sched_dump_file)); if (dbr_sched_dump) { TIMEVAR (dump_time, { fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n", IDENTIFIER_POINTER (DECL_NAME (decl))); print_rtl (dbr_sched_dump_file, insns); fflush (dbr_sched_dump_file); }); } }#endif /* Now turn the rtl into assembler code. */ TIMEVAR (final_time, { assemble_function (decl); final_start_function (insns, asm_out_file, write_symbols, optimize); final (insns, asm_out_file, write_symbols, optimize, 0); final_end_function (insns, asm_out_file, write_symbols, optimize); fflush (asm_out_file); }); /* Write GDB symbols if requested */ if (write_symbols == GDB_DEBUG) { TIMEVAR (symout_time, { symout_types (get_permanent_types ()); symout_types (get_temporary_types ()); DECL_BLOCK_SYMTAB_ADDRESS (decl) = symout_function (DECL_INITIAL (decl), DECL_ARGUMENTS (decl), 0); symout_function_end (); }); } else get_temporary_types (); /* Write DBX symbols if requested */#ifdef DBX_DEBUGGING_INFO if (write_symbols == DBX_DEBUG) TIMEVAR (symout_time, dbxout_function (decl));#endif exit_rest_of_compilation: rtx_equal_function_value_matters = 0; reload_completed = 0; /* Clear out the real_constant_chain before some of the rtx's it runs through become garbage. */ clear_const_double_mem (); /* The parsing time is all the time spent in yyparse *except* what is spent in this function. */ parse_time -= gettime () - start_time;}/* Entry point of cc1. Decode command args, then call compile_file. Exit code is 35 if can't open files, 34 if fatal error, 33 if had nonfatal errors, else success. */intmain (argc, argv, envp) int argc; char **argv; char **envp;{ register int i; char *filename = 0; int print_mem_flag = 0; char *p; /* save in case md file wants to emit args as a comment. */ save_argc = argc; save_argv = argv; p = argv[0] + strlen (argv[0]); while (p != argv[0] && p[-1] != '/') --p; progname = p;#ifdef RLIMIT_STACK /* Get rid of any avoidable limit on stack size. */ { struct rlimit rlim; /* Set the stack limit huge so that alloca does not fail. */ getrlimit (RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max; setrlimit (RLIMIT_STACK, &rlim); }#endif /* RLIMIT_STACK */ signal (SIGFPE, float_signal); signal (SIGPIPE, pipe_closed); /* Initialize whether `char' is signed. */ flag_signed_char = DEFAULT_SIGNED_CHAR;#ifdef DEFAULT_SHORT_ENUMS /* Initialize how much space enums occupy, by default. */ flag_short_enums = DEFAULT_SHORT_ENUMS;#endif /* This is zeroed by -O. */ obey_regdecls = 1; /* Initialize register usage now so switches may override. */ init_reg_sets (); target_flags = 0; set_target_switch (""); for (i = 1; i < argc; i++) if (argv[i][0] == '-' && argv[i][1] != 0) { register char *str = argv[i] + 1; if (str[0] == 'Y') str++; if (str[0] == 'm') set_target_switch (&str[1]); else if (!strcmp (str, "dumpbase")) { dump_base_name = argv[++i]; } else if (str[0] == 'd') { register char *p = &str[1]; while (*p) switch (*p++) { case 'c': combine_dump = 1; break; case 'd': dbr_sched_dump = 1; break; case 'f': flow_dump = 1; break; case 'g': global_reg_dump = 1; break; case 'j': jump_opt_dump = 1; break; case 'J': jump2_opt_dump = 1; break; case 'l': local_reg_dump = 1; break; case 'L': loop_dump = 1; break; case 'm': print_mem_flag = 1; break; case 'r': rtl_dump = 1; break; case 's': cse_dump = 1; break; case 'y': yydebug = 1; break; } } else if (str[0] == 'f') { int j; register char *p = &str[1]; int found = 0; /* Some kind of -f option. P's value is the option sans `-f'. Search for it in the table of options. */ for (j = 0; !found && j < sizeof (f_options) / sizeof (f_options[0]); j++) { if (!strcmp (p, f_options[j].string)) { *f_options[j].variable = f_options[j].on_value; /* A goto here would be cleaner, but breaks the vax pcc. */ found = 1; } if (p[0] == 'n' && p[1] == 'o' && p[2] == '-' && ! strcmp (p+3, f_options[j].string)) { *f_options[j].variable = ! f_options[j].on_value; found = 1; } } if (found) ; else if (!strncmp (p, "fixed-", 6)) fix_register (&p[6], 1, 1); else if (!strncmp (p, "call-used-", 10)) fix_register (&p[10], 0, 1); else if (!strncmp (p, "call-saved-", 11)) fix_register (&p[11], 0, 0); else if (! lang_decode_option (argv[i])) error ("Invalid option `%s'", argv[i]); } else if (!strcmp (str, "noreg")) ; else if (!strcmp (str, "opt")) optimize = 1, obey_regdecls = 0; else if (!strcmp (str, "O")) optimize = 1, obey_regdecls = 0; /* Accept -O1 and -O2 for compatibility with version 2. */ else if (!strcmp (str, "O1") || !strcmp (str, "O2")) optimize = 1, obey_regdecls = 0; else if (!strcmp (str, "O0")) optimize = 0, obey_regdecls = 1; else if (!strcmp (str, "pedantic")) pedantic = 1; else if (lang_decode_option (argv[i])) ; else if (!strcmp (str, "quiet")) quiet_flag = 1; else if (!strcmp (str, "version")) { extern char *version_string, *language_string; fprintf (stderr, "%s version %s", language_string, version_string);#ifdef TARGET_VERSION TARGET_VERSION;#endif#ifdef __GNUC__#ifndef __VERSION__#define __VERSION__ "[unknown]"#endif fprintf (stderr, " compiled by GNU C version %s.\n", __VERSION__);#else fprintf (stderr, " compiled by CC.\n");#endif print_target_switch_defaults (); } else if (!strcmp (str, "w")) inhibit_warnings = 1; else if (!strcmp (str, "W")) extra_warnings = 1; else if (!strcmp (str, "Wunused")) warn_unused = 1; else if (!strcmp (str, "Wshadow")) warn_shadow = 1; else if (!strcmp (str, "Wswitch")) warn_switch = 1; else if (!strncmp (str, "Wid-clash-", 10)) { char *endp = str + 10; while (*endp) { if (*endp >= '0' && *endp <= '9') endp++; else error ("Invalid option `%s'", argv[i]); } warn_id_clash = 1; id_clash_len = atoi (str + 10); } else if (!strcmp (str, "p")) profile_flag = 1; else if (!strcmp (str, "a")) {#if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER) warning ("`-a' option (basic block profile) not supported");#else profile_block_flag = 1;#endif } else if (!strcmp (str, "gg")) write_symbols = GDB_DEBUG;#ifdef DBX_DEBUGGING_INFO else if (!strcmp (str, "g0")) write_symbols = DBX_DEBUG; else if (!strcmp (str, "G0")) write_symbols = DBX_DEBUG; else if (!strcmp (str, "g")) { write_symbols = DBX_DEBUG; use_gdb_dbx_extensions = 1; } else if (!strcmp (str, "G")) { write_symbols = DBX_DEBUG; use_gdb_dbx_extensions = 1; }#endif#ifdef SDB_DEBUGGING_INFO else if (!strcmp (str, "g")) write_symbols = SDB_DEBUG; else if (!strcmp (str, "G")) write_symbols = SDB_DEBUG; else if (!strcmp (str, "g0")) write_symbols = SDB_DEBUG; else if (!strcmp (str, "G0")) write_symbols = SDB_DEBUG;#endif else if (!strcmp (str, "g") || !strcmp (str, "G") || !strcmp (str, "g0") || !strcmp (str, "G0")) warning ("`%s' not supported on this system", str); else if (!strcmp (str, "symout")) { if (write_symbols == NO_DEBUG) write_symbols = GDB_DEBUG; sym_file_name = argv[++i]; } else if (!strcmp (str, "o")) { asm_file_name = argv[++i]; } else error ("Invalid option `%s'", argv[i]); } else filename = argv[i];#ifdef OVERRIDE_OPTIONS /* Some machines may reject certain combinations of options. */ OVERRIDE_OPTIONS;#endif /* Now that register usage is specified, convert it to HARD_REG_SETs. */ init_reg_sets_1 (); compile_file (filename);#ifndef USG#ifndef VMS if (print_mem_flag) { extern char **environ; char *lim = (char *) sbrk (0); fprintf (stderr, "Data size %d.\n", (int) lim - (int) &environ); fflush (stderr); system ("ps v"); }#endif /* not VMS */#endif /* not USG */ if (errorcount) exit (FATAL_EXIT_CODE); if (sorrycount) exit (FATAL_EXIT_CODE); exit (SUCCESS_EXIT_CODE); return 34;}/* Decode -m switches. *//* Here is a table, controlled by the tm-...h file, listing each -m switch and which bits in `target_switches' it should set or clear. If VALUE is positive, it is bits to set. If VALUE is negative, -VALUE is bits to clear. (The sign bit is not used so there is no confusion.) */struct {char *name; int value;} target_switches [] = TARGET_SWITCHES;/* Decode the switch -mNAME. */voidset_target_switch (name) char *name;{ register int j; for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++) if (!strcmp (target_switches[j].name, name)) { if (target_switches[j].value < 0) target_flags &= ~-target_switches[j].value; else target_flags |= target_switches[j].value; return; } error ("Invalid option `%s'", name);}/* Print default target switches for -version. */voidprint_target_switch_defaults (){ register int j; register int mask = TARGET_DEFAULT; fprintf (stderr, "default target switches:"); for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++) if (target_switches[j].name[0] != '\0' && target_switches[j].value > 0 && (target_switches[j].value & mask) == target_switches[j].value) fprintf (stderr, " -m%s", target_switches[j].name); fprintf (stderr, "\n");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -