diff options
Diffstat (limited to 'clang/include')
| -rw-r--r-- | clang/include/clang-c/Index.h | 6 | ||||
| -rw-r--r-- | clang/include/clang/AST/RecursiveASTVisitor.h | 3 | ||||
| -rw-r--r-- | clang/include/clang/AST/StmtOpenMP.h | 73 | ||||
| -rw-r--r-- | clang/include/clang/Basic/OpenMPKinds.def | 28 | ||||
| -rw-r--r-- | clang/include/clang/Basic/StmtNodes.td | 1 | ||||
| -rw-r--r-- | clang/include/clang/Sema/Sema.h | 6 | ||||
| -rw-r--r-- | clang/include/clang/Serialization/ASTBitCodes.h | 1 |
7 files changed, 117 insertions, 1 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index e6b1cd7d99b..47998859f67 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -2362,7 +2362,11 @@ enum CXCursorKind { */ CXCursor_OMPTargetTeamsDistributeDirective = 276, - CXCursor_LastStmt = CXCursor_OMPTargetTeamsDistributeDirective, + /** \brief OpenMP target teams distribute parallel for directive. + */ + CXCursor_OMPTargetTeamsDistributeParallelForDirective = 277, + + CXCursor_LastStmt = CXCursor_OMPTargetTeamsDistributeParallelForDirective, /** * \brief Cursor that represents the translation unit itself. diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index f02006d97c8..c0b0400cb88 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -2666,6 +2666,9 @@ DEF_TRAVERSE_STMT(OMPTargetTeamsDirective, DEF_TRAVERSE_STMT(OMPTargetTeamsDistributeDirective, { TRY_TO(TraverseOMPExecutableDirective(S)); }) +DEF_TRAVERSE_STMT(OMPTargetTeamsDistributeParallelForDirective, + { TRY_TO(TraverseOMPExecutableDirective(S)); }) + // OpenMP clauses. template <typename Derived> bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) { diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h index 84e522bc6df..80300dae80d 100644 --- a/clang/include/clang/AST/StmtOpenMP.h +++ b/clang/include/clang/AST/StmtOpenMP.h @@ -3565,6 +3565,79 @@ public: } }; +/// This represents '#pragma omp target teams distribute parallel for' combined +/// directive. +/// +/// \code +/// #pragma omp target teams distribute parallel for private(x) +/// \endcode +/// In this example directive '#pragma omp target teams distribute parallel +/// for' has clause 'private' with the variables 'x' +/// +class OMPTargetTeamsDistributeParallelForDirective final + : 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. + /// + OMPTargetTeamsDistributeParallelForDirective(SourceLocation StartLoc, + SourceLocation EndLoc, + unsigned CollapsedNum, + unsigned NumClauses) + : OMPLoopDirective(this, + OMPTargetTeamsDistributeParallelForDirectiveClass, + OMPD_target_teams_distribute_parallel_for, StartLoc, + EndLoc, CollapsedNum, NumClauses) {} + + /// Build an empty directive. + /// + /// \param CollapsedNum Number of collapsed nested loops. + /// \param NumClauses Number of clauses. + /// + explicit OMPTargetTeamsDistributeParallelForDirective(unsigned CollapsedNum, + unsigned NumClauses) + : OMPLoopDirective( + this, OMPTargetTeamsDistributeParallelForDirectiveClass, + OMPD_target_teams_distribute_parallel_for, 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 OMPTargetTeamsDistributeParallelForDirective * + 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 OMPTargetTeamsDistributeParallelForDirective * + CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, + EmptyShell); + + static bool classof(const Stmt *T) { + return T->getStmtClass() == + OMPTargetTeamsDistributeParallelForDirectiveClass; + } +}; + } // end namespace clang #endif diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def index 13832911db4..808e0d2bb0c 100644 --- a/clang/include/clang/Basic/OpenMPKinds.def +++ b/clang/include/clang/Basic/OpenMPKinds.def @@ -159,6 +159,9 @@ #ifndef OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE #define OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(Name) #endif +#ifndef OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE +#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) +#endif // OpenMP directives. OPENMP_DIRECTIVE(threadprivate) @@ -210,6 +213,7 @@ OPENMP_DIRECTIVE_EXT(teams_distribute_parallel_for_simd, "teams distribute paral OPENMP_DIRECTIVE_EXT(teams_distribute_parallel_for, "teams distribute parallel for") OPENMP_DIRECTIVE_EXT(target_teams, "target teams") OPENMP_DIRECTIVE_EXT(target_teams_distribute, "target teams distribute") +OPENMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for, "target teams distribute parallel for") // OpenMP clauses. OPENMP_CLAUSE(if, OMPIfClause) @@ -766,6 +770,29 @@ OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(lastprivate) OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(collapse) OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(dist_schedule) +// Clauses allowed for OpenMP directive 'target teams distribute parallel for'. +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(if) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(device) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(map) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(private) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(nowait) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(depend) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(defaultmap) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(firstprivate) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(is_device_ptr) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(default) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(shared) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(reduction) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(num_teams) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(thread_limit) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(lastprivate) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(collapse) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(dist_schedule) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(num_threads) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(proc_bind) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(schedule) +OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(linear) + #undef OPENMP_TASKLOOP_SIMD_CLAUSE #undef OPENMP_TASKLOOP_CLAUSE #undef OPENMP_LINEAR_KIND @@ -815,3 +842,4 @@ OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(dist_schedule) #undef OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE #undef OPENMP_TARGET_TEAMS_CLAUSE #undef OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE +#undef OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE diff --git a/clang/include/clang/Basic/StmtNodes.td b/clang/include/clang/Basic/StmtNodes.td index 98308f1439d..d8eed553d86 100644 --- a/clang/include/clang/Basic/StmtNodes.td +++ b/clang/include/clang/Basic/StmtNodes.td @@ -242,3 +242,4 @@ def OMPTeamsDistributeParallelForSimdDirective : DStmt<OMPLoopDirective>; def OMPTeamsDistributeParallelForDirective : DStmt<OMPLoopDirective>; def OMPTargetTeamsDirective : DStmt<OMPExecutableDirective>; def OMPTargetTeamsDistributeDirective : DStmt<OMPLoopDirective>; +def OMPTargetTeamsDistributeParallelForDirective : DStmt<OMPLoopDirective>; diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 10a55539960..d012ebdab2f 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -8505,6 +8505,12 @@ public: ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA); + /// Called on well-formed '\#pragma omp target teams distribute parallel for' + /// after parsing of the associated statement. + StmtResult ActOnOpenMPTargetTeamsDistributeParallelForDirective( + ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, + SourceLocation EndLoc, + llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA); /// Checks correctness of linear modifiers. bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind, diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h index 441e034244f..861fe64096a 100644 --- a/clang/include/clang/Serialization/ASTBitCodes.h +++ b/clang/include/clang/Serialization/ASTBitCodes.h @@ -1515,6 +1515,7 @@ namespace clang { STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE, STMT_OMP_TARGET_TEAMS_DIRECTIVE, STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE, + STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE, EXPR_OMP_ARRAY_SECTION, // ARC |

