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: [sched] Dump dependency graph to a dot file


On 11/05/2015 03:26 AM, Nikolai Bozhenov wrote:
On 11/05/2015 12:18 PM, Kyrill Tkachov wrote:
Hi Nikolai,

On 05/11/15 08:29, Nikolai Bozhenov wrote:
Hi!

The attached patch adds a procedure to dump the scheduler's dependency
graph into a dot file. The patch has been bootstrapped and regtested
on x86_64. Please commit if it is OK for trunk.

Thanks,
Nikolai

A couple of style nits.

+      // begin subgraph (basic block)
+      pp_printf (&pp, "subgraph cluster_block_%d {\n", bb);
+      pp_printf (&pp, "\t" "color=blue;" "\n");
+      pp_printf (&pp, "\t" "style=bold;" "\n");
+      pp_printf (&pp, "\t" "label=\"BB #%d\";\n", BB_TO_BLOCK (bb));
+
+      // setup head and tail (no support for EBBs)
+      gcc_assert (EBB_FIRST_BB (bb) == EBB_LAST_BB (bb));
+      get_ebb_head_tail (EBB_FIRST_BB (bb), EBB_LAST_BB (bb), &head,
&tail);
+      tail = NEXT_INSN (tail);
+
+      // dump all insns
+      for (con = head; con != tail; con = NEXT_INSN (con))
+    {
+      if (!INSN_P (con))
+        continue;
+
+      // pretty print the insn
+      pp_printf (&pp, "\t%d [label=\"{", INSN_UID (con));

Please use C-style comments i.e. /**/ instead of //.
Also, throughout the comments leave two empty spaces after a full stop
i.e. /* <text>.  */.

You can use the check_GNU_style.sh script in the contrib/ directory on
your patches to highlight similar issues. For example:
$ ./contrib/check_GNU_style.sh ~/patches/dep-graph.patch

Dot, space, space, end of comment.
83:+/* Dump dependency graph for the current region to a file using
dot syntax. */
166:+/* Dump dependency graph for the current region to a file using
dot syntax. */

Sentences should end with a dot.  Dot, space, space, end of the comment.
127:+      /* dump all deps */

Cheers,
Kyrill


Thanks for your remarks, Kyrill!

I've uploaded an updated patch.

Nikolai

dep-graph.patch


2015-11-04  Nikolai Bozhenov<n.bozhenov@samsung.com>

	* sched-int.h (dump_rgn_dependencies_dot): Declare
	* sched-rgn.c (dump_rgn_dependencies_dot): New function
	* print-rtl.h (print_insn): Add prototype
I was briefly worried about using the DOT format here. There was a time when GraphViz was considered by the FSF to be non-free and thus using the DOT format was verboten. That thankfully changed way back in 2005 :-)

With that out of the way, this patch is fine for the trunk.  Please install.

Thanks,
Jeff


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