clang 24.0.0git
StmtOpenMP.cpp
Go to the documentation of this file.
1//===--- StmtOpenMP.cpp - Classes for OpenMP directives -------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the subclasses of Stmt class declared in StmtOpenMP.h
10//
11//===----------------------------------------------------------------------===//
12
15
16using namespace clang;
17using namespace llvm::omp;
18
19size_t OMPChildren::size(unsigned NumClauses, bool HasAssociatedStmt,
20 unsigned NumChildren) {
21 return llvm::alignTo(
22 totalSizeToAlloc<OMPClause *, Stmt *>(
23 NumClauses, NumChildren + (HasAssociatedStmt ? 1 : 0)),
24 alignof(OMPChildren));
25}
26
28 assert(Clauses.size() == NumClauses &&
29 "Number of clauses is not the same as the preallocated buffer");
30 llvm::copy(Clauses, getTrailingObjects<OMPClause *>());
31}
32
34 return getTrailingObjects<Stmt *>(NumChildren);
35}
36
37OMPChildren *OMPChildren::Create(void *Mem, ArrayRef<OMPClause *> Clauses) {
38 auto *Data = CreateEmpty(Mem, Clauses.size());
39 Data->setClauses(Clauses);
40 return Data;
41}
42
43OMPChildren *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);
47 if (S)
48 Data->setAssociatedStmt(S);
49 return Data;
50}
51
52OMPChildren *OMPChildren::CreateEmpty(void *Mem, unsigned NumClauses,
53 bool HasAssociatedStmt,
54 unsigned NumChildren) {
55 return new (Mem) OMPChildren(NumClauses, NumChildren, HasAssociatedStmt);
56}
57
58bool 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.
65 return true;
66 return !hasAssociatedStmt();
67}
68
69Stmt *OMPExecutableDirective::getStructuredBlock() {
70 assert(!isStandaloneDirective() &&
71 "Standalone Executable Directives don't have Structured Blocks.");
72 if (auto *LD = dyn_cast<OMPLoopDirective>(this))
73 return LD->getBody();
74 return getRawStmt();
75}
76
77Stmt *
78OMPLoopBasedDirective::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)) {
85 CurStmt = nullptr;
86 SmallVector<CompoundStmt *, 4> Statements(1, CS);
87 SmallVector<CompoundStmt *, 4> NextStatements;
88 while (!Statements.empty()) {
89 CS = Statements.pop_back_val();
90 if (!CS)
91 continue;
92 for (Stmt *S : CS->body()) {
93 if (!S)
94 continue;
95 if (auto *CanonLoop = dyn_cast<OMPCanonicalLoop>(S))
96 S = CanonLoop->getLoopStmt();
99 // Only single loop construct is allowed.
100 if (CurStmt) {
101 CurStmt = OrigStmt;
102 break;
103 }
104 CurStmt = S;
105 continue;
106 }
107 S = S->IgnoreContainers();
108 if (auto *InnerCS = dyn_cast_or_null<CompoundStmt>(S))
109 NextStatements.push_back(InnerCS);
110 }
111 if (Statements.empty()) {
112 // Found single inner loop or multiple loops - exit.
113 if (CurStmt)
114 break;
115 Statements.swap(NextStatements);
116 }
117 }
118 if (!CurStmt)
119 CurStmt = OrigStmt;
120 }
121 }
122 return CurStmt;
123}
124
125bool 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) {
132 while (true) {
133 auto *Dir = dyn_cast<OMPLoopTransformationDirective>(CurStmt);
134 if (!Dir)
135 break;
136
137 OnTransformationCallback(Dir);
138
139 Stmt *TransformedStmt = Dir->getTransformedStmt();
140 if (!TransformedStmt) {
141 unsigned NumGeneratedTopLevelLoops =
142 Dir->getNumGeneratedTopLevelLoops();
143 if (NumGeneratedTopLevelLoops == 0) {
144 // May happen if the loop transformation does not result in a
145 // generated loop (such as full unrolling).
146 break;
147 }
148 if (NumGeneratedTopLevelLoops > 0) {
149 // The loop transformation construct has generated loops, but these
150 // may not have been generated yet due to being in a dependent
151 // context.
152 return true;
153 }
154 }
155
156 CurStmt = TransformedStmt;
157 }
158 if (auto *CanonLoop = dyn_cast<OMPCanonicalLoop>(CurStmt))
159 CurStmt = CanonLoop->getLoopStmt();
160 if (Callback(Cnt, CurStmt))
161 return false;
162 // Move on to the next nested for loop, or to the loop body.
163 // OpenMP [2.8.1, simd construct, Restrictions]
164 // All loops associated with the construct must be perfectly nested; that
165 // is, there must be no intervening code nor any OpenMP directive between
166 // any two loops.
167 if (auto *For = dyn_cast<ForStmt>(CurStmt)) {
168 CurStmt = For->getBody();
169 } else {
170 assert(isa<CXXForRangeStmt>(CurStmt) &&
171 "Expected canonical for or range-based for loops.");
172 CurStmt = cast<CXXForRangeStmt>(CurStmt)->getBody();
173 }
174 CurStmt = OMPLoopBasedDirective::tryToFindNextInnerLoop(
175 CurStmt, TryImperfectlyNestedLoops);
176 }
177 return true;
178}
179
180void OMPLoopBasedDirective::doForAllLoopsBodies(
181 Stmt *CurStmt, bool TryImperfectlyNestedLoops, unsigned NumLoops,
182 llvm::function_ref<void(unsigned, Stmt *, Stmt *)> Callback) {
183 bool Res = OMPLoopBasedDirective::doForAllLoops(
184 CurStmt, TryImperfectlyNestedLoops, NumLoops,
185 [Callback](unsigned Cnt, Stmt *Loop) {
186 Stmt *Body = nullptr;
187 if (auto *For = dyn_cast<ForStmt>(Loop)) {
188 Body = For->getBody();
189 } else {
190 assert(isa<CXXForRangeStmt>(Loop) &&
191 "Expected canonical for or range-based for loops.");
192 Body = cast<CXXForRangeStmt>(Loop)->getBody();
193 }
194 if (auto *CanonLoop = dyn_cast<OMPCanonicalLoop>(Body))
195 Body = CanonLoop->getLoopStmt();
196 Callback(Cnt, Loop, Body);
197 return false;
198 });
199 assert(Res && "Expected only loops");
200 (void)Res;
201}
202
203Stmt *OMPLoopDirective::getBody() {
204 // This relies on the loop form is already checked by Sema.
205 Stmt *Body = nullptr;
206 OMPLoopBasedDirective::doForAllLoopsBodies(
207 Data->getRawStmt(), /*TryImperfectlyNestedLoops=*/true,
208 NumAssociatedLoops,
209 [&Body](unsigned, Stmt *, Stmt *BodyStmt) { Body = BodyStmt; });
210 return Body;
211}
212
213void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
214 assert(A.size() == getLoopsNumber() &&
215 "Number of loop counters is not the same as the collapsed number");
216 llvm::copy(A, getCounters().begin());
217}
218
219void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
220 assert(A.size() == getLoopsNumber() && "Number of loop private counters "
221 "is not the same as the collapsed "
222 "number");
223 llvm::copy(A, getPrivateCounters().begin());
224}
225
226void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
227 assert(A.size() == getLoopsNumber() &&
228 "Number of counter inits is not the same as the collapsed number");
229 llvm::copy(A, getInits().begin());
230}
231
232void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
233 assert(A.size() == getLoopsNumber() &&
234 "Number of counter updates is not the same as the collapsed number");
235 llvm::copy(A, getUpdates().begin());
236}
237
238void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
239 assert(A.size() == getLoopsNumber() &&
240 "Number of counter finals is not the same as the collapsed number");
241 llvm::copy(A, getFinals().begin());
242}
243
244void OMPLoopDirective::setDependentCounters(ArrayRef<Expr *> A) {
245 assert(
246 A.size() == getLoopsNumber() &&
247 "Number of dependent counters is not the same as the collapsed number");
248 llvm::copy(A, getDependentCounters().begin());
249}
250
251void OMPLoopDirective::setDependentInits(ArrayRef<Expr *> A) {
252 assert(A.size() == getLoopsNumber() &&
253 "Number of dependent inits is not the same as the collapsed number");
254 llvm::copy(A, getDependentInits().begin());
255}
256
257void OMPLoopDirective::setFinalsConditions(ArrayRef<Expr *> A) {
258 assert(A.size() == getLoopsNumber() &&
259 "Number of finals conditions is not the same as the collapsed number");
260 llvm::copy(A, getFinalsConditions().begin());
261}
262
263OMPMetaDirective *OMPMetaDirective::Create(const ASTContext &C,
264 SourceLocation StartLoc,
265 SourceLocation EndLoc,
266 ArrayRef<OMPClause *> Clauses,
267 Stmt *AssociatedStmt, Stmt *IfStmt) {
268 auto *Dir = createDirective<OMPMetaDirective>(
269 C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
270 Dir->setIfStmt(IfStmt);
271 return Dir;
272}
273
275 unsigned NumClauses,
276 EmptyShell) {
277 return createEmptyDirective<OMPMetaDirective>(C, NumClauses,
278 /*HasAssociatedStmt=*/true,
279 /*NumChildren=*/1);
280}
281
282OMPParallelDirective *OMPParallelDirective::Create(
283 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
284 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
285 bool HasCancel) {
286 auto *Dir = createDirective<OMPParallelDirective>(
287 C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
288 Dir->setTaskReductionRefExpr(TaskRedRef);
289 Dir->setHasCancel(HasCancel);
290 return Dir;
291}
292
293OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
294 unsigned NumClauses,
295 EmptyShell) {
296 return createEmptyDirective<OMPParallelDirective>(C, NumClauses,
297 /*HasAssociatedStmt=*/true,
298 /*NumChildren=*/1);
299}
300
301OMPSimdDirective *
302OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
303 SourceLocation EndLoc, unsigned CollapsedNum,
304 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
305 const HelperExprs &Exprs) {
306 auto *Dir = createDirective<OMPSimdDirective>(
307 C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_simd),
308 StartLoc, EndLoc, CollapsedNum);
309 Dir->setIterationVariable(Exprs.IterationVarRef);
310 Dir->setLastIteration(Exprs.LastIteration);
311 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
312 Dir->setPreCond(Exprs.PreCond);
313 Dir->setCond(Exprs.Cond);
314 Dir->setInit(Exprs.Init);
315 Dir->setInc(Exprs.Inc);
316 Dir->setCounters(Exprs.Counters);
317 Dir->setPrivateCounters(Exprs.PrivateCounters);
318 Dir->setInits(Exprs.Inits);
319 Dir->setUpdates(Exprs.Updates);
320 Dir->setFinals(Exprs.Finals);
321 Dir->setDependentCounters(Exprs.DependentCounters);
322 Dir->setDependentInits(Exprs.DependentInits);
323 Dir->setFinalsConditions(Exprs.FinalsConditions);
324 Dir->setPreInits(Exprs.PreInits);
325 return Dir;
326}
327
328OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C,
329 unsigned NumClauses,
330 unsigned CollapsedNum,
331 EmptyShell) {
332 return createEmptyDirective<OMPSimdDirective>(
333 C, NumClauses, /*HasAssociatedStmt=*/true,
334 numLoopChildren(CollapsedNum, OMPD_simd), CollapsedNum);
335}
336
337OMPForDirective *OMPForDirective::Create(
338 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
339 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
340 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
341 auto *Dir = createDirective<OMPForDirective>(
342 C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_for) + 1,
343 StartLoc, EndLoc, CollapsedNum);
344 Dir->setIterationVariable(Exprs.IterationVarRef);
345 Dir->setLastIteration(Exprs.LastIteration);
346 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
347 Dir->setPreCond(Exprs.PreCond);
348 Dir->setCond(Exprs.Cond);
349 Dir->setInit(Exprs.Init);
350 Dir->setInc(Exprs.Inc);
351 Dir->setIsLastIterVariable(Exprs.IL);
352 Dir->setLowerBoundVariable(Exprs.LB);
353 Dir->setUpperBoundVariable(Exprs.UB);
354 Dir->setStrideVariable(Exprs.ST);
355 Dir->setEnsureUpperBound(Exprs.EUB);
356 Dir->setNextLowerBound(Exprs.NLB);
357 Dir->setNextUpperBound(Exprs.NUB);
358 Dir->setNumIterations(Exprs.NumIterations);
359 Dir->setCounters(Exprs.Counters);
360 Dir->setPrivateCounters(Exprs.PrivateCounters);
361 Dir->setInits(Exprs.Inits);
362 Dir->setUpdates(Exprs.Updates);
363 Dir->setFinals(Exprs.Finals);
364 Dir->setDependentCounters(Exprs.DependentCounters);
365 Dir->setDependentInits(Exprs.DependentInits);
366 Dir->setFinalsConditions(Exprs.FinalsConditions);
367 Dir->setPreInits(Exprs.PreInits);
368 Dir->setTaskReductionRefExpr(TaskRedRef);
369 Dir->setHasCancel(HasCancel);
370 return Dir;
371}
372
373Stmt *OMPLoopTransformationDirective::getTransformedStmt() const {
374 if (auto *D = dyn_cast<OMPCanonicalLoopNestTransformationDirective>(S))
375 return D->getTransformedStmt();
376 if (auto *D = dyn_cast<OMPCanonicalLoopSequenceTransformationDirective>(S))
377 return D->getTransformedStmt();
378 llvm_unreachable("unexpected object type");
379}
380
381Stmt *OMPLoopTransformationDirective::getPreInits() const {
382 if (auto *D = dyn_cast<OMPCanonicalLoopNestTransformationDirective>(S))
383 return D->getPreInits();
384 if (auto *D = dyn_cast<OMPCanonicalLoopSequenceTransformationDirective>(S))
385 return D->getPreInits();
386 llvm_unreachable("unexpected object type");
387}
388
389Stmt *OMPCanonicalLoopNestTransformationDirective::getTransformedStmt() const {
390 switch (getStmtClass()) {
391#define STMT(CLASS, PARENT)
392#define ABSTRACT_STMT(CLASS)
393#define OMPCANONICALLOOPNESTTRANSFORMATIONDIRECTIVE(CLASS, PARENT) \
394 case Stmt::CLASS##Class: \
395 return static_cast<const CLASS *>(this)->getTransformedStmt();
396#include "clang/AST/StmtNodes.inc"
397 default:
398 llvm_unreachable("Not a loop transformation for canonical loop nests");
399 }
400}
401
402Stmt *OMPCanonicalLoopNestTransformationDirective::getPreInits() const {
403 switch (getStmtClass()) {
404#define STMT(CLASS, PARENT)
405#define ABSTRACT_STMT(CLASS)
406#define OMPCANONICALLOOPNESTTRANSFORMATIONDIRECTIVE(CLASS, PARENT) \
407 case Stmt::CLASS##Class: \
408 return static_cast<const CLASS *>(this)->getPreInits();
409#include "clang/AST/StmtNodes.inc"
410 default:
411 llvm_unreachable("Not a loop transformation for canonical loop nests");
412 }
413}
414
415Stmt *
417 switch (getStmtClass()) {
418#define STMT(CLASS, PARENT)
419#define ABSTRACT_STMT(CLASS)
420#define OMPCANONICALLOOPSEQUENCETRANSFORMATIONDIRECTIVE(CLASS, PARENT) \
421 case Stmt::CLASS##Class: \
422 return static_cast<const CLASS *>(this)->getTransformedStmt();
423#include "clang/AST/StmtNodes.inc"
424 default:
425 llvm_unreachable("Not a loop transformation for canonical loop sequences");
426 }
427}
428
430 switch (getStmtClass()) {
431#define STMT(CLASS, PARENT)
432#define ABSTRACT_STMT(CLASS)
433#define OMPCANONICALLOOPSEQUENCETRANSFORMATIONDIRECTIVE(CLASS, PARENT) \
434 case Stmt::CLASS##Class: \
435 return static_cast<const CLASS *>(this)->getPreInits();
436#include "clang/AST/StmtNodes.inc"
437 default:
438 llvm_unreachable("Not a loop transformation for canonical loop sequences");
439 }
440}
441
442OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
443 unsigned NumClauses,
444 unsigned CollapsedNum,
445 EmptyShell) {
446 return createEmptyDirective<OMPForDirective>(
447 C, NumClauses, /*HasAssociatedStmt=*/true,
448 numLoopChildren(CollapsedNum, OMPD_for) + 1, CollapsedNum);
449}
450
454 unsigned NumLoops, Stmt *AssociatedStmt,
455 Stmt *TransformedStmt, Stmt *PreInits) {
456 OMPTileDirective *Dir = createDirective<OMPTileDirective>(
457 C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc,
458 NumLoops);
459 Dir->setTransformedStmt(TransformedStmt);
460 Dir->setPreInits(PreInits);
461 return Dir;
462}
463
465 unsigned NumClauses,
466 unsigned NumLoops) {
467 return createEmptyDirective<OMPTileDirective>(
468 C, NumClauses, /*HasAssociatedStmt=*/true, TransformedStmtOffset + 1,
469 SourceLocation(), SourceLocation(), NumLoops);
470}
471
475 unsigned NumLoops, Stmt *AssociatedStmt,
476 Stmt *TransformedStmt, Stmt *PreInits) {
477 OMPStripeDirective *Dir = createDirective<OMPStripeDirective>(
478 C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc,
479 NumLoops);
480 Dir->setTransformedStmt(TransformedStmt);
481 Dir->setPreInits(PreInits);
482 return Dir;
483}
484
486 unsigned NumClauses,
487 unsigned NumLoops) {
488 return createEmptyDirective<OMPStripeDirective>(
489 C, NumClauses, /*HasAssociatedStmt=*/true, TransformedStmtOffset + 1,
490 SourceLocation(), SourceLocation(), NumLoops);
491}
492
493OMPUnrollDirective *OMPUnrollDirective::Create(
494 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
495 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
496 unsigned NumGeneratedTopLevelLoops, Stmt *TransformedStmt, Stmt *PreInits) {
497 assert(NumGeneratedTopLevelLoops <= 1 &&
498 "Unrolling generates at most one loop");
499
500 auto *Dir = createDirective<OMPUnrollDirective>(
501 C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc);
502 Dir->setNumGeneratedTopLevelLoops(NumGeneratedTopLevelLoops);
503 Dir->setTransformedStmt(TransformedStmt);
504 Dir->setPreInits(PreInits);
505 return Dir;
506}
507
509 unsigned NumClauses) {
510 return createEmptyDirective<OMPUnrollDirective>(
511 C, NumClauses, /*HasAssociatedStmt=*/true, TransformedStmtOffset + 1,
513}
514
517 SourceLocation EndLoc, Stmt *AssociatedStmt,
518 unsigned NumLoops, Stmt *TransformedStmt,
519 Stmt *PreInits) {
520 OMPReverseDirective *Dir = createDirective<OMPReverseDirective>(
521 C, {}, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc,
522 NumLoops);
523 Dir->setTransformedStmt(TransformedStmt);
524 Dir->setPreInits(PreInits);
525 return Dir;
526}
527
529 unsigned NumLoops) {
530 return createEmptyDirective<OMPReverseDirective>(
531 C, /*NumClauses=*/0, /*HasAssociatedStmt=*/true,
532 TransformedStmtOffset + 1, SourceLocation(), SourceLocation(), NumLoops);
533}
534
535OMPInterchangeDirective *OMPInterchangeDirective::Create(
536 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
537 ArrayRef<OMPClause *> Clauses, unsigned NumLoops, Stmt *AssociatedStmt,
538 Stmt *TransformedStmt, Stmt *PreInits) {
539 OMPInterchangeDirective *Dir = createDirective<OMPInterchangeDirective>(
540 C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc,
541 NumLoops);
542 Dir->setTransformedStmt(TransformedStmt);
543 Dir->setPreInits(PreInits);
544 return Dir;
545}
546
549 unsigned NumLoops) {
550 return createEmptyDirective<OMPInterchangeDirective>(
551 C, NumClauses, /*HasAssociatedStmt=*/true, TransformedStmtOffset + 1,
552 SourceLocation(), SourceLocation(), NumLoops);
553}
554
558 unsigned NumLoops, Stmt *AssociatedStmt,
559 Stmt *TransformedStmt, Stmt *PreInits) {
560 OMPSplitDirective *Dir = createDirective<OMPSplitDirective>(
561 C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc,
562 NumLoops);
563 Dir->setTransformedStmt(TransformedStmt);
564 Dir->setPreInits(PreInits);
565 return Dir;
566}
567
569 unsigned NumClauses,
570 unsigned NumLoops) {
571 return createEmptyDirective<OMPSplitDirective>(
572 C, NumClauses, /*HasAssociatedStmt=*/true, TransformedStmtOffset + 1,
573 SourceLocation(), SourceLocation(), NumLoops);
574}
575
576OMPFuseDirective *OMPFuseDirective::Create(
577 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
578 ArrayRef<OMPClause *> Clauses, unsigned NumGeneratedTopLevelLoops,
579 Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits) {
580
581 OMPFuseDirective *Dir = createDirective<OMPFuseDirective>(
582 C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc);
583 Dir->setTransformedStmt(TransformedStmt);
584 Dir->setPreInits(PreInits);
585 Dir->setNumGeneratedTopLevelLoops(NumGeneratedTopLevelLoops);
586 return Dir;
587}
588
590 unsigned NumClauses) {
591 OMPFuseDirective *Dir = createEmptyDirective<OMPFuseDirective>(
592 C, NumClauses, /*HasAssociatedStmt=*/true, TransformedStmtOffset + 1,
594 return Dir;
595}
596
597OMPForSimdDirective *
598OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
599 SourceLocation EndLoc, unsigned CollapsedNum,
600 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
601 const HelperExprs &Exprs) {
602 auto *Dir = createDirective<OMPForSimdDirective>(
603 C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_for_simd),
604 StartLoc, EndLoc, CollapsedNum);
605 Dir->setIterationVariable(Exprs.IterationVarRef);
606 Dir->setLastIteration(Exprs.LastIteration);
607 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
608 Dir->setPreCond(Exprs.PreCond);
609 Dir->setCond(Exprs.Cond);
610 Dir->setInit(Exprs.Init);
611 Dir->setInc(Exprs.Inc);
612 Dir->setIsLastIterVariable(Exprs.IL);
613 Dir->setLowerBoundVariable(Exprs.LB);
614 Dir->setUpperBoundVariable(Exprs.UB);
615 Dir->setStrideVariable(Exprs.ST);
616 Dir->setEnsureUpperBound(Exprs.EUB);
617 Dir->setNextLowerBound(Exprs.NLB);
618 Dir->setNextUpperBound(Exprs.NUB);
619 Dir->setNumIterations(Exprs.NumIterations);
620 Dir->setCounters(Exprs.Counters);
621 Dir->setPrivateCounters(Exprs.PrivateCounters);
622 Dir->setInits(Exprs.Inits);
623 Dir->setUpdates(Exprs.Updates);
624 Dir->setFinals(Exprs.Finals);
625 Dir->setDependentCounters(Exprs.DependentCounters);
626 Dir->setDependentInits(Exprs.DependentInits);
627 Dir->setFinalsConditions(Exprs.FinalsConditions);
628 Dir->setPreInits(Exprs.PreInits);
629 return Dir;
630}
631
632OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
633 unsigned NumClauses,
634 unsigned CollapsedNum,
635 EmptyShell) {
636 return createEmptyDirective<OMPForSimdDirective>(
637 C, NumClauses, /*HasAssociatedStmt=*/true,
638 numLoopChildren(CollapsedNum, OMPD_for_simd), CollapsedNum);
639}
640
641OMPSectionsDirective *OMPSectionsDirective::Create(
642 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
643 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
644 bool HasCancel) {
645 auto *Dir = createDirective<OMPSectionsDirective>(C, Clauses, AssociatedStmt,
646 /*NumChildren=*/1, StartLoc,
647 EndLoc);
648 Dir->setTaskReductionRefExpr(TaskRedRef);
649 Dir->setHasCancel(HasCancel);
650 return Dir;
651}
652
653OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
654 unsigned NumClauses,
655 EmptyShell) {
656 return createEmptyDirective<OMPSectionsDirective>(C, NumClauses,
657 /*HasAssociatedStmt=*/true,
658 /*NumChildren=*/1);
659}
660
661OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
662 SourceLocation StartLoc,
663 SourceLocation EndLoc,
664 Stmt *AssociatedStmt,
665 bool HasCancel) {
666 auto *Dir =
667 createDirective<OMPSectionDirective>(C, {}, AssociatedStmt,
668 /*NumChildren=*/0, StartLoc, EndLoc);
669 Dir->setHasCancel(HasCancel);
670 return Dir;
671}
672
673OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
674 EmptyShell) {
675 return createEmptyDirective<OMPSectionDirective>(C, /*NumClauses=*/0,
676 /*HasAssociatedStmt=*/true);
677}
678
679OMPScopeDirective *OMPScopeDirective::Create(const ASTContext &C,
680 SourceLocation StartLoc,
681 SourceLocation EndLoc,
682 ArrayRef<OMPClause *> Clauses,
683 Stmt *AssociatedStmt) {
684 return createDirective<OMPScopeDirective>(C, Clauses, AssociatedStmt,
685 /*NumChildren=*/0, StartLoc,
686 EndLoc);
687}
688
689OMPScopeDirective *OMPScopeDirective::CreateEmpty(const ASTContext &C,
690 unsigned NumClauses,
691 EmptyShell) {
692 return createEmptyDirective<OMPScopeDirective>(C, NumClauses,
693 /*HasAssociatedStmt=*/true);
694}
695
696OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
697 SourceLocation StartLoc,
698 SourceLocation EndLoc,
699 ArrayRef<OMPClause *> Clauses,
700 Stmt *AssociatedStmt) {
701 return createDirective<OMPSingleDirective>(C, Clauses, AssociatedStmt,
702 /*NumChildren=*/0, StartLoc,
703 EndLoc);
704}
705
706OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
707 unsigned NumClauses,
708 EmptyShell) {
709 return createEmptyDirective<OMPSingleDirective>(C, NumClauses,
710 /*HasAssociatedStmt=*/true);
711}
712
713OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
714 SourceLocation StartLoc,
715 SourceLocation EndLoc,
716 Stmt *AssociatedStmt) {
717 return createDirective<OMPMasterDirective>(C, {}, AssociatedStmt,
718 /*NumChildren=*/0, StartLoc,
719 EndLoc);
720}
721
722OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
723 EmptyShell) {
724 return createEmptyDirective<OMPMasterDirective>(C, /*NumClauses=*/0,
725 /*HasAssociatedStmt=*/true);
726}
727
728OMPCriticalDirective *OMPCriticalDirective::Create(
729 const ASTContext &C, const DeclarationNameInfo &Name,
730 SourceLocation StartLoc, SourceLocation EndLoc,
731 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
732 return createDirective<OMPCriticalDirective>(C, Clauses, AssociatedStmt,
733 /*NumChildren=*/0, Name,
734 StartLoc, EndLoc);
735}
736
737OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
738 unsigned NumClauses,
739 EmptyShell) {
740 return createEmptyDirective<OMPCriticalDirective>(C, NumClauses,
741 /*HasAssociatedStmt=*/true);
742}
743
744OMPParallelForDirective *OMPParallelForDirective::Create(
745 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
746 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
747 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
748 auto *Dir = createDirective<OMPParallelForDirective>(
749 C, Clauses, AssociatedStmt,
750 numLoopChildren(CollapsedNum, OMPD_parallel_for) + 1, StartLoc, EndLoc,
751 CollapsedNum);
752 Dir->setIterationVariable(Exprs.IterationVarRef);
753 Dir->setLastIteration(Exprs.LastIteration);
754 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
755 Dir->setPreCond(Exprs.PreCond);
756 Dir->setCond(Exprs.Cond);
757 Dir->setInit(Exprs.Init);
758 Dir->setInc(Exprs.Inc);
759 Dir->setIsLastIterVariable(Exprs.IL);
760 Dir->setLowerBoundVariable(Exprs.LB);
761 Dir->setUpperBoundVariable(Exprs.UB);
762 Dir->setStrideVariable(Exprs.ST);
763 Dir->setEnsureUpperBound(Exprs.EUB);
764 Dir->setNextLowerBound(Exprs.NLB);
765 Dir->setNextUpperBound(Exprs.NUB);
766 Dir->setNumIterations(Exprs.NumIterations);
767 Dir->setCounters(Exprs.Counters);
768 Dir->setPrivateCounters(Exprs.PrivateCounters);
769 Dir->setInits(Exprs.Inits);
770 Dir->setUpdates(Exprs.Updates);
771 Dir->setFinals(Exprs.Finals);
772 Dir->setDependentCounters(Exprs.DependentCounters);
773 Dir->setDependentInits(Exprs.DependentInits);
774 Dir->setFinalsConditions(Exprs.FinalsConditions);
775 Dir->setPreInits(Exprs.PreInits);
776 Dir->setTaskReductionRefExpr(TaskRedRef);
777 Dir->setHasCancel(HasCancel);
778 return Dir;
779}
780
781OMPParallelForDirective *
782OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
783 unsigned CollapsedNum, EmptyShell) {
784 return createEmptyDirective<OMPParallelForDirective>(
785 C, NumClauses, /*HasAssociatedStmt=*/true,
786 numLoopChildren(CollapsedNum, OMPD_parallel_for) + 1, CollapsedNum);
787}
788
789OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
790 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
791 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
792 const HelperExprs &Exprs) {
793 auto *Dir = createDirective<OMPParallelForSimdDirective>(
794 C, Clauses, AssociatedStmt,
795 numLoopChildren(CollapsedNum, OMPD_parallel_for_simd), StartLoc, EndLoc,
796 CollapsedNum);
797 Dir->setIterationVariable(Exprs.IterationVarRef);
798 Dir->setLastIteration(Exprs.LastIteration);
799 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
800 Dir->setPreCond(Exprs.PreCond);
801 Dir->setCond(Exprs.Cond);
802 Dir->setInit(Exprs.Init);
803 Dir->setInc(Exprs.Inc);
804 Dir->setIsLastIterVariable(Exprs.IL);
805 Dir->setLowerBoundVariable(Exprs.LB);
806 Dir->setUpperBoundVariable(Exprs.UB);
807 Dir->setStrideVariable(Exprs.ST);
808 Dir->setEnsureUpperBound(Exprs.EUB);
809 Dir->setNextLowerBound(Exprs.NLB);
810 Dir->setNextUpperBound(Exprs.NUB);
811 Dir->setNumIterations(Exprs.NumIterations);
812 Dir->setCounters(Exprs.Counters);
813 Dir->setPrivateCounters(Exprs.PrivateCounters);
814 Dir->setInits(Exprs.Inits);
815 Dir->setUpdates(Exprs.Updates);
816 Dir->setFinals(Exprs.Finals);
817 Dir->setDependentCounters(Exprs.DependentCounters);
818 Dir->setDependentInits(Exprs.DependentInits);
819 Dir->setFinalsConditions(Exprs.FinalsConditions);
820 Dir->setPreInits(Exprs.PreInits);
821 return Dir;
822}
823
824OMPParallelForSimdDirective *
825OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
826 unsigned NumClauses,
827 unsigned CollapsedNum, EmptyShell) {
828 return createEmptyDirective<OMPParallelForSimdDirective>(
829 C, NumClauses, /*HasAssociatedStmt=*/true,
830 numLoopChildren(CollapsedNum, OMPD_parallel_for_simd), CollapsedNum);
831}
832
833OMPParallelMasterDirective *OMPParallelMasterDirective::Create(
834 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
835 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef) {
836 auto *Dir = createDirective<OMPParallelMasterDirective>(
837 C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
838 Dir->setTaskReductionRefExpr(TaskRedRef);
839 return Dir;
840}
841
842OMPParallelMasterDirective *
843OMPParallelMasterDirective::CreateEmpty(const ASTContext &C,
844 unsigned NumClauses, EmptyShell) {
845 return createEmptyDirective<OMPParallelMasterDirective>(
846 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
847}
848
849OMPParallelMaskedDirective *OMPParallelMaskedDirective::Create(
850 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
851 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef) {
852 auto *Dir = createDirective<OMPParallelMaskedDirective>(
853 C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
854 Dir->setTaskReductionRefExpr(TaskRedRef);
855 return Dir;
856}
857
858OMPParallelMaskedDirective *
859OMPParallelMaskedDirective::CreateEmpty(const ASTContext &C,
860 unsigned NumClauses, EmptyShell) {
861 return createEmptyDirective<OMPParallelMaskedDirective>(
862 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
863}
864
865OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
866 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
867 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
868 bool HasCancel) {
869 auto *Dir = createDirective<OMPParallelSectionsDirective>(
870 C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
871 Dir->setTaskReductionRefExpr(TaskRedRef);
872 Dir->setHasCancel(HasCancel);
873 return Dir;
874}
875
876OMPParallelSectionsDirective *
877OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
878 unsigned NumClauses, EmptyShell) {
879 return createEmptyDirective<OMPParallelSectionsDirective>(
880 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
881}
882
883OMPTaskDirective *
884OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
886 Stmt *AssociatedStmt, bool HasCancel) {
887 auto *Dir = createDirective<OMPTaskDirective>(
888 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
889 Dir->setHasCancel(HasCancel);
890 return Dir;
891}
892
893OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
894 unsigned NumClauses,
895 EmptyShell) {
896 return createEmptyDirective<OMPTaskDirective>(C, NumClauses,
897 /*HasAssociatedStmt=*/true);
898}
899
900OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
901 SourceLocation StartLoc,
902 SourceLocation EndLoc) {
903 return new (C) OMPTaskyieldDirective(StartLoc, EndLoc);
904}
905
906OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
907 EmptyShell) {
908 return new (C) OMPTaskyieldDirective();
909}
910
911OMPAssumeDirective *OMPAssumeDirective::Create(const ASTContext &C,
912 SourceLocation StartLoc,
913 SourceLocation EndLoc,
914 ArrayRef<OMPClause *> Clauses,
915 Stmt *AStmt) {
916 return createDirective<OMPAssumeDirective>(C, Clauses, AStmt,
917 /*NumChildren=*/0, StartLoc,
918 EndLoc);
919}
920
922 unsigned NumClauses,
923 EmptyShell) {
924 return createEmptyDirective<OMPAssumeDirective>(C, NumClauses,
925 /*HasAssociatedStmt=*/true);
926}
927
928OMPErrorDirective *OMPErrorDirective::Create(const ASTContext &C,
929 SourceLocation StartLoc,
930 SourceLocation EndLoc,
931 ArrayRef<OMPClause *> Clauses) {
932 return createDirective<OMPErrorDirective>(
933 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
934 EndLoc);
935}
936
938 unsigned NumClauses,
939 EmptyShell) {
940 return createEmptyDirective<OMPErrorDirective>(C, NumClauses);
941}
942
943OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
944 SourceLocation StartLoc,
945 SourceLocation EndLoc) {
946 return new (C) OMPBarrierDirective(StartLoc, EndLoc);
947}
948
949OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
950 EmptyShell) {
951 return new (C) OMPBarrierDirective();
952}
953
954OMPTaskwaitDirective *
955OMPTaskwaitDirective::Create(const ASTContext &C, SourceLocation StartLoc,
956 SourceLocation EndLoc,
957 ArrayRef<OMPClause *> Clauses) {
958 return createDirective<OMPTaskwaitDirective>(
959 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
960 EndLoc);
961}
962
963OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
964 unsigned NumClauses,
965 EmptyShell) {
966 return createEmptyDirective<OMPTaskwaitDirective>(C, NumClauses);
967}
968
969OMPTaskgroupDirective *OMPTaskgroupDirective::Create(
970 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
971 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) {
972 auto *Dir = createDirective<OMPTaskgroupDirective>(
973 C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
974 Dir->setReductionRef(ReductionRef);
975 return Dir;
976}
977
978OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
979 unsigned NumClauses,
980 EmptyShell) {
981 return createEmptyDirective<OMPTaskgroupDirective>(
982 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
983}
984
985OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
986 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
987 OpenMPDirectiveKind CancelRegion) {
988 auto *Dir = new (C) OMPCancellationPointDirective(StartLoc, EndLoc);
989 Dir->setCancelRegion(CancelRegion);
990 return Dir;
991}
992
995 return new (C) OMPCancellationPointDirective();
996}
997
1000 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
1001 OpenMPDirectiveKind CancelRegion) {
1002 auto *Dir = createDirective<OMPCancelDirective>(
1003 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
1004 EndLoc);
1005 Dir->setCancelRegion(CancelRegion);
1006 return Dir;
1007}
1008
1010 unsigned NumClauses,
1011 EmptyShell) {
1012 return createEmptyDirective<OMPCancelDirective>(C, NumClauses);
1013}
1014
1015OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
1016 SourceLocation StartLoc,
1017 SourceLocation EndLoc,
1018 ArrayRef<OMPClause *> Clauses) {
1019 return createDirective<OMPFlushDirective>(
1020 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
1021 EndLoc);
1022}
1023
1024OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
1025 unsigned NumClauses,
1026 EmptyShell) {
1027 return createEmptyDirective<OMPFlushDirective>(C, NumClauses);
1028}
1029
1030OMPDepobjDirective *OMPDepobjDirective::Create(const ASTContext &C,
1031 SourceLocation StartLoc,
1032 SourceLocation EndLoc,
1033 ArrayRef<OMPClause *> Clauses) {
1034 return createDirective<OMPDepobjDirective>(
1035 C, Clauses, /*AssociatedStmt=*/nullptr,
1036 /*NumChildren=*/0, StartLoc, EndLoc);
1037}
1038
1039OMPDepobjDirective *OMPDepobjDirective::CreateEmpty(const ASTContext &C,
1040 unsigned NumClauses,
1041 EmptyShell) {
1042 return createEmptyDirective<OMPDepobjDirective>(C, NumClauses);
1043}
1044
1045OMPScanDirective *OMPScanDirective::Create(const ASTContext &C,
1046 SourceLocation StartLoc,
1047 SourceLocation EndLoc,
1048 ArrayRef<OMPClause *> Clauses) {
1049 return createDirective<OMPScanDirective>(C, Clauses,
1050 /*AssociatedStmt=*/nullptr,
1051 /*NumChildren=*/0, StartLoc, EndLoc);
1052}
1053
1055 unsigned NumClauses,
1056 EmptyShell) {
1057 return createEmptyDirective<OMPScanDirective>(C, NumClauses);
1058}
1059
1060OMPOrderedStandaloneDirective *OMPOrderedStandaloneDirective::Create(
1061 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1062 ArrayRef<OMPClause *> Clauses) {
1063 return createDirective<OMPOrderedStandaloneDirective>(
1064 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
1065 EndLoc);
1066}
1067
1068OMPOrderedStandaloneDirective *
1069OMPOrderedStandaloneDirective::CreateEmpty(const ASTContext &C,
1070 unsigned NumClauses, EmptyShell) {
1071 return createEmptyDirective<OMPOrderedStandaloneDirective>(C, NumClauses);
1072}
1073
1074OMPOrderedBlockAssocDirective *OMPOrderedBlockAssocDirective::Create(
1075 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1076 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1077 return createDirective<OMPOrderedBlockAssocDirective>(
1078 C, Clauses, cast<CapturedStmt>(AssociatedStmt), /*NumChildren=*/0,
1079 StartLoc, EndLoc);
1080}
1081
1082OMPOrderedBlockAssocDirective *
1083OMPOrderedBlockAssocDirective::CreateEmpty(const ASTContext &C,
1084 unsigned NumClauses, EmptyShell) {
1085 return createEmptyDirective<OMPOrderedBlockAssocDirective>(
1086 C, NumClauses, /*HasAssociatedStmt=*/true);
1087}
1088
1089OMPAtomicDirective *
1090OMPAtomicDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1091 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
1092 Stmt *AssociatedStmt, Expressions Exprs) {
1093 auto *Dir = createDirective<OMPAtomicDirective>(
1094 C, Clauses, AssociatedStmt, /*NumChildren=*/7, StartLoc, EndLoc);
1095 Dir->setX(Exprs.X);
1096 Dir->setV(Exprs.V);
1097 Dir->setR(Exprs.R);
1098 Dir->setExpr(Exprs.E);
1099 Dir->setUpdateExpr(Exprs.UE);
1100 Dir->setD(Exprs.D);
1101 Dir->setCond(Exprs.Cond);
1102 Dir->Flags.IsXLHSInRHSPart = Exprs.IsXLHSInRHSPart ? 1 : 0;
1103 Dir->Flags.IsPostfixUpdate = Exprs.IsPostfixUpdate ? 1 : 0;
1104 Dir->Flags.IsFailOnly = Exprs.IsFailOnly ? 1 : 0;
1105 return Dir;
1106}
1107
1108OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
1109 unsigned NumClauses,
1110 EmptyShell) {
1111 return createEmptyDirective<OMPAtomicDirective>(
1112 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/7);
1113}
1114
1115OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
1116 SourceLocation StartLoc,
1117 SourceLocation EndLoc,
1118 ArrayRef<OMPClause *> Clauses,
1119 Stmt *AssociatedStmt) {
1120 return createDirective<OMPTargetDirective>(
1121 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1122}
1123
1125 unsigned NumClauses,
1126 EmptyShell) {
1127 return createEmptyDirective<OMPTargetDirective>(C, NumClauses,
1128 /*HasAssociatedStmt=*/true);
1129}
1130
1131OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
1132 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1133 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
1134 bool HasCancel) {
1135 auto *Dir = createDirective<OMPTargetParallelDirective>(
1136 C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
1137 Dir->setTaskReductionRefExpr(TaskRedRef);
1138 Dir->setHasCancel(HasCancel);
1139 return Dir;
1140}
1141
1144 unsigned NumClauses, EmptyShell) {
1145 return createEmptyDirective<OMPTargetParallelDirective>(
1146 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
1147}
1148
1149OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
1150 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1151 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1152 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1153 auto *Dir = createDirective<OMPTargetParallelForDirective>(
1154 C, Clauses, AssociatedStmt,
1155 numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1, StartLoc,
1156 EndLoc, CollapsedNum);
1157 Dir->setIterationVariable(Exprs.IterationVarRef);
1158 Dir->setLastIteration(Exprs.LastIteration);
1159 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1160 Dir->setPreCond(Exprs.PreCond);
1161 Dir->setCond(Exprs.Cond);
1162 Dir->setInit(Exprs.Init);
1163 Dir->setInc(Exprs.Inc);
1164 Dir->setIsLastIterVariable(Exprs.IL);
1165 Dir->setLowerBoundVariable(Exprs.LB);
1166 Dir->setUpperBoundVariable(Exprs.UB);
1167 Dir->setStrideVariable(Exprs.ST);
1168 Dir->setEnsureUpperBound(Exprs.EUB);
1169 Dir->setNextLowerBound(Exprs.NLB);
1170 Dir->setNextUpperBound(Exprs.NUB);
1171 Dir->setNumIterations(Exprs.NumIterations);
1172 Dir->setCounters(Exprs.Counters);
1173 Dir->setPrivateCounters(Exprs.PrivateCounters);
1174 Dir->setInits(Exprs.Inits);
1175 Dir->setUpdates(Exprs.Updates);
1176 Dir->setFinals(Exprs.Finals);
1177 Dir->setDependentCounters(Exprs.DependentCounters);
1178 Dir->setDependentInits(Exprs.DependentInits);
1179 Dir->setFinalsConditions(Exprs.FinalsConditions);
1180 Dir->setPreInits(Exprs.PreInits);
1181 Dir->setTaskReductionRefExpr(TaskRedRef);
1182 Dir->setHasCancel(HasCancel);
1183 return Dir;
1184}
1185
1188 unsigned NumClauses,
1189 unsigned CollapsedNum, EmptyShell) {
1190 return createEmptyDirective<OMPTargetParallelForDirective>(
1191 C, NumClauses, /*HasAssociatedStmt=*/true,
1192 numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1,
1193 CollapsedNum);
1194}
1195
1196OMPTargetDataDirective *OMPTargetDataDirective::Create(
1197 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1198 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1199 return createDirective<OMPTargetDataDirective>(
1200 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1201}
1202
1203OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
1204 unsigned N,
1205 EmptyShell) {
1206 return createEmptyDirective<OMPTargetDataDirective>(
1207 C, N, /*HasAssociatedStmt=*/true);
1208}
1209
1210OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
1211 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1212 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1213 return createDirective<OMPTargetEnterDataDirective>(
1214 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1215}
1216
1219 EmptyShell) {
1220 return createEmptyDirective<OMPTargetEnterDataDirective>(
1221 C, N, /*HasAssociatedStmt=*/true);
1222}
1223
1224OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create(
1225 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1226 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1227 return createDirective<OMPTargetExitDataDirective>(
1228 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1229}
1230
1233 EmptyShell) {
1234 return createEmptyDirective<OMPTargetExitDataDirective>(
1235 C, N, /*HasAssociatedStmt=*/true);
1236}
1237
1238OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
1239 SourceLocation StartLoc,
1240 SourceLocation EndLoc,
1241 ArrayRef<OMPClause *> Clauses,
1242 Stmt *AssociatedStmt) {
1243 return createDirective<OMPTeamsDirective>(
1244 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1245}
1246
1248 unsigned NumClauses,
1249 EmptyShell) {
1250 return createEmptyDirective<OMPTeamsDirective>(C, NumClauses,
1251 /*HasAssociatedStmt=*/true);
1252}
1253
1254OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
1255 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1256 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1257 const HelperExprs &Exprs, bool HasCancel) {
1258 auto *Dir = createDirective<OMPTaskLoopDirective>(
1259 C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_taskloop),
1260 StartLoc, EndLoc, CollapsedNum);
1261 Dir->setIterationVariable(Exprs.IterationVarRef);
1262 Dir->setLastIteration(Exprs.LastIteration);
1263 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1264 Dir->setPreCond(Exprs.PreCond);
1265 Dir->setCond(Exprs.Cond);
1266 Dir->setInit(Exprs.Init);
1267 Dir->setInc(Exprs.Inc);
1268 Dir->setIsLastIterVariable(Exprs.IL);
1269 Dir->setLowerBoundVariable(Exprs.LB);
1270 Dir->setUpperBoundVariable(Exprs.UB);
1271 Dir->setStrideVariable(Exprs.ST);
1272 Dir->setEnsureUpperBound(Exprs.EUB);
1273 Dir->setNextLowerBound(Exprs.NLB);
1274 Dir->setNextUpperBound(Exprs.NUB);
1275 Dir->setNumIterations(Exprs.NumIterations);
1276 Dir->setCounters(Exprs.Counters);
1277 Dir->setPrivateCounters(Exprs.PrivateCounters);
1278 Dir->setInits(Exprs.Inits);
1279 Dir->setUpdates(Exprs.Updates);
1280 Dir->setFinals(Exprs.Finals);
1281 Dir->setDependentCounters(Exprs.DependentCounters);
1282 Dir->setDependentInits(Exprs.DependentInits);
1283 Dir->setFinalsConditions(Exprs.FinalsConditions);
1284 Dir->setPreInits(Exprs.PreInits);
1285 Dir->setHasCancel(HasCancel);
1286 return Dir;
1287}
1288
1290 unsigned NumClauses,
1291 unsigned CollapsedNum,
1292 EmptyShell) {
1293 return createEmptyDirective<OMPTaskLoopDirective>(
1294 C, NumClauses, /*HasAssociatedStmt=*/true,
1295 numLoopChildren(CollapsedNum, OMPD_taskloop), CollapsedNum);
1296}
1297
1298OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
1299 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1300 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1301 const HelperExprs &Exprs) {
1302 auto *Dir = createDirective<OMPTaskLoopSimdDirective>(
1303 C, Clauses, AssociatedStmt,
1304 numLoopChildren(CollapsedNum, OMPD_taskloop_simd), StartLoc, EndLoc,
1305 CollapsedNum);
1306 Dir->setIterationVariable(Exprs.IterationVarRef);
1307 Dir->setLastIteration(Exprs.LastIteration);
1308 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1309 Dir->setPreCond(Exprs.PreCond);
1310 Dir->setCond(Exprs.Cond);
1311 Dir->setInit(Exprs.Init);
1312 Dir->setInc(Exprs.Inc);
1313 Dir->setIsLastIterVariable(Exprs.IL);
1314 Dir->setLowerBoundVariable(Exprs.LB);
1315 Dir->setUpperBoundVariable(Exprs.UB);
1316 Dir->setStrideVariable(Exprs.ST);
1317 Dir->setEnsureUpperBound(Exprs.EUB);
1318 Dir->setNextLowerBound(Exprs.NLB);
1319 Dir->setNextUpperBound(Exprs.NUB);
1320 Dir->setNumIterations(Exprs.NumIterations);
1321 Dir->setCounters(Exprs.Counters);
1322 Dir->setPrivateCounters(Exprs.PrivateCounters);
1323 Dir->setInits(Exprs.Inits);
1324 Dir->setUpdates(Exprs.Updates);
1325 Dir->setFinals(Exprs.Finals);
1326 Dir->setDependentCounters(Exprs.DependentCounters);
1327 Dir->setDependentInits(Exprs.DependentInits);
1328 Dir->setFinalsConditions(Exprs.FinalsConditions);
1329 Dir->setPreInits(Exprs.PreInits);
1330 return Dir;
1331}
1332
1335 unsigned CollapsedNum, EmptyShell) {
1336 return createEmptyDirective<OMPTaskLoopSimdDirective>(
1337 C, NumClauses, /*HasAssociatedStmt=*/true,
1338 numLoopChildren(CollapsedNum, OMPD_taskloop_simd), CollapsedNum);
1339}
1340
1341OMPMasterTaskLoopDirective *OMPMasterTaskLoopDirective::Create(
1342 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1343 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1344 const HelperExprs &Exprs, bool HasCancel) {
1345 auto *Dir = createDirective<OMPMasterTaskLoopDirective>(
1346 C, Clauses, AssociatedStmt,
1347 numLoopChildren(CollapsedNum, OMPD_master_taskloop), StartLoc, EndLoc,
1348 CollapsedNum);
1349 Dir->setIterationVariable(Exprs.IterationVarRef);
1350 Dir->setLastIteration(Exprs.LastIteration);
1351 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1352 Dir->setPreCond(Exprs.PreCond);
1353 Dir->setCond(Exprs.Cond);
1354 Dir->setInit(Exprs.Init);
1355 Dir->setInc(Exprs.Inc);
1356 Dir->setIsLastIterVariable(Exprs.IL);
1357 Dir->setLowerBoundVariable(Exprs.LB);
1358 Dir->setUpperBoundVariable(Exprs.UB);
1359 Dir->setStrideVariable(Exprs.ST);
1360 Dir->setEnsureUpperBound(Exprs.EUB);
1361 Dir->setNextLowerBound(Exprs.NLB);
1362 Dir->setNextUpperBound(Exprs.NUB);
1363 Dir->setNumIterations(Exprs.NumIterations);
1364 Dir->setCounters(Exprs.Counters);
1365 Dir->setPrivateCounters(Exprs.PrivateCounters);
1366 Dir->setInits(Exprs.Inits);
1367 Dir->setUpdates(Exprs.Updates);
1368 Dir->setFinals(Exprs.Finals);
1369 Dir->setDependentCounters(Exprs.DependentCounters);
1370 Dir->setDependentInits(Exprs.DependentInits);
1371 Dir->setFinalsConditions(Exprs.FinalsConditions);
1372 Dir->setPreInits(Exprs.PreInits);
1373 Dir->setHasCancel(HasCancel);
1374 return Dir;
1375}
1376
1379 unsigned NumClauses,
1380 unsigned CollapsedNum, EmptyShell) {
1381 return createEmptyDirective<OMPMasterTaskLoopDirective>(
1382 C, NumClauses, /*HasAssociatedStmt=*/true,
1383 numLoopChildren(CollapsedNum, OMPD_master_taskloop), CollapsedNum);
1384}
1385
1386OMPMaskedTaskLoopDirective *OMPMaskedTaskLoopDirective::Create(
1387 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1388 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1389 const HelperExprs &Exprs, bool HasCancel) {
1390 auto *Dir = createDirective<OMPMaskedTaskLoopDirective>(
1391 C, Clauses, AssociatedStmt,
1392 numLoopChildren(CollapsedNum, OMPD_masked_taskloop), StartLoc, EndLoc,
1393 CollapsedNum);
1394 Dir->setIterationVariable(Exprs.IterationVarRef);
1395 Dir->setLastIteration(Exprs.LastIteration);
1396 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1397 Dir->setPreCond(Exprs.PreCond);
1398 Dir->setCond(Exprs.Cond);
1399 Dir->setInit(Exprs.Init);
1400 Dir->setInc(Exprs.Inc);
1401 Dir->setIsLastIterVariable(Exprs.IL);
1402 Dir->setLowerBoundVariable(Exprs.LB);
1403 Dir->setUpperBoundVariable(Exprs.UB);
1404 Dir->setStrideVariable(Exprs.ST);
1405 Dir->setEnsureUpperBound(Exprs.EUB);
1406 Dir->setNextLowerBound(Exprs.NLB);
1407 Dir->setNextUpperBound(Exprs.NUB);
1408 Dir->setNumIterations(Exprs.NumIterations);
1409 Dir->setCounters(Exprs.Counters);
1410 Dir->setPrivateCounters(Exprs.PrivateCounters);
1411 Dir->setInits(Exprs.Inits);
1412 Dir->setUpdates(Exprs.Updates);
1413 Dir->setFinals(Exprs.Finals);
1414 Dir->setDependentCounters(Exprs.DependentCounters);
1415 Dir->setDependentInits(Exprs.DependentInits);
1416 Dir->setFinalsConditions(Exprs.FinalsConditions);
1417 Dir->setPreInits(Exprs.PreInits);
1418 Dir->setHasCancel(HasCancel);
1419 return Dir;
1420}
1421
1424 unsigned NumClauses,
1425 unsigned CollapsedNum, EmptyShell) {
1426 return createEmptyDirective<OMPMaskedTaskLoopDirective>(
1427 C, NumClauses, /*HasAssociatedStmt=*/true,
1428 numLoopChildren(CollapsedNum, OMPD_masked_taskloop), CollapsedNum);
1429}
1430
1431OMPMasterTaskLoopSimdDirective *OMPMasterTaskLoopSimdDirective::Create(
1432 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1433 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1434 const HelperExprs &Exprs) {
1435 auto *Dir = createDirective<OMPMasterTaskLoopSimdDirective>(
1436 C, Clauses, AssociatedStmt,
1437 numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), StartLoc,
1438 EndLoc, CollapsedNum);
1439 Dir->setIterationVariable(Exprs.IterationVarRef);
1440 Dir->setLastIteration(Exprs.LastIteration);
1441 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1442 Dir->setPreCond(Exprs.PreCond);
1443 Dir->setCond(Exprs.Cond);
1444 Dir->setInit(Exprs.Init);
1445 Dir->setInc(Exprs.Inc);
1446 Dir->setIsLastIterVariable(Exprs.IL);
1447 Dir->setLowerBoundVariable(Exprs.LB);
1448 Dir->setUpperBoundVariable(Exprs.UB);
1449 Dir->setStrideVariable(Exprs.ST);
1450 Dir->setEnsureUpperBound(Exprs.EUB);
1451 Dir->setNextLowerBound(Exprs.NLB);
1452 Dir->setNextUpperBound(Exprs.NUB);
1453 Dir->setNumIterations(Exprs.NumIterations);
1454 Dir->setCounters(Exprs.Counters);
1455 Dir->setPrivateCounters(Exprs.PrivateCounters);
1456 Dir->setInits(Exprs.Inits);
1457 Dir->setUpdates(Exprs.Updates);
1458 Dir->setFinals(Exprs.Finals);
1459 Dir->setDependentCounters(Exprs.DependentCounters);
1460 Dir->setDependentInits(Exprs.DependentInits);
1461 Dir->setFinalsConditions(Exprs.FinalsConditions);
1462 Dir->setPreInits(Exprs.PreInits);
1463 return Dir;
1464}
1465
1468 unsigned NumClauses,
1469 unsigned CollapsedNum, EmptyShell) {
1470 return createEmptyDirective<OMPMasterTaskLoopSimdDirective>(
1471 C, NumClauses, /*HasAssociatedStmt=*/true,
1472 numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), CollapsedNum);
1473}
1474
1475OMPMaskedTaskLoopSimdDirective *OMPMaskedTaskLoopSimdDirective::Create(
1476 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1477 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1478 const HelperExprs &Exprs) {
1479 auto *Dir = createDirective<OMPMaskedTaskLoopSimdDirective>(
1480 C, Clauses, AssociatedStmt,
1481 numLoopChildren(CollapsedNum, OMPD_masked_taskloop_simd), StartLoc,
1482 EndLoc, CollapsedNum);
1483 Dir->setIterationVariable(Exprs.IterationVarRef);
1484 Dir->setLastIteration(Exprs.LastIteration);
1485 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1486 Dir->setPreCond(Exprs.PreCond);
1487 Dir->setCond(Exprs.Cond);
1488 Dir->setInit(Exprs.Init);
1489 Dir->setInc(Exprs.Inc);
1490 Dir->setIsLastIterVariable(Exprs.IL);
1491 Dir->setLowerBoundVariable(Exprs.LB);
1492 Dir->setUpperBoundVariable(Exprs.UB);
1493 Dir->setStrideVariable(Exprs.ST);
1494 Dir->setEnsureUpperBound(Exprs.EUB);
1495 Dir->setNextLowerBound(Exprs.NLB);
1496 Dir->setNextUpperBound(Exprs.NUB);
1497 Dir->setNumIterations(Exprs.NumIterations);
1498 Dir->setCounters(Exprs.Counters);
1499 Dir->setPrivateCounters(Exprs.PrivateCounters);
1500 Dir->setInits(Exprs.Inits);
1501 Dir->setUpdates(Exprs.Updates);
1502 Dir->setFinals(Exprs.Finals);
1503 Dir->setDependentCounters(Exprs.DependentCounters);
1504 Dir->setDependentInits(Exprs.DependentInits);
1505 Dir->setFinalsConditions(Exprs.FinalsConditions);
1506 Dir->setPreInits(Exprs.PreInits);
1507 return Dir;
1508}
1509
1512 unsigned NumClauses,
1513 unsigned CollapsedNum, EmptyShell) {
1514 return createEmptyDirective<OMPMaskedTaskLoopSimdDirective>(
1515 C, NumClauses, /*HasAssociatedStmt=*/true,
1516 numLoopChildren(CollapsedNum, OMPD_masked_taskloop_simd), CollapsedNum);
1517}
1518
1519OMPParallelMasterTaskLoopDirective *OMPParallelMasterTaskLoopDirective::Create(
1520 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1521 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1522 const HelperExprs &Exprs, bool HasCancel) {
1523 auto *Dir = createDirective<OMPParallelMasterTaskLoopDirective>(
1524 C, Clauses, AssociatedStmt,
1525 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop), StartLoc,
1526 EndLoc, CollapsedNum);
1527 Dir->setIterationVariable(Exprs.IterationVarRef);
1528 Dir->setLastIteration(Exprs.LastIteration);
1529 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1530 Dir->setPreCond(Exprs.PreCond);
1531 Dir->setCond(Exprs.Cond);
1532 Dir->setInit(Exprs.Init);
1533 Dir->setInc(Exprs.Inc);
1534 Dir->setIsLastIterVariable(Exprs.IL);
1535 Dir->setLowerBoundVariable(Exprs.LB);
1536 Dir->setUpperBoundVariable(Exprs.UB);
1537 Dir->setStrideVariable(Exprs.ST);
1538 Dir->setEnsureUpperBound(Exprs.EUB);
1539 Dir->setNextLowerBound(Exprs.NLB);
1540 Dir->setNextUpperBound(Exprs.NUB);
1541 Dir->setNumIterations(Exprs.NumIterations);
1542 Dir->setCounters(Exprs.Counters);
1543 Dir->setPrivateCounters(Exprs.PrivateCounters);
1544 Dir->setInits(Exprs.Inits);
1545 Dir->setUpdates(Exprs.Updates);
1546 Dir->setFinals(Exprs.Finals);
1547 Dir->setDependentCounters(Exprs.DependentCounters);
1548 Dir->setDependentInits(Exprs.DependentInits);
1549 Dir->setFinalsConditions(Exprs.FinalsConditions);
1550 Dir->setPreInits(Exprs.PreInits);
1551 Dir->setHasCancel(HasCancel);
1552 return Dir;
1553}
1554
1557 unsigned NumClauses,
1558 unsigned CollapsedNum,
1559 EmptyShell) {
1560 return createEmptyDirective<OMPParallelMasterTaskLoopDirective>(
1561 C, NumClauses, /*HasAssociatedStmt=*/true,
1562 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop),
1563 CollapsedNum);
1564}
1565
1566OMPParallelMaskedTaskLoopDirective *OMPParallelMaskedTaskLoopDirective::Create(
1567 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1568 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1569 const HelperExprs &Exprs, bool HasCancel) {
1570 auto *Dir = createDirective<OMPParallelMaskedTaskLoopDirective>(
1571 C, Clauses, AssociatedStmt,
1572 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop), StartLoc,
1573 EndLoc, CollapsedNum);
1574 Dir->setIterationVariable(Exprs.IterationVarRef);
1575 Dir->setLastIteration(Exprs.LastIteration);
1576 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1577 Dir->setPreCond(Exprs.PreCond);
1578 Dir->setCond(Exprs.Cond);
1579 Dir->setInit(Exprs.Init);
1580 Dir->setInc(Exprs.Inc);
1581 Dir->setIsLastIterVariable(Exprs.IL);
1582 Dir->setLowerBoundVariable(Exprs.LB);
1583 Dir->setUpperBoundVariable(Exprs.UB);
1584 Dir->setStrideVariable(Exprs.ST);
1585 Dir->setEnsureUpperBound(Exprs.EUB);
1586 Dir->setNextLowerBound(Exprs.NLB);
1587 Dir->setNextUpperBound(Exprs.NUB);
1588 Dir->setNumIterations(Exprs.NumIterations);
1589 Dir->setCounters(Exprs.Counters);
1590 Dir->setPrivateCounters(Exprs.PrivateCounters);
1591 Dir->setInits(Exprs.Inits);
1592 Dir->setUpdates(Exprs.Updates);
1593 Dir->setFinals(Exprs.Finals);
1594 Dir->setDependentCounters(Exprs.DependentCounters);
1595 Dir->setDependentInits(Exprs.DependentInits);
1596 Dir->setFinalsConditions(Exprs.FinalsConditions);
1597 Dir->setPreInits(Exprs.PreInits);
1598 Dir->setHasCancel(HasCancel);
1599 return Dir;
1600}
1601
1604 unsigned NumClauses,
1605 unsigned CollapsedNum,
1606 EmptyShell) {
1607 return createEmptyDirective<OMPParallelMaskedTaskLoopDirective>(
1608 C, NumClauses, /*HasAssociatedStmt=*/true,
1609 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop),
1610 CollapsedNum);
1611}
1612
1615 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1616 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1617 const HelperExprs &Exprs) {
1618 auto *Dir = createDirective<OMPParallelMasterTaskLoopSimdDirective>(
1619 C, Clauses, AssociatedStmt,
1620 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd),
1621 StartLoc, EndLoc, CollapsedNum);
1622 Dir->setIterationVariable(Exprs.IterationVarRef);
1623 Dir->setLastIteration(Exprs.LastIteration);
1624 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1625 Dir->setPreCond(Exprs.PreCond);
1626 Dir->setCond(Exprs.Cond);
1627 Dir->setInit(Exprs.Init);
1628 Dir->setInc(Exprs.Inc);
1629 Dir->setIsLastIterVariable(Exprs.IL);
1630 Dir->setLowerBoundVariable(Exprs.LB);
1631 Dir->setUpperBoundVariable(Exprs.UB);
1632 Dir->setStrideVariable(Exprs.ST);
1633 Dir->setEnsureUpperBound(Exprs.EUB);
1634 Dir->setNextLowerBound(Exprs.NLB);
1635 Dir->setNextUpperBound(Exprs.NUB);
1636 Dir->setNumIterations(Exprs.NumIterations);
1637 Dir->setCounters(Exprs.Counters);
1638 Dir->setPrivateCounters(Exprs.PrivateCounters);
1639 Dir->setInits(Exprs.Inits);
1640 Dir->setUpdates(Exprs.Updates);
1641 Dir->setFinals(Exprs.Finals);
1642 Dir->setDependentCounters(Exprs.DependentCounters);
1643 Dir->setDependentInits(Exprs.DependentInits);
1644 Dir->setFinalsConditions(Exprs.FinalsConditions);
1645 Dir->setPreInits(Exprs.PreInits);
1646 return Dir;
1647}
1648
1651 unsigned NumClauses,
1652 unsigned CollapsedNum,
1653 EmptyShell) {
1654 return createEmptyDirective<OMPParallelMasterTaskLoopSimdDirective>(
1655 C, NumClauses, /*HasAssociatedStmt=*/true,
1656 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd),
1657 CollapsedNum);
1658}
1659
1662 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1663 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1664 const HelperExprs &Exprs) {
1665 auto *Dir = createDirective<OMPParallelMaskedTaskLoopSimdDirective>(
1666 C, Clauses, AssociatedStmt,
1667 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop_simd),
1668 StartLoc, EndLoc, CollapsedNum);
1669 Dir->setIterationVariable(Exprs.IterationVarRef);
1670 Dir->setLastIteration(Exprs.LastIteration);
1671 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1672 Dir->setPreCond(Exprs.PreCond);
1673 Dir->setCond(Exprs.Cond);
1674 Dir->setInit(Exprs.Init);
1675 Dir->setInc(Exprs.Inc);
1676 Dir->setIsLastIterVariable(Exprs.IL);
1677 Dir->setLowerBoundVariable(Exprs.LB);
1678 Dir->setUpperBoundVariable(Exprs.UB);
1679 Dir->setStrideVariable(Exprs.ST);
1680 Dir->setEnsureUpperBound(Exprs.EUB);
1681 Dir->setNextLowerBound(Exprs.NLB);
1682 Dir->setNextUpperBound(Exprs.NUB);
1683 Dir->setNumIterations(Exprs.NumIterations);
1684 Dir->setCounters(Exprs.Counters);
1685 Dir->setPrivateCounters(Exprs.PrivateCounters);
1686 Dir->setInits(Exprs.Inits);
1687 Dir->setUpdates(Exprs.Updates);
1688 Dir->setFinals(Exprs.Finals);
1689 Dir->setDependentCounters(Exprs.DependentCounters);
1690 Dir->setDependentInits(Exprs.DependentInits);
1691 Dir->setFinalsConditions(Exprs.FinalsConditions);
1692 Dir->setPreInits(Exprs.PreInits);
1693 return Dir;
1694}
1695
1698 unsigned NumClauses,
1699 unsigned CollapsedNum,
1700 EmptyShell) {
1701 return createEmptyDirective<OMPParallelMaskedTaskLoopSimdDirective>(
1702 C, NumClauses, /*HasAssociatedStmt=*/true,
1703 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop_simd),
1704 CollapsedNum);
1705}
1706
1709 SourceLocation EndLoc, unsigned CollapsedNum,
1710 ArrayRef<OMPClause *> Clauses,
1711 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
1712 auto *Dir = createDirective<OMPDistributeDirective>(
1713 C, Clauses, AssociatedStmt,
1714 numLoopChildren(CollapsedNum, OMPD_distribute), StartLoc, EndLoc,
1715 CollapsedNum);
1716 Dir->setIterationVariable(Exprs.IterationVarRef);
1717 Dir->setLastIteration(Exprs.LastIteration);
1718 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1719 Dir->setPreCond(Exprs.PreCond);
1720 Dir->setCond(Exprs.Cond);
1721 Dir->setInit(Exprs.Init);
1722 Dir->setInc(Exprs.Inc);
1723 Dir->setIsLastIterVariable(Exprs.IL);
1724 Dir->setLowerBoundVariable(Exprs.LB);
1725 Dir->setUpperBoundVariable(Exprs.UB);
1726 Dir->setStrideVariable(Exprs.ST);
1727 Dir->setEnsureUpperBound(Exprs.EUB);
1728 Dir->setNextLowerBound(Exprs.NLB);
1729 Dir->setNextUpperBound(Exprs.NUB);
1730 Dir->setNumIterations(Exprs.NumIterations);
1731 Dir->setCounters(Exprs.Counters);
1732 Dir->setPrivateCounters(Exprs.PrivateCounters);
1733 Dir->setInits(Exprs.Inits);
1734 Dir->setUpdates(Exprs.Updates);
1735 Dir->setFinals(Exprs.Finals);
1736 Dir->setDependentCounters(Exprs.DependentCounters);
1737 Dir->setDependentInits(Exprs.DependentInits);
1738 Dir->setFinalsConditions(Exprs.FinalsConditions);
1739 Dir->setPreInits(Exprs.PreInits);
1740 return Dir;
1741}
1742
1745 unsigned CollapsedNum, EmptyShell) {
1746 return createEmptyDirective<OMPDistributeDirective>(
1747 C, NumClauses, /*HasAssociatedStmt=*/true,
1748 numLoopChildren(CollapsedNum, OMPD_distribute), CollapsedNum);
1749}
1750
1751OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create(
1752 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1753 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1754 return createDirective<OMPTargetUpdateDirective>(C, Clauses, AssociatedStmt,
1755 /*NumChildren=*/0, StartLoc,
1756 EndLoc);
1757}
1758
1761 EmptyShell) {
1762 return createEmptyDirective<OMPTargetUpdateDirective>(
1763 C, NumClauses, /*HasAssociatedStmt=*/true);
1764}
1765
1766OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1767 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1768 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1769 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1770 auto *Dir = createDirective<OMPDistributeParallelForDirective>(
1771 C, Clauses, AssociatedStmt,
1772 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1, StartLoc,
1773 EndLoc, CollapsedNum);
1774 Dir->setIterationVariable(Exprs.IterationVarRef);
1775 Dir->setLastIteration(Exprs.LastIteration);
1776 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1777 Dir->setPreCond(Exprs.PreCond);
1778 Dir->setCond(Exprs.Cond);
1779 Dir->setInit(Exprs.Init);
1780 Dir->setInc(Exprs.Inc);
1781 Dir->setIsLastIterVariable(Exprs.IL);
1782 Dir->setLowerBoundVariable(Exprs.LB);
1783 Dir->setUpperBoundVariable(Exprs.UB);
1784 Dir->setStrideVariable(Exprs.ST);
1785 Dir->setEnsureUpperBound(Exprs.EUB);
1786 Dir->setNextLowerBound(Exprs.NLB);
1787 Dir->setNextUpperBound(Exprs.NUB);
1788 Dir->setNumIterations(Exprs.NumIterations);
1789 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1790 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1791 Dir->setDistInc(Exprs.DistInc);
1792 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1793 Dir->setCounters(Exprs.Counters);
1794 Dir->setPrivateCounters(Exprs.PrivateCounters);
1795 Dir->setInits(Exprs.Inits);
1796 Dir->setUpdates(Exprs.Updates);
1797 Dir->setFinals(Exprs.Finals);
1798 Dir->setDependentCounters(Exprs.DependentCounters);
1799 Dir->setDependentInits(Exprs.DependentInits);
1800 Dir->setFinalsConditions(Exprs.FinalsConditions);
1801 Dir->setPreInits(Exprs.PreInits);
1802 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1803 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1804 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1805 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1806 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1807 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1808 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1809 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1810 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1811 Dir->setTaskReductionRefExpr(TaskRedRef);
1812 Dir->HasCancel = HasCancel;
1813 return Dir;
1814}
1815
1818 unsigned NumClauses,
1819 unsigned CollapsedNum,
1820 EmptyShell) {
1821 return createEmptyDirective<OMPDistributeParallelForDirective>(
1822 C, NumClauses, /*HasAssociatedStmt=*/true,
1823 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1,
1824 CollapsedNum);
1825}
1826
1829 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1830 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1831 const HelperExprs &Exprs) {
1832 auto *Dir = createDirective<OMPDistributeParallelForSimdDirective>(
1833 C, Clauses, AssociatedStmt,
1834 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1835 StartLoc, EndLoc, CollapsedNum);
1836 Dir->setIterationVariable(Exprs.IterationVarRef);
1837 Dir->setLastIteration(Exprs.LastIteration);
1838 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1839 Dir->setPreCond(Exprs.PreCond);
1840 Dir->setCond(Exprs.Cond);
1841 Dir->setInit(Exprs.Init);
1842 Dir->setInc(Exprs.Inc);
1843 Dir->setIsLastIterVariable(Exprs.IL);
1844 Dir->setLowerBoundVariable(Exprs.LB);
1845 Dir->setUpperBoundVariable(Exprs.UB);
1846 Dir->setStrideVariable(Exprs.ST);
1847 Dir->setEnsureUpperBound(Exprs.EUB);
1848 Dir->setNextLowerBound(Exprs.NLB);
1849 Dir->setNextUpperBound(Exprs.NUB);
1850 Dir->setNumIterations(Exprs.NumIterations);
1851 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1852 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1853 Dir->setDistInc(Exprs.DistInc);
1854 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1855 Dir->setCounters(Exprs.Counters);
1856 Dir->setPrivateCounters(Exprs.PrivateCounters);
1857 Dir->setInits(Exprs.Inits);
1858 Dir->setUpdates(Exprs.Updates);
1859 Dir->setFinals(Exprs.Finals);
1860 Dir->setDependentCounters(Exprs.DependentCounters);
1861 Dir->setDependentInits(Exprs.DependentInits);
1862 Dir->setFinalsConditions(Exprs.FinalsConditions);
1863 Dir->setPreInits(Exprs.PreInits);
1864 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1865 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1866 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1867 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1868 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1869 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1870 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1871 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1872 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1873 return Dir;
1874}
1875
1878 unsigned NumClauses,
1879 unsigned CollapsedNum,
1880 EmptyShell) {
1881 return createEmptyDirective<OMPDistributeParallelForSimdDirective>(
1882 C, NumClauses, /*HasAssociatedStmt=*/true,
1883 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1884 CollapsedNum);
1885}
1886
1887OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1888 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1889 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1890 const HelperExprs &Exprs) {
1891 auto *Dir = createDirective<OMPDistributeSimdDirective>(
1892 C, Clauses, AssociatedStmt,
1893 numLoopChildren(CollapsedNum, OMPD_distribute_simd), StartLoc, EndLoc,
1894 CollapsedNum);
1895 Dir->setIterationVariable(Exprs.IterationVarRef);
1896 Dir->setLastIteration(Exprs.LastIteration);
1897 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1898 Dir->setPreCond(Exprs.PreCond);
1899 Dir->setCond(Exprs.Cond);
1900 Dir->setInit(Exprs.Init);
1901 Dir->setInc(Exprs.Inc);
1902 Dir->setIsLastIterVariable(Exprs.IL);
1903 Dir->setLowerBoundVariable(Exprs.LB);
1904 Dir->setUpperBoundVariable(Exprs.UB);
1905 Dir->setStrideVariable(Exprs.ST);
1906 Dir->setEnsureUpperBound(Exprs.EUB);
1907 Dir->setNextLowerBound(Exprs.NLB);
1908 Dir->setNextUpperBound(Exprs.NUB);
1909 Dir->setNumIterations(Exprs.NumIterations);
1910 Dir->setCounters(Exprs.Counters);
1911 Dir->setPrivateCounters(Exprs.PrivateCounters);
1912 Dir->setInits(Exprs.Inits);
1913 Dir->setUpdates(Exprs.Updates);
1914 Dir->setFinals(Exprs.Finals);
1915 Dir->setDependentCounters(Exprs.DependentCounters);
1916 Dir->setDependentInits(Exprs.DependentInits);
1917 Dir->setFinalsConditions(Exprs.FinalsConditions);
1918 Dir->setPreInits(Exprs.PreInits);
1919 return Dir;
1920}
1921
1924 unsigned NumClauses,
1925 unsigned CollapsedNum, EmptyShell) {
1926 return createEmptyDirective<OMPDistributeSimdDirective>(
1927 C, NumClauses, /*HasAssociatedStmt=*/true,
1928 numLoopChildren(CollapsedNum, OMPD_distribute_simd), CollapsedNum);
1929}
1930
1931OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1932 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1933 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1934 const HelperExprs &Exprs) {
1935 auto *Dir = createDirective<OMPTargetParallelForSimdDirective>(
1936 C, Clauses, AssociatedStmt,
1937 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd), StartLoc,
1938 EndLoc, CollapsedNum);
1939 Dir->setIterationVariable(Exprs.IterationVarRef);
1940 Dir->setLastIteration(Exprs.LastIteration);
1941 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1942 Dir->setPreCond(Exprs.PreCond);
1943 Dir->setCond(Exprs.Cond);
1944 Dir->setInit(Exprs.Init);
1945 Dir->setInc(Exprs.Inc);
1946 Dir->setIsLastIterVariable(Exprs.IL);
1947 Dir->setLowerBoundVariable(Exprs.LB);
1948 Dir->setUpperBoundVariable(Exprs.UB);
1949 Dir->setStrideVariable(Exprs.ST);
1950 Dir->setEnsureUpperBound(Exprs.EUB);
1951 Dir->setNextLowerBound(Exprs.NLB);
1952 Dir->setNextUpperBound(Exprs.NUB);
1953 Dir->setNumIterations(Exprs.NumIterations);
1954 Dir->setCounters(Exprs.Counters);
1955 Dir->setPrivateCounters(Exprs.PrivateCounters);
1956 Dir->setInits(Exprs.Inits);
1957 Dir->setUpdates(Exprs.Updates);
1958 Dir->setFinals(Exprs.Finals);
1959 Dir->setDependentCounters(Exprs.DependentCounters);
1960 Dir->setDependentInits(Exprs.DependentInits);
1961 Dir->setFinalsConditions(Exprs.FinalsConditions);
1962 Dir->setPreInits(Exprs.PreInits);
1963 return Dir;
1964}
1965
1968 unsigned NumClauses,
1969 unsigned CollapsedNum,
1970 EmptyShell) {
1971 return createEmptyDirective<OMPTargetParallelForSimdDirective>(
1972 C, NumClauses, /*HasAssociatedStmt=*/true,
1973 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd),
1974 CollapsedNum);
1975}
1976
1979 SourceLocation EndLoc, unsigned CollapsedNum,
1980 ArrayRef<OMPClause *> Clauses,
1981 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
1982 auto *Dir = createDirective<OMPTargetSimdDirective>(
1983 C, Clauses, AssociatedStmt,
1984 numLoopChildren(CollapsedNum, OMPD_target_simd), StartLoc, EndLoc,
1985 CollapsedNum);
1986 Dir->setIterationVariable(Exprs.IterationVarRef);
1987 Dir->setLastIteration(Exprs.LastIteration);
1988 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1989 Dir->setPreCond(Exprs.PreCond);
1990 Dir->setCond(Exprs.Cond);
1991 Dir->setInit(Exprs.Init);
1992 Dir->setInc(Exprs.Inc);
1993 Dir->setCounters(Exprs.Counters);
1994 Dir->setPrivateCounters(Exprs.PrivateCounters);
1995 Dir->setInits(Exprs.Inits);
1996 Dir->setUpdates(Exprs.Updates);
1997 Dir->setFinals(Exprs.Finals);
1998 Dir->setDependentCounters(Exprs.DependentCounters);
1999 Dir->setDependentInits(Exprs.DependentInits);
2000 Dir->setFinalsConditions(Exprs.FinalsConditions);
2001 Dir->setPreInits(Exprs.PreInits);
2002 return Dir;
2003}
2004
2007 unsigned CollapsedNum, EmptyShell) {
2008 return createEmptyDirective<OMPTargetSimdDirective>(
2009 C, NumClauses, /*HasAssociatedStmt=*/true,
2010 numLoopChildren(CollapsedNum, OMPD_target_simd), CollapsedNum);
2011}
2012
2013OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
2014 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2015 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2016 const HelperExprs &Exprs) {
2017 auto *Dir = createDirective<OMPTeamsDistributeDirective>(
2018 C, Clauses, AssociatedStmt,
2019 numLoopChildren(CollapsedNum, OMPD_teams_distribute), StartLoc, EndLoc,
2020 CollapsedNum);
2021 Dir->setIterationVariable(Exprs.IterationVarRef);
2022 Dir->setLastIteration(Exprs.LastIteration);
2023 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2024 Dir->setPreCond(Exprs.PreCond);
2025 Dir->setCond(Exprs.Cond);
2026 Dir->setInit(Exprs.Init);
2027 Dir->setInc(Exprs.Inc);
2028 Dir->setIsLastIterVariable(Exprs.IL);
2029 Dir->setLowerBoundVariable(Exprs.LB);
2030 Dir->setUpperBoundVariable(Exprs.UB);
2031 Dir->setStrideVariable(Exprs.ST);
2032 Dir->setEnsureUpperBound(Exprs.EUB);
2033 Dir->setNextLowerBound(Exprs.NLB);
2034 Dir->setNextUpperBound(Exprs.NUB);
2035 Dir->setNumIterations(Exprs.NumIterations);
2036 Dir->setCounters(Exprs.Counters);
2037 Dir->setPrivateCounters(Exprs.PrivateCounters);
2038 Dir->setInits(Exprs.Inits);
2039 Dir->setUpdates(Exprs.Updates);
2040 Dir->setFinals(Exprs.Finals);
2041 Dir->setDependentCounters(Exprs.DependentCounters);
2042 Dir->setDependentInits(Exprs.DependentInits);
2043 Dir->setFinalsConditions(Exprs.FinalsConditions);
2044 Dir->setPreInits(Exprs.PreInits);
2045 return Dir;
2046}
2047
2050 unsigned NumClauses,
2051 unsigned CollapsedNum, EmptyShell) {
2052 return createEmptyDirective<OMPTeamsDistributeDirective>(
2053 C, NumClauses, /*HasAssociatedStmt=*/true,
2054 numLoopChildren(CollapsedNum, OMPD_teams_distribute), CollapsedNum);
2055}
2056
2057OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
2058 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2059 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2060 const HelperExprs &Exprs) {
2061 auto *Dir = createDirective<OMPTeamsDistributeSimdDirective>(
2062 C, Clauses, AssociatedStmt,
2063 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), StartLoc,
2064 EndLoc, CollapsedNum);
2065 Dir->setIterationVariable(Exprs.IterationVarRef);
2066 Dir->setLastIteration(Exprs.LastIteration);
2067 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2068 Dir->setPreCond(Exprs.PreCond);
2069 Dir->setCond(Exprs.Cond);
2070 Dir->setInit(Exprs.Init);
2071 Dir->setInc(Exprs.Inc);
2072 Dir->setIsLastIterVariable(Exprs.IL);
2073 Dir->setLowerBoundVariable(Exprs.LB);
2074 Dir->setUpperBoundVariable(Exprs.UB);
2075 Dir->setStrideVariable(Exprs.ST);
2076 Dir->setEnsureUpperBound(Exprs.EUB);
2077 Dir->setNextLowerBound(Exprs.NLB);
2078 Dir->setNextUpperBound(Exprs.NUB);
2079 Dir->setNumIterations(Exprs.NumIterations);
2080 Dir->setCounters(Exprs.Counters);
2081 Dir->setPrivateCounters(Exprs.PrivateCounters);
2082 Dir->setInits(Exprs.Inits);
2083 Dir->setUpdates(Exprs.Updates);
2084 Dir->setFinals(Exprs.Finals);
2085 Dir->setDependentCounters(Exprs.DependentCounters);
2086 Dir->setDependentInits(Exprs.DependentInits);
2087 Dir->setFinalsConditions(Exprs.FinalsConditions);
2088 Dir->setPreInits(Exprs.PreInits);
2089 return Dir;
2090}
2091
2092OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
2093 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
2094 EmptyShell) {
2095 return createEmptyDirective<OMPTeamsDistributeSimdDirective>(
2096 C, NumClauses, /*HasAssociatedStmt=*/true,
2097 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), CollapsedNum);
2098}
2099
2102 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2103 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2104 const HelperExprs &Exprs) {
2105 auto *Dir = createDirective<OMPTeamsDistributeParallelForSimdDirective>(
2106 C, Clauses, AssociatedStmt,
2107 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
2108 StartLoc, EndLoc, CollapsedNum);
2109 Dir->setIterationVariable(Exprs.IterationVarRef);
2110 Dir->setLastIteration(Exprs.LastIteration);
2111 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2112 Dir->setPreCond(Exprs.PreCond);
2113 Dir->setCond(Exprs.Cond);
2114 Dir->setInit(Exprs.Init);
2115 Dir->setInc(Exprs.Inc);
2116 Dir->setIsLastIterVariable(Exprs.IL);
2117 Dir->setLowerBoundVariable(Exprs.LB);
2118 Dir->setUpperBoundVariable(Exprs.UB);
2119 Dir->setStrideVariable(Exprs.ST);
2120 Dir->setEnsureUpperBound(Exprs.EUB);
2121 Dir->setNextLowerBound(Exprs.NLB);
2122 Dir->setNextUpperBound(Exprs.NUB);
2123 Dir->setNumIterations(Exprs.NumIterations);
2124 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2125 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2126 Dir->setDistInc(Exprs.DistInc);
2127 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2128 Dir->setCounters(Exprs.Counters);
2129 Dir->setPrivateCounters(Exprs.PrivateCounters);
2130 Dir->setInits(Exprs.Inits);
2131 Dir->setUpdates(Exprs.Updates);
2132 Dir->setFinals(Exprs.Finals);
2133 Dir->setDependentCounters(Exprs.DependentCounters);
2134 Dir->setDependentInits(Exprs.DependentInits);
2135 Dir->setFinalsConditions(Exprs.FinalsConditions);
2136 Dir->setPreInits(Exprs.PreInits);
2137 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2138 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2139 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2140 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2141 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2142 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2143 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2144 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2145 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2146 return Dir;
2147}
2148
2151 unsigned NumClauses,
2152 unsigned CollapsedNum,
2153 EmptyShell) {
2154 return createEmptyDirective<OMPTeamsDistributeParallelForSimdDirective>(
2155 C, NumClauses, /*HasAssociatedStmt=*/true,
2156 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
2157 CollapsedNum);
2158}
2159
2162 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2163 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2164 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
2165 auto *Dir = createDirective<OMPTeamsDistributeParallelForDirective>(
2166 C, Clauses, AssociatedStmt,
2167 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
2168 StartLoc, EndLoc, CollapsedNum);
2169 Dir->setIterationVariable(Exprs.IterationVarRef);
2170 Dir->setLastIteration(Exprs.LastIteration);
2171 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2172 Dir->setPreCond(Exprs.PreCond);
2173 Dir->setCond(Exprs.Cond);
2174 Dir->setInit(Exprs.Init);
2175 Dir->setInc(Exprs.Inc);
2176 Dir->setIsLastIterVariable(Exprs.IL);
2177 Dir->setLowerBoundVariable(Exprs.LB);
2178 Dir->setUpperBoundVariable(Exprs.UB);
2179 Dir->setStrideVariable(Exprs.ST);
2180 Dir->setEnsureUpperBound(Exprs.EUB);
2181 Dir->setNextLowerBound(Exprs.NLB);
2182 Dir->setNextUpperBound(Exprs.NUB);
2183 Dir->setNumIterations(Exprs.NumIterations);
2184 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2185 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2186 Dir->setDistInc(Exprs.DistInc);
2187 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2188 Dir->setCounters(Exprs.Counters);
2189 Dir->setPrivateCounters(Exprs.PrivateCounters);
2190 Dir->setInits(Exprs.Inits);
2191 Dir->setUpdates(Exprs.Updates);
2192 Dir->setFinals(Exprs.Finals);
2193 Dir->setDependentCounters(Exprs.DependentCounters);
2194 Dir->setDependentInits(Exprs.DependentInits);
2195 Dir->setFinalsConditions(Exprs.FinalsConditions);
2196 Dir->setPreInits(Exprs.PreInits);
2197 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2198 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2199 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2200 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2201 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2202 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2203 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2204 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2205 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2206 Dir->setTaskReductionRefExpr(TaskRedRef);
2207 Dir->HasCancel = HasCancel;
2208 return Dir;
2209}
2210
2213 unsigned NumClauses,
2214 unsigned CollapsedNum,
2215 EmptyShell) {
2216 return createEmptyDirective<OMPTeamsDistributeParallelForDirective>(
2217 C, NumClauses, /*HasAssociatedStmt=*/true,
2218 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
2219 CollapsedNum);
2220}
2221
2222OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
2223 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2224 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
2225 return createDirective<OMPTargetTeamsDirective>(C, Clauses, AssociatedStmt,
2226 /*NumChildren=*/0, StartLoc,
2227 EndLoc);
2228}
2229
2232 EmptyShell) {
2233 return createEmptyDirective<OMPTargetTeamsDirective>(
2234 C, NumClauses, /*HasAssociatedStmt=*/true);
2235}
2236
2237OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
2238 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2239 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2240 const HelperExprs &Exprs) {
2241 auto *Dir = createDirective<OMPTargetTeamsDistributeDirective>(
2242 C, Clauses, AssociatedStmt,
2243 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute), StartLoc,
2244 EndLoc, CollapsedNum);
2245 Dir->setIterationVariable(Exprs.IterationVarRef);
2246 Dir->setLastIteration(Exprs.LastIteration);
2247 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2248 Dir->setPreCond(Exprs.PreCond);
2249 Dir->setCond(Exprs.Cond);
2250 Dir->setInit(Exprs.Init);
2251 Dir->setInc(Exprs.Inc);
2252 Dir->setIsLastIterVariable(Exprs.IL);
2253 Dir->setLowerBoundVariable(Exprs.LB);
2254 Dir->setUpperBoundVariable(Exprs.UB);
2255 Dir->setStrideVariable(Exprs.ST);
2256 Dir->setEnsureUpperBound(Exprs.EUB);
2257 Dir->setNextLowerBound(Exprs.NLB);
2258 Dir->setNextUpperBound(Exprs.NUB);
2259 Dir->setNumIterations(Exprs.NumIterations);
2260 Dir->setCounters(Exprs.Counters);
2261 Dir->setPrivateCounters(Exprs.PrivateCounters);
2262 Dir->setInits(Exprs.Inits);
2263 Dir->setUpdates(Exprs.Updates);
2264 Dir->setFinals(Exprs.Finals);
2265 Dir->setDependentCounters(Exprs.DependentCounters);
2266 Dir->setDependentInits(Exprs.DependentInits);
2267 Dir->setFinalsConditions(Exprs.FinalsConditions);
2268 Dir->setPreInits(Exprs.PreInits);
2269 return Dir;
2270}
2271
2274 unsigned NumClauses,
2275 unsigned CollapsedNum,
2276 EmptyShell) {
2277 return createEmptyDirective<OMPTargetTeamsDistributeDirective>(
2278 C, NumClauses, /*HasAssociatedStmt=*/true,
2279 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute),
2280 CollapsedNum);
2281}
2282
2285 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2286 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2287 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
2288 auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForDirective>(
2289 C, Clauses, AssociatedStmt,
2290 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
2291 1,
2292 StartLoc, EndLoc, CollapsedNum);
2293 Dir->setIterationVariable(Exprs.IterationVarRef);
2294 Dir->setLastIteration(Exprs.LastIteration);
2295 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2296 Dir->setPreCond(Exprs.PreCond);
2297 Dir->setCond(Exprs.Cond);
2298 Dir->setInit(Exprs.Init);
2299 Dir->setInc(Exprs.Inc);
2300 Dir->setIsLastIterVariable(Exprs.IL);
2301 Dir->setLowerBoundVariable(Exprs.LB);
2302 Dir->setUpperBoundVariable(Exprs.UB);
2303 Dir->setStrideVariable(Exprs.ST);
2304 Dir->setEnsureUpperBound(Exprs.EUB);
2305 Dir->setNextLowerBound(Exprs.NLB);
2306 Dir->setNextUpperBound(Exprs.NUB);
2307 Dir->setNumIterations(Exprs.NumIterations);
2308 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2309 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2310 Dir->setDistInc(Exprs.DistInc);
2311 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2312 Dir->setCounters(Exprs.Counters);
2313 Dir->setPrivateCounters(Exprs.PrivateCounters);
2314 Dir->setInits(Exprs.Inits);
2315 Dir->setUpdates(Exprs.Updates);
2316 Dir->setFinals(Exprs.Finals);
2317 Dir->setDependentCounters(Exprs.DependentCounters);
2318 Dir->setDependentInits(Exprs.DependentInits);
2319 Dir->setFinalsConditions(Exprs.FinalsConditions);
2320 Dir->setPreInits(Exprs.PreInits);
2321 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2322 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2323 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2324 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2325 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2326 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2327 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2328 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2329 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2330 Dir->setTaskReductionRefExpr(TaskRedRef);
2331 Dir->HasCancel = HasCancel;
2332 return Dir;
2333}
2334
2337 unsigned NumClauses,
2338 unsigned CollapsedNum,
2339 EmptyShell) {
2340 return createEmptyDirective<OMPTargetTeamsDistributeParallelForDirective>(
2341 C, NumClauses, /*HasAssociatedStmt=*/true,
2342 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
2343 1,
2344 CollapsedNum);
2345}
2346
2349 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2350 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2351 const HelperExprs &Exprs) {
2352 auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
2353 C, Clauses, AssociatedStmt,
2354 numLoopChildren(CollapsedNum,
2355 OMPD_target_teams_distribute_parallel_for_simd),
2356 StartLoc, EndLoc, CollapsedNum);
2357 Dir->setIterationVariable(Exprs.IterationVarRef);
2358 Dir->setLastIteration(Exprs.LastIteration);
2359 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2360 Dir->setPreCond(Exprs.PreCond);
2361 Dir->setCond(Exprs.Cond);
2362 Dir->setInit(Exprs.Init);
2363 Dir->setInc(Exprs.Inc);
2364 Dir->setIsLastIterVariable(Exprs.IL);
2365 Dir->setLowerBoundVariable(Exprs.LB);
2366 Dir->setUpperBoundVariable(Exprs.UB);
2367 Dir->setStrideVariable(Exprs.ST);
2368 Dir->setEnsureUpperBound(Exprs.EUB);
2369 Dir->setNextLowerBound(Exprs.NLB);
2370 Dir->setNextUpperBound(Exprs.NUB);
2371 Dir->setNumIterations(Exprs.NumIterations);
2372 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2373 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2374 Dir->setDistInc(Exprs.DistInc);
2375 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2376 Dir->setCounters(Exprs.Counters);
2377 Dir->setPrivateCounters(Exprs.PrivateCounters);
2378 Dir->setInits(Exprs.Inits);
2379 Dir->setUpdates(Exprs.Updates);
2380 Dir->setFinals(Exprs.Finals);
2381 Dir->setDependentCounters(Exprs.DependentCounters);
2382 Dir->setDependentInits(Exprs.DependentInits);
2383 Dir->setFinalsConditions(Exprs.FinalsConditions);
2384 Dir->setPreInits(Exprs.PreInits);
2385 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2386 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2387 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2388 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2389 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2390 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2391 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2392 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2393 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2394 return Dir;
2395}
2396
2399 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
2400 EmptyShell) {
2401 return createEmptyDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
2402 C, NumClauses, /*HasAssociatedStmt=*/true,
2403 numLoopChildren(CollapsedNum,
2404 OMPD_target_teams_distribute_parallel_for_simd),
2405 CollapsedNum);
2406}
2407
2410 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2411 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2412 const HelperExprs &Exprs) {
2413 auto *Dir = createDirective<OMPTargetTeamsDistributeSimdDirective>(
2414 C, Clauses, AssociatedStmt,
2415 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
2416 StartLoc, EndLoc, CollapsedNum);
2417 Dir->setIterationVariable(Exprs.IterationVarRef);
2418 Dir->setLastIteration(Exprs.LastIteration);
2419 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2420 Dir->setPreCond(Exprs.PreCond);
2421 Dir->setCond(Exprs.Cond);
2422 Dir->setInit(Exprs.Init);
2423 Dir->setInc(Exprs.Inc);
2424 Dir->setIsLastIterVariable(Exprs.IL);
2425 Dir->setLowerBoundVariable(Exprs.LB);
2426 Dir->setUpperBoundVariable(Exprs.UB);
2427 Dir->setStrideVariable(Exprs.ST);
2428 Dir->setEnsureUpperBound(Exprs.EUB);
2429 Dir->setNextLowerBound(Exprs.NLB);
2430 Dir->setNextUpperBound(Exprs.NUB);
2431 Dir->setNumIterations(Exprs.NumIterations);
2432 Dir->setCounters(Exprs.Counters);
2433 Dir->setPrivateCounters(Exprs.PrivateCounters);
2434 Dir->setInits(Exprs.Inits);
2435 Dir->setUpdates(Exprs.Updates);
2436 Dir->setFinals(Exprs.Finals);
2437 Dir->setDependentCounters(Exprs.DependentCounters);
2438 Dir->setDependentInits(Exprs.DependentInits);
2439 Dir->setFinalsConditions(Exprs.FinalsConditions);
2440 Dir->setPreInits(Exprs.PreInits);
2441 return Dir;
2442}
2443
2446 unsigned NumClauses,
2447 unsigned CollapsedNum,
2448 EmptyShell) {
2449 return createEmptyDirective<OMPTargetTeamsDistributeSimdDirective>(
2450 C, NumClauses, /*HasAssociatedStmt=*/true,
2451 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
2452 CollapsedNum);
2453}
2454
2457 SourceLocation EndLoc,
2458 ArrayRef<OMPClause *> Clauses) {
2459 return createDirective<OMPInteropDirective>(
2460 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
2461 EndLoc);
2462}
2463
2465 unsigned NumClauses,
2466 EmptyShell) {
2467 return createEmptyDirective<OMPInteropDirective>(C, NumClauses);
2468}
2469
2470OMPDispatchDirective *OMPDispatchDirective::Create(
2471 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2472 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2473 SourceLocation TargetCallLoc) {
2474 auto *Dir = createDirective<OMPDispatchDirective>(
2475 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
2476 Dir->setTargetCallLoc(TargetCallLoc);
2477 return Dir;
2478}
2479
2481 unsigned NumClauses,
2482 EmptyShell) {
2483 return createEmptyDirective<OMPDispatchDirective>(C, NumClauses,
2484 /*HasAssociatedStmt=*/true,
2485 /*NumChildren=*/0);
2486}
2487
2488OMPMaskedDirective *OMPMaskedDirective::Create(const ASTContext &C,
2489 SourceLocation StartLoc,
2490 SourceLocation EndLoc,
2491 ArrayRef<OMPClause *> Clauses,
2492 Stmt *AssociatedStmt) {
2493 return createDirective<OMPMaskedDirective>(C, Clauses, AssociatedStmt,
2494 /*NumChildren=*/0, StartLoc,
2495 EndLoc);
2496}
2497
2499 unsigned NumClauses,
2500 EmptyShell) {
2501 return createEmptyDirective<OMPMaskedDirective>(C, NumClauses,
2502 /*HasAssociatedStmt=*/true);
2503}
2504
2505OMPGenericLoopDirective *OMPGenericLoopDirective::Create(
2506 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2507 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2508 const HelperExprs &Exprs) {
2509 auto *Dir = createDirective<OMPGenericLoopDirective>(
2510 C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_loop),
2511 StartLoc, EndLoc, CollapsedNum);
2512 Dir->setIterationVariable(Exprs.IterationVarRef);
2513 Dir->setLastIteration(Exprs.LastIteration);
2514 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2515 Dir->setPreCond(Exprs.PreCond);
2516 Dir->setCond(Exprs.Cond);
2517 Dir->setInit(Exprs.Init);
2518 Dir->setInc(Exprs.Inc);
2519 Dir->setIsLastIterVariable(Exprs.IL);
2520 Dir->setLowerBoundVariable(Exprs.LB);
2521 Dir->setUpperBoundVariable(Exprs.UB);
2522 Dir->setStrideVariable(Exprs.ST);
2523 Dir->setEnsureUpperBound(Exprs.EUB);
2524 Dir->setNextLowerBound(Exprs.NLB);
2525 Dir->setNextUpperBound(Exprs.NUB);
2526 Dir->setNumIterations(Exprs.NumIterations);
2527 Dir->setCounters(Exprs.Counters);
2528 Dir->setPrivateCounters(Exprs.PrivateCounters);
2529 Dir->setInits(Exprs.Inits);
2530 Dir->setUpdates(Exprs.Updates);
2531 Dir->setFinals(Exprs.Finals);
2532 Dir->setDependentCounters(Exprs.DependentCounters);
2533 Dir->setDependentInits(Exprs.DependentInits);
2534 Dir->setFinalsConditions(Exprs.FinalsConditions);
2535 Dir->setPreInits(Exprs.PreInits);
2536 return Dir;
2537}
2538
2541 unsigned CollapsedNum, EmptyShell) {
2542 return createEmptyDirective<OMPGenericLoopDirective>(
2543 C, NumClauses, /*HasAssociatedStmt=*/true,
2544 numLoopChildren(CollapsedNum, OMPD_loop), CollapsedNum);
2545}
2546
2547OMPTeamsGenericLoopDirective *OMPTeamsGenericLoopDirective::Create(
2548 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2549 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2550 const HelperExprs &Exprs) {
2551 auto *Dir = createDirective<OMPTeamsGenericLoopDirective>(
2552 C, Clauses, AssociatedStmt,
2553 numLoopChildren(CollapsedNum, OMPD_teams_loop), StartLoc, EndLoc,
2554 CollapsedNum);
2555 Dir->setIterationVariable(Exprs.IterationVarRef);
2556 Dir->setLastIteration(Exprs.LastIteration);
2557 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2558 Dir->setPreCond(Exprs.PreCond);
2559 Dir->setCond(Exprs.Cond);
2560 Dir->setInit(Exprs.Init);
2561 Dir->setInc(Exprs.Inc);
2562 Dir->setIsLastIterVariable(Exprs.IL);
2563 Dir->setLowerBoundVariable(Exprs.LB);
2564 Dir->setUpperBoundVariable(Exprs.UB);
2565 Dir->setStrideVariable(Exprs.ST);
2566 Dir->setEnsureUpperBound(Exprs.EUB);
2567 Dir->setNextLowerBound(Exprs.NLB);
2568 Dir->setNextUpperBound(Exprs.NUB);
2569 Dir->setNumIterations(Exprs.NumIterations);
2570 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2571 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2572 Dir->setDistInc(Exprs.DistInc);
2573 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2574 Dir->setCounters(Exprs.Counters);
2575 Dir->setPrivateCounters(Exprs.PrivateCounters);
2576 Dir->setInits(Exprs.Inits);
2577 Dir->setUpdates(Exprs.Updates);
2578 Dir->setFinals(Exprs.Finals);
2579 Dir->setDependentCounters(Exprs.DependentCounters);
2580 Dir->setDependentInits(Exprs.DependentInits);
2581 Dir->setFinalsConditions(Exprs.FinalsConditions);
2582 Dir->setPreInits(Exprs.PreInits);
2583 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2584 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2585 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2586 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2587 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2588 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2589 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2590 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2591 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2592 return Dir;
2593}
2594
2597 unsigned NumClauses,
2598 unsigned CollapsedNum, EmptyShell) {
2599 return createEmptyDirective<OMPTeamsGenericLoopDirective>(
2600 C, NumClauses, /*HasAssociatedStmt=*/true,
2601 numLoopChildren(CollapsedNum, OMPD_teams_loop), CollapsedNum);
2602}
2603
2604OMPTargetTeamsGenericLoopDirective *OMPTargetTeamsGenericLoopDirective::Create(
2605 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2606 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2607 const HelperExprs &Exprs, bool CanBeParallelFor) {
2608 auto *Dir = createDirective<OMPTargetTeamsGenericLoopDirective>(
2609 C, Clauses, AssociatedStmt,
2610 numLoopChildren(CollapsedNum, OMPD_target_teams_loop), StartLoc, EndLoc,
2611 CollapsedNum);
2612 Dir->setIterationVariable(Exprs.IterationVarRef);
2613 Dir->setLastIteration(Exprs.LastIteration);
2614 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2615 Dir->setPreCond(Exprs.PreCond);
2616 Dir->setCond(Exprs.Cond);
2617 Dir->setInit(Exprs.Init);
2618 Dir->setInc(Exprs.Inc);
2619 Dir->setIsLastIterVariable(Exprs.IL);
2620 Dir->setLowerBoundVariable(Exprs.LB);
2621 Dir->setUpperBoundVariable(Exprs.UB);
2622 Dir->setStrideVariable(Exprs.ST);
2623 Dir->setEnsureUpperBound(Exprs.EUB);
2624 Dir->setNextLowerBound(Exprs.NLB);
2625 Dir->setNextUpperBound(Exprs.NUB);
2626 Dir->setNumIterations(Exprs.NumIterations);
2627 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2628 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2629 Dir->setDistInc(Exprs.DistInc);
2630 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2631 Dir->setCounters(Exprs.Counters);
2632 Dir->setPrivateCounters(Exprs.PrivateCounters);
2633 Dir->setInits(Exprs.Inits);
2634 Dir->setUpdates(Exprs.Updates);
2635 Dir->setFinals(Exprs.Finals);
2636 Dir->setDependentCounters(Exprs.DependentCounters);
2637 Dir->setDependentInits(Exprs.DependentInits);
2638 Dir->setFinalsConditions(Exprs.FinalsConditions);
2639 Dir->setPreInits(Exprs.PreInits);
2640 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2641 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2642 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2643 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2644 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2645 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2646 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2647 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2648 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2649 Dir->setCanBeParallelFor(CanBeParallelFor);
2650 return Dir;
2651}
2652
2655 unsigned NumClauses,
2656 unsigned CollapsedNum,
2657 EmptyShell) {
2658 return createEmptyDirective<OMPTargetTeamsGenericLoopDirective>(
2659 C, NumClauses, /*HasAssociatedStmt=*/true,
2660 numLoopChildren(CollapsedNum, OMPD_target_teams_loop), CollapsedNum);
2661}
2662
2663OMPParallelGenericLoopDirective *OMPParallelGenericLoopDirective::Create(
2664 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2665 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2666 const HelperExprs &Exprs) {
2667 auto *Dir = createDirective<OMPParallelGenericLoopDirective>(
2668 C, Clauses, AssociatedStmt,
2669 numLoopChildren(CollapsedNum, OMPD_parallel_loop), StartLoc, EndLoc,
2670 CollapsedNum);
2671 Dir->setIterationVariable(Exprs.IterationVarRef);
2672 Dir->setLastIteration(Exprs.LastIteration);
2673 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2674 Dir->setPreCond(Exprs.PreCond);
2675 Dir->setCond(Exprs.Cond);
2676 Dir->setInit(Exprs.Init);
2677 Dir->setInc(Exprs.Inc);
2678 Dir->setIsLastIterVariable(Exprs.IL);
2679 Dir->setLowerBoundVariable(Exprs.LB);
2680 Dir->setUpperBoundVariable(Exprs.UB);
2681 Dir->setStrideVariable(Exprs.ST);
2682 Dir->setEnsureUpperBound(Exprs.EUB);
2683 Dir->setNextLowerBound(Exprs.NLB);
2684 Dir->setNextUpperBound(Exprs.NUB);
2685 Dir->setNumIterations(Exprs.NumIterations);
2686 Dir->setCounters(Exprs.Counters);
2687 Dir->setPrivateCounters(Exprs.PrivateCounters);
2688 Dir->setInits(Exprs.Inits);
2689 Dir->setUpdates(Exprs.Updates);
2690 Dir->setFinals(Exprs.Finals);
2691 Dir->setDependentCounters(Exprs.DependentCounters);
2692 Dir->setDependentInits(Exprs.DependentInits);
2693 Dir->setFinalsConditions(Exprs.FinalsConditions);
2694 Dir->setPreInits(Exprs.PreInits);
2695 return Dir;
2696}
2697
2698OMPParallelGenericLoopDirective *OMPParallelGenericLoopDirective::CreateEmpty(
2699 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
2700 EmptyShell) {
2701 return createEmptyDirective<OMPParallelGenericLoopDirective>(
2702 C, NumClauses, /*HasAssociatedStmt=*/true,
2703 numLoopChildren(CollapsedNum, OMPD_parallel_loop), CollapsedNum);
2704}
2705
2708 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2709 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2710 const HelperExprs &Exprs) {
2711 auto *Dir = createDirective<OMPTargetParallelGenericLoopDirective>(
2712 C, Clauses, AssociatedStmt,
2713 numLoopChildren(CollapsedNum, OMPD_target_parallel_loop), StartLoc,
2714 EndLoc, CollapsedNum);
2715 Dir->setIterationVariable(Exprs.IterationVarRef);
2716 Dir->setLastIteration(Exprs.LastIteration);
2717 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2718 Dir->setPreCond(Exprs.PreCond);
2719 Dir->setCond(Exprs.Cond);
2720 Dir->setInit(Exprs.Init);
2721 Dir->setInc(Exprs.Inc);
2722 Dir->setIsLastIterVariable(Exprs.IL);
2723 Dir->setLowerBoundVariable(Exprs.LB);
2724 Dir->setUpperBoundVariable(Exprs.UB);
2725 Dir->setStrideVariable(Exprs.ST);
2726 Dir->setEnsureUpperBound(Exprs.EUB);
2727 Dir->setNextLowerBound(Exprs.NLB);
2728 Dir->setNextUpperBound(Exprs.NUB);
2729 Dir->setNumIterations(Exprs.NumIterations);
2730 Dir->setCounters(Exprs.Counters);
2731 Dir->setPrivateCounters(Exprs.PrivateCounters);
2732 Dir->setInits(Exprs.Inits);
2733 Dir->setUpdates(Exprs.Updates);
2734 Dir->setFinals(Exprs.Finals);
2735 Dir->setDependentCounters(Exprs.DependentCounters);
2736 Dir->setDependentInits(Exprs.DependentInits);
2737 Dir->setFinalsConditions(Exprs.FinalsConditions);
2738 Dir->setPreInits(Exprs.PreInits);
2739 return Dir;
2740}
2741
2744 unsigned NumClauses,
2745 unsigned CollapsedNum,
2746 EmptyShell) {
2747 return createEmptyDirective<OMPTargetParallelGenericLoopDirective>(
2748 C, NumClauses, /*HasAssociatedStmt=*/true,
2749 numLoopChildren(CollapsedNum, OMPD_target_parallel_loop), CollapsedNum);
2750}
Defines the clang::ASTContext interface.
This file defines OpenMP AST classes for executable directives and clauses.
static OMPAssumeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
static OMPAssumeDirective * Create(const ASTContext &Ctx, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AStmt)
This represents 'pragma omp cancel' directive.
static OMPCancelDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, OpenMPDirectiveKind CancelRegion)
Creates directive.
static OMPCancelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
This represents 'pragma omp cancellation point' directive.
static OMPCancellationPointDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
static OMPCancellationPointDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Creates directive.
Stmt * getPreInits() const
Return preinits statement.
Stmt * getTransformedStmt() const
Get the de-sugared statements after the loop transformation.
Contains data for OpenMP directives: clauses, children expressions/statements (helpers for codegen) a...
void setClauses(ArrayRef< OMPClause * > Clauses)
Sets the list of variables for this clause.
MutableArrayRef< Stmt * > getChildren()
static OMPDispatchDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, SourceLocation TargetCallLoc)
Creates directive with a list of Clauses.
static OMPDispatchDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp distribute' directive.
static OMPDistributeDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp distribute parallel for' composite directive.
static OMPDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPDistributeParallelForDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel)
Creates directive with a list of Clauses.
This represents 'pragma omp distribute parallel for simd' composite directive.
static OMPDistributeParallelForSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPDistributeParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp distribute simd' composite directive.
static OMPDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPDistributeSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPErrorDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses)
static OMPErrorDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
static OMPFuseDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, unsigned NumGeneratedTopLevelLoops, Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits)
Create a new AST node representation for pragma omp fuse'.
static OMPFuseDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses)
Build an empty 'pragma omp fuse' AST node for deserialization.
This represents 'pragma omp loop' directive.
static OMPGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with a place for NumClauses clauses.
static OMPGenericLoopDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
Represents the 'pragma omp interchange' loop transformation directive.
static OMPInterchangeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned NumLoops)
Build an empty 'pragma omp interchange' AST node for deserialization.
static OMPInterchangeDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, unsigned NumLoops, Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits)
Create a new AST node representation for 'pragma omp interchange'.
This represents 'pragma omp interop' directive.
static OMPInteropDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
static OMPInteropDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses)
Creates directive.
static OMPMaskedDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive.
static OMPMaskedDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive.
This represents 'pragma omp masked taskloop' directive.
static OMPMaskedTaskLoopDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel)
Creates directive with a list of Clauses.
static OMPMaskedTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp masked taskloop simd' directive.
static OMPMaskedTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPMaskedTaskLoopSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
This represents 'pragma omp master taskloop' directive.
static OMPMasterTaskLoopDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel)
Creates directive with a list of Clauses.
static OMPMasterTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp master taskloop simd' directive.
static OMPMasterTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPMasterTaskLoopSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPMetaDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
static OMPMetaDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, Stmt *IfStmt)
static OMPParallelGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPParallelGenericLoopDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
This represents 'pragma omp parallel masked taskloop' directive.
static OMPParallelMaskedTaskLoopDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel)
Creates directive with a list of Clauses.
static OMPParallelMaskedTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp parallel masked taskloop simd' directive.
static OMPParallelMaskedTaskLoopSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPParallelMaskedTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp parallel master taskloop' directive.
static OMPParallelMasterTaskLoopDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel)
Creates directive with a list of Clauses.
static OMPParallelMasterTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp parallel master taskloop simd' directive.
static OMPParallelMasterTaskLoopSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPParallelMasterTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Represents the 'pragma omp reverse' loop transformation directive.
static OMPReverseDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt, unsigned NumLoops, Stmt *TransformedStmt, Stmt *PreInits)
Create a new AST node representation for 'pragma omp reverse'.
static OMPReverseDirective * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty 'pragma omp reverse' AST node for deserialization.
static OMPScanDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPScanDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses)
Creates directive with a list of Clauses.
Represents the 'pragma omp split' loop transformation directive.
static OMPSplitDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned NumLoops)
Build an empty 'pragma omp split' AST node for deserialization.
static OMPSplitDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, unsigned NumLoops, Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits)
Create a new AST node representation for 'pragma omp split'.
This represents the 'pragma omp stripe' loop transformation directive.
static OMPStripeDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, unsigned NumLoops, Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits)
Create a new AST node representation for 'pragma omp stripe'.
static OMPStripeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned NumLoops)
Build an empty 'pragma omp stripe' AST node for deserialization.
static OMPTargetDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
static OMPTargetDataDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
static OMPTargetDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
static OMPTargetDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp target enter data' directive.
static OMPTargetEnterDataDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
static OMPTargetEnterDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
This represents 'pragma omp target exit data' directive.
static OMPTargetExitDataDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
static OMPTargetExitDataDirective * CreateEmpty(const ASTContext &C, unsigned N, EmptyShell)
Creates an empty directive with the place for N clauses.
This represents 'pragma omp target parallel' directive.
static OMPTargetParallelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetParallelDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef, bool HasCancel)
Creates directive with a list of Clauses.
This represents 'pragma omp target parallel for' directive.
static OMPTargetParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetParallelForDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel)
Creates directive with a list of Clauses.
This represents 'pragma omp target parallel for simd' directive.
static OMPTargetParallelForSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPTargetParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp target parallel loop' directive.
static OMPTargetParallelGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetParallelGenericLoopDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
This represents 'pragma omp target simd' directive.
static OMPTargetSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPTargetSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp target teams' directive.
static OMPTargetTeamsDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
static OMPTargetTeamsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp target teams distribute' combined directive.
static OMPTargetTeamsDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetTeamsDistributeDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
This represents 'pragma omp target teams distribute parallel for' combined directive.
static OMPTargetTeamsDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetTeamsDistributeParallelForDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel)
Creates directive with a list of Clauses.
This represents 'pragma omp target teams distribute parallel for simd' combined directive.
static OMPTargetTeamsDistributeParallelForSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPTargetTeamsDistributeParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp target teams distribute simd' combined directive.
static OMPTargetTeamsDistributeSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPTargetTeamsDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp target teams loop' directive.
static OMPTargetTeamsGenericLoopDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, bool CanBeParallelFor)
Creates directive with a list of Clauses.
static OMPTargetTeamsGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp target update' directive.
static OMPTargetUpdateDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetUpdateDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
static OMPTaskLoopDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel)
Creates directive with a list of Clauses.
static OMPTaskLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp taskloop simd' directive.
static OMPTaskLoopSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTaskLoopSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPTeamsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTeamsDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
This represents 'pragma omp teams distribute' directive.
static OMPTeamsDistributeDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPTeamsDistributeDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp teams distribute parallel for' composite directive.
static OMPTeamsDistributeParallelForDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel)
Creates directive with a list of Clauses.
static OMPTeamsDistributeParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp teams distribute parallel for simd' composite directive.
static OMPTeamsDistributeParallelForSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPTeamsDistributeParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTeamsDistributeSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
static OMPTeamsDistributeSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents 'pragma omp teams loop' directive.
static OMPTeamsGenericLoopDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTeamsGenericLoopDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
This represents the 'pragma omp tile' loop transformation directive.
static OMPTileDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned NumLoops)
Build an empty 'pragma omp tile' AST node for deserialization.
static OMPTileDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, unsigned NumLoops, Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits)
Create a new AST node representation for 'pragma omp tile'.
static OMPUnrollDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, unsigned NumGeneratedTopLevelLoops, Stmt *TransformedStmt, Stmt *PreInits)
Create a new AST node representation for 'pragma omp unroll'.
static OMPUnrollDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses)
Build an empty 'pragma omp unroll' AST node for deserialization.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:223
This represents one expression.
Definition Expr.h:112
Encodes a location in the source.
Stmt - This represents one statement.
Definition Stmt.h:85
Stmt * IgnoreContainers(bool IgnoreCaptured=false)
Skip no-op (attributed, compound) container stmts and skip captured stmt at the top,...
Definition Stmt.cpp:210
Top level wrappers for InstallAPI frontend operations.
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
bool isa(CodeGen::Address addr)
Definition Address.h:330
MutableArrayRef< Expr * > getFinals()
Sets the list of final update expressions for linear variables.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition OpenMPKinds.h:25
MutableArrayRef< Expr * > getUpdates()
Sets the list of update expressions for linear variables.
MutableArrayRef< Expr * > getInits()
U cast(CodeGen::Address addr)
Definition Address.h:327
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...