From 61098249b51d7c483274d72796401720079e55a9 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 1 Apr 2000 11:07:05 -0800 Subject: [PATCH] Makefile.in (STAGESTUFF): Wildcard all debugging dumps at once. * Makefile.in (STAGESTUFF): Wildcard all debugging dumps at once. (mostlyclean): Likewise. * toplev.c (rtl_dump, jump_opt_dump, etc): Remove. (struct dump_file_info, enum dump_file_index, dump_file): New. (open_dump_file): Take a dump_file_index not a suffix, and a decl not a string. Clean out file if we havn't yet done so. Do nothing if the dump isn't enabled. (close_dump_file): Do nothing if the dump isn't open. Dump graph data if requested. (dump_rtl, clean_dump_file): Remove. (compile_file): Don't clean the dump files. Only finalize .bp dump if flag_test_coverage or flag_branch_probabilities. Only finalize .combine dump if optimizing. Iterate over dump_file to finalize the graph dumps. (rest_of_compilation): Update for open_dump_file/close_dump_file. Convert all uses of dump_rtl. (decode_d_option): Iterate over dump_file to implement 'a' and to locate pass-specific dumps. From-SVN: r32857 --- gcc/ChangeLog | 22 ++ gcc/Makefile.in | 15 +- gcc/toplev.c | 868 +++++++++++++++--------------------------------- 3 files changed, 284 insertions(+), 621 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 92a7e0e9d58..2c195f4ebff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2000-04-01 Richard Henderson + + * Makefile.in (STAGESTUFF): Wildcard all debugging dumps at once. + (mostlyclean): Likewise. + + * toplev.c (rtl_dump, jump_opt_dump, etc): Remove. + (struct dump_file_info, enum dump_file_index, dump_file): New. + (open_dump_file): Take a dump_file_index not a suffix, and a decl + not a string. Clean out file if we havn't yet done so. Do nothing + if the dump isn't enabled. + (close_dump_file): Do nothing if the dump isn't open. Dump + graph data if requested. + (dump_rtl, clean_dump_file): Remove. + (compile_file): Don't clean the dump files. Only finalize .bp dump + if flag_test_coverage or flag_branch_probabilities. Only finalize + .combine dump if optimizing. Iterate over dump_file to finalize the + graph dumps. + (rest_of_compilation): Update for open_dump_file/close_dump_file. + Convert all uses of dump_rtl. + (decode_d_option): Iterate over dump_file to implement 'a' and to + locate pass-specific dumps. + 2000-04-01 Neil Booth * cppexp.c: Redefine priority constants. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 117edb732e6..67d1b4d4423 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -707,11 +707,7 @@ STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \ $(CCCP)$(exeext) cc1obj$(exeext) enquire$(exeext) \ protoize$(exeext) unprotoize$(exeext) \ specs collect2$(exeext) $(USE_COLLECT2) underscore.c \ - gcov$(exeext) *.bp \ - *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \ - *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.gcse *.flow2 *.peephole2 \ - *.ssa *.ussa \ - *.[si] libcpp.a \ + gcov$(exeext) *.[0-9][0-9].* *.[si] libcpp.a \ $(LANG_STAGESTUFF) # Members of libgcc1.a. @@ -2381,13 +2377,7 @@ mostlyclean: $(INTL_MOSTLYCLEAN) lang.mostlyclean -rm -f s-* tmp-* stamp-* stmp-* -rm -f */stamp-* */tmp-* # Delete debugging dump files. - -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop - -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.addressof - -rm -f *.regmove *.mach *.bp *.gcse *.flow2 *.peephole2 *.ssa *.ussa - -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl - -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2 - -rm -f */*.sched2 */*.stack */*.regmove */*.gcse */*.flow2 - -rm -f */*.peephole2 */*.ssa */*.ussa + -rm -f *.[0-9][0-9].* */*.[0-9][0-9].* # Delete some files made during installation. -rm -f specs float.h-* enquire SYSCALLS.c.X SYSCALLS.c -rm -f collect collect2 mips-tfile mips-tdump alloca.s @@ -2401,7 +2391,6 @@ mostlyclean: $(INTL_MOSTLYCLEAN) lang.mostlyclean -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns # Delete core dumps. -rm -f core */core - -rm -f *.bp */*.bp # Delete all files made by compilation # that don't exist in the distribution. diff --git a/gcc/toplev.c b/gcc/toplev.c index f91e488b2c8..6d84c915c4e 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -162,18 +162,14 @@ static void pipe_closed PARAMS ((int)) ATTRIBUTE_NORETURN; /* This might or might not be used in ASM_IDENTIFY_LANGUAGE. */ static void output_lang_identify PARAMS ((FILE *)) ATTRIBUTE_UNUSED; #endif -static void open_dump_file PARAMS ((const char *, const char *)); -static void close_dump_file PARAMS ((void (*) (FILE *, rtx), rtx)); -static void dump_rtl PARAMS ((const char *, tree, void (*) (FILE *, rtx), rtx)); -static void clean_dump_file PARAMS ((const char *)); static void compile_file PARAMS ((char *)); static void display_help PARAMS ((void)); static void mark_file_stack PARAMS ((void *)); static void decode_d_option PARAMS ((const char *)); -static int decode_f_option PARAMS ((const char *)); -static int decode_W_option PARAMS ((const char *)); -static int decode_g_option PARAMS ((const char *)); +static int decode_f_option PARAMS ((const char *)); +static int decode_W_option PARAMS ((const char *)); +static int decode_g_option PARAMS ((const char *)); static unsigned int independent_decode_option PARAMS ((int, char **, unsigned int)); @@ -230,42 +226,99 @@ const char *dump_base_name; extern int target_flags; -/* Flags saying which kinds of debugging dump have been requested. */ - -int rtl_dump = 0; -int rtl_dump_and_exit = 0; -int jump_opt_dump = 0; -int addressof_dump = 0; -int cse_dump = 0; -int gcse_dump = 0; -int loop_dump = 0; -int cse2_dump = 0; -int branch_prob_dump = 0; -int flow_dump = 0; -int combine_dump = 0; -int regmove_dump = 0; -int sched_dump = 0; -int local_reg_dump = 0; -int global_reg_dump = 0; -int flow2_dump = 0; -int peephole2_dump = 0; -int sched2_dump = 0; -int jump2_opt_dump = 0; -#ifdef DELAY_SLOTS -int dbr_sched_dump = 0; -#endif -int reorder_blocks_dump = 0; -int flag_print_asm_name = 0; -#ifdef STACK_REGS -int stack_reg_dump = 0; -#endif -#ifdef MACHINE_DEPENDENT_REORG -int mach_dep_reorg_dump = 0; -#endif -int ssa_dump = 0; -static int flag_print_mem = 0; -static int version_flag = 0; -static char * filename = 0; +/* Describes a dump file. */ + +struct dump_file_info +{ + /* The unique extension to apply, e.g. ".jump". */ + const char * const extension; + + /* The -d character that enables this dump file. */ + char const debug_switch; + + /* True if there is a corresponding graph dump file. */ + char const graph_dump_p; + + /* True if the user selected this dump. */ + char enabled; + + /* True if the files have been initialized (ie truncated). */ + char initialized; +}; + +/* Enumerate the extant dump files. */ + +enum dump_file_index +{ + DFI_rtl, + DFI_jump, + DFI_cse, + DFI_addressof, + DFI_ssa, + DFI_ussa, + DFI_gcse, + DFI_loop, + DFI_cse2, + DFI_bp, + DFI_flow, + DFI_combine, + DFI_regmove, + DFI_sched, + DFI_lreg, + DFI_greg, + DFI_flow2, + DFI_peephole2, + DFI_sched2, + DFI_bbro, + DFI_jump2, + DFI_mach, + DFI_dbr, + DFI_stack, + DFI_MAX +}; + +/* Describes all the dump files. Should be kept in order of the + pass and in sync with dump_file_index above. */ + +struct dump_file_info dump_file[DFI_MAX] = +{ + { "rtl", 'r', 0, 0, 0 }, + { "jump", 'j', 0, 0, 0 }, + { "cse", 's', 0, 0, 0 }, + { "addressof", 'F', 0, 0, 0 }, + { "ssa", 'e', 1, 0, 0 }, + { "ussa", 'e', 1, 0, 0 }, /* Yes, duplicate enable switch. */ + { "gcse", 'G', 1, 0, 0 }, + { "loop", 'L', 1, 0, 0 }, + { "cse2", 't', 1, 0, 0 }, + { "bp", 'b', 1, 0, 0 }, + { "flow", 'f', 1, 0, 0 }, + { "combine", 'c', 1, 0, 0 }, + { "regmove", 'N', 1, 0, 0 }, + { "sched", 'S', 1, 0, 0 }, + { "lreg", 'l', 1, 0, 0 }, + { "greg", 'g', 1, 0, 0 }, + { "flow2", 'w', 1, 0, 0 }, + { "peephole2", 'z', 1, 0, 0 }, + { "sched2", 'R', 1, 0, 0 }, + { "bbro", 'B', 1, 0, 0 }, + { "jump2", 'J', 1, 0, 0 }, + { "mach", 'M', 1, 0, 0 }, + { "dbr", 'd', 0, 0, 0 }, + { "stack", 'k', 1, 0, 0 }, +}; + +static int open_dump_file PARAMS ((enum dump_file_index, tree)); +static void close_dump_file PARAMS ((enum dump_file_index, + void (*) (FILE *, rtx), rtx)); + +/* Other flags saying which kinds of debugging dump have been requested. */ + +int rtl_dump_and_exit; +int flag_print_asm_name; +static int flag_print_mem; +static int version_flag; +static char * filename; enum graph_dump_types graph_dump_format; /* Name for output file of assembly code, specified with -o. */ @@ -1736,46 +1789,89 @@ output_lang_identify (asm_out_file) } #endif -/* Routine to open a dump file. */ -static void -open_dump_file (suffix, function_name) - const char *suffix; - const char *function_name; +/* Routine to open a dump file. Return true if the dump file is enabled. */ + +static int +open_dump_file (index, decl) + enum dump_file_index index; + tree decl; { - char *dumpname; + char *dump_name; + const char *open_arg; + char seq[16]; + + if (! dump_file[index].enabled) + return 0; TIMEVAR (dump_time, - { - dumpname = concat (dump_base_name, suffix, NULL); - - if (rtl_dump_file != NULL) - fclose (rtl_dump_file); + { + if (rtl_dump_file != NULL) + fclose (rtl_dump_file); - rtl_dump_file = fopen (dumpname, "a"); - - if (rtl_dump_file == NULL) - pfatal_with_name (dumpname); + sprintf (seq, ".%02d.", index); + + if (! dump_file[index].initialized) + { + /* If we've not initialized the files, do so now. */ + if (graph_dump_format != no_graph + && dump_file[index].graph_dump_p) + { + dump_name = concat (seq, dump_file[index].extension, NULL); + clean_graph_dump_file (dump_base_name, dump_name); + free (dump_name); + } + dump_file[index].initialized = 1; + open_arg = "w"; + } + else + open_arg = "a"; + + dump_name = concat (dump_base_name, seq, + dump_file[index].extension, NULL); + + rtl_dump_file = fopen (dump_name, open_arg); + if (rtl_dump_file == NULL) + pfatal_with_name (dump_name); - free (dumpname); + free (dump_name); - if (function_name) - fprintf (rtl_dump_file, "\n;; Function %s\n\n", function_name); - }); + if (decl) + fprintf (rtl_dump_file, "\n;; Function %s\n\n", + decl_printable_name (decl, 2)); + }); - return; + return 1; } /* Routine to close a dump file. */ + static void -close_dump_file (func, insns) +close_dump_file (index, func, insns) + enum dump_file_index index; void (*func) PARAMS ((FILE *, rtx)); rtx insns; { + if (! rtl_dump_file) + return; + TIMEVAR (dump_time, - { - if (func) + { + if (insns + && graph_dump_format != no_graph + && dump_file[index].graph_dump_p) + { + char seq[16]; + char *suffix; + + sprintf (seq, ".%02d.", index); + suffix = concat (seq, dump_file[index].extension, NULL); + print_rtl_graph_with_bb (dump_base_name, suffix, insns); + free (suffix); + } + + if (func && insns) func (rtl_dump_file, insns); fflush (rtl_dump_file); @@ -1783,40 +1879,6 @@ close_dump_file (func, insns) rtl_dump_file = NULL; }); - - return; -} - -/* Routine to dump rtl into a file. */ -static void -dump_rtl (suffix, decl, func, insns) - const char *suffix; - tree decl; - void (*func) PARAMS ((FILE *, rtx)); - rtx insns; -{ - open_dump_file (suffix, decl_printable_name (decl, 2)); - close_dump_file (func, insns); -} - -/* Routine to empty a dump file. */ -static void -clean_dump_file (suffix) - const char *suffix; -{ - char * const dumpname = concat (dump_base_name, suffix, NULL); - - rtl_dump_file = fopen (dumpname, "w"); - - if (rtl_dump_file == NULL) - pfatal_with_name (dumpname); - - free (dumpname); - - fclose (rtl_dump_file); - rtl_dump_file = NULL; - - return; } /* Do any final processing required for the declarations in VEC, of @@ -2148,153 +2210,6 @@ compile_file (name) pfatal_with_name (aux_info_file_name); } - /* Clear the dump files. */ - if (rtl_dump) - clean_dump_file (".00.rtl"); - if (jump_opt_dump) - { - clean_dump_file (".01.jump"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".01.jump"); - } - if (cse_dump) - { - clean_dump_file (".02.cse"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".02.cse"); - } - if (addressof_dump) - { - clean_dump_file (".03.addressof"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".03.addressof"); - } - if (ssa_dump) - { - clean_dump_file (".033.ssa"); - clean_dump_file (".037.ussa"); - } - if (gcse_dump) - { - clean_dump_file (".04.gcse"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".04.gcse"); - } - if (loop_dump) - { - clean_dump_file (".05.loop"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".05.loop"); - } - if (cse2_dump) - { - clean_dump_file (".06.cse2"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".06.cse2"); - } - if (branch_prob_dump) - { - clean_dump_file (".07.bp"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".07.bp"); - } - if (flow_dump) - { - clean_dump_file (".08.flow"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".08.flow"); - } - if (combine_dump) - { - clean_dump_file (".09.combine"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".09.combine"); - } - if (regmove_dump) - { - clean_dump_file (".10.regmove"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".10.regmove"); - } -#ifdef INSN_SCHEDULING - if (sched_dump) - { - clean_dump_file (".11.sched"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".11.sched"); - } -#endif - if (local_reg_dump) - { - clean_dump_file (".12.lreg"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".12.lreg"); - } - if (global_reg_dump) - { - clean_dump_file (".13.greg"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".13.greg"); - } - if (flow2_dump) - { - clean_dump_file (".14.flow2"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".14.flow2"); - } -#ifdef HAVE_peephole2 - if (peephole2_dump) - { - clean_dump_file (".15.peephole2"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".15.peephole2"); - } -#endif -#ifdef INSN_SCHEDULING - if (sched2_dump) - { - clean_dump_file (".16.sched2"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".16.sched2"); - } -#endif - if (reorder_blocks_dump) - { - clean_dump_file (".bbro"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".bbro"); - } - if (jump2_opt_dump) - { - clean_dump_file (".17.jump2"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".17.jump2"); - } -#ifdef MACHINE_DEPENDENT_REORG - if (mach_dep_reorg_dump) - { - clean_dump_file (".18.mach"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".18.mach"); - } -#endif -#ifdef DELAY_SLOTS - if (dbr_sched_dump) - { - clean_dump_file (".19.dbr"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".19.dbr"); - } -#endif -#ifdef STACK_REGS - if (stack_reg_dump) - { - clean_dump_file (".20.stack"); - if (graph_dump_format != no_graph) - clean_graph_dump_file (dump_base_name, ".20.stack"); - } -#endif - /* Open assembler code output file. */ if (flag_syntax_only) @@ -2559,19 +2474,19 @@ compile_file (name) end_final (dump_base_name); - if (branch_prob_dump) - open_dump_file (".07.bp", NULL); + if (flag_test_coverage || flag_branch_probabilities) + { + open_dump_file (DFI_bp, NULL); - TIMEVAR (dump_time, end_branch_prob (rtl_dump_file)); + TIMEVAR (dump_time, end_branch_prob (rtl_dump_file)); - if (branch_prob_dump) - close_dump_file (NULL, NULL_RTX); + close_dump_file (DFI_bp, NULL, NULL_RTX); + } #ifdef ASM_FILE_END ASM_FILE_END (asm_out_file); #endif - /* Language-specific end of compilation actions. */ finish_syntax: lang_finish (); @@ -2585,11 +2500,10 @@ compile_file (name) unlink (aux_info_file_name); } - if (combine_dump) + if (optimize > 0 && open_dump_file (DFI_combine, NULL)) { - open_dump_file (".09.combine", NULL); TIMEVAR (dump_time, dump_combine_total_stats (rtl_dump_file)); - close_dump_file (NULL, NULL_RTX); + close_dump_file (DFI_combine, NULL, NULL_RTX); } /* Close non-debugging input and output files. Take special care to note @@ -2605,60 +2519,19 @@ compile_file (name) /* Do whatever is necessary to finish printing the graphs. */ if (graph_dump_format != no_graph) { - if (jump_opt_dump) - finish_graph_dump_file (dump_base_name, ".01.jump"); - if (cse_dump) - finish_graph_dump_file (dump_base_name, ".02.cse"); - if (addressof_dump) - finish_graph_dump_file (dump_base_name, ".03.addressof"); - if (gcse_dump) - finish_graph_dump_file (dump_base_name, ".04.gcse"); - if (loop_dump) - finish_graph_dump_file (dump_base_name, ".05.loop"); - if (cse2_dump) - finish_graph_dump_file (dump_base_name, ".06.cse2"); - if (branch_prob_dump) - finish_graph_dump_file (dump_base_name, ".07.bp"); - if (flow_dump) - finish_graph_dump_file (dump_base_name, ".08.flow"); - if (combine_dump) - finish_graph_dump_file (dump_base_name, ".09.combine"); - if (regmove_dump) - finish_graph_dump_file (dump_base_name, ".10.regmove"); -#ifdef INSN_SCHEDULING - if (sched_dump) - finish_graph_dump_file (dump_base_name, ".11.sched"); -#endif - if (local_reg_dump) - finish_graph_dump_file (dump_base_name, ".12.lreg"); - if (global_reg_dump) - finish_graph_dump_file (dump_base_name, ".13.greg"); - if (flow2_dump) - finish_graph_dump_file (dump_base_name, ".14.flow2"); -#ifdef HAVE_peephole2 - if (flow2_dump) - finish_graph_dump_file (dump_base_name, ".15.peephole2"); -#endif -#ifdef INSN_SCHEDULING - if (sched2_dump) - finish_graph_dump_file (dump_base_name, ".16.sched2"); -#endif - if (reorder_blocks_dump) - finish_graph_dump_file (dump_base_name, ".bbro"); - if (jump2_opt_dump) - finish_graph_dump_file (dump_base_name, ".17.jump2"); -#ifdef MACHINE_DEPENDENT_REORG - if (mach_dep_reorg_dump) - finish_graph_dump_file (dump_base_name, ".18.mach"); -#endif -#ifdef DELAY_SLOTS - if (dbr_sched_dump) - finish_graph_dump_file (dump_base_name, ".19.dbr"); -#endif -#ifdef STACK_REGS - if (stack_reg_dump) - finish_graph_dump_file (dump_base_name, ".20.stack"); -#endif + int i; + + for (i = 0; i < DFI_MAX; ++i) + if (dump_file[i].initialized && dump_file[i].graph_dump_p) + { + char seq[16]; + char *suffix; + + sprintf (seq, ".%02d.", i); + suffix = concat (seq, dump_file[i].extension, NULL); + finish_graph_dump_file (dump_base_name, suffix); + free (suffix); + } } /* Free up memory for the benefit of leak detectors. */ @@ -2936,14 +2809,11 @@ rest_of_compilation (decl) /* Dump the rtl code if we are dumping rtl. */ - if (rtl_dump) + if (open_dump_file (DFI_rtl, decl)) { - open_dump_file (".00.rtl", decl_printable_name (decl, 2)); - if (DECL_SAVED_INSNS (decl)) fprintf (rtl_dump_file, ";; (integrable)\n\n"); - - close_dump_file (print_rtl, insns); + close_dump_file (DFI_rtl, print_rtl, insns); } /* If function is inline, and we don't yet know whether to @@ -3069,8 +2939,7 @@ rest_of_compilation (decl) /* Find all the EH handlers. */ find_exception_handler_labels (); - if (jump_opt_dump) - open_dump_file (".01.jump", decl_printable_name (decl, 2)); + open_dump_file (DFI_jump, decl); /* Always do one jump optimization pass to ensure that JUMP_LABEL fields are initialized and to compute whether control can drop off the end @@ -3086,9 +2955,7 @@ rest_of_compilation (decl) memory. */ renumber_insns (rtl_dump_file); - /* Dump rtl code after jump, if we are doing that. */ - if (jump_opt_dump) - close_dump_file (print_rtl, insns); + close_dump_file (DFI_jump, print_rtl, insns); /* Now is when we stop if -fsyntax-only and -Wreturn-type. */ if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl)) @@ -3108,8 +2975,7 @@ rest_of_compilation (decl) if (optimize > 0) { - if (cse_dump) - open_dump_file (".02.cse", decl_printable_name (decl, 2)); + open_dump_file (DFI_cse, decl); TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1)); @@ -3139,43 +3005,30 @@ rest_of_compilation (decl) removed a bunch more instructions. */ renumber_insns (rtl_dump_file); - /* Dump rtl code after cse, if we are doing that. */ - if (cse_dump) - { - close_dump_file (print_rtl, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".02.cse", insns); - } + close_dump_file (DFI_cse, print_rtl, insns); } + open_dump_file (DFI_addressof, decl); + purge_addressof (insns); reg_scan (insns, max_reg_num (), 1); - if (addressof_dump) - { - dump_rtl (".03.addressof", decl, print_rtl, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".03.addressof", insns); - } + close_dump_file (DFI_addressof, print_rtl, insns); if (ggc_p) ggc_collect (); if (flag_ssa) { - if (ssa_dump) - open_dump_file (".033.ssa", decl_printable_name (decl, 2)); + open_dump_file (DFI_ssa, decl); convert_to_ssa (); - if (ssa_dump) - close_dump_file (print_rtl_with_bb, insns); + close_dump_file (DFI_ssa, print_rtl_with_bb, insns); - if (ssa_dump) - open_dump_file (".037.ussa", decl_printable_name (decl, 2)); + open_dump_file (DFI_ussa, decl); convert_from_ssa (); /* New registers have been created. Rescan their usage. */ reg_scan (insns, max_reg_num (), 1); - if (ssa_dump) - close_dump_file (print_rtl_with_bb, insns); + close_dump_file (DFI_ussa, print_rtl_with_bb, insns); /* Life analysis used in SSA adds log_links but these shouldn't be there until the flow stage, so clear them away. */ @@ -3189,8 +3042,7 @@ rest_of_compilation (decl) if (optimize > 0 && flag_gcse) { - if (gcse_dump) - open_dump_file (".04.gcse", decl_printable_name (decl, 2)); + open_dump_file (DFI_gcse, decl); TIMEVAR (gcse_time, tem = gcse_main (insns, rtl_dump_file)); @@ -3203,12 +3055,7 @@ rest_of_compilation (decl) !JUMP_AFTER_REGSCAN)); } - if (gcse_dump) - { - close_dump_file (print_rtl, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".04.gcse", insns); - } + close_dump_file (DFI_gcse, print_rtl, insns); if (ggc_p) ggc_collect (); @@ -3217,9 +3064,8 @@ rest_of_compilation (decl) if (optimize > 0) { - if (loop_dump) - open_dump_file (".05.loop", decl_printable_name (decl, 2)); - + open_dump_file (DFI_loop, decl); + TIMEVAR (loop_time, { @@ -3243,14 +3089,7 @@ rest_of_compilation (decl) loop_optimize (insns, rtl_dump_file, flag_unroll_loops, 1); }); - /* Dump rtl code after loop opt, if we are doing that. */ - - if (loop_dump) - { - close_dump_file (print_rtl, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".05.loop", insns); - } + close_dump_file (DFI_loop, print_rtl, insns); if (ggc_p) ggc_collect (); @@ -3263,8 +3102,7 @@ rest_of_compilation (decl) if (optimize > 0) { - if (cse2_dump) - open_dump_file (".06.cse2", decl_printable_name (decl, 2)); + open_dump_file (DFI_cse2, decl); if (flag_rerun_cse_after_loop) { @@ -3295,13 +3133,7 @@ rest_of_compilation (decl) TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0)); } - /* Dump rtl code after cse, if we are doing that. */ - if (cse2_dump) - { - close_dump_file (print_rtl, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".06.cse2", insns); - } + close_dump_file (DFI_cse2, print_rtl, insns); if (ggc_p) ggc_collect (); @@ -3309,8 +3141,7 @@ rest_of_compilation (decl) if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) { - if (branch_prob_dump) - open_dump_file (".07.bp", decl_printable_name (decl, 2)); + open_dump_file (DFI_bp, decl); TIMEVAR (branch_prob_time, @@ -3318,12 +3149,7 @@ rest_of_compilation (decl) branch_prob (insns, rtl_dump_file); }); - if (branch_prob_dump) - { - close_dump_file (print_rtl, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".07.bp", insns); - } + close_dump_file (DFI_bp, print_rtl, insns); if (ggc_p) ggc_collect (); @@ -3334,8 +3160,7 @@ rest_of_compilation (decl) /* Print function header into flow dump now because doing the flow analysis makes some of the dump. */ - if (flow_dump) - open_dump_file (".08.flow", decl_printable_name (decl, 2)); + open_dump_file (DFI_flow, decl); /* Do control and data flow analysis; wrote some of the results to the dump file. */ @@ -3358,14 +3183,7 @@ rest_of_compilation (decl) setjmp_args_warning (); } - /* Dump rtl after flow analysis. */ - - if (flow_dump) - { - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".08.flow", insns); - } + close_dump_file (DFI_flow, print_rtl_with_bb, insns); if (ggc_p) ggc_collect (); @@ -3380,6 +3198,8 @@ rest_of_compilation (decl) { int rebuild_jump_labels_after_combine = 0; + open_dump_file (DFI_combine, decl); + TIMEVAR (combine_time, { rebuild_jump_labels_after_combine @@ -3394,14 +3214,7 @@ rest_of_compilation (decl) TIMEVAR (jump_time, rebuild_jump_labels (insns)); } - /* Dump rtl code after insn combination. */ - - if (combine_dump) - { - dump_rtl (".09.combine", decl, print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".09.combine", insns); - } + close_dump_file (DFI_combine, print_rtl_with_bb, insns); if (ggc_p) ggc_collect (); @@ -3411,18 +3224,12 @@ rest_of_compilation (decl) necessary for two-address machines. */ if (optimize > 0 && (flag_regmove || flag_expensive_optimizations)) { - if (regmove_dump) - open_dump_file (".10.regmove", decl_printable_name (decl, 2)); + open_dump_file (DFI_regmove, decl); TIMEVAR (regmove_time, regmove_optimize (insns, max_reg_num (), rtl_dump_file)); - if (regmove_dump) - { - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".10.regmove", insns); - } + close_dump_file (DFI_regmove, print_rtl_with_bb, insns); if (ggc_p) ggc_collect (); @@ -3439,22 +3246,14 @@ rest_of_compilation (decl) because doing the sched analysis makes some of the dump. */ if (optimize > 0 && flag_schedule_insns) { - if (sched_dump) - open_dump_file (".11.sched", decl_printable_name (decl, 2)); + open_dump_file (DFI_sched, decl); /* Do control and data sched analysis, and write some of the results to dump file. */ TIMEVAR (sched_time, schedule_insns (rtl_dump_file)); - /* Dump rtl after instruction scheduling. */ - - if (sched_dump) - { - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".11.sched", insns); - } + close_dump_file (DFI_sched, print_rtl_with_bb, insns); if (ggc_p) ggc_collect (); @@ -3466,8 +3265,7 @@ rest_of_compilation (decl) epilogue thus changing register elimination offsets. */ current_function_is_leaf = leaf_function_p (); - if (local_reg_dump) - open_dump_file (".12.lreg", decl_printable_name (decl, 2)); + open_dump_file (DFI_lreg, decl); /* Allocate pseudo-regs that are used only within 1 basic block. @@ -3484,23 +3282,18 @@ rest_of_compilation (decl) rebuild_label_notes_after_reload = local_alloc (); }); - /* Dump rtl code after allocating regs within basic blocks. */ - - if (local_reg_dump) + if (dump_file[DFI_lreg].enabled) { TIMEVAR (dump_time, dump_flow_info (rtl_dump_file)); TIMEVAR (dump_time, dump_local_alloc (rtl_dump_file)); - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".12.lreg", insns); + close_dump_file (DFI_lreg, print_rtl_with_bb, insns); } if (ggc_p) ggc_collect (); - if (global_reg_dump) - open_dump_file (".13.greg", decl_printable_name (decl, 2)); + open_dump_file (DFI_greg, decl); /* If optimizing, allocate remaining pseudo-regs. Do the reload pass fixing up any insns that are invalid. */ @@ -3541,17 +3334,14 @@ rest_of_compilation (decl) if (rebuild_label_notes_after_reload) TIMEVAR (jump_time, rebuild_jump_labels (insns)); - if (global_reg_dump) + if (dump_file[DFI_greg].enabled) { TIMEVAR (dump_time, dump_global_regs (rtl_dump_file)); - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".13.greg", insns); + close_dump_file (DFI_greg, print_rtl_with_bb, insns); } /* Re-create the death notes which were deleted during reload. */ - if (flow2_dump) - open_dump_file (".14.flow2", decl_printable_name (decl, 2)); + open_dump_file (DFI_flow2, decl); TIMEVAR (flow2_time, { @@ -3587,49 +3377,30 @@ rest_of_compilation (decl) flow2_completed = 1; - if (flow2_dump) - { - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".14.flow2", insns); - } + close_dump_file (DFI_flow2, print_rtl_with_bb, insns); #ifdef HAVE_peephole2 if (optimize > 0 && flag_peephole2) { - if (peephole2_dump) - open_dump_file (".15.peephole2", decl_printable_name (decl, 2)); + open_dump_file (DFI_peephole2, decl); TIMEVAR (peephole2_time, peephole2_optimize (rtl_dump_file)); - if (peephole2_dump) - { - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".15.peephole2", insns); - } + close_dump_file (DFI_peephole2, print_rtl_with_bb, insns); } #endif #ifdef INSN_SCHEDULING if (optimize > 0 && flag_schedule_insns_after_reload) { - if (sched2_dump) - open_dump_file (".16.sched2", decl_printable_name (decl, 2)); + open_dump_file (DFI_sched2, decl); /* Do control and data sched analysis again, and write some more of the results to dump file. */ TIMEVAR (sched2_time, schedule_insns (rtl_dump_file)); - /* Dump rtl after post-reorder instruction scheduling. */ - - if (sched2_dump) - { - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".16.sched2", insns); - } + close_dump_file (DFI_sched2, print_rtl_with_bb, insns); if (ggc_p) ggc_collect (); @@ -3643,17 +3414,11 @@ rest_of_compilation (decl) if (optimize > 0 && flag_reorder_blocks) { - if (reorder_blocks_dump) - open_dump_file (".bbro", decl_printable_name (decl, 2)); + open_dump_file (DFI_bbro, decl); TIMEVAR (reorder_blocks_time, reorder_basic_blocks ()); - if (reorder_blocks_dump) - { - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".bbro", insns); - } + close_dump_file (DFI_bbro, print_rtl_with_bb, insns); } /* One more attempt to remove jumps to .+1 left by dead-store elimination. @@ -3661,36 +3426,25 @@ rest_of_compilation (decl) if (optimize > 0) { + open_dump_file (DFI_jump2, decl); + TIMEVAR (jump_time, jump_optimize (insns, JUMP_CROSS_JUMP, JUMP_NOOP_MOVES, !JUMP_AFTER_REGSCAN)); - /* Dump rtl code after jump, if we are doing that. */ - - if (jump2_opt_dump) - { - dump_rtl (".17.jump2", decl, print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".17.jump2", insns); - } + close_dump_file (DFI_jump2, print_rtl_with_bb, insns); } /* If a machine dependent reorganization is needed, call it. */ #ifdef MACHINE_DEPENDENT_REORG - if (mach_dep_reorg_dump) - open_dump_file (".18.mach", decl_printable_name (decl, 2)); + open_dump_file (DFI_mach, decl); - MACHINE_DEPENDENT_REORG (insns); + MACHINE_DEPENDENT_REORG (insns); - if (mach_dep_reorg_dump) - { - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".18.mach", insns); - } + close_dump_file (DFI_mach, print_rtl_with_bb, insns); - if (ggc_p) - ggc_collect (); + if (ggc_p) + ggc_collect (); #endif /* If a scheduling pass for delayed branches is to be done, @@ -3699,8 +3453,7 @@ rest_of_compilation (decl) #ifdef DELAY_SLOTS if (optimize > 0 && flag_delayed_branch) { - if (dbr_sched_dump) - open_dump_file (".19.dbr", decl_printable_name (decl, 2)); + open_dump_file (DFI_dbr, decl); TIMEVAR (dbr_sched_time, @@ -3708,16 +3461,11 @@ rest_of_compilation (decl) dbr_schedule (insns, rtl_dump_file); }); - if (dbr_sched_dump) - { - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".19.dbr", insns); - } - } + close_dump_file (DFI_dbr, print_rtl_with_bb, insns); - if (ggc_p) - ggc_collect (); + if (ggc_p) + ggc_collect (); + } #endif /* Shorten branches. @@ -3730,17 +3478,11 @@ rest_of_compilation (decl) }); #ifdef STACK_REGS - if (stack_reg_dump) - open_dump_file (".20.stack", decl_printable_name (decl, 2)); + open_dump_file (DFI_stack, decl); TIMEVAR (stack_reg_time, reg_to_stack (insns, rtl_dump_file)); - if (stack_reg_dump) - { - close_dump_file (print_rtl_with_bb, insns); - if (graph_dump_format != no_graph) - print_rtl_graph_with_bb (dump_base_name, ".20.stack", insns); - } + close_dump_file (DFI_stack, print_rtl_with_bb, insns); if (ggc_p) ggc_collect (); @@ -4057,138 +3799,48 @@ static void decode_d_option (arg) const char * arg; { - while (* arg) - switch (* arg ++) + int i, c, matched; + + while (*arg) + switch (c = *arg++) { case 'a': - branch_prob_dump = 1; - combine_dump = 1; -#ifdef DELAY_SLOTS - dbr_sched_dump = 1; -#endif - reorder_blocks_dump = 1; - flow_dump = 1; - flow2_dump = 1; - global_reg_dump = 1; - jump_opt_dump = 1; - addressof_dump = 1; - jump2_opt_dump = 1; - local_reg_dump = 1; - loop_dump = 1; - regmove_dump = 1; - rtl_dump = 1; - cse_dump = 1; - cse2_dump = 1; - gcse_dump = 1; - sched_dump = 1; - sched2_dump = 1; -#ifdef STACK_REGS - stack_reg_dump = 1; -#endif -#ifdef MACHINE_DEPENDENT_REORG - mach_dep_reorg_dump = 1; -#endif - peephole2_dump = 1; - ssa_dump = 1; + for (i = 0; i < DFI_MAX; ++i) + dump_file[i].enabled = 1; break; case 'A': flag_debug_asm = 1; break; - case 'b': - branch_prob_dump = 1; - break; - case 'B': - reorder_blocks_dump = 1; - break; - case 'c': - combine_dump = 1; - break; -#ifdef DELAY_SLOTS - case 'd': - dbr_sched_dump = 1; - break; -#endif - case 'e': - ssa_dump = 1; - break; - case 'f': - flow_dump = 1; - break; - case 'F': - addressof_dump = 1; - break; - case 'g': - global_reg_dump = 1; - break; - case 'G': - gcse_dump = 1; - break; - case 'j': - jump_opt_dump = 1; - break; - case 'J': - jump2_opt_dump = 1; - break; -#ifdef STACK_REGS - case 'k': - stack_reg_dump = 1; - break; -#endif - case 'l': - local_reg_dump = 1; - break; - case 'L': - loop_dump = 1; - break; case 'm': flag_print_mem = 1; break; -#ifdef MACHINE_DEPENDENT_REORG - case 'M': - mach_dep_reorg_dump = 1; - break; -#endif case 'p': flag_print_asm_name = 1; break; - case 'r': - rtl_dump = 1; - break; - case 'R': - sched2_dump = 1; - break; - case 's': - cse_dump = 1; - break; - case 'S': - sched_dump = 1; - break; - case 't': - cse2_dump = 1; - break; - case 'N': - regmove_dump = 1; - break; case 'v': graph_dump_format = vcg; break; - case 'w': - flow2_dump = 1; - break; case 'x': rtl_dump_and_exit = 1; break; case 'y': set_yydebug (1); break; - case 'z': - peephole2_dump = 1; - break; case 'D': /* These are handled by the preprocessor. */ case 'I': break; + default: - warning ("unrecognized gcc debugging option: %c", arg[-1]); + matched = 0; + for (i = 0; i < DFI_MAX; ++i) + if (c == dump_file[i].debug_switch) + { + dump_file[i].enabled = 1; + matched = 1; + } + + if (! matched) + warning ("unrecognized gcc debugging option: %c", c); break; } } -- 2.30.2