blob: 1dcb4fd5196be442c92d073590d417d6d28b41c2 [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,
527 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
528 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
529 sizeof(OMPClause *) * Clauses.size(),
530 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000531 void *Mem = C.Allocate(Size + sizeof(Stmt *));
532 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 Bataev169d96a2017-07-18 20:17:46 +0000535 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000536 return Dir;
537}
538
539OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev169d96a2017-07-18 20:17:46 +0000540 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000541 EmptyShell) {
Alexey Bataev169d96a2017-07-18 20:17:46 +0000542 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
543 sizeof(OMPClause *) * NumClauses,
544 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000545 void *Mem = C.Allocate(Size + sizeof(Stmt *));
Alexey Bataev169d96a2017-07-18 20:17:46 +0000546 return new (Mem) OMPTaskgroupDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000547}
548
549OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
550 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
551 OpenMPDirectiveKind CancelRegion) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000552 unsigned Size =
553 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000554 void *Mem = C.Allocate(Size);
555 OMPCancellationPointDirective *Dir =
556 new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc);
557 Dir->setCancelRegion(CancelRegion);
558 return Dir;
559}
560
561OMPCancellationPointDirective *
562OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000563 unsigned Size =
564 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000565 void *Mem = C.Allocate(Size);
566 return new (Mem) OMPCancellationPointDirective();
567}
568
569OMPCancelDirective *
570OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
571 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
572 OpenMPDirectiveKind CancelRegion) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000573 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
574 sizeof(OMPClause *) * Clauses.size(),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000575 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000576 void *Mem = C.Allocate(Size);
577 OMPCancelDirective *Dir =
578 new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size());
579 Dir->setClauses(Clauses);
580 Dir->setCancelRegion(CancelRegion);
581 return Dir;
582}
583
584OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
585 unsigned NumClauses,
586 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000587 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
588 sizeof(OMPClause *) * NumClauses,
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000589 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000590 void *Mem = C.Allocate(Size);
591 return new (Mem) OMPCancelDirective(NumClauses);
592}
593
594OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
595 SourceLocation StartLoc,
596 SourceLocation EndLoc,
597 ArrayRef<OMPClause *> Clauses) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000598 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000599 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000600 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
601 OMPFlushDirective *Dir =
602 new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size());
603 Dir->setClauses(Clauses);
604 return Dir;
605}
606
607OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
608 unsigned NumClauses,
609 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000610 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000611 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000612 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
613 return new (Mem) OMPFlushDirective(NumClauses);
614}
615
616OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
617 SourceLocation StartLoc,
618 SourceLocation EndLoc,
619 ArrayRef<OMPClause *> Clauses,
620 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000621 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000622 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000623 void *Mem =
624 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size());
625 OMPOrderedDirective *Dir =
626 new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size());
627 Dir->setClauses(Clauses);
628 Dir->setAssociatedStmt(AssociatedStmt);
629 return Dir;
630}
631
632OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
633 unsigned NumClauses,
634 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000635 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000636 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000637 void *Mem =
638 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses);
639 return new (Mem) OMPOrderedDirective(NumClauses);
640}
641
642OMPAtomicDirective *OMPAtomicDirective::Create(
643 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
644 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
645 Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000646 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000647 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000648 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
649 5 * sizeof(Stmt *));
650 OMPAtomicDirective *Dir =
651 new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size());
652 Dir->setClauses(Clauses);
653 Dir->setAssociatedStmt(AssociatedStmt);
654 Dir->setX(X);
655 Dir->setV(V);
656 Dir->setExpr(E);
657 Dir->setUpdateExpr(UE);
658 Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
659 Dir->IsPostfixUpdate = IsPostfixUpdate;
660 return Dir;
661}
662
663OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
664 unsigned NumClauses,
665 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000666 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000667 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000668 void *Mem =
669 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *));
670 return new (Mem) OMPAtomicDirective(NumClauses);
671}
672
673OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
674 SourceLocation StartLoc,
675 SourceLocation EndLoc,
676 ArrayRef<OMPClause *> Clauses,
677 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000678 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000679 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000680 void *Mem =
681 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
682 OMPTargetDirective *Dir =
683 new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size());
684 Dir->setClauses(Clauses);
685 Dir->setAssociatedStmt(AssociatedStmt);
686 return Dir;
687}
688
689OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
690 unsigned NumClauses,
691 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000692 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000693 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000694 void *Mem =
695 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
696 return new (Mem) OMPTargetDirective(NumClauses);
697}
698
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000699OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
700 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
701 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000702 unsigned Size =
703 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000704 void *Mem =
705 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
706 OMPTargetParallelDirective *Dir =
707 new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size());
708 Dir->setClauses(Clauses);
709 Dir->setAssociatedStmt(AssociatedStmt);
710 return Dir;
711}
712
713OMPTargetParallelDirective *
714OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
715 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000716 unsigned Size =
717 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000718 void *Mem =
719 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
720 return new (Mem) OMPTargetParallelDirective(NumClauses);
721}
722
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000723OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
724 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
725 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
726 const HelperExprs &Exprs, bool HasCancel) {
727 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000728 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000729 void *Mem = C.Allocate(
730 Size + sizeof(OMPClause *) * Clauses.size() +
731 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
732 OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective(
733 StartLoc, EndLoc, CollapsedNum, Clauses.size());
734 Dir->setClauses(Clauses);
735 Dir->setAssociatedStmt(AssociatedStmt);
736 Dir->setIterationVariable(Exprs.IterationVarRef);
737 Dir->setLastIteration(Exprs.LastIteration);
738 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
739 Dir->setPreCond(Exprs.PreCond);
740 Dir->setCond(Exprs.Cond);
741 Dir->setInit(Exprs.Init);
742 Dir->setInc(Exprs.Inc);
743 Dir->setIsLastIterVariable(Exprs.IL);
744 Dir->setLowerBoundVariable(Exprs.LB);
745 Dir->setUpperBoundVariable(Exprs.UB);
746 Dir->setStrideVariable(Exprs.ST);
747 Dir->setEnsureUpperBound(Exprs.EUB);
748 Dir->setNextLowerBound(Exprs.NLB);
749 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000750 Dir->setNumIterations(Exprs.NumIterations);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000751 Dir->setCounters(Exprs.Counters);
752 Dir->setPrivateCounters(Exprs.PrivateCounters);
753 Dir->setInits(Exprs.Inits);
754 Dir->setUpdates(Exprs.Updates);
755 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000756 Dir->setPreInits(Exprs.PreInits);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000757 Dir->setHasCancel(HasCancel);
758 return Dir;
759}
760
761OMPTargetParallelForDirective *
762OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
763 unsigned NumClauses,
764 unsigned CollapsedNum, EmptyShell) {
765 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000766 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000767 void *Mem = C.Allocate(
768 Size + sizeof(OMPClause *) * NumClauses +
769 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
770 return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses);
771}
772
James Y Knightb8bfd962015-10-02 13:41:04 +0000773OMPTargetDataDirective *OMPTargetDataDirective::Create(
774 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
775 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000776 void *Mem = C.Allocate(
777 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
778 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000779 OMPTargetDataDirective *Dir =
780 new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size());
781 Dir->setClauses(Clauses);
782 Dir->setAssociatedStmt(AssociatedStmt);
783 return Dir;
784}
785
786OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
787 unsigned N,
788 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000789 void *Mem = C.Allocate(
790 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
791 sizeof(OMPClause *) * N + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000792 return new (Mem) OMPTargetDataDirective(N);
793}
794
Samuel Antaodf67fc42016-01-19 19:15:56 +0000795OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
796 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
797 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000798 void *Mem = C.Allocate(
799 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
800 sizeof(OMPClause *) * Clauses.size());
Samuel Antaodf67fc42016-01-19 19:15:56 +0000801 OMPTargetEnterDataDirective *Dir =
802 new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size());
803 Dir->setClauses(Clauses);
804 return Dir;
805}
806
807OMPTargetEnterDataDirective *
808OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
809 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000810 void *Mem = C.Allocate(
811 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
812 sizeof(OMPClause *) * N);
Samuel Antaodf67fc42016-01-19 19:15:56 +0000813 return new (Mem) OMPTargetEnterDataDirective(N);
814}
815
Samuel Antao72590762016-01-19 20:04:50 +0000816OMPTargetExitDataDirective *
817OMPTargetExitDataDirective::Create(const ASTContext &C, SourceLocation StartLoc,
818 SourceLocation EndLoc,
819 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000820 void *Mem = C.Allocate(
821 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
822 sizeof(OMPClause *) * Clauses.size());
Samuel Antao72590762016-01-19 20:04:50 +0000823 OMPTargetExitDataDirective *Dir =
824 new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size());
825 Dir->setClauses(Clauses);
826 return Dir;
827}
828
829OMPTargetExitDataDirective *
830OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
831 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000832 void *Mem = C.Allocate(
833 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
834 sizeof(OMPClause *) * N);
Samuel Antao72590762016-01-19 20:04:50 +0000835 return new (Mem) OMPTargetExitDataDirective(N);
836}
837
James Y Knightb8bfd962015-10-02 13:41:04 +0000838OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
839 SourceLocation StartLoc,
840 SourceLocation EndLoc,
841 ArrayRef<OMPClause *> Clauses,
842 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000843 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000844 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000845 void *Mem =
846 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
847 OMPTeamsDirective *Dir =
848 new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size());
849 Dir->setClauses(Clauses);
850 Dir->setAssociatedStmt(AssociatedStmt);
851 return Dir;
852}
853
854OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
855 unsigned NumClauses,
856 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000857 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000858 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000859 void *Mem =
860 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
861 return new (Mem) OMPTeamsDirective(NumClauses);
862}
Alexey Bataev49f6e782015-12-01 04:18:41 +0000863
864OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
865 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
866 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
867 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000868 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000869 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000870 void *Mem =
871 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
872 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
873 OMPTaskLoopDirective *Dir = new (Mem)
874 OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
875 Dir->setClauses(Clauses);
876 Dir->setAssociatedStmt(AssociatedStmt);
877 Dir->setIterationVariable(Exprs.IterationVarRef);
878 Dir->setLastIteration(Exprs.LastIteration);
879 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
880 Dir->setPreCond(Exprs.PreCond);
881 Dir->setCond(Exprs.Cond);
882 Dir->setInit(Exprs.Init);
883 Dir->setInc(Exprs.Inc);
884 Dir->setIsLastIterVariable(Exprs.IL);
885 Dir->setLowerBoundVariable(Exprs.LB);
886 Dir->setUpperBoundVariable(Exprs.UB);
887 Dir->setStrideVariable(Exprs.ST);
888 Dir->setEnsureUpperBound(Exprs.EUB);
889 Dir->setNextLowerBound(Exprs.NLB);
890 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000891 Dir->setNumIterations(Exprs.NumIterations);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000892 Dir->setCounters(Exprs.Counters);
893 Dir->setPrivateCounters(Exprs.PrivateCounters);
894 Dir->setInits(Exprs.Inits);
895 Dir->setUpdates(Exprs.Updates);
896 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000897 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000898 return Dir;
899}
900
901OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
902 unsigned NumClauses,
903 unsigned CollapsedNum,
904 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000905 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000906 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000907 void *Mem =
908 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
909 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
910 return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses);
911}
912
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000913OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
914 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
915 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
916 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000917 unsigned Size =
918 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000919 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
920 sizeof(Stmt *) *
921 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
922 OMPTaskLoopSimdDirective *Dir = new (Mem)
923 OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
924 Dir->setClauses(Clauses);
925 Dir->setAssociatedStmt(AssociatedStmt);
926 Dir->setIterationVariable(Exprs.IterationVarRef);
927 Dir->setLastIteration(Exprs.LastIteration);
928 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
929 Dir->setPreCond(Exprs.PreCond);
930 Dir->setCond(Exprs.Cond);
931 Dir->setInit(Exprs.Init);
932 Dir->setInc(Exprs.Inc);
933 Dir->setIsLastIterVariable(Exprs.IL);
934 Dir->setLowerBoundVariable(Exprs.LB);
935 Dir->setUpperBoundVariable(Exprs.UB);
936 Dir->setStrideVariable(Exprs.ST);
937 Dir->setEnsureUpperBound(Exprs.EUB);
938 Dir->setNextLowerBound(Exprs.NLB);
939 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000940 Dir->setNumIterations(Exprs.NumIterations);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000941 Dir->setCounters(Exprs.Counters);
942 Dir->setPrivateCounters(Exprs.PrivateCounters);
943 Dir->setInits(Exprs.Inits);
944 Dir->setUpdates(Exprs.Updates);
945 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000946 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000947 return Dir;
948}
949
950OMPTaskLoopSimdDirective *
951OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
952 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000953 unsigned Size =
954 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000955 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
956 sizeof(Stmt *) *
957 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
958 return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);
959}
960
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000961OMPDistributeDirective *OMPDistributeDirective::Create(
962 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
963 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
964 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000965 unsigned Size =
966 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000967 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
968 sizeof(Stmt *) *
969 numLoopChildren(CollapsedNum, OMPD_distribute));
970 OMPDistributeDirective *Dir = new (Mem)
971 OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
972 Dir->setClauses(Clauses);
973 Dir->setAssociatedStmt(AssociatedStmt);
974 Dir->setIterationVariable(Exprs.IterationVarRef);
975 Dir->setLastIteration(Exprs.LastIteration);
976 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
977 Dir->setPreCond(Exprs.PreCond);
978 Dir->setCond(Exprs.Cond);
979 Dir->setInit(Exprs.Init);
980 Dir->setInc(Exprs.Inc);
981 Dir->setIsLastIterVariable(Exprs.IL);
982 Dir->setLowerBoundVariable(Exprs.LB);
983 Dir->setUpperBoundVariable(Exprs.UB);
984 Dir->setStrideVariable(Exprs.ST);
985 Dir->setEnsureUpperBound(Exprs.EUB);
986 Dir->setNextLowerBound(Exprs.NLB);
987 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000988 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000989 Dir->setCounters(Exprs.Counters);
990 Dir->setPrivateCounters(Exprs.PrivateCounters);
991 Dir->setInits(Exprs.Inits);
992 Dir->setUpdates(Exprs.Updates);
993 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000994 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000995 return Dir;
996}
997
998OMPDistributeDirective *
999OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1000 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001001 unsigned Size =
1002 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001003 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1004 sizeof(Stmt *) *
1005 numLoopChildren(CollapsedNum, OMPD_distribute));
1006 return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);
1007}
Samuel Antao686c70c2016-05-26 17:30:50 +00001008
1009OMPTargetUpdateDirective *
1010OMPTargetUpdateDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1011 SourceLocation EndLoc,
1012 ArrayRef<OMPClause *> Clauses) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001013 unsigned Size =
1014 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001015 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
1016 OMPTargetUpdateDirective *Dir =
1017 new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size());
1018 Dir->setClauses(Clauses);
1019 return Dir;
1020}
1021
1022OMPTargetUpdateDirective *
1023OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1024 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001025 unsigned Size =
1026 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001027 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
1028 return new (Mem) OMPTargetUpdateDirective(NumClauses);
1029}
Carlo Bertolli9925f152016-06-27 14:55:37 +00001030
1031OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1032 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1033 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1034 const HelperExprs &Exprs) {
1035 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001036 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001037 void *Mem = C.Allocate(
1038 Size + sizeof(OMPClause *) * Clauses.size() +
1039 sizeof(Stmt *) *
1040 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1041 OMPDistributeParallelForDirective *Dir =
1042 new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc,
1043 CollapsedNum, Clauses.size());
1044 Dir->setClauses(Clauses);
1045 Dir->setAssociatedStmt(AssociatedStmt);
1046 Dir->setIterationVariable(Exprs.IterationVarRef);
1047 Dir->setLastIteration(Exprs.LastIteration);
1048 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1049 Dir->setPreCond(Exprs.PreCond);
1050 Dir->setCond(Exprs.Cond);
1051 Dir->setInit(Exprs.Init);
1052 Dir->setInc(Exprs.Inc);
1053 Dir->setIsLastIterVariable(Exprs.IL);
1054 Dir->setLowerBoundVariable(Exprs.LB);
1055 Dir->setUpperBoundVariable(Exprs.UB);
1056 Dir->setStrideVariable(Exprs.ST);
1057 Dir->setEnsureUpperBound(Exprs.EUB);
1058 Dir->setNextLowerBound(Exprs.NLB);
1059 Dir->setNextUpperBound(Exprs.NUB);
1060 Dir->setNumIterations(Exprs.NumIterations);
1061 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1062 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001063 Dir->setDistInc(Exprs.DistInc);
1064 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Carlo Bertolli9925f152016-06-27 14:55:37 +00001065 Dir->setCounters(Exprs.Counters);
1066 Dir->setPrivateCounters(Exprs.PrivateCounters);
1067 Dir->setInits(Exprs.Inits);
1068 Dir->setUpdates(Exprs.Updates);
1069 Dir->setFinals(Exprs.Finals);
1070 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001071 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1072 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1073 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1074 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1075 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1076 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1077 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Carlo Bertolli9925f152016-06-27 14:55:37 +00001078 return Dir;
1079}
1080
1081OMPDistributeParallelForDirective *
1082OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1083 unsigned NumClauses,
1084 unsigned CollapsedNum,
1085 EmptyShell) {
1086 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001087 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001088 void *Mem = C.Allocate(
1089 Size + sizeof(OMPClause *) * NumClauses +
1090 sizeof(Stmt *) *
1091 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1092 return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses);
1093}
Kelvin Li4a39add2016-07-05 05:00:15 +00001094
1095OMPDistributeParallelForSimdDirective *
1096OMPDistributeParallelForSimdDirective::Create(
1097 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1098 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1099 const HelperExprs &Exprs) {
1100 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001101 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001102 void *Mem = C.Allocate(
1103 Size + sizeof(OMPClause *) * Clauses.size() +
1104 sizeof(Stmt *) *
1105 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1106 OMPDistributeParallelForSimdDirective *Dir = new (Mem)
1107 OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1108 Clauses.size());
1109 Dir->setClauses(Clauses);
1110 Dir->setAssociatedStmt(AssociatedStmt);
1111 Dir->setIterationVariable(Exprs.IterationVarRef);
1112 Dir->setLastIteration(Exprs.LastIteration);
1113 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1114 Dir->setPreCond(Exprs.PreCond);
1115 Dir->setCond(Exprs.Cond);
1116 Dir->setInit(Exprs.Init);
1117 Dir->setInc(Exprs.Inc);
1118 Dir->setIsLastIterVariable(Exprs.IL);
1119 Dir->setLowerBoundVariable(Exprs.LB);
1120 Dir->setUpperBoundVariable(Exprs.UB);
1121 Dir->setStrideVariable(Exprs.ST);
1122 Dir->setEnsureUpperBound(Exprs.EUB);
1123 Dir->setNextLowerBound(Exprs.NLB);
1124 Dir->setNextUpperBound(Exprs.NUB);
1125 Dir->setNumIterations(Exprs.NumIterations);
1126 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1127 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001128 Dir->setDistInc(Exprs.DistInc);
1129 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li4a39add2016-07-05 05:00:15 +00001130 Dir->setCounters(Exprs.Counters);
1131 Dir->setPrivateCounters(Exprs.PrivateCounters);
1132 Dir->setInits(Exprs.Inits);
1133 Dir->setUpdates(Exprs.Updates);
1134 Dir->setFinals(Exprs.Finals);
1135 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001136 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1137 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1138 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1139 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1140 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1141 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1142 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Kelvin Li4a39add2016-07-05 05:00:15 +00001143 return Dir;
1144}
1145
1146OMPDistributeParallelForSimdDirective *
1147OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1148 unsigned NumClauses,
1149 unsigned CollapsedNum,
1150 EmptyShell) {
1151 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001152 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001153 void *Mem = C.Allocate(
1154 Size + sizeof(OMPClause *) * NumClauses +
1155 sizeof(Stmt *) *
1156 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1157 return new (Mem)
1158 OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1159}
Kelvin Li787f3fc2016-07-06 04:45:38 +00001160
1161OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1162 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1163 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1164 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001165 unsigned Size =
1166 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001167 void *Mem = C.Allocate(
1168 Size + sizeof(OMPClause *) * Clauses.size() +
1169 sizeof(Stmt *) *
1170 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1171 OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective(
1172 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1173 Dir->setClauses(Clauses);
1174 Dir->setAssociatedStmt(AssociatedStmt);
1175 Dir->setIterationVariable(Exprs.IterationVarRef);
1176 Dir->setLastIteration(Exprs.LastIteration);
1177 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1178 Dir->setPreCond(Exprs.PreCond);
1179 Dir->setCond(Exprs.Cond);
1180 Dir->setInit(Exprs.Init);
1181 Dir->setInc(Exprs.Inc);
1182 Dir->setIsLastIterVariable(Exprs.IL);
1183 Dir->setLowerBoundVariable(Exprs.LB);
1184 Dir->setUpperBoundVariable(Exprs.UB);
1185 Dir->setStrideVariable(Exprs.ST);
1186 Dir->setEnsureUpperBound(Exprs.EUB);
1187 Dir->setNextLowerBound(Exprs.NLB);
1188 Dir->setNextUpperBound(Exprs.NUB);
1189 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li787f3fc2016-07-06 04:45:38 +00001190 Dir->setCounters(Exprs.Counters);
1191 Dir->setPrivateCounters(Exprs.PrivateCounters);
1192 Dir->setInits(Exprs.Inits);
1193 Dir->setUpdates(Exprs.Updates);
1194 Dir->setFinals(Exprs.Finals);
1195 Dir->setPreInits(Exprs.PreInits);
1196 return Dir;
1197}
1198
1199OMPDistributeSimdDirective *
1200OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1201 unsigned NumClauses,
1202 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001203 unsigned Size =
1204 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001205 void *Mem = C.Allocate(
1206 Size + sizeof(OMPClause *) * NumClauses +
1207 sizeof(Stmt *) *
1208 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1209 return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses);
1210}
Kelvin Lia579b912016-07-14 02:54:56 +00001211
1212OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1213 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1214 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1215 const HelperExprs &Exprs) {
1216 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001217 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001218 void *Mem = C.Allocate(
1219 Size + sizeof(OMPClause *) * Clauses.size() +
1220 sizeof(Stmt *) *
1221 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1222 OMPTargetParallelForSimdDirective *Dir =
1223 new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc,
1224 CollapsedNum, Clauses.size());
1225 Dir->setClauses(Clauses);
1226 Dir->setAssociatedStmt(AssociatedStmt);
1227 Dir->setIterationVariable(Exprs.IterationVarRef);
1228 Dir->setLastIteration(Exprs.LastIteration);
1229 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1230 Dir->setPreCond(Exprs.PreCond);
1231 Dir->setCond(Exprs.Cond);
1232 Dir->setInit(Exprs.Init);
1233 Dir->setInc(Exprs.Inc);
1234 Dir->setIsLastIterVariable(Exprs.IL);
1235 Dir->setLowerBoundVariable(Exprs.LB);
1236 Dir->setUpperBoundVariable(Exprs.UB);
1237 Dir->setStrideVariable(Exprs.ST);
1238 Dir->setEnsureUpperBound(Exprs.EUB);
1239 Dir->setNextLowerBound(Exprs.NLB);
1240 Dir->setNextUpperBound(Exprs.NUB);
1241 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Lia579b912016-07-14 02:54:56 +00001242 Dir->setCounters(Exprs.Counters);
1243 Dir->setPrivateCounters(Exprs.PrivateCounters);
1244 Dir->setInits(Exprs.Inits);
1245 Dir->setUpdates(Exprs.Updates);
1246 Dir->setFinals(Exprs.Finals);
1247 Dir->setPreInits(Exprs.PreInits);
1248 return Dir;
1249}
1250
1251OMPTargetParallelForSimdDirective *
1252OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1253 unsigned NumClauses,
1254 unsigned CollapsedNum,
1255 EmptyShell) {
1256 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001257 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001258 void *Mem = C.Allocate(
1259 Size + sizeof(OMPClause *) * NumClauses +
1260 sizeof(Stmt *) *
1261 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1262 return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses);
1263}
Kelvin Li986330c2016-07-20 22:57:10 +00001264
1265OMPTargetSimdDirective *
1266OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1267 SourceLocation EndLoc, unsigned CollapsedNum,
1268 ArrayRef<OMPClause *> Clauses,
1269 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001270 unsigned Size =
1271 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001272 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1273 sizeof(Stmt *) *
1274 numLoopChildren(CollapsedNum, OMPD_target_simd));
1275 OMPTargetSimdDirective *Dir = new (Mem)
1276 OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1277 Dir->setClauses(Clauses);
1278 Dir->setAssociatedStmt(AssociatedStmt);
1279 Dir->setIterationVariable(Exprs.IterationVarRef);
1280 Dir->setLastIteration(Exprs.LastIteration);
1281 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1282 Dir->setPreCond(Exprs.PreCond);
1283 Dir->setCond(Exprs.Cond);
1284 Dir->setInit(Exprs.Init);
1285 Dir->setInc(Exprs.Inc);
1286 Dir->setCounters(Exprs.Counters);
1287 Dir->setPrivateCounters(Exprs.PrivateCounters);
1288 Dir->setInits(Exprs.Inits);
1289 Dir->setUpdates(Exprs.Updates);
1290 Dir->setFinals(Exprs.Finals);
1291 Dir->setPreInits(Exprs.PreInits);
1292 return Dir;
1293}
1294
1295OMPTargetSimdDirective *
1296OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1297 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001298 unsigned Size =
1299 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001300 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1301 sizeof(Stmt *) *
1302 numLoopChildren(CollapsedNum, OMPD_target_simd));
1303 return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses);
1304}
Kelvin Li02532872016-08-05 14:37:37 +00001305
1306OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1307 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1308 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1309 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001310 unsigned Size =
1311 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001312 void *Mem = C.Allocate(
1313 Size + sizeof(OMPClause *) * Clauses.size() +
1314 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1315 OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective(
1316 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1317 Dir->setClauses(Clauses);
1318 Dir->setAssociatedStmt(AssociatedStmt);
1319 Dir->setIterationVariable(Exprs.IterationVarRef);
1320 Dir->setLastIteration(Exprs.LastIteration);
1321 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1322 Dir->setPreCond(Exprs.PreCond);
1323 Dir->setCond(Exprs.Cond);
1324 Dir->setInit(Exprs.Init);
1325 Dir->setInc(Exprs.Inc);
1326 Dir->setIsLastIterVariable(Exprs.IL);
1327 Dir->setLowerBoundVariable(Exprs.LB);
1328 Dir->setUpperBoundVariable(Exprs.UB);
1329 Dir->setStrideVariable(Exprs.ST);
1330 Dir->setEnsureUpperBound(Exprs.EUB);
1331 Dir->setNextLowerBound(Exprs.NLB);
1332 Dir->setNextUpperBound(Exprs.NUB);
1333 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li02532872016-08-05 14:37:37 +00001334 Dir->setCounters(Exprs.Counters);
1335 Dir->setPrivateCounters(Exprs.PrivateCounters);
1336 Dir->setInits(Exprs.Inits);
1337 Dir->setUpdates(Exprs.Updates);
1338 Dir->setFinals(Exprs.Finals);
1339 Dir->setPreInits(Exprs.PreInits);
1340 return Dir;
1341}
1342
1343OMPTeamsDistributeDirective *
1344OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1345 unsigned NumClauses,
1346 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001347 unsigned Size =
1348 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001349 void *Mem = C.Allocate(
1350 Size + sizeof(OMPClause *) * NumClauses +
1351 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1352 return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses);
1353}
Kelvin Li4e325f72016-10-25 12:50:55 +00001354
1355OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1356 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1357 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1358 const HelperExprs &Exprs) {
1359 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1360 alignof(OMPClause *));
1361 void *Mem =
1362 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1363 sizeof(Stmt *) *
1364 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1365 OMPTeamsDistributeSimdDirective *Dir =
1366 new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1367 Clauses.size());
1368 Dir->setClauses(Clauses);
1369 Dir->setAssociatedStmt(AssociatedStmt);
1370 Dir->setIterationVariable(Exprs.IterationVarRef);
1371 Dir->setLastIteration(Exprs.LastIteration);
1372 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1373 Dir->setPreCond(Exprs.PreCond);
1374 Dir->setCond(Exprs.Cond);
1375 Dir->setInit(Exprs.Init);
1376 Dir->setInc(Exprs.Inc);
1377 Dir->setIsLastIterVariable(Exprs.IL);
1378 Dir->setLowerBoundVariable(Exprs.LB);
1379 Dir->setUpperBoundVariable(Exprs.UB);
1380 Dir->setStrideVariable(Exprs.ST);
1381 Dir->setEnsureUpperBound(Exprs.EUB);
1382 Dir->setNextLowerBound(Exprs.NLB);
1383 Dir->setNextUpperBound(Exprs.NUB);
1384 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li4e325f72016-10-25 12:50:55 +00001385 Dir->setCounters(Exprs.Counters);
1386 Dir->setPrivateCounters(Exprs.PrivateCounters);
1387 Dir->setInits(Exprs.Inits);
1388 Dir->setUpdates(Exprs.Updates);
1389 Dir->setFinals(Exprs.Finals);
1390 Dir->setPreInits(Exprs.PreInits);
1391 return Dir;
1392}
1393
1394OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1395 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1396 EmptyShell) {
1397 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1398 alignof(OMPClause *));
1399 void *Mem =
1400 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1401 sizeof(Stmt *) *
1402 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1403 return new (Mem) OMPTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1404}
Kelvin Li579e41c2016-11-30 23:51:03 +00001405
1406OMPTeamsDistributeParallelForSimdDirective *
1407OMPTeamsDistributeParallelForSimdDirective::Create(
1408 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1409 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1410 const HelperExprs &Exprs) {
1411 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1412 alignof(OMPClause *));
1413 void *Mem =
1414 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1415 sizeof(Stmt *) *
1416 numLoopChildren(CollapsedNum,
1417 OMPD_teams_distribute_parallel_for_simd));
1418 OMPTeamsDistributeParallelForSimdDirective *Dir = new (Mem)
1419 OMPTeamsDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1420 Clauses.size());
1421 Dir->setClauses(Clauses);
1422 Dir->setAssociatedStmt(AssociatedStmt);
1423 Dir->setIterationVariable(Exprs.IterationVarRef);
1424 Dir->setLastIteration(Exprs.LastIteration);
1425 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1426 Dir->setPreCond(Exprs.PreCond);
1427 Dir->setCond(Exprs.Cond);
1428 Dir->setInit(Exprs.Init);
1429 Dir->setInc(Exprs.Inc);
1430 Dir->setIsLastIterVariable(Exprs.IL);
1431 Dir->setLowerBoundVariable(Exprs.LB);
1432 Dir->setUpperBoundVariable(Exprs.UB);
1433 Dir->setStrideVariable(Exprs.ST);
1434 Dir->setEnsureUpperBound(Exprs.EUB);
1435 Dir->setNextLowerBound(Exprs.NLB);
1436 Dir->setNextUpperBound(Exprs.NUB);
1437 Dir->setNumIterations(Exprs.NumIterations);
1438 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1439 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001440 Dir->setDistInc(Exprs.DistInc);
1441 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li579e41c2016-11-30 23:51:03 +00001442 Dir->setCounters(Exprs.Counters);
1443 Dir->setPrivateCounters(Exprs.PrivateCounters);
1444 Dir->setInits(Exprs.Inits);
1445 Dir->setUpdates(Exprs.Updates);
1446 Dir->setFinals(Exprs.Finals);
1447 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001448 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1449 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1450 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1451 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1452 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1453 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1454 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Kelvin Li579e41c2016-11-30 23:51:03 +00001455 return Dir;
1456}
1457
1458OMPTeamsDistributeParallelForSimdDirective *
1459OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1460 unsigned NumClauses,
1461 unsigned CollapsedNum,
1462 EmptyShell) {
1463 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1464 alignof(OMPClause *));
1465 void *Mem =
1466 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1467 sizeof(Stmt *) *
1468 numLoopChildren(CollapsedNum,
1469 OMPD_teams_distribute_parallel_for_simd));
1470 return new (Mem)
1471 OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1472}
Kelvin Li7ade93f2016-12-09 03:24:30 +00001473
1474OMPTeamsDistributeParallelForDirective *
1475OMPTeamsDistributeParallelForDirective::Create(
1476 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1477 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1478 const HelperExprs &Exprs) {
1479 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1480 alignof(OMPClause *));
1481 void *Mem = C.Allocate(
1482 Size + sizeof(OMPClause *) * Clauses.size() +
1483 sizeof(Stmt *) *
1484 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1485 OMPTeamsDistributeParallelForDirective *Dir = new (Mem)
1486 OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum,
1487 Clauses.size());
1488 Dir->setClauses(Clauses);
1489 Dir->setAssociatedStmt(AssociatedStmt);
1490 Dir->setIterationVariable(Exprs.IterationVarRef);
1491 Dir->setLastIteration(Exprs.LastIteration);
1492 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1493 Dir->setPreCond(Exprs.PreCond);
1494 Dir->setCond(Exprs.Cond);
1495 Dir->setInit(Exprs.Init);
1496 Dir->setInc(Exprs.Inc);
1497 Dir->setIsLastIterVariable(Exprs.IL);
1498 Dir->setLowerBoundVariable(Exprs.LB);
1499 Dir->setUpperBoundVariable(Exprs.UB);
1500 Dir->setStrideVariable(Exprs.ST);
1501 Dir->setEnsureUpperBound(Exprs.EUB);
1502 Dir->setNextLowerBound(Exprs.NLB);
1503 Dir->setNextUpperBound(Exprs.NUB);
1504 Dir->setNumIterations(Exprs.NumIterations);
1505 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1506 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001507 Dir->setDistInc(Exprs.DistInc);
1508 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li7ade93f2016-12-09 03:24:30 +00001509 Dir->setCounters(Exprs.Counters);
1510 Dir->setPrivateCounters(Exprs.PrivateCounters);
1511 Dir->setInits(Exprs.Inits);
1512 Dir->setUpdates(Exprs.Updates);
1513 Dir->setFinals(Exprs.Finals);
1514 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001515 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1516 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1517 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1518 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1519 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1520 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1521 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Kelvin Li7ade93f2016-12-09 03:24:30 +00001522 return Dir;
1523}
1524
1525OMPTeamsDistributeParallelForDirective *
1526OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1527 unsigned NumClauses,
1528 unsigned CollapsedNum,
1529 EmptyShell) {
1530 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1531 alignof(OMPClause *));
1532 void *Mem = C.Allocate(
1533 Size + sizeof(OMPClause *) * NumClauses +
1534 sizeof(Stmt *) *
1535 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1536 return new (Mem)
1537 OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1538}
1539
Kelvin Libf594a52016-12-17 05:48:59 +00001540OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1541 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1542 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1543 auto Size =
1544 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1545 void *Mem =
1546 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
1547 OMPTargetTeamsDirective *Dir =
1548 new (Mem) OMPTargetTeamsDirective(StartLoc, EndLoc, Clauses.size());
1549 Dir->setClauses(Clauses);
1550 Dir->setAssociatedStmt(AssociatedStmt);
1551 return Dir;
1552}
1553
1554OMPTargetTeamsDirective *
1555OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1556 EmptyShell) {
1557 auto Size =
1558 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1559 void *Mem =
1560 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1561 return new (Mem) OMPTargetTeamsDirective(NumClauses);
1562}
Kelvin Li83c451e2016-12-25 04:52:54 +00001563
1564OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
1565 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1566 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1567 const HelperExprs &Exprs) {
1568 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1569 alignof(OMPClause *));
1570 void *Mem = C.Allocate(
1571 Size + sizeof(OMPClause *) * Clauses.size() +
1572 sizeof(Stmt *) *
1573 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1574 OMPTargetTeamsDistributeDirective *Dir =
1575 new (Mem) OMPTargetTeamsDistributeDirective(StartLoc, EndLoc, CollapsedNum,
1576 Clauses.size());
1577 Dir->setClauses(Clauses);
1578 Dir->setAssociatedStmt(AssociatedStmt);
1579 Dir->setIterationVariable(Exprs.IterationVarRef);
1580 Dir->setLastIteration(Exprs.LastIteration);
1581 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1582 Dir->setPreCond(Exprs.PreCond);
1583 Dir->setCond(Exprs.Cond);
1584 Dir->setInit(Exprs.Init);
1585 Dir->setInc(Exprs.Inc);
1586 Dir->setIsLastIterVariable(Exprs.IL);
1587 Dir->setLowerBoundVariable(Exprs.LB);
1588 Dir->setUpperBoundVariable(Exprs.UB);
1589 Dir->setStrideVariable(Exprs.ST);
1590 Dir->setEnsureUpperBound(Exprs.EUB);
1591 Dir->setNextLowerBound(Exprs.NLB);
1592 Dir->setNextUpperBound(Exprs.NUB);
1593 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li83c451e2016-12-25 04:52:54 +00001594 Dir->setCounters(Exprs.Counters);
1595 Dir->setPrivateCounters(Exprs.PrivateCounters);
1596 Dir->setInits(Exprs.Inits);
1597 Dir->setUpdates(Exprs.Updates);
1598 Dir->setFinals(Exprs.Finals);
1599 Dir->setPreInits(Exprs.PreInits);
1600 return Dir;
1601}
1602
1603OMPTargetTeamsDistributeDirective *
1604OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1605 unsigned NumClauses,
1606 unsigned CollapsedNum,
1607 EmptyShell) {
1608 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1609 alignof(OMPClause *));
1610 void *Mem = C.Allocate(
1611 Size + sizeof(OMPClause *) * NumClauses +
1612 sizeof(Stmt *) *
1613 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1614 return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses);
1615}
Kelvin Li80e8f562016-12-29 22:16:30 +00001616
1617OMPTargetTeamsDistributeParallelForDirective *
1618OMPTargetTeamsDistributeParallelForDirective::Create(
1619 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1620 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1621 const HelperExprs &Exprs) {
1622 auto Size =
1623 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1624 alignof(OMPClause *));
1625 void *Mem = C.Allocate(
1626 Size + sizeof(OMPClause *) * Clauses.size() +
1627 sizeof(Stmt *) *
1628 numLoopChildren(CollapsedNum,
1629 OMPD_target_teams_distribute_parallel_for));
1630 OMPTargetTeamsDistributeParallelForDirective *Dir =
1631 new (Mem) OMPTargetTeamsDistributeParallelForDirective(
1632 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1633 Dir->setClauses(Clauses);
1634 Dir->setAssociatedStmt(AssociatedStmt);
1635 Dir->setIterationVariable(Exprs.IterationVarRef);
1636 Dir->setLastIteration(Exprs.LastIteration);
1637 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1638 Dir->setPreCond(Exprs.PreCond);
1639 Dir->setCond(Exprs.Cond);
1640 Dir->setInit(Exprs.Init);
1641 Dir->setInc(Exprs.Inc);
1642 Dir->setIsLastIterVariable(Exprs.IL);
1643 Dir->setLowerBoundVariable(Exprs.LB);
1644 Dir->setUpperBoundVariable(Exprs.UB);
1645 Dir->setStrideVariable(Exprs.ST);
1646 Dir->setEnsureUpperBound(Exprs.EUB);
1647 Dir->setNextLowerBound(Exprs.NLB);
1648 Dir->setNextUpperBound(Exprs.NUB);
1649 Dir->setNumIterations(Exprs.NumIterations);
1650 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1651 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001652 Dir->setDistInc(Exprs.DistInc);
1653 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li80e8f562016-12-29 22:16:30 +00001654 Dir->setCounters(Exprs.Counters);
1655 Dir->setPrivateCounters(Exprs.PrivateCounters);
1656 Dir->setInits(Exprs.Inits);
1657 Dir->setUpdates(Exprs.Updates);
1658 Dir->setFinals(Exprs.Finals);
1659 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001660 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1661 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1662 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1663 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1664 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1665 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1666 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Kelvin Li80e8f562016-12-29 22:16:30 +00001667 return Dir;
1668}
1669
1670OMPTargetTeamsDistributeParallelForDirective *
1671OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1672 unsigned NumClauses,
1673 unsigned CollapsedNum,
1674 EmptyShell) {
1675 auto Size =
1676 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1677 alignof(OMPClause *));
1678 void *Mem = C.Allocate(
1679 Size + sizeof(OMPClause *) * NumClauses +
1680 sizeof(Stmt *) *
1681 numLoopChildren(CollapsedNum,
1682 OMPD_target_teams_distribute_parallel_for));
1683 return new (Mem)
1684 OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1685}
Kelvin Li1851df52017-01-03 05:23:48 +00001686
1687OMPTargetTeamsDistributeParallelForSimdDirective *
1688OMPTargetTeamsDistributeParallelForSimdDirective::Create(
1689 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1690 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1691 const HelperExprs &Exprs) {
1692 auto Size =
1693 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1694 alignof(OMPClause *));
1695 void *Mem = C.Allocate(
1696 Size + sizeof(OMPClause *) * Clauses.size() +
1697 sizeof(Stmt *) *
1698 numLoopChildren(CollapsedNum,
1699 OMPD_target_teams_distribute_parallel_for_simd));
1700 OMPTargetTeamsDistributeParallelForSimdDirective *Dir =
1701 new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1702 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1703 Dir->setClauses(Clauses);
1704 Dir->setAssociatedStmt(AssociatedStmt);
1705 Dir->setIterationVariable(Exprs.IterationVarRef);
1706 Dir->setLastIteration(Exprs.LastIteration);
1707 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1708 Dir->setPreCond(Exprs.PreCond);
1709 Dir->setCond(Exprs.Cond);
1710 Dir->setInit(Exprs.Init);
1711 Dir->setInc(Exprs.Inc);
1712 Dir->setIsLastIterVariable(Exprs.IL);
1713 Dir->setLowerBoundVariable(Exprs.LB);
1714 Dir->setUpperBoundVariable(Exprs.UB);
1715 Dir->setStrideVariable(Exprs.ST);
1716 Dir->setEnsureUpperBound(Exprs.EUB);
1717 Dir->setNextLowerBound(Exprs.NLB);
1718 Dir->setNextUpperBound(Exprs.NUB);
1719 Dir->setNumIterations(Exprs.NumIterations);
1720 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1721 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001722 Dir->setDistInc(Exprs.DistInc);
1723 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li1851df52017-01-03 05:23:48 +00001724 Dir->setCounters(Exprs.Counters);
1725 Dir->setPrivateCounters(Exprs.PrivateCounters);
1726 Dir->setInits(Exprs.Inits);
1727 Dir->setUpdates(Exprs.Updates);
1728 Dir->setFinals(Exprs.Finals);
1729 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001730 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1731 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1732 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1733 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1734 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1735 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1736 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Kelvin Li1851df52017-01-03 05:23:48 +00001737 return Dir;
1738}
1739
1740OMPTargetTeamsDistributeParallelForSimdDirective *
1741OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
1742 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1743 EmptyShell) {
1744 auto Size =
1745 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1746 alignof(OMPClause *));
1747 void *Mem = C.Allocate(
1748 Size + sizeof(OMPClause *) * NumClauses +
1749 sizeof(Stmt *) *
1750 numLoopChildren(CollapsedNum,
1751 OMPD_target_teams_distribute_parallel_for_simd));
1752 return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1753 CollapsedNum, NumClauses);
1754}
1755
Kelvin Lida681182017-01-10 18:08:18 +00001756OMPTargetTeamsDistributeSimdDirective *
1757OMPTargetTeamsDistributeSimdDirective::Create(
1758 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1759 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1760 const HelperExprs &Exprs) {
1761 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1762 alignof(OMPClause *));
1763 void *Mem = C.Allocate(
1764 Size + sizeof(OMPClause *) * Clauses.size() +
1765 sizeof(Stmt *) *
1766 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1767 OMPTargetTeamsDistributeSimdDirective *Dir = new (Mem)
1768 OMPTargetTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1769 Clauses.size());
1770 Dir->setClauses(Clauses);
1771 Dir->setAssociatedStmt(AssociatedStmt);
1772 Dir->setIterationVariable(Exprs.IterationVarRef);
1773 Dir->setLastIteration(Exprs.LastIteration);
1774 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1775 Dir->setPreCond(Exprs.PreCond);
1776 Dir->setCond(Exprs.Cond);
1777 Dir->setInit(Exprs.Init);
1778 Dir->setInc(Exprs.Inc);
1779 Dir->setIsLastIterVariable(Exprs.IL);
1780 Dir->setLowerBoundVariable(Exprs.LB);
1781 Dir->setUpperBoundVariable(Exprs.UB);
1782 Dir->setStrideVariable(Exprs.ST);
1783 Dir->setEnsureUpperBound(Exprs.EUB);
1784 Dir->setNextLowerBound(Exprs.NLB);
1785 Dir->setNextUpperBound(Exprs.NUB);
1786 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Lida681182017-01-10 18:08:18 +00001787 Dir->setCounters(Exprs.Counters);
1788 Dir->setPrivateCounters(Exprs.PrivateCounters);
1789 Dir->setInits(Exprs.Inits);
1790 Dir->setUpdates(Exprs.Updates);
1791 Dir->setFinals(Exprs.Finals);
1792 Dir->setPreInits(Exprs.PreInits);
1793 return Dir;
1794}
1795
1796OMPTargetTeamsDistributeSimdDirective *
1797OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1798 unsigned NumClauses,
1799 unsigned CollapsedNum,
1800 EmptyShell) {
1801 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1802 alignof(OMPClause *));
1803 void *Mem = C.Allocate(
1804 Size + sizeof(OMPClause *) * NumClauses +
1805 sizeof(Stmt *) *
1806 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1807 return new (Mem)
1808 OMPTargetTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1809}