blob: 5b61e05aae87ef2721bdb8750e0c009270807929 [file] [log] [blame]
James Y Knightb8bfd962015-10-02 13:41:04 +00001//===--- StmtOpenMP.cpp - Classes for OpenMP directives -------------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
James Y Knightb8bfd962015-10-02 13:41:04 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the subclesses of Stmt class declared in StmtOpenMP.h
10//
11//===----------------------------------------------------------------------===//
12
13#include "clang/AST/StmtOpenMP.h"
14
15#include "clang/AST/ASTContext.h"
16
17using namespace clang;
18
19void OMPExecutableDirective::setClauses(ArrayRef<OMPClause *> Clauses) {
20 assert(Clauses.size() == getNumClauses() &&
21 "Number of clauses is not the same as the preallocated buffer");
22 std::copy(Clauses.begin(), Clauses.end(), getClauses().begin());
23}
24
Roman Lebedevb5700602019-03-20 16:32:36 +000025bool OMPExecutableDirective::isStandaloneDirective() const {
26 // Special case: 'omp target enter data', 'omp target exit data',
27 // 'omp target update' are stand-alone directives, but for implementation
28 // reasons they have empty synthetic structured block, to simplify codegen.
29 if (isa<OMPTargetEnterDataDirective>(this) ||
30 isa<OMPTargetExitDataDirective>(this) ||
31 isa<OMPTargetUpdateDirective>(this))
32 return true;
33 return !hasAssociatedStmt() || !getAssociatedStmt();
34}
35
36const Stmt *OMPExecutableDirective::getStructuredBlock() const {
37 assert(!isStandaloneDirective() &&
38 "Standalone Executable Directives don't have Structured Blocks.");
39 if (auto *LD = dyn_cast<OMPLoopDirective>(this))
40 return LD->getBody();
41 return getInnermostCapturedStmt()->getCapturedStmt();
42}
43
Alexey Bataev8bbf2e32019-11-04 09:59:11 -050044Stmt *OMPLoopDirective::tryToFindNextInnerLoop(Stmt *CurStmt,
45 bool TryImperfectlyNestedLoops) {
46 Stmt *OrigStmt = CurStmt;
47 CurStmt = CurStmt->IgnoreContainers();
48 // Additional work for imperfectly nested loops, introduced in OpenMP 5.0.
49 if (TryImperfectlyNestedLoops) {
50 if (auto *CS = dyn_cast<CompoundStmt>(CurStmt)) {
51 CurStmt = nullptr;
52 SmallVector<CompoundStmt *, 4> Statements(1, CS);
53 SmallVector<CompoundStmt *, 4> NextStatements;
54 while (!Statements.empty()) {
55 CS = Statements.pop_back_val();
56 if (!CS)
57 continue;
58 for (Stmt *S : CS->body()) {
59 if (!S)
60 continue;
61 if (isa<ForStmt>(S) || isa<CXXForRangeStmt>(S)) {
62 // Only single loop construct is allowed.
63 if (CurStmt) {
64 CurStmt = OrigStmt;
65 break;
66 }
67 CurStmt = S;
68 continue;
69 }
70 S = S->IgnoreContainers();
71 if (auto *InnerCS = dyn_cast_or_null<CompoundStmt>(S))
72 NextStatements.push_back(InnerCS);
73 }
74 if (Statements.empty()) {
75 // Found single inner loop or multiple loops - exit.
76 if (CurStmt)
77 break;
78 Statements.swap(NextStatements);
79 }
80 }
81 if (!CurStmt)
82 CurStmt = OrigStmt;
83 }
84 }
85 return CurStmt;
86}
87
88Stmt *OMPLoopDirective::getBody() {
89 // This relies on the loop form is already checked by Sema.
90 Stmt *Body =
91 getInnermostCapturedStmt()->getCapturedStmt()->IgnoreContainers();
92 if (auto *For = dyn_cast<ForStmt>(Body)) {
93 Body = For->getBody();
94 } else {
95 assert(isa<CXXForRangeStmt>(Body) &&
96 "Expected canonical for loop or range-based for loop.");
97 Body = cast<CXXForRangeStmt>(Body)->getBody();
98 }
99 for (unsigned Cnt = 1; Cnt < CollapsedNum; ++Cnt) {
100 Body = tryToFindNextInnerLoop(Body, /*TryImperfectlyNestedLoops=*/true);
101 if (auto *For = dyn_cast<ForStmt>(Body)) {
102 Body = For->getBody();
103 } else {
104 assert(isa<CXXForRangeStmt>(Body) &&
105 "Expected canonical for loop or range-based for loop.");
106 Body = cast<CXXForRangeStmt>(Body)->getBody();
107 }
108 }
109 return Body;
110}
111
James Y Knightb8bfd962015-10-02 13:41:04 +0000112void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
113 assert(A.size() == getCollapsedNumber() &&
114 "Number of loop counters is not the same as the collapsed number");
115 std::copy(A.begin(), A.end(), getCounters().begin());
116}
117
118void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
119 assert(A.size() == getCollapsedNumber() && "Number of loop private counters "
120 "is not the same as the collapsed "
121 "number");
122 std::copy(A.begin(), A.end(), getPrivateCounters().begin());
123}
124
125void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
126 assert(A.size() == getCollapsedNumber() &&
127 "Number of counter inits is not the same as the collapsed number");
128 std::copy(A.begin(), A.end(), getInits().begin());
129}
130
131void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
132 assert(A.size() == getCollapsedNumber() &&
133 "Number of counter updates is not the same as the collapsed number");
134 std::copy(A.begin(), A.end(), getUpdates().begin());
135}
136
137void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
138 assert(A.size() == getCollapsedNumber() &&
139 "Number of counter finals is not the same as the collapsed number");
140 std::copy(A.begin(), A.end(), getFinals().begin());
141}
142
Alexey Bataevf8be4762019-08-14 19:30:06 +0000143void OMPLoopDirective::setDependentCounters(ArrayRef<Expr *> A) {
144 assert(
145 A.size() == getCollapsedNumber() &&
146 "Number of dependent counters is not the same as the collapsed number");
147 llvm::copy(A, getDependentCounters().begin());
148}
149
150void OMPLoopDirective::setDependentInits(ArrayRef<Expr *> A) {
151 assert(A.size() == getCollapsedNumber() &&
152 "Number of dependent inits is not the same as the collapsed number");
153 llvm::copy(A, getDependentInits().begin());
154}
155
156void OMPLoopDirective::setFinalsConditions(ArrayRef<Expr *> A) {
157 assert(A.size() == getCollapsedNumber() &&
158 "Number of finals conditions is not the same as the collapsed number");
159 llvm::copy(A, getFinalsConditions().begin());
160}
161
James Y Knightb8bfd962015-10-02 13:41:04 +0000162OMPParallelDirective *OMPParallelDirective::Create(
163 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
164 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000165 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000166 llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000167 void *Mem =
168 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
169 OMPParallelDirective *Dir =
170 new (Mem) OMPParallelDirective(StartLoc, EndLoc, Clauses.size());
171 Dir->setClauses(Clauses);
172 Dir->setAssociatedStmt(AssociatedStmt);
173 Dir->setHasCancel(HasCancel);
174 return Dir;
175}
176
177OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
178 unsigned NumClauses,
179 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000180 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000181 llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000182 void *Mem =
183 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
184 return new (Mem) OMPParallelDirective(NumClauses);
185}
186
187OMPSimdDirective *
188OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
189 SourceLocation EndLoc, unsigned CollapsedNum,
190 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
191 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000192 unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000193 void *Mem =
194 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
195 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
196 OMPSimdDirective *Dir = new (Mem)
197 OMPSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
198 Dir->setClauses(Clauses);
199 Dir->setAssociatedStmt(AssociatedStmt);
200 Dir->setIterationVariable(Exprs.IterationVarRef);
201 Dir->setLastIteration(Exprs.LastIteration);
202 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
203 Dir->setPreCond(Exprs.PreCond);
204 Dir->setCond(Exprs.Cond);
205 Dir->setInit(Exprs.Init);
206 Dir->setInc(Exprs.Inc);
207 Dir->setCounters(Exprs.Counters);
208 Dir->setPrivateCounters(Exprs.PrivateCounters);
209 Dir->setInits(Exprs.Inits);
210 Dir->setUpdates(Exprs.Updates);
211 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +0000212 Dir->setDependentCounters(Exprs.DependentCounters);
213 Dir->setDependentInits(Exprs.DependentInits);
214 Dir->setFinalsConditions(Exprs.FinalsConditions);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000215 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000216 return Dir;
217}
218
219OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C,
220 unsigned NumClauses,
221 unsigned CollapsedNum,
222 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000223 unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000224 void *Mem =
225 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
226 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
227 return new (Mem) OMPSimdDirective(CollapsedNum, NumClauses);
228}
229
230OMPForDirective *
231OMPForDirective::Create(const ASTContext &C, SourceLocation StartLoc,
232 SourceLocation EndLoc, unsigned CollapsedNum,
233 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
234 const HelperExprs &Exprs, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000235 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000236 void *Mem =
237 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
238 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
239 OMPForDirective *Dir =
240 new (Mem) OMPForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
241 Dir->setClauses(Clauses);
242 Dir->setAssociatedStmt(AssociatedStmt);
243 Dir->setIterationVariable(Exprs.IterationVarRef);
244 Dir->setLastIteration(Exprs.LastIteration);
245 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
246 Dir->setPreCond(Exprs.PreCond);
247 Dir->setCond(Exprs.Cond);
248 Dir->setInit(Exprs.Init);
249 Dir->setInc(Exprs.Inc);
250 Dir->setIsLastIterVariable(Exprs.IL);
251 Dir->setLowerBoundVariable(Exprs.LB);
252 Dir->setUpperBoundVariable(Exprs.UB);
253 Dir->setStrideVariable(Exprs.ST);
254 Dir->setEnsureUpperBound(Exprs.EUB);
255 Dir->setNextLowerBound(Exprs.NLB);
256 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000257 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000258 Dir->setCounters(Exprs.Counters);
259 Dir->setPrivateCounters(Exprs.PrivateCounters);
260 Dir->setInits(Exprs.Inits);
261 Dir->setUpdates(Exprs.Updates);
262 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +0000263 Dir->setDependentCounters(Exprs.DependentCounters);
264 Dir->setDependentInits(Exprs.DependentInits);
265 Dir->setFinalsConditions(Exprs.FinalsConditions);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000266 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000267 Dir->setHasCancel(HasCancel);
268 return Dir;
269}
270
271OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
272 unsigned NumClauses,
273 unsigned CollapsedNum,
274 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000275 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000276 void *Mem =
277 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
278 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
279 return new (Mem) OMPForDirective(CollapsedNum, NumClauses);
280}
281
282OMPForSimdDirective *
283OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
284 SourceLocation EndLoc, unsigned CollapsedNum,
285 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
286 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000287 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000288 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000289 void *Mem =
290 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
291 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
292 OMPForSimdDirective *Dir = new (Mem)
293 OMPForSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
294 Dir->setClauses(Clauses);
295 Dir->setAssociatedStmt(AssociatedStmt);
296 Dir->setIterationVariable(Exprs.IterationVarRef);
297 Dir->setLastIteration(Exprs.LastIteration);
298 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
299 Dir->setPreCond(Exprs.PreCond);
300 Dir->setCond(Exprs.Cond);
301 Dir->setInit(Exprs.Init);
302 Dir->setInc(Exprs.Inc);
303 Dir->setIsLastIterVariable(Exprs.IL);
304 Dir->setLowerBoundVariable(Exprs.LB);
305 Dir->setUpperBoundVariable(Exprs.UB);
306 Dir->setStrideVariable(Exprs.ST);
307 Dir->setEnsureUpperBound(Exprs.EUB);
308 Dir->setNextLowerBound(Exprs.NLB);
309 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000310 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000311 Dir->setCounters(Exprs.Counters);
312 Dir->setPrivateCounters(Exprs.PrivateCounters);
313 Dir->setInits(Exprs.Inits);
314 Dir->setUpdates(Exprs.Updates);
315 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +0000316 Dir->setDependentCounters(Exprs.DependentCounters);
317 Dir->setDependentInits(Exprs.DependentInits);
318 Dir->setFinalsConditions(Exprs.FinalsConditions);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000319 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000320 return Dir;
321}
322
323OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
324 unsigned NumClauses,
325 unsigned CollapsedNum,
326 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000327 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000328 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000329 void *Mem =
330 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
331 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
332 return new (Mem) OMPForSimdDirective(CollapsedNum, NumClauses);
333}
334
335OMPSectionsDirective *OMPSectionsDirective::Create(
336 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
337 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000338 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000339 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000340 void *Mem =
341 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
342 OMPSectionsDirective *Dir =
343 new (Mem) OMPSectionsDirective(StartLoc, EndLoc, Clauses.size());
344 Dir->setClauses(Clauses);
345 Dir->setAssociatedStmt(AssociatedStmt);
346 Dir->setHasCancel(HasCancel);
347 return Dir;
348}
349
350OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
351 unsigned NumClauses,
352 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000353 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000354 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000355 void *Mem =
356 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
357 return new (Mem) OMPSectionsDirective(NumClauses);
358}
359
360OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
361 SourceLocation StartLoc,
362 SourceLocation EndLoc,
363 Stmt *AssociatedStmt,
364 bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000365 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000366 void *Mem = C.Allocate(Size + sizeof(Stmt *));
367 OMPSectionDirective *Dir = new (Mem) OMPSectionDirective(StartLoc, EndLoc);
368 Dir->setAssociatedStmt(AssociatedStmt);
369 Dir->setHasCancel(HasCancel);
370 return Dir;
371}
372
373OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
374 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000375 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000376 void *Mem = C.Allocate(Size + sizeof(Stmt *));
377 return new (Mem) OMPSectionDirective();
378}
379
380OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
381 SourceLocation StartLoc,
382 SourceLocation EndLoc,
383 ArrayRef<OMPClause *> Clauses,
384 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000385 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000386 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000387 void *Mem =
388 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
389 OMPSingleDirective *Dir =
390 new (Mem) OMPSingleDirective(StartLoc, EndLoc, Clauses.size());
391 Dir->setClauses(Clauses);
392 Dir->setAssociatedStmt(AssociatedStmt);
393 return Dir;
394}
395
396OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
397 unsigned NumClauses,
398 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000399 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000400 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000401 void *Mem =
402 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
403 return new (Mem) OMPSingleDirective(NumClauses);
404}
405
406OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
407 SourceLocation StartLoc,
408 SourceLocation EndLoc,
409 Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000410 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000411 void *Mem = C.Allocate(Size + sizeof(Stmt *));
412 OMPMasterDirective *Dir = new (Mem) OMPMasterDirective(StartLoc, EndLoc);
413 Dir->setAssociatedStmt(AssociatedStmt);
414 return Dir;
415}
416
417OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
418 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000419 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000420 void *Mem = C.Allocate(Size + sizeof(Stmt *));
421 return new (Mem) OMPMasterDirective();
422}
423
424OMPCriticalDirective *OMPCriticalDirective::Create(
425 const ASTContext &C, const DeclarationNameInfo &Name,
Alexey Bataev28c75412015-12-15 08:19:24 +0000426 SourceLocation StartLoc, SourceLocation EndLoc,
427 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000428 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000429 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000430 void *Mem =
431 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000432 OMPCriticalDirective *Dir =
Alexey Bataev28c75412015-12-15 08:19:24 +0000433 new (Mem) OMPCriticalDirective(Name, StartLoc, EndLoc, Clauses.size());
434 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000435 Dir->setAssociatedStmt(AssociatedStmt);
436 return Dir;
437}
438
439OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev28c75412015-12-15 08:19:24 +0000440 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000441 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000442 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000443 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000444 void *Mem =
445 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
446 return new (Mem) OMPCriticalDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000447}
448
449OMPParallelForDirective *OMPParallelForDirective::Create(
450 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
451 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
452 const HelperExprs &Exprs, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000453 unsigned Size =
454 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000455 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
456 sizeof(Stmt *) *
457 numLoopChildren(CollapsedNum, OMPD_parallel_for));
458 OMPParallelForDirective *Dir = new (Mem)
459 OMPParallelForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
460 Dir->setClauses(Clauses);
461 Dir->setAssociatedStmt(AssociatedStmt);
462 Dir->setIterationVariable(Exprs.IterationVarRef);
463 Dir->setLastIteration(Exprs.LastIteration);
464 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
465 Dir->setPreCond(Exprs.PreCond);
466 Dir->setCond(Exprs.Cond);
467 Dir->setInit(Exprs.Init);
468 Dir->setInc(Exprs.Inc);
469 Dir->setIsLastIterVariable(Exprs.IL);
470 Dir->setLowerBoundVariable(Exprs.LB);
471 Dir->setUpperBoundVariable(Exprs.UB);
472 Dir->setStrideVariable(Exprs.ST);
473 Dir->setEnsureUpperBound(Exprs.EUB);
474 Dir->setNextLowerBound(Exprs.NLB);
475 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000476 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000477 Dir->setCounters(Exprs.Counters);
478 Dir->setPrivateCounters(Exprs.PrivateCounters);
479 Dir->setInits(Exprs.Inits);
480 Dir->setUpdates(Exprs.Updates);
481 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +0000482 Dir->setDependentCounters(Exprs.DependentCounters);
483 Dir->setDependentInits(Exprs.DependentInits);
484 Dir->setFinalsConditions(Exprs.FinalsConditions);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000485 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000486 Dir->setHasCancel(HasCancel);
487 return Dir;
488}
489
490OMPParallelForDirective *
491OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
492 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000493 unsigned Size =
494 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000495 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
496 sizeof(Stmt *) *
497 numLoopChildren(CollapsedNum, OMPD_parallel_for));
498 return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses);
499}
500
501OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
502 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
503 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
504 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000505 unsigned Size =
506 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000507 void *Mem = C.Allocate(
508 Size + sizeof(OMPClause *) * Clauses.size() +
509 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
510 OMPParallelForSimdDirective *Dir = new (Mem) OMPParallelForSimdDirective(
511 StartLoc, EndLoc, CollapsedNum, Clauses.size());
512 Dir->setClauses(Clauses);
513 Dir->setAssociatedStmt(AssociatedStmt);
514 Dir->setIterationVariable(Exprs.IterationVarRef);
515 Dir->setLastIteration(Exprs.LastIteration);
516 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
517 Dir->setPreCond(Exprs.PreCond);
518 Dir->setCond(Exprs.Cond);
519 Dir->setInit(Exprs.Init);
520 Dir->setInc(Exprs.Inc);
521 Dir->setIsLastIterVariable(Exprs.IL);
522 Dir->setLowerBoundVariable(Exprs.LB);
523 Dir->setUpperBoundVariable(Exprs.UB);
524 Dir->setStrideVariable(Exprs.ST);
525 Dir->setEnsureUpperBound(Exprs.EUB);
526 Dir->setNextLowerBound(Exprs.NLB);
527 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000528 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000529 Dir->setCounters(Exprs.Counters);
530 Dir->setPrivateCounters(Exprs.PrivateCounters);
531 Dir->setInits(Exprs.Inits);
532 Dir->setUpdates(Exprs.Updates);
533 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +0000534 Dir->setDependentCounters(Exprs.DependentCounters);
535 Dir->setDependentInits(Exprs.DependentInits);
536 Dir->setFinalsConditions(Exprs.FinalsConditions);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000537 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000538 return Dir;
539}
540
541OMPParallelForSimdDirective *
542OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
543 unsigned NumClauses,
544 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000545 unsigned Size =
546 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000547 void *Mem = C.Allocate(
548 Size + sizeof(OMPClause *) * NumClauses +
549 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
550 return new (Mem) OMPParallelForSimdDirective(CollapsedNum, NumClauses);
551}
552
cchen47d60942019-12-05 13:43:48 -0500553OMPParallelMasterDirective *OMPParallelMasterDirective::Create(
554 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
555 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
556 unsigned Size =
557 llvm::alignTo(sizeof(OMPParallelMasterDirective), alignof(OMPClause *));
558 void *Mem =
559 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
560 auto *Dir =
561 new (Mem) OMPParallelMasterDirective(StartLoc, EndLoc, Clauses.size());
562 Dir->setClauses(Clauses);
563 Dir->setAssociatedStmt(AssociatedStmt);
564 return Dir;
565}
566
567OMPParallelMasterDirective *OMPParallelMasterDirective::CreateEmpty(const ASTContext &C,
568 unsigned NumClauses,
569 EmptyShell) {
570 unsigned Size =
571 llvm::alignTo(sizeof(OMPParallelMasterDirective), alignof(OMPClause *));
572 void *Mem =
573 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
574 return new (Mem) OMPParallelMasterDirective(NumClauses);
575}
576
James Y Knightb8bfd962015-10-02 13:41:04 +0000577OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
578 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
579 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000580 unsigned Size =
581 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000582 void *Mem =
583 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
584 OMPParallelSectionsDirective *Dir =
585 new (Mem) OMPParallelSectionsDirective(StartLoc, EndLoc, Clauses.size());
586 Dir->setClauses(Clauses);
587 Dir->setAssociatedStmt(AssociatedStmt);
588 Dir->setHasCancel(HasCancel);
589 return Dir;
590}
591
592OMPParallelSectionsDirective *
593OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
594 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000595 unsigned Size =
596 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000597 void *Mem =
598 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
599 return new (Mem) OMPParallelSectionsDirective(NumClauses);
600}
601
602OMPTaskDirective *
603OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
604 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
605 Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000606 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000607 void *Mem =
608 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
609 OMPTaskDirective *Dir =
610 new (Mem) OMPTaskDirective(StartLoc, EndLoc, Clauses.size());
611 Dir->setClauses(Clauses);
612 Dir->setAssociatedStmt(AssociatedStmt);
613 Dir->setHasCancel(HasCancel);
614 return Dir;
615}
616
617OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
618 unsigned NumClauses,
619 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000620 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000621 void *Mem =
622 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
623 return new (Mem) OMPTaskDirective(NumClauses);
624}
625
626OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
627 SourceLocation StartLoc,
628 SourceLocation EndLoc) {
629 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
630 OMPTaskyieldDirective *Dir =
631 new (Mem) OMPTaskyieldDirective(StartLoc, EndLoc);
632 return Dir;
633}
634
635OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
636 EmptyShell) {
637 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
638 return new (Mem) OMPTaskyieldDirective();
639}
640
641OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
642 SourceLocation StartLoc,
643 SourceLocation EndLoc) {
644 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
645 OMPBarrierDirective *Dir = new (Mem) OMPBarrierDirective(StartLoc, EndLoc);
646 return Dir;
647}
648
649OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
650 EmptyShell) {
651 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
652 return new (Mem) OMPBarrierDirective();
653}
654
655OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C,
656 SourceLocation StartLoc,
657 SourceLocation EndLoc) {
658 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
659 OMPTaskwaitDirective *Dir = new (Mem) OMPTaskwaitDirective(StartLoc, EndLoc);
660 return Dir;
661}
662
663OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
664 EmptyShell) {
665 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
666 return new (Mem) OMPTaskwaitDirective();
667}
668
Alexey Bataev169d96a2017-07-18 20:17:46 +0000669OMPTaskgroupDirective *OMPTaskgroupDirective::Create(
670 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000671 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) {
Alexey Bataev169d96a2017-07-18 20:17:46 +0000672 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
673 sizeof(OMPClause *) * Clauses.size(),
674 alignof(Stmt *));
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000675 void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000676 OMPTaskgroupDirective *Dir =
Alexey Bataev169d96a2017-07-18 20:17:46 +0000677 new (Mem) OMPTaskgroupDirective(StartLoc, EndLoc, Clauses.size());
James Y Knightb8bfd962015-10-02 13:41:04 +0000678 Dir->setAssociatedStmt(AssociatedStmt);
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000679 Dir->setReductionRef(ReductionRef);
Alexey Bataev169d96a2017-07-18 20:17:46 +0000680 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000681 return Dir;
682}
683
684OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev169d96a2017-07-18 20:17:46 +0000685 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000686 EmptyShell) {
Alexey Bataev169d96a2017-07-18 20:17:46 +0000687 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
688 sizeof(OMPClause *) * NumClauses,
689 alignof(Stmt *));
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000690 void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
Alexey Bataev169d96a2017-07-18 20:17:46 +0000691 return new (Mem) OMPTaskgroupDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000692}
693
694OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
695 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
696 OpenMPDirectiveKind CancelRegion) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000697 unsigned Size =
698 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000699 void *Mem = C.Allocate(Size);
700 OMPCancellationPointDirective *Dir =
701 new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc);
702 Dir->setCancelRegion(CancelRegion);
703 return Dir;
704}
705
706OMPCancellationPointDirective *
707OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000708 unsigned Size =
709 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000710 void *Mem = C.Allocate(Size);
711 return new (Mem) OMPCancellationPointDirective();
712}
713
714OMPCancelDirective *
715OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
716 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
717 OpenMPDirectiveKind CancelRegion) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000718 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
719 sizeof(OMPClause *) * Clauses.size(),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000720 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000721 void *Mem = C.Allocate(Size);
722 OMPCancelDirective *Dir =
723 new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size());
724 Dir->setClauses(Clauses);
725 Dir->setCancelRegion(CancelRegion);
726 return Dir;
727}
728
729OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
730 unsigned NumClauses,
731 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000732 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
733 sizeof(OMPClause *) * NumClauses,
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000734 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000735 void *Mem = C.Allocate(Size);
736 return new (Mem) OMPCancelDirective(NumClauses);
737}
738
739OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
740 SourceLocation StartLoc,
741 SourceLocation EndLoc,
742 ArrayRef<OMPClause *> Clauses) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000743 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000744 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000745 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
746 OMPFlushDirective *Dir =
747 new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size());
748 Dir->setClauses(Clauses);
749 return Dir;
750}
751
752OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
753 unsigned NumClauses,
754 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000755 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000756 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000757 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
758 return new (Mem) OMPFlushDirective(NumClauses);
759}
760
761OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
762 SourceLocation StartLoc,
763 SourceLocation EndLoc,
764 ArrayRef<OMPClause *> Clauses,
765 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000766 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000767 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000768 void *Mem =
769 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size());
770 OMPOrderedDirective *Dir =
771 new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size());
772 Dir->setClauses(Clauses);
773 Dir->setAssociatedStmt(AssociatedStmt);
774 return Dir;
775}
776
777OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
778 unsigned NumClauses,
779 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000780 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000781 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000782 void *Mem =
783 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses);
784 return new (Mem) OMPOrderedDirective(NumClauses);
785}
786
787OMPAtomicDirective *OMPAtomicDirective::Create(
788 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
789 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
790 Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000791 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000792 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000793 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
794 5 * sizeof(Stmt *));
795 OMPAtomicDirective *Dir =
796 new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size());
797 Dir->setClauses(Clauses);
798 Dir->setAssociatedStmt(AssociatedStmt);
799 Dir->setX(X);
800 Dir->setV(V);
801 Dir->setExpr(E);
802 Dir->setUpdateExpr(UE);
803 Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
804 Dir->IsPostfixUpdate = IsPostfixUpdate;
805 return Dir;
806}
807
808OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
809 unsigned NumClauses,
810 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000811 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000812 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000813 void *Mem =
814 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *));
815 return new (Mem) OMPAtomicDirective(NumClauses);
816}
817
818OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
819 SourceLocation StartLoc,
820 SourceLocation EndLoc,
821 ArrayRef<OMPClause *> Clauses,
822 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000823 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000824 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000825 void *Mem =
826 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
827 OMPTargetDirective *Dir =
828 new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size());
829 Dir->setClauses(Clauses);
830 Dir->setAssociatedStmt(AssociatedStmt);
831 return Dir;
832}
833
834OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
835 unsigned NumClauses,
836 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000837 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000838 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000839 void *Mem =
840 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
841 return new (Mem) OMPTargetDirective(NumClauses);
842}
843
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000844OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
845 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
846 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000847 unsigned Size =
848 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000849 void *Mem =
850 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
851 OMPTargetParallelDirective *Dir =
852 new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size());
853 Dir->setClauses(Clauses);
854 Dir->setAssociatedStmt(AssociatedStmt);
855 return Dir;
856}
857
858OMPTargetParallelDirective *
859OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
860 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000861 unsigned Size =
862 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000863 void *Mem =
864 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
865 return new (Mem) OMPTargetParallelDirective(NumClauses);
866}
867
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000868OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
869 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
870 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
871 const HelperExprs &Exprs, bool HasCancel) {
872 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000873 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000874 void *Mem = C.Allocate(
875 Size + sizeof(OMPClause *) * Clauses.size() +
876 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
877 OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective(
878 StartLoc, EndLoc, CollapsedNum, Clauses.size());
879 Dir->setClauses(Clauses);
880 Dir->setAssociatedStmt(AssociatedStmt);
881 Dir->setIterationVariable(Exprs.IterationVarRef);
882 Dir->setLastIteration(Exprs.LastIteration);
883 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
884 Dir->setPreCond(Exprs.PreCond);
885 Dir->setCond(Exprs.Cond);
886 Dir->setInit(Exprs.Init);
887 Dir->setInc(Exprs.Inc);
888 Dir->setIsLastIterVariable(Exprs.IL);
889 Dir->setLowerBoundVariable(Exprs.LB);
890 Dir->setUpperBoundVariable(Exprs.UB);
891 Dir->setStrideVariable(Exprs.ST);
892 Dir->setEnsureUpperBound(Exprs.EUB);
893 Dir->setNextLowerBound(Exprs.NLB);
894 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000895 Dir->setNumIterations(Exprs.NumIterations);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000896 Dir->setCounters(Exprs.Counters);
897 Dir->setPrivateCounters(Exprs.PrivateCounters);
898 Dir->setInits(Exprs.Inits);
899 Dir->setUpdates(Exprs.Updates);
900 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +0000901 Dir->setDependentCounters(Exprs.DependentCounters);
902 Dir->setDependentInits(Exprs.DependentInits);
903 Dir->setFinalsConditions(Exprs.FinalsConditions);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000904 Dir->setPreInits(Exprs.PreInits);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000905 Dir->setHasCancel(HasCancel);
906 return Dir;
907}
908
909OMPTargetParallelForDirective *
910OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
911 unsigned NumClauses,
912 unsigned CollapsedNum, EmptyShell) {
913 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000914 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000915 void *Mem = C.Allocate(
916 Size + sizeof(OMPClause *) * NumClauses +
917 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
918 return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses);
919}
920
James Y Knightb8bfd962015-10-02 13:41:04 +0000921OMPTargetDataDirective *OMPTargetDataDirective::Create(
922 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
923 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000924 void *Mem = C.Allocate(
925 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
926 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000927 OMPTargetDataDirective *Dir =
928 new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size());
929 Dir->setClauses(Clauses);
930 Dir->setAssociatedStmt(AssociatedStmt);
931 return Dir;
932}
933
934OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
935 unsigned N,
936 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000937 void *Mem = C.Allocate(
938 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
939 sizeof(OMPClause *) * N + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000940 return new (Mem) OMPTargetDataDirective(N);
941}
942
Samuel Antaodf67fc42016-01-19 19:15:56 +0000943OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
944 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
Alexey Bataev7828b252017-11-21 17:08:48 +0000945 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000946 void *Mem = C.Allocate(
947 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000948 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
Samuel Antaodf67fc42016-01-19 19:15:56 +0000949 OMPTargetEnterDataDirective *Dir =
950 new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size());
951 Dir->setClauses(Clauses);
Alexey Bataev7828b252017-11-21 17:08:48 +0000952 Dir->setAssociatedStmt(AssociatedStmt);
Samuel Antaodf67fc42016-01-19 19:15:56 +0000953 return Dir;
954}
955
956OMPTargetEnterDataDirective *
957OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
958 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000959 void *Mem = C.Allocate(
960 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000961 sizeof(OMPClause *) * N + sizeof(Stmt *));
Samuel Antaodf67fc42016-01-19 19:15:56 +0000962 return new (Mem) OMPTargetEnterDataDirective(N);
963}
964
Alexey Bataev7828b252017-11-21 17:08:48 +0000965OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create(
966 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
967 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000968 void *Mem = C.Allocate(
969 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000970 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
Samuel Antao72590762016-01-19 20:04:50 +0000971 OMPTargetExitDataDirective *Dir =
972 new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size());
973 Dir->setClauses(Clauses);
Alexey Bataev7828b252017-11-21 17:08:48 +0000974 Dir->setAssociatedStmt(AssociatedStmt);
Samuel Antao72590762016-01-19 20:04:50 +0000975 return Dir;
976}
977
978OMPTargetExitDataDirective *
979OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
980 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000981 void *Mem = C.Allocate(
982 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000983 sizeof(OMPClause *) * N + sizeof(Stmt *));
Samuel Antao72590762016-01-19 20:04:50 +0000984 return new (Mem) OMPTargetExitDataDirective(N);
985}
986
James Y Knightb8bfd962015-10-02 13:41:04 +0000987OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
988 SourceLocation StartLoc,
989 SourceLocation EndLoc,
990 ArrayRef<OMPClause *> Clauses,
991 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000992 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000993 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000994 void *Mem =
995 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
996 OMPTeamsDirective *Dir =
997 new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size());
998 Dir->setClauses(Clauses);
999 Dir->setAssociatedStmt(AssociatedStmt);
1000 return Dir;
1001}
1002
1003OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
1004 unsigned NumClauses,
1005 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +00001006 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001007 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +00001008 void *Mem =
1009 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1010 return new (Mem) OMPTeamsDirective(NumClauses);
1011}
Alexey Bataev49f6e782015-12-01 04:18:41 +00001012
1013OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
1014 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1015 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1016 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +00001017 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001018 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +00001019 void *Mem =
1020 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1021 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
1022 OMPTaskLoopDirective *Dir = new (Mem)
1023 OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1024 Dir->setClauses(Clauses);
1025 Dir->setAssociatedStmt(AssociatedStmt);
1026 Dir->setIterationVariable(Exprs.IterationVarRef);
1027 Dir->setLastIteration(Exprs.LastIteration);
1028 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1029 Dir->setPreCond(Exprs.PreCond);
1030 Dir->setCond(Exprs.Cond);
1031 Dir->setInit(Exprs.Init);
1032 Dir->setInc(Exprs.Inc);
1033 Dir->setIsLastIterVariable(Exprs.IL);
1034 Dir->setLowerBoundVariable(Exprs.LB);
1035 Dir->setUpperBoundVariable(Exprs.UB);
1036 Dir->setStrideVariable(Exprs.ST);
1037 Dir->setEnsureUpperBound(Exprs.EUB);
1038 Dir->setNextLowerBound(Exprs.NLB);
1039 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +00001040 Dir->setNumIterations(Exprs.NumIterations);
Alexey Bataev49f6e782015-12-01 04:18:41 +00001041 Dir->setCounters(Exprs.Counters);
1042 Dir->setPrivateCounters(Exprs.PrivateCounters);
1043 Dir->setInits(Exprs.Inits);
1044 Dir->setUpdates(Exprs.Updates);
1045 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001046 Dir->setDependentCounters(Exprs.DependentCounters);
1047 Dir->setDependentInits(Exprs.DependentInits);
1048 Dir->setFinalsConditions(Exprs.FinalsConditions);
Alexey Bataev5a3af132016-03-29 08:58:54 +00001049 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev49f6e782015-12-01 04:18:41 +00001050 return Dir;
1051}
1052
1053OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
1054 unsigned NumClauses,
1055 unsigned CollapsedNum,
1056 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +00001057 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001058 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +00001059 void *Mem =
1060 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1061 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
1062 return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses);
1063}
1064
Alexey Bataev0a6ed842015-12-03 09:40:15 +00001065OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
1066 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1067 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1068 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001069 unsigned Size =
1070 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +00001071 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1072 sizeof(Stmt *) *
1073 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
1074 OMPTaskLoopSimdDirective *Dir = new (Mem)
1075 OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1076 Dir->setClauses(Clauses);
1077 Dir->setAssociatedStmt(AssociatedStmt);
1078 Dir->setIterationVariable(Exprs.IterationVarRef);
1079 Dir->setLastIteration(Exprs.LastIteration);
1080 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1081 Dir->setPreCond(Exprs.PreCond);
1082 Dir->setCond(Exprs.Cond);
1083 Dir->setInit(Exprs.Init);
1084 Dir->setInc(Exprs.Inc);
1085 Dir->setIsLastIterVariable(Exprs.IL);
1086 Dir->setLowerBoundVariable(Exprs.LB);
1087 Dir->setUpperBoundVariable(Exprs.UB);
1088 Dir->setStrideVariable(Exprs.ST);
1089 Dir->setEnsureUpperBound(Exprs.EUB);
1090 Dir->setNextLowerBound(Exprs.NLB);
1091 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +00001092 Dir->setNumIterations(Exprs.NumIterations);
Alexey Bataev0a6ed842015-12-03 09:40:15 +00001093 Dir->setCounters(Exprs.Counters);
1094 Dir->setPrivateCounters(Exprs.PrivateCounters);
1095 Dir->setInits(Exprs.Inits);
1096 Dir->setUpdates(Exprs.Updates);
1097 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001098 Dir->setDependentCounters(Exprs.DependentCounters);
1099 Dir->setDependentInits(Exprs.DependentInits);
1100 Dir->setFinalsConditions(Exprs.FinalsConditions);
Alexey Bataev5a3af132016-03-29 08:58:54 +00001101 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev0a6ed842015-12-03 09:40:15 +00001102 return Dir;
1103}
1104
1105OMPTaskLoopSimdDirective *
1106OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1107 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001108 unsigned Size =
1109 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +00001110 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1111 sizeof(Stmt *) *
1112 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
1113 return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);
1114}
1115
Alexey Bataev60e51c42019-10-10 20:13:02 +00001116OMPMasterTaskLoopDirective *OMPMasterTaskLoopDirective::Create(
1117 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1118 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1119 const HelperExprs &Exprs) {
1120 unsigned Size =
1121 llvm::alignTo(sizeof(OMPMasterTaskLoopDirective), alignof(OMPClause *));
1122 void *Mem = C.Allocate(
1123 Size + sizeof(OMPClause *) * Clauses.size() +
1124 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_master_taskloop));
1125 OMPMasterTaskLoopDirective *Dir = new (Mem) OMPMasterTaskLoopDirective(
1126 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1127 Dir->setClauses(Clauses);
1128 Dir->setAssociatedStmt(AssociatedStmt);
1129 Dir->setIterationVariable(Exprs.IterationVarRef);
1130 Dir->setLastIteration(Exprs.LastIteration);
1131 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1132 Dir->setPreCond(Exprs.PreCond);
1133 Dir->setCond(Exprs.Cond);
1134 Dir->setInit(Exprs.Init);
1135 Dir->setInc(Exprs.Inc);
1136 Dir->setIsLastIterVariable(Exprs.IL);
1137 Dir->setLowerBoundVariable(Exprs.LB);
1138 Dir->setUpperBoundVariable(Exprs.UB);
1139 Dir->setStrideVariable(Exprs.ST);
1140 Dir->setEnsureUpperBound(Exprs.EUB);
1141 Dir->setNextLowerBound(Exprs.NLB);
1142 Dir->setNextUpperBound(Exprs.NUB);
1143 Dir->setNumIterations(Exprs.NumIterations);
1144 Dir->setCounters(Exprs.Counters);
1145 Dir->setPrivateCounters(Exprs.PrivateCounters);
1146 Dir->setInits(Exprs.Inits);
1147 Dir->setUpdates(Exprs.Updates);
1148 Dir->setFinals(Exprs.Finals);
1149 Dir->setDependentCounters(Exprs.DependentCounters);
1150 Dir->setDependentInits(Exprs.DependentInits);
1151 Dir->setFinalsConditions(Exprs.FinalsConditions);
1152 Dir->setPreInits(Exprs.PreInits);
1153 return Dir;
1154}
1155
1156OMPMasterTaskLoopDirective *
1157OMPMasterTaskLoopDirective::CreateEmpty(const ASTContext &C,
1158 unsigned NumClauses,
1159 unsigned CollapsedNum, EmptyShell) {
1160 unsigned Size =
1161 llvm::alignTo(sizeof(OMPMasterTaskLoopDirective), alignof(OMPClause *));
1162 void *Mem = C.Allocate(
1163 Size + sizeof(OMPClause *) * NumClauses +
1164 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_master_taskloop));
1165 return new (Mem) OMPMasterTaskLoopDirective(CollapsedNum, NumClauses);
1166}
1167
Alexey Bataevb8552ab2019-10-18 16:47:35 +00001168OMPMasterTaskLoopSimdDirective *OMPMasterTaskLoopSimdDirective::Create(
1169 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1170 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1171 const HelperExprs &Exprs) {
1172 unsigned Size = llvm::alignTo(sizeof(OMPMasterTaskLoopSimdDirective),
1173 alignof(OMPClause *));
1174 void *Mem =
1175 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1176 sizeof(Stmt *) *
1177 numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd));
1178 auto *Dir = new (Mem) OMPMasterTaskLoopSimdDirective(
1179 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1180 Dir->setClauses(Clauses);
1181 Dir->setAssociatedStmt(AssociatedStmt);
1182 Dir->setIterationVariable(Exprs.IterationVarRef);
1183 Dir->setLastIteration(Exprs.LastIteration);
1184 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1185 Dir->setPreCond(Exprs.PreCond);
1186 Dir->setCond(Exprs.Cond);
1187 Dir->setInit(Exprs.Init);
1188 Dir->setInc(Exprs.Inc);
1189 Dir->setIsLastIterVariable(Exprs.IL);
1190 Dir->setLowerBoundVariable(Exprs.LB);
1191 Dir->setUpperBoundVariable(Exprs.UB);
1192 Dir->setStrideVariable(Exprs.ST);
1193 Dir->setEnsureUpperBound(Exprs.EUB);
1194 Dir->setNextLowerBound(Exprs.NLB);
1195 Dir->setNextUpperBound(Exprs.NUB);
1196 Dir->setNumIterations(Exprs.NumIterations);
1197 Dir->setCounters(Exprs.Counters);
1198 Dir->setPrivateCounters(Exprs.PrivateCounters);
1199 Dir->setInits(Exprs.Inits);
1200 Dir->setUpdates(Exprs.Updates);
1201 Dir->setFinals(Exprs.Finals);
1202 Dir->setDependentCounters(Exprs.DependentCounters);
1203 Dir->setDependentInits(Exprs.DependentInits);
1204 Dir->setFinalsConditions(Exprs.FinalsConditions);
1205 Dir->setPreInits(Exprs.PreInits);
1206 return Dir;
1207}
1208
1209OMPMasterTaskLoopSimdDirective *
1210OMPMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1211 unsigned NumClauses,
1212 unsigned CollapsedNum, EmptyShell) {
1213 unsigned Size = llvm::alignTo(sizeof(OMPMasterTaskLoopSimdDirective),
1214 alignof(OMPClause *));
1215 void *Mem =
1216 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1217 sizeof(Stmt *) *
1218 numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd));
1219 return new (Mem) OMPMasterTaskLoopSimdDirective(CollapsedNum, NumClauses);
1220}
1221
Alexey Bataev5bbcead2019-10-14 17:17:41 +00001222OMPParallelMasterTaskLoopDirective *OMPParallelMasterTaskLoopDirective::Create(
1223 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1224 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1225 const HelperExprs &Exprs) {
1226 unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopDirective),
1227 alignof(OMPClause *));
1228 void *Mem = C.Allocate(
1229 Size + sizeof(OMPClause *) * Clauses.size() +
1230 sizeof(Stmt *) *
1231 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop));
1232 auto *Dir = new (Mem) OMPParallelMasterTaskLoopDirective(
1233 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1234 Dir->setClauses(Clauses);
1235 Dir->setAssociatedStmt(AssociatedStmt);
1236 Dir->setIterationVariable(Exprs.IterationVarRef);
1237 Dir->setLastIteration(Exprs.LastIteration);
1238 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1239 Dir->setPreCond(Exprs.PreCond);
1240 Dir->setCond(Exprs.Cond);
1241 Dir->setInit(Exprs.Init);
1242 Dir->setInc(Exprs.Inc);
1243 Dir->setIsLastIterVariable(Exprs.IL);
1244 Dir->setLowerBoundVariable(Exprs.LB);
1245 Dir->setUpperBoundVariable(Exprs.UB);
1246 Dir->setStrideVariable(Exprs.ST);
1247 Dir->setEnsureUpperBound(Exprs.EUB);
1248 Dir->setNextLowerBound(Exprs.NLB);
1249 Dir->setNextUpperBound(Exprs.NUB);
1250 Dir->setNumIterations(Exprs.NumIterations);
1251 Dir->setCounters(Exprs.Counters);
1252 Dir->setPrivateCounters(Exprs.PrivateCounters);
1253 Dir->setInits(Exprs.Inits);
1254 Dir->setUpdates(Exprs.Updates);
1255 Dir->setFinals(Exprs.Finals);
1256 Dir->setDependentCounters(Exprs.DependentCounters);
1257 Dir->setDependentInits(Exprs.DependentInits);
1258 Dir->setFinalsConditions(Exprs.FinalsConditions);
1259 Dir->setPreInits(Exprs.PreInits);
1260 return Dir;
1261}
1262
1263OMPParallelMasterTaskLoopDirective *
1264OMPParallelMasterTaskLoopDirective::CreateEmpty(const ASTContext &C,
1265 unsigned NumClauses,
1266 unsigned CollapsedNum,
1267 EmptyShell) {
1268 unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopDirective),
1269 alignof(OMPClause *));
1270 void *Mem = C.Allocate(
1271 Size + sizeof(OMPClause *) * NumClauses +
1272 sizeof(Stmt *) *
1273 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop));
1274 return new (Mem) OMPParallelMasterTaskLoopDirective(CollapsedNum, NumClauses);
1275}
1276
Alexey Bataev14a388f2019-10-25 10:27:13 -04001277OMPParallelMasterTaskLoopSimdDirective *
1278OMPParallelMasterTaskLoopSimdDirective::Create(
1279 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1280 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1281 const HelperExprs &Exprs) {
1282 unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopSimdDirective),
1283 alignof(OMPClause *));
1284 void *Mem = C.Allocate(
1285 Size + sizeof(OMPClause *) * Clauses.size() +
1286 sizeof(Stmt *) *
1287 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd));
1288 auto *Dir = new (Mem) OMPParallelMasterTaskLoopSimdDirective(
1289 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1290 Dir->setClauses(Clauses);
1291 Dir->setAssociatedStmt(AssociatedStmt);
1292 Dir->setIterationVariable(Exprs.IterationVarRef);
1293 Dir->setLastIteration(Exprs.LastIteration);
1294 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1295 Dir->setPreCond(Exprs.PreCond);
1296 Dir->setCond(Exprs.Cond);
1297 Dir->setInit(Exprs.Init);
1298 Dir->setInc(Exprs.Inc);
1299 Dir->setIsLastIterVariable(Exprs.IL);
1300 Dir->setLowerBoundVariable(Exprs.LB);
1301 Dir->setUpperBoundVariable(Exprs.UB);
1302 Dir->setStrideVariable(Exprs.ST);
1303 Dir->setEnsureUpperBound(Exprs.EUB);
1304 Dir->setNextLowerBound(Exprs.NLB);
1305 Dir->setNextUpperBound(Exprs.NUB);
1306 Dir->setNumIterations(Exprs.NumIterations);
1307 Dir->setCounters(Exprs.Counters);
1308 Dir->setPrivateCounters(Exprs.PrivateCounters);
1309 Dir->setInits(Exprs.Inits);
1310 Dir->setUpdates(Exprs.Updates);
1311 Dir->setFinals(Exprs.Finals);
1312 Dir->setDependentCounters(Exprs.DependentCounters);
1313 Dir->setDependentInits(Exprs.DependentInits);
1314 Dir->setFinalsConditions(Exprs.FinalsConditions);
1315 Dir->setPreInits(Exprs.PreInits);
1316 return Dir;
1317}
1318
1319OMPParallelMasterTaskLoopSimdDirective *
1320OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1321 unsigned NumClauses,
1322 unsigned CollapsedNum,
1323 EmptyShell) {
1324 unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopSimdDirective),
1325 alignof(OMPClause *));
1326 void *Mem = C.Allocate(
1327 Size + sizeof(OMPClause *) * NumClauses +
1328 sizeof(Stmt *) *
1329 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd));
1330 return new (Mem)
1331 OMPParallelMasterTaskLoopSimdDirective(CollapsedNum, NumClauses);
1332}
1333
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001334OMPDistributeDirective *OMPDistributeDirective::Create(
1335 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1336 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1337 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001338 unsigned Size =
1339 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001340 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1341 sizeof(Stmt *) *
1342 numLoopChildren(CollapsedNum, OMPD_distribute));
1343 OMPDistributeDirective *Dir = new (Mem)
1344 OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1345 Dir->setClauses(Clauses);
1346 Dir->setAssociatedStmt(AssociatedStmt);
1347 Dir->setIterationVariable(Exprs.IterationVarRef);
1348 Dir->setLastIteration(Exprs.LastIteration);
1349 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1350 Dir->setPreCond(Exprs.PreCond);
1351 Dir->setCond(Exprs.Cond);
1352 Dir->setInit(Exprs.Init);
1353 Dir->setInc(Exprs.Inc);
1354 Dir->setIsLastIterVariable(Exprs.IL);
1355 Dir->setLowerBoundVariable(Exprs.LB);
1356 Dir->setUpperBoundVariable(Exprs.UB);
1357 Dir->setStrideVariable(Exprs.ST);
1358 Dir->setEnsureUpperBound(Exprs.EUB);
1359 Dir->setNextLowerBound(Exprs.NLB);
1360 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +00001361 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001362 Dir->setCounters(Exprs.Counters);
1363 Dir->setPrivateCounters(Exprs.PrivateCounters);
1364 Dir->setInits(Exprs.Inits);
1365 Dir->setUpdates(Exprs.Updates);
1366 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001367 Dir->setDependentCounters(Exprs.DependentCounters);
1368 Dir->setDependentInits(Exprs.DependentInits);
1369 Dir->setFinalsConditions(Exprs.FinalsConditions);
Alexey Bataev5a3af132016-03-29 08:58:54 +00001370 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001371 return Dir;
1372}
1373
1374OMPDistributeDirective *
1375OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1376 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001377 unsigned Size =
1378 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001379 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1380 sizeof(Stmt *) *
1381 numLoopChildren(CollapsedNum, OMPD_distribute));
1382 return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);
1383}
Samuel Antao686c70c2016-05-26 17:30:50 +00001384
Alexey Bataev7828b252017-11-21 17:08:48 +00001385OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create(
1386 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1387 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001388 unsigned Size =
1389 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Alexey Bataev7828b252017-11-21 17:08:48 +00001390 void *Mem =
1391 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001392 OMPTargetUpdateDirective *Dir =
1393 new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size());
1394 Dir->setClauses(Clauses);
Alexey Bataev7828b252017-11-21 17:08:48 +00001395 Dir->setAssociatedStmt(AssociatedStmt);
Samuel Antao686c70c2016-05-26 17:30:50 +00001396 return Dir;
1397}
1398
1399OMPTargetUpdateDirective *
1400OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1401 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001402 unsigned Size =
1403 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Alexey Bataev7828b252017-11-21 17:08:48 +00001404 void *Mem =
1405 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001406 return new (Mem) OMPTargetUpdateDirective(NumClauses);
1407}
Carlo Bertolli9925f152016-06-27 14:55:37 +00001408
1409OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1410 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1411 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001412 const HelperExprs &Exprs, bool HasCancel) {
Carlo Bertolli9925f152016-06-27 14:55:37 +00001413 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001414 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001415 void *Mem = C.Allocate(
1416 Size + sizeof(OMPClause *) * Clauses.size() +
1417 sizeof(Stmt *) *
1418 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1419 OMPDistributeParallelForDirective *Dir =
1420 new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc,
1421 CollapsedNum, Clauses.size());
1422 Dir->setClauses(Clauses);
1423 Dir->setAssociatedStmt(AssociatedStmt);
1424 Dir->setIterationVariable(Exprs.IterationVarRef);
1425 Dir->setLastIteration(Exprs.LastIteration);
1426 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1427 Dir->setPreCond(Exprs.PreCond);
1428 Dir->setCond(Exprs.Cond);
1429 Dir->setInit(Exprs.Init);
1430 Dir->setInc(Exprs.Inc);
1431 Dir->setIsLastIterVariable(Exprs.IL);
1432 Dir->setLowerBoundVariable(Exprs.LB);
1433 Dir->setUpperBoundVariable(Exprs.UB);
1434 Dir->setStrideVariable(Exprs.ST);
1435 Dir->setEnsureUpperBound(Exprs.EUB);
1436 Dir->setNextLowerBound(Exprs.NLB);
1437 Dir->setNextUpperBound(Exprs.NUB);
1438 Dir->setNumIterations(Exprs.NumIterations);
1439 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1440 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001441 Dir->setDistInc(Exprs.DistInc);
1442 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Carlo Bertolli9925f152016-06-27 14:55:37 +00001443 Dir->setCounters(Exprs.Counters);
1444 Dir->setPrivateCounters(Exprs.PrivateCounters);
1445 Dir->setInits(Exprs.Inits);
1446 Dir->setUpdates(Exprs.Updates);
1447 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001448 Dir->setDependentCounters(Exprs.DependentCounters);
1449 Dir->setDependentInits(Exprs.DependentInits);
1450 Dir->setFinalsConditions(Exprs.FinalsConditions);
Carlo Bertolli9925f152016-06-27 14:55:37 +00001451 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001452 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1453 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1454 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1455 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1456 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1457 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1458 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001459 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1460 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001461 Dir->HasCancel = HasCancel;
Carlo Bertolli9925f152016-06-27 14:55:37 +00001462 return Dir;
1463}
1464
1465OMPDistributeParallelForDirective *
1466OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1467 unsigned NumClauses,
1468 unsigned CollapsedNum,
1469 EmptyShell) {
1470 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001471 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001472 void *Mem = C.Allocate(
1473 Size + sizeof(OMPClause *) * NumClauses +
1474 sizeof(Stmt *) *
1475 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1476 return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses);
1477}
Kelvin Li4a39add2016-07-05 05:00:15 +00001478
1479OMPDistributeParallelForSimdDirective *
1480OMPDistributeParallelForSimdDirective::Create(
1481 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1482 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1483 const HelperExprs &Exprs) {
1484 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001485 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001486 void *Mem = C.Allocate(
1487 Size + sizeof(OMPClause *) * Clauses.size() +
1488 sizeof(Stmt *) *
1489 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1490 OMPDistributeParallelForSimdDirective *Dir = new (Mem)
1491 OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1492 Clauses.size());
1493 Dir->setClauses(Clauses);
1494 Dir->setAssociatedStmt(AssociatedStmt);
1495 Dir->setIterationVariable(Exprs.IterationVarRef);
1496 Dir->setLastIteration(Exprs.LastIteration);
1497 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1498 Dir->setPreCond(Exprs.PreCond);
1499 Dir->setCond(Exprs.Cond);
1500 Dir->setInit(Exprs.Init);
1501 Dir->setInc(Exprs.Inc);
1502 Dir->setIsLastIterVariable(Exprs.IL);
1503 Dir->setLowerBoundVariable(Exprs.LB);
1504 Dir->setUpperBoundVariable(Exprs.UB);
1505 Dir->setStrideVariable(Exprs.ST);
1506 Dir->setEnsureUpperBound(Exprs.EUB);
1507 Dir->setNextLowerBound(Exprs.NLB);
1508 Dir->setNextUpperBound(Exprs.NUB);
1509 Dir->setNumIterations(Exprs.NumIterations);
1510 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1511 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001512 Dir->setDistInc(Exprs.DistInc);
1513 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li4a39add2016-07-05 05:00:15 +00001514 Dir->setCounters(Exprs.Counters);
1515 Dir->setPrivateCounters(Exprs.PrivateCounters);
1516 Dir->setInits(Exprs.Inits);
1517 Dir->setUpdates(Exprs.Updates);
1518 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001519 Dir->setDependentCounters(Exprs.DependentCounters);
1520 Dir->setDependentInits(Exprs.DependentInits);
1521 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Li4a39add2016-07-05 05:00:15 +00001522 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001523 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1524 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1525 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1526 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1527 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1528 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1529 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001530 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1531 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Kelvin Li4a39add2016-07-05 05:00:15 +00001532 return Dir;
1533}
1534
1535OMPDistributeParallelForSimdDirective *
1536OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1537 unsigned NumClauses,
1538 unsigned CollapsedNum,
1539 EmptyShell) {
1540 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001541 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001542 void *Mem = C.Allocate(
1543 Size + sizeof(OMPClause *) * NumClauses +
1544 sizeof(Stmt *) *
1545 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1546 return new (Mem)
1547 OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1548}
Kelvin Li787f3fc2016-07-06 04:45:38 +00001549
1550OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1551 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1552 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1553 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001554 unsigned Size =
1555 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001556 void *Mem = C.Allocate(
1557 Size + sizeof(OMPClause *) * Clauses.size() +
1558 sizeof(Stmt *) *
1559 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1560 OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective(
1561 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1562 Dir->setClauses(Clauses);
1563 Dir->setAssociatedStmt(AssociatedStmt);
1564 Dir->setIterationVariable(Exprs.IterationVarRef);
1565 Dir->setLastIteration(Exprs.LastIteration);
1566 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1567 Dir->setPreCond(Exprs.PreCond);
1568 Dir->setCond(Exprs.Cond);
1569 Dir->setInit(Exprs.Init);
1570 Dir->setInc(Exprs.Inc);
1571 Dir->setIsLastIterVariable(Exprs.IL);
1572 Dir->setLowerBoundVariable(Exprs.LB);
1573 Dir->setUpperBoundVariable(Exprs.UB);
1574 Dir->setStrideVariable(Exprs.ST);
1575 Dir->setEnsureUpperBound(Exprs.EUB);
1576 Dir->setNextLowerBound(Exprs.NLB);
1577 Dir->setNextUpperBound(Exprs.NUB);
1578 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li787f3fc2016-07-06 04:45:38 +00001579 Dir->setCounters(Exprs.Counters);
1580 Dir->setPrivateCounters(Exprs.PrivateCounters);
1581 Dir->setInits(Exprs.Inits);
1582 Dir->setUpdates(Exprs.Updates);
1583 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001584 Dir->setDependentCounters(Exprs.DependentCounters);
1585 Dir->setDependentInits(Exprs.DependentInits);
1586 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Li787f3fc2016-07-06 04:45:38 +00001587 Dir->setPreInits(Exprs.PreInits);
1588 return Dir;
1589}
1590
1591OMPDistributeSimdDirective *
1592OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1593 unsigned NumClauses,
1594 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001595 unsigned Size =
1596 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001597 void *Mem = C.Allocate(
1598 Size + sizeof(OMPClause *) * NumClauses +
1599 sizeof(Stmt *) *
1600 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1601 return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses);
1602}
Kelvin Lia579b912016-07-14 02:54:56 +00001603
1604OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1605 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1606 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1607 const HelperExprs &Exprs) {
1608 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001609 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001610 void *Mem = C.Allocate(
1611 Size + sizeof(OMPClause *) * Clauses.size() +
Fangrui Song6907ce22018-07-30 19:24:48 +00001612 sizeof(Stmt *) *
Kelvin Lia579b912016-07-14 02:54:56 +00001613 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
Fangrui Song6907ce22018-07-30 19:24:48 +00001614 OMPTargetParallelForSimdDirective *Dir =
Kelvin Lia579b912016-07-14 02:54:56 +00001615 new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc,
1616 CollapsedNum, Clauses.size());
1617 Dir->setClauses(Clauses);
1618 Dir->setAssociatedStmt(AssociatedStmt);
1619 Dir->setIterationVariable(Exprs.IterationVarRef);
1620 Dir->setLastIteration(Exprs.LastIteration);
1621 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1622 Dir->setPreCond(Exprs.PreCond);
1623 Dir->setCond(Exprs.Cond);
1624 Dir->setInit(Exprs.Init);
1625 Dir->setInc(Exprs.Inc);
1626 Dir->setIsLastIterVariable(Exprs.IL);
1627 Dir->setLowerBoundVariable(Exprs.LB);
1628 Dir->setUpperBoundVariable(Exprs.UB);
1629 Dir->setStrideVariable(Exprs.ST);
1630 Dir->setEnsureUpperBound(Exprs.EUB);
1631 Dir->setNextLowerBound(Exprs.NLB);
1632 Dir->setNextUpperBound(Exprs.NUB);
1633 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Lia579b912016-07-14 02:54:56 +00001634 Dir->setCounters(Exprs.Counters);
1635 Dir->setPrivateCounters(Exprs.PrivateCounters);
1636 Dir->setInits(Exprs.Inits);
1637 Dir->setUpdates(Exprs.Updates);
1638 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001639 Dir->setDependentCounters(Exprs.DependentCounters);
1640 Dir->setDependentInits(Exprs.DependentInits);
1641 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Lia579b912016-07-14 02:54:56 +00001642 Dir->setPreInits(Exprs.PreInits);
1643 return Dir;
1644}
1645
1646OMPTargetParallelForSimdDirective *
1647OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1648 unsigned NumClauses,
1649 unsigned CollapsedNum,
1650 EmptyShell) {
1651 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001652 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001653 void *Mem = C.Allocate(
1654 Size + sizeof(OMPClause *) * NumClauses +
Fangrui Song6907ce22018-07-30 19:24:48 +00001655 sizeof(Stmt *) *
Kelvin Lia579b912016-07-14 02:54:56 +00001656 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1657 return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses);
1658}
Kelvin Li986330c2016-07-20 22:57:10 +00001659
1660OMPTargetSimdDirective *
Fangrui Song6907ce22018-07-30 19:24:48 +00001661OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
Kelvin Li986330c2016-07-20 22:57:10 +00001662 SourceLocation EndLoc, unsigned CollapsedNum,
1663 ArrayRef<OMPClause *> Clauses,
1664 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001665 unsigned Size =
1666 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001667 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
Fangrui Song6907ce22018-07-30 19:24:48 +00001668 sizeof(Stmt *) *
Kelvin Li986330c2016-07-20 22:57:10 +00001669 numLoopChildren(CollapsedNum, OMPD_target_simd));
1670 OMPTargetSimdDirective *Dir = new (Mem)
1671 OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1672 Dir->setClauses(Clauses);
1673 Dir->setAssociatedStmt(AssociatedStmt);
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->setCounters(Exprs.Counters);
1682 Dir->setPrivateCounters(Exprs.PrivateCounters);
1683 Dir->setInits(Exprs.Inits);
1684 Dir->setUpdates(Exprs.Updates);
1685 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001686 Dir->setDependentCounters(Exprs.DependentCounters);
1687 Dir->setDependentInits(Exprs.DependentInits);
1688 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Li986330c2016-07-20 22:57:10 +00001689 Dir->setPreInits(Exprs.PreInits);
1690 return Dir;
1691}
1692
1693OMPTargetSimdDirective *
1694OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1695 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001696 unsigned Size =
1697 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001698 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
Fangrui Song6907ce22018-07-30 19:24:48 +00001699 sizeof(Stmt *) *
Kelvin Li986330c2016-07-20 22:57:10 +00001700 numLoopChildren(CollapsedNum, OMPD_target_simd));
1701 return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses);
1702}
Kelvin Li02532872016-08-05 14:37:37 +00001703
1704OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1705 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1706 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1707 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001708 unsigned Size =
1709 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001710 void *Mem = C.Allocate(
1711 Size + sizeof(OMPClause *) * Clauses.size() +
1712 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1713 OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective(
1714 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1715 Dir->setClauses(Clauses);
1716 Dir->setAssociatedStmt(AssociatedStmt);
1717 Dir->setIterationVariable(Exprs.IterationVarRef);
1718 Dir->setLastIteration(Exprs.LastIteration);
1719 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1720 Dir->setPreCond(Exprs.PreCond);
1721 Dir->setCond(Exprs.Cond);
1722 Dir->setInit(Exprs.Init);
1723 Dir->setInc(Exprs.Inc);
1724 Dir->setIsLastIterVariable(Exprs.IL);
1725 Dir->setLowerBoundVariable(Exprs.LB);
1726 Dir->setUpperBoundVariable(Exprs.UB);
1727 Dir->setStrideVariable(Exprs.ST);
1728 Dir->setEnsureUpperBound(Exprs.EUB);
1729 Dir->setNextLowerBound(Exprs.NLB);
1730 Dir->setNextUpperBound(Exprs.NUB);
1731 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li02532872016-08-05 14:37:37 +00001732 Dir->setCounters(Exprs.Counters);
1733 Dir->setPrivateCounters(Exprs.PrivateCounters);
1734 Dir->setInits(Exprs.Inits);
1735 Dir->setUpdates(Exprs.Updates);
1736 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001737 Dir->setDependentCounters(Exprs.DependentCounters);
1738 Dir->setDependentInits(Exprs.DependentInits);
1739 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Li02532872016-08-05 14:37:37 +00001740 Dir->setPreInits(Exprs.PreInits);
1741 return Dir;
1742}
1743
1744OMPTeamsDistributeDirective *
1745OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1746 unsigned NumClauses,
1747 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001748 unsigned Size =
1749 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001750 void *Mem = C.Allocate(
1751 Size + sizeof(OMPClause *) * NumClauses +
1752 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1753 return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses);
1754}
Kelvin Li4e325f72016-10-25 12:50:55 +00001755
1756OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1757 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1758 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1759 const HelperExprs &Exprs) {
1760 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1761 alignof(OMPClause *));
1762 void *Mem =
1763 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1764 sizeof(Stmt *) *
1765 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1766 OMPTeamsDistributeSimdDirective *Dir =
1767 new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1768 Clauses.size());
1769 Dir->setClauses(Clauses);
1770 Dir->setAssociatedStmt(AssociatedStmt);
1771 Dir->setIterationVariable(Exprs.IterationVarRef);
1772 Dir->setLastIteration(Exprs.LastIteration);
1773 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1774 Dir->setPreCond(Exprs.PreCond);
1775 Dir->setCond(Exprs.Cond);
1776 Dir->setInit(Exprs.Init);
1777 Dir->setInc(Exprs.Inc);
1778 Dir->setIsLastIterVariable(Exprs.IL);
1779 Dir->setLowerBoundVariable(Exprs.LB);
1780 Dir->setUpperBoundVariable(Exprs.UB);
1781 Dir->setStrideVariable(Exprs.ST);
1782 Dir->setEnsureUpperBound(Exprs.EUB);
1783 Dir->setNextLowerBound(Exprs.NLB);
1784 Dir->setNextUpperBound(Exprs.NUB);
1785 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li4e325f72016-10-25 12:50:55 +00001786 Dir->setCounters(Exprs.Counters);
1787 Dir->setPrivateCounters(Exprs.PrivateCounters);
1788 Dir->setInits(Exprs.Inits);
1789 Dir->setUpdates(Exprs.Updates);
1790 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001791 Dir->setDependentCounters(Exprs.DependentCounters);
1792 Dir->setDependentInits(Exprs.DependentInits);
1793 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Li4e325f72016-10-25 12:50:55 +00001794 Dir->setPreInits(Exprs.PreInits);
1795 return Dir;
1796}
1797
1798OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1799 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1800 EmptyShell) {
1801 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1802 alignof(OMPClause *));
1803 void *Mem =
1804 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1805 sizeof(Stmt *) *
1806 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1807 return new (Mem) OMPTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1808}
Kelvin Li579e41c2016-11-30 23:51:03 +00001809
1810OMPTeamsDistributeParallelForSimdDirective *
1811OMPTeamsDistributeParallelForSimdDirective::Create(
1812 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1813 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1814 const HelperExprs &Exprs) {
1815 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1816 alignof(OMPClause *));
1817 void *Mem =
1818 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1819 sizeof(Stmt *) *
1820 numLoopChildren(CollapsedNum,
1821 OMPD_teams_distribute_parallel_for_simd));
1822 OMPTeamsDistributeParallelForSimdDirective *Dir = new (Mem)
1823 OMPTeamsDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1824 Clauses.size());
1825 Dir->setClauses(Clauses);
1826 Dir->setAssociatedStmt(AssociatedStmt);
1827 Dir->setIterationVariable(Exprs.IterationVarRef);
1828 Dir->setLastIteration(Exprs.LastIteration);
1829 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1830 Dir->setPreCond(Exprs.PreCond);
1831 Dir->setCond(Exprs.Cond);
1832 Dir->setInit(Exprs.Init);
1833 Dir->setInc(Exprs.Inc);
1834 Dir->setIsLastIterVariable(Exprs.IL);
1835 Dir->setLowerBoundVariable(Exprs.LB);
1836 Dir->setUpperBoundVariable(Exprs.UB);
1837 Dir->setStrideVariable(Exprs.ST);
1838 Dir->setEnsureUpperBound(Exprs.EUB);
1839 Dir->setNextLowerBound(Exprs.NLB);
1840 Dir->setNextUpperBound(Exprs.NUB);
1841 Dir->setNumIterations(Exprs.NumIterations);
1842 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1843 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001844 Dir->setDistInc(Exprs.DistInc);
1845 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li579e41c2016-11-30 23:51:03 +00001846 Dir->setCounters(Exprs.Counters);
1847 Dir->setPrivateCounters(Exprs.PrivateCounters);
1848 Dir->setInits(Exprs.Inits);
1849 Dir->setUpdates(Exprs.Updates);
1850 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001851 Dir->setDependentCounters(Exprs.DependentCounters);
1852 Dir->setDependentInits(Exprs.DependentInits);
1853 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Li579e41c2016-11-30 23:51:03 +00001854 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001855 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1856 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1857 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1858 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1859 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1860 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1861 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001862 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1863 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Kelvin Li579e41c2016-11-30 23:51:03 +00001864 return Dir;
1865}
1866
1867OMPTeamsDistributeParallelForSimdDirective *
1868OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1869 unsigned NumClauses,
1870 unsigned CollapsedNum,
1871 EmptyShell) {
1872 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1873 alignof(OMPClause *));
1874 void *Mem =
1875 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1876 sizeof(Stmt *) *
1877 numLoopChildren(CollapsedNum,
1878 OMPD_teams_distribute_parallel_for_simd));
1879 return new (Mem)
1880 OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1881}
Kelvin Li7ade93f2016-12-09 03:24:30 +00001882
1883OMPTeamsDistributeParallelForDirective *
1884OMPTeamsDistributeParallelForDirective::Create(
1885 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1886 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001887 const HelperExprs &Exprs, bool HasCancel) {
Kelvin Li7ade93f2016-12-09 03:24:30 +00001888 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1889 alignof(OMPClause *));
1890 void *Mem = C.Allocate(
1891 Size + sizeof(OMPClause *) * Clauses.size() +
1892 sizeof(Stmt *) *
1893 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1894 OMPTeamsDistributeParallelForDirective *Dir = new (Mem)
1895 OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum,
1896 Clauses.size());
1897 Dir->setClauses(Clauses);
1898 Dir->setAssociatedStmt(AssociatedStmt);
1899 Dir->setIterationVariable(Exprs.IterationVarRef);
1900 Dir->setLastIteration(Exprs.LastIteration);
1901 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1902 Dir->setPreCond(Exprs.PreCond);
1903 Dir->setCond(Exprs.Cond);
1904 Dir->setInit(Exprs.Init);
1905 Dir->setInc(Exprs.Inc);
1906 Dir->setIsLastIterVariable(Exprs.IL);
1907 Dir->setLowerBoundVariable(Exprs.LB);
1908 Dir->setUpperBoundVariable(Exprs.UB);
1909 Dir->setStrideVariable(Exprs.ST);
1910 Dir->setEnsureUpperBound(Exprs.EUB);
1911 Dir->setNextLowerBound(Exprs.NLB);
1912 Dir->setNextUpperBound(Exprs.NUB);
1913 Dir->setNumIterations(Exprs.NumIterations);
1914 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1915 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001916 Dir->setDistInc(Exprs.DistInc);
1917 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li7ade93f2016-12-09 03:24:30 +00001918 Dir->setCounters(Exprs.Counters);
1919 Dir->setPrivateCounters(Exprs.PrivateCounters);
1920 Dir->setInits(Exprs.Inits);
1921 Dir->setUpdates(Exprs.Updates);
1922 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00001923 Dir->setDependentCounters(Exprs.DependentCounters);
1924 Dir->setDependentInits(Exprs.DependentInits);
1925 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Li7ade93f2016-12-09 03:24:30 +00001926 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001927 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1928 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1929 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1930 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1931 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1932 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1933 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001934 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1935 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001936 Dir->HasCancel = HasCancel;
Kelvin Li7ade93f2016-12-09 03:24:30 +00001937 return Dir;
1938}
1939
1940OMPTeamsDistributeParallelForDirective *
1941OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1942 unsigned NumClauses,
1943 unsigned CollapsedNum,
1944 EmptyShell) {
1945 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1946 alignof(OMPClause *));
1947 void *Mem = C.Allocate(
1948 Size + sizeof(OMPClause *) * NumClauses +
1949 sizeof(Stmt *) *
1950 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1951 return new (Mem)
1952 OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1953}
1954
Kelvin Libf594a52016-12-17 05:48:59 +00001955OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1956 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1957 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1958 auto Size =
1959 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1960 void *Mem =
1961 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
1962 OMPTargetTeamsDirective *Dir =
1963 new (Mem) OMPTargetTeamsDirective(StartLoc, EndLoc, Clauses.size());
1964 Dir->setClauses(Clauses);
1965 Dir->setAssociatedStmt(AssociatedStmt);
1966 return Dir;
1967}
1968
1969OMPTargetTeamsDirective *
1970OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1971 EmptyShell) {
1972 auto Size =
1973 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1974 void *Mem =
1975 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1976 return new (Mem) OMPTargetTeamsDirective(NumClauses);
1977}
Kelvin Li83c451e2016-12-25 04:52:54 +00001978
1979OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
1980 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1981 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1982 const HelperExprs &Exprs) {
1983 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1984 alignof(OMPClause *));
1985 void *Mem = C.Allocate(
1986 Size + sizeof(OMPClause *) * Clauses.size() +
1987 sizeof(Stmt *) *
1988 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1989 OMPTargetTeamsDistributeDirective *Dir =
1990 new (Mem) OMPTargetTeamsDistributeDirective(StartLoc, EndLoc, CollapsedNum,
1991 Clauses.size());
1992 Dir->setClauses(Clauses);
1993 Dir->setAssociatedStmt(AssociatedStmt);
1994 Dir->setIterationVariable(Exprs.IterationVarRef);
1995 Dir->setLastIteration(Exprs.LastIteration);
1996 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1997 Dir->setPreCond(Exprs.PreCond);
1998 Dir->setCond(Exprs.Cond);
1999 Dir->setInit(Exprs.Init);
2000 Dir->setInc(Exprs.Inc);
2001 Dir->setIsLastIterVariable(Exprs.IL);
2002 Dir->setLowerBoundVariable(Exprs.LB);
2003 Dir->setUpperBoundVariable(Exprs.UB);
2004 Dir->setStrideVariable(Exprs.ST);
2005 Dir->setEnsureUpperBound(Exprs.EUB);
2006 Dir->setNextLowerBound(Exprs.NLB);
2007 Dir->setNextUpperBound(Exprs.NUB);
2008 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li83c451e2016-12-25 04:52:54 +00002009 Dir->setCounters(Exprs.Counters);
2010 Dir->setPrivateCounters(Exprs.PrivateCounters);
2011 Dir->setInits(Exprs.Inits);
2012 Dir->setUpdates(Exprs.Updates);
2013 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00002014 Dir->setDependentCounters(Exprs.DependentCounters);
2015 Dir->setDependentInits(Exprs.DependentInits);
2016 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Li83c451e2016-12-25 04:52:54 +00002017 Dir->setPreInits(Exprs.PreInits);
2018 return Dir;
2019}
2020
2021OMPTargetTeamsDistributeDirective *
2022OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
2023 unsigned NumClauses,
2024 unsigned CollapsedNum,
2025 EmptyShell) {
2026 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
2027 alignof(OMPClause *));
2028 void *Mem = C.Allocate(
2029 Size + sizeof(OMPClause *) * NumClauses +
2030 sizeof(Stmt *) *
2031 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
2032 return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses);
2033}
Kelvin Li80e8f562016-12-29 22:16:30 +00002034
2035OMPTargetTeamsDistributeParallelForDirective *
2036OMPTargetTeamsDistributeParallelForDirective::Create(
2037 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2038 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
Alexey Bataev16e79882017-11-22 21:12:03 +00002039 const HelperExprs &Exprs, bool HasCancel) {
Kelvin Li80e8f562016-12-29 22:16:30 +00002040 auto Size =
2041 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
2042 alignof(OMPClause *));
2043 void *Mem = C.Allocate(
2044 Size + sizeof(OMPClause *) * Clauses.size() +
2045 sizeof(Stmt *) *
2046 numLoopChildren(CollapsedNum,
2047 OMPD_target_teams_distribute_parallel_for));
2048 OMPTargetTeamsDistributeParallelForDirective *Dir =
2049 new (Mem) OMPTargetTeamsDistributeParallelForDirective(
2050 StartLoc, EndLoc, CollapsedNum, Clauses.size());
2051 Dir->setClauses(Clauses);
2052 Dir->setAssociatedStmt(AssociatedStmt);
2053 Dir->setIterationVariable(Exprs.IterationVarRef);
2054 Dir->setLastIteration(Exprs.LastIteration);
2055 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2056 Dir->setPreCond(Exprs.PreCond);
2057 Dir->setCond(Exprs.Cond);
2058 Dir->setInit(Exprs.Init);
2059 Dir->setInc(Exprs.Inc);
2060 Dir->setIsLastIterVariable(Exprs.IL);
2061 Dir->setLowerBoundVariable(Exprs.LB);
2062 Dir->setUpperBoundVariable(Exprs.UB);
2063 Dir->setStrideVariable(Exprs.ST);
2064 Dir->setEnsureUpperBound(Exprs.EUB);
2065 Dir->setNextLowerBound(Exprs.NLB);
2066 Dir->setNextUpperBound(Exprs.NUB);
2067 Dir->setNumIterations(Exprs.NumIterations);
2068 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2069 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00002070 Dir->setDistInc(Exprs.DistInc);
2071 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li80e8f562016-12-29 22:16:30 +00002072 Dir->setCounters(Exprs.Counters);
2073 Dir->setPrivateCounters(Exprs.PrivateCounters);
2074 Dir->setInits(Exprs.Inits);
2075 Dir->setUpdates(Exprs.Updates);
2076 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00002077 Dir->setDependentCounters(Exprs.DependentCounters);
2078 Dir->setDependentInits(Exprs.DependentInits);
2079 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Li80e8f562016-12-29 22:16:30 +00002080 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00002081 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2082 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2083 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2084 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2085 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2086 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2087 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00002088 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2089 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Alexey Bataev16e79882017-11-22 21:12:03 +00002090 Dir->HasCancel = HasCancel;
Kelvin Li80e8f562016-12-29 22:16:30 +00002091 return Dir;
2092}
2093
2094OMPTargetTeamsDistributeParallelForDirective *
2095OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
2096 unsigned NumClauses,
2097 unsigned CollapsedNum,
2098 EmptyShell) {
2099 auto Size =
2100 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
2101 alignof(OMPClause *));
2102 void *Mem = C.Allocate(
2103 Size + sizeof(OMPClause *) * NumClauses +
2104 sizeof(Stmt *) *
2105 numLoopChildren(CollapsedNum,
2106 OMPD_target_teams_distribute_parallel_for));
2107 return new (Mem)
2108 OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
2109}
Kelvin Li1851df52017-01-03 05:23:48 +00002110
2111OMPTargetTeamsDistributeParallelForSimdDirective *
2112OMPTargetTeamsDistributeParallelForSimdDirective::Create(
2113 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2114 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2115 const HelperExprs &Exprs) {
2116 auto Size =
2117 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
2118 alignof(OMPClause *));
2119 void *Mem = C.Allocate(
2120 Size + sizeof(OMPClause *) * Clauses.size() +
2121 sizeof(Stmt *) *
2122 numLoopChildren(CollapsedNum,
2123 OMPD_target_teams_distribute_parallel_for_simd));
2124 OMPTargetTeamsDistributeParallelForSimdDirective *Dir =
2125 new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
2126 StartLoc, EndLoc, CollapsedNum, Clauses.size());
2127 Dir->setClauses(Clauses);
2128 Dir->setAssociatedStmt(AssociatedStmt);
2129 Dir->setIterationVariable(Exprs.IterationVarRef);
2130 Dir->setLastIteration(Exprs.LastIteration);
2131 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2132 Dir->setPreCond(Exprs.PreCond);
2133 Dir->setCond(Exprs.Cond);
2134 Dir->setInit(Exprs.Init);
2135 Dir->setInc(Exprs.Inc);
2136 Dir->setIsLastIterVariable(Exprs.IL);
2137 Dir->setLowerBoundVariable(Exprs.LB);
2138 Dir->setUpperBoundVariable(Exprs.UB);
2139 Dir->setStrideVariable(Exprs.ST);
2140 Dir->setEnsureUpperBound(Exprs.EUB);
2141 Dir->setNextLowerBound(Exprs.NLB);
2142 Dir->setNextUpperBound(Exprs.NUB);
2143 Dir->setNumIterations(Exprs.NumIterations);
2144 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2145 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00002146 Dir->setDistInc(Exprs.DistInc);
2147 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li1851df52017-01-03 05:23:48 +00002148 Dir->setCounters(Exprs.Counters);
2149 Dir->setPrivateCounters(Exprs.PrivateCounters);
2150 Dir->setInits(Exprs.Inits);
2151 Dir->setUpdates(Exprs.Updates);
2152 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00002153 Dir->setDependentCounters(Exprs.DependentCounters);
2154 Dir->setDependentInits(Exprs.DependentInits);
2155 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Li1851df52017-01-03 05:23:48 +00002156 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00002157 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2158 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2159 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2160 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2161 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2162 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2163 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00002164 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2165 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Kelvin Li1851df52017-01-03 05:23:48 +00002166 return Dir;
2167}
2168
2169OMPTargetTeamsDistributeParallelForSimdDirective *
2170OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
2171 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
2172 EmptyShell) {
2173 auto Size =
2174 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
2175 alignof(OMPClause *));
2176 void *Mem = C.Allocate(
2177 Size + sizeof(OMPClause *) * NumClauses +
2178 sizeof(Stmt *) *
2179 numLoopChildren(CollapsedNum,
2180 OMPD_target_teams_distribute_parallel_for_simd));
2181 return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
2182 CollapsedNum, NumClauses);
2183}
2184
Kelvin Lida681182017-01-10 18:08:18 +00002185OMPTargetTeamsDistributeSimdDirective *
2186OMPTargetTeamsDistributeSimdDirective::Create(
2187 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2188 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2189 const HelperExprs &Exprs) {
2190 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
2191 alignof(OMPClause *));
2192 void *Mem = C.Allocate(
2193 Size + sizeof(OMPClause *) * Clauses.size() +
2194 sizeof(Stmt *) *
2195 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
2196 OMPTargetTeamsDistributeSimdDirective *Dir = new (Mem)
2197 OMPTargetTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
2198 Clauses.size());
2199 Dir->setClauses(Clauses);
2200 Dir->setAssociatedStmt(AssociatedStmt);
2201 Dir->setIterationVariable(Exprs.IterationVarRef);
2202 Dir->setLastIteration(Exprs.LastIteration);
2203 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2204 Dir->setPreCond(Exprs.PreCond);
2205 Dir->setCond(Exprs.Cond);
2206 Dir->setInit(Exprs.Init);
2207 Dir->setInc(Exprs.Inc);
2208 Dir->setIsLastIterVariable(Exprs.IL);
2209 Dir->setLowerBoundVariable(Exprs.LB);
2210 Dir->setUpperBoundVariable(Exprs.UB);
2211 Dir->setStrideVariable(Exprs.ST);
2212 Dir->setEnsureUpperBound(Exprs.EUB);
2213 Dir->setNextLowerBound(Exprs.NLB);
2214 Dir->setNextUpperBound(Exprs.NUB);
2215 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Lida681182017-01-10 18:08:18 +00002216 Dir->setCounters(Exprs.Counters);
2217 Dir->setPrivateCounters(Exprs.PrivateCounters);
2218 Dir->setInits(Exprs.Inits);
2219 Dir->setUpdates(Exprs.Updates);
2220 Dir->setFinals(Exprs.Finals);
Alexey Bataevf8be4762019-08-14 19:30:06 +00002221 Dir->setDependentCounters(Exprs.DependentCounters);
2222 Dir->setDependentInits(Exprs.DependentInits);
2223 Dir->setFinalsConditions(Exprs.FinalsConditions);
Kelvin Lida681182017-01-10 18:08:18 +00002224 Dir->setPreInits(Exprs.PreInits);
2225 return Dir;
2226}
2227
2228OMPTargetTeamsDistributeSimdDirective *
2229OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
2230 unsigned NumClauses,
2231 unsigned CollapsedNum,
2232 EmptyShell) {
2233 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
2234 alignof(OMPClause *));
2235 void *Mem = C.Allocate(
2236 Size + sizeof(OMPClause *) * NumClauses +
2237 sizeof(Stmt *) *
2238 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
2239 return new (Mem)
2240 OMPTargetTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
2241}