forked from OSchip/llvm-project
[flang] Change some empty classes into enums
Original-commit: flang-compiler/f18@652e474556 Reviewed-on: https://github.com/flang-compiler/f18/pull/569 Tree-same-pre-rewrite: false
This commit is contained in:
parent
a3242b8107
commit
2d0f9636a8
|
@ -498,28 +498,7 @@ public:
|
|||
NODE(parser, OmpLinearModifier)
|
||||
NODE_ENUM(parser::OmpLinearModifier, Type)
|
||||
NODE(parser, OmpLoopDirective)
|
||||
NODE(parser::OmpLoopDirective, Distribute)
|
||||
NODE(parser::OmpLoopDirective, DistributeParallelDo)
|
||||
NODE(parser::OmpLoopDirective, DistributeParallelDoSimd)
|
||||
NODE(parser::OmpLoopDirective, DistributeSimd)
|
||||
NODE(parser::OmpLoopDirective, Do)
|
||||
NODE(parser::OmpLoopDirective, DoSimd)
|
||||
NODE(parser::OmpLoopDirective, ParallelDo)
|
||||
NODE(parser::OmpLoopDirective, ParallelDoSimd)
|
||||
NODE(parser::OmpLoopDirective, Simd)
|
||||
NODE(parser::OmpLoopDirective, TargetParallelDo)
|
||||
NODE(parser::OmpLoopDirective, TargetParallelDoSimd)
|
||||
NODE(parser::OmpLoopDirective, TargetSimd)
|
||||
NODE(parser::OmpLoopDirective, TargetTeamsDistribute)
|
||||
NODE(parser::OmpLoopDirective, TargetTeamsDistributeParallelDo)
|
||||
NODE(parser::OmpLoopDirective, TargetTeamsDistributeParallelDoSimd)
|
||||
NODE(parser::OmpLoopDirective, TargetTeamsDistributeSimd)
|
||||
NODE(parser::OmpLoopDirective, Taskloop)
|
||||
NODE(parser::OmpLoopDirective, TaskloopSimd)
|
||||
NODE(parser::OmpLoopDirective, TeamsDistribute)
|
||||
NODE(parser::OmpLoopDirective, TeamsDistributeParallelDo)
|
||||
NODE(parser::OmpLoopDirective, TeamsDistributeParallelDoSimd)
|
||||
NODE(parser::OmpLoopDirective, TeamsDistributeSimd)
|
||||
NODE_ENUM(parser::OmpLoopDirective, Directive)
|
||||
NODE(parser, OmpMapClause)
|
||||
NODE(parser, OmpMapType)
|
||||
NODE(parser::OmpMapType, Always)
|
||||
|
|
|
@ -250,60 +250,50 @@ TYPE_PARSER(construct<OmpClauseList>(
|
|||
TYPE_PARSER(construct<OmpObjectList>(nonemptyList(Parser<OmpObject>{})))
|
||||
|
||||
// Omp directives enclosing do loop
|
||||
TYPE_PARSER("DISTRIBUTE PARALLEL DO SIMD" >>
|
||||
construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::DistributeParallelDoSimd>()) ||
|
||||
"DISTRIBUTE PARALLEL DO" >>
|
||||
construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::DistributeParallelDo>()) ||
|
||||
"DISTRIBUTE SIMD" >> construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::DistributeSimd>()) ||
|
||||
"DISTRIBUTE" >> construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::Distribute>()) ||
|
||||
"DO SIMD" >>
|
||||
construct<OmpLoopDirective>(construct<OmpLoopDirective::DoSimd>()) ||
|
||||
"DO" >> construct<OmpLoopDirective>(construct<OmpLoopDirective::Do>()) ||
|
||||
"PARALLEL DO SIMD" >> construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::ParallelDoSimd>()) ||
|
||||
"PARALLEL DO" >> construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::ParallelDo>()) ||
|
||||
"SIMD" >>
|
||||
construct<OmpLoopDirective>(construct<OmpLoopDirective::Simd>()) ||
|
||||
"TARGET PARALLEL DO SIMD" >>
|
||||
construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TargetParallelDoSimd>()) ||
|
||||
"TARGET PARALLEL DO" >>
|
||||
construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TargetParallelDo>()) ||
|
||||
"TARGET SIMD" >> construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TargetSimd>()) ||
|
||||
"TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD" >>
|
||||
construct<OmpLoopDirective>(construct<
|
||||
OmpLoopDirective::TargetTeamsDistributeParallelDoSimd>()) ||
|
||||
"TARGET TEAMS DISTRIBUTE PARALLEL DO" >>
|
||||
construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TargetTeamsDistributeParallelDo>()) ||
|
||||
"TARGET TEAMS DISTRIBUTE SIMD" >>
|
||||
construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TargetTeamsDistributeSimd>()) ||
|
||||
"TARGET TEAMS DISTRIBUTE" >>
|
||||
construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TargetTeamsDistribute>()) ||
|
||||
"TASKLOOP SIMD" >> construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TaskloopSimd>()) ||
|
||||
"TASKLOOP" >>
|
||||
construct<OmpLoopDirective>(construct<OmpLoopDirective::Taskloop>()) ||
|
||||
"TEAMS DISTRIBUTE PARALLEL DO SIMD" >>
|
||||
construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TeamsDistributeParallelDoSimd>()) ||
|
||||
"TEAMS DISTRIBUTE PARALLEL DO" >>
|
||||
construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TeamsDistributeParallelDo>()) ||
|
||||
"TEAMS DISTRIBUTE SIMD" >>
|
||||
construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TeamsDistributeSimd>()) ||
|
||||
"TEAMS DISTRIBUTE" >> construct<OmpLoopDirective>(
|
||||
construct<OmpLoopDirective::TeamsDistribute>()))
|
||||
TYPE_PARSER(first(
|
||||
construct<OmpLoopDirective>("DISTRIBUTE PARALLEL DO SIMD" >>
|
||||
pure(OmpLoopDirective::Directive::DistributeParallelDoSimd)),
|
||||
construct<OmpLoopDirective>("DISTRIBUTE PARALLEL DO" >>
|
||||
pure(OmpLoopDirective::Directive::DistributeParallelDo)),
|
||||
construct<OmpLoopDirective>(
|
||||
"DISTRIBUTE SIMD" >> pure(OmpLoopDirective::Directive::DistributeSimd)),
|
||||
construct<OmpLoopDirective>(
|
||||
"DISTRIBUTE" >> pure(OmpLoopDirective::Directive::Distribute)),
|
||||
construct<OmpLoopDirective>(
|
||||
"DO SIMD" >> pure(OmpLoopDirective::Directive::DoSimd)),
|
||||
construct<OmpLoopDirective>("DO" >> pure(OmpLoopDirective::Directive::Do)),
|
||||
construct<OmpLoopDirective>("PARALLEL DO SIMD" >>
|
||||
pure(OmpLoopDirective::Directive::ParallelDoSimd)),
|
||||
construct<OmpLoopDirective>(
|
||||
"PARALLEL DO" >> pure(OmpLoopDirective::Directive::ParallelDo)),
|
||||
construct<OmpLoopDirective>(
|
||||
"SIMD" >> pure(OmpLoopDirective::Directive::Simd)),
|
||||
construct<OmpLoopDirective>("TARGET PARALLEL DO SIMD" >>
|
||||
pure(OmpLoopDirective::Directive::TargetParallelDoSimd)),
|
||||
construct<OmpLoopDirective>("TARGET PARALLEL DO" >>
|
||||
pure(OmpLoopDirective::Directive::TargetParallelDo)),
|
||||
construct<OmpLoopDirective>(
|
||||
"TARGET SIMD" >> pure(OmpLoopDirective::Directive::TargetSimd)),
|
||||
construct<OmpLoopDirective>("TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD" >>
|
||||
pure(OmpLoopDirective::Directive::TargetTeamsDistributeParallelDoSimd)),
|
||||
construct<OmpLoopDirective>("TARGET TEAMS DISTRIBUTE PARALLEL DO" >>
|
||||
pure(OmpLoopDirective::Directive::TargetTeamsDistributeParallelDo)),
|
||||
construct<OmpLoopDirective>("TARGET TEAMS DISTRIBUTE SIMD" >>
|
||||
pure(OmpLoopDirective::Directive::TargetTeamsDistributeSimd)),
|
||||
construct<OmpLoopDirective>("TARGET TEAMS DISTRIBUTE" >>
|
||||
pure(OmpLoopDirective::Directive::TargetTeamsDistribute)),
|
||||
construct<OmpLoopDirective>(
|
||||
"TASKLOOP SIMD" >> pure(OmpLoopDirective::Directive::TaskloopSimd)),
|
||||
construct<OmpLoopDirective>(
|
||||
"TASKLOOP" >> pure(OmpLoopDirective::Directive::Taskloop)),
|
||||
construct<OmpLoopDirective>("TEAMS DISTRIBUTE PARALLEL DO SIMD" >>
|
||||
pure(OmpLoopDirective::Directive::TeamsDistributeParallelDoSimd)),
|
||||
construct<OmpLoopDirective>("TEAMS DISTRIBUTE PARALLEL DO" >>
|
||||
pure(OmpLoopDirective::Directive::TeamsDistributeParallelDo)),
|
||||
construct<OmpLoopDirective>("TEAMS DISTRIBUTE SIMD" >>
|
||||
pure(OmpLoopDirective::Directive::TeamsDistributeSimd)),
|
||||
construct<OmpLoopDirective>("TEAMS DISTRIBUTE" >>
|
||||
pure(OmpLoopDirective::Directive::TeamsDistribute))))
|
||||
|
||||
// Cancellation Point construct
|
||||
TYPE_PARSER("CANCELLATION POINT" >>
|
||||
|
|
|
@ -3645,38 +3645,16 @@ struct OpenMPAtomicConstruct {
|
|||
};
|
||||
|
||||
struct OmpLoopDirective {
|
||||
UNION_CLASS_BOILERPLATE(OmpLoopDirective);
|
||||
EMPTY_CLASS(Distribute);
|
||||
EMPTY_CLASS(DistributeParallelDoSimd);
|
||||
EMPTY_CLASS(DistributeParallelDo);
|
||||
EMPTY_CLASS(DistributeSimd);
|
||||
EMPTY_CLASS(ParallelDo);
|
||||
EMPTY_CLASS(ParallelDoSimd);
|
||||
EMPTY_CLASS(Do);
|
||||
EMPTY_CLASS(DoSimd);
|
||||
EMPTY_CLASS(Simd);
|
||||
EMPTY_CLASS(TargetParallelDo);
|
||||
EMPTY_CLASS(TargetParallelDoSimd);
|
||||
EMPTY_CLASS(TargetTeamsDistribute);
|
||||
EMPTY_CLASS(TargetTeamsDistributeParallelDo);
|
||||
EMPTY_CLASS(TargetTeamsDistributeParallelDoSimd);
|
||||
EMPTY_CLASS(TargetTeamsDistributeSimd);
|
||||
EMPTY_CLASS(TargetSimd);
|
||||
EMPTY_CLASS(Taskloop);
|
||||
EMPTY_CLASS(TaskloopSimd);
|
||||
EMPTY_CLASS(TeamsDistribute);
|
||||
EMPTY_CLASS(TeamsDistributeParallelDoSimd);
|
||||
EMPTY_CLASS(TeamsDistributeParallelDo);
|
||||
EMPTY_CLASS(TeamsDistributeSimd);
|
||||
ENUM_CLASS(Directive, Distribute, DistributeParallelDo,
|
||||
DistributeParallelDoSimd, DistributeSimd, ParallelDo, ParallelDoSimd, Do,
|
||||
DoSimd, Simd, TargetParallelDo, TargetParallelDoSimd,
|
||||
TargetTeamsDistribute, TargetTeamsDistributeParallelDo,
|
||||
TargetTeamsDistributeParallelDoSimd, TargetTeamsDistributeSimd,
|
||||
TargetSimd, Taskloop, TaskloopSimd, TeamsDistribute,
|
||||
TeamsDistributeParallelDo, TeamsDistributeParallelDoSimd,
|
||||
TeamsDistributeSimd)
|
||||
WRAPPER_CLASS_BOILERPLATE(OmpLoopDirective, Directive);
|
||||
CharBlock source;
|
||||
std::variant<DistributeParallelDoSimd, DistributeParallelDo, DistributeSimd,
|
||||
Distribute, ParallelDoSimd, ParallelDo, Do, DoSimd, Simd,
|
||||
TargetParallelDoSimd, TargetParallelDo,
|
||||
TargetTeamsDistributeParallelDoSimd, TargetTeamsDistributeParallelDo,
|
||||
TargetTeamsDistributeSimd, TargetTeamsDistribute, TargetSimd,
|
||||
TaskloopSimd, Taskloop, TeamsDistributeParallelDoSimd,
|
||||
TeamsDistributeParallelDo, TeamsDistributeSimd, TeamsDistribute>
|
||||
u;
|
||||
};
|
||||
|
||||
// Cancel/Cancellation type
|
||||
|
|
|
@ -1989,62 +1989,61 @@ public:
|
|||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpLoopDirective &x) {
|
||||
std::visit(
|
||||
common::visitors{
|
||||
[&](const OmpLoopDirective::DistributeParallelDoSimd &) {
|
||||
Word("DISTRIBUTE PARALLEL DO SIMD ");
|
||||
},
|
||||
[&](const OmpLoopDirective::DistributeParallelDo &) {
|
||||
Word("DISTRIBUTE PARALLEL DO ");
|
||||
},
|
||||
[&](const OmpLoopDirective::DistributeSimd &) {
|
||||
Word("DISTRIBUTE SIMD ");
|
||||
},
|
||||
[&](const OmpLoopDirective::Distribute &) { Word("DISTRIBUTE "); },
|
||||
[&](const OmpLoopDirective::ParallelDoSimd &) {
|
||||
Word("PARALLEL DO SIMD ");
|
||||
},
|
||||
[&](const OmpLoopDirective::ParallelDo &) { Word("PARALLEL DO "); },
|
||||
[&](const OmpLoopDirective::Do &) { Word("DO "); },
|
||||
[&](const OmpLoopDirective::DoSimd &) { Word("Do SIMD "); },
|
||||
[&](const OmpLoopDirective::Simd &) { Word("SIMD "); },
|
||||
[&](const OmpLoopDirective::TargetParallelDoSimd &) {
|
||||
Word("TARGET PARALLEL DO SIMD ");
|
||||
},
|
||||
[&](const OmpLoopDirective::TargetParallelDo &) {
|
||||
Word("TARGET PARALLEL DO ");
|
||||
},
|
||||
[&](const OmpLoopDirective::TargetTeamsDistributeParallelDoSimd &) {
|
||||
Word("TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD ");
|
||||
},
|
||||
[&](const OmpLoopDirective::TargetTeamsDistributeParallelDo &) {
|
||||
Word("TARGET TEAMS DISTRIBUTE PARALLEL DO ");
|
||||
},
|
||||
[&](const OmpLoopDirective::TargetTeamsDistributeSimd &) {
|
||||
Word("TARGET TEAMS DISTRIBUTE SIMD ");
|
||||
},
|
||||
[&](const OmpLoopDirective::TargetTeamsDistribute &) {
|
||||
Word("TARGET TEAMS DISTRIBUTE ");
|
||||
},
|
||||
[&](const OmpLoopDirective::TargetSimd &) { Word("TARGET SIMD "); },
|
||||
[&](const OmpLoopDirective::TaskloopSimd &) {
|
||||
Word("TASKLOOP SIMD ");
|
||||
},
|
||||
[&](const OmpLoopDirective::Taskloop &) { Word("TASKLOOP "); },
|
||||
[&](const OmpLoopDirective::TeamsDistributeParallelDoSimd &) {
|
||||
Word("TEAMS DISTRIBUTE PARALLEL DO SIMD ");
|
||||
},
|
||||
[&](const OmpLoopDirective::TeamsDistributeParallelDo &) {
|
||||
Word("TEAMS DISTRIBUTE PARALLEL DO ");
|
||||
},
|
||||
[&](const OmpLoopDirective::TeamsDistributeSimd &) {
|
||||
Word("TEAMS DISTRIBUTE SIMD ");
|
||||
},
|
||||
[&](const OmpLoopDirective::TeamsDistribute &) {
|
||||
Word("TEAMS DISTRIBUTE ");
|
||||
},
|
||||
},
|
||||
x.u);
|
||||
switch (x.v) {
|
||||
case OmpLoopDirective::Directive::Distribute: Word("DISTRIBUTE "); break;
|
||||
case OmpLoopDirective::Directive::DistributeParallelDo:
|
||||
Word("DISTRIBUTE PARALLEL DO ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::DistributeParallelDoSimd:
|
||||
Word("DISTRIBUTE PARALLEL DO SIMD ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::DistributeSimd:
|
||||
Word("DISTRIBUTE SIMD ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::Do: Word("DO "); break;
|
||||
case OmpLoopDirective::Directive::DoSimd: Word("Do SIMD "); break;
|
||||
case OmpLoopDirective::Directive::ParallelDo: Word("PARALLEL DO "); break;
|
||||
case OmpLoopDirective::Directive::ParallelDoSimd:
|
||||
Word("PARALLEL DO SIMD ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::Simd: Word("SIMD "); break;
|
||||
case OmpLoopDirective::Directive::TargetParallelDo:
|
||||
Word("TARGET PARALLEL DO ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::TargetParallelDoSimd:
|
||||
Word("TARGET PARALLEL DO SIMD ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::TargetTeamsDistribute:
|
||||
Word("TARGET TEAMS DISTRIBUTE ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::TargetTeamsDistributeParallelDo:
|
||||
Word("TARGET TEAMS DISTRIBUTE PARALLEL DO ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::TargetTeamsDistributeParallelDoSimd:
|
||||
Word("TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::TargetTeamsDistributeSimd:
|
||||
Word("TARGET TEAMS DISTRIBUTE SIMD ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::TargetSimd: Word("TARGET SIMD "); break;
|
||||
case OmpLoopDirective::Directive::Taskloop: Word("TASKLOOP "); break;
|
||||
case OmpLoopDirective::Directive::TaskloopSimd:
|
||||
Word("TASKLOOP SIMD ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::TeamsDistribute:
|
||||
Word("TEAMS DISTRIBUTE ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::TeamsDistributeParallelDo:
|
||||
Word("TEAMS DISTRIBUTE PARALLEL DO ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::TeamsDistributeParallelDoSimd:
|
||||
Word("TEAMS DISTRIBUTE PARALLEL DO SIMD ");
|
||||
break;
|
||||
case OmpLoopDirective::Directive::TeamsDistributeSimd:
|
||||
Word("TEAMS DISTRIBUTE SIMD ");
|
||||
break;
|
||||
default: CRASH_NO_CASE;
|
||||
}
|
||||
}
|
||||
void Unparse(const OmpObjectList &x) { Walk(x.v, ","); }
|
||||
void Unparse(const OmpStandaloneDirective &x) {
|
||||
|
|
|
@ -71,7 +71,7 @@ void OmpStructureChecker::Enter(const parser::OpenMPConstruct &x) {
|
|||
|
||||
void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
|
||||
const auto &dir{std::get<parser::OmpLoopDirective>(x.t)};
|
||||
if (std::holds_alternative<parser::OmpLoopDirective::Do>(dir.u)) {
|
||||
if (dir.v == parser::OmpLoopDirective::Directive::Do) {
|
||||
HasInvalidWorksharingNesting(dir.source,
|
||||
{OmpDirective::DO, OmpDirective::SECTIONS, OmpDirective::SINGLE,
|
||||
OmpDirective::WORKSHARE, OmpDirective::TASK, OmpDirective::TASKLOOP,
|
||||
|
@ -121,94 +121,91 @@ void OmpStructureChecker::Enter(const parser::OmpBlockDirective::Parallel &) {
|
|||
SetContextAllowedOnce(allowedOnce);
|
||||
}
|
||||
|
||||
// 2.7.1 do-clause -> private-clause |
|
||||
// firstprivate-clause |
|
||||
// lastprivate-clause |
|
||||
// linear-clause |
|
||||
// reduction-clause |
|
||||
// schedule-clause |
|
||||
// collapse-clause |
|
||||
// ordered-clause
|
||||
void OmpStructureChecker::Enter(const parser::OmpLoopDirective::Do &) {
|
||||
// reserve for nesting check
|
||||
SetContextDirectiveEnum(OmpDirective::DO);
|
||||
void OmpStructureChecker::Enter(const parser::OmpLoopDirective &x) {
|
||||
switch (x.v) {
|
||||
// 2.7.1 do-clause -> private-clause |
|
||||
// firstprivate-clause |
|
||||
// lastprivate-clause |
|
||||
// linear-clause |
|
||||
// reduction-clause |
|
||||
// schedule-clause |
|
||||
// collapse-clause |
|
||||
// ordered-clause
|
||||
case parser::OmpLoopDirective::Directive::Do: {
|
||||
// reserve for nesting check
|
||||
SetContextDirectiveEnum(OmpDirective::DO);
|
||||
OmpClauseSet allowed{OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE,
|
||||
OmpClause::LASTPRIVATE, OmpClause::LINEAR, OmpClause::REDUCTION};
|
||||
SetContextAllowed(allowed);
|
||||
OmpClauseSet allowedOnce{
|
||||
OmpClause::SCHEDULE, OmpClause::COLLAPSE, OmpClause::ORDERED};
|
||||
SetContextAllowedOnce(allowedOnce);
|
||||
} break;
|
||||
|
||||
OmpClauseSet allowed{OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE,
|
||||
OmpClause::LASTPRIVATE, OmpClause::LINEAR, OmpClause::REDUCTION};
|
||||
SetContextAllowed(allowed);
|
||||
// 2.11.1 parallel-do-clause -> parallel-clause |
|
||||
// do-clause
|
||||
case parser::OmpLoopDirective::Directive::ParallelDo: {
|
||||
SetContextDirectiveEnum(OmpDirective::PARALLEL_DO);
|
||||
OmpClauseSet allowed{OmpClause::DEFAULT, OmpClause::PRIVATE,
|
||||
OmpClause::FIRSTPRIVATE, OmpClause::SHARED, OmpClause::COPYIN,
|
||||
OmpClause::REDUCTION, OmpClause::LASTPRIVATE, OmpClause::LINEAR};
|
||||
SetContextAllowed(allowed);
|
||||
OmpClauseSet allowedOnce{OmpClause::IF, OmpClause::NUM_THREADS,
|
||||
OmpClause::PROC_BIND, OmpClause::SCHEDULE, OmpClause::COLLAPSE,
|
||||
OmpClause::ORDERED};
|
||||
SetContextAllowedOnce(allowedOnce);
|
||||
} break;
|
||||
|
||||
OmpClauseSet allowedOnce{
|
||||
OmpClause::SCHEDULE, OmpClause::COLLAPSE, OmpClause::ORDERED};
|
||||
SetContextAllowedOnce(allowedOnce);
|
||||
}
|
||||
// 2.8.1 simd-clause -> safelen-clause |
|
||||
// simdlen-clause |
|
||||
// linear-clause |
|
||||
// aligned-clause |
|
||||
// private-clause |
|
||||
// lastprivate-clause |
|
||||
// reduction-clause |
|
||||
// collapse-clause
|
||||
case parser::OmpLoopDirective::Directive::Simd: {
|
||||
SetContextDirectiveEnum(OmpDirective::SIMD);
|
||||
OmpClauseSet allowed{OmpClause::LINEAR, OmpClause::ALIGNED,
|
||||
OmpClause::PRIVATE, OmpClause::LASTPRIVATE, OmpClause::REDUCTION};
|
||||
SetContextAllowed(allowed);
|
||||
OmpClauseSet allowedOnce{
|
||||
OmpClause::COLLAPSE, OmpClause::SAFELEN, OmpClause::SIMDLEN};
|
||||
SetContextAllowedOnce(allowedOnce);
|
||||
} break;
|
||||
|
||||
// 2.11.1 parallel-do-clause -> parallel-clause |
|
||||
// do-clause
|
||||
void OmpStructureChecker::Enter(const parser::OmpLoopDirective::ParallelDo &) {
|
||||
SetContextDirectiveEnum(OmpDirective::PARALLEL_DO);
|
||||
// 2.8.3 do-simd-clause -> do-clause |
|
||||
// simd-clause
|
||||
case parser::OmpLoopDirective::Directive::DoSimd: {
|
||||
SetContextDirectiveEnum(OmpDirective::DO_SIMD);
|
||||
OmpClauseSet allowed{OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE,
|
||||
OmpClause::LASTPRIVATE, OmpClause::LINEAR, OmpClause::REDUCTION,
|
||||
OmpClause::ALIGNED};
|
||||
SetContextAllowed(allowed);
|
||||
OmpClauseSet allowedOnce{OmpClause::SCHEDULE, OmpClause::COLLAPSE,
|
||||
OmpClause::ORDERED, OmpClause::SAFELEN, OmpClause::SIMDLEN};
|
||||
SetContextAllowedOnce(allowedOnce);
|
||||
} break;
|
||||
|
||||
OmpClauseSet allowed{OmpClause::DEFAULT, OmpClause::PRIVATE,
|
||||
OmpClause::FIRSTPRIVATE, OmpClause::SHARED, OmpClause::COPYIN,
|
||||
OmpClause::REDUCTION, OmpClause::LASTPRIVATE, OmpClause::LINEAR};
|
||||
SetContextAllowed(allowed);
|
||||
// 2.11.4 parallel-do-simd-clause -> parallel-clause |
|
||||
// do-simd-clause
|
||||
case parser::OmpLoopDirective::Directive::ParallelDoSimd: {
|
||||
SetContextDirectiveEnum(OmpDirective::PARALLEL_DO_SIMD);
|
||||
OmpClauseSet allowed{OmpClause::DEFAULT, OmpClause::PRIVATE,
|
||||
OmpClause::FIRSTPRIVATE, OmpClause::SHARED, OmpClause::COPYIN,
|
||||
OmpClause::REDUCTION, OmpClause::LASTPRIVATE, OmpClause::LINEAR,
|
||||
OmpClause::ALIGNED};
|
||||
SetContextAllowed(allowed);
|
||||
OmpClauseSet allowedOnce{OmpClause::IF, OmpClause::NUM_THREADS,
|
||||
OmpClause::PROC_BIND, OmpClause::SCHEDULE, OmpClause::COLLAPSE,
|
||||
OmpClause::ORDERED, OmpClause::SAFELEN, OmpClause::SIMDLEN};
|
||||
SetContextAllowedOnce(allowedOnce);
|
||||
} break;
|
||||
|
||||
OmpClauseSet allowedOnce{OmpClause::IF, OmpClause::NUM_THREADS,
|
||||
OmpClause::PROC_BIND, OmpClause::SCHEDULE, OmpClause::COLLAPSE,
|
||||
OmpClause::ORDERED};
|
||||
SetContextAllowedOnce(allowedOnce);
|
||||
}
|
||||
|
||||
// 2.8.1 simd-clause -> safelen-clause |
|
||||
// simdlen-clause |
|
||||
// linear-clause |
|
||||
// aligned-clause |
|
||||
// private-clause |
|
||||
// lastprivate-clause |
|
||||
// reduction-clause |
|
||||
// collapse-clause
|
||||
void OmpStructureChecker::Enter(const parser::OmpLoopDirective::Simd &) {
|
||||
SetContextDirectiveEnum(OmpDirective::SIMD);
|
||||
|
||||
OmpClauseSet allowed{OmpClause::LINEAR, OmpClause::ALIGNED,
|
||||
OmpClause::PRIVATE, OmpClause::LASTPRIVATE, OmpClause::REDUCTION};
|
||||
SetContextAllowed(allowed);
|
||||
|
||||
OmpClauseSet allowedOnce{
|
||||
OmpClause::COLLAPSE, OmpClause::SAFELEN, OmpClause::SIMDLEN};
|
||||
SetContextAllowedOnce(allowedOnce);
|
||||
}
|
||||
|
||||
// 2.8.3 do-simd-clause -> do-clause |
|
||||
// simd-clause
|
||||
void OmpStructureChecker::Enter(const parser::OmpLoopDirective::DoSimd &) {
|
||||
SetContextDirectiveEnum(OmpDirective::DO_SIMD);
|
||||
|
||||
OmpClauseSet allowed{OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE,
|
||||
OmpClause::LASTPRIVATE, OmpClause::LINEAR, OmpClause::REDUCTION,
|
||||
OmpClause::ALIGNED};
|
||||
SetContextAllowed(allowed);
|
||||
|
||||
OmpClauseSet allowedOnce{OmpClause::SCHEDULE, OmpClause::COLLAPSE,
|
||||
OmpClause::ORDERED, OmpClause::SAFELEN, OmpClause::SIMDLEN};
|
||||
SetContextAllowedOnce(allowedOnce);
|
||||
}
|
||||
|
||||
// 2.11.4 parallel-do-simd-clause -> parallel-clause |
|
||||
// do-simd-clause
|
||||
void OmpStructureChecker::Enter(
|
||||
const parser::OmpLoopDirective::ParallelDoSimd &) {
|
||||
SetContextDirectiveEnum(OmpDirective::PARALLEL_DO_SIMD);
|
||||
|
||||
OmpClauseSet allowed{OmpClause::DEFAULT, OmpClause::PRIVATE,
|
||||
OmpClause::FIRSTPRIVATE, OmpClause::SHARED, OmpClause::COPYIN,
|
||||
OmpClause::REDUCTION, OmpClause::LASTPRIVATE, OmpClause::LINEAR,
|
||||
OmpClause::ALIGNED};
|
||||
SetContextAllowed(allowed);
|
||||
|
||||
OmpClauseSet allowedOnce{OmpClause::IF, OmpClause::NUM_THREADS,
|
||||
OmpClause::PROC_BIND, OmpClause::SCHEDULE, OmpClause::COLLAPSE,
|
||||
OmpClause::ORDERED, OmpClause::SAFELEN, OmpClause::SIMDLEN};
|
||||
SetContextAllowedOnce(allowedOnce);
|
||||
default:
|
||||
// TODO others
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OmpStructureChecker::Leave(const parser::OmpClauseList &) {
|
||||
|
|
|
@ -58,11 +58,7 @@ public:
|
|||
void Enter(const parser::OpenMPConstruct &);
|
||||
void Enter(const parser::OpenMPLoopConstruct &);
|
||||
void Leave(const parser::OpenMPLoopConstruct &);
|
||||
void Enter(const parser::OmpLoopDirective::Do &);
|
||||
void Enter(const parser::OmpLoopDirective::ParallelDo &);
|
||||
void Enter(const parser::OmpLoopDirective::Simd &);
|
||||
void Enter(const parser::OmpLoopDirective::DoSimd &);
|
||||
void Enter(const parser::OmpLoopDirective::ParallelDoSimd &);
|
||||
void Enter(const parser::OmpLoopDirective &);
|
||||
|
||||
void Enter(const parser::OpenMPBlockConstruct &);
|
||||
void Leave(const parser::OpenMPBlockConstruct &);
|
||||
|
|
Loading…
Reference in New Issue