diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2018-08-13 14:42:18 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-08-13 14:42:18 +0000 |
commit | 23647171ea067aff6f11f480aed6cd46a36de75b (patch) | |
tree | 79a1b9eac80fa99470b80039709449d9bee99411 /clang/lib/AST/OpenMPClause.cpp | |
parent | d2a36bdf0988b7106931758ec81ab7db4c5ea128 (diff) | |
download | bcm5719-llvm-23647171ea067aff6f11f480aed6cd46a36de75b.tar.gz bcm5719-llvm-23647171ea067aff6f11f480aed6cd46a36de75b.zip |
Revert "[OPENMP] Fix emission of the loop doacross constructs."
This reverts commit r339568 because of the problems with the buildbots.
llvm-svn: 339574
Diffstat (limited to 'clang/lib/AST/OpenMPClause.cpp')
-rw-r--r-- | clang/lib/AST/OpenMPClause.cpp | 123 |
1 files changed, 31 insertions, 92 deletions
diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp index 32be4df9bf3..50729264bfe 100644 --- a/clang/lib/AST/OpenMPClause.cpp +++ b/clang/lib/AST/OpenMPClause.cpp @@ -181,53 +181,6 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C) return nullptr; } -OMPOrderedClause *OMPOrderedClause::Create(const ASTContext &C, Expr *Num, - unsigned NumLoops, - SourceLocation StartLoc, - SourceLocation LParenLoc, - SourceLocation EndLoc) { - void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops)); - auto *Clause = - new (Mem) OMPOrderedClause(Num, NumLoops, StartLoc, LParenLoc, EndLoc); - for (unsigned I = 0; I < NumLoops; ++I) { - Clause->setLoopNumIterations(I, nullptr); - Clause->setLoopCounter(I, nullptr); - } - return Clause; -} - -OMPOrderedClause *OMPOrderedClause::CreateEmpty(const ASTContext &C, - unsigned NumLoops) { - void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops)); - auto *Clause = new (Mem) OMPOrderedClause(NumLoops); - for (unsigned I = 0; I < NumLoops; ++I) { - Clause->setLoopNumIterations(I, nullptr); - Clause->setLoopCounter(I, nullptr); - } - return Clause; -} - -void OMPOrderedClause::setLoopNumIterations(unsigned NumLoop, - Expr *NumIterations) { - getTrailingObjects<Expr *>()[NumLoop] = NumIterations; -} - -ArrayRef<Expr *> OMPOrderedClause::getLoopNumIterations() const { - return llvm::makeArrayRef(getTrailingObjects<Expr *>(), NumberOfLoops); -} - -void OMPOrderedClause::setLoopCounter(unsigned NumLoop, Expr *Counter) { - getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop] = Counter; -} - -Expr *OMPOrderedClause::getLoopCunter(unsigned NumLoop) { - return getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop]; -} - -const Expr *OMPOrderedClause::getLoopCunter(unsigned NumLoop) const { - return getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop]; -} - void OMPPrivateClause::setPrivateCopies(ArrayRef<Expr *> VL) { assert(VL.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer"); @@ -700,58 +653,44 @@ OMPFlushClause *OMPFlushClause::CreateEmpty(const ASTContext &C, unsigned N) { return new (Mem) OMPFlushClause(N); } -OMPDependClause * -OMPDependClause::Create(const ASTContext &C, SourceLocation StartLoc, - SourceLocation LParenLoc, SourceLocation EndLoc, - OpenMPDependClauseKind DepKind, SourceLocation DepLoc, - SourceLocation ColonLoc, ArrayRef<Expr *> VL, - unsigned NumLoops) { - void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + NumLoops)); - OMPDependClause *Clause = new (Mem) - OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops); +OMPDependClause *OMPDependClause::Create( + const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, + SourceLocation EndLoc, OpenMPDependClauseKind DepKind, + SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL) { + void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1)); + OMPDependClause *Clause = + new (Mem) OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size()); Clause->setVarRefs(VL); Clause->setDependencyKind(DepKind); Clause->setDependencyLoc(DepLoc); Clause->setColonLoc(ColonLoc); - for (unsigned I = 0 ; I < NumLoops; ++I) - Clause->setLoopData(I, nullptr); + Clause->setCounterValue(nullptr); return Clause; } -OMPDependClause *OMPDependClause::CreateEmpty(const ASTContext &C, unsigned N, - unsigned NumLoops) { - void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N + NumLoops)); - return new (Mem) OMPDependClause(N, NumLoops); -} - -void OMPDependClause::setLoopData(unsigned int NumLoop, Expr *Cnt) { - assert((getDependencyKind() == OMPC_DEPEND_sink || - getDependencyKind() == OMPC_DEPEND_source) && - NumLoop < NumLoops && - "Expected sink or source depend + loop index must be less number of " - "loops."); - auto It = std::next(getVarRefs().end(), NumLoop); - *It = Cnt; -} - -Expr *OMPDependClause::getLoopData(unsigned NumLoop) { - assert((getDependencyKind() == OMPC_DEPEND_sink || - getDependencyKind() == OMPC_DEPEND_source) && - NumLoop < NumLoops && - "Expected sink or source depend + loop index must be less number of " - "loops."); - auto It = std::next(getVarRefs().end(), NumLoop); - return *It; -} - -const Expr *OMPDependClause::getLoopData(unsigned NumLoop) const { - assert((getDependencyKind() == OMPC_DEPEND_sink || - getDependencyKind() == OMPC_DEPEND_source) && - NumLoop < NumLoops && - "Expected sink or source depend + loop index must be less number of " - "loops."); - auto It = std::next(getVarRefs().end(), NumLoop); - return *It; +OMPDependClause *OMPDependClause::CreateEmpty(const ASTContext &C, unsigned N) { + void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N + 1)); + return new (Mem) OMPDependClause(N); +} + +void OMPDependClause::setCounterValue(Expr *V) { + assert(getDependencyKind() == OMPC_DEPEND_sink || + getDependencyKind() == OMPC_DEPEND_source || V == nullptr); + *getVarRefs().end() = V; +} + +const Expr *OMPDependClause::getCounterValue() const { + auto *V = *getVarRefs().end(); + assert(getDependencyKind() == OMPC_DEPEND_sink || + getDependencyKind() == OMPC_DEPEND_source || V == nullptr); + return V; +} + +Expr *OMPDependClause::getCounterValue() { + auto *V = *getVarRefs().end(); + assert(getDependencyKind() == OMPC_DEPEND_sink || + getDependencyKind() == OMPC_DEPEND_source || V == nullptr); + return V; } unsigned OMPClauseMappableExprCommon::getComponentsTotalNumber( |