blob: 6e03181f27acf3fed1a6c2a6fe557c09c2e8d67c [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
25void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
26 assert(A.size() == getCollapsedNumber() &&
27 "Number of loop counters is not the same as the collapsed number");
28 std::copy(A.begin(), A.end(), getCounters().begin());
29}
30
31void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
32 assert(A.size() == getCollapsedNumber() && "Number of loop private counters "
33 "is not the same as the collapsed "
34 "number");
35 std::copy(A.begin(), A.end(), getPrivateCounters().begin());
36}
37
38void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
39 assert(A.size() == getCollapsedNumber() &&
40 "Number of counter inits is not the same as the collapsed number");
41 std::copy(A.begin(), A.end(), getInits().begin());
42}
43
44void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
45 assert(A.size() == getCollapsedNumber() &&
46 "Number of counter updates is not the same as the collapsed number");
47 std::copy(A.begin(), A.end(), getUpdates().begin());
48}
49
50void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
51 assert(A.size() == getCollapsedNumber() &&
52 "Number of counter finals is not the same as the collapsed number");
53 std::copy(A.begin(), A.end(), getFinals().begin());
54}
55
56OMPParallelDirective *OMPParallelDirective::Create(
57 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
58 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Rui Ueyama83aa9792016-01-14 21:00:27 +000059 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +000060 llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +000061 void *Mem =
62 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
63 OMPParallelDirective *Dir =
64 new (Mem) OMPParallelDirective(StartLoc, EndLoc, Clauses.size());
65 Dir->setClauses(Clauses);
66 Dir->setAssociatedStmt(AssociatedStmt);
67 Dir->setHasCancel(HasCancel);
68 return Dir;
69}
70
71OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
72 unsigned NumClauses,
73 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +000074 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +000075 llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +000076 void *Mem =
77 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
78 return new (Mem) OMPParallelDirective(NumClauses);
79}
80
81OMPSimdDirective *
82OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
83 SourceLocation EndLoc, unsigned CollapsedNum,
84 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
85 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +000086 unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +000087 void *Mem =
88 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
89 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
90 OMPSimdDirective *Dir = new (Mem)
91 OMPSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
92 Dir->setClauses(Clauses);
93 Dir->setAssociatedStmt(AssociatedStmt);
94 Dir->setIterationVariable(Exprs.IterationVarRef);
95 Dir->setLastIteration(Exprs.LastIteration);
96 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
97 Dir->setPreCond(Exprs.PreCond);
98 Dir->setCond(Exprs.Cond);
99 Dir->setInit(Exprs.Init);
100 Dir->setInc(Exprs.Inc);
101 Dir->setCounters(Exprs.Counters);
102 Dir->setPrivateCounters(Exprs.PrivateCounters);
103 Dir->setInits(Exprs.Inits);
104 Dir->setUpdates(Exprs.Updates);
105 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000106 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000107 return Dir;
108}
109
110OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C,
111 unsigned NumClauses,
112 unsigned CollapsedNum,
113 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000114 unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000115 void *Mem =
116 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
117 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
118 return new (Mem) OMPSimdDirective(CollapsedNum, NumClauses);
119}
120
121OMPForDirective *
122OMPForDirective::Create(const ASTContext &C, SourceLocation StartLoc,
123 SourceLocation EndLoc, unsigned CollapsedNum,
124 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
125 const HelperExprs &Exprs, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000126 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000127 void *Mem =
128 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
129 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
130 OMPForDirective *Dir =
131 new (Mem) OMPForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
132 Dir->setClauses(Clauses);
133 Dir->setAssociatedStmt(AssociatedStmt);
134 Dir->setIterationVariable(Exprs.IterationVarRef);
135 Dir->setLastIteration(Exprs.LastIteration);
136 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
137 Dir->setPreCond(Exprs.PreCond);
138 Dir->setCond(Exprs.Cond);
139 Dir->setInit(Exprs.Init);
140 Dir->setInc(Exprs.Inc);
141 Dir->setIsLastIterVariable(Exprs.IL);
142 Dir->setLowerBoundVariable(Exprs.LB);
143 Dir->setUpperBoundVariable(Exprs.UB);
144 Dir->setStrideVariable(Exprs.ST);
145 Dir->setEnsureUpperBound(Exprs.EUB);
146 Dir->setNextLowerBound(Exprs.NLB);
147 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000148 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000149 Dir->setCounters(Exprs.Counters);
150 Dir->setPrivateCounters(Exprs.PrivateCounters);
151 Dir->setInits(Exprs.Inits);
152 Dir->setUpdates(Exprs.Updates);
153 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000154 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000155 Dir->setHasCancel(HasCancel);
156 return Dir;
157}
158
159OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
160 unsigned NumClauses,
161 unsigned CollapsedNum,
162 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000163 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000164 void *Mem =
165 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
166 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
167 return new (Mem) OMPForDirective(CollapsedNum, NumClauses);
168}
169
170OMPForSimdDirective *
171OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
172 SourceLocation EndLoc, unsigned CollapsedNum,
173 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
174 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000175 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000176 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000177 void *Mem =
178 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
179 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
180 OMPForSimdDirective *Dir = new (Mem)
181 OMPForSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
182 Dir->setClauses(Clauses);
183 Dir->setAssociatedStmt(AssociatedStmt);
184 Dir->setIterationVariable(Exprs.IterationVarRef);
185 Dir->setLastIteration(Exprs.LastIteration);
186 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
187 Dir->setPreCond(Exprs.PreCond);
188 Dir->setCond(Exprs.Cond);
189 Dir->setInit(Exprs.Init);
190 Dir->setInc(Exprs.Inc);
191 Dir->setIsLastIterVariable(Exprs.IL);
192 Dir->setLowerBoundVariable(Exprs.LB);
193 Dir->setUpperBoundVariable(Exprs.UB);
194 Dir->setStrideVariable(Exprs.ST);
195 Dir->setEnsureUpperBound(Exprs.EUB);
196 Dir->setNextLowerBound(Exprs.NLB);
197 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000198 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000199 Dir->setCounters(Exprs.Counters);
200 Dir->setPrivateCounters(Exprs.PrivateCounters);
201 Dir->setInits(Exprs.Inits);
202 Dir->setUpdates(Exprs.Updates);
203 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000204 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000205 return Dir;
206}
207
208OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
209 unsigned NumClauses,
210 unsigned CollapsedNum,
211 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000212 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000213 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000214 void *Mem =
215 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
216 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
217 return new (Mem) OMPForSimdDirective(CollapsedNum, NumClauses);
218}
219
220OMPSectionsDirective *OMPSectionsDirective::Create(
221 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
222 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000223 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000224 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000225 void *Mem =
226 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
227 OMPSectionsDirective *Dir =
228 new (Mem) OMPSectionsDirective(StartLoc, EndLoc, Clauses.size());
229 Dir->setClauses(Clauses);
230 Dir->setAssociatedStmt(AssociatedStmt);
231 Dir->setHasCancel(HasCancel);
232 return Dir;
233}
234
235OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
236 unsigned NumClauses,
237 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000238 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000239 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000240 void *Mem =
241 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
242 return new (Mem) OMPSectionsDirective(NumClauses);
243}
244
245OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
246 SourceLocation StartLoc,
247 SourceLocation EndLoc,
248 Stmt *AssociatedStmt,
249 bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000250 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000251 void *Mem = C.Allocate(Size + sizeof(Stmt *));
252 OMPSectionDirective *Dir = new (Mem) OMPSectionDirective(StartLoc, EndLoc);
253 Dir->setAssociatedStmt(AssociatedStmt);
254 Dir->setHasCancel(HasCancel);
255 return Dir;
256}
257
258OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
259 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000260 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000261 void *Mem = C.Allocate(Size + sizeof(Stmt *));
262 return new (Mem) OMPSectionDirective();
263}
264
265OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
266 SourceLocation StartLoc,
267 SourceLocation EndLoc,
268 ArrayRef<OMPClause *> Clauses,
269 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000270 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000271 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000272 void *Mem =
273 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
274 OMPSingleDirective *Dir =
275 new (Mem) OMPSingleDirective(StartLoc, EndLoc, Clauses.size());
276 Dir->setClauses(Clauses);
277 Dir->setAssociatedStmt(AssociatedStmt);
278 return Dir;
279}
280
281OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
282 unsigned NumClauses,
283 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000284 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000285 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000286 void *Mem =
287 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
288 return new (Mem) OMPSingleDirective(NumClauses);
289}
290
291OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
292 SourceLocation StartLoc,
293 SourceLocation EndLoc,
294 Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000295 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000296 void *Mem = C.Allocate(Size + sizeof(Stmt *));
297 OMPMasterDirective *Dir = new (Mem) OMPMasterDirective(StartLoc, EndLoc);
298 Dir->setAssociatedStmt(AssociatedStmt);
299 return Dir;
300}
301
302OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
303 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000304 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000305 void *Mem = C.Allocate(Size + sizeof(Stmt *));
306 return new (Mem) OMPMasterDirective();
307}
308
309OMPCriticalDirective *OMPCriticalDirective::Create(
310 const ASTContext &C, const DeclarationNameInfo &Name,
Alexey Bataev28c75412015-12-15 08:19:24 +0000311 SourceLocation StartLoc, SourceLocation EndLoc,
312 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000313 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000314 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000315 void *Mem =
316 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000317 OMPCriticalDirective *Dir =
Alexey Bataev28c75412015-12-15 08:19:24 +0000318 new (Mem) OMPCriticalDirective(Name, StartLoc, EndLoc, Clauses.size());
319 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000320 Dir->setAssociatedStmt(AssociatedStmt);
321 return Dir;
322}
323
324OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev28c75412015-12-15 08:19:24 +0000325 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000326 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000327 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000328 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000329 void *Mem =
330 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
331 return new (Mem) OMPCriticalDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000332}
333
334OMPParallelForDirective *OMPParallelForDirective::Create(
335 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
336 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
337 const HelperExprs &Exprs, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000338 unsigned Size =
339 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000340 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
341 sizeof(Stmt *) *
342 numLoopChildren(CollapsedNum, OMPD_parallel_for));
343 OMPParallelForDirective *Dir = new (Mem)
344 OMPParallelForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
345 Dir->setClauses(Clauses);
346 Dir->setAssociatedStmt(AssociatedStmt);
347 Dir->setIterationVariable(Exprs.IterationVarRef);
348 Dir->setLastIteration(Exprs.LastIteration);
349 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
350 Dir->setPreCond(Exprs.PreCond);
351 Dir->setCond(Exprs.Cond);
352 Dir->setInit(Exprs.Init);
353 Dir->setInc(Exprs.Inc);
354 Dir->setIsLastIterVariable(Exprs.IL);
355 Dir->setLowerBoundVariable(Exprs.LB);
356 Dir->setUpperBoundVariable(Exprs.UB);
357 Dir->setStrideVariable(Exprs.ST);
358 Dir->setEnsureUpperBound(Exprs.EUB);
359 Dir->setNextLowerBound(Exprs.NLB);
360 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000361 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000362 Dir->setCounters(Exprs.Counters);
363 Dir->setPrivateCounters(Exprs.PrivateCounters);
364 Dir->setInits(Exprs.Inits);
365 Dir->setUpdates(Exprs.Updates);
366 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000367 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000368 Dir->setHasCancel(HasCancel);
369 return Dir;
370}
371
372OMPParallelForDirective *
373OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
374 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000375 unsigned Size =
376 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000377 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
378 sizeof(Stmt *) *
379 numLoopChildren(CollapsedNum, OMPD_parallel_for));
380 return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses);
381}
382
383OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
384 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
385 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
386 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000387 unsigned Size =
388 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000389 void *Mem = C.Allocate(
390 Size + sizeof(OMPClause *) * Clauses.size() +
391 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
392 OMPParallelForSimdDirective *Dir = new (Mem) OMPParallelForSimdDirective(
393 StartLoc, EndLoc, CollapsedNum, Clauses.size());
394 Dir->setClauses(Clauses);
395 Dir->setAssociatedStmt(AssociatedStmt);
396 Dir->setIterationVariable(Exprs.IterationVarRef);
397 Dir->setLastIteration(Exprs.LastIteration);
398 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
399 Dir->setPreCond(Exprs.PreCond);
400 Dir->setCond(Exprs.Cond);
401 Dir->setInit(Exprs.Init);
402 Dir->setInc(Exprs.Inc);
403 Dir->setIsLastIterVariable(Exprs.IL);
404 Dir->setLowerBoundVariable(Exprs.LB);
405 Dir->setUpperBoundVariable(Exprs.UB);
406 Dir->setStrideVariable(Exprs.ST);
407 Dir->setEnsureUpperBound(Exprs.EUB);
408 Dir->setNextLowerBound(Exprs.NLB);
409 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000410 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000411 Dir->setCounters(Exprs.Counters);
412 Dir->setPrivateCounters(Exprs.PrivateCounters);
413 Dir->setInits(Exprs.Inits);
414 Dir->setUpdates(Exprs.Updates);
415 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000416 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000417 return Dir;
418}
419
420OMPParallelForSimdDirective *
421OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
422 unsigned NumClauses,
423 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000424 unsigned Size =
425 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000426 void *Mem = C.Allocate(
427 Size + sizeof(OMPClause *) * NumClauses +
428 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
429 return new (Mem) OMPParallelForSimdDirective(CollapsedNum, NumClauses);
430}
431
432OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
433 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
434 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000435 unsigned Size =
436 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000437 void *Mem =
438 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
439 OMPParallelSectionsDirective *Dir =
440 new (Mem) OMPParallelSectionsDirective(StartLoc, EndLoc, Clauses.size());
441 Dir->setClauses(Clauses);
442 Dir->setAssociatedStmt(AssociatedStmt);
443 Dir->setHasCancel(HasCancel);
444 return Dir;
445}
446
447OMPParallelSectionsDirective *
448OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
449 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000450 unsigned Size =
451 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000452 void *Mem =
453 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
454 return new (Mem) OMPParallelSectionsDirective(NumClauses);
455}
456
457OMPTaskDirective *
458OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
459 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
460 Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000461 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000462 void *Mem =
463 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
464 OMPTaskDirective *Dir =
465 new (Mem) OMPTaskDirective(StartLoc, EndLoc, Clauses.size());
466 Dir->setClauses(Clauses);
467 Dir->setAssociatedStmt(AssociatedStmt);
468 Dir->setHasCancel(HasCancel);
469 return Dir;
470}
471
472OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
473 unsigned NumClauses,
474 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000475 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000476 void *Mem =
477 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
478 return new (Mem) OMPTaskDirective(NumClauses);
479}
480
481OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
482 SourceLocation StartLoc,
483 SourceLocation EndLoc) {
484 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
485 OMPTaskyieldDirective *Dir =
486 new (Mem) OMPTaskyieldDirective(StartLoc, EndLoc);
487 return Dir;
488}
489
490OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
491 EmptyShell) {
492 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
493 return new (Mem) OMPTaskyieldDirective();
494}
495
496OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
497 SourceLocation StartLoc,
498 SourceLocation EndLoc) {
499 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
500 OMPBarrierDirective *Dir = new (Mem) OMPBarrierDirective(StartLoc, EndLoc);
501 return Dir;
502}
503
504OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
505 EmptyShell) {
506 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
507 return new (Mem) OMPBarrierDirective();
508}
509
510OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C,
511 SourceLocation StartLoc,
512 SourceLocation EndLoc) {
513 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
514 OMPTaskwaitDirective *Dir = new (Mem) OMPTaskwaitDirective(StartLoc, EndLoc);
515 return Dir;
516}
517
518OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
519 EmptyShell) {
520 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
521 return new (Mem) OMPTaskwaitDirective();
522}
523
Alexey Bataev169d96a2017-07-18 20:17:46 +0000524OMPTaskgroupDirective *OMPTaskgroupDirective::Create(
525 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000526 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) {
Alexey Bataev169d96a2017-07-18 20:17:46 +0000527 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
528 sizeof(OMPClause *) * Clauses.size(),
529 alignof(Stmt *));
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000530 void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000531 OMPTaskgroupDirective *Dir =
Alexey Bataev169d96a2017-07-18 20:17:46 +0000532 new (Mem) OMPTaskgroupDirective(StartLoc, EndLoc, Clauses.size());
James Y Knightb8bfd962015-10-02 13:41:04 +0000533 Dir->setAssociatedStmt(AssociatedStmt);
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000534 Dir->setReductionRef(ReductionRef);
Alexey Bataev169d96a2017-07-18 20:17:46 +0000535 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000536 return Dir;
537}
538
539OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev169d96a2017-07-18 20:17:46 +0000540 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000541 EmptyShell) {
Alexey Bataev169d96a2017-07-18 20:17:46 +0000542 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
543 sizeof(OMPClause *) * NumClauses,
544 alignof(Stmt *));
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000545 void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
Alexey Bataev169d96a2017-07-18 20:17:46 +0000546 return new (Mem) OMPTaskgroupDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000547}
548
549OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
550 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
551 OpenMPDirectiveKind CancelRegion) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000552 unsigned Size =
553 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000554 void *Mem = C.Allocate(Size);
555 OMPCancellationPointDirective *Dir =
556 new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc);
557 Dir->setCancelRegion(CancelRegion);
558 return Dir;
559}
560
561OMPCancellationPointDirective *
562OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000563 unsigned Size =
564 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000565 void *Mem = C.Allocate(Size);
566 return new (Mem) OMPCancellationPointDirective();
567}
568
569OMPCancelDirective *
570OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
571 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
572 OpenMPDirectiveKind CancelRegion) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000573 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
574 sizeof(OMPClause *) * Clauses.size(),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000575 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000576 void *Mem = C.Allocate(Size);
577 OMPCancelDirective *Dir =
578 new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size());
579 Dir->setClauses(Clauses);
580 Dir->setCancelRegion(CancelRegion);
581 return Dir;
582}
583
584OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
585 unsigned NumClauses,
586 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000587 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
588 sizeof(OMPClause *) * NumClauses,
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000589 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000590 void *Mem = C.Allocate(Size);
591 return new (Mem) OMPCancelDirective(NumClauses);
592}
593
594OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
595 SourceLocation StartLoc,
596 SourceLocation EndLoc,
597 ArrayRef<OMPClause *> Clauses) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000598 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000599 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000600 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
601 OMPFlushDirective *Dir =
602 new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size());
603 Dir->setClauses(Clauses);
604 return Dir;
605}
606
607OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
608 unsigned NumClauses,
609 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000610 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000611 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000612 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
613 return new (Mem) OMPFlushDirective(NumClauses);
614}
615
616OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
617 SourceLocation StartLoc,
618 SourceLocation EndLoc,
619 ArrayRef<OMPClause *> Clauses,
620 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000621 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000622 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000623 void *Mem =
624 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size());
625 OMPOrderedDirective *Dir =
626 new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size());
627 Dir->setClauses(Clauses);
628 Dir->setAssociatedStmt(AssociatedStmt);
629 return Dir;
630}
631
632OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
633 unsigned NumClauses,
634 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000635 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000636 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000637 void *Mem =
638 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses);
639 return new (Mem) OMPOrderedDirective(NumClauses);
640}
641
642OMPAtomicDirective *OMPAtomicDirective::Create(
643 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
644 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
645 Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000646 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000647 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000648 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
649 5 * sizeof(Stmt *));
650 OMPAtomicDirective *Dir =
651 new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size());
652 Dir->setClauses(Clauses);
653 Dir->setAssociatedStmt(AssociatedStmt);
654 Dir->setX(X);
655 Dir->setV(V);
656 Dir->setExpr(E);
657 Dir->setUpdateExpr(UE);
658 Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
659 Dir->IsPostfixUpdate = IsPostfixUpdate;
660 return Dir;
661}
662
663OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
664 unsigned NumClauses,
665 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000666 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000667 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000668 void *Mem =
669 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *));
670 return new (Mem) OMPAtomicDirective(NumClauses);
671}
672
673OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
674 SourceLocation StartLoc,
675 SourceLocation EndLoc,
676 ArrayRef<OMPClause *> Clauses,
677 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000678 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000679 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000680 void *Mem =
681 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
682 OMPTargetDirective *Dir =
683 new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size());
684 Dir->setClauses(Clauses);
685 Dir->setAssociatedStmt(AssociatedStmt);
686 return Dir;
687}
688
689OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
690 unsigned NumClauses,
691 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000692 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000693 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000694 void *Mem =
695 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
696 return new (Mem) OMPTargetDirective(NumClauses);
697}
698
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000699OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
700 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
701 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000702 unsigned Size =
703 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000704 void *Mem =
705 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
706 OMPTargetParallelDirective *Dir =
707 new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size());
708 Dir->setClauses(Clauses);
709 Dir->setAssociatedStmt(AssociatedStmt);
710 return Dir;
711}
712
713OMPTargetParallelDirective *
714OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
715 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000716 unsigned Size =
717 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000718 void *Mem =
719 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
720 return new (Mem) OMPTargetParallelDirective(NumClauses);
721}
722
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000723OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
724 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
725 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
726 const HelperExprs &Exprs, bool HasCancel) {
727 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000728 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000729 void *Mem = C.Allocate(
730 Size + sizeof(OMPClause *) * Clauses.size() +
731 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
732 OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective(
733 StartLoc, EndLoc, CollapsedNum, Clauses.size());
734 Dir->setClauses(Clauses);
735 Dir->setAssociatedStmt(AssociatedStmt);
736 Dir->setIterationVariable(Exprs.IterationVarRef);
737 Dir->setLastIteration(Exprs.LastIteration);
738 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
739 Dir->setPreCond(Exprs.PreCond);
740 Dir->setCond(Exprs.Cond);
741 Dir->setInit(Exprs.Init);
742 Dir->setInc(Exprs.Inc);
743 Dir->setIsLastIterVariable(Exprs.IL);
744 Dir->setLowerBoundVariable(Exprs.LB);
745 Dir->setUpperBoundVariable(Exprs.UB);
746 Dir->setStrideVariable(Exprs.ST);
747 Dir->setEnsureUpperBound(Exprs.EUB);
748 Dir->setNextLowerBound(Exprs.NLB);
749 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000750 Dir->setNumIterations(Exprs.NumIterations);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000751 Dir->setCounters(Exprs.Counters);
752 Dir->setPrivateCounters(Exprs.PrivateCounters);
753 Dir->setInits(Exprs.Inits);
754 Dir->setUpdates(Exprs.Updates);
755 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000756 Dir->setPreInits(Exprs.PreInits);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000757 Dir->setHasCancel(HasCancel);
758 return Dir;
759}
760
761OMPTargetParallelForDirective *
762OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
763 unsigned NumClauses,
764 unsigned CollapsedNum, EmptyShell) {
765 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000766 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000767 void *Mem = C.Allocate(
768 Size + sizeof(OMPClause *) * NumClauses +
769 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
770 return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses);
771}
772
James Y Knightb8bfd962015-10-02 13:41:04 +0000773OMPTargetDataDirective *OMPTargetDataDirective::Create(
774 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
775 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000776 void *Mem = C.Allocate(
777 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
778 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000779 OMPTargetDataDirective *Dir =
780 new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size());
781 Dir->setClauses(Clauses);
782 Dir->setAssociatedStmt(AssociatedStmt);
783 return Dir;
784}
785
786OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
787 unsigned N,
788 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000789 void *Mem = C.Allocate(
790 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
791 sizeof(OMPClause *) * N + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000792 return new (Mem) OMPTargetDataDirective(N);
793}
794
Samuel Antaodf67fc42016-01-19 19:15:56 +0000795OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
796 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
Alexey Bataev7828b252017-11-21 17:08:48 +0000797 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000798 void *Mem = C.Allocate(
799 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000800 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
Samuel Antaodf67fc42016-01-19 19:15:56 +0000801 OMPTargetEnterDataDirective *Dir =
802 new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size());
803 Dir->setClauses(Clauses);
Alexey Bataev7828b252017-11-21 17:08:48 +0000804 Dir->setAssociatedStmt(AssociatedStmt);
Samuel Antaodf67fc42016-01-19 19:15:56 +0000805 return Dir;
806}
807
808OMPTargetEnterDataDirective *
809OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
810 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000811 void *Mem = C.Allocate(
812 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000813 sizeof(OMPClause *) * N + sizeof(Stmt *));
Samuel Antaodf67fc42016-01-19 19:15:56 +0000814 return new (Mem) OMPTargetEnterDataDirective(N);
815}
816
Alexey Bataev7828b252017-11-21 17:08:48 +0000817OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create(
818 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
819 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000820 void *Mem = C.Allocate(
821 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000822 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
Samuel Antao72590762016-01-19 20:04:50 +0000823 OMPTargetExitDataDirective *Dir =
824 new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size());
825 Dir->setClauses(Clauses);
Alexey Bataev7828b252017-11-21 17:08:48 +0000826 Dir->setAssociatedStmt(AssociatedStmt);
Samuel Antao72590762016-01-19 20:04:50 +0000827 return Dir;
828}
829
830OMPTargetExitDataDirective *
831OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
832 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000833 void *Mem = C.Allocate(
834 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000835 sizeof(OMPClause *) * N + sizeof(Stmt *));
Samuel Antao72590762016-01-19 20:04:50 +0000836 return new (Mem) OMPTargetExitDataDirective(N);
837}
838
James Y Knightb8bfd962015-10-02 13:41:04 +0000839OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
840 SourceLocation StartLoc,
841 SourceLocation EndLoc,
842 ArrayRef<OMPClause *> Clauses,
843 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000844 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000845 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000846 void *Mem =
847 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
848 OMPTeamsDirective *Dir =
849 new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size());
850 Dir->setClauses(Clauses);
851 Dir->setAssociatedStmt(AssociatedStmt);
852 return Dir;
853}
854
855OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
856 unsigned NumClauses,
857 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000858 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000859 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000860 void *Mem =
861 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
862 return new (Mem) OMPTeamsDirective(NumClauses);
863}
Alexey Bataev49f6e782015-12-01 04:18:41 +0000864
865OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
866 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
867 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
868 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000869 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000870 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000871 void *Mem =
872 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
873 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
874 OMPTaskLoopDirective *Dir = new (Mem)
875 OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
876 Dir->setClauses(Clauses);
877 Dir->setAssociatedStmt(AssociatedStmt);
878 Dir->setIterationVariable(Exprs.IterationVarRef);
879 Dir->setLastIteration(Exprs.LastIteration);
880 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
881 Dir->setPreCond(Exprs.PreCond);
882 Dir->setCond(Exprs.Cond);
883 Dir->setInit(Exprs.Init);
884 Dir->setInc(Exprs.Inc);
885 Dir->setIsLastIterVariable(Exprs.IL);
886 Dir->setLowerBoundVariable(Exprs.LB);
887 Dir->setUpperBoundVariable(Exprs.UB);
888 Dir->setStrideVariable(Exprs.ST);
889 Dir->setEnsureUpperBound(Exprs.EUB);
890 Dir->setNextLowerBound(Exprs.NLB);
891 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000892 Dir->setNumIterations(Exprs.NumIterations);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000893 Dir->setCounters(Exprs.Counters);
894 Dir->setPrivateCounters(Exprs.PrivateCounters);
895 Dir->setInits(Exprs.Inits);
896 Dir->setUpdates(Exprs.Updates);
897 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000898 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000899 return Dir;
900}
901
902OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
903 unsigned NumClauses,
904 unsigned CollapsedNum,
905 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000906 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000907 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000908 void *Mem =
909 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
910 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
911 return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses);
912}
913
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000914OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
915 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
916 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
917 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000918 unsigned Size =
919 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000920 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
921 sizeof(Stmt *) *
922 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
923 OMPTaskLoopSimdDirective *Dir = new (Mem)
924 OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
925 Dir->setClauses(Clauses);
926 Dir->setAssociatedStmt(AssociatedStmt);
927 Dir->setIterationVariable(Exprs.IterationVarRef);
928 Dir->setLastIteration(Exprs.LastIteration);
929 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
930 Dir->setPreCond(Exprs.PreCond);
931 Dir->setCond(Exprs.Cond);
932 Dir->setInit(Exprs.Init);
933 Dir->setInc(Exprs.Inc);
934 Dir->setIsLastIterVariable(Exprs.IL);
935 Dir->setLowerBoundVariable(Exprs.LB);
936 Dir->setUpperBoundVariable(Exprs.UB);
937 Dir->setStrideVariable(Exprs.ST);
938 Dir->setEnsureUpperBound(Exprs.EUB);
939 Dir->setNextLowerBound(Exprs.NLB);
940 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000941 Dir->setNumIterations(Exprs.NumIterations);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000942 Dir->setCounters(Exprs.Counters);
943 Dir->setPrivateCounters(Exprs.PrivateCounters);
944 Dir->setInits(Exprs.Inits);
945 Dir->setUpdates(Exprs.Updates);
946 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000947 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000948 return Dir;
949}
950
951OMPTaskLoopSimdDirective *
952OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
953 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000954 unsigned Size =
955 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000956 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
957 sizeof(Stmt *) *
958 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
959 return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);
960}
961
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000962OMPDistributeDirective *OMPDistributeDirective::Create(
963 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
964 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
965 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000966 unsigned Size =
967 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000968 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
969 sizeof(Stmt *) *
970 numLoopChildren(CollapsedNum, OMPD_distribute));
971 OMPDistributeDirective *Dir = new (Mem)
972 OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
973 Dir->setClauses(Clauses);
974 Dir->setAssociatedStmt(AssociatedStmt);
975 Dir->setIterationVariable(Exprs.IterationVarRef);
976 Dir->setLastIteration(Exprs.LastIteration);
977 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
978 Dir->setPreCond(Exprs.PreCond);
979 Dir->setCond(Exprs.Cond);
980 Dir->setInit(Exprs.Init);
981 Dir->setInc(Exprs.Inc);
982 Dir->setIsLastIterVariable(Exprs.IL);
983 Dir->setLowerBoundVariable(Exprs.LB);
984 Dir->setUpperBoundVariable(Exprs.UB);
985 Dir->setStrideVariable(Exprs.ST);
986 Dir->setEnsureUpperBound(Exprs.EUB);
987 Dir->setNextLowerBound(Exprs.NLB);
988 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000989 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000990 Dir->setCounters(Exprs.Counters);
991 Dir->setPrivateCounters(Exprs.PrivateCounters);
992 Dir->setInits(Exprs.Inits);
993 Dir->setUpdates(Exprs.Updates);
994 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000995 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000996 return Dir;
997}
998
999OMPDistributeDirective *
1000OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1001 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001002 unsigned Size =
1003 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001004 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1005 sizeof(Stmt *) *
1006 numLoopChildren(CollapsedNum, OMPD_distribute));
1007 return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);
1008}
Samuel Antao686c70c2016-05-26 17:30:50 +00001009
Alexey Bataev7828b252017-11-21 17:08:48 +00001010OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create(
1011 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1012 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001013 unsigned Size =
1014 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Alexey Bataev7828b252017-11-21 17:08:48 +00001015 void *Mem =
1016 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001017 OMPTargetUpdateDirective *Dir =
1018 new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size());
1019 Dir->setClauses(Clauses);
Alexey Bataev7828b252017-11-21 17:08:48 +00001020 Dir->setAssociatedStmt(AssociatedStmt);
Samuel Antao686c70c2016-05-26 17:30:50 +00001021 return Dir;
1022}
1023
1024OMPTargetUpdateDirective *
1025OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1026 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001027 unsigned Size =
1028 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Alexey Bataev7828b252017-11-21 17:08:48 +00001029 void *Mem =
1030 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001031 return new (Mem) OMPTargetUpdateDirective(NumClauses);
1032}
Carlo Bertolli9925f152016-06-27 14:55:37 +00001033
1034OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1035 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1036 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001037 const HelperExprs &Exprs, bool HasCancel) {
Carlo Bertolli9925f152016-06-27 14:55:37 +00001038 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001039 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001040 void *Mem = C.Allocate(
1041 Size + sizeof(OMPClause *) * Clauses.size() +
1042 sizeof(Stmt *) *
1043 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1044 OMPDistributeParallelForDirective *Dir =
1045 new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc,
1046 CollapsedNum, Clauses.size());
1047 Dir->setClauses(Clauses);
1048 Dir->setAssociatedStmt(AssociatedStmt);
1049 Dir->setIterationVariable(Exprs.IterationVarRef);
1050 Dir->setLastIteration(Exprs.LastIteration);
1051 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1052 Dir->setPreCond(Exprs.PreCond);
1053 Dir->setCond(Exprs.Cond);
1054 Dir->setInit(Exprs.Init);
1055 Dir->setInc(Exprs.Inc);
1056 Dir->setIsLastIterVariable(Exprs.IL);
1057 Dir->setLowerBoundVariable(Exprs.LB);
1058 Dir->setUpperBoundVariable(Exprs.UB);
1059 Dir->setStrideVariable(Exprs.ST);
1060 Dir->setEnsureUpperBound(Exprs.EUB);
1061 Dir->setNextLowerBound(Exprs.NLB);
1062 Dir->setNextUpperBound(Exprs.NUB);
1063 Dir->setNumIterations(Exprs.NumIterations);
1064 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1065 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001066 Dir->setDistInc(Exprs.DistInc);
1067 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Carlo Bertolli9925f152016-06-27 14:55:37 +00001068 Dir->setCounters(Exprs.Counters);
1069 Dir->setPrivateCounters(Exprs.PrivateCounters);
1070 Dir->setInits(Exprs.Inits);
1071 Dir->setUpdates(Exprs.Updates);
1072 Dir->setFinals(Exprs.Finals);
1073 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001074 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1075 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1076 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1077 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1078 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1079 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1080 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001081 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1082 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001083 Dir->HasCancel = HasCancel;
Carlo Bertolli9925f152016-06-27 14:55:37 +00001084 return Dir;
1085}
1086
1087OMPDistributeParallelForDirective *
1088OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1089 unsigned NumClauses,
1090 unsigned CollapsedNum,
1091 EmptyShell) {
1092 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001093 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001094 void *Mem = C.Allocate(
1095 Size + sizeof(OMPClause *) * NumClauses +
1096 sizeof(Stmt *) *
1097 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1098 return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses);
1099}
Kelvin Li4a39add2016-07-05 05:00:15 +00001100
1101OMPDistributeParallelForSimdDirective *
1102OMPDistributeParallelForSimdDirective::Create(
1103 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1104 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1105 const HelperExprs &Exprs) {
1106 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001107 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001108 void *Mem = C.Allocate(
1109 Size + sizeof(OMPClause *) * Clauses.size() +
1110 sizeof(Stmt *) *
1111 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1112 OMPDistributeParallelForSimdDirective *Dir = new (Mem)
1113 OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1114 Clauses.size());
1115 Dir->setClauses(Clauses);
1116 Dir->setAssociatedStmt(AssociatedStmt);
1117 Dir->setIterationVariable(Exprs.IterationVarRef);
1118 Dir->setLastIteration(Exprs.LastIteration);
1119 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1120 Dir->setPreCond(Exprs.PreCond);
1121 Dir->setCond(Exprs.Cond);
1122 Dir->setInit(Exprs.Init);
1123 Dir->setInc(Exprs.Inc);
1124 Dir->setIsLastIterVariable(Exprs.IL);
1125 Dir->setLowerBoundVariable(Exprs.LB);
1126 Dir->setUpperBoundVariable(Exprs.UB);
1127 Dir->setStrideVariable(Exprs.ST);
1128 Dir->setEnsureUpperBound(Exprs.EUB);
1129 Dir->setNextLowerBound(Exprs.NLB);
1130 Dir->setNextUpperBound(Exprs.NUB);
1131 Dir->setNumIterations(Exprs.NumIterations);
1132 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1133 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001134 Dir->setDistInc(Exprs.DistInc);
1135 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li4a39add2016-07-05 05:00:15 +00001136 Dir->setCounters(Exprs.Counters);
1137 Dir->setPrivateCounters(Exprs.PrivateCounters);
1138 Dir->setInits(Exprs.Inits);
1139 Dir->setUpdates(Exprs.Updates);
1140 Dir->setFinals(Exprs.Finals);
1141 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001142 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1143 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1144 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1145 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1146 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1147 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1148 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001149 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1150 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Kelvin Li4a39add2016-07-05 05:00:15 +00001151 return Dir;
1152}
1153
1154OMPDistributeParallelForSimdDirective *
1155OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1156 unsigned NumClauses,
1157 unsigned CollapsedNum,
1158 EmptyShell) {
1159 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001160 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001161 void *Mem = C.Allocate(
1162 Size + sizeof(OMPClause *) * NumClauses +
1163 sizeof(Stmt *) *
1164 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1165 return new (Mem)
1166 OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1167}
Kelvin Li787f3fc2016-07-06 04:45:38 +00001168
1169OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1170 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1171 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1172 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001173 unsigned Size =
1174 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001175 void *Mem = C.Allocate(
1176 Size + sizeof(OMPClause *) * Clauses.size() +
1177 sizeof(Stmt *) *
1178 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1179 OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective(
1180 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1181 Dir->setClauses(Clauses);
1182 Dir->setAssociatedStmt(AssociatedStmt);
1183 Dir->setIterationVariable(Exprs.IterationVarRef);
1184 Dir->setLastIteration(Exprs.LastIteration);
1185 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1186 Dir->setPreCond(Exprs.PreCond);
1187 Dir->setCond(Exprs.Cond);
1188 Dir->setInit(Exprs.Init);
1189 Dir->setInc(Exprs.Inc);
1190 Dir->setIsLastIterVariable(Exprs.IL);
1191 Dir->setLowerBoundVariable(Exprs.LB);
1192 Dir->setUpperBoundVariable(Exprs.UB);
1193 Dir->setStrideVariable(Exprs.ST);
1194 Dir->setEnsureUpperBound(Exprs.EUB);
1195 Dir->setNextLowerBound(Exprs.NLB);
1196 Dir->setNextUpperBound(Exprs.NUB);
1197 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li787f3fc2016-07-06 04:45:38 +00001198 Dir->setCounters(Exprs.Counters);
1199 Dir->setPrivateCounters(Exprs.PrivateCounters);
1200 Dir->setInits(Exprs.Inits);
1201 Dir->setUpdates(Exprs.Updates);
1202 Dir->setFinals(Exprs.Finals);
1203 Dir->setPreInits(Exprs.PreInits);
1204 return Dir;
1205}
1206
1207OMPDistributeSimdDirective *
1208OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1209 unsigned NumClauses,
1210 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001211 unsigned Size =
1212 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001213 void *Mem = C.Allocate(
1214 Size + sizeof(OMPClause *) * NumClauses +
1215 sizeof(Stmt *) *
1216 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1217 return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses);
1218}
Kelvin Lia579b912016-07-14 02:54:56 +00001219
1220OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1221 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1222 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1223 const HelperExprs &Exprs) {
1224 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001225 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001226 void *Mem = C.Allocate(
1227 Size + sizeof(OMPClause *) * Clauses.size() +
Fangrui Song6907ce22018-07-30 19:24:48 +00001228 sizeof(Stmt *) *
Kelvin Lia579b912016-07-14 02:54:56 +00001229 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
Fangrui Song6907ce22018-07-30 19:24:48 +00001230 OMPTargetParallelForSimdDirective *Dir =
Kelvin Lia579b912016-07-14 02:54:56 +00001231 new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc,
1232 CollapsedNum, Clauses.size());
1233 Dir->setClauses(Clauses);
1234 Dir->setAssociatedStmt(AssociatedStmt);
1235 Dir->setIterationVariable(Exprs.IterationVarRef);
1236 Dir->setLastIteration(Exprs.LastIteration);
1237 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1238 Dir->setPreCond(Exprs.PreCond);
1239 Dir->setCond(Exprs.Cond);
1240 Dir->setInit(Exprs.Init);
1241 Dir->setInc(Exprs.Inc);
1242 Dir->setIsLastIterVariable(Exprs.IL);
1243 Dir->setLowerBoundVariable(Exprs.LB);
1244 Dir->setUpperBoundVariable(Exprs.UB);
1245 Dir->setStrideVariable(Exprs.ST);
1246 Dir->setEnsureUpperBound(Exprs.EUB);
1247 Dir->setNextLowerBound(Exprs.NLB);
1248 Dir->setNextUpperBound(Exprs.NUB);
1249 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Lia579b912016-07-14 02:54:56 +00001250 Dir->setCounters(Exprs.Counters);
1251 Dir->setPrivateCounters(Exprs.PrivateCounters);
1252 Dir->setInits(Exprs.Inits);
1253 Dir->setUpdates(Exprs.Updates);
1254 Dir->setFinals(Exprs.Finals);
1255 Dir->setPreInits(Exprs.PreInits);
1256 return Dir;
1257}
1258
1259OMPTargetParallelForSimdDirective *
1260OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1261 unsigned NumClauses,
1262 unsigned CollapsedNum,
1263 EmptyShell) {
1264 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001265 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001266 void *Mem = C.Allocate(
1267 Size + sizeof(OMPClause *) * NumClauses +
Fangrui Song6907ce22018-07-30 19:24:48 +00001268 sizeof(Stmt *) *
Kelvin Lia579b912016-07-14 02:54:56 +00001269 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1270 return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses);
1271}
Kelvin Li986330c2016-07-20 22:57:10 +00001272
1273OMPTargetSimdDirective *
Fangrui Song6907ce22018-07-30 19:24:48 +00001274OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
Kelvin Li986330c2016-07-20 22:57:10 +00001275 SourceLocation EndLoc, unsigned CollapsedNum,
1276 ArrayRef<OMPClause *> Clauses,
1277 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001278 unsigned Size =
1279 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001280 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
Fangrui Song6907ce22018-07-30 19:24:48 +00001281 sizeof(Stmt *) *
Kelvin Li986330c2016-07-20 22:57:10 +00001282 numLoopChildren(CollapsedNum, OMPD_target_simd));
1283 OMPTargetSimdDirective *Dir = new (Mem)
1284 OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1285 Dir->setClauses(Clauses);
1286 Dir->setAssociatedStmt(AssociatedStmt);
1287 Dir->setIterationVariable(Exprs.IterationVarRef);
1288 Dir->setLastIteration(Exprs.LastIteration);
1289 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1290 Dir->setPreCond(Exprs.PreCond);
1291 Dir->setCond(Exprs.Cond);
1292 Dir->setInit(Exprs.Init);
1293 Dir->setInc(Exprs.Inc);
1294 Dir->setCounters(Exprs.Counters);
1295 Dir->setPrivateCounters(Exprs.PrivateCounters);
1296 Dir->setInits(Exprs.Inits);
1297 Dir->setUpdates(Exprs.Updates);
1298 Dir->setFinals(Exprs.Finals);
1299 Dir->setPreInits(Exprs.PreInits);
1300 return Dir;
1301}
1302
1303OMPTargetSimdDirective *
1304OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1305 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001306 unsigned Size =
1307 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001308 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
Fangrui Song6907ce22018-07-30 19:24:48 +00001309 sizeof(Stmt *) *
Kelvin Li986330c2016-07-20 22:57:10 +00001310 numLoopChildren(CollapsedNum, OMPD_target_simd));
1311 return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses);
1312}
Kelvin Li02532872016-08-05 14:37:37 +00001313
1314OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1315 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1316 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1317 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001318 unsigned Size =
1319 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001320 void *Mem = C.Allocate(
1321 Size + sizeof(OMPClause *) * Clauses.size() +
1322 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1323 OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective(
1324 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1325 Dir->setClauses(Clauses);
1326 Dir->setAssociatedStmt(AssociatedStmt);
1327 Dir->setIterationVariable(Exprs.IterationVarRef);
1328 Dir->setLastIteration(Exprs.LastIteration);
1329 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1330 Dir->setPreCond(Exprs.PreCond);
1331 Dir->setCond(Exprs.Cond);
1332 Dir->setInit(Exprs.Init);
1333 Dir->setInc(Exprs.Inc);
1334 Dir->setIsLastIterVariable(Exprs.IL);
1335 Dir->setLowerBoundVariable(Exprs.LB);
1336 Dir->setUpperBoundVariable(Exprs.UB);
1337 Dir->setStrideVariable(Exprs.ST);
1338 Dir->setEnsureUpperBound(Exprs.EUB);
1339 Dir->setNextLowerBound(Exprs.NLB);
1340 Dir->setNextUpperBound(Exprs.NUB);
1341 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li02532872016-08-05 14:37:37 +00001342 Dir->setCounters(Exprs.Counters);
1343 Dir->setPrivateCounters(Exprs.PrivateCounters);
1344 Dir->setInits(Exprs.Inits);
1345 Dir->setUpdates(Exprs.Updates);
1346 Dir->setFinals(Exprs.Finals);
1347 Dir->setPreInits(Exprs.PreInits);
1348 return Dir;
1349}
1350
1351OMPTeamsDistributeDirective *
1352OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1353 unsigned NumClauses,
1354 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001355 unsigned Size =
1356 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001357 void *Mem = C.Allocate(
1358 Size + sizeof(OMPClause *) * NumClauses +
1359 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1360 return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses);
1361}
Kelvin Li4e325f72016-10-25 12:50:55 +00001362
1363OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1364 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1365 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1366 const HelperExprs &Exprs) {
1367 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1368 alignof(OMPClause *));
1369 void *Mem =
1370 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1371 sizeof(Stmt *) *
1372 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1373 OMPTeamsDistributeSimdDirective *Dir =
1374 new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1375 Clauses.size());
1376 Dir->setClauses(Clauses);
1377 Dir->setAssociatedStmt(AssociatedStmt);
1378 Dir->setIterationVariable(Exprs.IterationVarRef);
1379 Dir->setLastIteration(Exprs.LastIteration);
1380 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1381 Dir->setPreCond(Exprs.PreCond);
1382 Dir->setCond(Exprs.Cond);
1383 Dir->setInit(Exprs.Init);
1384 Dir->setInc(Exprs.Inc);
1385 Dir->setIsLastIterVariable(Exprs.IL);
1386 Dir->setLowerBoundVariable(Exprs.LB);
1387 Dir->setUpperBoundVariable(Exprs.UB);
1388 Dir->setStrideVariable(Exprs.ST);
1389 Dir->setEnsureUpperBound(Exprs.EUB);
1390 Dir->setNextLowerBound(Exprs.NLB);
1391 Dir->setNextUpperBound(Exprs.NUB);
1392 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li4e325f72016-10-25 12:50:55 +00001393 Dir->setCounters(Exprs.Counters);
1394 Dir->setPrivateCounters(Exprs.PrivateCounters);
1395 Dir->setInits(Exprs.Inits);
1396 Dir->setUpdates(Exprs.Updates);
1397 Dir->setFinals(Exprs.Finals);
1398 Dir->setPreInits(Exprs.PreInits);
1399 return Dir;
1400}
1401
1402OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1403 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1404 EmptyShell) {
1405 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1406 alignof(OMPClause *));
1407 void *Mem =
1408 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1409 sizeof(Stmt *) *
1410 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1411 return new (Mem) OMPTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1412}
Kelvin Li579e41c2016-11-30 23:51:03 +00001413
1414OMPTeamsDistributeParallelForSimdDirective *
1415OMPTeamsDistributeParallelForSimdDirective::Create(
1416 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1417 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1418 const HelperExprs &Exprs) {
1419 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1420 alignof(OMPClause *));
1421 void *Mem =
1422 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1423 sizeof(Stmt *) *
1424 numLoopChildren(CollapsedNum,
1425 OMPD_teams_distribute_parallel_for_simd));
1426 OMPTeamsDistributeParallelForSimdDirective *Dir = new (Mem)
1427 OMPTeamsDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1428 Clauses.size());
1429 Dir->setClauses(Clauses);
1430 Dir->setAssociatedStmt(AssociatedStmt);
1431 Dir->setIterationVariable(Exprs.IterationVarRef);
1432 Dir->setLastIteration(Exprs.LastIteration);
1433 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1434 Dir->setPreCond(Exprs.PreCond);
1435 Dir->setCond(Exprs.Cond);
1436 Dir->setInit(Exprs.Init);
1437 Dir->setInc(Exprs.Inc);
1438 Dir->setIsLastIterVariable(Exprs.IL);
1439 Dir->setLowerBoundVariable(Exprs.LB);
1440 Dir->setUpperBoundVariable(Exprs.UB);
1441 Dir->setStrideVariable(Exprs.ST);
1442 Dir->setEnsureUpperBound(Exprs.EUB);
1443 Dir->setNextLowerBound(Exprs.NLB);
1444 Dir->setNextUpperBound(Exprs.NUB);
1445 Dir->setNumIterations(Exprs.NumIterations);
1446 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1447 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001448 Dir->setDistInc(Exprs.DistInc);
1449 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li579e41c2016-11-30 23:51:03 +00001450 Dir->setCounters(Exprs.Counters);
1451 Dir->setPrivateCounters(Exprs.PrivateCounters);
1452 Dir->setInits(Exprs.Inits);
1453 Dir->setUpdates(Exprs.Updates);
1454 Dir->setFinals(Exprs.Finals);
1455 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001456 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1457 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1458 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1459 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1460 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1461 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1462 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001463 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1464 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Kelvin Li579e41c2016-11-30 23:51:03 +00001465 return Dir;
1466}
1467
1468OMPTeamsDistributeParallelForSimdDirective *
1469OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1470 unsigned NumClauses,
1471 unsigned CollapsedNum,
1472 EmptyShell) {
1473 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1474 alignof(OMPClause *));
1475 void *Mem =
1476 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1477 sizeof(Stmt *) *
1478 numLoopChildren(CollapsedNum,
1479 OMPD_teams_distribute_parallel_for_simd));
1480 return new (Mem)
1481 OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1482}
Kelvin Li7ade93f2016-12-09 03:24:30 +00001483
1484OMPTeamsDistributeParallelForDirective *
1485OMPTeamsDistributeParallelForDirective::Create(
1486 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1487 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001488 const HelperExprs &Exprs, bool HasCancel) {
Kelvin Li7ade93f2016-12-09 03:24:30 +00001489 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1490 alignof(OMPClause *));
1491 void *Mem = C.Allocate(
1492 Size + sizeof(OMPClause *) * Clauses.size() +
1493 sizeof(Stmt *) *
1494 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1495 OMPTeamsDistributeParallelForDirective *Dir = new (Mem)
1496 OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum,
1497 Clauses.size());
1498 Dir->setClauses(Clauses);
1499 Dir->setAssociatedStmt(AssociatedStmt);
1500 Dir->setIterationVariable(Exprs.IterationVarRef);
1501 Dir->setLastIteration(Exprs.LastIteration);
1502 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1503 Dir->setPreCond(Exprs.PreCond);
1504 Dir->setCond(Exprs.Cond);
1505 Dir->setInit(Exprs.Init);
1506 Dir->setInc(Exprs.Inc);
1507 Dir->setIsLastIterVariable(Exprs.IL);
1508 Dir->setLowerBoundVariable(Exprs.LB);
1509 Dir->setUpperBoundVariable(Exprs.UB);
1510 Dir->setStrideVariable(Exprs.ST);
1511 Dir->setEnsureUpperBound(Exprs.EUB);
1512 Dir->setNextLowerBound(Exprs.NLB);
1513 Dir->setNextUpperBound(Exprs.NUB);
1514 Dir->setNumIterations(Exprs.NumIterations);
1515 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1516 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001517 Dir->setDistInc(Exprs.DistInc);
1518 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li7ade93f2016-12-09 03:24:30 +00001519 Dir->setCounters(Exprs.Counters);
1520 Dir->setPrivateCounters(Exprs.PrivateCounters);
1521 Dir->setInits(Exprs.Inits);
1522 Dir->setUpdates(Exprs.Updates);
1523 Dir->setFinals(Exprs.Finals);
1524 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001525 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1526 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1527 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1528 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1529 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1530 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1531 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001532 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1533 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001534 Dir->HasCancel = HasCancel;
Kelvin Li7ade93f2016-12-09 03:24:30 +00001535 return Dir;
1536}
1537
1538OMPTeamsDistributeParallelForDirective *
1539OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1540 unsigned NumClauses,
1541 unsigned CollapsedNum,
1542 EmptyShell) {
1543 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1544 alignof(OMPClause *));
1545 void *Mem = C.Allocate(
1546 Size + sizeof(OMPClause *) * NumClauses +
1547 sizeof(Stmt *) *
1548 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1549 return new (Mem)
1550 OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1551}
1552
Kelvin Libf594a52016-12-17 05:48:59 +00001553OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1554 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1555 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1556 auto Size =
1557 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1558 void *Mem =
1559 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
1560 OMPTargetTeamsDirective *Dir =
1561 new (Mem) OMPTargetTeamsDirective(StartLoc, EndLoc, Clauses.size());
1562 Dir->setClauses(Clauses);
1563 Dir->setAssociatedStmt(AssociatedStmt);
1564 return Dir;
1565}
1566
1567OMPTargetTeamsDirective *
1568OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1569 EmptyShell) {
1570 auto Size =
1571 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1572 void *Mem =
1573 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1574 return new (Mem) OMPTargetTeamsDirective(NumClauses);
1575}
Kelvin Li83c451e2016-12-25 04:52:54 +00001576
1577OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
1578 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1579 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1580 const HelperExprs &Exprs) {
1581 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1582 alignof(OMPClause *));
1583 void *Mem = C.Allocate(
1584 Size + sizeof(OMPClause *) * Clauses.size() +
1585 sizeof(Stmt *) *
1586 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1587 OMPTargetTeamsDistributeDirective *Dir =
1588 new (Mem) OMPTargetTeamsDistributeDirective(StartLoc, EndLoc, CollapsedNum,
1589 Clauses.size());
1590 Dir->setClauses(Clauses);
1591 Dir->setAssociatedStmt(AssociatedStmt);
1592 Dir->setIterationVariable(Exprs.IterationVarRef);
1593 Dir->setLastIteration(Exprs.LastIteration);
1594 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1595 Dir->setPreCond(Exprs.PreCond);
1596 Dir->setCond(Exprs.Cond);
1597 Dir->setInit(Exprs.Init);
1598 Dir->setInc(Exprs.Inc);
1599 Dir->setIsLastIterVariable(Exprs.IL);
1600 Dir->setLowerBoundVariable(Exprs.LB);
1601 Dir->setUpperBoundVariable(Exprs.UB);
1602 Dir->setStrideVariable(Exprs.ST);
1603 Dir->setEnsureUpperBound(Exprs.EUB);
1604 Dir->setNextLowerBound(Exprs.NLB);
1605 Dir->setNextUpperBound(Exprs.NUB);
1606 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li83c451e2016-12-25 04:52:54 +00001607 Dir->setCounters(Exprs.Counters);
1608 Dir->setPrivateCounters(Exprs.PrivateCounters);
1609 Dir->setInits(Exprs.Inits);
1610 Dir->setUpdates(Exprs.Updates);
1611 Dir->setFinals(Exprs.Finals);
1612 Dir->setPreInits(Exprs.PreInits);
1613 return Dir;
1614}
1615
1616OMPTargetTeamsDistributeDirective *
1617OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1618 unsigned NumClauses,
1619 unsigned CollapsedNum,
1620 EmptyShell) {
1621 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1622 alignof(OMPClause *));
1623 void *Mem = C.Allocate(
1624 Size + sizeof(OMPClause *) * NumClauses +
1625 sizeof(Stmt *) *
1626 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1627 return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses);
1628}
Kelvin Li80e8f562016-12-29 22:16:30 +00001629
1630OMPTargetTeamsDistributeParallelForDirective *
1631OMPTargetTeamsDistributeParallelForDirective::Create(
1632 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1633 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
Alexey Bataev16e79882017-11-22 21:12:03 +00001634 const HelperExprs &Exprs, bool HasCancel) {
Kelvin Li80e8f562016-12-29 22:16:30 +00001635 auto Size =
1636 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1637 alignof(OMPClause *));
1638 void *Mem = C.Allocate(
1639 Size + sizeof(OMPClause *) * Clauses.size() +
1640 sizeof(Stmt *) *
1641 numLoopChildren(CollapsedNum,
1642 OMPD_target_teams_distribute_parallel_for));
1643 OMPTargetTeamsDistributeParallelForDirective *Dir =
1644 new (Mem) OMPTargetTeamsDistributeParallelForDirective(
1645 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1646 Dir->setClauses(Clauses);
1647 Dir->setAssociatedStmt(AssociatedStmt);
1648 Dir->setIterationVariable(Exprs.IterationVarRef);
1649 Dir->setLastIteration(Exprs.LastIteration);
1650 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1651 Dir->setPreCond(Exprs.PreCond);
1652 Dir->setCond(Exprs.Cond);
1653 Dir->setInit(Exprs.Init);
1654 Dir->setInc(Exprs.Inc);
1655 Dir->setIsLastIterVariable(Exprs.IL);
1656 Dir->setLowerBoundVariable(Exprs.LB);
1657 Dir->setUpperBoundVariable(Exprs.UB);
1658 Dir->setStrideVariable(Exprs.ST);
1659 Dir->setEnsureUpperBound(Exprs.EUB);
1660 Dir->setNextLowerBound(Exprs.NLB);
1661 Dir->setNextUpperBound(Exprs.NUB);
1662 Dir->setNumIterations(Exprs.NumIterations);
1663 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1664 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001665 Dir->setDistInc(Exprs.DistInc);
1666 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li80e8f562016-12-29 22:16:30 +00001667 Dir->setCounters(Exprs.Counters);
1668 Dir->setPrivateCounters(Exprs.PrivateCounters);
1669 Dir->setInits(Exprs.Inits);
1670 Dir->setUpdates(Exprs.Updates);
1671 Dir->setFinals(Exprs.Finals);
1672 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001673 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1674 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1675 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1676 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1677 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1678 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1679 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001680 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1681 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Alexey Bataev16e79882017-11-22 21:12:03 +00001682 Dir->HasCancel = HasCancel;
Kelvin Li80e8f562016-12-29 22:16:30 +00001683 return Dir;
1684}
1685
1686OMPTargetTeamsDistributeParallelForDirective *
1687OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1688 unsigned NumClauses,
1689 unsigned CollapsedNum,
1690 EmptyShell) {
1691 auto Size =
1692 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1693 alignof(OMPClause *));
1694 void *Mem = C.Allocate(
1695 Size + sizeof(OMPClause *) * NumClauses +
1696 sizeof(Stmt *) *
1697 numLoopChildren(CollapsedNum,
1698 OMPD_target_teams_distribute_parallel_for));
1699 return new (Mem)
1700 OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1701}
Kelvin Li1851df52017-01-03 05:23:48 +00001702
1703OMPTargetTeamsDistributeParallelForSimdDirective *
1704OMPTargetTeamsDistributeParallelForSimdDirective::Create(
1705 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1706 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1707 const HelperExprs &Exprs) {
1708 auto Size =
1709 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1710 alignof(OMPClause *));
1711 void *Mem = C.Allocate(
1712 Size + sizeof(OMPClause *) * Clauses.size() +
1713 sizeof(Stmt *) *
1714 numLoopChildren(CollapsedNum,
1715 OMPD_target_teams_distribute_parallel_for_simd));
1716 OMPTargetTeamsDistributeParallelForSimdDirective *Dir =
1717 new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1718 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1719 Dir->setClauses(Clauses);
1720 Dir->setAssociatedStmt(AssociatedStmt);
1721 Dir->setIterationVariable(Exprs.IterationVarRef);
1722 Dir->setLastIteration(Exprs.LastIteration);
1723 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1724 Dir->setPreCond(Exprs.PreCond);
1725 Dir->setCond(Exprs.Cond);
1726 Dir->setInit(Exprs.Init);
1727 Dir->setInc(Exprs.Inc);
1728 Dir->setIsLastIterVariable(Exprs.IL);
1729 Dir->setLowerBoundVariable(Exprs.LB);
1730 Dir->setUpperBoundVariable(Exprs.UB);
1731 Dir->setStrideVariable(Exprs.ST);
1732 Dir->setEnsureUpperBound(Exprs.EUB);
1733 Dir->setNextLowerBound(Exprs.NLB);
1734 Dir->setNextUpperBound(Exprs.NUB);
1735 Dir->setNumIterations(Exprs.NumIterations);
1736 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1737 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001738 Dir->setDistInc(Exprs.DistInc);
1739 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li1851df52017-01-03 05:23:48 +00001740 Dir->setCounters(Exprs.Counters);
1741 Dir->setPrivateCounters(Exprs.PrivateCounters);
1742 Dir->setInits(Exprs.Inits);
1743 Dir->setUpdates(Exprs.Updates);
1744 Dir->setFinals(Exprs.Finals);
1745 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001746 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1747 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1748 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1749 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1750 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1751 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1752 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001753 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1754 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Kelvin Li1851df52017-01-03 05:23:48 +00001755 return Dir;
1756}
1757
1758OMPTargetTeamsDistributeParallelForSimdDirective *
1759OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
1760 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1761 EmptyShell) {
1762 auto Size =
1763 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1764 alignof(OMPClause *));
1765 void *Mem = C.Allocate(
1766 Size + sizeof(OMPClause *) * NumClauses +
1767 sizeof(Stmt *) *
1768 numLoopChildren(CollapsedNum,
1769 OMPD_target_teams_distribute_parallel_for_simd));
1770 return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1771 CollapsedNum, NumClauses);
1772}
1773
Kelvin Lida681182017-01-10 18:08:18 +00001774OMPTargetTeamsDistributeSimdDirective *
1775OMPTargetTeamsDistributeSimdDirective::Create(
1776 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1777 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1778 const HelperExprs &Exprs) {
1779 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1780 alignof(OMPClause *));
1781 void *Mem = C.Allocate(
1782 Size + sizeof(OMPClause *) * Clauses.size() +
1783 sizeof(Stmt *) *
1784 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1785 OMPTargetTeamsDistributeSimdDirective *Dir = new (Mem)
1786 OMPTargetTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1787 Clauses.size());
1788 Dir->setClauses(Clauses);
1789 Dir->setAssociatedStmt(AssociatedStmt);
1790 Dir->setIterationVariable(Exprs.IterationVarRef);
1791 Dir->setLastIteration(Exprs.LastIteration);
1792 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1793 Dir->setPreCond(Exprs.PreCond);
1794 Dir->setCond(Exprs.Cond);
1795 Dir->setInit(Exprs.Init);
1796 Dir->setInc(Exprs.Inc);
1797 Dir->setIsLastIterVariable(Exprs.IL);
1798 Dir->setLowerBoundVariable(Exprs.LB);
1799 Dir->setUpperBoundVariable(Exprs.UB);
1800 Dir->setStrideVariable(Exprs.ST);
1801 Dir->setEnsureUpperBound(Exprs.EUB);
1802 Dir->setNextLowerBound(Exprs.NLB);
1803 Dir->setNextUpperBound(Exprs.NUB);
1804 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Lida681182017-01-10 18:08:18 +00001805 Dir->setCounters(Exprs.Counters);
1806 Dir->setPrivateCounters(Exprs.PrivateCounters);
1807 Dir->setInits(Exprs.Inits);
1808 Dir->setUpdates(Exprs.Updates);
1809 Dir->setFinals(Exprs.Finals);
1810 Dir->setPreInits(Exprs.PreInits);
1811 return Dir;
1812}
1813
1814OMPTargetTeamsDistributeSimdDirective *
1815OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1816 unsigned NumClauses,
1817 unsigned CollapsedNum,
1818 EmptyShell) {
1819 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1820 alignof(OMPClause *));
1821 void *Mem = C.Allocate(
1822 Size + sizeof(OMPClause *) * NumClauses +
1823 sizeof(Stmt *) *
1824 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1825 return new (Mem)
1826 OMPTargetTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1827}