Coverage Report

Created: 2020-09-19 12:23

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/AST/StmtOpenMP.cpp
Line
Count
Source (jump to first uncovered line)
1
//===--- StmtOpenMP.cpp - Classes for OpenMP directives -------------------===//
2
//
3
// 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
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file implements the subclesses of Stmt class declared in StmtOpenMP.h
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "clang/AST/ASTContext.h"
14
#include "clang/AST/StmtOpenMP.h"
15
16
using namespace clang;
17
using namespace llvm::omp;
18
19
size_t OMPChildren::size(unsigned NumClauses, bool HasAssociatedStmt,
20
300k
                         unsigned NumChildren) {
21
300k
  return llvm::alignTo(
22
300k
      totalSizeToAlloc<OMPClause *, Stmt *>(
23
294k
          NumClauses, NumChildren + (HasAssociatedStmt ? 1 : 
06.52k
)),
24
300k
      alignof(OMPChildren));
25
300k
}
26
27
304k
void OMPChildren::setClauses(ArrayRef<OMPClause *> Clauses) {
28
304k
  assert(Clauses.size() == NumClauses &&
29
304k
         "Number of clauses is not the same as the preallocated buffer");
30
304k
  llvm::copy(Clauses, getTrailingObjects<OMPClause *>());
31
304k
}
32
33
4.43M
MutableArrayRef<Stmt *> OMPChildren::getChildren() {
34
4.43M
  return llvm::makeMutableArrayRef(getTrailingObjects<Stmt *>(), NumChildren);
35
4.43M
}
36
37
0
OMPChildren *OMPChildren::Create(void *Mem, ArrayRef<OMPClause *> Clauses) {
38
0
  auto *Data = CreateEmpty(Mem, Clauses.size());
39
0
  Data->setClauses(Clauses);
40
0
  return Data;
41
0
}
42
43
OMPChildren *OMPChildren::Create(void *Mem, ArrayRef<OMPClause *> Clauses,
44
284k
                                 Stmt *S, unsigned NumChildren) {
45
284k
  auto *Data = CreateEmpty(Mem, Clauses.size(), S, NumChildren);
46
284k
  Data->setClauses(Clauses);
47
284k
  if (S)
48
278k
    Data->setAssociatedStmt(S);
49
284k
  return Data;
50
284k
}
51
52
OMPChildren *OMPChildren::CreateEmpty(void *Mem, unsigned NumClauses,
53
                                      bool HasAssociatedStmt,
54
300k
                                      unsigned NumChildren) {
55
300k
  return new (Mem) OMPChildren(NumClauses, NumChildren, HasAssociatedStmt);
56
300k
}
57
58
32.8k
bool OMPExecutableDirective::isStandaloneDirective() const {
59
  // Special case: 'omp target enter data', 'omp target exit data',
60
  // 'omp target update' are stand-alone directives, but for implementation
61
  // reasons they have empty synthetic structured block, to simplify codegen.
62
32.8k
  if (isa<OMPTargetEnterDataDirective>(this) ||
63
32.4k
      isa<OMPTargetExitDataDirective>(this) ||
64
32.0k
      isa<OMPTargetUpdateDirective>(this))
65
1.00k
    return true;
66
31.8k
  return !hasAssociatedStmt();
67
31.8k
}
68
69
5.73k
Stmt *OMPExecutableDirective::getStructuredBlock() {
70
5.73k
  assert(!isStandaloneDirective() &&
71
5.73k
         "Standalone Executable Directives don't have Structured Blocks.");
72
5.73k
  if (auto *LD = dyn_cast<OMPLoopDirective>(this))
73
2.79k
    return LD->getBody();
74
2.93k
  return getRawStmt();
75
2.93k
}
76
77
Stmt *OMPLoopDirective::tryToFindNextInnerLoop(Stmt *CurStmt,
78
168k
                                               bool TryImperfectlyNestedLoops) {
79
168k
  Stmt *OrigStmt = CurStmt;
80
168k
  CurStmt = CurStmt->IgnoreContainers();
81
  // Additional work for imperfectly nested loops, introduced in OpenMP 5.0.
82
168k
  if (TryImperfectlyNestedLoops) {
83
117k
    if (auto *CS = dyn_cast<CompoundStmt>(CurStmt)) {
84
8.94k
      CurStmt = nullptr;
85
8.94k
      SmallVector<CompoundStmt *, 4> Statements(1, CS);
86
8.94k
      SmallVector<CompoundStmt *, 4> NextStatements;
87
17.7k
      while (!Statements.empty()) {
88
8.95k
        CS = Statements.pop_back_val();
89
8.95k
        if (!CS)
90
0
          continue;
91
11.8k
        
for (Stmt *S : CS->body())8.95k
{
92
11.8k
          if (!S)
93
0
            continue;
94
11.8k
          if (isa<ForStmt>(S) || 
isa<CXXForRangeStmt>(S)11.7k
) {
95
            // Only single loop construct is allowed.
96
162
            if (CurStmt) {
97
18
              CurStmt = OrigStmt;
98
18
              break;
99
18
            }
100
144
            CurStmt = S;
101
144
            continue;
102
144
          }
103
11.7k
          S = S->IgnoreContainers();
104
11.7k
          if (auto *InnerCS = dyn_cast_or_null<CompoundStmt>(S))
105
18
            NextStatements.push_back(InnerCS);
106
11.7k
        }
107
8.95k
        if (Statements.empty()) {
108
          // Found single inner loop or multiple loops - exit.
109
8.95k
          if (CurStmt)
110
144
            break;
111
8.80k
          Statements.swap(NextStatements);
112
8.80k
        }
113
8.95k
      }
114
8.94k
      if (!CurStmt)
115
8.80k
        CurStmt = OrigStmt;
116
8.94k
    }
117
117k
  }
118
168k
  return CurStmt;
119
168k
}
120
121
2.81k
Stmt *OMPLoopDirective::getBody() {
122
  // This relies on the loop form is already checked by Sema.
123
2.81k
  Stmt *Body = Data->getRawStmt()->IgnoreContainers();
124
2.81k
  if (auto *For = dyn_cast<ForStmt>(Body)) {
125
2.81k
    Body = For->getBody();
126
0
  } else {
127
0
    assert(isa<CXXForRangeStmt>(Body) &&
128
0
           "Expected canonical for loop or range-based for loop.");
129
0
    Body = cast<CXXForRangeStmt>(Body)->getBody();
130
0
  }
131
2.83k
  for (unsigned Cnt = 1; Cnt < CollapsedNum; 
++Cnt20
) {
132
20
    Body = tryToFindNextInnerLoop(Body, /*TryImperfectlyNestedLoops=*/true);
133
20
    if (auto *For = dyn_cast<ForStmt>(Body)) {
134
20
      Body = For->getBody();
135
0
    } else {
136
0
      assert(isa<CXXForRangeStmt>(Body) &&
137
0
             "Expected canonical for loop or range-based for loop.");
138
0
      Body = cast<CXXForRangeStmt>(Body)->getBody();
139
0
    }
140
20
  }
141
2.81k
  return Body;
142
2.81k
}
143
144
137k
void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
145
137k
  assert(A.size() == getCollapsedNumber() &&
146
137k
         "Number of loop counters is not the same as the collapsed number");
147
137k
  llvm::copy(A, getCounters().begin());
148
137k
}
149
150
137k
void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
151
137k
  assert(A.size() == getCollapsedNumber() && "Number of loop private counters "
152
137k
                                             "is not the same as the collapsed "
153
137k
                                             "number");
154
137k
  llvm::copy(A, getPrivateCounters().begin());
155
137k
}
156
157
137k
void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
158
137k
  assert(A.size() == getCollapsedNumber() &&
159
137k
         "Number of counter inits is not the same as the collapsed number");
160
137k
  llvm::copy(A, getInits().begin());
161
137k
}
162
163
137k
void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
164
137k
  assert(A.size() == getCollapsedNumber() &&
165
137k
         "Number of counter updates is not the same as the collapsed number");
166
137k
  llvm::copy(A, getUpdates().begin());
167
137k
}
168
169
137k
void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
170
137k
  assert(A.size() == getCollapsedNumber() &&
171
137k
         "Number of counter finals is not the same as the collapsed number");
172
137k
  llvm::copy(A, getFinals().begin());
173
137k
}
174
175
137k
void OMPLoopDirective::setDependentCounters(ArrayRef<Expr *> A) {
176
137k
  assert(
177
137k
      A.size() == getCollapsedNumber() &&
178
137k
      "Number of dependent counters is not the same as the collapsed number");
179
137k
  llvm::copy(A, getDependentCounters().begin());
180
137k
}
181
182
137k
void OMPLoopDirective::setDependentInits(ArrayRef<Expr *> A) {
183
137k
  assert(A.size() == getCollapsedNumber() &&
184
137k
         "Number of dependent inits is not the same as the collapsed number");
185
137k
  llvm::copy(A, getDependentInits().begin());
186
137k
}
187
188
137k
void OMPLoopDirective::setFinalsConditions(ArrayRef<Expr *> A) {
189
137k
  assert(A.size() == getCollapsedNumber() &&
190
137k
         "Number of finals conditions is not the same as the collapsed number");
191
137k
  llvm::copy(A, getFinalsConditions().begin());
192
137k
}
193
194
OMPParallelDirective *OMPParallelDirective::Create(
195
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
196
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
197
23.6k
    bool HasCancel) {
198
23.6k
  auto *Dir = createDirective<OMPParallelDirective>(
199
23.6k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
200
23.6k
  Dir->setTaskReductionRefExpr(TaskRedRef);
201
23.6k
  Dir->setHasCancel(HasCancel);
202
23.6k
  return Dir;
203
23.6k
}
204
205
OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
206
                                                        unsigned NumClauses,
207
649
                                                        EmptyShell) {
208
649
  return createEmptyDirective<OMPParallelDirective>(C, NumClauses,
209
649
                                                    /*HasAssociatedStmt=*/true,
210
649
                                                    /*NumChildren=*/1);
211
649
}
212
213
OMPSimdDirective *
214
OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
215
                         SourceLocation EndLoc, unsigned CollapsedNum,
216
                         ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
217
5.71k
                         const HelperExprs &Exprs) {
218
5.71k
  auto *Dir = createDirective<OMPSimdDirective>(
219
5.71k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_simd),
220
5.71k
      StartLoc, EndLoc, CollapsedNum);
221
5.71k
  Dir->setIterationVariable(Exprs.IterationVarRef);
222
5.71k
  Dir->setLastIteration(Exprs.LastIteration);
223
5.71k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
224
5.71k
  Dir->setPreCond(Exprs.PreCond);
225
5.71k
  Dir->setCond(Exprs.Cond);
226
5.71k
  Dir->setInit(Exprs.Init);
227
5.71k
  Dir->setInc(Exprs.Inc);
228
5.71k
  Dir->setCounters(Exprs.Counters);
229
5.71k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
230
5.71k
  Dir->setInits(Exprs.Inits);
231
5.71k
  Dir->setUpdates(Exprs.Updates);
232
5.71k
  Dir->setFinals(Exprs.Finals);
233
5.71k
  Dir->setDependentCounters(Exprs.DependentCounters);
234
5.71k
  Dir->setDependentInits(Exprs.DependentInits);
235
5.71k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
236
5.71k
  Dir->setPreInits(Exprs.PreInits);
237
5.71k
  return Dir;
238
5.71k
}
239
240
OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C,
241
                                                unsigned NumClauses,
242
                                                unsigned CollapsedNum,
243
159
                                                EmptyShell) {
244
159
  return createEmptyDirective<OMPSimdDirective>(
245
159
      C, NumClauses, /*HasAssociatedStmt=*/true,
246
159
      numLoopChildren(CollapsedNum, OMPD_simd), CollapsedNum);
247
159
}
248
249
OMPForDirective *OMPForDirective::Create(
250
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
251
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
252
6.35k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
253
6.35k
  auto *Dir = createDirective<OMPForDirective>(
254
6.35k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_for) + 1,
255
6.35k
      StartLoc, EndLoc, CollapsedNum);
256
6.35k
  Dir->setIterationVariable(Exprs.IterationVarRef);
257
6.35k
  Dir->setLastIteration(Exprs.LastIteration);
258
6.35k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
259
6.35k
  Dir->setPreCond(Exprs.PreCond);
260
6.35k
  Dir->setCond(Exprs.Cond);
261
6.35k
  Dir->setInit(Exprs.Init);
262
6.35k
  Dir->setInc(Exprs.Inc);
263
6.35k
  Dir->setIsLastIterVariable(Exprs.IL);
264
6.35k
  Dir->setLowerBoundVariable(Exprs.LB);
265
6.35k
  Dir->setUpperBoundVariable(Exprs.UB);
266
6.35k
  Dir->setStrideVariable(Exprs.ST);
267
6.35k
  Dir->setEnsureUpperBound(Exprs.EUB);
268
6.35k
  Dir->setNextLowerBound(Exprs.NLB);
269
6.35k
  Dir->setNextUpperBound(Exprs.NUB);
270
6.35k
  Dir->setNumIterations(Exprs.NumIterations);
271
6.35k
  Dir->setCounters(Exprs.Counters);
272
6.35k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
273
6.35k
  Dir->setInits(Exprs.Inits);
274
6.35k
  Dir->setUpdates(Exprs.Updates);
275
6.35k
  Dir->setFinals(Exprs.Finals);
276
6.35k
  Dir->setDependentCounters(Exprs.DependentCounters);
277
6.35k
  Dir->setDependentInits(Exprs.DependentInits);
278
6.35k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
279
6.35k
  Dir->setPreInits(Exprs.PreInits);
280
6.35k
  Dir->setTaskReductionRefExpr(TaskRedRef);
281
6.35k
  Dir->setHasCancel(HasCancel);
282
6.35k
  return Dir;
283
6.35k
}
284
285
OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
286
                                              unsigned NumClauses,
287
                                              unsigned CollapsedNum,
288
301
                                              EmptyShell) {
289
301
  return createEmptyDirective<OMPForDirective>(
290
301
      C, NumClauses, /*HasAssociatedStmt=*/true,
291
301
      numLoopChildren(CollapsedNum, OMPD_for) + 1, CollapsedNum);
292
301
}
293
294
OMPForSimdDirective *
295
OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
296
                            SourceLocation EndLoc, unsigned CollapsedNum,
297
                            ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
298
5.26k
                            const HelperExprs &Exprs) {
299
5.26k
  auto *Dir = createDirective<OMPForSimdDirective>(
300
5.26k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_for_simd),
301
5.26k
      StartLoc, EndLoc, CollapsedNum);
302
5.26k
  Dir->setIterationVariable(Exprs.IterationVarRef);
303
5.26k
  Dir->setLastIteration(Exprs.LastIteration);
304
5.26k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
305
5.26k
  Dir->setPreCond(Exprs.PreCond);
306
5.26k
  Dir->setCond(Exprs.Cond);
307
5.26k
  Dir->setInit(Exprs.Init);
308
5.26k
  Dir->setInc(Exprs.Inc);
309
5.26k
  Dir->setIsLastIterVariable(Exprs.IL);
310
5.26k
  Dir->setLowerBoundVariable(Exprs.LB);
311
5.26k
  Dir->setUpperBoundVariable(Exprs.UB);
312
5.26k
  Dir->setStrideVariable(Exprs.ST);
313
5.26k
  Dir->setEnsureUpperBound(Exprs.EUB);
314
5.26k
  Dir->setNextLowerBound(Exprs.NLB);
315
5.26k
  Dir->setNextUpperBound(Exprs.NUB);
316
5.26k
  Dir->setNumIterations(Exprs.NumIterations);
317
5.26k
  Dir->setCounters(Exprs.Counters);
318
5.26k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
319
5.26k
  Dir->setInits(Exprs.Inits);
320
5.26k
  Dir->setUpdates(Exprs.Updates);
321
5.26k
  Dir->setFinals(Exprs.Finals);
322
5.26k
  Dir->setDependentCounters(Exprs.DependentCounters);
323
5.26k
  Dir->setDependentInits(Exprs.DependentInits);
324
5.26k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
325
5.26k
  Dir->setPreInits(Exprs.PreInits);
326
5.26k
  return Dir;
327
5.26k
}
328
329
OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
330
                                                      unsigned NumClauses,
331
                                                      unsigned CollapsedNum,
332
109
                                                      EmptyShell) {
333
109
  return createEmptyDirective<OMPForSimdDirective>(
334
109
      C, NumClauses, /*HasAssociatedStmt=*/true,
335
109
      numLoopChildren(CollapsedNum, OMPD_for_simd), CollapsedNum);
336
109
}
337
338
OMPSectionsDirective *OMPSectionsDirective::Create(
339
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
340
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
341
3.48k
    bool HasCancel) {
342
3.48k
  auto *Dir = createDirective<OMPSectionsDirective>(C, Clauses, AssociatedStmt,
343
3.48k
                                                    /*NumChildren=*/1, StartLoc,
344
3.48k
                                                    EndLoc);
345
3.48k
  Dir->setTaskReductionRefExpr(TaskRedRef);
346
3.48k
  Dir->setHasCancel(HasCancel);
347
3.48k
  return Dir;
348
3.48k
}
349
350
OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
351
                                                        unsigned NumClauses,
352
58
                                                        EmptyShell) {
353
58
  return createEmptyDirective<OMPSectionsDirective>(C, NumClauses,
354
58
                                                    /*HasAssociatedStmt=*/true,
355
58
                                                    /*NumChildren=*/1);
356
58
}
357
358
OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
359
                                                 SourceLocation StartLoc,
360
                                                 SourceLocation EndLoc,
361
                                                 Stmt *AssociatedStmt,
362
855
                                                 bool HasCancel) {
363
855
  auto *Dir =
364
855
      createDirective<OMPSectionDirective>(C, llvm::None, AssociatedStmt,
365
855
                                           /*NumChildre=*/0, StartLoc, EndLoc);
366
855
  Dir->setHasCancel(HasCancel);
367
855
  return Dir;
368
855
}
369
370
OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
371
50
                                                      EmptyShell) {
372
50
  return createEmptyDirective<OMPSectionDirective>(C, /*NumClauses=*/0,
373
50
                                                   /*HasAssociatedStmt=*/true);
374
50
}
375
376
OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
377
                                               SourceLocation StartLoc,
378
                                               SourceLocation EndLoc,
379
                                               ArrayRef<OMPClause *> Clauses,
380
1.78k
                                               Stmt *AssociatedStmt) {
381
1.78k
  return createDirective<OMPSingleDirective>(C, Clauses, AssociatedStmt,
382
1.78k
                                             /*NumChildren=*/0, StartLoc,
383
1.78k
                                             EndLoc);
384
1.78k
}
385
386
OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
387
                                                    unsigned NumClauses,
388
44
                                                    EmptyShell) {
389
44
  return createEmptyDirective<OMPSingleDirective>(C, NumClauses,
390
44
                                                  /*HasAssociatedStmt=*/true);
391
44
}
392
393
OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
394
                                               SourceLocation StartLoc,
395
                                               SourceLocation EndLoc,
396
1.07k
                                               Stmt *AssociatedStmt) {
397
1.07k
  return createDirective<OMPMasterDirective>(C, llvm::None, AssociatedStmt,
398
1.07k
                                             /*NumChildren=*/0, StartLoc,
399
1.07k
                                             EndLoc);
400
1.07k
}
401
402
OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
403
11
                                                    EmptyShell) {
404
11
  return createEmptyDirective<OMPMasterDirective>(C, /*NumClauses=*/0,
405
11
                                                  /*HasAssociatedStmt=*/true);
406
11
}
407
408
OMPCriticalDirective *OMPCriticalDirective::Create(
409
    const ASTContext &C, const DeclarationNameInfo &Name,
410
    SourceLocation StartLoc, SourceLocation EndLoc,
411
1.55k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
412
1.55k
  return createDirective<OMPCriticalDirective>(C, Clauses, AssociatedStmt,
413
1.55k
                                               /*NumChildren=*/0, Name,
414
1.55k
                                               StartLoc, EndLoc);
415
1.55k
}
416
417
OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
418
                                                        unsigned NumClauses,
419
43
                                                        EmptyShell) {
420
43
  return createEmptyDirective<OMPCriticalDirective>(C, NumClauses,
421
43
                                                    /*HasAssociatedStmt=*/true);
422
43
}
423
424
OMPParallelForDirective *OMPParallelForDirective::Create(
425
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
426
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
427
4.40k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
428
4.40k
  auto *Dir = createDirective<OMPParallelForDirective>(
429
4.40k
      C, Clauses, AssociatedStmt,
430
4.40k
      numLoopChildren(CollapsedNum, OMPD_parallel_for) + 1, StartLoc, EndLoc,
431
4.40k
      CollapsedNum);
432
4.40k
  Dir->setIterationVariable(Exprs.IterationVarRef);
433
4.40k
  Dir->setLastIteration(Exprs.LastIteration);
434
4.40k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
435
4.40k
  Dir->setPreCond(Exprs.PreCond);
436
4.40k
  Dir->setCond(Exprs.Cond);
437
4.40k
  Dir->setInit(Exprs.Init);
438
4.40k
  Dir->setInc(Exprs.Inc);
439
4.40k
  Dir->setIsLastIterVariable(Exprs.IL);
440
4.40k
  Dir->setLowerBoundVariable(Exprs.LB);
441
4.40k
  Dir->setUpperBoundVariable(Exprs.UB);
442
4.40k
  Dir->setStrideVariable(Exprs.ST);
443
4.40k
  Dir->setEnsureUpperBound(Exprs.EUB);
444
4.40k
  Dir->setNextLowerBound(Exprs.NLB);
445
4.40k
  Dir->setNextUpperBound(Exprs.NUB);
446
4.40k
  Dir->setNumIterations(Exprs.NumIterations);
447
4.40k
  Dir->setCounters(Exprs.Counters);
448
4.40k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
449
4.40k
  Dir->setInits(Exprs.Inits);
450
4.40k
  Dir->setUpdates(Exprs.Updates);
451
4.40k
  Dir->setFinals(Exprs.Finals);
452
4.40k
  Dir->setDependentCounters(Exprs.DependentCounters);
453
4.40k
  Dir->setDependentInits(Exprs.DependentInits);
454
4.40k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
455
4.40k
  Dir->setPreInits(Exprs.PreInits);
456
4.40k
  Dir->setTaskReductionRefExpr(TaskRedRef);
457
4.40k
  Dir->setHasCancel(HasCancel);
458
4.40k
  return Dir;
459
4.40k
}
460
461
OMPParallelForDirective *
462
OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
463
93
                                     unsigned CollapsedNum, EmptyShell) {
464
93
  return createEmptyDirective<OMPParallelForDirective>(
465
93
      C, NumClauses, /*HasAssociatedStmt=*/true,
466
93
      numLoopChildren(CollapsedNum, OMPD_parallel_for) + 1, CollapsedNum);
467
93
}
468
469
OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
470
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
471
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
472
5.64k
    const HelperExprs &Exprs) {
473
5.64k
  auto *Dir = createDirective<OMPParallelForSimdDirective>(
474
5.64k
      C, Clauses, AssociatedStmt,
475
5.64k
      numLoopChildren(CollapsedNum, OMPD_parallel_for_simd), StartLoc, EndLoc,
476
5.64k
      CollapsedNum);
477
5.64k
  Dir->setIterationVariable(Exprs.IterationVarRef);
478
5.64k
  Dir->setLastIteration(Exprs.LastIteration);
479
5.64k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
480
5.64k
  Dir->setPreCond(Exprs.PreCond);
481
5.64k
  Dir->setCond(Exprs.Cond);
482
5.64k
  Dir->setInit(Exprs.Init);
483
5.64k
  Dir->setInc(Exprs.Inc);
484
5.64k
  Dir->setIsLastIterVariable(Exprs.IL);
485
5.64k
  Dir->setLowerBoundVariable(Exprs.LB);
486
5.64k
  Dir->setUpperBoundVariable(Exprs.UB);
487
5.64k
  Dir->setStrideVariable(Exprs.ST);
488
5.64k
  Dir->setEnsureUpperBound(Exprs.EUB);
489
5.64k
  Dir->setNextLowerBound(Exprs.NLB);
490
5.64k
  Dir->setNextUpperBound(Exprs.NUB);
491
5.64k
  Dir->setNumIterations(Exprs.NumIterations);
492
5.64k
  Dir->setCounters(Exprs.Counters);
493
5.64k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
494
5.64k
  Dir->setInits(Exprs.Inits);
495
5.64k
  Dir->setUpdates(Exprs.Updates);
496
5.64k
  Dir->setFinals(Exprs.Finals);
497
5.64k
  Dir->setDependentCounters(Exprs.DependentCounters);
498
5.64k
  Dir->setDependentInits(Exprs.DependentInits);
499
5.64k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
500
5.64k
  Dir->setPreInits(Exprs.PreInits);
501
5.64k
  return Dir;
502
5.64k
}
503
504
OMPParallelForSimdDirective *
505
OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
506
                                         unsigned NumClauses,
507
112
                                         unsigned CollapsedNum, EmptyShell) {
508
112
  return createEmptyDirective<OMPParallelForSimdDirective>(
509
112
      C, NumClauses, /*HasAssociatedStmt=*/true,
510
112
      numLoopChildren(CollapsedNum, OMPD_parallel_for_simd), CollapsedNum);
511
112
}
512
513
OMPParallelMasterDirective *OMPParallelMasterDirective::Create(
514
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
515
2.83k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef) {
516
2.83k
  auto *Dir = createDirective<OMPParallelMasterDirective>(
517
2.83k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
518
2.83k
  Dir->setTaskReductionRefExpr(TaskRedRef);
519
2.83k
  return Dir;
520
2.83k
}
521
522
OMPParallelMasterDirective *
523
OMPParallelMasterDirective::CreateEmpty(const ASTContext &C,
524
74
                                        unsigned NumClauses, EmptyShell) {
525
74
  return createEmptyDirective<OMPParallelMasterDirective>(
526
74
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
527
74
}
528
529
OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
530
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
531
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
532
3.30k
    bool HasCancel) {
533
3.30k
  auto *Dir = createDirective<OMPParallelSectionsDirective>(
534
3.30k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
535
3.30k
  Dir->setTaskReductionRefExpr(TaskRedRef);
536
3.30k
  Dir->setHasCancel(HasCancel);
537
3.30k
  return Dir;
538
3.30k
}
539
540
OMPParallelSectionsDirective *
541
OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
542
32
                                          unsigned NumClauses, EmptyShell) {
543
32
  return createEmptyDirective<OMPParallelSectionsDirective>(
544
32
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
545
32
}
546
547
OMPTaskDirective *
548
OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
549
                         SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
550
3.57k
                         Stmt *AssociatedStmt, bool HasCancel) {
551
3.57k
  auto *Dir = createDirective<OMPTaskDirective>(
552
3.57k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
553
3.57k
  Dir->setHasCancel(HasCancel);
554
3.57k
  return Dir;
555
3.57k
}
556
557
OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
558
                                                unsigned NumClauses,
559
180
                                                EmptyShell) {
560
180
  return createEmptyDirective<OMPTaskDirective>(C, NumClauses,
561
180
                                                /*HasAssociatedStmt=*/true);
562
180
}
563
564
OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
565
                                                     SourceLocation StartLoc,
566
606
                                                     SourceLocation EndLoc) {
567
606
  return new (C) OMPTaskyieldDirective(StartLoc, EndLoc);
568
606
}
569
570
OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
571
13
                                                          EmptyShell) {
572
13
  return new (C) OMPTaskyieldDirective();
573
13
}
574
575
OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
576
                                                 SourceLocation StartLoc,
577
363
                                                 SourceLocation EndLoc) {
578
363
  return new (C) OMPBarrierDirective(StartLoc, EndLoc);
579
363
}
580
581
OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
582
30
                                                      EmptyShell) {
583
30
  return new (C) OMPBarrierDirective();
584
30
}
585
586
OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C,
587
                                                   SourceLocation StartLoc,
588
551
                                                   SourceLocation EndLoc) {
589
551
  return new (C) OMPTaskwaitDirective(StartLoc, EndLoc);
590
551
}
591
592
OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
593
13
                                                        EmptyShell) {
594
13
  return new (C) OMPTaskwaitDirective();
595
13
}
596
597
OMPTaskgroupDirective *OMPTaskgroupDirective::Create(
598
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
599
2.52k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) {
600
2.52k
  auto *Dir = createDirective<OMPTaskgroupDirective>(
601
2.52k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
602
2.52k
  Dir->setReductionRef(ReductionRef);
603
2.52k
  return Dir;
604
2.52k
}
605
606
OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
607
                                                          unsigned NumClauses,
608
88
                                                          EmptyShell) {
609
88
  return createEmptyDirective<OMPTaskgroupDirective>(
610
88
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
611
88
}
612
613
OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
614
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
615
179
    OpenMPDirectiveKind CancelRegion) {
616
179
  auto *Dir = new (C) OMPCancellationPointDirective(StartLoc, EndLoc);
617
179
  Dir->setCancelRegion(CancelRegion);
618
179
  return Dir;
619
179
}
620
621
OMPCancellationPointDirective *
622
66
OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
623
66
  return new (C) OMPCancellationPointDirective();
624
66
}
625
626
OMPCancelDirective *
627
OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
628
                           SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
629
624
                           OpenMPDirectiveKind CancelRegion) {
630
624
  auto *Dir = createDirective<OMPCancelDirective>(
631
624
      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
632
624
      EndLoc);
633
624
  Dir->setCancelRegion(CancelRegion);
634
624
  return Dir;
635
624
}
636
637
OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
638
                                                    unsigned NumClauses,
639
162
                                                    EmptyShell) {
640
162
  return createEmptyDirective<OMPCancelDirective>(C, NumClauses);
641
162
}
642
643
OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
644
                                             SourceLocation StartLoc,
645
                                             SourceLocation EndLoc,
646
917
                                             ArrayRef<OMPClause *> Clauses) {
647
917
  return createDirective<OMPFlushDirective>(
648
917
      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
649
917
      EndLoc);
650
917
}
651
652
OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
653
                                                  unsigned NumClauses,
654
50
                                                  EmptyShell) {
655
50
  return createEmptyDirective<OMPFlushDirective>(C, NumClauses);
656
50
}
657
658
OMPDepobjDirective *OMPDepobjDirective::Create(const ASTContext &C,
659
                                               SourceLocation StartLoc,
660
                                               SourceLocation EndLoc,
661
238
                                               ArrayRef<OMPClause *> Clauses) {
662
238
  return createDirective<OMPDepobjDirective>(
663
238
      C, Clauses, /*AssociatedStmt=*/nullptr,
664
238
      /*NumChildren=*/0, StartLoc, EndLoc);
665
238
}
666
667
OMPDepobjDirective *OMPDepobjDirective::CreateEmpty(const ASTContext &C,
668
                                                    unsigned NumClauses,
669
28
                                                    EmptyShell) {
670
28
  return createEmptyDirective<OMPDepobjDirective>(C, NumClauses);
671
28
}
672
673
OMPScanDirective *OMPScanDirective::Create(const ASTContext &C,
674
                                           SourceLocation StartLoc,
675
                                           SourceLocation EndLoc,
676
98
                                           ArrayRef<OMPClause *> Clauses) {
677
98
  return createDirective<OMPScanDirective>(C, Clauses,
678
98
                                           /*AssociatedStmt=*/nullptr,
679
98
                                           /*NumChildren=*/0, StartLoc, EndLoc);
680
98
}
681
682
OMPScanDirective *OMPScanDirective::CreateEmpty(const ASTContext &C,
683
                                                unsigned NumClauses,
684
24
                                                EmptyShell) {
685
24
  return createEmptyDirective<OMPScanDirective>(C, NumClauses);
686
24
}
687
688
OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
689
                                                 SourceLocation StartLoc,
690
                                                 SourceLocation EndLoc,
691
                                                 ArrayRef<OMPClause *> Clauses,
692
1.18k
                                                 Stmt *AssociatedStmt) {
693
1.18k
  return createDirective<OMPOrderedDirective>(
694
1.18k
      C, Clauses, cast_or_null<CapturedStmt>(AssociatedStmt),
695
1.18k
      /*NumChildren=*/0, StartLoc, EndLoc);
696
1.18k
}
697
698
OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
699
                                                      unsigned NumClauses,
700
                                                      bool IsStandalone,
701
62
                                                      EmptyShell) {
702
62
  return createEmptyDirective<OMPOrderedDirective>(C, NumClauses,
703
62
                                                   !IsStandalone);
704
62
}
705
706
OMPAtomicDirective *OMPAtomicDirective::Create(
707
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
708
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
709
3.35k
    Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) {
710
3.35k
  auto *Dir = createDirective<OMPAtomicDirective>(
711
3.35k
      C, Clauses, AssociatedStmt, /*NumChildren=*/4, StartLoc, EndLoc);
712
3.35k
  Dir->setX(X);
713
3.35k
  Dir->setV(V);
714
3.35k
  Dir->setExpr(E);
715
3.35k
  Dir->setUpdateExpr(UE);
716
3.35k
  Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
717
3.35k
  Dir->IsPostfixUpdate = IsPostfixUpdate;
718
3.35k
  return Dir;
719
3.35k
}
720
721
OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
722
                                                    unsigned NumClauses,
723
584
                                                    EmptyShell) {
724
584
  return createEmptyDirective<OMPAtomicDirective>(
725
584
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/4);
726
584
}
727
728
OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
729
                                               SourceLocation StartLoc,
730
                                               SourceLocation EndLoc,
731
                                               ArrayRef<OMPClause *> Clauses,
732
49.2k
                                               Stmt *AssociatedStmt) {
733
49.2k
  return createDirective<OMPTargetDirective>(
734
49.2k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
735
49.2k
}
736
737
OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
738
                                                    unsigned NumClauses,
739
4.32k
                                                    EmptyShell) {
740
4.32k
  return createEmptyDirective<OMPTargetDirective>(C, NumClauses,
741
4.32k
                                                  /*HasAssociatedStmt=*/true);
742
4.32k
}
743
744
OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
745
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
746
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
747
7.39k
    bool HasCancel) {
748
7.39k
  auto *Dir = createDirective<OMPTargetParallelDirective>(
749
7.39k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
750
7.39k
  Dir->setTaskReductionRefExpr(TaskRedRef);
751
7.39k
  Dir->setHasCancel(HasCancel);
752
7.39k
  return Dir;
753
7.39k
}
754
755
OMPTargetParallelDirective *
756
OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
757
623
                                        unsigned NumClauses, EmptyShell) {
758
623
  return createEmptyDirective<OMPTargetParallelDirective>(
759
623
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
760
623
}
761
762
OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
763
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
764
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
765
7.39k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
766
7.39k
  auto *Dir = createDirective<OMPTargetParallelForDirective>(
767
7.39k
      C, Clauses, AssociatedStmt,
768
7.39k
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1, StartLoc,
769
7.39k
      EndLoc, CollapsedNum);
770
7.39k
  Dir->setIterationVariable(Exprs.IterationVarRef);
771
7.39k
  Dir->setLastIteration(Exprs.LastIteration);
772
7.39k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
773
7.39k
  Dir->setPreCond(Exprs.PreCond);
774
7.39k
  Dir->setCond(Exprs.Cond);
775
7.39k
  Dir->setInit(Exprs.Init);
776
7.39k
  Dir->setInc(Exprs.Inc);
777
7.39k
  Dir->setIsLastIterVariable(Exprs.IL);
778
7.39k
  Dir->setLowerBoundVariable(Exprs.LB);
779
7.39k
  Dir->setUpperBoundVariable(Exprs.UB);
780
7.39k
  Dir->setStrideVariable(Exprs.ST);
781
7.39k
  Dir->setEnsureUpperBound(Exprs.EUB);
782
7.39k
  Dir->setNextLowerBound(Exprs.NLB);
783
7.39k
  Dir->setNextUpperBound(Exprs.NUB);
784
7.39k
  Dir->setNumIterations(Exprs.NumIterations);
785
7.39k
  Dir->setCounters(Exprs.Counters);
786
7.39k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
787
7.39k
  Dir->setInits(Exprs.Inits);
788
7.39k
  Dir->setUpdates(Exprs.Updates);
789
7.39k
  Dir->setFinals(Exprs.Finals);
790
7.39k
  Dir->setDependentCounters(Exprs.DependentCounters);
791
7.39k
  Dir->setDependentInits(Exprs.DependentInits);
792
7.39k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
793
7.39k
  Dir->setPreInits(Exprs.PreInits);
794
7.39k
  Dir->setTaskReductionRefExpr(TaskRedRef);
795
7.39k
  Dir->setHasCancel(HasCancel);
796
7.39k
  return Dir;
797
7.39k
}
798
799
OMPTargetParallelForDirective *
800
OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
801
                                           unsigned NumClauses,
802
437
                                           unsigned CollapsedNum, EmptyShell) {
803
437
  return createEmptyDirective<OMPTargetParallelForDirective>(
804
437
      C, NumClauses, /*HasAssociatedStmt=*/true,
805
437
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1,
806
437
      CollapsedNum);
807
437
}
808
809
OMPTargetDataDirective *OMPTargetDataDirective::Create(
810
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
811
3.89k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
812
3.89k
  return createDirective<OMPTargetDataDirective>(
813
3.89k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
814
3.89k
}
815
816
OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
817
                                                            unsigned N,
818
238
                                                            EmptyShell) {
819
238
  return createEmptyDirective<OMPTargetDataDirective>(
820
238
      C, N, /*HasAssociatedStmt=*/true);
821
238
}
822
823
OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
824
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
825
1.70k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
826
1.70k
  return createDirective<OMPTargetEnterDataDirective>(
827
1.70k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
828
1.70k
}
829
830
OMPTargetEnterDataDirective *
831
OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
832
277
                                         EmptyShell) {
833
277
  return createEmptyDirective<OMPTargetEnterDataDirective>(
834
277
      C, N, /*HasAssociatedStmt=*/true);
835
277
}
836
837
OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create(
838
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
839
1.71k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
840
1.71k
  return createDirective<OMPTargetExitDataDirective>(
841
1.71k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
842
1.71k
}
843
844
OMPTargetExitDataDirective *
845
OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
846
277
                                        EmptyShell) {
847
277
  return createEmptyDirective<OMPTargetExitDataDirective>(
848
277
      C, N, /*HasAssociatedStmt=*/true);
849
277
}
850
851
OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
852
                                             SourceLocation StartLoc,
853
                                             SourceLocation EndLoc,
854
                                             ArrayRef<OMPClause *> Clauses,
855
18.0k
                                             Stmt *AssociatedStmt) {
856
18.0k
  return createDirective<OMPTeamsDirective>(
857
18.0k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
858
18.0k
}
859
860
OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
861
                                                  unsigned NumClauses,
862
856
                                                  EmptyShell) {
863
856
  return createEmptyDirective<OMPTeamsDirective>(C, NumClauses,
864
856
                                                 /*HasAssociatedStmt=*/true);
865
856
}
866
867
OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
868
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
869
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
870
4.47k
    const HelperExprs &Exprs, bool HasCancel) {
871
4.47k
  auto *Dir = createDirective<OMPTaskLoopDirective>(
872
4.47k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_taskloop),
873
4.47k
      StartLoc, EndLoc, CollapsedNum);
874
4.47k
  Dir->setIterationVariable(Exprs.IterationVarRef);
875
4.47k
  Dir->setLastIteration(Exprs.LastIteration);
876
4.47k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
877
4.47k
  Dir->setPreCond(Exprs.PreCond);
878
4.47k
  Dir->setCond(Exprs.Cond);
879
4.47k
  Dir->setInit(Exprs.Init);
880
4.47k
  Dir->setInc(Exprs.Inc);
881
4.47k
  Dir->setIsLastIterVariable(Exprs.IL);
882
4.47k
  Dir->setLowerBoundVariable(Exprs.LB);
883
4.47k
  Dir->setUpperBoundVariable(Exprs.UB);
884
4.47k
  Dir->setStrideVariable(Exprs.ST);
885
4.47k
  Dir->setEnsureUpperBound(Exprs.EUB);
886
4.47k
  Dir->setNextLowerBound(Exprs.NLB);
887
4.47k
  Dir->setNextUpperBound(Exprs.NUB);
888
4.47k
  Dir->setNumIterations(Exprs.NumIterations);
889
4.47k
  Dir->setCounters(Exprs.Counters);
890
4.47k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
891
4.47k
  Dir->setInits(Exprs.Inits);
892
4.47k
  Dir->setUpdates(Exprs.Updates);
893
4.47k
  Dir->setFinals(Exprs.Finals);
894
4.47k
  Dir->setDependentCounters(Exprs.DependentCounters);
895
4.47k
  Dir->setDependentInits(Exprs.DependentInits);
896
4.47k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
897
4.47k
  Dir->setPreInits(Exprs.PreInits);
898
4.47k
  Dir->setHasCancel(HasCancel);
899
4.47k
  return Dir;
900
4.47k
}
901
902
OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
903
                                                        unsigned NumClauses,
904
                                                        unsigned CollapsedNum,
905
34
                                                        EmptyShell) {
906
34
  return createEmptyDirective<OMPTaskLoopDirective>(
907
34
      C, NumClauses, /*HasAssociatedStmt=*/true,
908
34
      numLoopChildren(CollapsedNum, OMPD_taskloop), CollapsedNum);
909
34
}
910
911
OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
912
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
913
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
914
4.30k
    const HelperExprs &Exprs) {
915
4.30k
  auto *Dir = createDirective<OMPTaskLoopSimdDirective>(
916
4.30k
      C, Clauses, AssociatedStmt,
917
4.30k
      numLoopChildren(CollapsedNum, OMPD_taskloop_simd), StartLoc, EndLoc,
918
4.30k
      CollapsedNum);
919
4.30k
  Dir->setIterationVariable(Exprs.IterationVarRef);
920
4.30k
  Dir->setLastIteration(Exprs.LastIteration);
921
4.30k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
922
4.30k
  Dir->setPreCond(Exprs.PreCond);
923
4.30k
  Dir->setCond(Exprs.Cond);
924
4.30k
  Dir->setInit(Exprs.Init);
925
4.30k
  Dir->setInc(Exprs.Inc);
926
4.30k
  Dir->setIsLastIterVariable(Exprs.IL);
927
4.30k
  Dir->setLowerBoundVariable(Exprs.LB);
928
4.30k
  Dir->setUpperBoundVariable(Exprs.UB);
929
4.30k
  Dir->setStrideVariable(Exprs.ST);
930
4.30k
  Dir->setEnsureUpperBound(Exprs.EUB);
931
4.30k
  Dir->setNextLowerBound(Exprs.NLB);
932
4.30k
  Dir->setNextUpperBound(Exprs.NUB);
933
4.30k
  Dir->setNumIterations(Exprs.NumIterations);
934
4.30k
  Dir->setCounters(Exprs.Counters);
935
4.30k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
936
4.30k
  Dir->setInits(Exprs.Inits);
937
4.30k
  Dir->setUpdates(Exprs.Updates);
938
4.30k
  Dir->setFinals(Exprs.Finals);
939
4.30k
  Dir->setDependentCounters(Exprs.DependentCounters);
940
4.30k
  Dir->setDependentInits(Exprs.DependentInits);
941
4.30k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
942
4.30k
  Dir->setPreInits(Exprs.PreInits);
943
4.30k
  return Dir;
944
4.30k
}
945
946
OMPTaskLoopSimdDirective *
947
OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
948
46
                                      unsigned CollapsedNum, EmptyShell) {
949
46
  return createEmptyDirective<OMPTaskLoopSimdDirective>(
950
46
      C, NumClauses, /*HasAssociatedStmt=*/true,
951
46
      numLoopChildren(CollapsedNum, OMPD_taskloop_simd), CollapsedNum);
952
46
}
953
954
OMPMasterTaskLoopDirective *OMPMasterTaskLoopDirective::Create(
955
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
956
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
957
3.39k
    const HelperExprs &Exprs, bool HasCancel) {
958
3.39k
  auto *Dir = createDirective<OMPMasterTaskLoopDirective>(
959
3.39k
      C, Clauses, AssociatedStmt,
960
3.39k
      numLoopChildren(CollapsedNum, OMPD_master_taskloop), StartLoc, EndLoc,
961
3.39k
      CollapsedNum);
962
3.39k
  Dir->setIterationVariable(Exprs.IterationVarRef);
963
3.39k
  Dir->setLastIteration(Exprs.LastIteration);
964
3.39k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
965
3.39k
  Dir->setPreCond(Exprs.PreCond);
966
3.39k
  Dir->setCond(Exprs.Cond);
967
3.39k
  Dir->setInit(Exprs.Init);
968
3.39k
  Dir->setInc(Exprs.Inc);
969
3.39k
  Dir->setIsLastIterVariable(Exprs.IL);
970
3.39k
  Dir->setLowerBoundVariable(Exprs.LB);
971
3.39k
  Dir->setUpperBoundVariable(Exprs.UB);
972
3.39k
  Dir->setStrideVariable(Exprs.ST);
973
3.39k
  Dir->setEnsureUpperBound(Exprs.EUB);
974
3.39k
  Dir->setNextLowerBound(Exprs.NLB);
975
3.39k
  Dir->setNextUpperBound(Exprs.NUB);
976
3.39k
  Dir->setNumIterations(Exprs.NumIterations);
977
3.39k
  Dir->setCounters(Exprs.Counters);
978
3.39k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
979
3.39k
  Dir->setInits(Exprs.Inits);
980
3.39k
  Dir->setUpdates(Exprs.Updates);
981
3.39k
  Dir->setFinals(Exprs.Finals);
982
3.39k
  Dir->setDependentCounters(Exprs.DependentCounters);
983
3.39k
  Dir->setDependentInits(Exprs.DependentInits);
984
3.39k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
985
3.39k
  Dir->setPreInits(Exprs.PreInits);
986
3.39k
  Dir->setHasCancel(HasCancel);
987
3.39k
  return Dir;
988
3.39k
}
989
990
OMPMasterTaskLoopDirective *
991
OMPMasterTaskLoopDirective::CreateEmpty(const ASTContext &C,
992
                                        unsigned NumClauses,
993
32
                                        unsigned CollapsedNum, EmptyShell) {
994
32
  return createEmptyDirective<OMPMasterTaskLoopDirective>(
995
32
      C, NumClauses, /*HasAssociatedStmt=*/true,
996
32
      numLoopChildren(CollapsedNum, OMPD_master_taskloop), CollapsedNum);
997
32
}
998
999
OMPMasterTaskLoopSimdDirective *OMPMasterTaskLoopSimdDirective::Create(
1000
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1001
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1002
4.28k
    const HelperExprs &Exprs) {
1003
4.28k
  auto *Dir = createDirective<OMPMasterTaskLoopSimdDirective>(
1004
4.28k
      C, Clauses, AssociatedStmt,
1005
4.28k
      numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), StartLoc,
1006
4.28k
      EndLoc, CollapsedNum);
1007
4.28k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1008
4.28k
  Dir->setLastIteration(Exprs.LastIteration);
1009
4.28k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1010
4.28k
  Dir->setPreCond(Exprs.PreCond);
1011
4.28k
  Dir->setCond(Exprs.Cond);
1012
4.28k
  Dir->setInit(Exprs.Init);
1013
4.28k
  Dir->setInc(Exprs.Inc);
1014
4.28k
  Dir->setIsLastIterVariable(Exprs.IL);
1015
4.28k
  Dir->setLowerBoundVariable(Exprs.LB);
1016
4.28k
  Dir->setUpperBoundVariable(Exprs.UB);
1017
4.28k
  Dir->setStrideVariable(Exprs.ST);
1018
4.28k
  Dir->setEnsureUpperBound(Exprs.EUB);
1019
4.28k
  Dir->setNextLowerBound(Exprs.NLB);
1020
4.28k
  Dir->setNextUpperBound(Exprs.NUB);
1021
4.28k
  Dir->setNumIterations(Exprs.NumIterations);
1022
4.28k
  Dir->setCounters(Exprs.Counters);
1023
4.28k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1024
4.28k
  Dir->setInits(Exprs.Inits);
1025
4.28k
  Dir->setUpdates(Exprs.Updates);
1026
4.28k
  Dir->setFinals(Exprs.Finals);
1027
4.28k
  Dir->setDependentCounters(Exprs.DependentCounters);
1028
4.28k
  Dir->setDependentInits(Exprs.DependentInits);
1029
4.28k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1030
4.28k
  Dir->setPreInits(Exprs.PreInits);
1031
4.28k
  return Dir;
1032
4.28k
}
1033
1034
OMPMasterTaskLoopSimdDirective *
1035
OMPMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1036
                                            unsigned NumClauses,
1037
46
                                            unsigned CollapsedNum, EmptyShell) {
1038
46
  return createEmptyDirective<OMPMasterTaskLoopSimdDirective>(
1039
46
      C, NumClauses, /*HasAssociatedStmt=*/true,
1040
46
      numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), CollapsedNum);
1041
46
}
1042
1043
OMPParallelMasterTaskLoopDirective *OMPParallelMasterTaskLoopDirective::Create(
1044
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1045
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1046
2.74k
    const HelperExprs &Exprs, bool HasCancel) {
1047
2.74k
  auto *Dir = createDirective<OMPParallelMasterTaskLoopDirective>(
1048
2.74k
      C, Clauses, AssociatedStmt,
1049
2.74k
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop), StartLoc,
1050
2.74k
      EndLoc, CollapsedNum);
1051
2.74k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1052
2.74k
  Dir->setLastIteration(Exprs.LastIteration);
1053
2.74k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1054
2.74k
  Dir->setPreCond(Exprs.PreCond);
1055
2.74k
  Dir->setCond(Exprs.Cond);
1056
2.74k
  Dir->setInit(Exprs.Init);
1057
2.74k
  Dir->setInc(Exprs.Inc);
1058
2.74k
  Dir->setIsLastIterVariable(Exprs.IL);
1059
2.74k
  Dir->setLowerBoundVariable(Exprs.LB);
1060
2.74k
  Dir->setUpperBoundVariable(Exprs.UB);
1061
2.74k
  Dir->setStrideVariable(Exprs.ST);
1062
2.74k
  Dir->setEnsureUpperBound(Exprs.EUB);
1063
2.74k
  Dir->setNextLowerBound(Exprs.NLB);
1064
2.74k
  Dir->setNextUpperBound(Exprs.NUB);
1065
2.74k
  Dir->setNumIterations(Exprs.NumIterations);
1066
2.74k
  Dir->setCounters(Exprs.Counters);
1067
2.74k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1068
2.74k
  Dir->setInits(Exprs.Inits);
1069
2.74k
  Dir->setUpdates(Exprs.Updates);
1070
2.74k
  Dir->setFinals(Exprs.Finals);
1071
2.74k
  Dir->setDependentCounters(Exprs.DependentCounters);
1072
2.74k
  Dir->setDependentInits(Exprs.DependentInits);
1073
2.74k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1074
2.74k
  Dir->setPreInits(Exprs.PreInits);
1075
2.74k
  Dir->setHasCancel(HasCancel);
1076
2.74k
  return Dir;
1077
2.74k
}
1078
1079
OMPParallelMasterTaskLoopDirective *
1080
OMPParallelMasterTaskLoopDirective::CreateEmpty(const ASTContext &C,
1081
                                                unsigned NumClauses,
1082
                                                unsigned CollapsedNum,
1083
30
                                                EmptyShell) {
1084
30
  return createEmptyDirective<OMPParallelMasterTaskLoopDirective>(
1085
30
      C, NumClauses, /*HasAssociatedStmt=*/true,
1086
30
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop),
1087
30
      CollapsedNum);
1088
30
}
1089
1090
OMPParallelMasterTaskLoopSimdDirective *
1091
OMPParallelMasterTaskLoopSimdDirective::Create(
1092
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1093
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1094
3.64k
    const HelperExprs &Exprs) {
1095
3.64k
  auto *Dir = createDirective<OMPParallelMasterTaskLoopSimdDirective>(
1096
3.64k
      C, Clauses, AssociatedStmt,
1097
3.64k
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd),
1098
3.64k
      StartLoc, EndLoc, CollapsedNum);
1099
3.64k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1100
3.64k
  Dir->setLastIteration(Exprs.LastIteration);
1101
3.64k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1102
3.64k
  Dir->setPreCond(Exprs.PreCond);
1103
3.64k
  Dir->setCond(Exprs.Cond);
1104
3.64k
  Dir->setInit(Exprs.Init);
1105
3.64k
  Dir->setInc(Exprs.Inc);
1106
3.64k
  Dir->setIsLastIterVariable(Exprs.IL);
1107
3.64k
  Dir->setLowerBoundVariable(Exprs.LB);
1108
3.64k
  Dir->setUpperBoundVariable(Exprs.UB);
1109
3.64k
  Dir->setStrideVariable(Exprs.ST);
1110
3.64k
  Dir->setEnsureUpperBound(Exprs.EUB);
1111
3.64k
  Dir->setNextLowerBound(Exprs.NLB);
1112
3.64k
  Dir->setNextUpperBound(Exprs.NUB);
1113
3.64k
  Dir->setNumIterations(Exprs.NumIterations);
1114
3.64k
  Dir->setCounters(Exprs.Counters);
1115
3.64k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1116
3.64k
  Dir->setInits(Exprs.Inits);
1117
3.64k
  Dir->setUpdates(Exprs.Updates);
1118
3.64k
  Dir->setFinals(Exprs.Finals);
1119
3.64k
  Dir->setDependentCounters(Exprs.DependentCounters);
1120
3.64k
  Dir->setDependentInits(Exprs.DependentInits);
1121
3.64k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1122
3.64k
  Dir->setPreInits(Exprs.PreInits);
1123
3.64k
  return Dir;
1124
3.64k
}
1125
1126
OMPParallelMasterTaskLoopSimdDirective *
1127
OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1128
                                                    unsigned NumClauses,
1129
                                                    unsigned CollapsedNum,
1130
44
                                                    EmptyShell) {
1131
44
  return createEmptyDirective<OMPParallelMasterTaskLoopSimdDirective>(
1132
44
      C, NumClauses, /*HasAssociatedStmt=*/true,
1133
44
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd),
1134
44
      CollapsedNum);
1135
44
}
1136
1137
OMPDistributeDirective *OMPDistributeDirective::Create(
1138
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1139
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1140
1.68k
    const HelperExprs &Exprs) {
1141
1.68k
  auto *Dir = createDirective<OMPDistributeDirective>(
1142
1.68k
      C, Clauses, AssociatedStmt,
1143
1.68k
      numLoopChildren(CollapsedNum, OMPD_distribute), StartLoc, EndLoc,
1144
1.68k
      CollapsedNum);
1145
1.68k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1146
1.68k
  Dir->setLastIteration(Exprs.LastIteration);
1147
1.68k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1148
1.68k
  Dir->setPreCond(Exprs.PreCond);
1149
1.68k
  Dir->setCond(Exprs.Cond);
1150
1.68k
  Dir->setInit(Exprs.Init);
1151
1.68k
  Dir->setInc(Exprs.Inc);
1152
1.68k
  Dir->setIsLastIterVariable(Exprs.IL);
1153
1.68k
  Dir->setLowerBoundVariable(Exprs.LB);
1154
1.68k
  Dir->setUpperBoundVariable(Exprs.UB);
1155
1.68k
  Dir->setStrideVariable(Exprs.ST);
1156
1.68k
  Dir->setEnsureUpperBound(Exprs.EUB);
1157
1.68k
  Dir->setNextLowerBound(Exprs.NLB);
1158
1.68k
  Dir->setNextUpperBound(Exprs.NUB);
1159
1.68k
  Dir->setNumIterations(Exprs.NumIterations);
1160
1.68k
  Dir->setCounters(Exprs.Counters);
1161
1.68k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1162
1.68k
  Dir->setInits(Exprs.Inits);
1163
1.68k
  Dir->setUpdates(Exprs.Updates);
1164
1.68k
  Dir->setFinals(Exprs.Finals);
1165
1.68k
  Dir->setDependentCounters(Exprs.DependentCounters);
1166
1.68k
  Dir->setDependentInits(Exprs.DependentInits);
1167
1.68k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1168
1.68k
  Dir->setPreInits(Exprs.PreInits);
1169
1.68k
  return Dir;
1170
1.68k
}
1171
1172
OMPDistributeDirective *
1173
OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1174
140
                                    unsigned CollapsedNum, EmptyShell) {
1175
140
  return createEmptyDirective<OMPDistributeDirective>(
1176
140
      C, NumClauses, /*HasAssociatedStmt=*/true,
1177
140
      numLoopChildren(CollapsedNum, OMPD_distribute), CollapsedNum);
1178
140
}
1179
1180
OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create(
1181
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1182
2.95k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1183
2.95k
  return createDirective<OMPTargetUpdateDirective>(C, Clauses, AssociatedStmt,
1184
2.95k
                                                   /*NumChildren=*/0, StartLoc,
1185
2.95k
                                                   EndLoc);
1186
2.95k
}
1187
1188
OMPTargetUpdateDirective *
1189
OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1190
260
                                      EmptyShell) {
1191
260
  return createEmptyDirective<OMPTargetUpdateDirective>(
1192
260
      C, NumClauses, /*HasAssociatedStmt=*/true);
1193
260
}
1194
1195
OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1196
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1197
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1198
4.67k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1199
4.67k
  auto *Dir = createDirective<OMPDistributeParallelForDirective>(
1200
4.67k
      C, Clauses, AssociatedStmt,
1201
4.67k
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1, StartLoc,
1202
4.67k
      EndLoc, CollapsedNum);
1203
4.67k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1204
4.67k
  Dir->setLastIteration(Exprs.LastIteration);
1205
4.67k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1206
4.67k
  Dir->setPreCond(Exprs.PreCond);
1207
4.67k
  Dir->setCond(Exprs.Cond);
1208
4.67k
  Dir->setInit(Exprs.Init);
1209
4.67k
  Dir->setInc(Exprs.Inc);
1210
4.67k
  Dir->setIsLastIterVariable(Exprs.IL);
1211
4.67k
  Dir->setLowerBoundVariable(Exprs.LB);
1212
4.67k
  Dir->setUpperBoundVariable(Exprs.UB);
1213
4.67k
  Dir->setStrideVariable(Exprs.ST);
1214
4.67k
  Dir->setEnsureUpperBound(Exprs.EUB);
1215
4.67k
  Dir->setNextLowerBound(Exprs.NLB);
1216
4.67k
  Dir->setNextUpperBound(Exprs.NUB);
1217
4.67k
  Dir->setNumIterations(Exprs.NumIterations);
1218
4.67k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1219
4.67k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1220
4.67k
  Dir->setDistInc(Exprs.DistInc);
1221
4.67k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1222
4.67k
  Dir->setCounters(Exprs.Counters);
1223
4.67k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1224
4.67k
  Dir->setInits(Exprs.Inits);
1225
4.67k
  Dir->setUpdates(Exprs.Updates);
1226
4.67k
  Dir->setFinals(Exprs.Finals);
1227
4.67k
  Dir->setDependentCounters(Exprs.DependentCounters);
1228
4.67k
  Dir->setDependentInits(Exprs.DependentInits);
1229
4.67k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1230
4.67k
  Dir->setPreInits(Exprs.PreInits);
1231
4.67k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1232
4.67k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1233
4.67k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1234
4.67k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1235
4.67k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1236
4.67k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1237
4.67k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1238
4.67k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1239
4.67k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1240
4.67k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1241
4.67k
  Dir->HasCancel = HasCancel;
1242
4.67k
  return Dir;
1243
4.67k
}
1244
1245
OMPDistributeParallelForDirective *
1246
OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1247
                                               unsigned NumClauses,
1248
                                               unsigned CollapsedNum,
1249
232
                                               EmptyShell) {
1250
232
  return createEmptyDirective<OMPDistributeParallelForDirective>(
1251
232
      C, NumClauses, /*HasAssociatedStmt=*/true,
1252
232
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1,
1253
232
      CollapsedNum);
1254
232
}
1255
1256
OMPDistributeParallelForSimdDirective *
1257
OMPDistributeParallelForSimdDirective::Create(
1258
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1259
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1260
5.60k
    const HelperExprs &Exprs) {
1261
5.60k
  auto *Dir = createDirective<OMPDistributeParallelForSimdDirective>(
1262
5.60k
      C, Clauses, AssociatedStmt,
1263
5.60k
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1264
5.60k
      StartLoc, EndLoc, CollapsedNum);
1265
5.60k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1266
5.60k
  Dir->setLastIteration(Exprs.LastIteration);
1267
5.60k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1268
5.60k
  Dir->setPreCond(Exprs.PreCond);
1269
5.60k
  Dir->setCond(Exprs.Cond);
1270
5.60k
  Dir->setInit(Exprs.Init);
1271
5.60k
  Dir->setInc(Exprs.Inc);
1272
5.60k
  Dir->setIsLastIterVariable(Exprs.IL);
1273
5.60k
  Dir->setLowerBoundVariable(Exprs.LB);
1274
5.60k
  Dir->setUpperBoundVariable(Exprs.UB);
1275
5.60k
  Dir->setStrideVariable(Exprs.ST);
1276
5.60k
  Dir->setEnsureUpperBound(Exprs.EUB);
1277
5.60k
  Dir->setNextLowerBound(Exprs.NLB);
1278
5.60k
  Dir->setNextUpperBound(Exprs.NUB);
1279
5.60k
  Dir->setNumIterations(Exprs.NumIterations);
1280
5.60k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1281
5.60k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1282
5.60k
  Dir->setDistInc(Exprs.DistInc);
1283
5.60k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1284
5.60k
  Dir->setCounters(Exprs.Counters);
1285
5.60k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1286
5.60k
  Dir->setInits(Exprs.Inits);
1287
5.60k
  Dir->setUpdates(Exprs.Updates);
1288
5.60k
  Dir->setFinals(Exprs.Finals);
1289
5.60k
  Dir->setDependentCounters(Exprs.DependentCounters);
1290
5.60k
  Dir->setDependentInits(Exprs.DependentInits);
1291
5.60k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1292
5.60k
  Dir->setPreInits(Exprs.PreInits);
1293
5.60k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1294
5.60k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1295
5.60k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1296
5.60k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1297
5.60k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1298
5.60k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1299
5.60k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1300
5.60k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1301
5.60k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1302
5.60k
  return Dir;
1303
5.60k
}
1304
1305
OMPDistributeParallelForSimdDirective *
1306
OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1307
                                                   unsigned NumClauses,
1308
                                                   unsigned CollapsedNum,
1309
210
                                                   EmptyShell) {
1310
210
  return createEmptyDirective<OMPDistributeParallelForSimdDirective>(
1311
210
      C, NumClauses, /*HasAssociatedStmt=*/true,
1312
210
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1313
210
      CollapsedNum);
1314
210
}
1315
1316
OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1317
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1318
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1319
4.38k
    const HelperExprs &Exprs) {
1320
4.38k
  auto *Dir = createDirective<OMPDistributeSimdDirective>(
1321
4.38k
      C, Clauses, AssociatedStmt,
1322
4.38k
      numLoopChildren(CollapsedNum, OMPD_distribute_simd), StartLoc, EndLoc,
1323
4.38k
      CollapsedNum);
1324
4.38k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1325
4.38k
  Dir->setLastIteration(Exprs.LastIteration);
1326
4.38k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1327
4.38k
  Dir->setPreCond(Exprs.PreCond);
1328
4.38k
  Dir->setCond(Exprs.Cond);
1329
4.38k
  Dir->setInit(Exprs.Init);
1330
4.38k
  Dir->setInc(Exprs.Inc);
1331
4.38k
  Dir->setIsLastIterVariable(Exprs.IL);
1332
4.38k
  Dir->setLowerBoundVariable(Exprs.LB);
1333
4.38k
  Dir->setUpperBoundVariable(Exprs.UB);
1334
4.38k
  Dir->setStrideVariable(Exprs.ST);
1335
4.38k
  Dir->setEnsureUpperBound(Exprs.EUB);
1336
4.38k
  Dir->setNextLowerBound(Exprs.NLB);
1337
4.38k
  Dir->setNextUpperBound(Exprs.NUB);
1338
4.38k
  Dir->setNumIterations(Exprs.NumIterations);
1339
4.38k
  Dir->setCounters(Exprs.Counters);
1340
4.38k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1341
4.38k
  Dir->setInits(Exprs.Inits);
1342
4.38k
  Dir->setUpdates(Exprs.Updates);
1343
4.38k
  Dir->setFinals(Exprs.Finals);
1344
4.38k
  Dir->setDependentCounters(Exprs.DependentCounters);
1345
4.38k
  Dir->setDependentInits(Exprs.DependentInits);
1346
4.38k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1347
4.38k
  Dir->setPreInits(Exprs.PreInits);
1348
4.38k
  return Dir;
1349
4.38k
}
1350
1351
OMPDistributeSimdDirective *
1352
OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1353
                                        unsigned NumClauses,
1354
166
                                        unsigned CollapsedNum, EmptyShell) {
1355
166
  return createEmptyDirective<OMPDistributeSimdDirective>(
1356
166
      C, NumClauses, /*HasAssociatedStmt=*/true,
1357
166
      numLoopChildren(CollapsedNum, OMPD_distribute_simd), CollapsedNum);
1358
166
}
1359
1360
OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1361
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1362
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1363
7.53k
    const HelperExprs &Exprs) {
1364
7.53k
  auto *Dir = createDirective<OMPTargetParallelForSimdDirective>(
1365
7.53k
      C, Clauses, AssociatedStmt,
1366
7.53k
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd), StartLoc,
1367
7.53k
      EndLoc, CollapsedNum);
1368
7.53k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1369
7.53k
  Dir->setLastIteration(Exprs.LastIteration);
1370
7.53k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1371
7.53k
  Dir->setPreCond(Exprs.PreCond);
1372
7.53k
  Dir->setCond(Exprs.Cond);
1373
7.53k
  Dir->setInit(Exprs.Init);
1374
7.53k
  Dir->setInc(Exprs.Inc);
1375
7.53k
  Dir->setIsLastIterVariable(Exprs.IL);
1376
7.53k
  Dir->setLowerBoundVariable(Exprs.LB);
1377
7.53k
  Dir->setUpperBoundVariable(Exprs.UB);
1378
7.53k
  Dir->setStrideVariable(Exprs.ST);
1379
7.53k
  Dir->setEnsureUpperBound(Exprs.EUB);
1380
7.53k
  Dir->setNextLowerBound(Exprs.NLB);
1381
7.53k
  Dir->setNextUpperBound(Exprs.NUB);
1382
7.53k
  Dir->setNumIterations(Exprs.NumIterations);
1383
7.53k
  Dir->setCounters(Exprs.Counters);
1384
7.53k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1385
7.53k
  Dir->setInits(Exprs.Inits);
1386
7.53k
  Dir->setUpdates(Exprs.Updates);
1387
7.53k
  Dir->setFinals(Exprs.Finals);
1388
7.53k
  Dir->setDependentCounters(Exprs.DependentCounters);
1389
7.53k
  Dir->setDependentInits(Exprs.DependentInits);
1390
7.53k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1391
7.53k
  Dir->setPreInits(Exprs.PreInits);
1392
7.53k
  return Dir;
1393
7.53k
}
1394
1395
OMPTargetParallelForSimdDirective *
1396
OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1397
                                               unsigned NumClauses,
1398
                                               unsigned CollapsedNum,
1399
523
                                               EmptyShell) {
1400
523
  return createEmptyDirective<OMPTargetParallelForSimdDirective>(
1401
523
      C, NumClauses, /*HasAssociatedStmt=*/true,
1402
523
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd),
1403
523
      CollapsedNum);
1404
523
}
1405
1406
OMPTargetSimdDirective *
1407
OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1408
                               SourceLocation EndLoc, unsigned CollapsedNum,
1409
                               ArrayRef<OMPClause *> Clauses,
1410
7.64k
                               Stmt *AssociatedStmt, const HelperExprs &Exprs) {
1411
7.64k
  auto *Dir = createDirective<OMPTargetSimdDirective>(
1412
7.64k
      C, Clauses, AssociatedStmt,
1413
7.64k
      numLoopChildren(CollapsedNum, OMPD_target_simd), StartLoc, EndLoc,
1414
7.64k
      CollapsedNum);
1415
7.64k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1416
7.64k
  Dir->setLastIteration(Exprs.LastIteration);
1417
7.64k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1418
7.64k
  Dir->setPreCond(Exprs.PreCond);
1419
7.64k
  Dir->setCond(Exprs.Cond);
1420
7.64k
  Dir->setInit(Exprs.Init);
1421
7.64k
  Dir->setInc(Exprs.Inc);
1422
7.64k
  Dir->setCounters(Exprs.Counters);
1423
7.64k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1424
7.64k
  Dir->setInits(Exprs.Inits);
1425
7.64k
  Dir->setUpdates(Exprs.Updates);
1426
7.64k
  Dir->setFinals(Exprs.Finals);
1427
7.64k
  Dir->setDependentCounters(Exprs.DependentCounters);
1428
7.64k
  Dir->setDependentInits(Exprs.DependentInits);
1429
7.64k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1430
7.64k
  Dir->setPreInits(Exprs.PreInits);
1431
7.64k
  return Dir;
1432
7.64k
}
1433
1434
OMPTargetSimdDirective *
1435
OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1436
481
                                    unsigned CollapsedNum, EmptyShell) {
1437
481
  return createEmptyDirective<OMPTargetSimdDirective>(
1438
481
      C, NumClauses, /*HasAssociatedStmt=*/true,
1439
481
      numLoopChildren(CollapsedNum, OMPD_target_simd), CollapsedNum);
1440
481
}
1441
1442
OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1443
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1444
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1445
3.95k
    const HelperExprs &Exprs) {
1446
3.95k
  auto *Dir = createDirective<OMPTeamsDistributeDirective>(
1447
3.95k
      C, Clauses, AssociatedStmt,
1448
3.95k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute), StartLoc, EndLoc,
1449
3.95k
      CollapsedNum);
1450
3.95k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1451
3.95k
  Dir->setLastIteration(Exprs.LastIteration);
1452
3.95k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1453
3.95k
  Dir->setPreCond(Exprs.PreCond);
1454
3.95k
  Dir->setCond(Exprs.Cond);
1455
3.95k
  Dir->setInit(Exprs.Init);
1456
3.95k
  Dir->setInc(Exprs.Inc);
1457
3.95k
  Dir->setIsLastIterVariable(Exprs.IL);
1458
3.95k
  Dir->setLowerBoundVariable(Exprs.LB);
1459
3.95k
  Dir->setUpperBoundVariable(Exprs.UB);
1460
3.95k
  Dir->setStrideVariable(Exprs.ST);
1461
3.95k
  Dir->setEnsureUpperBound(Exprs.EUB);
1462
3.95k
  Dir->setNextLowerBound(Exprs.NLB);
1463
3.95k
  Dir->setNextUpperBound(Exprs.NUB);
1464
3.95k
  Dir->setNumIterations(Exprs.NumIterations);
1465
3.95k
  Dir->setCounters(Exprs.Counters);
1466
3.95k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1467
3.95k
  Dir->setInits(Exprs.Inits);
1468
3.95k
  Dir->setUpdates(Exprs.Updates);
1469
3.95k
  Dir->setFinals(Exprs.Finals);
1470
3.95k
  Dir->setDependentCounters(Exprs.DependentCounters);
1471
3.95k
  Dir->setDependentInits(Exprs.DependentInits);
1472
3.95k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1473
3.95k
  Dir->setPreInits(Exprs.PreInits);
1474
3.95k
  return Dir;
1475
3.95k
}
1476
1477
OMPTeamsDistributeDirective *
1478
OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1479
                                         unsigned NumClauses,
1480
142
                                         unsigned CollapsedNum, EmptyShell) {
1481
142
  return createEmptyDirective<OMPTeamsDistributeDirective>(
1482
142
      C, NumClauses, /*HasAssociatedStmt=*/true,
1483
142
      numLoopChildren(CollapsedNum, OMPD_teams_distribute), CollapsedNum);
1484
142
}
1485
1486
OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1487
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1488
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1489
4.50k
    const HelperExprs &Exprs) {
1490
4.50k
  auto *Dir = createDirective<OMPTeamsDistributeSimdDirective>(
1491
4.50k
      C, Clauses, AssociatedStmt,
1492
4.50k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), StartLoc,
1493
4.50k
      EndLoc, CollapsedNum);
1494
4.50k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1495
4.50k
  Dir->setLastIteration(Exprs.LastIteration);
1496
4.50k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1497
4.50k
  Dir->setPreCond(Exprs.PreCond);
1498
4.50k
  Dir->setCond(Exprs.Cond);
1499
4.50k
  Dir->setInit(Exprs.Init);
1500
4.50k
  Dir->setInc(Exprs.Inc);
1501
4.50k
  Dir->setIsLastIterVariable(Exprs.IL);
1502
4.50k
  Dir->setLowerBoundVariable(Exprs.LB);
1503
4.50k
  Dir->setUpperBoundVariable(Exprs.UB);
1504
4.50k
  Dir->setStrideVariable(Exprs.ST);
1505
4.50k
  Dir->setEnsureUpperBound(Exprs.EUB);
1506
4.50k
  Dir->setNextLowerBound(Exprs.NLB);
1507
4.50k
  Dir->setNextUpperBound(Exprs.NUB);
1508
4.50k
  Dir->setNumIterations(Exprs.NumIterations);
1509
4.50k
  Dir->setCounters(Exprs.Counters);
1510
4.50k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1511
4.50k
  Dir->setInits(Exprs.Inits);
1512
4.50k
  Dir->setUpdates(Exprs.Updates);
1513
4.50k
  Dir->setFinals(Exprs.Finals);
1514
4.50k
  Dir->setDependentCounters(Exprs.DependentCounters);
1515
4.50k
  Dir->setDependentInits(Exprs.DependentInits);
1516
4.50k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1517
4.50k
  Dir->setPreInits(Exprs.PreInits);
1518
4.50k
  return Dir;
1519
4.50k
}
1520
1521
OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1522
    const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1523
206
    EmptyShell) {
1524
206
  return createEmptyDirective<OMPTeamsDistributeSimdDirective>(
1525
206
      C, NumClauses, /*HasAssociatedStmt=*/true,
1526
206
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), CollapsedNum);
1527
206
}
1528
1529
OMPTeamsDistributeParallelForSimdDirective *
1530
OMPTeamsDistributeParallelForSimdDirective::Create(
1531
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1532
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1533
5.18k
    const HelperExprs &Exprs) {
1534
5.18k
  auto *Dir = createDirective<OMPTeamsDistributeParallelForSimdDirective>(
1535
5.18k
      C, Clauses, AssociatedStmt,
1536
5.18k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
1537
5.18k
      StartLoc, EndLoc, CollapsedNum);
1538
5.18k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1539
5.18k
  Dir->setLastIteration(Exprs.LastIteration);
1540
5.18k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1541
5.18k
  Dir->setPreCond(Exprs.PreCond);
1542
5.18k
  Dir->setCond(Exprs.Cond);
1543
5.18k
  Dir->setInit(Exprs.Init);
1544
5.18k
  Dir->setInc(Exprs.Inc);
1545
5.18k
  Dir->setIsLastIterVariable(Exprs.IL);
1546
5.18k
  Dir->setLowerBoundVariable(Exprs.LB);
1547
5.18k
  Dir->setUpperBoundVariable(Exprs.UB);
1548
5.18k
  Dir->setStrideVariable(Exprs.ST);
1549
5.18k
  Dir->setEnsureUpperBound(Exprs.EUB);
1550
5.18k
  Dir->setNextLowerBound(Exprs.NLB);
1551
5.18k
  Dir->setNextUpperBound(Exprs.NUB);
1552
5.18k
  Dir->setNumIterations(Exprs.NumIterations);
1553
5.18k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1554
5.18k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1555
5.18k
  Dir->setDistInc(Exprs.DistInc);
1556
5.18k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1557
5.18k
  Dir->setCounters(Exprs.Counters);
1558
5.18k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1559
5.18k
  Dir->setInits(Exprs.Inits);
1560
5.18k
  Dir->setUpdates(Exprs.Updates);
1561
5.18k
  Dir->setFinals(Exprs.Finals);
1562
5.18k
  Dir->setDependentCounters(Exprs.DependentCounters);
1563
5.18k
  Dir->setDependentInits(Exprs.DependentInits);
1564
5.18k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1565
5.18k
  Dir->setPreInits(Exprs.PreInits);
1566
5.18k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1567
5.18k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1568
5.18k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1569
5.18k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1570
5.18k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1571
5.18k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1572
5.18k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1573
5.18k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1574
5.18k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1575
5.18k
  return Dir;
1576
5.18k
}
1577
1578
OMPTeamsDistributeParallelForSimdDirective *
1579
OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1580
                                                        unsigned NumClauses,
1581
                                                        unsigned CollapsedNum,
1582
338
                                                        EmptyShell) {
1583
338
  return createEmptyDirective<OMPTeamsDistributeParallelForSimdDirective>(
1584
338
      C, NumClauses, /*HasAssociatedStmt=*/true,
1585
338
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
1586
338
      CollapsedNum);
1587
338
}
1588
1589
OMPTeamsDistributeParallelForDirective *
1590
OMPTeamsDistributeParallelForDirective::Create(
1591
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1592
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1593
4.43k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1594
4.43k
  auto *Dir = createDirective<OMPTeamsDistributeParallelForDirective>(
1595
4.43k
      C, Clauses, AssociatedStmt,
1596
4.43k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
1597
4.43k
      StartLoc, EndLoc, CollapsedNum);
1598
4.43k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1599
4.43k
  Dir->setLastIteration(Exprs.LastIteration);
1600
4.43k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1601
4.43k
  Dir->setPreCond(Exprs.PreCond);
1602
4.43k
  Dir->setCond(Exprs.Cond);
1603
4.43k
  Dir->setInit(Exprs.Init);
1604
4.43k
  Dir->setInc(Exprs.Inc);
1605
4.43k
  Dir->setIsLastIterVariable(Exprs.IL);
1606
4.43k
  Dir->setLowerBoundVariable(Exprs.LB);
1607
4.43k
  Dir->setUpperBoundVariable(Exprs.UB);
1608
4.43k
  Dir->setStrideVariable(Exprs.ST);
1609
4.43k
  Dir->setEnsureUpperBound(Exprs.EUB);
1610
4.43k
  Dir->setNextLowerBound(Exprs.NLB);
1611
4.43k
  Dir->setNextUpperBound(Exprs.NUB);
1612
4.43k
  Dir->setNumIterations(Exprs.NumIterations);
1613
4.43k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1614
4.43k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1615
4.43k
  Dir->setDistInc(Exprs.DistInc);
1616
4.43k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1617
4.43k
  Dir->setCounters(Exprs.Counters);
1618
4.43k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1619
4.43k
  Dir->setInits(Exprs.Inits);
1620
4.43k
  Dir->setUpdates(Exprs.Updates);
1621
4.43k
  Dir->setFinals(Exprs.Finals);
1622
4.43k
  Dir->setDependentCounters(Exprs.DependentCounters);
1623
4.43k
  Dir->setDependentInits(Exprs.DependentInits);
1624
4.43k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1625
4.43k
  Dir->setPreInits(Exprs.PreInits);
1626
4.43k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1627
4.43k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1628
4.43k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1629
4.43k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1630
4.43k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1631
4.43k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1632
4.43k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1633
4.43k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1634
4.43k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1635
4.43k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1636
4.43k
  Dir->HasCancel = HasCancel;
1637
4.43k
  return Dir;
1638
4.43k
}
1639
1640
OMPTeamsDistributeParallelForDirective *
1641
OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1642
                                                    unsigned NumClauses,
1643
                                                    unsigned CollapsedNum,
1644
302
                                                    EmptyShell) {
1645
302
  return createEmptyDirective<OMPTeamsDistributeParallelForDirective>(
1646
302
      C, NumClauses, /*HasAssociatedStmt=*/true,
1647
302
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
1648
302
      CollapsedNum);
1649
302
}
1650
1651
OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1652
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1653
7.17k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1654
7.17k
  return createDirective<OMPTargetTeamsDirective>(C, Clauses, AssociatedStmt,
1655
7.17k
                                                  /*NumChildren=*/0, StartLoc,
1656
7.17k
                                                  EndLoc);
1657
7.17k
}
1658
1659
OMPTargetTeamsDirective *
1660
OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1661
667
                                     EmptyShell) {
1662
667
  return createEmptyDirective<OMPTargetTeamsDirective>(
1663
667
      C, NumClauses, /*HasAssociatedStmt=*/true);
1664
667
}
1665
1666
OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
1667
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1668
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1669
6.51k
    const HelperExprs &Exprs) {
1670
6.51k
  auto *Dir = createDirective<OMPTargetTeamsDistributeDirective>(
1671
6.51k
      C, Clauses, AssociatedStmt,
1672
6.51k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute), StartLoc,
1673
6.51k
      EndLoc, CollapsedNum);
1674
6.51k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1675
6.51k
  Dir->setLastIteration(Exprs.LastIteration);
1676
6.51k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1677
6.51k
  Dir->setPreCond(Exprs.PreCond);
1678
6.51k
  Dir->setCond(Exprs.Cond);
1679
6.51k
  Dir->setInit(Exprs.Init);
1680
6.51k
  Dir->setInc(Exprs.Inc);
1681
6.51k
  Dir->setIsLastIterVariable(Exprs.IL);
1682
6.51k
  Dir->setLowerBoundVariable(Exprs.LB);
1683
6.51k
  Dir->setUpperBoundVariable(Exprs.UB);
1684
6.51k
  Dir->setStrideVariable(Exprs.ST);
1685
6.51k
  Dir->setEnsureUpperBound(Exprs.EUB);
1686
6.51k
  Dir->setNextLowerBound(Exprs.NLB);
1687
6.51k
  Dir->setNextUpperBound(Exprs.NUB);
1688
6.51k
  Dir->setNumIterations(Exprs.NumIterations);
1689
6.51k
  Dir->setCounters(Exprs.Counters);
1690
6.51k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1691
6.51k
  Dir->setInits(Exprs.Inits);
1692
6.51k
  Dir->setUpdates(Exprs.Updates);
1693
6.51k
  Dir->setFinals(Exprs.Finals);
1694
6.51k
  Dir->setDependentCounters(Exprs.DependentCounters);
1695
6.51k
  Dir->setDependentInits(Exprs.DependentInits);
1696
6.51k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1697
6.51k
  Dir->setPreInits(Exprs.PreInits);
1698
6.51k
  return Dir;
1699
6.51k
}
1700
1701
OMPTargetTeamsDistributeDirective *
1702
OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1703
                                               unsigned NumClauses,
1704
                                               unsigned CollapsedNum,
1705
447
                                               EmptyShell) {
1706
447
  return createEmptyDirective<OMPTargetTeamsDistributeDirective>(
1707
447
      C, NumClauses, /*HasAssociatedStmt=*/true,
1708
447
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute),
1709
447
      CollapsedNum);
1710
447
}
1711
1712
OMPTargetTeamsDistributeParallelForDirective *
1713
OMPTargetTeamsDistributeParallelForDirective::Create(
1714
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1715
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1716
6.90k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1717
6.90k
  auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForDirective>(
1718
6.90k
      C, Clauses, AssociatedStmt,
1719
6.90k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
1720
6.90k
          1,
1721
6.90k
      StartLoc, EndLoc, CollapsedNum);
1722
6.90k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1723
6.90k
  Dir->setLastIteration(Exprs.LastIteration);
1724
6.90k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1725
6.90k
  Dir->setPreCond(Exprs.PreCond);
1726
6.90k
  Dir->setCond(Exprs.Cond);
1727
6.90k
  Dir->setInit(Exprs.Init);
1728
6.90k
  Dir->setInc(Exprs.Inc);
1729
6.90k
  Dir->setIsLastIterVariable(Exprs.IL);
1730
6.90k
  Dir->setLowerBoundVariable(Exprs.LB);
1731
6.90k
  Dir->setUpperBoundVariable(Exprs.UB);
1732
6.90k
  Dir->setStrideVariable(Exprs.ST);
1733
6.90k
  Dir->setEnsureUpperBound(Exprs.EUB);
1734
6.90k
  Dir->setNextLowerBound(Exprs.NLB);
1735
6.90k
  Dir->setNextUpperBound(Exprs.NUB);
1736
6.90k
  Dir->setNumIterations(Exprs.NumIterations);
1737
6.90k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1738
6.90k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1739
6.90k
  Dir->setDistInc(Exprs.DistInc);
1740
6.90k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1741
6.90k
  Dir->setCounters(Exprs.Counters);
1742
6.90k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1743
6.90k
  Dir->setInits(Exprs.Inits);
1744
6.90k
  Dir->setUpdates(Exprs.Updates);
1745
6.90k
  Dir->setFinals(Exprs.Finals);
1746
6.90k
  Dir->setDependentCounters(Exprs.DependentCounters);
1747
6.90k
  Dir->setDependentInits(Exprs.DependentInits);
1748
6.90k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1749
6.90k
  Dir->setPreInits(Exprs.PreInits);
1750
6.90k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1751
6.90k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1752
6.90k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1753
6.90k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1754
6.90k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1755
6.90k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1756
6.90k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1757
6.90k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1758
6.90k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1759
6.90k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1760
6.90k
  Dir->HasCancel = HasCancel;
1761
6.90k
  return Dir;
1762
6.90k
}
1763
1764
OMPTargetTeamsDistributeParallelForDirective *
1765
OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1766
                                                          unsigned NumClauses,
1767
                                                          unsigned CollapsedNum,
1768
357
                                                          EmptyShell) {
1769
357
  return createEmptyDirective<OMPTargetTeamsDistributeParallelForDirective>(
1770
357
      C, NumClauses, /*HasAssociatedStmt=*/true,
1771
357
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
1772
357
          1,
1773
357
      CollapsedNum);
1774
357
}
1775
1776
OMPTargetTeamsDistributeParallelForSimdDirective *
1777
OMPTargetTeamsDistributeParallelForSimdDirective::Create(
1778
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1779
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1780
8.74k
    const HelperExprs &Exprs) {
1781
8.74k
  auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
1782
8.74k
      C, Clauses, AssociatedStmt,
1783
8.74k
      numLoopChildren(CollapsedNum,
1784
8.74k
                      OMPD_target_teams_distribute_parallel_for_simd),
1785
8.74k
      StartLoc, EndLoc, CollapsedNum);
1786
8.74k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1787
8.74k
  Dir->setLastIteration(Exprs.LastIteration);
1788
8.74k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1789
8.74k
  Dir->setPreCond(Exprs.PreCond);
1790
8.74k
  Dir->setCond(Exprs.Cond);
1791
8.74k
  Dir->setInit(Exprs.Init);
1792
8.74k
  Dir->setInc(Exprs.Inc);
1793
8.74k
  Dir->setIsLastIterVariable(Exprs.IL);
1794
8.74k
  Dir->setLowerBoundVariable(Exprs.LB);
1795
8.74k
  Dir->setUpperBoundVariable(Exprs.UB);
1796
8.74k
  Dir->setStrideVariable(Exprs.ST);
1797
8.74k
  Dir->setEnsureUpperBound(Exprs.EUB);
1798
8.74k
  Dir->setNextLowerBound(Exprs.NLB);
1799
8.74k
  Dir->setNextUpperBound(Exprs.NUB);
1800
8.74k
  Dir->setNumIterations(Exprs.NumIterations);
1801
8.74k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1802
8.74k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1803
8.74k
  Dir->setDistInc(Exprs.DistInc);
1804
8.74k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1805
8.74k
  Dir->setCounters(Exprs.Counters);
1806
8.74k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1807
8.74k
  Dir->setInits(Exprs.Inits);
1808
8.74k
  Dir->setUpdates(Exprs.Updates);
1809
8.74k
  Dir->setFinals(Exprs.Finals);
1810
8.74k
  Dir->setDependentCounters(Exprs.DependentCounters);
1811
8.74k
  Dir->setDependentInits(Exprs.DependentInits);
1812
8.74k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1813
8.74k
  Dir->setPreInits(Exprs.PreInits);
1814
8.74k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1815
8.74k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1816
8.74k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1817
8.74k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1818
8.74k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1819
8.74k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1820
8.74k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1821
8.74k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1822
8.74k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1823
8.74k
  return Dir;
1824
8.74k
}
1825
1826
OMPTargetTeamsDistributeParallelForSimdDirective *
1827
OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
1828
    const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1829
533
    EmptyShell) {
1830
533
  return createEmptyDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
1831
533
      C, NumClauses, /*HasAssociatedStmt=*/true,
1832
533
      numLoopChildren(CollapsedNum,
1833
533
                      OMPD_target_teams_distribute_parallel_for_simd),
1834
533
      CollapsedNum);
1835
533
}
1836
1837
OMPTargetTeamsDistributeSimdDirective *
1838
OMPTargetTeamsDistributeSimdDirective::Create(
1839
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1840
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1841
8.30k
    const HelperExprs &Exprs) {
1842
8.30k
  auto *Dir = createDirective<OMPTargetTeamsDistributeSimdDirective>(
1843
8.30k
      C, Clauses, AssociatedStmt,
1844
8.30k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
1845
8.30k
      StartLoc, EndLoc, CollapsedNum);
1846
8.30k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1847
8.30k
  Dir->setLastIteration(Exprs.LastIteration);
1848
8.30k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1849
8.30k
  Dir->setPreCond(Exprs.PreCond);
1850
8.30k
  Dir->setCond(Exprs.Cond);
1851
8.30k
  Dir->setInit(Exprs.Init);
1852
8.30k
  Dir->setInc(Exprs.Inc);
1853
8.30k
  Dir->setIsLastIterVariable(Exprs.IL);
1854
8.30k
  Dir->setLowerBoundVariable(Exprs.LB);
1855
8.30k
  Dir->setUpperBoundVariable(Exprs.UB);
1856
8.30k
  Dir->setStrideVariable(Exprs.ST);
1857
8.30k
  Dir->setEnsureUpperBound(Exprs.EUB);
1858
8.30k
  Dir->setNextLowerBound(Exprs.NLB);
1859
8.30k
  Dir->setNextUpperBound(Exprs.NUB);
1860
8.30k
  Dir->setNumIterations(Exprs.NumIterations);
1861
8.30k
  Dir->setCounters(Exprs.Counters);
1862
8.30k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1863
8.30k
  Dir->setInits(Exprs.Inits);
1864
8.30k
  Dir->setUpdates(Exprs.Updates);
1865
8.30k
  Dir->setFinals(Exprs.Finals);
1866
8.30k
  Dir->setDependentCounters(Exprs.DependentCounters);
1867
8.30k
  Dir->setDependentInits(Exprs.DependentInits);
1868
8.30k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1869
8.30k
  Dir->setPreInits(Exprs.PreInits);
1870
8.30k
  return Dir;
1871
8.30k
}
1872
1873
OMPTargetTeamsDistributeSimdDirective *
1874
OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1875
                                                   unsigned NumClauses,
1876
                                                   unsigned CollapsedNum,
1877
547
                                                   EmptyShell) {
1878
547
  return createEmptyDirective<OMPTargetTeamsDistributeSimdDirective>(
1879
547
      C, NumClauses, /*HasAssociatedStmt=*/true,
1880
547
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
1881
547
      CollapsedNum);
1882
547
}