blob: a812884cd9278a5e4ba8f34cc2192a6fd0153be6 [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);
Carlo Bertolli8429d812017-02-17 21:29:13 +0000152 Dir->setDistInc(Exprs.DistInc);
153 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
James Y Knightb8bfd962015-10-02 13:41:04 +0000154 Dir->setCounters(Exprs.Counters);
155 Dir->setPrivateCounters(Exprs.PrivateCounters);
156 Dir->setInits(Exprs.Inits);
157 Dir->setUpdates(Exprs.Updates);
158 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000159 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000160 Dir->setHasCancel(HasCancel);
161 return Dir;
162}
163
164OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
165 unsigned NumClauses,
166 unsigned CollapsedNum,
167 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000168 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000169 void *Mem =
170 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
171 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
172 return new (Mem) OMPForDirective(CollapsedNum, NumClauses);
173}
174
175OMPForSimdDirective *
176OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
177 SourceLocation EndLoc, unsigned CollapsedNum,
178 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
179 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000180 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000181 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000182 void *Mem =
183 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
184 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
185 OMPForSimdDirective *Dir = new (Mem)
186 OMPForSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
187 Dir->setClauses(Clauses);
188 Dir->setAssociatedStmt(AssociatedStmt);
189 Dir->setIterationVariable(Exprs.IterationVarRef);
190 Dir->setLastIteration(Exprs.LastIteration);
191 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
192 Dir->setPreCond(Exprs.PreCond);
193 Dir->setCond(Exprs.Cond);
194 Dir->setInit(Exprs.Init);
195 Dir->setInc(Exprs.Inc);
196 Dir->setIsLastIterVariable(Exprs.IL);
197 Dir->setLowerBoundVariable(Exprs.LB);
198 Dir->setUpperBoundVariable(Exprs.UB);
199 Dir->setStrideVariable(Exprs.ST);
200 Dir->setEnsureUpperBound(Exprs.EUB);
201 Dir->setNextLowerBound(Exprs.NLB);
202 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000203 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000204 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
205 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +0000206 Dir->setDistInc(Exprs.DistInc);
207 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
James Y Knightb8bfd962015-10-02 13:41:04 +0000208 Dir->setCounters(Exprs.Counters);
209 Dir->setPrivateCounters(Exprs.PrivateCounters);
210 Dir->setInits(Exprs.Inits);
211 Dir->setUpdates(Exprs.Updates);
212 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000213 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000214 return Dir;
215}
216
217OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
218 unsigned NumClauses,
219 unsigned CollapsedNum,
220 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000221 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000222 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000223 void *Mem =
224 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
225 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
226 return new (Mem) OMPForSimdDirective(CollapsedNum, NumClauses);
227}
228
229OMPSectionsDirective *OMPSectionsDirective::Create(
230 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
231 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000232 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000233 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000234 void *Mem =
235 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
236 OMPSectionsDirective *Dir =
237 new (Mem) OMPSectionsDirective(StartLoc, EndLoc, Clauses.size());
238 Dir->setClauses(Clauses);
239 Dir->setAssociatedStmt(AssociatedStmt);
240 Dir->setHasCancel(HasCancel);
241 return Dir;
242}
243
244OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
245 unsigned NumClauses,
246 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000247 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000248 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000249 void *Mem =
250 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
251 return new (Mem) OMPSectionsDirective(NumClauses);
252}
253
254OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
255 SourceLocation StartLoc,
256 SourceLocation EndLoc,
257 Stmt *AssociatedStmt,
258 bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000259 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000260 void *Mem = C.Allocate(Size + sizeof(Stmt *));
261 OMPSectionDirective *Dir = new (Mem) OMPSectionDirective(StartLoc, EndLoc);
262 Dir->setAssociatedStmt(AssociatedStmt);
263 Dir->setHasCancel(HasCancel);
264 return Dir;
265}
266
267OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
268 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000269 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000270 void *Mem = C.Allocate(Size + sizeof(Stmt *));
271 return new (Mem) OMPSectionDirective();
272}
273
274OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
275 SourceLocation StartLoc,
276 SourceLocation EndLoc,
277 ArrayRef<OMPClause *> Clauses,
278 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000279 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000280 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000281 void *Mem =
282 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
283 OMPSingleDirective *Dir =
284 new (Mem) OMPSingleDirective(StartLoc, EndLoc, Clauses.size());
285 Dir->setClauses(Clauses);
286 Dir->setAssociatedStmt(AssociatedStmt);
287 return Dir;
288}
289
290OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
291 unsigned NumClauses,
292 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000293 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000294 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000295 void *Mem =
296 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
297 return new (Mem) OMPSingleDirective(NumClauses);
298}
299
300OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
301 SourceLocation StartLoc,
302 SourceLocation EndLoc,
303 Stmt *AssociatedStmt) {
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 OMPMasterDirective *Dir = new (Mem) OMPMasterDirective(StartLoc, EndLoc);
307 Dir->setAssociatedStmt(AssociatedStmt);
308 return Dir;
309}
310
311OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
312 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000313 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000314 void *Mem = C.Allocate(Size + sizeof(Stmt *));
315 return new (Mem) OMPMasterDirective();
316}
317
318OMPCriticalDirective *OMPCriticalDirective::Create(
319 const ASTContext &C, const DeclarationNameInfo &Name,
Alexey Bataev28c75412015-12-15 08:19:24 +0000320 SourceLocation StartLoc, SourceLocation EndLoc,
321 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000322 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000323 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000324 void *Mem =
325 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000326 OMPCriticalDirective *Dir =
Alexey Bataev28c75412015-12-15 08:19:24 +0000327 new (Mem) OMPCriticalDirective(Name, StartLoc, EndLoc, Clauses.size());
328 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000329 Dir->setAssociatedStmt(AssociatedStmt);
330 return Dir;
331}
332
333OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev28c75412015-12-15 08:19:24 +0000334 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000335 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000336 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000337 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000338 void *Mem =
339 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
340 return new (Mem) OMPCriticalDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000341}
342
343OMPParallelForDirective *OMPParallelForDirective::Create(
344 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
345 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
346 const HelperExprs &Exprs, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000347 unsigned Size =
348 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000349 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
350 sizeof(Stmt *) *
351 numLoopChildren(CollapsedNum, OMPD_parallel_for));
352 OMPParallelForDirective *Dir = new (Mem)
353 OMPParallelForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
354 Dir->setClauses(Clauses);
355 Dir->setAssociatedStmt(AssociatedStmt);
356 Dir->setIterationVariable(Exprs.IterationVarRef);
357 Dir->setLastIteration(Exprs.LastIteration);
358 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
359 Dir->setPreCond(Exprs.PreCond);
360 Dir->setCond(Exprs.Cond);
361 Dir->setInit(Exprs.Init);
362 Dir->setInc(Exprs.Inc);
363 Dir->setIsLastIterVariable(Exprs.IL);
364 Dir->setLowerBoundVariable(Exprs.LB);
365 Dir->setUpperBoundVariable(Exprs.UB);
366 Dir->setStrideVariable(Exprs.ST);
367 Dir->setEnsureUpperBound(Exprs.EUB);
368 Dir->setNextLowerBound(Exprs.NLB);
369 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000370 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000371 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
372 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +0000373 Dir->setDistInc(Exprs.DistInc);
374 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
James Y Knightb8bfd962015-10-02 13:41:04 +0000375 Dir->setCounters(Exprs.Counters);
376 Dir->setPrivateCounters(Exprs.PrivateCounters);
377 Dir->setInits(Exprs.Inits);
378 Dir->setUpdates(Exprs.Updates);
379 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000380 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000381 Dir->setHasCancel(HasCancel);
382 return Dir;
383}
384
385OMPParallelForDirective *
386OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
387 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000388 unsigned Size =
389 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000390 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
391 sizeof(Stmt *) *
392 numLoopChildren(CollapsedNum, OMPD_parallel_for));
393 return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses);
394}
395
396OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
397 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
398 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
399 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000400 unsigned Size =
401 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000402 void *Mem = C.Allocate(
403 Size + sizeof(OMPClause *) * Clauses.size() +
404 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
405 OMPParallelForSimdDirective *Dir = new (Mem) OMPParallelForSimdDirective(
406 StartLoc, EndLoc, CollapsedNum, Clauses.size());
407 Dir->setClauses(Clauses);
408 Dir->setAssociatedStmt(AssociatedStmt);
409 Dir->setIterationVariable(Exprs.IterationVarRef);
410 Dir->setLastIteration(Exprs.LastIteration);
411 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
412 Dir->setPreCond(Exprs.PreCond);
413 Dir->setCond(Exprs.Cond);
414 Dir->setInit(Exprs.Init);
415 Dir->setInc(Exprs.Inc);
416 Dir->setIsLastIterVariable(Exprs.IL);
417 Dir->setLowerBoundVariable(Exprs.LB);
418 Dir->setUpperBoundVariable(Exprs.UB);
419 Dir->setStrideVariable(Exprs.ST);
420 Dir->setEnsureUpperBound(Exprs.EUB);
421 Dir->setNextLowerBound(Exprs.NLB);
422 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000423 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000424 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
425 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +0000426 Dir->setDistInc(Exprs.DistInc);
427 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
James Y Knightb8bfd962015-10-02 13:41:04 +0000428 Dir->setCounters(Exprs.Counters);
429 Dir->setPrivateCounters(Exprs.PrivateCounters);
430 Dir->setInits(Exprs.Inits);
431 Dir->setUpdates(Exprs.Updates);
432 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000433 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000434 return Dir;
435}
436
437OMPParallelForSimdDirective *
438OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
439 unsigned NumClauses,
440 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000441 unsigned Size =
442 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000443 void *Mem = C.Allocate(
444 Size + sizeof(OMPClause *) * NumClauses +
445 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
446 return new (Mem) OMPParallelForSimdDirective(CollapsedNum, NumClauses);
447}
448
449OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
450 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
451 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000452 unsigned Size =
453 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000454 void *Mem =
455 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
456 OMPParallelSectionsDirective *Dir =
457 new (Mem) OMPParallelSectionsDirective(StartLoc, EndLoc, Clauses.size());
458 Dir->setClauses(Clauses);
459 Dir->setAssociatedStmt(AssociatedStmt);
460 Dir->setHasCancel(HasCancel);
461 return Dir;
462}
463
464OMPParallelSectionsDirective *
465OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
466 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000467 unsigned Size =
468 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000469 void *Mem =
470 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
471 return new (Mem) OMPParallelSectionsDirective(NumClauses);
472}
473
474OMPTaskDirective *
475OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
476 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
477 Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000478 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000479 void *Mem =
480 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
481 OMPTaskDirective *Dir =
482 new (Mem) OMPTaskDirective(StartLoc, EndLoc, Clauses.size());
483 Dir->setClauses(Clauses);
484 Dir->setAssociatedStmt(AssociatedStmt);
485 Dir->setHasCancel(HasCancel);
486 return Dir;
487}
488
489OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
490 unsigned NumClauses,
491 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000492 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000493 void *Mem =
494 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
495 return new (Mem) OMPTaskDirective(NumClauses);
496}
497
498OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
499 SourceLocation StartLoc,
500 SourceLocation EndLoc) {
501 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
502 OMPTaskyieldDirective *Dir =
503 new (Mem) OMPTaskyieldDirective(StartLoc, EndLoc);
504 return Dir;
505}
506
507OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
508 EmptyShell) {
509 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
510 return new (Mem) OMPTaskyieldDirective();
511}
512
513OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
514 SourceLocation StartLoc,
515 SourceLocation EndLoc) {
516 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
517 OMPBarrierDirective *Dir = new (Mem) OMPBarrierDirective(StartLoc, EndLoc);
518 return Dir;
519}
520
521OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
522 EmptyShell) {
523 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
524 return new (Mem) OMPBarrierDirective();
525}
526
527OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C,
528 SourceLocation StartLoc,
529 SourceLocation EndLoc) {
530 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
531 OMPTaskwaitDirective *Dir = new (Mem) OMPTaskwaitDirective(StartLoc, EndLoc);
532 return Dir;
533}
534
535OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
536 EmptyShell) {
537 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
538 return new (Mem) OMPTaskwaitDirective();
539}
540
541OMPTaskgroupDirective *OMPTaskgroupDirective::Create(const ASTContext &C,
542 SourceLocation StartLoc,
543 SourceLocation EndLoc,
544 Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000545 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000546 void *Mem = C.Allocate(Size + sizeof(Stmt *));
547 OMPTaskgroupDirective *Dir =
548 new (Mem) OMPTaskgroupDirective(StartLoc, EndLoc);
549 Dir->setAssociatedStmt(AssociatedStmt);
550 return Dir;
551}
552
553OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
554 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000555 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000556 void *Mem = C.Allocate(Size + sizeof(Stmt *));
557 return new (Mem) OMPTaskgroupDirective();
558}
559
560OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
561 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
562 OpenMPDirectiveKind CancelRegion) {
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 OMPCancellationPointDirective *Dir =
567 new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc);
568 Dir->setCancelRegion(CancelRegion);
569 return Dir;
570}
571
572OMPCancellationPointDirective *
573OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000574 unsigned Size =
575 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000576 void *Mem = C.Allocate(Size);
577 return new (Mem) OMPCancellationPointDirective();
578}
579
580OMPCancelDirective *
581OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
582 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
583 OpenMPDirectiveKind CancelRegion) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000584 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
585 sizeof(OMPClause *) * Clauses.size(),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000586 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000587 void *Mem = C.Allocate(Size);
588 OMPCancelDirective *Dir =
589 new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size());
590 Dir->setClauses(Clauses);
591 Dir->setCancelRegion(CancelRegion);
592 return Dir;
593}
594
595OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
596 unsigned NumClauses,
597 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000598 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
599 sizeof(OMPClause *) * NumClauses,
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000600 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000601 void *Mem = C.Allocate(Size);
602 return new (Mem) OMPCancelDirective(NumClauses);
603}
604
605OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
606 SourceLocation StartLoc,
607 SourceLocation EndLoc,
608 ArrayRef<OMPClause *> Clauses) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000609 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000610 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000611 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
612 OMPFlushDirective *Dir =
613 new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size());
614 Dir->setClauses(Clauses);
615 return Dir;
616}
617
618OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
619 unsigned NumClauses,
620 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000621 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000622 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000623 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
624 return new (Mem) OMPFlushDirective(NumClauses);
625}
626
627OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
628 SourceLocation StartLoc,
629 SourceLocation EndLoc,
630 ArrayRef<OMPClause *> Clauses,
631 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000632 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000633 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000634 void *Mem =
635 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size());
636 OMPOrderedDirective *Dir =
637 new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size());
638 Dir->setClauses(Clauses);
639 Dir->setAssociatedStmt(AssociatedStmt);
640 return Dir;
641}
642
643OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
644 unsigned NumClauses,
645 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000646 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000647 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000648 void *Mem =
649 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses);
650 return new (Mem) OMPOrderedDirective(NumClauses);
651}
652
653OMPAtomicDirective *OMPAtomicDirective::Create(
654 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
655 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
656 Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000657 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000658 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000659 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
660 5 * sizeof(Stmt *));
661 OMPAtomicDirective *Dir =
662 new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size());
663 Dir->setClauses(Clauses);
664 Dir->setAssociatedStmt(AssociatedStmt);
665 Dir->setX(X);
666 Dir->setV(V);
667 Dir->setExpr(E);
668 Dir->setUpdateExpr(UE);
669 Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
670 Dir->IsPostfixUpdate = IsPostfixUpdate;
671 return Dir;
672}
673
674OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
675 unsigned NumClauses,
676 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000677 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000678 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000679 void *Mem =
680 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *));
681 return new (Mem) OMPAtomicDirective(NumClauses);
682}
683
684OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
685 SourceLocation StartLoc,
686 SourceLocation EndLoc,
687 ArrayRef<OMPClause *> Clauses,
688 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000689 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000690 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000691 void *Mem =
692 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
693 OMPTargetDirective *Dir =
694 new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size());
695 Dir->setClauses(Clauses);
696 Dir->setAssociatedStmt(AssociatedStmt);
697 return Dir;
698}
699
700OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
701 unsigned NumClauses,
702 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000703 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000704 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000705 void *Mem =
706 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
707 return new (Mem) OMPTargetDirective(NumClauses);
708}
709
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000710OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
711 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
712 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000713 unsigned Size =
714 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000715 void *Mem =
716 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
717 OMPTargetParallelDirective *Dir =
718 new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size());
719 Dir->setClauses(Clauses);
720 Dir->setAssociatedStmt(AssociatedStmt);
721 return Dir;
722}
723
724OMPTargetParallelDirective *
725OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
726 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000727 unsigned Size =
728 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000729 void *Mem =
730 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
731 return new (Mem) OMPTargetParallelDirective(NumClauses);
732}
733
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000734OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
735 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
736 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
737 const HelperExprs &Exprs, bool HasCancel) {
738 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000739 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000740 void *Mem = C.Allocate(
741 Size + sizeof(OMPClause *) * Clauses.size() +
742 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
743 OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective(
744 StartLoc, EndLoc, CollapsedNum, Clauses.size());
745 Dir->setClauses(Clauses);
746 Dir->setAssociatedStmt(AssociatedStmt);
747 Dir->setIterationVariable(Exprs.IterationVarRef);
748 Dir->setLastIteration(Exprs.LastIteration);
749 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
750 Dir->setPreCond(Exprs.PreCond);
751 Dir->setCond(Exprs.Cond);
752 Dir->setInit(Exprs.Init);
753 Dir->setInc(Exprs.Inc);
754 Dir->setIsLastIterVariable(Exprs.IL);
755 Dir->setLowerBoundVariable(Exprs.LB);
756 Dir->setUpperBoundVariable(Exprs.UB);
757 Dir->setStrideVariable(Exprs.ST);
758 Dir->setEnsureUpperBound(Exprs.EUB);
759 Dir->setNextLowerBound(Exprs.NLB);
760 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000761 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000762 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
763 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +0000764 Dir->setDistInc(Exprs.DistInc);
765 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000766 Dir->setCounters(Exprs.Counters);
767 Dir->setPrivateCounters(Exprs.PrivateCounters);
768 Dir->setInits(Exprs.Inits);
769 Dir->setUpdates(Exprs.Updates);
770 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000771 Dir->setPreInits(Exprs.PreInits);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000772 Dir->setHasCancel(HasCancel);
773 return Dir;
774}
775
776OMPTargetParallelForDirective *
777OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
778 unsigned NumClauses,
779 unsigned CollapsedNum, EmptyShell) {
780 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000781 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000782 void *Mem = C.Allocate(
783 Size + sizeof(OMPClause *) * NumClauses +
784 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
785 return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses);
786}
787
James Y Knightb8bfd962015-10-02 13:41:04 +0000788OMPTargetDataDirective *OMPTargetDataDirective::Create(
789 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
790 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000791 void *Mem = C.Allocate(
792 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
793 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000794 OMPTargetDataDirective *Dir =
795 new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size());
796 Dir->setClauses(Clauses);
797 Dir->setAssociatedStmt(AssociatedStmt);
798 return Dir;
799}
800
801OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
802 unsigned N,
803 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000804 void *Mem = C.Allocate(
805 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
806 sizeof(OMPClause *) * N + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000807 return new (Mem) OMPTargetDataDirective(N);
808}
809
Samuel Antaodf67fc42016-01-19 19:15:56 +0000810OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
811 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
812 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000813 void *Mem = C.Allocate(
814 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
815 sizeof(OMPClause *) * Clauses.size());
Samuel Antaodf67fc42016-01-19 19:15:56 +0000816 OMPTargetEnterDataDirective *Dir =
817 new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size());
818 Dir->setClauses(Clauses);
819 return Dir;
820}
821
822OMPTargetEnterDataDirective *
823OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
824 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000825 void *Mem = C.Allocate(
826 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
827 sizeof(OMPClause *) * N);
Samuel Antaodf67fc42016-01-19 19:15:56 +0000828 return new (Mem) OMPTargetEnterDataDirective(N);
829}
830
Samuel Antao72590762016-01-19 20:04:50 +0000831OMPTargetExitDataDirective *
832OMPTargetExitDataDirective::Create(const ASTContext &C, SourceLocation StartLoc,
833 SourceLocation EndLoc,
834 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000835 void *Mem = C.Allocate(
836 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
837 sizeof(OMPClause *) * Clauses.size());
Samuel Antao72590762016-01-19 20:04:50 +0000838 OMPTargetExitDataDirective *Dir =
839 new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size());
840 Dir->setClauses(Clauses);
841 return Dir;
842}
843
844OMPTargetExitDataDirective *
845OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
846 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000847 void *Mem = C.Allocate(
848 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
849 sizeof(OMPClause *) * N);
Samuel Antao72590762016-01-19 20:04:50 +0000850 return new (Mem) OMPTargetExitDataDirective(N);
851}
852
James Y Knightb8bfd962015-10-02 13:41:04 +0000853OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
854 SourceLocation StartLoc,
855 SourceLocation EndLoc,
856 ArrayRef<OMPClause *> Clauses,
857 Stmt *AssociatedStmt) {
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 *) * Clauses.size() + sizeof(Stmt *));
862 OMPTeamsDirective *Dir =
863 new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size());
864 Dir->setClauses(Clauses);
865 Dir->setAssociatedStmt(AssociatedStmt);
866 return Dir;
867}
868
869OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
870 unsigned NumClauses,
871 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000872 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000873 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000874 void *Mem =
875 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
876 return new (Mem) OMPTeamsDirective(NumClauses);
877}
Alexey Bataev49f6e782015-12-01 04:18:41 +0000878
879OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
880 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
881 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
882 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000883 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000884 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000885 void *Mem =
886 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
887 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
888 OMPTaskLoopDirective *Dir = new (Mem)
889 OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
890 Dir->setClauses(Clauses);
891 Dir->setAssociatedStmt(AssociatedStmt);
892 Dir->setIterationVariable(Exprs.IterationVarRef);
893 Dir->setLastIteration(Exprs.LastIteration);
894 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
895 Dir->setPreCond(Exprs.PreCond);
896 Dir->setCond(Exprs.Cond);
897 Dir->setInit(Exprs.Init);
898 Dir->setInc(Exprs.Inc);
899 Dir->setIsLastIterVariable(Exprs.IL);
900 Dir->setLowerBoundVariable(Exprs.LB);
901 Dir->setUpperBoundVariable(Exprs.UB);
902 Dir->setStrideVariable(Exprs.ST);
903 Dir->setEnsureUpperBound(Exprs.EUB);
904 Dir->setNextLowerBound(Exprs.NLB);
905 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000906 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000907 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
908 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +0000909 Dir->setDistInc(Exprs.DistInc);
910 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000911 Dir->setCounters(Exprs.Counters);
912 Dir->setPrivateCounters(Exprs.PrivateCounters);
913 Dir->setInits(Exprs.Inits);
914 Dir->setUpdates(Exprs.Updates);
915 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000916 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000917 return Dir;
918}
919
920OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
921 unsigned NumClauses,
922 unsigned CollapsedNum,
923 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000924 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000925 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000926 void *Mem =
927 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
928 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
929 return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses);
930}
931
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000932OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
933 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
934 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
935 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000936 unsigned Size =
937 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000938 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
939 sizeof(Stmt *) *
940 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
941 OMPTaskLoopSimdDirective *Dir = new (Mem)
942 OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
943 Dir->setClauses(Clauses);
944 Dir->setAssociatedStmt(AssociatedStmt);
945 Dir->setIterationVariable(Exprs.IterationVarRef);
946 Dir->setLastIteration(Exprs.LastIteration);
947 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
948 Dir->setPreCond(Exprs.PreCond);
949 Dir->setCond(Exprs.Cond);
950 Dir->setInit(Exprs.Init);
951 Dir->setInc(Exprs.Inc);
952 Dir->setIsLastIterVariable(Exprs.IL);
953 Dir->setLowerBoundVariable(Exprs.LB);
954 Dir->setUpperBoundVariable(Exprs.UB);
955 Dir->setStrideVariable(Exprs.ST);
956 Dir->setEnsureUpperBound(Exprs.EUB);
957 Dir->setNextLowerBound(Exprs.NLB);
958 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000959 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +0000960 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
961 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +0000962 Dir->setDistInc(Exprs.DistInc);
963 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000964 Dir->setCounters(Exprs.Counters);
965 Dir->setPrivateCounters(Exprs.PrivateCounters);
966 Dir->setInits(Exprs.Inits);
967 Dir->setUpdates(Exprs.Updates);
968 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000969 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000970 return Dir;
971}
972
973OMPTaskLoopSimdDirective *
974OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
975 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000976 unsigned Size =
977 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000978 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
979 sizeof(Stmt *) *
980 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
981 return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);
982}
983
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000984OMPDistributeDirective *OMPDistributeDirective::Create(
985 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
986 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
987 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000988 unsigned Size =
989 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000990 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
991 sizeof(Stmt *) *
992 numLoopChildren(CollapsedNum, OMPD_distribute));
993 OMPDistributeDirective *Dir = new (Mem)
994 OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
995 Dir->setClauses(Clauses);
996 Dir->setAssociatedStmt(AssociatedStmt);
997 Dir->setIterationVariable(Exprs.IterationVarRef);
998 Dir->setLastIteration(Exprs.LastIteration);
999 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1000 Dir->setPreCond(Exprs.PreCond);
1001 Dir->setCond(Exprs.Cond);
1002 Dir->setInit(Exprs.Init);
1003 Dir->setInc(Exprs.Inc);
1004 Dir->setIsLastIterVariable(Exprs.IL);
1005 Dir->setLowerBoundVariable(Exprs.LB);
1006 Dir->setUpperBoundVariable(Exprs.UB);
1007 Dir->setStrideVariable(Exprs.ST);
1008 Dir->setEnsureUpperBound(Exprs.EUB);
1009 Dir->setNextLowerBound(Exprs.NLB);
1010 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +00001011 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli9925f152016-06-27 14:55:37 +00001012 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1013 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001014 Dir->setDistInc(Exprs.DistInc);
1015 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001016 Dir->setCounters(Exprs.Counters);
1017 Dir->setPrivateCounters(Exprs.PrivateCounters);
1018 Dir->setInits(Exprs.Inits);
1019 Dir->setUpdates(Exprs.Updates);
1020 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +00001021 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001022 return Dir;
1023}
1024
1025OMPDistributeDirective *
1026OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1027 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001028 unsigned Size =
1029 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001030 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1031 sizeof(Stmt *) *
1032 numLoopChildren(CollapsedNum, OMPD_distribute));
1033 return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);
1034}
Samuel Antao686c70c2016-05-26 17:30:50 +00001035
1036OMPTargetUpdateDirective *
1037OMPTargetUpdateDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1038 SourceLocation EndLoc,
1039 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001040 unsigned Size =
1041 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001042 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
1043 OMPTargetUpdateDirective *Dir =
1044 new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size());
1045 Dir->setClauses(Clauses);
1046 return Dir;
1047}
1048
1049OMPTargetUpdateDirective *
1050OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1051 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001052 unsigned Size =
1053 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001054 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
1055 return new (Mem) OMPTargetUpdateDirective(NumClauses);
1056}
Carlo Bertolli9925f152016-06-27 14:55:37 +00001057
1058OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1059 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1060 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1061 const HelperExprs &Exprs) {
1062 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001063 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001064 void *Mem = C.Allocate(
1065 Size + sizeof(OMPClause *) * Clauses.size() +
1066 sizeof(Stmt *) *
1067 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1068 OMPDistributeParallelForDirective *Dir =
1069 new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc,
1070 CollapsedNum, Clauses.size());
1071 Dir->setClauses(Clauses);
1072 Dir->setAssociatedStmt(AssociatedStmt);
1073 Dir->setIterationVariable(Exprs.IterationVarRef);
1074 Dir->setLastIteration(Exprs.LastIteration);
1075 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1076 Dir->setPreCond(Exprs.PreCond);
1077 Dir->setCond(Exprs.Cond);
1078 Dir->setInit(Exprs.Init);
1079 Dir->setInc(Exprs.Inc);
1080 Dir->setIsLastIterVariable(Exprs.IL);
1081 Dir->setLowerBoundVariable(Exprs.LB);
1082 Dir->setUpperBoundVariable(Exprs.UB);
1083 Dir->setStrideVariable(Exprs.ST);
1084 Dir->setEnsureUpperBound(Exprs.EUB);
1085 Dir->setNextLowerBound(Exprs.NLB);
1086 Dir->setNextUpperBound(Exprs.NUB);
1087 Dir->setNumIterations(Exprs.NumIterations);
1088 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1089 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001090 Dir->setDistInc(Exprs.DistInc);
1091 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Carlo Bertolli9925f152016-06-27 14:55:37 +00001092 Dir->setCounters(Exprs.Counters);
1093 Dir->setPrivateCounters(Exprs.PrivateCounters);
1094 Dir->setInits(Exprs.Inits);
1095 Dir->setUpdates(Exprs.Updates);
1096 Dir->setFinals(Exprs.Finals);
1097 Dir->setPreInits(Exprs.PreInits);
1098 return Dir;
1099}
1100
1101OMPDistributeParallelForDirective *
1102OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1103 unsigned NumClauses,
1104 unsigned CollapsedNum,
1105 EmptyShell) {
1106 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001107 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001108 void *Mem = C.Allocate(
1109 Size + sizeof(OMPClause *) * NumClauses +
1110 sizeof(Stmt *) *
1111 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1112 return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses);
1113}
Kelvin Li4a39add2016-07-05 05:00:15 +00001114
1115OMPDistributeParallelForSimdDirective *
1116OMPDistributeParallelForSimdDirective::Create(
1117 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1118 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1119 const HelperExprs &Exprs) {
1120 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001121 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001122 void *Mem = C.Allocate(
1123 Size + sizeof(OMPClause *) * Clauses.size() +
1124 sizeof(Stmt *) *
1125 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1126 OMPDistributeParallelForSimdDirective *Dir = new (Mem)
1127 OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1128 Clauses.size());
1129 Dir->setClauses(Clauses);
1130 Dir->setAssociatedStmt(AssociatedStmt);
1131 Dir->setIterationVariable(Exprs.IterationVarRef);
1132 Dir->setLastIteration(Exprs.LastIteration);
1133 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1134 Dir->setPreCond(Exprs.PreCond);
1135 Dir->setCond(Exprs.Cond);
1136 Dir->setInit(Exprs.Init);
1137 Dir->setInc(Exprs.Inc);
1138 Dir->setIsLastIterVariable(Exprs.IL);
1139 Dir->setLowerBoundVariable(Exprs.LB);
1140 Dir->setUpperBoundVariable(Exprs.UB);
1141 Dir->setStrideVariable(Exprs.ST);
1142 Dir->setEnsureUpperBound(Exprs.EUB);
1143 Dir->setNextLowerBound(Exprs.NLB);
1144 Dir->setNextUpperBound(Exprs.NUB);
1145 Dir->setNumIterations(Exprs.NumIterations);
1146 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1147 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001148 Dir->setDistInc(Exprs.DistInc);
1149 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li4a39add2016-07-05 05:00:15 +00001150 Dir->setCounters(Exprs.Counters);
1151 Dir->setPrivateCounters(Exprs.PrivateCounters);
1152 Dir->setInits(Exprs.Inits);
1153 Dir->setUpdates(Exprs.Updates);
1154 Dir->setFinals(Exprs.Finals);
1155 Dir->setPreInits(Exprs.PreInits);
1156 return Dir;
1157}
1158
1159OMPDistributeParallelForSimdDirective *
1160OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1161 unsigned NumClauses,
1162 unsigned CollapsedNum,
1163 EmptyShell) {
1164 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001165 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001166 void *Mem = C.Allocate(
1167 Size + sizeof(OMPClause *) * NumClauses +
1168 sizeof(Stmt *) *
1169 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1170 return new (Mem)
1171 OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1172}
Kelvin Li787f3fc2016-07-06 04:45:38 +00001173
1174OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1175 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1176 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1177 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001178 unsigned Size =
1179 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001180 void *Mem = C.Allocate(
1181 Size + sizeof(OMPClause *) * Clauses.size() +
1182 sizeof(Stmt *) *
1183 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1184 OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective(
1185 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1186 Dir->setClauses(Clauses);
1187 Dir->setAssociatedStmt(AssociatedStmt);
1188 Dir->setIterationVariable(Exprs.IterationVarRef);
1189 Dir->setLastIteration(Exprs.LastIteration);
1190 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1191 Dir->setPreCond(Exprs.PreCond);
1192 Dir->setCond(Exprs.Cond);
1193 Dir->setInit(Exprs.Init);
1194 Dir->setInc(Exprs.Inc);
1195 Dir->setIsLastIterVariable(Exprs.IL);
1196 Dir->setLowerBoundVariable(Exprs.LB);
1197 Dir->setUpperBoundVariable(Exprs.UB);
1198 Dir->setStrideVariable(Exprs.ST);
1199 Dir->setEnsureUpperBound(Exprs.EUB);
1200 Dir->setNextLowerBound(Exprs.NLB);
1201 Dir->setNextUpperBound(Exprs.NUB);
1202 Dir->setNumIterations(Exprs.NumIterations);
1203 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1204 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001205 Dir->setDistInc(Exprs.DistInc);
1206 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li787f3fc2016-07-06 04:45:38 +00001207 Dir->setCounters(Exprs.Counters);
1208 Dir->setPrivateCounters(Exprs.PrivateCounters);
1209 Dir->setInits(Exprs.Inits);
1210 Dir->setUpdates(Exprs.Updates);
1211 Dir->setFinals(Exprs.Finals);
1212 Dir->setPreInits(Exprs.PreInits);
1213 return Dir;
1214}
1215
1216OMPDistributeSimdDirective *
1217OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1218 unsigned NumClauses,
1219 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001220 unsigned Size =
1221 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001222 void *Mem = C.Allocate(
1223 Size + sizeof(OMPClause *) * NumClauses +
1224 sizeof(Stmt *) *
1225 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1226 return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses);
1227}
Kelvin Lia579b912016-07-14 02:54:56 +00001228
1229OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1230 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1231 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1232 const HelperExprs &Exprs) {
1233 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001234 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001235 void *Mem = C.Allocate(
1236 Size + sizeof(OMPClause *) * Clauses.size() +
1237 sizeof(Stmt *) *
1238 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1239 OMPTargetParallelForSimdDirective *Dir =
1240 new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc,
1241 CollapsedNum, Clauses.size());
1242 Dir->setClauses(Clauses);
1243 Dir->setAssociatedStmt(AssociatedStmt);
1244 Dir->setIterationVariable(Exprs.IterationVarRef);
1245 Dir->setLastIteration(Exprs.LastIteration);
1246 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1247 Dir->setPreCond(Exprs.PreCond);
1248 Dir->setCond(Exprs.Cond);
1249 Dir->setInit(Exprs.Init);
1250 Dir->setInc(Exprs.Inc);
1251 Dir->setIsLastIterVariable(Exprs.IL);
1252 Dir->setLowerBoundVariable(Exprs.LB);
1253 Dir->setUpperBoundVariable(Exprs.UB);
1254 Dir->setStrideVariable(Exprs.ST);
1255 Dir->setEnsureUpperBound(Exprs.EUB);
1256 Dir->setNextLowerBound(Exprs.NLB);
1257 Dir->setNextUpperBound(Exprs.NUB);
1258 Dir->setNumIterations(Exprs.NumIterations);
1259 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1260 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001261 Dir->setDistInc(Exprs.DistInc);
1262 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Lia579b912016-07-14 02:54:56 +00001263 Dir->setCounters(Exprs.Counters);
1264 Dir->setPrivateCounters(Exprs.PrivateCounters);
1265 Dir->setInits(Exprs.Inits);
1266 Dir->setUpdates(Exprs.Updates);
1267 Dir->setFinals(Exprs.Finals);
1268 Dir->setPreInits(Exprs.PreInits);
1269 return Dir;
1270}
1271
1272OMPTargetParallelForSimdDirective *
1273OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1274 unsigned NumClauses,
1275 unsigned CollapsedNum,
1276 EmptyShell) {
1277 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001278 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001279 void *Mem = C.Allocate(
1280 Size + sizeof(OMPClause *) * NumClauses +
1281 sizeof(Stmt *) *
1282 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1283 return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses);
1284}
Kelvin Li986330c2016-07-20 22:57:10 +00001285
1286OMPTargetSimdDirective *
1287OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1288 SourceLocation EndLoc, unsigned CollapsedNum,
1289 ArrayRef<OMPClause *> Clauses,
1290 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001291 unsigned Size =
1292 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001293 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1294 sizeof(Stmt *) *
1295 numLoopChildren(CollapsedNum, OMPD_target_simd));
1296 OMPTargetSimdDirective *Dir = new (Mem)
1297 OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1298 Dir->setClauses(Clauses);
1299 Dir->setAssociatedStmt(AssociatedStmt);
1300 Dir->setIterationVariable(Exprs.IterationVarRef);
1301 Dir->setLastIteration(Exprs.LastIteration);
1302 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1303 Dir->setPreCond(Exprs.PreCond);
1304 Dir->setCond(Exprs.Cond);
1305 Dir->setInit(Exprs.Init);
1306 Dir->setInc(Exprs.Inc);
1307 Dir->setCounters(Exprs.Counters);
1308 Dir->setPrivateCounters(Exprs.PrivateCounters);
1309 Dir->setInits(Exprs.Inits);
1310 Dir->setUpdates(Exprs.Updates);
1311 Dir->setFinals(Exprs.Finals);
1312 Dir->setPreInits(Exprs.PreInits);
1313 return Dir;
1314}
1315
1316OMPTargetSimdDirective *
1317OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1318 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001319 unsigned Size =
1320 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001321 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1322 sizeof(Stmt *) *
1323 numLoopChildren(CollapsedNum, OMPD_target_simd));
1324 return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses);
1325}
Kelvin Li02532872016-08-05 14:37:37 +00001326
1327OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1328 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1329 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1330 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001331 unsigned Size =
1332 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001333 void *Mem = C.Allocate(
1334 Size + sizeof(OMPClause *) * Clauses.size() +
1335 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1336 OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective(
1337 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1338 Dir->setClauses(Clauses);
1339 Dir->setAssociatedStmt(AssociatedStmt);
1340 Dir->setIterationVariable(Exprs.IterationVarRef);
1341 Dir->setLastIteration(Exprs.LastIteration);
1342 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1343 Dir->setPreCond(Exprs.PreCond);
1344 Dir->setCond(Exprs.Cond);
1345 Dir->setInit(Exprs.Init);
1346 Dir->setInc(Exprs.Inc);
1347 Dir->setIsLastIterVariable(Exprs.IL);
1348 Dir->setLowerBoundVariable(Exprs.LB);
1349 Dir->setUpperBoundVariable(Exprs.UB);
1350 Dir->setStrideVariable(Exprs.ST);
1351 Dir->setEnsureUpperBound(Exprs.EUB);
1352 Dir->setNextLowerBound(Exprs.NLB);
1353 Dir->setNextUpperBound(Exprs.NUB);
1354 Dir->setNumIterations(Exprs.NumIterations);
1355 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1356 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001357 Dir->setDistInc(Exprs.DistInc);
1358 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li02532872016-08-05 14:37:37 +00001359 Dir->setCounters(Exprs.Counters);
1360 Dir->setPrivateCounters(Exprs.PrivateCounters);
1361 Dir->setInits(Exprs.Inits);
1362 Dir->setUpdates(Exprs.Updates);
1363 Dir->setFinals(Exprs.Finals);
1364 Dir->setPreInits(Exprs.PreInits);
1365 return Dir;
1366}
1367
1368OMPTeamsDistributeDirective *
1369OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1370 unsigned NumClauses,
1371 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001372 unsigned Size =
1373 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001374 void *Mem = C.Allocate(
1375 Size + sizeof(OMPClause *) * NumClauses +
1376 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1377 return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses);
1378}
Kelvin Li4e325f72016-10-25 12:50:55 +00001379
1380OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1381 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1382 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1383 const HelperExprs &Exprs) {
1384 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1385 alignof(OMPClause *));
1386 void *Mem =
1387 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1388 sizeof(Stmt *) *
1389 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1390 OMPTeamsDistributeSimdDirective *Dir =
1391 new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1392 Clauses.size());
1393 Dir->setClauses(Clauses);
1394 Dir->setAssociatedStmt(AssociatedStmt);
1395 Dir->setIterationVariable(Exprs.IterationVarRef);
1396 Dir->setLastIteration(Exprs.LastIteration);
1397 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1398 Dir->setPreCond(Exprs.PreCond);
1399 Dir->setCond(Exprs.Cond);
1400 Dir->setInit(Exprs.Init);
1401 Dir->setInc(Exprs.Inc);
1402 Dir->setIsLastIterVariable(Exprs.IL);
1403 Dir->setLowerBoundVariable(Exprs.LB);
1404 Dir->setUpperBoundVariable(Exprs.UB);
1405 Dir->setStrideVariable(Exprs.ST);
1406 Dir->setEnsureUpperBound(Exprs.EUB);
1407 Dir->setNextLowerBound(Exprs.NLB);
1408 Dir->setNextUpperBound(Exprs.NUB);
1409 Dir->setNumIterations(Exprs.NumIterations);
1410 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1411 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001412 Dir->setDistInc(Exprs.DistInc);
1413 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li4e325f72016-10-25 12:50:55 +00001414 Dir->setCounters(Exprs.Counters);
1415 Dir->setPrivateCounters(Exprs.PrivateCounters);
1416 Dir->setInits(Exprs.Inits);
1417 Dir->setUpdates(Exprs.Updates);
1418 Dir->setFinals(Exprs.Finals);
1419 Dir->setPreInits(Exprs.PreInits);
1420 return Dir;
1421}
1422
1423OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1424 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1425 EmptyShell) {
1426 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1427 alignof(OMPClause *));
1428 void *Mem =
1429 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1430 sizeof(Stmt *) *
1431 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1432 return new (Mem) OMPTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1433}
Kelvin Li579e41c2016-11-30 23:51:03 +00001434
1435OMPTeamsDistributeParallelForSimdDirective *
1436OMPTeamsDistributeParallelForSimdDirective::Create(
1437 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1438 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1439 const HelperExprs &Exprs) {
1440 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1441 alignof(OMPClause *));
1442 void *Mem =
1443 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1444 sizeof(Stmt *) *
1445 numLoopChildren(CollapsedNum,
1446 OMPD_teams_distribute_parallel_for_simd));
1447 OMPTeamsDistributeParallelForSimdDirective *Dir = new (Mem)
1448 OMPTeamsDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1449 Clauses.size());
1450 Dir->setClauses(Clauses);
1451 Dir->setAssociatedStmt(AssociatedStmt);
1452 Dir->setIterationVariable(Exprs.IterationVarRef);
1453 Dir->setLastIteration(Exprs.LastIteration);
1454 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1455 Dir->setPreCond(Exprs.PreCond);
1456 Dir->setCond(Exprs.Cond);
1457 Dir->setInit(Exprs.Init);
1458 Dir->setInc(Exprs.Inc);
1459 Dir->setIsLastIterVariable(Exprs.IL);
1460 Dir->setLowerBoundVariable(Exprs.LB);
1461 Dir->setUpperBoundVariable(Exprs.UB);
1462 Dir->setStrideVariable(Exprs.ST);
1463 Dir->setEnsureUpperBound(Exprs.EUB);
1464 Dir->setNextLowerBound(Exprs.NLB);
1465 Dir->setNextUpperBound(Exprs.NUB);
1466 Dir->setNumIterations(Exprs.NumIterations);
1467 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1468 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001469 Dir->setDistInc(Exprs.DistInc);
1470 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li579e41c2016-11-30 23:51:03 +00001471 Dir->setCounters(Exprs.Counters);
1472 Dir->setPrivateCounters(Exprs.PrivateCounters);
1473 Dir->setInits(Exprs.Inits);
1474 Dir->setUpdates(Exprs.Updates);
1475 Dir->setFinals(Exprs.Finals);
1476 Dir->setPreInits(Exprs.PreInits);
1477 return Dir;
1478}
1479
1480OMPTeamsDistributeParallelForSimdDirective *
1481OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1482 unsigned NumClauses,
1483 unsigned CollapsedNum,
1484 EmptyShell) {
1485 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1486 alignof(OMPClause *));
1487 void *Mem =
1488 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1489 sizeof(Stmt *) *
1490 numLoopChildren(CollapsedNum,
1491 OMPD_teams_distribute_parallel_for_simd));
1492 return new (Mem)
1493 OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1494}
Kelvin Li7ade93f2016-12-09 03:24:30 +00001495
1496OMPTeamsDistributeParallelForDirective *
1497OMPTeamsDistributeParallelForDirective::Create(
1498 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1499 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1500 const HelperExprs &Exprs) {
1501 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1502 alignof(OMPClause *));
1503 void *Mem = C.Allocate(
1504 Size + sizeof(OMPClause *) * Clauses.size() +
1505 sizeof(Stmt *) *
1506 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1507 OMPTeamsDistributeParallelForDirective *Dir = new (Mem)
1508 OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum,
1509 Clauses.size());
1510 Dir->setClauses(Clauses);
1511 Dir->setAssociatedStmt(AssociatedStmt);
1512 Dir->setIterationVariable(Exprs.IterationVarRef);
1513 Dir->setLastIteration(Exprs.LastIteration);
1514 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1515 Dir->setPreCond(Exprs.PreCond);
1516 Dir->setCond(Exprs.Cond);
1517 Dir->setInit(Exprs.Init);
1518 Dir->setInc(Exprs.Inc);
1519 Dir->setIsLastIterVariable(Exprs.IL);
1520 Dir->setLowerBoundVariable(Exprs.LB);
1521 Dir->setUpperBoundVariable(Exprs.UB);
1522 Dir->setStrideVariable(Exprs.ST);
1523 Dir->setEnsureUpperBound(Exprs.EUB);
1524 Dir->setNextLowerBound(Exprs.NLB);
1525 Dir->setNextUpperBound(Exprs.NUB);
1526 Dir->setNumIterations(Exprs.NumIterations);
1527 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1528 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001529 Dir->setDistInc(Exprs.DistInc);
1530 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li7ade93f2016-12-09 03:24:30 +00001531 Dir->setCounters(Exprs.Counters);
1532 Dir->setPrivateCounters(Exprs.PrivateCounters);
1533 Dir->setInits(Exprs.Inits);
1534 Dir->setUpdates(Exprs.Updates);
1535 Dir->setFinals(Exprs.Finals);
1536 Dir->setPreInits(Exprs.PreInits);
1537 return Dir;
1538}
1539
1540OMPTeamsDistributeParallelForDirective *
1541OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1542 unsigned NumClauses,
1543 unsigned CollapsedNum,
1544 EmptyShell) {
1545 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1546 alignof(OMPClause *));
1547 void *Mem = C.Allocate(
1548 Size + sizeof(OMPClause *) * NumClauses +
1549 sizeof(Stmt *) *
1550 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1551 return new (Mem)
1552 OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1553}
1554
Kelvin Libf594a52016-12-17 05:48:59 +00001555OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1556 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1557 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1558 auto Size =
1559 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1560 void *Mem =
1561 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
1562 OMPTargetTeamsDirective *Dir =
1563 new (Mem) OMPTargetTeamsDirective(StartLoc, EndLoc, Clauses.size());
1564 Dir->setClauses(Clauses);
1565 Dir->setAssociatedStmt(AssociatedStmt);
1566 return Dir;
1567}
1568
1569OMPTargetTeamsDirective *
1570OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1571 EmptyShell) {
1572 auto Size =
1573 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1574 void *Mem =
1575 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1576 return new (Mem) OMPTargetTeamsDirective(NumClauses);
1577}
Kelvin Li83c451e2016-12-25 04:52:54 +00001578
1579OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
1580 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1581 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1582 const HelperExprs &Exprs) {
1583 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1584 alignof(OMPClause *));
1585 void *Mem = C.Allocate(
1586 Size + sizeof(OMPClause *) * Clauses.size() +
1587 sizeof(Stmt *) *
1588 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1589 OMPTargetTeamsDistributeDirective *Dir =
1590 new (Mem) OMPTargetTeamsDistributeDirective(StartLoc, EndLoc, CollapsedNum,
1591 Clauses.size());
1592 Dir->setClauses(Clauses);
1593 Dir->setAssociatedStmt(AssociatedStmt);
1594 Dir->setIterationVariable(Exprs.IterationVarRef);
1595 Dir->setLastIteration(Exprs.LastIteration);
1596 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1597 Dir->setPreCond(Exprs.PreCond);
1598 Dir->setCond(Exprs.Cond);
1599 Dir->setInit(Exprs.Init);
1600 Dir->setInc(Exprs.Inc);
1601 Dir->setIsLastIterVariable(Exprs.IL);
1602 Dir->setLowerBoundVariable(Exprs.LB);
1603 Dir->setUpperBoundVariable(Exprs.UB);
1604 Dir->setStrideVariable(Exprs.ST);
1605 Dir->setEnsureUpperBound(Exprs.EUB);
1606 Dir->setNextLowerBound(Exprs.NLB);
1607 Dir->setNextUpperBound(Exprs.NUB);
1608 Dir->setNumIterations(Exprs.NumIterations);
1609 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1610 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001611 Dir->setDistInc(Exprs.DistInc);
1612 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li83c451e2016-12-25 04:52:54 +00001613 Dir->setCounters(Exprs.Counters);
1614 Dir->setPrivateCounters(Exprs.PrivateCounters);
1615 Dir->setInits(Exprs.Inits);
1616 Dir->setUpdates(Exprs.Updates);
1617 Dir->setFinals(Exprs.Finals);
1618 Dir->setPreInits(Exprs.PreInits);
1619 return Dir;
1620}
1621
1622OMPTargetTeamsDistributeDirective *
1623OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1624 unsigned NumClauses,
1625 unsigned CollapsedNum,
1626 EmptyShell) {
1627 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1628 alignof(OMPClause *));
1629 void *Mem = C.Allocate(
1630 Size + sizeof(OMPClause *) * NumClauses +
1631 sizeof(Stmt *) *
1632 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1633 return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses);
1634}
Kelvin Li80e8f562016-12-29 22:16:30 +00001635
1636OMPTargetTeamsDistributeParallelForDirective *
1637OMPTargetTeamsDistributeParallelForDirective::Create(
1638 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1639 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1640 const HelperExprs &Exprs) {
1641 auto Size =
1642 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1643 alignof(OMPClause *));
1644 void *Mem = C.Allocate(
1645 Size + sizeof(OMPClause *) * Clauses.size() +
1646 sizeof(Stmt *) *
1647 numLoopChildren(CollapsedNum,
1648 OMPD_target_teams_distribute_parallel_for));
1649 OMPTargetTeamsDistributeParallelForDirective *Dir =
1650 new (Mem) OMPTargetTeamsDistributeParallelForDirective(
1651 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1652 Dir->setClauses(Clauses);
1653 Dir->setAssociatedStmt(AssociatedStmt);
1654 Dir->setIterationVariable(Exprs.IterationVarRef);
1655 Dir->setLastIteration(Exprs.LastIteration);
1656 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1657 Dir->setPreCond(Exprs.PreCond);
1658 Dir->setCond(Exprs.Cond);
1659 Dir->setInit(Exprs.Init);
1660 Dir->setInc(Exprs.Inc);
1661 Dir->setIsLastIterVariable(Exprs.IL);
1662 Dir->setLowerBoundVariable(Exprs.LB);
1663 Dir->setUpperBoundVariable(Exprs.UB);
1664 Dir->setStrideVariable(Exprs.ST);
1665 Dir->setEnsureUpperBound(Exprs.EUB);
1666 Dir->setNextLowerBound(Exprs.NLB);
1667 Dir->setNextUpperBound(Exprs.NUB);
1668 Dir->setNumIterations(Exprs.NumIterations);
1669 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1670 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001671 Dir->setDistInc(Exprs.DistInc);
1672 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li80e8f562016-12-29 22:16:30 +00001673 Dir->setCounters(Exprs.Counters);
1674 Dir->setPrivateCounters(Exprs.PrivateCounters);
1675 Dir->setInits(Exprs.Inits);
1676 Dir->setUpdates(Exprs.Updates);
1677 Dir->setFinals(Exprs.Finals);
1678 Dir->setPreInits(Exprs.PreInits);
1679 return Dir;
1680}
1681
1682OMPTargetTeamsDistributeParallelForDirective *
1683OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1684 unsigned NumClauses,
1685 unsigned CollapsedNum,
1686 EmptyShell) {
1687 auto Size =
1688 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1689 alignof(OMPClause *));
1690 void *Mem = C.Allocate(
1691 Size + sizeof(OMPClause *) * NumClauses +
1692 sizeof(Stmt *) *
1693 numLoopChildren(CollapsedNum,
1694 OMPD_target_teams_distribute_parallel_for));
1695 return new (Mem)
1696 OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1697}
Kelvin Li1851df52017-01-03 05:23:48 +00001698
1699OMPTargetTeamsDistributeParallelForSimdDirective *
1700OMPTargetTeamsDistributeParallelForSimdDirective::Create(
1701 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1702 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1703 const HelperExprs &Exprs) {
1704 auto Size =
1705 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1706 alignof(OMPClause *));
1707 void *Mem = C.Allocate(
1708 Size + sizeof(OMPClause *) * Clauses.size() +
1709 sizeof(Stmt *) *
1710 numLoopChildren(CollapsedNum,
1711 OMPD_target_teams_distribute_parallel_for_simd));
1712 OMPTargetTeamsDistributeParallelForSimdDirective *Dir =
1713 new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1714 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1715 Dir->setClauses(Clauses);
1716 Dir->setAssociatedStmt(AssociatedStmt);
1717 Dir->setIterationVariable(Exprs.IterationVarRef);
1718 Dir->setLastIteration(Exprs.LastIteration);
1719 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1720 Dir->setPreCond(Exprs.PreCond);
1721 Dir->setCond(Exprs.Cond);
1722 Dir->setInit(Exprs.Init);
1723 Dir->setInc(Exprs.Inc);
1724 Dir->setIsLastIterVariable(Exprs.IL);
1725 Dir->setLowerBoundVariable(Exprs.LB);
1726 Dir->setUpperBoundVariable(Exprs.UB);
1727 Dir->setStrideVariable(Exprs.ST);
1728 Dir->setEnsureUpperBound(Exprs.EUB);
1729 Dir->setNextLowerBound(Exprs.NLB);
1730 Dir->setNextUpperBound(Exprs.NUB);
1731 Dir->setNumIterations(Exprs.NumIterations);
1732 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1733 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001734 Dir->setDistInc(Exprs.DistInc);
1735 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li1851df52017-01-03 05:23:48 +00001736 Dir->setCounters(Exprs.Counters);
1737 Dir->setPrivateCounters(Exprs.PrivateCounters);
1738 Dir->setInits(Exprs.Inits);
1739 Dir->setUpdates(Exprs.Updates);
1740 Dir->setFinals(Exprs.Finals);
1741 Dir->setPreInits(Exprs.PreInits);
1742 return Dir;
1743}
1744
1745OMPTargetTeamsDistributeParallelForSimdDirective *
1746OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
1747 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1748 EmptyShell) {
1749 auto Size =
1750 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1751 alignof(OMPClause *));
1752 void *Mem = C.Allocate(
1753 Size + sizeof(OMPClause *) * NumClauses +
1754 sizeof(Stmt *) *
1755 numLoopChildren(CollapsedNum,
1756 OMPD_target_teams_distribute_parallel_for_simd));
1757 return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1758 CollapsedNum, NumClauses);
1759}
1760
Kelvin Lida681182017-01-10 18:08:18 +00001761OMPTargetTeamsDistributeSimdDirective *
1762OMPTargetTeamsDistributeSimdDirective::Create(
1763 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1764 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1765 const HelperExprs &Exprs) {
1766 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1767 alignof(OMPClause *));
1768 void *Mem = C.Allocate(
1769 Size + sizeof(OMPClause *) * Clauses.size() +
1770 sizeof(Stmt *) *
1771 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1772 OMPTargetTeamsDistributeSimdDirective *Dir = new (Mem)
1773 OMPTargetTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1774 Clauses.size());
1775 Dir->setClauses(Clauses);
1776 Dir->setAssociatedStmt(AssociatedStmt);
1777 Dir->setIterationVariable(Exprs.IterationVarRef);
1778 Dir->setLastIteration(Exprs.LastIteration);
1779 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1780 Dir->setPreCond(Exprs.PreCond);
1781 Dir->setCond(Exprs.Cond);
1782 Dir->setInit(Exprs.Init);
1783 Dir->setInc(Exprs.Inc);
1784 Dir->setIsLastIterVariable(Exprs.IL);
1785 Dir->setLowerBoundVariable(Exprs.LB);
1786 Dir->setUpperBoundVariable(Exprs.UB);
1787 Dir->setStrideVariable(Exprs.ST);
1788 Dir->setEnsureUpperBound(Exprs.EUB);
1789 Dir->setNextLowerBound(Exprs.NLB);
1790 Dir->setNextUpperBound(Exprs.NUB);
1791 Dir->setNumIterations(Exprs.NumIterations);
1792 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1793 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001794 Dir->setDistInc(Exprs.DistInc);
1795 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Lida681182017-01-10 18:08:18 +00001796 Dir->setCounters(Exprs.Counters);
1797 Dir->setPrivateCounters(Exprs.PrivateCounters);
1798 Dir->setInits(Exprs.Inits);
1799 Dir->setUpdates(Exprs.Updates);
1800 Dir->setFinals(Exprs.Finals);
1801 Dir->setPreInits(Exprs.PreInits);
1802 return Dir;
1803}
1804
1805OMPTargetTeamsDistributeSimdDirective *
1806OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1807 unsigned NumClauses,
1808 unsigned CollapsedNum,
1809 EmptyShell) {
1810 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1811 alignof(OMPClause *));
1812 void *Mem = C.Allocate(
1813 Size + sizeof(OMPClause *) * NumClauses +
1814 sizeof(Stmt *) *
1815 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1816 return new (Mem)
1817 OMPTargetTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1818}