public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, stage1] Make function names visible in -fdump-rtl-*-graph
@ 2015-03-13  7:25 Thomas Preud'homme
  2015-03-13  9:01 ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Preud'homme @ 2015-03-13  7:25 UTC (permalink / raw)
  To: gcc-patches, 'Richard Biener'

Hi,

The description is longer than the patch so you might want to skip directly to it.

The dot file generated by -fdump-rtl-*-graph switches group basic blocks for a given function together in a subgraph and use the function name as the label. However, when generating an image (for instance a svg with "dot -Tsvg") the label does not appear. This makes analyzing the resulting file more difficult than it should be.

The section "Subgraphs and clusters" of "The DOT language" document contains the following excerpt:
 
"The third role for subgraphs directly involves how the graph will be laid out by certain layout engines. If the name of the subgraph begins with cluster, Graphviz notes the subgraph as a special cluster subgraph. If supported, the layout engine will do the layout so that the nodes belonging to the cluster are drawn together, with the entire drawing of the cluster contained within a bounding rectangle. Note that, for good and bad, cluster subgraphs are not part of the DOT language, but solely a syntactic convention adhered to by certain of the layout engines."

Hence prepending cluster_ to subgraph id (not its label) would improve the output image with many layout engines while no doing any difference for other layout engines. The patch also make the subgraph boudary visible with dashed lines and add "()" to the label of the subgraph (so for a function f the label would be "f ()").

ChangeLog entry is as follows:

*** gcc/ChangeLog ***

2015-03-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * graph.c (print_graph_cfg): Make function names visible and append
        parenthesis to it.  Also make groups of basic blocks belonging to the
        same function visible.


diff --git a/gcc/graph.c b/gcc/graph.c
index a1eb24c..5fb0d78 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -292,9 +292,10 @@ print_graph_cfg (const char *base, struct function *fun)
   pretty_printer graph_slim_pp;
   graph_slim_pp.buffer->stream = fp;
   pretty_printer *const pp = &graph_slim_pp;
-  pp_printf (pp, "subgraph \"%s\" {\n"
-	         "\tcolor=\"black\";\n"
-		 "\tlabel=\"%s\";\n",
+  pp_printf (pp, "subgraph \"cluster_%s\" {\n"
+		 "\tstyle=\"dashed\";\n"
+		 "\tcolor=\"black\";\n"
+		 "\tlabel=\"%s ()\";\n",
 		 funcname, funcname);
   draw_cfg_nodes (pp, fun);
   draw_cfg_edges (pp, fun);

Is this ok for stage1? It's not a bug but it helps debuggability so is this something we might consider backporting?

Best regards,

Thomas



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, stage1] Make function names visible in -fdump-rtl-*-graph
  2015-03-13  7:25 [PATCH, stage1] Make function names visible in -fdump-rtl-*-graph Thomas Preud'homme
@ 2015-03-13  9:01 ` Richard Biener
  2015-03-13  9:46   ` Thomas Preud'homme
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2015-03-13  9:01 UTC (permalink / raw)
  To: Thomas Preud'homme; +Cc: gcc-patches

On Fri, 13 Mar 2015, Thomas Preud'homme wrote:

> Hi,
> 
> The description is longer than the patch so you might want to skip directly to it.
> 
> The dot file generated by -fdump-rtl-*-graph switches group basic blocks for a given function together in a subgraph and use the function name as the label. However, when generating an image (for instance a svg with "dot -Tsvg") the label does not appear. This makes analyzing the resulting file more difficult than it should be.
> 
> The section "Subgraphs and clusters" of "The DOT language" document contains the following excerpt:
>  
> "The third role for subgraphs directly involves how the graph will be laid out by certain layout engines. If the name of the subgraph begins with cluster, Graphviz notes the subgraph as a special cluster subgraph. If supported, the layout engine will do the layout so that the nodes belonging to the cluster are drawn together, with the entire drawing of the cluster contained within a bounding rectangle. Note that, for good and bad, cluster subgraphs are not part of the DOT language, but solely a syntactic convention adhered to by certain of the layout engines."
> 
> Hence prepending cluster_ to subgraph id (not its label) would improve the output image with many layout engines while no doing any difference for other layout engines. The patch also make the subgraph boudary visible with dashed lines and add "()" to the label of the subgraph (so for a function f the label would be "f ()").
> 
> ChangeLog entry is as follows:
> 
> *** gcc/ChangeLog ***
> 
> 2015-03-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * graph.c (print_graph_cfg): Make function names visible and append
>         parenthesis to it.  Also make groups of basic blocks belonging to the
>         same function visible.
> 
> 
> diff --git a/gcc/graph.c b/gcc/graph.c
> index a1eb24c..5fb0d78 100644
> --- a/gcc/graph.c
> +++ b/gcc/graph.c
> @@ -292,9 +292,10 @@ print_graph_cfg (const char *base, struct function *fun)
>    pretty_printer graph_slim_pp;
>    graph_slim_pp.buffer->stream = fp;
>    pretty_printer *const pp = &graph_slim_pp;
> -  pp_printf (pp, "subgraph \"%s\" {\n"
> -	         "\tcolor=\"black\";\n"
> -		 "\tlabel=\"%s\";\n",
> +  pp_printf (pp, "subgraph \"cluster_%s\" {\n"
> +		 "\tstyle=\"dashed\";\n"
> +		 "\tcolor=\"black\";\n"
> +		 "\tlabel=\"%s ()\";\n",
>  		 funcname, funcname);
>    draw_cfg_nodes (pp, fun);
>    draw_cfg_edges (pp, fun);
> 
> Is this ok for stage1? It's not a bug but it helps debuggability so is 
> this something we might consider backporting?

It's ok now given you bootstrapped the change.

Thanks,
Richard.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH, stage1] Make function names visible in -fdump-rtl-*-graph
  2015-03-13  9:01 ` Richard Biener
@ 2015-03-13  9:46   ` Thomas Preud'homme
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Preud'homme @ 2015-03-13  9:46 UTC (permalink / raw)
  To: 'Richard Biener'; +Cc: gcc-patches

> From: Richard Biener [mailto:rguenther@suse.de]
> Sent: Friday, March 13, 2015 5:02 PM
> >
> > Is this ok for stage1? It's not a bug but it helps debuggability so is
> > this something we might consider backporting?
> 
> It's ok now given you bootstrapped the change.

I did + regression testsuite on both arm-none-eabi and
x86_64-linux-gnu. I forgot to mentioned it sorry.

I just committed it.

Best regards,

Thomas




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-13  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13  7:25 [PATCH, stage1] Make function names visible in -fdump-rtl-*-graph Thomas Preud'homme
2015-03-13  9:01 ` Richard Biener
2015-03-13  9:46   ` Thomas Preud'homme

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).