1 //===--- StmtOpenMP.cpp - Classes for OpenMP directives -------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file implements the subclesses of Stmt class declared in StmtOpenMP.h
11 //===----------------------------------------------------------------------===//
13 #include "clang/AST/StmtOpenMP.h"
15 #include "clang/AST/ASTContext.h"
17 using namespace clang;
18 using namespace llvm::omp;
20 void OMPExecutableDirective::setClauses(ArrayRef<OMPClause *> Clauses) {
21 assert(Clauses.size() == getNumClauses() &&
22 "Number of clauses is not the same as the preallocated buffer");
23 std::copy(Clauses.begin(), Clauses.end(), getClauses().begin());
26 bool OMPExecutableDirective::isStandaloneDirective() const {
27 // Special case: 'omp target enter data', 'omp target exit data',
28 // 'omp target update' are stand-alone directives, but for implementation
29 // reasons they have empty synthetic structured block, to simplify codegen.
30 if (isa<OMPTargetEnterDataDirective>(this) ||
31 isa<OMPTargetExitDataDirective>(this) ||
32 isa<OMPTargetUpdateDirective>(this))
34 return !hasAssociatedStmt() || !getAssociatedStmt();
37 const Stmt *OMPExecutableDirective::getStructuredBlock() const {
38 assert(!isStandaloneDirective() &&
39 "Standalone Executable Directives don't have Structured Blocks.");
40 if (auto *LD = dyn_cast<OMPLoopDirective>(this))
42 return getInnermostCapturedStmt()->getCapturedStmt();
45 Stmt *OMPLoopDirective::tryToFindNextInnerLoop(Stmt *CurStmt,
46 bool TryImperfectlyNestedLoops) {
47 Stmt *OrigStmt = CurStmt;
48 CurStmt = CurStmt->IgnoreContainers();
49 // Additional work for imperfectly nested loops, introduced in OpenMP 5.0.
50 if (TryImperfectlyNestedLoops) {
51 if (auto *CS = dyn_cast<CompoundStmt>(CurStmt)) {
53 SmallVector<CompoundStmt *, 4> Statements(1, CS);
54 SmallVector<CompoundStmt *, 4> NextStatements;
55 while (!Statements.empty()) {
56 CS = Statements.pop_back_val();
59 for (Stmt *S : CS->body()) {
62 if (isa<ForStmt>(S) || isa<CXXForRangeStmt>(S)) {
63 // Only single loop construct is allowed.
71 S = S->IgnoreContainers();
72 if (auto *InnerCS = dyn_cast_or_null<CompoundStmt>(S))
73 NextStatements.push_back(InnerCS);
75 if (Statements.empty()) {
76 // Found single inner loop or multiple loops - exit.
79 Statements.swap(NextStatements);
89 Stmt *OMPLoopDirective::getBody() {
90 // This relies on the loop form is already checked by Sema.
92 getInnermostCapturedStmt()->getCapturedStmt()->IgnoreContainers();
93 if (auto *For = dyn_cast<ForStmt>(Body)) {
94 Body = For->getBody();
96 assert(isa<CXXForRangeStmt>(Body) &&
97 "Expected canonical for loop or range-based for loop.");
98 Body = cast<CXXForRangeStmt>(Body)->getBody();
100 for (unsigned Cnt = 1; Cnt < CollapsedNum; ++Cnt) {
101 Body = tryToFindNextInnerLoop(Body, /*TryImperfectlyNestedLoops=*/true);
102 if (auto *For = dyn_cast<ForStmt>(Body)) {
103 Body = For->getBody();
105 assert(isa<CXXForRangeStmt>(Body) &&
106 "Expected canonical for loop or range-based for loop.");
107 Body = cast<CXXForRangeStmt>(Body)->getBody();
113 void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
114 assert(A.size() == getCollapsedNumber() &&
115 "Number of loop counters is not the same as the collapsed number");
116 std::copy(A.begin(), A.end(), getCounters().begin());
119 void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
120 assert(A.size() == getCollapsedNumber() && "Number of loop private counters "
121 "is not the same as the collapsed "
123 std::copy(A.begin(), A.end(), getPrivateCounters().begin());
126 void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
127 assert(A.size() == getCollapsedNumber() &&
128 "Number of counter inits is not the same as the collapsed number");
129 std::copy(A.begin(), A.end(), getInits().begin());
132 void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
133 assert(A.size() == getCollapsedNumber() &&
134 "Number of counter updates is not the same as the collapsed number");
135 std::copy(A.begin(), A.end(), getUpdates().begin());
138 void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
139 assert(A.size() == getCollapsedNumber() &&
140 "Number of counter finals is not the same as the collapsed number");
141 std::copy(A.begin(), A.end(), getFinals().begin());
144 void OMPLoopDirective::setDependentCounters(ArrayRef<Expr *> A) {
146 A.size() == getCollapsedNumber() &&
147 "Number of dependent counters is not the same as the collapsed number");
148 llvm::copy(A, getDependentCounters().begin());
151 void OMPLoopDirective::setDependentInits(ArrayRef<Expr *> A) {
152 assert(A.size() == getCollapsedNumber() &&
153 "Number of dependent inits is not the same as the collapsed number");
154 llvm::copy(A, getDependentInits().begin());
157 void OMPLoopDirective::setFinalsConditions(ArrayRef<Expr *> A) {
158 assert(A.size() == getCollapsedNumber() &&
159 "Number of finals conditions is not the same as the collapsed number");
160 llvm::copy(A, getFinalsConditions().begin());
163 OMPParallelDirective *OMPParallelDirective::Create(
164 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
165 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
167 llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
169 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
170 OMPParallelDirective *Dir =
171 new (Mem) OMPParallelDirective(StartLoc, EndLoc, Clauses.size());
172 Dir->setClauses(Clauses);
173 Dir->setAssociatedStmt(AssociatedStmt);
174 Dir->setHasCancel(HasCancel);
178 OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
182 llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
184 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
185 return new (Mem) OMPParallelDirective(NumClauses);
189 OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
190 SourceLocation EndLoc, unsigned CollapsedNum,
191 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
192 const HelperExprs &Exprs) {
193 unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
195 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
196 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
197 OMPSimdDirective *Dir = new (Mem)
198 OMPSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
199 Dir->setClauses(Clauses);
200 Dir->setAssociatedStmt(AssociatedStmt);
201 Dir->setIterationVariable(Exprs.IterationVarRef);
202 Dir->setLastIteration(Exprs.LastIteration);
203 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
204 Dir->setPreCond(Exprs.PreCond);
205 Dir->setCond(Exprs.Cond);
206 Dir->setInit(Exprs.Init);
207 Dir->setInc(Exprs.Inc);
208 Dir->setCounters(Exprs.Counters);
209 Dir->setPrivateCounters(Exprs.PrivateCounters);
210 Dir->setInits(Exprs.Inits);
211 Dir->setUpdates(Exprs.Updates);
212 Dir->setFinals(Exprs.Finals);
213 Dir->setDependentCounters(Exprs.DependentCounters);
214 Dir->setDependentInits(Exprs.DependentInits);
215 Dir->setFinalsConditions(Exprs.FinalsConditions);
216 Dir->setPreInits(Exprs.PreInits);
220 OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C,
222 unsigned CollapsedNum,
224 unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
226 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
227 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
228 return new (Mem) OMPSimdDirective(CollapsedNum, NumClauses);
232 OMPForDirective::Create(const ASTContext &C, SourceLocation StartLoc,
233 SourceLocation EndLoc, unsigned CollapsedNum,
234 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
235 const HelperExprs &Exprs, bool HasCancel) {
236 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
238 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
239 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
240 OMPForDirective *Dir =
241 new (Mem) OMPForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
242 Dir->setClauses(Clauses);
243 Dir->setAssociatedStmt(AssociatedStmt);
244 Dir->setIterationVariable(Exprs.IterationVarRef);
245 Dir->setLastIteration(Exprs.LastIteration);
246 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
247 Dir->setPreCond(Exprs.PreCond);
248 Dir->setCond(Exprs.Cond);
249 Dir->setInit(Exprs.Init);
250 Dir->setInc(Exprs.Inc);
251 Dir->setIsLastIterVariable(Exprs.IL);
252 Dir->setLowerBoundVariable(Exprs.LB);
253 Dir->setUpperBoundVariable(Exprs.UB);
254 Dir->setStrideVariable(Exprs.ST);
255 Dir->setEnsureUpperBound(Exprs.EUB);
256 Dir->setNextLowerBound(Exprs.NLB);
257 Dir->setNextUpperBound(Exprs.NUB);
258 Dir->setNumIterations(Exprs.NumIterations);
259 Dir->setCounters(Exprs.Counters);
260 Dir->setPrivateCounters(Exprs.PrivateCounters);
261 Dir->setInits(Exprs.Inits);
262 Dir->setUpdates(Exprs.Updates);
263 Dir->setFinals(Exprs.Finals);
264 Dir->setDependentCounters(Exprs.DependentCounters);
265 Dir->setDependentInits(Exprs.DependentInits);
266 Dir->setFinalsConditions(Exprs.FinalsConditions);
267 Dir->setPreInits(Exprs.PreInits);
268 Dir->setHasCancel(HasCancel);
272 OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
274 unsigned CollapsedNum,
276 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
278 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
279 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
280 return new (Mem) OMPForDirective(CollapsedNum, NumClauses);
283 OMPForSimdDirective *
284 OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
285 SourceLocation EndLoc, unsigned CollapsedNum,
286 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
287 const HelperExprs &Exprs) {
289 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
291 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
292 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
293 OMPForSimdDirective *Dir = new (Mem)
294 OMPForSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
295 Dir->setClauses(Clauses);
296 Dir->setAssociatedStmt(AssociatedStmt);
297 Dir->setIterationVariable(Exprs.IterationVarRef);
298 Dir->setLastIteration(Exprs.LastIteration);
299 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
300 Dir->setPreCond(Exprs.PreCond);
301 Dir->setCond(Exprs.Cond);
302 Dir->setInit(Exprs.Init);
303 Dir->setInc(Exprs.Inc);
304 Dir->setIsLastIterVariable(Exprs.IL);
305 Dir->setLowerBoundVariable(Exprs.LB);
306 Dir->setUpperBoundVariable(Exprs.UB);
307 Dir->setStrideVariable(Exprs.ST);
308 Dir->setEnsureUpperBound(Exprs.EUB);
309 Dir->setNextLowerBound(Exprs.NLB);
310 Dir->setNextUpperBound(Exprs.NUB);
311 Dir->setNumIterations(Exprs.NumIterations);
312 Dir->setCounters(Exprs.Counters);
313 Dir->setPrivateCounters(Exprs.PrivateCounters);
314 Dir->setInits(Exprs.Inits);
315 Dir->setUpdates(Exprs.Updates);
316 Dir->setFinals(Exprs.Finals);
317 Dir->setDependentCounters(Exprs.DependentCounters);
318 Dir->setDependentInits(Exprs.DependentInits);
319 Dir->setFinalsConditions(Exprs.FinalsConditions);
320 Dir->setPreInits(Exprs.PreInits);
324 OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
326 unsigned CollapsedNum,
329 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
331 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
332 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
333 return new (Mem) OMPForSimdDirective(CollapsedNum, NumClauses);
336 OMPSectionsDirective *OMPSectionsDirective::Create(
337 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
338 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
340 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
342 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
343 OMPSectionsDirective *Dir =
344 new (Mem) OMPSectionsDirective(StartLoc, EndLoc, Clauses.size());
345 Dir->setClauses(Clauses);
346 Dir->setAssociatedStmt(AssociatedStmt);
347 Dir->setHasCancel(HasCancel);
351 OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
355 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
357 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
358 return new (Mem) OMPSectionsDirective(NumClauses);
361 OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
362 SourceLocation StartLoc,
363 SourceLocation EndLoc,
364 Stmt *AssociatedStmt,
366 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
367 void *Mem = C.Allocate(Size + sizeof(Stmt *));
368 OMPSectionDirective *Dir = new (Mem) OMPSectionDirective(StartLoc, EndLoc);
369 Dir->setAssociatedStmt(AssociatedStmt);
370 Dir->setHasCancel(HasCancel);
374 OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
376 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
377 void *Mem = C.Allocate(Size + sizeof(Stmt *));
378 return new (Mem) OMPSectionDirective();
381 OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
382 SourceLocation StartLoc,
383 SourceLocation EndLoc,
384 ArrayRef<OMPClause *> Clauses,
385 Stmt *AssociatedStmt) {
387 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
389 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
390 OMPSingleDirective *Dir =
391 new (Mem) OMPSingleDirective(StartLoc, EndLoc, Clauses.size());
392 Dir->setClauses(Clauses);
393 Dir->setAssociatedStmt(AssociatedStmt);
397 OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
401 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
403 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
404 return new (Mem) OMPSingleDirective(NumClauses);
407 OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
408 SourceLocation StartLoc,
409 SourceLocation EndLoc,
410 Stmt *AssociatedStmt) {
411 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
412 void *Mem = C.Allocate(Size + sizeof(Stmt *));
413 OMPMasterDirective *Dir = new (Mem) OMPMasterDirective(StartLoc, EndLoc);
414 Dir->setAssociatedStmt(AssociatedStmt);
418 OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
420 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
421 void *Mem = C.Allocate(Size + sizeof(Stmt *));
422 return new (Mem) OMPMasterDirective();
425 OMPCriticalDirective *OMPCriticalDirective::Create(
426 const ASTContext &C, const DeclarationNameInfo &Name,
427 SourceLocation StartLoc, SourceLocation EndLoc,
428 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
430 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
432 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
433 OMPCriticalDirective *Dir =
434 new (Mem) OMPCriticalDirective(Name, StartLoc, EndLoc, Clauses.size());
435 Dir->setClauses(Clauses);
436 Dir->setAssociatedStmt(AssociatedStmt);
440 OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
444 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
446 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
447 return new (Mem) OMPCriticalDirective(NumClauses);
450 OMPParallelForDirective *OMPParallelForDirective::Create(
451 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
452 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
453 const HelperExprs &Exprs, bool HasCancel) {
455 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
456 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
458 numLoopChildren(CollapsedNum, OMPD_parallel_for));
459 OMPParallelForDirective *Dir = new (Mem)
460 OMPParallelForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
461 Dir->setClauses(Clauses);
462 Dir->setAssociatedStmt(AssociatedStmt);
463 Dir->setIterationVariable(Exprs.IterationVarRef);
464 Dir->setLastIteration(Exprs.LastIteration);
465 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
466 Dir->setPreCond(Exprs.PreCond);
467 Dir->setCond(Exprs.Cond);
468 Dir->setInit(Exprs.Init);
469 Dir->setInc(Exprs.Inc);
470 Dir->setIsLastIterVariable(Exprs.IL);
471 Dir->setLowerBoundVariable(Exprs.LB);
472 Dir->setUpperBoundVariable(Exprs.UB);
473 Dir->setStrideVariable(Exprs.ST);
474 Dir->setEnsureUpperBound(Exprs.EUB);
475 Dir->setNextLowerBound(Exprs.NLB);
476 Dir->setNextUpperBound(Exprs.NUB);
477 Dir->setNumIterations(Exprs.NumIterations);
478 Dir->setCounters(Exprs.Counters);
479 Dir->setPrivateCounters(Exprs.PrivateCounters);
480 Dir->setInits(Exprs.Inits);
481 Dir->setUpdates(Exprs.Updates);
482 Dir->setFinals(Exprs.Finals);
483 Dir->setDependentCounters(Exprs.DependentCounters);
484 Dir->setDependentInits(Exprs.DependentInits);
485 Dir->setFinalsConditions(Exprs.FinalsConditions);
486 Dir->setPreInits(Exprs.PreInits);
487 Dir->setHasCancel(HasCancel);
491 OMPParallelForDirective *
492 OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
493 unsigned CollapsedNum, EmptyShell) {
495 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
496 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
498 numLoopChildren(CollapsedNum, OMPD_parallel_for));
499 return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses);
502 OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
503 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
504 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
505 const HelperExprs &Exprs) {
507 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
508 void *Mem = C.Allocate(
509 Size + sizeof(OMPClause *) * Clauses.size() +
510 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
511 OMPParallelForSimdDirective *Dir = new (Mem) OMPParallelForSimdDirective(
512 StartLoc, EndLoc, CollapsedNum, Clauses.size());
513 Dir->setClauses(Clauses);
514 Dir->setAssociatedStmt(AssociatedStmt);
515 Dir->setIterationVariable(Exprs.IterationVarRef);
516 Dir->setLastIteration(Exprs.LastIteration);
517 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
518 Dir->setPreCond(Exprs.PreCond);
519 Dir->setCond(Exprs.Cond);
520 Dir->setInit(Exprs.Init);
521 Dir->setInc(Exprs.Inc);
522 Dir->setIsLastIterVariable(Exprs.IL);
523 Dir->setLowerBoundVariable(Exprs.LB);
524 Dir->setUpperBoundVariable(Exprs.UB);
525 Dir->setStrideVariable(Exprs.ST);
526 Dir->setEnsureUpperBound(Exprs.EUB);
527 Dir->setNextLowerBound(Exprs.NLB);
528 Dir->setNextUpperBound(Exprs.NUB);
529 Dir->setNumIterations(Exprs.NumIterations);
530 Dir->setCounters(Exprs.Counters);
531 Dir->setPrivateCounters(Exprs.PrivateCounters);
532 Dir->setInits(Exprs.Inits);
533 Dir->setUpdates(Exprs.Updates);
534 Dir->setFinals(Exprs.Finals);
535 Dir->setDependentCounters(Exprs.DependentCounters);
536 Dir->setDependentInits(Exprs.DependentInits);
537 Dir->setFinalsConditions(Exprs.FinalsConditions);
538 Dir->setPreInits(Exprs.PreInits);
542 OMPParallelForSimdDirective *
543 OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
545 unsigned CollapsedNum, EmptyShell) {
547 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
548 void *Mem = C.Allocate(
549 Size + sizeof(OMPClause *) * NumClauses +
550 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
551 return new (Mem) OMPParallelForSimdDirective(CollapsedNum, NumClauses);
554 OMPParallelMasterDirective *OMPParallelMasterDirective::Create(
555 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
556 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
558 llvm::alignTo(sizeof(OMPParallelMasterDirective), alignof(OMPClause *));
560 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
562 new (Mem) OMPParallelMasterDirective(StartLoc, EndLoc, Clauses.size());
563 Dir->setClauses(Clauses);
564 Dir->setAssociatedStmt(AssociatedStmt);
568 OMPParallelMasterDirective *OMPParallelMasterDirective::CreateEmpty(const ASTContext &C,
572 llvm::alignTo(sizeof(OMPParallelMasterDirective), alignof(OMPClause *));
574 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
575 return new (Mem) OMPParallelMasterDirective(NumClauses);
578 OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
579 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
580 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
582 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
584 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
585 OMPParallelSectionsDirective *Dir =
586 new (Mem) OMPParallelSectionsDirective(StartLoc, EndLoc, Clauses.size());
587 Dir->setClauses(Clauses);
588 Dir->setAssociatedStmt(AssociatedStmt);
589 Dir->setHasCancel(HasCancel);
593 OMPParallelSectionsDirective *
594 OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
595 unsigned NumClauses, EmptyShell) {
597 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
599 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
600 return new (Mem) OMPParallelSectionsDirective(NumClauses);
604 OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
605 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
606 Stmt *AssociatedStmt, bool HasCancel) {
607 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
609 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
610 OMPTaskDirective *Dir =
611 new (Mem) OMPTaskDirective(StartLoc, EndLoc, Clauses.size());
612 Dir->setClauses(Clauses);
613 Dir->setAssociatedStmt(AssociatedStmt);
614 Dir->setHasCancel(HasCancel);
618 OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
621 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
623 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
624 return new (Mem) OMPTaskDirective(NumClauses);
627 OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
628 SourceLocation StartLoc,
629 SourceLocation EndLoc) {
630 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
631 OMPTaskyieldDirective *Dir =
632 new (Mem) OMPTaskyieldDirective(StartLoc, EndLoc);
636 OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
638 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
639 return new (Mem) OMPTaskyieldDirective();
642 OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
643 SourceLocation StartLoc,
644 SourceLocation EndLoc) {
645 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
646 OMPBarrierDirective *Dir = new (Mem) OMPBarrierDirective(StartLoc, EndLoc);
650 OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
652 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
653 return new (Mem) OMPBarrierDirective();
656 OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C,
657 SourceLocation StartLoc,
658 SourceLocation EndLoc) {
659 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
660 OMPTaskwaitDirective *Dir = new (Mem) OMPTaskwaitDirective(StartLoc, EndLoc);
664 OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
666 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
667 return new (Mem) OMPTaskwaitDirective();
670 OMPTaskgroupDirective *OMPTaskgroupDirective::Create(
671 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
672 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) {
673 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
674 sizeof(OMPClause *) * Clauses.size(),
676 void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
677 OMPTaskgroupDirective *Dir =
678 new (Mem) OMPTaskgroupDirective(StartLoc, EndLoc, Clauses.size());
679 Dir->setAssociatedStmt(AssociatedStmt);
680 Dir->setReductionRef(ReductionRef);
681 Dir->setClauses(Clauses);
685 OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
688 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
689 sizeof(OMPClause *) * NumClauses,
691 void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
692 return new (Mem) OMPTaskgroupDirective(NumClauses);
695 OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
696 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
697 OpenMPDirectiveKind CancelRegion) {
699 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
700 void *Mem = C.Allocate(Size);
701 OMPCancellationPointDirective *Dir =
702 new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc);
703 Dir->setCancelRegion(CancelRegion);
707 OMPCancellationPointDirective *
708 OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
710 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
711 void *Mem = C.Allocate(Size);
712 return new (Mem) OMPCancellationPointDirective();
716 OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
717 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
718 OpenMPDirectiveKind CancelRegion) {
719 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
720 sizeof(OMPClause *) * Clauses.size(),
722 void *Mem = C.Allocate(Size);
723 OMPCancelDirective *Dir =
724 new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size());
725 Dir->setClauses(Clauses);
726 Dir->setCancelRegion(CancelRegion);
730 OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
733 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
734 sizeof(OMPClause *) * NumClauses,
736 void *Mem = C.Allocate(Size);
737 return new (Mem) OMPCancelDirective(NumClauses);
740 OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
741 SourceLocation StartLoc,
742 SourceLocation EndLoc,
743 ArrayRef<OMPClause *> Clauses) {
745 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
746 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
747 OMPFlushDirective *Dir =
748 new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size());
749 Dir->setClauses(Clauses);
753 OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
757 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
758 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
759 return new (Mem) OMPFlushDirective(NumClauses);
762 OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
763 SourceLocation StartLoc,
764 SourceLocation EndLoc,
765 ArrayRef<OMPClause *> Clauses,
766 Stmt *AssociatedStmt) {
768 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
770 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size());
771 OMPOrderedDirective *Dir =
772 new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size());
773 Dir->setClauses(Clauses);
774 Dir->setAssociatedStmt(AssociatedStmt);
778 OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
782 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
784 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses);
785 return new (Mem) OMPOrderedDirective(NumClauses);
788 OMPAtomicDirective *OMPAtomicDirective::Create(
789 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
790 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
791 Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) {
793 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
794 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
796 OMPAtomicDirective *Dir =
797 new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size());
798 Dir->setClauses(Clauses);
799 Dir->setAssociatedStmt(AssociatedStmt);
803 Dir->setUpdateExpr(UE);
804 Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
805 Dir->IsPostfixUpdate = IsPostfixUpdate;
809 OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
813 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
815 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *));
816 return new (Mem) OMPAtomicDirective(NumClauses);
819 OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
820 SourceLocation StartLoc,
821 SourceLocation EndLoc,
822 ArrayRef<OMPClause *> Clauses,
823 Stmt *AssociatedStmt) {
825 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
827 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
828 OMPTargetDirective *Dir =
829 new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size());
830 Dir->setClauses(Clauses);
831 Dir->setAssociatedStmt(AssociatedStmt);
835 OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
839 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
841 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
842 return new (Mem) OMPTargetDirective(NumClauses);
845 OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
846 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
847 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
849 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
851 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
852 OMPTargetParallelDirective *Dir =
853 new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size());
854 Dir->setClauses(Clauses);
855 Dir->setAssociatedStmt(AssociatedStmt);
859 OMPTargetParallelDirective *
860 OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
861 unsigned NumClauses, EmptyShell) {
863 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
865 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
866 return new (Mem) OMPTargetParallelDirective(NumClauses);
869 OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
870 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
871 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
872 const HelperExprs &Exprs, bool HasCancel) {
873 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
874 alignof(OMPClause *));
875 void *Mem = C.Allocate(
876 Size + sizeof(OMPClause *) * Clauses.size() +
877 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
878 OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective(
879 StartLoc, EndLoc, CollapsedNum, Clauses.size());
880 Dir->setClauses(Clauses);
881 Dir->setAssociatedStmt(AssociatedStmt);
882 Dir->setIterationVariable(Exprs.IterationVarRef);
883 Dir->setLastIteration(Exprs.LastIteration);
884 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
885 Dir->setPreCond(Exprs.PreCond);
886 Dir->setCond(Exprs.Cond);
887 Dir->setInit(Exprs.Init);
888 Dir->setInc(Exprs.Inc);
889 Dir->setIsLastIterVariable(Exprs.IL);
890 Dir->setLowerBoundVariable(Exprs.LB);
891 Dir->setUpperBoundVariable(Exprs.UB);
892 Dir->setStrideVariable(Exprs.ST);
893 Dir->setEnsureUpperBound(Exprs.EUB);
894 Dir->setNextLowerBound(Exprs.NLB);
895 Dir->setNextUpperBound(Exprs.NUB);
896 Dir->setNumIterations(Exprs.NumIterations);
897 Dir->setCounters(Exprs.Counters);
898 Dir->setPrivateCounters(Exprs.PrivateCounters);
899 Dir->setInits(Exprs.Inits);
900 Dir->setUpdates(Exprs.Updates);
901 Dir->setFinals(Exprs.Finals);
902 Dir->setDependentCounters(Exprs.DependentCounters);
903 Dir->setDependentInits(Exprs.DependentInits);
904 Dir->setFinalsConditions(Exprs.FinalsConditions);
905 Dir->setPreInits(Exprs.PreInits);
906 Dir->setHasCancel(HasCancel);
910 OMPTargetParallelForDirective *
911 OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
913 unsigned CollapsedNum, EmptyShell) {
914 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
915 alignof(OMPClause *));
916 void *Mem = C.Allocate(
917 Size + sizeof(OMPClause *) * NumClauses +
918 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
919 return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses);
922 OMPTargetDataDirective *OMPTargetDataDirective::Create(
923 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
924 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
925 void *Mem = C.Allocate(
926 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
927 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
928 OMPTargetDataDirective *Dir =
929 new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size());
930 Dir->setClauses(Clauses);
931 Dir->setAssociatedStmt(AssociatedStmt);
935 OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
938 void *Mem = C.Allocate(
939 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
940 sizeof(OMPClause *) * N + sizeof(Stmt *));
941 return new (Mem) OMPTargetDataDirective(N);
944 OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
945 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
946 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
947 void *Mem = C.Allocate(
948 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
949 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
950 OMPTargetEnterDataDirective *Dir =
951 new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size());
952 Dir->setClauses(Clauses);
953 Dir->setAssociatedStmt(AssociatedStmt);
957 OMPTargetEnterDataDirective *
958 OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
960 void *Mem = C.Allocate(
961 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
962 sizeof(OMPClause *) * N + sizeof(Stmt *));
963 return new (Mem) OMPTargetEnterDataDirective(N);
966 OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create(
967 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
968 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
969 void *Mem = C.Allocate(
970 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
971 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
972 OMPTargetExitDataDirective *Dir =
973 new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size());
974 Dir->setClauses(Clauses);
975 Dir->setAssociatedStmt(AssociatedStmt);
979 OMPTargetExitDataDirective *
980 OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
982 void *Mem = C.Allocate(
983 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
984 sizeof(OMPClause *) * N + sizeof(Stmt *));
985 return new (Mem) OMPTargetExitDataDirective(N);
988 OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
989 SourceLocation StartLoc,
990 SourceLocation EndLoc,
991 ArrayRef<OMPClause *> Clauses,
992 Stmt *AssociatedStmt) {
994 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
996 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
997 OMPTeamsDirective *Dir =
998 new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size());
999 Dir->setClauses(Clauses);
1000 Dir->setAssociatedStmt(AssociatedStmt);
1004 OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
1005 unsigned NumClauses,
1008 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
1010 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1011 return new (Mem) OMPTeamsDirective(NumClauses);
1014 OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
1015 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1016 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1017 const HelperExprs &Exprs) {
1019 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
1021 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1022 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
1023 OMPTaskLoopDirective *Dir = new (Mem)
1024 OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1025 Dir->setClauses(Clauses);
1026 Dir->setAssociatedStmt(AssociatedStmt);
1027 Dir->setIterationVariable(Exprs.IterationVarRef);
1028 Dir->setLastIteration(Exprs.LastIteration);
1029 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1030 Dir->setPreCond(Exprs.PreCond);
1031 Dir->setCond(Exprs.Cond);
1032 Dir->setInit(Exprs.Init);
1033 Dir->setInc(Exprs.Inc);
1034 Dir->setIsLastIterVariable(Exprs.IL);
1035 Dir->setLowerBoundVariable(Exprs.LB);
1036 Dir->setUpperBoundVariable(Exprs.UB);
1037 Dir->setStrideVariable(Exprs.ST);
1038 Dir->setEnsureUpperBound(Exprs.EUB);
1039 Dir->setNextLowerBound(Exprs.NLB);
1040 Dir->setNextUpperBound(Exprs.NUB);
1041 Dir->setNumIterations(Exprs.NumIterations);
1042 Dir->setCounters(Exprs.Counters);
1043 Dir->setPrivateCounters(Exprs.PrivateCounters);
1044 Dir->setInits(Exprs.Inits);
1045 Dir->setUpdates(Exprs.Updates);
1046 Dir->setFinals(Exprs.Finals);
1047 Dir->setDependentCounters(Exprs.DependentCounters);
1048 Dir->setDependentInits(Exprs.DependentInits);
1049 Dir->setFinalsConditions(Exprs.FinalsConditions);
1050 Dir->setPreInits(Exprs.PreInits);
1054 OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
1055 unsigned NumClauses,
1056 unsigned CollapsedNum,
1059 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
1061 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1062 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
1063 return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses);
1066 OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
1067 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1068 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1069 const HelperExprs &Exprs) {
1071 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
1072 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1074 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
1075 OMPTaskLoopSimdDirective *Dir = new (Mem)
1076 OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1077 Dir->setClauses(Clauses);
1078 Dir->setAssociatedStmt(AssociatedStmt);
1079 Dir->setIterationVariable(Exprs.IterationVarRef);
1080 Dir->setLastIteration(Exprs.LastIteration);
1081 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1082 Dir->setPreCond(Exprs.PreCond);
1083 Dir->setCond(Exprs.Cond);
1084 Dir->setInit(Exprs.Init);
1085 Dir->setInc(Exprs.Inc);
1086 Dir->setIsLastIterVariable(Exprs.IL);
1087 Dir->setLowerBoundVariable(Exprs.LB);
1088 Dir->setUpperBoundVariable(Exprs.UB);
1089 Dir->setStrideVariable(Exprs.ST);
1090 Dir->setEnsureUpperBound(Exprs.EUB);
1091 Dir->setNextLowerBound(Exprs.NLB);
1092 Dir->setNextUpperBound(Exprs.NUB);
1093 Dir->setNumIterations(Exprs.NumIterations);
1094 Dir->setCounters(Exprs.Counters);
1095 Dir->setPrivateCounters(Exprs.PrivateCounters);
1096 Dir->setInits(Exprs.Inits);
1097 Dir->setUpdates(Exprs.Updates);
1098 Dir->setFinals(Exprs.Finals);
1099 Dir->setDependentCounters(Exprs.DependentCounters);
1100 Dir->setDependentInits(Exprs.DependentInits);
1101 Dir->setFinalsConditions(Exprs.FinalsConditions);
1102 Dir->setPreInits(Exprs.PreInits);
1106 OMPTaskLoopSimdDirective *
1107 OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1108 unsigned CollapsedNum, EmptyShell) {
1110 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
1111 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1113 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
1114 return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);
1117 OMPMasterTaskLoopDirective *OMPMasterTaskLoopDirective::Create(
1118 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1119 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1120 const HelperExprs &Exprs) {
1122 llvm::alignTo(sizeof(OMPMasterTaskLoopDirective), alignof(OMPClause *));
1123 void *Mem = C.Allocate(
1124 Size + sizeof(OMPClause *) * Clauses.size() +
1125 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_master_taskloop));
1126 OMPMasterTaskLoopDirective *Dir = new (Mem) OMPMasterTaskLoopDirective(
1127 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1128 Dir->setClauses(Clauses);
1129 Dir->setAssociatedStmt(AssociatedStmt);
1130 Dir->setIterationVariable(Exprs.IterationVarRef);
1131 Dir->setLastIteration(Exprs.LastIteration);
1132 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1133 Dir->setPreCond(Exprs.PreCond);
1134 Dir->setCond(Exprs.Cond);
1135 Dir->setInit(Exprs.Init);
1136 Dir->setInc(Exprs.Inc);
1137 Dir->setIsLastIterVariable(Exprs.IL);
1138 Dir->setLowerBoundVariable(Exprs.LB);
1139 Dir->setUpperBoundVariable(Exprs.UB);
1140 Dir->setStrideVariable(Exprs.ST);
1141 Dir->setEnsureUpperBound(Exprs.EUB);
1142 Dir->setNextLowerBound(Exprs.NLB);
1143 Dir->setNextUpperBound(Exprs.NUB);
1144 Dir->setNumIterations(Exprs.NumIterations);
1145 Dir->setCounters(Exprs.Counters);
1146 Dir->setPrivateCounters(Exprs.PrivateCounters);
1147 Dir->setInits(Exprs.Inits);
1148 Dir->setUpdates(Exprs.Updates);
1149 Dir->setFinals(Exprs.Finals);
1150 Dir->setDependentCounters(Exprs.DependentCounters);
1151 Dir->setDependentInits(Exprs.DependentInits);
1152 Dir->setFinalsConditions(Exprs.FinalsConditions);
1153 Dir->setPreInits(Exprs.PreInits);
1157 OMPMasterTaskLoopDirective *
1158 OMPMasterTaskLoopDirective::CreateEmpty(const ASTContext &C,
1159 unsigned NumClauses,
1160 unsigned CollapsedNum, EmptyShell) {
1162 llvm::alignTo(sizeof(OMPMasterTaskLoopDirective), alignof(OMPClause *));
1163 void *Mem = C.Allocate(
1164 Size + sizeof(OMPClause *) * NumClauses +
1165 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_master_taskloop));
1166 return new (Mem) OMPMasterTaskLoopDirective(CollapsedNum, NumClauses);
1169 OMPMasterTaskLoopSimdDirective *OMPMasterTaskLoopSimdDirective::Create(
1170 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1171 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1172 const HelperExprs &Exprs) {
1173 unsigned Size = llvm::alignTo(sizeof(OMPMasterTaskLoopSimdDirective),
1174 alignof(OMPClause *));
1176 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1178 numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd));
1179 auto *Dir = new (Mem) OMPMasterTaskLoopSimdDirective(
1180 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1181 Dir->setClauses(Clauses);
1182 Dir->setAssociatedStmt(AssociatedStmt);
1183 Dir->setIterationVariable(Exprs.IterationVarRef);
1184 Dir->setLastIteration(Exprs.LastIteration);
1185 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1186 Dir->setPreCond(Exprs.PreCond);
1187 Dir->setCond(Exprs.Cond);
1188 Dir->setInit(Exprs.Init);
1189 Dir->setInc(Exprs.Inc);
1190 Dir->setIsLastIterVariable(Exprs.IL);
1191 Dir->setLowerBoundVariable(Exprs.LB);
1192 Dir->setUpperBoundVariable(Exprs.UB);
1193 Dir->setStrideVariable(Exprs.ST);
1194 Dir->setEnsureUpperBound(Exprs.EUB);
1195 Dir->setNextLowerBound(Exprs.NLB);
1196 Dir->setNextUpperBound(Exprs.NUB);
1197 Dir->setNumIterations(Exprs.NumIterations);
1198 Dir->setCounters(Exprs.Counters);
1199 Dir->setPrivateCounters(Exprs.PrivateCounters);
1200 Dir->setInits(Exprs.Inits);
1201 Dir->setUpdates(Exprs.Updates);
1202 Dir->setFinals(Exprs.Finals);
1203 Dir->setDependentCounters(Exprs.DependentCounters);
1204 Dir->setDependentInits(Exprs.DependentInits);
1205 Dir->setFinalsConditions(Exprs.FinalsConditions);
1206 Dir->setPreInits(Exprs.PreInits);
1210 OMPMasterTaskLoopSimdDirective *
1211 OMPMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1212 unsigned NumClauses,
1213 unsigned CollapsedNum, EmptyShell) {
1214 unsigned Size = llvm::alignTo(sizeof(OMPMasterTaskLoopSimdDirective),
1215 alignof(OMPClause *));
1217 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1219 numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd));
1220 return new (Mem) OMPMasterTaskLoopSimdDirective(CollapsedNum, NumClauses);
1223 OMPParallelMasterTaskLoopDirective *OMPParallelMasterTaskLoopDirective::Create(
1224 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1225 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1226 const HelperExprs &Exprs) {
1227 unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopDirective),
1228 alignof(OMPClause *));
1229 void *Mem = C.Allocate(
1230 Size + sizeof(OMPClause *) * Clauses.size() +
1232 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop));
1233 auto *Dir = new (Mem) OMPParallelMasterTaskLoopDirective(
1234 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1235 Dir->setClauses(Clauses);
1236 Dir->setAssociatedStmt(AssociatedStmt);
1237 Dir->setIterationVariable(Exprs.IterationVarRef);
1238 Dir->setLastIteration(Exprs.LastIteration);
1239 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1240 Dir->setPreCond(Exprs.PreCond);
1241 Dir->setCond(Exprs.Cond);
1242 Dir->setInit(Exprs.Init);
1243 Dir->setInc(Exprs.Inc);
1244 Dir->setIsLastIterVariable(Exprs.IL);
1245 Dir->setLowerBoundVariable(Exprs.LB);
1246 Dir->setUpperBoundVariable(Exprs.UB);
1247 Dir->setStrideVariable(Exprs.ST);
1248 Dir->setEnsureUpperBound(Exprs.EUB);
1249 Dir->setNextLowerBound(Exprs.NLB);
1250 Dir->setNextUpperBound(Exprs.NUB);
1251 Dir->setNumIterations(Exprs.NumIterations);
1252 Dir->setCounters(Exprs.Counters);
1253 Dir->setPrivateCounters(Exprs.PrivateCounters);
1254 Dir->setInits(Exprs.Inits);
1255 Dir->setUpdates(Exprs.Updates);
1256 Dir->setFinals(Exprs.Finals);
1257 Dir->setDependentCounters(Exprs.DependentCounters);
1258 Dir->setDependentInits(Exprs.DependentInits);
1259 Dir->setFinalsConditions(Exprs.FinalsConditions);
1260 Dir->setPreInits(Exprs.PreInits);
1264 OMPParallelMasterTaskLoopDirective *
1265 OMPParallelMasterTaskLoopDirective::CreateEmpty(const ASTContext &C,
1266 unsigned NumClauses,
1267 unsigned CollapsedNum,
1269 unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopDirective),
1270 alignof(OMPClause *));
1271 void *Mem = C.Allocate(
1272 Size + sizeof(OMPClause *) * NumClauses +
1274 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop));
1275 return new (Mem) OMPParallelMasterTaskLoopDirective(CollapsedNum, NumClauses);
1278 OMPParallelMasterTaskLoopSimdDirective *
1279 OMPParallelMasterTaskLoopSimdDirective::Create(
1280 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1281 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1282 const HelperExprs &Exprs) {
1283 unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopSimdDirective),
1284 alignof(OMPClause *));
1285 void *Mem = C.Allocate(
1286 Size + sizeof(OMPClause *) * Clauses.size() +
1288 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd));
1289 auto *Dir = new (Mem) OMPParallelMasterTaskLoopSimdDirective(
1290 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1291 Dir->setClauses(Clauses);
1292 Dir->setAssociatedStmt(AssociatedStmt);
1293 Dir->setIterationVariable(Exprs.IterationVarRef);
1294 Dir->setLastIteration(Exprs.LastIteration);
1295 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1296 Dir->setPreCond(Exprs.PreCond);
1297 Dir->setCond(Exprs.Cond);
1298 Dir->setInit(Exprs.Init);
1299 Dir->setInc(Exprs.Inc);
1300 Dir->setIsLastIterVariable(Exprs.IL);
1301 Dir->setLowerBoundVariable(Exprs.LB);
1302 Dir->setUpperBoundVariable(Exprs.UB);
1303 Dir->setStrideVariable(Exprs.ST);
1304 Dir->setEnsureUpperBound(Exprs.EUB);
1305 Dir->setNextLowerBound(Exprs.NLB);
1306 Dir->setNextUpperBound(Exprs.NUB);
1307 Dir->setNumIterations(Exprs.NumIterations);
1308 Dir->setCounters(Exprs.Counters);
1309 Dir->setPrivateCounters(Exprs.PrivateCounters);
1310 Dir->setInits(Exprs.Inits);
1311 Dir->setUpdates(Exprs.Updates);
1312 Dir->setFinals(Exprs.Finals);
1313 Dir->setDependentCounters(Exprs.DependentCounters);
1314 Dir->setDependentInits(Exprs.DependentInits);
1315 Dir->setFinalsConditions(Exprs.FinalsConditions);
1316 Dir->setPreInits(Exprs.PreInits);
1320 OMPParallelMasterTaskLoopSimdDirective *
1321 OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1322 unsigned NumClauses,
1323 unsigned CollapsedNum,
1325 unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopSimdDirective),
1326 alignof(OMPClause *));
1327 void *Mem = C.Allocate(
1328 Size + sizeof(OMPClause *) * NumClauses +
1330 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd));
1332 OMPParallelMasterTaskLoopSimdDirective(CollapsedNum, NumClauses);
1335 OMPDistributeDirective *OMPDistributeDirective::Create(
1336 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1337 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1338 const HelperExprs &Exprs) {
1340 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
1341 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1343 numLoopChildren(CollapsedNum, OMPD_distribute));
1344 OMPDistributeDirective *Dir = new (Mem)
1345 OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1346 Dir->setClauses(Clauses);
1347 Dir->setAssociatedStmt(AssociatedStmt);
1348 Dir->setIterationVariable(Exprs.IterationVarRef);
1349 Dir->setLastIteration(Exprs.LastIteration);
1350 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1351 Dir->setPreCond(Exprs.PreCond);
1352 Dir->setCond(Exprs.Cond);
1353 Dir->setInit(Exprs.Init);
1354 Dir->setInc(Exprs.Inc);
1355 Dir->setIsLastIterVariable(Exprs.IL);
1356 Dir->setLowerBoundVariable(Exprs.LB);
1357 Dir->setUpperBoundVariable(Exprs.UB);
1358 Dir->setStrideVariable(Exprs.ST);
1359 Dir->setEnsureUpperBound(Exprs.EUB);
1360 Dir->setNextLowerBound(Exprs.NLB);
1361 Dir->setNextUpperBound(Exprs.NUB);
1362 Dir->setNumIterations(Exprs.NumIterations);
1363 Dir->setCounters(Exprs.Counters);
1364 Dir->setPrivateCounters(Exprs.PrivateCounters);
1365 Dir->setInits(Exprs.Inits);
1366 Dir->setUpdates(Exprs.Updates);
1367 Dir->setFinals(Exprs.Finals);
1368 Dir->setDependentCounters(Exprs.DependentCounters);
1369 Dir->setDependentInits(Exprs.DependentInits);
1370 Dir->setFinalsConditions(Exprs.FinalsConditions);
1371 Dir->setPreInits(Exprs.PreInits);
1375 OMPDistributeDirective *
1376 OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1377 unsigned CollapsedNum, EmptyShell) {
1379 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
1380 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1382 numLoopChildren(CollapsedNum, OMPD_distribute));
1383 return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);
1386 OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create(
1387 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1388 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1390 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
1392 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
1393 OMPTargetUpdateDirective *Dir =
1394 new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size());
1395 Dir->setClauses(Clauses);
1396 Dir->setAssociatedStmt(AssociatedStmt);
1400 OMPTargetUpdateDirective *
1401 OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1404 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
1406 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1407 return new (Mem) OMPTargetUpdateDirective(NumClauses);
1410 OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1411 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1412 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1413 const HelperExprs &Exprs, bool HasCancel) {
1414 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
1415 alignof(OMPClause *));
1416 void *Mem = C.Allocate(
1417 Size + sizeof(OMPClause *) * Clauses.size() +
1419 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1420 OMPDistributeParallelForDirective *Dir =
1421 new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc,
1422 CollapsedNum, Clauses.size());
1423 Dir->setClauses(Clauses);
1424 Dir->setAssociatedStmt(AssociatedStmt);
1425 Dir->setIterationVariable(Exprs.IterationVarRef);
1426 Dir->setLastIteration(Exprs.LastIteration);
1427 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1428 Dir->setPreCond(Exprs.PreCond);
1429 Dir->setCond(Exprs.Cond);
1430 Dir->setInit(Exprs.Init);
1431 Dir->setInc(Exprs.Inc);
1432 Dir->setIsLastIterVariable(Exprs.IL);
1433 Dir->setLowerBoundVariable(Exprs.LB);
1434 Dir->setUpperBoundVariable(Exprs.UB);
1435 Dir->setStrideVariable(Exprs.ST);
1436 Dir->setEnsureUpperBound(Exprs.EUB);
1437 Dir->setNextLowerBound(Exprs.NLB);
1438 Dir->setNextUpperBound(Exprs.NUB);
1439 Dir->setNumIterations(Exprs.NumIterations);
1440 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1441 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1442 Dir->setDistInc(Exprs.DistInc);
1443 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1444 Dir->setCounters(Exprs.Counters);
1445 Dir->setPrivateCounters(Exprs.PrivateCounters);
1446 Dir->setInits(Exprs.Inits);
1447 Dir->setUpdates(Exprs.Updates);
1448 Dir->setFinals(Exprs.Finals);
1449 Dir->setDependentCounters(Exprs.DependentCounters);
1450 Dir->setDependentInits(Exprs.DependentInits);
1451 Dir->setFinalsConditions(Exprs.FinalsConditions);
1452 Dir->setPreInits(Exprs.PreInits);
1453 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1454 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1455 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1456 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1457 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1458 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1459 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1460 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1461 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1462 Dir->HasCancel = HasCancel;
1466 OMPDistributeParallelForDirective *
1467 OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1468 unsigned NumClauses,
1469 unsigned CollapsedNum,
1471 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
1472 alignof(OMPClause *));
1473 void *Mem = C.Allocate(
1474 Size + sizeof(OMPClause *) * NumClauses +
1476 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1477 return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses);
1480 OMPDistributeParallelForSimdDirective *
1481 OMPDistributeParallelForSimdDirective::Create(
1482 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1483 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1484 const HelperExprs &Exprs) {
1485 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
1486 alignof(OMPClause *));
1487 void *Mem = C.Allocate(
1488 Size + sizeof(OMPClause *) * Clauses.size() +
1490 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1491 OMPDistributeParallelForSimdDirective *Dir = new (Mem)
1492 OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1494 Dir->setClauses(Clauses);
1495 Dir->setAssociatedStmt(AssociatedStmt);
1496 Dir->setIterationVariable(Exprs.IterationVarRef);
1497 Dir->setLastIteration(Exprs.LastIteration);
1498 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1499 Dir->setPreCond(Exprs.PreCond);
1500 Dir->setCond(Exprs.Cond);
1501 Dir->setInit(Exprs.Init);
1502 Dir->setInc(Exprs.Inc);
1503 Dir->setIsLastIterVariable(Exprs.IL);
1504 Dir->setLowerBoundVariable(Exprs.LB);
1505 Dir->setUpperBoundVariable(Exprs.UB);
1506 Dir->setStrideVariable(Exprs.ST);
1507 Dir->setEnsureUpperBound(Exprs.EUB);
1508 Dir->setNextLowerBound(Exprs.NLB);
1509 Dir->setNextUpperBound(Exprs.NUB);
1510 Dir->setNumIterations(Exprs.NumIterations);
1511 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1512 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1513 Dir->setDistInc(Exprs.DistInc);
1514 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1515 Dir->setCounters(Exprs.Counters);
1516 Dir->setPrivateCounters(Exprs.PrivateCounters);
1517 Dir->setInits(Exprs.Inits);
1518 Dir->setUpdates(Exprs.Updates);
1519 Dir->setFinals(Exprs.Finals);
1520 Dir->setDependentCounters(Exprs.DependentCounters);
1521 Dir->setDependentInits(Exprs.DependentInits);
1522 Dir->setFinalsConditions(Exprs.FinalsConditions);
1523 Dir->setPreInits(Exprs.PreInits);
1524 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1525 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1526 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1527 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1528 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1529 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1530 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1531 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1532 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1536 OMPDistributeParallelForSimdDirective *
1537 OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1538 unsigned NumClauses,
1539 unsigned CollapsedNum,
1541 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
1542 alignof(OMPClause *));
1543 void *Mem = C.Allocate(
1544 Size + sizeof(OMPClause *) * NumClauses +
1546 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1548 OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1551 OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1552 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1553 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1554 const HelperExprs &Exprs) {
1556 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
1557 void *Mem = C.Allocate(
1558 Size + sizeof(OMPClause *) * Clauses.size() +
1560 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1561 OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective(
1562 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1563 Dir->setClauses(Clauses);
1564 Dir->setAssociatedStmt(AssociatedStmt);
1565 Dir->setIterationVariable(Exprs.IterationVarRef);
1566 Dir->setLastIteration(Exprs.LastIteration);
1567 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1568 Dir->setPreCond(Exprs.PreCond);
1569 Dir->setCond(Exprs.Cond);
1570 Dir->setInit(Exprs.Init);
1571 Dir->setInc(Exprs.Inc);
1572 Dir->setIsLastIterVariable(Exprs.IL);
1573 Dir->setLowerBoundVariable(Exprs.LB);
1574 Dir->setUpperBoundVariable(Exprs.UB);
1575 Dir->setStrideVariable(Exprs.ST);
1576 Dir->setEnsureUpperBound(Exprs.EUB);
1577 Dir->setNextLowerBound(Exprs.NLB);
1578 Dir->setNextUpperBound(Exprs.NUB);
1579 Dir->setNumIterations(Exprs.NumIterations);
1580 Dir->setCounters(Exprs.Counters);
1581 Dir->setPrivateCounters(Exprs.PrivateCounters);
1582 Dir->setInits(Exprs.Inits);
1583 Dir->setUpdates(Exprs.Updates);
1584 Dir->setFinals(Exprs.Finals);
1585 Dir->setDependentCounters(Exprs.DependentCounters);
1586 Dir->setDependentInits(Exprs.DependentInits);
1587 Dir->setFinalsConditions(Exprs.FinalsConditions);
1588 Dir->setPreInits(Exprs.PreInits);
1592 OMPDistributeSimdDirective *
1593 OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1594 unsigned NumClauses,
1595 unsigned CollapsedNum, EmptyShell) {
1597 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
1598 void *Mem = C.Allocate(
1599 Size + sizeof(OMPClause *) * NumClauses +
1601 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1602 return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses);
1605 OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1606 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1607 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1608 const HelperExprs &Exprs) {
1609 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
1610 alignof(OMPClause *));
1611 void *Mem = C.Allocate(
1612 Size + sizeof(OMPClause *) * Clauses.size() +
1614 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1615 OMPTargetParallelForSimdDirective *Dir =
1616 new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc,
1617 CollapsedNum, Clauses.size());
1618 Dir->setClauses(Clauses);
1619 Dir->setAssociatedStmt(AssociatedStmt);
1620 Dir->setIterationVariable(Exprs.IterationVarRef);
1621 Dir->setLastIteration(Exprs.LastIteration);
1622 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1623 Dir->setPreCond(Exprs.PreCond);
1624 Dir->setCond(Exprs.Cond);
1625 Dir->setInit(Exprs.Init);
1626 Dir->setInc(Exprs.Inc);
1627 Dir->setIsLastIterVariable(Exprs.IL);
1628 Dir->setLowerBoundVariable(Exprs.LB);
1629 Dir->setUpperBoundVariable(Exprs.UB);
1630 Dir->setStrideVariable(Exprs.ST);
1631 Dir->setEnsureUpperBound(Exprs.EUB);
1632 Dir->setNextLowerBound(Exprs.NLB);
1633 Dir->setNextUpperBound(Exprs.NUB);
1634 Dir->setNumIterations(Exprs.NumIterations);
1635 Dir->setCounters(Exprs.Counters);
1636 Dir->setPrivateCounters(Exprs.PrivateCounters);
1637 Dir->setInits(Exprs.Inits);
1638 Dir->setUpdates(Exprs.Updates);
1639 Dir->setFinals(Exprs.Finals);
1640 Dir->setDependentCounters(Exprs.DependentCounters);
1641 Dir->setDependentInits(Exprs.DependentInits);
1642 Dir->setFinalsConditions(Exprs.FinalsConditions);
1643 Dir->setPreInits(Exprs.PreInits);
1647 OMPTargetParallelForSimdDirective *
1648 OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1649 unsigned NumClauses,
1650 unsigned CollapsedNum,
1652 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
1653 alignof(OMPClause *));
1654 void *Mem = C.Allocate(
1655 Size + sizeof(OMPClause *) * NumClauses +
1657 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1658 return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses);
1661 OMPTargetSimdDirective *
1662 OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1663 SourceLocation EndLoc, unsigned CollapsedNum,
1664 ArrayRef<OMPClause *> Clauses,
1665 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
1667 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
1668 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1670 numLoopChildren(CollapsedNum, OMPD_target_simd));
1671 OMPTargetSimdDirective *Dir = new (Mem)
1672 OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1673 Dir->setClauses(Clauses);
1674 Dir->setAssociatedStmt(AssociatedStmt);
1675 Dir->setIterationVariable(Exprs.IterationVarRef);
1676 Dir->setLastIteration(Exprs.LastIteration);
1677 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1678 Dir->setPreCond(Exprs.PreCond);
1679 Dir->setCond(Exprs.Cond);
1680 Dir->setInit(Exprs.Init);
1681 Dir->setInc(Exprs.Inc);
1682 Dir->setCounters(Exprs.Counters);
1683 Dir->setPrivateCounters(Exprs.PrivateCounters);
1684 Dir->setInits(Exprs.Inits);
1685 Dir->setUpdates(Exprs.Updates);
1686 Dir->setFinals(Exprs.Finals);
1687 Dir->setDependentCounters(Exprs.DependentCounters);
1688 Dir->setDependentInits(Exprs.DependentInits);
1689 Dir->setFinalsConditions(Exprs.FinalsConditions);
1690 Dir->setPreInits(Exprs.PreInits);
1694 OMPTargetSimdDirective *
1695 OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1696 unsigned CollapsedNum, EmptyShell) {
1698 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
1699 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1701 numLoopChildren(CollapsedNum, OMPD_target_simd));
1702 return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses);
1705 OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1706 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1707 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1708 const HelperExprs &Exprs) {
1710 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
1711 void *Mem = C.Allocate(
1712 Size + sizeof(OMPClause *) * Clauses.size() +
1713 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1714 OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective(
1715 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1716 Dir->setClauses(Clauses);
1717 Dir->setAssociatedStmt(AssociatedStmt);
1718 Dir->setIterationVariable(Exprs.IterationVarRef);
1719 Dir->setLastIteration(Exprs.LastIteration);
1720 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1721 Dir->setPreCond(Exprs.PreCond);
1722 Dir->setCond(Exprs.Cond);
1723 Dir->setInit(Exprs.Init);
1724 Dir->setInc(Exprs.Inc);
1725 Dir->setIsLastIterVariable(Exprs.IL);
1726 Dir->setLowerBoundVariable(Exprs.LB);
1727 Dir->setUpperBoundVariable(Exprs.UB);
1728 Dir->setStrideVariable(Exprs.ST);
1729 Dir->setEnsureUpperBound(Exprs.EUB);
1730 Dir->setNextLowerBound(Exprs.NLB);
1731 Dir->setNextUpperBound(Exprs.NUB);
1732 Dir->setNumIterations(Exprs.NumIterations);
1733 Dir->setCounters(Exprs.Counters);
1734 Dir->setPrivateCounters(Exprs.PrivateCounters);
1735 Dir->setInits(Exprs.Inits);
1736 Dir->setUpdates(Exprs.Updates);
1737 Dir->setFinals(Exprs.Finals);
1738 Dir->setDependentCounters(Exprs.DependentCounters);
1739 Dir->setDependentInits(Exprs.DependentInits);
1740 Dir->setFinalsConditions(Exprs.FinalsConditions);
1741 Dir->setPreInits(Exprs.PreInits);
1745 OMPTeamsDistributeDirective *
1746 OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1747 unsigned NumClauses,
1748 unsigned CollapsedNum, EmptyShell) {
1750 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
1751 void *Mem = C.Allocate(
1752 Size + sizeof(OMPClause *) * NumClauses +
1753 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1754 return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses);
1757 OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1758 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1759 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1760 const HelperExprs &Exprs) {
1761 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1762 alignof(OMPClause *));
1764 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1766 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1767 OMPTeamsDistributeSimdDirective *Dir =
1768 new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1770 Dir->setClauses(Clauses);
1771 Dir->setAssociatedStmt(AssociatedStmt);
1772 Dir->setIterationVariable(Exprs.IterationVarRef);
1773 Dir->setLastIteration(Exprs.LastIteration);
1774 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1775 Dir->setPreCond(Exprs.PreCond);
1776 Dir->setCond(Exprs.Cond);
1777 Dir->setInit(Exprs.Init);
1778 Dir->setInc(Exprs.Inc);
1779 Dir->setIsLastIterVariable(Exprs.IL);
1780 Dir->setLowerBoundVariable(Exprs.LB);
1781 Dir->setUpperBoundVariable(Exprs.UB);
1782 Dir->setStrideVariable(Exprs.ST);
1783 Dir->setEnsureUpperBound(Exprs.EUB);
1784 Dir->setNextLowerBound(Exprs.NLB);
1785 Dir->setNextUpperBound(Exprs.NUB);
1786 Dir->setNumIterations(Exprs.NumIterations);
1787 Dir->setCounters(Exprs.Counters);
1788 Dir->setPrivateCounters(Exprs.PrivateCounters);
1789 Dir->setInits(Exprs.Inits);
1790 Dir->setUpdates(Exprs.Updates);
1791 Dir->setFinals(Exprs.Finals);
1792 Dir->setDependentCounters(Exprs.DependentCounters);
1793 Dir->setDependentInits(Exprs.DependentInits);
1794 Dir->setFinalsConditions(Exprs.FinalsConditions);
1795 Dir->setPreInits(Exprs.PreInits);
1799 OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1800 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1802 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1803 alignof(OMPClause *));
1805 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1807 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1808 return new (Mem) OMPTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1811 OMPTeamsDistributeParallelForSimdDirective *
1812 OMPTeamsDistributeParallelForSimdDirective::Create(
1813 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1814 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1815 const HelperExprs &Exprs) {
1816 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1817 alignof(OMPClause *));
1819 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1821 numLoopChildren(CollapsedNum,
1822 OMPD_teams_distribute_parallel_for_simd));
1823 OMPTeamsDistributeParallelForSimdDirective *Dir = new (Mem)
1824 OMPTeamsDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1826 Dir->setClauses(Clauses);
1827 Dir->setAssociatedStmt(AssociatedStmt);
1828 Dir->setIterationVariable(Exprs.IterationVarRef);
1829 Dir->setLastIteration(Exprs.LastIteration);
1830 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1831 Dir->setPreCond(Exprs.PreCond);
1832 Dir->setCond(Exprs.Cond);
1833 Dir->setInit(Exprs.Init);
1834 Dir->setInc(Exprs.Inc);
1835 Dir->setIsLastIterVariable(Exprs.IL);
1836 Dir->setLowerBoundVariable(Exprs.LB);
1837 Dir->setUpperBoundVariable(Exprs.UB);
1838 Dir->setStrideVariable(Exprs.ST);
1839 Dir->setEnsureUpperBound(Exprs.EUB);
1840 Dir->setNextLowerBound(Exprs.NLB);
1841 Dir->setNextUpperBound(Exprs.NUB);
1842 Dir->setNumIterations(Exprs.NumIterations);
1843 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1844 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1845 Dir->setDistInc(Exprs.DistInc);
1846 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1847 Dir->setCounters(Exprs.Counters);
1848 Dir->setPrivateCounters(Exprs.PrivateCounters);
1849 Dir->setInits(Exprs.Inits);
1850 Dir->setUpdates(Exprs.Updates);
1851 Dir->setFinals(Exprs.Finals);
1852 Dir->setDependentCounters(Exprs.DependentCounters);
1853 Dir->setDependentInits(Exprs.DependentInits);
1854 Dir->setFinalsConditions(Exprs.FinalsConditions);
1855 Dir->setPreInits(Exprs.PreInits);
1856 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1857 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1858 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1859 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1860 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1861 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1862 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1863 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1864 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1868 OMPTeamsDistributeParallelForSimdDirective *
1869 OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1870 unsigned NumClauses,
1871 unsigned CollapsedNum,
1873 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1874 alignof(OMPClause *));
1876 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1878 numLoopChildren(CollapsedNum,
1879 OMPD_teams_distribute_parallel_for_simd));
1881 OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1884 OMPTeamsDistributeParallelForDirective *
1885 OMPTeamsDistributeParallelForDirective::Create(
1886 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1887 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1888 const HelperExprs &Exprs, bool HasCancel) {
1889 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1890 alignof(OMPClause *));
1891 void *Mem = C.Allocate(
1892 Size + sizeof(OMPClause *) * Clauses.size() +
1894 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1895 OMPTeamsDistributeParallelForDirective *Dir = new (Mem)
1896 OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum,
1898 Dir->setClauses(Clauses);
1899 Dir->setAssociatedStmt(AssociatedStmt);
1900 Dir->setIterationVariable(Exprs.IterationVarRef);
1901 Dir->setLastIteration(Exprs.LastIteration);
1902 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1903 Dir->setPreCond(Exprs.PreCond);
1904 Dir->setCond(Exprs.Cond);
1905 Dir->setInit(Exprs.Init);
1906 Dir->setInc(Exprs.Inc);
1907 Dir->setIsLastIterVariable(Exprs.IL);
1908 Dir->setLowerBoundVariable(Exprs.LB);
1909 Dir->setUpperBoundVariable(Exprs.UB);
1910 Dir->setStrideVariable(Exprs.ST);
1911 Dir->setEnsureUpperBound(Exprs.EUB);
1912 Dir->setNextLowerBound(Exprs.NLB);
1913 Dir->setNextUpperBound(Exprs.NUB);
1914 Dir->setNumIterations(Exprs.NumIterations);
1915 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1916 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1917 Dir->setDistInc(Exprs.DistInc);
1918 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1919 Dir->setCounters(Exprs.Counters);
1920 Dir->setPrivateCounters(Exprs.PrivateCounters);
1921 Dir->setInits(Exprs.Inits);
1922 Dir->setUpdates(Exprs.Updates);
1923 Dir->setFinals(Exprs.Finals);
1924 Dir->setDependentCounters(Exprs.DependentCounters);
1925 Dir->setDependentInits(Exprs.DependentInits);
1926 Dir->setFinalsConditions(Exprs.FinalsConditions);
1927 Dir->setPreInits(Exprs.PreInits);
1928 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1929 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1930 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1931 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1932 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1933 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1934 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1935 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1936 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1937 Dir->HasCancel = HasCancel;
1941 OMPTeamsDistributeParallelForDirective *
1942 OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1943 unsigned NumClauses,
1944 unsigned CollapsedNum,
1946 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1947 alignof(OMPClause *));
1948 void *Mem = C.Allocate(
1949 Size + sizeof(OMPClause *) * NumClauses +
1951 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1953 OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1956 OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1957 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1958 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1960 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1962 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
1963 OMPTargetTeamsDirective *Dir =
1964 new (Mem) OMPTargetTeamsDirective(StartLoc, EndLoc, Clauses.size());
1965 Dir->setClauses(Clauses);
1966 Dir->setAssociatedStmt(AssociatedStmt);
1970 OMPTargetTeamsDirective *
1971 OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1974 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1976 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1977 return new (Mem) OMPTargetTeamsDirective(NumClauses);
1980 OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
1981 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1982 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1983 const HelperExprs &Exprs) {
1984 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1985 alignof(OMPClause *));
1986 void *Mem = C.Allocate(
1987 Size + sizeof(OMPClause *) * Clauses.size() +
1989 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1990 OMPTargetTeamsDistributeDirective *Dir =
1991 new (Mem) OMPTargetTeamsDistributeDirective(StartLoc, EndLoc, CollapsedNum,
1993 Dir->setClauses(Clauses);
1994 Dir->setAssociatedStmt(AssociatedStmt);
1995 Dir->setIterationVariable(Exprs.IterationVarRef);
1996 Dir->setLastIteration(Exprs.LastIteration);
1997 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1998 Dir->setPreCond(Exprs.PreCond);
1999 Dir->setCond(Exprs.Cond);
2000 Dir->setInit(Exprs.Init);
2001 Dir->setInc(Exprs.Inc);
2002 Dir->setIsLastIterVariable(Exprs.IL);
2003 Dir->setLowerBoundVariable(Exprs.LB);
2004 Dir->setUpperBoundVariable(Exprs.UB);
2005 Dir->setStrideVariable(Exprs.ST);
2006 Dir->setEnsureUpperBound(Exprs.EUB);
2007 Dir->setNextLowerBound(Exprs.NLB);
2008 Dir->setNextUpperBound(Exprs.NUB);
2009 Dir->setNumIterations(Exprs.NumIterations);
2010 Dir->setCounters(Exprs.Counters);
2011 Dir->setPrivateCounters(Exprs.PrivateCounters);
2012 Dir->setInits(Exprs.Inits);
2013 Dir->setUpdates(Exprs.Updates);
2014 Dir->setFinals(Exprs.Finals);
2015 Dir->setDependentCounters(Exprs.DependentCounters);
2016 Dir->setDependentInits(Exprs.DependentInits);
2017 Dir->setFinalsConditions(Exprs.FinalsConditions);
2018 Dir->setPreInits(Exprs.PreInits);
2022 OMPTargetTeamsDistributeDirective *
2023 OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
2024 unsigned NumClauses,
2025 unsigned CollapsedNum,
2027 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
2028 alignof(OMPClause *));
2029 void *Mem = C.Allocate(
2030 Size + sizeof(OMPClause *) * NumClauses +
2032 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
2033 return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses);
2036 OMPTargetTeamsDistributeParallelForDirective *
2037 OMPTargetTeamsDistributeParallelForDirective::Create(
2038 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2039 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2040 const HelperExprs &Exprs, bool HasCancel) {
2042 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
2043 alignof(OMPClause *));
2044 void *Mem = C.Allocate(
2045 Size + sizeof(OMPClause *) * Clauses.size() +
2047 numLoopChildren(CollapsedNum,
2048 OMPD_target_teams_distribute_parallel_for));
2049 OMPTargetTeamsDistributeParallelForDirective *Dir =
2050 new (Mem) OMPTargetTeamsDistributeParallelForDirective(
2051 StartLoc, EndLoc, CollapsedNum, Clauses.size());
2052 Dir->setClauses(Clauses);
2053 Dir->setAssociatedStmt(AssociatedStmt);
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->setPrevLowerBoundVariable(Exprs.PrevLB);
2070 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2071 Dir->setDistInc(Exprs.DistInc);
2072 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2073 Dir->setCounters(Exprs.Counters);
2074 Dir->setPrivateCounters(Exprs.PrivateCounters);
2075 Dir->setInits(Exprs.Inits);
2076 Dir->setUpdates(Exprs.Updates);
2077 Dir->setFinals(Exprs.Finals);
2078 Dir->setDependentCounters(Exprs.DependentCounters);
2079 Dir->setDependentInits(Exprs.DependentInits);
2080 Dir->setFinalsConditions(Exprs.FinalsConditions);
2081 Dir->setPreInits(Exprs.PreInits);
2082 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2083 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2084 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2085 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2086 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2087 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2088 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2089 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2090 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2091 Dir->HasCancel = HasCancel;
2095 OMPTargetTeamsDistributeParallelForDirective *
2096 OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
2097 unsigned NumClauses,
2098 unsigned CollapsedNum,
2101 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
2102 alignof(OMPClause *));
2103 void *Mem = C.Allocate(
2104 Size + sizeof(OMPClause *) * NumClauses +
2106 numLoopChildren(CollapsedNum,
2107 OMPD_target_teams_distribute_parallel_for));
2109 OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
2112 OMPTargetTeamsDistributeParallelForSimdDirective *
2113 OMPTargetTeamsDistributeParallelForSimdDirective::Create(
2114 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2115 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2116 const HelperExprs &Exprs) {
2118 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
2119 alignof(OMPClause *));
2120 void *Mem = C.Allocate(
2121 Size + sizeof(OMPClause *) * Clauses.size() +
2123 numLoopChildren(CollapsedNum,
2124 OMPD_target_teams_distribute_parallel_for_simd));
2125 OMPTargetTeamsDistributeParallelForSimdDirective *Dir =
2126 new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
2127 StartLoc, EndLoc, CollapsedNum, Clauses.size());
2128 Dir->setClauses(Clauses);
2129 Dir->setAssociatedStmt(AssociatedStmt);
2130 Dir->setIterationVariable(Exprs.IterationVarRef);
2131 Dir->setLastIteration(Exprs.LastIteration);
2132 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2133 Dir->setPreCond(Exprs.PreCond);
2134 Dir->setCond(Exprs.Cond);
2135 Dir->setInit(Exprs.Init);
2136 Dir->setInc(Exprs.Inc);
2137 Dir->setIsLastIterVariable(Exprs.IL);
2138 Dir->setLowerBoundVariable(Exprs.LB);
2139 Dir->setUpperBoundVariable(Exprs.UB);
2140 Dir->setStrideVariable(Exprs.ST);
2141 Dir->setEnsureUpperBound(Exprs.EUB);
2142 Dir->setNextLowerBound(Exprs.NLB);
2143 Dir->setNextUpperBound(Exprs.NUB);
2144 Dir->setNumIterations(Exprs.NumIterations);
2145 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2146 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2147 Dir->setDistInc(Exprs.DistInc);
2148 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2149 Dir->setCounters(Exprs.Counters);
2150 Dir->setPrivateCounters(Exprs.PrivateCounters);
2151 Dir->setInits(Exprs.Inits);
2152 Dir->setUpdates(Exprs.Updates);
2153 Dir->setFinals(Exprs.Finals);
2154 Dir->setDependentCounters(Exprs.DependentCounters);
2155 Dir->setDependentInits(Exprs.DependentInits);
2156 Dir->setFinalsConditions(Exprs.FinalsConditions);
2157 Dir->setPreInits(Exprs.PreInits);
2158 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2159 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2160 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2161 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2162 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2163 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2164 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2165 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2166 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2170 OMPTargetTeamsDistributeParallelForSimdDirective *
2171 OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
2172 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
2175 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
2176 alignof(OMPClause *));
2177 void *Mem = C.Allocate(
2178 Size + sizeof(OMPClause *) * NumClauses +
2180 numLoopChildren(CollapsedNum,
2181 OMPD_target_teams_distribute_parallel_for_simd));
2182 return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
2183 CollapsedNum, NumClauses);
2186 OMPTargetTeamsDistributeSimdDirective *
2187 OMPTargetTeamsDistributeSimdDirective::Create(
2188 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2189 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2190 const HelperExprs &Exprs) {
2191 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
2192 alignof(OMPClause *));
2193 void *Mem = C.Allocate(
2194 Size + sizeof(OMPClause *) * Clauses.size() +
2196 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
2197 OMPTargetTeamsDistributeSimdDirective *Dir = new (Mem)
2198 OMPTargetTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
2200 Dir->setClauses(Clauses);
2201 Dir->setAssociatedStmt(AssociatedStmt);
2202 Dir->setIterationVariable(Exprs.IterationVarRef);
2203 Dir->setLastIteration(Exprs.LastIteration);
2204 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2205 Dir->setPreCond(Exprs.PreCond);
2206 Dir->setCond(Exprs.Cond);
2207 Dir->setInit(Exprs.Init);
2208 Dir->setInc(Exprs.Inc);
2209 Dir->setIsLastIterVariable(Exprs.IL);
2210 Dir->setLowerBoundVariable(Exprs.LB);
2211 Dir->setUpperBoundVariable(Exprs.UB);
2212 Dir->setStrideVariable(Exprs.ST);
2213 Dir->setEnsureUpperBound(Exprs.EUB);
2214 Dir->setNextLowerBound(Exprs.NLB);
2215 Dir->setNextUpperBound(Exprs.NUB);
2216 Dir->setNumIterations(Exprs.NumIterations);
2217 Dir->setCounters(Exprs.Counters);
2218 Dir->setPrivateCounters(Exprs.PrivateCounters);
2219 Dir->setInits(Exprs.Inits);
2220 Dir->setUpdates(Exprs.Updates);
2221 Dir->setFinals(Exprs.Finals);
2222 Dir->setDependentCounters(Exprs.DependentCounters);
2223 Dir->setDependentInits(Exprs.DependentInits);
2224 Dir->setFinalsConditions(Exprs.FinalsConditions);
2225 Dir->setPreInits(Exprs.PreInits);
2229 OMPTargetTeamsDistributeSimdDirective *
2230 OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
2231 unsigned NumClauses,
2232 unsigned CollapsedNum,
2234 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
2235 alignof(OMPClause *));
2236 void *Mem = C.Allocate(
2237 Size + sizeof(OMPClause *) * NumClauses +
2239 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
2241 OMPTargetTeamsDistributeSimdDirective(CollapsedNum, NumClauses);