Commit 4d58c533 by Nathan Sidwell Committed by Nathan Sidwell

internal-fn.h (IFN_UNIQUE_CODES, [...]): New.

	* internal-fn.h (IFN_UNIQUE_CODES, IFN_GOACC_LOOP_CODES,
	IFN_GOACC_REDUCTION_CODES): New.
	(enum ifn_unique_kind, enum ifn_goacc_loop_kind, enum
	ifn_goacc_reduction_kind): Use them.
	* gimple-pretty-print.c (dump_gimple_call_args): Decode first arg
	of internal functions, when applicable.

From-SVN: r240552
parent 20fba714
2016-09-27 Nathan Sidwell <nathan@codesourcery.com>
* internal-fn.h (IFN_UNIQUE_CODES, IFN_GOACC_LOOP_CODES,
IFN_GOACC_REDUCTION_CODES): New.
(enum ifn_unique_kind, enum ifn_goacc_loop_kind, enum
ifn_goacc_reduction_kind): Use them.
* gimple-pretty-print.c (dump_gimple_call_args): Decode first arg
of internal functions, when applicable.
2016-09-27 Maciej W. Rozycki <macro@imgtec.com>
* config/mips/constraints.md (d): Fix documentation.
......
......@@ -599,9 +599,63 @@ dump_gimple_return (pretty_printer *buffer, greturn *gs, int spc, int flags)
static void
dump_gimple_call_args (pretty_printer *buffer, gcall *gs, int flags)
{
size_t i;
size_t i = 0;
/* Pretty print first arg to certain internal fns. */
if (gimple_call_internal_p (gs))
{
const char *const *enums = NULL;
unsigned limit = 0;
switch (gimple_call_internal_fn (gs))
{
case IFN_UNIQUE:
#define DEF(X) #X
static const char *const unique_args[] = {IFN_UNIQUE_CODES};
#undef DEF
enums = unique_args;
limit = ARRAY_SIZE (unique_args);
break;
case IFN_GOACC_LOOP:
#define DEF(X) #X
static const char *const loop_args[] = {IFN_GOACC_LOOP_CODES};
#undef DEF
enums = loop_args;
limit = ARRAY_SIZE (loop_args);
break;
case IFN_GOACC_REDUCTION:
#define DEF(X) #X
static const char *const reduction_args[]
= {IFN_GOACC_REDUCTION_CODES};
#undef DEF
enums = reduction_args;
limit = ARRAY_SIZE (reduction_args);
break;
default:
break;
}
if (limit)
{
tree arg0 = gimple_call_arg (gs, 0);
HOST_WIDE_INT v;
if (TREE_CODE (arg0) == INTEGER_CST
&& tree_fits_shwi_p (arg0)
&& (v = tree_to_shwi (arg0)) >= 0 && v < limit)
{
i++;
pp_string (buffer, enums[v]);
if (i < gimple_call_num_args (gs))
pp_string (buffer, ", ");
}
}
}
for (i = 0; i < gimple_call_num_args (gs); i++)
for (; i < gimple_call_num_args (gs); i++)
{
dump_generic_node (buffer, gimple_call_arg (gs, i), 0, flags, false);
if (i < gimple_call_num_args (gs) - 1)
......
......@@ -20,26 +20,28 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_INTERNAL_FN_H
#define GCC_INTERNAL_FN_H
/* INTEGER_CST values for IFN_UNIQUE function arg-0. */
enum ifn_unique_kind {
IFN_UNIQUE_UNSPEC, /* Undifferentiated UNIQUE. */
/* INTEGER_CST values for IFN_UNIQUE function arg-0.
UNSPEC: Undifferentiated UNIQUE.
/* FORK and JOIN mark the points at which OpenACC partitioned
FORK and JOIN mark the points at which OpenACC partitioned
execution is entered or exited.
return: data dependency value
arg-1: data dependency var
arg-2: INTEGER_CST argument, indicating the axis. */
IFN_UNIQUE_OACC_FORK,
IFN_UNIQUE_OACC_JOIN,
DEP_VAR = UNIQUE ({FORK,JOIN}, DEP_VAR, AXIS)
/* HEAD_MARK and TAIL_MARK are used to demark the sequence entering
HEAD_MARK and TAIL_MARK are used to demark the sequence entering
or leaving partitioned execution.
return: data dependency value
arg-1: data dependency var
arg-2: INTEGER_CST argument, remaining markers in this sequence
arg-3...: varargs on primary header */
IFN_UNIQUE_OACC_HEAD_MARK,
IFN_UNIQUE_OACC_TAIL_MARK
DEP_VAR = UNIQUE ({HEAD,TAIL}_MARK, REMAINING_MARKS, ...PRIMARY_FLAGS)
The PRIMARY_FLAGS only occur on the first HEAD_MARK of a sequence. */
#define IFN_UNIQUE_CODES \
DEF(UNSPEC), \
DEF(OACC_FORK), DEF(OACC_JOIN), \
DEF(OACC_HEAD_MARK), DEF(OACC_TAIL_MARK)
enum ifn_unique_kind {
#define DEF(X) IFN_UNIQUE_##X
IFN_UNIQUE_CODES
#undef DEF
};
/* INTEGER_CST values for IFN_GOACC_LOOP arg-0. Allows the precise
......@@ -59,11 +61,12 @@ enum ifn_unique_kind {
CHUNK_NO - chunk number
MASK - partitioning mask. */
#define IFN_GOACC_LOOP_CODES \
DEF(CHUNKS), DEF(STEP), DEF(OFFSET), DEF(BOUND)
enum ifn_goacc_loop_kind {
IFN_GOACC_LOOP_CHUNKS, /* Number of chunks. */
IFN_GOACC_LOOP_STEP, /* Size of each thread's step. */
IFN_GOACC_LOOP_OFFSET, /* Initial iteration value. */
IFN_GOACC_LOOP_BOUND /* Limit of iteration value. */
#define DEF(X) IFN_GOACC_LOOP_##X
IFN_GOACC_LOOP_CODES
#undef DEF
};
/* The GOACC_REDUCTION function defines a generic interface to support
......@@ -81,11 +84,12 @@ enum ifn_goacc_loop_kind {
In general the return value is LOCAL_VAR, which creates a data
dependency between calls operating on the same reduction. */
#define IFN_GOACC_REDUCTION_CODES \
DEF(SETUP), DEF(INIT), DEF(FINI), DEF(TEARDOWN)
enum ifn_goacc_reduction_kind {
IFN_GOACC_REDUCTION_SETUP,
IFN_GOACC_REDUCTION_INIT,
IFN_GOACC_REDUCTION_FINI,
IFN_GOACC_REDUCTION_TEARDOWN
#define DEF(X) IFN_GOACC_REDUCTION_##X
IFN_GOACC_REDUCTION_CODES
#undef DEF
};
/* Initialize internal function tables. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment