aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2022-09-06 09:19:24 +0200
committerJakub Jelinek <jakub@redhat.com>2022-09-06 09:19:24 +0200
commit3f585bdaa7f6fb02753ba7b4918f065357a6b7fd (patch)
tree53ea65f5ebeb1bdd0118b0fc92532776c4ccfb69 /gcc/gimple.h
parentfc52efeb9c6fe214ea78f9d506aa9e8ee9ebdd61 (diff)
downloadgcc-3f585bdaa7f6fb02753ba7b4918f065357a6b7fd.zip
gcc-3f585bdaa7f6fb02753ba7b4918f065357a6b7fd.tar.gz
gcc-3f585bdaa7f6fb02753ba7b4918f065357a6b7fd.tar.bz2
openmp: Introduce gimple_omp_ordered_standalone_p
On Sat, Sep 03, 2022 at 10:07:27AM +0200, Jakub Jelinek via Gcc-patches wrote: > Incrementally, I'd like to change the way we differentiate between > stand-alone and block-associated ordered constructs, because the current > way of looking for presence of doacross clause doesn't work well if those > clauses are removed because they had been invalid (wrong syntax or > unknown variables in it etc.) The following, so far only lightly tested, patch implements that. 2022-09-06 Jakub Jelinek <jakub@redhat.com> gcc/ * gimple.h (enum gf_mask): Add GF_OMP_ORDERED_STANDALONE enumerator. (gimple_omp_subcode): Use GIMPLE_OMP_ORDERED instead of GIMPLE_OMP_TEAMS as upper bound. (gimple_omp_ordered_standalone_p, gimple_omp_ordered_standalone): New inline functions. * gimplify.cc (find_standalone_omp_ordered): Look for OMP_ORDERED with NULL OMP_ORDERED_BODY rather than with OMP_DOACROSS clause. (gimplify_expr): Call gimple_omp_ordered_standalone for OMP_ORDERED with NULL OMP_ORDERED_BODY. * omp-low.cc (check_omp_nesting_restrictions): Use gimple_omp_ordered_standalone_p test instead of omp_find_clause (..., OMP_CLAUSE_DOACROSS). (lower_omp_ordered): Likewise. * omp-expand.cc (expand_omp, build_omp_regions_1, omp_make_gimple_edges): Likewise. gcc/cp/ * pt.cc (tsubst_expr) <case OMP_ORDERED>: If OMP_BODY was NULL, keep it NULL after instantiation too. gcc/testsuite/ * c-c++-common/gomp/sink-3.c: Don't expect a superfluous error during error recovery. * c-c++-common/gomp/doacross-6.c (foo): Add further tests.
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r--gcc/gimple.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 1d15ff9..77ac149 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -194,6 +194,7 @@ enum gf_mask {
GF_OMP_RETURN_NOWAIT = 1 << 0,
GF_OMP_SECTION_LAST = 1 << 0,
+ GF_OMP_ORDERED_STANDALONE = 1 << 0,
GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 6) - 1,
GF_OMP_ATOMIC_NEED_VALUE = 1 << 6,
GF_OMP_ATOMIC_WEAK = 1 << 7,
@@ -2312,7 +2313,7 @@ static inline unsigned
gimple_omp_subcode (const gimple *s)
{
gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
- && gimple_code (s) <= GIMPLE_OMP_TEAMS);
+ && gimple_code (s) <= GIMPLE_OMP_ORDERED);
return s->subcode;
}
@@ -2402,6 +2403,27 @@ gimple_omp_section_set_last (gimple *g)
}
+/* Return true if OMP ordered construct is stand-alone
+ (G has the GF_OMP_ORDERED_STANDALONE flag set). */
+
+static inline bool
+gimple_omp_ordered_standalone_p (const gimple *g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
+ return (gimple_omp_subcode (g) & GF_OMP_ORDERED_STANDALONE) != 0;
+}
+
+
+/* Set the GF_OMP_ORDERED_STANDALONE flag on G. */
+
+static inline void
+gimple_omp_ordered_standalone (gimple *g)
+{
+ GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
+ g->subcode |= GF_OMP_ORDERED_STANDALONE;
+}
+
+
/* Return true if OMP parallel statement G has the
GF_OMP_PARALLEL_COMBINED flag set. */