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)
#ifndef GCC_INTERNAL_FN_H
#define GCC_INTERNAL_FN_H
-/* INTEGER_CST values for IFN_UNIQUE function arg-0. */
+/* INTEGER_CST values for IFN_UNIQUE function arg-0.
+
+ UNSPEC: Undifferentiated UNIQUE.
+
+ FORK and JOIN mark the points at which OpenACC partitioned
+ execution is entered or exited.
+ DEP_VAR = UNIQUE ({FORK,JOIN}, DEP_VAR, AXIS)
+
+ HEAD_MARK and TAIL_MARK are used to demark the sequence entering
+ or leaving partitioned execution.
+ 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 {
- IFN_UNIQUE_UNSPEC, /* Undifferentiated UNIQUE. */
-
- /* 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,
-
- /* 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
+#define DEF(X) IFN_UNIQUE_##X
+ IFN_UNIQUE_CODES
+#undef DEF
};
/* INTEGER_CST values for IFN_GOACC_LOOP arg-0. Allows the precise
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
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. */