Coverage Report

Created: 2021-01-19 06:58

/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
304k
                         unsigned NumChildren) {
21
304k
  return llvm::alignTo(
22
304k
      totalSizeToAlloc<OMPClause *, Stmt *>(
23
297k
          NumClauses, NumChildren + (HasAssociatedStmt ? 1 : 
06.52k
)),
24
304k
      alignof(OMPChildren));
25
304k
}
26
27
307k
void OMPChildren::setClauses(ArrayRef<OMPClause *> Clauses) {
28
307k
  assert(Clauses.size() == NumClauses &&
29
307k
         "Number of clauses is not the same as the preallocated buffer");
30
307k
  llvm::copy(Clauses, getTrailingObjects<OMPClause *>());
31
307k
}
32
33
4.50M
MutableArrayRef<Stmt *> OMPChildren::getChildren() {
34
4.50M
  return llvm::makeMutableArrayRef(getTrailingObjects<Stmt *>(), NumChildren);
35
4.50M
}
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
287k
                                 Stmt *S, unsigned NumChildren) {
45
287k
  auto *Data = CreateEmpty(Mem, Clauses.size(), S, NumChildren);
46
287k
  Data->setClauses(Clauses);
47
287k
  if (S)
48
281k
    Data->setAssociatedStmt(S);
49
287k
  return Data;
50
287k
}
51
52
OMPChildren *OMPChildren::CreateEmpty(void *Mem, unsigned NumClauses,
53
                                      bool HasAssociatedStmt,
54
304k
                                      unsigned NumChildren) {
55
304k
  return new (Mem) OMPChildren(NumClauses, NumChildren, HasAssociatedStmt);
56
304k
}
57
58
33.6k
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
33.6k
  if (isa<OMPTargetEnterDataDirective>(this) ||
63
33.2k
      isa<OMPTargetExitDataDirective>(this) ||
64
32.8k
      isa<OMPTargetUpdateDirective>(this))
65
1.23k
    return true;
66
32.4k
  return !hasAssociatedStmt();
67
32.4k
}
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
170k
                                               bool TryImperfectlyNestedLoops) {
79
170k
  Stmt *OrigStmt = CurStmt;
80
170k
  CurStmt = CurStmt->IgnoreContainers();
81
  // Additional work for imperfectly nested loops, introduced in OpenMP 5.0.
82
170k
  if (TryImperfectlyNestedLoops) {
83
118k
    if (auto *CS = dyn_cast<CompoundStmt>(CurStmt)) {
84
8.92k
      CurStmt = nullptr;
85
8.92k
      SmallVector<CompoundStmt *, 4> Statements(1, CS);
86
8.92k
      SmallVector<CompoundStmt *, 4> NextStatements;
87
17.7k
      while (!Statements.empty()) {
88
8.94k
        CS = Statements.pop_back_val();
89
8.94k
        if (!CS)
90
0
          continue;
91
11.8k
        
for (Stmt *S : CS->body())8.94k
{
92
11.8k
          if (!S)
93
0
            continue;
94
11.8k
          if (isa<ForStmt>(S) || 
isa<CXXForRangeStmt>(S)11.6k
) {
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.6k
          S = S->IgnoreContainers();
104
11.6k
          if (auto *InnerCS = dyn_cast_or_null<CompoundStmt>(S))
105
18
            NextStatements.push_back(InnerCS);
106
11.6k
        }
107
8.94k
        if (Statements.empty()) {
108
          // Found single inner loop or multiple loops - exit.
109
8.93k
          if (CurStmt)
110
144
            break;
111
8.79k
          Statements.swap(NextStatements);
112
8.79k
        }
113
8.94k
      }
114
8.92k
      if (!CurStmt)
115
8.78k
        CurStmt = OrigStmt;
116
8.92k
    }
117
118k
  }
118
170k
  return CurStmt;
119
170k
}
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
138k
void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
145
138k
  assert(A.size() == getCollapsedNumber() &&
146
138k
         "Number of loop counters is not the same as the collapsed number");
147
138k
  llvm::copy(A, getCounters().begin());
148
138k
}
149
150
138k
void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
151
138k
  assert(A.size() == getCollapsedNumber() && "Number of loop private counters "
152
138k
                                             "is not the same as the collapsed "
153
138k
                                             "number");
154
138k
  llvm::copy(A, getPrivateCounters().begin());
155
138k
}
156
157
138k
void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
158
138k
  assert(A.size() == getCollapsedNumber() &&
159
138k
         "Number of counter inits is not the same as the collapsed number");
160
138k
  llvm::copy(A, getInits().begin());
161
138k
}
162
163
138k
void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
164
138k
  assert(A.size() == getCollapsedNumber() &&
165
138k
         "Number of counter updates is not the same as the collapsed number");
166
138k
  llvm::copy(A, getUpdates().begin());
167
138k
}
168
169
138k
void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
170
138k
  assert(A.size() == getCollapsedNumber() &&
171
138k
         "Number of counter finals is not the same as the collapsed number");
172
138k
  llvm::copy(A, getFinals().begin());
173
138k
}
174
175
138k
void OMPLoopDirective::setDependentCounters(ArrayRef<Expr *> A) {
176
138k
  assert(
177
138k
      A.size() == getCollapsedNumber() &&
178
138k
      "Number of dependent counters is not the same as the collapsed number");
179
138k
  llvm::copy(A, getDependentCounters().begin());
180
138k
}
181
182
138k
void OMPLoopDirective::setDependentInits(ArrayRef<Expr *> A) {
183
138k
  assert(A.size() == getCollapsedNumber() &&
184
138k
         "Number of dependent inits is not the same as the collapsed number");
185
138k
  llvm::copy(A, getDependentInits().begin());
186
138k
}
187
188
138k
void OMPLoopDirective::setFinalsConditions(ArrayRef<Expr *> A) {
189
138k
  assert(A.size() == getCollapsedNumber() &&
190
138k
         "Number of finals conditions is not the same as the collapsed number");
191
138k
  llvm::copy(A, getFinalsConditions().begin());
192
138k
}
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
654
                                                        EmptyShell) {
208
654
  return createEmptyDirective<OMPParallelDirective>(C, NumClauses,
209
654
                                                    /*HasAssociatedStmt=*/true,
210
654
                                                    /*NumChildren=*/1);
211
654
}
212
213
OMPSimdDirective *
214
OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
215
                         SourceLocation EndLoc, unsigned CollapsedNum,
216
                         ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
217
5.70k
                         const HelperExprs &Exprs) {
218
5.70k
  auto *Dir = createDirective<OMPSimdDirective>(
219
5.70k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_simd),
220
5.70k
      StartLoc, EndLoc, CollapsedNum);
221
5.70k
  Dir->setIterationVariable(Exprs.IterationVarRef);
222
5.70k
  Dir->setLastIteration(Exprs.LastIteration);
223
5.70k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
224
5.70k
  Dir->setPreCond(Exprs.PreCond);
225
5.70k
  Dir->setCond(Exprs.Cond);
226
5.70k
  Dir->setInit(Exprs.Init);
227
5.70k
  Dir->setInc(Exprs.Inc);
228
5.70k
  Dir->setCounters(Exprs.Counters);
229
5.70k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
230
5.70k
  Dir->setInits(Exprs.Inits);
231
5.70k
  Dir->setUpdates(Exprs.Updates);
232
5.70k
  Dir->setFinals(Exprs.Finals);
233
5.70k
  Dir->setDependentCounters(Exprs.DependentCounters);
234
5.70k
  Dir->setDependentInits(Exprs.DependentInits);
235
5.70k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
236
5.70k
  Dir->setPreInits(Exprs.PreInits);
237
5.70k
  return Dir;
238
5.70k
}
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.79k
                                               Stmt *AssociatedStmt) {
381
1.79k
  return createDirective<OMPSingleDirective>(C, Clauses, AssociatedStmt,
382
1.79k
                                             /*NumChildren=*/0, StartLoc,
383
1.79k
                                             EndLoc);
384
1.79k
}
385
386
OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
387
                                                    unsigned NumClauses,
388
45
                                                    EmptyShell) {
389
45
  return createEmptyDirective<OMPSingleDirective>(C, NumClauses,
390
45
                                                  /*HasAssociatedStmt=*/true);
391
45
}
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.41k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
428
4.41k
  auto *Dir = createDirective<OMPParallelForDirective>(
429
4.41k
      C, Clauses, AssociatedStmt,
430
4.41k
      numLoopChildren(CollapsedNum, OMPD_parallel_for) + 1, StartLoc, EndLoc,
431
4.41k
      CollapsedNum);
432
4.41k
  Dir->setIterationVariable(Exprs.IterationVarRef);
433
4.41k
  Dir->setLastIteration(Exprs.LastIteration);
434
4.41k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
435
4.41k
  Dir->setPreCond(Exprs.PreCond);
436
4.41k
  Dir->setCond(Exprs.Cond);
437
4.41k
  Dir->setInit(Exprs.Init);
438
4.41k
  Dir->setInc(Exprs.Inc);
439
4.41k
  Dir->setIsLastIterVariable(Exprs.IL);
440
4.41k
  Dir->setLowerBoundVariable(Exprs.LB);
441
4.41k
  Dir->setUpperBoundVariable(Exprs.UB);
442
4.41k
  Dir->setStrideVariable(Exprs.ST);
443
4.41k
  Dir->setEnsureUpperBound(Exprs.EUB);
444
4.41k
  Dir->setNextLowerBound(Exprs.NLB);
445
4.41k
  Dir->setNextUpperBound(Exprs.NUB);
446
4.41k
  Dir->setNumIterations(Exprs.NumIterations);
447
4.41k
  Dir->setCounters(Exprs.Counters);
448
4.41k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
449
4.41k
  Dir->setInits(Exprs.Inits);
450
4.41k
  Dir->setUpdates(Exprs.Updates);
451
4.41k
  Dir->setFinals(Exprs.Finals);
452
4.41k
  Dir->setDependentCounters(Exprs.DependentCounters);
453
4.41k
  Dir->setDependentInits(Exprs.DependentInits);
454
4.41k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
455
4.41k
  Dir->setPreInits(Exprs.PreInits);
456
4.41k
  Dir->setTaskReductionRefExpr(TaskRedRef);
457
4.41k
  Dir->setHasCancel(HasCancel);
458
4.41k
  return Dir;
459
4.41k
}
460
461
OMPParallelForDirective *
462
OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
463
95
                                     unsigned CollapsedNum, EmptyShell) {
464
95
  return createEmptyDirective<OMPParallelForDirective>(
465
95
      C, NumClauses, /*HasAssociatedStmt=*/true,
466
95
      numLoopChildren(CollapsedNum, OMPD_parallel_for) + 1, CollapsedNum);
467
95
}
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.59k
                         Stmt *AssociatedStmt, bool HasCancel) {
551
3.59k
  auto *Dir = createDirective<OMPTaskDirective>(
552
3.59k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
553
3.59k
  Dir->setHasCancel(HasCancel);
554
3.59k
  return Dir;
555
3.59k
}
556
557
OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
558
                                                unsigned NumClauses,
559
185
                                                EmptyShell) {
560
185
  return createEmptyDirective<OMPTaskDirective>(C, NumClauses,
561
185
                                                /*HasAssociatedStmt=*/true);
562
185
}
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
586
                                                    EmptyShell) {
724
586
  return createEmptyDirective<OMPAtomicDirective>(
725
586
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/4);
726
586
}
727
728
OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
729
                                               SourceLocation StartLoc,
730
                                               SourceLocation EndLoc,
731
                                               ArrayRef<OMPClause *> Clauses,
732
49.9k
                                               Stmt *AssociatedStmt) {
733
49.9k
  return createDirective<OMPTargetDirective>(
734
49.9k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
735
49.9k
}
736
737
OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
738
                                                    unsigned NumClauses,
739
4.52k
                                                    EmptyShell) {
740
4.52k
  return createEmptyDirective<OMPTargetDirective>(C, NumClauses,
741
4.52k
                                                  /*HasAssociatedStmt=*/true);
742
4.52k
}
743
744
OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
745
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
746
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
747
7.43k
    bool HasCancel) {
748
7.43k
  auto *Dir = createDirective<OMPTargetParallelDirective>(
749
7.43k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
750
7.43k
  Dir->setTaskReductionRefExpr(TaskRedRef);
751
7.43k
  Dir->setHasCancel(HasCancel);
752
7.43k
  return Dir;
753
7.43k
}
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.45k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
766
7.45k
  auto *Dir = createDirective<OMPTargetParallelForDirective>(
767
7.45k
      C, Clauses, AssociatedStmt,
768
7.45k
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1, StartLoc,
769
7.45k
      EndLoc, CollapsedNum);
770
7.45k
  Dir->setIterationVariable(Exprs.IterationVarRef);
771
7.45k
  Dir->setLastIteration(Exprs.LastIteration);
772
7.45k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
773
7.45k
  Dir->setPreCond(Exprs.PreCond);
774
7.45k
  Dir->setCond(Exprs.Cond);
775
7.45k
  Dir->setInit(Exprs.Init);
776
7.45k
  Dir->setInc(Exprs.Inc);
777
7.45k
  Dir->setIsLastIterVariable(Exprs.IL);
778
7.45k
  Dir->setLowerBoundVariable(Exprs.LB);
779
7.45k
  Dir->setUpperBoundVariable(Exprs.UB);
780
7.45k
  Dir->setStrideVariable(Exprs.ST);
781
7.45k
  Dir->setEnsureUpperBound(Exprs.EUB);
782
7.45k
  Dir->setNextLowerBound(Exprs.NLB);
783
7.45k
  Dir->setNextUpperBound(Exprs.NUB);
784
7.45k
  Dir->setNumIterations(Exprs.NumIterations);
785
7.45k
  Dir->setCounters(Exprs.Counters);
786
7.45k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
787
7.45k
  Dir->setInits(Exprs.Inits);
788
7.45k
  Dir->setUpdates(Exprs.Updates);
789
7.45k
  Dir->setFinals(Exprs.Finals);
790
7.45k
  Dir->setDependentCounters(Exprs.DependentCounters);
791
7.45k
  Dir->setDependentInits(Exprs.DependentInits);
792
7.45k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
793
7.45k
  Dir->setPreInits(Exprs.PreInits);
794
7.45k
  Dir->setTaskReductionRefExpr(TaskRedRef);
795
7.45k
  Dir->setHasCancel(HasCancel);
796
7.45k
  return Dir;
797
7.45k
}
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.90k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
812
3.90k
  return createDirective<OMPTargetDataDirective>(
813
3.90k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
814
3.90k
}
815
816
OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
817
                                                            unsigned N,
818
242
                                                            EmptyShell) {
819
242
  return createEmptyDirective<OMPTargetDataDirective>(
820
242
      C, N, /*HasAssociatedStmt=*/true);
821
242
}
822
823
OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
824
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
825
1.73k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
826
1.73k
  return createDirective<OMPTargetEnterDataDirective>(
827
1.73k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
828
1.73k
}
829
830
OMPTargetEnterDataDirective *
831
OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
832
289
                                         EmptyShell) {
833
289
  return createEmptyDirective<OMPTargetEnterDataDirective>(
834
289
      C, N, /*HasAssociatedStmt=*/true);
835
289
}
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.3k
                                             Stmt *AssociatedStmt) {
856
18.3k
  return createDirective<OMPTeamsDirective>(
857
18.3k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
858
18.3k
}
859
860
OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
861
                                                  unsigned NumClauses,
862
952
                                                  EmptyShell) {
863
952
  return createEmptyDirective<OMPTeamsDirective>(C, NumClauses,
864
952
                                                 /*HasAssociatedStmt=*/true);
865
952
}
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
36
                                                        EmptyShell) {
906
36
  return createEmptyDirective<OMPTaskLoopDirective>(
907
36
      C, NumClauses, /*HasAssociatedStmt=*/true,
908
36
      numLoopChildren(CollapsedNum, OMPD_taskloop), CollapsedNum);
909
36
}
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.27k
    const HelperExprs &Exprs) {
1003
4.27k
  auto *Dir = createDirective<OMPMasterTaskLoopSimdDirective>(
1004
4.27k
      C, Clauses, AssociatedStmt,
1005
4.27k
      numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), StartLoc,
1006
4.27k
      EndLoc, CollapsedNum);
1007
4.27k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1008
4.27k
  Dir->setLastIteration(Exprs.LastIteration);
1009
4.27k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1010
4.27k
  Dir->setPreCond(Exprs.PreCond);
1011
4.27k
  Dir->setCond(Exprs.Cond);
1012
4.27k
  Dir->setInit(Exprs.Init);
1013
4.27k
  Dir->setInc(Exprs.Inc);
1014
4.27k
  Dir->setIsLastIterVariable(Exprs.IL);
1015
4.27k
  Dir->setLowerBoundVariable(Exprs.LB);
1016
4.27k
  Dir->setUpperBoundVariable(Exprs.UB);
1017
4.27k
  Dir->setStrideVariable(Exprs.ST);
1018
4.27k
  Dir->setEnsureUpperBound(Exprs.EUB);
1019
4.27k
  Dir->setNextLowerBound(Exprs.NLB);
1020
4.27k
  Dir->setNextUpperBound(Exprs.NUB);
1021
4.27k
  Dir->setNumIterations(Exprs.NumIterations);
1022
4.27k
  Dir->setCounters(Exprs.Counters);
1023
4.27k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1024
4.27k
  Dir->setInits(Exprs.Inits);
1025
4.27k
  Dir->setUpdates(Exprs.Updates);
1026
4.27k
  Dir->setFinals(Exprs.Finals);
1027
4.27k
  Dir->setDependentCounters(Exprs.DependentCounters);
1028
4.27k
  Dir->setDependentInits(Exprs.DependentInits);
1029
4.27k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1030
4.27k
  Dir->setPreInits(Exprs.PreInits);
1031
4.27k
  return Dir;
1032
4.27k
}
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
3.52k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1183
3.52k
  return createDirective<OMPTargetUpdateDirective>(C, Clauses, AssociatedStmt,
1184
3.52k
                                                   /*NumChildren=*/0, StartLoc,
1185
3.52k
                                                   EndLoc);
1186
3.52k
}
1187
1188
OMPTargetUpdateDirective *
1189
OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1190
404
                                      EmptyShell) {
1191
404
  return createEmptyDirective<OMPTargetUpdateDirective>(
1192
404
      C, NumClauses, /*HasAssociatedStmt=*/true);
1193
404
}
1194
1195
OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1196
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1197
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1198
4.82k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1199
4.82k
  auto *Dir = createDirective<OMPDistributeParallelForDirective>(
1200
4.82k
      C, Clauses, AssociatedStmt,
1201
4.82k
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1, StartLoc,
1202
4.82k
      EndLoc, CollapsedNum);
1203
4.82k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1204
4.82k
  Dir->setLastIteration(Exprs.LastIteration);
1205
4.82k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1206
4.82k
  Dir->setPreCond(Exprs.PreCond);
1207
4.82k
  Dir->setCond(Exprs.Cond);
1208
4.82k
  Dir->setInit(Exprs.Init);
1209
4.82k
  Dir->setInc(Exprs.Inc);
1210
4.82k
  Dir->setIsLastIterVariable(Exprs.IL);
1211
4.82k
  Dir->setLowerBoundVariable(Exprs.LB);
1212
4.82k
  Dir->setUpperBoundVariable(Exprs.UB);
1213
4.82k
  Dir->setStrideVariable(Exprs.ST);
1214
4.82k
  Dir->setEnsureUpperBound(Exprs.EUB);
1215
4.82k
  Dir->setNextLowerBound(Exprs.NLB);
1216
4.82k
  Dir->setNextUpperBound(Exprs.NUB);
1217
4.82k
  Dir->setNumIterations(Exprs.NumIterations);
1218
4.82k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1219
4.82k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1220
4.82k
  Dir->setDistInc(Exprs.DistInc);
1221
4.82k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1222
4.82k
  Dir->setCounters(Exprs.Counters);
1223
4.82k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1224
4.82k
  Dir->setInits(Exprs.Inits);
1225
4.82k
  Dir->setUpdates(Exprs.Updates);
1226
4.82k
  Dir->setFinals(Exprs.Finals);
1227
4.82k
  Dir->setDependentCounters(Exprs.DependentCounters);
1228
4.82k
  Dir->setDependentInits(Exprs.DependentInits);
1229
4.82k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1230
4.82k
  Dir->setPreInits(Exprs.PreInits);
1231
4.82k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1232
4.82k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1233
4.82k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1234
4.82k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1235
4.82k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1236
4.82k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1237
4.82k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1238
4.82k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1239
4.82k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1240
4.82k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1241
4.82k
  Dir->HasCancel = HasCancel;
1242
4.82k
  return Dir;
1243
4.82k
}
1244
1245
OMPDistributeParallelForDirective *
1246
OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1247
                                               unsigned NumClauses,
1248
                                               unsigned CollapsedNum,
1249
280
                                               EmptyShell) {
1250
280
  return createEmptyDirective<OMPDistributeParallelForDirective>(
1251
280
      C, NumClauses, /*HasAssociatedStmt=*/true,
1252
280
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1,
1253
280
      CollapsedNum);
1254
280
}
1255
1256
OMPDistributeParallelForSimdDirective *
1257
OMPDistributeParallelForSimdDirective::Create(
1258
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1259
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1260
5.75k
    const HelperExprs &Exprs) {
1261
5.75k
  auto *Dir = createDirective<OMPDistributeParallelForSimdDirective>(
1262
5.75k
      C, Clauses, AssociatedStmt,
1263
5.75k
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1264
5.75k
      StartLoc, EndLoc, CollapsedNum);
1265
5.75k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1266
5.75k
  Dir->setLastIteration(Exprs.LastIteration);
1267
5.75k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1268
5.75k
  Dir->setPreCond(Exprs.PreCond);
1269
5.75k
  Dir->setCond(Exprs.Cond);
1270
5.75k
  Dir->setInit(Exprs.Init);
1271
5.75k
  Dir->setInc(Exprs.Inc);
1272
5.75k
  Dir->setIsLastIterVariable(Exprs.IL);
1273
5.75k
  Dir->setLowerBoundVariable(Exprs.LB);
1274
5.75k
  Dir->setUpperBoundVariable(Exprs.UB);
1275
5.75k
  Dir->setStrideVariable(Exprs.ST);
1276
5.75k
  Dir->setEnsureUpperBound(Exprs.EUB);
1277
5.75k
  Dir->setNextLowerBound(Exprs.NLB);
1278
5.75k
  Dir->setNextUpperBound(Exprs.NUB);
1279
5.75k
  Dir->setNumIterations(Exprs.NumIterations);
1280
5.75k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1281
5.75k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1282
5.75k
  Dir->setDistInc(Exprs.DistInc);
1283
5.75k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1284
5.75k
  Dir->setCounters(Exprs.Counters);
1285
5.75k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1286
5.75k
  Dir->setInits(Exprs.Inits);
1287
5.75k
  Dir->setUpdates(Exprs.Updates);
1288
5.75k
  Dir->setFinals(Exprs.Finals);
1289
5.75k
  Dir->setDependentCounters(Exprs.DependentCounters);
1290
5.75k
  Dir->setDependentInits(Exprs.DependentInits);
1291
5.75k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1292
5.75k
  Dir->setPreInits(Exprs.PreInits);
1293
5.75k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1294
5.75k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1295
5.75k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1296
5.75k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1297
5.75k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1298
5.75k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1299
5.75k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1300
5.75k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1301
5.75k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1302
5.75k
  return Dir;
1303
5.75k
}
1304
1305
OMPDistributeParallelForSimdDirective *
1306
OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1307
                                                   unsigned NumClauses,
1308
                                                   unsigned CollapsedNum,
1309
258
                                                   EmptyShell) {
1310
258
  return createEmptyDirective<OMPDistributeParallelForSimdDirective>(
1311
258
      C, NumClauses, /*HasAssociatedStmt=*/true,
1312
258
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1313
258
      CollapsedNum);
1314
258
}
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.55k
    const HelperExprs &Exprs) {
1364
7.55k
  auto *Dir = createDirective<OMPTargetParallelForSimdDirective>(
1365
7.55k
      C, Clauses, AssociatedStmt,
1366
7.55k
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd), StartLoc,
1367
7.55k
      EndLoc, CollapsedNum);
1368
7.55k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1369
7.55k
  Dir->setLastIteration(Exprs.LastIteration);
1370
7.55k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1371
7.55k
  Dir->setPreCond(Exprs.PreCond);
1372
7.55k
  Dir->setCond(Exprs.Cond);
1373
7.55k
  Dir->setInit(Exprs.Init);
1374
7.55k
  Dir->setInc(Exprs.Inc);
1375
7.55k
  Dir->setIsLastIterVariable(Exprs.IL);
1376
7.55k
  Dir->setLowerBoundVariable(Exprs.LB);
1377
7.55k
  Dir->setUpperBoundVariable(Exprs.UB);
1378
7.55k
  Dir->setStrideVariable(Exprs.ST);
1379
7.55k
  Dir->setEnsureUpperBound(Exprs.EUB);
1380
7.55k
  Dir->setNextLowerBound(Exprs.NLB);
1381
7.55k
  Dir->setNextUpperBound(Exprs.NUB);
1382
7.55k
  Dir->setNumIterations(Exprs.NumIterations);
1383
7.55k
  Dir->setCounters(Exprs.Counters);
1384
7.55k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1385
7.55k
  Dir->setInits(Exprs.Inits);
1386
7.55k
  Dir->setUpdates(Exprs.Updates);
1387
7.55k
  Dir->setFinals(Exprs.Finals);
1388
7.55k
  Dir->setDependentCounters(Exprs.DependentCounters);
1389
7.55k
  Dir->setDependentInits(Exprs.DependentInits);
1390
7.55k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1391
7.55k
  Dir->setPreInits(Exprs.PreInits);
1392
7.55k
  return Dir;
1393
7.55k
}
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.69k
                               Stmt *AssociatedStmt, const HelperExprs &Exprs) {
1411
7.69k
  auto *Dir = createDirective<OMPTargetSimdDirective>(
1412
7.69k
      C, Clauses, AssociatedStmt,
1413
7.69k
      numLoopChildren(CollapsedNum, OMPD_target_simd), StartLoc, EndLoc,
1414
7.69k
      CollapsedNum);
1415
7.69k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1416
7.69k
  Dir->setLastIteration(Exprs.LastIteration);
1417
7.69k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1418
7.69k
  Dir->setPreCond(Exprs.PreCond);
1419
7.69k
  Dir->setCond(Exprs.Cond);
1420
7.69k
  Dir->setInit(Exprs.Init);
1421
7.69k
  Dir->setInc(Exprs.Inc);
1422
7.69k
  Dir->setCounters(Exprs.Counters);
1423
7.69k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1424
7.69k
  Dir->setInits(Exprs.Inits);
1425
7.69k
  Dir->setUpdates(Exprs.Updates);
1426
7.69k
  Dir->setFinals(Exprs.Finals);
1427
7.69k
  Dir->setDependentCounters(Exprs.DependentCounters);
1428
7.69k
  Dir->setDependentInits(Exprs.DependentInits);
1429
7.69k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1430
7.69k
  Dir->setPreInits(Exprs.PreInits);
1431
7.69k
  return Dir;
1432
7.69k
}
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.27k
    const HelperExprs &Exprs) {
1534
5.27k
  auto *Dir = createDirective<OMPTeamsDistributeParallelForSimdDirective>(
1535
5.27k
      C, Clauses, AssociatedStmt,
1536
5.27k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
1537
5.27k
      StartLoc, EndLoc, CollapsedNum);
1538
5.27k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1539
5.27k
  Dir->setLastIteration(Exprs.LastIteration);
1540
5.27k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1541
5.27k
  Dir->setPreCond(Exprs.PreCond);
1542
5.27k
  Dir->setCond(Exprs.Cond);
1543
5.27k
  Dir->setInit(Exprs.Init);
1544
5.27k
  Dir->setInc(Exprs.Inc);
1545
5.27k
  Dir->setIsLastIterVariable(Exprs.IL);
1546
5.27k
  Dir->setLowerBoundVariable(Exprs.LB);
1547
5.27k
  Dir->setUpperBoundVariable(Exprs.UB);
1548
5.27k
  Dir->setStrideVariable(Exprs.ST);
1549
5.27k
  Dir->setEnsureUpperBound(Exprs.EUB);
1550
5.27k
  Dir->setNextLowerBound(Exprs.NLB);
1551
5.27k
  Dir->setNextUpperBound(Exprs.NUB);
1552
5.27k
  Dir->setNumIterations(Exprs.NumIterations);
1553
5.27k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1554
5.27k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1555
5.27k
  Dir->setDistInc(Exprs.DistInc);
1556
5.27k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1557
5.27k
  Dir->setCounters(Exprs.Counters);
1558
5.27k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1559
5.27k
  Dir->setInits(Exprs.Inits);
1560
5.27k
  Dir->setUpdates(Exprs.Updates);
1561
5.27k
  Dir->setFinals(Exprs.Finals);
1562
5.27k
  Dir->setDependentCounters(Exprs.DependentCounters);
1563
5.27k
  Dir->setDependentInits(Exprs.DependentInits);
1564
5.27k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1565
5.27k
  Dir->setPreInits(Exprs.PreInits);
1566
5.27k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1567
5.27k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1568
5.27k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1569
5.27k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1570
5.27k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1571
5.27k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1572
5.27k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1573
5.27k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1574
5.27k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1575
5.27k
  return Dir;
1576
5.27k
}
1577
1578
OMPTeamsDistributeParallelForSimdDirective *
1579
OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1580
                                                        unsigned NumClauses,
1581
                                                        unsigned CollapsedNum,
1582
370
                                                        EmptyShell) {
1583
370
  return createEmptyDirective<OMPTeamsDistributeParallelForSimdDirective>(
1584
370
      C, NumClauses, /*HasAssociatedStmt=*/true,
1585
370
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
1586
370
      CollapsedNum);
1587
370
}
1588
1589
OMPTeamsDistributeParallelForDirective *
1590
OMPTeamsDistributeParallelForDirective::Create(
1591
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1592
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1593
4.52k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1594
4.52k
  auto *Dir = createDirective<OMPTeamsDistributeParallelForDirective>(
1595
4.52k
      C, Clauses, AssociatedStmt,
1596
4.52k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
1597
4.52k
      StartLoc, EndLoc, CollapsedNum);
1598
4.52k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1599
4.52k
  Dir->setLastIteration(Exprs.LastIteration);
1600
4.52k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1601
4.52k
  Dir->setPreCond(Exprs.PreCond);
1602
4.52k
  Dir->setCond(Exprs.Cond);
1603
4.52k
  Dir->setInit(Exprs.Init);
1604
4.52k
  Dir->setInc(Exprs.Inc);
1605
4.52k
  Dir->setIsLastIterVariable(Exprs.IL);
1606
4.52k
  Dir->setLowerBoundVariable(Exprs.LB);
1607
4.52k
  Dir->setUpperBoundVariable(Exprs.UB);
1608
4.52k
  Dir->setStrideVariable(Exprs.ST);
1609
4.52k
  Dir->setEnsureUpperBound(Exprs.EUB);
1610
4.52k
  Dir->setNextLowerBound(Exprs.NLB);
1611
4.52k
  Dir->setNextUpperBound(Exprs.NUB);
1612
4.52k
  Dir->setNumIterations(Exprs.NumIterations);
1613
4.52k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1614
4.52k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1615
4.52k
  Dir->setDistInc(Exprs.DistInc);
1616
4.52k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1617
4.52k
  Dir->setCounters(Exprs.Counters);
1618
4.52k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1619
4.52k
  Dir->setInits(Exprs.Inits);
1620
4.52k
  Dir->setUpdates(Exprs.Updates);
1621
4.52k
  Dir->setFinals(Exprs.Finals);
1622
4.52k
  Dir->setDependentCounters(Exprs.DependentCounters);
1623
4.52k
  Dir->setDependentInits(Exprs.DependentInits);
1624
4.52k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1625
4.52k
  Dir->setPreInits(Exprs.PreInits);
1626
4.52k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1627
4.52k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1628
4.52k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1629
4.52k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1630
4.52k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1631
4.52k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1632
4.52k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1633
4.52k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1634
4.52k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1635
4.52k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1636
4.52k
  Dir->HasCancel = HasCancel;
1637
4.52k
  return Dir;
1638
4.52k
}
1639
1640
OMPTeamsDistributeParallelForDirective *
1641
OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1642
                                                    unsigned NumClauses,
1643
                                                    unsigned CollapsedNum,
1644
334
                                                    EmptyShell) {
1645
334
  return createEmptyDirective<OMPTeamsDistributeParallelForDirective>(
1646
334
      C, NumClauses, /*HasAssociatedStmt=*/true,
1647
334
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
1648
334
      CollapsedNum);
1649
334
}
1650
1651
OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1652
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1653
7.23k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1654
7.23k
  return createDirective<OMPTargetTeamsDirective>(C, Clauses, AssociatedStmt,
1655
7.23k
                                                  /*NumChildren=*/0, StartLoc,
1656
7.23k
                                                  EndLoc);
1657
7.23k
}
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.57k
    const HelperExprs &Exprs) {
1670
6.57k
  auto *Dir = createDirective<OMPTargetTeamsDistributeDirective>(
1671
6.57k
      C, Clauses, AssociatedStmt,
1672
6.57k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute), StartLoc,
1673
6.57k
      EndLoc, CollapsedNum);
1674
6.57k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1675
6.57k
  Dir->setLastIteration(Exprs.LastIteration);
1676
6.57k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1677
6.57k
  Dir->setPreCond(Exprs.PreCond);
1678
6.57k
  Dir->setCond(Exprs.Cond);
1679
6.57k
  Dir->setInit(Exprs.Init);
1680
6.57k
  Dir->setInc(Exprs.Inc);
1681
6.57k
  Dir->setIsLastIterVariable(Exprs.IL);
1682
6.57k
  Dir->setLowerBoundVariable(Exprs.LB);
1683
6.57k
  Dir->setUpperBoundVariable(Exprs.UB);
1684
6.57k
  Dir->setStrideVariable(Exprs.ST);
1685
6.57k
  Dir->setEnsureUpperBound(Exprs.EUB);
1686
6.57k
  Dir->setNextLowerBound(Exprs.NLB);
1687
6.57k
  Dir->setNextUpperBound(Exprs.NUB);
1688
6.57k
  Dir->setNumIterations(Exprs.NumIterations);
1689
6.57k
  Dir->setCounters(Exprs.Counters);
1690
6.57k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1691
6.57k
  Dir->setInits(Exprs.Inits);
1692
6.57k
  Dir->setUpdates(Exprs.Updates);
1693
6.57k
  Dir->setFinals(Exprs.Finals);
1694
6.57k
  Dir->setDependentCounters(Exprs.DependentCounters);
1695
6.57k
  Dir->setDependentInits(Exprs.DependentInits);
1696
6.57k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1697
6.57k
  Dir->setPreInits(Exprs.PreInits);
1698
6.57k
  return Dir;
1699
6.57k
}
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
7.04k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1717
7.04k
  auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForDirective>(
1718
7.04k
      C, Clauses, AssociatedStmt,
1719
7.04k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
1720
7.04k
          1,
1721
7.04k
      StartLoc, EndLoc, CollapsedNum);
1722
7.04k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1723
7.04k
  Dir->setLastIteration(Exprs.LastIteration);
1724
7.04k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1725
7.04k
  Dir->setPreCond(Exprs.PreCond);
1726
7.04k
  Dir->setCond(Exprs.Cond);
1727
7.04k
  Dir->setInit(Exprs.Init);
1728
7.04k
  Dir->setInc(Exprs.Inc);
1729
7.04k
  Dir->setIsLastIterVariable(Exprs.IL);
1730
7.04k
  Dir->setLowerBoundVariable(Exprs.LB);
1731
7.04k
  Dir->setUpperBoundVariable(Exprs.UB);
1732
7.04k
  Dir->setStrideVariable(Exprs.ST);
1733
7.04k
  Dir->setEnsureUpperBound(Exprs.EUB);
1734
7.04k
  Dir->setNextLowerBound(Exprs.NLB);
1735
7.04k
  Dir->setNextUpperBound(Exprs.NUB);
1736
7.04k
  Dir->setNumIterations(Exprs.NumIterations);
1737
7.04k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1738
7.04k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1739
7.04k
  Dir->setDistInc(Exprs.DistInc);
1740
7.04k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1741
7.04k
  Dir->setCounters(Exprs.Counters);
1742
7.04k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1743
7.04k
  Dir->setInits(Exprs.Inits);
1744
7.04k
  Dir->setUpdates(Exprs.Updates);
1745
7.04k
  Dir->setFinals(Exprs.Finals);
1746
7.04k
  Dir->setDependentCounters(Exprs.DependentCounters);
1747
7.04k
  Dir->setDependentInits(Exprs.DependentInits);
1748
7.04k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1749
7.04k
  Dir->setPreInits(Exprs.PreInits);
1750
7.04k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1751
7.04k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1752
7.04k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1753
7.04k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1754
7.04k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1755
7.04k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1756
7.04k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1757
7.04k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1758
7.04k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1759
7.04k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1760
7.04k
  Dir->HasCancel = HasCancel;
1761
7.04k
  return Dir;
1762
7.04k
}
1763
1764
OMPTargetTeamsDistributeParallelForDirective *
1765
OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1766
                                                          unsigned NumClauses,
1767
                                                          unsigned CollapsedNum,
1768
389
                                                          EmptyShell) {
1769
389
  return createEmptyDirective<OMPTargetTeamsDistributeParallelForDirective>(
1770
389
      C, NumClauses, /*HasAssociatedStmt=*/true,
1771
389
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
1772
389
          1,
1773
389
      CollapsedNum);
1774
389
}
1775
1776
OMPTargetTeamsDistributeParallelForSimdDirective *
1777
OMPTargetTeamsDistributeParallelForSimdDirective::Create(
1778
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1779
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1780
8.88k
    const HelperExprs &Exprs) {
1781
8.88k
  auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
1782
8.88k
      C, Clauses, AssociatedStmt,
1783
8.88k
      numLoopChildren(CollapsedNum,
1784
8.88k
                      OMPD_target_teams_distribute_parallel_for_simd),
1785
8.88k
      StartLoc, EndLoc, CollapsedNum);
1786
8.88k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1787
8.88k
  Dir->setLastIteration(Exprs.LastIteration);
1788
8.88k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1789
8.88k
  Dir->setPreCond(Exprs.PreCond);
1790
8.88k
  Dir->setCond(Exprs.Cond);
1791
8.88k
  Dir->setInit(Exprs.Init);
1792
8.88k
  Dir->setInc(Exprs.Inc);
1793
8.88k
  Dir->setIsLastIterVariable(Exprs.IL);
1794
8.88k
  Dir->setLowerBoundVariable(Exprs.LB);
1795
8.88k
  Dir->setUpperBoundVariable(Exprs.UB);
1796
8.88k
  Dir->setStrideVariable(Exprs.ST);
1797
8.88k
  Dir->setEnsureUpperBound(Exprs.EUB);
1798
8.88k
  Dir->setNextLowerBound(Exprs.NLB);
1799
8.88k
  Dir->setNextUpperBound(Exprs.NUB);
1800
8.88k
  Dir->setNumIterations(Exprs.NumIterations);
1801
8.88k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1802
8.88k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1803
8.88k
  Dir->setDistInc(Exprs.DistInc);
1804
8.88k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1805
8.88k
  Dir->setCounters(Exprs.Counters);
1806
8.88k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1807
8.88k
  Dir->setInits(Exprs.Inits);
1808
8.88k
  Dir->setUpdates(Exprs.Updates);
1809
8.88k
  Dir->setFinals(Exprs.Finals);
1810
8.88k
  Dir->setDependentCounters(Exprs.DependentCounters);
1811
8.88k
  Dir->setDependentInits(Exprs.DependentInits);
1812
8.88k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1813
8.88k
  Dir->setPreInits(Exprs.PreInits);
1814
8.88k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1815
8.88k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1816
8.88k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1817
8.88k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1818
8.88k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1819
8.88k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1820
8.88k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1821
8.88k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1822
8.88k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1823
8.88k
  return Dir;
1824
8.88k
}
1825
1826
OMPTargetTeamsDistributeParallelForSimdDirective *
1827
OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
1828
    const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1829
565
    EmptyShell) {
1830
565
  return createEmptyDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
1831
565
      C, NumClauses, /*HasAssociatedStmt=*/true,
1832
565
      numLoopChildren(CollapsedNum,
1833
565
                      OMPD_target_teams_distribute_parallel_for_simd),
1834
565
      CollapsedNum);
1835
565
}
1836
1837
OMPTargetTeamsDistributeSimdDirective *
1838
OMPTargetTeamsDistributeSimdDirective::Create(
1839
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1840
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1841
8.35k
    const HelperExprs &Exprs) {
1842
8.35k
  auto *Dir = createDirective<OMPTargetTeamsDistributeSimdDirective>(
1843
8.35k
      C, Clauses, AssociatedStmt,
1844
8.35k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
1845
8.35k
      StartLoc, EndLoc, CollapsedNum);
1846
8.35k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1847
8.35k
  Dir->setLastIteration(Exprs.LastIteration);
1848
8.35k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1849
8.35k
  Dir->setPreCond(Exprs.PreCond);
1850
8.35k
  Dir->setCond(Exprs.Cond);
1851
8.35k
  Dir->setInit(Exprs.Init);
1852
8.35k
  Dir->setInc(Exprs.Inc);
1853
8.35k
  Dir->setIsLastIterVariable(Exprs.IL);
1854
8.35k
  Dir->setLowerBoundVariable(Exprs.LB);
1855
8.35k
  Dir->setUpperBoundVariable(Exprs.UB);
1856
8.35k
  Dir->setStrideVariable(Exprs.ST);
1857
8.35k
  Dir->setEnsureUpperBound(Exprs.EUB);
1858
8.35k
  Dir->setNextLowerBound(Exprs.NLB);
1859
8.35k
  Dir->setNextUpperBound(Exprs.NUB);
1860
8.35k
  Dir->setNumIterations(Exprs.NumIterations);
1861
8.35k
  Dir->setCounters(Exprs.Counters);
1862
8.35k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1863
8.35k
  Dir->setInits(Exprs.Inits);
1864
8.35k
  Dir->setUpdates(Exprs.Updates);
1865
8.35k
  Dir->setFinals(Exprs.Finals);
1866
8.35k
  Dir->setDependentCounters(Exprs.DependentCounters);
1867
8.35k
  Dir->setDependentInits(Exprs.DependentInits);
1868
8.35k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1869
8.35k
  Dir->setPreInits(Exprs.PreInits);
1870
8.35k
  return Dir;
1871
8.35k
}
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
}