---------------------------------------- > Subject: Re: [PATCH] Print Pass Names > From: richard.guent...@gmail.com > Date: Fri, 22 May 2015 21:32:24 +0200 > To: hiradi...@msn.com; gcc-patches@gcc.gnu.org > > On May 22, 2015 6:32:38 PM GMT+02:00, Aditya K <hiradi...@msn.com> wrote: >>Currently, when we print the passes it does not print its name. This >>becomes confusing when we want to print all the passes at once (e.g., >>-fdump-tree-all-all=stderr &> pass.dump). >>This patch adds functionality to print the pass name. It passes >>bootstrap (with default configurations). >> >>Hope this is useful. > > Can't you just use current_pass->name?
You are right. I have updated the patch. Thanks -Aditya gcc/ChangeLog: 2015-05-22 Aditya Kumar <hiradi...@msn.com> * statistics.c (statistics_fini_pass): Print pass name. --- gcc/statistics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/statistics.c b/gcc/statistics.c index 8cbe88d..50b41d1 100644 --- a/gcc/statistics.c +++ b/gcc/statistics.c @@ -201,7 +201,7 @@ statistics_fini_pass (void) && dump_flags & TDF_STATS) { fprintf (dump_file, "\n"); - fprintf (dump_file, "Pass statistics:\n"); + fprintf (dump_file, "Pass statistics of \"%s\": ", current_pass->name); fprintf (dump_file, "----------------\n"); curr_statistics_hash () ->traverse_noresize <void *, statistics_fini_pass_1> (NULL); -- 2.1.0.243.g30d45f7 > > Richard. > >>Thanks, >>-Aditya >> >> >>gcc/ChangeLog: >> >>2015-05-22 Aditya Kumar <hiradi...@msn.com> >> >> * passes.c (execute_todo): Added a parameter to pass the pass name. >> (execute_one_pass): Likewise >> * statistics.c (statistics_fini_pass): Likewise >> * statistics.h: Likewise >> >>--- >> gcc/passes.c | 9 +++++---- >> gcc/statistics.c | 4 ++-- >> gcc/statistics.h | 2 +- >> 3 files changed, 8 insertions(+), 7 deletions(-) >> >>diff --git a/gcc/passes.c b/gcc/passes.c >>index 04ff042..7d41bd8 100644 >>--- a/gcc/passes.c >>+++ b/gcc/passes.c >>@@ -1984,7 +1984,7 @@ execute_function_todo (function *fn, void *data) >> >> /* Perform all TODO actions. */ >> static void >>-execute_todo (unsigned int flags) >>+execute_todo (unsigned int flags, const char *pass_name=NULL) >> { >> #if defined ENABLE_CHECKING >> if (cfun >>@@ -1997,7 +1997,7 @@ execute_todo (unsigned int flags) >> /* Inform the pass whether it is the first time it is run. */ >> first_pass_instance = (flags & TODO_mark_first_instance) != 0; >> >>- statistics_fini_pass (); >>+ statistics_fini_pass (pass_name); >> >> if (flags) >> do_per_function (execute_function_todo, (void *)(size_t) flags); >>@@ -2302,7 +2302,7 @@ execute_one_pass (opt_pass *pass) >> pass_init_dump_file (pass); >> >> /* Run pre-pass verification. */ >>- execute_todo (pass->todo_flags_start); >>+ execute_todo (pass->todo_flags_start, pass->name); >> >> #ifdef ENABLE_CHECKING >> do_per_function (verify_curr_properties, >>@@ -2327,7 +2327,8 @@ execute_one_pass (opt_pass *pass) >> check_profile_consistency (pass->static_pass_number, 0, true); >> >> /* Run post-pass cleanup and verification. */ >>- execute_todo (todo_after | pass->todo_flags_finish | >>TODO_verify_il); >>+ execute_todo (todo_after | pass->todo_flags_finish | TODO_verify_il, >>+ pass->name); >> if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)) >> check_profile_consistency (pass->static_pass_number, 1, true); >> >>diff --git a/gcc/statistics.c b/gcc/statistics.c >>index 8cbe88d..54f81d5 100644 >>--- a/gcc/statistics.c >>+++ b/gcc/statistics.c >>@@ -192,7 +192,7 @@ statistics_fini_pass_3 (statistics_counter_t >>**slot, >> /* Dump the current statistics incrementally. */ >> >> void >>-statistics_fini_pass (void) >>+statistics_fini_pass (const char *pass_name) >> { >> if (current_pass->static_pass_number == -1) >> return; >>@@ -201,7 +201,7 @@ statistics_fini_pass (void) >> && dump_flags & TDF_STATS) >> { >> fprintf (dump_file, "\n"); >>- fprintf (dump_file, "Pass statistics:\n"); >>+ fprintf (dump_file, "Pass statistics of \"%s\":\n", pass_name); >> fprintf (dump_file, "----------------\n"); >> curr_statistics_hash () >> ->traverse_noresize <void *, statistics_fini_pass_1> (NULL); >>diff --git a/gcc/statistics.h b/gcc/statistics.h >>index 0b871ec..4348b7a 100644 >>--- a/gcc/statistics.h >>+++ b/gcc/statistics.h >>@@ -64,7 +64,7 @@ struct function; >> extern void statistics_early_init (void); >> extern void statistics_init (void); >> extern void statistics_fini (void); >>-extern void statistics_fini_pass (void); >>+extern void statistics_fini_pass (const char *pass_name = NULL); >>extern void statistics_counter_event (struct function *, const char *, >>int); >>extern void statistics_histogram_event (struct function *, const char >>*, int); >> > >