[flang][openmp] Use common Directive and Clause enum from llvm/Frontend

Summary:
This patch is removing the custom enumeration for OpenMP Directives and Clauses and replace them
with the newly tablegen generated one from llvm/Frontend. This is a first patch and some will follow to share the same
infrastructure where possible. The next patch should use the clauses allowance defined in the tablegen file.

Reviewers: jdoerfert, DavidTruby, sscalpone, kiranchandramohan, ichoyjx

Reviewed By: DavidTruby, ichoyjx

Subscribers: jholewinski, cfe-commits, dblaikie, MaskRay, ymandel, ichoyjx, mgorny, yaxunl, guansong, jfb, sstefan1, aaron.ballman, llvm-commits

Tags: #llvm, #flang, #clang

Differential Revision: https://reviews.llvm.org/D82906
This commit is contained in:
Valentin Clement 2020-07-01 20:57:11 -04:00 committed by clementval
parent aded4f0cc0
commit 2ddba3082c
24 changed files with 713 additions and 646 deletions

View File

@ -7556,6 +7556,8 @@ public:
case llvm::omp::Clause::Enum: \
break;
#include "llvm/Frontend/OpenMP/OMPKinds.def"
default:
break;
}
}
// Base case, ignore it. :)

View File

@ -3000,6 +3000,8 @@ bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
case llvm::omp::Clause::Enum: \
break;
#include "llvm/Frontend/OpenMP/OMPKinds.def"
default:
break;
}
return true;
}

View File

@ -118,6 +118,8 @@ ASTNodeKind ASTNodeKind::getFromNode(const OMPClause &C) {
#define OMP_CLAUSE_NO_CLASS(Enum, Str) \
case llvm::omp::Clause::Enum: \
llvm_unreachable("unexpected OpenMP clause kind");
default:
break;
#include "llvm/Frontend/OpenMP/OMPKinds.def"
}
llvm_unreachable("invalid stmt kind");

View File

@ -51,6 +51,8 @@ OMPClause::child_range OMPClause::used_children() {
case OMPC_match:
case OMPC_unknown:
break;
default:
break;
}
llvm_unreachable("unknown OMPClause");
}
@ -154,6 +156,8 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
case OMPC_uses_allocators:
case OMPC_affinity:
break;
default:
break;
}
return nullptr;
@ -246,6 +250,8 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
case OMPC_uses_allocators:
case OMPC_affinity:
break;
default:
break;
}
return nullptr;

View File

@ -178,6 +178,8 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
case OMPC_uses_allocators:
case OMPC_affinity:
break;
default:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
}
@ -427,6 +429,8 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
case OMPC_uses_allocators:
case OMPC_affinity:
break;
default:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
}
@ -681,6 +685,7 @@ void clang::getOpenMPCaptureRegions(
case OMPD_end_declare_variant:
llvm_unreachable("OpenMP Directive is not allowed");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
}

View File

@ -6680,6 +6680,8 @@ emitNumTeamsForTargetDirective(CodeGenFunction &CGF,
case OMPD_requires:
case OMPD_unknown:
break;
default:
break;
}
llvm_unreachable("Unexpected directive kind.");
}
@ -6995,6 +6997,8 @@ emitNumThreadsForTargetDirective(CodeGenFunction &CGF,
case OMPD_requires:
case OMPD_unknown:
break;
default:
break;
}
llvm_unreachable("Unsupported directive kind.");
}
@ -8914,6 +8918,7 @@ getNestedDistributeDirective(ASTContext &Ctx, const OMPExecutableDirective &D) {
case OMPD_parallel_master_taskloop_simd:
case OMPD_requires:
case OMPD_unknown:
default:
llvm_unreachable("Unexpected directive.");
}
}
@ -9704,6 +9709,7 @@ void CGOpenMPRuntime::scanForTargetRegionsFunctions(const Stmt *S,
case OMPD_parallel_master_taskloop_simd:
case OMPD_requires:
case OMPD_unknown:
default:
llvm_unreachable("Unknown target directive for OpenMP device codegen.");
}
return;
@ -10362,6 +10368,7 @@ void CGOpenMPRuntime::emitTargetDataStandAloneCall(
case OMPD_target_parallel_for_simd:
case OMPD_requires:
case OMPD_unknown:
default:
llvm_unreachable("Unexpected standalone target data directive.");
break;
}

View File

@ -819,6 +819,7 @@ static bool hasNestedSPMDDirective(ASTContext &Ctx,
case OMPD_parallel_master_taskloop_simd:
case OMPD_requires:
case OMPD_unknown:
default:
llvm_unreachable("Unexpected directive.");
}
}
@ -899,6 +900,7 @@ static bool supportsSPMDExecutionMode(ASTContext &Ctx,
case OMPD_parallel_master_taskloop_simd:
case OMPD_requires:
case OMPD_unknown:
default:
break;
}
llvm_unreachable(
@ -1072,6 +1074,7 @@ static bool hasNestedLightweightDirective(ASTContext &Ctx,
case OMPD_parallel_master_taskloop_simd:
case OMPD_requires:
case OMPD_unknown:
default:
llvm_unreachable("Unexpected directive.");
}
}
@ -1158,6 +1161,7 @@ static bool supportsLightweightRuntime(ASTContext &Ctx,
case OMPD_parallel_master_taskloop_simd:
case OMPD_requires:
case OMPD_unknown:
default:
break;
}
llvm_unreachable(

View File

@ -1377,6 +1377,7 @@ void CodeGenFunction::EmitOMPReductionClauseInit(
case OMPD_begin_declare_variant:
case OMPD_end_declare_variant:
case OMPD_unknown:
default:
llvm_unreachable("Enexpected directive with task reductions.");
}
@ -5302,6 +5303,7 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind,
case OMPC_exclusive:
case OMPC_uses_allocators:
case OMPC_affinity:
default:
llvm_unreachable("Clause is not allowed in 'omp atomic'.");
}
}

View File

@ -2009,6 +2009,8 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
Diag(Tok, diag::err_omp_unexpected_directive)
<< 1 << getOpenMPDirectiveName(DKind);
break;
default:
break;
}
while (Tok.isNot(tok::annot_pragma_openmp_end))
ConsumeAnyToken();
@ -2358,6 +2360,7 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext StmtCtx) {
SkipUntil(tok::annot_pragma_openmp_end);
break;
case OMPD_unknown:
default:
Diag(Tok, diag::err_omp_unknown_directive);
SkipUntil(tok::annot_pragma_openmp_end);
break;
@ -2681,6 +2684,8 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
<< getOpenMPClauseName(CKind) << getOpenMPDirectiveName(DKind);
SkipUntil(tok::comma, tok::annot_pragma_openmp_end, StopBeforeMatch);
break;
default:
break;
}
return ErrorFound ? nullptr : Clause;
}

View File

@ -4050,6 +4050,7 @@ void Sema::ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope) {
case OMPD_end_declare_variant:
llvm_unreachable("OpenMP Directive is not allowed");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
}
@ -5335,6 +5336,7 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
case OMPD_end_declare_variant:
llvm_unreachable("OpenMP Directive is not allowed");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
@ -5437,6 +5439,7 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
case OMPC_match:
default:
llvm_unreachable("Unexpected clause");
}
for (Stmt *CC : C->children()) {
@ -11683,6 +11686,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
case OMPC_exclusive:
case OMPC_uses_allocators:
case OMPC_affinity:
default:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@ -11837,6 +11841,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPD_requires:
llvm_unreachable("Unexpected OpenMP directive with if-clause");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
break;
@ -11915,6 +11920,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPD_requires:
llvm_unreachable("Unexpected OpenMP directive with num_threads-clause");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
break;
@ -11991,6 +11997,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPD_requires:
llvm_unreachable("Unexpected OpenMP directive with num_teams-clause");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
break;
@ -12067,6 +12074,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPD_requires:
llvm_unreachable("Unexpected OpenMP directive with thread_limit-clause");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
break;
@ -12143,6 +12151,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPD_requires:
llvm_unreachable("Unexpected OpenMP directive with schedule clause");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
break;
@ -12219,6 +12228,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPD_requires:
llvm_unreachable("Unexpected OpenMP directive with schedule clause");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
break;
@ -12295,6 +12305,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPD_requires:
llvm_unreachable("Unexpected OpenMP directive with num_teams-clause");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
break;
@ -12373,6 +12384,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPD_requires:
llvm_unreachable("Unexpected OpenMP directive with grainsize-clause");
case OMPD_unknown:
default:
llvm_unreachable("Unknown OpenMP directive");
}
break;
@ -12439,6 +12451,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPC_exclusive:
case OMPC_uses_allocators:
case OMPC_affinity:
default:
llvm_unreachable("Unexpected OpenMP clause.");
}
return CaptureRegion;
@ -12880,6 +12893,7 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(
case OMPC_exclusive:
case OMPC_uses_allocators:
case OMPC_affinity:
default:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@ -13108,6 +13122,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause(
case OMPC_exclusive:
case OMPC_uses_allocators:
case OMPC_affinity:
default:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@ -13345,6 +13360,7 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind,
case OMPC_exclusive:
case OMPC_uses_allocators:
case OMPC_affinity:
default:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@ -13618,6 +13634,7 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
case OMPC_destroy:
case OMPC_detach:
case OMPC_uses_allocators:
default:
llvm_unreachable("Clause is not allowed.");
}
return Res;

View File

@ -11994,6 +11994,8 @@ OMPClause *OMPClauseReader::readClause() {
case llvm::omp::Enum: \
break;
#include "llvm/Frontend/OpenMP/OMPKinds.def"
default:
break;
}
assert(C && "Unknown OMPClause type");

View File

@ -190,7 +190,7 @@ public:
// std::bitset: just iterate
for (std::size_t j{0}; j < BITS; ++j) {
auto enumerator{static_cast<enumerationType>(j)};
if (bitset_.test(enumerator)) {
if (bitset_.test(j)) {
return {enumerator};
}
}

View File

@ -409,7 +409,11 @@ public:
NODE(parser, OmpBeginLoopDirective)
NODE(parser, OmpBeginSectionsDirective)
NODE(parser, OmpBlockDirective)
NODE_ENUM(OmpBlockDirective, Directive)
static std::string GetNodeName(const llvm::omp::Directive &x) {
return llvm::Twine(
"llvm::omp::Directive = ", llvm::omp::getOpenMPDirectiveName(x))
.str();
}
NODE(parser, OmpCancelType)
NODE_ENUM(OmpCancelType, Type)
NODE(parser, OmpClause)
@ -477,7 +481,6 @@ public:
NODE(parser, OmpLinearModifier)
NODE_ENUM(OmpLinearModifier, Type)
NODE(parser, OmpLoopDirective)
NODE_ENUM(OmpLoopDirective, Directive)
NODE(parser, OmpMapClause)
NODE(parser, OmpMapType)
NODE(OmpMapType, Always)
@ -505,9 +508,7 @@ public:
NODE_ENUM(OmpScheduleModifierType, ModType)
NODE(parser, OmpSectionBlocks)
NODE(parser, OmpSectionsDirective)
NODE_ENUM(OmpSectionsDirective, Directive)
NODE(parser, OmpSimpleStandaloneDirective)
NODE_ENUM(OmpSimpleStandaloneDirective, Directive)
NODE(parser, Only)
NODE(parser, OpenMPAtomicConstruct)
NODE(parser, OpenMPBlockConstruct)

View File

@ -25,6 +25,7 @@
#include "flang/Common/Fortran.h"
#include "flang/Common/idioms.h"
#include "flang/Common/indirection.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"
#include <cinttypes>
#include <list>
#include <memory>
@ -3495,8 +3496,7 @@ struct OmpClauseList {
// 2.7.2 SECTIONS
// 2.11.2 PARALLEL SECTIONS
struct OmpSectionsDirective {
ENUM_CLASS(Directive, Sections, ParallelSections);
WRAPPER_CLASS_BOILERPLATE(OmpSectionsDirective, Directive);
WRAPPER_CLASS_BOILERPLATE(OmpSectionsDirective, llvm::omp::Directive);
CharBlock source;
};
@ -3527,10 +3527,7 @@ struct OpenMPSectionsConstruct {
// OpenMP directive beginning or ending a block
struct OmpBlockDirective {
ENUM_CLASS(Directive, Master, Ordered, Parallel, ParallelWorkshare, Single,
Target, TargetData, TargetParallel, TargetTeams, Task, Taskgroup, Teams,
Workshare);
WRAPPER_CLASS_BOILERPLATE(OmpBlockDirective, Directive);
WRAPPER_CLASS_BOILERPLATE(OmpBlockDirective, llvm::omp::Directive);
CharBlock source;
};
@ -3684,15 +3681,7 @@ struct OpenMPAtomicConstruct {
// OpenMP directives that associate with loop(s)
struct OmpLoopDirective {
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);
WRAPPER_CLASS_BOILERPLATE(OmpLoopDirective, llvm::omp::Directive);
CharBlock source;
};
@ -3726,9 +3715,7 @@ struct OpenMPFlushConstruct {
};
struct OmpSimpleStandaloneDirective {
ENUM_CLASS(Directive, Barrier, Taskwait, Taskyield, TargetEnterData,
TargetExitData, TargetUpdate, Ordered)
WRAPPER_CLASS_BOILERPLATE(OmpSimpleStandaloneDirective, Directive);
WRAPPER_CLASS_BOILERPLATE(OmpSimpleStandaloneDirective, llvm::omp::Directive);
CharBlock source;
};

View File

@ -33,6 +33,9 @@ add_flang_library(FortranEvaluate
FortranDecimal
FortranSemantics
FortranParser
DEPENDS
omp_gen
)
if (LIBPGMATH_DIR)

View File

@ -29,4 +29,7 @@ add_flang_library(FortranParser
LINK_COMPONENTS
Support
DEPENDS
omp_gen
)

View File

@ -240,45 +240,38 @@ TYPE_PARSER(construct<OmpObjectList>(nonemptyList(Parser<OmpObject>{})))
// Omp directives enclosing do loop
TYPE_PARSER(sourced(construct<OmpLoopDirective>(first(
"DISTRIBUTE PARALLEL DO SIMD" >>
pure(OmpLoopDirective::Directive::DistributeParallelDoSimd),
pure(llvm::omp::Directive::OMPD_distribute_parallel_do_simd),
"DISTRIBUTE PARALLEL DO" >>
pure(OmpLoopDirective::Directive::DistributeParallelDo),
"DISTRIBUTE SIMD" >> pure(OmpLoopDirective::Directive::DistributeSimd),
"DISTRIBUTE" >> pure(OmpLoopDirective::Directive::Distribute),
"DO SIMD" >> pure(OmpLoopDirective::Directive::DoSimd),
"DO" >> pure(OmpLoopDirective::Directive::Do),
"PARALLEL DO SIMD" >> pure(OmpLoopDirective::Directive::ParallelDoSimd),
"PARALLEL DO" >> pure(OmpLoopDirective::Directive::ParallelDo),
"SIMD" >> pure(OmpLoopDirective::Directive::Simd),
pure(llvm::omp::Directive::OMPD_distribute_parallel_do),
"DISTRIBUTE SIMD" >> pure(llvm::omp::Directive::OMPD_distribute_simd),
"DISTRIBUTE" >> pure(llvm::omp::Directive::OMPD_distribute),
"DO SIMD" >> pure(llvm::omp::Directive::OMPD_do_simd),
"DO" >> pure(llvm::omp::Directive::OMPD_do),
"PARALLEL DO SIMD" >> pure(llvm::omp::Directive::OMPD_parallel_do_simd),
"PARALLEL DO" >> pure(llvm::omp::Directive::OMPD_parallel_do),
"SIMD" >> pure(llvm::omp::Directive::OMPD_simd),
"TARGET PARALLEL DO SIMD" >>
pure(OmpLoopDirective::Directive::TargetParallelDoSimd),
"TARGET PARALLEL DO" >> pure(OmpLoopDirective::Directive::TargetParallelDo),
"TARGET SIMD" >> pure(OmpLoopDirective::Directive::TargetSimd),
pure(llvm::omp::Directive::OMPD_target_parallel_do_simd),
"TARGET PARALLEL DO" >> pure(llvm::omp::Directive::OMPD_target_parallel_do),
"TARGET SIMD" >> pure(llvm::omp::Directive::OMPD_target_simd),
"TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD" >>
pure(OmpLoopDirective::Directive::TargetTeamsDistributeParallelDoSimd),
pure(llvm::omp::Directive::
OMPD_target_teams_distribute_parallel_do_simd),
"TARGET TEAMS DISTRIBUTE PARALLEL DO" >>
pure(OmpLoopDirective::Directive::TargetTeamsDistributeParallelDo),
pure(llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do),
"TARGET TEAMS DISTRIBUTE SIMD" >>
pure(OmpLoopDirective::Directive::TargetTeamsDistributeSimd),
pure(llvm::omp::Directive::OMPD_target_teams_distribute_simd),
"TARGET TEAMS DISTRIBUTE" >>
pure(OmpLoopDirective::Directive::TargetTeamsDistribute),
"TASKLOOP SIMD" >> pure(OmpLoopDirective::Directive::TaskloopSimd),
"TASKLOOP" >> pure(OmpLoopDirective::Directive::Taskloop),
pure(llvm::omp::Directive::OMPD_target_teams_distribute),
"TASKLOOP SIMD" >> pure(llvm::omp::Directive::OMPD_taskloop_simd),
"TASKLOOP" >> pure(llvm::omp::Directive::OMPD_taskloop),
"TEAMS DISTRIBUTE PARALLEL DO SIMD" >>
pure(OmpLoopDirective::Directive::TeamsDistributeParallelDoSimd),
pure(llvm::omp::Directive::OMPD_teams_distribute_parallel_do_simd),
"TEAMS DISTRIBUTE PARALLEL DO" >>
pure(OmpLoopDirective::Directive::TeamsDistributeParallelDo),
pure(llvm::omp::Directive::OMPD_teams_distribute_parallel_do),
"TEAMS DISTRIBUTE SIMD" >>
pure(OmpLoopDirective::Directive::TeamsDistributeSimd),
"TEAMS DISTRIBUTE" >> pure(OmpLoopDirective::Directive::TeamsDistribute)))))
pure(llvm::omp::Directive::OMPD_teams_distribute_simd),
"TEAMS DISTRIBUTE" >> pure(llvm::omp::Directive::OMPD_teams_distribute)))))
TYPE_PARSER(sourced(construct<OmpBeginLoopDirective>(
sourced(Parser<OmpLoopDirective>{}), Parser<OmpClauseList>{})))
@ -304,16 +297,13 @@ TYPE_PARSER(sourced(construct<OpenMPFlushConstruct>(
// Simple Standalone Directives
TYPE_PARSER(sourced(construct<OmpSimpleStandaloneDirective>(first(
"BARRIER" >> pure(OmpSimpleStandaloneDirective::Directive::Barrier),
"ORDERED" >> pure(OmpSimpleStandaloneDirective::Directive::Ordered),
"TARGET ENTER DATA" >>
pure(OmpSimpleStandaloneDirective::Directive::TargetEnterData),
"TARGET EXIT DATA" >>
pure(OmpSimpleStandaloneDirective::Directive::TargetExitData),
"TARGET UPDATE" >>
pure(OmpSimpleStandaloneDirective::Directive::TargetUpdate),
"TASKWAIT" >> pure(OmpSimpleStandaloneDirective::Directive::Taskwait),
"TASKYIELD" >> pure(OmpSimpleStandaloneDirective::Directive::Taskyield)))))
"BARRIER" >> pure(llvm::omp::Directive::OMPD_barrier),
"ORDERED" >> pure(llvm::omp::Directive::OMPD_ordered),
"TARGET ENTER DATA" >> pure(llvm::omp::Directive::OMPD_target_enter_data),
"TARGET EXIT DATA" >> pure(llvm::omp::Directive::OMPD_target_exit_data),
"TARGET UPDATE" >> pure(llvm::omp::Directive::OMPD_target_update),
"TASKWAIT" >> pure(llvm::omp::Directive::OMPD_taskwait),
"TASKYIELD" >> pure(llvm::omp::Directive::OMPD_taskyield)))))
TYPE_PARSER(sourced(construct<OpenMPSimpleStandaloneConstruct>(
Parser<OmpSimpleStandaloneDirective>{}, Parser<OmpClauseList>{})))
@ -329,21 +319,20 @@ TYPE_PARSER(
endOfLine)
// Directives enclosing structured-block
TYPE_PARSER(construct<OmpBlockDirective>(
first("MASTER" >> pure(OmpBlockDirective::Directive::Master),
"ORDERED" >> pure(OmpBlockDirective::Directive::Ordered),
"PARALLEL WORKSHARE" >>
pure(OmpBlockDirective::Directive::ParallelWorkshare),
"PARALLEL" >> pure(OmpBlockDirective::Directive::Parallel),
"SINGLE" >> pure(OmpBlockDirective::Directive::Single),
"TARGET DATA" >> pure(OmpBlockDirective::Directive::TargetData),
"TARGET PARALLEL" >> pure(OmpBlockDirective::Directive::TargetParallel),
"TARGET TEAMS" >> pure(OmpBlockDirective::Directive::TargetTeams),
"TARGET" >> pure(OmpBlockDirective::Directive::Target),
"TASK"_id >> pure(OmpBlockDirective::Directive::Task),
"TASKGROUP" >> pure(OmpBlockDirective::Directive::Taskgroup),
"TEAMS" >> pure(OmpBlockDirective::Directive::Teams),
"WORKSHARE" >> pure(OmpBlockDirective::Directive::Workshare))))
TYPE_PARSER(construct<OmpBlockDirective>(first(
"MASTER" >> pure(llvm::omp::Directive::OMPD_master),
"ORDERED" >> pure(llvm::omp::Directive::OMPD_ordered),
"PARALLEL WORKSHARE" >> pure(llvm::omp::Directive::OMPD_parallel_workshare),
"PARALLEL" >> pure(llvm::omp::Directive::OMPD_parallel),
"SINGLE" >> pure(llvm::omp::Directive::OMPD_single),
"TARGET DATA" >> pure(llvm::omp::Directive::OMPD_target_data),
"TARGET PARALLEL" >> pure(llvm::omp::Directive::OMPD_target_parallel),
"TARGET TEAMS" >> pure(llvm::omp::Directive::OMPD_target_teams),
"TARGET" >> pure(llvm::omp::Directive::OMPD_target),
"TASK"_id >> pure(llvm::omp::Directive::OMPD_task),
"TASKGROUP" >> pure(llvm::omp::Directive::OMPD_taskgroup),
"TEAMS" >> pure(llvm::omp::Directive::OMPD_teams),
"WORKSHARE" >> pure(llvm::omp::Directive::OMPD_workshare))))
TYPE_PARSER(sourced(construct<OmpBeginBlockDirective>(
sourced(Parser<OmpBlockDirective>{}), Parser<OmpClauseList>{})))
@ -476,10 +465,9 @@ TYPE_PARSER(construct<OpenMPBlockConstruct>(
Parser<OmpEndBlockDirective>{} / endOmpLine))
// OMP SECTIONS Directive
TYPE_PARSER(construct<OmpSectionsDirective>(
first("SECTIONS" >> pure(OmpSectionsDirective::Directive::Sections),
"PARALLEL SECTIONS" >>
pure(OmpSectionsDirective::Directive::ParallelSections))))
TYPE_PARSER(construct<OmpSectionsDirective>(first(
"SECTIONS" >> pure(llvm::omp::Directive::OMPD_sections),
"PARALLEL SECTIONS" >> pure(llvm::omp::Directive::OMPD_parallel_sections))))
// OMP BEGIN and END SECTIONS Directive
TYPE_PARSER(sourced(construct<OmpBeginSectionsDirective>(

View File

@ -2017,141 +2017,149 @@ public:
}
void Unparse(const OmpLoopDirective &x) {
switch (x.v) {
case OmpLoopDirective::Directive::Distribute:
case llvm::omp::Directive::OMPD_distribute:
Word("DISTRIBUTE ");
break;
case OmpLoopDirective::Directive::DistributeParallelDo:
case llvm::omp::Directive::OMPD_distribute_parallel_do:
Word("DISTRIBUTE PARALLEL DO ");
break;
case OmpLoopDirective::Directive::DistributeParallelDoSimd:
case llvm::omp::Directive::OMPD_distribute_parallel_do_simd:
Word("DISTRIBUTE PARALLEL DO SIMD ");
break;
case OmpLoopDirective::Directive::DistributeSimd:
case llvm::omp::Directive::OMPD_distribute_simd:
Word("DISTRIBUTE SIMD ");
break;
case OmpLoopDirective::Directive::Do:
case llvm::omp::Directive::OMPD_do:
Word("DO ");
break;
case OmpLoopDirective::Directive::DoSimd:
Word("Do SIMD ");
case llvm::omp::Directive::OMPD_do_simd:
Word("DO SIMD ");
break;
case OmpLoopDirective::Directive::ParallelDo:
case llvm::omp::Directive::OMPD_parallel_do:
Word("PARALLEL DO ");
break;
case OmpLoopDirective::Directive::ParallelDoSimd:
case llvm::omp::Directive::OMPD_parallel_do_simd:
Word("PARALLEL DO SIMD ");
break;
case OmpLoopDirective::Directive::Simd:
case llvm::omp::Directive::OMPD_simd:
Word("SIMD ");
break;
case OmpLoopDirective::Directive::TargetParallelDo:
case llvm::omp::Directive::OMPD_target_parallel_do:
Word("TARGET PARALLEL DO ");
break;
case OmpLoopDirective::Directive::TargetParallelDoSimd:
case llvm::omp::Directive::OMPD_target_parallel_do_simd:
Word("TARGET PARALLEL DO SIMD ");
break;
case OmpLoopDirective::Directive::TargetTeamsDistribute:
case llvm::omp::Directive::OMPD_target_teams_distribute:
Word("TARGET TEAMS DISTRIBUTE ");
break;
case OmpLoopDirective::Directive::TargetTeamsDistributeParallelDo:
case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do:
Word("TARGET TEAMS DISTRIBUTE PARALLEL DO ");
break;
case OmpLoopDirective::Directive::TargetTeamsDistributeParallelDoSimd:
case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do_simd:
Word("TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD ");
break;
case OmpLoopDirective::Directive::TargetTeamsDistributeSimd:
case llvm::omp::Directive::OMPD_target_teams_distribute_simd:
Word("TARGET TEAMS DISTRIBUTE SIMD ");
break;
case OmpLoopDirective::Directive::TargetSimd:
case llvm::omp::Directive::OMPD_target_simd:
Word("TARGET SIMD ");
break;
case OmpLoopDirective::Directive::Taskloop:
case llvm::omp::Directive::OMPD_taskloop:
Word("TASKLOOP ");
break;
case OmpLoopDirective::Directive::TaskloopSimd:
case llvm::omp::Directive::OMPD_taskloop_simd:
Word("TASKLOOP SIMD ");
break;
case OmpLoopDirective::Directive::TeamsDistribute:
case llvm::omp::Directive::OMPD_teams_distribute:
Word("TEAMS DISTRIBUTE ");
break;
case OmpLoopDirective::Directive::TeamsDistributeParallelDo:
case llvm::omp::Directive::OMPD_teams_distribute_parallel_do:
Word("TEAMS DISTRIBUTE PARALLEL DO ");
break;
case OmpLoopDirective::Directive::TeamsDistributeParallelDoSimd:
case llvm::omp::Directive::OMPD_teams_distribute_parallel_do_simd:
Word("TEAMS DISTRIBUTE PARALLEL DO SIMD ");
break;
case OmpLoopDirective::Directive::TeamsDistributeSimd:
case llvm::omp::Directive::OMPD_teams_distribute_simd:
Word("TEAMS DISTRIBUTE SIMD ");
break;
default:
break;
}
}
void Unparse(const OmpObjectList &x) { Walk(x.v, ","); }
void Unparse(const OmpSimpleStandaloneDirective &x) {
switch (x.v) {
case OmpSimpleStandaloneDirective::Directive::Barrier:
case llvm::omp::Directive::OMPD_barrier:
Word("BARRIER ");
break;
case OmpSimpleStandaloneDirective::Directive::Taskwait:
case llvm::omp::Directive::OMPD_taskwait:
Word("TASKWAIT ");
break;
case OmpSimpleStandaloneDirective::Directive::Taskyield:
case llvm::omp::Directive::OMPD_taskyield:
Word("TASKYIELD ");
break;
case OmpSimpleStandaloneDirective::Directive::TargetEnterData:
case llvm::omp::Directive::OMPD_target_enter_data:
Word("TARGET ENTER DATA ");
break;
case OmpSimpleStandaloneDirective::Directive::TargetExitData:
case llvm::omp::Directive::OMPD_target_exit_data:
Word("TARGET EXIT DATA ");
break;
case OmpSimpleStandaloneDirective::Directive::TargetUpdate:
case llvm::omp::Directive::OMPD_target_update:
Word("TARGET UPDATE ");
break;
case OmpSimpleStandaloneDirective::Directive::Ordered:
case llvm::omp::Directive::OMPD_ordered:
Word("ORDERED ");
break;
default:
// Nothing to be done
break;
}
}
void Unparse(const OmpBlockDirective &x) {
switch (x.v) {
case OmpBlockDirective::Directive::Master:
case llvm::omp::Directive::OMPD_master:
Word("MASTER");
break;
case OmpBlockDirective::Directive::Ordered:
case llvm::omp::Directive::OMPD_ordered:
Word("ORDERED ");
break;
case OmpBlockDirective::Directive::ParallelWorkshare:
case llvm::omp::Directive::OMPD_parallel_workshare:
Word("PARALLEL WORKSHARE ");
break;
case OmpBlockDirective::Directive::Parallel:
case llvm::omp::Directive::OMPD_parallel:
Word("PARALLEL ");
break;
case OmpBlockDirective::Directive::Single:
case llvm::omp::Directive::OMPD_single:
Word("SINGLE ");
break;
case OmpBlockDirective::Directive::TargetData:
case llvm::omp::Directive::OMPD_target_data:
Word("TARGET DATA ");
break;
case OmpBlockDirective::Directive::TargetParallel:
case llvm::omp::Directive::OMPD_target_parallel:
Word("TARGET PARALLEL ");
break;
case OmpBlockDirective::Directive::TargetTeams:
case llvm::omp::Directive::OMPD_target_teams:
Word("TARGET TEAMS ");
break;
case OmpBlockDirective::Directive::Target:
case llvm::omp::Directive::OMPD_target:
Word("TARGET ");
break;
case OmpBlockDirective::Directive::Taskgroup:
case llvm::omp::Directive::OMPD_taskgroup:
Word("TASKGROUP ");
break;
case OmpBlockDirective::Directive::Task:
case llvm::omp::Directive::OMPD_task:
Word("TASK ");
break;
case OmpBlockDirective::Directive::Teams:
case llvm::omp::Directive::OMPD_teams:
Word("TEAMS ");
break;
case OmpBlockDirective::Directive::Workshare:
case llvm::omp::Directive::OMPD_workshare:
Word("WORKSHARE ");
break;
default:
// Nothing to be done
break;
}
}
void Unparse(const OmpMemoryClause &x) {
@ -2314,12 +2322,14 @@ public:
}
void Unparse(const OmpSectionsDirective &x) {
switch (x.v) {
case OmpSectionsDirective::Directive::Sections:
case llvm::omp::Directive::OMPD_sections:
Word("SECTIONS ");
break;
case OmpSectionsDirective::Directive::ParallelSections:
case llvm::omp::Directive::OMPD_parallel_sections:
Word("PARALLEL SECTIONS ");
break;
default:
break;
}
}
void Unparse(const OmpSectionBlocks &x) {

View File

@ -39,10 +39,14 @@ add_flang_library(FortranSemantics
type.cpp
unparse-with-symbols.cpp
DEPENDS
omp_gen
LINK_LIBS
FortranCommon
FortranEvaluate
LINK_COMPONENTS
Support
FrontendOpenMP
)

File diff suppressed because it is too large Load Diff

View File

@ -17,80 +17,63 @@
#include "flang/Common/enum-set.h"
#include "flang/Parser/parse-tree.h"
#include "flang/Semantics/semantics.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"
using OmpDirectiveSet = Fortran::common::EnumSet<llvm::omp::Directive,
llvm::omp::Directive_enumSize>;
using OmpClauseSet =
Fortran::common::EnumSet<llvm::omp::Clause, llvm::omp::Clause_enumSize>;
namespace llvm {
namespace omp {
static OmpDirectiveSet parallelSet{Directive::OMPD_distribute_parallel_do,
Directive::OMPD_distribute_parallel_do_simd, Directive::OMPD_parallel,
Directive::OMPD_parallel_do, Directive::OMPD_parallel_do_simd,
Directive::OMPD_parallel_sections, Directive::OMPD_parallel_workshare,
Directive::OMPD_target_parallel, Directive::OMPD_target_parallel_do,
Directive::OMPD_target_parallel_do_simd,
Directive::OMPD_target_teams_distribute_parallel_do,
Directive::OMPD_target_teams_distribute_parallel_do_simd,
Directive::OMPD_teams_distribute_parallel_do,
Directive::OMPD_teams_distribute_parallel_do_simd};
static OmpDirectiveSet doSet{Directive::OMPD_distribute_parallel_do,
Directive::OMPD_distribute_parallel_do_simd, Directive::OMPD_parallel,
Directive::OMPD_parallel_do, Directive::OMPD_parallel_do_simd,
Directive::OMPD_do, Directive::OMPD_do_simd,
Directive::OMPD_target_parallel_do, Directive::OMPD_target_parallel_do_simd,
Directive::OMPD_target_teams_distribute_parallel_do,
Directive::OMPD_target_teams_distribute_parallel_do_simd,
Directive::OMPD_teams_distribute_parallel_do,
Directive::OMPD_teams_distribute_parallel_do_simd};
static OmpDirectiveSet doSimdSet{Directive::OMPD_distribute_parallel_do_simd,
Directive::OMPD_parallel_do_simd, Directive::OMPD_do_simd,
Directive::OMPD_target_parallel_do_simd,
Directive::OMPD_target_teams_distribute_parallel_do_simd,
Directive::OMPD_teams_distribute_parallel_do_simd};
static OmpDirectiveSet taskloopSet{
Directive::OMPD_taskloop, Directive::OMPD_taskloop_simd};
static OmpDirectiveSet targetSet{Directive::OMPD_target,
Directive::OMPD_target_parallel, Directive::OMPD_target_parallel_do,
Directive::OMPD_target_parallel_do_simd, Directive::OMPD_target_simd,
Directive::OMPD_target_teams, Directive::OMPD_target_teams_distribute,
Directive::OMPD_target_teams_distribute_simd};
static OmpDirectiveSet simdSet{Directive::OMPD_distribute_parallel_do_simd,
Directive::OMPD_distribute_simd, Directive::OMPD_parallel_do_simd,
Directive::OMPD_do_simd, Directive::OMPD_simd,
Directive::OMPD_target_parallel_do_simd,
Directive::OMPD_target_teams_distribute_parallel_do_simd,
Directive::OMPD_target_teams_distribute_simd, Directive::OMPD_target_simd,
Directive::OMPD_taskloop_simd,
Directive::OMPD_teams_distribute_parallel_do_simd,
Directive::OMPD_teams_distribute_simd};
static OmpDirectiveSet taskGeneratingSet{
OmpDirectiveSet{Directive::OMPD_task} | taskloopSet};
} // namespace omp
} // namespace llvm
namespace Fortran::semantics {
ENUM_CLASS(OmpDirective, ATOMIC, BARRIER, CANCEL, CANCELLATION_POINT, CRITICAL,
DECLARE_REDUCTION, DECLARE_SIMD, DECLARE_TARGET, DISTRIBUTE,
DISTRIBUTE_PARALLEL_DO, DISTRIBUTE_PARALLEL_DO_SIMD, DISTRIBUTE_SIMD, DO,
DO_SIMD, END_CRITICAL, END_DO, END_DO_SIMD, END_SECTIONS, END_SINGLE,
END_WORKSHARE, FLUSH, MASTER, ORDERED, PARALLEL, PARALLEL_DO,
PARALLEL_DO_SIMD, PARALLEL_SECTIONS, PARALLEL_WORKSHARE, SECTION, SECTIONS,
SIMD, SINGLE, TARGET, TARGET_DATA, TARGET_ENTER_DATA, TARGET_EXIT_DATA,
TARGET_PARALLEL, TARGET_PARALLEL_DO, TARGET_PARALLEL_DO_SIMD, TARGET_SIMD,
TARGET_TEAMS, TARGET_TEAMS_DISTRIBUTE, TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, TARGET_TEAMS_DISTRIBUTE_SIMD,
TARGET_UPDATE, TASK, TASKGROUP, TASKLOOP, TASKLOOP_SIMD, TASKWAIT,
TASKYIELD, TEAMS, TEAMS_DISTRIBUTE, TEAMS_DISTRIBUTE_PARALLEL_DO,
TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, TEAMS_DISTRIBUTE_SIMD, THREADPRIVATE,
WORKSHARE)
using OmpDirectiveSet = common::EnumSet<OmpDirective, OmpDirective_enumSize>;
ENUM_CLASS(OmpClause, ALIGNED, COLLAPSE, COPYIN, COPYPRIVATE, DEFAULT,
DEFAULTMAP, DEPEND, DEVICE, DIST_SCHEDULE, FINAL, FIRSTPRIVATE, FROM,
GRAINSIZE, IF, INBRANCH, IS_DEVICE_PTR, LASTPRIVATE, LINEAR, LINK, MAP,
MERGEABLE, NOGROUP, NOTINBRANCH, NOWAIT, NUM_TASKS, NUM_TEAMS, NUM_THREADS,
ORDERED, PRIORITY, PRIVATE, PROC_BIND, REDUCTION, SAFELEN, SCHEDULE, SHARED,
SIMD, SIMDLEN, THREAD_LIMIT, THREADS, TO, UNIFORM, UNTIED, USE_DEVICE_PTR)
using OmpClauseSet = common::EnumSet<OmpClause, OmpClause_enumSize>;
static constexpr OmpDirectiveSet parallelSet{
OmpDirective::DISTRIBUTE_PARALLEL_DO,
OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD, OmpDirective::PARALLEL,
OmpDirective::PARALLEL_DO, OmpDirective::PARALLEL_DO_SIMD,
OmpDirective::PARALLEL_SECTIONS, OmpDirective::PARALLEL_WORKSHARE,
OmpDirective::TARGET_PARALLEL, OmpDirective::TARGET_PARALLEL_DO,
OmpDirective::TARGET_PARALLEL_DO_SIMD,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO,
OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD};
static constexpr OmpDirectiveSet doSet{OmpDirective::DISTRIBUTE_PARALLEL_DO,
OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD, OmpDirective::PARALLEL_DO,
OmpDirective::PARALLEL_DO_SIMD, OmpDirective::DO, OmpDirective::DO_SIMD,
OmpDirective::TARGET_PARALLEL_DO, OmpDirective::TARGET_PARALLEL_DO_SIMD,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO,
OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD};
static constexpr OmpDirectiveSet doSimdSet{
OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD, OmpDirective::PARALLEL_DO_SIMD,
OmpDirective::DO_SIMD, OmpDirective::TARGET_PARALLEL_DO_SIMD,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD};
static constexpr OmpDirectiveSet taskloopSet{
OmpDirective::TASKLOOP, OmpDirective::TASKLOOP_SIMD};
static constexpr OmpDirectiveSet targetSet{OmpDirective::TARGET,
OmpDirective::TARGET_PARALLEL, OmpDirective::TARGET_PARALLEL_DO,
OmpDirective::TARGET_PARALLEL_DO_SIMD, OmpDirective::TARGET_SIMD,
OmpDirective::TARGET_TEAMS, OmpDirective::TARGET_TEAMS_DISTRIBUTE,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_SIMD};
static constexpr OmpDirectiveSet simdSet{
OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD, OmpDirective::DISTRIBUTE_SIMD,
OmpDirective::PARALLEL_DO_SIMD, OmpDirective::DO_SIMD, OmpDirective::SIMD,
OmpDirective::TARGET_PARALLEL_DO_SIMD,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_SIMD, OmpDirective::TARGET_SIMD,
OmpDirective::TASKLOOP_SIMD,
OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD,
OmpDirective::TEAMS_DISTRIBUTE_SIMD};
static constexpr OmpDirectiveSet taskGeneratingSet{
OmpDirectiveSet{OmpDirective::TASK} | taskloopSet};
class OmpStructureChecker : public virtual BaseChecker {
public:
OmpStructureChecker(SemanticsContext &context) : context_{context} {}
@ -169,18 +152,18 @@ public:
private:
struct OmpContext {
OmpContext(parser::CharBlock source, OmpDirective d)
OmpContext(parser::CharBlock source, llvm::omp::Directive d)
: directiveSource{source}, directive{d} {}
parser::CharBlock directiveSource{nullptr};
parser::CharBlock clauseSource{nullptr};
OmpDirective directive;
llvm::omp::Directive directive;
OmpClauseSet allowedClauses{};
OmpClauseSet allowedOnceClauses{};
OmpClauseSet allowedExclusiveClauses{};
OmpClauseSet requiredClauses{};
const parser::OmpClause *clause{nullptr};
std::multimap<OmpClause, const parser::OmpClause *> clauseInfo;
std::multimap<llvm::omp::Clause, const parser::OmpClause *> clauseInfo;
};
// back() is the top of the stack
OmpContext &GetContext() {
@ -205,7 +188,7 @@ private:
GetContext().clauseSource = clause.source;
GetContext().clause = &clause;
}
void SetContextDirectiveEnum(OmpDirective dir) {
void SetContextDirectiveEnum(llvm::omp::Directive dir) {
GetContext().directive = dir;
}
void SetContextAllowed(const OmpClauseSet &allowed) {
@ -220,30 +203,30 @@ private:
void SetContextRequired(const OmpClauseSet &required) {
GetContext().requiredClauses = required;
}
void SetContextClauseInfo(OmpClause type) {
void SetContextClauseInfo(llvm::omp::Clause type) {
GetContext().clauseInfo.emplace(type, GetContext().clause);
}
const parser::OmpClause *FindClause(OmpClause type) {
const parser::OmpClause *FindClause(llvm::omp::Clause type) {
auto it{GetContext().clauseInfo.find(type)};
if (it != GetContext().clauseInfo.end()) {
return it->second;
}
return nullptr;
}
void PushContext(const parser::CharBlock &source, OmpDirective dir) {
void PushContext(const parser::CharBlock &source, llvm::omp::Directive dir) {
ompContext_.emplace_back(source, dir);
}
void RequiresConstantPositiveParameter(
const OmpClause &clause, const parser::ScalarIntConstantExpr &i);
const llvm::omp::Clause &clause, const parser::ScalarIntConstantExpr &i);
void RequiresPositiveParameter(
const OmpClause &clause, const parser::ScalarIntExpr &i);
const llvm::omp::Clause &clause, const parser::ScalarIntExpr &i);
bool CurrentDirectiveIsNested() { return ompContext_.size() > 0; };
bool HasInvalidWorksharingNesting(
const parser::CharBlock &, const OmpDirectiveSet &);
void CheckAllowed(OmpClause);
void CheckRequired(OmpClause);
void CheckAllowed(llvm::omp::Clause);
void CheckRequired(llvm::omp::Clause);
std::string ContextDirectiveAsFortran();
void SayNotMatching(const parser::CharBlock &, const parser::CharBlock &);
template <typename A, typename B, typename C>

View File

@ -1150,9 +1150,9 @@ bool OmpVisitor::NeedsScope(const parser::OpenMPBlockConstruct &x) {
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)};
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
switch (beginDir.v) {
case parser::OmpBlockDirective::Directive::TargetData:
case parser::OmpBlockDirective::Directive::Master:
case parser::OmpBlockDirective::Directive::Ordered:
case llvm::omp::Directive::OMPD_target_data:
case llvm::omp::Directive::OMPD_master:
case llvm::omp::Directive::OMPD_ordered:
return false;
default:
return true;
@ -1236,10 +1236,11 @@ public:
private:
struct OmpContext {
OmpContext(const parser::CharBlock &source, OmpDirective d, Scope &s)
OmpContext(
const parser::CharBlock &source, llvm::omp::Directive d, Scope &s)
: directiveSource{source}, directive{d}, scope{s} {}
parser::CharBlock directiveSource;
OmpDirective directive;
llvm::omp::Directive directive;
Scope &scope;
// TODO: default DSA is implicitly determined in different ways
Symbol::Flag defaultDSA{Symbol::Flag::OmpShared};
@ -1253,14 +1254,14 @@ private:
CHECK(!ompContext_.empty());
return ompContext_.back();
}
void PushContext(const parser::CharBlock &source, OmpDirective dir) {
void PushContext(const parser::CharBlock &source, llvm::omp::Directive dir) {
ompContext_.emplace_back(source, dir, context_.FindScope(source));
}
void PopContext() { ompContext_.pop_back(); }
void SetContextDirectiveSource(parser::CharBlock &dir) {
GetContext().directiveSource = dir;
}
void SetContextDirectiveEnum(OmpDirective dir) {
void SetContextDirectiveEnum(llvm::omp::Directive dir) {
GetContext().directive = dir;
}
Scope &currScope() { return GetContext().scope; }
@ -6441,41 +6442,19 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPBlockConstruct &x) {
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)};
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
switch (beginDir.v) {
case parser::OmpBlockDirective::Directive::Master:
PushContext(beginDir.source, OmpDirective::MASTER);
break;
case parser::OmpBlockDirective::Directive::Ordered:
PushContext(beginDir.source, OmpDirective::ORDERED);
break;
case parser::OmpBlockDirective::Directive::Parallel:
PushContext(beginDir.source, OmpDirective::PARALLEL);
break;
case parser::OmpBlockDirective::Directive::Single:
PushContext(beginDir.source, OmpDirective::SINGLE);
break;
case parser::OmpBlockDirective::Directive::Target:
PushContext(beginDir.source, OmpDirective::TARGET);
break;
case parser::OmpBlockDirective::Directive::TargetData:
PushContext(beginDir.source, OmpDirective::TARGET_DATA);
break;
case parser::OmpBlockDirective::Directive::Task:
PushContext(beginDir.source, OmpDirective::TASK);
break;
case parser::OmpBlockDirective::Directive::Teams:
PushContext(beginDir.source, OmpDirective::TEAMS);
break;
case parser::OmpBlockDirective::Directive::Workshare:
PushContext(beginDir.source, OmpDirective::WORKSHARE);
break;
case parser::OmpBlockDirective::Directive::ParallelWorkshare:
PushContext(beginDir.source, OmpDirective::PARALLEL_WORKSHARE);
break;
case parser::OmpBlockDirective::Directive::TargetTeams:
PushContext(beginDir.source, OmpDirective::TARGET_TEAMS);
break;
case parser::OmpBlockDirective::Directive::TargetParallel:
PushContext(beginDir.source, OmpDirective::TARGET_PARALLEL);
case llvm::omp::Directive::OMPD_master:
case llvm::omp::Directive::OMPD_ordered:
case llvm::omp::Directive::OMPD_parallel:
case llvm::omp::Directive::OMPD_single:
case llvm::omp::Directive::OMPD_target:
case llvm::omp::Directive::OMPD_target_data:
case llvm::omp::Directive::OMPD_task:
case llvm::omp::Directive::OMPD_teams:
case llvm::omp::Directive::OMPD_workshare:
case llvm::omp::Directive::OMPD_parallel_workshare:
case llvm::omp::Directive::OMPD_target_teams:
case llvm::omp::Directive::OMPD_target_parallel:
PushContext(beginDir.source, beginDir.v);
break;
default:
// TODO others
@ -6490,74 +6469,31 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPLoopConstruct &x) {
const auto &beginDir{std::get<parser::OmpLoopDirective>(beginLoopDir.t)};
const auto &clauseList{std::get<parser::OmpClauseList>(beginLoopDir.t)};
switch (beginDir.v) {
case parser::OmpLoopDirective::Directive::Distribute:
PushContext(beginDir.source, OmpDirective::DISTRIBUTE);
case llvm::omp::Directive::OMPD_distribute:
case llvm::omp::Directive::OMPD_distribute_parallel_do:
case llvm::omp::Directive::OMPD_distribute_parallel_do_simd:
case llvm::omp::Directive::OMPD_distribute_simd:
case llvm::omp::Directive::OMPD_do:
case llvm::omp::Directive::OMPD_do_simd:
case llvm::omp::Directive::OMPD_parallel_do:
case llvm::omp::Directive::OMPD_parallel_do_simd:
case llvm::omp::Directive::OMPD_simd:
case llvm::omp::Directive::OMPD_target_parallel_do:
case llvm::omp::Directive::OMPD_target_parallel_do_simd:
case llvm::omp::Directive::OMPD_target_teams_distribute:
case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do:
case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do_simd:
case llvm::omp::Directive::OMPD_target_teams_distribute_simd:
case llvm::omp::Directive::OMPD_target_simd:
case llvm::omp::Directive::OMPD_taskloop:
case llvm::omp::Directive::OMPD_taskloop_simd:
case llvm::omp::Directive::OMPD_teams_distribute:
case llvm::omp::Directive::OMPD_teams_distribute_parallel_do:
case llvm::omp::Directive::OMPD_teams_distribute_parallel_do_simd:
case llvm::omp::Directive::OMPD_teams_distribute_simd:
PushContext(beginDir.source, beginDir.v);
break;
case parser::OmpLoopDirective::Directive::DistributeParallelDo:
PushContext(beginDir.source, OmpDirective::DISTRIBUTE_PARALLEL_DO);
break;
case parser::OmpLoopDirective::Directive::DistributeParallelDoSimd:
PushContext(beginDir.source, OmpDirective::DISTRIBUTE_PARALLEL_DO_SIMD);
break;
case parser::OmpLoopDirective::Directive::DistributeSimd:
PushContext(beginDir.source, OmpDirective::DISTRIBUTE_SIMD);
break;
case parser::OmpLoopDirective::Directive::Do:
PushContext(beginDir.source, OmpDirective::DO);
break;
case parser::OmpLoopDirective::Directive::DoSimd:
PushContext(beginDir.source, OmpDirective::DO_SIMD);
break;
case parser::OmpLoopDirective::Directive::ParallelDo:
PushContext(beginDir.source, OmpDirective::PARALLEL_DO);
break;
case parser::OmpLoopDirective::Directive::ParallelDoSimd:
PushContext(beginDir.source, OmpDirective::PARALLEL_DO_SIMD);
break;
case parser::OmpLoopDirective::Directive::Simd:
PushContext(beginDir.source, OmpDirective::SIMD);
break;
case parser::OmpLoopDirective::Directive::TargetParallelDo:
PushContext(beginDir.source, OmpDirective::TARGET_PARALLEL_DO);
break;
case parser::OmpLoopDirective::Directive::TargetParallelDoSimd:
PushContext(beginDir.source, OmpDirective::TARGET_PARALLEL_DO_SIMD);
break;
case parser::OmpLoopDirective::Directive::TargetTeamsDistribute:
PushContext(beginDir.source, OmpDirective::TARGET_TEAMS_DISTRIBUTE);
break;
case parser::OmpLoopDirective::Directive::TargetTeamsDistributeParallelDo:
PushContext(
beginDir.source, OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO);
break;
case parser::OmpLoopDirective::Directive::TargetTeamsDistributeParallelDoSimd:
PushContext(beginDir.source,
OmpDirective::TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD);
break;
case parser::OmpLoopDirective::Directive::TargetTeamsDistributeSimd:
PushContext(beginDir.source, OmpDirective::TARGET_TEAMS_DISTRIBUTE_SIMD);
break;
case parser::OmpLoopDirective::Directive::TargetSimd:
PushContext(beginDir.source, OmpDirective::TARGET_SIMD);
break;
case parser::OmpLoopDirective::Directive::Taskloop:
PushContext(beginDir.source, OmpDirective::TASKLOOP);
break;
case parser::OmpLoopDirective::Directive::TaskloopSimd:
PushContext(beginDir.source, OmpDirective::TASKLOOP_SIMD);
break;
case parser::OmpLoopDirective::Directive::TeamsDistribute:
PushContext(beginDir.source, OmpDirective::TEAMS_DISTRIBUTE);
break;
case parser::OmpLoopDirective::Directive::TeamsDistributeParallelDo:
PushContext(beginDir.source, OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO);
break;
case parser::OmpLoopDirective::Directive::TeamsDistributeParallelDoSimd:
PushContext(
beginDir.source, OmpDirective::TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD);
break;
case parser::OmpLoopDirective::Directive::TeamsDistributeSimd:
PushContext(beginDir.source, OmpDirective::TEAMS_DISTRIBUTE_SIMD);
default:
break;
}
ClearDataSharingAttributeObjects();
@ -6581,8 +6517,8 @@ void OmpAttributeVisitor::ResolveSeqLoopIndexInParallelOrTaskConstruct(
if (targetIt == ompContext_.rend()) {
return;
}
if (parallelSet.test(targetIt->directive) ||
taskGeneratingSet.test(targetIt->directive)) {
if (llvm::omp::parallelSet.test(targetIt->directive) ||
llvm::omp::taskGeneratingSet.test(targetIt->directive)) {
break;
}
}
@ -6669,7 +6605,7 @@ void OmpAttributeVisitor::PrivatizeAssociatedLoopIndex(
if (level <= 0)
return;
Symbol::Flag ivDSA{Symbol::Flag::OmpPrivate};
if (simdSet.test(GetContext().directive)) {
if (llvm::omp::simdSet.test(GetContext().directive)) {
if (level == 1) {
ivDSA = Symbol::Flag::OmpLinear;
} else {
@ -6700,11 +6636,11 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPSectionsConstruct &x) {
const auto &beginDir{
std::get<parser::OmpSectionsDirective>(beginSectionsDir.t)};
switch (beginDir.v) {
case parser::OmpSectionsDirective::Directive::ParallelSections:
PushContext(beginDir.source, OmpDirective::PARALLEL_SECTIONS);
case llvm::omp::Directive::OMPD_parallel_sections:
case llvm::omp::Directive::OMPD_sections:
PushContext(beginDir.source, beginDir.v);
break;
case parser::OmpSectionsDirective::Directive::Sections:
PushContext(beginDir.source, OmpDirective::SECTIONS);
default:
break;
}
ClearDataSharingAttributeObjects();
@ -6712,7 +6648,7 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPSectionsConstruct &x) {
}
bool OmpAttributeVisitor::Pre(const parser::OpenMPThreadprivate &x) {
PushContext(x.source, OmpDirective::THREADPRIVATE);
PushContext(x.source, llvm::omp::Directive::OMPD_threadprivate);
const auto &list{std::get<parser::OmpObjectList>(x.t)};
ResolveOmpObjectList(list, Symbol::Flag::OmpThreadprivate);
return false;

View File

@ -1,3 +1,7 @@
set(LLVM_LINK_COMPONENTS
FrontendOpenMP
)
add_flang_tool(f18-parse-demo
f18-parse-demo.cpp
stub-evaluate.cpp

View File

@ -189,6 +189,9 @@ def OMPC_Unknown : Clause<"unknown"> {
let isImplicit = 1;
let isDefault = 1;
}
def OMPC_Link : Clause<"link"> {}
def OMPC_Inbranch : Clause<"inbranch"> {}
def OMPC_Notinbranch : Clause<"notinbranch"> {}
//===----------------------------------------------------------------------===//
// Definition of OpenMP directives
@ -216,6 +219,11 @@ def OMP_For : Directive<"for"> {
OMPC_Reduction, OMPC_Collapse, OMPC_Schedule, OMPC_Ordered, OMPC_NoWait,
OMPC_Linear, OMPC_Allocate, OMPC_Order];
}
def OMP_Do : Directive<"do"> {
let allowedClauses = [OMPC_Private, OMPC_FirstPrivate, OMPC_LastPrivate,
OMPC_Linear, OMPC_Reduction];
let allowedOnceClauses = [OMPC_Schedule, OMPC_Collapse, OMPC_Ordered];
}
def OMP_Sections : Directive<"sections"> {
let allowedClauses = [OMPC_Private, OMPC_LastPrivate, OMPC_FirstPrivate,
OMPC_Reduction, OMPC_NoWait, OMPC_Allocate];
@ -289,6 +297,14 @@ def OMP_TargetParallelFor : Directive<"target parallel for"> {
OMPC_Linear, OMPC_IsDevicePtr, OMPC_Allocator, OMPC_Order,
OMPC_UsesAllocators];
}
def OMP_TargetParallelDo : Directive<"target parallel do"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_NoWait, OMPC_Depend,
OMPC_DefaultMap, OMPC_NumThreads, OMPC_DefaultMap, OMPC_ProcBind,
OMPC_Shared, OMPC_Reduction, OMPC_Collapse, OMPC_Schedule, OMPC_Ordered,
OMPC_Linear, OMPC_IsDevicePtr, OMPC_Allocator, OMPC_Order,
OMPC_UsesAllocators];
}
def OMP_TargetUpdate : Directive<"target update"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_To, OMPC_From, OMPC_NoWait,
OMPC_Depend];
@ -299,6 +315,12 @@ def OMP_ParallelFor : Directive<"parallel for"> {
OMPC_LastPrivate, OMPC_Collapse, OMPC_Schedule, OMPC_Ordered, OMPC_Linear,
OMPC_Allocate, OMPC_Order];
}
def OMP_ParallelDo : Directive<"parallel do"> {
let allowedClauses = [ OMPC_Default, OMPC_Private, OMPC_FirstPrivate,
OMPC_Shared, OMPC_Reduction, OMPC_Copyin, OMPC_LastPrivate, OMPC_Linear];
let allowedOnceClauses = [OMPC_If, OMPC_NumThreads, OMPC_ProcBind,
OMPC_Schedule, OMPC_Ordered, OMPC_Collapse];
}
def OMP_ParallelForSimd : Directive<"parallel for simd"> {
let allowedClauses = [OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
OMPC_Private, OMPC_FirstPrivate, OMPC_Shared, OMPC_Reduction, OMPC_Copyin,
@ -306,6 +328,13 @@ def OMP_ParallelForSimd : Directive<"parallel for simd"> {
OMPC_SimdLen, OMPC_Linear, OMPC_Aligned, OMPC_Ordered, OMPC_Allocate,
OMPC_NonTemporal, OMPC_Order];
}
def OMP_ParallelDoSimd : Directive<"parallel do simd"> {
let allowedClauses = [OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
OMPC_Private, OMPC_FirstPrivate, OMPC_Shared, OMPC_Reduction, OMPC_Copyin,
OMPC_LastPrivate, OMPC_Collapse, OMPC_Schedule, OMPC_SafeLen,
OMPC_SimdLen, OMPC_Linear, OMPC_Aligned, OMPC_Ordered, OMPC_Allocate,
OMPC_NonTemporal, OMPC_Order];
}
def OMP_ParallelMaster : Directive<"parallel master"> {
let allowedClauses = [OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_Private,
OMPC_FirstPrivate, OMPC_Shared, OMPC_Copyin, OMPC_Reduction,
@ -322,6 +351,12 @@ def OMP_ForSimd : Directive<"for simd"> {
OMPC_SimdLen, OMPC_Linear, OMPC_Aligned, OMPC_Ordered, OMPC_Allocate,
OMPC_If, OMPC_NonTemporal, OMPC_Order];
}
def OMP_DoSimd : Directive<"do simd"> {
let allowedClauses = [OMPC_Aligned, OMPC_Private, OMPC_FirstPrivate,
OMPC_LastPrivate, OMPC_Linear, OMPC_Reduction];
let allowedOnceClauses = [OMPC_Schedule, OMPC_Collapse, OMPC_Ordered,
OMPC_SafeLen, OMPC_SimdLen];
}
def OMP_CancellationPoint : Directive<"cancellation point"> {}
def OMP_DeclareReduction : Directive<"declare reduction"> {}
def OMP_DeclareMapper : Directive<"declare mapper"> {
@ -353,6 +388,12 @@ def OMP_DistributeParallelFor : Directive<"distribute parallel for"> {
OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Copyin, OMPC_Schedule,
OMPC_Allocate, OMPC_Order];
}
def OMP_DistributeParallelDo : Directive<"distribute parallel do"> {
let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
OMPC_DistSchedule, OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Copyin, OMPC_Schedule,
OMPC_Allocate, OMPC_Order];
}
def OMP_DistributeParallelForSimd : Directive<"distribute parallel for simd"> {
let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
OMPC_DistSchedule, OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
@ -360,6 +401,13 @@ def OMP_DistributeParallelForSimd : Directive<"distribute parallel for simd"> {
OMPC_Linear, OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_Allocate,
OMPC_NonTemporal, OMPC_Order];
}
def OMP_DistributeParallelDoSimd : Directive<"distribute parallel do simd"> {
let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
OMPC_DistSchedule, OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Copyin, OMPC_Schedule,
OMPC_Linear, OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_Allocate,
OMPC_NonTemporal, OMPC_Order];
}
def OMP_DistributeSimd : Directive<"distribute simd"> {
let allowedClauses = [OMPC_Private, OMPC_FirstPrivate, OMPC_LastPrivate,
OMPC_Collapse, OMPC_DistSchedule, OMPC_Linear, OMPC_Aligned, OMPC_SafeLen,
@ -374,6 +422,14 @@ def OMP_TargetParallelForSimd : Directive<"target parallel for simd"> {
OMPC_Linear, OMPC_SafeLen, OMPC_SimdLen, OMPC_Aligned, OMPC_IsDevicePtr,
OMPC_Allocate, OMPC_NonTemporal, OMPC_Order, OMPC_UsesAllocators];
}
def OMP_TargetParallelDoSimd : Directive<"target parallel do simd"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_NoWait, OMPC_Depend,
OMPC_DefaultMap, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
OMPC_Shared, OMPC_Reduction, OMPC_Collapse, OMPC_Schedule, OMPC_Ordered,
OMPC_Linear, OMPC_SafeLen, OMPC_SimdLen, OMPC_Aligned, OMPC_IsDevicePtr,
OMPC_Allocate, OMPC_NonTemporal, OMPC_Order, OMPC_UsesAllocators];
}
def OMP_TargetSimd : Directive<"target simd"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
OMPC_NoWait, OMPC_Depend, OMPC_DefaultMap, OMPC_FirstPrivate,
@ -401,6 +457,14 @@ def OMP_TeamsDistributeParallelForSimd :
OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_NumTeams, OMPC_ThreadLimit,
OMPC_Allocate, OMPC_NonTemporal, OMPC_Order];
}
def OMP_TeamsDistributeParallelDoSimd :
Directive<"teams distribute parallel do simd"> {
let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
OMPC_DistSchedule, OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Schedule, OMPC_Linear,
OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_NumTeams, OMPC_ThreadLimit,
OMPC_Allocate, OMPC_NonTemporal, OMPC_Order];
}
def OMP_TeamsDistributeParallelFor :
Directive<"teams distribute parallel for"> {
let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
@ -408,6 +472,13 @@ def OMP_TeamsDistributeParallelFor :
OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Schedule, OMPC_NumTeams,
OMPC_ThreadLimit, OMPC_Copyin, OMPC_Allocate, OMPC_Order];
}
def OMP_TeamsDistributeParallelDo :
Directive<"teams distribute parallel do"> {
let allowedClauses = [OMPC_FirstPrivate, OMPC_LastPrivate, OMPC_Collapse,
OMPC_DistSchedule, OMPC_If, OMPC_NumThreads, OMPC_Default, OMPC_ProcBind,
OMPC_Private, OMPC_Shared, OMPC_Reduction, OMPC_Schedule, OMPC_NumTeams,
OMPC_ThreadLimit, OMPC_Copyin, OMPC_Allocate, OMPC_Order];
}
def OMP_TargetTeams : Directive<"target teams"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
OMPC_NoWait, OMPC_Depend, OMPC_DefaultMap, OMPC_FirstPrivate,
@ -430,6 +501,15 @@ def OMP_TargetTeamsDistributeParallelFor :
OMPC_DistSchedule, OMPC_NumThreads, OMPC_ProcBind, OMPC_Schedule,
OMPC_Allocate, OMPC_Order, OMPC_UsesAllocators];
}
def OMP_TargetTeamsDistributeParallelDo :
Directive<"target teams distribute parallel do"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
OMPC_NoWait, OMPC_Depend, OMPC_DefaultMap, OMPC_FirstPrivate,
OMPC_IsDevicePtr, OMPC_Default, OMPC_Shared, OMPC_Reduction,
OMPC_NumTeams, OMPC_ThreadLimit, OMPC_LastPrivate, OMPC_Collapse,
OMPC_DistSchedule, OMPC_NumThreads, OMPC_ProcBind, OMPC_Schedule,
OMPC_Allocate, OMPC_Order, OMPC_UsesAllocators];
}
def OMP_TargetTeamsDistributeParallelForSimd :
Directive<"target teams distribute parallel for simd"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
@ -440,6 +520,16 @@ def OMP_TargetTeamsDistributeParallelForSimd :
OMPC_Linear, OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_Allocate,
OMPC_NonTemporal, OMPC_Order, OMPC_UsesAllocators];
}
def OMP_TargetTeamsDistributeParallelDoSimd :
Directive<"target teams distribute parallel do simd"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
OMPC_NoWait, OMPC_Depend, OMPC_DefaultMap, OMPC_FirstPrivate,
OMPC_IsDevicePtr, OMPC_Default, OMPC_Shared, OMPC_Reduction,
OMPC_NumTeams, OMPC_ThreadLimit, OMPC_LastPrivate, OMPC_Collapse,
OMPC_DistSchedule, OMPC_NumThreads, OMPC_ProcBind, OMPC_Schedule,
OMPC_Linear, OMPC_Aligned, OMPC_SafeLen, OMPC_SimdLen, OMPC_Allocate,
OMPC_NonTemporal, OMPC_Order, OMPC_UsesAllocators];
}
def OMP_TargetTeamsDistributeSimd :
Directive<"target teams distribute simd"> {
let allowedClauses = [OMPC_If, OMPC_Device, OMPC_Map, OMPC_Private,
@ -494,6 +584,13 @@ def OMP_Scan : Directive<"scan"> {
}
def OMP_BeginDeclareVariant : Directive<"begin declare variant"> {}
def OMP_EndDeclareVariant : Directive<"end declare variant"> {}
def OMP_ParallelWorkshare : Directive<"parallel workshare"> {}
def OMP_Workshare : Directive<"workshare"> {}
def OMP_EndDo : Directive<"end do"> {}
def OMP_EndDoSimd : Directive<"end do simd"> {}
def OMP_EndSections : Directive<"end sections"> {}
def OMP_EndSingle : Directive<"end single"> {}
def OMP_EndWorkshare : Directive<"end workshare"> {}
def OMP_Unknown : Directive<"unknown"> {
let isDefault = 1;
}