public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aditya K <hiraditya@msn.com>
To: Richard Biener <richard.guenther@gmail.com>,
	"gcc-patches@gcc.gnu.org"	<gcc-patches@gcc.gnu.org>
Subject: RE: [PATCH] Print Pass Names
Date: Fri, 22 May 2015 20:55:00 -0000	[thread overview]
Message-ID: <BLU179-W7997D32E9FCECE75E1EA26B6C00@phx.gbl> (raw)
In-Reply-To: <F9B29F05-F2B1-4100-A37F-69F8026717C6@gmail.com>



----------------------------------------
> Subject: Re: [PATCH] Print Pass Names
> From: richard.guenther@gmail.com
> Date: Fri, 22 May 2015 21:32:24 +0200
> To: hiraditya@msn.com; gcc-patches@gcc.gnu.org
>
> On May 22, 2015 6:32:38 PM GMT+02:00, Aditya K <hiraditya@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  <hiraditya@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 <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);
>>
>
>
 		 	   		  

  reply	other threads:[~2015-05-22 20:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22 17:04 Aditya K
2015-05-22 19:59 ` Richard Biener
2015-05-22 20:55   ` Aditya K [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BLU179-W7997D32E9FCECE75E1EA26B6C00@phx.gbl \
    --to=hiraditya@msn.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).