diff options
author | Tobias Burnus <tburnus@baylibre.com> | 2024-11-22 16:15:17 +0100 |
---|---|---|
committer | Tobias Burnus <tburnus@baylibre.com> | 2024-11-22 16:15:17 +0100 |
commit | f34422e06c38eb1f69c301ad5d8e2114c46a2796 (patch) | |
tree | db9f0f76a6ee9779d3f0456b9cae6bbf36819331 /gcc/c | |
parent | 8f0c8e577a56891fa104c818834ddafe268722bb (diff) | |
download | gcc-f34422e06c38eb1f69c301ad5d8e2114c46a2796.zip gcc-f34422e06c38eb1f69c301ad5d8e2114c46a2796.tar.gz gcc-f34422e06c38eb1f69c301ad5d8e2114c46a2796.tar.bz2 |
OpenMP: Add 'interop' clause to 'dispatch' for C/C++
Will fail with an error if/as no suitable 'append_args' has been specified,
given that 'append_args' is not yet implemented.
gcc/c-family/ChangeLog:
* c-pragma.h (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_INTEROP.
gcc/c/ChangeLog:
* c-parser.cc (c_parser_omp_clause_interop): New.
(c_parser_omp_clause_name, c_parser_omp_all_clauses,
c_parser_omp_dispatch_body): Handle 'interop' clause.
* c-typeck.cc (c_finish_omp_clauses): Likewise.
gcc/cp/ChangeLog:
* parser.cc (cp_parser_omp_clause_name, cp_parser_omp_all_clauses,
cp_parser_omp_dispatch_body): Handle 'interop' clause.
* pt.cc (tsubst_omp_clauses): Likewise.
* semantics.cc (finish_omp_clauses): Likewise.
gcc/ChangeLog:
* gimplify.cc (gimplify_call_expr): Add initial support for
dispatch's 'interop' clause.
(gimplify_scan_omp_clauses): Handle interop clause.
* tree-pretty-print.cc (dump_omp_clause): Likewise.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_INTEROP.
* tree.cc (omp_clause_num_ops, omp_clause_code_name): Add interop.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/dispatch-11.c: New test.
* c-c++-common/gomp/dispatch-12.c: New test.
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/c-parser.cc | 17 | ||||
-rw-r--r-- | gcc/c/c-typeck.cc | 23 |
2 files changed, 34 insertions, 6 deletions
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index ca4a6b3..f3ed610 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -15786,6 +15786,8 @@ c_parser_omp_clause_name (c_parser *parser) result = PRAGMA_OMP_CLAUSE_INIT; else if (!strcmp ("is_device_ptr", p)) result = PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR; + else if (!strcmp ("interop", p)) + result = PRAGMA_OMP_CLAUSE_INTEROP; break; case 'l': if (!strcmp ("lastprivate", p)) @@ -20569,6 +20571,16 @@ c_parser_omp_clause_use (c_parser *parser, tree list) return c_parser_omp_var_list_parens (parser, OMP_CLAUSE_USE, list); } +/* OpenMP 6.0: + interop ( variable-list ) */ + +static tree +c_parser_omp_clause_interop (c_parser *parser, tree list) +{ + check_no_duplicate_clause (list, OMP_CLAUSE_INTEROP, "interop"); + return c_parser_omp_var_list_parens (parser, OMP_CLAUSE_INTEROP, list); +} + /* Parse all OpenACC clauses. The set clauses allowed by the directive is a bitmask in MASK. Return the list of clauses found. */ @@ -21076,6 +21088,10 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask, clauses = c_parser_omp_clause_use (parser, clauses); c_name = "use"; break; + case PRAGMA_OMP_CLAUSE_INTEROP: + clauses = c_parser_omp_clause_interop (parser, clauses); + c_name = "interop"; + break; case PRAGMA_OMP_CLAUSE_MAP: clauses = c_parser_omp_clause_map (parser, clauses); c_name = "map"; @@ -25078,6 +25094,7 @@ c_parser_omp_dispatch_body (c_parser *parser) | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEPEND) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOVARIANTS) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOCONTEXT) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_INTEROP) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT)) diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index f6f63ca..970fe68 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -17091,16 +17091,27 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) error_at (OMP_CLAUSE_LOCATION (c), "%qD appears more than once in action clauses", t); remove = true; + break; } - else if (/* ort == C_ORT_OMP_INTEROP [uncomment for depobj init] */ + bitmap_set_bit (&generic_head, DECL_UID (t)); + /* FALLTHRU */ + case OMP_CLAUSE_INTEROP: + if (/* ort == C_ORT_OMP_INTEROP [uncomment for depobj init] */ !c_omp_interop_t_p (TREE_TYPE (OMP_CLAUSE_DECL (c)))) - error_at (OMP_CLAUSE_LOCATION (c), - "%qD must be of %<omp_interop_t%>", OMP_CLAUSE_DECL (c)); - else if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_USE + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qD must be of %<omp_interop_t%>", + OMP_CLAUSE_DECL (c)); + remove = true; + } + else if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_INIT + || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DESTROY) && TREE_READONLY (OMP_CLAUSE_DECL (c))) - error_at (OMP_CLAUSE_LOCATION (c), + { + error_at (OMP_CLAUSE_LOCATION (c), "%qD shall not be const", OMP_CLAUSE_DECL (c)); - bitmap_set_bit (&generic_head, DECL_UID (t)); + remove = true; + } pc = &OMP_CLAUSE_CHAIN (c); break; default: |