📄 toplev.c
字号:
fprintf (stderr, "At top level:\n"); else if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE) fprintf (stderr, "In method %s:\n", DECL_PRINT_NAME (current_function_decl)); else fprintf (stderr, "In function %s:\n", DECL_PRINT_NAME (current_function_decl)); last_error_function = current_function_decl; } if (input_file_stack && input_file_stack->next != 0 && input_file_stack_tick != last_error_tick) { fprintf (stderr, "In file included"); for (p = input_file_stack->next; p; p = p->next) { fprintf (stderr, " from %s:%d", p->name, p->line); if (p->next) fprintf (stderr, ","); } fprintf (stderr, ":\n"); last_error_tick = input_file_stack_tick; }}/* Report an error at the current line number. S and V are a string and an arg for `printf'. */voiderror (s, v, v2) char *s; int v; /* @@also used as pointer */ int v2; /* @@also used as pointer */{ error_with_file_and_line (input_filename, lineno, s, v, v2);}/* Report an error at line LINE of file FILE. S and V are a string and an arg for `printf'. */voiderror_with_file_and_line (file, line, s, v, v2) char *file; int line; char *s; int v; int v2;{ count_error (0); report_error_function (file); if (file) fprintf (stderr, "%s:%d: ", file, line); else fprintf (stderr, "%s: ", progname); fprintf (stderr, s, v, v2); fprintf (stderr, "\n");}/* Report an error at the declaration DECL. S and V are a string and an arg which uses %s to substitute the declaration name. */voiderror_with_decl (decl, s, v) tree decl; char *s; int v;{ count_error (0); report_error_function (DECL_SOURCE_FILE (decl)); fprintf (stderr, "%s:%d: ", DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); if (DECL_PRINT_NAME (decl)) fprintf (stderr, s, DECL_PRINT_NAME (decl), v); else if (DECL_NAME (decl)) fprintf (stderr, s, IDENTIFIER_POINTER (DECL_NAME (decl)), v); else fprintf (stderr, s, "((anonymous))", v); fprintf (stderr, "\n");}/* Report an error at the line number of the insn INSN. S and V are a string and an arg for `printf'. This is used only when INSN is an `asm' with operands, and each ASM_OPERANDS records its own source file and line. */voiderror_for_asm (insn, s, v, v2) rtx insn; char *s; int v; /* @@also used as pointer */ int v2; /* @@also used as pointer */{ rtx temp; char *filename; int line; rtx body = PATTERN (insn); rtx asmop; /* Find the (or one of the) ASM_OPERANDS in the insn. */ if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS) asmop = SET_SRC (body); else if (GET_CODE (body) == ASM_OPERANDS) asmop = body; else if (GET_CODE (body) == PARALLEL && GET_CODE (XVECEXP (body, 0, 0)) == SET) asmop = SET_SRC (XVECEXP (body, 0, 0)); else if (GET_CODE (body) == PARALLEL && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS) asmop = XVECEXP (body, 0, 0); filename = ASM_OPERANDS_SOURCE_FILE (asmop); line = ASM_OPERANDS_SOURCE_LINE (asmop); error_with_file_and_line (filename, line, s, v, v2);}/* Report a warning at line LINE. S and V are a string and an arg for `printf'. */voidwarning_with_file_and_line (file, line, s, v, v2) char *file; int line; char *s; int v; int v2;{ if (count_error (1) == 0) return; report_error_function (file); if (file) fprintf (stderr, "%s:%d: ", file, line); else fprintf (stderr, "%s: ", progname); fprintf (stderr, "warning: "); fprintf (stderr, s, v, v2); fprintf (stderr, "\n");}/* Report a warning at the current line number. S and V are a string and an arg for `printf'. */voidwarning (s, v, v2) char *s; int v; /* @@also used as pointer */ int v2;{ warning_with_file_and_line (input_filename, lineno, s, v, v2);}/* Report a warning at the declaration DECL. S is string which uses %s to substitute the declaration name. V is a second parameter that S can refer to. */voidwarning_with_decl (decl, s, v) tree decl; char *s; int v;{ if (count_error (1) == 0) return; report_error_function (DECL_SOURCE_FILE (decl)); fprintf (stderr, "%s:%d: ", DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); fprintf (stderr, "warning: "); if (DECL_PRINT_NAME (decl)) fprintf (stderr, s, DECL_PRINT_NAME (decl), v); else if (DECL_NAME (decl)) fprintf (stderr, s, IDENTIFIER_POINTER (DECL_NAME (decl)), v); else fprintf (stderr, s, "((anonymous))", v); fprintf (stderr, "\n");}/* Report a warning at the line number of the insn INSN. S and V are a string and an arg for `printf'. This is used only when INSN is an `asm' with operands, and each ASM_OPERANDS records its own source file and line. */voidwarning_for_asm (insn, s, v, v2) rtx insn; char *s; int v; /* @@also used as pointer */ int v2; /* @@also used as pointer */{ char *filename; int line; rtx body = PATTERN (insn); rtx asmop; /* Find the (or one of the) ASM_OPERANDS in the insn. */ if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS) asmop = SET_SRC (body); else if (GET_CODE (body) == ASM_OPERANDS) asmop = body; else if (GET_CODE (body) == PARALLEL && GET_CODE (XVECEXP (body, 0, 0)) == SET) asmop = SET_SRC (XVECEXP (body, 0, 0)); else if (GET_CODE (body) == PARALLEL && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS) asmop = XVECEXP (body, 0, 0); filename = ASM_OPERANDS_SOURCE_FILE (asmop); line = ASM_OPERANDS_SOURCE_LINE (asmop); warning_with_file_and_line (filename, line, s, v, v2);}/* Apologize for not implementing some feature. S, V, and V2 are a string and args for `printf'. */voidsorry (s, v, v2) char *s; int v, v2;{ sorrycount++; if (input_filename) fprintf (stderr, "%s:%d: ", input_filename, lineno); else fprintf (stderr, "%s: ", progname); fprintf (stderr, "sorry, not implemented: "); fprintf (stderr, s, v, v2); fprintf (stderr, "\n");}/* Apologize for not implementing some feature, then quit. S, V, and V2 are a string and args for `printf'. */voidreally_sorry (s, v, v2) char *s; int v, v2;{ if (input_filename) fprintf (stderr, "%s:%d: ", input_filename, lineno); else fprintf (stderr, "c++: "); fprintf (stderr, "sorry, not implemented: "); fprintf (stderr, s, v, v2); fatal (" (fatal)\n");}/* More 'friendly' abort that prints the line and file. config.h can #define abort fancy_abort if you like that sort of thing. */voidfancy_abort (){ fatal ("Internal gcc abort.");}/* When `malloc.c' is compiled with `rcheck' defined, it calls this function to report clobberage. */voidbotch (s){ abort ();}/* Same as `malloc' but report error if no memory available. */intxmalloc (size) unsigned size;{ register int value = (int) malloc (size); if (value == 0) fatal ("Virtual memory exhausted."); return value;}/* Same as `realloc' but report error if no memory available. */intxrealloc (ptr, size) char *ptr; int size;{ int result = realloc (ptr, size); if (!result) fatal ("Virtual memory exhausted."); return result;}/* Return the logarithm of X, base 2, considering X unsigned, if X is a power of 2. Otherwise, returns -1. */intexact_log2 (x) register unsigned int x;{ register int log = 0; for (log = 0; log < HOST_BITS_PER_INT; log++) if (x == (1 << log)) return log; return -1;}/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X. If X is 0, return -1. */intfloor_log2 (x) register unsigned int x;{ register int log = 0; for (log = 0; log < HOST_BITS_PER_INT; log++) if ((x & ((-1) << log)) == 0) return log - 1; return HOST_BITS_PER_INT - 1;}int float_handled;jmp_buf float_handler;/* Specify where to longjmp to when a floating arithmetic error happens. If HANDLER is 0, it means don't handle the errors any more. */voidset_float_handler (handler) jmp_buf handler;{ float_handled = (handler != 0); if (handler) bcopy (handler, float_handler, sizeof (float_handler));}/* Signals actually come here. */static voidfloat_signal (){ if (float_handled == 0) abort (); float_handled = 0; longjmp (float_handler, 1);}/* Handler for SIGPIPE. */static voidpipe_closed (){ fatal ("output pipe has been closed");}/* Compile an entire file of output from cpp, named NAME. Write a file of assembly output and various debugging dumps. */static voidcompile_file (name) char *name;{ tree globals; int start_time; int dump_base_name_length; int name_specified = name != 0; if (dump_base_name == 0) dump_base_name = name ? name : "gccdump"; dump_base_name_length = strlen (dump_base_name); parse_time = 0; varconst_time = 0; integration_time = 0; jump_time = 0; cse_time = 0; loop_time = 0; flow_time = 0; combine_time = 0; local_alloc_time = 0; global_alloc_time = 0; dbr_sched_time = 0; final_time = 0; symout_time = 0; dump_time = 0; /* Open input file. */ if (name == 0 || !strcmp (name, "-")) { finput = stdin; name = "stdin"; } else finput = fopen (name, "r"); if (finput == 0) pfatal_with_name (name); /* Initialize data in various passes. */ init_tree (); init_lex (); init_rtl (); init_emit_once (); init_decl_processing (); init_optabs (); /* If rtl dump desired, open the output file. */ if (rtl_dump) { register char *dumpname = (char *) xmalloc (dump_base_name_length + 6); strcpy (dumpname, dump_base_name); strcat (dumpname, ".rtl"); rtl_dump_file = fopen (dumpname, "w"); if (rtl_dump_file == 0) pfatal_with_name (dumpname); } /* If jump_opt dump desired, open the output file. */ if (jump_opt_dump) { register char *dumpname = (char *) xmalloc (dump_base_name_length + 6); strcpy (dumpname, dump_base_name); strcat (dumpname, ".jump"); jump_opt_dump_file = fopen (dumpname, "w"); if (jump_opt_dump_file == 0) pfatal_with_name (dumpname); } /* If cse dump desired, open the output file. */ if (cse_dump) { register char *dumpname = (char *) xmalloc (dump_base_name_length + 6); strcpy (dumpname, dump_base_name); strcat (dumpname, ".cse"); cse_dump_file = fopen (dumpname, "w"); if (cse_dump_file == 0) pfatal_with_name (dumpname); } /* If loop dump desired, open the output file. */ if (loop_dump) { register char *dumpname = (char *) xmalloc (dump_base_name_length + 6); strcpy (dumpname, dump_base_name); strcat (dumpname, ".loop"); loop_dump_file = fopen (dumpname, "w"); if (loop_dump_file == 0) pfatal_with_name (dumpname); } /* If flow dump desired, open the output file. */ if (flow_dump) { register char *dumpname = (char *) xmalloc (dump_base_name_length + 6); strcpy (dumpname, dump_base_name); strcat (dumpname, ".flow"); flow_dump_file = fopen (dumpname, "w"); if (flow_dump_file == 0) pfatal_with_name (dumpname); } /* If combine dump desired, open the output file. */ if (combine_dump) { register char *dumpname = (char *) xmalloc (dump_base_name_length + 10); strcpy (dumpname, dump_base_name); strcat (dumpname, ".combine"); combine_dump_file = fopen (dumpname, "w"); if (combine_dump_file == 0) pfatal_with_name (dumpname); } /* If local_reg dump desired, open the output file. */ if (local_reg_dump) { register char *dumpname = (char *) xmalloc (dump_base_name_length + 6); strcpy (dumpname, dump_base_name); strcat (dumpname, ".lreg"); local_reg_dump_file = fopen (dumpname, "w"); if (local_reg_dump_file == 0) pfatal_with_name (dumpname); } /* If global_reg dump desired, open the output file. */ if (global_reg_dump) { register char *dumpname = (char *) xmalloc (dump_base_name_length + 6); strcpy (dumpname, dump_base_name); strcat (dumpname, ".greg"); global_reg_dump_file = fopen (dumpname, "w"); if (global_reg_dump_file == 0) pfatal_with_name (dumpname); } /* If jump2_opt dump desired, open the output file. */ if (jump2_opt_dump) { register char *dumpname = (char *) xmalloc (dump_base_name_length + 7); strcpy (dumpname, dump_base_name); strcat (dumpname, ".jump2"); jump2_opt_dump_file = fopen (dumpname, "w"); if (jump2_opt_dump_file == 0) pfatal_with_name (dumpname); } /* If dbr_sched dump desired, open the output file. */ if (dbr_sched_dump) { register char *dumpname = (char *) xmalloc (dump_base_name_length + 7); strcpy (dumpname, dump_base_name); strcat (dumpname, ".dbr"); dbr_sched_dump_file = fopen (dumpname, "w"); if (dbr_sched_dump_file == 0) pfatal_with_name (dumpname); } /* Open assembler code output file. */ if (! name_specified && asm_file_name == 0) asm_out_file = stdout;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -