blob: 72094077378f253867ee6a38122661a550c30be2 [file] [log] [blame]
James Y Knightb8bfd962015-10-02 13:41:04 +00001//===--- StmtOpenMP.cpp - Classes for OpenMP directives -------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the subclesses of Stmt class declared in StmtOpenMP.h
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/AST/StmtOpenMP.h"
15
16#include "clang/AST/ASTContext.h"
17
18using namespace clang;
19
20void OMPExecutableDirective::setClauses(ArrayRef<OMPClause *> Clauses) {
21 assert(Clauses.size() == getNumClauses() &&
22 "Number of clauses is not the same as the preallocated buffer");
23 std::copy(Clauses.begin(), Clauses.end(), getClauses().begin());
24}
25
26void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
27 assert(A.size() == getCollapsedNumber() &&
28 "Number of loop counters is not the same as the collapsed number");
29 std::copy(A.begin(), A.end(), getCounters().begin());
30}
31
32void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
33 assert(A.size() == getCollapsedNumber() && "Number of loop private counters "
34 "is not the same as the collapsed "
35 "number");
36 std::copy(A.begin(), A.end(), getPrivateCounters().begin());
37}
38
39void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
40 assert(A.size() == getCollapsedNumber() &&
41 "Number of counter inits is not the same as the collapsed number");
42 std::copy(A.begin(), A.end(), getInits().begin());
43}
44
45void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
46 assert(A.size() == getCollapsedNumber() &&
47 "Number of counter updates is not the same as the collapsed number");
48 std::copy(A.begin(), A.end(), getUpdates().begin());
49}
50
51void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
52 assert(A.size() == getCollapsedNumber() &&
53 "Number of counter finals is not the same as the collapsed number");
54 std::copy(A.begin(), A.end(), getFinals().begin());
55}
56
57OMPParallelDirective *OMPParallelDirective::Create(
58 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
59 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Rui Ueyama83aa9792016-01-14 21:00:27 +000060 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +000061 llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +000062 void *Mem =
63 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
64 OMPParallelDirective *Dir =
65 new (Mem) OMPParallelDirective(StartLoc, EndLoc, Clauses.size());
66 Dir->setClauses(Clauses);
67 Dir->setAssociatedStmt(AssociatedStmt);
68 Dir->setHasCancel(HasCancel);
69 return Dir;
70}
71
72OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
73 unsigned NumClauses,
74 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +000075 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +000076 llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +000077 void *Mem =
78 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
79 return new (Mem) OMPParallelDirective(NumClauses);
80}
81
82OMPSimdDirective *
83OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
84 SourceLocation EndLoc, unsigned CollapsedNum,
85 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
86 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +000087 unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +000088 void *Mem =
89 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
90 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
91 OMPSimdDirective *Dir = new (Mem)
92 OMPSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
93 Dir->setClauses(Clauses);
94 Dir->setAssociatedStmt(AssociatedStmt);
95 Dir->setIterationVariable(Exprs.IterationVarRef);
96 Dir->setLastIteration(Exprs.LastIteration);
97 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
98 Dir->setPreCond(Exprs.PreCond);
99 Dir->setCond(Exprs.Cond);
100 Dir->setInit(Exprs.Init);
101 Dir->setInc(Exprs.Inc);
102 Dir->setCounters(Exprs.Counters);
103 Dir->setPrivateCounters(Exprs.PrivateCounters);
104 Dir->setInits(Exprs.Inits);
105 Dir->setUpdates(Exprs.Updates);
106 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000107 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000108 return Dir;
109}
110
111OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C,
112 unsigned NumClauses,
113 unsigned CollapsedNum,
114 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000115 unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000116 void *Mem =
117 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
118 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
119 return new (Mem) OMPSimdDirective(CollapsedNum, NumClauses);
120}
121
122OMPForDirective *
123OMPForDirective::Create(const ASTContext &C, SourceLocation StartLoc,
124 SourceLocation EndLoc, unsigned CollapsedNum,
125 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
126 const HelperExprs &Exprs, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000127 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000128 void *Mem =
129 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
130 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
131 OMPForDirective *Dir =
132 new (Mem) OMPForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
133 Dir->setClauses(Clauses);
134 Dir->setAssociatedStmt(AssociatedStmt);
135 Dir->setIterationVariable(Exprs.IterationVarRef);
136 Dir->setLastIteration(Exprs.LastIteration);
137 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
138 Dir->setPreCond(Exprs.PreCond);
139 Dir->setCond(Exprs.Cond);
140 Dir->setInit(Exprs.Init);
141 Dir->setInc(Exprs.Inc);
142 Dir->setIsLastIterVariable(Exprs.IL);
143 Dir->setLowerBoundVariable(Exprs.LB);
144 Dir->setUpperBoundVariable(Exprs.UB);
145 Dir->setStrideVariable(Exprs.ST);
146 Dir->setEnsureUpperBound(Exprs.EUB);
147 Dir->setNextLowerBound(Exprs.NLB);
148 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000149 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000150 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
151 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
James Y Knightb8bfd962015-10-02 13:41:04 +0000152 Dir->setCounters(Exprs.Counters);
153 Dir->setPrivateCounters(Exprs.PrivateCounters);
154 Dir->setInits(Exprs.Inits);
155 Dir->setUpdates(Exprs.Updates);
156 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000157 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000158 Dir->setHasCancel(HasCancel);
159 return Dir;
160}
161
162OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
163 unsigned NumClauses,
164 unsigned CollapsedNum,
165 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000166 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000167 void *Mem =
168 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
169 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
170 return new (Mem) OMPForDirective(CollapsedNum, NumClauses);
171}
172
173OMPForSimdDirective *
174OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
175 SourceLocation EndLoc, unsigned CollapsedNum,
176 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
177 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000178 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000179 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000180 void *Mem =
181 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
182 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
183 OMPForSimdDirective *Dir = new (Mem)
184 OMPForSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
185 Dir->setClauses(Clauses);
186 Dir->setAssociatedStmt(AssociatedStmt);
187 Dir->setIterationVariable(Exprs.IterationVarRef);
188 Dir->setLastIteration(Exprs.LastIteration);
189 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
190 Dir->setPreCond(Exprs.PreCond);
191 Dir->setCond(Exprs.Cond);
192 Dir->setInit(Exprs.Init);
193 Dir->setInc(Exprs.Inc);
194 Dir->setIsLastIterVariable(Exprs.IL);
195 Dir->setLowerBoundVariable(Exprs.LB);
196 Dir->setUpperBoundVariable(Exprs.UB);
197 Dir->setStrideVariable(Exprs.ST);
198 Dir->setEnsureUpperBound(Exprs.EUB);
199 Dir->setNextLowerBound(Exprs.NLB);
200 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000201 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000202 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
203 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
James Y Knightb8bfd962015-10-02 13:41:04 +0000204 Dir->setCounters(Exprs.Counters);
205 Dir->setPrivateCounters(Exprs.PrivateCounters);
206 Dir->setInits(Exprs.Inits);
207 Dir->setUpdates(Exprs.Updates);
208 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000209 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000210 return Dir;
211}
212
213OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
214 unsigned NumClauses,
215 unsigned CollapsedNum,
216 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000217 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000218 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000219 void *Mem =
220 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
221 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
222 return new (Mem) OMPForSimdDirective(CollapsedNum, NumClauses);
223}
224
225OMPSectionsDirective *OMPSectionsDirective::Create(
226 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
227 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000228 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000229 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000230 void *Mem =
231 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
232 OMPSectionsDirective *Dir =
233 new (Mem) OMPSectionsDirective(StartLoc, EndLoc, Clauses.size());
234 Dir->setClauses(Clauses);
235 Dir->setAssociatedStmt(AssociatedStmt);
236 Dir->setHasCancel(HasCancel);
237 return Dir;
238}
239
240OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
241 unsigned NumClauses,
242 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000243 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000244 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000245 void *Mem =
246 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
247 return new (Mem) OMPSectionsDirective(NumClauses);
248}
249
250OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
251 SourceLocation StartLoc,
252 SourceLocation EndLoc,
253 Stmt *AssociatedStmt,
254 bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000255 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000256 void *Mem = C.Allocate(Size + sizeof(Stmt *));
257 OMPSectionDirective *Dir = new (Mem) OMPSectionDirective(StartLoc, EndLoc);
258 Dir->setAssociatedStmt(AssociatedStmt);
259 Dir->setHasCancel(HasCancel);
260 return Dir;
261}
262
263OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
264 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000265 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000266 void *Mem = C.Allocate(Size + sizeof(Stmt *));
267 return new (Mem) OMPSectionDirective();
268}
269
270OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
271 SourceLocation StartLoc,
272 SourceLocation EndLoc,
273 ArrayRef<OMPClause *> Clauses,
274 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000275 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000276 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000277 void *Mem =
278 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
279 OMPSingleDirective *Dir =
280 new (Mem) OMPSingleDirective(StartLoc, EndLoc, Clauses.size());
281 Dir->setClauses(Clauses);
282 Dir->setAssociatedStmt(AssociatedStmt);
283 return Dir;
284}
285
286OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
287 unsigned NumClauses,
288 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000289 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000290 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000291 void *Mem =
292 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
293 return new (Mem) OMPSingleDirective(NumClauses);
294}
295
296OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
297 SourceLocation StartLoc,
298 SourceLocation EndLoc,
299 Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000300 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000301 void *Mem = C.Allocate(Size + sizeof(Stmt *));
302 OMPMasterDirective *Dir = new (Mem) OMPMasterDirective(StartLoc, EndLoc);
303 Dir->setAssociatedStmt(AssociatedStmt);
304 return Dir;
305}
306
307OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
308 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000309 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000310 void *Mem = C.Allocate(Size + sizeof(Stmt *));
311 return new (Mem) OMPMasterDirective();
312}
313
314OMPCriticalDirective *OMPCriticalDirective::Create(
315 const ASTContext &C, const DeclarationNameInfo &Name,
Alexey Bataev28c75412015-12-15 08:19:24 +0000316 SourceLocation StartLoc, SourceLocation EndLoc,
317 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000318 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000319 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000320 void *Mem =
321 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000322 OMPCriticalDirective *Dir =
Alexey Bataev28c75412015-12-15 08:19:24 +0000323 new (Mem) OMPCriticalDirective(Name, StartLoc, EndLoc, Clauses.size());
324 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000325 Dir->setAssociatedStmt(AssociatedStmt);
326 return Dir;
327}
328
329OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev28c75412015-12-15 08:19:24 +0000330 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000331 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000332 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000333 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000334 void *Mem =
335 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
336 return new (Mem) OMPCriticalDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000337}
338
339OMPParallelForDirective *OMPParallelForDirective::Create(
340 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
341 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
342 const HelperExprs &Exprs, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000343 unsigned Size =
344 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000345 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
346 sizeof(Stmt *) *
347 numLoopChildren(CollapsedNum, OMPD_parallel_for));
348 OMPParallelForDirective *Dir = new (Mem)
349 OMPParallelForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
350 Dir->setClauses(Clauses);
351 Dir->setAssociatedStmt(AssociatedStmt);
352 Dir->setIterationVariable(Exprs.IterationVarRef);
353 Dir->setLastIteration(Exprs.LastIteration);
354 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
355 Dir->setPreCond(Exprs.PreCond);
356 Dir->setCond(Exprs.Cond);
357 Dir->setInit(Exprs.Init);
358 Dir->setInc(Exprs.Inc);
359 Dir->setIsLastIterVariable(Exprs.IL);
360 Dir->setLowerBoundVariable(Exprs.LB);
361 Dir->setUpperBoundVariable(Exprs.UB);
362 Dir->setStrideVariable(Exprs.ST);
363 Dir->setEnsureUpperBound(Exprs.EUB);
364 Dir->setNextLowerBound(Exprs.NLB);
365 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000366 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000367 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
368 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
James Y Knightb8bfd962015-10-02 13:41:04 +0000369 Dir->setCounters(Exprs.Counters);
370 Dir->setPrivateCounters(Exprs.PrivateCounters);
371 Dir->setInits(Exprs.Inits);
372 Dir->setUpdates(Exprs.Updates);
373 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000374 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000375 Dir->setHasCancel(HasCancel);
376 return Dir;
377}
378
379OMPParallelForDirective *
380OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
381 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000382 unsigned Size =
383 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000384 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
385 sizeof(Stmt *) *
386 numLoopChildren(CollapsedNum, OMPD_parallel_for));
387 return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses);
388}
389
390OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
391 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
392 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
393 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000394 unsigned Size =
395 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000396 void *Mem = C.Allocate(
397 Size + sizeof(OMPClause *) * Clauses.size() +
398 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
399 OMPParallelForSimdDirective *Dir = new (Mem) OMPParallelForSimdDirective(
400 StartLoc, EndLoc, CollapsedNum, Clauses.size());
401 Dir->setClauses(Clauses);
402 Dir->setAssociatedStmt(AssociatedStmt);
403 Dir->setIterationVariable(Exprs.IterationVarRef);
404 Dir->setLastIteration(Exprs.LastIteration);
405 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
406 Dir->setPreCond(Exprs.PreCond);
407 Dir->setCond(Exprs.Cond);
408 Dir->setInit(Exprs.Init);
409 Dir->setInc(Exprs.Inc);
410 Dir->setIsLastIterVariable(Exprs.IL);
411 Dir->setLowerBoundVariable(Exprs.LB);
412 Dir->setUpperBoundVariable(Exprs.UB);
413 Dir->setStrideVariable(Exprs.ST);
414 Dir->setEnsureUpperBound(Exprs.EUB);
415 Dir->setNextLowerBound(Exprs.NLB);
416 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000417 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000418 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
419 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
James Y Knightb8bfd962015-10-02 13:41:04 +0000420 Dir->setCounters(Exprs.Counters);
421 Dir->setPrivateCounters(Exprs.PrivateCounters);
422 Dir->setInits(Exprs.Inits);
423 Dir->setUpdates(Exprs.Updates);
424 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000425 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000426 return Dir;
427}
428
429OMPParallelForSimdDirective *
430OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
431 unsigned NumClauses,
432 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000433 unsigned Size =
434 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000435 void *Mem = C.Allocate(
436 Size + sizeof(OMPClause *) * NumClauses +
437 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
438 return new (Mem) OMPParallelForSimdDirective(CollapsedNum, NumClauses);
439}
440
441OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
442 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
443 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000444 unsigned Size =
445 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000446 void *Mem =
447 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
448 OMPParallelSectionsDirective *Dir =
449 new (Mem) OMPParallelSectionsDirective(StartLoc, EndLoc, Clauses.size());
450 Dir->setClauses(Clauses);
451 Dir->setAssociatedStmt(AssociatedStmt);
452 Dir->setHasCancel(HasCancel);
453 return Dir;
454}
455
456OMPParallelSectionsDirective *
457OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
458 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000459 unsigned Size =
460 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000461 void *Mem =
462 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
463 return new (Mem) OMPParallelSectionsDirective(NumClauses);
464}
465
466OMPTaskDirective *
467OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
468 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
469 Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000470 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000471 void *Mem =
472 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
473 OMPTaskDirective *Dir =
474 new (Mem) OMPTaskDirective(StartLoc, EndLoc, Clauses.size());
475 Dir->setClauses(Clauses);
476 Dir->setAssociatedStmt(AssociatedStmt);
477 Dir->setHasCancel(HasCancel);
478 return Dir;
479}
480
481OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
482 unsigned NumClauses,
483 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000484 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000485 void *Mem =
486 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
487 return new (Mem) OMPTaskDirective(NumClauses);
488}
489
490OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
491 SourceLocation StartLoc,
492 SourceLocation EndLoc) {
493 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
494 OMPTaskyieldDirective *Dir =
495 new (Mem) OMPTaskyieldDirective(StartLoc, EndLoc);
496 return Dir;
497}
498
499OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
500 EmptyShell) {
501 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
502 return new (Mem) OMPTaskyieldDirective();
503}
504
505OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
506 SourceLocation StartLoc,
507 SourceLocation EndLoc) {
508 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
509 OMPBarrierDirective *Dir = new (Mem) OMPBarrierDirective(StartLoc, EndLoc);
510 return Dir;
511}
512
513OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
514 EmptyShell) {
515 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
516 return new (Mem) OMPBarrierDirective();
517}
518
519OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C,
520 SourceLocation StartLoc,
521 SourceLocation EndLoc) {
522 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
523 OMPTaskwaitDirective *Dir = new (Mem) OMPTaskwaitDirective(StartLoc, EndLoc);
524 return Dir;
525}
526
527OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
528 EmptyShell) {
529 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
530 return new (Mem) OMPTaskwaitDirective();
531}
532
533OMPTaskgroupDirective *OMPTaskgroupDirective::Create(const ASTContext &C,
534 SourceLocation StartLoc,
535 SourceLocation EndLoc,
536 Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000537 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000538 void *Mem = C.Allocate(Size + sizeof(Stmt *));
539 OMPTaskgroupDirective *Dir =
540 new (Mem) OMPTaskgroupDirective(StartLoc, EndLoc);
541 Dir->setAssociatedStmt(AssociatedStmt);
542 return Dir;
543}
544
545OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
546 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000547 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000548 void *Mem = C.Allocate(Size + sizeof(Stmt *));
549 return new (Mem) OMPTaskgroupDirective();
550}
551
552OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
553 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
554 OpenMPDirectiveKind CancelRegion) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000555 unsigned Size =
556 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000557 void *Mem = C.Allocate(Size);
558 OMPCancellationPointDirective *Dir =
559 new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc);
560 Dir->setCancelRegion(CancelRegion);
561 return Dir;
562}
563
564OMPCancellationPointDirective *
565OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000566 unsigned Size =
567 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000568 void *Mem = C.Allocate(Size);
569 return new (Mem) OMPCancellationPointDirective();
570}
571
572OMPCancelDirective *
573OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
574 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
575 OpenMPDirectiveKind CancelRegion) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000576 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
577 sizeof(OMPClause *) * Clauses.size(),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000578 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000579 void *Mem = C.Allocate(Size);
580 OMPCancelDirective *Dir =
581 new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size());
582 Dir->setClauses(Clauses);
583 Dir->setCancelRegion(CancelRegion);
584 return Dir;
585}
586
587OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
588 unsigned NumClauses,
589 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000590 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
591 sizeof(OMPClause *) * NumClauses,
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000592 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000593 void *Mem = C.Allocate(Size);
594 return new (Mem) OMPCancelDirective(NumClauses);
595}
596
597OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
598 SourceLocation StartLoc,
599 SourceLocation EndLoc,
600 ArrayRef<OMPClause *> Clauses) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000601 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000602 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000603 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
604 OMPFlushDirective *Dir =
605 new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size());
606 Dir->setClauses(Clauses);
607 return Dir;
608}
609
610OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
611 unsigned NumClauses,
612 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000613 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000614 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000615 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
616 return new (Mem) OMPFlushDirective(NumClauses);
617}
618
619OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
620 SourceLocation StartLoc,
621 SourceLocation EndLoc,
622 ArrayRef<OMPClause *> Clauses,
623 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000624 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000625 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000626 void *Mem =
627 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size());
628 OMPOrderedDirective *Dir =
629 new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size());
630 Dir->setClauses(Clauses);
631 Dir->setAssociatedStmt(AssociatedStmt);
632 return Dir;
633}
634
635OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
636 unsigned NumClauses,
637 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000638 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000639 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000640 void *Mem =
641 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses);
642 return new (Mem) OMPOrderedDirective(NumClauses);
643}
644
645OMPAtomicDirective *OMPAtomicDirective::Create(
646 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
647 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
648 Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000649 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000650 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000651 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
652 5 * sizeof(Stmt *));
653 OMPAtomicDirective *Dir =
654 new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size());
655 Dir->setClauses(Clauses);
656 Dir->setAssociatedStmt(AssociatedStmt);
657 Dir->setX(X);
658 Dir->setV(V);
659 Dir->setExpr(E);
660 Dir->setUpdateExpr(UE);
661 Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
662 Dir->IsPostfixUpdate = IsPostfixUpdate;
663 return Dir;
664}
665
666OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
667 unsigned NumClauses,
668 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000669 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000670 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000671 void *Mem =
672 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *));
673 return new (Mem) OMPAtomicDirective(NumClauses);
674}
675
676OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
677 SourceLocation StartLoc,
678 SourceLocation EndLoc,
679 ArrayRef<OMPClause *> Clauses,
680 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000681 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000682 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000683 void *Mem =
684 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
685 OMPTargetDirective *Dir =
686 new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size());
687 Dir->setClauses(Clauses);
688 Dir->setAssociatedStmt(AssociatedStmt);
689 return Dir;
690}
691
692OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
693 unsigned NumClauses,
694 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000695 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000696 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000697 void *Mem =
698 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
699 return new (Mem) OMPTargetDirective(NumClauses);
700}
701
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000702OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
703 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
704 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000705 unsigned Size =
706 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000707 void *Mem =
708 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
709 OMPTargetParallelDirective *Dir =
710 new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size());
711 Dir->setClauses(Clauses);
712 Dir->setAssociatedStmt(AssociatedStmt);
713 return Dir;
714}
715
716OMPTargetParallelDirective *
717OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
718 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000719 unsigned Size =
720 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000721 void *Mem =
722 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
723 return new (Mem) OMPTargetParallelDirective(NumClauses);
724}
725
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000726OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
727 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
728 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
729 const HelperExprs &Exprs, bool HasCancel) {
730 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000731 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000732 void *Mem = C.Allocate(
733 Size + sizeof(OMPClause *) * Clauses.size() +
734 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
735 OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective(
736 StartLoc, EndLoc, CollapsedNum, Clauses.size());
737 Dir->setClauses(Clauses);
738 Dir->setAssociatedStmt(AssociatedStmt);
739 Dir->setIterationVariable(Exprs.IterationVarRef);
740 Dir->setLastIteration(Exprs.LastIteration);
741 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
742 Dir->setPreCond(Exprs.PreCond);
743 Dir->setCond(Exprs.Cond);
744 Dir->setInit(Exprs.Init);
745 Dir->setInc(Exprs.Inc);
746 Dir->setIsLastIterVariable(Exprs.IL);
747 Dir->setLowerBoundVariable(Exprs.LB);
748 Dir->setUpperBoundVariable(Exprs.UB);
749 Dir->setStrideVariable(Exprs.ST);
750 Dir->setEnsureUpperBound(Exprs.EUB);
751 Dir->setNextLowerBound(Exprs.NLB);
752 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000753 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000754 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
755 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000756 Dir->setCounters(Exprs.Counters);
757 Dir->setPrivateCounters(Exprs.PrivateCounters);
758 Dir->setInits(Exprs.Inits);
759 Dir->setUpdates(Exprs.Updates);
760 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000761 Dir->setPreInits(Exprs.PreInits);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000762 Dir->setHasCancel(HasCancel);
763 return Dir;
764}
765
766OMPTargetParallelForDirective *
767OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
768 unsigned NumClauses,
769 unsigned CollapsedNum, EmptyShell) {
770 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000771 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000772 void *Mem = C.Allocate(
773 Size + sizeof(OMPClause *) * NumClauses +
774 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
775 return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses);
776}
777
James Y Knightb8bfd962015-10-02 13:41:04 +0000778OMPTargetDataDirective *OMPTargetDataDirective::Create(
779 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
780 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000781 void *Mem = C.Allocate(
782 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
783 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000784 OMPTargetDataDirective *Dir =
785 new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size());
786 Dir->setClauses(Clauses);
787 Dir->setAssociatedStmt(AssociatedStmt);
788 return Dir;
789}
790
791OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
792 unsigned N,
793 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000794 void *Mem = C.Allocate(
795 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
796 sizeof(OMPClause *) * N + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000797 return new (Mem) OMPTargetDataDirective(N);
798}
799
Samuel Antaodf67fc42016-01-19 19:15:56 +0000800OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
801 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
802 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000803 void *Mem = C.Allocate(
804 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
805 sizeof(OMPClause *) * Clauses.size());
Samuel Antaodf67fc42016-01-19 19:15:56 +0000806 OMPTargetEnterDataDirective *Dir =
807 new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size());
808 Dir->setClauses(Clauses);
809 return Dir;
810}
811
812OMPTargetEnterDataDirective *
813OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
814 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000815 void *Mem = C.Allocate(
816 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
817 sizeof(OMPClause *) * N);
Samuel Antaodf67fc42016-01-19 19:15:56 +0000818 return new (Mem) OMPTargetEnterDataDirective(N);
819}
820
Samuel Antao72590762016-01-19 20:04:50 +0000821OMPTargetExitDataDirective *
822OMPTargetExitDataDirective::Create(const ASTContext &C, SourceLocation StartLoc,
823 SourceLocation EndLoc,
824 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000825 void *Mem = C.Allocate(
826 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
827 sizeof(OMPClause *) * Clauses.size());
Samuel Antao72590762016-01-19 20:04:50 +0000828 OMPTargetExitDataDirective *Dir =
829 new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size());
830 Dir->setClauses(Clauses);
831 return Dir;
832}
833
834OMPTargetExitDataDirective *
835OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
836 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000837 void *Mem = C.Allocate(
838 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
839 sizeof(OMPClause *) * N);
Samuel Antao72590762016-01-19 20:04:50 +0000840 return new (Mem) OMPTargetExitDataDirective(N);
841}
842
James Y Knightb8bfd962015-10-02 13:41:04 +0000843OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
844 SourceLocation StartLoc,
845 SourceLocation EndLoc,
846 ArrayRef<OMPClause *> Clauses,
847 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000848 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000849 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000850 void *Mem =
851 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
852 OMPTeamsDirective *Dir =
853 new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size());
854 Dir->setClauses(Clauses);
855 Dir->setAssociatedStmt(AssociatedStmt);
856 return Dir;
857}
858
859OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
860 unsigned NumClauses,
861 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000862 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000863 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000864 void *Mem =
865 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
866 return new (Mem) OMPTeamsDirective(NumClauses);
867}
Alexey Bataev49f6e782015-12-01 04:18:41 +0000868
869OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
870 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
871 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
872 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000873 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000874 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000875 void *Mem =
876 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
877 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
878 OMPTaskLoopDirective *Dir = new (Mem)
879 OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
880 Dir->setClauses(Clauses);
881 Dir->setAssociatedStmt(AssociatedStmt);
882 Dir->setIterationVariable(Exprs.IterationVarRef);
883 Dir->setLastIteration(Exprs.LastIteration);
884 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
885 Dir->setPreCond(Exprs.PreCond);
886 Dir->setCond(Exprs.Cond);
887 Dir->setInit(Exprs.Init);
888 Dir->setInc(Exprs.Inc);
889 Dir->setIsLastIterVariable(Exprs.IL);
890 Dir->setLowerBoundVariable(Exprs.LB);
891 Dir->setUpperBoundVariable(Exprs.UB);
892 Dir->setStrideVariable(Exprs.ST);
893 Dir->setEnsureUpperBound(Exprs.EUB);
894 Dir->setNextLowerBound(Exprs.NLB);
895 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000896 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000897 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
898 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000899 Dir->setCounters(Exprs.Counters);
900 Dir->setPrivateCounters(Exprs.PrivateCounters);
901 Dir->setInits(Exprs.Inits);
902 Dir->setUpdates(Exprs.Updates);
903 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000904 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000905 return Dir;
906}
907
908OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
909 unsigned NumClauses,
910 unsigned CollapsedNum,
911 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000912 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000913 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000914 void *Mem =
915 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
916 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
917 return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses);
918}
919
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000920OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
921 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
922 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
923 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000924 unsigned Size =
925 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000926 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
927 sizeof(Stmt *) *
928 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
929 OMPTaskLoopSimdDirective *Dir = new (Mem)
930 OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
931 Dir->setClauses(Clauses);
932 Dir->setAssociatedStmt(AssociatedStmt);
933 Dir->setIterationVariable(Exprs.IterationVarRef);
934 Dir->setLastIteration(Exprs.LastIteration);
935 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
936 Dir->setPreCond(Exprs.PreCond);
937 Dir->setCond(Exprs.Cond);
938 Dir->setInit(Exprs.Init);
939 Dir->setInc(Exprs.Inc);
940 Dir->setIsLastIterVariable(Exprs.IL);
941 Dir->setLowerBoundVariable(Exprs.LB);
942 Dir->setUpperBoundVariable(Exprs.UB);
943 Dir->setStrideVariable(Exprs.ST);
944 Dir->setEnsureUpperBound(Exprs.EUB);
945 Dir->setNextLowerBound(Exprs.NLB);
946 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000947 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000948 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
949 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000950 Dir->setCounters(Exprs.Counters);
951 Dir->setPrivateCounters(Exprs.PrivateCounters);
952 Dir->setInits(Exprs.Inits);
953 Dir->setUpdates(Exprs.Updates);
954 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000955 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000956 return Dir;
957}
958
959OMPTaskLoopSimdDirective *
960OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
961 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000962 unsigned Size =
963 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000964 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
965 sizeof(Stmt *) *
966 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
967 return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);
968}
969
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000970OMPDistributeDirective *OMPDistributeDirective::Create(
971 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
972 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
973 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000974 unsigned Size =
975 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000976 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
977 sizeof(Stmt *) *
978 numLoopChildren(CollapsedNum, OMPD_distribute));
979 OMPDistributeDirective *Dir = new (Mem)
980 OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
981 Dir->setClauses(Clauses);
982 Dir->setAssociatedStmt(AssociatedStmt);
983 Dir->setIterationVariable(Exprs.IterationVarRef);
984 Dir->setLastIteration(Exprs.LastIteration);
985 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
986 Dir->setPreCond(Exprs.PreCond);
987 Dir->setCond(Exprs.Cond);
988 Dir->setInit(Exprs.Init);
989 Dir->setInc(Exprs.Inc);
990 Dir->setIsLastIterVariable(Exprs.IL);
991 Dir->setLowerBoundVariable(Exprs.LB);
992 Dir->setUpperBoundVariable(Exprs.UB);
993 Dir->setStrideVariable(Exprs.ST);
994 Dir->setEnsureUpperBound(Exprs.EUB);
995 Dir->setNextLowerBound(Exprs.NLB);
996 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000997 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000998 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
999 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001000 Dir->setCounters(Exprs.Counters);
1001 Dir->setPrivateCounters(Exprs.PrivateCounters);
1002 Dir->setInits(Exprs.Inits);
1003 Dir->setUpdates(Exprs.Updates);
1004 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +00001005 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001006 return Dir;
1007}
1008
1009OMPDistributeDirective *
1010OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1011 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001012 unsigned Size =
1013 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001014 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1015 sizeof(Stmt *) *
1016 numLoopChildren(CollapsedNum, OMPD_distribute));
1017 return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);
1018}
Samuel Antao686c70c2016-05-26 17:30:50 +00001019
1020OMPTargetUpdateDirective *
1021OMPTargetUpdateDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1022 SourceLocation EndLoc,
1023 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001024 unsigned Size =
1025 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001026 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
1027 OMPTargetUpdateDirective *Dir =
1028 new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size());
1029 Dir->setClauses(Clauses);
1030 return Dir;
1031}
1032
1033OMPTargetUpdateDirective *
1034OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1035 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001036 unsigned Size =
1037 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001038 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
1039 return new (Mem) OMPTargetUpdateDirective(NumClauses);
1040}
Carlo Bertolli9925f152016-06-27 14:55:37 +00001041
1042OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1043 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1044 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1045 const HelperExprs &Exprs) {
1046 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001047 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001048 void *Mem = C.Allocate(
1049 Size + sizeof(OMPClause *) * Clauses.size() +
1050 sizeof(Stmt *) *
1051 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1052 OMPDistributeParallelForDirective *Dir =
1053 new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc,
1054 CollapsedNum, Clauses.size());
1055 Dir->setClauses(Clauses);
1056 Dir->setAssociatedStmt(AssociatedStmt);
1057 Dir->setIterationVariable(Exprs.IterationVarRef);
1058 Dir->setLastIteration(Exprs.LastIteration);
1059 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1060 Dir->setPreCond(Exprs.PreCond);
1061 Dir->setCond(Exprs.Cond);
1062 Dir->setInit(Exprs.Init);
1063 Dir->setInc(Exprs.Inc);
1064 Dir->setIsLastIterVariable(Exprs.IL);
1065 Dir->setLowerBoundVariable(Exprs.LB);
1066 Dir->setUpperBoundVariable(Exprs.UB);
1067 Dir->setStrideVariable(Exprs.ST);
1068 Dir->setEnsureUpperBound(Exprs.EUB);
1069 Dir->setNextLowerBound(Exprs.NLB);
1070 Dir->setNextUpperBound(Exprs.NUB);
1071 Dir->setNumIterations(Exprs.NumIterations);
1072 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1073 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1074 Dir->setCounters(Exprs.Counters);
1075 Dir->setPrivateCounters(Exprs.PrivateCounters);
1076 Dir->setInits(Exprs.Inits);
1077 Dir->setUpdates(Exprs.Updates);
1078 Dir->setFinals(Exprs.Finals);
1079 Dir->setPreInits(Exprs.PreInits);
1080 return Dir;
1081}
1082
1083OMPDistributeParallelForDirective *
1084OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1085 unsigned NumClauses,
1086 unsigned CollapsedNum,
1087 EmptyShell) {
1088 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001089 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001090 void *Mem = C.Allocate(
1091 Size + sizeof(OMPClause *) * NumClauses +
1092 sizeof(Stmt *) *
1093 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1094 return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses);
1095}
Kelvin Li4a39add2016-07-05 05:00:15 +00001096
1097OMPDistributeParallelForSimdDirective *
1098OMPDistributeParallelForSimdDirective::Create(
1099 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1100 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1101 const HelperExprs &Exprs) {
1102 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001103 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001104 void *Mem = C.Allocate(
1105 Size + sizeof(OMPClause *) * Clauses.size() +
1106 sizeof(Stmt *) *
1107 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1108 OMPDistributeParallelForSimdDirective *Dir = new (Mem)
1109 OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1110 Clauses.size());
1111 Dir->setClauses(Clauses);
1112 Dir->setAssociatedStmt(AssociatedStmt);
1113 Dir->setIterationVariable(Exprs.IterationVarRef);
1114 Dir->setLastIteration(Exprs.LastIteration);
1115 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1116 Dir->setPreCond(Exprs.PreCond);
1117 Dir->setCond(Exprs.Cond);
1118 Dir->setInit(Exprs.Init);
1119 Dir->setInc(Exprs.Inc);
1120 Dir->setIsLastIterVariable(Exprs.IL);
1121 Dir->setLowerBoundVariable(Exprs.LB);
1122 Dir->setUpperBoundVariable(Exprs.UB);
1123 Dir->setStrideVariable(Exprs.ST);
1124 Dir->setEnsureUpperBound(Exprs.EUB);
1125 Dir->setNextLowerBound(Exprs.NLB);
1126 Dir->setNextUpperBound(Exprs.NUB);
1127 Dir->setNumIterations(Exprs.NumIterations);
1128 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1129 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1130 Dir->setCounters(Exprs.Counters);
1131 Dir->setPrivateCounters(Exprs.PrivateCounters);
1132 Dir->setInits(Exprs.Inits);
1133 Dir->setUpdates(Exprs.Updates);
1134 Dir->setFinals(Exprs.Finals);
1135 Dir->setPreInits(Exprs.PreInits);
1136 return Dir;
1137}
1138
1139OMPDistributeParallelForSimdDirective *
1140OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1141 unsigned NumClauses,
1142 unsigned CollapsedNum,
1143 EmptyShell) {
1144 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001145 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001146 void *Mem = C.Allocate(
1147 Size + sizeof(OMPClause *) * NumClauses +
1148 sizeof(Stmt *) *
1149 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1150 return new (Mem)
1151 OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1152}
Kelvin Li787f3fc2016-07-06 04:45:38 +00001153
1154OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1155 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1156 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1157 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001158 unsigned Size =
1159 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001160 void *Mem = C.Allocate(
1161 Size + sizeof(OMPClause *) * Clauses.size() +
1162 sizeof(Stmt *) *
1163 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1164 OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective(
1165 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1166 Dir->setClauses(Clauses);
1167 Dir->setAssociatedStmt(AssociatedStmt);
1168 Dir->setIterationVariable(Exprs.IterationVarRef);
1169 Dir->setLastIteration(Exprs.LastIteration);
1170 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1171 Dir->setPreCond(Exprs.PreCond);
1172 Dir->setCond(Exprs.Cond);
1173 Dir->setInit(Exprs.Init);
1174 Dir->setInc(Exprs.Inc);
1175 Dir->setIsLastIterVariable(Exprs.IL);
1176 Dir->setLowerBoundVariable(Exprs.LB);
1177 Dir->setUpperBoundVariable(Exprs.UB);
1178 Dir->setStrideVariable(Exprs.ST);
1179 Dir->setEnsureUpperBound(Exprs.EUB);
1180 Dir->setNextLowerBound(Exprs.NLB);
1181 Dir->setNextUpperBound(Exprs.NUB);
1182 Dir->setNumIterations(Exprs.NumIterations);
1183 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1184 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1185 Dir->setCounters(Exprs.Counters);
1186 Dir->setPrivateCounters(Exprs.PrivateCounters);
1187 Dir->setInits(Exprs.Inits);
1188 Dir->setUpdates(Exprs.Updates);
1189 Dir->setFinals(Exprs.Finals);
1190 Dir->setPreInits(Exprs.PreInits);
1191 return Dir;
1192}
1193
1194OMPDistributeSimdDirective *
1195OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1196 unsigned NumClauses,
1197 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001198 unsigned Size =
1199 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001200 void *Mem = C.Allocate(
1201 Size + sizeof(OMPClause *) * NumClauses +
1202 sizeof(Stmt *) *
1203 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1204 return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses);
1205}
Kelvin Lia579b912016-07-14 02:54:56 +00001206
1207OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1208 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1209 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1210 const HelperExprs &Exprs) {
1211 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001212 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001213 void *Mem = C.Allocate(
1214 Size + sizeof(OMPClause *) * Clauses.size() +
1215 sizeof(Stmt *) *
1216 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1217 OMPTargetParallelForSimdDirective *Dir =
1218 new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc,
1219 CollapsedNum, Clauses.size());
1220 Dir->setClauses(Clauses);
1221 Dir->setAssociatedStmt(AssociatedStmt);
1222 Dir->setIterationVariable(Exprs.IterationVarRef);
1223 Dir->setLastIteration(Exprs.LastIteration);
1224 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1225 Dir->setPreCond(Exprs.PreCond);
1226 Dir->setCond(Exprs.Cond);
1227 Dir->setInit(Exprs.Init);
1228 Dir->setInc(Exprs.Inc);
1229 Dir->setIsLastIterVariable(Exprs.IL);
1230 Dir->setLowerBoundVariable(Exprs.LB);
1231 Dir->setUpperBoundVariable(Exprs.UB);
1232 Dir->setStrideVariable(Exprs.ST);
1233 Dir->setEnsureUpperBound(Exprs.EUB);
1234 Dir->setNextLowerBound(Exprs.NLB);
1235 Dir->setNextUpperBound(Exprs.NUB);
1236 Dir->setNumIterations(Exprs.NumIterations);
1237 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1238 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1239 Dir->setCounters(Exprs.Counters);
1240 Dir->setPrivateCounters(Exprs.PrivateCounters);
1241 Dir->setInits(Exprs.Inits);
1242 Dir->setUpdates(Exprs.Updates);
1243 Dir->setFinals(Exprs.Finals);
1244 Dir->setPreInits(Exprs.PreInits);
1245 return Dir;
1246}
1247
1248OMPTargetParallelForSimdDirective *
1249OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1250 unsigned NumClauses,
1251 unsigned CollapsedNum,
1252 EmptyShell) {
1253 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001254 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001255 void *Mem = C.Allocate(
1256 Size + sizeof(OMPClause *) * NumClauses +
1257 sizeof(Stmt *) *
1258 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1259 return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses);
1260}
Kelvin Li986330c2016-07-20 22:57:10 +00001261
1262OMPTargetSimdDirective *
1263OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1264 SourceLocation EndLoc, unsigned CollapsedNum,
1265 ArrayRef<OMPClause *> Clauses,
1266 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001267 unsigned Size =
1268 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001269 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1270 sizeof(Stmt *) *
1271 numLoopChildren(CollapsedNum, OMPD_target_simd));
1272 OMPTargetSimdDirective *Dir = new (Mem)
1273 OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1274 Dir->setClauses(Clauses);
1275 Dir->setAssociatedStmt(AssociatedStmt);
1276 Dir->setIterationVariable(Exprs.IterationVarRef);
1277 Dir->setLastIteration(Exprs.LastIteration);
1278 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1279 Dir->setPreCond(Exprs.PreCond);
1280 Dir->setCond(Exprs.Cond);
1281 Dir->setInit(Exprs.Init);
1282 Dir->setInc(Exprs.Inc);
1283 Dir->setCounters(Exprs.Counters);
1284 Dir->setPrivateCounters(Exprs.PrivateCounters);
1285 Dir->setInits(Exprs.Inits);
1286 Dir->setUpdates(Exprs.Updates);
1287 Dir->setFinals(Exprs.Finals);
1288 Dir->setPreInits(Exprs.PreInits);
1289 return Dir;
1290}
1291
1292OMPTargetSimdDirective *
1293OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1294 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001295 unsigned Size =
1296 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001297 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1298 sizeof(Stmt *) *
1299 numLoopChildren(CollapsedNum, OMPD_target_simd));
1300 return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses);
1301}
Kelvin Li02532872016-08-05 14:37:37 +00001302
1303OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1304 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1305 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1306 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001307 unsigned Size =
1308 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001309 void *Mem = C.Allocate(
1310 Size + sizeof(OMPClause *) * Clauses.size() +
1311 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1312 OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective(
1313 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1314 Dir->setClauses(Clauses);
1315 Dir->setAssociatedStmt(AssociatedStmt);
1316 Dir->setIterationVariable(Exprs.IterationVarRef);
1317 Dir->setLastIteration(Exprs.LastIteration);
1318 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1319 Dir->setPreCond(Exprs.PreCond);
1320 Dir->setCond(Exprs.Cond);
1321 Dir->setInit(Exprs.Init);
1322 Dir->setInc(Exprs.Inc);
1323 Dir->setIsLastIterVariable(Exprs.IL);
1324 Dir->setLowerBoundVariable(Exprs.LB);
1325 Dir->setUpperBoundVariable(Exprs.UB);
1326 Dir->setStrideVariable(Exprs.ST);
1327 Dir->setEnsureUpperBound(Exprs.EUB);
1328 Dir->setNextLowerBound(Exprs.NLB);
1329 Dir->setNextUpperBound(Exprs.NUB);
1330 Dir->setNumIterations(Exprs.NumIterations);
1331 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1332 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1333 Dir->setCounters(Exprs.Counters);
1334 Dir->setPrivateCounters(Exprs.PrivateCounters);
1335 Dir->setInits(Exprs.Inits);
1336 Dir->setUpdates(Exprs.Updates);
1337 Dir->setFinals(Exprs.Finals);
1338 Dir->setPreInits(Exprs.PreInits);
1339 return Dir;
1340}
1341
1342OMPTeamsDistributeDirective *
1343OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1344 unsigned NumClauses,
1345 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001346 unsigned Size =
1347 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001348 void *Mem = C.Allocate(
1349 Size + sizeof(OMPClause *) * NumClauses +
1350 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1351 return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses);
1352}
Kelvin Li4e325f72016-10-25 12:50:55 +00001353
1354OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1355 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1356 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1357 const HelperExprs &Exprs) {
1358 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1359 alignof(OMPClause *));
1360 void *Mem =
1361 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1362 sizeof(Stmt *) *
1363 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1364 OMPTeamsDistributeSimdDirective *Dir =
1365 new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1366 Clauses.size());
1367 Dir->setClauses(Clauses);
1368 Dir->setAssociatedStmt(AssociatedStmt);
1369 Dir->setIterationVariable(Exprs.IterationVarRef);
1370 Dir->setLastIteration(Exprs.LastIteration);
1371 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1372 Dir->setPreCond(Exprs.PreCond);
1373 Dir->setCond(Exprs.Cond);
1374 Dir->setInit(Exprs.Init);
1375 Dir->setInc(Exprs.Inc);
1376 Dir->setIsLastIterVariable(Exprs.IL);
1377 Dir->setLowerBoundVariable(Exprs.LB);
1378 Dir->setUpperBoundVariable(Exprs.UB);
1379 Dir->setStrideVariable(Exprs.ST);
1380 Dir->setEnsureUpperBound(Exprs.EUB);
1381 Dir->setNextLowerBound(Exprs.NLB);
1382 Dir->setNextUpperBound(Exprs.NUB);
1383 Dir->setNumIterations(Exprs.NumIterations);
1384 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1385 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1386 Dir->setCounters(Exprs.Counters);
1387 Dir->setPrivateCounters(Exprs.PrivateCounters);
1388 Dir->setInits(Exprs.Inits);
1389 Dir->setUpdates(Exprs.Updates);
1390 Dir->setFinals(Exprs.Finals);
1391 Dir->setPreInits(Exprs.PreInits);
1392 return Dir;
1393}
1394
1395OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1396 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1397 EmptyShell) {
1398 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1399 alignof(OMPClause *));
1400 void *Mem =
1401 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1402 sizeof(Stmt *) *
1403 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1404 return new (Mem) OMPTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1405}
Kelvin Li579e41c2016-11-30 23:51:03 +00001406
1407OMPTeamsDistributeParallelForSimdDirective *
1408OMPTeamsDistributeParallelForSimdDirective::Create(
1409 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1410 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1411 const HelperExprs &Exprs) {
1412 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1413 alignof(OMPClause *));
1414 void *Mem =
1415 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1416 sizeof(Stmt *) *
1417 numLoopChildren(CollapsedNum,
1418 OMPD_teams_distribute_parallel_for_simd));
1419 OMPTeamsDistributeParallelForSimdDirective *Dir = new (Mem)
1420 OMPTeamsDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1421 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);
1441 Dir->setCounters(Exprs.Counters);
1442 Dir->setPrivateCounters(Exprs.PrivateCounters);
1443 Dir->setInits(Exprs.Inits);
1444 Dir->setUpdates(Exprs.Updates);
1445 Dir->setFinals(Exprs.Finals);
1446 Dir->setPreInits(Exprs.PreInits);
1447 return Dir;
1448}
1449
1450OMPTeamsDistributeParallelForSimdDirective *
1451OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1452 unsigned NumClauses,
1453 unsigned CollapsedNum,
1454 EmptyShell) {
1455 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1456 alignof(OMPClause *));
1457 void *Mem =
1458 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1459 sizeof(Stmt *) *
1460 numLoopChildren(CollapsedNum,
1461 OMPD_teams_distribute_parallel_for_simd));
1462 return new (Mem)
1463 OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1464}
Kelvin Li7ade93f2016-12-09 03:24:30 +00001465
1466OMPTeamsDistributeParallelForDirective *
1467OMPTeamsDistributeParallelForDirective::Create(
1468 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1469 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1470 const HelperExprs &Exprs) {
1471 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1472 alignof(OMPClause *));
1473 void *Mem = C.Allocate(
1474 Size + sizeof(OMPClause *) * Clauses.size() +
1475 sizeof(Stmt *) *
1476 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1477 OMPTeamsDistributeParallelForDirective *Dir = new (Mem)
1478 OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum,
1479 Clauses.size());
1480 Dir->setClauses(Clauses);
1481 Dir->setAssociatedStmt(AssociatedStmt);
1482 Dir->setIterationVariable(Exprs.IterationVarRef);
1483 Dir->setLastIteration(Exprs.LastIteration);
1484 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1485 Dir->setPreCond(Exprs.PreCond);
1486 Dir->setCond(Exprs.Cond);
1487 Dir->setInit(Exprs.Init);
1488 Dir->setInc(Exprs.Inc);
1489 Dir->setIsLastIterVariable(Exprs.IL);
1490 Dir->setLowerBoundVariable(Exprs.LB);
1491 Dir->setUpperBoundVariable(Exprs.UB);
1492 Dir->setStrideVariable(Exprs.ST);
1493 Dir->setEnsureUpperBound(Exprs.EUB);
1494 Dir->setNextLowerBound(Exprs.NLB);
1495 Dir->setNextUpperBound(Exprs.NUB);
1496 Dir->setNumIterations(Exprs.NumIterations);
1497 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1498 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1499 Dir->setCounters(Exprs.Counters);
1500 Dir->setPrivateCounters(Exprs.PrivateCounters);
1501 Dir->setInits(Exprs.Inits);
1502 Dir->setUpdates(Exprs.Updates);
1503 Dir->setFinals(Exprs.Finals);
1504 Dir->setPreInits(Exprs.PreInits);
1505 return Dir;
1506}
1507
1508OMPTeamsDistributeParallelForDirective *
1509OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1510 unsigned NumClauses,
1511 unsigned CollapsedNum,
1512 EmptyShell) {
1513 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1514 alignof(OMPClause *));
1515 void *Mem = C.Allocate(
1516 Size + sizeof(OMPClause *) * NumClauses +
1517 sizeof(Stmt *) *
1518 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1519 return new (Mem)
1520 OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1521}
1522