blob: 4e829897cebe61fb4ca5c06e97f3abbf46475272 [file] [log] [blame]
James Y Knightb8bfd962015-10-02 13:41:04 +00001//===--- StmtOpenMP.cpp - Classes for OpenMP directives -------------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
James Y Knightb8bfd962015-10-02 13:41:04 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the subclesses of Stmt class declared in StmtOpenMP.h
10//
11//===----------------------------------------------------------------------===//
12
13#include "clang/AST/StmtOpenMP.h"
14
15#include "clang/AST/ASTContext.h"
16
17using namespace clang;
18
19void OMPExecutableDirective::setClauses(ArrayRef<OMPClause *> Clauses) {
20 assert(Clauses.size() == getNumClauses() &&
21 "Number of clauses is not the same as the preallocated buffer");
22 std::copy(Clauses.begin(), Clauses.end(), getClauses().begin());
23}
24
Roman Lebedevb5700602019-03-20 16:32:36 +000025bool OMPExecutableDirective::isStandaloneDirective() const {
26 // Special case: 'omp target enter data', 'omp target exit data',
27 // 'omp target update' are stand-alone directives, but for implementation
28 // reasons they have empty synthetic structured block, to simplify codegen.
29 if (isa<OMPTargetEnterDataDirective>(this) ||
30 isa<OMPTargetExitDataDirective>(this) ||
31 isa<OMPTargetUpdateDirective>(this))
32 return true;
33 return !hasAssociatedStmt() || !getAssociatedStmt();
34}
35
36const Stmt *OMPExecutableDirective::getStructuredBlock() const {
37 assert(!isStandaloneDirective() &&
38 "Standalone Executable Directives don't have Structured Blocks.");
39 if (auto *LD = dyn_cast<OMPLoopDirective>(this))
40 return LD->getBody();
41 return getInnermostCapturedStmt()->getCapturedStmt();
42}
43
James Y Knightb8bfd962015-10-02 13:41:04 +000044void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
45 assert(A.size() == getCollapsedNumber() &&
46 "Number of loop counters is not the same as the collapsed number");
47 std::copy(A.begin(), A.end(), getCounters().begin());
48}
49
50void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
51 assert(A.size() == getCollapsedNumber() && "Number of loop private counters "
52 "is not the same as the collapsed "
53 "number");
54 std::copy(A.begin(), A.end(), getPrivateCounters().begin());
55}
56
57void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
58 assert(A.size() == getCollapsedNumber() &&
59 "Number of counter inits is not the same as the collapsed number");
60 std::copy(A.begin(), A.end(), getInits().begin());
61}
62
63void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
64 assert(A.size() == getCollapsedNumber() &&
65 "Number of counter updates is not the same as the collapsed number");
66 std::copy(A.begin(), A.end(), getUpdates().begin());
67}
68
69void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
70 assert(A.size() == getCollapsedNumber() &&
71 "Number of counter finals is not the same as the collapsed number");
72 std::copy(A.begin(), A.end(), getFinals().begin());
73}
74
75OMPParallelDirective *OMPParallelDirective::Create(
76 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
77 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Rui Ueyama83aa9792016-01-14 21:00:27 +000078 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +000079 llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +000080 void *Mem =
81 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
82 OMPParallelDirective *Dir =
83 new (Mem) OMPParallelDirective(StartLoc, EndLoc, Clauses.size());
84 Dir->setClauses(Clauses);
85 Dir->setAssociatedStmt(AssociatedStmt);
86 Dir->setHasCancel(HasCancel);
87 return Dir;
88}
89
90OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
91 unsigned NumClauses,
92 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +000093 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +000094 llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +000095 void *Mem =
96 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
97 return new (Mem) OMPParallelDirective(NumClauses);
98}
99
100OMPSimdDirective *
101OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
102 SourceLocation EndLoc, unsigned CollapsedNum,
103 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
104 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000105 unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000106 void *Mem =
107 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
108 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
109 OMPSimdDirective *Dir = new (Mem)
110 OMPSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
111 Dir->setClauses(Clauses);
112 Dir->setAssociatedStmt(AssociatedStmt);
113 Dir->setIterationVariable(Exprs.IterationVarRef);
114 Dir->setLastIteration(Exprs.LastIteration);
115 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
116 Dir->setPreCond(Exprs.PreCond);
117 Dir->setCond(Exprs.Cond);
118 Dir->setInit(Exprs.Init);
119 Dir->setInc(Exprs.Inc);
120 Dir->setCounters(Exprs.Counters);
121 Dir->setPrivateCounters(Exprs.PrivateCounters);
122 Dir->setInits(Exprs.Inits);
123 Dir->setUpdates(Exprs.Updates);
124 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000125 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000126 return Dir;
127}
128
129OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C,
130 unsigned NumClauses,
131 unsigned CollapsedNum,
132 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000133 unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000134 void *Mem =
135 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
136 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
137 return new (Mem) OMPSimdDirective(CollapsedNum, NumClauses);
138}
139
140OMPForDirective *
141OMPForDirective::Create(const ASTContext &C, SourceLocation StartLoc,
142 SourceLocation EndLoc, unsigned CollapsedNum,
143 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
144 const HelperExprs &Exprs, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000145 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000146 void *Mem =
147 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
148 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
149 OMPForDirective *Dir =
150 new (Mem) OMPForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
151 Dir->setClauses(Clauses);
152 Dir->setAssociatedStmt(AssociatedStmt);
153 Dir->setIterationVariable(Exprs.IterationVarRef);
154 Dir->setLastIteration(Exprs.LastIteration);
155 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
156 Dir->setPreCond(Exprs.PreCond);
157 Dir->setCond(Exprs.Cond);
158 Dir->setInit(Exprs.Init);
159 Dir->setInc(Exprs.Inc);
160 Dir->setIsLastIterVariable(Exprs.IL);
161 Dir->setLowerBoundVariable(Exprs.LB);
162 Dir->setUpperBoundVariable(Exprs.UB);
163 Dir->setStrideVariable(Exprs.ST);
164 Dir->setEnsureUpperBound(Exprs.EUB);
165 Dir->setNextLowerBound(Exprs.NLB);
166 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000167 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000168 Dir->setCounters(Exprs.Counters);
169 Dir->setPrivateCounters(Exprs.PrivateCounters);
170 Dir->setInits(Exprs.Inits);
171 Dir->setUpdates(Exprs.Updates);
172 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000173 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000174 Dir->setHasCancel(HasCancel);
175 return Dir;
176}
177
178OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
179 unsigned NumClauses,
180 unsigned CollapsedNum,
181 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000182 unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000183 void *Mem =
184 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
185 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
186 return new (Mem) OMPForDirective(CollapsedNum, NumClauses);
187}
188
189OMPForSimdDirective *
190OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
191 SourceLocation EndLoc, unsigned CollapsedNum,
192 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
193 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000194 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000195 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000196 void *Mem =
197 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
198 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
199 OMPForSimdDirective *Dir = new (Mem)
200 OMPForSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
201 Dir->setClauses(Clauses);
202 Dir->setAssociatedStmt(AssociatedStmt);
203 Dir->setIterationVariable(Exprs.IterationVarRef);
204 Dir->setLastIteration(Exprs.LastIteration);
205 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
206 Dir->setPreCond(Exprs.PreCond);
207 Dir->setCond(Exprs.Cond);
208 Dir->setInit(Exprs.Init);
209 Dir->setInc(Exprs.Inc);
210 Dir->setIsLastIterVariable(Exprs.IL);
211 Dir->setLowerBoundVariable(Exprs.LB);
212 Dir->setUpperBoundVariable(Exprs.UB);
213 Dir->setStrideVariable(Exprs.ST);
214 Dir->setEnsureUpperBound(Exprs.EUB);
215 Dir->setNextLowerBound(Exprs.NLB);
216 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000217 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000218 Dir->setCounters(Exprs.Counters);
219 Dir->setPrivateCounters(Exprs.PrivateCounters);
220 Dir->setInits(Exprs.Inits);
221 Dir->setUpdates(Exprs.Updates);
222 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000223 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000224 return Dir;
225}
226
227OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
228 unsigned NumClauses,
229 unsigned CollapsedNum,
230 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000231 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000232 llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000233 void *Mem =
234 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
235 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
236 return new (Mem) OMPForSimdDirective(CollapsedNum, NumClauses);
237}
238
239OMPSectionsDirective *OMPSectionsDirective::Create(
240 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
241 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000242 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000243 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000244 void *Mem =
245 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
246 OMPSectionsDirective *Dir =
247 new (Mem) OMPSectionsDirective(StartLoc, EndLoc, Clauses.size());
248 Dir->setClauses(Clauses);
249 Dir->setAssociatedStmt(AssociatedStmt);
250 Dir->setHasCancel(HasCancel);
251 return Dir;
252}
253
254OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
255 unsigned NumClauses,
256 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000257 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000258 llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000259 void *Mem =
260 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
261 return new (Mem) OMPSectionsDirective(NumClauses);
262}
263
264OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
265 SourceLocation StartLoc,
266 SourceLocation EndLoc,
267 Stmt *AssociatedStmt,
268 bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000269 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000270 void *Mem = C.Allocate(Size + sizeof(Stmt *));
271 OMPSectionDirective *Dir = new (Mem) OMPSectionDirective(StartLoc, EndLoc);
272 Dir->setAssociatedStmt(AssociatedStmt);
273 Dir->setHasCancel(HasCancel);
274 return Dir;
275}
276
277OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
278 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000279 unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000280 void *Mem = C.Allocate(Size + sizeof(Stmt *));
281 return new (Mem) OMPSectionDirective();
282}
283
284OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
285 SourceLocation StartLoc,
286 SourceLocation EndLoc,
287 ArrayRef<OMPClause *> Clauses,
288 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000289 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000290 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000291 void *Mem =
292 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
293 OMPSingleDirective *Dir =
294 new (Mem) OMPSingleDirective(StartLoc, EndLoc, Clauses.size());
295 Dir->setClauses(Clauses);
296 Dir->setAssociatedStmt(AssociatedStmt);
297 return Dir;
298}
299
300OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
301 unsigned NumClauses,
302 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000303 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000304 llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000305 void *Mem =
306 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
307 return new (Mem) OMPSingleDirective(NumClauses);
308}
309
310OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
311 SourceLocation StartLoc,
312 SourceLocation EndLoc,
313 Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000314 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000315 void *Mem = C.Allocate(Size + sizeof(Stmt *));
316 OMPMasterDirective *Dir = new (Mem) OMPMasterDirective(StartLoc, EndLoc);
317 Dir->setAssociatedStmt(AssociatedStmt);
318 return Dir;
319}
320
321OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
322 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000323 unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000324 void *Mem = C.Allocate(Size + sizeof(Stmt *));
325 return new (Mem) OMPMasterDirective();
326}
327
328OMPCriticalDirective *OMPCriticalDirective::Create(
329 const ASTContext &C, const DeclarationNameInfo &Name,
Alexey Bataev28c75412015-12-15 08:19:24 +0000330 SourceLocation StartLoc, SourceLocation EndLoc,
331 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000332 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000333 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000334 void *Mem =
335 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000336 OMPCriticalDirective *Dir =
Alexey Bataev28c75412015-12-15 08:19:24 +0000337 new (Mem) OMPCriticalDirective(Name, StartLoc, EndLoc, Clauses.size());
338 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000339 Dir->setAssociatedStmt(AssociatedStmt);
340 return Dir;
341}
342
343OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev28c75412015-12-15 08:19:24 +0000344 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000345 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000346 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000347 llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
Alexey Bataev28c75412015-12-15 08:19:24 +0000348 void *Mem =
349 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
350 return new (Mem) OMPCriticalDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000351}
352
353OMPParallelForDirective *OMPParallelForDirective::Create(
354 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
355 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
356 const HelperExprs &Exprs, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000357 unsigned Size =
358 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000359 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
360 sizeof(Stmt *) *
361 numLoopChildren(CollapsedNum, OMPD_parallel_for));
362 OMPParallelForDirective *Dir = new (Mem)
363 OMPParallelForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
364 Dir->setClauses(Clauses);
365 Dir->setAssociatedStmt(AssociatedStmt);
366 Dir->setIterationVariable(Exprs.IterationVarRef);
367 Dir->setLastIteration(Exprs.LastIteration);
368 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
369 Dir->setPreCond(Exprs.PreCond);
370 Dir->setCond(Exprs.Cond);
371 Dir->setInit(Exprs.Init);
372 Dir->setInc(Exprs.Inc);
373 Dir->setIsLastIterVariable(Exprs.IL);
374 Dir->setLowerBoundVariable(Exprs.LB);
375 Dir->setUpperBoundVariable(Exprs.UB);
376 Dir->setStrideVariable(Exprs.ST);
377 Dir->setEnsureUpperBound(Exprs.EUB);
378 Dir->setNextLowerBound(Exprs.NLB);
379 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000380 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000381 Dir->setCounters(Exprs.Counters);
382 Dir->setPrivateCounters(Exprs.PrivateCounters);
383 Dir->setInits(Exprs.Inits);
384 Dir->setUpdates(Exprs.Updates);
385 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000386 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000387 Dir->setHasCancel(HasCancel);
388 return Dir;
389}
390
391OMPParallelForDirective *
392OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
393 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000394 unsigned Size =
395 llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000396 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
397 sizeof(Stmt *) *
398 numLoopChildren(CollapsedNum, OMPD_parallel_for));
399 return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses);
400}
401
402OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
403 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
404 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
405 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000406 unsigned Size =
407 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000408 void *Mem = C.Allocate(
409 Size + sizeof(OMPClause *) * Clauses.size() +
410 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
411 OMPParallelForSimdDirective *Dir = new (Mem) OMPParallelForSimdDirective(
412 StartLoc, EndLoc, CollapsedNum, Clauses.size());
413 Dir->setClauses(Clauses);
414 Dir->setAssociatedStmt(AssociatedStmt);
415 Dir->setIterationVariable(Exprs.IterationVarRef);
416 Dir->setLastIteration(Exprs.LastIteration);
417 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
418 Dir->setPreCond(Exprs.PreCond);
419 Dir->setCond(Exprs.Cond);
420 Dir->setInit(Exprs.Init);
421 Dir->setInc(Exprs.Inc);
422 Dir->setIsLastIterVariable(Exprs.IL);
423 Dir->setLowerBoundVariable(Exprs.LB);
424 Dir->setUpperBoundVariable(Exprs.UB);
425 Dir->setStrideVariable(Exprs.ST);
426 Dir->setEnsureUpperBound(Exprs.EUB);
427 Dir->setNextLowerBound(Exprs.NLB);
428 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000429 Dir->setNumIterations(Exprs.NumIterations);
James Y Knightb8bfd962015-10-02 13:41:04 +0000430 Dir->setCounters(Exprs.Counters);
431 Dir->setPrivateCounters(Exprs.PrivateCounters);
432 Dir->setInits(Exprs.Inits);
433 Dir->setUpdates(Exprs.Updates);
434 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000435 Dir->setPreInits(Exprs.PreInits);
James Y Knightb8bfd962015-10-02 13:41:04 +0000436 return Dir;
437}
438
439OMPParallelForSimdDirective *
440OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
441 unsigned NumClauses,
442 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000443 unsigned Size =
444 llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000445 void *Mem = C.Allocate(
446 Size + sizeof(OMPClause *) * NumClauses +
447 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
448 return new (Mem) OMPParallelForSimdDirective(CollapsedNum, NumClauses);
449}
450
451OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
452 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
453 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000454 unsigned Size =
455 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000456 void *Mem =
457 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
458 OMPParallelSectionsDirective *Dir =
459 new (Mem) OMPParallelSectionsDirective(StartLoc, EndLoc, Clauses.size());
460 Dir->setClauses(Clauses);
461 Dir->setAssociatedStmt(AssociatedStmt);
462 Dir->setHasCancel(HasCancel);
463 return Dir;
464}
465
466OMPParallelSectionsDirective *
467OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
468 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000469 unsigned Size =
470 llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000471 void *Mem =
472 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
473 return new (Mem) OMPParallelSectionsDirective(NumClauses);
474}
475
476OMPTaskDirective *
477OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
478 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
479 Stmt *AssociatedStmt, bool HasCancel) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000480 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000481 void *Mem =
482 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
483 OMPTaskDirective *Dir =
484 new (Mem) OMPTaskDirective(StartLoc, EndLoc, Clauses.size());
485 Dir->setClauses(Clauses);
486 Dir->setAssociatedStmt(AssociatedStmt);
487 Dir->setHasCancel(HasCancel);
488 return Dir;
489}
490
491OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
492 unsigned NumClauses,
493 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000494 unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000495 void *Mem =
496 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
497 return new (Mem) OMPTaskDirective(NumClauses);
498}
499
500OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
501 SourceLocation StartLoc,
502 SourceLocation EndLoc) {
503 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
504 OMPTaskyieldDirective *Dir =
505 new (Mem) OMPTaskyieldDirective(StartLoc, EndLoc);
506 return Dir;
507}
508
509OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
510 EmptyShell) {
511 void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
512 return new (Mem) OMPTaskyieldDirective();
513}
514
515OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
516 SourceLocation StartLoc,
517 SourceLocation EndLoc) {
518 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
519 OMPBarrierDirective *Dir = new (Mem) OMPBarrierDirective(StartLoc, EndLoc);
520 return Dir;
521}
522
523OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
524 EmptyShell) {
525 void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
526 return new (Mem) OMPBarrierDirective();
527}
528
529OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C,
530 SourceLocation StartLoc,
531 SourceLocation EndLoc) {
532 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
533 OMPTaskwaitDirective *Dir = new (Mem) OMPTaskwaitDirective(StartLoc, EndLoc);
534 return Dir;
535}
536
537OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
538 EmptyShell) {
539 void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
540 return new (Mem) OMPTaskwaitDirective();
541}
542
Alexey Bataev169d96a2017-07-18 20:17:46 +0000543OMPTaskgroupDirective *OMPTaskgroupDirective::Create(
544 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000545 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) {
Alexey Bataev169d96a2017-07-18 20:17:46 +0000546 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
547 sizeof(OMPClause *) * Clauses.size(),
548 alignof(Stmt *));
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000549 void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000550 OMPTaskgroupDirective *Dir =
Alexey Bataev169d96a2017-07-18 20:17:46 +0000551 new (Mem) OMPTaskgroupDirective(StartLoc, EndLoc, Clauses.size());
James Y Knightb8bfd962015-10-02 13:41:04 +0000552 Dir->setAssociatedStmt(AssociatedStmt);
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000553 Dir->setReductionRef(ReductionRef);
Alexey Bataev169d96a2017-07-18 20:17:46 +0000554 Dir->setClauses(Clauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000555 return Dir;
556}
557
558OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
Alexey Bataev169d96a2017-07-18 20:17:46 +0000559 unsigned NumClauses,
James Y Knightb8bfd962015-10-02 13:41:04 +0000560 EmptyShell) {
Alexey Bataev169d96a2017-07-18 20:17:46 +0000561 unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
562 sizeof(OMPClause *) * NumClauses,
563 alignof(Stmt *));
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000564 void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
Alexey Bataev169d96a2017-07-18 20:17:46 +0000565 return new (Mem) OMPTaskgroupDirective(NumClauses);
James Y Knightb8bfd962015-10-02 13:41:04 +0000566}
567
568OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
569 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
570 OpenMPDirectiveKind CancelRegion) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000571 unsigned Size =
572 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000573 void *Mem = C.Allocate(Size);
574 OMPCancellationPointDirective *Dir =
575 new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc);
576 Dir->setCancelRegion(CancelRegion);
577 return Dir;
578}
579
580OMPCancellationPointDirective *
581OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000582 unsigned Size =
583 llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000584 void *Mem = C.Allocate(Size);
585 return new (Mem) OMPCancellationPointDirective();
586}
587
588OMPCancelDirective *
589OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
590 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
591 OpenMPDirectiveKind CancelRegion) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000592 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
593 sizeof(OMPClause *) * Clauses.size(),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000594 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000595 void *Mem = C.Allocate(Size);
596 OMPCancelDirective *Dir =
597 new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size());
598 Dir->setClauses(Clauses);
599 Dir->setCancelRegion(CancelRegion);
600 return Dir;
601}
602
603OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
604 unsigned NumClauses,
605 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000606 unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
607 sizeof(OMPClause *) * NumClauses,
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000608 alignof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000609 void *Mem = C.Allocate(Size);
610 return new (Mem) OMPCancelDirective(NumClauses);
611}
612
613OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
614 SourceLocation StartLoc,
615 SourceLocation EndLoc,
616 ArrayRef<OMPClause *> Clauses) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000617 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000618 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000619 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
620 OMPFlushDirective *Dir =
621 new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size());
622 Dir->setClauses(Clauses);
623 return Dir;
624}
625
626OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
627 unsigned NumClauses,
628 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000629 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000630 llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000631 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
632 return new (Mem) OMPFlushDirective(NumClauses);
633}
634
635OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
636 SourceLocation StartLoc,
637 SourceLocation EndLoc,
638 ArrayRef<OMPClause *> Clauses,
639 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000640 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000641 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000642 void *Mem =
643 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size());
644 OMPOrderedDirective *Dir =
645 new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size());
646 Dir->setClauses(Clauses);
647 Dir->setAssociatedStmt(AssociatedStmt);
648 return Dir;
649}
650
651OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
652 unsigned NumClauses,
653 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000654 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000655 llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000656 void *Mem =
657 C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses);
658 return new (Mem) OMPOrderedDirective(NumClauses);
659}
660
661OMPAtomicDirective *OMPAtomicDirective::Create(
662 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
663 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
664 Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000665 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000666 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000667 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
668 5 * sizeof(Stmt *));
669 OMPAtomicDirective *Dir =
670 new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size());
671 Dir->setClauses(Clauses);
672 Dir->setAssociatedStmt(AssociatedStmt);
673 Dir->setX(X);
674 Dir->setV(V);
675 Dir->setExpr(E);
676 Dir->setUpdateExpr(UE);
677 Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
678 Dir->IsPostfixUpdate = IsPostfixUpdate;
679 return Dir;
680}
681
682OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
683 unsigned NumClauses,
684 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000685 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000686 llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000687 void *Mem =
688 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *));
689 return new (Mem) OMPAtomicDirective(NumClauses);
690}
691
692OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
693 SourceLocation StartLoc,
694 SourceLocation EndLoc,
695 ArrayRef<OMPClause *> Clauses,
696 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000697 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000698 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000699 void *Mem =
700 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
701 OMPTargetDirective *Dir =
702 new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size());
703 Dir->setClauses(Clauses);
704 Dir->setAssociatedStmt(AssociatedStmt);
705 return Dir;
706}
707
708OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
709 unsigned NumClauses,
710 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000711 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000712 llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000713 void *Mem =
714 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
715 return new (Mem) OMPTargetDirective(NumClauses);
716}
717
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000718OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
719 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
720 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000721 unsigned Size =
722 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000723 void *Mem =
724 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
725 OMPTargetParallelDirective *Dir =
726 new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size());
727 Dir->setClauses(Clauses);
728 Dir->setAssociatedStmt(AssociatedStmt);
729 return Dir;
730}
731
732OMPTargetParallelDirective *
733OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
734 unsigned NumClauses, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000735 unsigned Size =
736 llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000737 void *Mem =
738 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
739 return new (Mem) OMPTargetParallelDirective(NumClauses);
740}
741
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000742OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
743 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
744 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
745 const HelperExprs &Exprs, bool HasCancel) {
746 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000747 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000748 void *Mem = C.Allocate(
749 Size + sizeof(OMPClause *) * Clauses.size() +
750 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
751 OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective(
752 StartLoc, EndLoc, CollapsedNum, Clauses.size());
753 Dir->setClauses(Clauses);
754 Dir->setAssociatedStmt(AssociatedStmt);
755 Dir->setIterationVariable(Exprs.IterationVarRef);
756 Dir->setLastIteration(Exprs.LastIteration);
757 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
758 Dir->setPreCond(Exprs.PreCond);
759 Dir->setCond(Exprs.Cond);
760 Dir->setInit(Exprs.Init);
761 Dir->setInc(Exprs.Inc);
762 Dir->setIsLastIterVariable(Exprs.IL);
763 Dir->setLowerBoundVariable(Exprs.LB);
764 Dir->setUpperBoundVariable(Exprs.UB);
765 Dir->setStrideVariable(Exprs.ST);
766 Dir->setEnsureUpperBound(Exprs.EUB);
767 Dir->setNextLowerBound(Exprs.NLB);
768 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000769 Dir->setNumIterations(Exprs.NumIterations);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000770 Dir->setCounters(Exprs.Counters);
771 Dir->setPrivateCounters(Exprs.PrivateCounters);
772 Dir->setInits(Exprs.Inits);
773 Dir->setUpdates(Exprs.Updates);
774 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000775 Dir->setPreInits(Exprs.PreInits);
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000776 Dir->setHasCancel(HasCancel);
777 return Dir;
778}
779
780OMPTargetParallelForDirective *
781OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
782 unsigned NumClauses,
783 unsigned CollapsedNum, EmptyShell) {
784 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000785 alignof(OMPClause *));
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000786 void *Mem = C.Allocate(
787 Size + sizeof(OMPClause *) * NumClauses +
788 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
789 return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses);
790}
791
James Y Knightb8bfd962015-10-02 13:41:04 +0000792OMPTargetDataDirective *OMPTargetDataDirective::Create(
793 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
794 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000795 void *Mem = C.Allocate(
796 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
797 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000798 OMPTargetDataDirective *Dir =
799 new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size());
800 Dir->setClauses(Clauses);
801 Dir->setAssociatedStmt(AssociatedStmt);
802 return Dir;
803}
804
805OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
806 unsigned N,
807 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000808 void *Mem = C.Allocate(
809 llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
810 sizeof(OMPClause *) * N + sizeof(Stmt *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000811 return new (Mem) OMPTargetDataDirective(N);
812}
813
Samuel Antaodf67fc42016-01-19 19:15:56 +0000814OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
815 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
Alexey Bataev7828b252017-11-21 17:08:48 +0000816 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000817 void *Mem = C.Allocate(
818 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000819 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
Samuel Antaodf67fc42016-01-19 19:15:56 +0000820 OMPTargetEnterDataDirective *Dir =
821 new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size());
822 Dir->setClauses(Clauses);
Alexey Bataev7828b252017-11-21 17:08:48 +0000823 Dir->setAssociatedStmt(AssociatedStmt);
Samuel Antaodf67fc42016-01-19 19:15:56 +0000824 return Dir;
825}
826
827OMPTargetEnterDataDirective *
828OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
829 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000830 void *Mem = C.Allocate(
831 llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000832 sizeof(OMPClause *) * N + sizeof(Stmt *));
Samuel Antaodf67fc42016-01-19 19:15:56 +0000833 return new (Mem) OMPTargetEnterDataDirective(N);
834}
835
Alexey Bataev7828b252017-11-21 17:08:48 +0000836OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create(
837 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
838 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000839 void *Mem = C.Allocate(
840 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000841 sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
Samuel Antao72590762016-01-19 20:04:50 +0000842 OMPTargetExitDataDirective *Dir =
843 new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size());
844 Dir->setClauses(Clauses);
Alexey Bataev7828b252017-11-21 17:08:48 +0000845 Dir->setAssociatedStmt(AssociatedStmt);
Samuel Antao72590762016-01-19 20:04:50 +0000846 return Dir;
847}
848
849OMPTargetExitDataDirective *
850OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
851 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000852 void *Mem = C.Allocate(
853 llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
Alexey Bataev7828b252017-11-21 17:08:48 +0000854 sizeof(OMPClause *) * N + sizeof(Stmt *));
Samuel Antao72590762016-01-19 20:04:50 +0000855 return new (Mem) OMPTargetExitDataDirective(N);
856}
857
James Y Knightb8bfd962015-10-02 13:41:04 +0000858OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
859 SourceLocation StartLoc,
860 SourceLocation EndLoc,
861 ArrayRef<OMPClause *> Clauses,
862 Stmt *AssociatedStmt) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000863 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000864 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000865 void *Mem =
866 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
867 OMPTeamsDirective *Dir =
868 new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size());
869 Dir->setClauses(Clauses);
870 Dir->setAssociatedStmt(AssociatedStmt);
871 return Dir;
872}
873
874OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
875 unsigned NumClauses,
876 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000877 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000878 llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
James Y Knightb8bfd962015-10-02 13:41:04 +0000879 void *Mem =
880 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
881 return new (Mem) OMPTeamsDirective(NumClauses);
882}
Alexey Bataev49f6e782015-12-01 04:18:41 +0000883
884OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
885 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
886 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
887 const HelperExprs &Exprs) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000888 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000889 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000890 void *Mem =
891 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
892 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
893 OMPTaskLoopDirective *Dir = new (Mem)
894 OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
895 Dir->setClauses(Clauses);
896 Dir->setAssociatedStmt(AssociatedStmt);
897 Dir->setIterationVariable(Exprs.IterationVarRef);
898 Dir->setLastIteration(Exprs.LastIteration);
899 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
900 Dir->setPreCond(Exprs.PreCond);
901 Dir->setCond(Exprs.Cond);
902 Dir->setInit(Exprs.Init);
903 Dir->setInc(Exprs.Inc);
904 Dir->setIsLastIterVariable(Exprs.IL);
905 Dir->setLowerBoundVariable(Exprs.LB);
906 Dir->setUpperBoundVariable(Exprs.UB);
907 Dir->setStrideVariable(Exprs.ST);
908 Dir->setEnsureUpperBound(Exprs.EUB);
909 Dir->setNextLowerBound(Exprs.NLB);
910 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000911 Dir->setNumIterations(Exprs.NumIterations);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000912 Dir->setCounters(Exprs.Counters);
913 Dir->setPrivateCounters(Exprs.PrivateCounters);
914 Dir->setInits(Exprs.Inits);
915 Dir->setUpdates(Exprs.Updates);
916 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000917 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev49f6e782015-12-01 04:18:41 +0000918 return Dir;
919}
920
921OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
922 unsigned NumClauses,
923 unsigned CollapsedNum,
924 EmptyShell) {
Rui Ueyama83aa9792016-01-14 21:00:27 +0000925 unsigned Size =
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000926 llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
Alexey Bataev49f6e782015-12-01 04:18:41 +0000927 void *Mem =
928 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
929 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
930 return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses);
931}
932
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000933OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
934 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
935 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
936 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000937 unsigned Size =
938 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000939 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
940 sizeof(Stmt *) *
941 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
942 OMPTaskLoopSimdDirective *Dir = new (Mem)
943 OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
944 Dir->setClauses(Clauses);
945 Dir->setAssociatedStmt(AssociatedStmt);
946 Dir->setIterationVariable(Exprs.IterationVarRef);
947 Dir->setLastIteration(Exprs.LastIteration);
948 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
949 Dir->setPreCond(Exprs.PreCond);
950 Dir->setCond(Exprs.Cond);
951 Dir->setInit(Exprs.Init);
952 Dir->setInc(Exprs.Inc);
953 Dir->setIsLastIterVariable(Exprs.IL);
954 Dir->setLowerBoundVariable(Exprs.LB);
955 Dir->setUpperBoundVariable(Exprs.UB);
956 Dir->setStrideVariable(Exprs.ST);
957 Dir->setEnsureUpperBound(Exprs.EUB);
958 Dir->setNextLowerBound(Exprs.NLB);
959 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +0000960 Dir->setNumIterations(Exprs.NumIterations);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000961 Dir->setCounters(Exprs.Counters);
962 Dir->setPrivateCounters(Exprs.PrivateCounters);
963 Dir->setInits(Exprs.Inits);
964 Dir->setUpdates(Exprs.Updates);
965 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +0000966 Dir->setPreInits(Exprs.PreInits);
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000967 return Dir;
968}
969
970OMPTaskLoopSimdDirective *
971OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
972 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000973 unsigned Size =
974 llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000975 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
976 sizeof(Stmt *) *
977 numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
978 return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);
979}
980
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000981OMPDistributeDirective *OMPDistributeDirective::Create(
982 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
983 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
984 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +0000985 unsigned Size =
986 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000987 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
988 sizeof(Stmt *) *
989 numLoopChildren(CollapsedNum, OMPD_distribute));
990 OMPDistributeDirective *Dir = new (Mem)
991 OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
992 Dir->setClauses(Clauses);
993 Dir->setAssociatedStmt(AssociatedStmt);
994 Dir->setIterationVariable(Exprs.IterationVarRef);
995 Dir->setLastIteration(Exprs.LastIteration);
996 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
997 Dir->setPreCond(Exprs.PreCond);
998 Dir->setCond(Exprs.Cond);
999 Dir->setInit(Exprs.Init);
1000 Dir->setInc(Exprs.Inc);
1001 Dir->setIsLastIterVariable(Exprs.IL);
1002 Dir->setLowerBoundVariable(Exprs.LB);
1003 Dir->setUpperBoundVariable(Exprs.UB);
1004 Dir->setStrideVariable(Exprs.ST);
1005 Dir->setEnsureUpperBound(Exprs.EUB);
1006 Dir->setNextLowerBound(Exprs.NLB);
1007 Dir->setNextUpperBound(Exprs.NUB);
Alexey Bataev8b427062016-05-25 12:36:08 +00001008 Dir->setNumIterations(Exprs.NumIterations);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001009 Dir->setCounters(Exprs.Counters);
1010 Dir->setPrivateCounters(Exprs.PrivateCounters);
1011 Dir->setInits(Exprs.Inits);
1012 Dir->setUpdates(Exprs.Updates);
1013 Dir->setFinals(Exprs.Finals);
Alexey Bataev5a3af132016-03-29 08:58:54 +00001014 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001015 return Dir;
1016}
1017
1018OMPDistributeDirective *
1019OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1020 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001021 unsigned Size =
1022 llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
Carlo Bertolli6200a3d2015-12-14 14:51:25 +00001023 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1024 sizeof(Stmt *) *
1025 numLoopChildren(CollapsedNum, OMPD_distribute));
1026 return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);
1027}
Samuel Antao686c70c2016-05-26 17:30:50 +00001028
Alexey Bataev7828b252017-11-21 17:08:48 +00001029OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create(
1030 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1031 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001032 unsigned Size =
1033 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Alexey Bataev7828b252017-11-21 17:08:48 +00001034 void *Mem =
1035 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001036 OMPTargetUpdateDirective *Dir =
1037 new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size());
1038 Dir->setClauses(Clauses);
Alexey Bataev7828b252017-11-21 17:08:48 +00001039 Dir->setAssociatedStmt(AssociatedStmt);
Samuel Antao686c70c2016-05-26 17:30:50 +00001040 return Dir;
1041}
1042
1043OMPTargetUpdateDirective *
1044OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1045 EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001046 unsigned Size =
1047 llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
Alexey Bataev7828b252017-11-21 17:08:48 +00001048 void *Mem =
1049 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
Samuel Antao686c70c2016-05-26 17:30:50 +00001050 return new (Mem) OMPTargetUpdateDirective(NumClauses);
1051}
Carlo Bertolli9925f152016-06-27 14:55:37 +00001052
1053OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1054 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1055 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001056 const HelperExprs &Exprs, bool HasCancel) {
Carlo Bertolli9925f152016-06-27 14:55:37 +00001057 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001058 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001059 void *Mem = C.Allocate(
1060 Size + sizeof(OMPClause *) * Clauses.size() +
1061 sizeof(Stmt *) *
1062 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1063 OMPDistributeParallelForDirective *Dir =
1064 new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc,
1065 CollapsedNum, Clauses.size());
1066 Dir->setClauses(Clauses);
1067 Dir->setAssociatedStmt(AssociatedStmt);
1068 Dir->setIterationVariable(Exprs.IterationVarRef);
1069 Dir->setLastIteration(Exprs.LastIteration);
1070 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1071 Dir->setPreCond(Exprs.PreCond);
1072 Dir->setCond(Exprs.Cond);
1073 Dir->setInit(Exprs.Init);
1074 Dir->setInc(Exprs.Inc);
1075 Dir->setIsLastIterVariable(Exprs.IL);
1076 Dir->setLowerBoundVariable(Exprs.LB);
1077 Dir->setUpperBoundVariable(Exprs.UB);
1078 Dir->setStrideVariable(Exprs.ST);
1079 Dir->setEnsureUpperBound(Exprs.EUB);
1080 Dir->setNextLowerBound(Exprs.NLB);
1081 Dir->setNextUpperBound(Exprs.NUB);
1082 Dir->setNumIterations(Exprs.NumIterations);
1083 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1084 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001085 Dir->setDistInc(Exprs.DistInc);
1086 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Carlo Bertolli9925f152016-06-27 14:55:37 +00001087 Dir->setCounters(Exprs.Counters);
1088 Dir->setPrivateCounters(Exprs.PrivateCounters);
1089 Dir->setInits(Exprs.Inits);
1090 Dir->setUpdates(Exprs.Updates);
1091 Dir->setFinals(Exprs.Finals);
1092 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001093 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1094 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1095 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1096 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1097 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1098 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1099 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001100 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1101 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001102 Dir->HasCancel = HasCancel;
Carlo Bertolli9925f152016-06-27 14:55:37 +00001103 return Dir;
1104}
1105
1106OMPDistributeParallelForDirective *
1107OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1108 unsigned NumClauses,
1109 unsigned CollapsedNum,
1110 EmptyShell) {
1111 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001112 alignof(OMPClause *));
Carlo Bertolli9925f152016-06-27 14:55:37 +00001113 void *Mem = C.Allocate(
1114 Size + sizeof(OMPClause *) * NumClauses +
1115 sizeof(Stmt *) *
1116 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1117 return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses);
1118}
Kelvin Li4a39add2016-07-05 05:00:15 +00001119
1120OMPDistributeParallelForSimdDirective *
1121OMPDistributeParallelForSimdDirective::Create(
1122 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1123 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1124 const HelperExprs &Exprs) {
1125 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001126 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001127 void *Mem = C.Allocate(
1128 Size + sizeof(OMPClause *) * Clauses.size() +
1129 sizeof(Stmt *) *
1130 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1131 OMPDistributeParallelForSimdDirective *Dir = new (Mem)
1132 OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1133 Clauses.size());
1134 Dir->setClauses(Clauses);
1135 Dir->setAssociatedStmt(AssociatedStmt);
1136 Dir->setIterationVariable(Exprs.IterationVarRef);
1137 Dir->setLastIteration(Exprs.LastIteration);
1138 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1139 Dir->setPreCond(Exprs.PreCond);
1140 Dir->setCond(Exprs.Cond);
1141 Dir->setInit(Exprs.Init);
1142 Dir->setInc(Exprs.Inc);
1143 Dir->setIsLastIterVariable(Exprs.IL);
1144 Dir->setLowerBoundVariable(Exprs.LB);
1145 Dir->setUpperBoundVariable(Exprs.UB);
1146 Dir->setStrideVariable(Exprs.ST);
1147 Dir->setEnsureUpperBound(Exprs.EUB);
1148 Dir->setNextLowerBound(Exprs.NLB);
1149 Dir->setNextUpperBound(Exprs.NUB);
1150 Dir->setNumIterations(Exprs.NumIterations);
1151 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1152 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001153 Dir->setDistInc(Exprs.DistInc);
1154 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li4a39add2016-07-05 05:00:15 +00001155 Dir->setCounters(Exprs.Counters);
1156 Dir->setPrivateCounters(Exprs.PrivateCounters);
1157 Dir->setInits(Exprs.Inits);
1158 Dir->setUpdates(Exprs.Updates);
1159 Dir->setFinals(Exprs.Finals);
1160 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001161 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1162 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1163 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1164 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1165 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1166 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1167 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001168 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1169 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Kelvin Li4a39add2016-07-05 05:00:15 +00001170 return Dir;
1171}
1172
1173OMPDistributeParallelForSimdDirective *
1174OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1175 unsigned NumClauses,
1176 unsigned CollapsedNum,
1177 EmptyShell) {
1178 unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001179 alignof(OMPClause *));
Kelvin Li4a39add2016-07-05 05:00:15 +00001180 void *Mem = C.Allocate(
1181 Size + sizeof(OMPClause *) * NumClauses +
1182 sizeof(Stmt *) *
1183 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1184 return new (Mem)
1185 OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1186}
Kelvin Li787f3fc2016-07-06 04:45:38 +00001187
1188OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1189 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1190 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1191 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001192 unsigned Size =
1193 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001194 void *Mem = C.Allocate(
1195 Size + sizeof(OMPClause *) * Clauses.size() +
1196 sizeof(Stmt *) *
1197 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1198 OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective(
1199 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1200 Dir->setClauses(Clauses);
1201 Dir->setAssociatedStmt(AssociatedStmt);
1202 Dir->setIterationVariable(Exprs.IterationVarRef);
1203 Dir->setLastIteration(Exprs.LastIteration);
1204 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1205 Dir->setPreCond(Exprs.PreCond);
1206 Dir->setCond(Exprs.Cond);
1207 Dir->setInit(Exprs.Init);
1208 Dir->setInc(Exprs.Inc);
1209 Dir->setIsLastIterVariable(Exprs.IL);
1210 Dir->setLowerBoundVariable(Exprs.LB);
1211 Dir->setUpperBoundVariable(Exprs.UB);
1212 Dir->setStrideVariable(Exprs.ST);
1213 Dir->setEnsureUpperBound(Exprs.EUB);
1214 Dir->setNextLowerBound(Exprs.NLB);
1215 Dir->setNextUpperBound(Exprs.NUB);
1216 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li787f3fc2016-07-06 04:45:38 +00001217 Dir->setCounters(Exprs.Counters);
1218 Dir->setPrivateCounters(Exprs.PrivateCounters);
1219 Dir->setInits(Exprs.Inits);
1220 Dir->setUpdates(Exprs.Updates);
1221 Dir->setFinals(Exprs.Finals);
1222 Dir->setPreInits(Exprs.PreInits);
1223 return Dir;
1224}
1225
1226OMPDistributeSimdDirective *
1227OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1228 unsigned NumClauses,
1229 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001230 unsigned Size =
1231 llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
Kelvin Li787f3fc2016-07-06 04:45:38 +00001232 void *Mem = C.Allocate(
1233 Size + sizeof(OMPClause *) * NumClauses +
1234 sizeof(Stmt *) *
1235 numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1236 return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses);
1237}
Kelvin Lia579b912016-07-14 02:54:56 +00001238
1239OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1240 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1241 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1242 const HelperExprs &Exprs) {
1243 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001244 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001245 void *Mem = C.Allocate(
1246 Size + sizeof(OMPClause *) * Clauses.size() +
Fangrui Song6907ce22018-07-30 19:24:48 +00001247 sizeof(Stmt *) *
Kelvin Lia579b912016-07-14 02:54:56 +00001248 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
Fangrui Song6907ce22018-07-30 19:24:48 +00001249 OMPTargetParallelForSimdDirective *Dir =
Kelvin Lia579b912016-07-14 02:54:56 +00001250 new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc,
1251 CollapsedNum, Clauses.size());
1252 Dir->setClauses(Clauses);
1253 Dir->setAssociatedStmt(AssociatedStmt);
1254 Dir->setIterationVariable(Exprs.IterationVarRef);
1255 Dir->setLastIteration(Exprs.LastIteration);
1256 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1257 Dir->setPreCond(Exprs.PreCond);
1258 Dir->setCond(Exprs.Cond);
1259 Dir->setInit(Exprs.Init);
1260 Dir->setInc(Exprs.Inc);
1261 Dir->setIsLastIterVariable(Exprs.IL);
1262 Dir->setLowerBoundVariable(Exprs.LB);
1263 Dir->setUpperBoundVariable(Exprs.UB);
1264 Dir->setStrideVariable(Exprs.ST);
1265 Dir->setEnsureUpperBound(Exprs.EUB);
1266 Dir->setNextLowerBound(Exprs.NLB);
1267 Dir->setNextUpperBound(Exprs.NUB);
1268 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Lia579b912016-07-14 02:54:56 +00001269 Dir->setCounters(Exprs.Counters);
1270 Dir->setPrivateCounters(Exprs.PrivateCounters);
1271 Dir->setInits(Exprs.Inits);
1272 Dir->setUpdates(Exprs.Updates);
1273 Dir->setFinals(Exprs.Finals);
1274 Dir->setPreInits(Exprs.PreInits);
1275 return Dir;
1276}
1277
1278OMPTargetParallelForSimdDirective *
1279OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1280 unsigned NumClauses,
1281 unsigned CollapsedNum,
1282 EmptyShell) {
1283 unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001284 alignof(OMPClause *));
Kelvin Lia579b912016-07-14 02:54:56 +00001285 void *Mem = C.Allocate(
1286 Size + sizeof(OMPClause *) * NumClauses +
Fangrui Song6907ce22018-07-30 19:24:48 +00001287 sizeof(Stmt *) *
Kelvin Lia579b912016-07-14 02:54:56 +00001288 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1289 return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses);
1290}
Kelvin Li986330c2016-07-20 22:57:10 +00001291
1292OMPTargetSimdDirective *
Fangrui Song6907ce22018-07-30 19:24:48 +00001293OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
Kelvin Li986330c2016-07-20 22:57:10 +00001294 SourceLocation EndLoc, unsigned CollapsedNum,
1295 ArrayRef<OMPClause *> Clauses,
1296 Stmt *AssociatedStmt, const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001297 unsigned Size =
1298 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001299 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
Fangrui Song6907ce22018-07-30 19:24:48 +00001300 sizeof(Stmt *) *
Kelvin Li986330c2016-07-20 22:57:10 +00001301 numLoopChildren(CollapsedNum, OMPD_target_simd));
1302 OMPTargetSimdDirective *Dir = new (Mem)
1303 OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1304 Dir->setClauses(Clauses);
1305 Dir->setAssociatedStmt(AssociatedStmt);
1306 Dir->setIterationVariable(Exprs.IterationVarRef);
1307 Dir->setLastIteration(Exprs.LastIteration);
1308 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1309 Dir->setPreCond(Exprs.PreCond);
1310 Dir->setCond(Exprs.Cond);
1311 Dir->setInit(Exprs.Init);
1312 Dir->setInc(Exprs.Inc);
1313 Dir->setCounters(Exprs.Counters);
1314 Dir->setPrivateCounters(Exprs.PrivateCounters);
1315 Dir->setInits(Exprs.Inits);
1316 Dir->setUpdates(Exprs.Updates);
1317 Dir->setFinals(Exprs.Finals);
1318 Dir->setPreInits(Exprs.PreInits);
1319 return Dir;
1320}
1321
1322OMPTargetSimdDirective *
1323OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1324 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001325 unsigned Size =
1326 llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
Kelvin Li986330c2016-07-20 22:57:10 +00001327 void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
Fangrui Song6907ce22018-07-30 19:24:48 +00001328 sizeof(Stmt *) *
Kelvin Li986330c2016-07-20 22:57:10 +00001329 numLoopChildren(CollapsedNum, OMPD_target_simd));
1330 return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses);
1331}
Kelvin Li02532872016-08-05 14:37:37 +00001332
1333OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1334 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1335 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1336 const HelperExprs &Exprs) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001337 unsigned Size =
1338 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001339 void *Mem = C.Allocate(
1340 Size + sizeof(OMPClause *) * Clauses.size() +
1341 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1342 OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective(
1343 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1344 Dir->setClauses(Clauses);
1345 Dir->setAssociatedStmt(AssociatedStmt);
1346 Dir->setIterationVariable(Exprs.IterationVarRef);
1347 Dir->setLastIteration(Exprs.LastIteration);
1348 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1349 Dir->setPreCond(Exprs.PreCond);
1350 Dir->setCond(Exprs.Cond);
1351 Dir->setInit(Exprs.Init);
1352 Dir->setInc(Exprs.Inc);
1353 Dir->setIsLastIterVariable(Exprs.IL);
1354 Dir->setLowerBoundVariable(Exprs.LB);
1355 Dir->setUpperBoundVariable(Exprs.UB);
1356 Dir->setStrideVariable(Exprs.ST);
1357 Dir->setEnsureUpperBound(Exprs.EUB);
1358 Dir->setNextLowerBound(Exprs.NLB);
1359 Dir->setNextUpperBound(Exprs.NUB);
1360 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li02532872016-08-05 14:37:37 +00001361 Dir->setCounters(Exprs.Counters);
1362 Dir->setPrivateCounters(Exprs.PrivateCounters);
1363 Dir->setInits(Exprs.Inits);
1364 Dir->setUpdates(Exprs.Updates);
1365 Dir->setFinals(Exprs.Finals);
1366 Dir->setPreInits(Exprs.PreInits);
1367 return Dir;
1368}
1369
1370OMPTeamsDistributeDirective *
1371OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1372 unsigned NumClauses,
1373 unsigned CollapsedNum, EmptyShell) {
Benjamin Kramerc3f89252016-10-20 14:27:22 +00001374 unsigned Size =
1375 llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
Kelvin Li02532872016-08-05 14:37:37 +00001376 void *Mem = C.Allocate(
1377 Size + sizeof(OMPClause *) * NumClauses +
1378 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1379 return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses);
1380}
Kelvin Li4e325f72016-10-25 12:50:55 +00001381
1382OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1383 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1384 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1385 const HelperExprs &Exprs) {
1386 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1387 alignof(OMPClause *));
1388 void *Mem =
1389 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1390 sizeof(Stmt *) *
1391 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1392 OMPTeamsDistributeSimdDirective *Dir =
1393 new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1394 Clauses.size());
1395 Dir->setClauses(Clauses);
1396 Dir->setAssociatedStmt(AssociatedStmt);
1397 Dir->setIterationVariable(Exprs.IterationVarRef);
1398 Dir->setLastIteration(Exprs.LastIteration);
1399 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1400 Dir->setPreCond(Exprs.PreCond);
1401 Dir->setCond(Exprs.Cond);
1402 Dir->setInit(Exprs.Init);
1403 Dir->setInc(Exprs.Inc);
1404 Dir->setIsLastIterVariable(Exprs.IL);
1405 Dir->setLowerBoundVariable(Exprs.LB);
1406 Dir->setUpperBoundVariable(Exprs.UB);
1407 Dir->setStrideVariable(Exprs.ST);
1408 Dir->setEnsureUpperBound(Exprs.EUB);
1409 Dir->setNextLowerBound(Exprs.NLB);
1410 Dir->setNextUpperBound(Exprs.NUB);
1411 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li4e325f72016-10-25 12:50:55 +00001412 Dir->setCounters(Exprs.Counters);
1413 Dir->setPrivateCounters(Exprs.PrivateCounters);
1414 Dir->setInits(Exprs.Inits);
1415 Dir->setUpdates(Exprs.Updates);
1416 Dir->setFinals(Exprs.Finals);
1417 Dir->setPreInits(Exprs.PreInits);
1418 return Dir;
1419}
1420
1421OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1422 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1423 EmptyShell) {
1424 unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1425 alignof(OMPClause *));
1426 void *Mem =
1427 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1428 sizeof(Stmt *) *
1429 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1430 return new (Mem) OMPTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1431}
Kelvin Li579e41c2016-11-30 23:51:03 +00001432
1433OMPTeamsDistributeParallelForSimdDirective *
1434OMPTeamsDistributeParallelForSimdDirective::Create(
1435 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1436 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1437 const HelperExprs &Exprs) {
1438 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1439 alignof(OMPClause *));
1440 void *Mem =
1441 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1442 sizeof(Stmt *) *
1443 numLoopChildren(CollapsedNum,
1444 OMPD_teams_distribute_parallel_for_simd));
1445 OMPTeamsDistributeParallelForSimdDirective *Dir = new (Mem)
1446 OMPTeamsDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1447 Clauses.size());
1448 Dir->setClauses(Clauses);
1449 Dir->setAssociatedStmt(AssociatedStmt);
1450 Dir->setIterationVariable(Exprs.IterationVarRef);
1451 Dir->setLastIteration(Exprs.LastIteration);
1452 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1453 Dir->setPreCond(Exprs.PreCond);
1454 Dir->setCond(Exprs.Cond);
1455 Dir->setInit(Exprs.Init);
1456 Dir->setInc(Exprs.Inc);
1457 Dir->setIsLastIterVariable(Exprs.IL);
1458 Dir->setLowerBoundVariable(Exprs.LB);
1459 Dir->setUpperBoundVariable(Exprs.UB);
1460 Dir->setStrideVariable(Exprs.ST);
1461 Dir->setEnsureUpperBound(Exprs.EUB);
1462 Dir->setNextLowerBound(Exprs.NLB);
1463 Dir->setNextUpperBound(Exprs.NUB);
1464 Dir->setNumIterations(Exprs.NumIterations);
1465 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1466 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001467 Dir->setDistInc(Exprs.DistInc);
1468 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li579e41c2016-11-30 23:51:03 +00001469 Dir->setCounters(Exprs.Counters);
1470 Dir->setPrivateCounters(Exprs.PrivateCounters);
1471 Dir->setInits(Exprs.Inits);
1472 Dir->setUpdates(Exprs.Updates);
1473 Dir->setFinals(Exprs.Finals);
1474 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001475 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1476 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1477 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1478 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1479 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1480 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1481 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001482 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1483 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Kelvin Li579e41c2016-11-30 23:51:03 +00001484 return Dir;
1485}
1486
1487OMPTeamsDistributeParallelForSimdDirective *
1488OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1489 unsigned NumClauses,
1490 unsigned CollapsedNum,
1491 EmptyShell) {
1492 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1493 alignof(OMPClause *));
1494 void *Mem =
1495 C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1496 sizeof(Stmt *) *
1497 numLoopChildren(CollapsedNum,
1498 OMPD_teams_distribute_parallel_for_simd));
1499 return new (Mem)
1500 OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1501}
Kelvin Li7ade93f2016-12-09 03:24:30 +00001502
1503OMPTeamsDistributeParallelForDirective *
1504OMPTeamsDistributeParallelForDirective::Create(
1505 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1506 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001507 const HelperExprs &Exprs, bool HasCancel) {
Kelvin Li7ade93f2016-12-09 03:24:30 +00001508 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1509 alignof(OMPClause *));
1510 void *Mem = C.Allocate(
1511 Size + sizeof(OMPClause *) * Clauses.size() +
1512 sizeof(Stmt *) *
1513 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1514 OMPTeamsDistributeParallelForDirective *Dir = new (Mem)
1515 OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum,
1516 Clauses.size());
1517 Dir->setClauses(Clauses);
1518 Dir->setAssociatedStmt(AssociatedStmt);
1519 Dir->setIterationVariable(Exprs.IterationVarRef);
1520 Dir->setLastIteration(Exprs.LastIteration);
1521 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1522 Dir->setPreCond(Exprs.PreCond);
1523 Dir->setCond(Exprs.Cond);
1524 Dir->setInit(Exprs.Init);
1525 Dir->setInc(Exprs.Inc);
1526 Dir->setIsLastIterVariable(Exprs.IL);
1527 Dir->setLowerBoundVariable(Exprs.LB);
1528 Dir->setUpperBoundVariable(Exprs.UB);
1529 Dir->setStrideVariable(Exprs.ST);
1530 Dir->setEnsureUpperBound(Exprs.EUB);
1531 Dir->setNextLowerBound(Exprs.NLB);
1532 Dir->setNextUpperBound(Exprs.NUB);
1533 Dir->setNumIterations(Exprs.NumIterations);
1534 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1535 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001536 Dir->setDistInc(Exprs.DistInc);
1537 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li7ade93f2016-12-09 03:24:30 +00001538 Dir->setCounters(Exprs.Counters);
1539 Dir->setPrivateCounters(Exprs.PrivateCounters);
1540 Dir->setInits(Exprs.Inits);
1541 Dir->setUpdates(Exprs.Updates);
1542 Dir->setFinals(Exprs.Finals);
1543 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001544 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1545 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1546 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1547 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1548 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1549 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1550 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001551 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1552 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Alexey Bataevdcb4b8fb2017-11-22 20:19:50 +00001553 Dir->HasCancel = HasCancel;
Kelvin Li7ade93f2016-12-09 03:24:30 +00001554 return Dir;
1555}
1556
1557OMPTeamsDistributeParallelForDirective *
1558OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1559 unsigned NumClauses,
1560 unsigned CollapsedNum,
1561 EmptyShell) {
1562 auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1563 alignof(OMPClause *));
1564 void *Mem = C.Allocate(
1565 Size + sizeof(OMPClause *) * NumClauses +
1566 sizeof(Stmt *) *
1567 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1568 return new (Mem)
1569 OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1570}
1571
Kelvin Libf594a52016-12-17 05:48:59 +00001572OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1573 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1574 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1575 auto Size =
1576 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1577 void *Mem =
1578 C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
1579 OMPTargetTeamsDirective *Dir =
1580 new (Mem) OMPTargetTeamsDirective(StartLoc, EndLoc, Clauses.size());
1581 Dir->setClauses(Clauses);
1582 Dir->setAssociatedStmt(AssociatedStmt);
1583 return Dir;
1584}
1585
1586OMPTargetTeamsDirective *
1587OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1588 EmptyShell) {
1589 auto Size =
1590 llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1591 void *Mem =
1592 C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1593 return new (Mem) OMPTargetTeamsDirective(NumClauses);
1594}
Kelvin Li83c451e2016-12-25 04:52:54 +00001595
1596OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
1597 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1598 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1599 const HelperExprs &Exprs) {
1600 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1601 alignof(OMPClause *));
1602 void *Mem = C.Allocate(
1603 Size + sizeof(OMPClause *) * Clauses.size() +
1604 sizeof(Stmt *) *
1605 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1606 OMPTargetTeamsDistributeDirective *Dir =
1607 new (Mem) OMPTargetTeamsDistributeDirective(StartLoc, EndLoc, CollapsedNum,
1608 Clauses.size());
1609 Dir->setClauses(Clauses);
1610 Dir->setAssociatedStmt(AssociatedStmt);
1611 Dir->setIterationVariable(Exprs.IterationVarRef);
1612 Dir->setLastIteration(Exprs.LastIteration);
1613 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1614 Dir->setPreCond(Exprs.PreCond);
1615 Dir->setCond(Exprs.Cond);
1616 Dir->setInit(Exprs.Init);
1617 Dir->setInc(Exprs.Inc);
1618 Dir->setIsLastIterVariable(Exprs.IL);
1619 Dir->setLowerBoundVariable(Exprs.LB);
1620 Dir->setUpperBoundVariable(Exprs.UB);
1621 Dir->setStrideVariable(Exprs.ST);
1622 Dir->setEnsureUpperBound(Exprs.EUB);
1623 Dir->setNextLowerBound(Exprs.NLB);
1624 Dir->setNextUpperBound(Exprs.NUB);
1625 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Li83c451e2016-12-25 04:52:54 +00001626 Dir->setCounters(Exprs.Counters);
1627 Dir->setPrivateCounters(Exprs.PrivateCounters);
1628 Dir->setInits(Exprs.Inits);
1629 Dir->setUpdates(Exprs.Updates);
1630 Dir->setFinals(Exprs.Finals);
1631 Dir->setPreInits(Exprs.PreInits);
1632 return Dir;
1633}
1634
1635OMPTargetTeamsDistributeDirective *
1636OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1637 unsigned NumClauses,
1638 unsigned CollapsedNum,
1639 EmptyShell) {
1640 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1641 alignof(OMPClause *));
1642 void *Mem = C.Allocate(
1643 Size + sizeof(OMPClause *) * NumClauses +
1644 sizeof(Stmt *) *
1645 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1646 return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses);
1647}
Kelvin Li80e8f562016-12-29 22:16:30 +00001648
1649OMPTargetTeamsDistributeParallelForDirective *
1650OMPTargetTeamsDistributeParallelForDirective::Create(
1651 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1652 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
Alexey Bataev16e79882017-11-22 21:12:03 +00001653 const HelperExprs &Exprs, bool HasCancel) {
Kelvin Li80e8f562016-12-29 22:16:30 +00001654 auto Size =
1655 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1656 alignof(OMPClause *));
1657 void *Mem = C.Allocate(
1658 Size + sizeof(OMPClause *) * Clauses.size() +
1659 sizeof(Stmt *) *
1660 numLoopChildren(CollapsedNum,
1661 OMPD_target_teams_distribute_parallel_for));
1662 OMPTargetTeamsDistributeParallelForDirective *Dir =
1663 new (Mem) OMPTargetTeamsDistributeParallelForDirective(
1664 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1665 Dir->setClauses(Clauses);
1666 Dir->setAssociatedStmt(AssociatedStmt);
1667 Dir->setIterationVariable(Exprs.IterationVarRef);
1668 Dir->setLastIteration(Exprs.LastIteration);
1669 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1670 Dir->setPreCond(Exprs.PreCond);
1671 Dir->setCond(Exprs.Cond);
1672 Dir->setInit(Exprs.Init);
1673 Dir->setInc(Exprs.Inc);
1674 Dir->setIsLastIterVariable(Exprs.IL);
1675 Dir->setLowerBoundVariable(Exprs.LB);
1676 Dir->setUpperBoundVariable(Exprs.UB);
1677 Dir->setStrideVariable(Exprs.ST);
1678 Dir->setEnsureUpperBound(Exprs.EUB);
1679 Dir->setNextLowerBound(Exprs.NLB);
1680 Dir->setNextUpperBound(Exprs.NUB);
1681 Dir->setNumIterations(Exprs.NumIterations);
1682 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1683 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001684 Dir->setDistInc(Exprs.DistInc);
1685 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li80e8f562016-12-29 22:16:30 +00001686 Dir->setCounters(Exprs.Counters);
1687 Dir->setPrivateCounters(Exprs.PrivateCounters);
1688 Dir->setInits(Exprs.Inits);
1689 Dir->setUpdates(Exprs.Updates);
1690 Dir->setFinals(Exprs.Finals);
1691 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001692 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1693 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1694 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1695 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1696 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1697 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1698 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001699 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1700 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Alexey Bataev16e79882017-11-22 21:12:03 +00001701 Dir->HasCancel = HasCancel;
Kelvin Li80e8f562016-12-29 22:16:30 +00001702 return Dir;
1703}
1704
1705OMPTargetTeamsDistributeParallelForDirective *
1706OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1707 unsigned NumClauses,
1708 unsigned CollapsedNum,
1709 EmptyShell) {
1710 auto Size =
1711 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1712 alignof(OMPClause *));
1713 void *Mem = C.Allocate(
1714 Size + sizeof(OMPClause *) * NumClauses +
1715 sizeof(Stmt *) *
1716 numLoopChildren(CollapsedNum,
1717 OMPD_target_teams_distribute_parallel_for));
1718 return new (Mem)
1719 OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1720}
Kelvin Li1851df52017-01-03 05:23:48 +00001721
1722OMPTargetTeamsDistributeParallelForSimdDirective *
1723OMPTargetTeamsDistributeParallelForSimdDirective::Create(
1724 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1725 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1726 const HelperExprs &Exprs) {
1727 auto Size =
1728 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1729 alignof(OMPClause *));
1730 void *Mem = C.Allocate(
1731 Size + sizeof(OMPClause *) * Clauses.size() +
1732 sizeof(Stmt *) *
1733 numLoopChildren(CollapsedNum,
1734 OMPD_target_teams_distribute_parallel_for_simd));
1735 OMPTargetTeamsDistributeParallelForSimdDirective *Dir =
1736 new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1737 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1738 Dir->setClauses(Clauses);
1739 Dir->setAssociatedStmt(AssociatedStmt);
1740 Dir->setIterationVariable(Exprs.IterationVarRef);
1741 Dir->setLastIteration(Exprs.LastIteration);
1742 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1743 Dir->setPreCond(Exprs.PreCond);
1744 Dir->setCond(Exprs.Cond);
1745 Dir->setInit(Exprs.Init);
1746 Dir->setInc(Exprs.Inc);
1747 Dir->setIsLastIterVariable(Exprs.IL);
1748 Dir->setLowerBoundVariable(Exprs.LB);
1749 Dir->setUpperBoundVariable(Exprs.UB);
1750 Dir->setStrideVariable(Exprs.ST);
1751 Dir->setEnsureUpperBound(Exprs.EUB);
1752 Dir->setNextLowerBound(Exprs.NLB);
1753 Dir->setNextUpperBound(Exprs.NUB);
1754 Dir->setNumIterations(Exprs.NumIterations);
1755 Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1756 Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
Carlo Bertolli8429d812017-02-17 21:29:13 +00001757 Dir->setDistInc(Exprs.DistInc);
1758 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
Kelvin Li1851df52017-01-03 05:23:48 +00001759 Dir->setCounters(Exprs.Counters);
1760 Dir->setPrivateCounters(Exprs.PrivateCounters);
1761 Dir->setInits(Exprs.Inits);
1762 Dir->setUpdates(Exprs.Updates);
1763 Dir->setFinals(Exprs.Finals);
1764 Dir->setPreInits(Exprs.PreInits);
Carlo Bertolliffafe102017-04-20 00:39:39 +00001765 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1766 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1767 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1768 Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1769 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1770 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1771 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
Gheorghe-Teodor Berceae9256762018-10-29 15:45:47 +00001772 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1773 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
Kelvin Li1851df52017-01-03 05:23:48 +00001774 return Dir;
1775}
1776
1777OMPTargetTeamsDistributeParallelForSimdDirective *
1778OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
1779 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1780 EmptyShell) {
1781 auto Size =
1782 llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1783 alignof(OMPClause *));
1784 void *Mem = C.Allocate(
1785 Size + sizeof(OMPClause *) * NumClauses +
1786 sizeof(Stmt *) *
1787 numLoopChildren(CollapsedNum,
1788 OMPD_target_teams_distribute_parallel_for_simd));
1789 return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1790 CollapsedNum, NumClauses);
1791}
1792
Kelvin Lida681182017-01-10 18:08:18 +00001793OMPTargetTeamsDistributeSimdDirective *
1794OMPTargetTeamsDistributeSimdDirective::Create(
1795 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1796 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1797 const HelperExprs &Exprs) {
1798 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1799 alignof(OMPClause *));
1800 void *Mem = C.Allocate(
1801 Size + sizeof(OMPClause *) * Clauses.size() +
1802 sizeof(Stmt *) *
1803 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1804 OMPTargetTeamsDistributeSimdDirective *Dir = new (Mem)
1805 OMPTargetTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1806 Clauses.size());
1807 Dir->setClauses(Clauses);
1808 Dir->setAssociatedStmt(AssociatedStmt);
1809 Dir->setIterationVariable(Exprs.IterationVarRef);
1810 Dir->setLastIteration(Exprs.LastIteration);
1811 Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1812 Dir->setPreCond(Exprs.PreCond);
1813 Dir->setCond(Exprs.Cond);
1814 Dir->setInit(Exprs.Init);
1815 Dir->setInc(Exprs.Inc);
1816 Dir->setIsLastIterVariable(Exprs.IL);
1817 Dir->setLowerBoundVariable(Exprs.LB);
1818 Dir->setUpperBoundVariable(Exprs.UB);
1819 Dir->setStrideVariable(Exprs.ST);
1820 Dir->setEnsureUpperBound(Exprs.EUB);
1821 Dir->setNextLowerBound(Exprs.NLB);
1822 Dir->setNextUpperBound(Exprs.NUB);
1823 Dir->setNumIterations(Exprs.NumIterations);
Kelvin Lida681182017-01-10 18:08:18 +00001824 Dir->setCounters(Exprs.Counters);
1825 Dir->setPrivateCounters(Exprs.PrivateCounters);
1826 Dir->setInits(Exprs.Inits);
1827 Dir->setUpdates(Exprs.Updates);
1828 Dir->setFinals(Exprs.Finals);
1829 Dir->setPreInits(Exprs.PreInits);
1830 return Dir;
1831}
1832
1833OMPTargetTeamsDistributeSimdDirective *
1834OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1835 unsigned NumClauses,
1836 unsigned CollapsedNum,
1837 EmptyShell) {
1838 auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1839 alignof(OMPClause *));
1840 void *Mem = C.Allocate(
1841 Size + sizeof(OMPClause *) * NumClauses +
1842 sizeof(Stmt *) *
1843 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1844 return new (Mem)
1845 OMPTargetTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1846}