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