This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Name unnamed passes and change duplicate pass names


Thanks again for looking at this.

> what if you call those passes like "*all_optimizations" and just write
>
>      if (pass->name[0] != '*')

That makes sense.  It avoids adding a slightly awkward TODO flag.  I
think there should be some documentation for the *name feature then.
I'll add that in if someone can point me to the best place to put it.

So here's a patch that uses *names to disable dump files.  I've got
two other revised patches to take care of giving passes names that
I'll include in two other e-mails.

2009-05-16 Justin Seyster <jrseys@gmail.com>

gcc/
	* passes.c (register_dump_files_1, next_pass_1): Check for a
	leading * in a pass name to determine if it needs a dump
	file (instead of checking if the name is non-NULL).
	(execute_one_pass): Remove special case for NULL pass->name.
	* statistics.c (curr_statistics_hash): Added assert to make sure
	that a negative static_pasS_number never gets implicitly cast to
	an unsigned int.

Index: gcc/passes.c
===================================================================
--- gcc/passes.c	(revision 147136)
+++ gcc/passes.c	(working copy)
@@ -406,7 +406,7 @@
       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)
@@ -459,7 +459,7 @@
          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)
+      if (pass->name[0] != '*')
         {
           pass->static_pass_number -= 1;
           new_pass->static_pass_number = -pass->static_pass_number;
@@ -1262,7 +1262,7 @@
     return false;

   if (!quiet_flag && !cfun)
-    fprintf (stderr, " <%s>", pass->name ? pass->name : "");
+    fprintf (stderr, " <%s>", pass->name);

   if (pass->todo_flags_start & TODO_set_props)
     cfun->curr_properties = pass->properties_required;
Index: gcc/statistics.c
===================================================================
--- gcc/statistics.c	(revision 147136)
+++ gcc/statistics.c	(working copy)
@@ -82,8 +82,11 @@
 static htab_t
 curr_statistics_hash (void)
 {
-  unsigned idx = current_pass->static_pass_number;
+  unsigned idx;

+  gcc_assert (current_pass->static_pass_number > 0);
+  idx = current_pass->static_pass_number;
+
   if (idx < nr_statistics_hashes
       && statistics_hashes[idx] != NULL)
     return statistics_hashes[idx];


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]