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]

[RFA] Jump threading stats


Jeff, does this do what I mean it to do?


Thanks.  Diego.


	* tree-ssa-threadupdate.c (struct thread_stats_d): Declare.
	(thread_stats): New local variable.
	(thread_block): Increment count of threaded edges.
	(thread_through_all_blocks): Initialize thread_stats.
	Display number of threaded jumps if TDF_STATS is enabled.


Index: tree-ssa-threadupdate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-threadupdate.c,v
retrieving revision 2.29
diff -d -u -p -r2.29 tree-ssa-threadupdate.c
--- tree-ssa-threadupdate.c	1 Jun 2005 02:51:05 -0000	2.29
+++ tree-ssa-threadupdate.c	6 Jun 2005 14:27:17 -0000
@@ -147,6 +147,16 @@ struct local_info
   bool jumps_threaded;
 };
 
+/* Jump threading statistics.  */
+
+struct thread_stats_d
+{
+  unsigned long num_threaded_edges;
+};
+
+struct thread_stats_d thread_stats;
+
+
 /* Remove the last statement in block BB if it is a control statement
    Also remove all outgoing edges except the edge which reaches DEST_BB.
    If DEST_BB is NULL, then remove all outgoing edges.  */
@@ -737,6 +747,7 @@ thread_block (basic_block bb)
 	  /* Insert the outgoing edge into the hash table if it is not
 	     already in the hash table.  */
 	  lookup_redirection_data (e2, e, INSERT);
+	  thread_stats.num_threaded_edges++;
 	}
     }
 
@@ -811,6 +822,7 @@ thread_through_all_blocks (bitmap thread
   bitmap_iterator bi;
 
   rediscover_loops_after_threading = false;
+  memset (&thread_stats, 0, sizeof (thread_stats));
 
   EXECUTE_IF_SET_IN_BITMAP (threaded_blocks, 0, i, bi)
     {
@@ -820,5 +832,9 @@ thread_through_all_blocks (bitmap thread
 	retval |= thread_block (bb);
     }
 
+  if (dump_file && (dump_flags & TDF_STATS))
+    fprintf (dump_file, "\nJumps threaded: %lu\n",
+	     thread_stats.num_threaded_edges);
+
   return retval;
 }


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