From patchwork Wed Apr 29 15:25:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 466162 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 91CD214032B for ; Thu, 30 Apr 2015 01:26:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=D+hn0u7h; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=ogK44ky6pGKpaidj doUOSVUOz0yh0ybXcp6r4793/Xd5uw/LmdsnHSSMMnFOJF1RnVWc8pitnj6t7MuR E+e9FnnYU2TE8DVkT5csc7gZCJD9sCgss7TxCXL2JpO+eggAGYrYEoWeR9V8Kx9x GPekuKx6tCzcEB6K+Ff4lWkYXpc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=+QhMmR6PpPOiY0H6C5lL6Z 5pSNE=; b=D+hn0u7hhROckG4ncSocYy9Ou+77Klo1YB4hZxTbI9sW31EPhfJMsl VidgWDPcO5GYToFOUAhiEfD6Ae2YCZPyFqROStT1BQ6r1ZB31ey9eWA5sVCuCkXY Y7f3e19q9ufbRtH6QceTdjW5LNm09Nj2dvtSCIksCoHMc1shl3J3U= Received: (qmail 75871 invoked by alias); 29 Apr 2015 15:26:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 75846 invoked by uid 89); 29 Apr 2015 15:26:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Apr 2015 15:26:00 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YnTs4-0002lm-Vx from Thomas_Schwinge@mentor.com ; Wed, 29 Apr 2015 08:25:57 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Wed, 29 Apr 2015 16:25:55 +0100 From: Thomas Schwinge To: Jakub Jelinek CC: , Cesar Philippidis Subject: Re: OMP_CLAUSES with clauses in operand 0 In-Reply-To: <20150429143624.GI1751@tucnak.redhat.com> References: <553E695A.2070007@mentor.com> <87zj5ttqpz.fsf@schwinge.name> <553E787A.1020109@mentor.com> <87383kt7kx.fsf@schwinge.name> <20150429085332.GC1751@tucnak.redhat.com> <87egn3s2p4.fsf@schwinge.name> <20150429093231.GD1751@tucnak.redhat.com> <877fsvrxuu.fsf@schwinge.name> <20150429114355.GF1751@tucnak.redhat.com> <871tj3roor.fsf@schwinge.name> <20150429143624.GI1751@tucnak.redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Wed, 29 Apr 2015 17:25:39 +0200 Message-ID: <87twvzq7m4.fsf@schwinge.name> MIME-Version: 1.0 Hi Jakub! On Wed, 29 Apr 2015 16:36:24 +0200, Jakub Jelinek wrote: > On Wed, Apr 29, 2015 at 04:31:32PM +0200, Thomas Schwinge wrote: > > > So yes, I really prefer OMP_STANDALONE_CLAUSES over OMP_CLAUSES for > > > everything. > > > > Like this (for trunk)? > > > > commit 300e28fce192cb56d73cb61f787872643030f0bf > > Author: Thomas Schwinge > > Date: Wed Apr 29 16:18:49 2015 +0200 > > > > Add OMP_STANDALONE_CLAUSES. > > > > gcc/ > > * tree.h (OACC_CACHE_CLAUSES, OACC_DECLARE_CLAUSES) > > (OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES) > > (OACC_UPDATE_CLAUSES, OMP_TARGET_UPDATE_CLAUSES): Merge into... > > (OMP_STANDALONE_CLAUSES): ... this new macro. Adjust all users. > > I would keep the specific *_CLAUSES macros, just add > OMP_STANDALONE_CLAUSES and change the uses only if you are dealing with > multiple different codes. That will match OMP_CLAUSES vs. OMP_FOR_CLAUSES, > OMP_PARALLEL_CLAUSES etc. My (non-explicit) rationale has been: > > --- gcc/c/c-parser.c > > +++ gcc/c/c-parser.c > > @@ -11987,7 +11987,7 @@ c_parser_oacc_cache (location_t loc, c_parser *parser) > > > > stmt = make_node (OACC_CACHE); We have just created a OACC_CACHE node here... > > TREE_TYPE (stmt) = void_type_node; > > - OACC_CACHE_CLAUSES (stmt) = clauses; > > + OMP_STANDALONE_CLAUSES (stmt) = clauses; ..., so there is no point in checking here that we're indeed dealing specifically with an OACC_CACHE node. > So, drop hunks like this. > > > @@ -12155,10 +12155,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); > > } > > And just keep ones like this. Done. (I also reverted the gcc/cp/pt.c:tsubst_expr change which motivated this patch; will include that with the patch adding support for C++ templates usage with OpenACC directives.) OK for trunk? commit 82e588b6d62f9e7254e76a3dfcc46efceb2075a5 Author: Thomas Schwinge Date: Wed Apr 29 17:08:17 2015 +0200 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. --- gcc/c/c-parser.c | 5 +---- gcc/cp/parser.c | 5 +---- gcc/gimplify.c | 13 +++++-------- gcc/tree.h | 6 ++++++ 4 files changed, 13 insertions(+), 16 deletions(-) Grüße, Thomas diff --git gcc/c/c-parser.c gcc/c/c-parser.c index f5e2ac2c..015de7f 100644 --- gcc/c/c-parser.c +++ gcc/c/c-parser.c @@ -12155,10 +12155,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 gcc/cp/parser.c gcc/cp/parser.c index 4ea2ca2..cfb512b 100644 --- gcc/cp/parser.c +++ 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 gcc/gimplify.c gcc/gimplify.c index c68bd47..bda62ce 100644 --- gcc/gimplify.c +++ gcc/gimplify.c @@ -7427,34 +7427,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 gcc/tree.h gcc/tree.h index 2ec9708..e17bd9b 100644 --- gcc/tree.h +++ 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) \