summaryrefslogtreecommitdiff
path: root/include/clang/AST
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-08-14 19:30:06 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2019-08-14 19:30:06 +0000
commit8992979c9f883945fbf1778f16e7d979dd6a2840 (patch)
tree3e0ea693b46dfcc784042b24fd58e09629e3c5c5 /include/clang/AST
parentf6a49c4be89f8ca89f4b7ab96f08e6a0d8aabd66 (diff)
downloadclang-8992979c9f883945fbf1778f16e7d979dd6a2840.tar.gz
[OPENMP]Support for non-rectangular loops.
Added basic support for non-rectangular loops. It requires an additional analysis of min/max boundaries for non-rectangular loops. Since only linear dependency is allowed, we can do this analysis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368903 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST')
-rw-r--r--include/clang/AST/StmtOpenMP.h77
1 files changed, 71 insertions, 6 deletions
diff --git a/include/clang/AST/StmtOpenMP.h b/include/clang/AST/StmtOpenMP.h
index e37f5b1e00..c9efe32387 100644
--- a/include/clang/AST/StmtOpenMP.h
+++ b/include/clang/AST/StmtOpenMP.h
@@ -448,7 +448,8 @@ class OMPLoopDirective : public OMPExecutableDirective {
PreInitsOffset = 8,
// The '...End' enumerators do not correspond to child expressions - they
// specify the offset to the end (and start of the following counters/
- // updates/finals arrays).
+ // updates/finals/dependent_counters/dependent_inits/finals_conditions
+ // arrays).
DefaultEnd = 9,
// The following 8 exprs are used by worksharing and distribute loops only.
IsLastIterVariableOffset = 9,
@@ -474,7 +475,8 @@ class OMPLoopDirective : public OMPExecutableDirective {
CombinedNextUpperBoundOffset = 27,
CombinedDistConditionOffset = 28,
CombinedParForInDistConditionOffset = 29,
- // Offset to the end (and start of the following counters/updates/finals
+ // Offset to the end (and start of the following
+ // counters/updates/finals/dependent_counters/dependent_inits/finals_conditions
// arrays) for combined distribute loop directives.
CombinedDistributeEnd = 30,
};
@@ -517,6 +519,30 @@ class OMPLoopDirective : public OMPExecutableDirective {
return MutableArrayRef<Expr *>(Storage, CollapsedNum);
}
+ /// Get the dependent counters storage.
+ MutableArrayRef<Expr *> getDependentCounters() {
+ Expr **Storage = reinterpret_cast<Expr **>(
+ &*std::next(child_begin(),
+ getArraysOffset(getDirectiveKind()) + 5 * CollapsedNum));
+ return MutableArrayRef<Expr *>(Storage, CollapsedNum);
+ }
+
+ /// Get the dependent inits storage.
+ MutableArrayRef<Expr *> getDependentInits() {
+ Expr **Storage = reinterpret_cast<Expr **>(
+ &*std::next(child_begin(),
+ getArraysOffset(getDirectiveKind()) + 6 * CollapsedNum));
+ return MutableArrayRef<Expr *>(Storage, CollapsedNum);
+ }
+
+ /// Get the finals conditions storage.
+ MutableArrayRef<Expr *> getFinalsConditions() {
+ Expr **Storage = reinterpret_cast<Expr **>(
+ &*std::next(child_begin(),
+ getArraysOffset(getDirectiveKind()) + 7 * CollapsedNum));
+ return MutableArrayRef<Expr *>(Storage, CollapsedNum);
+ }
+
protected:
/// Build instance of loop directive of class \a Kind.
///
@@ -551,9 +577,10 @@ protected:
/// Children number.
static unsigned numLoopChildren(unsigned CollapsedNum,
OpenMPDirectiveKind Kind) {
- return getArraysOffset(Kind) + 5 * CollapsedNum; // Counters,
- // PrivateCounters, Inits,
- // Updates and Finals
+ return getArraysOffset(Kind) +
+ 8 * CollapsedNum; // Counters, PrivateCounters, Inits,
+ // Updates, Finals, DependentCounters,
+ // DependentInits, FinalsConditions.
}
void setIterationVariable(Expr *IV) {
@@ -703,6 +730,9 @@ protected:
void setInits(ArrayRef<Expr *> A);
void setUpdates(ArrayRef<Expr *> A);
void setFinals(ArrayRef<Expr *> A);
+ void setDependentCounters(ArrayRef<Expr *> A);
+ void setDependentInits(ArrayRef<Expr *> A);
+ void setFinalsConditions(ArrayRef<Expr *> A);
public:
/// The expressions built to support OpenMP loops in combined/composite
@@ -798,6 +828,15 @@ public:
SmallVector<Expr *, 4> Updates;
/// Final loop counter values for GodeGen.
SmallVector<Expr *, 4> Finals;
+ /// List of counters required for the generation of the non-rectangular
+ /// loops.
+ SmallVector<Expr *, 4> DependentCounters;
+ /// List of initializers required for the generation of the non-rectangular
+ /// loops.
+ SmallVector<Expr *, 4> DependentInits;
+ /// List of final conditions required for the generation of the
+ /// non-rectangular loops.
+ SmallVector<Expr *, 4> FinalsConditions;
/// Init statement for all captured expressions.
Stmt *PreInits;
@@ -813,7 +852,9 @@ public:
}
/// Initialize all the fields to null.
- /// \param Size Number of elements in the counters/finals/updates arrays.
+ /// \param Size Number of elements in the
+ /// counters/finals/updates/dependent_counters/dependent_inits/finals_conditions
+ /// arrays.
void clear(unsigned Size) {
IterationVarRef = nullptr;
LastIteration = nullptr;
@@ -839,12 +880,18 @@ public:
Inits.resize(Size);
Updates.resize(Size);
Finals.resize(Size);
+ DependentCounters.resize(Size);
+ DependentInits.resize(Size);
+ FinalsConditions.resize(Size);
for (unsigned i = 0; i < Size; ++i) {
Counters[i] = nullptr;
PrivateCounters[i] = nullptr;
Inits[i] = nullptr;
Updates[i] = nullptr;
Finals[i] = nullptr;
+ DependentCounters[i] = nullptr;
+ DependentInits[i] = nullptr;
+ FinalsConditions[i] = nullptr;
}
PreInits = nullptr;
DistCombinedFields.LB = nullptr;
@@ -1078,6 +1125,24 @@ public:
return const_cast<OMPLoopDirective *>(this)->getFinals();
}
+ ArrayRef<Expr *> dependent_counters() { return getDependentCounters(); }
+
+ ArrayRef<Expr *> dependent_counters() const {
+ return const_cast<OMPLoopDirective *>(this)->getDependentCounters();
+ }
+
+ ArrayRef<Expr *> dependent_inits() { return getDependentInits(); }
+
+ ArrayRef<Expr *> dependent_inits() const {
+ return const_cast<OMPLoopDirective *>(this)->getDependentInits();
+ }
+
+ ArrayRef<Expr *> finals_conditions() { return getFinalsConditions(); }
+
+ ArrayRef<Expr *> finals_conditions() const {
+ return const_cast<OMPLoopDirective *>(this)->getFinalsConditions();
+ }
+
static bool classof(const Stmt *T) {
return T->getStmtClass() == OMPSimdDirectiveClass ||
T->getStmtClass() == OMPForDirectiveClass ||