diff options
author | Cesar Philippidis <cesar@codesourcery.com> | 2015-11-05 18:03:48 -0800 |
---|---|---|
committer | Cesar Philippidis <cesar@gcc.gnu.org> | 2015-11-05 18:03:48 -0800 |
commit | 7a5e4956cc026cba54159d5c764486ac4151db85 (patch) | |
tree | 2f50525608c6a6a2a595620ad902d2efc85ab031 /gcc/cp | |
parent | 906f9ad995368b4891186c07ed3c5c2fd5f53bea (diff) | |
download | gcc-7a5e4956cc026cba54159d5c764486ac4151db85.zip gcc-7a5e4956cc026cba54159d5c764486ac4151db85.tar.gz gcc-7a5e4956cc026cba54159d5c764486ac4151db85.tar.bz2 |
gimplify.c (gimplify_scan_omp_clauses): Add support for OMP_CLAUSE_TILE.
gcc/
* gimplify.c (gimplify_scan_omp_clauses): Add support for
OMP_CLAUSE_TILE. Update handling of OMP_CLAUSE_INDEPENDENT.
(gimplify_adjust_omp_clauses): Likewise.
* omp-low.c (scan_sharing_clauses): Add support for OMP_CLAUSE_TILE.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_TILE.
* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_TILE.
* tree.c (omp_clause_num_ops): Add an entry for OMP_CLAUSE_TILE.
(omp_clause_code_name): Likewise.
(walk_tree_1): Handle OMP_CLAUSE_TILE.
* tree.h (OMP_TILE_LIST): New macro.
gcc/c-family/
* c-omp.c (c_oacc_split_loop_clauses): Make TILE, GANG, WORKER, VECTOR,
AUTO, SEQ, INDEPENDENT and PRIVATE loop clauses. Associate REDUCTION
clauses with parallel and kernels and loops.
* c-pragma.h (enum pragma_omp_clause): Add entries for
PRAGMA_OACC_CLAUSE_{INDEPENDENT,TILE,DEFAULT}.
* pt.c (tsubst_omp_clauses): Add support for OMP_CLAUSE_{NUM_GANGS,
NUM_WORKERS,VECTOR_LENGTH,GANG,WORKER,VECTOR,ASYNC,WAIT,TILE,AUTO,
INDEPENDENT,SEQ}.
(tsubst_expr): Add support for OMP_CLAUSE_{KERNELS,PARALLEL,LOOP}.
gcc/c/
* c-parser.c (c_parser_omp_clause_name): Add support for
PRAGMA_OACC_CLAUSE_INDEPENDENT and PRAGMA_OACC_CLAUSE_TILE.
(c_parser_omp_clause_default): Add is_oacc argument. Handle
default(none) in OpenACC.
(c_parser_oacc_shape_clause): Allow pointer variables as gang static
arguments.
(c_parser_oacc_clause_tile): New function.
(c_parser_oacc_all_clauses): Add support for OMP_CLAUSE_DEFAULT,
OMP_CLAUSE_INDEPENDENT and OMP_CLAUSE_TILE.
(OACC_LOOP_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_{PRIVATE,INDEPENDENT,
TILE}.
(OACC_KERNELS_MASK): Add PRAGMA_OACC_CLAUSE_DEFAULT.
(OACC_PARALLEL_MASK): Add PRAGMA_OACC_CLAUSE_{DEFAULT,PRIVATE,
FIRSTPRIVATE}.
(c_parser_omp_all_clauses): Update call to c_parser_omp_clause_default.
(c_parser_oacc_update): Update the error message for missing clauses.
* c-typeck.c (c_finish_omp_clauses): Add support for OMP_CLAUSE_TILE
and OMP_CLAUSE_INDEPENDENT.
gcc/cp/
* parser.c (cp_parser_omp_clause_name): Add support for
PRAGMA_OACC_CLAUSE_INDEPENDENT and PRAGMA_OACC_CLAUSE_TILE.
(cp_parser_oacc_shape_clause): Allow pointer variables as gang static
arguments.
(cp_parser_oacc_clause_tile): New function.
(cp_parser_omp_clause_default): Add is_oacc argument. Handle
default(none) in OpenACC.
(cp_parser_oacc_all_clauses): Add support for
(cp_parser_omp_all_clauses): Update call to
cp_parser_omp_clause_default.
PRAGMA_OACC_CLAUSE_{DEFAULT,INDEPENDENT,TILE,PRIVATE,FIRSTPRIVATE}.
(OACC_LOOP_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_{PRIVATE,INDEPENDENT,
TILE}.
(OACC_KERNELS_MASK): Add PRAGMA_OACC_CLAUSE_DEFAULT.
(OACC_PARALLEL_MASK): Add PRAGMA_OACC_CLAUSE_{DEFAULT,PRIVATE,
FIRSTPRIVATE}.
(cp_parser_oacc_update): Update the error message for missing clauses.
* semantics.c (finish_omp_clauses): Add support for
OMP_CLAUSE_INDEPENDENT and OMP_CLAUSE_TILE.
gcc/fortran/
* openmp.c (gfc_match_omp_clauses): Update support for the tile
and default clauses in OpenACC.
(gfc_match_oacc_update): Error when data clauses are supplied.
(oacc_compatible_clauses): Delete.
(resolve_omp_clauses): Give special care for OpenACC reductions.
Also update error reporting for the tile clause.
(resolve_oacc_loop_blocks): Update error reporting for the tile clause.
* trans-openmp.c (gfc_trans_omp_clauses): Update OMP_CLAUSE_SEQ. Add
OMP_CLAUSE_{AUTO,TILE} and add support the the gang static argument.
(gfc_trans_oacc_combined_directive): Update the list of clauses which
are split to acc loops.
gcc/testsuite/
* c-c++-common/goacc/combined-directives.c: New test.
* c-c++-common/goacc/loop-clauses.c: New test.
* c-c++-common/goacc/tile.c: New test.
* c-c++-common/goacc/loop-shape.c: Add test for pointer variable
as gang static arguments.
* c-c++-common/goacc/update-1.c: Adjust expected error message.
* g++.dg/goacc/template.C: New test.
* gfortran.dg/goacc/combined-directives.f90: New test.
* gfortran.dg/goacc/default.f95: New test.
* gfortran.dg/goacc/default_none.f95: New test.
* gfortran.dg/goacc/firstprivate-1.f95: New test.
* gfortran.dg/goacc/gang-static.f95: New test.
* gfortran.dg/goacc/kernels-loop-inner.f95: New test.
* gfortran.dg/goacc/kernels-loops-adjacent.f95: New test.
* gfortran.dg/goacc/list.f95: Update test.
* gfortran.dg/goacc/loop-2.f95: Likewise.
* gfortran.dg/goacc/loop-4.f95: New test.
* gfortran.dg/goacc/loop-5.f95: New test.
* gfortran.dg/goacc/loop-6.f95: New test.
* gfortran.dg/goacc/loop-tree-1.f90: Update test.
* gfortran.dg/goacc/multi-clause.f90: New test.
* gfortran.dg/goacc/parallel-tree.f95: Update test.
* gfortran.dg/goacc/update.f95: New test.
Co-Authored-By: James Norris <jnorris@codesourcery.com>
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r229832
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 24 | ||||
-rw-r--r-- | gcc/cp/parser.c | 107 | ||||
-rw-r--r-- | gcc/cp/pt.c | 51 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 38 |
4 files changed, 210 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1741fa2..e780c86 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,27 @@ +2015-11-05 Cesar Philippidis <cesar@codesourcery.com> + Thomas Schwinge <thomas@codesourcery.com> + James Norris <jnorris@codesourcery.com> + + * parser.c (cp_parser_omp_clause_name): Add support for + PRAGMA_OACC_CLAUSE_INDEPENDENT and PRAGMA_OACC_CLAUSE_TILE. + (cp_parser_oacc_shape_clause): Allow pointer variables as gang static + arguments. + (cp_parser_oacc_clause_tile): New function. + (cp_parser_omp_clause_default): Add is_oacc argument. Handle + default(none) in OpenACC. + (cp_parser_oacc_all_clauses): Add support for + (cp_parser_omp_all_clauses): Update call to + cp_parser_omp_clause_default. + PRAGMA_OACC_CLAUSE_{DEFAULT,INDEPENDENT,TILE,PRIVATE,FIRSTPRIVATE}. + (OACC_LOOP_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_{PRIVATE,INDEPENDENT, + TILE}. + (OACC_KERNELS_MASK): Add PRAGMA_OACC_CLAUSE_DEFAULT. + (OACC_PARALLEL_MASK): Add PRAGMA_OACC_CLAUSE_{DEFAULT,PRIVATE, + FIRSTPRIVATE}. + (cp_parser_oacc_update): Update the error message for missing clauses. + * semantics.c (finish_omp_clauses): Add support for + OMP_CLAUSE_INDEPENDENT and OMP_CLAUSE_TILE. + 2015-11-05 Martin Sebor <msebor@redhat.com> PR c++/67942 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d439c06..c6f5729 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -29125,6 +29125,8 @@ cp_parser_omp_clause_name (cp_parser *parser) case 'i': if (!strcmp ("inbranch", p)) result = PRAGMA_OMP_CLAUSE_INBRANCH; + else if (!strcmp ("independent", p)) + result = PRAGMA_OACC_CLAUSE_INDEPENDENT; else if (!strcmp ("is_device_ptr", p)) result = PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR; break; @@ -29219,6 +29221,8 @@ cp_parser_omp_clause_name (cp_parser *parser) result = PRAGMA_OMP_CLAUSE_THREAD_LIMIT; else if (!strcmp ("threads", p)) result = PRAGMA_OMP_CLAUSE_THREADS; + else if (!strcmp ("tile", p)) + result = PRAGMA_OACC_CLAUSE_TILE; else if (!strcmp ("to", p)) result = PRAGMA_OMP_CLAUSE_TO; break; @@ -29684,7 +29688,10 @@ cp_parser_oacc_shape_clause (cp_parser *parser, omp_clause_code kind, } /* Check for the '*' argument. */ - if (cp_lexer_next_token_is (lexer, CPP_MULT)) + if (cp_lexer_next_token_is (lexer, CPP_MULT) + && (cp_lexer_nth_token_is (parser->lexer, 2, CPP_COMMA) + || cp_lexer_nth_token_is (parser->lexer, 2, + CPP_CLOSE_PAREN))) { cp_lexer_consume_token (lexer); ops[idx] = integer_minus_one_node; @@ -29752,6 +29759,52 @@ cp_parser_oacc_shape_clause (cp_parser *parser, omp_clause_code kind, return list; } +/* OpenACC 2.0: + tile ( size-expr-list ) */ + +static tree +cp_parser_oacc_clause_tile (cp_parser *parser, location_t clause_loc, tree list) +{ + tree c, expr = error_mark_node; + tree tile = NULL_TREE; + + check_no_duplicate_clause (list, OMP_CLAUSE_TILE, "tile", clause_loc); + + if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN)) + return list; + + do + { + if (cp_lexer_next_token_is (parser->lexer, CPP_MULT) + && (cp_lexer_nth_token_is (parser->lexer, 2, CPP_COMMA) + || cp_lexer_nth_token_is (parser->lexer, 2, CPP_CLOSE_PAREN))) + { + cp_lexer_consume_token (parser->lexer); + expr = integer_minus_one_node; + } + else + expr = cp_parser_assignment_expression (parser, NULL, false, false); + + if (expr == error_mark_node) + return list; + + tile = tree_cons (NULL_TREE, expr, tile); + + if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)) + cp_lexer_consume_token (parser->lexer); + } + while (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN)); + + /* Consume the trailing ')'. */ + cp_lexer_consume_token (parser->lexer); + + c = build_omp_clause (clause_loc, OMP_CLAUSE_TILE); + tile = nreverse (tile); + OMP_CLAUSE_TILE_LIST (c) = tile; + OMP_CLAUSE_CHAIN (c) = list; + return c; +} + /* OpenACC 2.0 Parse wait clause or directive parameters. */ @@ -29859,10 +29912,14 @@ cp_parser_omp_clause_collapse (cp_parser *parser, tree list, location_t location } /* OpenMP 2.5: - default ( shared | none ) */ + default ( shared | none ) + + OpenACC 2.0 + default (none) */ static tree -cp_parser_omp_clause_default (cp_parser *parser, tree list, location_t location) +cp_parser_omp_clause_default (cp_parser *parser, tree list, + location_t location, bool is_oacc) { enum omp_clause_default_kind kind = OMP_CLAUSE_DEFAULT_UNSPECIFIED; tree c; @@ -29883,7 +29940,7 @@ cp_parser_omp_clause_default (cp_parser *parser, tree list, location_t location) break; case 's': - if (strcmp ("shared", p) != 0) + if (strcmp ("shared", p) != 0 || is_oacc) goto invalid_kind; kind = OMP_CLAUSE_DEFAULT_SHARED; break; @@ -29897,7 +29954,10 @@ cp_parser_omp_clause_default (cp_parser *parser, tree list, location_t location) else { invalid_kind: - cp_parser_error (parser, "expected %<none%> or %<shared%>"); + if (is_oacc) + cp_parser_error (parser, "expected %<none%>"); + else + cp_parser_error (parser, "expected %<none%> or %<shared%>"); } if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN)) @@ -31444,6 +31504,10 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, clauses = cp_parser_oacc_data_clause (parser, c_kind, clauses); c_name = "delete"; break; + case PRAGMA_OMP_CLAUSE_DEFAULT: + clauses = cp_parser_omp_clause_default (parser, clauses, here, true); + c_name = "default"; + break; case PRAGMA_OACC_CLAUSE_DEVICE: clauses = cp_parser_oacc_data_clause (parser, c_kind, clauses); c_name = "device"; @@ -31452,6 +31516,11 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, clauses = cp_parser_oacc_data_clause_deviceptr (parser, clauses); c_name = "deviceptr"; break; + case PRAGMA_OACC_CLAUSE_FIRSTPRIVATE: + clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_FIRSTPRIVATE, + clauses); + c_name = "firstprivate"; + break; case PRAGMA_OACC_CLAUSE_GANG: c_name = "gang"; clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_GANG, @@ -31465,6 +31534,12 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, clauses = cp_parser_omp_clause_if (parser, clauses, here, false); c_name = "if"; break; + case PRAGMA_OACC_CLAUSE_INDEPENDENT: + clauses = cp_parser_oacc_simple_clause (parser, + OMP_CLAUSE_INDEPENDENT, + clauses, here); + c_name = "independent"; + break; case PRAGMA_OACC_CLAUSE_NUM_GANGS: code = OMP_CLAUSE_NUM_GANGS; c_name = "num_gangs"; @@ -31497,6 +31572,11 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, clauses = cp_parser_oacc_data_clause (parser, c_kind, clauses); c_name = "present_or_create"; break; + case PRAGMA_OACC_CLAUSE_PRIVATE: + clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE_PRIVATE, + clauses); + c_name = "private"; + break; case PRAGMA_OACC_CLAUSE_REDUCTION: clauses = cp_parser_omp_clause_reduction (parser, clauses); c_name = "reduction"; @@ -31510,6 +31590,10 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, clauses, here); c_name = "seq"; break; + case PRAGMA_OACC_CLAUSE_TILE: + clauses = cp_parser_oacc_clause_tile (parser, here, clauses); + c_name = "tile"; + break; case PRAGMA_OACC_CLAUSE_VECTOR: c_name = "vector"; clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_VECTOR, @@ -31598,7 +31682,7 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask, break; case PRAGMA_OMP_CLAUSE_DEFAULT: clauses = cp_parser_omp_clause_default (parser, clauses, - token->location); + token->location, false); c_name = "default"; break; case PRAGMA_OMP_CLAUSE_FINAL: @@ -34493,12 +34577,15 @@ cp_parser_oacc_enter_exit_data (cp_parser *parser, cp_token *pragma_tok, #define OACC_LOOP_CLAUSE_MASK \ ( (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_COLLAPSE) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRIVATE) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_REDUCTION) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_GANG) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_VECTOR) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_WORKER) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_AUTO) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_INDEPENDENT) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_SEQ) \ - | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_REDUCTION) ) + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_TILE)) static tree cp_parser_oacc_loop (cp_parser *parser, cp_token *pragma_tok, char *p_name, @@ -34543,6 +34630,7 @@ cp_parser_oacc_loop (cp_parser *parser, cp_token *pragma_tok, char *p_name, | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_COPYIN) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_COPYOUT) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_CREATE) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEFAULT) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEVICEPTR) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_IF) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT) \ @@ -34558,7 +34646,9 @@ cp_parser_oacc_loop (cp_parser *parser, cp_token *pragma_tok, char *p_name, | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_COPYIN) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_COPYOUT) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_CREATE) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEFAULT) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_DEVICEPTR) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_FIRSTPRIVATE) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_IF) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NUM_GANGS) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_NUM_WORKERS) \ @@ -34567,6 +34657,7 @@ cp_parser_oacc_loop (cp_parser *parser, cp_token *pragma_tok, char *p_name, | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRIVATE) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_REDUCTION) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_VECTOR_LENGTH) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_WAIT) ) @@ -34642,7 +34733,7 @@ cp_parser_oacc_update (cp_parser *parser, cp_token *pragma_tok) { error_at (pragma_tok->location, "%<#pragma acc update%> must contain at least one " - "%<device%> or %<host/self%> clause"); + "%<device%> or %<host%> or %<self%> clause"); return NULL_TREE; } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9e3bd2d..45eda3a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14395,6 +14395,13 @@ tsubst_omp_clauses (tree clauses, bool declare_simd, bool allow_fields, case OMP_CLAUSE_PRIORITY: case OMP_CLAUSE_ORDERED: case OMP_CLAUSE_HINT: + case OMP_CLAUSE_NUM_GANGS: + case OMP_CLAUSE_NUM_WORKERS: + case OMP_CLAUSE_VECTOR_LENGTH: + case OMP_CLAUSE_WORKER: + case OMP_CLAUSE_VECTOR: + case OMP_CLAUSE_ASYNC: + case OMP_CLAUSE_WAIT: OMP_CLAUSE_OPERAND (nc, 0) = tsubst_expr (OMP_CLAUSE_OPERAND (oc, 0), args, complain, in_decl, /*integral_constant_expression_p=*/false); @@ -14419,6 +14426,7 @@ tsubst_omp_clauses (tree clauses, bool declare_simd, bool allow_fields, = tsubst_omp_clause_decl (OMP_CLAUSE_DECL (oc), args, complain, in_decl); break; + case OMP_CLAUSE_GANG: case OMP_CLAUSE_ALIGNED: OMP_CLAUSE_DECL (nc) = tsubst_omp_clause_decl (OMP_CLAUSE_DECL (oc), args, complain, @@ -14461,6 +14469,22 @@ tsubst_omp_clauses (tree clauses, bool declare_simd, bool allow_fields, case OMP_CLAUSE_THREADS: case OMP_CLAUSE_SIMD: case OMP_CLAUSE_DEFAULTMAP: + case OMP_CLAUSE_INDEPENDENT: + case OMP_CLAUSE_AUTO: + case OMP_CLAUSE_SEQ: + break; + case OMP_CLAUSE_TILE: + { + tree lnc, loc; + for (lnc = OMP_CLAUSE_TILE_LIST (nc), + loc = OMP_CLAUSE_TILE_LIST (oc); + loc; + loc = TREE_CHAIN (loc), lnc = TREE_CHAIN (lnc)) + { + TREE_VALUE (lnc) = tsubst_expr (TREE_VALUE (loc), args, + complain, in_decl, false); + } + } break; default: gcc_unreachable (); @@ -15231,6 +15255,15 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, } break; + case OACC_KERNELS: + case OACC_PARALLEL: + tmp = tsubst_omp_clauses (OMP_CLAUSES (t), false, false, args, complain, + in_decl); + stmt = begin_omp_parallel (); + RECUR (OMP_BODY (t)); + finish_omp_construct (TREE_CODE (t), stmt, tmp); + break; + case OMP_PARALLEL: r = push_omp_privatization_clauses (OMP_PARALLEL_COMBINED (t)); tmp = tsubst_omp_clauses (OMP_PARALLEL_CLAUSES (t), false, true, @@ -15261,6 +15294,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, case CILK_FOR: case OMP_DISTRIBUTE: case OMP_TASKLOOP: + case OACC_LOOP: { tree clauses, body, pre_body; tree declv = NULL_TREE, initv = NULL_TREE, condv = NULL_TREE; @@ -15269,7 +15303,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, int i; r = push_omp_privatization_clauses (OMP_FOR_INIT (t) == NULL_TREE); - clauses = tsubst_omp_clauses (OMP_FOR_CLAUSES (t), false, true, + clauses = tsubst_omp_clauses (OMP_FOR_CLAUSES (t), false, + TREE_CODE (t) != OACC_LOOP, args, complain, in_decl); if (OMP_FOR_INIT (t) != NULL_TREE) { @@ -15339,9 +15374,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, pop_omp_privatization_clauses (r); break; + case OACC_DATA: case OMP_TARGET_DATA: case OMP_TARGET: - tmp = tsubst_omp_clauses (OMP_CLAUSES (t), false, true, + tmp = tsubst_omp_clauses (OMP_CLAUSES (t), false, + TREE_CODE (t) != OACC_DATA, args, complain, in_decl); keep_next_level (true); stmt = begin_omp_structured_block (); @@ -15395,6 +15432,16 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, add_stmt (t); break; + case OACC_ENTER_DATA: + case OACC_EXIT_DATA: + case OACC_UPDATE: + tmp = tsubst_omp_clauses (OMP_STANDALONE_CLAUSES (t), false, false, + args, complain, in_decl); + t = copy_node (t); + OMP_STANDALONE_CLAUSES (t) = tmp; + add_stmt (t); + break; + case OMP_ORDERED: tmp = tsubst_omp_clauses (OMP_ORDERED_CLAUSES (t), false, true, args, complain, in_decl); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index fe18b27..7702a41 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -6855,9 +6855,47 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd) case OMP_CLAUSE_DEFAULTMAP: case OMP_CLAUSE__CILK_FOR_COUNT_: case OMP_CLAUSE_AUTO: + case OMP_CLAUSE_INDEPENDENT: case OMP_CLAUSE_SEQ: break; + case OMP_CLAUSE_TILE: + for (tree list = OMP_CLAUSE_TILE_LIST (c); !remove && list; + list = TREE_CHAIN (list)) + { + t = TREE_VALUE (list); + + if (t == error_mark_node) + remove = true; + else if (!type_dependent_expression_p (t) + && !INTEGRAL_TYPE_P (TREE_TYPE (t))) + { + error ("%<tile%> value must be integral"); + remove = true; + } + else + { + t = mark_rvalue_use (t); + if (!processing_template_decl) + { + t = maybe_constant_value (t); + if (TREE_CODE (t) == INTEGER_CST + && tree_int_cst_sgn (t) != 1 + && t != integer_minus_one_node) + { + warning_at (OMP_CLAUSE_LOCATION (c), 0, + "%<tile%> value must be positive"); + t = integer_one_node; + } + } + t = fold_build_cleanup_point_expr (TREE_TYPE (t), t); + } + + /* Update list item. */ + TREE_VALUE (list) = t; + } + break; + case OMP_CLAUSE_ORDERED: ordered_seen = true; break; |