/* All clauses defined by OpenACC 2.0, and OpenMP 2.5, 3.0, 3.1, 4.0, 4.5, 5.0,
- and 5.1. Used internally by both C and C++ parsers. */
+ 5.1 and 5.2. Used internally by both C and C++ parsers. */
enum pragma_omp_clause {
PRAGMA_OMP_CLAUSE_NONE = 0,
PRAGMA_OMP_CLAUSE_DEVICE,
PRAGMA_OMP_CLAUSE_DEVICE_TYPE,
PRAGMA_OMP_CLAUSE_DIST_SCHEDULE,
+ PRAGMA_OMP_CLAUSE_ENTER,
PRAGMA_OMP_CLAUSE_FILTER,
PRAGMA_OMP_CLAUSE_FINAL,
PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
else if (!strcmp ("dist_schedule", p))
result = PRAGMA_OMP_CLAUSE_DIST_SCHEDULE;
break;
+ case 'e':
+ if (!strcmp ("enter", p))
+ result = PRAGMA_OMP_CLAUSE_ENTER;
+ break;
case 'f':
if (!strcmp ("filter", p))
result = PRAGMA_OMP_CLAUSE_FILTER;
break;
case PRAGMA_OMP_CLAUSE_TO:
if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_LINK)) != 0)
- clauses
- = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_TO_DECLARE,
- clauses);
+ {
+ tree nl = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_ENTER,
+ clauses);
+ for (tree c = nl; c != clauses; c = OMP_CLAUSE_CHAIN (c))
+ OMP_CLAUSE_ENTER_TO (c) = 1;
+ clauses = nl;
+ }
else
clauses = c_parser_omp_clause_to (parser, clauses);
c_name = "to";
clauses);
c_name = "simd";
break;
+ case PRAGMA_OMP_CLAUSE_ENTER:
+ clauses
+ = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_ENTER,
+ clauses);
+ c_name = "enter";
+ break;
default:
c_parser_error (parser, "expected %<#pragma omp%> clause");
goto saw_error;
#define OMP_DECLARE_TARGET_CLAUSE_MASK \
( (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_TO) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ENTER) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_LINK) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEVICE_TYPE))
"#pragma omp declare target");
else if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
{
- clauses = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_TO_DECLARE,
+ clauses = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_ENTER,
clauses);
clauses = c_finish_omp_clauses (clauses, C_ORT_OMP);
c_parser_skip_to_pragma_eol (parser);
}
break;
- case OMP_CLAUSE_TO_DECLARE:
+ case OMP_CLAUSE_ENTER:
case OMP_CLAUSE_LINK:
t = OMP_CLAUSE_DECL (c);
+ const char *cname;
+ cname = omp_clause_code_name[OMP_CLAUSE_CODE (c)];
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ENTER
+ && OMP_CLAUSE_ENTER_TO (c))
+ cname = "to";
if (TREE_CODE (t) == FUNCTION_DECL
- && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_TO_DECLARE)
+ && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ENTER)
;
else if (!VAR_P (t))
{
- if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_TO_DECLARE)
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ENTER)
error_at (OMP_CLAUSE_LOCATION (c),
"%qE is neither a variable nor a function name in "
- "clause %qs", t,
- omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ "clause %qs", t, cname);
else
error_at (OMP_CLAUSE_LOCATION (c),
- "%qE is not a variable in clause %qs", t,
- omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ "%qE is not a variable in clause %qs", t, cname);
remove = true;
}
else if (DECL_THREAD_LOCAL_P (t))
{
error_at (OMP_CLAUSE_LOCATION (c),
"%qD is threadprivate variable in %qs clause", t,
- omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ cname);
remove = true;
}
else if (!lang_hooks.types.omp_mappable_type (TREE_TYPE (t)))
{
error_at (OMP_CLAUSE_LOCATION (c),
"%qD does not have a mappable type in %qs clause", t,
- omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ cname);
remove = true;
}
if (remove)
else if (!strcmp ("dist_schedule", p))
result = PRAGMA_OMP_CLAUSE_DIST_SCHEDULE;
break;
+ case 'e':
+ if (!strcmp ("enter", p))
+ result = PRAGMA_OMP_CLAUSE_ENTER;
+ break;
case 'f':
if (!strcmp ("filter", p))
result = PRAGMA_OMP_CLAUSE_FILTER;
break;
case PRAGMA_OMP_CLAUSE_TO:
if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_LINK)) != 0)
- clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_TO_DECLARE,
- clauses);
+ {
+ tree nl = cp_parser_omp_var_list (parser, OMP_CLAUSE_ENTER,
+ clauses);
+ for (tree c = nl; c != clauses; c = OMP_CLAUSE_CHAIN (c))
+ OMP_CLAUSE_ENTER_TO (c) = 1;
+ clauses = nl;
+ }
else
clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_TO, clauses,
true);
clauses, token->location);
c_name = "simd";
break;
+ case PRAGMA_OMP_CLAUSE_ENTER:
+ clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_ENTER,
+ clauses);
+ c_name = "enter";
+ break;
default:
cp_parser_error (parser, "expected %<#pragma omp%> clause");
goto saw_error;
#define OMP_DECLARE_TARGET_CLAUSE_MASK \
( (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_TO) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ENTER) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_LINK) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEVICE_TYPE))
"#pragma omp declare target", pragma_tok);
else if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
{
- clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_TO_DECLARE,
+ clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_ENTER,
clauses);
clauses = finish_omp_clauses (clauses, C_ORT_OMP);
cp_parser_require_pragma_eol (parser, pragma_tok);
}
break;
- case OMP_CLAUSE_TO_DECLARE:
+ case OMP_CLAUSE_ENTER:
case OMP_CLAUSE_LINK:
t = OMP_CLAUSE_DECL (c);
+ const char *cname;
+ cname = omp_clause_code_name[OMP_CLAUSE_CODE (c)];
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ENTER
+ && OMP_CLAUSE_ENTER_TO (c))
+ cname = "to";
if (TREE_CODE (t) == FUNCTION_DECL
- && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_TO_DECLARE)
+ && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ENTER)
;
else if (!VAR_P (t))
{
- if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_TO_DECLARE)
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ENTER)
{
if (TREE_CODE (t) == TEMPLATE_ID_EXPR)
error_at (OMP_CLAUSE_LOCATION (c),
- "template %qE in clause %qs", t,
- omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ "template %qE in clause %qs", t, cname);
else if (really_overloaded_fn (t))
error_at (OMP_CLAUSE_LOCATION (c),
"overloaded function name %qE in clause %qs", t,
- omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ cname);
else
error_at (OMP_CLAUSE_LOCATION (c),
"%qE is neither a variable nor a function name "
- "in clause %qs", t,
- omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ "in clause %qs", t, cname);
}
else
error_at (OMP_CLAUSE_LOCATION (c),
- "%qE is not a variable in clause %qs", t,
- omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ "%qE is not a variable in clause %qs", t, cname);
remove = true;
}
else if (DECL_THREAD_LOCAL_P (t))
{
error_at (OMP_CLAUSE_LOCATION (c),
"%qD is threadprivate variable in %qs clause", t,
- omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ cname);
remove = true;
}
else if (!cp_omp_mappable_type (TREE_TYPE (t)))
{
error_at (OMP_CLAUSE_LOCATION (c),
"%qD does not have a mappable type in %qs clause", t,
- omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ cname);
cp_omp_emit_unmappable_type_notes (TREE_TYPE (t));
remove = true;
}
void bar (int *);
#pragma omp declare target to (bar)
+void baz (int *);
+#pragma omp declare target enter (baz)
int
main ()
#pragma omp target map (s.s[0]) map (s.v.b[:3])
;
#pragma omp target map (s.s[0]) map (s.v.b[:3])
- bar (s.s);
+ baz (s.s);
return 0;
}
#pragma omp end declare target
#pragma omp declare target (bar, a)
-#pragma omp declare target to (b) link (d) to (foo)
+#pragma omp declare target to (b) link (d) enter (foo)
#pragma omp end declare target
int b;
#pragma omp declare target to (b) link (b) /* { dg-error "appears more than once on the same .declare target. directive" } */
+#pragma omp declare target enter (b) link (b) /* { dg-error "appears more than once on the same .declare target. directive" } */
int c;
#pragma omp declare target (c)
#pragma omp declare target link (c) /* { dg-error "specified both in declare target" } */
#pragma omp declare target to (k)
#pragma omp declare target (k)
#pragma omp declare target to (k, m) link (l)
+#pragma omp declare target enter (k, m) link (l)
#pragma omp declare target link (l)
int n, o, s, t;
#pragma omp declare target to (n) to (n) /* { dg-error "appears more than once on the same .declare target. directive" } */
+#pragma omp declare target enter (n) enter (n) /* { dg-error "appears more than once on the same .declare target. directive" } */
+#pragma omp declare target enter (n) to (n) /* { dg-error "appears more than once on the same .declare target. directive" } */
+#pragma omp declare target to (n) enter (n) /* { dg-error "appears more than once on the same .declare target. directive" } */
#pragma omp declare target link (o, o) /* { dg-error "appears more than once on the same .declare target. directive" } */
#pragma omp declare target (s, t, s) /* { dg-error "appears more than once on the same .declare target. directive" } */
int p, q, r;
#pragma omp declare target to (f) /* { dg-error "'f' does not have a mappable type in 'to' clause" } */
extern int g[];
#pragma omp declare target to (g) /* { dg-error "'g' does not have a mappable type in 'to' clause" } */
+extern int g2[];
+#pragma omp declare target enter (g2) /* { dg-error "'g2' does not have a mappable type in 'enter' clause" } */
int g[3];
extern int h[];
int h[3];
#pragma omp declare target to (h)
+#pragma omp declare target enter (h)
int i[] = { 1, 2, 3 };
int j[] = { 1, 2, 3 };
[[omp::directive (declare target (a))]];
int t;
[[omp::sequence (omp::directive (threadprivate (t)))]];
-int b, c;
-[[omp::directive (declare target, to (b), link (c))]];
+int b, c, e;
+[[omp::directive (declare target, to (b), link (c), enter (e))]];
[[omp::directive (declare target)]];
[[omp::directive (declare target)]];
int d;
#pragma omp declare target (f3)
#pragma omp declare target to (f4) // { dg-error "overloaded function name .f4. in clause .to." }
#pragma omp declare target to (f5<int>) // { dg-error "template .f5<int>. in clause .to." }
+#pragma omp declare target enter (f5<short>) // { dg-error "template .f5<short int>. in clause .enter." }
template <int N>
void f6 (int)
{
#pragma omp declare target (N::M::f7)
#pragma omp declare target to (::N::f8)
#pragma omp declare target to (::f9) to (::v)
+#pragma omp declare target to (::f9, ::v)
+#pragma omp declare target enter (::N::f8)
+#pragma omp declare target enter (::f9) enter (::v)
+#pragma omp declare target enter (::f9, ::v)
/* OpenMP clause: uniform (argument-list). */
OMP_CLAUSE_UNIFORM,
- /* OpenMP clause: to (extended-list).
- Only when it appears in declare target. */
- OMP_CLAUSE_TO_DECLARE,
+ /* OpenMP clause: enter (extended-list).
+ to is a deprecated alias when it appears in declare target. */
+ OMP_CLAUSE_ENTER,
/* OpenMP clause: link (variable-list). */
OMP_CLAUSE_LINK,
case OMP_CLAUSE_FIRSTPRIVATE:
case OMP_CLAUSE_COPYPRIVATE:
case OMP_CLAUSE_SHARED:
- case OMP_CLAUSE_TO_DECLARE:
+ case OMP_CLAUSE_ENTER:
case OMP_CLAUSE_LINK:
case OMP_CLAUSE_USE_DEVICE_PTR:
case OMP_CLAUSE_USE_DEVICE_ADDR:
case OMP_CLAUSE_FIRSTPRIVATE:
case OMP_CLAUSE_COPYPRIVATE:
case OMP_CLAUSE_SHARED:
- case OMP_CLAUSE_TO_DECLARE:
+ case OMP_CLAUSE_ENTER:
case OMP_CLAUSE_LINK:
case OMP_CLAUSE_USE_DEVICE_PTR:
case OMP_CLAUSE_USE_DEVICE_ADDR:
case OMP_CLAUSE__SCANTEMP_:
name = "_scantemp_";
goto print_remap;
- case OMP_CLAUSE_TO_DECLARE:
- name = "to";
+ case OMP_CLAUSE_ENTER:
+ if (OMP_CLAUSE_ENTER_TO (clause))
+ name = "to";
+ else
+ name = "enter";
goto print_remap;
case OMP_CLAUSE_LINK:
name = "link";
1, /* OMP_CLAUSE_DEPEND */
1, /* OMP_CLAUSE_NONTEMPORAL */
1, /* OMP_CLAUSE_UNIFORM */
- 1, /* OMP_CLAUSE_TO_DECLARE */
+ 1, /* OMP_CLAUSE_ENTER */
1, /* OMP_CLAUSE_LINK */
1, /* OMP_CLAUSE_DETACH */
1, /* OMP_CLAUSE_USE_DEVICE_PTR */
"depend",
"nontemporal",
"uniform",
- "to",
+ "enter",
"link",
"detach",
"use_device_ptr",
#define OMP_CLAUSE_BIND_KIND(NODE) \
(OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_BIND)->omp_clause.subcode.bind_kind)
+/* True if ENTER clause is spelled as TO. */
+#define OMP_CLAUSE_ENTER_TO(NODE) \
+ (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ENTER)->base.public_flag)
+
#define OMP_CLAUSE_TILE_LIST(NODE) \
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_TILE), 0)
#define OMP_CLAUSE_TILE_ITERVAR(NODE) \
int *b = &a;
int **c = &b;
fnp2 f5 (void) { f3 (); return f4; }
-#pragma omp declare target to (c)
+#pragma omp declare target enter (c)
int
main ()
v++;
}
-#pragma omp declare target to (v, foo)
+#pragma omp declare target enter (v, foo)
int
main ()