diff options
author | Kelvin Li <kkwli0@gmail.com> | 2016-12-29 22:16:30 +0000 |
---|---|---|
committer | Kelvin Li <kkwli0@gmail.com> | 2016-12-29 22:16:30 +0000 |
commit | 80e8f562846e9d2b7c73f0feadb1c160f5e59a51 (patch) | |
tree | a8779e799045b14b5741ff4a47919c1ec821e850 /clang/lib/AST/StmtOpenMP.cpp | |
parent | e0bd37e78fb4a6e80e6f43c2b959b8aeb9ee6303 (diff) | |
download | bcm5719-llvm-80e8f562846e9d2b7c73f0feadb1c160f5e59a51.tar.gz bcm5719-llvm-80e8f562846e9d2b7c73f0feadb1c160f5e59a51.zip |
[OpenMP] Sema and parsing for 'target teams distribute parallel for’ pragma
This patch is to implement sema and parsing for 'target teams distribute parallel for’ pragma.
Differential Revision: https://reviews.llvm.org/D28160
llvm-svn: 290725
Diffstat (limited to 'clang/lib/AST/StmtOpenMP.cpp')
-rw-r--r-- | clang/lib/AST/StmtOpenMP.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/clang/lib/AST/StmtOpenMP.cpp b/clang/lib/AST/StmtOpenMP.cpp index 81c1d2c138a..0a90740162b 100644 --- a/clang/lib/AST/StmtOpenMP.cpp +++ b/clang/lib/AST/StmtOpenMP.cpp @@ -1598,3 +1598,64 @@ OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C, numLoopChildren(CollapsedNum, OMPD_target_teams_distribute)); return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses); } + +OMPTargetTeamsDistributeParallelForDirective * +OMPTargetTeamsDistributeParallelForDirective::Create( + const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, + unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, + const HelperExprs &Exprs) { + auto Size = + llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective), + alignof(OMPClause *)); + void *Mem = C.Allocate( + Size + sizeof(OMPClause *) * Clauses.size() + + sizeof(Stmt *) * + numLoopChildren(CollapsedNum, + OMPD_target_teams_distribute_parallel_for)); + OMPTargetTeamsDistributeParallelForDirective *Dir = + new (Mem) OMPTargetTeamsDistributeParallelForDirective( + StartLoc, EndLoc, CollapsedNum, Clauses.size()); + Dir->setClauses(Clauses); + Dir->setAssociatedStmt(AssociatedStmt); + Dir->setIterationVariable(Exprs.IterationVarRef); + Dir->setLastIteration(Exprs.LastIteration); + Dir->setCalcLastIteration(Exprs.CalcLastIteration); + Dir->setPreCond(Exprs.PreCond); + Dir->setCond(Exprs.Cond); + Dir->setInit(Exprs.Init); + Dir->setInc(Exprs.Inc); + Dir->setIsLastIterVariable(Exprs.IL); + Dir->setLowerBoundVariable(Exprs.LB); + Dir->setUpperBoundVariable(Exprs.UB); + Dir->setStrideVariable(Exprs.ST); + Dir->setEnsureUpperBound(Exprs.EUB); + Dir->setNextLowerBound(Exprs.NLB); + Dir->setNextUpperBound(Exprs.NUB); + Dir->setNumIterations(Exprs.NumIterations); + Dir->setPrevLowerBoundVariable(Exprs.PrevLB); + Dir->setPrevUpperBoundVariable(Exprs.PrevUB); + Dir->setCounters(Exprs.Counters); + Dir->setPrivateCounters(Exprs.PrivateCounters); + Dir->setInits(Exprs.Inits); + Dir->setUpdates(Exprs.Updates); + Dir->setFinals(Exprs.Finals); + Dir->setPreInits(Exprs.PreInits); + return Dir; +} + +OMPTargetTeamsDistributeParallelForDirective * +OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C, + unsigned NumClauses, + unsigned CollapsedNum, + EmptyShell) { + auto Size = + llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective), + alignof(OMPClause *)); + void *Mem = C.Allocate( + Size + sizeof(OMPClause *) * NumClauses + + sizeof(Stmt *) * + numLoopChildren(CollapsedNum, + OMPD_target_teams_distribute_parallel_for)); + return new (Mem) + OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses); +} |