case OMP_ORDERED:
tmp = tsubst_omp_clauses (OMP_ORDERED_CLAUSES (t), C_ORT_OMP, args,
complain, in_decl);
- stmt = push_stmt_list ();
- RECUR (OMP_BODY (t));
- stmt = pop_stmt_list (stmt);
+ if (OMP_BODY (t))
+ {
+ stmt = push_stmt_list ();
+ RECUR (OMP_BODY (t));
+ stmt = pop_stmt_list (stmt);
+ }
+ else
+ stmt = NULL_TREE;
t = copy_node (t);
OMP_BODY (t) = stmt;
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,
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;
}
}
+/* 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. */
}
/* Helper function of gimplify_omp_for, find OMP_ORDERED with
- OMP_CLAUSE_DOACROSS clause inside of OMP_FOR's body. */
+ null OMP_ORDERED_BODY inside of OMP_FOR's body. */
static tree
find_standalone_omp_ordered (tree *tp, int *walk_subtrees, void *)
switch (TREE_CODE (*tp))
{
case OMP_ORDERED:
- if (omp_find_clause (OMP_ORDERED_CLAUSES (*tp), OMP_CLAUSE_DOACROSS))
+ if (OMP_ORDERED_BODY (*tp) == NULL_TREE)
return *tp;
break;
case OMP_SIMD:
break;
case OMP_ORDERED:
g = gimplify_omp_ordered (*expr_p, body);
+ if (OMP_BODY (*expr_p) == NULL_TREE
+ && gimple_code (g) == GIMPLE_OMP_ORDERED)
+ gimple_omp_ordered_standalone (g);
break;
case OMP_MASKED:
gimplify_scan_omp_clauses (&OMP_MASKED_CLAUSES (*expr_p),
{
gomp_ordered *ord_stmt
= as_a <gomp_ordered *> (last_stmt (region->entry));
- if (omp_find_clause (gimple_omp_ordered_clauses (ord_stmt),
- OMP_CLAUSE_DOACROSS))
+ if (gimple_omp_ordered_standalone_p (ord_stmt))
{
/* We'll expand these when expanding corresponding
worksharing region with ordered(n) clause. */
}
}
else if (code == GIMPLE_OMP_ORDERED
- && omp_find_clause (gimple_omp_ordered_clauses
- (as_a <gomp_ordered *> (stmt)),
- OMP_CLAUSE_DOACROSS))
+ && gimple_omp_ordered_standalone_p (stmt))
/* #pragma omp ordered depend is also just a stand-alone
directive. */
region = NULL;
case GIMPLE_OMP_ORDERED:
cur_region = new_omp_region (bb, code, cur_region);
fallthru = true;
- if (omp_find_clause (gimple_omp_ordered_clauses
- (as_a <gomp_ordered *> (last)),
- OMP_CLAUSE_DOACROSS))
+ if (gimple_omp_ordered_standalone_p (last))
cur_region = cur_region->outer;
break;
"a loop region with an %<ordered%> clause");
return false;
}
- if (omp_find_clause (c, OMP_CLAUSE_DOACROSS) == NULL_TREE)
+ if (!gimple_omp_ordered_standalone_p (stmt))
{
if (OMP_CLAUSE_ORDERED_DOACROSS (o))
{
bool threads = omp_find_clause (gimple_omp_ordered_clauses (ord_stmt),
OMP_CLAUSE_THREADS);
- if (omp_find_clause (gimple_omp_ordered_clauses (ord_stmt),
- OMP_CLAUSE_DOACROSS))
+ if (gimple_omp_ordered_standalone_p (ord_stmt))
{
/* FIXME: This is needs to be moved to the expansion to verify various
conditions only testable on cfg with dominators computed, and also
{
#pragma omp ordered doacross(sink) /* { dg-error "expected ':' before '\\\)' token" } */
}
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(source) /* { dg-error "expected ':' before '\\\)' token" } */
+ #pragma omp ordered doacross(sink:i-1)
+ }
+ #pragma omp for ordered
+ for (i = 0; i < 8; i += n)
+ {
+ #pragma omp ordered doacross(source:)
+ #pragma omp ordered doacross(sink) /* { dg-error "expected ':' before '\\\)' token" } */
+ }
}
void
for (i=0; i < 100; ++i)
{
#pragma omp ordered depend(sink:poo-1,paa+1) /* { dg-error "poo.*declared.*paa.*declared" } */
- bar(&i); /* { dg-error "must not have the same binding region" "" { target *-*-* } .-1 } */
+ bar(&i);
#pragma omp ordered depend(source)
}
}