diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-10-10 20:13:02 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-10-10 20:13:02 +0000 |
commit | e30a155e75ebed7fdb03d23c3cae1385c9078f12 (patch) | |
tree | 1664424dcd954107b18e0d85733aff067c4bb0cf /include/clang | |
parent | 07ca3aee78a50b49ccb758a9b16917ae166622d6 (diff) | |
download | clang-e30a155e75ebed7fdb03d23c3cae1385c9078f12.tar.gz |
[OPENMP50]Support for 'master taskloop' directive.
Added full support for master taskloop directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374437 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/RecursiveASTVisitor.h | 3 | ||||
-rw-r--r-- | include/clang/AST/StmtOpenMP.h | 69 | ||||
-rw-r--r-- | include/clang/Basic/OpenMPKinds.def | 24 | ||||
-rw-r--r-- | include/clang/Basic/StmtNodes.td | 1 | ||||
-rw-r--r-- | include/clang/Sema/Sema.h | 5 | ||||
-rw-r--r-- | include/clang/Serialization/ASTBitCodes.h | 1 |
6 files changed, 103 insertions, 0 deletions
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index 426c256b6a..20b298093c 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -2788,6 +2788,9 @@ DEF_TRAVERSE_STMT(OMPTaskLoopDirective, DEF_TRAVERSE_STMT(OMPTaskLoopSimdDirective, { TRY_TO(TraverseOMPExecutableDirective(S)); }) +DEF_TRAVERSE_STMT(OMPMasterTaskLoopDirective, + { TRY_TO(TraverseOMPExecutableDirective(S)); }) + DEF_TRAVERSE_STMT(OMPDistributeDirective, { TRY_TO(TraverseOMPExecutableDirective(S)); }) diff --git a/include/clang/AST/StmtOpenMP.h b/include/clang/AST/StmtOpenMP.h index 9d58c1d793..90eb541a9c 100644 --- a/include/clang/AST/StmtOpenMP.h +++ b/include/clang/AST/StmtOpenMP.h @@ -1164,6 +1164,7 @@ public: T->getStmtClass() == OMPParallelForSimdDirectiveClass || T->getStmtClass() == OMPTaskLoopDirectiveClass || T->getStmtClass() == OMPTaskLoopSimdDirectiveClass || + T->getStmtClass() == OMPMasterTaskLoopDirectiveClass || T->getStmtClass() == OMPDistributeDirectiveClass || T->getStmtClass() == OMPTargetParallelForDirectiveClass || T->getStmtClass() == OMPDistributeParallelForDirectiveClass || @@ -3119,6 +3120,74 @@ public: } }; +/// This represents '#pragma omp master taskloop' directive. +/// +/// \code +/// #pragma omp master taskloop private(a,b) grainsize(val) num_tasks(num) +/// \endcode +/// In this example directive '#pragma omp master taskloop' has clauses +/// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val' +/// and 'num_tasks' with expression 'num'. +/// +class OMPMasterTaskLoopDirective : public OMPLoopDirective { + friend class ASTStmtReader; + /// Build directive with the given start and end location. + /// + /// \param StartLoc Starting location of the directive kind. + /// \param EndLoc Ending location of the directive. + /// \param CollapsedNum Number of collapsed nested loops. + /// \param NumClauses Number of clauses. + /// + OMPMasterTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc, + unsigned CollapsedNum, unsigned NumClauses) + : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass, + OMPD_master_taskloop, StartLoc, EndLoc, CollapsedNum, + NumClauses) {} + + /// Build an empty directive. + /// + /// \param CollapsedNum Number of collapsed nested loops. + /// \param NumClauses Number of clauses. + /// + explicit OMPMasterTaskLoopDirective(unsigned CollapsedNum, + unsigned NumClauses) + : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass, + OMPD_master_taskloop, SourceLocation(), + SourceLocation(), CollapsedNum, NumClauses) {} + +public: + /// Creates directive with a list of \a Clauses. + /// + /// \param C AST context. + /// \param StartLoc Starting location of the directive kind. + /// \param EndLoc Ending Location of the directive. + /// \param CollapsedNum Number of collapsed loops. + /// \param Clauses List of clauses. + /// \param AssociatedStmt Statement, associated with the directive. + /// \param Exprs Helper expressions for CodeGen. + /// + static OMPMasterTaskLoopDirective * + Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, + unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, + Stmt *AssociatedStmt, const HelperExprs &Exprs); + + /// Creates an empty directive with the place + /// for \a NumClauses clauses. + /// + /// \param C AST context. + /// \param CollapsedNum Number of collapsed nested loops. + /// \param NumClauses Number of clauses. + /// + static OMPMasterTaskLoopDirective *CreateEmpty(const ASTContext &C, + unsigned NumClauses, + unsigned CollapsedNum, + EmptyShell); + + static bool classof(const Stmt *T) { + return T->getStmtClass() == OMPMasterTaskLoopDirectiveClass; + } +}; + /// This represents '#pragma omp distribute' directive. /// /// \code diff --git a/include/clang/Basic/OpenMPKinds.def b/include/clang/Basic/OpenMPKinds.def index e8a40de3e3..6f9067d698 100644 --- a/include/clang/Basic/OpenMPKinds.def +++ b/include/clang/Basic/OpenMPKinds.def @@ -92,6 +92,9 @@ #ifndef OPENMP_TASKLOOP_SIMD_CLAUSE # define OPENMP_TASKLOOP_SIMD_CLAUSE(Name) #endif +#ifndef OPENMP_MASTER_TASKLOOP_CLAUSE +# define OPENMP_MASTER_TASKLOOP_CLAUSE(Name) +#endif #ifndef OPENMP_CRITICAL_CLAUSE # define OPENMP_CRITICAL_CLAUSE(Name) #endif @@ -258,6 +261,7 @@ OPENMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for_simd, "target teams di OPENMP_DIRECTIVE_EXT(target_teams_distribute_simd, "target teams distribute simd") OPENMP_DIRECTIVE(allocate) OPENMP_DIRECTIVE_EXT(declare_variant, "declare variant") +OPENMP_DIRECTIVE_EXT(master_taskloop, "master taskloop") // OpenMP clauses. OPENMP_CLAUSE(allocator, OMPAllocatorClause) @@ -666,6 +670,25 @@ OPENMP_TASKLOOP_SIMD_CLAUSE(reduction) OPENMP_TASKLOOP_SIMD_CLAUSE(in_reduction) OPENMP_TASKLOOP_SIMD_CLAUSE(allocate) +// Clauses allowed for OpenMP directive 'master taskloop'. +OPENMP_MASTER_TASKLOOP_CLAUSE(if) +OPENMP_MASTER_TASKLOOP_CLAUSE(shared) +OPENMP_MASTER_TASKLOOP_CLAUSE(private) +OPENMP_MASTER_TASKLOOP_CLAUSE(firstprivate) +OPENMP_MASTER_TASKLOOP_CLAUSE(lastprivate) +OPENMP_MASTER_TASKLOOP_CLAUSE(default) +OPENMP_MASTER_TASKLOOP_CLAUSE(collapse) +OPENMP_MASTER_TASKLOOP_CLAUSE(final) +OPENMP_MASTER_TASKLOOP_CLAUSE(untied) +OPENMP_MASTER_TASKLOOP_CLAUSE(mergeable) +OPENMP_MASTER_TASKLOOP_CLAUSE(priority) +OPENMP_MASTER_TASKLOOP_CLAUSE(grainsize) +OPENMP_MASTER_TASKLOOP_CLAUSE(nogroup) +OPENMP_MASTER_TASKLOOP_CLAUSE(num_tasks) +OPENMP_MASTER_TASKLOOP_CLAUSE(reduction) +OPENMP_MASTER_TASKLOOP_CLAUSE(in_reduction) +OPENMP_MASTER_TASKLOOP_CLAUSE(allocate) + // Clauses allowed for OpenMP directive 'critical'. OPENMP_CRITICAL_CLAUSE(hint) @@ -978,6 +1001,7 @@ OPENMP_MATCH_KIND(implementation) #undef OPENMP_ALLOCATE_CLAUSE #undef OPENMP_DECLARE_MAPPER_CLAUSE #undef OPENMP_TASKGROUP_CLAUSE +#undef OPENMP_MASTER_TASKLOOP_CLAUSE #undef OPENMP_TASKLOOP_SIMD_CLAUSE #undef OPENMP_TASKLOOP_CLAUSE #undef OPENMP_LINEAR_KIND diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td index be364de1a7..eb5af6f415 100644 --- a/include/clang/Basic/StmtNodes.td +++ b/include/clang/Basic/StmtNodes.td @@ -242,6 +242,7 @@ def OMPCancellationPointDirective : DStmt<OMPExecutableDirective>; def OMPCancelDirective : DStmt<OMPExecutableDirective>; def OMPTaskLoopDirective : DStmt<OMPLoopDirective>; def OMPTaskLoopSimdDirective : DStmt<OMPLoopDirective>; +def OMPMasterTaskLoopDirective : DStmt<OMPLoopDirective>; def OMPDistributeDirective : DStmt<OMPLoopDirective>; def OMPDistributeParallelForDirective : DStmt<OMPLoopDirective>; def OMPDistributeParallelForSimdDirective : DStmt<OMPLoopDirective>; diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index de7211437e..0b8270dc23 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -9465,6 +9465,11 @@ public: StmtResult ActOnOpenMPTaskLoopSimdDirective( ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); + /// Called on well-formed '\#pragma omp master taskloop' after parsing of the + /// associated statement. + StmtResult ActOnOpenMPMasterTaskLoopDirective( + ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, + SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); /// Called on well-formed '\#pragma omp distribute' after parsing /// of the associated statement. StmtResult diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index be0bbe1a8c..0a535f9f0e 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -1961,6 +1961,7 @@ namespace serialization { STMT_OMP_CANCEL_DIRECTIVE, STMT_OMP_TASKLOOP_DIRECTIVE, STMT_OMP_TASKLOOP_SIMD_DIRECTIVE, + STMT_OMP_MASTER_TASKLOOP_DIRECTIVE, STMT_OMP_DISTRIBUTE_DIRECTIVE, STMT_OMP_TARGET_UPDATE_DIRECTIVE, STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE, |