public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Print Pass Names
@ 2015-05-22 17:04 Aditya K
  2015-05-22 19:59 ` Richard Biener
  0 siblings, 1 reply; 7+ messages in thread
From: Aditya K @ 2015-05-22 17:04 UTC (permalink / raw)
  To: gcc-patches

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.

Thanks,
-Aditya


gcc/ChangeLog:
 
2015-05-22  Aditya Kumar  <hiraditya@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);
 
-- 
2.1.0.243.g30d45f7 		 	   		  

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-27 18:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-22 17:04 [PATCH] Print Pass Names Aditya K
2015-05-22 19:59 ` Richard Biener
2015-05-22 20:55   ` Aditya K
2015-05-22 21:09     ` Jeff Law
2015-05-26 14:51       ` Aditya K
2015-05-27 15:25         ` Jeff Law
2015-05-27 19:58           ` Aditya K

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).