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
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  <t...@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 via email to