From b811915de18ac5837e60898cf05cbb428dc35ead Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 29 Apr 2015 17:44:41 +0200 Subject: [PATCH] Add OMP_STANDALONE_CLAUSES. gcc/ * tree.h (OMP_STANDALONE_CLAUSES): New macro. * gimplify.c (gimplify_omp_workshare): Use it. gcc/c/ * c-parser.c (c_parser_oacc_enter_exit_data): Use OMP_STANDALONE_CLAUSES. gcc/cp/ * parser.c (cp_parser_oacc_enter_exit_data): Use OMP_STANDALONE_CLAUSES. From-SVN: r222580 --- gcc/ChangeLog | 5 +++++ gcc/c/ChangeLog | 5 +++++ gcc/c/c-parser.c | 5 +---- gcc/cp/ChangeLog | 5 +++++ gcc/cp/parser.c | 5 +---- gcc/gimplify.c | 13 +++++-------- gcc/tree.h | 6 ++++++ 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4fb54903d61..11cb62ae7bb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-04-29 Thomas Schwinge + + * tree.h (OMP_STANDALONE_CLAUSES): New macro. + * gimplify.c (gimplify_omp_workshare): Use it. + 2015-04-29 Richard Sandiford * Makefile.in (build/genrecog.o): Depend on inchash.h. diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 9c769ca6d93..6d8dbb1b135 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2015-04-29 Thomas Schwinge + + * c-parser.c (c_parser_oacc_enter_exit_data): Use + OMP_STANDALONE_CLAUSES. + 2015-04-28 Marek Polacek * c-parser.c (c_parser_binary_expression): Remove duplicate line. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index cc8a4e36a27..bf0e4c577cc 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -12154,10 +12154,7 @@ c_parser_oacc_enter_exit_data (c_parser *parser, bool enter) stmt = enter ? make_node (OACC_ENTER_DATA) : make_node (OACC_EXIT_DATA); TREE_TYPE (stmt) = void_type_node; - if (enter) - OACC_ENTER_DATA_CLAUSES (stmt) = clauses; - else - OACC_EXIT_DATA_CLAUSES (stmt) = clauses; + OMP_STANDALONE_CLAUSES (stmt) = clauses; SET_EXPR_LOCATION (stmt, loc); add_stmt (stmt); } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3ee050ce753..9442faa9c40 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-04-29 Thomas Schwinge + + * parser.c (cp_parser_oacc_enter_exit_data): Use + OMP_STANDALONE_CLAUSES. + 2015-04-29 Paolo Carlini PR c++/64667 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 4ea2ca2db4a..cfb512be8e7 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -31606,10 +31606,7 @@ cp_parser_oacc_enter_exit_data (cp_parser *parser, cp_token *pragma_tok, stmt = enter ? make_node (OACC_ENTER_DATA) : make_node (OACC_EXIT_DATA); TREE_TYPE (stmt) = void_type_node; - if (enter) - OACC_ENTER_DATA_CLAUSES (stmt) = clauses; - else - OACC_EXIT_DATA_CLAUSES (stmt) = clauses; + OMP_STANDALONE_CLAUSES (stmt) = clauses; SET_EXPR_LOCATION (stmt, pragma_tok->location); add_stmt (stmt); return stmt; diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 1d5341eec5b..9ce3dd973cc 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -7411,34 +7411,31 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p) static void gimplify_omp_target_update (tree *expr_p, gimple_seq *pre_p) { - tree expr = *expr_p, clauses; + tree expr = *expr_p; int kind; gomp_target *stmt; switch (TREE_CODE (expr)) { case OACC_ENTER_DATA: - clauses = OACC_ENTER_DATA_CLAUSES (expr); kind = GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA; break; case OACC_EXIT_DATA: - clauses = OACC_EXIT_DATA_CLAUSES (expr); kind = GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA; break; case OACC_UPDATE: - clauses = OACC_UPDATE_CLAUSES (expr); kind = GF_OMP_TARGET_KIND_OACC_UPDATE; break; case OMP_TARGET_UPDATE: - clauses = OMP_TARGET_UPDATE_CLAUSES (expr); kind = GF_OMP_TARGET_KIND_UPDATE; break; default: gcc_unreachable (); } - gimplify_scan_omp_clauses (&clauses, pre_p, ORT_WORKSHARE); - gimplify_adjust_omp_clauses (pre_p, &clauses); - stmt = gimple_build_omp_target (NULL, kind, clauses); + gimplify_scan_omp_clauses (&OMP_STANDALONE_CLAUSES (expr), pre_p, + ORT_WORKSHARE); + gimplify_adjust_omp_clauses (pre_p, &OMP_STANDALONE_CLAUSES (expr)); + stmt = gimple_build_omp_target (NULL, kind, OMP_STANDALONE_CLAUSES (expr)); gimplify_seq_add_stmt (pre_p, stmt); *expr_p = NULL_TREE; diff --git a/gcc/tree.h b/gcc/tree.h index 2ec970884b6..e17bd9b1109 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1197,11 +1197,17 @@ extern void protected_set_expr_location (tree, location_t); /* OpenMP and OpenACC directive and clause accessors. */ +/* Generic accessors for OMP nodes that keep the body as operand 0, and clauses + as operand 1. */ #define OMP_BODY(NODE) \ TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_PARALLEL, OMP_CRITICAL), 0) #define OMP_CLAUSES(NODE) \ TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_PARALLEL, OMP_SINGLE), 1) +/* Generic accessors for OMP nodes that keep clauses as operand 0. */ +#define OMP_STANDALONE_CLAUSES(NODE) \ + TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_CACHE, OMP_TARGET_UPDATE), 0) + #define OACC_PARALLEL_BODY(NODE) \ TREE_OPERAND (OACC_PARALLEL_CHECK (NODE), 0) #define OACC_PARALLEL_CLAUSES(NODE) \ -- 2.30.2