diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-11-02 00:30:55 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-11-02 00:30:55 +0100 |
commit | 917dd789e55c88123d804a8a411e4a61ee7b6e43 (patch) | |
tree | f9f2f596da38caa176b5dafe2a18ac61f1957f4f /gcc/c-family | |
parent | f968ef9b8df2bc2287e5e7e87299e5a2a44e8c94 (diff) | |
download | gcc-917dd789e55c88123d804a8a411e4a61ee7b6e43.zip gcc-917dd789e55c88123d804a8a411e4a61ee7b6e43.tar.gz gcc-917dd789e55c88123d804a8a411e4a61ee7b6e43.tar.bz2 |
omp-general.h (omp_context_selector_set_compare): Declare.
* omp-general.h (omp_context_selector_set_compare): Declare.
* omp-general.c (omp_construct_simd_compare,
omp_context_selector_props_compare, omp_context_selector_set_compare,
omp_context_selector_compare): New functions.
(omp_resolve_declare_variant): Prune variants that are strict subset
of another variant.
c-family/
* c-omp.c (c_omp_mark_declare_variant): Use
omp_context_selector_set_compare.
testsuite/
* c-c++-common/gomp/declare-variant-6.c: Expect construct rather than
constructor in diagnostic messages.
* c-c++-common/gomp/declare-variant-7.c: Likewise.
* c-c++-common/gomp/declare-variant-11.c: New test.
From-SVN: r277734
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/c-family/c-omp.c | 113 |
2 files changed, 8 insertions, 108 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 9bc2190..dfc78a4 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,5 +1,8 @@ 2019-11-02 Jakub Jelinek <jakub@redhat.com> + * c-omp.c (c_omp_mark_declare_variant): Use + omp_context_selector_set_compare. + PR c++/88335 - Implement P1073R3: Immediate functions * c-common.h (enum rid): Add RID_CONSTEVAL. * c-common.c (c_common_reswords): Add consteval. diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index 4f5a6ed..fdf778f 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -2275,113 +2275,10 @@ c_omp_mark_declare_variant (location_t loc, tree variant, tree construct) DECL_ATTRIBUTES (variant) = attr; return; } - tree t1 = TREE_VALUE (attr); - tree t2 = construct; - tree simd = get_identifier ("simd"); - while (t1 && t2) - { - if (TREE_PURPOSE (t1) != TREE_PURPOSE (t2)) - break; - if (TREE_PURPOSE (t1) == simd) - { - if ((TREE_VALUE (t1) == NULL_TREE) - != (TREE_VALUE (t2) == NULL_TREE)) - break; - if (TREE_VALUE (t1)) - { - struct declare_variant_simd_data { - bool inbranch, notinbranch; - tree simdlen; - auto_vec<tree,16> data_sharing; - auto_vec<tree,16> aligned; - declare_variant_simd_data () - : inbranch(false), notinbranch(false), simdlen(NULL_TREE) {} - } data[2]; - unsigned int i; - for (i = 0; i < 2; i++) - for (tree c = TREE_VALUE (i ? t2 : t1); - c; c = OMP_CLAUSE_CHAIN (c)) - { - vec<tree> *v; - switch (OMP_CLAUSE_CODE (c)) - { - case OMP_CLAUSE_INBRANCH: - data[i].inbranch = true; - continue; - case OMP_CLAUSE_NOTINBRANCH: - data[i].notinbranch = true; - continue; - case OMP_CLAUSE_SIMDLEN: - data[i].simdlen = OMP_CLAUSE_SIMDLEN_EXPR (c); - continue; - case OMP_CLAUSE_UNIFORM: - case OMP_CLAUSE_LINEAR: - v = &data[i].data_sharing; - break; - case OMP_CLAUSE_ALIGNED: - v = &data[i].aligned; - break; - default: - gcc_unreachable (); - } - unsigned HOST_WIDE_INT argno - = tree_to_uhwi (OMP_CLAUSE_DECL (c)); - if (argno >= v->length ()) - v->safe_grow_cleared (argno + 1); - (*v)[argno] = c; - } - if (data[0].inbranch != data[1].inbranch - || data[0].notinbranch != data[1].notinbranch - || !simple_cst_equal (data[0].simdlen, - data[1].simdlen) - || (data[0].data_sharing.length () - != data[1].data_sharing.length ()) - || (data[0].aligned.length () - != data[1].aligned.length ())) - break; - tree c1, c2; - FOR_EACH_VEC_ELT (data[0].data_sharing, i, c1) - { - c2 = data[1].data_sharing[i]; - if ((c1 == NULL_TREE) != (c2 == NULL_TREE)) - break; - if (c1 == NULL_TREE) - continue; - if (OMP_CLAUSE_CODE (c1) != OMP_CLAUSE_CODE (c2)) - break; - if (OMP_CLAUSE_CODE (c1) != OMP_CLAUSE_LINEAR) - continue; - if (OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (c1) - != OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (c2)) - break; - if (OMP_CLAUSE_LINEAR_KIND (c1) - != OMP_CLAUSE_LINEAR_KIND (c2)) - break; - if (!simple_cst_equal (OMP_CLAUSE_LINEAR_STEP (c1), - OMP_CLAUSE_LINEAR_STEP (c2))) - break; - } - if (i < data[0].data_sharing.length ()) - break; - FOR_EACH_VEC_ELT (data[0].aligned, i, c1) - { - c2 = data[1].aligned[i]; - if ((c1 == NULL_TREE) != (c2 == NULL_TREE)) - break; - if (c1 == NULL_TREE) - continue; - if (!simple_cst_equal (OMP_CLAUSE_ALIGNED_ALIGNMENT (c1), - OMP_CLAUSE_ALIGNED_ALIGNMENT (c2))) - break; - } - if (i < data[0].aligned.length ()) - break; - } - } - t1 = TREE_CHAIN (t1); - t2 = TREE_CHAIN (t2); - } - if (t1 || t2) - error_at (loc, "%qD used as a variant with incompatible %<constructor%> " + if ((TREE_VALUE (attr) != NULL_TREE) != (construct != NULL_TREE) + || (construct != NULL_TREE + && omp_context_selector_set_compare ("construct", TREE_VALUE (attr), + construct))) + error_at (loc, "%qD used as a variant with incompatible %<construct%> " "selector sets", variant); } |