public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] Pretty-print GOACC_REDUCTION arguments
Date: Mon, 25 Sep 2017 14:58:00 -0000	[thread overview]
Message-ID: <b0855102-fb3e-ba64-a4a5-1f058fb7a38e@mentor.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 340 bytes --]

Hi,

currently for a GOACC_REDUCTION internal fn call we print:
...
   sum_5 = GOACC_REDUCTION (SETUP, _3, 0, 0, 67, 0);
...

This patch adds a comment for some arguments explaining the meaning of 
the argument:
...
       sum_5 = GOACC_REDUCTION (SETUP, _3, 0, 0 /*gang*/, 67 /*+*/, 0);
...

OK for trunk, if testing is ok?

Thanks,
- Tom

[-- Attachment #2: 0001-Pretty-print-GOACC_REDUCTION-arguments.patch --]
[-- Type: text/x-patch, Size: 1902 bytes --]

Pretty-print GOACC_REDUCTION arguments

Prints
  sum_5 = GOACC_REDUCTION (SETUP, _3, 0, 0 /*gang*/, 67 /*+*/, 0);
instead of
  sum_5 = GOACC_REDUCTION (SETUP, _3, 0, 0, 67, 0);

2017-09-25  Tom de Vries  <tom@codesourcery.com>

	* gimple-pretty-print.c (dump_gimple_call_args): Pretty-print
	GOACC_REDUCTION arguments.

---
 gcc/gimple-pretty-print.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index ed8e51c..61efd93 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -41,6 +41,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "stringpool.h"
 #include "attribs.h"
 #include "asan.h"
+#include "gomp-constants.h"
 
 #define INDENT(SPACE)							\
   do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
@@ -765,6 +766,40 @@ dump_gimple_call_args (pretty_printer *buffer, gcall *gs, dump_flags_t flags)
       if (i)
 	pp_string (buffer, ", ");
       dump_generic_node (buffer, gimple_call_arg (gs, i), 0, flags, false);
+
+      if (gimple_call_internal_p (gs))
+	switch (gimple_call_internal_fn (gs))
+	  {
+	  case IFN_GOACC_REDUCTION:
+	    switch (i)
+	      {
+	      case 3:
+		switch (tree_to_uhwi (gimple_call_arg (gs, i)))
+		  {
+		  case GOMP_DIM_GANG:
+		    pp_string (buffer, " /*gang*/");
+		    break;
+		  case GOMP_DIM_WORKER:
+		    pp_string (buffer, " /*worker*/");
+		    break;
+		  case GOMP_DIM_VECTOR:
+		    pp_string (buffer, " /*vector*/");
+		    break;
+		  default:
+		    gcc_unreachable ();
+		  }
+		break;
+	      case 4:
+		{
+		  enum tree_code rcode
+		    = (enum tree_code)tree_to_uhwi (gimple_call_arg (gs, i));
+		  pp_string (buffer, " /*");
+		  pp_string (buffer, op_symbol_code (rcode));
+		  pp_string (buffer, "*/");
+		}
+		break;
+	      }
+	  }
     }
 
   if (gimple_call_va_arg_pack_p (gs))

             reply	other threads:[~2017-09-25 14:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 14:58 Tom de Vries [this message]
2017-09-27 13:47 ` Thomas Schwinge
2017-10-03  8:57   ` Tom de Vries
2017-10-04 15:01     ` Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b0855102-fb3e-ba64-a4a5-1f058fb7a38e@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).