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]

[PATCH] Fix -dv


On Thu, Aug 11, 2005 at 04:33:19AM -0400, Jakub Jelinek wrote:
> If -dXv is used where X != a (i.e. vcg graphs requested, but not
> all dump files enabled), GCC ICEs in cleanup_graph_dump_file, as
> that function is called even for passes where the dump was not enabled.
> Ok for HEAD/4.0?  This is a regression from 3.4.x.
> 
> There is another problem, with GCC 4+ print_rtl_graph_with_bb
> is never called when -dv is requested, so all the vcg files contain just:
> graph: {
> port_sharing: no
> }

The following patch which obsoletes the previous one not only fixes the ICE,
but also emits the *.vcg graphs.  Ok for HEAD/4.0?

2005-08-11  Jakub Jelinek  <jakub@redhat.com>

	* tree-pass.h (TDF_GRAPH): Define.
	* tree-dump.c (dump_options): Don't set TDF_GRAPH in "all".
	* passes.c (finish_optimization_passes): Only call
	finish_graph_dump_file if TDF_GRAPH is set.
	(execute_one_pass): Only call clean_graph_dump_file if dump_file !=
	NULL.  Set TDF_GRAPH bit.  If TDF_GRAPH Is set, call
	print_rtl_graph_with_bb at the end of the pass.

--- gcc/tree-pass.h.jj	2005-08-06 10:40:01.000000000 +0200
+++ gcc/tree-pass.h	2005-08-11 11:10:30.000000000 +0200
@@ -67,6 +67,8 @@ enum tree_dump_index
 #define TDF_IPA		(1 << 11)	/* is an IPA dump */
 #define TDF_STMTADDR	(1 << 12)	/* Address of stmt.  */
 
+#define TDF_GRAPH	(1 << 13)	/* a graph dump is being emitted */
+
 extern char *get_dump_file_name (enum tree_dump_index);
 extern int dump_enabled_p (enum tree_dump_index);
 extern int dump_initialized_p (enum tree_dump_index);
--- gcc/tree-dump.c.jj	2005-08-06 10:40:00.000000000 +0200
+++ gcc/tree-dump.c	2005-08-11 11:11:35.000000000 +0200
@@ -752,7 +752,7 @@ static const struct dump_option_value_in
   {"uid", TDF_UID},
   {"stmtaddr", TDF_STMTADDR},
   {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA 
-	    | TDF_STMTADDR)},
+	    | TDF_STMTADDR | TDF_GRAPH)},
   {NULL, 0}
 };
 
--- gcc/passes.c.jj	2005-08-06 10:39:59.000000000 +0200
+++ gcc/passes.c	2005-08-11 11:15:01.000000000 +0200
@@ -237,12 +237,12 @@ finish_optimization_passes (void)
   if (graph_dump_format != no_graph)
     for (i = TDI_end; (dfi = get_dump_file_info (i)) != NULL; ++i)
       if (dump_initialized_p (i)
-	  && (dfi->flags & TDF_RTL) != 0
+	  && (dfi->flags & TDF_GRAPH) != 0
 	  && (name = get_dump_file_name (i)) != NULL)
-        {
-          finish_graph_dump_file (name);
-          free (name);
-        }
+	{
+	  finish_graph_dump_file (name);
+	  free (name);
+	}
 
   timevar_pop (TV_DUMP);
 }
@@ -782,10 +782,14 @@ execute_one_pass (struct tree_opt_pass *
 	}
 
       if (initializing_dump
-          && graph_dump_format != no_graph
+	  && dump_file
+	  && graph_dump_format != no_graph
 	  && (pass->properties_provided & (PROP_cfg | PROP_rtl))
 	      == (PROP_cfg | PROP_rtl))
-        clean_graph_dump_file (dump_file_name);
+	{
+	  get_dump_file_info (pass->static_pass_number)->flags |= TDF_GRAPH;
+	  clean_graph_dump_file (dump_file_name);
+	}
     }
 
   /* If a timevar is present, start it.  */
@@ -809,6 +813,14 @@ execute_one_pass (struct tree_opt_pass *
   /* Flush and close dump file.  */
   if (dump_file_name)
     {
+      struct dump_file_info *dfi
+	= get_dump_file_info (pass->static_pass_number);
+      if (graph_dump_format != no_graph
+	  && (pass->properties_provided & (PROP_cfg | PROP_rtl))
+	     == (PROP_cfg | PROP_rtl)
+	  && (dfi->flags & TDF_GRAPH))
+	print_rtl_graph_with_bb (dump_file_name, get_insns ());
+
       free ((char *) dump_file_name);
       dump_file_name = NULL;
     }


	Jakub


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