aboutsummaryrefslogtreecommitdiff
path: root/clang/include/clang/AST/StmtOpenMP.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include/clang/AST/StmtOpenMP.h')
-rw-r--r--clang/include/clang/AST/StmtOpenMP.h343
1 files changed, 322 insertions, 21 deletions
diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h
index 65f0afece224..bd87eafc9034 100644
--- a/clang/include/clang/AST/StmtOpenMP.h
+++ b/clang/include/clang/AST/StmtOpenMP.h
@@ -356,6 +356,9 @@ public:
///
class OMPParallelDirective : public OMPExecutableDirective {
friend class ASTStmtReader;
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
/// true if the construct has inner cancel directive.
bool HasCancel;
@@ -381,6 +384,9 @@ class OMPParallelDirective : public OMPExecutableDirective {
SourceLocation(), NumClauses, 1),
HasCancel(false) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+
/// Set cancel state.
void setHasCancel(bool Has) { HasCancel = Has; }
@@ -392,11 +398,14 @@ public:
/// \param EndLoc Ending Location of the directive.
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement associated with the directive.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
/// \param HasCancel true if this directive has inner cancel directive.
///
static OMPParallelDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
- ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel);
+ ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
+ bool HasCancel);
/// Creates an empty directive with the place for \a N clauses.
///
@@ -406,6 +415,10 @@ public:
static OMPParallelDirective *CreateEmpty(const ASTContext &C,
unsigned NumClauses, EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
/// Return true if current directive has inner cancel directive.
bool hasCancel() const { return HasCancel; }
@@ -1258,7 +1271,9 @@ public:
///
class OMPForDirective : public OMPLoopDirective {
friend class ASTStmtReader;
-
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
/// true if current directive has inner cancel directive.
bool HasCancel;
@@ -1286,6 +1301,9 @@ class OMPForDirective : public OMPLoopDirective {
NumClauses),
HasCancel(false) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+
/// Set cancel state.
void setHasCancel(bool Has) { HasCancel = Has; }
@@ -1299,13 +1317,15 @@ public:
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
/// \param Exprs Helper expressions for CodeGen.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
/// \param HasCancel true if current directive has inner cancel directive.
///
static OMPForDirective *Create(const ASTContext &C, SourceLocation StartLoc,
SourceLocation EndLoc, unsigned CollapsedNum,
ArrayRef<OMPClause *> Clauses,
Stmt *AssociatedStmt, const HelperExprs &Exprs,
- bool HasCancel);
+ Expr *TaskRedRef, bool HasCancel);
/// Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -1317,6 +1337,10 @@ public:
static OMPForDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
unsigned CollapsedNum, EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
/// Return true if current directive has inner cancel directive.
bool hasCancel() const { return HasCancel; }
@@ -1403,6 +1427,9 @@ public:
class OMPSectionsDirective : public OMPExecutableDirective {
friend class ASTStmtReader;
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
/// true if current directive has inner cancel directive.
bool HasCancel;
@@ -1429,6 +1456,9 @@ class OMPSectionsDirective : public OMPExecutableDirective {
SourceLocation(), NumClauses, 1),
HasCancel(false) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+
/// Set cancel state.
void setHasCancel(bool Has) { HasCancel = Has; }
@@ -1440,11 +1470,14 @@ public:
/// \param EndLoc Ending Location of the directive.
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
/// \param HasCancel true if current directive has inner directive.
///
static OMPSectionsDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
- ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel);
+ ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
+ bool HasCancel);
/// Creates an empty directive with the place for \a NumClauses
/// clauses.
@@ -1455,6 +1488,10 @@ public:
static OMPSectionsDirective *CreateEmpty(const ASTContext &C,
unsigned NumClauses, EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
/// Return true if current directive has inner cancel directive.
bool hasCancel() const { return HasCancel; }
@@ -1715,6 +1752,9 @@ public:
class OMPParallelForDirective : public OMPLoopDirective {
friend class ASTStmtReader;
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
/// true if current region has inner cancel directive.
bool HasCancel;
@@ -1743,6 +1783,9 @@ class OMPParallelForDirective : public OMPLoopDirective {
SourceLocation(), CollapsedNum, NumClauses),
HasCancel(false) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+
/// Set cancel state.
void setHasCancel(bool Has) { HasCancel = Has; }
@@ -1756,12 +1799,15 @@ public:
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
/// \param Exprs Helper expressions for CodeGen.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
/// \param HasCancel true if current directive has inner cancel directive.
///
static OMPParallelForDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs, Expr *TaskRedRef,
+ bool HasCancel);
/// Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -1775,6 +1821,10 @@ public:
unsigned CollapsedNum,
EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
/// Return true if current directive has inner cancel directive.
bool hasCancel() const { return HasCancel; }
@@ -1863,6 +1913,10 @@ public:
class OMPParallelMasterDirective : public OMPExecutableDirective {
friend class ASTStmtReader;
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
+
OMPParallelMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc,
unsigned NumClauses)
: OMPExecutableDirective(this, OMPParallelMasterDirectiveClass,
@@ -1875,6 +1929,9 @@ class OMPParallelMasterDirective : public OMPExecutableDirective {
SourceLocation(), SourceLocation(), NumClauses,
1) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+
public:
/// Creates directive with a list of \a Clauses.
///
@@ -1883,10 +1940,12 @@ public:
/// \param EndLoc Ending Location of the directive.
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
///
static OMPParallelMasterDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
- ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
+ ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef);
/// Creates an empty directive with the place for \a NumClauses
/// clauses.
@@ -1897,6 +1956,10 @@ public:
static OMPParallelMasterDirective *
CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
static bool classof(const Stmt *T) {
return T->getStmtClass() == OMPParallelMasterDirectiveClass;
}
@@ -1914,6 +1977,9 @@ public:
class OMPParallelSectionsDirective : public OMPExecutableDirective {
friend class ASTStmtReader;
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
/// true if current directive has inner cancel directive.
bool HasCancel;
@@ -1941,6 +2007,9 @@ class OMPParallelSectionsDirective : public OMPExecutableDirective {
1),
HasCancel(false) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+
/// Set cancel state.
void setHasCancel(bool Has) { HasCancel = Has; }
@@ -1952,11 +2021,14 @@ public:
/// \param EndLoc Ending Location of the directive.
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
/// \param HasCancel true if current directive has inner cancel directive.
///
static OMPParallelSectionsDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
- ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel);
+ ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
+ bool HasCancel);
/// Creates an empty directive with the place for \a NumClauses
/// clauses.
@@ -1967,6 +2039,10 @@ public:
static OMPParallelSectionsDirective *
CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
/// Return true if current directive has inner cancel directive.
bool hasCancel() const { return HasCancel; }
@@ -2314,6 +2390,64 @@ public:
}
};
+/// This represents '#pragma omp depobj' directive.
+///
+/// \code
+/// #pragma omp depobj(a) depend(in:x,y)
+/// \endcode
+/// In this example directive '#pragma omp depobj' initializes a depobj object
+/// 'a' with dependence type 'in' and a list with 'x' and 'y' locators.
+class OMPDepobjDirective final : public OMPExecutableDirective {
+ 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 NumClauses Number of clauses.
+ ///
+ OMPDepobjDirective(SourceLocation StartLoc, SourceLocation EndLoc,
+ unsigned NumClauses)
+ : OMPExecutableDirective(this, OMPDepobjDirectiveClass,
+ llvm::omp::OMPD_depobj, StartLoc, EndLoc,
+ NumClauses, 0) {}
+
+ /// Build an empty directive.
+ ///
+ /// \param NumClauses Number of clauses.
+ ///
+ explicit OMPDepobjDirective(unsigned NumClauses)
+ : OMPExecutableDirective(this, OMPDepobjDirectiveClass,
+ llvm::omp::OMPD_depobj, SourceLocation(),
+ SourceLocation(), NumClauses, 0) {}
+
+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 Clauses List of clauses.
+ ///
+ static OMPDepobjDirective *Create(const ASTContext &C,
+ SourceLocation StartLoc,
+ SourceLocation EndLoc,
+ ArrayRef<OMPClause *> Clauses);
+
+ /// Creates an empty directive with the place for \a NumClauses
+ /// clauses.
+ ///
+ /// \param C AST context.
+ /// \param NumClauses Number of clauses.
+ ///
+ static OMPDepobjDirective *CreateEmpty(const ASTContext &C,
+ unsigned NumClauses, EmptyShell);
+
+ static bool classof(const Stmt *T) {
+ return T->getStmtClass() == OMPDepobjDirectiveClass;
+ }
+};
+
/// This represents '#pragma omp ordered' directive.
///
/// \code
@@ -2747,6 +2881,12 @@ public:
///
class OMPTargetParallelDirective : public OMPExecutableDirective {
friend class ASTStmtReader;
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
+ /// true if the construct has inner cancel directive.
+ bool HasCancel = false;
+
/// Build directive with the given start and end location.
///
/// \param StartLoc Starting location of the directive kind.
@@ -2769,6 +2909,11 @@ class OMPTargetParallelDirective : public OMPExecutableDirective {
SourceLocation(), SourceLocation(), NumClauses,
/*NumChildren=*/1) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+ /// Set cancel state.
+ void setHasCancel(bool Has) { HasCancel = Has; }
+
public:
/// Creates directive with a list of \a Clauses.
///
@@ -2777,10 +2922,14 @@ public:
/// \param EndLoc Ending Location of the directive.
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
+ /// \param HasCancel true if this directive has inner cancel directive.
///
static OMPTargetParallelDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
- ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
+ ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
+ bool HasCancel);
/// Creates an empty directive with the place for \a NumClauses
/// clauses.
@@ -2791,6 +2940,13 @@ public:
static OMPTargetParallelDirective *
CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
+ /// Return true if current directive has inner cancel directive.
+ bool hasCancel() const { return HasCancel; }
+
static bool classof(const Stmt *T) {
return T->getStmtClass() == OMPTargetParallelDirectiveClass;
}
@@ -2808,6 +2964,9 @@ public:
class OMPTargetParallelForDirective : public OMPLoopDirective {
friend class ASTStmtReader;
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
/// true if current region has inner cancel directive.
bool HasCancel;
@@ -2837,6 +2996,9 @@ class OMPTargetParallelForDirective : public OMPLoopDirective {
SourceLocation(), CollapsedNum, NumClauses),
HasCancel(false) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+
/// Set cancel state.
void setHasCancel(bool Has) { HasCancel = Has; }
@@ -2850,12 +3012,15 @@ public:
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
/// \param Exprs Helper expressions for CodeGen.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
/// \param HasCancel true if current directive has inner cancel directive.
///
static OMPTargetParallelForDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs, Expr *TaskRedRef,
+ bool HasCancel);
/// Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -2869,6 +3034,10 @@ public:
unsigned CollapsedNum,
EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
/// Return true if current directive has inner cancel directive.
bool hasCancel() const { return HasCancel; }
@@ -3070,6 +3239,9 @@ public:
///
class OMPTaskLoopDirective : public OMPLoopDirective {
friend class ASTStmtReader;
+ /// true if the construct has inner cancel directive.
+ bool HasCancel;
+
/// Build directive with the given start and end location.
///
/// \param StartLoc Starting location of the directive kind.
@@ -3081,7 +3253,8 @@ class OMPTaskLoopDirective : public OMPLoopDirective {
unsigned CollapsedNum, unsigned NumClauses)
: OMPLoopDirective(this, OMPTaskLoopDirectiveClass,
llvm::omp::OMPD_taskloop, StartLoc, EndLoc,
- CollapsedNum, NumClauses) {}
+ CollapsedNum, NumClauses),
+ HasCancel(false) {}
/// Build an empty directive.
///
@@ -3091,7 +3264,11 @@ class OMPTaskLoopDirective : public OMPLoopDirective {
explicit OMPTaskLoopDirective(unsigned CollapsedNum, unsigned NumClauses)
: OMPLoopDirective(this, OMPTaskLoopDirectiveClass,
llvm::omp::OMPD_taskloop, SourceLocation(),
- SourceLocation(), CollapsedNum, NumClauses) {}
+ SourceLocation(), CollapsedNum, NumClauses),
+ HasCancel(false) {}
+
+ /// Set cancel state.
+ void setHasCancel(bool Has) { HasCancel = Has; }
public:
/// Creates directive with a list of \a Clauses.
@@ -3103,11 +3280,12 @@ public:
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
/// \param Exprs Helper expressions for CodeGen.
+ /// \param HasCancel true if this directive has inner cancel directive.
///
static OMPTaskLoopDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, const HelperExprs &Exprs);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
/// Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -3120,6 +3298,9 @@ public:
unsigned NumClauses,
unsigned CollapsedNum, EmptyShell);
+ /// Return true if current directive has inner cancel directive.
+ bool hasCancel() const { return HasCancel; }
+
static bool classof(const Stmt *T) {
return T->getStmtClass() == OMPTaskLoopDirectiveClass;
}
@@ -3203,6 +3384,9 @@ public:
///
class OMPMasterTaskLoopDirective : public OMPLoopDirective {
friend class ASTStmtReader;
+ /// true if the construct has inner cancel directive.
+ bool HasCancel;
+
/// Build directive with the given start and end location.
///
/// \param StartLoc Starting location of the directive kind.
@@ -3214,7 +3398,8 @@ class OMPMasterTaskLoopDirective : public OMPLoopDirective {
unsigned CollapsedNum, unsigned NumClauses)
: OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass,
llvm::omp::OMPD_master_taskloop, StartLoc, EndLoc,
- CollapsedNum, NumClauses) {}
+ CollapsedNum, NumClauses),
+ HasCancel(false) {}
/// Build an empty directive.
///
@@ -3225,7 +3410,11 @@ class OMPMasterTaskLoopDirective : public OMPLoopDirective {
unsigned NumClauses)
: OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass,
llvm::omp::OMPD_master_taskloop, SourceLocation(),
- SourceLocation(), CollapsedNum, NumClauses) {}
+ SourceLocation(), CollapsedNum, NumClauses),
+ HasCancel(false) {}
+
+ /// Set cancel state.
+ void setHasCancel(bool Has) { HasCancel = Has; }
public:
/// Creates directive with a list of \a Clauses.
@@ -3237,11 +3426,12 @@ public:
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
/// \param Exprs Helper expressions for CodeGen.
+ /// \param HasCancel true if this directive has inner cancel directive.
///
static OMPMasterTaskLoopDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, const HelperExprs &Exprs);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
/// Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -3255,6 +3445,9 @@ public:
unsigned CollapsedNum,
EmptyShell);
+ /// Return true if current directive has inner cancel directive.
+ bool hasCancel() const { return HasCancel; }
+
static bool classof(const Stmt *T) {
return T->getStmtClass() == OMPMasterTaskLoopDirectiveClass;
}
@@ -3339,6 +3532,9 @@ public:
///
class OMPParallelMasterTaskLoopDirective : public OMPLoopDirective {
friend class ASTStmtReader;
+ /// true if the construct has inner cancel directive.
+ bool HasCancel;
+
/// Build directive with the given start and end location.
///
/// \param StartLoc Starting location of the directive kind.
@@ -3351,7 +3547,8 @@ class OMPParallelMasterTaskLoopDirective : public OMPLoopDirective {
unsigned CollapsedNum, unsigned NumClauses)
: OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass,
llvm::omp::OMPD_parallel_master_taskloop, StartLoc,
- EndLoc, CollapsedNum, NumClauses) {}
+ EndLoc, CollapsedNum, NumClauses),
+ HasCancel(false) {}
/// Build an empty directive.
///
@@ -3363,7 +3560,11 @@ class OMPParallelMasterTaskLoopDirective : public OMPLoopDirective {
: OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass,
llvm::omp::OMPD_parallel_master_taskloop,
SourceLocation(), SourceLocation(), CollapsedNum,
- NumClauses) {}
+ NumClauses),
+ HasCancel(false) {}
+
+ /// Set cancel state.
+ void setHasCancel(bool Has) { HasCancel = Has; }
public:
/// Creates directive with a list of \a Clauses.
@@ -3375,11 +3576,12 @@ public:
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
/// \param Exprs Helper expressions for CodeGen.
+ /// \param HasCancel true if this directive has inner cancel directive.
///
static OMPParallelMasterTaskLoopDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, const HelperExprs &Exprs);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
/// Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -3393,6 +3595,9 @@ public:
unsigned CollapsedNum,
EmptyShell);
+ /// Return true if current directive has inner cancel directive.
+ bool hasCancel() const { return HasCancel; }
+
static bool classof(const Stmt *T) {
return T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass;
}
@@ -3605,6 +3810,9 @@ public:
///
class OMPDistributeParallelForDirective : public OMPLoopDirective {
friend class ASTStmtReader;
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
/// true if the construct has inner cancel directive.
bool HasCancel = false;
@@ -3636,6 +3844,9 @@ class OMPDistributeParallelForDirective : public OMPLoopDirective {
NumClauses),
HasCancel(false) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+
/// Set cancel state.
void setHasCancel(bool Has) { HasCancel = Has; }
@@ -3649,12 +3860,15 @@ public:
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
/// \param Exprs Helper expressions for CodeGen.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
/// \param HasCancel true if this directive has inner cancel directive.
///
static OMPDistributeParallelForDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs, Expr *TaskRedRef,
+ bool HasCancel);
/// Creates an empty directive with the place
/// for \a NumClauses clauses.
@@ -3668,6 +3882,10 @@ public:
unsigned CollapsedNum,
EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
/// Return true if current directive has inner cancel directive.
bool hasCancel() const { return HasCancel; }
@@ -4170,6 +4388,9 @@ public:
///
class OMPTeamsDistributeParallelForDirective final : public OMPLoopDirective {
friend class ASTStmtReader;
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
/// true if the construct has inner cancel directive.
bool HasCancel = false;
@@ -4202,6 +4423,9 @@ class OMPTeamsDistributeParallelForDirective final : public OMPLoopDirective {
NumClauses),
HasCancel(false) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+
/// Set cancel state.
void setHasCancel(bool Has) { HasCancel = Has; }
@@ -4215,12 +4439,15 @@ public:
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
/// \param Exprs Helper expressions for CodeGen.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
/// \param HasCancel true if this directive has inner cancel directive.
///
static OMPTeamsDistributeParallelForDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs, Expr *TaskRedRef,
+ bool HasCancel);
/// Creates an empty directive with the place for \a NumClauses clauses.
///
@@ -4232,6 +4459,10 @@ public:
CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
/// Return true if current directive has inner cancel directive.
bool hasCancel() const { return HasCancel; }
@@ -4379,6 +4610,9 @@ public:
class OMPTargetTeamsDistributeParallelForDirective final
: public OMPLoopDirective {
friend class ASTStmtReader;
+ /// Special reference expression for handling task reduction. Used to store
+ /// the taskgroup descriptor returned by the runtime functions.
+ Expr *TaskRedRef = nullptr;
/// true if the construct has inner cancel directive.
bool HasCancel = false;
@@ -4412,6 +4646,9 @@ class OMPTargetTeamsDistributeParallelForDirective final
SourceLocation(), SourceLocation(), CollapsedNum, NumClauses),
HasCancel(false) {}
+ /// Sets special task reduction descriptor.
+ void setTaskReductionRefExpr(Expr *E) { TaskRedRef = E; }
+
/// Set cancel state.
void setHasCancel(bool Has) { HasCancel = Has; }
@@ -4425,12 +4662,15 @@ public:
/// \param Clauses List of clauses.
/// \param AssociatedStmt Statement, associated with the directive.
/// \param Exprs Helper expressions for CodeGen.
+ /// \param TaskRedRef Task reduction special reference expression to handle
+ /// taskgroup descriptor.
/// \param HasCancel true if this directive has inner cancel directive.
///
static OMPTargetTeamsDistributeParallelForDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs, Expr *TaskRedRef,
+ bool HasCancel);
/// Creates an empty directive with the place for \a NumClauses clauses.
///
@@ -4442,6 +4682,10 @@ public:
CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
EmptyShell);
+ /// Returns special task reduction reference expression.
+ Expr *getTaskReductionRefExpr() { return TaskRedRef; }
+ const Expr *getTaskReductionRefExpr() const { return TaskRedRef; }
+
/// Return true if current directive has inner cancel directive.
bool hasCancel() const { return HasCancel; }
@@ -4594,6 +4838,63 @@ public:
}
};
+/// This represents '#pragma omp scan' directive.
+///
+/// \code
+/// #pragma omp scan inclusive(a)
+/// \endcode
+/// In this example directive '#pragma omp scan' has clause 'inclusive' with
+/// list item 'a'.
+class OMPScanDirective final : public OMPExecutableDirective {
+ 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 NumClauses Number of clauses.
+ ///
+ OMPScanDirective(SourceLocation StartLoc, SourceLocation EndLoc,
+ unsigned NumClauses)
+ : OMPExecutableDirective(this, OMPScanDirectiveClass,
+ llvm::omp::OMPD_scan, StartLoc, EndLoc,
+ NumClauses, 0) {}
+
+ /// Build an empty directive.
+ ///
+ /// \param NumClauses Number of clauses.
+ ///
+ explicit OMPScanDirective(unsigned NumClauses)
+ : OMPExecutableDirective(this, OMPScanDirectiveClass,
+ llvm::omp::OMPD_scan, SourceLocation(),
+ SourceLocation(), NumClauses, 0) {}
+
+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 Clauses List of clauses (only single OMPFlushClause clause is
+ /// allowed).
+ ///
+ static OMPScanDirective *Create(const ASTContext &C, SourceLocation StartLoc,
+ SourceLocation EndLoc,
+ ArrayRef<OMPClause *> Clauses);
+
+ /// Creates an empty directive with the place for \a NumClauses
+ /// clauses.
+ ///
+ /// \param C AST context.
+ /// \param NumClauses Number of clauses.
+ ///
+ static OMPScanDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
+ EmptyShell);
+
+ static bool classof(const Stmt *T) {
+ return T->getStmtClass() == OMPScanDirectiveClass;
+ }
+};
+
} // end namespace clang
#endif