This patch implements the following semantic checks according to
OpenMP Version 5.1 Ordered construct restriction:
At most one threads clause can appear on an ordered construct; At most one simd clause can appear on an ordered construct; At most one depend(source) clause can appear on an ordered construct; Either depend(sink:vec) clauses or depend(source) clauses may appear on an ordered construct, but not both.
This patch also implements the following semantic checks according to
the syntax and descriptions in OpenMP Version 5.1 Ordered construct:
The dependence types of sink or source are only allowed on an ordered construct. The depend(*) clauses are not allowed when ordered construct is a block construct with an ordered region. The threads or simd clauses are not allowed when the ordered construct is a standalone construct with no ordered region.
Co-authored-by: Sameeran Joshi <sameeranjayant.joshi@amd.com>
You can use the allowedOnce specification in OMP.td to achieve this. Change allowedClauses to allowedOnceClauses for Ordered.
https://github.com/llvm/llvm-project/blob/79b55e5038324e61a3abf4e6a9a949c473edd858/llvm/include/llvm/Frontend/OpenMP/OMP.td#L491