public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Dennis, CHENG Renquan" <crquan@fedoraproject.org>
To: gcc-patches@gcc.gnu.org
Cc: "Dennis, CHENG Renquan" <crquan@fedoraproject.org>
Subject: [PATCH] passes.c: handle register_pass with a name starting with a star
Date: Sun, 11 Jul 2010 15:34:00 -0000	[thread overview]
Message-ID: <1278862389-24851-1-git-send-email-crquan@fedoraproject.org> (raw)
In-Reply-To: <1278820035-18384-2-git-send-email-crquan@gmail.com>

The gcc included passes have the feature that a name starting with a start do
not dump anything; so should the plugin registered passes have.

And since passes from gcc and from plugin both have been asserted having a name
at least; the check for pass->name in any following code is not necessary.

Bootstraped and tested on i686-pc-linux-gnu with "--enable-checking=all".

2010-07-10  "Dennis, CHENG Renquan" <crquan@fedoraproject.org>

	* passes.c (register_pass): handle plugin registered passes with
	a name starting with a star do not dump anything.
	* passes.c: remove some cases of pass->name check.

---
Updated: "enum tree_dump_index tdi" should be put inside the block.

--- gcc-4.5-20100708/gcc/passes.c.orig	2010-05-19 21:14:37.000000000 +0800
+++ gcc-4.5-20100708/gcc/passes.c	2010-07-11 17:33:07.098787669 +0800
@@ -422,7 +422,7 @@ register_dump_files_1 (struct opt_pass *
       int new_properties = (properties | pass->properties_provided)
 			   & ~pass->properties_destroyed;
 
-      if (pass->name && pass->name[0] != '*')
+      if (pass->name[0] != '*')
         register_one_dump_file (pass);
 
       if (pass->sub)
@@ -488,7 +488,7 @@ make_pass_instance (struct opt_pass *pas
          and so it should rename the dump file.  The first instance will
          be -1, and be number of duplicates = -static_pass_number - 1.
          Subsequent instances will be > 0 and just the duplicate number.  */
-      if ((pass->name && pass->name[0] != '*') || track_duplicates)
+      if ((pass->name[0] != '*') || track_duplicates)
         {
           pass->static_pass_number -= 1;
           new_pass->static_pass_number = -pass->static_pass_number;
@@ -553,7 +553,6 @@ position_pass (struct register_pass_info
       /* Check if the current pass is of the same type as the new pass and
          matches the name and the instance number of the reference pass.  */
       if (pass->type == new_pass_info->pass->type
-          && pass->name
           && !strcmp (pass->name, new_pass_info->reference_pass_name)
           && ((new_pass_info->ref_pass_instance_number == 0)
               || (new_pass_info->ref_pass_instance_number ==
@@ -678,19 +677,24 @@ register_pass (struct register_pass_info
   while (added_pass_nodes)
     {
       struct pass_list_node *next_node = added_pass_nodes->next;
-      enum tree_dump_index tdi;
-      register_one_dump_file (added_pass_nodes->pass);
-      if (added_pass_nodes->pass->type == SIMPLE_IPA_PASS
-          || added_pass_nodes->pass->type == IPA_PASS)
-        tdi = TDI_ipa_all;
-      else if (added_pass_nodes->pass->type == GIMPLE_PASS)
-        tdi = TDI_tree_all;
-      else
-        tdi = TDI_rtl_all;
-      /* Check if dump-all flag is specified.  */
-      if (get_dump_file_info (tdi)->state)
-        get_dump_file_info (added_pass_nodes->pass->static_pass_number)
-            ->state = get_dump_file_info (tdi)->state;
+
+      if (added_pass_nodes->pass->name[0] != '*')
+	{
+	  enum tree_dump_index tdi;
+
+	  register_one_dump_file (added_pass_nodes->pass);
+	  if (added_pass_nodes->pass->type == SIMPLE_IPA_PASS
+	      || added_pass_nodes->pass->type == IPA_PASS)
+	    tdi = TDI_ipa_all;
+	  else if (added_pass_nodes->pass->type == GIMPLE_PASS)
+	    tdi = TDI_tree_all;
+	  else
+	    tdi = TDI_rtl_all;
+	  /* Check if dump-all flag is specified.  */
+	  if (get_dump_file_info (tdi)->state)
+	    get_dump_file_info (added_pass_nodes->pass->static_pass_number)
+	      ->state = get_dump_file_info (tdi)->state;
+    	}
       XDELETE (added_pass_nodes);
       added_pass_nodes = next_node;
     }
@@ -1542,7 +1546,7 @@ execute_one_pass (struct opt_pass *pass)
   invoke_plugin_callbacks (PLUGIN_PASS_EXECUTION, pass);
 
   if (!quiet_flag && !cfun)
-    fprintf (stderr, " <%s>", pass->name ? pass->name : "");
+    fprintf (stderr, " <%s>", pass->name);
 
   /* Note that the folders should only create gimple expressions.
      This is a hack until the new folder is ready.  */

--
Git 1.7.1.1

CHENG Renquan
38 St Thomas Walk, Singapore 238118      http://crquan.fedorapeople.org

  parent reply	other threads:[~2010-07-11 15:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-11  3:47 [PATCH] passes.texi: fill crossref nodes (GCC Internals) crquan
2010-07-11  3:48 ` [PATCH] passes.c: handle register_pass with a name starting with a star crquan
2010-07-11  4:12   ` Dennis, CHENG Renquan
2010-07-11 15:34   ` Dennis, CHENG Renquan [this message]
2010-07-11 16:08     ` Andreas Schwab
2010-07-11 17:04       ` Dennis, CHENG Renquan
2010-07-11 17:40         ` Basile Starynkevitch
2010-07-11 18:14           ` Dennis, CHENG Renquan
2010-07-11 18:17           ` Dennis, CHENG Renquan
2010-07-20 10:21             ` Dennis, CHENG Renquan
2011-04-18 21:35 ` [PATCH] passes.texi: fill crossref nodes (GCC Internals) Gerald Pfeifer

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=1278862389-24851-1-git-send-email-crquan@fedoraproject.org \
    --to=crquan@fedoraproject.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).