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/cp | |
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/cp')
-rw-r--r-- | gcc/cp/parser.cc | 10 | ||||
-rw-r--r-- | gcc/cp/pt.cc | 1 | ||||
-rw-r--r-- | gcc/cp/semantics.cc | 29 |
3 files changed, 31 insertions, 9 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index fa9945b..f449ebd 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -38335,6 +38335,8 @@ cp_parser_omp_clause_name (cp_parser *parser) result = PRAGMA_OMP_CLAUSE_INDIRECT; else if (!strcmp ("init", p)) result = PRAGMA_OMP_CLAUSE_INIT; + else if (!strcmp ("interop", p)) + result = PRAGMA_OMP_CLAUSE_INTEROP; else if (!strcmp ("is_device_ptr", p)) result = PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR; break; @@ -43336,6 +43338,13 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask, clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_USE, clauses); c_name = "use"; break; + case PRAGMA_OMP_CLAUSE_INTEROP: + check_no_duplicate_clause (clauses, OMP_CLAUSE_INTEROP, "interop", + token->location); + clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_INTEROP, + clauses); + c_name = "interop"; + break; case PRAGMA_OMP_CLAUSE_DETACH: clauses = cp_parser_omp_clause_detach (parser, clauses); c_name = "detach"; @@ -49728,6 +49737,7 @@ cp_parser_omp_dispatch_body (cp_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/cp/pt.cc b/gcc/cp/pt.cc index 74d0d86..5b79188 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -17893,6 +17893,7 @@ tsubst_omp_clauses (tree clauses, enum c_omp_region_type ort, /* FALLTHRU */ case OMP_CLAUSE_DESTROY: case OMP_CLAUSE_USE: + case OMP_CLAUSE_INTEROP: OMP_CLAUSE_OPERAND (nc, 0) = tsubst_stmt (OMP_CLAUSE_OPERAND (oc, 0), args, complain, in_decl); break; diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 328de39..d58dd02 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -9448,20 +9448,31 @@ 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; } + bitmap_set_bit (&generic_head, DECL_UID (t)); + /* FALLTHRU */ + case OMP_CLAUSE_INTEROP: if (!processing_template_decl) { - 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 + if (/* (ort == C_ORT_OMP_INTEROP [uncomment for depobj init] + || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_INTEROP) && */ + !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)); + 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), - "%qD shall not be const", OMP_CLAUSE_DECL (c)); + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qD shall not be const", OMP_CLAUSE_DECL (c)); + remove = true; + } } - bitmap_set_bit (&generic_head, DECL_UID (t)); pc = &OMP_CLAUSE_CHAIN (c); break; default: |