forked from OSchip/llvm-project
[Flang][openmp][5/5] Make dist_schedule clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not following the common OmpClause convention. The benefits of using OmpClause: - Functionalities from structure checker are mostly aligned to work with `llvm::omp::Clause`. - The unparsing as well can take advantage. - Homogeneity with OpenACC and rest of the clauses in OpenMP. - Could even generate the parser with TableGen, when there is homogeneity. - It becomes confusing when to use `flangClass` and `flangClassValue` inside TableGen, if incase we generate parser using TableGen we could have only a single `let expression`. This patch makes `OmpDistScheduleClause` clause part of `OmpClause`. The unparse function for `OmpDistScheduleClause` is adapted since the keyword and parenthesis are issued by the corresponding unparse function for `parser::OmpClause::DistSchedule`. Reviewed By: clementval, kiranktp Differential Revision: https://reviews.llvm.org/D93644
This commit is contained in:
parent
2f5569f6f6
commit
1a6f43991f
|
@ -485,7 +485,6 @@ public:
|
|||
NODE_ENUM(OmpDependenceType, Type)
|
||||
NODE(parser, OmpDependSinkVec)
|
||||
NODE(parser, OmpDependSinkVecLength)
|
||||
NODE(parser, OmpDistScheduleClause)
|
||||
NODE(parser, OmpEndAtomic)
|
||||
NODE(parser, OmpEndBlockDirective)
|
||||
NODE(parser, OmpEndCriticalDirective)
|
||||
|
|
|
@ -3456,10 +3456,6 @@ struct OmpDependClause {
|
|||
std::variant<Source, Sink, InOut> u;
|
||||
};
|
||||
|
||||
// dist_schedule clause does not fit in generic clause class for tablegen.
|
||||
// Therefore it is declared separatly here.
|
||||
WRAPPER_CLASS(OmpDistScheduleClause, std::optional<ScalarIntExpr>);
|
||||
|
||||
// OpenMP Clauses
|
||||
struct OmpClause {
|
||||
UNION_CLASS_BOILERPLATE(OmpClause);
|
||||
|
|
|
@ -176,7 +176,7 @@ TYPE_PARSER(
|
|||
"DEVICE" >> construct<OmpClause>(construct<OmpClause::Device>(
|
||||
parenthesized(scalarIntExpr))) ||
|
||||
"DIST_SCHEDULE" >>
|
||||
construct<OmpClause>(construct<OmpDistScheduleClause>(
|
||||
construct<OmpClause>(construct<OmpClause::DistSchedule>(
|
||||
parenthesized("STATIC" >> maybe("," >> scalarIntExpr)))) ||
|
||||
"FINAL" >> construct<OmpClause>(construct<OmpClause::Final>(
|
||||
parenthesized(scalarLogicalExpr))) ||
|
||||
|
|
|
@ -2065,11 +2065,6 @@ public:
|
|||
std::get<std::optional<OmpDefaultmapClause::VariableCategory>>(x.t));
|
||||
Word(")");
|
||||
}
|
||||
void Unparse(const OmpDistScheduleClause &x) {
|
||||
Word("DIST_SCHEDULE(STATIC");
|
||||
Walk(", ", x.v);
|
||||
Put(")");
|
||||
}
|
||||
#define GEN_FLANG_CLAUSE_UNPARSE
|
||||
#include "llvm/Frontend/OpenMP/OMP.inc"
|
||||
void Unparse(const OmpLoopDirective &x) {
|
||||
|
|
|
@ -430,6 +430,7 @@ CHECK_SIMPLE_CLAUSE(Release, OMPC_release)
|
|||
CHECK_SIMPLE_CLAUSE(Relaxed, OMPC_relaxed)
|
||||
CHECK_SIMPLE_CLAUSE(Hint, OMPC_hint)
|
||||
CHECK_SIMPLE_CLAUSE(ProcBind, OMPC_proc_bind)
|
||||
CHECK_SIMPLE_CLAUSE(DistSchedule, OMPC_dist_schedule)
|
||||
|
||||
CHECK_REQ_SCALAR_INT_CLAUSE(Allocator, OMPC_allocator)
|
||||
CHECK_REQ_SCALAR_INT_CLAUSE(Grainsize, OMPC_grainsize)
|
||||
|
@ -493,7 +494,6 @@ void OmpStructureChecker::CheckIsVarPartOfAnotherVar(
|
|||
}
|
||||
}
|
||||
// Following clauses have a seperate node in parse-tree.h.
|
||||
CHECK_SIMPLE_PARSER_CLAUSE(OmpDistScheduleClause, OMPC_dist_schedule)
|
||||
CHECK_SIMPLE_PARSER_CLAUSE(OmpReductionClause, OMPC_reduction)
|
||||
// Atomic-clause
|
||||
CHECK_SIMPLE_PARSER_CLAUSE(OmpAtomicRead, OMPC_read)
|
||||
|
|
|
@ -139,6 +139,7 @@ public:
|
|||
void Enter(const parser::OmpClause::Copyprivate &);
|
||||
void Enter(const parser::OmpClause::Default &);
|
||||
void Enter(const parser::OmpClause::Device &);
|
||||
void Enter(const parser::OmpClause::DistSchedule &);
|
||||
void Enter(const parser::OmpClause::Final &);
|
||||
void Enter(const parser::OmpClause::Firstprivate &);
|
||||
void Enter(const parser::OmpClause::From &);
|
||||
|
@ -179,7 +180,6 @@ public:
|
|||
void Enter(const parser::OmpAlignedClause &);
|
||||
void Enter(const parser::OmpDefaultmapClause &);
|
||||
void Enter(const parser::OmpDependClause &);
|
||||
void Enter(const parser::OmpDistScheduleClause &);
|
||||
void Enter(const parser::OmpIfClause &);
|
||||
void Enter(const parser::OmpLinearClause &);
|
||||
void Enter(const parser::OmpMapClause &);
|
||||
|
|
|
@ -204,7 +204,6 @@ def OMPC_Hint : Clause<"hint"> {
|
|||
}
|
||||
def OMPC_DistSchedule : Clause<"dist_schedule"> {
|
||||
let clangClass = "OMPDistScheduleClause";
|
||||
let flangClass = "OmpDistScheduleClause";
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let isValueOptional = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue