@@ -391,6 +391,9 @@ enum omp_clause_code {
/* OpenMP clause: hint (integer-expression). */
OMP_CLAUSE_HINT,
+ /* OpenMP clause: defaultmap (tofrom: scalar). */
+ OMP_CLAUSE_DEFAULTMAP,
+
/* Internally used only clause, holding SIMD uid. */
OMP_CLAUSE__SIMDUID_,
@@ -343,6 +343,7 @@ unsigned const char omp_clause_num_ops[]
0, /* OMP_CLAUSE_THREADS */
0, /* OMP_CLAUSE_SIMD */
1, /* OMP_CLAUSE_HINT */
+ 0, /* OMP_CLAUSE_DEFALTMAP */
1, /* OMP_CLAUSE__SIMDUID_ */
1, /* OMP_CLAUSE__CILK_FOR_COUNT_ */
0, /* OMP_CLAUSE_INDEPENDENT */
@@ -409,6 +410,7 @@ const char * const omp_clause_code_name[
"threads",
"simd",
"hint",
+ "defaultmap",
"_simduid_",
"_Cilk_for_count_",
"independent",
@@ -11405,6 +11407,7 @@ walk_tree_1 (tree *tp, walk_tree_fn func
case OMP_CLAUSE_NOGROUP:
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
+ case OMP_CLAUSE_DEFAULTMAP:
case OMP_CLAUSE_AUTO:
case OMP_CLAUSE_SEQ:
WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
@@ -1202,6 +1202,7 @@ convert_nonlocal_omp_clauses (tree *pcla
case OMP_CLAUSE_NOGROUP:
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
+ case OMP_CLAUSE_DEFAULTMAP:
break;
default:
@@ -1854,6 +1855,7 @@ convert_local_omp_clauses (tree *pclause
case OMP_CLAUSE_NOGROUP:
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
+ case OMP_CLAUSE_DEFAULTMAP:
break;
default:
@@ -733,6 +733,10 @@ dump_omp_clause (pretty_printer *pp, tre
pp_right_paren (pp);
break;
+ case OMP_CLAUSE_DEFAULTMAP:
+ pp_string (pp, "defaultmap(tofrom:scalar)");
+ break;
+
case OMP_CLAUSE__SIMDUID_:
pp_string (pp, "_simduid_(");
dump_generic_node (pp, OMP_CLAUSE__SIMDUID__DECL (clause),
@@ -6606,6 +6606,7 @@ gimplify_scan_omp_clauses (tree *list_p,
case OMP_CLAUSE_NOGROUP:
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
+ case OMP_CLAUSE_DEFAULTMAP:
break;
case OMP_CLAUSE_ALIGNED:
@@ -6965,6 +6966,7 @@ gimplify_adjust_omp_clauses (gimple_seq
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
case OMP_CLAUSE_HINT:
+ case OMP_CLAUSE_DEFAULTMAP:
case OMP_CLAUSE__CILK_FOR_COUNT_:
case OMP_CLAUSE_ASYNC:
case OMP_CLAUSE_WAIT:
@@ -2100,6 +2100,7 @@ scan_sharing_clauses (tree clauses, omp_
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
case OMP_CLAUSE_NOGROUP:
+ case OMP_CLAUSE_DEFAULTMAP:
case OMP_CLAUSE_ASYNC:
case OMP_CLAUSE_WAIT:
case OMP_CLAUSE_GANG:
@@ -2255,6 +2256,7 @@ scan_sharing_clauses (tree clauses, omp_
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
case OMP_CLAUSE_NOGROUP:
+ case OMP_CLAUSE_DEFAULTMAP:
case OMP_CLAUSE__CILK_FOR_COUNT_:
case OMP_CLAUSE_ASYNC:
case OMP_CLAUSE_WAIT:
@@ -86,6 +86,7 @@ typedef enum pragma_omp_clause {
PRAGMA_OMP_CLAUSE_COPYIN,
PRAGMA_OMP_CLAUSE_COPYPRIVATE,
PRAGMA_OMP_CLAUSE_DEFAULT,
+ PRAGMA_OMP_CLAUSE_DEFAULTMAP,
PRAGMA_OMP_CLAUSE_DEPEND,
PRAGMA_OMP_CLAUSE_DEVICE,
PRAGMA_OMP_CLAUSE_DIST_SCHEDULE,
@@ -9910,7 +9910,9 @@ c_parser_omp_clause_name (c_parser *pars
result = PRAGMA_OACC_CLAUSE_CREATE;
break;
case 'd':
- if (!strcmp ("delete", p))
+ if (!strcmp ("defaultmap", p))
+ result = PRAGMA_OMP_CLAUSE_DEFAULTMAP;
+ else if (!strcmp ("delete", p))
result = PRAGMA_OACC_CLAUSE_DELETE;
else if (!strcmp ("depend", p))
result = PRAGMA_OMP_CLAUSE_DEPEND;
@@ -10866,6 +10868,55 @@ c_parser_omp_clause_hint (c_parser *pars
return list;
}
+/* OpenMP 4.1:
+ defaultmap ( tofrom : scalar ) */
+
+static tree
+c_parser_omp_clause_defaultmap (c_parser *parser, tree list)
+{
+ location_t loc = c_parser_peek_token (parser)->location;
+ tree c;
+ const char *p;
+
+ if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ return list;
+ if (!c_parser_next_token_is (parser, CPP_NAME))
+ {
+ c_parser_error (parser, "expected %<tofrom%>");
+ goto out_err;
+ }
+ p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
+ if (strcmp (p, "tofrom") != 0)
+ {
+ c_parser_error (parser, "expected %<tofrom%>");
+ goto out_err;
+ }
+ c_parser_consume_token (parser);
+ if (!c_parser_require (parser, CPP_COLON, "expected %<:%>"))
+ goto out_err;
+ if (!c_parser_next_token_is (parser, CPP_NAME))
+ {
+ c_parser_error (parser, "expected %<scalar%>");
+ goto out_err;
+ }
+ p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
+ if (strcmp (p, "scalar") != 0)
+ {
+ c_parser_error (parser, "expected %<scalar%>");
+ goto out_err;
+ }
+ c_parser_consume_token (parser);
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+ check_no_duplicate_clause (list, OMP_CLAUSE_DEFAULTMAP, "defaultmap");
+ c = build_omp_clause (loc, OMP_CLAUSE_DEFAULTMAP);
+ OMP_CLAUSE_CHAIN (c) = list;
+ return c;
+
+ out_err:
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
+ return list;
+}
+
/* OpenACC:
num_workers ( expression ) */
@@ -12210,6 +12261,10 @@ c_parser_omp_all_clauses (c_parser *pars
clauses = c_parser_omp_clause_hint (parser, clauses);
c_name = "hint";
break;
+ case PRAGMA_OMP_CLAUSE_DEFAULTMAP:
+ clauses = c_parser_omp_clause_defaultmap (parser, clauses);
+ c_name = "defaultmap";
+ break;
case PRAGMA_OMP_CLAUSE_IF:
clauses = c_parser_omp_clause_if (parser, clauses);
c_name = "if";
@@ -14607,7 +14662,10 @@ c_parser_omp_target_exit_data (location_
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MAP) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IF) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEPEND) \
- | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT))
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIVATE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEFAULTMAP))
static bool
c_parser_omp_target (c_parser *parser, enum pragma_context context)
@@ -12101,7 +12101,7 @@ tree
c_finish_omp_clauses (tree clauses, bool declare_simd)
{
bitmap_head generic_head, firstprivate_head, lastprivate_head;
- bitmap_head aligned_head;
+ bitmap_head aligned_head, map_head;
tree c, t, type, *pc;
tree simdlen = NULL_TREE, safelen = NULL_TREE;
bool branch_seen = false;
@@ -12113,6 +12113,7 @@ c_finish_omp_clauses (tree clauses, bool
bitmap_initialize (&firstprivate_head, &bitmap_default_obstack);
bitmap_initialize (&lastprivate_head, &bitmap_default_obstack);
bitmap_initialize (&aligned_head, &bitmap_default_obstack);
+ bitmap_initialize (&map_head, &bitmap_default_obstack);
for (pc = &clauses, c = clauses; c ; c = *pc)
{
@@ -12559,7 +12560,7 @@ c_finish_omp_clauses (tree clauses, bool
omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
remove = true;
}
- else if (bitmap_bit_p (&generic_head, DECL_UID (t)))
+ else if (bitmap_bit_p (&map_head, DECL_UID (t)))
{
if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_MAP)
error ("%qD appears more than once in motion clauses", t);
@@ -12568,7 +12569,7 @@ c_finish_omp_clauses (tree clauses, bool
remove = true;
}
else
- bitmap_set_bit (&generic_head, DECL_UID (t));
+ bitmap_set_bit (&map_head, DECL_UID (t));
break;
case OMP_CLAUSE_UNIFORM:
@@ -12624,6 +12625,7 @@ c_finish_omp_clauses (tree clauses, bool
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
case OMP_CLAUSE_HINT:
+ case OMP_CLAUSE_DEFAULTMAP:
case OMP_CLAUSE__CILK_FOR_COUNT_:
case OMP_CLAUSE_NUM_GANGS:
case OMP_CLAUSE_NUM_WORKERS:
@@ -27683,7 +27683,9 @@ cp_parser_omp_clause_name (cp_parser *pa
result = PRAGMA_OACC_CLAUSE_CREATE;
break;
case 'd':
- if (!strcmp ("depend", p))
+ if (!strcmp ("defaultmap", p))
+ result = PRAGMA_OMP_CLAUSE_DEFAULTMAP;
+ else if (!strcmp ("depend", p))
result = PRAGMA_OMP_CLAUSE_DEPEND;
else if (!strcmp ("device", p))
result = PRAGMA_OMP_CLAUSE_DEVICE;
@@ -28605,6 +28607,65 @@ cp_parser_omp_clause_hint (cp_parser *pa
return c;
}
+/* OpenMP 4.1:
+ defaultmap ( tofrom : scalar ) */
+
+static tree
+cp_parser_omp_clause_defaultmap (cp_parser *parser, tree list,
+ location_t location)
+{
+ tree c, id;
+ const char *p;
+
+ if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
+ return list;
+
+ if (!cp_lexer_next_token_is (parser->lexer, CPP_NAME))
+ {
+ cp_parser_error (parser, "expected %<tofrom%>");
+ goto out_err;
+ }
+ id = cp_lexer_peek_token (parser->lexer)->u.value;
+ p = IDENTIFIER_POINTER (id);
+ if (strcmp (p, "tofrom") != 0)
+ {
+ cp_parser_error (parser, "expected %<tofrom%>");
+ goto out_err;
+ }
+ cp_lexer_consume_token (parser->lexer);
+ if (!cp_parser_require (parser, CPP_COLON, RT_COLON))
+ goto out_err;
+
+ if (!cp_lexer_next_token_is (parser->lexer, CPP_NAME))
+ {
+ cp_parser_error (parser, "expected %<scalar%>");
+ goto out_err;
+ }
+ id = cp_lexer_peek_token (parser->lexer)->u.value;
+ p = IDENTIFIER_POINTER (id);
+ if (strcmp (p, "scalar") != 0)
+ {
+ cp_parser_error (parser, "expected %<scalar%>");
+ goto out_err;
+ }
+ cp_lexer_consume_token (parser->lexer);
+ if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
+ goto out_err;
+
+ check_no_duplicate_clause (list, OMP_CLAUSE_DEFAULTMAP, "defaultmap",
+ location);
+
+ c = build_omp_clause (location, OMP_CLAUSE_DEFAULTMAP);
+ OMP_CLAUSE_CHAIN (c) = list;
+ return c;
+
+ out_err:
+ cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
+ /*or_comma=*/false,
+ /*consume_paren=*/true);
+ return list;
+}
+
/* OpenACC:
num_workers ( expression ) */
@@ -29750,6 +29811,11 @@ cp_parser_omp_all_clauses (cp_parser *pa
token->location);
c_name = "hint";
break;
+ case PRAGMA_OMP_CLAUSE_DEFAULTMAP:
+ clauses = cp_parser_omp_clause_defaultmap (parser, clauses,
+ token->location);
+ c_name = "defaultmap";
+ break;
case PRAGMA_OMP_CLAUSE_IF:
clauses = cp_parser_omp_clause_if (parser, clauses, token->location);
c_name = "if";
@@ -32187,7 +32253,10 @@ cp_parser_omp_target_update (cp_parser *
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MAP) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IF) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEPEND) \
- | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT))
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIVATE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEFAULTMAP))
static bool
cp_parser_omp_target (cp_parser *parser, cp_token *pragma_tok,
@@ -13617,6 +13617,7 @@ tsubst_omp_clauses (tree clauses, bool d
case OMP_CLAUSE_GRAINSIZE:
case OMP_CLAUSE_PRIORITY:
case OMP_CLAUSE_ORDERED:
+ case OMP_CLAUSE_HINT:
OMP_CLAUSE_OPERAND (nc, 0)
= tsubst_expr (OMP_CLAUSE_OPERAND (oc, 0), args, complain,
in_decl, /*integral_constant_expression_p=*/false);
@@ -13670,6 +13671,7 @@ tsubst_omp_clauses (tree clauses, bool d
case OMP_CLAUSE_NOGROUP:
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
+ case OMP_CLAUSE_DEFAULTMAP:
break;
default:
gcc_unreachable ();
@@ -5498,7 +5498,7 @@ tree
finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd)
{
bitmap_head generic_head, firstprivate_head, lastprivate_head;
- bitmap_head aligned_head;
+ bitmap_head aligned_head, map_head;
tree c, t, *pc;
tree safelen = NULL_TREE;
bool branch_seen = false;
@@ -5509,6 +5509,7 @@ finish_omp_clauses (tree clauses, bool a
bitmap_initialize (&firstprivate_head, &bitmap_default_obstack);
bitmap_initialize (&lastprivate_head, &bitmap_default_obstack);
bitmap_initialize (&aligned_head, &bitmap_default_obstack);
+ bitmap_initialize (&map_head, &bitmap_default_obstack);
for (pc = &clauses, c = clauses; c ; c = *pc)
{
@@ -6155,7 +6156,7 @@ finish_omp_clauses (tree clauses, bool a
omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
remove = true;
}
- else if (bitmap_bit_p (&generic_head, DECL_UID (t)))
+ else if (bitmap_bit_p (&map_head, DECL_UID (t)))
{
if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_MAP)
error ("%qD appears more than once in motion clauses", t);
@@ -6164,7 +6165,7 @@ finish_omp_clauses (tree clauses, bool a
remove = true;
}
else
- bitmap_set_bit (&generic_head, DECL_UID (t));
+ bitmap_set_bit (&map_head, DECL_UID (t));
break;
case OMP_CLAUSE_UNIFORM:
@@ -6305,6 +6306,7 @@ finish_omp_clauses (tree clauses, bool a
case OMP_CLAUSE_NOGROUP:
case OMP_CLAUSE_THREADS:
case OMP_CLAUSE_SIMD:
+ case OMP_CLAUSE_DEFAULTMAP:
case OMP_CLAUSE__CILK_FOR_COUNT_:
break;