1 //===--- StmtOpenMP.cpp - Classes for OpenMP directives -------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file implements the subclesses of Stmt class declared in StmtOpenMP.h
11 //===----------------------------------------------------------------------===//
13 #include "clang/AST/ASTContext.h"
14 #include "clang/AST/StmtOpenMP.h"
16 using namespace clang
;
17 using namespace llvm::omp
;
19 size_t OMPChildren::size(unsigned NumClauses
, bool HasAssociatedStmt
,
20 unsigned NumChildren
) {
22 totalSizeToAlloc
<OMPClause
*, Stmt
*>(
23 NumClauses
, NumChildren
+ (HasAssociatedStmt
? 1 : 0)),
24 alignof(OMPChildren
));
27 void OMPChildren::setClauses(ArrayRef
<OMPClause
*> Clauses
) {
28 assert(Clauses
.size() == NumClauses
&&
29 "Number of clauses is not the same as the preallocated buffer");
30 llvm::copy(Clauses
, getTrailingObjects
<OMPClause
*>());
33 MutableArrayRef
<Stmt
*> OMPChildren::getChildren() {
34 return llvm::makeMutableArrayRef(getTrailingObjects
<Stmt
*>(), NumChildren
);
37 OMPChildren
*OMPChildren::Create(void *Mem
, ArrayRef
<OMPClause
*> Clauses
) {
38 auto *Data
= CreateEmpty(Mem
, Clauses
.size());
39 Data
->setClauses(Clauses
);
43 OMPChildren
*OMPChildren::Create(void *Mem
, ArrayRef
<OMPClause
*> Clauses
,
44 Stmt
*S
, unsigned NumChildren
) {
45 auto *Data
= CreateEmpty(Mem
, Clauses
.size(), S
, NumChildren
);
46 Data
->setClauses(Clauses
);
48 Data
->setAssociatedStmt(S
);
52 OMPChildren
*OMPChildren::CreateEmpty(void *Mem
, unsigned NumClauses
,
53 bool HasAssociatedStmt
,
54 unsigned NumChildren
) {
55 return new (Mem
) OMPChildren(NumClauses
, NumChildren
, HasAssociatedStmt
);
58 bool OMPExecutableDirective::isStandaloneDirective() const {
59 // Special case: 'omp target enter data', 'omp target exit data',
60 // 'omp target update' are stand-alone directives, but for implementation
61 // reasons they have empty synthetic structured block, to simplify codegen.
62 if (isa
<OMPTargetEnterDataDirective
>(this) ||
63 isa
<OMPTargetExitDataDirective
>(this) ||
64 isa
<OMPTargetUpdateDirective
>(this))
66 return !hasAssociatedStmt();
69 Stmt
*OMPExecutableDirective::getStructuredBlock() {
70 assert(!isStandaloneDirective() &&
71 "Standalone Executable Directives don't have Structured Blocks.");
72 if (auto *LD
= dyn_cast
<OMPLoopDirective
>(this))
78 OMPLoopBasedDirective::tryToFindNextInnerLoop(Stmt
*CurStmt
,
79 bool TryImperfectlyNestedLoops
) {
80 Stmt
*OrigStmt
= CurStmt
;
81 CurStmt
= CurStmt
->IgnoreContainers();
82 // Additional work for imperfectly nested loops, introduced in OpenMP 5.0.
83 if (TryImperfectlyNestedLoops
) {
84 if (auto *CS
= dyn_cast
<CompoundStmt
>(CurStmt
)) {
86 SmallVector
<CompoundStmt
*, 4> Statements(1, CS
);
87 SmallVector
<CompoundStmt
*, 4> NextStatements
;
88 while (!Statements
.empty()) {
89 CS
= Statements
.pop_back_val();
92 for (Stmt
*S
: CS
->body()) {
95 if (auto *CanonLoop
= dyn_cast
<OMPCanonicalLoop
>(S
))
96 S
= CanonLoop
->getLoopStmt();
97 if (isa
<ForStmt
>(S
) || isa
<CXXForRangeStmt
>(S
) ||
98 (isa
<OMPLoopBasedDirective
>(S
) && !isa
<OMPLoopDirective
>(S
))) {
99 // Only single loop construct is allowed.
107 S
= S
->IgnoreContainers();
108 if (auto *InnerCS
= dyn_cast_or_null
<CompoundStmt
>(S
))
109 NextStatements
.push_back(InnerCS
);
111 if (Statements
.empty()) {
112 // Found single inner loop or multiple loops - exit.
115 Statements
.swap(NextStatements
);
125 bool OMPLoopBasedDirective::doForAllLoops(
126 Stmt
*CurStmt
, bool TryImperfectlyNestedLoops
, unsigned NumLoops
,
127 llvm::function_ref
<bool(unsigned, Stmt
*)> Callback
,
128 llvm::function_ref
<void(OMPLoopTransformationDirective
*)>
129 OnTransformationCallback
) {
130 CurStmt
= CurStmt
->IgnoreContainers();
131 for (unsigned Cnt
= 0; Cnt
< NumLoops
; ++Cnt
) {
133 auto *Dir
= dyn_cast
<OMPLoopTransformationDirective
>(CurStmt
);
137 OnTransformationCallback(Dir
);
139 Stmt
*TransformedStmt
= Dir
->getTransformedStmt();
140 if (!TransformedStmt
) {
141 unsigned NumGeneratedLoops
= Dir
->getNumGeneratedLoops();
142 if (NumGeneratedLoops
== 0) {
143 // May happen if the loop transformation does not result in a
144 // generated loop (such as full unrolling).
147 if (NumGeneratedLoops
> 0) {
148 // The loop transformation construct has generated loops, but these
149 // may not have been generated yet due to being in a dependent
155 CurStmt
= TransformedStmt
;
157 if (auto *CanonLoop
= dyn_cast
<OMPCanonicalLoop
>(CurStmt
))
158 CurStmt
= CanonLoop
->getLoopStmt();
159 if (Callback(Cnt
, CurStmt
))
161 // Move on to the next nested for loop, or to the loop body.
162 // OpenMP [2.8.1, simd construct, Restrictions]
163 // All loops associated with the construct must be perfectly nested; that
164 // is, there must be no intervening code nor any OpenMP directive between
166 if (auto *For
= dyn_cast
<ForStmt
>(CurStmt
)) {
167 CurStmt
= For
->getBody();
169 assert(isa
<CXXForRangeStmt
>(CurStmt
) &&
170 "Expected canonical for or range-based for loops.");
171 CurStmt
= cast
<CXXForRangeStmt
>(CurStmt
)->getBody();
173 CurStmt
= OMPLoopBasedDirective::tryToFindNextInnerLoop(
174 CurStmt
, TryImperfectlyNestedLoops
);
179 void OMPLoopBasedDirective::doForAllLoopsBodies(
180 Stmt
*CurStmt
, bool TryImperfectlyNestedLoops
, unsigned NumLoops
,
181 llvm::function_ref
<void(unsigned, Stmt
*, Stmt
*)> Callback
) {
182 bool Res
= OMPLoopBasedDirective::doForAllLoops(
183 CurStmt
, TryImperfectlyNestedLoops
, NumLoops
,
184 [Callback
](unsigned Cnt
, Stmt
*Loop
) {
185 Stmt
*Body
= nullptr;
186 if (auto *For
= dyn_cast
<ForStmt
>(Loop
)) {
187 Body
= For
->getBody();
189 assert(isa
<CXXForRangeStmt
>(Loop
) &&
190 "Expected canonical for or range-based for loops.");
191 Body
= cast
<CXXForRangeStmt
>(Loop
)->getBody();
193 if (auto *CanonLoop
= dyn_cast
<OMPCanonicalLoop
>(Body
))
194 Body
= CanonLoop
->getLoopStmt();
195 Callback(Cnt
, Loop
, Body
);
198 assert(Res
&& "Expected only loops");
202 Stmt
*OMPLoopDirective::getBody() {
203 // This relies on the loop form is already checked by Sema.
204 Stmt
*Body
= nullptr;
205 OMPLoopBasedDirective::doForAllLoopsBodies(
206 Data
->getRawStmt(), /*TryImperfectlyNestedLoops=*/true,
208 [&Body
](unsigned, Stmt
*, Stmt
*BodyStmt
) { Body
= BodyStmt
; });
212 void OMPLoopDirective::setCounters(ArrayRef
<Expr
*> A
) {
213 assert(A
.size() == getLoopsNumber() &&
214 "Number of loop counters is not the same as the collapsed number");
215 llvm::copy(A
, getCounters().begin());
218 void OMPLoopDirective::setPrivateCounters(ArrayRef
<Expr
*> A
) {
219 assert(A
.size() == getLoopsNumber() && "Number of loop private counters "
220 "is not the same as the collapsed "
222 llvm::copy(A
, getPrivateCounters().begin());
225 void OMPLoopDirective::setInits(ArrayRef
<Expr
*> A
) {
226 assert(A
.size() == getLoopsNumber() &&
227 "Number of counter inits is not the same as the collapsed number");
228 llvm::copy(A
, getInits().begin());
231 void OMPLoopDirective::setUpdates(ArrayRef
<Expr
*> A
) {
232 assert(A
.size() == getLoopsNumber() &&
233 "Number of counter updates is not the same as the collapsed number");
234 llvm::copy(A
, getUpdates().begin());
237 void OMPLoopDirective::setFinals(ArrayRef
<Expr
*> A
) {
238 assert(A
.size() == getLoopsNumber() &&
239 "Number of counter finals is not the same as the collapsed number");
240 llvm::copy(A
, getFinals().begin());
243 void OMPLoopDirective::setDependentCounters(ArrayRef
<Expr
*> A
) {
245 A
.size() == getLoopsNumber() &&
246 "Number of dependent counters is not the same as the collapsed number");
247 llvm::copy(A
, getDependentCounters().begin());
250 void OMPLoopDirective::setDependentInits(ArrayRef
<Expr
*> A
) {
251 assert(A
.size() == getLoopsNumber() &&
252 "Number of dependent inits is not the same as the collapsed number");
253 llvm::copy(A
, getDependentInits().begin());
256 void OMPLoopDirective::setFinalsConditions(ArrayRef
<Expr
*> A
) {
257 assert(A
.size() == getLoopsNumber() &&
258 "Number of finals conditions is not the same as the collapsed number");
259 llvm::copy(A
, getFinalsConditions().begin());
262 OMPMetaDirective
*OMPMetaDirective::Create(const ASTContext
&C
,
263 SourceLocation StartLoc
,
264 SourceLocation EndLoc
,
265 ArrayRef
<OMPClause
*> Clauses
,
266 Stmt
*AssociatedStmt
, Stmt
*IfStmt
) {
267 auto *Dir
= createDirective
<OMPMetaDirective
>(
268 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/1, StartLoc
, EndLoc
);
269 Dir
->setIfStmt(IfStmt
);
273 OMPMetaDirective
*OMPMetaDirective::CreateEmpty(const ASTContext
&C
,
276 return createEmptyDirective
<OMPMetaDirective
>(C
, NumClauses
,
277 /*HasAssociatedStmt=*/true,
281 OMPParallelDirective
*OMPParallelDirective::Create(
282 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
283 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
, Expr
*TaskRedRef
,
285 auto *Dir
= createDirective
<OMPParallelDirective
>(
286 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/1, StartLoc
, EndLoc
);
287 Dir
->setTaskReductionRefExpr(TaskRedRef
);
288 Dir
->setHasCancel(HasCancel
);
292 OMPParallelDirective
*OMPParallelDirective::CreateEmpty(const ASTContext
&C
,
295 return createEmptyDirective
<OMPParallelDirective
>(C
, NumClauses
,
296 /*HasAssociatedStmt=*/true,
301 OMPSimdDirective::Create(const ASTContext
&C
, SourceLocation StartLoc
,
302 SourceLocation EndLoc
, unsigned CollapsedNum
,
303 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
304 const HelperExprs
&Exprs
) {
305 auto *Dir
= createDirective
<OMPSimdDirective
>(
306 C
, Clauses
, AssociatedStmt
, numLoopChildren(CollapsedNum
, OMPD_simd
),
307 StartLoc
, EndLoc
, CollapsedNum
);
308 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
309 Dir
->setLastIteration(Exprs
.LastIteration
);
310 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
311 Dir
->setPreCond(Exprs
.PreCond
);
312 Dir
->setCond(Exprs
.Cond
);
313 Dir
->setInit(Exprs
.Init
);
314 Dir
->setInc(Exprs
.Inc
);
315 Dir
->setCounters(Exprs
.Counters
);
316 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
317 Dir
->setInits(Exprs
.Inits
);
318 Dir
->setUpdates(Exprs
.Updates
);
319 Dir
->setFinals(Exprs
.Finals
);
320 Dir
->setDependentCounters(Exprs
.DependentCounters
);
321 Dir
->setDependentInits(Exprs
.DependentInits
);
322 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
323 Dir
->setPreInits(Exprs
.PreInits
);
327 OMPSimdDirective
*OMPSimdDirective::CreateEmpty(const ASTContext
&C
,
329 unsigned CollapsedNum
,
331 return createEmptyDirective
<OMPSimdDirective
>(
332 C
, NumClauses
, /*HasAssociatedStmt=*/true,
333 numLoopChildren(CollapsedNum
, OMPD_simd
), CollapsedNum
);
336 OMPForDirective
*OMPForDirective::Create(
337 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
338 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
339 const HelperExprs
&Exprs
, Expr
*TaskRedRef
, bool HasCancel
) {
340 auto *Dir
= createDirective
<OMPForDirective
>(
341 C
, Clauses
, AssociatedStmt
, numLoopChildren(CollapsedNum
, OMPD_for
) + 1,
342 StartLoc
, EndLoc
, CollapsedNum
);
343 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
344 Dir
->setLastIteration(Exprs
.LastIteration
);
345 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
346 Dir
->setPreCond(Exprs
.PreCond
);
347 Dir
->setCond(Exprs
.Cond
);
348 Dir
->setInit(Exprs
.Init
);
349 Dir
->setInc(Exprs
.Inc
);
350 Dir
->setIsLastIterVariable(Exprs
.IL
);
351 Dir
->setLowerBoundVariable(Exprs
.LB
);
352 Dir
->setUpperBoundVariable(Exprs
.UB
);
353 Dir
->setStrideVariable(Exprs
.ST
);
354 Dir
->setEnsureUpperBound(Exprs
.EUB
);
355 Dir
->setNextLowerBound(Exprs
.NLB
);
356 Dir
->setNextUpperBound(Exprs
.NUB
);
357 Dir
->setNumIterations(Exprs
.NumIterations
);
358 Dir
->setCounters(Exprs
.Counters
);
359 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
360 Dir
->setInits(Exprs
.Inits
);
361 Dir
->setUpdates(Exprs
.Updates
);
362 Dir
->setFinals(Exprs
.Finals
);
363 Dir
->setDependentCounters(Exprs
.DependentCounters
);
364 Dir
->setDependentInits(Exprs
.DependentInits
);
365 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
366 Dir
->setPreInits(Exprs
.PreInits
);
367 Dir
->setTaskReductionRefExpr(TaskRedRef
);
368 Dir
->setHasCancel(HasCancel
);
372 Stmt
*OMPLoopTransformationDirective::getTransformedStmt() const {
373 switch (getStmtClass()) {
374 #define STMT(CLASS, PARENT)
375 #define ABSTRACT_STMT(CLASS)
376 #define OMPLOOPTRANSFORMATIONDIRECTIVE(CLASS, PARENT) \
377 case Stmt::CLASS##Class: \
378 return static_cast<const CLASS *>(this)->getTransformedStmt();
379 #include "clang/AST/StmtNodes.inc"
381 llvm_unreachable("Not a loop transformation");
385 Stmt
*OMPLoopTransformationDirective::getPreInits() const {
386 switch (getStmtClass()) {
387 #define STMT(CLASS, PARENT)
388 #define ABSTRACT_STMT(CLASS)
389 #define OMPLOOPTRANSFORMATIONDIRECTIVE(CLASS, PARENT) \
390 case Stmt::CLASS##Class: \
391 return static_cast<const CLASS *>(this)->getPreInits();
392 #include "clang/AST/StmtNodes.inc"
394 llvm_unreachable("Not a loop transformation");
398 OMPForDirective
*OMPForDirective::CreateEmpty(const ASTContext
&C
,
400 unsigned CollapsedNum
,
402 return createEmptyDirective
<OMPForDirective
>(
403 C
, NumClauses
, /*HasAssociatedStmt=*/true,
404 numLoopChildren(CollapsedNum
, OMPD_for
) + 1, CollapsedNum
);
408 OMPTileDirective::Create(const ASTContext
&C
, SourceLocation StartLoc
,
409 SourceLocation EndLoc
, ArrayRef
<OMPClause
*> Clauses
,
410 unsigned NumLoops
, Stmt
*AssociatedStmt
,
411 Stmt
*TransformedStmt
, Stmt
*PreInits
) {
412 OMPTileDirective
*Dir
= createDirective
<OMPTileDirective
>(
413 C
, Clauses
, AssociatedStmt
, TransformedStmtOffset
+ 1, StartLoc
, EndLoc
,
415 Dir
->setTransformedStmt(TransformedStmt
);
416 Dir
->setPreInits(PreInits
);
420 OMPTileDirective
*OMPTileDirective::CreateEmpty(const ASTContext
&C
,
423 return createEmptyDirective
<OMPTileDirective
>(
424 C
, NumClauses
, /*HasAssociatedStmt=*/true, TransformedStmtOffset
+ 1,
425 SourceLocation(), SourceLocation(), NumLoops
);
429 OMPUnrollDirective::Create(const ASTContext
&C
, SourceLocation StartLoc
,
430 SourceLocation EndLoc
, ArrayRef
<OMPClause
*> Clauses
,
431 Stmt
*AssociatedStmt
, unsigned NumGeneratedLoops
,
432 Stmt
*TransformedStmt
, Stmt
*PreInits
) {
433 assert(NumGeneratedLoops
<= 1 && "Unrolling generates at most one loop");
435 auto *Dir
= createDirective
<OMPUnrollDirective
>(
436 C
, Clauses
, AssociatedStmt
, TransformedStmtOffset
+ 1, StartLoc
, EndLoc
);
437 Dir
->setNumGeneratedLoops(NumGeneratedLoops
);
438 Dir
->setTransformedStmt(TransformedStmt
);
439 Dir
->setPreInits(PreInits
);
443 OMPUnrollDirective
*OMPUnrollDirective::CreateEmpty(const ASTContext
&C
,
444 unsigned NumClauses
) {
445 return createEmptyDirective
<OMPUnrollDirective
>(
446 C
, NumClauses
, /*HasAssociatedStmt=*/true, TransformedStmtOffset
+ 1,
447 SourceLocation(), SourceLocation());
450 OMPForSimdDirective
*
451 OMPForSimdDirective::Create(const ASTContext
&C
, SourceLocation StartLoc
,
452 SourceLocation EndLoc
, unsigned CollapsedNum
,
453 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
454 const HelperExprs
&Exprs
) {
455 auto *Dir
= createDirective
<OMPForSimdDirective
>(
456 C
, Clauses
, AssociatedStmt
, numLoopChildren(CollapsedNum
, OMPD_for_simd
),
457 StartLoc
, EndLoc
, CollapsedNum
);
458 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
459 Dir
->setLastIteration(Exprs
.LastIteration
);
460 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
461 Dir
->setPreCond(Exprs
.PreCond
);
462 Dir
->setCond(Exprs
.Cond
);
463 Dir
->setInit(Exprs
.Init
);
464 Dir
->setInc(Exprs
.Inc
);
465 Dir
->setIsLastIterVariable(Exprs
.IL
);
466 Dir
->setLowerBoundVariable(Exprs
.LB
);
467 Dir
->setUpperBoundVariable(Exprs
.UB
);
468 Dir
->setStrideVariable(Exprs
.ST
);
469 Dir
->setEnsureUpperBound(Exprs
.EUB
);
470 Dir
->setNextLowerBound(Exprs
.NLB
);
471 Dir
->setNextUpperBound(Exprs
.NUB
);
472 Dir
->setNumIterations(Exprs
.NumIterations
);
473 Dir
->setCounters(Exprs
.Counters
);
474 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
475 Dir
->setInits(Exprs
.Inits
);
476 Dir
->setUpdates(Exprs
.Updates
);
477 Dir
->setFinals(Exprs
.Finals
);
478 Dir
->setDependentCounters(Exprs
.DependentCounters
);
479 Dir
->setDependentInits(Exprs
.DependentInits
);
480 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
481 Dir
->setPreInits(Exprs
.PreInits
);
485 OMPForSimdDirective
*OMPForSimdDirective::CreateEmpty(const ASTContext
&C
,
487 unsigned CollapsedNum
,
489 return createEmptyDirective
<OMPForSimdDirective
>(
490 C
, NumClauses
, /*HasAssociatedStmt=*/true,
491 numLoopChildren(CollapsedNum
, OMPD_for_simd
), CollapsedNum
);
494 OMPSectionsDirective
*OMPSectionsDirective::Create(
495 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
496 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
, Expr
*TaskRedRef
,
498 auto *Dir
= createDirective
<OMPSectionsDirective
>(C
, Clauses
, AssociatedStmt
,
499 /*NumChildren=*/1, StartLoc
,
501 Dir
->setTaskReductionRefExpr(TaskRedRef
);
502 Dir
->setHasCancel(HasCancel
);
506 OMPSectionsDirective
*OMPSectionsDirective::CreateEmpty(const ASTContext
&C
,
509 return createEmptyDirective
<OMPSectionsDirective
>(C
, NumClauses
,
510 /*HasAssociatedStmt=*/true,
514 OMPSectionDirective
*OMPSectionDirective::Create(const ASTContext
&C
,
515 SourceLocation StartLoc
,
516 SourceLocation EndLoc
,
517 Stmt
*AssociatedStmt
,
520 createDirective
<OMPSectionDirective
>(C
, llvm::None
, AssociatedStmt
,
521 /*NumChildren=*/0, StartLoc
, EndLoc
);
522 Dir
->setHasCancel(HasCancel
);
526 OMPSectionDirective
*OMPSectionDirective::CreateEmpty(const ASTContext
&C
,
528 return createEmptyDirective
<OMPSectionDirective
>(C
, /*NumClauses=*/0,
529 /*HasAssociatedStmt=*/true);
532 OMPSingleDirective
*OMPSingleDirective::Create(const ASTContext
&C
,
533 SourceLocation StartLoc
,
534 SourceLocation EndLoc
,
535 ArrayRef
<OMPClause
*> Clauses
,
536 Stmt
*AssociatedStmt
) {
537 return createDirective
<OMPSingleDirective
>(C
, Clauses
, AssociatedStmt
,
538 /*NumChildren=*/0, StartLoc
,
542 OMPSingleDirective
*OMPSingleDirective::CreateEmpty(const ASTContext
&C
,
545 return createEmptyDirective
<OMPSingleDirective
>(C
, NumClauses
,
546 /*HasAssociatedStmt=*/true);
549 OMPMasterDirective
*OMPMasterDirective::Create(const ASTContext
&C
,
550 SourceLocation StartLoc
,
551 SourceLocation EndLoc
,
552 Stmt
*AssociatedStmt
) {
553 return createDirective
<OMPMasterDirective
>(C
, llvm::None
, AssociatedStmt
,
554 /*NumChildren=*/0, StartLoc
,
558 OMPMasterDirective
*OMPMasterDirective::CreateEmpty(const ASTContext
&C
,
560 return createEmptyDirective
<OMPMasterDirective
>(C
, /*NumClauses=*/0,
561 /*HasAssociatedStmt=*/true);
564 OMPCriticalDirective
*OMPCriticalDirective::Create(
565 const ASTContext
&C
, const DeclarationNameInfo
&Name
,
566 SourceLocation StartLoc
, SourceLocation EndLoc
,
567 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
) {
568 return createDirective
<OMPCriticalDirective
>(C
, Clauses
, AssociatedStmt
,
569 /*NumChildren=*/0, Name
,
573 OMPCriticalDirective
*OMPCriticalDirective::CreateEmpty(const ASTContext
&C
,
576 return createEmptyDirective
<OMPCriticalDirective
>(C
, NumClauses
,
577 /*HasAssociatedStmt=*/true);
580 OMPParallelForDirective
*OMPParallelForDirective::Create(
581 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
582 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
583 const HelperExprs
&Exprs
, Expr
*TaskRedRef
, bool HasCancel
) {
584 auto *Dir
= createDirective
<OMPParallelForDirective
>(
585 C
, Clauses
, AssociatedStmt
,
586 numLoopChildren(CollapsedNum
, OMPD_parallel_for
) + 1, StartLoc
, EndLoc
,
588 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
589 Dir
->setLastIteration(Exprs
.LastIteration
);
590 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
591 Dir
->setPreCond(Exprs
.PreCond
);
592 Dir
->setCond(Exprs
.Cond
);
593 Dir
->setInit(Exprs
.Init
);
594 Dir
->setInc(Exprs
.Inc
);
595 Dir
->setIsLastIterVariable(Exprs
.IL
);
596 Dir
->setLowerBoundVariable(Exprs
.LB
);
597 Dir
->setUpperBoundVariable(Exprs
.UB
);
598 Dir
->setStrideVariable(Exprs
.ST
);
599 Dir
->setEnsureUpperBound(Exprs
.EUB
);
600 Dir
->setNextLowerBound(Exprs
.NLB
);
601 Dir
->setNextUpperBound(Exprs
.NUB
);
602 Dir
->setNumIterations(Exprs
.NumIterations
);
603 Dir
->setCounters(Exprs
.Counters
);
604 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
605 Dir
->setInits(Exprs
.Inits
);
606 Dir
->setUpdates(Exprs
.Updates
);
607 Dir
->setFinals(Exprs
.Finals
);
608 Dir
->setDependentCounters(Exprs
.DependentCounters
);
609 Dir
->setDependentInits(Exprs
.DependentInits
);
610 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
611 Dir
->setPreInits(Exprs
.PreInits
);
612 Dir
->setTaskReductionRefExpr(TaskRedRef
);
613 Dir
->setHasCancel(HasCancel
);
617 OMPParallelForDirective
*
618 OMPParallelForDirective::CreateEmpty(const ASTContext
&C
, unsigned NumClauses
,
619 unsigned CollapsedNum
, EmptyShell
) {
620 return createEmptyDirective
<OMPParallelForDirective
>(
621 C
, NumClauses
, /*HasAssociatedStmt=*/true,
622 numLoopChildren(CollapsedNum
, OMPD_parallel_for
) + 1, CollapsedNum
);
625 OMPParallelForSimdDirective
*OMPParallelForSimdDirective::Create(
626 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
627 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
628 const HelperExprs
&Exprs
) {
629 auto *Dir
= createDirective
<OMPParallelForSimdDirective
>(
630 C
, Clauses
, AssociatedStmt
,
631 numLoopChildren(CollapsedNum
, OMPD_parallel_for_simd
), StartLoc
, EndLoc
,
633 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
634 Dir
->setLastIteration(Exprs
.LastIteration
);
635 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
636 Dir
->setPreCond(Exprs
.PreCond
);
637 Dir
->setCond(Exprs
.Cond
);
638 Dir
->setInit(Exprs
.Init
);
639 Dir
->setInc(Exprs
.Inc
);
640 Dir
->setIsLastIterVariable(Exprs
.IL
);
641 Dir
->setLowerBoundVariable(Exprs
.LB
);
642 Dir
->setUpperBoundVariable(Exprs
.UB
);
643 Dir
->setStrideVariable(Exprs
.ST
);
644 Dir
->setEnsureUpperBound(Exprs
.EUB
);
645 Dir
->setNextLowerBound(Exprs
.NLB
);
646 Dir
->setNextUpperBound(Exprs
.NUB
);
647 Dir
->setNumIterations(Exprs
.NumIterations
);
648 Dir
->setCounters(Exprs
.Counters
);
649 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
650 Dir
->setInits(Exprs
.Inits
);
651 Dir
->setUpdates(Exprs
.Updates
);
652 Dir
->setFinals(Exprs
.Finals
);
653 Dir
->setDependentCounters(Exprs
.DependentCounters
);
654 Dir
->setDependentInits(Exprs
.DependentInits
);
655 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
656 Dir
->setPreInits(Exprs
.PreInits
);
660 OMPParallelForSimdDirective
*
661 OMPParallelForSimdDirective::CreateEmpty(const ASTContext
&C
,
663 unsigned CollapsedNum
, EmptyShell
) {
664 return createEmptyDirective
<OMPParallelForSimdDirective
>(
665 C
, NumClauses
, /*HasAssociatedStmt=*/true,
666 numLoopChildren(CollapsedNum
, OMPD_parallel_for_simd
), CollapsedNum
);
669 OMPParallelMasterDirective
*OMPParallelMasterDirective::Create(
670 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
671 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
, Expr
*TaskRedRef
) {
672 auto *Dir
= createDirective
<OMPParallelMasterDirective
>(
673 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/1, StartLoc
, EndLoc
);
674 Dir
->setTaskReductionRefExpr(TaskRedRef
);
678 OMPParallelMasterDirective
*
679 OMPParallelMasterDirective::CreateEmpty(const ASTContext
&C
,
680 unsigned NumClauses
, EmptyShell
) {
681 return createEmptyDirective
<OMPParallelMasterDirective
>(
682 C
, NumClauses
, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
685 OMPParallelMaskedDirective
*OMPParallelMaskedDirective::Create(
686 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
687 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
, Expr
*TaskRedRef
) {
688 auto *Dir
= createDirective
<OMPParallelMaskedDirective
>(
689 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/1, StartLoc
, EndLoc
);
690 Dir
->setTaskReductionRefExpr(TaskRedRef
);
694 OMPParallelMaskedDirective
*
695 OMPParallelMaskedDirective::CreateEmpty(const ASTContext
&C
,
696 unsigned NumClauses
, EmptyShell
) {
697 return createEmptyDirective
<OMPParallelMaskedDirective
>(
698 C
, NumClauses
, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
701 OMPParallelSectionsDirective
*OMPParallelSectionsDirective::Create(
702 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
703 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
, Expr
*TaskRedRef
,
705 auto *Dir
= createDirective
<OMPParallelSectionsDirective
>(
706 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/1, StartLoc
, EndLoc
);
707 Dir
->setTaskReductionRefExpr(TaskRedRef
);
708 Dir
->setHasCancel(HasCancel
);
712 OMPParallelSectionsDirective
*
713 OMPParallelSectionsDirective::CreateEmpty(const ASTContext
&C
,
714 unsigned NumClauses
, EmptyShell
) {
715 return createEmptyDirective
<OMPParallelSectionsDirective
>(
716 C
, NumClauses
, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
720 OMPTaskDirective::Create(const ASTContext
&C
, SourceLocation StartLoc
,
721 SourceLocation EndLoc
, ArrayRef
<OMPClause
*> Clauses
,
722 Stmt
*AssociatedStmt
, bool HasCancel
) {
723 auto *Dir
= createDirective
<OMPTaskDirective
>(
724 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/0, StartLoc
, EndLoc
);
725 Dir
->setHasCancel(HasCancel
);
729 OMPTaskDirective
*OMPTaskDirective::CreateEmpty(const ASTContext
&C
,
732 return createEmptyDirective
<OMPTaskDirective
>(C
, NumClauses
,
733 /*HasAssociatedStmt=*/true);
736 OMPTaskyieldDirective
*OMPTaskyieldDirective::Create(const ASTContext
&C
,
737 SourceLocation StartLoc
,
738 SourceLocation EndLoc
) {
739 return new (C
) OMPTaskyieldDirective(StartLoc
, EndLoc
);
742 OMPTaskyieldDirective
*OMPTaskyieldDirective::CreateEmpty(const ASTContext
&C
,
744 return new (C
) OMPTaskyieldDirective();
747 OMPBarrierDirective
*OMPBarrierDirective::Create(const ASTContext
&C
,
748 SourceLocation StartLoc
,
749 SourceLocation EndLoc
) {
750 return new (C
) OMPBarrierDirective(StartLoc
, EndLoc
);
753 OMPBarrierDirective
*OMPBarrierDirective::CreateEmpty(const ASTContext
&C
,
755 return new (C
) OMPBarrierDirective();
758 OMPTaskwaitDirective
*
759 OMPTaskwaitDirective::Create(const ASTContext
&C
, SourceLocation StartLoc
,
760 SourceLocation EndLoc
,
761 ArrayRef
<OMPClause
*> Clauses
) {
762 return createDirective
<OMPTaskwaitDirective
>(
763 C
, Clauses
, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc
,
767 OMPTaskwaitDirective
*OMPTaskwaitDirective::CreateEmpty(const ASTContext
&C
,
770 return createEmptyDirective
<OMPTaskwaitDirective
>(C
, NumClauses
);
773 OMPTaskgroupDirective
*OMPTaskgroupDirective::Create(
774 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
775 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
, Expr
*ReductionRef
) {
776 auto *Dir
= createDirective
<OMPTaskgroupDirective
>(
777 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/1, StartLoc
, EndLoc
);
778 Dir
->setReductionRef(ReductionRef
);
782 OMPTaskgroupDirective
*OMPTaskgroupDirective::CreateEmpty(const ASTContext
&C
,
785 return createEmptyDirective
<OMPTaskgroupDirective
>(
786 C
, NumClauses
, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
789 OMPCancellationPointDirective
*OMPCancellationPointDirective::Create(
790 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
791 OpenMPDirectiveKind CancelRegion
) {
792 auto *Dir
= new (C
) OMPCancellationPointDirective(StartLoc
, EndLoc
);
793 Dir
->setCancelRegion(CancelRegion
);
797 OMPCancellationPointDirective
*
798 OMPCancellationPointDirective::CreateEmpty(const ASTContext
&C
, EmptyShell
) {
799 return new (C
) OMPCancellationPointDirective();
803 OMPCancelDirective::Create(const ASTContext
&C
, SourceLocation StartLoc
,
804 SourceLocation EndLoc
, ArrayRef
<OMPClause
*> Clauses
,
805 OpenMPDirectiveKind CancelRegion
) {
806 auto *Dir
= createDirective
<OMPCancelDirective
>(
807 C
, Clauses
, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc
,
809 Dir
->setCancelRegion(CancelRegion
);
813 OMPCancelDirective
*OMPCancelDirective::CreateEmpty(const ASTContext
&C
,
816 return createEmptyDirective
<OMPCancelDirective
>(C
, NumClauses
);
819 OMPFlushDirective
*OMPFlushDirective::Create(const ASTContext
&C
,
820 SourceLocation StartLoc
,
821 SourceLocation EndLoc
,
822 ArrayRef
<OMPClause
*> Clauses
) {
823 return createDirective
<OMPFlushDirective
>(
824 C
, Clauses
, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc
,
828 OMPFlushDirective
*OMPFlushDirective::CreateEmpty(const ASTContext
&C
,
831 return createEmptyDirective
<OMPFlushDirective
>(C
, NumClauses
);
834 OMPDepobjDirective
*OMPDepobjDirective::Create(const ASTContext
&C
,
835 SourceLocation StartLoc
,
836 SourceLocation EndLoc
,
837 ArrayRef
<OMPClause
*> Clauses
) {
838 return createDirective
<OMPDepobjDirective
>(
839 C
, Clauses
, /*AssociatedStmt=*/nullptr,
840 /*NumChildren=*/0, StartLoc
, EndLoc
);
843 OMPDepobjDirective
*OMPDepobjDirective::CreateEmpty(const ASTContext
&C
,
846 return createEmptyDirective
<OMPDepobjDirective
>(C
, NumClauses
);
849 OMPScanDirective
*OMPScanDirective::Create(const ASTContext
&C
,
850 SourceLocation StartLoc
,
851 SourceLocation EndLoc
,
852 ArrayRef
<OMPClause
*> Clauses
) {
853 return createDirective
<OMPScanDirective
>(C
, Clauses
,
854 /*AssociatedStmt=*/nullptr,
855 /*NumChildren=*/0, StartLoc
, EndLoc
);
858 OMPScanDirective
*OMPScanDirective::CreateEmpty(const ASTContext
&C
,
861 return createEmptyDirective
<OMPScanDirective
>(C
, NumClauses
);
864 OMPOrderedDirective
*OMPOrderedDirective::Create(const ASTContext
&C
,
865 SourceLocation StartLoc
,
866 SourceLocation EndLoc
,
867 ArrayRef
<OMPClause
*> Clauses
,
868 Stmt
*AssociatedStmt
) {
869 return createDirective
<OMPOrderedDirective
>(
870 C
, Clauses
, cast_or_null
<CapturedStmt
>(AssociatedStmt
),
871 /*NumChildren=*/0, StartLoc
, EndLoc
);
874 OMPOrderedDirective
*OMPOrderedDirective::CreateEmpty(const ASTContext
&C
,
878 return createEmptyDirective
<OMPOrderedDirective
>(C
, NumClauses
,
883 OMPAtomicDirective::Create(const ASTContext
&C
, SourceLocation StartLoc
,
884 SourceLocation EndLoc
, ArrayRef
<OMPClause
*> Clauses
,
885 Stmt
*AssociatedStmt
, Expressions Exprs
) {
886 auto *Dir
= createDirective
<OMPAtomicDirective
>(
887 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/7, StartLoc
, EndLoc
);
891 Dir
->setExpr(Exprs
.E
);
892 Dir
->setUpdateExpr(Exprs
.UE
);
894 Dir
->setCond(Exprs
.Cond
);
895 Dir
->Flags
.IsXLHSInRHSPart
= Exprs
.IsXLHSInRHSPart
? 1 : 0;
896 Dir
->Flags
.IsPostfixUpdate
= Exprs
.IsPostfixUpdate
? 1 : 0;
897 Dir
->Flags
.IsFailOnly
= Exprs
.IsFailOnly
? 1 : 0;
901 OMPAtomicDirective
*OMPAtomicDirective::CreateEmpty(const ASTContext
&C
,
904 return createEmptyDirective
<OMPAtomicDirective
>(
905 C
, NumClauses
, /*HasAssociatedStmt=*/true, /*NumChildren=*/7);
908 OMPTargetDirective
*OMPTargetDirective::Create(const ASTContext
&C
,
909 SourceLocation StartLoc
,
910 SourceLocation EndLoc
,
911 ArrayRef
<OMPClause
*> Clauses
,
912 Stmt
*AssociatedStmt
) {
913 return createDirective
<OMPTargetDirective
>(
914 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/0, StartLoc
, EndLoc
);
917 OMPTargetDirective
*OMPTargetDirective::CreateEmpty(const ASTContext
&C
,
920 return createEmptyDirective
<OMPTargetDirective
>(C
, NumClauses
,
921 /*HasAssociatedStmt=*/true);
924 OMPTargetParallelDirective
*OMPTargetParallelDirective::Create(
925 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
926 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
, Expr
*TaskRedRef
,
928 auto *Dir
= createDirective
<OMPTargetParallelDirective
>(
929 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/1, StartLoc
, EndLoc
);
930 Dir
->setTaskReductionRefExpr(TaskRedRef
);
931 Dir
->setHasCancel(HasCancel
);
935 OMPTargetParallelDirective
*
936 OMPTargetParallelDirective::CreateEmpty(const ASTContext
&C
,
937 unsigned NumClauses
, EmptyShell
) {
938 return createEmptyDirective
<OMPTargetParallelDirective
>(
939 C
, NumClauses
, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
942 OMPTargetParallelForDirective
*OMPTargetParallelForDirective::Create(
943 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
944 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
945 const HelperExprs
&Exprs
, Expr
*TaskRedRef
, bool HasCancel
) {
946 auto *Dir
= createDirective
<OMPTargetParallelForDirective
>(
947 C
, Clauses
, AssociatedStmt
,
948 numLoopChildren(CollapsedNum
, OMPD_target_parallel_for
) + 1, StartLoc
,
949 EndLoc
, CollapsedNum
);
950 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
951 Dir
->setLastIteration(Exprs
.LastIteration
);
952 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
953 Dir
->setPreCond(Exprs
.PreCond
);
954 Dir
->setCond(Exprs
.Cond
);
955 Dir
->setInit(Exprs
.Init
);
956 Dir
->setInc(Exprs
.Inc
);
957 Dir
->setIsLastIterVariable(Exprs
.IL
);
958 Dir
->setLowerBoundVariable(Exprs
.LB
);
959 Dir
->setUpperBoundVariable(Exprs
.UB
);
960 Dir
->setStrideVariable(Exprs
.ST
);
961 Dir
->setEnsureUpperBound(Exprs
.EUB
);
962 Dir
->setNextLowerBound(Exprs
.NLB
);
963 Dir
->setNextUpperBound(Exprs
.NUB
);
964 Dir
->setNumIterations(Exprs
.NumIterations
);
965 Dir
->setCounters(Exprs
.Counters
);
966 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
967 Dir
->setInits(Exprs
.Inits
);
968 Dir
->setUpdates(Exprs
.Updates
);
969 Dir
->setFinals(Exprs
.Finals
);
970 Dir
->setDependentCounters(Exprs
.DependentCounters
);
971 Dir
->setDependentInits(Exprs
.DependentInits
);
972 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
973 Dir
->setPreInits(Exprs
.PreInits
);
974 Dir
->setTaskReductionRefExpr(TaskRedRef
);
975 Dir
->setHasCancel(HasCancel
);
979 OMPTargetParallelForDirective
*
980 OMPTargetParallelForDirective::CreateEmpty(const ASTContext
&C
,
982 unsigned CollapsedNum
, EmptyShell
) {
983 return createEmptyDirective
<OMPTargetParallelForDirective
>(
984 C
, NumClauses
, /*HasAssociatedStmt=*/true,
985 numLoopChildren(CollapsedNum
, OMPD_target_parallel_for
) + 1,
989 OMPTargetDataDirective
*OMPTargetDataDirective::Create(
990 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
991 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
) {
992 return createDirective
<OMPTargetDataDirective
>(
993 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/0, StartLoc
, EndLoc
);
996 OMPTargetDataDirective
*OMPTargetDataDirective::CreateEmpty(const ASTContext
&C
,
999 return createEmptyDirective
<OMPTargetDataDirective
>(
1000 C
, N
, /*HasAssociatedStmt=*/true);
1003 OMPTargetEnterDataDirective
*OMPTargetEnterDataDirective::Create(
1004 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1005 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
) {
1006 return createDirective
<OMPTargetEnterDataDirective
>(
1007 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/0, StartLoc
, EndLoc
);
1010 OMPTargetEnterDataDirective
*
1011 OMPTargetEnterDataDirective::CreateEmpty(const ASTContext
&C
, unsigned N
,
1013 return createEmptyDirective
<OMPTargetEnterDataDirective
>(
1014 C
, N
, /*HasAssociatedStmt=*/true);
1017 OMPTargetExitDataDirective
*OMPTargetExitDataDirective::Create(
1018 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1019 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
) {
1020 return createDirective
<OMPTargetExitDataDirective
>(
1021 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/0, StartLoc
, EndLoc
);
1024 OMPTargetExitDataDirective
*
1025 OMPTargetExitDataDirective::CreateEmpty(const ASTContext
&C
, unsigned N
,
1027 return createEmptyDirective
<OMPTargetExitDataDirective
>(
1028 C
, N
, /*HasAssociatedStmt=*/true);
1031 OMPTeamsDirective
*OMPTeamsDirective::Create(const ASTContext
&C
,
1032 SourceLocation StartLoc
,
1033 SourceLocation EndLoc
,
1034 ArrayRef
<OMPClause
*> Clauses
,
1035 Stmt
*AssociatedStmt
) {
1036 return createDirective
<OMPTeamsDirective
>(
1037 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/0, StartLoc
, EndLoc
);
1040 OMPTeamsDirective
*OMPTeamsDirective::CreateEmpty(const ASTContext
&C
,
1041 unsigned NumClauses
,
1043 return createEmptyDirective
<OMPTeamsDirective
>(C
, NumClauses
,
1044 /*HasAssociatedStmt=*/true);
1047 OMPTaskLoopDirective
*OMPTaskLoopDirective::Create(
1048 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1049 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1050 const HelperExprs
&Exprs
, bool HasCancel
) {
1051 auto *Dir
= createDirective
<OMPTaskLoopDirective
>(
1052 C
, Clauses
, AssociatedStmt
, numLoopChildren(CollapsedNum
, OMPD_taskloop
),
1053 StartLoc
, EndLoc
, CollapsedNum
);
1054 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1055 Dir
->setLastIteration(Exprs
.LastIteration
);
1056 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1057 Dir
->setPreCond(Exprs
.PreCond
);
1058 Dir
->setCond(Exprs
.Cond
);
1059 Dir
->setInit(Exprs
.Init
);
1060 Dir
->setInc(Exprs
.Inc
);
1061 Dir
->setIsLastIterVariable(Exprs
.IL
);
1062 Dir
->setLowerBoundVariable(Exprs
.LB
);
1063 Dir
->setUpperBoundVariable(Exprs
.UB
);
1064 Dir
->setStrideVariable(Exprs
.ST
);
1065 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1066 Dir
->setNextLowerBound(Exprs
.NLB
);
1067 Dir
->setNextUpperBound(Exprs
.NUB
);
1068 Dir
->setNumIterations(Exprs
.NumIterations
);
1069 Dir
->setCounters(Exprs
.Counters
);
1070 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1071 Dir
->setInits(Exprs
.Inits
);
1072 Dir
->setUpdates(Exprs
.Updates
);
1073 Dir
->setFinals(Exprs
.Finals
);
1074 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1075 Dir
->setDependentInits(Exprs
.DependentInits
);
1076 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1077 Dir
->setPreInits(Exprs
.PreInits
);
1078 Dir
->setHasCancel(HasCancel
);
1082 OMPTaskLoopDirective
*OMPTaskLoopDirective::CreateEmpty(const ASTContext
&C
,
1083 unsigned NumClauses
,
1084 unsigned CollapsedNum
,
1086 return createEmptyDirective
<OMPTaskLoopDirective
>(
1087 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1088 numLoopChildren(CollapsedNum
, OMPD_taskloop
), CollapsedNum
);
1091 OMPTaskLoopSimdDirective
*OMPTaskLoopSimdDirective::Create(
1092 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1093 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1094 const HelperExprs
&Exprs
) {
1095 auto *Dir
= createDirective
<OMPTaskLoopSimdDirective
>(
1096 C
, Clauses
, AssociatedStmt
,
1097 numLoopChildren(CollapsedNum
, OMPD_taskloop_simd
), StartLoc
, EndLoc
,
1099 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1100 Dir
->setLastIteration(Exprs
.LastIteration
);
1101 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1102 Dir
->setPreCond(Exprs
.PreCond
);
1103 Dir
->setCond(Exprs
.Cond
);
1104 Dir
->setInit(Exprs
.Init
);
1105 Dir
->setInc(Exprs
.Inc
);
1106 Dir
->setIsLastIterVariable(Exprs
.IL
);
1107 Dir
->setLowerBoundVariable(Exprs
.LB
);
1108 Dir
->setUpperBoundVariable(Exprs
.UB
);
1109 Dir
->setStrideVariable(Exprs
.ST
);
1110 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1111 Dir
->setNextLowerBound(Exprs
.NLB
);
1112 Dir
->setNextUpperBound(Exprs
.NUB
);
1113 Dir
->setNumIterations(Exprs
.NumIterations
);
1114 Dir
->setCounters(Exprs
.Counters
);
1115 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1116 Dir
->setInits(Exprs
.Inits
);
1117 Dir
->setUpdates(Exprs
.Updates
);
1118 Dir
->setFinals(Exprs
.Finals
);
1119 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1120 Dir
->setDependentInits(Exprs
.DependentInits
);
1121 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1122 Dir
->setPreInits(Exprs
.PreInits
);
1126 OMPTaskLoopSimdDirective
*
1127 OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext
&C
, unsigned NumClauses
,
1128 unsigned CollapsedNum
, EmptyShell
) {
1129 return createEmptyDirective
<OMPTaskLoopSimdDirective
>(
1130 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1131 numLoopChildren(CollapsedNum
, OMPD_taskloop_simd
), CollapsedNum
);
1134 OMPMasterTaskLoopDirective
*OMPMasterTaskLoopDirective::Create(
1135 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1136 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1137 const HelperExprs
&Exprs
, bool HasCancel
) {
1138 auto *Dir
= createDirective
<OMPMasterTaskLoopDirective
>(
1139 C
, Clauses
, AssociatedStmt
,
1140 numLoopChildren(CollapsedNum
, OMPD_master_taskloop
), StartLoc
, EndLoc
,
1142 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1143 Dir
->setLastIteration(Exprs
.LastIteration
);
1144 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1145 Dir
->setPreCond(Exprs
.PreCond
);
1146 Dir
->setCond(Exprs
.Cond
);
1147 Dir
->setInit(Exprs
.Init
);
1148 Dir
->setInc(Exprs
.Inc
);
1149 Dir
->setIsLastIterVariable(Exprs
.IL
);
1150 Dir
->setLowerBoundVariable(Exprs
.LB
);
1151 Dir
->setUpperBoundVariable(Exprs
.UB
);
1152 Dir
->setStrideVariable(Exprs
.ST
);
1153 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1154 Dir
->setNextLowerBound(Exprs
.NLB
);
1155 Dir
->setNextUpperBound(Exprs
.NUB
);
1156 Dir
->setNumIterations(Exprs
.NumIterations
);
1157 Dir
->setCounters(Exprs
.Counters
);
1158 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1159 Dir
->setInits(Exprs
.Inits
);
1160 Dir
->setUpdates(Exprs
.Updates
);
1161 Dir
->setFinals(Exprs
.Finals
);
1162 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1163 Dir
->setDependentInits(Exprs
.DependentInits
);
1164 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1165 Dir
->setPreInits(Exprs
.PreInits
);
1166 Dir
->setHasCancel(HasCancel
);
1170 OMPMasterTaskLoopDirective
*
1171 OMPMasterTaskLoopDirective::CreateEmpty(const ASTContext
&C
,
1172 unsigned NumClauses
,
1173 unsigned CollapsedNum
, EmptyShell
) {
1174 return createEmptyDirective
<OMPMasterTaskLoopDirective
>(
1175 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1176 numLoopChildren(CollapsedNum
, OMPD_master_taskloop
), CollapsedNum
);
1179 OMPMaskedTaskLoopDirective
*OMPMaskedTaskLoopDirective::Create(
1180 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1181 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1182 const HelperExprs
&Exprs
, bool HasCancel
) {
1183 auto *Dir
= createDirective
<OMPMaskedTaskLoopDirective
>(
1184 C
, Clauses
, AssociatedStmt
,
1185 numLoopChildren(CollapsedNum
, OMPD_masked_taskloop
), StartLoc
, EndLoc
,
1187 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1188 Dir
->setLastIteration(Exprs
.LastIteration
);
1189 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1190 Dir
->setPreCond(Exprs
.PreCond
);
1191 Dir
->setCond(Exprs
.Cond
);
1192 Dir
->setInit(Exprs
.Init
);
1193 Dir
->setInc(Exprs
.Inc
);
1194 Dir
->setIsLastIterVariable(Exprs
.IL
);
1195 Dir
->setLowerBoundVariable(Exprs
.LB
);
1196 Dir
->setUpperBoundVariable(Exprs
.UB
);
1197 Dir
->setStrideVariable(Exprs
.ST
);
1198 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1199 Dir
->setNextLowerBound(Exprs
.NLB
);
1200 Dir
->setNextUpperBound(Exprs
.NUB
);
1201 Dir
->setNumIterations(Exprs
.NumIterations
);
1202 Dir
->setCounters(Exprs
.Counters
);
1203 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1204 Dir
->setInits(Exprs
.Inits
);
1205 Dir
->setUpdates(Exprs
.Updates
);
1206 Dir
->setFinals(Exprs
.Finals
);
1207 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1208 Dir
->setDependentInits(Exprs
.DependentInits
);
1209 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1210 Dir
->setPreInits(Exprs
.PreInits
);
1211 Dir
->setHasCancel(HasCancel
);
1215 OMPMaskedTaskLoopDirective
*
1216 OMPMaskedTaskLoopDirective::CreateEmpty(const ASTContext
&C
,
1217 unsigned NumClauses
,
1218 unsigned CollapsedNum
, EmptyShell
) {
1219 return createEmptyDirective
<OMPMaskedTaskLoopDirective
>(
1220 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1221 numLoopChildren(CollapsedNum
, OMPD_masked_taskloop
), CollapsedNum
);
1224 OMPMasterTaskLoopSimdDirective
*OMPMasterTaskLoopSimdDirective::Create(
1225 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1226 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1227 const HelperExprs
&Exprs
) {
1228 auto *Dir
= createDirective
<OMPMasterTaskLoopSimdDirective
>(
1229 C
, Clauses
, AssociatedStmt
,
1230 numLoopChildren(CollapsedNum
, OMPD_master_taskloop_simd
), StartLoc
,
1231 EndLoc
, CollapsedNum
);
1232 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1233 Dir
->setLastIteration(Exprs
.LastIteration
);
1234 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1235 Dir
->setPreCond(Exprs
.PreCond
);
1236 Dir
->setCond(Exprs
.Cond
);
1237 Dir
->setInit(Exprs
.Init
);
1238 Dir
->setInc(Exprs
.Inc
);
1239 Dir
->setIsLastIterVariable(Exprs
.IL
);
1240 Dir
->setLowerBoundVariable(Exprs
.LB
);
1241 Dir
->setUpperBoundVariable(Exprs
.UB
);
1242 Dir
->setStrideVariable(Exprs
.ST
);
1243 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1244 Dir
->setNextLowerBound(Exprs
.NLB
);
1245 Dir
->setNextUpperBound(Exprs
.NUB
);
1246 Dir
->setNumIterations(Exprs
.NumIterations
);
1247 Dir
->setCounters(Exprs
.Counters
);
1248 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1249 Dir
->setInits(Exprs
.Inits
);
1250 Dir
->setUpdates(Exprs
.Updates
);
1251 Dir
->setFinals(Exprs
.Finals
);
1252 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1253 Dir
->setDependentInits(Exprs
.DependentInits
);
1254 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1255 Dir
->setPreInits(Exprs
.PreInits
);
1259 OMPMasterTaskLoopSimdDirective
*
1260 OMPMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext
&C
,
1261 unsigned NumClauses
,
1262 unsigned CollapsedNum
, EmptyShell
) {
1263 return createEmptyDirective
<OMPMasterTaskLoopSimdDirective
>(
1264 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1265 numLoopChildren(CollapsedNum
, OMPD_master_taskloop_simd
), CollapsedNum
);
1268 OMPMaskedTaskLoopSimdDirective
*OMPMaskedTaskLoopSimdDirective::Create(
1269 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1270 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1271 const HelperExprs
&Exprs
) {
1272 auto *Dir
= createDirective
<OMPMaskedTaskLoopSimdDirective
>(
1273 C
, Clauses
, AssociatedStmt
,
1274 numLoopChildren(CollapsedNum
, OMPD_masked_taskloop_simd
), StartLoc
,
1275 EndLoc
, CollapsedNum
);
1276 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1277 Dir
->setLastIteration(Exprs
.LastIteration
);
1278 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1279 Dir
->setPreCond(Exprs
.PreCond
);
1280 Dir
->setCond(Exprs
.Cond
);
1281 Dir
->setInit(Exprs
.Init
);
1282 Dir
->setInc(Exprs
.Inc
);
1283 Dir
->setIsLastIterVariable(Exprs
.IL
);
1284 Dir
->setLowerBoundVariable(Exprs
.LB
);
1285 Dir
->setUpperBoundVariable(Exprs
.UB
);
1286 Dir
->setStrideVariable(Exprs
.ST
);
1287 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1288 Dir
->setNextLowerBound(Exprs
.NLB
);
1289 Dir
->setNextUpperBound(Exprs
.NUB
);
1290 Dir
->setNumIterations(Exprs
.NumIterations
);
1291 Dir
->setCounters(Exprs
.Counters
);
1292 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1293 Dir
->setInits(Exprs
.Inits
);
1294 Dir
->setUpdates(Exprs
.Updates
);
1295 Dir
->setFinals(Exprs
.Finals
);
1296 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1297 Dir
->setDependentInits(Exprs
.DependentInits
);
1298 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1299 Dir
->setPreInits(Exprs
.PreInits
);
1303 OMPMaskedTaskLoopSimdDirective
*
1304 OMPMaskedTaskLoopSimdDirective::CreateEmpty(const ASTContext
&C
,
1305 unsigned NumClauses
,
1306 unsigned CollapsedNum
, EmptyShell
) {
1307 return createEmptyDirective
<OMPMaskedTaskLoopSimdDirective
>(
1308 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1309 numLoopChildren(CollapsedNum
, OMPD_masked_taskloop_simd
), CollapsedNum
);
1312 OMPParallelMasterTaskLoopDirective
*OMPParallelMasterTaskLoopDirective::Create(
1313 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1314 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1315 const HelperExprs
&Exprs
, bool HasCancel
) {
1316 auto *Dir
= createDirective
<OMPParallelMasterTaskLoopDirective
>(
1317 C
, Clauses
, AssociatedStmt
,
1318 numLoopChildren(CollapsedNum
, OMPD_parallel_master_taskloop
), StartLoc
,
1319 EndLoc
, CollapsedNum
);
1320 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1321 Dir
->setLastIteration(Exprs
.LastIteration
);
1322 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1323 Dir
->setPreCond(Exprs
.PreCond
);
1324 Dir
->setCond(Exprs
.Cond
);
1325 Dir
->setInit(Exprs
.Init
);
1326 Dir
->setInc(Exprs
.Inc
);
1327 Dir
->setIsLastIterVariable(Exprs
.IL
);
1328 Dir
->setLowerBoundVariable(Exprs
.LB
);
1329 Dir
->setUpperBoundVariable(Exprs
.UB
);
1330 Dir
->setStrideVariable(Exprs
.ST
);
1331 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1332 Dir
->setNextLowerBound(Exprs
.NLB
);
1333 Dir
->setNextUpperBound(Exprs
.NUB
);
1334 Dir
->setNumIterations(Exprs
.NumIterations
);
1335 Dir
->setCounters(Exprs
.Counters
);
1336 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1337 Dir
->setInits(Exprs
.Inits
);
1338 Dir
->setUpdates(Exprs
.Updates
);
1339 Dir
->setFinals(Exprs
.Finals
);
1340 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1341 Dir
->setDependentInits(Exprs
.DependentInits
);
1342 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1343 Dir
->setPreInits(Exprs
.PreInits
);
1344 Dir
->setHasCancel(HasCancel
);
1348 OMPParallelMasterTaskLoopDirective
*
1349 OMPParallelMasterTaskLoopDirective::CreateEmpty(const ASTContext
&C
,
1350 unsigned NumClauses
,
1351 unsigned CollapsedNum
,
1353 return createEmptyDirective
<OMPParallelMasterTaskLoopDirective
>(
1354 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1355 numLoopChildren(CollapsedNum
, OMPD_parallel_master_taskloop
),
1359 OMPParallelMaskedTaskLoopDirective
*OMPParallelMaskedTaskLoopDirective::Create(
1360 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1361 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1362 const HelperExprs
&Exprs
, bool HasCancel
) {
1363 auto *Dir
= createDirective
<OMPParallelMaskedTaskLoopDirective
>(
1364 C
, Clauses
, AssociatedStmt
,
1365 numLoopChildren(CollapsedNum
, OMPD_parallel_masked_taskloop
), StartLoc
,
1366 EndLoc
, CollapsedNum
);
1367 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1368 Dir
->setLastIteration(Exprs
.LastIteration
);
1369 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1370 Dir
->setPreCond(Exprs
.PreCond
);
1371 Dir
->setCond(Exprs
.Cond
);
1372 Dir
->setInit(Exprs
.Init
);
1373 Dir
->setInc(Exprs
.Inc
);
1374 Dir
->setIsLastIterVariable(Exprs
.IL
);
1375 Dir
->setLowerBoundVariable(Exprs
.LB
);
1376 Dir
->setUpperBoundVariable(Exprs
.UB
);
1377 Dir
->setStrideVariable(Exprs
.ST
);
1378 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1379 Dir
->setNextLowerBound(Exprs
.NLB
);
1380 Dir
->setNextUpperBound(Exprs
.NUB
);
1381 Dir
->setNumIterations(Exprs
.NumIterations
);
1382 Dir
->setCounters(Exprs
.Counters
);
1383 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1384 Dir
->setInits(Exprs
.Inits
);
1385 Dir
->setUpdates(Exprs
.Updates
);
1386 Dir
->setFinals(Exprs
.Finals
);
1387 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1388 Dir
->setDependentInits(Exprs
.DependentInits
);
1389 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1390 Dir
->setPreInits(Exprs
.PreInits
);
1391 Dir
->setHasCancel(HasCancel
);
1395 OMPParallelMaskedTaskLoopDirective
*
1396 OMPParallelMaskedTaskLoopDirective::CreateEmpty(const ASTContext
&C
,
1397 unsigned NumClauses
,
1398 unsigned CollapsedNum
,
1400 return createEmptyDirective
<OMPParallelMaskedTaskLoopDirective
>(
1401 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1402 numLoopChildren(CollapsedNum
, OMPD_parallel_masked_taskloop
),
1406 OMPParallelMasterTaskLoopSimdDirective
*
1407 OMPParallelMasterTaskLoopSimdDirective::Create(
1408 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1409 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1410 const HelperExprs
&Exprs
) {
1411 auto *Dir
= createDirective
<OMPParallelMasterTaskLoopSimdDirective
>(
1412 C
, Clauses
, AssociatedStmt
,
1413 numLoopChildren(CollapsedNum
, OMPD_parallel_master_taskloop_simd
),
1414 StartLoc
, EndLoc
, CollapsedNum
);
1415 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1416 Dir
->setLastIteration(Exprs
.LastIteration
);
1417 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1418 Dir
->setPreCond(Exprs
.PreCond
);
1419 Dir
->setCond(Exprs
.Cond
);
1420 Dir
->setInit(Exprs
.Init
);
1421 Dir
->setInc(Exprs
.Inc
);
1422 Dir
->setIsLastIterVariable(Exprs
.IL
);
1423 Dir
->setLowerBoundVariable(Exprs
.LB
);
1424 Dir
->setUpperBoundVariable(Exprs
.UB
);
1425 Dir
->setStrideVariable(Exprs
.ST
);
1426 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1427 Dir
->setNextLowerBound(Exprs
.NLB
);
1428 Dir
->setNextUpperBound(Exprs
.NUB
);
1429 Dir
->setNumIterations(Exprs
.NumIterations
);
1430 Dir
->setCounters(Exprs
.Counters
);
1431 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1432 Dir
->setInits(Exprs
.Inits
);
1433 Dir
->setUpdates(Exprs
.Updates
);
1434 Dir
->setFinals(Exprs
.Finals
);
1435 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1436 Dir
->setDependentInits(Exprs
.DependentInits
);
1437 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1438 Dir
->setPreInits(Exprs
.PreInits
);
1442 OMPParallelMasterTaskLoopSimdDirective
*
1443 OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext
&C
,
1444 unsigned NumClauses
,
1445 unsigned CollapsedNum
,
1447 return createEmptyDirective
<OMPParallelMasterTaskLoopSimdDirective
>(
1448 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1449 numLoopChildren(CollapsedNum
, OMPD_parallel_master_taskloop_simd
),
1453 OMPParallelMaskedTaskLoopSimdDirective
*
1454 OMPParallelMaskedTaskLoopSimdDirective::Create(
1455 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1456 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1457 const HelperExprs
&Exprs
) {
1458 auto *Dir
= createDirective
<OMPParallelMaskedTaskLoopSimdDirective
>(
1459 C
, Clauses
, AssociatedStmt
,
1460 numLoopChildren(CollapsedNum
, OMPD_parallel_masked_taskloop_simd
),
1461 StartLoc
, EndLoc
, CollapsedNum
);
1462 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1463 Dir
->setLastIteration(Exprs
.LastIteration
);
1464 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1465 Dir
->setPreCond(Exprs
.PreCond
);
1466 Dir
->setCond(Exprs
.Cond
);
1467 Dir
->setInit(Exprs
.Init
);
1468 Dir
->setInc(Exprs
.Inc
);
1469 Dir
->setIsLastIterVariable(Exprs
.IL
);
1470 Dir
->setLowerBoundVariable(Exprs
.LB
);
1471 Dir
->setUpperBoundVariable(Exprs
.UB
);
1472 Dir
->setStrideVariable(Exprs
.ST
);
1473 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1474 Dir
->setNextLowerBound(Exprs
.NLB
);
1475 Dir
->setNextUpperBound(Exprs
.NUB
);
1476 Dir
->setNumIterations(Exprs
.NumIterations
);
1477 Dir
->setCounters(Exprs
.Counters
);
1478 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1479 Dir
->setInits(Exprs
.Inits
);
1480 Dir
->setUpdates(Exprs
.Updates
);
1481 Dir
->setFinals(Exprs
.Finals
);
1482 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1483 Dir
->setDependentInits(Exprs
.DependentInits
);
1484 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1485 Dir
->setPreInits(Exprs
.PreInits
);
1489 OMPParallelMaskedTaskLoopSimdDirective
*
1490 OMPParallelMaskedTaskLoopSimdDirective::CreateEmpty(const ASTContext
&C
,
1491 unsigned NumClauses
,
1492 unsigned CollapsedNum
,
1494 return createEmptyDirective
<OMPParallelMaskedTaskLoopSimdDirective
>(
1495 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1496 numLoopChildren(CollapsedNum
, OMPD_parallel_masked_taskloop_simd
),
1500 OMPDistributeDirective
*OMPDistributeDirective::Create(
1501 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1502 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1503 const HelperExprs
&Exprs
) {
1504 auto *Dir
= createDirective
<OMPDistributeDirective
>(
1505 C
, Clauses
, AssociatedStmt
,
1506 numLoopChildren(CollapsedNum
, OMPD_distribute
), StartLoc
, EndLoc
,
1508 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1509 Dir
->setLastIteration(Exprs
.LastIteration
);
1510 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1511 Dir
->setPreCond(Exprs
.PreCond
);
1512 Dir
->setCond(Exprs
.Cond
);
1513 Dir
->setInit(Exprs
.Init
);
1514 Dir
->setInc(Exprs
.Inc
);
1515 Dir
->setIsLastIterVariable(Exprs
.IL
);
1516 Dir
->setLowerBoundVariable(Exprs
.LB
);
1517 Dir
->setUpperBoundVariable(Exprs
.UB
);
1518 Dir
->setStrideVariable(Exprs
.ST
);
1519 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1520 Dir
->setNextLowerBound(Exprs
.NLB
);
1521 Dir
->setNextUpperBound(Exprs
.NUB
);
1522 Dir
->setNumIterations(Exprs
.NumIterations
);
1523 Dir
->setCounters(Exprs
.Counters
);
1524 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1525 Dir
->setInits(Exprs
.Inits
);
1526 Dir
->setUpdates(Exprs
.Updates
);
1527 Dir
->setFinals(Exprs
.Finals
);
1528 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1529 Dir
->setDependentInits(Exprs
.DependentInits
);
1530 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1531 Dir
->setPreInits(Exprs
.PreInits
);
1535 OMPDistributeDirective
*
1536 OMPDistributeDirective::CreateEmpty(const ASTContext
&C
, unsigned NumClauses
,
1537 unsigned CollapsedNum
, EmptyShell
) {
1538 return createEmptyDirective
<OMPDistributeDirective
>(
1539 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1540 numLoopChildren(CollapsedNum
, OMPD_distribute
), CollapsedNum
);
1543 OMPTargetUpdateDirective
*OMPTargetUpdateDirective::Create(
1544 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1545 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
) {
1546 return createDirective
<OMPTargetUpdateDirective
>(C
, Clauses
, AssociatedStmt
,
1547 /*NumChildren=*/0, StartLoc
,
1551 OMPTargetUpdateDirective
*
1552 OMPTargetUpdateDirective::CreateEmpty(const ASTContext
&C
, unsigned NumClauses
,
1554 return createEmptyDirective
<OMPTargetUpdateDirective
>(
1555 C
, NumClauses
, /*HasAssociatedStmt=*/true);
1558 OMPDistributeParallelForDirective
*OMPDistributeParallelForDirective::Create(
1559 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1560 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1561 const HelperExprs
&Exprs
, Expr
*TaskRedRef
, bool HasCancel
) {
1562 auto *Dir
= createDirective
<OMPDistributeParallelForDirective
>(
1563 C
, Clauses
, AssociatedStmt
,
1564 numLoopChildren(CollapsedNum
, OMPD_distribute_parallel_for
) + 1, StartLoc
,
1565 EndLoc
, CollapsedNum
);
1566 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1567 Dir
->setLastIteration(Exprs
.LastIteration
);
1568 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1569 Dir
->setPreCond(Exprs
.PreCond
);
1570 Dir
->setCond(Exprs
.Cond
);
1571 Dir
->setInit(Exprs
.Init
);
1572 Dir
->setInc(Exprs
.Inc
);
1573 Dir
->setIsLastIterVariable(Exprs
.IL
);
1574 Dir
->setLowerBoundVariable(Exprs
.LB
);
1575 Dir
->setUpperBoundVariable(Exprs
.UB
);
1576 Dir
->setStrideVariable(Exprs
.ST
);
1577 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1578 Dir
->setNextLowerBound(Exprs
.NLB
);
1579 Dir
->setNextUpperBound(Exprs
.NUB
);
1580 Dir
->setNumIterations(Exprs
.NumIterations
);
1581 Dir
->setPrevLowerBoundVariable(Exprs
.PrevLB
);
1582 Dir
->setPrevUpperBoundVariable(Exprs
.PrevUB
);
1583 Dir
->setDistInc(Exprs
.DistInc
);
1584 Dir
->setPrevEnsureUpperBound(Exprs
.PrevEUB
);
1585 Dir
->setCounters(Exprs
.Counters
);
1586 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1587 Dir
->setInits(Exprs
.Inits
);
1588 Dir
->setUpdates(Exprs
.Updates
);
1589 Dir
->setFinals(Exprs
.Finals
);
1590 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1591 Dir
->setDependentInits(Exprs
.DependentInits
);
1592 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1593 Dir
->setPreInits(Exprs
.PreInits
);
1594 Dir
->setCombinedLowerBoundVariable(Exprs
.DistCombinedFields
.LB
);
1595 Dir
->setCombinedUpperBoundVariable(Exprs
.DistCombinedFields
.UB
);
1596 Dir
->setCombinedEnsureUpperBound(Exprs
.DistCombinedFields
.EUB
);
1597 Dir
->setCombinedInit(Exprs
.DistCombinedFields
.Init
);
1598 Dir
->setCombinedCond(Exprs
.DistCombinedFields
.Cond
);
1599 Dir
->setCombinedNextLowerBound(Exprs
.DistCombinedFields
.NLB
);
1600 Dir
->setCombinedNextUpperBound(Exprs
.DistCombinedFields
.NUB
);
1601 Dir
->setCombinedDistCond(Exprs
.DistCombinedFields
.DistCond
);
1602 Dir
->setCombinedParForInDistCond(Exprs
.DistCombinedFields
.ParForInDistCond
);
1603 Dir
->setTaskReductionRefExpr(TaskRedRef
);
1604 Dir
->HasCancel
= HasCancel
;
1608 OMPDistributeParallelForDirective
*
1609 OMPDistributeParallelForDirective::CreateEmpty(const ASTContext
&C
,
1610 unsigned NumClauses
,
1611 unsigned CollapsedNum
,
1613 return createEmptyDirective
<OMPDistributeParallelForDirective
>(
1614 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1615 numLoopChildren(CollapsedNum
, OMPD_distribute_parallel_for
) + 1,
1619 OMPDistributeParallelForSimdDirective
*
1620 OMPDistributeParallelForSimdDirective::Create(
1621 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1622 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1623 const HelperExprs
&Exprs
) {
1624 auto *Dir
= createDirective
<OMPDistributeParallelForSimdDirective
>(
1625 C
, Clauses
, AssociatedStmt
,
1626 numLoopChildren(CollapsedNum
, OMPD_distribute_parallel_for_simd
),
1627 StartLoc
, EndLoc
, CollapsedNum
);
1628 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1629 Dir
->setLastIteration(Exprs
.LastIteration
);
1630 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1631 Dir
->setPreCond(Exprs
.PreCond
);
1632 Dir
->setCond(Exprs
.Cond
);
1633 Dir
->setInit(Exprs
.Init
);
1634 Dir
->setInc(Exprs
.Inc
);
1635 Dir
->setIsLastIterVariable(Exprs
.IL
);
1636 Dir
->setLowerBoundVariable(Exprs
.LB
);
1637 Dir
->setUpperBoundVariable(Exprs
.UB
);
1638 Dir
->setStrideVariable(Exprs
.ST
);
1639 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1640 Dir
->setNextLowerBound(Exprs
.NLB
);
1641 Dir
->setNextUpperBound(Exprs
.NUB
);
1642 Dir
->setNumIterations(Exprs
.NumIterations
);
1643 Dir
->setPrevLowerBoundVariable(Exprs
.PrevLB
);
1644 Dir
->setPrevUpperBoundVariable(Exprs
.PrevUB
);
1645 Dir
->setDistInc(Exprs
.DistInc
);
1646 Dir
->setPrevEnsureUpperBound(Exprs
.PrevEUB
);
1647 Dir
->setCounters(Exprs
.Counters
);
1648 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1649 Dir
->setInits(Exprs
.Inits
);
1650 Dir
->setUpdates(Exprs
.Updates
);
1651 Dir
->setFinals(Exprs
.Finals
);
1652 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1653 Dir
->setDependentInits(Exprs
.DependentInits
);
1654 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1655 Dir
->setPreInits(Exprs
.PreInits
);
1656 Dir
->setCombinedLowerBoundVariable(Exprs
.DistCombinedFields
.LB
);
1657 Dir
->setCombinedUpperBoundVariable(Exprs
.DistCombinedFields
.UB
);
1658 Dir
->setCombinedEnsureUpperBound(Exprs
.DistCombinedFields
.EUB
);
1659 Dir
->setCombinedInit(Exprs
.DistCombinedFields
.Init
);
1660 Dir
->setCombinedCond(Exprs
.DistCombinedFields
.Cond
);
1661 Dir
->setCombinedNextLowerBound(Exprs
.DistCombinedFields
.NLB
);
1662 Dir
->setCombinedNextUpperBound(Exprs
.DistCombinedFields
.NUB
);
1663 Dir
->setCombinedDistCond(Exprs
.DistCombinedFields
.DistCond
);
1664 Dir
->setCombinedParForInDistCond(Exprs
.DistCombinedFields
.ParForInDistCond
);
1668 OMPDistributeParallelForSimdDirective
*
1669 OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext
&C
,
1670 unsigned NumClauses
,
1671 unsigned CollapsedNum
,
1673 return createEmptyDirective
<OMPDistributeParallelForSimdDirective
>(
1674 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1675 numLoopChildren(CollapsedNum
, OMPD_distribute_parallel_for_simd
),
1679 OMPDistributeSimdDirective
*OMPDistributeSimdDirective::Create(
1680 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1681 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1682 const HelperExprs
&Exprs
) {
1683 auto *Dir
= createDirective
<OMPDistributeSimdDirective
>(
1684 C
, Clauses
, AssociatedStmt
,
1685 numLoopChildren(CollapsedNum
, OMPD_distribute_simd
), StartLoc
, EndLoc
,
1687 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1688 Dir
->setLastIteration(Exprs
.LastIteration
);
1689 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1690 Dir
->setPreCond(Exprs
.PreCond
);
1691 Dir
->setCond(Exprs
.Cond
);
1692 Dir
->setInit(Exprs
.Init
);
1693 Dir
->setInc(Exprs
.Inc
);
1694 Dir
->setIsLastIterVariable(Exprs
.IL
);
1695 Dir
->setLowerBoundVariable(Exprs
.LB
);
1696 Dir
->setUpperBoundVariable(Exprs
.UB
);
1697 Dir
->setStrideVariable(Exprs
.ST
);
1698 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1699 Dir
->setNextLowerBound(Exprs
.NLB
);
1700 Dir
->setNextUpperBound(Exprs
.NUB
);
1701 Dir
->setNumIterations(Exprs
.NumIterations
);
1702 Dir
->setCounters(Exprs
.Counters
);
1703 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1704 Dir
->setInits(Exprs
.Inits
);
1705 Dir
->setUpdates(Exprs
.Updates
);
1706 Dir
->setFinals(Exprs
.Finals
);
1707 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1708 Dir
->setDependentInits(Exprs
.DependentInits
);
1709 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1710 Dir
->setPreInits(Exprs
.PreInits
);
1714 OMPDistributeSimdDirective
*
1715 OMPDistributeSimdDirective::CreateEmpty(const ASTContext
&C
,
1716 unsigned NumClauses
,
1717 unsigned CollapsedNum
, EmptyShell
) {
1718 return createEmptyDirective
<OMPDistributeSimdDirective
>(
1719 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1720 numLoopChildren(CollapsedNum
, OMPD_distribute_simd
), CollapsedNum
);
1723 OMPTargetParallelForSimdDirective
*OMPTargetParallelForSimdDirective::Create(
1724 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1725 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1726 const HelperExprs
&Exprs
) {
1727 auto *Dir
= createDirective
<OMPTargetParallelForSimdDirective
>(
1728 C
, Clauses
, AssociatedStmt
,
1729 numLoopChildren(CollapsedNum
, OMPD_target_parallel_for_simd
), StartLoc
,
1730 EndLoc
, CollapsedNum
);
1731 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1732 Dir
->setLastIteration(Exprs
.LastIteration
);
1733 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1734 Dir
->setPreCond(Exprs
.PreCond
);
1735 Dir
->setCond(Exprs
.Cond
);
1736 Dir
->setInit(Exprs
.Init
);
1737 Dir
->setInc(Exprs
.Inc
);
1738 Dir
->setIsLastIterVariable(Exprs
.IL
);
1739 Dir
->setLowerBoundVariable(Exprs
.LB
);
1740 Dir
->setUpperBoundVariable(Exprs
.UB
);
1741 Dir
->setStrideVariable(Exprs
.ST
);
1742 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1743 Dir
->setNextLowerBound(Exprs
.NLB
);
1744 Dir
->setNextUpperBound(Exprs
.NUB
);
1745 Dir
->setNumIterations(Exprs
.NumIterations
);
1746 Dir
->setCounters(Exprs
.Counters
);
1747 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1748 Dir
->setInits(Exprs
.Inits
);
1749 Dir
->setUpdates(Exprs
.Updates
);
1750 Dir
->setFinals(Exprs
.Finals
);
1751 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1752 Dir
->setDependentInits(Exprs
.DependentInits
);
1753 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1754 Dir
->setPreInits(Exprs
.PreInits
);
1758 OMPTargetParallelForSimdDirective
*
1759 OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext
&C
,
1760 unsigned NumClauses
,
1761 unsigned CollapsedNum
,
1763 return createEmptyDirective
<OMPTargetParallelForSimdDirective
>(
1764 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1765 numLoopChildren(CollapsedNum
, OMPD_target_parallel_for_simd
),
1769 OMPTargetSimdDirective
*
1770 OMPTargetSimdDirective::Create(const ASTContext
&C
, SourceLocation StartLoc
,
1771 SourceLocation EndLoc
, unsigned CollapsedNum
,
1772 ArrayRef
<OMPClause
*> Clauses
,
1773 Stmt
*AssociatedStmt
, const HelperExprs
&Exprs
) {
1774 auto *Dir
= createDirective
<OMPTargetSimdDirective
>(
1775 C
, Clauses
, AssociatedStmt
,
1776 numLoopChildren(CollapsedNum
, OMPD_target_simd
), StartLoc
, EndLoc
,
1778 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1779 Dir
->setLastIteration(Exprs
.LastIteration
);
1780 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1781 Dir
->setPreCond(Exprs
.PreCond
);
1782 Dir
->setCond(Exprs
.Cond
);
1783 Dir
->setInit(Exprs
.Init
);
1784 Dir
->setInc(Exprs
.Inc
);
1785 Dir
->setCounters(Exprs
.Counters
);
1786 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1787 Dir
->setInits(Exprs
.Inits
);
1788 Dir
->setUpdates(Exprs
.Updates
);
1789 Dir
->setFinals(Exprs
.Finals
);
1790 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1791 Dir
->setDependentInits(Exprs
.DependentInits
);
1792 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1793 Dir
->setPreInits(Exprs
.PreInits
);
1797 OMPTargetSimdDirective
*
1798 OMPTargetSimdDirective::CreateEmpty(const ASTContext
&C
, unsigned NumClauses
,
1799 unsigned CollapsedNum
, EmptyShell
) {
1800 return createEmptyDirective
<OMPTargetSimdDirective
>(
1801 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1802 numLoopChildren(CollapsedNum
, OMPD_target_simd
), CollapsedNum
);
1805 OMPTeamsDistributeDirective
*OMPTeamsDistributeDirective::Create(
1806 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1807 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1808 const HelperExprs
&Exprs
) {
1809 auto *Dir
= createDirective
<OMPTeamsDistributeDirective
>(
1810 C
, Clauses
, AssociatedStmt
,
1811 numLoopChildren(CollapsedNum
, OMPD_teams_distribute
), StartLoc
, EndLoc
,
1813 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1814 Dir
->setLastIteration(Exprs
.LastIteration
);
1815 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1816 Dir
->setPreCond(Exprs
.PreCond
);
1817 Dir
->setCond(Exprs
.Cond
);
1818 Dir
->setInit(Exprs
.Init
);
1819 Dir
->setInc(Exprs
.Inc
);
1820 Dir
->setIsLastIterVariable(Exprs
.IL
);
1821 Dir
->setLowerBoundVariable(Exprs
.LB
);
1822 Dir
->setUpperBoundVariable(Exprs
.UB
);
1823 Dir
->setStrideVariable(Exprs
.ST
);
1824 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1825 Dir
->setNextLowerBound(Exprs
.NLB
);
1826 Dir
->setNextUpperBound(Exprs
.NUB
);
1827 Dir
->setNumIterations(Exprs
.NumIterations
);
1828 Dir
->setCounters(Exprs
.Counters
);
1829 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1830 Dir
->setInits(Exprs
.Inits
);
1831 Dir
->setUpdates(Exprs
.Updates
);
1832 Dir
->setFinals(Exprs
.Finals
);
1833 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1834 Dir
->setDependentInits(Exprs
.DependentInits
);
1835 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1836 Dir
->setPreInits(Exprs
.PreInits
);
1840 OMPTeamsDistributeDirective
*
1841 OMPTeamsDistributeDirective::CreateEmpty(const ASTContext
&C
,
1842 unsigned NumClauses
,
1843 unsigned CollapsedNum
, EmptyShell
) {
1844 return createEmptyDirective
<OMPTeamsDistributeDirective
>(
1845 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1846 numLoopChildren(CollapsedNum
, OMPD_teams_distribute
), CollapsedNum
);
1849 OMPTeamsDistributeSimdDirective
*OMPTeamsDistributeSimdDirective::Create(
1850 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1851 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1852 const HelperExprs
&Exprs
) {
1853 auto *Dir
= createDirective
<OMPTeamsDistributeSimdDirective
>(
1854 C
, Clauses
, AssociatedStmt
,
1855 numLoopChildren(CollapsedNum
, OMPD_teams_distribute_simd
), StartLoc
,
1856 EndLoc
, CollapsedNum
);
1857 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1858 Dir
->setLastIteration(Exprs
.LastIteration
);
1859 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1860 Dir
->setPreCond(Exprs
.PreCond
);
1861 Dir
->setCond(Exprs
.Cond
);
1862 Dir
->setInit(Exprs
.Init
);
1863 Dir
->setInc(Exprs
.Inc
);
1864 Dir
->setIsLastIterVariable(Exprs
.IL
);
1865 Dir
->setLowerBoundVariable(Exprs
.LB
);
1866 Dir
->setUpperBoundVariable(Exprs
.UB
);
1867 Dir
->setStrideVariable(Exprs
.ST
);
1868 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1869 Dir
->setNextLowerBound(Exprs
.NLB
);
1870 Dir
->setNextUpperBound(Exprs
.NUB
);
1871 Dir
->setNumIterations(Exprs
.NumIterations
);
1872 Dir
->setCounters(Exprs
.Counters
);
1873 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1874 Dir
->setInits(Exprs
.Inits
);
1875 Dir
->setUpdates(Exprs
.Updates
);
1876 Dir
->setFinals(Exprs
.Finals
);
1877 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1878 Dir
->setDependentInits(Exprs
.DependentInits
);
1879 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1880 Dir
->setPreInits(Exprs
.PreInits
);
1884 OMPTeamsDistributeSimdDirective
*OMPTeamsDistributeSimdDirective::CreateEmpty(
1885 const ASTContext
&C
, unsigned NumClauses
, unsigned CollapsedNum
,
1887 return createEmptyDirective
<OMPTeamsDistributeSimdDirective
>(
1888 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1889 numLoopChildren(CollapsedNum
, OMPD_teams_distribute_simd
), CollapsedNum
);
1892 OMPTeamsDistributeParallelForSimdDirective
*
1893 OMPTeamsDistributeParallelForSimdDirective::Create(
1894 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1895 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1896 const HelperExprs
&Exprs
) {
1897 auto *Dir
= createDirective
<OMPTeamsDistributeParallelForSimdDirective
>(
1898 C
, Clauses
, AssociatedStmt
,
1899 numLoopChildren(CollapsedNum
, OMPD_teams_distribute_parallel_for_simd
),
1900 StartLoc
, EndLoc
, CollapsedNum
);
1901 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1902 Dir
->setLastIteration(Exprs
.LastIteration
);
1903 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1904 Dir
->setPreCond(Exprs
.PreCond
);
1905 Dir
->setCond(Exprs
.Cond
);
1906 Dir
->setInit(Exprs
.Init
);
1907 Dir
->setInc(Exprs
.Inc
);
1908 Dir
->setIsLastIterVariable(Exprs
.IL
);
1909 Dir
->setLowerBoundVariable(Exprs
.LB
);
1910 Dir
->setUpperBoundVariable(Exprs
.UB
);
1911 Dir
->setStrideVariable(Exprs
.ST
);
1912 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1913 Dir
->setNextLowerBound(Exprs
.NLB
);
1914 Dir
->setNextUpperBound(Exprs
.NUB
);
1915 Dir
->setNumIterations(Exprs
.NumIterations
);
1916 Dir
->setPrevLowerBoundVariable(Exprs
.PrevLB
);
1917 Dir
->setPrevUpperBoundVariable(Exprs
.PrevUB
);
1918 Dir
->setDistInc(Exprs
.DistInc
);
1919 Dir
->setPrevEnsureUpperBound(Exprs
.PrevEUB
);
1920 Dir
->setCounters(Exprs
.Counters
);
1921 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1922 Dir
->setInits(Exprs
.Inits
);
1923 Dir
->setUpdates(Exprs
.Updates
);
1924 Dir
->setFinals(Exprs
.Finals
);
1925 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1926 Dir
->setDependentInits(Exprs
.DependentInits
);
1927 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1928 Dir
->setPreInits(Exprs
.PreInits
);
1929 Dir
->setCombinedLowerBoundVariable(Exprs
.DistCombinedFields
.LB
);
1930 Dir
->setCombinedUpperBoundVariable(Exprs
.DistCombinedFields
.UB
);
1931 Dir
->setCombinedEnsureUpperBound(Exprs
.DistCombinedFields
.EUB
);
1932 Dir
->setCombinedInit(Exprs
.DistCombinedFields
.Init
);
1933 Dir
->setCombinedCond(Exprs
.DistCombinedFields
.Cond
);
1934 Dir
->setCombinedNextLowerBound(Exprs
.DistCombinedFields
.NLB
);
1935 Dir
->setCombinedNextUpperBound(Exprs
.DistCombinedFields
.NUB
);
1936 Dir
->setCombinedDistCond(Exprs
.DistCombinedFields
.DistCond
);
1937 Dir
->setCombinedParForInDistCond(Exprs
.DistCombinedFields
.ParForInDistCond
);
1941 OMPTeamsDistributeParallelForSimdDirective
*
1942 OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext
&C
,
1943 unsigned NumClauses
,
1944 unsigned CollapsedNum
,
1946 return createEmptyDirective
<OMPTeamsDistributeParallelForSimdDirective
>(
1947 C
, NumClauses
, /*HasAssociatedStmt=*/true,
1948 numLoopChildren(CollapsedNum
, OMPD_teams_distribute_parallel_for_simd
),
1952 OMPTeamsDistributeParallelForDirective
*
1953 OMPTeamsDistributeParallelForDirective::Create(
1954 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
1955 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
1956 const HelperExprs
&Exprs
, Expr
*TaskRedRef
, bool HasCancel
) {
1957 auto *Dir
= createDirective
<OMPTeamsDistributeParallelForDirective
>(
1958 C
, Clauses
, AssociatedStmt
,
1959 numLoopChildren(CollapsedNum
, OMPD_teams_distribute_parallel_for
) + 1,
1960 StartLoc
, EndLoc
, CollapsedNum
);
1961 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
1962 Dir
->setLastIteration(Exprs
.LastIteration
);
1963 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
1964 Dir
->setPreCond(Exprs
.PreCond
);
1965 Dir
->setCond(Exprs
.Cond
);
1966 Dir
->setInit(Exprs
.Init
);
1967 Dir
->setInc(Exprs
.Inc
);
1968 Dir
->setIsLastIterVariable(Exprs
.IL
);
1969 Dir
->setLowerBoundVariable(Exprs
.LB
);
1970 Dir
->setUpperBoundVariable(Exprs
.UB
);
1971 Dir
->setStrideVariable(Exprs
.ST
);
1972 Dir
->setEnsureUpperBound(Exprs
.EUB
);
1973 Dir
->setNextLowerBound(Exprs
.NLB
);
1974 Dir
->setNextUpperBound(Exprs
.NUB
);
1975 Dir
->setNumIterations(Exprs
.NumIterations
);
1976 Dir
->setPrevLowerBoundVariable(Exprs
.PrevLB
);
1977 Dir
->setPrevUpperBoundVariable(Exprs
.PrevUB
);
1978 Dir
->setDistInc(Exprs
.DistInc
);
1979 Dir
->setPrevEnsureUpperBound(Exprs
.PrevEUB
);
1980 Dir
->setCounters(Exprs
.Counters
);
1981 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
1982 Dir
->setInits(Exprs
.Inits
);
1983 Dir
->setUpdates(Exprs
.Updates
);
1984 Dir
->setFinals(Exprs
.Finals
);
1985 Dir
->setDependentCounters(Exprs
.DependentCounters
);
1986 Dir
->setDependentInits(Exprs
.DependentInits
);
1987 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
1988 Dir
->setPreInits(Exprs
.PreInits
);
1989 Dir
->setCombinedLowerBoundVariable(Exprs
.DistCombinedFields
.LB
);
1990 Dir
->setCombinedUpperBoundVariable(Exprs
.DistCombinedFields
.UB
);
1991 Dir
->setCombinedEnsureUpperBound(Exprs
.DistCombinedFields
.EUB
);
1992 Dir
->setCombinedInit(Exprs
.DistCombinedFields
.Init
);
1993 Dir
->setCombinedCond(Exprs
.DistCombinedFields
.Cond
);
1994 Dir
->setCombinedNextLowerBound(Exprs
.DistCombinedFields
.NLB
);
1995 Dir
->setCombinedNextUpperBound(Exprs
.DistCombinedFields
.NUB
);
1996 Dir
->setCombinedDistCond(Exprs
.DistCombinedFields
.DistCond
);
1997 Dir
->setCombinedParForInDistCond(Exprs
.DistCombinedFields
.ParForInDistCond
);
1998 Dir
->setTaskReductionRefExpr(TaskRedRef
);
1999 Dir
->HasCancel
= HasCancel
;
2003 OMPTeamsDistributeParallelForDirective
*
2004 OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext
&C
,
2005 unsigned NumClauses
,
2006 unsigned CollapsedNum
,
2008 return createEmptyDirective
<OMPTeamsDistributeParallelForDirective
>(
2009 C
, NumClauses
, /*HasAssociatedStmt=*/true,
2010 numLoopChildren(CollapsedNum
, OMPD_teams_distribute_parallel_for
) + 1,
2014 OMPTargetTeamsDirective
*OMPTargetTeamsDirective::Create(
2015 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2016 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
) {
2017 return createDirective
<OMPTargetTeamsDirective
>(C
, Clauses
, AssociatedStmt
,
2018 /*NumChildren=*/0, StartLoc
,
2022 OMPTargetTeamsDirective
*
2023 OMPTargetTeamsDirective::CreateEmpty(const ASTContext
&C
, unsigned NumClauses
,
2025 return createEmptyDirective
<OMPTargetTeamsDirective
>(
2026 C
, NumClauses
, /*HasAssociatedStmt=*/true);
2029 OMPTargetTeamsDistributeDirective
*OMPTargetTeamsDistributeDirective::Create(
2030 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2031 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
2032 const HelperExprs
&Exprs
) {
2033 auto *Dir
= createDirective
<OMPTargetTeamsDistributeDirective
>(
2034 C
, Clauses
, AssociatedStmt
,
2035 numLoopChildren(CollapsedNum
, OMPD_target_teams_distribute
), StartLoc
,
2036 EndLoc
, CollapsedNum
);
2037 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
2038 Dir
->setLastIteration(Exprs
.LastIteration
);
2039 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
2040 Dir
->setPreCond(Exprs
.PreCond
);
2041 Dir
->setCond(Exprs
.Cond
);
2042 Dir
->setInit(Exprs
.Init
);
2043 Dir
->setInc(Exprs
.Inc
);
2044 Dir
->setIsLastIterVariable(Exprs
.IL
);
2045 Dir
->setLowerBoundVariable(Exprs
.LB
);
2046 Dir
->setUpperBoundVariable(Exprs
.UB
);
2047 Dir
->setStrideVariable(Exprs
.ST
);
2048 Dir
->setEnsureUpperBound(Exprs
.EUB
);
2049 Dir
->setNextLowerBound(Exprs
.NLB
);
2050 Dir
->setNextUpperBound(Exprs
.NUB
);
2051 Dir
->setNumIterations(Exprs
.NumIterations
);
2052 Dir
->setCounters(Exprs
.Counters
);
2053 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
2054 Dir
->setInits(Exprs
.Inits
);
2055 Dir
->setUpdates(Exprs
.Updates
);
2056 Dir
->setFinals(Exprs
.Finals
);
2057 Dir
->setDependentCounters(Exprs
.DependentCounters
);
2058 Dir
->setDependentInits(Exprs
.DependentInits
);
2059 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
2060 Dir
->setPreInits(Exprs
.PreInits
);
2064 OMPTargetTeamsDistributeDirective
*
2065 OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext
&C
,
2066 unsigned NumClauses
,
2067 unsigned CollapsedNum
,
2069 return createEmptyDirective
<OMPTargetTeamsDistributeDirective
>(
2070 C
, NumClauses
, /*HasAssociatedStmt=*/true,
2071 numLoopChildren(CollapsedNum
, OMPD_target_teams_distribute
),
2075 OMPTargetTeamsDistributeParallelForDirective
*
2076 OMPTargetTeamsDistributeParallelForDirective::Create(
2077 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2078 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
2079 const HelperExprs
&Exprs
, Expr
*TaskRedRef
, bool HasCancel
) {
2080 auto *Dir
= createDirective
<OMPTargetTeamsDistributeParallelForDirective
>(
2081 C
, Clauses
, AssociatedStmt
,
2082 numLoopChildren(CollapsedNum
, OMPD_target_teams_distribute_parallel_for
) +
2084 StartLoc
, EndLoc
, CollapsedNum
);
2085 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
2086 Dir
->setLastIteration(Exprs
.LastIteration
);
2087 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
2088 Dir
->setPreCond(Exprs
.PreCond
);
2089 Dir
->setCond(Exprs
.Cond
);
2090 Dir
->setInit(Exprs
.Init
);
2091 Dir
->setInc(Exprs
.Inc
);
2092 Dir
->setIsLastIterVariable(Exprs
.IL
);
2093 Dir
->setLowerBoundVariable(Exprs
.LB
);
2094 Dir
->setUpperBoundVariable(Exprs
.UB
);
2095 Dir
->setStrideVariable(Exprs
.ST
);
2096 Dir
->setEnsureUpperBound(Exprs
.EUB
);
2097 Dir
->setNextLowerBound(Exprs
.NLB
);
2098 Dir
->setNextUpperBound(Exprs
.NUB
);
2099 Dir
->setNumIterations(Exprs
.NumIterations
);
2100 Dir
->setPrevLowerBoundVariable(Exprs
.PrevLB
);
2101 Dir
->setPrevUpperBoundVariable(Exprs
.PrevUB
);
2102 Dir
->setDistInc(Exprs
.DistInc
);
2103 Dir
->setPrevEnsureUpperBound(Exprs
.PrevEUB
);
2104 Dir
->setCounters(Exprs
.Counters
);
2105 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
2106 Dir
->setInits(Exprs
.Inits
);
2107 Dir
->setUpdates(Exprs
.Updates
);
2108 Dir
->setFinals(Exprs
.Finals
);
2109 Dir
->setDependentCounters(Exprs
.DependentCounters
);
2110 Dir
->setDependentInits(Exprs
.DependentInits
);
2111 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
2112 Dir
->setPreInits(Exprs
.PreInits
);
2113 Dir
->setCombinedLowerBoundVariable(Exprs
.DistCombinedFields
.LB
);
2114 Dir
->setCombinedUpperBoundVariable(Exprs
.DistCombinedFields
.UB
);
2115 Dir
->setCombinedEnsureUpperBound(Exprs
.DistCombinedFields
.EUB
);
2116 Dir
->setCombinedInit(Exprs
.DistCombinedFields
.Init
);
2117 Dir
->setCombinedCond(Exprs
.DistCombinedFields
.Cond
);
2118 Dir
->setCombinedNextLowerBound(Exprs
.DistCombinedFields
.NLB
);
2119 Dir
->setCombinedNextUpperBound(Exprs
.DistCombinedFields
.NUB
);
2120 Dir
->setCombinedDistCond(Exprs
.DistCombinedFields
.DistCond
);
2121 Dir
->setCombinedParForInDistCond(Exprs
.DistCombinedFields
.ParForInDistCond
);
2122 Dir
->setTaskReductionRefExpr(TaskRedRef
);
2123 Dir
->HasCancel
= HasCancel
;
2127 OMPTargetTeamsDistributeParallelForDirective
*
2128 OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext
&C
,
2129 unsigned NumClauses
,
2130 unsigned CollapsedNum
,
2132 return createEmptyDirective
<OMPTargetTeamsDistributeParallelForDirective
>(
2133 C
, NumClauses
, /*HasAssociatedStmt=*/true,
2134 numLoopChildren(CollapsedNum
, OMPD_target_teams_distribute_parallel_for
) +
2139 OMPTargetTeamsDistributeParallelForSimdDirective
*
2140 OMPTargetTeamsDistributeParallelForSimdDirective::Create(
2141 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2142 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
2143 const HelperExprs
&Exprs
) {
2144 auto *Dir
= createDirective
<OMPTargetTeamsDistributeParallelForSimdDirective
>(
2145 C
, Clauses
, AssociatedStmt
,
2146 numLoopChildren(CollapsedNum
,
2147 OMPD_target_teams_distribute_parallel_for_simd
),
2148 StartLoc
, EndLoc
, CollapsedNum
);
2149 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
2150 Dir
->setLastIteration(Exprs
.LastIteration
);
2151 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
2152 Dir
->setPreCond(Exprs
.PreCond
);
2153 Dir
->setCond(Exprs
.Cond
);
2154 Dir
->setInit(Exprs
.Init
);
2155 Dir
->setInc(Exprs
.Inc
);
2156 Dir
->setIsLastIterVariable(Exprs
.IL
);
2157 Dir
->setLowerBoundVariable(Exprs
.LB
);
2158 Dir
->setUpperBoundVariable(Exprs
.UB
);
2159 Dir
->setStrideVariable(Exprs
.ST
);
2160 Dir
->setEnsureUpperBound(Exprs
.EUB
);
2161 Dir
->setNextLowerBound(Exprs
.NLB
);
2162 Dir
->setNextUpperBound(Exprs
.NUB
);
2163 Dir
->setNumIterations(Exprs
.NumIterations
);
2164 Dir
->setPrevLowerBoundVariable(Exprs
.PrevLB
);
2165 Dir
->setPrevUpperBoundVariable(Exprs
.PrevUB
);
2166 Dir
->setDistInc(Exprs
.DistInc
);
2167 Dir
->setPrevEnsureUpperBound(Exprs
.PrevEUB
);
2168 Dir
->setCounters(Exprs
.Counters
);
2169 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
2170 Dir
->setInits(Exprs
.Inits
);
2171 Dir
->setUpdates(Exprs
.Updates
);
2172 Dir
->setFinals(Exprs
.Finals
);
2173 Dir
->setDependentCounters(Exprs
.DependentCounters
);
2174 Dir
->setDependentInits(Exprs
.DependentInits
);
2175 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
2176 Dir
->setPreInits(Exprs
.PreInits
);
2177 Dir
->setCombinedLowerBoundVariable(Exprs
.DistCombinedFields
.LB
);
2178 Dir
->setCombinedUpperBoundVariable(Exprs
.DistCombinedFields
.UB
);
2179 Dir
->setCombinedEnsureUpperBound(Exprs
.DistCombinedFields
.EUB
);
2180 Dir
->setCombinedInit(Exprs
.DistCombinedFields
.Init
);
2181 Dir
->setCombinedCond(Exprs
.DistCombinedFields
.Cond
);
2182 Dir
->setCombinedNextLowerBound(Exprs
.DistCombinedFields
.NLB
);
2183 Dir
->setCombinedNextUpperBound(Exprs
.DistCombinedFields
.NUB
);
2184 Dir
->setCombinedDistCond(Exprs
.DistCombinedFields
.DistCond
);
2185 Dir
->setCombinedParForInDistCond(Exprs
.DistCombinedFields
.ParForInDistCond
);
2189 OMPTargetTeamsDistributeParallelForSimdDirective
*
2190 OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
2191 const ASTContext
&C
, unsigned NumClauses
, unsigned CollapsedNum
,
2193 return createEmptyDirective
<OMPTargetTeamsDistributeParallelForSimdDirective
>(
2194 C
, NumClauses
, /*HasAssociatedStmt=*/true,
2195 numLoopChildren(CollapsedNum
,
2196 OMPD_target_teams_distribute_parallel_for_simd
),
2200 OMPTargetTeamsDistributeSimdDirective
*
2201 OMPTargetTeamsDistributeSimdDirective::Create(
2202 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2203 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
2204 const HelperExprs
&Exprs
) {
2205 auto *Dir
= createDirective
<OMPTargetTeamsDistributeSimdDirective
>(
2206 C
, Clauses
, AssociatedStmt
,
2207 numLoopChildren(CollapsedNum
, OMPD_target_teams_distribute_simd
),
2208 StartLoc
, EndLoc
, CollapsedNum
);
2209 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
2210 Dir
->setLastIteration(Exprs
.LastIteration
);
2211 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
2212 Dir
->setPreCond(Exprs
.PreCond
);
2213 Dir
->setCond(Exprs
.Cond
);
2214 Dir
->setInit(Exprs
.Init
);
2215 Dir
->setInc(Exprs
.Inc
);
2216 Dir
->setIsLastIterVariable(Exprs
.IL
);
2217 Dir
->setLowerBoundVariable(Exprs
.LB
);
2218 Dir
->setUpperBoundVariable(Exprs
.UB
);
2219 Dir
->setStrideVariable(Exprs
.ST
);
2220 Dir
->setEnsureUpperBound(Exprs
.EUB
);
2221 Dir
->setNextLowerBound(Exprs
.NLB
);
2222 Dir
->setNextUpperBound(Exprs
.NUB
);
2223 Dir
->setNumIterations(Exprs
.NumIterations
);
2224 Dir
->setCounters(Exprs
.Counters
);
2225 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
2226 Dir
->setInits(Exprs
.Inits
);
2227 Dir
->setUpdates(Exprs
.Updates
);
2228 Dir
->setFinals(Exprs
.Finals
);
2229 Dir
->setDependentCounters(Exprs
.DependentCounters
);
2230 Dir
->setDependentInits(Exprs
.DependentInits
);
2231 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
2232 Dir
->setPreInits(Exprs
.PreInits
);
2236 OMPTargetTeamsDistributeSimdDirective
*
2237 OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext
&C
,
2238 unsigned NumClauses
,
2239 unsigned CollapsedNum
,
2241 return createEmptyDirective
<OMPTargetTeamsDistributeSimdDirective
>(
2242 C
, NumClauses
, /*HasAssociatedStmt=*/true,
2243 numLoopChildren(CollapsedNum
, OMPD_target_teams_distribute_simd
),
2247 OMPInteropDirective
*
2248 OMPInteropDirective::Create(const ASTContext
&C
, SourceLocation StartLoc
,
2249 SourceLocation EndLoc
,
2250 ArrayRef
<OMPClause
*> Clauses
) {
2251 return createDirective
<OMPInteropDirective
>(
2252 C
, Clauses
, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc
,
2256 OMPInteropDirective
*OMPInteropDirective::CreateEmpty(const ASTContext
&C
,
2257 unsigned NumClauses
,
2259 return createEmptyDirective
<OMPInteropDirective
>(C
, NumClauses
);
2262 OMPDispatchDirective
*OMPDispatchDirective::Create(
2263 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2264 ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
2265 SourceLocation TargetCallLoc
) {
2266 auto *Dir
= createDirective
<OMPDispatchDirective
>(
2267 C
, Clauses
, AssociatedStmt
, /*NumChildren=*/0, StartLoc
, EndLoc
);
2268 Dir
->setTargetCallLoc(TargetCallLoc
);
2272 OMPDispatchDirective
*OMPDispatchDirective::CreateEmpty(const ASTContext
&C
,
2273 unsigned NumClauses
,
2275 return createEmptyDirective
<OMPDispatchDirective
>(C
, NumClauses
,
2276 /*HasAssociatedStmt=*/true,
2280 OMPMaskedDirective
*OMPMaskedDirective::Create(const ASTContext
&C
,
2281 SourceLocation StartLoc
,
2282 SourceLocation EndLoc
,
2283 ArrayRef
<OMPClause
*> Clauses
,
2284 Stmt
*AssociatedStmt
) {
2285 return createDirective
<OMPMaskedDirective
>(C
, Clauses
, AssociatedStmt
,
2286 /*NumChildren=*/0, StartLoc
,
2290 OMPMaskedDirective
*OMPMaskedDirective::CreateEmpty(const ASTContext
&C
,
2291 unsigned NumClauses
,
2293 return createEmptyDirective
<OMPMaskedDirective
>(C
, NumClauses
,
2294 /*HasAssociatedStmt=*/true);
2297 OMPGenericLoopDirective
*OMPGenericLoopDirective::Create(
2298 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2299 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
2300 const HelperExprs
&Exprs
) {
2301 auto *Dir
= createDirective
<OMPGenericLoopDirective
>(
2302 C
, Clauses
, AssociatedStmt
, numLoopChildren(CollapsedNum
, OMPD_loop
),
2303 StartLoc
, EndLoc
, CollapsedNum
);
2304 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
2305 Dir
->setLastIteration(Exprs
.LastIteration
);
2306 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
2307 Dir
->setPreCond(Exprs
.PreCond
);
2308 Dir
->setCond(Exprs
.Cond
);
2309 Dir
->setInit(Exprs
.Init
);
2310 Dir
->setInc(Exprs
.Inc
);
2311 Dir
->setIsLastIterVariable(Exprs
.IL
);
2312 Dir
->setLowerBoundVariable(Exprs
.LB
);
2313 Dir
->setUpperBoundVariable(Exprs
.UB
);
2314 Dir
->setStrideVariable(Exprs
.ST
);
2315 Dir
->setEnsureUpperBound(Exprs
.EUB
);
2316 Dir
->setNextLowerBound(Exprs
.NLB
);
2317 Dir
->setNextUpperBound(Exprs
.NUB
);
2318 Dir
->setNumIterations(Exprs
.NumIterations
);
2319 Dir
->setCounters(Exprs
.Counters
);
2320 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
2321 Dir
->setInits(Exprs
.Inits
);
2322 Dir
->setUpdates(Exprs
.Updates
);
2323 Dir
->setFinals(Exprs
.Finals
);
2324 Dir
->setDependentCounters(Exprs
.DependentCounters
);
2325 Dir
->setDependentInits(Exprs
.DependentInits
);
2326 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
2327 Dir
->setPreInits(Exprs
.PreInits
);
2331 OMPGenericLoopDirective
*
2332 OMPGenericLoopDirective::CreateEmpty(const ASTContext
&C
, unsigned NumClauses
,
2333 unsigned CollapsedNum
, EmptyShell
) {
2334 return createEmptyDirective
<OMPGenericLoopDirective
>(
2335 C
, NumClauses
, /*HasAssociatedStmt=*/true,
2336 numLoopChildren(CollapsedNum
, OMPD_loop
), CollapsedNum
);
2339 OMPTeamsGenericLoopDirective
*OMPTeamsGenericLoopDirective::Create(
2340 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2341 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
2342 const HelperExprs
&Exprs
) {
2343 auto *Dir
= createDirective
<OMPTeamsGenericLoopDirective
>(
2344 C
, Clauses
, AssociatedStmt
,
2345 numLoopChildren(CollapsedNum
, OMPD_teams_loop
), StartLoc
, EndLoc
,
2347 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
2348 Dir
->setLastIteration(Exprs
.LastIteration
);
2349 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
2350 Dir
->setPreCond(Exprs
.PreCond
);
2351 Dir
->setCond(Exprs
.Cond
);
2352 Dir
->setInit(Exprs
.Init
);
2353 Dir
->setInc(Exprs
.Inc
);
2354 Dir
->setIsLastIterVariable(Exprs
.IL
);
2355 Dir
->setLowerBoundVariable(Exprs
.LB
);
2356 Dir
->setUpperBoundVariable(Exprs
.UB
);
2357 Dir
->setStrideVariable(Exprs
.ST
);
2358 Dir
->setEnsureUpperBound(Exprs
.EUB
);
2359 Dir
->setNextLowerBound(Exprs
.NLB
);
2360 Dir
->setNextUpperBound(Exprs
.NUB
);
2361 Dir
->setNumIterations(Exprs
.NumIterations
);
2362 Dir
->setCounters(Exprs
.Counters
);
2363 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
2364 Dir
->setInits(Exprs
.Inits
);
2365 Dir
->setUpdates(Exprs
.Updates
);
2366 Dir
->setFinals(Exprs
.Finals
);
2367 Dir
->setDependentCounters(Exprs
.DependentCounters
);
2368 Dir
->setDependentInits(Exprs
.DependentInits
);
2369 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
2370 Dir
->setPreInits(Exprs
.PreInits
);
2374 OMPTeamsGenericLoopDirective
*
2375 OMPTeamsGenericLoopDirective::CreateEmpty(const ASTContext
&C
,
2376 unsigned NumClauses
,
2377 unsigned CollapsedNum
, EmptyShell
) {
2378 return createEmptyDirective
<OMPTeamsGenericLoopDirective
>(
2379 C
, NumClauses
, /*HasAssociatedStmt=*/true,
2380 numLoopChildren(CollapsedNum
, OMPD_teams_loop
), CollapsedNum
);
2383 OMPTargetTeamsGenericLoopDirective
*OMPTargetTeamsGenericLoopDirective::Create(
2384 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2385 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
2386 const HelperExprs
&Exprs
) {
2387 auto *Dir
= createDirective
<OMPTargetTeamsGenericLoopDirective
>(
2388 C
, Clauses
, AssociatedStmt
,
2389 numLoopChildren(CollapsedNum
, OMPD_target_teams_loop
), StartLoc
, EndLoc
,
2391 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
2392 Dir
->setLastIteration(Exprs
.LastIteration
);
2393 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
2394 Dir
->setPreCond(Exprs
.PreCond
);
2395 Dir
->setCond(Exprs
.Cond
);
2396 Dir
->setInit(Exprs
.Init
);
2397 Dir
->setInc(Exprs
.Inc
);
2398 Dir
->setIsLastIterVariable(Exprs
.IL
);
2399 Dir
->setLowerBoundVariable(Exprs
.LB
);
2400 Dir
->setUpperBoundVariable(Exprs
.UB
);
2401 Dir
->setStrideVariable(Exprs
.ST
);
2402 Dir
->setEnsureUpperBound(Exprs
.EUB
);
2403 Dir
->setNextLowerBound(Exprs
.NLB
);
2404 Dir
->setNextUpperBound(Exprs
.NUB
);
2405 Dir
->setNumIterations(Exprs
.NumIterations
);
2406 Dir
->setCounters(Exprs
.Counters
);
2407 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
2408 Dir
->setInits(Exprs
.Inits
);
2409 Dir
->setUpdates(Exprs
.Updates
);
2410 Dir
->setFinals(Exprs
.Finals
);
2411 Dir
->setDependentCounters(Exprs
.DependentCounters
);
2412 Dir
->setDependentInits(Exprs
.DependentInits
);
2413 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
2414 Dir
->setPreInits(Exprs
.PreInits
);
2418 OMPTargetTeamsGenericLoopDirective
*
2419 OMPTargetTeamsGenericLoopDirective::CreateEmpty(const ASTContext
&C
,
2420 unsigned NumClauses
,
2421 unsigned CollapsedNum
,
2423 return createEmptyDirective
<OMPTargetTeamsGenericLoopDirective
>(
2424 C
, NumClauses
, /*HasAssociatedStmt=*/true,
2425 numLoopChildren(CollapsedNum
, OMPD_target_teams_loop
), CollapsedNum
);
2428 OMPParallelGenericLoopDirective
*OMPParallelGenericLoopDirective::Create(
2429 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2430 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
2431 const HelperExprs
&Exprs
) {
2432 auto *Dir
= createDirective
<OMPParallelGenericLoopDirective
>(
2433 C
, Clauses
, AssociatedStmt
,
2434 numLoopChildren(CollapsedNum
, OMPD_parallel_loop
), StartLoc
, EndLoc
,
2436 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
2437 Dir
->setLastIteration(Exprs
.LastIteration
);
2438 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
2439 Dir
->setPreCond(Exprs
.PreCond
);
2440 Dir
->setCond(Exprs
.Cond
);
2441 Dir
->setInit(Exprs
.Init
);
2442 Dir
->setInc(Exprs
.Inc
);
2443 Dir
->setIsLastIterVariable(Exprs
.IL
);
2444 Dir
->setLowerBoundVariable(Exprs
.LB
);
2445 Dir
->setUpperBoundVariable(Exprs
.UB
);
2446 Dir
->setStrideVariable(Exprs
.ST
);
2447 Dir
->setEnsureUpperBound(Exprs
.EUB
);
2448 Dir
->setNextLowerBound(Exprs
.NLB
);
2449 Dir
->setNextUpperBound(Exprs
.NUB
);
2450 Dir
->setNumIterations(Exprs
.NumIterations
);
2451 Dir
->setCounters(Exprs
.Counters
);
2452 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
2453 Dir
->setInits(Exprs
.Inits
);
2454 Dir
->setUpdates(Exprs
.Updates
);
2455 Dir
->setFinals(Exprs
.Finals
);
2456 Dir
->setDependentCounters(Exprs
.DependentCounters
);
2457 Dir
->setDependentInits(Exprs
.DependentInits
);
2458 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
2459 Dir
->setPreInits(Exprs
.PreInits
);
2463 OMPParallelGenericLoopDirective
*OMPParallelGenericLoopDirective::CreateEmpty(
2464 const ASTContext
&C
, unsigned NumClauses
, unsigned CollapsedNum
,
2466 return createEmptyDirective
<OMPParallelGenericLoopDirective
>(
2467 C
, NumClauses
, /*HasAssociatedStmt=*/true,
2468 numLoopChildren(CollapsedNum
, OMPD_parallel_loop
), CollapsedNum
);
2471 OMPTargetParallelGenericLoopDirective
*
2472 OMPTargetParallelGenericLoopDirective::Create(
2473 const ASTContext
&C
, SourceLocation StartLoc
, SourceLocation EndLoc
,
2474 unsigned CollapsedNum
, ArrayRef
<OMPClause
*> Clauses
, Stmt
*AssociatedStmt
,
2475 const HelperExprs
&Exprs
) {
2476 auto *Dir
= createDirective
<OMPTargetParallelGenericLoopDirective
>(
2477 C
, Clauses
, AssociatedStmt
,
2478 numLoopChildren(CollapsedNum
, OMPD_target_parallel_loop
), StartLoc
,
2479 EndLoc
, CollapsedNum
);
2480 Dir
->setIterationVariable(Exprs
.IterationVarRef
);
2481 Dir
->setLastIteration(Exprs
.LastIteration
);
2482 Dir
->setCalcLastIteration(Exprs
.CalcLastIteration
);
2483 Dir
->setPreCond(Exprs
.PreCond
);
2484 Dir
->setCond(Exprs
.Cond
);
2485 Dir
->setInit(Exprs
.Init
);
2486 Dir
->setInc(Exprs
.Inc
);
2487 Dir
->setIsLastIterVariable(Exprs
.IL
);
2488 Dir
->setLowerBoundVariable(Exprs
.LB
);
2489 Dir
->setUpperBoundVariable(Exprs
.UB
);
2490 Dir
->setStrideVariable(Exprs
.ST
);
2491 Dir
->setEnsureUpperBound(Exprs
.EUB
);
2492 Dir
->setNextLowerBound(Exprs
.NLB
);
2493 Dir
->setNextUpperBound(Exprs
.NUB
);
2494 Dir
->setNumIterations(Exprs
.NumIterations
);
2495 Dir
->setCounters(Exprs
.Counters
);
2496 Dir
->setPrivateCounters(Exprs
.PrivateCounters
);
2497 Dir
->setInits(Exprs
.Inits
);
2498 Dir
->setUpdates(Exprs
.Updates
);
2499 Dir
->setFinals(Exprs
.Finals
);
2500 Dir
->setDependentCounters(Exprs
.DependentCounters
);
2501 Dir
->setDependentInits(Exprs
.DependentInits
);
2502 Dir
->setFinalsConditions(Exprs
.FinalsConditions
);
2503 Dir
->setPreInits(Exprs
.PreInits
);
2507 OMPTargetParallelGenericLoopDirective
*
2508 OMPTargetParallelGenericLoopDirective::CreateEmpty(const ASTContext
&C
,
2509 unsigned NumClauses
,
2510 unsigned CollapsedNum
,
2512 return createEmptyDirective
<OMPTargetParallelGenericLoopDirective
>(
2513 C
, NumClauses
, /*HasAssociatedStmt=*/true,
2514 numLoopChildren(CollapsedNum
, OMPD_target_parallel_loop
), CollapsedNum
);