* Re: [gomp4] revert num_gangs, num_workers, vector_length and num_threads parser changes in c/c++
2015-10-29 14:09 [gomp4] revert num_gangs, num_workers, vector_length and num_threads parser changes in c/c++ Cesar Philippidis
@ 2015-10-29 18:43 ` Cesar Philippidis
0 siblings, 0 replies; 2+ messages in thread
From: Cesar Philippidis @ 2015-10-29 18:43 UTC (permalink / raw)
To: gcc-patches; +Cc: Thomas Schwinge
[-- Attachment #1: Type: text/plain, Size: 1123 bytes --]
On 10/29/2015 07:08 AM, Cesar Philippidis wrote:
> In gomp-4_0-branch, we've tried to consolidate the parsing all of the
> clauses of the form
>
> foo (int-expression)
>
> into a single c*_parser_omp_positive_int_clause function. At the time,
> such clauses included num_gangs, num_workers, vector_length and
> num_threads. Looking at OpenMP 4.5, there are additional candidates for
> this function, specifically num_tasks, grainsize, priority and hint.
> With that in mind, parser support for all of the aforementioned clauses
> is already present in trunk, so I'll revert these change in
> gomp-4_0-branch since they add no functionality. We might revisit a
> similar patch if OpenACC adds new clauses of this form in the future.
>
> I've applied this patch to gomp-4_0-branch.
I found some other bits that needed to be transferred from trunk, which
the attached patch does.
Note that I introduced a regression in template.C in gomp-4_0-branch in
the previous patch. The plan is to get templates working in trunk first,
then backport the fix to gomp-4_0-branch.
I've applied this patch to gomp-4_0-branch.
Cesar
[-- Attachment #2: cxxfe_revert.diff --]
[-- Type: text/x-patch, Size: 4678 bytes --]
2015-10-29 Cesar Philippidis <cesar@codesourcery.com>
gcc/cp/
* parser.c (cp_parser_omp_simple_clause): Rename to ...
(cp_parser_oacc_simple_clause): ... this.
(cp_parser_omp_clause_untied): Restore from trunk.
(cp_parser_omp_clause_branch): Likewise.
(cp_parser_oacc_all_clauses): Use cp_parser_oacc_simple_clause for
OACC_CLAUSE_{AUTO,INDEPENDENT,NOHOST,NUM_GANGS,SEQ}.
(cp_parser_omp_all_clauses): Use cp_parser_omp_clause_untied for
OMP_CLAUSE_UNTIED, and cp_parser_omp_clause_branch for
OMP_CLAUSE_{INBRANCH,NOTINBRANCH} and CICK_CLAUSE_{MASK,NOMASK}.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 71c33c4..8c1b20d 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -29642,6 +29642,23 @@ cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list)
return list;
}
+/* OpenACC 2.0:
+ auto
+ independent
+ nohost
+ seq */
+
+static tree
+cp_parser_oacc_simple_clause (cp_parser * /* parser */,
+ enum omp_clause_code code,
+ tree list, location_t location)
+{
+ check_no_duplicate_clause (list, code, omp_clause_code_name[code], location);
+ tree c = build_omp_clause (location, code);
+ OMP_CLAUSE_CHAIN (c) = list;
+ return c;
+}
+
/* OpenACC:
gang [( gang-arg-list )]
@@ -30886,20 +30903,27 @@ cp_parser_omp_clause_schedule (cp_parser *parser, tree list, location_t location
}
/* OpenMP 3.0:
- untied
+ untied */
- OpenMP 4.0:
- inbranch
- notinbranch
+static tree
+cp_parser_omp_clause_untied (cp_parser * /*parser*/,
+ tree list, location_t location)
+{
+ tree c;
- OpenACC 2.0:
- auto
- independent
- nohost
- seq */
+ check_no_duplicate_clause (list, OMP_CLAUSE_UNTIED, "untied", location);
+
+ c = build_omp_clause (location, OMP_CLAUSE_UNTIED);
+ OMP_CLAUSE_CHAIN (c) = list;
+ return c;
+}
+
+/* OpenMP 4.0:
+ inbranch
+ notinbranch */
static tree
-cp_parser_omp_simple_clause (cp_parser * /*parser*/, enum omp_clause_code code,
+cp_parser_omp_clause_branch (cp_parser * /*parser*/, enum omp_clause_code code,
tree list, location_t location)
{
check_no_duplicate_clause (list, code, omp_clause_code_name[code], location);
@@ -31697,7 +31721,7 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
c_name = "async";
break;
case PRAGMA_OACC_CLAUSE_AUTO:
- clauses = cp_parser_omp_simple_clause (parser, OMP_CLAUSE_AUTO,
+ clauses = cp_parser_oacc_simple_clause (parser, OMP_CLAUSE_AUTO,
clauses, here);
c_name = "auto";
break;
@@ -31762,9 +31786,9 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
c_name = "if";
break;
case PRAGMA_OACC_CLAUSE_INDEPENDENT:
- clauses = cp_parser_omp_simple_clause (parser,
- OMP_CLAUSE_INDEPENDENT,
- clauses, here);
+ clauses = cp_parser_oacc_simple_clause (parser,
+ OMP_CLAUSE_INDEPENDENT,
+ clauses, here);
c_name = "independent";
break;
case PRAGMA_OACC_CLAUSE_GANG:
@@ -31781,8 +31805,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
c_name = "link";
break;
case PRAGMA_OACC_CLAUSE_NOHOST:
- clauses = cp_parser_omp_simple_clause (parser, OMP_CLAUSE_NOHOST,
- clauses, here);
+ clauses = cp_parser_oacc_simple_clause (parser, OMP_CLAUSE_NOHOST,
+ clauses, here);
c_name = "nohost";
break;
case PRAGMA_OACC_CLAUSE_NUM_GANGS:
@@ -31823,7 +31847,7 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
c_name = "reduction";
break;
case PRAGMA_OACC_CLAUSE_SEQ:
- clauses = cp_parser_omp_simple_clause (parser, OMP_CLAUSE_SEQ,
+ clauses = cp_parser_oacc_simple_clause (parser, OMP_CLAUSE_SEQ,
clauses, here);
c_name = "seq";
break;
@@ -32022,19 +32046,19 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
c_name = "shared";
break;
case PRAGMA_OMP_CLAUSE_UNTIED:
- clauses = cp_parser_omp_simple_clause (parser, OMP_CLAUSE_UNTIED,
- clauses, token->location);
+ clauses = cp_parser_omp_clause_untied (parser, clauses,
+ token->location);
c_name = "untied";
break;
case PRAGMA_OMP_CLAUSE_INBRANCH:
case PRAGMA_CILK_CLAUSE_MASK:
- clauses = cp_parser_omp_simple_clause (parser, OMP_CLAUSE_INBRANCH,
+ clauses = cp_parser_omp_clause_branch (parser, OMP_CLAUSE_INBRANCH,
clauses, token->location);
c_name = "inbranch";
break;
case PRAGMA_OMP_CLAUSE_NOTINBRANCH:
case PRAGMA_CILK_CLAUSE_NOMASK:
- clauses = cp_parser_omp_simple_clause (parser,
+ clauses = cp_parser_omp_clause_branch (parser,
OMP_CLAUSE_NOTINBRANCH,
clauses, token->location);
c_name = "notinbranch";
^ permalink raw reply [flat|nested] 2+ messages in thread