clang 23.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
1060OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
1061 SourceLocation StartLoc,
1062 SourceLocation EndLoc,
1063 ArrayRef<OMPClause *> Clauses,
1064 Stmt *AssociatedStmt) {
1065 return createDirective<OMPOrderedDirective>(
1066 C, Clauses, cast_or_null<CapturedStmt>(AssociatedStmt),
1067 /*NumChildren=*/0, StartLoc, EndLoc);
1068}
1069
1070OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
1071 unsigned NumClauses,
1072 bool IsStandalone,
1073 EmptyShell) {
1074 return createEmptyDirective<OMPOrderedDirective>(C, NumClauses,
1075 !IsStandalone);
1076}
1077
1078OMPAtomicDirective *
1079OMPAtomicDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1080 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
1081 Stmt *AssociatedStmt, Expressions Exprs) {
1082 auto *Dir = createDirective<OMPAtomicDirective>(
1083 C, Clauses, AssociatedStmt, /*NumChildren=*/7, StartLoc, EndLoc);
1084 Dir->setX(Exprs.X);
1085 Dir->setV(Exprs.V);
1086 Dir->setR(Exprs.R);
1087 Dir->setExpr(Exprs.E);
1088 Dir->setUpdateExpr(Exprs.UE);
1089 Dir->setD(Exprs.D);
1090 Dir->setCond(Exprs.Cond);
1091 Dir->Flags.IsXLHSInRHSPart = Exprs.IsXLHSInRHSPart ? 1 : 0;
1092 Dir->Flags.IsPostfixUpdate = Exprs.IsPostfixUpdate ? 1 : 0;
1093 Dir->Flags.IsFailOnly = Exprs.IsFailOnly ? 1 : 0;
1094 return Dir;
1095}
1096
1097OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
1098 unsigned NumClauses,
1099 EmptyShell) {
1100 return createEmptyDirective<OMPAtomicDirective>(
1101 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/7);
1102}
1103
1104OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
1105 SourceLocation StartLoc,
1106 SourceLocation EndLoc,
1107 ArrayRef<OMPClause *> Clauses,
1108 Stmt *AssociatedStmt) {
1109 return createDirective<OMPTargetDirective>(
1110 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1111}
1112
1114 unsigned NumClauses,
1115 EmptyShell) {
1116 return createEmptyDirective<OMPTargetDirective>(C, NumClauses,
1117 /*HasAssociatedStmt=*/true);
1118}
1119
1120OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
1121 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1122 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
1123 bool HasCancel) {
1124 auto *Dir = createDirective<OMPTargetParallelDirective>(
1125 C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
1126 Dir->setTaskReductionRefExpr(TaskRedRef);
1127 Dir->setHasCancel(HasCancel);
1128 return Dir;
1129}
1130
1133 unsigned NumClauses, EmptyShell) {
1134 return createEmptyDirective<OMPTargetParallelDirective>(
1135 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
1136}
1137
1138OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
1139 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1140 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1141 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1142 auto *Dir = createDirective<OMPTargetParallelForDirective>(
1143 C, Clauses, AssociatedStmt,
1144 numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1, StartLoc,
1145 EndLoc, CollapsedNum);
1146 Dir->setIterationVariable(Exprs.IterationVarRef);
1147 Dir->setLastIteration(Exprs.LastIteration);
1148 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1149 Dir->setPreCond(Exprs.PreCond);
1150 Dir->setCond(Exprs.Cond);
1151 Dir->setInit(Exprs.Init);
1152 Dir->setInc(Exprs.Inc);
1153 Dir->setIsLastIterVariable(Exprs.IL);
1154 Dir->setLowerBoundVariable(Exprs.LB);
1155 Dir->setUpperBoundVariable(Exprs.UB);
1156 Dir->setStrideVariable(Exprs.ST);
1157 Dir->setEnsureUpperBound(Exprs.EUB);
1158 Dir->setNextLowerBound(Exprs.NLB);
1159 Dir->setNextUpperBound(Exprs.NUB);
1160 Dir->setNumIterations(Exprs.NumIterations);
1161 Dir->setCounters(Exprs.Counters);
1162 Dir->setPrivateCounters(Exprs.PrivateCounters);
1163 Dir->setInits(Exprs.Inits);
1164 Dir->setUpdates(Exprs.Updates);
1165 Dir->setFinals(Exprs.Finals);
1166 Dir->setDependentCounters(Exprs.DependentCounters);
1167 Dir->setDependentInits(Exprs.DependentInits);
1168 Dir->setFinalsConditions(Exprs.FinalsConditions);
1169 Dir->setPreInits(Exprs.PreInits);
1170 Dir->setTaskReductionRefExpr(TaskRedRef);
1171 Dir->setHasCancel(HasCancel);
1172 return Dir;
1173}
1174
1177 unsigned NumClauses,
1178 unsigned CollapsedNum, EmptyShell) {
1179 return createEmptyDirective<OMPTargetParallelForDirective>(
1180 C, NumClauses, /*HasAssociatedStmt=*/true,
1181 numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1,
1182 CollapsedNum);
1183}
1184
1185OMPTargetDataDirective *OMPTargetDataDirective::Create(
1186 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1187 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1188 return createDirective<OMPTargetDataDirective>(
1189 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1190}
1191
1192OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
1193 unsigned N,
1194 EmptyShell) {
1195 return createEmptyDirective<OMPTargetDataDirective>(
1196 C, N, /*HasAssociatedStmt=*/true);
1197}
1198
1199OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
1200 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1201 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1202 return createDirective<OMPTargetEnterDataDirective>(
1203 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1204}
1205
1208 EmptyShell) {
1209 return createEmptyDirective<OMPTargetEnterDataDirective>(
1210 C, N, /*HasAssociatedStmt=*/true);
1211}
1212
1213OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create(
1214 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1215 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1216 return createDirective<OMPTargetExitDataDirective>(
1217 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1218}
1219
1222 EmptyShell) {
1223 return createEmptyDirective<OMPTargetExitDataDirective>(
1224 C, N, /*HasAssociatedStmt=*/true);
1225}
1226
1227OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
1228 SourceLocation StartLoc,
1229 SourceLocation EndLoc,
1230 ArrayRef<OMPClause *> Clauses,
1231 Stmt *AssociatedStmt) {
1232 return createDirective<OMPTeamsDirective>(
1233 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1234}
1235
1237 unsigned NumClauses,
1238 EmptyShell) {
1239 return createEmptyDirective<OMPTeamsDirective>(C, NumClauses,
1240 /*HasAssociatedStmt=*/true);
1241}
1242
1243OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
1244 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1245 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1246 const HelperExprs &Exprs, bool HasCancel) {
1247 auto *Dir = createDirective<OMPTaskLoopDirective>(
1248 C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_taskloop),
1249 StartLoc, EndLoc, CollapsedNum);
1250 Dir->setIterationVariable(Exprs.IterationVarRef);
1251 Dir->setLastIteration(Exprs.LastIteration);
1252 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1253 Dir->setPreCond(Exprs.PreCond);
1254 Dir->setCond(Exprs.Cond);
1255 Dir->setInit(Exprs.Init);
1256 Dir->setInc(Exprs.Inc);
1257 Dir->setIsLastIterVariable(Exprs.IL);
1258 Dir->setLowerBoundVariable(Exprs.LB);
1259 Dir->setUpperBoundVariable(Exprs.UB);
1260 Dir->setStrideVariable(Exprs.ST);
1261 Dir->setEnsureUpperBound(Exprs.EUB);
1262 Dir->setNextLowerBound(Exprs.NLB);
1263 Dir->setNextUpperBound(Exprs.NUB);
1264 Dir->setNumIterations(Exprs.NumIterations);
1265 Dir->setCounters(Exprs.Counters);
1266 Dir->setPrivateCounters(Exprs.PrivateCounters);
1267 Dir->setInits(Exprs.Inits);
1268 Dir->setUpdates(Exprs.Updates);
1269 Dir->setFinals(Exprs.Finals);
1270 Dir->setDependentCounters(Exprs.DependentCounters);
1271 Dir->setDependentInits(Exprs.DependentInits);
1272 Dir->setFinalsConditions(Exprs.FinalsConditions);
1273 Dir->setPreInits(Exprs.PreInits);
1274 Dir->setHasCancel(HasCancel);
1275 return Dir;
1276}
1277
1279 unsigned NumClauses,
1280 unsigned CollapsedNum,
1281 EmptyShell) {
1282 return createEmptyDirective<OMPTaskLoopDirective>(
1283 C, NumClauses, /*HasAssociatedStmt=*/true,
1284 numLoopChildren(CollapsedNum, OMPD_taskloop), CollapsedNum);
1285}
1286
1287OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
1288 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1289 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1290 const HelperExprs &Exprs) {
1291 auto *Dir = createDirective<OMPTaskLoopSimdDirective>(
1292 C, Clauses, AssociatedStmt,
1293 numLoopChildren(CollapsedNum, OMPD_taskloop_simd), StartLoc, EndLoc,
1294 CollapsedNum);
1295 Dir->setIterationVariable(Exprs.IterationVarRef);
1296 Dir->setLastIteration(Exprs.LastIteration);
1297 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1298 Dir->setPreCond(Exprs.PreCond);
1299 Dir->setCond(Exprs.Cond);
1300 Dir->setInit(Exprs.Init);
1301 Dir->setInc(Exprs.Inc);
1302 Dir->setIsLastIterVariable(Exprs.IL);
1303 Dir->setLowerBoundVariable(Exprs.LB);
1304 Dir->setUpperBoundVariable(Exprs.UB);
1305 Dir->setStrideVariable(Exprs.ST);
1306 Dir->setEnsureUpperBound(Exprs.EUB);
1307 Dir->setNextLowerBound(Exprs.NLB);
1308 Dir->setNextUpperBound(Exprs.NUB);
1309 Dir->setNumIterations(Exprs.NumIterations);
1310 Dir->setCounters(Exprs.Counters);
1311 Dir->setPrivateCounters(Exprs.PrivateCounters);
1312 Dir->setInits(Exprs.Inits);
1313 Dir->setUpdates(Exprs.Updates);
1314 Dir->setFinals(Exprs.Finals);
1315 Dir->setDependentCounters(Exprs.DependentCounters);
1316 Dir->setDependentInits(Exprs.DependentInits);
1317 Dir->setFinalsConditions(Exprs.FinalsConditions);
1318 Dir->setPreInits(Exprs.PreInits);
1319 return Dir;
1320}
1321
1324 unsigned CollapsedNum, EmptyShell) {
1325 return createEmptyDirective<OMPTaskLoopSimdDirective>(
1326 C, NumClauses, /*HasAssociatedStmt=*/true,
1327 numLoopChildren(CollapsedNum, OMPD_taskloop_simd), CollapsedNum);
1328}
1329
1330OMPMasterTaskLoopDirective *OMPMasterTaskLoopDirective::Create(
1331 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1332 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1333 const HelperExprs &Exprs, bool HasCancel) {
1334 auto *Dir = createDirective<OMPMasterTaskLoopDirective>(
1335 C, Clauses, AssociatedStmt,
1336 numLoopChildren(CollapsedNum, OMPD_master_taskloop), StartLoc, EndLoc,
1337 CollapsedNum);
1338 Dir->setIterationVariable(Exprs.IterationVarRef);
1339 Dir->setLastIteration(Exprs.LastIteration);
1340 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1341 Dir->setPreCond(Exprs.PreCond);
1342 Dir->setCond(Exprs.Cond);
1343 Dir->setInit(Exprs.Init);
1344 Dir->setInc(Exprs.Inc);
1345 Dir->setIsLastIterVariable(Exprs.IL);
1346 Dir->setLowerBoundVariable(Exprs.LB);
1347 Dir->setUpperBoundVariable(Exprs.UB);
1348 Dir->setStrideVariable(Exprs.ST);
1349 Dir->setEnsureUpperBound(Exprs.EUB);
1350 Dir->setNextLowerBound(Exprs.NLB);
1351 Dir->setNextUpperBound(Exprs.NUB);
1352 Dir->setNumIterations(Exprs.NumIterations);
1353 Dir->setCounters(Exprs.Counters);
1354 Dir->setPrivateCounters(Exprs.PrivateCounters);
1355 Dir->setInits(Exprs.Inits);
1356 Dir->setUpdates(Exprs.Updates);
1357 Dir->setFinals(Exprs.Finals);
1358 Dir->setDependentCounters(Exprs.DependentCounters);
1359 Dir->setDependentInits(Exprs.DependentInits);
1360 Dir->setFinalsConditions(Exprs.FinalsConditions);
1361 Dir->setPreInits(Exprs.PreInits);
1362 Dir->setHasCancel(HasCancel);
1363 return Dir;
1364}
1365
1368 unsigned NumClauses,
1369 unsigned CollapsedNum, EmptyShell) {
1370 return createEmptyDirective<OMPMasterTaskLoopDirective>(
1371 C, NumClauses, /*HasAssociatedStmt=*/true,
1372 numLoopChildren(CollapsedNum, OMPD_master_taskloop), CollapsedNum);
1373}
1374
1375OMPMaskedTaskLoopDirective *OMPMaskedTaskLoopDirective::Create(
1376 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1377 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1378 const HelperExprs &Exprs, bool HasCancel) {
1379 auto *Dir = createDirective<OMPMaskedTaskLoopDirective>(
1380 C, Clauses, AssociatedStmt,
1381 numLoopChildren(CollapsedNum, OMPD_masked_taskloop), StartLoc, EndLoc,
1382 CollapsedNum);
1383 Dir->setIterationVariable(Exprs.IterationVarRef);
1384 Dir->setLastIteration(Exprs.LastIteration);
1385 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1386 Dir->setPreCond(Exprs.PreCond);
1387 Dir->setCond(Exprs.Cond);
1388 Dir->setInit(Exprs.Init);
1389 Dir->setInc(Exprs.Inc);
1390 Dir->setIsLastIterVariable(Exprs.IL);
1391 Dir->setLowerBoundVariable(Exprs.LB);
1392 Dir->setUpperBoundVariable(Exprs.UB);
1393 Dir->setStrideVariable(Exprs.ST);
1394 Dir->setEnsureUpperBound(Exprs.EUB);
1395 Dir->setNextLowerBound(Exprs.NLB);
1396 Dir->setNextUpperBound(Exprs.NUB);
1397 Dir->setNumIterations(Exprs.NumIterations);
1398 Dir->setCounters(Exprs.Counters);
1399 Dir->setPrivateCounters(Exprs.PrivateCounters);
1400 Dir->setInits(Exprs.Inits);
1401 Dir->setUpdates(Exprs.Updates);
1402 Dir->setFinals(Exprs.Finals);
1403 Dir->setDependentCounters(Exprs.DependentCounters);
1404 Dir->setDependentInits(Exprs.DependentInits);
1405 Dir->setFinalsConditions(Exprs.FinalsConditions);
1406 Dir->setPreInits(Exprs.PreInits);
1407 Dir->setHasCancel(HasCancel);
1408 return Dir;
1409}
1410
1413 unsigned NumClauses,
1414 unsigned CollapsedNum, EmptyShell) {
1415 return createEmptyDirective<OMPMaskedTaskLoopDirective>(
1416 C, NumClauses, /*HasAssociatedStmt=*/true,
1417 numLoopChildren(CollapsedNum, OMPD_masked_taskloop), CollapsedNum);
1418}
1419
1420OMPMasterTaskLoopSimdDirective *OMPMasterTaskLoopSimdDirective::Create(
1421 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1422 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1423 const HelperExprs &Exprs) {
1424 auto *Dir = createDirective<OMPMasterTaskLoopSimdDirective>(
1425 C, Clauses, AssociatedStmt,
1426 numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), StartLoc,
1427 EndLoc, CollapsedNum);
1428 Dir->setIterationVariable(Exprs.IterationVarRef);
1429 Dir->setLastIteration(Exprs.LastIteration);
1430 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1431 Dir->setPreCond(Exprs.PreCond);
1432 Dir->setCond(Exprs.Cond);
1433 Dir->setInit(Exprs.Init);
1434 Dir->setInc(Exprs.Inc);
1435 Dir->setIsLastIterVariable(Exprs.IL);
1436 Dir->setLowerBoundVariable(Exprs.LB);
1437 Dir->setUpperBoundVariable(Exprs.UB);
1438 Dir->setStrideVariable(Exprs.ST);
1439 Dir->setEnsureUpperBound(Exprs.EUB);
1440 Dir->setNextLowerBound(Exprs.NLB);
1441 Dir->setNextUpperBound(Exprs.NUB);
1442 Dir->setNumIterations(Exprs.NumIterations);
1443 Dir->setCounters(Exprs.Counters);
1444 Dir->setPrivateCounters(Exprs.PrivateCounters);
1445 Dir->setInits(Exprs.Inits);
1446 Dir->setUpdates(Exprs.Updates);
1447 Dir->setFinals(Exprs.Finals);
1448 Dir->setDependentCounters(Exprs.DependentCounters);
1449 Dir->setDependentInits(Exprs.DependentInits);
1450 Dir->setFinalsConditions(Exprs.FinalsConditions);
1451 Dir->setPreInits(Exprs.PreInits);
1452 return Dir;
1453}
1454
1457 unsigned NumClauses,
1458 unsigned CollapsedNum, EmptyShell) {
1459 return createEmptyDirective<OMPMasterTaskLoopSimdDirective>(
1460 C, NumClauses, /*HasAssociatedStmt=*/true,
1461 numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), CollapsedNum);
1462}
1463
1464OMPMaskedTaskLoopSimdDirective *OMPMaskedTaskLoopSimdDirective::Create(
1465 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1466 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1467 const HelperExprs &Exprs) {
1468 auto *Dir = createDirective<OMPMaskedTaskLoopSimdDirective>(
1469 C, Clauses, AssociatedStmt,
1470 numLoopChildren(CollapsedNum, OMPD_masked_taskloop_simd), StartLoc,
1471 EndLoc, CollapsedNum);
1472 Dir->setIterationVariable(Exprs.IterationVarRef);
1473 Dir->setLastIteration(Exprs.LastIteration);
1474 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1475 Dir->setPreCond(Exprs.PreCond);
1476 Dir->setCond(Exprs.Cond);
1477 Dir->setInit(Exprs.Init);
1478 Dir->setInc(Exprs.Inc);
1479 Dir->setIsLastIterVariable(Exprs.IL);
1480 Dir->setLowerBoundVariable(Exprs.LB);
1481 Dir->setUpperBoundVariable(Exprs.UB);
1482 Dir->setStrideVariable(Exprs.ST);
1483 Dir->setEnsureUpperBound(Exprs.EUB);
1484 Dir->setNextLowerBound(Exprs.NLB);
1485 Dir->setNextUpperBound(Exprs.NUB);
1486 Dir->setNumIterations(Exprs.NumIterations);
1487 Dir->setCounters(Exprs.Counters);
1488 Dir->setPrivateCounters(Exprs.PrivateCounters);
1489 Dir->setInits(Exprs.Inits);
1490 Dir->setUpdates(Exprs.Updates);
1491 Dir->setFinals(Exprs.Finals);
1492 Dir->setDependentCounters(Exprs.DependentCounters);
1493 Dir->setDependentInits(Exprs.DependentInits);
1494 Dir->setFinalsConditions(Exprs.FinalsConditions);
1495 Dir->setPreInits(Exprs.PreInits);
1496 return Dir;
1497}
1498
1501 unsigned NumClauses,
1502 unsigned CollapsedNum, EmptyShell) {
1503 return createEmptyDirective<OMPMaskedTaskLoopSimdDirective>(
1504 C, NumClauses, /*HasAssociatedStmt=*/true,
1505 numLoopChildren(CollapsedNum, OMPD_masked_taskloop_simd), CollapsedNum);
1506}
1507
1508OMPParallelMasterTaskLoopDirective *OMPParallelMasterTaskLoopDirective::Create(
1509 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1510 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1511 const HelperExprs &Exprs, bool HasCancel) {
1512 auto *Dir = createDirective<OMPParallelMasterTaskLoopDirective>(
1513 C, Clauses, AssociatedStmt,
1514 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop), StartLoc,
1515 EndLoc, CollapsedNum);
1516 Dir->setIterationVariable(Exprs.IterationVarRef);
1517 Dir->setLastIteration(Exprs.LastIteration);
1518 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1519 Dir->setPreCond(Exprs.PreCond);
1520 Dir->setCond(Exprs.Cond);
1521 Dir->setInit(Exprs.Init);
1522 Dir->setInc(Exprs.Inc);
1523 Dir->setIsLastIterVariable(Exprs.IL);
1524 Dir->setLowerBoundVariable(Exprs.LB);
1525 Dir->setUpperBoundVariable(Exprs.UB);
1526 Dir->setStrideVariable(Exprs.ST);
1527 Dir->setEnsureUpperBound(Exprs.EUB);
1528 Dir->setNextLowerBound(Exprs.NLB);
1529 Dir->setNextUpperBound(Exprs.NUB);
1530 Dir->setNumIterations(Exprs.NumIterations);
1531 Dir->setCounters(Exprs.Counters);
1532 Dir->setPrivateCounters(Exprs.PrivateCounters);
1533 Dir->setInits(Exprs.Inits);
1534 Dir->setUpdates(Exprs.Updates);
1535 Dir->setFinals(Exprs.Finals);
1536 Dir->setDependentCounters(Exprs.DependentCounters);
1537 Dir->setDependentInits(Exprs.DependentInits);
1538 Dir->setFinalsConditions(Exprs.FinalsConditions);
1539 Dir->setPreInits(Exprs.PreInits);
1540 Dir->setHasCancel(HasCancel);
1541 return Dir;
1542}
1543
1546 unsigned NumClauses,
1547 unsigned CollapsedNum,
1548 EmptyShell) {
1549 return createEmptyDirective<OMPParallelMasterTaskLoopDirective>(
1550 C, NumClauses, /*HasAssociatedStmt=*/true,
1551 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop),
1552 CollapsedNum);
1553}
1554
1555OMPParallelMaskedTaskLoopDirective *OMPParallelMaskedTaskLoopDirective::Create(
1556 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1557 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1558 const HelperExprs &Exprs, bool HasCancel) {
1559 auto *Dir = createDirective<OMPParallelMaskedTaskLoopDirective>(
1560 C, Clauses, AssociatedStmt,
1561 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop), StartLoc,
1562 EndLoc, CollapsedNum);
1563 Dir->setIterationVariable(Exprs.IterationVarRef);
1564 Dir->setLastIteration(Exprs.LastIteration);
1565 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1566 Dir->setPreCond(Exprs.PreCond);
1567 Dir->setCond(Exprs.Cond);
1568 Dir->setInit(Exprs.Init);
1569 Dir->setInc(Exprs.Inc);
1570 Dir->setIsLastIterVariable(Exprs.IL);
1571 Dir->setLowerBoundVariable(Exprs.LB);
1572 Dir->setUpperBoundVariable(Exprs.UB);
1573 Dir->setStrideVariable(Exprs.ST);
1574 Dir->setEnsureUpperBound(Exprs.EUB);
1575 Dir->setNextLowerBound(Exprs.NLB);
1576 Dir->setNextUpperBound(Exprs.NUB);
1577 Dir->setNumIterations(Exprs.NumIterations);
1578 Dir->setCounters(Exprs.Counters);
1579 Dir->setPrivateCounters(Exprs.PrivateCounters);
1580 Dir->setInits(Exprs.Inits);
1581 Dir->setUpdates(Exprs.Updates);
1582 Dir->setFinals(Exprs.Finals);
1583 Dir->setDependentCounters(Exprs.DependentCounters);
1584 Dir->setDependentInits(Exprs.DependentInits);
1585 Dir->setFinalsConditions(Exprs.FinalsConditions);
1586 Dir->setPreInits(Exprs.PreInits);
1587 Dir->setHasCancel(HasCancel);
1588 return Dir;
1589}
1590
1593 unsigned NumClauses,
1594 unsigned CollapsedNum,
1595 EmptyShell) {
1596 return createEmptyDirective<OMPParallelMaskedTaskLoopDirective>(
1597 C, NumClauses, /*HasAssociatedStmt=*/true,
1598 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop),
1599 CollapsedNum);
1600}
1601
1604 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1605 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1606 const HelperExprs &Exprs) {
1607 auto *Dir = createDirective<OMPParallelMasterTaskLoopSimdDirective>(
1608 C, Clauses, AssociatedStmt,
1609 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd),
1610 StartLoc, EndLoc, CollapsedNum);
1611 Dir->setIterationVariable(Exprs.IterationVarRef);
1612 Dir->setLastIteration(Exprs.LastIteration);
1613 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1614 Dir->setPreCond(Exprs.PreCond);
1615 Dir->setCond(Exprs.Cond);
1616 Dir->setInit(Exprs.Init);
1617 Dir->setInc(Exprs.Inc);
1618 Dir->setIsLastIterVariable(Exprs.IL);
1619 Dir->setLowerBoundVariable(Exprs.LB);
1620 Dir->setUpperBoundVariable(Exprs.UB);
1621 Dir->setStrideVariable(Exprs.ST);
1622 Dir->setEnsureUpperBound(Exprs.EUB);
1623 Dir->setNextLowerBound(Exprs.NLB);
1624 Dir->setNextUpperBound(Exprs.NUB);
1625 Dir->setNumIterations(Exprs.NumIterations);
1626 Dir->setCounters(Exprs.Counters);
1627 Dir->setPrivateCounters(Exprs.PrivateCounters);
1628 Dir->setInits(Exprs.Inits);
1629 Dir->setUpdates(Exprs.Updates);
1630 Dir->setFinals(Exprs.Finals);
1631 Dir->setDependentCounters(Exprs.DependentCounters);
1632 Dir->setDependentInits(Exprs.DependentInits);
1633 Dir->setFinalsConditions(Exprs.FinalsConditions);
1634 Dir->setPreInits(Exprs.PreInits);
1635 return Dir;
1636}
1637
1640 unsigned NumClauses,
1641 unsigned CollapsedNum,
1642 EmptyShell) {
1643 return createEmptyDirective<OMPParallelMasterTaskLoopSimdDirective>(
1644 C, NumClauses, /*HasAssociatedStmt=*/true,
1645 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd),
1646 CollapsedNum);
1647}
1648
1651 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1652 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1653 const HelperExprs &Exprs) {
1654 auto *Dir = createDirective<OMPParallelMaskedTaskLoopSimdDirective>(
1655 C, Clauses, AssociatedStmt,
1656 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop_simd),
1657 StartLoc, EndLoc, CollapsedNum);
1658 Dir->setIterationVariable(Exprs.IterationVarRef);
1659 Dir->setLastIteration(Exprs.LastIteration);
1660 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1661 Dir->setPreCond(Exprs.PreCond);
1662 Dir->setCond(Exprs.Cond);
1663 Dir->setInit(Exprs.Init);
1664 Dir->setInc(Exprs.Inc);
1665 Dir->setIsLastIterVariable(Exprs.IL);
1666 Dir->setLowerBoundVariable(Exprs.LB);
1667 Dir->setUpperBoundVariable(Exprs.UB);
1668 Dir->setStrideVariable(Exprs.ST);
1669 Dir->setEnsureUpperBound(Exprs.EUB);
1670 Dir->setNextLowerBound(Exprs.NLB);
1671 Dir->setNextUpperBound(Exprs.NUB);
1672 Dir->setNumIterations(Exprs.NumIterations);
1673 Dir->setCounters(Exprs.Counters);
1674 Dir->setPrivateCounters(Exprs.PrivateCounters);
1675 Dir->setInits(Exprs.Inits);
1676 Dir->setUpdates(Exprs.Updates);
1677 Dir->setFinals(Exprs.Finals);
1678 Dir->setDependentCounters(Exprs.DependentCounters);
1679 Dir->setDependentInits(Exprs.DependentInits);
1680 Dir->setFinalsConditions(Exprs.FinalsConditions);
1681 Dir->setPreInits(Exprs.PreInits);
1682 return Dir;
1683}
1684
1687 unsigned NumClauses,
1688 unsigned CollapsedNum,
1689 EmptyShell) {
1690 return createEmptyDirective<OMPParallelMaskedTaskLoopSimdDirective>(
1691 C, NumClauses, /*HasAssociatedStmt=*/true,
1692 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop_simd),
1693 CollapsedNum);
1694}
1695
1698 SourceLocation EndLoc, unsigned CollapsedNum,
1699 ArrayRef<OMPClause *> Clauses,
1700 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
1701 auto *Dir = createDirective<OMPDistributeDirective>(
1702 C, Clauses, AssociatedStmt,
1703 numLoopChildren(CollapsedNum, OMPD_distribute), StartLoc, EndLoc,
1704 CollapsedNum);
1705 Dir->setIterationVariable(Exprs.IterationVarRef);
1706 Dir->setLastIteration(Exprs.LastIteration);
1707 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1708 Dir->setPreCond(Exprs.PreCond);
1709 Dir->setCond(Exprs.Cond);
1710 Dir->setInit(Exprs.Init);
1711 Dir->setInc(Exprs.Inc);
1712 Dir->setIsLastIterVariable(Exprs.IL);
1713 Dir->setLowerBoundVariable(Exprs.LB);
1714 Dir->setUpperBoundVariable(Exprs.UB);
1715 Dir->setStrideVariable(Exprs.ST);
1716 Dir->setEnsureUpperBound(Exprs.EUB);
1717 Dir->setNextLowerBound(Exprs.NLB);
1718 Dir->setNextUpperBound(Exprs.NUB);
1719 Dir->setNumIterations(Exprs.NumIterations);
1720 Dir->setCounters(Exprs.Counters);
1721 Dir->setPrivateCounters(Exprs.PrivateCounters);
1722 Dir->setInits(Exprs.Inits);
1723 Dir->setUpdates(Exprs.Updates);
1724 Dir->setFinals(Exprs.Finals);
1725 Dir->setDependentCounters(Exprs.DependentCounters);
1726 Dir->setDependentInits(Exprs.DependentInits);
1727 Dir->setFinalsConditions(Exprs.FinalsConditions);
1728 Dir->setPreInits(Exprs.PreInits);
1729 return Dir;
1730}
1731
1734 unsigned CollapsedNum, EmptyShell) {
1735 return createEmptyDirective<OMPDistributeDirective>(
1736 C, NumClauses, /*HasAssociatedStmt=*/true,
1737 numLoopChildren(CollapsedNum, OMPD_distribute), CollapsedNum);
1738}
1739
1740OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create(
1741 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1742 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1743 return createDirective<OMPTargetUpdateDirective>(C, Clauses, AssociatedStmt,
1744 /*NumChildren=*/0, StartLoc,
1745 EndLoc);
1746}
1747
1750 EmptyShell) {
1751 return createEmptyDirective<OMPTargetUpdateDirective>(
1752 C, NumClauses, /*HasAssociatedStmt=*/true);
1753}
1754
1755OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1756 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1757 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1758 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1759 auto *Dir = createDirective<OMPDistributeParallelForDirective>(
1760 C, Clauses, AssociatedStmt,
1761 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1, StartLoc,
1762 EndLoc, CollapsedNum);
1763 Dir->setIterationVariable(Exprs.IterationVarRef);
1764 Dir->setLastIteration(Exprs.LastIteration);
1765 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1766 Dir->setPreCond(Exprs.PreCond);
1767 Dir->setCond(Exprs.Cond);
1768 Dir->setInit(Exprs.Init);
1769 Dir->setInc(Exprs.Inc);
1770 Dir->setIsLastIterVariable(Exprs.IL);
1771 Dir->setLowerBoundVariable(Exprs.LB);
1772 Dir->setUpperBoundVariable(Exprs.UB);
1773 Dir->setStrideVariable(Exprs.ST);
1774 Dir->setEnsureUpperBound(Exprs.EUB);
1775 Dir->setNextLowerBound(Exprs.NLB);
1776 Dir->setNextUpperBound(Exprs.NUB);
1777 Dir->setNumIterations(Exprs.NumIterations);
1778 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1779 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1780 Dir->setDistInc(Exprs.DistInc);
1781 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1782 Dir->setCounters(Exprs.Counters);
1783 Dir->setPrivateCounters(Exprs.PrivateCounters);
1784 Dir->setInits(Exprs.Inits);
1785 Dir->setUpdates(Exprs.Updates);
1786 Dir->setFinals(Exprs.Finals);
1787 Dir->setDependentCounters(Exprs.DependentCounters);
1788 Dir->setDependentInits(Exprs.DependentInits);
1789 Dir->setFinalsConditions(Exprs.FinalsConditions);
1790 Dir->setPreInits(Exprs.PreInits);
1791 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1792 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1793 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1794 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1795 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1796 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1797 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1798 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1799 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1800 Dir->setTaskReductionRefExpr(TaskRedRef);
1801 Dir->HasCancel = HasCancel;
1802 return Dir;
1803}
1804
1807 unsigned NumClauses,
1808 unsigned CollapsedNum,
1809 EmptyShell) {
1810 return createEmptyDirective<OMPDistributeParallelForDirective>(
1811 C, NumClauses, /*HasAssociatedStmt=*/true,
1812 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1,
1813 CollapsedNum);
1814}
1815
1818 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1819 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1820 const HelperExprs &Exprs) {
1821 auto *Dir = createDirective<OMPDistributeParallelForSimdDirective>(
1822 C, Clauses, AssociatedStmt,
1823 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1824 StartLoc, EndLoc, CollapsedNum);
1825 Dir->setIterationVariable(Exprs.IterationVarRef);
1826 Dir->setLastIteration(Exprs.LastIteration);
1827 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1828 Dir->setPreCond(Exprs.PreCond);
1829 Dir->setCond(Exprs.Cond);
1830 Dir->setInit(Exprs.Init);
1831 Dir->setInc(Exprs.Inc);
1832 Dir->setIsLastIterVariable(Exprs.IL);
1833 Dir->setLowerBoundVariable(Exprs.LB);
1834 Dir->setUpperBoundVariable(Exprs.UB);
1835 Dir->setStrideVariable(Exprs.ST);
1836 Dir->setEnsureUpperBound(Exprs.EUB);
1837 Dir->setNextLowerBound(Exprs.NLB);
1838 Dir->setNextUpperBound(Exprs.NUB);
1839 Dir->setNumIterations(Exprs.NumIterations);
1840 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1841 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1842 Dir->setDistInc(Exprs.DistInc);
1843 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1844 Dir->setCounters(Exprs.Counters);
1845 Dir->setPrivateCounters(Exprs.PrivateCounters);
1846 Dir->setInits(Exprs.Inits);
1847 Dir->setUpdates(Exprs.Updates);
1848 Dir->setFinals(Exprs.Finals);
1849 Dir->setDependentCounters(Exprs.DependentCounters);
1850 Dir->setDependentInits(Exprs.DependentInits);
1851 Dir->setFinalsConditions(Exprs.FinalsConditions);
1852 Dir->setPreInits(Exprs.PreInits);
1853 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1854 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1855 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1856 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1857 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1858 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1859 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1860 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1861 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1862 return Dir;
1863}
1864
1867 unsigned NumClauses,
1868 unsigned CollapsedNum,
1869 EmptyShell) {
1870 return createEmptyDirective<OMPDistributeParallelForSimdDirective>(
1871 C, NumClauses, /*HasAssociatedStmt=*/true,
1872 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1873 CollapsedNum);
1874}
1875
1876OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1877 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1878 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1879 const HelperExprs &Exprs) {
1880 auto *Dir = createDirective<OMPDistributeSimdDirective>(
1881 C, Clauses, AssociatedStmt,
1882 numLoopChildren(CollapsedNum, OMPD_distribute_simd), StartLoc, EndLoc,
1883 CollapsedNum);
1884 Dir->setIterationVariable(Exprs.IterationVarRef);
1885 Dir->setLastIteration(Exprs.LastIteration);
1886 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1887 Dir->setPreCond(Exprs.PreCond);
1888 Dir->setCond(Exprs.Cond);
1889 Dir->setInit(Exprs.Init);
1890 Dir->setInc(Exprs.Inc);
1891 Dir->setIsLastIterVariable(Exprs.IL);
1892 Dir->setLowerBoundVariable(Exprs.LB);
1893 Dir->setUpperBoundVariable(Exprs.UB);
1894 Dir->setStrideVariable(Exprs.ST);
1895 Dir->setEnsureUpperBound(Exprs.EUB);
1896 Dir->setNextLowerBound(Exprs.NLB);
1897 Dir->setNextUpperBound(Exprs.NUB);
1898 Dir->setNumIterations(Exprs.NumIterations);
1899 Dir->setCounters(Exprs.Counters);
1900 Dir->setPrivateCounters(Exprs.PrivateCounters);
1901 Dir->setInits(Exprs.Inits);
1902 Dir->setUpdates(Exprs.Updates);
1903 Dir->setFinals(Exprs.Finals);
1904 Dir->setDependentCounters(Exprs.DependentCounters);
1905 Dir->setDependentInits(Exprs.DependentInits);
1906 Dir->setFinalsConditions(Exprs.FinalsConditions);
1907 Dir->setPreInits(Exprs.PreInits);
1908 return Dir;
1909}
1910
1913 unsigned NumClauses,
1914 unsigned CollapsedNum, EmptyShell) {
1915 return createEmptyDirective<OMPDistributeSimdDirective>(
1916 C, NumClauses, /*HasAssociatedStmt=*/true,
1917 numLoopChildren(CollapsedNum, OMPD_distribute_simd), CollapsedNum);
1918}
1919
1920OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1921 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1922 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1923 const HelperExprs &Exprs) {
1924 auto *Dir = createDirective<OMPTargetParallelForSimdDirective>(
1925 C, Clauses, AssociatedStmt,
1926 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd), StartLoc,
1927 EndLoc, CollapsedNum);
1928 Dir->setIterationVariable(Exprs.IterationVarRef);
1929 Dir->setLastIteration(Exprs.LastIteration);
1930 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1931 Dir->setPreCond(Exprs.PreCond);
1932 Dir->setCond(Exprs.Cond);
1933 Dir->setInit(Exprs.Init);
1934 Dir->setInc(Exprs.Inc);
1935 Dir->setIsLastIterVariable(Exprs.IL);
1936 Dir->setLowerBoundVariable(Exprs.LB);
1937 Dir->setUpperBoundVariable(Exprs.UB);
1938 Dir->setStrideVariable(Exprs.ST);
1939 Dir->setEnsureUpperBound(Exprs.EUB);
1940 Dir->setNextLowerBound(Exprs.NLB);
1941 Dir->setNextUpperBound(Exprs.NUB);
1942 Dir->setNumIterations(Exprs.NumIterations);
1943 Dir->setCounters(Exprs.Counters);
1944 Dir->setPrivateCounters(Exprs.PrivateCounters);
1945 Dir->setInits(Exprs.Inits);
1946 Dir->setUpdates(Exprs.Updates);
1947 Dir->setFinals(Exprs.Finals);
1948 Dir->setDependentCounters(Exprs.DependentCounters);
1949 Dir->setDependentInits(Exprs.DependentInits);
1950 Dir->setFinalsConditions(Exprs.FinalsConditions);
1951 Dir->setPreInits(Exprs.PreInits);
1952 return Dir;
1953}
1954
1957 unsigned NumClauses,
1958 unsigned CollapsedNum,
1959 EmptyShell) {
1960 return createEmptyDirective<OMPTargetParallelForSimdDirective>(
1961 C, NumClauses, /*HasAssociatedStmt=*/true,
1962 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd),
1963 CollapsedNum);
1964}
1965
1968 SourceLocation EndLoc, unsigned CollapsedNum,
1969 ArrayRef<OMPClause *> Clauses,
1970 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
1971 auto *Dir = createDirective<OMPTargetSimdDirective>(
1972 C, Clauses, AssociatedStmt,
1973 numLoopChildren(CollapsedNum, OMPD_target_simd), StartLoc, EndLoc,
1974 CollapsedNum);
1975 Dir->setIterationVariable(Exprs.IterationVarRef);
1976 Dir->setLastIteration(Exprs.LastIteration);
1977 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1978 Dir->setPreCond(Exprs.PreCond);
1979 Dir->setCond(Exprs.Cond);
1980 Dir->setInit(Exprs.Init);
1981 Dir->setInc(Exprs.Inc);
1982 Dir->setCounters(Exprs.Counters);
1983 Dir->setPrivateCounters(Exprs.PrivateCounters);
1984 Dir->setInits(Exprs.Inits);
1985 Dir->setUpdates(Exprs.Updates);
1986 Dir->setFinals(Exprs.Finals);
1987 Dir->setDependentCounters(Exprs.DependentCounters);
1988 Dir->setDependentInits(Exprs.DependentInits);
1989 Dir->setFinalsConditions(Exprs.FinalsConditions);
1990 Dir->setPreInits(Exprs.PreInits);
1991 return Dir;
1992}
1993
1996 unsigned CollapsedNum, EmptyShell) {
1997 return createEmptyDirective<OMPTargetSimdDirective>(
1998 C, NumClauses, /*HasAssociatedStmt=*/true,
1999 numLoopChildren(CollapsedNum, OMPD_target_simd), CollapsedNum);
2000}
2001
2002OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
2003 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2004 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2005 const HelperExprs &Exprs) {
2006 auto *Dir = createDirective<OMPTeamsDistributeDirective>(
2007 C, Clauses, AssociatedStmt,
2008 numLoopChildren(CollapsedNum, OMPD_teams_distribute), StartLoc, EndLoc,
2009 CollapsedNum);
2010 Dir->setIterationVariable(Exprs.IterationVarRef);
2011 Dir->setLastIteration(Exprs.LastIteration);
2012 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2013 Dir->setPreCond(Exprs.PreCond);
2014 Dir->setCond(Exprs.Cond);
2015 Dir->setInit(Exprs.Init);
2016 Dir->setInc(Exprs.Inc);
2017 Dir->setIsLastIterVariable(Exprs.IL);
2018 Dir->setLowerBoundVariable(Exprs.LB);
2019 Dir->setUpperBoundVariable(Exprs.UB);
2020 Dir->setStrideVariable(Exprs.ST);
2021 Dir->setEnsureUpperBound(Exprs.EUB);
2022 Dir->setNextLowerBound(Exprs.NLB);
2023 Dir->setNextUpperBound(Exprs.NUB);
2024 Dir->setNumIterations(Exprs.NumIterations);
2025 Dir->setCounters(Exprs.Counters);
2026 Dir->setPrivateCounters(Exprs.PrivateCounters);
2027 Dir->setInits(Exprs.Inits);
2028 Dir->setUpdates(Exprs.Updates);
2029 Dir->setFinals(Exprs.Finals);
2030 Dir->setDependentCounters(Exprs.DependentCounters);
2031 Dir->setDependentInits(Exprs.DependentInits);
2032 Dir->setFinalsConditions(Exprs.FinalsConditions);
2033 Dir->setPreInits(Exprs.PreInits);
2034 return Dir;
2035}
2036
2039 unsigned NumClauses,
2040 unsigned CollapsedNum, EmptyShell) {
2041 return createEmptyDirective<OMPTeamsDistributeDirective>(
2042 C, NumClauses, /*HasAssociatedStmt=*/true,
2043 numLoopChildren(CollapsedNum, OMPD_teams_distribute), CollapsedNum);
2044}
2045
2046OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
2047 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2048 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2049 const HelperExprs &Exprs) {
2050 auto *Dir = createDirective<OMPTeamsDistributeSimdDirective>(
2051 C, Clauses, AssociatedStmt,
2052 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), StartLoc,
2053 EndLoc, CollapsedNum);
2054 Dir->setIterationVariable(Exprs.IterationVarRef);
2055 Dir->setLastIteration(Exprs.LastIteration);
2056 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2057 Dir->setPreCond(Exprs.PreCond);
2058 Dir->setCond(Exprs.Cond);
2059 Dir->setInit(Exprs.Init);
2060 Dir->setInc(Exprs.Inc);
2061 Dir->setIsLastIterVariable(Exprs.IL);
2062 Dir->setLowerBoundVariable(Exprs.LB);
2063 Dir->setUpperBoundVariable(Exprs.UB);
2064 Dir->setStrideVariable(Exprs.ST);
2065 Dir->setEnsureUpperBound(Exprs.EUB);
2066 Dir->setNextLowerBound(Exprs.NLB);
2067 Dir->setNextUpperBound(Exprs.NUB);
2068 Dir->setNumIterations(Exprs.NumIterations);
2069 Dir->setCounters(Exprs.Counters);
2070 Dir->setPrivateCounters(Exprs.PrivateCounters);
2071 Dir->setInits(Exprs.Inits);
2072 Dir->setUpdates(Exprs.Updates);
2073 Dir->setFinals(Exprs.Finals);
2074 Dir->setDependentCounters(Exprs.DependentCounters);
2075 Dir->setDependentInits(Exprs.DependentInits);
2076 Dir->setFinalsConditions(Exprs.FinalsConditions);
2077 Dir->setPreInits(Exprs.PreInits);
2078 return Dir;
2079}
2080
2081OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
2082 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
2083 EmptyShell) {
2084 return createEmptyDirective<OMPTeamsDistributeSimdDirective>(
2085 C, NumClauses, /*HasAssociatedStmt=*/true,
2086 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), CollapsedNum);
2087}
2088
2091 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2092 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2093 const HelperExprs &Exprs) {
2094 auto *Dir = createDirective<OMPTeamsDistributeParallelForSimdDirective>(
2095 C, Clauses, AssociatedStmt,
2096 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
2097 StartLoc, EndLoc, CollapsedNum);
2098 Dir->setIterationVariable(Exprs.IterationVarRef);
2099 Dir->setLastIteration(Exprs.LastIteration);
2100 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2101 Dir->setPreCond(Exprs.PreCond);
2102 Dir->setCond(Exprs.Cond);
2103 Dir->setInit(Exprs.Init);
2104 Dir->setInc(Exprs.Inc);
2105 Dir->setIsLastIterVariable(Exprs.IL);
2106 Dir->setLowerBoundVariable(Exprs.LB);
2107 Dir->setUpperBoundVariable(Exprs.UB);
2108 Dir->setStrideVariable(Exprs.ST);
2109 Dir->setEnsureUpperBound(Exprs.EUB);
2110 Dir->setNextLowerBound(Exprs.NLB);
2111 Dir->setNextUpperBound(Exprs.NUB);
2112 Dir->setNumIterations(Exprs.NumIterations);
2113 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2114 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2115 Dir->setDistInc(Exprs.DistInc);
2116 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2117 Dir->setCounters(Exprs.Counters);
2118 Dir->setPrivateCounters(Exprs.PrivateCounters);
2119 Dir->setInits(Exprs.Inits);
2120 Dir->setUpdates(Exprs.Updates);
2121 Dir->setFinals(Exprs.Finals);
2122 Dir->setDependentCounters(Exprs.DependentCounters);
2123 Dir->setDependentInits(Exprs.DependentInits);
2124 Dir->setFinalsConditions(Exprs.FinalsConditions);
2125 Dir->setPreInits(Exprs.PreInits);
2126 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2127 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2128 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2129 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2130 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2131 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2132 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2133 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2134 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2135 return Dir;
2136}
2137
2140 unsigned NumClauses,
2141 unsigned CollapsedNum,
2142 EmptyShell) {
2143 return createEmptyDirective<OMPTeamsDistributeParallelForSimdDirective>(
2144 C, NumClauses, /*HasAssociatedStmt=*/true,
2145 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
2146 CollapsedNum);
2147}
2148
2151 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2152 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2153 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
2154 auto *Dir = createDirective<OMPTeamsDistributeParallelForDirective>(
2155 C, Clauses, AssociatedStmt,
2156 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
2157 StartLoc, EndLoc, CollapsedNum);
2158 Dir->setIterationVariable(Exprs.IterationVarRef);
2159 Dir->setLastIteration(Exprs.LastIteration);
2160 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2161 Dir->setPreCond(Exprs.PreCond);
2162 Dir->setCond(Exprs.Cond);
2163 Dir->setInit(Exprs.Init);
2164 Dir->setInc(Exprs.Inc);
2165 Dir->setIsLastIterVariable(Exprs.IL);
2166 Dir->setLowerBoundVariable(Exprs.LB);
2167 Dir->setUpperBoundVariable(Exprs.UB);
2168 Dir->setStrideVariable(Exprs.ST);
2169 Dir->setEnsureUpperBound(Exprs.EUB);
2170 Dir->setNextLowerBound(Exprs.NLB);
2171 Dir->setNextUpperBound(Exprs.NUB);
2172 Dir->setNumIterations(Exprs.NumIterations);
2173 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2174 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2175 Dir->setDistInc(Exprs.DistInc);
2176 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2177 Dir->setCounters(Exprs.Counters);
2178 Dir->setPrivateCounters(Exprs.PrivateCounters);
2179 Dir->setInits(Exprs.Inits);
2180 Dir->setUpdates(Exprs.Updates);
2181 Dir->setFinals(Exprs.Finals);
2182 Dir->setDependentCounters(Exprs.DependentCounters);
2183 Dir->setDependentInits(Exprs.DependentInits);
2184 Dir->setFinalsConditions(Exprs.FinalsConditions);
2185 Dir->setPreInits(Exprs.PreInits);
2186 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2187 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2188 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2189 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2190 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2191 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2192 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2193 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2194 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2195 Dir->setTaskReductionRefExpr(TaskRedRef);
2196 Dir->HasCancel = HasCancel;
2197 return Dir;
2198}
2199
2202 unsigned NumClauses,
2203 unsigned CollapsedNum,
2204 EmptyShell) {
2205 return createEmptyDirective<OMPTeamsDistributeParallelForDirective>(
2206 C, NumClauses, /*HasAssociatedStmt=*/true,
2207 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
2208 CollapsedNum);
2209}
2210
2211OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
2212 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2213 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
2214 return createDirective<OMPTargetTeamsDirective>(C, Clauses, AssociatedStmt,
2215 /*NumChildren=*/0, StartLoc,
2216 EndLoc);
2217}
2218
2221 EmptyShell) {
2222 return createEmptyDirective<OMPTargetTeamsDirective>(
2223 C, NumClauses, /*HasAssociatedStmt=*/true);
2224}
2225
2226OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
2227 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2228 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2229 const HelperExprs &Exprs) {
2230 auto *Dir = createDirective<OMPTargetTeamsDistributeDirective>(
2231 C, Clauses, AssociatedStmt,
2232 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute), StartLoc,
2233 EndLoc, CollapsedNum);
2234 Dir->setIterationVariable(Exprs.IterationVarRef);
2235 Dir->setLastIteration(Exprs.LastIteration);
2236 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2237 Dir->setPreCond(Exprs.PreCond);
2238 Dir->setCond(Exprs.Cond);
2239 Dir->setInit(Exprs.Init);
2240 Dir->setInc(Exprs.Inc);
2241 Dir->setIsLastIterVariable(Exprs.IL);
2242 Dir->setLowerBoundVariable(Exprs.LB);
2243 Dir->setUpperBoundVariable(Exprs.UB);
2244 Dir->setStrideVariable(Exprs.ST);
2245 Dir->setEnsureUpperBound(Exprs.EUB);
2246 Dir->setNextLowerBound(Exprs.NLB);
2247 Dir->setNextUpperBound(Exprs.NUB);
2248 Dir->setNumIterations(Exprs.NumIterations);
2249 Dir->setCounters(Exprs.Counters);
2250 Dir->setPrivateCounters(Exprs.PrivateCounters);
2251 Dir->setInits(Exprs.Inits);
2252 Dir->setUpdates(Exprs.Updates);
2253 Dir->setFinals(Exprs.Finals);
2254 Dir->setDependentCounters(Exprs.DependentCounters);
2255 Dir->setDependentInits(Exprs.DependentInits);
2256 Dir->setFinalsConditions(Exprs.FinalsConditions);
2257 Dir->setPreInits(Exprs.PreInits);
2258 return Dir;
2259}
2260
2263 unsigned NumClauses,
2264 unsigned CollapsedNum,
2265 EmptyShell) {
2266 return createEmptyDirective<OMPTargetTeamsDistributeDirective>(
2267 C, NumClauses, /*HasAssociatedStmt=*/true,
2268 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute),
2269 CollapsedNum);
2270}
2271
2274 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2275 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2276 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
2277 auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForDirective>(
2278 C, Clauses, AssociatedStmt,
2279 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
2280 1,
2281 StartLoc, EndLoc, CollapsedNum);
2282 Dir->setIterationVariable(Exprs.IterationVarRef);
2283 Dir->setLastIteration(Exprs.LastIteration);
2284 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2285 Dir->setPreCond(Exprs.PreCond);
2286 Dir->setCond(Exprs.Cond);
2287 Dir->setInit(Exprs.Init);
2288 Dir->setInc(Exprs.Inc);
2289 Dir->setIsLastIterVariable(Exprs.IL);
2290 Dir->setLowerBoundVariable(Exprs.LB);
2291 Dir->setUpperBoundVariable(Exprs.UB);
2292 Dir->setStrideVariable(Exprs.ST);
2293 Dir->setEnsureUpperBound(Exprs.EUB);
2294 Dir->setNextLowerBound(Exprs.NLB);
2295 Dir->setNextUpperBound(Exprs.NUB);
2296 Dir->setNumIterations(Exprs.NumIterations);
2297 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2298 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2299 Dir->setDistInc(Exprs.DistInc);
2300 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2301 Dir->setCounters(Exprs.Counters);
2302 Dir->setPrivateCounters(Exprs.PrivateCounters);
2303 Dir->setInits(Exprs.Inits);
2304 Dir->setUpdates(Exprs.Updates);
2305 Dir->setFinals(Exprs.Finals);
2306 Dir->setDependentCounters(Exprs.DependentCounters);
2307 Dir->setDependentInits(Exprs.DependentInits);
2308 Dir->setFinalsConditions(Exprs.FinalsConditions);
2309 Dir->setPreInits(Exprs.PreInits);
2310 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2311 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2312 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2313 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2314 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2315 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2316 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2317 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2318 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2319 Dir->setTaskReductionRefExpr(TaskRedRef);
2320 Dir->HasCancel = HasCancel;
2321 return Dir;
2322}
2323
2326 unsigned NumClauses,
2327 unsigned CollapsedNum,
2328 EmptyShell) {
2329 return createEmptyDirective<OMPTargetTeamsDistributeParallelForDirective>(
2330 C, NumClauses, /*HasAssociatedStmt=*/true,
2331 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
2332 1,
2333 CollapsedNum);
2334}
2335
2338 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2339 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2340 const HelperExprs &Exprs) {
2341 auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
2342 C, Clauses, AssociatedStmt,
2343 numLoopChildren(CollapsedNum,
2344 OMPD_target_teams_distribute_parallel_for_simd),
2345 StartLoc, EndLoc, CollapsedNum);
2346 Dir->setIterationVariable(Exprs.IterationVarRef);
2347 Dir->setLastIteration(Exprs.LastIteration);
2348 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2349 Dir->setPreCond(Exprs.PreCond);
2350 Dir->setCond(Exprs.Cond);
2351 Dir->setInit(Exprs.Init);
2352 Dir->setInc(Exprs.Inc);
2353 Dir->setIsLastIterVariable(Exprs.IL);
2354 Dir->setLowerBoundVariable(Exprs.LB);
2355 Dir->setUpperBoundVariable(Exprs.UB);
2356 Dir->setStrideVariable(Exprs.ST);
2357 Dir->setEnsureUpperBound(Exprs.EUB);
2358 Dir->setNextLowerBound(Exprs.NLB);
2359 Dir->setNextUpperBound(Exprs.NUB);
2360 Dir->setNumIterations(Exprs.NumIterations);
2361 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2362 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2363 Dir->setDistInc(Exprs.DistInc);
2364 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2365 Dir->setCounters(Exprs.Counters);
2366 Dir->setPrivateCounters(Exprs.PrivateCounters);
2367 Dir->setInits(Exprs.Inits);
2368 Dir->setUpdates(Exprs.Updates);
2369 Dir->setFinals(Exprs.Finals);
2370 Dir->setDependentCounters(Exprs.DependentCounters);
2371 Dir->setDependentInits(Exprs.DependentInits);
2372 Dir->setFinalsConditions(Exprs.FinalsConditions);
2373 Dir->setPreInits(Exprs.PreInits);
2374 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2375 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2376 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2377 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2378 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2379 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2380 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2381 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2382 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2383 return Dir;
2384}
2385
2388 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
2389 EmptyShell) {
2390 return createEmptyDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
2391 C, NumClauses, /*HasAssociatedStmt=*/true,
2392 numLoopChildren(CollapsedNum,
2393 OMPD_target_teams_distribute_parallel_for_simd),
2394 CollapsedNum);
2395}
2396
2399 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2400 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2401 const HelperExprs &Exprs) {
2402 auto *Dir = createDirective<OMPTargetTeamsDistributeSimdDirective>(
2403 C, Clauses, AssociatedStmt,
2404 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
2405 StartLoc, EndLoc, CollapsedNum);
2406 Dir->setIterationVariable(Exprs.IterationVarRef);
2407 Dir->setLastIteration(Exprs.LastIteration);
2408 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2409 Dir->setPreCond(Exprs.PreCond);
2410 Dir->setCond(Exprs.Cond);
2411 Dir->setInit(Exprs.Init);
2412 Dir->setInc(Exprs.Inc);
2413 Dir->setIsLastIterVariable(Exprs.IL);
2414 Dir->setLowerBoundVariable(Exprs.LB);
2415 Dir->setUpperBoundVariable(Exprs.UB);
2416 Dir->setStrideVariable(Exprs.ST);
2417 Dir->setEnsureUpperBound(Exprs.EUB);
2418 Dir->setNextLowerBound(Exprs.NLB);
2419 Dir->setNextUpperBound(Exprs.NUB);
2420 Dir->setNumIterations(Exprs.NumIterations);
2421 Dir->setCounters(Exprs.Counters);
2422 Dir->setPrivateCounters(Exprs.PrivateCounters);
2423 Dir->setInits(Exprs.Inits);
2424 Dir->setUpdates(Exprs.Updates);
2425 Dir->setFinals(Exprs.Finals);
2426 Dir->setDependentCounters(Exprs.DependentCounters);
2427 Dir->setDependentInits(Exprs.DependentInits);
2428 Dir->setFinalsConditions(Exprs.FinalsConditions);
2429 Dir->setPreInits(Exprs.PreInits);
2430 return Dir;
2431}
2432
2435 unsigned NumClauses,
2436 unsigned CollapsedNum,
2437 EmptyShell) {
2438 return createEmptyDirective<OMPTargetTeamsDistributeSimdDirective>(
2439 C, NumClauses, /*HasAssociatedStmt=*/true,
2440 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
2441 CollapsedNum);
2442}
2443
2446 SourceLocation EndLoc,
2447 ArrayRef<OMPClause *> Clauses) {
2448 return createDirective<OMPInteropDirective>(
2449 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
2450 EndLoc);
2451}
2452
2454 unsigned NumClauses,
2455 EmptyShell) {
2456 return createEmptyDirective<OMPInteropDirective>(C, NumClauses);
2457}
2458
2459OMPDispatchDirective *OMPDispatchDirective::Create(
2460 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2461 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2462 SourceLocation TargetCallLoc) {
2463 auto *Dir = createDirective<OMPDispatchDirective>(
2464 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
2465 Dir->setTargetCallLoc(TargetCallLoc);
2466 return Dir;
2467}
2468
2470 unsigned NumClauses,
2471 EmptyShell) {
2472 return createEmptyDirective<OMPDispatchDirective>(C, NumClauses,
2473 /*HasAssociatedStmt=*/true,
2474 /*NumChildren=*/0);
2475}
2476
2477OMPMaskedDirective *OMPMaskedDirective::Create(const ASTContext &C,
2478 SourceLocation StartLoc,
2479 SourceLocation EndLoc,
2480 ArrayRef<OMPClause *> Clauses,
2481 Stmt *AssociatedStmt) {
2482 return createDirective<OMPMaskedDirective>(C, Clauses, AssociatedStmt,
2483 /*NumChildren=*/0, StartLoc,
2484 EndLoc);
2485}
2486
2488 unsigned NumClauses,
2489 EmptyShell) {
2490 return createEmptyDirective<OMPMaskedDirective>(C, NumClauses,
2491 /*HasAssociatedStmt=*/true);
2492}
2493
2494OMPGenericLoopDirective *OMPGenericLoopDirective::Create(
2495 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2496 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2497 const HelperExprs &Exprs) {
2498 auto *Dir = createDirective<OMPGenericLoopDirective>(
2499 C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_loop),
2500 StartLoc, EndLoc, CollapsedNum);
2501 Dir->setIterationVariable(Exprs.IterationVarRef);
2502 Dir->setLastIteration(Exprs.LastIteration);
2503 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2504 Dir->setPreCond(Exprs.PreCond);
2505 Dir->setCond(Exprs.Cond);
2506 Dir->setInit(Exprs.Init);
2507 Dir->setInc(Exprs.Inc);
2508 Dir->setIsLastIterVariable(Exprs.IL);
2509 Dir->setLowerBoundVariable(Exprs.LB);
2510 Dir->setUpperBoundVariable(Exprs.UB);
2511 Dir->setStrideVariable(Exprs.ST);
2512 Dir->setEnsureUpperBound(Exprs.EUB);
2513 Dir->setNextLowerBound(Exprs.NLB);
2514 Dir->setNextUpperBound(Exprs.NUB);
2515 Dir->setNumIterations(Exprs.NumIterations);
2516 Dir->setCounters(Exprs.Counters);
2517 Dir->setPrivateCounters(Exprs.PrivateCounters);
2518 Dir->setInits(Exprs.Inits);
2519 Dir->setUpdates(Exprs.Updates);
2520 Dir->setFinals(Exprs.Finals);
2521 Dir->setDependentCounters(Exprs.DependentCounters);
2522 Dir->setDependentInits(Exprs.DependentInits);
2523 Dir->setFinalsConditions(Exprs.FinalsConditions);
2524 Dir->setPreInits(Exprs.PreInits);
2525 return Dir;
2526}
2527
2530 unsigned CollapsedNum, EmptyShell) {
2531 return createEmptyDirective<OMPGenericLoopDirective>(
2532 C, NumClauses, /*HasAssociatedStmt=*/true,
2533 numLoopChildren(CollapsedNum, OMPD_loop), CollapsedNum);
2534}
2535
2536OMPTeamsGenericLoopDirective *OMPTeamsGenericLoopDirective::Create(
2537 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2538 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2539 const HelperExprs &Exprs) {
2540 auto *Dir = createDirective<OMPTeamsGenericLoopDirective>(
2541 C, Clauses, AssociatedStmt,
2542 numLoopChildren(CollapsedNum, OMPD_teams_loop), StartLoc, EndLoc,
2543 CollapsedNum);
2544 Dir->setIterationVariable(Exprs.IterationVarRef);
2545 Dir->setLastIteration(Exprs.LastIteration);
2546 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2547 Dir->setPreCond(Exprs.PreCond);
2548 Dir->setCond(Exprs.Cond);
2549 Dir->setInit(Exprs.Init);
2550 Dir->setInc(Exprs.Inc);
2551 Dir->setIsLastIterVariable(Exprs.IL);
2552 Dir->setLowerBoundVariable(Exprs.LB);
2553 Dir->setUpperBoundVariable(Exprs.UB);
2554 Dir->setStrideVariable(Exprs.ST);
2555 Dir->setEnsureUpperBound(Exprs.EUB);
2556 Dir->setNextLowerBound(Exprs.NLB);
2557 Dir->setNextUpperBound(Exprs.NUB);
2558 Dir->setNumIterations(Exprs.NumIterations);
2559 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2560 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2561 Dir->setDistInc(Exprs.DistInc);
2562 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2563 Dir->setCounters(Exprs.Counters);
2564 Dir->setPrivateCounters(Exprs.PrivateCounters);
2565 Dir->setInits(Exprs.Inits);
2566 Dir->setUpdates(Exprs.Updates);
2567 Dir->setFinals(Exprs.Finals);
2568 Dir->setDependentCounters(Exprs.DependentCounters);
2569 Dir->setDependentInits(Exprs.DependentInits);
2570 Dir->setFinalsConditions(Exprs.FinalsConditions);
2571 Dir->setPreInits(Exprs.PreInits);
2572 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2573 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2574 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2575 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2576 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2577 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2578 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2579 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2580 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2581 return Dir;
2582}
2583
2586 unsigned NumClauses,
2587 unsigned CollapsedNum, EmptyShell) {
2588 return createEmptyDirective<OMPTeamsGenericLoopDirective>(
2589 C, NumClauses, /*HasAssociatedStmt=*/true,
2590 numLoopChildren(CollapsedNum, OMPD_teams_loop), CollapsedNum);
2591}
2592
2593OMPTargetTeamsGenericLoopDirective *OMPTargetTeamsGenericLoopDirective::Create(
2594 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2595 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2596 const HelperExprs &Exprs, bool CanBeParallelFor) {
2597 auto *Dir = createDirective<OMPTargetTeamsGenericLoopDirective>(
2598 C, Clauses, AssociatedStmt,
2599 numLoopChildren(CollapsedNum, OMPD_target_teams_loop), StartLoc, EndLoc,
2600 CollapsedNum);
2601 Dir->setIterationVariable(Exprs.IterationVarRef);
2602 Dir->setLastIteration(Exprs.LastIteration);
2603 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2604 Dir->setPreCond(Exprs.PreCond);
2605 Dir->setCond(Exprs.Cond);
2606 Dir->setInit(Exprs.Init);
2607 Dir->setInc(Exprs.Inc);
2608 Dir->setIsLastIterVariable(Exprs.IL);
2609 Dir->setLowerBoundVariable(Exprs.LB);
2610 Dir->setUpperBoundVariable(Exprs.UB);
2611 Dir->setStrideVariable(Exprs.ST);
2612 Dir->setEnsureUpperBound(Exprs.EUB);
2613 Dir->setNextLowerBound(Exprs.NLB);
2614 Dir->setNextUpperBound(Exprs.NUB);
2615 Dir->setNumIterations(Exprs.NumIterations);
2616 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2617 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2618 Dir->setDistInc(Exprs.DistInc);
2619 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2620 Dir->setCounters(Exprs.Counters);
2621 Dir->setPrivateCounters(Exprs.PrivateCounters);
2622 Dir->setInits(Exprs.Inits);
2623 Dir->setUpdates(Exprs.Updates);
2624 Dir->setFinals(Exprs.Finals);
2625 Dir->setDependentCounters(Exprs.DependentCounters);
2626 Dir->setDependentInits(Exprs.DependentInits);
2627 Dir->setFinalsConditions(Exprs.FinalsConditions);
2628 Dir->setPreInits(Exprs.PreInits);
2629 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2630 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2631 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2632 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2633 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2634 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2635 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2636 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2637 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2638 Dir->setCanBeParallelFor(CanBeParallelFor);
2639 return Dir;
2640}
2641
2644 unsigned NumClauses,
2645 unsigned CollapsedNum,
2646 EmptyShell) {
2647 return createEmptyDirective<OMPTargetTeamsGenericLoopDirective>(
2648 C, NumClauses, /*HasAssociatedStmt=*/true,
2649 numLoopChildren(CollapsedNum, OMPD_target_teams_loop), CollapsedNum);
2650}
2651
2652OMPParallelGenericLoopDirective *OMPParallelGenericLoopDirective::Create(
2653 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2654 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2655 const HelperExprs &Exprs) {
2656 auto *Dir = createDirective<OMPParallelGenericLoopDirective>(
2657 C, Clauses, AssociatedStmt,
2658 numLoopChildren(CollapsedNum, OMPD_parallel_loop), StartLoc, EndLoc,
2659 CollapsedNum);
2660 Dir->setIterationVariable(Exprs.IterationVarRef);
2661 Dir->setLastIteration(Exprs.LastIteration);
2662 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2663 Dir->setPreCond(Exprs.PreCond);
2664 Dir->setCond(Exprs.Cond);
2665 Dir->setInit(Exprs.Init);
2666 Dir->setInc(Exprs.Inc);
2667 Dir->setIsLastIterVariable(Exprs.IL);
2668 Dir->setLowerBoundVariable(Exprs.LB);
2669 Dir->setUpperBoundVariable(Exprs.UB);
2670 Dir->setStrideVariable(Exprs.ST);
2671 Dir->setEnsureUpperBound(Exprs.EUB);
2672 Dir->setNextLowerBound(Exprs.NLB);
2673 Dir->setNextUpperBound(Exprs.NUB);
2674 Dir->setNumIterations(Exprs.NumIterations);
2675 Dir->setCounters(Exprs.Counters);
2676 Dir->setPrivateCounters(Exprs.PrivateCounters);
2677 Dir->setInits(Exprs.Inits);
2678 Dir->setUpdates(Exprs.Updates);
2679 Dir->setFinals(Exprs.Finals);
2680 Dir->setDependentCounters(Exprs.DependentCounters);
2681 Dir->setDependentInits(Exprs.DependentInits);
2682 Dir->setFinalsConditions(Exprs.FinalsConditions);
2683 Dir->setPreInits(Exprs.PreInits);
2684 return Dir;
2685}
2686
2687OMPParallelGenericLoopDirective *OMPParallelGenericLoopDirective::CreateEmpty(
2688 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
2689 EmptyShell) {
2690 return createEmptyDirective<OMPParallelGenericLoopDirective>(
2691 C, NumClauses, /*HasAssociatedStmt=*/true,
2692 numLoopChildren(CollapsedNum, OMPD_parallel_loop), CollapsedNum);
2693}
2694
2697 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2698 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2699 const HelperExprs &Exprs) {
2700 auto *Dir = createDirective<OMPTargetParallelGenericLoopDirective>(
2701 C, Clauses, AssociatedStmt,
2702 numLoopChildren(CollapsedNum, OMPD_target_parallel_loop), StartLoc,
2703 EndLoc, CollapsedNum);
2704 Dir->setIterationVariable(Exprs.IterationVarRef);
2705 Dir->setLastIteration(Exprs.LastIteration);
2706 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2707 Dir->setPreCond(Exprs.PreCond);
2708 Dir->setCond(Exprs.Cond);
2709 Dir->setInit(Exprs.Init);
2710 Dir->setInc(Exprs.Inc);
2711 Dir->setIsLastIterVariable(Exprs.IL);
2712 Dir->setLowerBoundVariable(Exprs.LB);
2713 Dir->setUpperBoundVariable(Exprs.UB);
2714 Dir->setStrideVariable(Exprs.ST);
2715 Dir->setEnsureUpperBound(Exprs.EUB);
2716 Dir->setNextLowerBound(Exprs.NLB);
2717 Dir->setNextUpperBound(Exprs.NUB);
2718 Dir->setNumIterations(Exprs.NumIterations);
2719 Dir->setCounters(Exprs.Counters);
2720 Dir->setPrivateCounters(Exprs.PrivateCounters);
2721 Dir->setInits(Exprs.Inits);
2722 Dir->setUpdates(Exprs.Updates);
2723 Dir->setFinals(Exprs.Finals);
2724 Dir->setDependentCounters(Exprs.DependentCounters);
2725 Dir->setDependentInits(Exprs.DependentInits);
2726 Dir->setFinalsConditions(Exprs.FinalsConditions);
2727 Dir->setPreInits(Exprs.PreInits);
2728 return Dir;
2729}
2730
2733 unsigned NumClauses,
2734 unsigned CollapsedNum,
2735 EmptyShell) {
2736 return createEmptyDirective<OMPTargetParallelGenericLoopDirective>(
2737 C, NumClauses, /*HasAssociatedStmt=*/true,
2738 numLoopChildren(CollapsedNum, OMPD_target_parallel_loop), CollapsedNum);
2739}
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:226
This represents one expression.
Definition Expr.h:112
Encodes a location in the source.
Stmt - This represents one statement.
Definition Stmt.h:86
Stmt * IgnoreContainers(bool IgnoreCaptured=false)
Skip no-op (attributed, compound) container stmts and skip captured stmt at the top,...
Definition Stmt.cpp:210
The JSON file list parser is used to communicate input to InstallAPI.
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...