aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-omp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family/c-omp.c')
-rw-r--r--gcc/c-family/c-omp.c113
1 files changed, 5 insertions, 108 deletions
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);
}