From patchwork Thu Jul 16 14:57:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 496721 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 A2E6B1402A9 for ; Fri, 17 Jul 2015 00:58:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Y8bSVgm0; 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=al8Y27Z5NOQ+A46BO eqSCx5cPGDb8NqiKpdo1F9wMn9S0EIE73DUNSJiXIOH7Jc3dAba9iAa0qXsgfL5S Sk9EhAcIVn9ltIZ3rxW4ULc7QLOA+6Yi6RnJWZGguKYK6AHXj9cNia+IpG8X6+ia Y9DXkWFRKZPk1qLf99QcUxApHo= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=phV7tetMWLzaFRm48GCWjJy 1QZg=; b=Y8bSVgm0+VE9MZWyZKG+R7ad26ajTAvyBs+XQlIFPh1mTKmc3EVLhIX Mz4OGA472hwPJf/GmGxJgNQaxk9vZuBGiaDsMl7J1f/fHAEK2+9D44DIRLF4QZYh G7MmK0j4vS2CgioZFn54Yy03RiiAQMQro8TQIB2uk1OeV/wvdFZQ= Received: (qmail 59396 invoked by alias); 16 Jul 2015 14:58:03 -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 58810 invoked by uid 89); 16 Jul 2015 14:58:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 16 Jul 2015 14:57:59 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 38A9E91D2C for ; Thu, 16 Jul 2015 14:57:58 +0000 (UTC) Received: from reynosa.quesejoda.com (vpn-55-251.rdu2.redhat.com [10.10.55.251]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6GEvunY009522; Thu, 16 Jul 2015 10:57:57 -0400 Message-ID: <55A7C674.8080405@redhat.com> Date: Thu, 16 Jul 2015 07:57:56 -0700 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Jakub Jelinek , Jason Merrill CC: gcc-patches Subject: Re: [gomp4.1] C++ iterators with #omp ordered depend(sink:) References: <55A67270.6050103@redhat.com> <20150715152102.GY1788@tucnak.redhat.com> <55A70342.4030602@redhat.com> <20150716070604.GC1788@tucnak.redhat.com> In-Reply-To: <20150716070604.GC1788@tucnak.redhat.com> On 07/16/2015 12:06 AM, Jakub Jelinek wrote: > Hi! > > CCing Jason on a tsubst issue below. > > On Wed, Jul 15, 2015 at 06:05:06PM -0700, Aldy Hernandez wrote: >> As I said on IRC, this looks ugly, but I can see why you wouldn't want the >> extra word on all loop variants. I've implemented it as requested. > > Thanks. > >> commit f55eced4ac6b045101a90914a8f27e99d26cfddf >> Author: Aldy Hernandez >> Date: Tue Jul 14 19:23:09 2015 -0700 >> >> * gimplify.c (gimplify_omp_for): Use OMP_FOR_ORIG_DECLS. >> * tree.def (omp_for): Add new operand. >> * tree.h (OMP_FOR_ORIG_DECLS): New macro. >> c-family/ >> * c-common.h (c_finish_omp_for): Add argument. >> * c-omp.c (c_finish_omp_for): Set OMP_FOR_ORIG_DECLS. >> cp/ >> * cp-tree.h (finish_omp_for): Add new argument. >> * parser.c (cp_parser_omp_for_loop): Pass new argument. >> * pt.c (tsubst_omp_for_iterator): New argument orig_declv. >> Set OMP_FOR_ORIG_DECLS from orig_declv if available. >> (tsubst_expr): Pass new vector to tsubst_omp_for_iterator. >> * semantics.c (finish_omp_for): Pass original DECLs to >> c_finish_omp_for. >> Set OMP_FOR_ORIG_DECLS. >> c/ >> * c-parser.c (c_parser_omp_for_loop): Pass new argument to >> c_finish_omp_for. > > Can you please add the > testsuite/ > additions to ChangeLog too? > >> @@ -13828,6 +13828,16 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv, >> >> init = TREE_VEC_ELT (OMP_FOR_INIT (t), i); >> gcc_assert (TREE_CODE (init) == MODIFY_EXPR); >> + >> + if (orig_declv && OMP_FOR_ORIG_DECLS (t)) >> + { >> + tree o = TREE_VEC_ELT (OMP_FOR_ORIG_DECLS (t), i); >> + tree spec = retrieve_local_specialization (o); >> + if (spec) >> + o = spec; > > Why doesn't o = RECUR (o); work here? Or tsubst_copy? > From my experience tsubst_expr can result in (here undesirable) convert_from_reference > if the decl has type of e.g. template parameter and you instantiate with > some reference type. But, that can only happen if the decl is dependent, > see below: Well, apparently I was covering something that fixing the dependent issue fixed. > >> @@ -14468,6 +14479,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, >> if (OMP_FOR_INIT (t) != NULL_TREE) >> { >> declv = make_tree_vec (TREE_VEC_LENGTH (OMP_FOR_INIT (t))); >> + if (TREE_CODE (t) == OMP_FOR) >> + orig_declv = make_tree_vec (TREE_VEC_LENGTH (OMP_FOR_INIT (t))); > > I'd have expected to guard this also with > if (TREE_CODE (t) == OMP_FOR && OMP_FOR_ORIG_DECLS (t) != NULL_TREE) > >> @@ -7302,6 +7303,9 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv, tree initv, >> TREE_VEC_ELT (initv, i) = init; >> } >> >> + if (!orig_declv || !TREE_VEC_LENGTH (orig_declv)) >> + orig_declv = copy_node (declv); > > When is TREE_VEC_LENGTH 0? Furthermore, I'd do this only after the > if (dependent_omp_for_p ()) fixed. > >> + >> if (dependent_omp_for_p (declv, initv, condv, incrv)) >> { >> tree stmt; >> @@ -7325,6 +7329,8 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv, tree initv, >> OMP_FOR_BODY (stmt) = body; >> OMP_FOR_PRE_BODY (stmt) = pre_body; >> OMP_FOR_CLAUSES (stmt) = clauses; >> + if (code == OMP_FOR) >> + OMP_FOR_ORIG_DECLS (stmt) = orig_declv; > > And leave this out. If something is dependent, we don't really modify it > before instantiation, thus there is no need to make a copy. During > instantiation another finish_omp_for will be called, then declv, initv, > condv, incrv won't be dependent and we can orig_declv = copy_node (declv). fixed. > >> diff --git a/gcc/testsuite/c-c++-common/gomp/sink-2.c b/gcc/testsuite/c-c++-common/gomp/sink-2.c >> new file mode 100644 >> index 0000000..7a075d4 >> --- /dev/null >> +++ b/gcc/testsuite/c-c++-common/gomp/sink-2.c >> @@ -0,0 +1,15 @@ >> +/* { dg-do compile } */ >> + >> +void bar (int *); >> + >> +void >> +foo () >> +{ >> + int i,j; >> +#pragma omp parallel for ordered(1) >> + for (i=0; i < 100; ++i) >> + { >> +#pragma omp ordered depend(sink:i-1) >> + bar(&i); > > Can you please add #pragma omp ordered depend(source) below the bar call? sure. Retested on x86-64 Linux. OK for branch? commit 9d6a83abf8759b72b75f2690eab33f8b4d3fc199 Author: Aldy Hernandez Date: Tue Jul 14 19:23:09 2015 -0700 * gimplify.c (gimplify_omp_for): Use OMP_FOR_ORIG_DECLS. * tree.def (omp_for): Add new operand. * tree.h (OMP_FOR_ORIG_DECLS): New macro. c-family/ * c-common.h (c_finish_omp_for): Add argument. * c-omp.c (c_finish_omp_for): Set OMP_FOR_ORIG_DECLS. cp/ * cp-tree.h (finish_omp_for): Add new argument. * parser.c (cp_parser_omp_for_loop): Pass new argument. * pt.c (tsubst_omp_for_iterator): New argument orig_declv. Set OMP_FOR_ORIG_DECLS from orig_declv if available. (tsubst_expr): Pass new vector to tsubst_omp_for_iterator. * semantics.c (finish_omp_for): Pass original DECLs to c_finish_omp_for. Set OMP_FOR_ORIG_DECLS. c/ * c-parser.c (c_parser_omp_for_loop): Pass new argument to c_finish_omp_for. testsuite/ * c-c++-common/gomp/sink-2.c: New test. * g++.dg/gomp/sink-2.C: New test. diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 202c8f9..7e857c3 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1245,7 +1245,7 @@ extern void c_finish_omp_flush (location_t); extern void c_finish_omp_taskwait (location_t); extern void c_finish_omp_taskyield (location_t); extern tree c_finish_omp_for (location_t, enum tree_code, tree, tree, tree, - tree, tree, tree); + tree, tree, tree, tree); extern tree c_finish_oacc_wait (location_t, tree, tree); extern void c_omp_split_clauses (location_t, enum tree_code, omp_clause_mask, tree, tree *); diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index f020a80..49cf5c7 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -432,6 +432,10 @@ c_omp_for_incr_canonicalize_ptr (location_t loc, tree decl, tree incr) /* Validate and generate OMP_FOR. DECLV is a vector of iteration variables, for each collapsed loop. + + ORIG_DECLV, if non-NULL, is a vector with the original iteration + variables (prior to any transformations, by say, C++ iterators). + INITV, CONDV and INCRV are vectors containing initialization expressions, controlling predicates and increment expressions. BODY is the body of the loop and PRE_BODY statements that go before @@ -439,7 +443,8 @@ c_omp_for_incr_canonicalize_ptr (location_t loc, tree decl, tree incr) tree c_finish_omp_for (location_t locus, enum tree_code code, tree declv, - tree initv, tree condv, tree incrv, tree body, tree pre_body) + tree orig_declv, tree initv, tree condv, tree incrv, + tree body, tree pre_body) { location_t elocus; bool fail = false; @@ -678,6 +683,8 @@ c_finish_omp_for (location_t locus, enum tree_code code, tree declv, OMP_FOR_INCR (t) = incrv; OMP_FOR_BODY (t) = body; OMP_FOR_PRE_BODY (t) = pre_body; + if (code == OMP_FOR) + OMP_FOR_ORIG_DECLS (t) = orig_declv; SET_EXPR_LOCATION (t, locus); return add_stmt (t); diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 90486d2..0a42072 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -13696,7 +13696,7 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, an error from the initialization parsing. */ if (!fail) { - stmt = c_finish_omp_for (loc, code, declv, initv, condv, + stmt = c_finish_omp_for (loc, code, declv, NULL, initv, condv, incrv, body, NULL); if (stmt) { diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 650473d..8513917 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6027,7 +6027,7 @@ extern tree begin_omp_task (void); extern tree finish_omp_task (tree, tree); extern tree finish_omp_for (location_t, enum tree_code, tree, tree, tree, tree, tree, - tree, tree); + tree, tree, tree); extern void finish_omp_atomic (enum tree_code, enum tree_code, tree, tree, tree, tree, tree, bool); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 5eaf7d9..b5d9508 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -31328,8 +31328,8 @@ cp_parser_omp_for_loop (cp_parser *parser, enum tree_code code, tree clauses, if (declv == NULL_TREE) ret = NULL_TREE; else - ret = finish_omp_for (loc_first, code, declv, initv, condv, incrv, body, - pre_body, clauses); + ret = finish_omp_for (loc_first, code, declv, NULL, initv, condv, incrv, + body, pre_body, clauses); while (nbraces) { diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c6320c9..2e78031 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13816,8 +13816,8 @@ static tree *omp_parallel_combined_clauses; /* Substitute one OMP_FOR iterator. */ static void -tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv, - tree condv, tree incrv, tree *clauses, +tsubst_omp_for_iterator (tree t, int i, tree declv, tree orig_declv, + tree initv, tree condv, tree incrv, tree *clauses, tree args, tsubst_flags_t complain, tree in_decl, bool integral_constant_expression_p) { @@ -13828,6 +13828,14 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv, init = TREE_VEC_ELT (OMP_FOR_INIT (t), i); gcc_assert (TREE_CODE (init) == MODIFY_EXPR); + + if (orig_declv && OMP_FOR_ORIG_DECLS (t)) + { + tree o = TREE_VEC_ELT (OMP_FOR_ORIG_DECLS (t), i); + o = RECUR (o); + TREE_VEC_ELT (orig_declv, i) = o; + } + decl = TREE_OPERAND (init, 0); init = TREE_OPERAND (init, 1); tree decl_expr = NULL_TREE; @@ -14459,6 +14467,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, { tree clauses, body, pre_body; tree declv = NULL_TREE, initv = NULL_TREE, condv = NULL_TREE; + tree orig_declv = NULL_TREE; tree incrv = NULL_TREE; int i; @@ -14468,6 +14477,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, if (OMP_FOR_INIT (t) != NULL_TREE) { declv = make_tree_vec (TREE_VEC_LENGTH (OMP_FOR_INIT (t))); + if (TREE_CODE (t) == OMP_FOR && OMP_FOR_ORIG_DECLS (t)) + orig_declv = make_tree_vec (TREE_VEC_LENGTH (OMP_FOR_INIT (t))); initv = make_tree_vec (TREE_VEC_LENGTH (OMP_FOR_INIT (t))); condv = make_tree_vec (TREE_VEC_LENGTH (OMP_FOR_INIT (t))); incrv = make_tree_vec (TREE_VEC_LENGTH (OMP_FOR_INIT (t))); @@ -14481,8 +14492,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, if (OMP_FOR_INIT (t) != NULL_TREE) for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (t)); i++) - tsubst_omp_for_iterator (t, i, declv, initv, condv, incrv, - &clauses, args, complain, in_decl, + tsubst_omp_for_iterator (t, i, declv, orig_declv, initv, condv, + incrv, &clauses, args, complain, in_decl, integral_constant_expression_p); omp_parallel_combined_clauses = NULL; @@ -14491,8 +14502,9 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, body = pop_stmt_list (body); if (OMP_FOR_INIT (t) != NULL_TREE) - t = finish_omp_for (EXPR_LOCATION (t), TREE_CODE (t), declv, initv, - condv, incrv, body, pre_body, clauses); + t = finish_omp_for (EXPR_LOCATION (t), TREE_CODE (t), declv, + orig_declv, initv, condv, incrv, body, pre_body, + clauses); else { t = make_node (TREE_CODE (t)); @@ -22151,7 +22163,7 @@ dependent_template_id_p (tree tmpl, tree args) } /* Returns TRUE if OMP_FOR with DECLV, INITV, CONDV and INCRV vectors - is dependent. */ + are dependent. */ bool dependent_omp_for_p (tree declv, tree initv, tree condv, tree incrv) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 5e7a94d..37fd682 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7235,8 +7235,9 @@ handle_omp_for_class_iterator (int i, location_t locus, enum tree_code code, sk_omp scope. */ tree -finish_omp_for (location_t locus, enum tree_code code, tree declv, tree initv, - tree condv, tree incrv, tree body, tree pre_body, tree clauses) +finish_omp_for (location_t locus, enum tree_code code, tree declv, + tree orig_declv, tree initv, tree condv, tree incrv, + tree body, tree pre_body, tree clauses) { tree omp_for = NULL, orig_incr = NULL; tree decl = NULL, init, cond, incr, orig_decl = NULL_TREE, block = NULL_TREE; @@ -7330,6 +7331,9 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv, tree initv, return add_stmt (stmt); } + if (!orig_declv) + orig_declv = copy_node (declv); + if (processing_template_decl) orig_incr = make_tree_vec (TREE_VEC_LENGTH (incrv)); @@ -7430,8 +7434,8 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv, tree initv, if (code == CILK_FOR && !processing_template_decl) block = push_stmt_list (); - omp_for = c_finish_omp_for (locus, code, declv, initv, condv, incrv, - body, pre_body); + omp_for = c_finish_omp_for (locus, code, declv, orig_declv, initv, condv, + incrv, body, pre_body); if (omp_for == NULL) { diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 9ba3f37..ed3fe3e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -7311,7 +7311,11 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) gcc_assert (DECL_P (decl)); gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (decl)) || POINTER_TYPE_P (TREE_TYPE (decl))); - gimplify_omp_ctxp->iter_vars.quick_push (decl); + if (TREE_CODE (for_stmt) == OMP_FOR && OMP_FOR_ORIG_DECLS (for_stmt)) + gimplify_omp_ctxp->iter_vars.quick_push + (TREE_VEC_ELT (OMP_FOR_ORIG_DECLS (for_stmt), i)); + else + gimplify_omp_ctxp->iter_vars.quick_push (decl); /* Make sure the iteration variable is private. */ tree c = NULL_TREE; diff --git a/gcc/testsuite/c-c++-common/gomp/sink-2.c b/gcc/testsuite/c-c++-common/gomp/sink-2.c new file mode 100644 index 0000000..e781a6f --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/sink-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +void bar (int *); + +void +foo () +{ + int i,j; +#pragma omp parallel for ordered(1) + for (i=0; i < 100; ++i) + { +#pragma omp ordered depend(sink:i-1) + bar(&i); +#pragma omp ordered depend(source) + } +} diff --git a/gcc/testsuite/g++.dg/gomp/sink-2.C b/gcc/testsuite/g++.dg/gomp/sink-2.C new file mode 100644 index 0000000..d1681a7 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/sink-2.C @@ -0,0 +1,64 @@ +/* { dg-do compile } */ + +/* Tests iterators are allowed in ordered loops and that we keep track + of the original iterator DECL for diagnostic purposes. */ + +#include +#include + +/* Test plain iterator. */ +void foo1 () +{ + std::vector v; + for (int i=1; i<=5; i++) v.push_back(i); + + std::vector::const_iterator it; + +#pragma omp parallel for ordered(1) + for (it = v.begin(); it < v.end(); ++it) + { +#pragma omp ordered depend(sink:it-1) + std::cout << *it << '\n'; +#pragma omp ordered depend(source) + } +} + +/* Test non-dependent iterator in a template. */ +template +void foo2 () +{ + std::vector v; + for (int i=1; i<=5; i++) v.push_back(i); + + std::vector::const_iterator it; +#pragma omp parallel for ordered(1) + for (it = v.begin(); it < v.end(); ++it) + { +#pragma omp ordered depend(sink:it-1) + std::cout << *it << '\n'; +#pragma omp ordered depend(source) + } +} + +/* Test dependent iterator in a template. */ +template +void foo3 () +{ + std::vector v; + for (int i=1; i<=5; i++) v.push_back(i); + + typename std::vector::const_iterator it; +#pragma omp parallel for ordered(1) + for (it = v.begin(); it < v.end(); ++it) + { +#pragma omp ordered depend(sink:it-1) + std::cout << *it << '\n'; +#pragma omp ordered depend(source) + } +} + +int main () +{ + foo2 <0> (); + foo3 (); +} diff --git a/gcc/tree.def b/gcc/tree.def index 6703b57..64e0727 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -1087,36 +1087,41 @@ DEFTREECODE (OMP_TASK, "omp_task", tcc_statement, 2) from INIT, COND, and INCR that are technically part of the OMP_FOR structured block, but are evaluated before the loop body begins. + Operand 6: OMP_FOR_ORIG_DECLS: If non-NULL, list of DECLs initialized + in OMP_FOR_INIT. In some cases, like C++ iterators, the original + DECL init has been lost in gimplification and now contains a + temporary (D.nnnn). This list contains the original DECLs in + the source. VAR must be an integer or pointer variable, which is implicitly thread private. N1, N2 and INCR are required to be loop invariant integer expressions that are evaluated without any synchronization. The evaluation order, frequency of evaluation and side-effects are unspecified by the standards. */ -DEFTREECODE (OMP_FOR, "omp_for", tcc_statement, 6) +DEFTREECODE (OMP_FOR, "omp_for", tcc_statement, 7) /* OpenMP - #pragma omp simd [clause1 ... clauseN] - Operands like for OMP_FOR. */ + Operands like operands 1-6 of OMP_FOR. */ DEFTREECODE (OMP_SIMD, "omp_simd", tcc_statement, 6) /* Cilk Plus - #pragma simd [clause1 ... clauseN] - Operands like for OMP_FOR. */ + Operands like operands 1-6 of OMP_FOR. */ DEFTREECODE (CILK_SIMD, "cilk_simd", tcc_statement, 6) /* Cilk Plus - _Cilk_for (..) - Operands like for OMP_FOR. */ + Operands like operands 1-6 of OMP_FOR. */ DEFTREECODE (CILK_FOR, "cilk_for", tcc_statement, 6) /* OpenMP - #pragma omp distribute [clause1 ... clauseN] - Operands like for OMP_FOR. */ + Operands like operands 1-6 of OMP_FOR. */ DEFTREECODE (OMP_DISTRIBUTE, "omp_distribute", tcc_statement, 6) /* OpenMP - #pragma omp taskloop [clause1 ... clauseN] - Operands like for OMP_FOR. */ + Operands like operands 1-6 of OMP_FOR. */ DEFTREECODE (OMP_TASKLOOP, "omp_taskloop", tcc_statement, 6) /* OpenMP - #pragma acc loop [clause1 ... clauseN] - Operands like for OMP_FOR. */ + Operands like operands 1-6 of OMP_FOR. */ DEFTREECODE (OACC_LOOP, "oacc_loop", tcc_statement, 6) /* OpenMP - #pragma omp teams [clause1 ... clauseN] diff --git a/gcc/tree.h b/gcc/tree.h index 7ea7a93..9db3c40 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1260,6 +1260,8 @@ extern void protected_set_expr_location (tree, location_t); #define OMP_FOR_COND(NODE) TREE_OPERAND (OMP_LOOP_CHECK (NODE), 3) #define OMP_FOR_INCR(NODE) TREE_OPERAND (OMP_LOOP_CHECK (NODE), 4) #define OMP_FOR_PRE_BODY(NODE) TREE_OPERAND (OMP_LOOP_CHECK (NODE), 5) +/* Note that this is only available for OMP_FOR, hence OMP_FOR_CHECK. */ +#define OMP_FOR_ORIG_DECLS(NODE) TREE_OPERAND (OMP_FOR_CHECK (NODE), 6) #define OMP_SECTIONS_BODY(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 0) #define OMP_SECTIONS_CLAUSES(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 1)