blob: b4e579521108478103277ca683f697daa8263500 [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);
James Y Knightb8bfd962015-10-02 13:41:04 +0000150 Dir->setCounters(Exprs.Counters);
151 Dir->setPrivateCounters(Exprs.PrivateCounters);
152 Dir->setInits(Exprs.Inits);
153 Dir->setUpdates(Exprs.Updates);
154 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000155 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000156 Dir->setHasCancel(HasCancel);
157 return Dir;
158}
159
160OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
161 unsigned NumClauses,
162 unsigned CollapsedNum,
163 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000164 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000165 void *Mem =
166 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
167 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
168 return new (Mem) OMPForDirective(CollapsedNum, NumClauses);
169}
170
171OMPForSimdDirective *
172OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
173 SourceLocation EndLoc, unsigned CollapsedNum,
174 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
175 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000176 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000177 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000178 void *Mem =
179 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
180 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
181 OMPForSimdDirective *Dir = new (Mem)
182 OMPForSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
183 Dir->setClauses(Clauses);
184 Dir->setAssociatedStmt(AssociatedStmt);
185 Dir->setIterationVariable(Exprs.IterationVarRef);
186 Dir->setLastIteration(Exprs.LastIteration);
187 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
188 Dir->setPreCond(Exprs.PreCond);
189 Dir->setCond(Exprs.Cond);
190 Dir->setInit(Exprs.Init);
191 Dir->setInc(Exprs.Inc);
192 Dir->setIsLastIterVariable(Exprs.IL);
193 Dir->setLowerBoundVariable(Exprs.LB);
194 Dir->setUpperBoundVariable(Exprs.UB);
195 Dir->setStrideVariable(Exprs.ST);
196 Dir->setEnsureUpperBound(Exprs.EUB);
197 Dir->setNextLowerBound(Exprs.NLB);
198 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000199 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000200 Dir->setCounters(Exprs.Counters);
201 Dir->setPrivateCounters(Exprs.PrivateCounters);
202 Dir->setInits(Exprs.Inits);
203 Dir->setUpdates(Exprs.Updates);
204 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000205 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000206 return Dir;
207}
208
209OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
210 unsigned NumClauses,
211 unsigned CollapsedNum,
212 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000213 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000214 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000215 void *Mem =
216 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
217 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
218 return new (Mem) OMPForSimdDirective(CollapsedNum, NumClauses);
219}
220
221OMPSectionsDirective *OMPSectionsDirective::Create(
222 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
223 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000224 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000225 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000226 void *Mem =
227 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
228 OMPSectionsDirective *Dir =
229 new (Mem) OMPSectionsDirective(StartLoc, EndLoc, Clauses.size());
230 Dir->setClauses(Clauses);
231 Dir->setAssociatedStmt(AssociatedStmt);
232 Dir->setHasCancel(HasCancel);
233 return Dir;
234}
235
236OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
237 unsigned NumClauses,
238 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000239 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000240 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000241 void *Mem =
242 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
243 return new (Mem) OMPSectionsDirective(NumClauses);
244}
245
246OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
247 SourceLocation StartLoc,
248 SourceLocation EndLoc,
249 Stmt *AssociatedStmt,
250 bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000251 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000252 void *Mem = C.Allocate(Size + sizeof(Stmt *));
253 OMPSectionDirective *Dir = new (Mem) OMPSectionDirective(StartLoc, EndLoc);
254 Dir->setAssociatedStmt(AssociatedStmt);
255 Dir->setHasCancel(HasCancel);
256 return Dir;
257}
258
259OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
260 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000261 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000262 void *Mem = C.Allocate(Size + sizeof(Stmt *));
263 return new (Mem) OMPSectionDirective();
264}
265
266OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
267 SourceLocation StartLoc,
268 SourceLocation EndLoc,
269 ArrayRef<OMPClause *> Clauses,
270 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000271 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000272 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000273 void *Mem =
274 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
275 OMPSingleDirective *Dir =
276 new (Mem) OMPSingleDirective(StartLoc, EndLoc, Clauses.size());
277 Dir->setClauses(Clauses);
278 Dir->setAssociatedStmt(AssociatedStmt);
279 return Dir;
280}
281
282OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
283 unsigned NumClauses,
284 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000285 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000286 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000287 void *Mem =
288 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
289 return new (Mem) OMPSingleDirective(NumClauses);
290}
291
292OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
293 SourceLocation StartLoc,
294 SourceLocation EndLoc,
295 Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000296 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000297 void *Mem = C.Allocate(Size + sizeof(Stmt *));
298 OMPMasterDirective *Dir = new (Mem) OMPMasterDirective(StartLoc, EndLoc);
299 Dir->setAssociatedStmt(AssociatedStmt);
300 return Dir;
301}
302
303OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
304 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000305 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000306 void *Mem = C.Allocate(Size + sizeof(Stmt *));
307 return new (Mem) OMPMasterDirective();
308}
309
310OMPCriticalDirective *OMPCriticalDirective::Create(
311 const ASTContext &C, const DeclarationNameInfo &Name,
Alexey Bataev28c75412015-12-15 08:19:24 +0000312 SourceLocation StartLoc, SourceLocation EndLoc,
313 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000314 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000315 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000316 void *Mem =
317 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000318 OMPCriticalDirective *Dir =
Alexey Bataev28c75412015-12-15 08:19:24 +0000319 new (Mem) OMPCriticalDirective(Name, StartLoc, EndLoc, Clauses.size());
320 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000321 Dir->setAssociatedStmt(AssociatedStmt);
322 return Dir;
323}
324
325OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev28c75412015-12-15 08:19:24 +0000326 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000327 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000328 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000329 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000330 void *Mem =
331 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
332 return new (Mem) OMPCriticalDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000333}
334
335OMPParallelForDirective *OMPParallelForDirective::Create(
336 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
337 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
338 const HelperExprs &Exprs, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000339 unsigned Size =
340 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000341 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
342 sizeof(Stmt *) *
343 numLoopChildren(CollapsedNum, OMPD_parallel_for));
344 OMPParallelForDirective *Dir = new (Mem)
345 OMPParallelForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
346 Dir->setClauses(Clauses);
347 Dir->setAssociatedStmt(AssociatedStmt);
348 Dir->setIterationVariable(Exprs.IterationVarRef);
349 Dir->setLastIteration(Exprs.LastIteration);
350 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
351 Dir->setPreCond(Exprs.PreCond);
352 Dir->setCond(Exprs.Cond);
353 Dir->setInit(Exprs.Init);
354 Dir->setInc(Exprs.Inc);
355 Dir->setIsLastIterVariable(Exprs.IL);
356 Dir->setLowerBoundVariable(Exprs.LB);
357 Dir->setUpperBoundVariable(Exprs.UB);
358 Dir->setStrideVariable(Exprs.ST);
359 Dir->setEnsureUpperBound(Exprs.EUB);
360 Dir->setNextLowerBound(Exprs.NLB);
361 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000362 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000363 Dir->setCounters(Exprs.Counters);
364 Dir->setPrivateCounters(Exprs.PrivateCounters);
365 Dir->setInits(Exprs.Inits);
366 Dir->setUpdates(Exprs.Updates);
367 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000368 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000369 Dir->setHasCancel(HasCancel);
370 return Dir;
371}
372
373OMPParallelForDirective *
374OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
375 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000376 unsigned Size =
377 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000378 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
379 sizeof(Stmt *) *
380 numLoopChildren(CollapsedNum, OMPD_parallel_for));
381 return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses);
382}
383
384OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
385 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
386 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
387 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000388 unsigned Size =
389 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000390 void *Mem = C.Allocate(
391 Size + sizeof(OMPClause *) * Clauses.size() +
392 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
393 OMPParallelForSimdDirective *Dir = new (Mem) OMPParallelForSimdDirective(
394 StartLoc, EndLoc, CollapsedNum, Clauses.size());
395 Dir->setClauses(Clauses);
396 Dir->setAssociatedStmt(AssociatedStmt);
397 Dir->setIterationVariable(Exprs.IterationVarRef);
398 Dir->setLastIteration(Exprs.LastIteration);
399 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
400 Dir->setPreCond(Exprs.PreCond);
401 Dir->setCond(Exprs.Cond);
402 Dir->setInit(Exprs.Init);
403 Dir->setInc(Exprs.Inc);
404 Dir->setIsLastIterVariable(Exprs.IL);
405 Dir->setLowerBoundVariable(Exprs.LB);
406 Dir->setUpperBoundVariable(Exprs.UB);
407 Dir->setStrideVariable(Exprs.ST);
408 Dir->setEnsureUpperBound(Exprs.EUB);
409 Dir->setNextLowerBound(Exprs.NLB);
410 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000411 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000412 Dir->setCounters(Exprs.Counters);
413 Dir->setPrivateCounters(Exprs.PrivateCounters);
414 Dir->setInits(Exprs.Inits);
415 Dir->setUpdates(Exprs.Updates);
416 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000417 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000418 return Dir;
419}
420
421OMPParallelForSimdDirective *
422OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
423 unsigned NumClauses,
424 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000425 unsigned Size =
426 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000427 void *Mem = C.Allocate(
428 Size + sizeof(OMPClause *) * NumClauses +
429 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
430 return new (Mem) OMPParallelForSimdDirective(CollapsedNum, NumClauses);
431}
432
433OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
434 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
435 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000436 unsigned Size =
437 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000438 void *Mem =
439 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
440 OMPParallelSectionsDirective *Dir =
441 new (Mem) OMPParallelSectionsDirective(StartLoc, EndLoc, Clauses.size());
442 Dir->setClauses(Clauses);
443 Dir->setAssociatedStmt(AssociatedStmt);
444 Dir->setHasCancel(HasCancel);
445 return Dir;
446}
447
448OMPParallelSectionsDirective *
449OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
450 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000451 unsigned Size =
452 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000453 void *Mem =
454 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
455 return new (Mem) OMPParallelSectionsDirective(NumClauses);
456}
457
458OMPTaskDirective *
459OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
460 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
461 Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000462 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000463 void *Mem =
464 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
465 OMPTaskDirective *Dir =
466 new (Mem) OMPTaskDirective(StartLoc, EndLoc, Clauses.size());
467 Dir->setClauses(Clauses);
468 Dir->setAssociatedStmt(AssociatedStmt);
469 Dir->setHasCancel(HasCancel);
470 return Dir;
471}
472
473OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
474 unsigned NumClauses,
475 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000476 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000477 void *Mem =
478 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
479 return new (Mem) OMPTaskDirective(NumClauses);
480}
481
482OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
483 SourceLocation StartLoc,
484 SourceLocation EndLoc) {
485 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
486 OMPTaskyieldDirective *Dir =
487 new (Mem) OMPTaskyieldDirective(StartLoc, EndLoc);
488 return Dir;
489}
490
491OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
492 EmptyShell) {
493 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
494 return new (Mem) OMPTaskyieldDirective();
495}
496
497OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
498 SourceLocation StartLoc,
499 SourceLocation EndLoc) {
500 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
501 OMPBarrierDirective *Dir = new (Mem) OMPBarrierDirective(StartLoc, EndLoc);
502 return Dir;
503}
504
505OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
506 EmptyShell) {
507 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
508 return new (Mem) OMPBarrierDirective();
509}
510
511OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C,
512 SourceLocation StartLoc,
513 SourceLocation EndLoc) {
514 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
515 OMPTaskwaitDirective *Dir = new (Mem) OMPTaskwaitDirective(StartLoc, EndLoc);
516 return Dir;
517}
518
519OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
520 EmptyShell) {
521 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
522 return new (Mem) OMPTaskwaitDirective();
523}
524
Alexey Bataev169d96a2017-07-18 20:17:46 +0000525OMPTaskgroupDirective *OMPTaskgroupDirective::Create(
526 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000527 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) {
Alexey Bataev169d96a2017-07-18 20:17:46 +0000528 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
529 sizeof(OMPClause *) * Clauses.size(),
530 alignof(Stmt *));
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000531 void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000532 OMPTaskgroupDirective *Dir =
Alexey Bataev169d96a2017-07-18 20:17:46 +0000533 new (Mem) OMPTaskgroupDirective(StartLoc, EndLoc, Clauses.size());
James Y Knightb8bfd962015-10-02 13:41:04 +0000534 Dir->setAssociatedStmt(AssociatedStmt);
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000535 Dir->setReductionRef(ReductionRef);
Alexey Bataev169d96a2017-07-18 20:17:46 +0000536 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000537 return Dir;
538}
539
540OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev169d96a2017-07-18 20:17:46 +0000541 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000542 EmptyShell) {
Alexey Bataev169d96a2017-07-18 20:17:46 +0000543 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
544 sizeof(OMPClause *) * NumClauses,
545 alignof(Stmt *));
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000546 void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
Alexey Bataev169d96a2017-07-18 20:17:46 +0000547 return new (Mem) OMPTaskgroupDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000548}
549
550OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
551 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
552 OpenMPDirectiveKind CancelRegion) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000553 unsigned Size =
554 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000555 void *Mem = C.Allocate(Size);
556 OMPCancellationPointDirective *Dir =
557 new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc);
558 Dir->setCancelRegion(CancelRegion);
559 return Dir;
560}
561
562OMPCancellationPointDirective *
563OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000564 unsigned Size =
565 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000566 void *Mem = C.Allocate(Size);
567 return new (Mem) OMPCancellationPointDirective();
568}
569
570OMPCancelDirective *
571OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
572 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
573 OpenMPDirectiveKind CancelRegion) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000574 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
575 sizeof(OMPClause *) * Clauses.size(),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000576 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000577 void *Mem = C.Allocate(Size);
578 OMPCancelDirective *Dir =
579 new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size());
580 Dir->setClauses(Clauses);
581 Dir->setCancelRegion(CancelRegion);
582 return Dir;
583}
584
585OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
586 unsigned NumClauses,
587 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000588 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
589 sizeof(OMPClause *) * NumClauses,
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000590 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000591 void *Mem = C.Allocate(Size);
592 return new (Mem) OMPCancelDirective(NumClauses);
593}
594
595OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
596 SourceLocation StartLoc,
597 SourceLocation EndLoc,
598 ArrayRef<OMPClause *> Clauses) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000599 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000600 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000601 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
602 OMPFlushDirective *Dir =
603 new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size());
604 Dir->setClauses(Clauses);
605 return Dir;
606}
607
608OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
609 unsigned NumClauses,
610 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000611 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000612 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000613 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
614 return new (Mem) OMPFlushDirective(NumClauses);
615}
616
617OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
618 SourceLocation StartLoc,
619 SourceLocation EndLoc,
620 ArrayRef<OMPClause *> Clauses,
621 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000622 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000623 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000624 void *Mem =
625 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size());
626 OMPOrderedDirective *Dir =
627 new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size());
628 Dir->setClauses(Clauses);
629 Dir->setAssociatedStmt(AssociatedStmt);
630 return Dir;
631}
632
633OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
634 unsigned NumClauses,
635 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000636 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000637 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000638 void *Mem =
639 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses);
640 return new (Mem) OMPOrderedDirective(NumClauses);
641}
642
643OMPAtomicDirective *OMPAtomicDirective::Create(
644 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
645 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
646 Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000647 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000648 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000649 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
650 5 * sizeof(Stmt *));
651 OMPAtomicDirective *Dir =
652 new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size());
653 Dir->setClauses(Clauses);
654 Dir->setAssociatedStmt(AssociatedStmt);
655 Dir->setX(X);
656 Dir->setV(V);
657 Dir->setExpr(E);
658 Dir->setUpdateExpr(UE);
659 Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
660 Dir->IsPostfixUpdate = IsPostfixUpdate;
661 return Dir;
662}
663
664OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
665 unsigned NumClauses,
666 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000667 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000668 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000669 void *Mem =
670 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *));
671 return new (Mem) OMPAtomicDirective(NumClauses);
672}
673
674OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
675 SourceLocation StartLoc,
676 SourceLocation EndLoc,
677 ArrayRef<OMPClause *> Clauses,
678 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000679 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000680 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000681 void *Mem =
682 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
683 OMPTargetDirective *Dir =
684 new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size());
685 Dir->setClauses(Clauses);
686 Dir->setAssociatedStmt(AssociatedStmt);
687 return Dir;
688}
689
690OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
691 unsigned NumClauses,
692 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000693 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000694 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000695 void *Mem =
696 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
697 return new (Mem) OMPTargetDirective(NumClauses);
698}
699
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000700OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
701 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
702 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000703 unsigned Size =
704 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000705 void *Mem =
706 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
707 OMPTargetParallelDirective *Dir =
708 new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size());
709 Dir->setClauses(Clauses);
710 Dir->setAssociatedStmt(AssociatedStmt);
711 return Dir;
712}
713
714OMPTargetParallelDirective *
715OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
716 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000717 unsigned Size =
718 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000719 void *Mem =
720 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
721 return new (Mem) OMPTargetParallelDirective(NumClauses);
722}
723
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000724OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
725 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
726 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
727 const HelperExprs &Exprs, bool HasCancel) {
728 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000729 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000730 void *Mem = C.Allocate(
731 Size + sizeof(OMPClause *) * Clauses.size() +
732 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
733 OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective(
734 StartLoc, EndLoc, CollapsedNum, Clauses.size());
735 Dir->setClauses(Clauses);
736 Dir->setAssociatedStmt(AssociatedStmt);
737 Dir->setIterationVariable(Exprs.IterationVarRef);
738 Dir->setLastIteration(Exprs.LastIteration);
739 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
740 Dir->setPreCond(Exprs.PreCond);
741 Dir->setCond(Exprs.Cond);
742 Dir->setInit(Exprs.Init);
743 Dir->setInc(Exprs.Inc);
744 Dir->setIsLastIterVariable(Exprs.IL);
745 Dir->setLowerBoundVariable(Exprs.LB);
746 Dir->setUpperBoundVariable(Exprs.UB);
747 Dir->setStrideVariable(Exprs.ST);
748 Dir->setEnsureUpperBound(Exprs.EUB);
749 Dir->setNextLowerBound(Exprs.NLB);
750 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000751 Dir->setNumIterations(Exprs.NumIterations);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000752 Dir->setCounters(Exprs.Counters);
753 Dir->setPrivateCounters(Exprs.PrivateCounters);
754 Dir->setInits(Exprs.Inits);
755 Dir->setUpdates(Exprs.Updates);
756 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000757 Dir->setPreInits(Exprs.PreInits);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000758 Dir->setHasCancel(HasCancel);
759 return Dir;
760}
761
762OMPTargetParallelForDirective *
763OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
764 unsigned NumClauses,
765 unsigned CollapsedNum, EmptyShell) {
766 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000767 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000768 void *Mem = C.Allocate(
769 Size + sizeof(OMPClause *) * NumClauses +
770 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
771 return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses);
772}
773
James Y Knightb8bfd962015-10-02 13:41:04 +0000774OMPTargetDataDirective *OMPTargetDataDirective::Create(
775 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
776 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000777 void *Mem = C.Allocate(
778 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
779 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000780 OMPTargetDataDirective *Dir =
781 new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size());
782 Dir->setClauses(Clauses);
783 Dir->setAssociatedStmt(AssociatedStmt);
784 return Dir;
785}
786
787OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
788 unsigned N,
789 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000790 void *Mem = C.Allocate(
791 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
792 sizeof(OMPClause *) * N + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000793 return new (Mem) OMPTargetDataDirective(N);
794}
795
Samuel Antaodf67fc42016-01-19 19:15:56 +0000796OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
797 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
798 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000799 void *Mem = C.Allocate(
800 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
801 sizeof(OMPClause *) * Clauses.size());
Samuel Antaodf67fc42016-01-19 19:15:56 +0000802 OMPTargetEnterDataDirective *Dir =
803 new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size());
804 Dir->setClauses(Clauses);
805 return Dir;
806}
807
808OMPTargetEnterDataDirective *
809OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
810 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000811 void *Mem = C.Allocate(
812 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
813 sizeof(OMPClause *) * N);
Samuel Antaodf67fc42016-01-19 19:15:56 +0000814 return new (Mem) OMPTargetEnterDataDirective(N);
815}
816
Samuel Antao72590762016-01-19 20:04:50 +0000817OMPTargetExitDataDirective *
818OMPTargetExitDataDirective::Create(const ASTContext &C, SourceLocation StartLoc,
819 SourceLocation EndLoc,
820 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000821 void *Mem = C.Allocate(
822 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
823 sizeof(OMPClause *) * Clauses.size());
Samuel Antao72590762016-01-19 20:04:50 +0000824 OMPTargetExitDataDirective *Dir =
825 new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size());
826 Dir->setClauses(Clauses);
827 return Dir;
828}
829
830OMPTargetExitDataDirective *
831OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
832 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000833 void *Mem = C.Allocate(
834 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
835 sizeof(OMPClause *) * N);
Samuel Antao72590762016-01-19 20:04:50 +0000836 return new (Mem) OMPTargetExitDataDirective(N);
837}
838
James Y Knightb8bfd962015-10-02 13:41:04 +0000839OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
840 SourceLocation StartLoc,
841 SourceLocation EndLoc,
842 ArrayRef<OMPClause *> Clauses,
843 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000844 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000845 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000846 void *Mem =
847 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
848 OMPTeamsDirective *Dir =
849 new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size());
850 Dir->setClauses(Clauses);
851 Dir->setAssociatedStmt(AssociatedStmt);
852 return Dir;
853}
854
855OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
856 unsigned NumClauses,
857 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000858 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000859 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000860 void *Mem =
861 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
862 return new (Mem) OMPTeamsDirective(NumClauses);
863}
Alexey Bataev49f6e782015-12-01 04:18:41 +0000864
865OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
866 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
867 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
868 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000869 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000870 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000871 void *Mem =
872 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
873 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
874 OMPTaskLoopDirective *Dir = new (Mem)
875 OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
876 Dir->setClauses(Clauses);
877 Dir->setAssociatedStmt(AssociatedStmt);
878 Dir->setIterationVariable(Exprs.IterationVarRef);
879 Dir->setLastIteration(Exprs.LastIteration);
880 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
881 Dir->setPreCond(Exprs.PreCond);
882 Dir->setCond(Exprs.Cond);
883 Dir->setInit(Exprs.Init);
884 Dir->setInc(Exprs.Inc);
885 Dir->setIsLastIterVariable(Exprs.IL);
886 Dir->setLowerBoundVariable(Exprs.LB);
887 Dir->setUpperBoundVariable(Exprs.UB);
888 Dir->setStrideVariable(Exprs.ST);
889 Dir->setEnsureUpperBound(Exprs.EUB);
890 Dir->setNextLowerBound(Exprs.NLB);
891 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000892 Dir->setNumIterations(Exprs.NumIterations);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000893 Dir->setCounters(Exprs.Counters);
894 Dir->setPrivateCounters(Exprs.PrivateCounters);
895 Dir->setInits(Exprs.Inits);
896 Dir->setUpdates(Exprs.Updates);
897 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000898 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000899 return Dir;
900}
901
902OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
903 unsigned NumClauses,
904 unsigned CollapsedNum,
905 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000906 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000907 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000908 void *Mem =
909 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
910 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
911 return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses);
912}
913
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000914OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
915 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
916 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
917 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000918 unsigned Size =
919 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000920 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
921 sizeof(Stmt *) *
922 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
923 OMPTaskLoopSimdDirective *Dir = new (Mem)
924 OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
925 Dir->setClauses(Clauses);
926 Dir->setAssociatedStmt(AssociatedStmt);
927 Dir->setIterationVariable(Exprs.IterationVarRef);
928 Dir->setLastIteration(Exprs.LastIteration);
929 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
930 Dir->setPreCond(Exprs.PreCond);
931 Dir->setCond(Exprs.Cond);
932 Dir->setInit(Exprs.Init);
933 Dir->setInc(Exprs.Inc);
934 Dir->setIsLastIterVariable(Exprs.IL);
935 Dir->setLowerBoundVariable(Exprs.LB);
936 Dir->setUpperBoundVariable(Exprs.UB);
937 Dir->setStrideVariable(Exprs.ST);
938 Dir->setEnsureUpperBound(Exprs.EUB);
939 Dir->setNextLowerBound(Exprs.NLB);
940 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000941 Dir->setNumIterations(Exprs.NumIterations);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000942 Dir->setCounters(Exprs.Counters);
943 Dir->setPrivateCounters(Exprs.PrivateCounters);
944 Dir->setInits(Exprs.Inits);
945 Dir->setUpdates(Exprs.Updates);
946 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000947 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000948 return Dir;
949}
950
951OMPTaskLoopSimdDirective *
952OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
953 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000954 unsigned Size =
955 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000956 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
957 sizeof(Stmt *) *
958 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
959 return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);
960}
961
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000962OMPDistributeDirective *OMPDistributeDirective::Create(
963 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
964 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
965 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000966 unsigned Size =
967 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000968 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
969 sizeof(Stmt *) *
970 numLoopChildren(CollapsedNum, OMPD_distribute));
971 OMPDistributeDirective *Dir = new (Mem)
972 OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
973 Dir->setClauses(Clauses);
974 Dir->setAssociatedStmt(AssociatedStmt);
975 Dir->setIterationVariable(Exprs.IterationVarRef);
976 Dir->setLastIteration(Exprs.LastIteration);
977 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
978 Dir->setPreCond(Exprs.PreCond);
979 Dir->setCond(Exprs.Cond);
980 Dir->setInit(Exprs.Init);
981 Dir->setInc(Exprs.Inc);
982 Dir->setIsLastIterVariable(Exprs.IL);
983 Dir->setLowerBoundVariable(Exprs.LB);
984 Dir->setUpperBoundVariable(Exprs.UB);
985 Dir->setStrideVariable(Exprs.ST);
986 Dir->setEnsureUpperBound(Exprs.EUB);
987 Dir->setNextLowerBound(Exprs.NLB);
988 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000989 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000990 Dir->setCounters(Exprs.Counters);
991 Dir->setPrivateCounters(Exprs.PrivateCounters);
992 Dir->setInits(Exprs.Inits);
993 Dir->setUpdates(Exprs.Updates);
994 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000995 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000996 return Dir;
997}
998
999OMPDistributeDirective *
1000OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1001 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001002 unsigned Size =
1003 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001004 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1005 sizeof(Stmt *) *
1006 numLoopChildren(CollapsedNum, OMPD_distribute));
1007 return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);
1008}
Samuel Antao686c70c2016-05-26 17:30:50 +00001009
1010OMPTargetUpdateDirective *
1011OMPTargetUpdateDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1012 SourceLocation EndLoc,
1013 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001014 unsigned Size =
1015 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001016 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
1017 OMPTargetUpdateDirective *Dir =
1018 new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size());
1019 Dir->setClauses(Clauses);
1020 return Dir;
1021}
1022
1023OMPTargetUpdateDirective *
1024OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1025 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001026 unsigned Size =
1027 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001028 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
1029 return new (Mem) OMPTargetUpdateDirective(NumClauses);
1030}
Carlo Bertolli9925f152016-06-27 14:55:37 +00001031
1032OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1033 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1034 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1035 const HelperExprs &Exprs) {
1036 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001037 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001038 void *Mem = C.Allocate(
1039 Size + sizeof(OMPClause *) * Clauses.size() +
1040 sizeof(Stmt *) *
1041 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1042 OMPDistributeParallelForDirective *Dir =
1043 new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc,
1044 CollapsedNum, Clauses.size());
1045 Dir->setClauses(Clauses);
1046 Dir->setAssociatedStmt(AssociatedStmt);
1047 Dir->setIterationVariable(Exprs.IterationVarRef);
1048 Dir->setLastIteration(Exprs.LastIteration);
1049 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1050 Dir->setPreCond(Exprs.PreCond);
1051 Dir->setCond(Exprs.Cond);
1052 Dir->setInit(Exprs.Init);
1053 Dir->setInc(Exprs.Inc);
1054 Dir->setIsLastIterVariable(Exprs.IL);
1055 Dir->setLowerBoundVariable(Exprs.LB);
1056 Dir->setUpperBoundVariable(Exprs.UB);
1057 Dir->setStrideVariable(Exprs.ST);
1058 Dir->setEnsureUpperBound(Exprs.EUB);
1059 Dir->setNextLowerBound(Exprs.NLB);
1060 Dir->setNextUpperBound(Exprs.NUB);
1061 Dir->setNumIterations(Exprs.NumIterations);
1062 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1063 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001064 Dir->setDistInc(Exprs.DistInc);
1065 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Carlo Bertolli9925f152016-06-27 14:55:37 +00001066 Dir->setCounters(Exprs.Counters);
1067 Dir->setPrivateCounters(Exprs.PrivateCounters);
1068 Dir->setInits(Exprs.Inits);
1069 Dir->setUpdates(Exprs.Updates);
1070 Dir->setFinals(Exprs.Finals);
1071 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001072 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1073 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1074 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1075 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1076 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1077 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1078 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Carlo Bertolli9925f152016-06-27 14:55:37 +00001079 return Dir;
1080}
1081
1082OMPDistributeParallelForDirective *
1083OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1084 unsigned NumClauses,
1085 unsigned CollapsedNum,
1086 EmptyShell) {
1087 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001088 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001089 void *Mem = C.Allocate(
1090 Size + sizeof(OMPClause *) * NumClauses +
1091 sizeof(Stmt *) *
1092 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1093 return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses);
1094}
Kelvin Li4a39add2016-07-05 05:00:15 +00001095
1096OMPDistributeParallelForSimdDirective *
1097OMPDistributeParallelForSimdDirective::Create(
1098 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1099 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1100 const HelperExprs &Exprs) {
1101 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001102 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001103 void *Mem = C.Allocate(
1104 Size + sizeof(OMPClause *) * Clauses.size() +
1105 sizeof(Stmt *) *
1106 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1107 OMPDistributeParallelForSimdDirective *Dir = new (Mem)
1108 OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1109 Clauses.size());
1110 Dir->setClauses(Clauses);
1111 Dir->setAssociatedStmt(AssociatedStmt);
1112 Dir->setIterationVariable(Exprs.IterationVarRef);
1113 Dir->setLastIteration(Exprs.LastIteration);
1114 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1115 Dir->setPreCond(Exprs.PreCond);
1116 Dir->setCond(Exprs.Cond);
1117 Dir->setInit(Exprs.Init);
1118 Dir->setInc(Exprs.Inc);
1119 Dir->setIsLastIterVariable(Exprs.IL);
1120 Dir->setLowerBoundVariable(Exprs.LB);
1121 Dir->setUpperBoundVariable(Exprs.UB);
1122 Dir->setStrideVariable(Exprs.ST);
1123 Dir->setEnsureUpperBound(Exprs.EUB);
1124 Dir->setNextLowerBound(Exprs.NLB);
1125 Dir->setNextUpperBound(Exprs.NUB);
1126 Dir->setNumIterations(Exprs.NumIterations);
1127 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1128 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001129 Dir->setDistInc(Exprs.DistInc);
1130 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li4a39add2016-07-05 05:00:15 +00001131 Dir->setCounters(Exprs.Counters);
1132 Dir->setPrivateCounters(Exprs.PrivateCounters);
1133 Dir->setInits(Exprs.Inits);
1134 Dir->setUpdates(Exprs.Updates);
1135 Dir->setFinals(Exprs.Finals);
1136 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001137 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1138 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1139 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1140 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1141 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1142 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1143 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Kelvin Li4a39add2016-07-05 05:00:15 +00001144 return Dir;
1145}
1146
1147OMPDistributeParallelForSimdDirective *
1148OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1149 unsigned NumClauses,
1150 unsigned CollapsedNum,
1151 EmptyShell) {
1152 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001153 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001154 void *Mem = C.Allocate(
1155 Size + sizeof(OMPClause *) * NumClauses +
1156 sizeof(Stmt *) *
1157 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1158 return new (Mem)
1159 OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1160}
Kelvin Li787f3fc2016-07-06 04:45:38 +00001161
1162OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1163 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1164 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1165 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001166 unsigned Size =
1167 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001168 void *Mem = C.Allocate(
1169 Size + sizeof(OMPClause *) * Clauses.size() +
1170 sizeof(Stmt *) *
1171 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1172 OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective(
1173 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1174 Dir->setClauses(Clauses);
1175 Dir->setAssociatedStmt(AssociatedStmt);
1176 Dir->setIterationVariable(Exprs.IterationVarRef);
1177 Dir->setLastIteration(Exprs.LastIteration);
1178 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1179 Dir->setPreCond(Exprs.PreCond);
1180 Dir->setCond(Exprs.Cond);
1181 Dir->setInit(Exprs.Init);
1182 Dir->setInc(Exprs.Inc);
1183 Dir->setIsLastIterVariable(Exprs.IL);
1184 Dir->setLowerBoundVariable(Exprs.LB);
1185 Dir->setUpperBoundVariable(Exprs.UB);
1186 Dir->setStrideVariable(Exprs.ST);
1187 Dir->setEnsureUpperBound(Exprs.EUB);
1188 Dir->setNextLowerBound(Exprs.NLB);
1189 Dir->setNextUpperBound(Exprs.NUB);
1190 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li787f3fc2016-07-06 04:45:38 +00001191 Dir->setCounters(Exprs.Counters);
1192 Dir->setPrivateCounters(Exprs.PrivateCounters);
1193 Dir->setInits(Exprs.Inits);
1194 Dir->setUpdates(Exprs.Updates);
1195 Dir->setFinals(Exprs.Finals);
1196 Dir->setPreInits(Exprs.PreInits);
1197 return Dir;
1198}
1199
1200OMPDistributeSimdDirective *
1201OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1202 unsigned NumClauses,
1203 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001204 unsigned Size =
1205 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001206 void *Mem = C.Allocate(
1207 Size + sizeof(OMPClause *) * NumClauses +
1208 sizeof(Stmt *) *
1209 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1210 return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses);
1211}
Kelvin Lia579b912016-07-14 02:54:56 +00001212
1213OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1214 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1215 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1216 const HelperExprs &Exprs) {
1217 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001218 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001219 void *Mem = C.Allocate(
1220 Size + sizeof(OMPClause *) * Clauses.size() +
1221 sizeof(Stmt *) *
1222 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1223 OMPTargetParallelForSimdDirective *Dir =
1224 new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc,
1225 CollapsedNum, Clauses.size());
1226 Dir->setClauses(Clauses);
1227 Dir->setAssociatedStmt(AssociatedStmt);
1228 Dir->setIterationVariable(Exprs.IterationVarRef);
1229 Dir->setLastIteration(Exprs.LastIteration);
1230 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1231 Dir->setPreCond(Exprs.PreCond);
1232 Dir->setCond(Exprs.Cond);
1233 Dir->setInit(Exprs.Init);
1234 Dir->setInc(Exprs.Inc);
1235 Dir->setIsLastIterVariable(Exprs.IL);
1236 Dir->setLowerBoundVariable(Exprs.LB);
1237 Dir->setUpperBoundVariable(Exprs.UB);
1238 Dir->setStrideVariable(Exprs.ST);
1239 Dir->setEnsureUpperBound(Exprs.EUB);
1240 Dir->setNextLowerBound(Exprs.NLB);
1241 Dir->setNextUpperBound(Exprs.NUB);
1242 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Lia579b912016-07-14 02:54:56 +00001243 Dir->setCounters(Exprs.Counters);
1244 Dir->setPrivateCounters(Exprs.PrivateCounters);
1245 Dir->setInits(Exprs.Inits);
1246 Dir->setUpdates(Exprs.Updates);
1247 Dir->setFinals(Exprs.Finals);
1248 Dir->setPreInits(Exprs.PreInits);
1249 return Dir;
1250}
1251
1252OMPTargetParallelForSimdDirective *
1253OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1254 unsigned NumClauses,
1255 unsigned CollapsedNum,
1256 EmptyShell) {
1257 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001258 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001259 void *Mem = C.Allocate(
1260 Size + sizeof(OMPClause *) * NumClauses +
1261 sizeof(Stmt *) *
1262 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1263 return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses);
1264}
Kelvin Li986330c2016-07-20 22:57:10 +00001265
1266OMPTargetSimdDirective *
1267OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1268 SourceLocation EndLoc, unsigned CollapsedNum,
1269 ArrayRef<OMPClause *> Clauses,
1270 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001271 unsigned Size =
1272 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001273 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1274 sizeof(Stmt *) *
1275 numLoopChildren(CollapsedNum, OMPD_target_simd));
1276 OMPTargetSimdDirective *Dir = new (Mem)
1277 OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1278 Dir->setClauses(Clauses);
1279 Dir->setAssociatedStmt(AssociatedStmt);
1280 Dir->setIterationVariable(Exprs.IterationVarRef);
1281 Dir->setLastIteration(Exprs.LastIteration);
1282 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1283 Dir->setPreCond(Exprs.PreCond);
1284 Dir->setCond(Exprs.Cond);
1285 Dir->setInit(Exprs.Init);
1286 Dir->setInc(Exprs.Inc);
1287 Dir->setCounters(Exprs.Counters);
1288 Dir->setPrivateCounters(Exprs.PrivateCounters);
1289 Dir->setInits(Exprs.Inits);
1290 Dir->setUpdates(Exprs.Updates);
1291 Dir->setFinals(Exprs.Finals);
1292 Dir->setPreInits(Exprs.PreInits);
1293 return Dir;
1294}
1295
1296OMPTargetSimdDirective *
1297OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1298 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001299 unsigned Size =
1300 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001301 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1302 sizeof(Stmt *) *
1303 numLoopChildren(CollapsedNum, OMPD_target_simd));
1304 return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses);
1305}
Kelvin Li02532872016-08-05 14:37:37 +00001306
1307OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1308 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1309 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1310 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001311 unsigned Size =
1312 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001313 void *Mem = C.Allocate(
1314 Size + sizeof(OMPClause *) * Clauses.size() +
1315 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1316 OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective(
1317 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1318 Dir->setClauses(Clauses);
1319 Dir->setAssociatedStmt(AssociatedStmt);
1320 Dir->setIterationVariable(Exprs.IterationVarRef);
1321 Dir->setLastIteration(Exprs.LastIteration);
1322 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1323 Dir->setPreCond(Exprs.PreCond);
1324 Dir->setCond(Exprs.Cond);
1325 Dir->setInit(Exprs.Init);
1326 Dir->setInc(Exprs.Inc);
1327 Dir->setIsLastIterVariable(Exprs.IL);
1328 Dir->setLowerBoundVariable(Exprs.LB);
1329 Dir->setUpperBoundVariable(Exprs.UB);
1330 Dir->setStrideVariable(Exprs.ST);
1331 Dir->setEnsureUpperBound(Exprs.EUB);
1332 Dir->setNextLowerBound(Exprs.NLB);
1333 Dir->setNextUpperBound(Exprs.NUB);
1334 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li02532872016-08-05 14:37:37 +00001335 Dir->setCounters(Exprs.Counters);
1336 Dir->setPrivateCounters(Exprs.PrivateCounters);
1337 Dir->setInits(Exprs.Inits);
1338 Dir->setUpdates(Exprs.Updates);
1339 Dir->setFinals(Exprs.Finals);
1340 Dir->setPreInits(Exprs.PreInits);
1341 return Dir;
1342}
1343
1344OMPTeamsDistributeDirective *
1345OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1346 unsigned NumClauses,
1347 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001348 unsigned Size =
1349 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001350 void *Mem = C.Allocate(
1351 Size + sizeof(OMPClause *) * NumClauses +
1352 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1353 return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses);
1354}
Kelvin Li4e325f72016-10-25 12:50:55 +00001355
1356OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1357 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1358 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1359 const HelperExprs &Exprs) {
1360 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1361 alignof(OMPClause *));
1362 void *Mem =
1363 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1364 sizeof(Stmt *) *
1365 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1366 OMPTeamsDistributeSimdDirective *Dir =
1367 new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1368 Clauses.size());
1369 Dir->setClauses(Clauses);
1370 Dir->setAssociatedStmt(AssociatedStmt);
1371 Dir->setIterationVariable(Exprs.IterationVarRef);
1372 Dir->setLastIteration(Exprs.LastIteration);
1373 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1374 Dir->setPreCond(Exprs.PreCond);
1375 Dir->setCond(Exprs.Cond);
1376 Dir->setInit(Exprs.Init);
1377 Dir->setInc(Exprs.Inc);
1378 Dir->setIsLastIterVariable(Exprs.IL);
1379 Dir->setLowerBoundVariable(Exprs.LB);
1380 Dir->setUpperBoundVariable(Exprs.UB);
1381 Dir->setStrideVariable(Exprs.ST);
1382 Dir->setEnsureUpperBound(Exprs.EUB);
1383 Dir->setNextLowerBound(Exprs.NLB);
1384 Dir->setNextUpperBound(Exprs.NUB);
1385 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li4e325f72016-10-25 12:50:55 +00001386 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);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001441 Dir->setDistInc(Exprs.DistInc);
1442 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li579e41c2016-11-30 23:51:03 +00001443 Dir->setCounters(Exprs.Counters);
1444 Dir->setPrivateCounters(Exprs.PrivateCounters);
1445 Dir->setInits(Exprs.Inits);
1446 Dir->setUpdates(Exprs.Updates);
1447 Dir->setFinals(Exprs.Finals);
1448 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001449 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1450 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1451 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1452 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1453 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1454 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1455 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Kelvin Li579e41c2016-11-30 23:51:03 +00001456 return Dir;
1457}
1458
1459OMPTeamsDistributeParallelForSimdDirective *
1460OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1461 unsigned NumClauses,
1462 unsigned CollapsedNum,
1463 EmptyShell) {
1464 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1465 alignof(OMPClause *));
1466 void *Mem =
1467 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1468 sizeof(Stmt *) *
1469 numLoopChildren(CollapsedNum,
1470 OMPD_teams_distribute_parallel_for_simd));
1471 return new (Mem)
1472 OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1473}
Kelvin Li7ade93f2016-12-09 03:24:30 +00001474
1475OMPTeamsDistributeParallelForDirective *
1476OMPTeamsDistributeParallelForDirective::Create(
1477 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1478 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1479 const HelperExprs &Exprs) {
1480 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1481 alignof(OMPClause *));
1482 void *Mem = C.Allocate(
1483 Size + sizeof(OMPClause *) * Clauses.size() +
1484 sizeof(Stmt *) *
1485 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1486 OMPTeamsDistributeParallelForDirective *Dir = new (Mem)
1487 OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum,
1488 Clauses.size());
1489 Dir->setClauses(Clauses);
1490 Dir->setAssociatedStmt(AssociatedStmt);
1491 Dir->setIterationVariable(Exprs.IterationVarRef);
1492 Dir->setLastIteration(Exprs.LastIteration);
1493 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1494 Dir->setPreCond(Exprs.PreCond);
1495 Dir->setCond(Exprs.Cond);
1496 Dir->setInit(Exprs.Init);
1497 Dir->setInc(Exprs.Inc);
1498 Dir->setIsLastIterVariable(Exprs.IL);
1499 Dir->setLowerBoundVariable(Exprs.LB);
1500 Dir->setUpperBoundVariable(Exprs.UB);
1501 Dir->setStrideVariable(Exprs.ST);
1502 Dir->setEnsureUpperBound(Exprs.EUB);
1503 Dir->setNextLowerBound(Exprs.NLB);
1504 Dir->setNextUpperBound(Exprs.NUB);
1505 Dir->setNumIterations(Exprs.NumIterations);
1506 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1507 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001508 Dir->setDistInc(Exprs.DistInc);
1509 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li7ade93f2016-12-09 03:24:30 +00001510 Dir->setCounters(Exprs.Counters);
1511 Dir->setPrivateCounters(Exprs.PrivateCounters);
1512 Dir->setInits(Exprs.Inits);
1513 Dir->setUpdates(Exprs.Updates);
1514 Dir->setFinals(Exprs.Finals);
1515 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001516 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1517 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1518 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1519 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1520 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1521 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1522 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Kelvin Li7ade93f2016-12-09 03:24:30 +00001523 return Dir;
1524}
1525
1526OMPTeamsDistributeParallelForDirective *
1527OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1528 unsigned NumClauses,
1529 unsigned CollapsedNum,
1530 EmptyShell) {
1531 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1532 alignof(OMPClause *));
1533 void *Mem = C.Allocate(
1534 Size + sizeof(OMPClause *) * NumClauses +
1535 sizeof(Stmt *) *
1536 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1537 return new (Mem)
1538 OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1539}
1540
Kelvin Libf594a52016-12-17 05:48:59 +00001541OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1542 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1543 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1544 auto Size =
1545 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1546 void *Mem =
1547 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
1548 OMPTargetTeamsDirective *Dir =
1549 new (Mem) OMPTargetTeamsDirective(StartLoc, EndLoc, Clauses.size());
1550 Dir->setClauses(Clauses);
1551 Dir->setAssociatedStmt(AssociatedStmt);
1552 return Dir;
1553}
1554
1555OMPTargetTeamsDirective *
1556OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1557 EmptyShell) {
1558 auto Size =
1559 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1560 void *Mem =
1561 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1562 return new (Mem) OMPTargetTeamsDirective(NumClauses);
1563}
Kelvin Li83c451e2016-12-25 04:52:54 +00001564
1565OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
1566 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1567 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1568 const HelperExprs &Exprs) {
1569 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1570 alignof(OMPClause *));
1571 void *Mem = C.Allocate(
1572 Size + sizeof(OMPClause *) * Clauses.size() +
1573 sizeof(Stmt *) *
1574 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1575 OMPTargetTeamsDistributeDirective *Dir =
1576 new (Mem) OMPTargetTeamsDistributeDirective(StartLoc, EndLoc, CollapsedNum,
1577 Clauses.size());
1578 Dir->setClauses(Clauses);
1579 Dir->setAssociatedStmt(AssociatedStmt);
1580 Dir->setIterationVariable(Exprs.IterationVarRef);
1581 Dir->setLastIteration(Exprs.LastIteration);
1582 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1583 Dir->setPreCond(Exprs.PreCond);
1584 Dir->setCond(Exprs.Cond);
1585 Dir->setInit(Exprs.Init);
1586 Dir->setInc(Exprs.Inc);
1587 Dir->setIsLastIterVariable(Exprs.IL);
1588 Dir->setLowerBoundVariable(Exprs.LB);
1589 Dir->setUpperBoundVariable(Exprs.UB);
1590 Dir->setStrideVariable(Exprs.ST);
1591 Dir->setEnsureUpperBound(Exprs.EUB);
1592 Dir->setNextLowerBound(Exprs.NLB);
1593 Dir->setNextUpperBound(Exprs.NUB);
1594 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li83c451e2016-12-25 04:52:54 +00001595 Dir->setCounters(Exprs.Counters);
1596 Dir->setPrivateCounters(Exprs.PrivateCounters);
1597 Dir->setInits(Exprs.Inits);
1598 Dir->setUpdates(Exprs.Updates);
1599 Dir->setFinals(Exprs.Finals);
1600 Dir->setPreInits(Exprs.PreInits);
1601 return Dir;
1602}
1603
1604OMPTargetTeamsDistributeDirective *
1605OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1606 unsigned NumClauses,
1607 unsigned CollapsedNum,
1608 EmptyShell) {
1609 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1610 alignof(OMPClause *));
1611 void *Mem = C.Allocate(
1612 Size + sizeof(OMPClause *) * NumClauses +
1613 sizeof(Stmt *) *
1614 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1615 return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses);
1616}
Kelvin Li80e8f562016-12-29 22:16:30 +00001617
1618OMPTargetTeamsDistributeParallelForDirective *
1619OMPTargetTeamsDistributeParallelForDirective::Create(
1620 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1621 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1622 const HelperExprs &Exprs) {
1623 auto Size =
1624 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1625 alignof(OMPClause *));
1626 void *Mem = C.Allocate(
1627 Size + sizeof(OMPClause *) * Clauses.size() +
1628 sizeof(Stmt *) *
1629 numLoopChildren(CollapsedNum,
1630 OMPD_target_teams_distribute_parallel_for));
1631 OMPTargetTeamsDistributeParallelForDirective *Dir =
1632 new (Mem) OMPTargetTeamsDistributeParallelForDirective(
1633 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1634 Dir->setClauses(Clauses);
1635 Dir->setAssociatedStmt(AssociatedStmt);
1636 Dir->setIterationVariable(Exprs.IterationVarRef);
1637 Dir->setLastIteration(Exprs.LastIteration);
1638 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1639 Dir->setPreCond(Exprs.PreCond);
1640 Dir->setCond(Exprs.Cond);
1641 Dir->setInit(Exprs.Init);
1642 Dir->setInc(Exprs.Inc);
1643 Dir->setIsLastIterVariable(Exprs.IL);
1644 Dir->setLowerBoundVariable(Exprs.LB);
1645 Dir->setUpperBoundVariable(Exprs.UB);
1646 Dir->setStrideVariable(Exprs.ST);
1647 Dir->setEnsureUpperBound(Exprs.EUB);
1648 Dir->setNextLowerBound(Exprs.NLB);
1649 Dir->setNextUpperBound(Exprs.NUB);
1650 Dir->setNumIterations(Exprs.NumIterations);
1651 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1652 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001653 Dir->setDistInc(Exprs.DistInc);
1654 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li80e8f562016-12-29 22:16:30 +00001655 Dir->setCounters(Exprs.Counters);
1656 Dir->setPrivateCounters(Exprs.PrivateCounters);
1657 Dir->setInits(Exprs.Inits);
1658 Dir->setUpdates(Exprs.Updates);
1659 Dir->setFinals(Exprs.Finals);
1660 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001661 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1662 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1663 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1664 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1665 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1666 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1667 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Kelvin Li80e8f562016-12-29 22:16:30 +00001668 return Dir;
1669}
1670
1671OMPTargetTeamsDistributeParallelForDirective *
1672OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1673 unsigned NumClauses,
1674 unsigned CollapsedNum,
1675 EmptyShell) {
1676 auto Size =
1677 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1678 alignof(OMPClause *));
1679 void *Mem = C.Allocate(
1680 Size + sizeof(OMPClause *) * NumClauses +
1681 sizeof(Stmt *) *
1682 numLoopChildren(CollapsedNum,
1683 OMPD_target_teams_distribute_parallel_for));
1684 return new (Mem)
1685 OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1686}
Kelvin Li1851df52017-01-03 05:23:48 +00001687
1688OMPTargetTeamsDistributeParallelForSimdDirective *
1689OMPTargetTeamsDistributeParallelForSimdDirective::Create(
1690 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1691 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1692 const HelperExprs &Exprs) {
1693 auto Size =
1694 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1695 alignof(OMPClause *));
1696 void *Mem = C.Allocate(
1697 Size + sizeof(OMPClause *) * Clauses.size() +
1698 sizeof(Stmt *) *
1699 numLoopChildren(CollapsedNum,
1700 OMPD_target_teams_distribute_parallel_for_simd));
1701 OMPTargetTeamsDistributeParallelForSimdDirective *Dir =
1702 new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1703 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1704 Dir->setClauses(Clauses);
1705 Dir->setAssociatedStmt(AssociatedStmt);
1706 Dir->setIterationVariable(Exprs.IterationVarRef);
1707 Dir->setLastIteration(Exprs.LastIteration);
1708 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1709 Dir->setPreCond(Exprs.PreCond);
1710 Dir->setCond(Exprs.Cond);
1711 Dir->setInit(Exprs.Init);
1712 Dir->setInc(Exprs.Inc);
1713 Dir->setIsLastIterVariable(Exprs.IL);
1714 Dir->setLowerBoundVariable(Exprs.LB);
1715 Dir->setUpperBoundVariable(Exprs.UB);
1716 Dir->setStrideVariable(Exprs.ST);
1717 Dir->setEnsureUpperBound(Exprs.EUB);
1718 Dir->setNextLowerBound(Exprs.NLB);
1719 Dir->setNextUpperBound(Exprs.NUB);
1720 Dir->setNumIterations(Exprs.NumIterations);
1721 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1722 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001723 Dir->setDistInc(Exprs.DistInc);
1724 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li1851df52017-01-03 05:23:48 +00001725 Dir->setCounters(Exprs.Counters);
1726 Dir->setPrivateCounters(Exprs.PrivateCounters);
1727 Dir->setInits(Exprs.Inits);
1728 Dir->setUpdates(Exprs.Updates);
1729 Dir->setFinals(Exprs.Finals);
1730 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001731 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1732 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1733 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1734 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1735 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1736 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1737 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Kelvin Li1851df52017-01-03 05:23:48 +00001738 return Dir;
1739}
1740
1741OMPTargetTeamsDistributeParallelForSimdDirective *
1742OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
1743 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1744 EmptyShell) {
1745 auto Size =
1746 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1747 alignof(OMPClause *));
1748 void *Mem = C.Allocate(
1749 Size + sizeof(OMPClause *) * NumClauses +
1750 sizeof(Stmt *) *
1751 numLoopChildren(CollapsedNum,
1752 OMPD_target_teams_distribute_parallel_for_simd));
1753 return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1754 CollapsedNum, NumClauses);
1755}
1756
Kelvin Lida681182017-01-10 18:08:18 +00001757OMPTargetTeamsDistributeSimdDirective *
1758OMPTargetTeamsDistributeSimdDirective::Create(
1759 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1760 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1761 const HelperExprs &Exprs) {
1762 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1763 alignof(OMPClause *));
1764 void *Mem = C.Allocate(
1765 Size + sizeof(OMPClause *) * Clauses.size() +
1766 sizeof(Stmt *) *
1767 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1768 OMPTargetTeamsDistributeSimdDirective *Dir = new (Mem)
1769 OMPTargetTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1770 Clauses.size());
1771 Dir->setClauses(Clauses);
1772 Dir->setAssociatedStmt(AssociatedStmt);
1773 Dir->setIterationVariable(Exprs.IterationVarRef);
1774 Dir->setLastIteration(Exprs.LastIteration);
1775 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1776 Dir->setPreCond(Exprs.PreCond);
1777 Dir->setCond(Exprs.Cond);
1778 Dir->setInit(Exprs.Init);
1779 Dir->setInc(Exprs.Inc);
1780 Dir->setIsLastIterVariable(Exprs.IL);
1781 Dir->setLowerBoundVariable(Exprs.LB);
1782 Dir->setUpperBoundVariable(Exprs.UB);
1783 Dir->setStrideVariable(Exprs.ST);
1784 Dir->setEnsureUpperBound(Exprs.EUB);
1785 Dir->setNextLowerBound(Exprs.NLB);
1786 Dir->setNextUpperBound(Exprs.NUB);
1787 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Lida681182017-01-10 18:08:18 +00001788 Dir->setCounters(Exprs.Counters);
1789 Dir->setPrivateCounters(Exprs.PrivateCounters);
1790 Dir->setInits(Exprs.Inits);
1791 Dir->setUpdates(Exprs.Updates);
1792 Dir->setFinals(Exprs.Finals);
1793 Dir->setPreInits(Exprs.PreInits);
1794 return Dir;
1795}
1796
1797OMPTargetTeamsDistributeSimdDirective *
1798OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1799 unsigned NumClauses,
1800 unsigned CollapsedNum,
1801 EmptyShell) {
1802 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1803 alignof(OMPClause *));
1804 void *Mem = C.Allocate(
1805 Size + sizeof(OMPClause *) * NumClauses +
1806 sizeof(Stmt *) *
1807 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1808 return new (Mem)
1809 OMPTargetTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1810}