Coverage Report

Created: 2022-07-16 07:03

/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
358k
                         unsigned NumChildren) {
21
358k
  return llvm::alignTo(
22
358k
      totalSizeToAlloc<OMPClause *, Stmt *>(
23
358k
          NumClauses, NumChildren + (HasAssociatedStmt ? 
1350k
:
08.55k
)),
24
358k
      alignof(OMPChildren));
25
358k
}
26
27
363k
void OMPChildren::setClauses(ArrayRef<OMPClause *> Clauses) {
28
363k
  assert(Clauses.size() == NumClauses &&
29
363k
         "Number of clauses is not the same as the preallocated buffer");
30
0
  llvm::copy(Clauses, getTrailingObjects<OMPClause *>());
31
363k
}
32
33
5.12M
MutableArrayRef<Stmt *> OMPChildren::getChildren() {
34
5.12M
  return llvm::makeMutableArrayRef(getTrailingObjects<Stmt *>(), NumChildren);
35
5.12M
}
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
336k
                                 Stmt *S, unsigned NumChildren) {
45
336k
  auto *Data = CreateEmpty(Mem, Clauses.size(), S, NumChildren);
46
336k
  Data->setClauses(Clauses);
47
336k
  if (S)
48
328k
    Data->setAssociatedStmt(S);
49
336k
  return Data;
50
336k
}
51
52
OMPChildren *OMPChildren::CreateEmpty(void *Mem, unsigned NumClauses,
53
                                      bool HasAssociatedStmt,
54
358k
                                      unsigned NumChildren) {
55
358k
  return new (Mem) OMPChildren(NumClauses, NumChildren, HasAssociatedStmt);
56
358k
}
57
58
33.5k
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.5k
  if (isa<OMPTargetEnterDataDirective>(this) ||
63
33.5k
      
isa<OMPTargetExitDataDirective>(this)33.1k
||
64
33.5k
      
isa<OMPTargetUpdateDirective>(this)32.6k
)
65
1.24k
    return true;
66
32.3k
  return !hasAssociatedStmt();
67
33.5k
}
68
69
6.04k
Stmt *OMPExecutableDirective::getStructuredBlock() {
70
6.04k
  assert(!isStandaloneDirective() &&
71
6.04k
         "Standalone Executable Directives don't have Structured Blocks.");
72
6.04k
  if (auto *LD = dyn_cast<OMPLoopDirective>(this))
73
2.91k
    return LD->getBody();
74
3.13k
  return getRawStmt();
75
6.04k
}
76
77
Stmt *
78
OMPLoopBasedDirective::tryToFindNextInnerLoop(Stmt *CurStmt,
79
191k
                                              bool TryImperfectlyNestedLoops) {
80
191k
  Stmt *OrigStmt = CurStmt;
81
191k
  CurStmt = CurStmt->IgnoreContainers();
82
  // Additional work for imperfectly nested loops, introduced in OpenMP 5.0.
83
191k
  if (TryImperfectlyNestedLoops) {
84
136k
    if (auto *CS = dyn_cast<CompoundStmt>(CurStmt)) {
85
15.7k
      CurStmt = nullptr;
86
15.7k
      SmallVector<CompoundStmt *, 4> Statements(1, CS);
87
15.7k
      SmallVector<CompoundStmt *, 4> NextStatements;
88
31.3k
      while (!Statements.empty()) {
89
15.7k
        CS = Statements.pop_back_val();
90
15.7k
        if (!CS)
91
0
          continue;
92
23.5k
        
for (Stmt *S : CS->body())15.7k
{
93
23.5k
          if (!S)
94
0
            continue;
95
23.5k
          if (auto *CanonLoop = dyn_cast<OMPCanonicalLoop>(S))
96
0
            S = CanonLoop->getLoopStmt();
97
23.5k
          if (isa<ForStmt>(S) || 
isa<CXXForRangeStmt>(S)23.3k
||
98
23.5k
              
(23.3k
isa<OMPLoopBasedDirective>(S)23.3k
&&
!isa<OMPLoopDirective>(S)37
)) {
99
            // Only single loop construct is allowed.
100
188
            if (CurStmt) {
101
18
              CurStmt = OrigStmt;
102
18
              break;
103
18
            }
104
170
            CurStmt = S;
105
170
            continue;
106
188
          }
107
23.3k
          S = S->IgnoreContainers();
108
23.3k
          if (auto *InnerCS = dyn_cast_or_null<CompoundStmt>(S))
109
18
            NextStatements.push_back(InnerCS);
110
23.3k
        }
111
15.7k
        if (Statements.empty()) {
112
          // Found single inner loop or multiple loops - exit.
113
15.7k
          if (CurStmt)
114
170
            break;
115
15.5k
          Statements.swap(NextStatements);
116
15.5k
        }
117
15.7k
      }
118
15.7k
      if (!CurStmt)
119
15.5k
        CurStmt = OrigStmt;
120
15.7k
    }
121
136k
  }
122
191k
  return CurStmt;
123
191k
}
124
125
bool OMPLoopBasedDirective::doForAllLoops(
126
    Stmt *CurStmt, bool TryImperfectlyNestedLoops, unsigned NumLoops,
127
    llvm::function_ref<bool(unsigned, Stmt *)> Callback,
128
    llvm::function_ref<void(OMPLoopTransformationDirective *)>
129
183k
        OnTransformationCallback) {
130
183k
  CurStmt = CurStmt->IgnoreContainers();
131
362k
  for (unsigned Cnt = 0; Cnt < NumLoops; 
++Cnt179k
) {
132
187k
    while (true) {
133
187k
      auto *Dir = dyn_cast<OMPLoopTransformationDirective>(CurStmt);
134
187k
      if (!Dir)
135
187k
        break;
136
137
89
      OnTransformationCallback(Dir);
138
139
89
      Stmt *TransformedStmt = Dir->getTransformedStmt();
140
89
      if (!TransformedStmt) {
141
7
        unsigned NumGeneratedLoops = Dir->getNumGeneratedLoops();
142
7
        if (NumGeneratedLoops == 0) {
143
          // May happen if the loop transformation does not result in a
144
          // generated loop (such as full unrolling).
145
7
          break;
146
7
        }
147
0
        if (NumGeneratedLoops > 0) {
148
          // The loop transformation construct has generated loops, but these
149
          // may not have been generated yet due to being in a dependent
150
          // context.
151
0
          return true;
152
0
        }
153
0
      }
154
155
82
      CurStmt = TransformedStmt;
156
82
    }
157
187k
    if (auto *CanonLoop = dyn_cast<OMPCanonicalLoop>(CurStmt))
158
138
      CurStmt = CanonLoop->getLoopStmt();
159
187k
    if (Callback(Cnt, CurStmt))
160
8.06k
      return false;
161
    // Move on to the next nested for loop, or to the loop body.
162
    // OpenMP [2.8.1, simd construct, Restrictions]
163
    // All loops associated with the construct must be perfectly nested; that
164
    // is, there must be no intervening code nor any OpenMP directive between
165
    // any two loops.
166
179k
    if (auto *For = dyn_cast<ForStmt>(CurStmt)) {
167
179k
      CurStmt = For->getBody();
168
179k
    } else {
169
95
      assert(isa<CXXForRangeStmt>(CurStmt) &&
170
95
             "Expected canonical for or range-based for loops.");
171
0
      CurStmt = cast<CXXForRangeStmt>(CurStmt)->getBody();
172
95
    }
173
0
    CurStmt = OMPLoopBasedDirective::tryToFindNextInnerLoop(
174
179k
        CurStmt, TryImperfectlyNestedLoops);
175
179k
  }
176
175k
  return true;
177
183k
}
178
179
void OMPLoopBasedDirective::doForAllLoopsBodies(
180
    Stmt *CurStmt, bool TryImperfectlyNestedLoops, unsigned NumLoops,
181
2.93k
    llvm::function_ref<void(unsigned, Stmt *, Stmt *)> Callback) {
182
2.93k
  bool Res = OMPLoopBasedDirective::doForAllLoops(
183
2.93k
      CurStmt, TryImperfectlyNestedLoops, NumLoops,
184
2.97k
      [Callback](unsigned Cnt, Stmt *Loop) {
185
2.97k
        Stmt *Body = nullptr;
186
2.97k
        if (auto *For = dyn_cast<ForStmt>(Loop)) {
187
2.97k
          Body = For->getBody();
188
2.97k
        } else {
189
0
          assert(isa<CXXForRangeStmt>(Loop) &&
190
0
                 "Expected canonical for or range-based for loops.");
191
0
          Body = cast<CXXForRangeStmt>(Loop)->getBody();
192
0
        }
193
2.97k
        if (auto *CanonLoop = dyn_cast<OMPCanonicalLoop>(Body))
194
0
          Body = CanonLoop->getLoopStmt();
195
2.97k
        Callback(Cnt, Loop, Body);
196
2.97k
        return false;
197
2.97k
      });
198
2.93k
  assert(Res && "Expected only loops");
199
0
  (void)Res;
200
2.93k
}
201
202
2.93k
Stmt *OMPLoopDirective::getBody() {
203
  // This relies on the loop form is already checked by Sema.
204
2.93k
  Stmt *Body = nullptr;
205
2.93k
  OMPLoopBasedDirective::doForAllLoopsBodies(
206
2.93k
      Data->getRawStmt(), /*TryImperfectlyNestedLoops=*/true,
207
2.93k
      NumAssociatedLoops,
208
2.97k
      [&Body](unsigned, Stmt *, Stmt *BodyStmt) { Body = BodyStmt; });
209
2.93k
  return Body;
210
2.93k
}
211
212
155k
void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
213
155k
  assert(A.size() == getLoopsNumber() &&
214
155k
         "Number of loop counters is not the same as the collapsed number");
215
0
  llvm::copy(A, getCounters().begin());
216
155k
}
217
218
155k
void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
219
155k
  assert(A.size() == getLoopsNumber() && "Number of loop private counters "
220
155k
                                         "is not the same as the collapsed "
221
155k
                                         "number");
222
0
  llvm::copy(A, getPrivateCounters().begin());
223
155k
}
224
225
155k
void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
226
155k
  assert(A.size() == getLoopsNumber() &&
227
155k
         "Number of counter inits is not the same as the collapsed number");
228
0
  llvm::copy(A, getInits().begin());
229
155k
}
230
231
155k
void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
232
155k
  assert(A.size() == getLoopsNumber() &&
233
155k
         "Number of counter updates is not the same as the collapsed number");
234
0
  llvm::copy(A, getUpdates().begin());
235
155k
}
236
237
155k
void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
238
155k
  assert(A.size() == getLoopsNumber() &&
239
155k
         "Number of counter finals is not the same as the collapsed number");
240
0
  llvm::copy(A, getFinals().begin());
241
155k
}
242
243
155k
void OMPLoopDirective::setDependentCounters(ArrayRef<Expr *> A) {
244
155k
  assert(
245
155k
      A.size() == getLoopsNumber() &&
246
155k
      "Number of dependent counters is not the same as the collapsed number");
247
0
  llvm::copy(A, getDependentCounters().begin());
248
155k
}
249
250
155k
void OMPLoopDirective::setDependentInits(ArrayRef<Expr *> A) {
251
155k
  assert(A.size() == getLoopsNumber() &&
252
155k
         "Number of dependent inits is not the same as the collapsed number");
253
0
  llvm::copy(A, getDependentInits().begin());
254
155k
}
255
256
155k
void OMPLoopDirective::setFinalsConditions(ArrayRef<Expr *> A) {
257
155k
  assert(A.size() == getLoopsNumber() &&
258
155k
         "Number of finals conditions is not the same as the collapsed number");
259
0
  llvm::copy(A, getFinalsConditions().begin());
260
155k
}
261
262
OMPMetaDirective *OMPMetaDirective::Create(const ASTContext &C,
263
                                           SourceLocation StartLoc,
264
                                           SourceLocation EndLoc,
265
                                           ArrayRef<OMPClause *> Clauses,
266
0
                                           Stmt *AssociatedStmt, Stmt *IfStmt) {
267
0
  auto *Dir = createDirective<OMPMetaDirective>(
268
0
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
269
0
  Dir->setIfStmt(IfStmt);
270
0
  return Dir;
271
0
}
272
273
OMPMetaDirective *OMPMetaDirective::CreateEmpty(const ASTContext &C,
274
                                                unsigned NumClauses,
275
0
                                                EmptyShell) {
276
0
  return createEmptyDirective<OMPMetaDirective>(C, NumClauses,
277
0
                                                /*HasAssociatedStmt=*/true,
278
0
                                                /*NumChildren=*/1);
279
0
}
280
281
OMPParallelDirective *OMPParallelDirective::Create(
282
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
283
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
284
27.9k
    bool HasCancel) {
285
27.9k
  auto *Dir = createDirective<OMPParallelDirective>(
286
27.9k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
287
27.9k
  Dir->setTaskReductionRefExpr(TaskRedRef);
288
27.9k
  Dir->setHasCancel(HasCancel);
289
27.9k
  return Dir;
290
27.9k
}
291
292
OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
293
                                                        unsigned NumClauses,
294
790
                                                        EmptyShell) {
295
790
  return createEmptyDirective<OMPParallelDirective>(C, NumClauses,
296
790
                                                    /*HasAssociatedStmt=*/true,
297
790
                                                    /*NumChildren=*/1);
298
790
}
299
300
OMPSimdDirective *
301
OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
302
                         SourceLocation EndLoc, unsigned CollapsedNum,
303
                         ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
304
5.98k
                         const HelperExprs &Exprs) {
305
5.98k
  auto *Dir = createDirective<OMPSimdDirective>(
306
5.98k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_simd),
307
5.98k
      StartLoc, EndLoc, CollapsedNum);
308
5.98k
  Dir->setIterationVariable(Exprs.IterationVarRef);
309
5.98k
  Dir->setLastIteration(Exprs.LastIteration);
310
5.98k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
311
5.98k
  Dir->setPreCond(Exprs.PreCond);
312
5.98k
  Dir->setCond(Exprs.Cond);
313
5.98k
  Dir->setInit(Exprs.Init);
314
5.98k
  Dir->setInc(Exprs.Inc);
315
5.98k
  Dir->setCounters(Exprs.Counters);
316
5.98k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
317
5.98k
  Dir->setInits(Exprs.Inits);
318
5.98k
  Dir->setUpdates(Exprs.Updates);
319
5.98k
  Dir->setFinals(Exprs.Finals);
320
5.98k
  Dir->setDependentCounters(Exprs.DependentCounters);
321
5.98k
  Dir->setDependentInits(Exprs.DependentInits);
322
5.98k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
323
5.98k
  Dir->setPreInits(Exprs.PreInits);
324
5.98k
  return Dir;
325
5.98k
}
326
327
OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C,
328
                                                unsigned NumClauses,
329
                                                unsigned CollapsedNum,
330
169
                                                EmptyShell) {
331
169
  return createEmptyDirective<OMPSimdDirective>(
332
169
      C, NumClauses, /*HasAssociatedStmt=*/true,
333
169
      numLoopChildren(CollapsedNum, OMPD_simd), CollapsedNum);
334
169
}
335
336
OMPForDirective *OMPForDirective::Create(
337
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
338
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
339
6.78k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
340
6.78k
  auto *Dir = createDirective<OMPForDirective>(
341
6.78k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_for) + 1,
342
6.78k
      StartLoc, EndLoc, CollapsedNum);
343
6.78k
  Dir->setIterationVariable(Exprs.IterationVarRef);
344
6.78k
  Dir->setLastIteration(Exprs.LastIteration);
345
6.78k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
346
6.78k
  Dir->setPreCond(Exprs.PreCond);
347
6.78k
  Dir->setCond(Exprs.Cond);
348
6.78k
  Dir->setInit(Exprs.Init);
349
6.78k
  Dir->setInc(Exprs.Inc);
350
6.78k
  Dir->setIsLastIterVariable(Exprs.IL);
351
6.78k
  Dir->setLowerBoundVariable(Exprs.LB);
352
6.78k
  Dir->setUpperBoundVariable(Exprs.UB);
353
6.78k
  Dir->setStrideVariable(Exprs.ST);
354
6.78k
  Dir->setEnsureUpperBound(Exprs.EUB);
355
6.78k
  Dir->setNextLowerBound(Exprs.NLB);
356
6.78k
  Dir->setNextUpperBound(Exprs.NUB);
357
6.78k
  Dir->setNumIterations(Exprs.NumIterations);
358
6.78k
  Dir->setCounters(Exprs.Counters);
359
6.78k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
360
6.78k
  Dir->setInits(Exprs.Inits);
361
6.78k
  Dir->setUpdates(Exprs.Updates);
362
6.78k
  Dir->setFinals(Exprs.Finals);
363
6.78k
  Dir->setDependentCounters(Exprs.DependentCounters);
364
6.78k
  Dir->setDependentInits(Exprs.DependentInits);
365
6.78k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
366
6.78k
  Dir->setPreInits(Exprs.PreInits);
367
6.78k
  Dir->setTaskReductionRefExpr(TaskRedRef);
368
6.78k
  Dir->setHasCancel(HasCancel);
369
6.78k
  return Dir;
370
6.78k
}
371
372
115
Stmt *OMPLoopTransformationDirective::getTransformedStmt() const {
373
115
  switch (getStmtClass()) {
374
0
#define STMT(CLASS, PARENT)
375
0
#define ABSTRACT_STMT(CLASS)
376
0
#define OMPLOOPTRANSFORMATIONDIRECTIVE(CLASS, PARENT)                          \
377
115
  case Stmt::CLASS##Class:                                                     \
378
115
    return static_cast<const CLASS *>(this)->getTransformedStmt();
379
0
#include "clang/AST/StmtNodes.inc"
380
0
  default:
381
0
    llvm_unreachable("Not a loop transformation");
382
115
  }
383
115
}
384
385
52
Stmt *OMPLoopTransformationDirective::getPreInits() const {
386
52
  switch (getStmtClass()) {
387
0
#define STMT(CLASS, PARENT)
388
0
#define ABSTRACT_STMT(CLASS)
389
0
#define OMPLOOPTRANSFORMATIONDIRECTIVE(CLASS, PARENT)                          \
390
52
  case Stmt::CLASS##Class:                                                     \
391
52
    return static_cast<const CLASS *>(this)->getPreInits();
392
0
#include "clang/AST/StmtNodes.inc"
393
0
  default:
394
0
    llvm_unreachable("Not a loop transformation");
395
52
  }
396
52
}
397
398
OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
399
                                              unsigned NumClauses,
400
                                              unsigned CollapsedNum,
401
355
                                              EmptyShell) {
402
355
  return createEmptyDirective<OMPForDirective>(
403
355
      C, NumClauses, /*HasAssociatedStmt=*/true,
404
355
      numLoopChildren(CollapsedNum, OMPD_for) + 1, CollapsedNum);
405
355
}
406
407
OMPTileDirective *
408
OMPTileDirective::Create(const ASTContext &C, SourceLocation StartLoc,
409
                         SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
410
                         unsigned NumLoops, Stmt *AssociatedStmt,
411
72
                         Stmt *TransformedStmt, Stmt *PreInits) {
412
72
  OMPTileDirective *Dir = createDirective<OMPTileDirective>(
413
72
      C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc,
414
72
      NumLoops);
415
72
  Dir->setTransformedStmt(TransformedStmt);
416
72
  Dir->setPreInits(PreInits);
417
72
  return Dir;
418
72
}
419
420
OMPTileDirective *OMPTileDirective::CreateEmpty(const ASTContext &C,
421
                                                unsigned NumClauses,
422
26
                                                unsigned NumLoops) {
423
26
  return createEmptyDirective<OMPTileDirective>(
424
26
      C, NumClauses, /*HasAssociatedStmt=*/true, TransformedStmtOffset + 1,
425
26
      SourceLocation(), SourceLocation(), NumLoops);
426
26
}
427
428
OMPUnrollDirective *
429
OMPUnrollDirective::Create(const ASTContext &C, SourceLocation StartLoc,
430
                           SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
431
                           Stmt *AssociatedStmt, unsigned NumGeneratedLoops,
432
95
                           Stmt *TransformedStmt, Stmt *PreInits) {
433
95
  assert(NumGeneratedLoops <= 1 && "Unrolling generates at most one loop");
434
435
0
  auto *Dir = createDirective<OMPUnrollDirective>(
436
95
      C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc);
437
95
  Dir->setNumGeneratedLoops(NumGeneratedLoops);
438
95
  Dir->setTransformedStmt(TransformedStmt);
439
95
  Dir->setPreInits(PreInits);
440
95
  return Dir;
441
95
}
442
443
OMPUnrollDirective *OMPUnrollDirective::CreateEmpty(const ASTContext &C,
444
26
                                                    unsigned NumClauses) {
445
26
  return createEmptyDirective<OMPUnrollDirective>(
446
26
      C, NumClauses, /*HasAssociatedStmt=*/true, TransformedStmtOffset + 1,
447
26
      SourceLocation(), SourceLocation());
448
26
}
449
450
OMPForSimdDirective *
451
OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
452
                            SourceLocation EndLoc, unsigned CollapsedNum,
453
                            ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
454
5.49k
                            const HelperExprs &Exprs) {
455
5.49k
  auto *Dir = createDirective<OMPForSimdDirective>(
456
5.49k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_for_simd),
457
5.49k
      StartLoc, EndLoc, CollapsedNum);
458
5.49k
  Dir->setIterationVariable(Exprs.IterationVarRef);
459
5.49k
  Dir->setLastIteration(Exprs.LastIteration);
460
5.49k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
461
5.49k
  Dir->setPreCond(Exprs.PreCond);
462
5.49k
  Dir->setCond(Exprs.Cond);
463
5.49k
  Dir->setInit(Exprs.Init);
464
5.49k
  Dir->setInc(Exprs.Inc);
465
5.49k
  Dir->setIsLastIterVariable(Exprs.IL);
466
5.49k
  Dir->setLowerBoundVariable(Exprs.LB);
467
5.49k
  Dir->setUpperBoundVariable(Exprs.UB);
468
5.49k
  Dir->setStrideVariable(Exprs.ST);
469
5.49k
  Dir->setEnsureUpperBound(Exprs.EUB);
470
5.49k
  Dir->setNextLowerBound(Exprs.NLB);
471
5.49k
  Dir->setNextUpperBound(Exprs.NUB);
472
5.49k
  Dir->setNumIterations(Exprs.NumIterations);
473
5.49k
  Dir->setCounters(Exprs.Counters);
474
5.49k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
475
5.49k
  Dir->setInits(Exprs.Inits);
476
5.49k
  Dir->setUpdates(Exprs.Updates);
477
5.49k
  Dir->setFinals(Exprs.Finals);
478
5.49k
  Dir->setDependentCounters(Exprs.DependentCounters);
479
5.49k
  Dir->setDependentInits(Exprs.DependentInits);
480
5.49k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
481
5.49k
  Dir->setPreInits(Exprs.PreInits);
482
5.49k
  return Dir;
483
5.49k
}
484
485
OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
486
                                                      unsigned NumClauses,
487
                                                      unsigned CollapsedNum,
488
111
                                                      EmptyShell) {
489
111
  return createEmptyDirective<OMPForSimdDirective>(
490
111
      C, NumClauses, /*HasAssociatedStmt=*/true,
491
111
      numLoopChildren(CollapsedNum, OMPD_for_simd), CollapsedNum);
492
111
}
493
494
OMPSectionsDirective *OMPSectionsDirective::Create(
495
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
496
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
497
3.78k
    bool HasCancel) {
498
3.78k
  auto *Dir = createDirective<OMPSectionsDirective>(C, Clauses, AssociatedStmt,
499
3.78k
                                                    /*NumChildren=*/1, StartLoc,
500
3.78k
                                                    EndLoc);
501
3.78k
  Dir->setTaskReductionRefExpr(TaskRedRef);
502
3.78k
  Dir->setHasCancel(HasCancel);
503
3.78k
  return Dir;
504
3.78k
}
505
506
OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
507
                                                        unsigned NumClauses,
508
58
                                                        EmptyShell) {
509
58
  return createEmptyDirective<OMPSectionsDirective>(C, NumClauses,
510
58
                                                    /*HasAssociatedStmt=*/true,
511
58
                                                    /*NumChildren=*/1);
512
58
}
513
514
OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
515
                                                 SourceLocation StartLoc,
516
                                                 SourceLocation EndLoc,
517
                                                 Stmt *AssociatedStmt,
518
981
                                                 bool HasCancel) {
519
981
  auto *Dir =
520
981
      createDirective<OMPSectionDirective>(C, llvm::None, AssociatedStmt,
521
981
                                           /*NumChildren=*/0, StartLoc, EndLoc);
522
981
  Dir->setHasCancel(HasCancel);
523
981
  return Dir;
524
981
}
525
526
OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
527
50
                                                      EmptyShell) {
528
50
  return createEmptyDirective<OMPSectionDirective>(C, /*NumClauses=*/0,
529
50
                                                   /*HasAssociatedStmt=*/true);
530
50
}
531
532
OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
533
                                               SourceLocation StartLoc,
534
                                               SourceLocation EndLoc,
535
                                               ArrayRef<OMPClause *> Clauses,
536
2.02k
                                               Stmt *AssociatedStmt) {
537
2.02k
  return createDirective<OMPSingleDirective>(C, Clauses, AssociatedStmt,
538
2.02k
                                             /*NumChildren=*/0, StartLoc,
539
2.02k
                                             EndLoc);
540
2.02k
}
541
542
OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
543
                                                    unsigned NumClauses,
544
46
                                                    EmptyShell) {
545
46
  return createEmptyDirective<OMPSingleDirective>(C, NumClauses,
546
46
                                                  /*HasAssociatedStmt=*/true);
547
46
}
548
549
OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
550
                                               SourceLocation StartLoc,
551
                                               SourceLocation EndLoc,
552
1.27k
                                               Stmt *AssociatedStmt) {
553
1.27k
  return createDirective<OMPMasterDirective>(C, llvm::None, AssociatedStmt,
554
1.27k
                                             /*NumChildren=*/0, StartLoc,
555
1.27k
                                             EndLoc);
556
1.27k
}
557
558
OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
559
17
                                                    EmptyShell) {
560
17
  return createEmptyDirective<OMPMasterDirective>(C, /*NumClauses=*/0,
561
17
                                                  /*HasAssociatedStmt=*/true);
562
17
}
563
564
OMPCriticalDirective *OMPCriticalDirective::Create(
565
    const ASTContext &C, const DeclarationNameInfo &Name,
566
    SourceLocation StartLoc, SourceLocation EndLoc,
567
1.89k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
568
1.89k
  return createDirective<OMPCriticalDirective>(C, Clauses, AssociatedStmt,
569
1.89k
                                               /*NumChildren=*/0, Name,
570
1.89k
                                               StartLoc, EndLoc);
571
1.89k
}
572
573
OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
574
                                                        unsigned NumClauses,
575
76
                                                        EmptyShell) {
576
76
  return createEmptyDirective<OMPCriticalDirective>(C, NumClauses,
577
76
                                                    /*HasAssociatedStmt=*/true);
578
76
}
579
580
OMPParallelForDirective *OMPParallelForDirective::Create(
581
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
582
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
583
4.73k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
584
4.73k
  auto *Dir = createDirective<OMPParallelForDirective>(
585
4.73k
      C, Clauses, AssociatedStmt,
586
4.73k
      numLoopChildren(CollapsedNum, OMPD_parallel_for) + 1, StartLoc, EndLoc,
587
4.73k
      CollapsedNum);
588
4.73k
  Dir->setIterationVariable(Exprs.IterationVarRef);
589
4.73k
  Dir->setLastIteration(Exprs.LastIteration);
590
4.73k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
591
4.73k
  Dir->setPreCond(Exprs.PreCond);
592
4.73k
  Dir->setCond(Exprs.Cond);
593
4.73k
  Dir->setInit(Exprs.Init);
594
4.73k
  Dir->setInc(Exprs.Inc);
595
4.73k
  Dir->setIsLastIterVariable(Exprs.IL);
596
4.73k
  Dir->setLowerBoundVariable(Exprs.LB);
597
4.73k
  Dir->setUpperBoundVariable(Exprs.UB);
598
4.73k
  Dir->setStrideVariable(Exprs.ST);
599
4.73k
  Dir->setEnsureUpperBound(Exprs.EUB);
600
4.73k
  Dir->setNextLowerBound(Exprs.NLB);
601
4.73k
  Dir->setNextUpperBound(Exprs.NUB);
602
4.73k
  Dir->setNumIterations(Exprs.NumIterations);
603
4.73k
  Dir->setCounters(Exprs.Counters);
604
4.73k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
605
4.73k
  Dir->setInits(Exprs.Inits);
606
4.73k
  Dir->setUpdates(Exprs.Updates);
607
4.73k
  Dir->setFinals(Exprs.Finals);
608
4.73k
  Dir->setDependentCounters(Exprs.DependentCounters);
609
4.73k
  Dir->setDependentInits(Exprs.DependentInits);
610
4.73k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
611
4.73k
  Dir->setPreInits(Exprs.PreInits);
612
4.73k
  Dir->setTaskReductionRefExpr(TaskRedRef);
613
4.73k
  Dir->setHasCancel(HasCancel);
614
4.73k
  return Dir;
615
4.73k
}
616
617
OMPParallelForDirective *
618
OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
619
104
                                     unsigned CollapsedNum, EmptyShell) {
620
104
  return createEmptyDirective<OMPParallelForDirective>(
621
104
      C, NumClauses, /*HasAssociatedStmt=*/true,
622
104
      numLoopChildren(CollapsedNum, OMPD_parallel_for) + 1, CollapsedNum);
623
104
}
624
625
OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
626
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
627
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
628
5.88k
    const HelperExprs &Exprs) {
629
5.88k
  auto *Dir = createDirective<OMPParallelForSimdDirective>(
630
5.88k
      C, Clauses, AssociatedStmt,
631
5.88k
      numLoopChildren(CollapsedNum, OMPD_parallel_for_simd), StartLoc, EndLoc,
632
5.88k
      CollapsedNum);
633
5.88k
  Dir->setIterationVariable(Exprs.IterationVarRef);
634
5.88k
  Dir->setLastIteration(Exprs.LastIteration);
635
5.88k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
636
5.88k
  Dir->setPreCond(Exprs.PreCond);
637
5.88k
  Dir->setCond(Exprs.Cond);
638
5.88k
  Dir->setInit(Exprs.Init);
639
5.88k
  Dir->setInc(Exprs.Inc);
640
5.88k
  Dir->setIsLastIterVariable(Exprs.IL);
641
5.88k
  Dir->setLowerBoundVariable(Exprs.LB);
642
5.88k
  Dir->setUpperBoundVariable(Exprs.UB);
643
5.88k
  Dir->setStrideVariable(Exprs.ST);
644
5.88k
  Dir->setEnsureUpperBound(Exprs.EUB);
645
5.88k
  Dir->setNextLowerBound(Exprs.NLB);
646
5.88k
  Dir->setNextUpperBound(Exprs.NUB);
647
5.88k
  Dir->setNumIterations(Exprs.NumIterations);
648
5.88k
  Dir->setCounters(Exprs.Counters);
649
5.88k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
650
5.88k
  Dir->setInits(Exprs.Inits);
651
5.88k
  Dir->setUpdates(Exprs.Updates);
652
5.88k
  Dir->setFinals(Exprs.Finals);
653
5.88k
  Dir->setDependentCounters(Exprs.DependentCounters);
654
5.88k
  Dir->setDependentInits(Exprs.DependentInits);
655
5.88k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
656
5.88k
  Dir->setPreInits(Exprs.PreInits);
657
5.88k
  return Dir;
658
5.88k
}
659
660
OMPParallelForSimdDirective *
661
OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
662
                                         unsigned NumClauses,
663
118
                                         unsigned CollapsedNum, EmptyShell) {
664
118
  return createEmptyDirective<OMPParallelForSimdDirective>(
665
118
      C, NumClauses, /*HasAssociatedStmt=*/true,
666
118
      numLoopChildren(CollapsedNum, OMPD_parallel_for_simd), CollapsedNum);
667
118
}
668
669
OMPParallelMasterDirective *OMPParallelMasterDirective::Create(
670
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
671
3.45k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef) {
672
3.45k
  auto *Dir = createDirective<OMPParallelMasterDirective>(
673
3.45k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
674
3.45k
  Dir->setTaskReductionRefExpr(TaskRedRef);
675
3.45k
  return Dir;
676
3.45k
}
677
678
OMPParallelMasterDirective *
679
OMPParallelMasterDirective::CreateEmpty(const ASTContext &C,
680
63
                                        unsigned NumClauses, EmptyShell) {
681
63
  return createEmptyDirective<OMPParallelMasterDirective>(
682
63
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
683
63
}
684
685
OMPParallelMaskedDirective *OMPParallelMaskedDirective::Create(
686
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
687
2.33k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef) {
688
2.33k
  auto *Dir = createDirective<OMPParallelMaskedDirective>(
689
2.33k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
690
2.33k
  Dir->setTaskReductionRefExpr(TaskRedRef);
691
2.33k
  return Dir;
692
2.33k
}
693
694
OMPParallelMaskedDirective *
695
OMPParallelMaskedDirective::CreateEmpty(const ASTContext &C,
696
44
                                        unsigned NumClauses, EmptyShell) {
697
44
  return createEmptyDirective<OMPParallelMaskedDirective>(
698
44
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
699
44
}
700
701
OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
702
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
703
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
704
3.49k
    bool HasCancel) {
705
3.49k
  auto *Dir = createDirective<OMPParallelSectionsDirective>(
706
3.49k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
707
3.49k
  Dir->setTaskReductionRefExpr(TaskRedRef);
708
3.49k
  Dir->setHasCancel(HasCancel);
709
3.49k
  return Dir;
710
3.49k
}
711
712
OMPParallelSectionsDirective *
713
OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
714
32
                                          unsigned NumClauses, EmptyShell) {
715
32
  return createEmptyDirective<OMPParallelSectionsDirective>(
716
32
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
717
32
}
718
719
OMPTaskDirective *
720
OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
721
                         SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
722
4.02k
                         Stmt *AssociatedStmt, bool HasCancel) {
723
4.02k
  auto *Dir = createDirective<OMPTaskDirective>(
724
4.02k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
725
4.02k
  Dir->setHasCancel(HasCancel);
726
4.02k
  return Dir;
727
4.02k
}
728
729
OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
730
                                                unsigned NumClauses,
731
249
                                                EmptyShell) {
732
249
  return createEmptyDirective<OMPTaskDirective>(C, NumClauses,
733
249
                                                /*HasAssociatedStmt=*/true);
734
249
}
735
736
OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
737
                                                     SourceLocation StartLoc,
738
691
                                                     SourceLocation EndLoc) {
739
691
  return new (C) OMPTaskyieldDirective(StartLoc, EndLoc);
740
691
}
741
742
OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
743
16
                                                          EmptyShell) {
744
16
  return new (C) OMPTaskyieldDirective();
745
16
}
746
747
OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
748
                                                 SourceLocation StartLoc,
749
375
                                                 SourceLocation EndLoc) {
750
375
  return new (C) OMPBarrierDirective(StartLoc, EndLoc);
751
375
}
752
753
OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
754
30
                                                      EmptyShell) {
755
30
  return new (C) OMPBarrierDirective();
756
30
}
757
758
OMPTaskwaitDirective *
759
OMPTaskwaitDirective::Create(const ASTContext &C, SourceLocation StartLoc,
760
                             SourceLocation EndLoc,
761
796
                             ArrayRef<OMPClause *> Clauses) {
762
796
  return createDirective<OMPTaskwaitDirective>(
763
796
      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
764
796
      EndLoc);
765
796
}
766
767
OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
768
                                                        unsigned NumClauses,
769
22
                                                        EmptyShell) {
770
22
  return createEmptyDirective<OMPTaskwaitDirective>(C, NumClauses);
771
22
}
772
773
OMPTaskgroupDirective *OMPTaskgroupDirective::Create(
774
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
775
3.24k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) {
776
3.24k
  auto *Dir = createDirective<OMPTaskgroupDirective>(
777
3.24k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
778
3.24k
  Dir->setReductionRef(ReductionRef);
779
3.24k
  return Dir;
780
3.24k
}
781
782
OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
783
                                                          unsigned NumClauses,
784
114
                                                          EmptyShell) {
785
114
  return createEmptyDirective<OMPTaskgroupDirective>(
786
114
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
787
114
}
788
789
OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
790
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
791
217
    OpenMPDirectiveKind CancelRegion) {
792
217
  auto *Dir = new (C) OMPCancellationPointDirective(StartLoc, EndLoc);
793
217
  Dir->setCancelRegion(CancelRegion);
794
217
  return Dir;
795
217
}
796
797
OMPCancellationPointDirective *
798
74
OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
799
74
  return new (C) OMPCancellationPointDirective();
800
74
}
801
802
OMPCancelDirective *
803
OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
804
                           SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
805
662
                           OpenMPDirectiveKind CancelRegion) {
806
662
  auto *Dir = createDirective<OMPCancelDirective>(
807
662
      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
808
662
      EndLoc);
809
662
  Dir->setCancelRegion(CancelRegion);
810
662
  return Dir;
811
662
}
812
813
OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
814
                                                    unsigned NumClauses,
815
170
                                                    EmptyShell) {
816
170
  return createEmptyDirective<OMPCancelDirective>(C, NumClauses);
817
170
}
818
819
OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
820
                                             SourceLocation StartLoc,
821
                                             SourceLocation EndLoc,
822
995
                                             ArrayRef<OMPClause *> Clauses) {
823
995
  return createDirective<OMPFlushDirective>(
824
995
      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
825
995
      EndLoc);
826
995
}
827
828
OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
829
                                                  unsigned NumClauses,
830
50
                                                  EmptyShell) {
831
50
  return createEmptyDirective<OMPFlushDirective>(C, NumClauses);
832
50
}
833
834
OMPDepobjDirective *OMPDepobjDirective::Create(const ASTContext &C,
835
                                               SourceLocation StartLoc,
836
                                               SourceLocation EndLoc,
837
392
                                               ArrayRef<OMPClause *> Clauses) {
838
392
  return createDirective<OMPDepobjDirective>(
839
392
      C, Clauses, /*AssociatedStmt=*/nullptr,
840
392
      /*NumChildren=*/0, StartLoc, EndLoc);
841
392
}
842
843
OMPDepobjDirective *OMPDepobjDirective::CreateEmpty(const ASTContext &C,
844
                                                    unsigned NumClauses,
845
28
                                                    EmptyShell) {
846
28
  return createEmptyDirective<OMPDepobjDirective>(C, NumClauses);
847
28
}
848
849
OMPScanDirective *OMPScanDirective::Create(const ASTContext &C,
850
                                           SourceLocation StartLoc,
851
                                           SourceLocation EndLoc,
852
98
                                           ArrayRef<OMPClause *> Clauses) {
853
98
  return createDirective<OMPScanDirective>(C, Clauses,
854
98
                                           /*AssociatedStmt=*/nullptr,
855
98
                                           /*NumChildren=*/0, StartLoc, EndLoc);
856
98
}
857
858
OMPScanDirective *OMPScanDirective::CreateEmpty(const ASTContext &C,
859
                                                unsigned NumClauses,
860
24
                                                EmptyShell) {
861
24
  return createEmptyDirective<OMPScanDirective>(C, NumClauses);
862
24
}
863
864
OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
865
                                                 SourceLocation StartLoc,
866
                                                 SourceLocation EndLoc,
867
                                                 ArrayRef<OMPClause *> Clauses,
868
1.33k
                                                 Stmt *AssociatedStmt) {
869
1.33k
  return createDirective<OMPOrderedDirective>(
870
1.33k
      C, Clauses, cast_or_null<CapturedStmt>(AssociatedStmt),
871
1.33k
      /*NumChildren=*/0, StartLoc, EndLoc);
872
1.33k
}
873
874
OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
875
                                                      unsigned NumClauses,
876
                                                      bool IsStandalone,
877
82
                                                      EmptyShell) {
878
82
  return createEmptyDirective<OMPOrderedDirective>(C, NumClauses,
879
82
                                                   !IsStandalone);
880
82
}
881
882
OMPAtomicDirective *
883
OMPAtomicDirective::Create(const ASTContext &C, SourceLocation StartLoc,
884
                           SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
885
13.8k
                           Stmt *AssociatedStmt, Expressions Exprs) {
886
13.8k
  auto *Dir = createDirective<OMPAtomicDirective>(
887
13.8k
      C, Clauses, AssociatedStmt, /*NumChildren=*/7, StartLoc, EndLoc);
888
13.8k
  Dir->setX(Exprs.X);
889
13.8k
  Dir->setV(Exprs.V);
890
13.8k
  Dir->setR(Exprs.R);
891
13.8k
  Dir->setExpr(Exprs.E);
892
13.8k
  Dir->setUpdateExpr(Exprs.UE);
893
13.8k
  Dir->setD(Exprs.D);
894
13.8k
  Dir->setCond(Exprs.Cond);
895
13.8k
  Dir->Flags.IsXLHSInRHSPart = Exprs.IsXLHSInRHSPart ? 
19.35k
:
04.53k
;
896
13.8k
  Dir->Flags.IsPostfixUpdate = Exprs.IsPostfixUpdate ? 
12.66k
:
011.2k
;
897
13.8k
  Dir->Flags.IsFailOnly = Exprs.IsFailOnly ? 
11.15k
:
012.7k
;
898
13.8k
  return Dir;
899
13.8k
}
900
901
OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
902
                                                    unsigned NumClauses,
903
5.24k
                                                    EmptyShell) {
904
5.24k
  return createEmptyDirective<OMPAtomicDirective>(
905
5.24k
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/7);
906
5.24k
}
907
908
OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
909
                                               SourceLocation StartLoc,
910
                                               SourceLocation EndLoc,
911
                                               ArrayRef<OMPClause *> Clauses,
912
56.1k
                                               Stmt *AssociatedStmt) {
913
56.1k
  return createDirective<OMPTargetDirective>(
914
56.1k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
915
56.1k
}
916
917
OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
918
                                                    unsigned NumClauses,
919
4.84k
                                                    EmptyShell) {
920
4.84k
  return createEmptyDirective<OMPTargetDirective>(C, NumClauses,
921
4.84k
                                                  /*HasAssociatedStmt=*/true);
922
4.84k
}
923
924
OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
925
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
926
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
927
7.67k
    bool HasCancel) {
928
7.67k
  auto *Dir = createDirective<OMPTargetParallelDirective>(
929
7.67k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
930
7.67k
  Dir->setTaskReductionRefExpr(TaskRedRef);
931
7.67k
  Dir->setHasCancel(HasCancel);
932
7.67k
  return Dir;
933
7.67k
}
934
935
OMPTargetParallelDirective *
936
OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
937
617
                                        unsigned NumClauses, EmptyShell) {
938
617
  return createEmptyDirective<OMPTargetParallelDirective>(
939
617
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
940
617
}
941
942
OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
943
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
944
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
945
7.71k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
946
7.71k
  auto *Dir = createDirective<OMPTargetParallelForDirective>(
947
7.71k
      C, Clauses, AssociatedStmt,
948
7.71k
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1, StartLoc,
949
7.71k
      EndLoc, CollapsedNum);
950
7.71k
  Dir->setIterationVariable(Exprs.IterationVarRef);
951
7.71k
  Dir->setLastIteration(Exprs.LastIteration);
952
7.71k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
953
7.71k
  Dir->setPreCond(Exprs.PreCond);
954
7.71k
  Dir->setCond(Exprs.Cond);
955
7.71k
  Dir->setInit(Exprs.Init);
956
7.71k
  Dir->setInc(Exprs.Inc);
957
7.71k
  Dir->setIsLastIterVariable(Exprs.IL);
958
7.71k
  Dir->setLowerBoundVariable(Exprs.LB);
959
7.71k
  Dir->setUpperBoundVariable(Exprs.UB);
960
7.71k
  Dir->setStrideVariable(Exprs.ST);
961
7.71k
  Dir->setEnsureUpperBound(Exprs.EUB);
962
7.71k
  Dir->setNextLowerBound(Exprs.NLB);
963
7.71k
  Dir->setNextUpperBound(Exprs.NUB);
964
7.71k
  Dir->setNumIterations(Exprs.NumIterations);
965
7.71k
  Dir->setCounters(Exprs.Counters);
966
7.71k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
967
7.71k
  Dir->setInits(Exprs.Inits);
968
7.71k
  Dir->setUpdates(Exprs.Updates);
969
7.71k
  Dir->setFinals(Exprs.Finals);
970
7.71k
  Dir->setDependentCounters(Exprs.DependentCounters);
971
7.71k
  Dir->setDependentInits(Exprs.DependentInits);
972
7.71k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
973
7.71k
  Dir->setPreInits(Exprs.PreInits);
974
7.71k
  Dir->setTaskReductionRefExpr(TaskRedRef);
975
7.71k
  Dir->setHasCancel(HasCancel);
976
7.71k
  return Dir;
977
7.71k
}
978
979
OMPTargetParallelForDirective *
980
OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
981
                                           unsigned NumClauses,
982
437
                                           unsigned CollapsedNum, EmptyShell) {
983
437
  return createEmptyDirective<OMPTargetParallelForDirective>(
984
437
      C, NumClauses, /*HasAssociatedStmt=*/true,
985
437
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1,
986
437
      CollapsedNum);
987
437
}
988
989
OMPTargetDataDirective *OMPTargetDataDirective::Create(
990
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
991
5.43k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
992
5.43k
  return createDirective<OMPTargetDataDirective>(
993
5.43k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
994
5.43k
}
995
996
OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
997
                                                            unsigned N,
998
254
                                                            EmptyShell) {
999
254
  return createEmptyDirective<OMPTargetDataDirective>(
1000
254
      C, N, /*HasAssociatedStmt=*/true);
1001
254
}
1002
1003
OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
1004
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1005
2.03k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1006
2.03k
  return createDirective<OMPTargetEnterDataDirective>(
1007
2.03k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1008
2.03k
}
1009
1010
OMPTargetEnterDataDirective *
1011
OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
1012
289
                                         EmptyShell) {
1013
289
  return createEmptyDirective<OMPTargetEnterDataDirective>(
1014
289
      C, N, /*HasAssociatedStmt=*/true);
1015
289
}
1016
1017
OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create(
1018
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1019
2.00k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1020
2.00k
  return createDirective<OMPTargetExitDataDirective>(
1021
2.00k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1022
2.00k
}
1023
1024
OMPTargetExitDataDirective *
1025
OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
1026
277
                                        EmptyShell) {
1027
277
  return createEmptyDirective<OMPTargetExitDataDirective>(
1028
277
      C, N, /*HasAssociatedStmt=*/true);
1029
277
}
1030
1031
OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
1032
                                             SourceLocation StartLoc,
1033
                                             SourceLocation EndLoc,
1034
                                             ArrayRef<OMPClause *> Clauses,
1035
18.8k
                                             Stmt *AssociatedStmt) {
1036
18.8k
  return createDirective<OMPTeamsDirective>(
1037
18.8k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1038
18.8k
}
1039
1040
OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
1041
                                                  unsigned NumClauses,
1042
959
                                                  EmptyShell) {
1043
959
  return createEmptyDirective<OMPTeamsDirective>(C, NumClauses,
1044
959
                                                 /*HasAssociatedStmt=*/true);
1045
959
}
1046
1047
OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
1048
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1049
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1050
5.04k
    const HelperExprs &Exprs, bool HasCancel) {
1051
5.04k
  auto *Dir = createDirective<OMPTaskLoopDirective>(
1052
5.04k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_taskloop),
1053
5.04k
      StartLoc, EndLoc, CollapsedNum);
1054
5.04k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1055
5.04k
  Dir->setLastIteration(Exprs.LastIteration);
1056
5.04k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1057
5.04k
  Dir->setPreCond(Exprs.PreCond);
1058
5.04k
  Dir->setCond(Exprs.Cond);
1059
5.04k
  Dir->setInit(Exprs.Init);
1060
5.04k
  Dir->setInc(Exprs.Inc);
1061
5.04k
  Dir->setIsLastIterVariable(Exprs.IL);
1062
5.04k
  Dir->setLowerBoundVariable(Exprs.LB);
1063
5.04k
  Dir->setUpperBoundVariable(Exprs.UB);
1064
5.04k
  Dir->setStrideVariable(Exprs.ST);
1065
5.04k
  Dir->setEnsureUpperBound(Exprs.EUB);
1066
5.04k
  Dir->setNextLowerBound(Exprs.NLB);
1067
5.04k
  Dir->setNextUpperBound(Exprs.NUB);
1068
5.04k
  Dir->setNumIterations(Exprs.NumIterations);
1069
5.04k
  Dir->setCounters(Exprs.Counters);
1070
5.04k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1071
5.04k
  Dir->setInits(Exprs.Inits);
1072
5.04k
  Dir->setUpdates(Exprs.Updates);
1073
5.04k
  Dir->setFinals(Exprs.Finals);
1074
5.04k
  Dir->setDependentCounters(Exprs.DependentCounters);
1075
5.04k
  Dir->setDependentInits(Exprs.DependentInits);
1076
5.04k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1077
5.04k
  Dir->setPreInits(Exprs.PreInits);
1078
5.04k
  Dir->setHasCancel(HasCancel);
1079
5.04k
  return Dir;
1080
5.04k
}
1081
1082
OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
1083
                                                        unsigned NumClauses,
1084
                                                        unsigned CollapsedNum,
1085
36
                                                        EmptyShell) {
1086
36
  return createEmptyDirective<OMPTaskLoopDirective>(
1087
36
      C, NumClauses, /*HasAssociatedStmt=*/true,
1088
36
      numLoopChildren(CollapsedNum, OMPD_taskloop), CollapsedNum);
1089
36
}
1090
1091
OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
1092
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1093
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1094
4.30k
    const HelperExprs &Exprs) {
1095
4.30k
  auto *Dir = createDirective<OMPTaskLoopSimdDirective>(
1096
4.30k
      C, Clauses, AssociatedStmt,
1097
4.30k
      numLoopChildren(CollapsedNum, OMPD_taskloop_simd), StartLoc, EndLoc,
1098
4.30k
      CollapsedNum);
1099
4.30k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1100
4.30k
  Dir->setLastIteration(Exprs.LastIteration);
1101
4.30k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1102
4.30k
  Dir->setPreCond(Exprs.PreCond);
1103
4.30k
  Dir->setCond(Exprs.Cond);
1104
4.30k
  Dir->setInit(Exprs.Init);
1105
4.30k
  Dir->setInc(Exprs.Inc);
1106
4.30k
  Dir->setIsLastIterVariable(Exprs.IL);
1107
4.30k
  Dir->setLowerBoundVariable(Exprs.LB);
1108
4.30k
  Dir->setUpperBoundVariable(Exprs.UB);
1109
4.30k
  Dir->setStrideVariable(Exprs.ST);
1110
4.30k
  Dir->setEnsureUpperBound(Exprs.EUB);
1111
4.30k
  Dir->setNextLowerBound(Exprs.NLB);
1112
4.30k
  Dir->setNextUpperBound(Exprs.NUB);
1113
4.30k
  Dir->setNumIterations(Exprs.NumIterations);
1114
4.30k
  Dir->setCounters(Exprs.Counters);
1115
4.30k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1116
4.30k
  Dir->setInits(Exprs.Inits);
1117
4.30k
  Dir->setUpdates(Exprs.Updates);
1118
4.30k
  Dir->setFinals(Exprs.Finals);
1119
4.30k
  Dir->setDependentCounters(Exprs.DependentCounters);
1120
4.30k
  Dir->setDependentInits(Exprs.DependentInits);
1121
4.30k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1122
4.30k
  Dir->setPreInits(Exprs.PreInits);
1123
4.30k
  return Dir;
1124
4.30k
}
1125
1126
OMPTaskLoopSimdDirective *
1127
OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1128
46
                                      unsigned CollapsedNum, EmptyShell) {
1129
46
  return createEmptyDirective<OMPTaskLoopSimdDirective>(
1130
46
      C, NumClauses, /*HasAssociatedStmt=*/true,
1131
46
      numLoopChildren(CollapsedNum, OMPD_taskloop_simd), CollapsedNum);
1132
46
}
1133
1134
OMPMasterTaskLoopDirective *OMPMasterTaskLoopDirective::Create(
1135
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1136
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1137
3.39k
    const HelperExprs &Exprs, bool HasCancel) {
1138
3.39k
  auto *Dir = createDirective<OMPMasterTaskLoopDirective>(
1139
3.39k
      C, Clauses, AssociatedStmt,
1140
3.39k
      numLoopChildren(CollapsedNum, OMPD_master_taskloop), StartLoc, EndLoc,
1141
3.39k
      CollapsedNum);
1142
3.39k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1143
3.39k
  Dir->setLastIteration(Exprs.LastIteration);
1144
3.39k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1145
3.39k
  Dir->setPreCond(Exprs.PreCond);
1146
3.39k
  Dir->setCond(Exprs.Cond);
1147
3.39k
  Dir->setInit(Exprs.Init);
1148
3.39k
  Dir->setInc(Exprs.Inc);
1149
3.39k
  Dir->setIsLastIterVariable(Exprs.IL);
1150
3.39k
  Dir->setLowerBoundVariable(Exprs.LB);
1151
3.39k
  Dir->setUpperBoundVariable(Exprs.UB);
1152
3.39k
  Dir->setStrideVariable(Exprs.ST);
1153
3.39k
  Dir->setEnsureUpperBound(Exprs.EUB);
1154
3.39k
  Dir->setNextLowerBound(Exprs.NLB);
1155
3.39k
  Dir->setNextUpperBound(Exprs.NUB);
1156
3.39k
  Dir->setNumIterations(Exprs.NumIterations);
1157
3.39k
  Dir->setCounters(Exprs.Counters);
1158
3.39k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1159
3.39k
  Dir->setInits(Exprs.Inits);
1160
3.39k
  Dir->setUpdates(Exprs.Updates);
1161
3.39k
  Dir->setFinals(Exprs.Finals);
1162
3.39k
  Dir->setDependentCounters(Exprs.DependentCounters);
1163
3.39k
  Dir->setDependentInits(Exprs.DependentInits);
1164
3.39k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1165
3.39k
  Dir->setPreInits(Exprs.PreInits);
1166
3.39k
  Dir->setHasCancel(HasCancel);
1167
3.39k
  return Dir;
1168
3.39k
}
1169
1170
OMPMasterTaskLoopDirective *
1171
OMPMasterTaskLoopDirective::CreateEmpty(const ASTContext &C,
1172
                                        unsigned NumClauses,
1173
32
                                        unsigned CollapsedNum, EmptyShell) {
1174
32
  return createEmptyDirective<OMPMasterTaskLoopDirective>(
1175
32
      C, NumClauses, /*HasAssociatedStmt=*/true,
1176
32
      numLoopChildren(CollapsedNum, OMPD_master_taskloop), CollapsedNum);
1177
32
}
1178
1179
OMPMaskedTaskLoopDirective *OMPMaskedTaskLoopDirective::Create(
1180
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1181
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1182
1.86k
    const HelperExprs &Exprs, bool HasCancel) {
1183
1.86k
  auto *Dir = createDirective<OMPMaskedTaskLoopDirective>(
1184
1.86k
      C, Clauses, AssociatedStmt,
1185
1.86k
      numLoopChildren(CollapsedNum, OMPD_masked_taskloop), StartLoc, EndLoc,
1186
1.86k
      CollapsedNum);
1187
1.86k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1188
1.86k
  Dir->setLastIteration(Exprs.LastIteration);
1189
1.86k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1190
1.86k
  Dir->setPreCond(Exprs.PreCond);
1191
1.86k
  Dir->setCond(Exprs.Cond);
1192
1.86k
  Dir->setInit(Exprs.Init);
1193
1.86k
  Dir->setInc(Exprs.Inc);
1194
1.86k
  Dir->setIsLastIterVariable(Exprs.IL);
1195
1.86k
  Dir->setLowerBoundVariable(Exprs.LB);
1196
1.86k
  Dir->setUpperBoundVariable(Exprs.UB);
1197
1.86k
  Dir->setStrideVariable(Exprs.ST);
1198
1.86k
  Dir->setEnsureUpperBound(Exprs.EUB);
1199
1.86k
  Dir->setNextLowerBound(Exprs.NLB);
1200
1.86k
  Dir->setNextUpperBound(Exprs.NUB);
1201
1.86k
  Dir->setNumIterations(Exprs.NumIterations);
1202
1.86k
  Dir->setCounters(Exprs.Counters);
1203
1.86k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1204
1.86k
  Dir->setInits(Exprs.Inits);
1205
1.86k
  Dir->setUpdates(Exprs.Updates);
1206
1.86k
  Dir->setFinals(Exprs.Finals);
1207
1.86k
  Dir->setDependentCounters(Exprs.DependentCounters);
1208
1.86k
  Dir->setDependentInits(Exprs.DependentInits);
1209
1.86k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1210
1.86k
  Dir->setPreInits(Exprs.PreInits);
1211
1.86k
  Dir->setHasCancel(HasCancel);
1212
1.86k
  return Dir;
1213
1.86k
}
1214
1215
OMPMaskedTaskLoopDirective *
1216
OMPMaskedTaskLoopDirective::CreateEmpty(const ASTContext &C,
1217
                                        unsigned NumClauses,
1218
8
                                        unsigned CollapsedNum, EmptyShell) {
1219
8
  return createEmptyDirective<OMPMaskedTaskLoopDirective>(
1220
8
      C, NumClauses, /*HasAssociatedStmt=*/true,
1221
8
      numLoopChildren(CollapsedNum, OMPD_masked_taskloop), CollapsedNum);
1222
8
}
1223
1224
OMPMasterTaskLoopSimdDirective *OMPMasterTaskLoopSimdDirective::Create(
1225
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1226
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1227
4.44k
    const HelperExprs &Exprs) {
1228
4.44k
  auto *Dir = createDirective<OMPMasterTaskLoopSimdDirective>(
1229
4.44k
      C, Clauses, AssociatedStmt,
1230
4.44k
      numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), StartLoc,
1231
4.44k
      EndLoc, CollapsedNum);
1232
4.44k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1233
4.44k
  Dir->setLastIteration(Exprs.LastIteration);
1234
4.44k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1235
4.44k
  Dir->setPreCond(Exprs.PreCond);
1236
4.44k
  Dir->setCond(Exprs.Cond);
1237
4.44k
  Dir->setInit(Exprs.Init);
1238
4.44k
  Dir->setInc(Exprs.Inc);
1239
4.44k
  Dir->setIsLastIterVariable(Exprs.IL);
1240
4.44k
  Dir->setLowerBoundVariable(Exprs.LB);
1241
4.44k
  Dir->setUpperBoundVariable(Exprs.UB);
1242
4.44k
  Dir->setStrideVariable(Exprs.ST);
1243
4.44k
  Dir->setEnsureUpperBound(Exprs.EUB);
1244
4.44k
  Dir->setNextLowerBound(Exprs.NLB);
1245
4.44k
  Dir->setNextUpperBound(Exprs.NUB);
1246
4.44k
  Dir->setNumIterations(Exprs.NumIterations);
1247
4.44k
  Dir->setCounters(Exprs.Counters);
1248
4.44k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1249
4.44k
  Dir->setInits(Exprs.Inits);
1250
4.44k
  Dir->setUpdates(Exprs.Updates);
1251
4.44k
  Dir->setFinals(Exprs.Finals);
1252
4.44k
  Dir->setDependentCounters(Exprs.DependentCounters);
1253
4.44k
  Dir->setDependentInits(Exprs.DependentInits);
1254
4.44k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1255
4.44k
  Dir->setPreInits(Exprs.PreInits);
1256
4.44k
  return Dir;
1257
4.44k
}
1258
1259
OMPMasterTaskLoopSimdDirective *
1260
OMPMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1261
                                            unsigned NumClauses,
1262
46
                                            unsigned CollapsedNum, EmptyShell) {
1263
46
  return createEmptyDirective<OMPMasterTaskLoopSimdDirective>(
1264
46
      C, NumClauses, /*HasAssociatedStmt=*/true,
1265
46
      numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), CollapsedNum);
1266
46
}
1267
1268
OMPMaskedTaskLoopSimdDirective *OMPMaskedTaskLoopSimdDirective::Create(
1269
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1270
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1271
3.74k
    const HelperExprs &Exprs) {
1272
3.74k
  auto *Dir = createDirective<OMPMaskedTaskLoopSimdDirective>(
1273
3.74k
      C, Clauses, AssociatedStmt,
1274
3.74k
      numLoopChildren(CollapsedNum, OMPD_masked_taskloop_simd), StartLoc,
1275
3.74k
      EndLoc, CollapsedNum);
1276
3.74k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1277
3.74k
  Dir->setLastIteration(Exprs.LastIteration);
1278
3.74k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1279
3.74k
  Dir->setPreCond(Exprs.PreCond);
1280
3.74k
  Dir->setCond(Exprs.Cond);
1281
3.74k
  Dir->setInit(Exprs.Init);
1282
3.74k
  Dir->setInc(Exprs.Inc);
1283
3.74k
  Dir->setIsLastIterVariable(Exprs.IL);
1284
3.74k
  Dir->setLowerBoundVariable(Exprs.LB);
1285
3.74k
  Dir->setUpperBoundVariable(Exprs.UB);
1286
3.74k
  Dir->setStrideVariable(Exprs.ST);
1287
3.74k
  Dir->setEnsureUpperBound(Exprs.EUB);
1288
3.74k
  Dir->setNextLowerBound(Exprs.NLB);
1289
3.74k
  Dir->setNextUpperBound(Exprs.NUB);
1290
3.74k
  Dir->setNumIterations(Exprs.NumIterations);
1291
3.74k
  Dir->setCounters(Exprs.Counters);
1292
3.74k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1293
3.74k
  Dir->setInits(Exprs.Inits);
1294
3.74k
  Dir->setUpdates(Exprs.Updates);
1295
3.74k
  Dir->setFinals(Exprs.Finals);
1296
3.74k
  Dir->setDependentCounters(Exprs.DependentCounters);
1297
3.74k
  Dir->setDependentInits(Exprs.DependentInits);
1298
3.74k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1299
3.74k
  Dir->setPreInits(Exprs.PreInits);
1300
3.74k
  return Dir;
1301
3.74k
}
1302
1303
OMPMaskedTaskLoopSimdDirective *
1304
OMPMaskedTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1305
                                            unsigned NumClauses,
1306
16
                                            unsigned CollapsedNum, EmptyShell) {
1307
16
  return createEmptyDirective<OMPMaskedTaskLoopSimdDirective>(
1308
16
      C, NumClauses, /*HasAssociatedStmt=*/true,
1309
16
      numLoopChildren(CollapsedNum, OMPD_masked_taskloop_simd), CollapsedNum);
1310
16
}
1311
1312
OMPParallelMasterTaskLoopDirective *OMPParallelMasterTaskLoopDirective::Create(
1313
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1314
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1315
2.75k
    const HelperExprs &Exprs, bool HasCancel) {
1316
2.75k
  auto *Dir = createDirective<OMPParallelMasterTaskLoopDirective>(
1317
2.75k
      C, Clauses, AssociatedStmt,
1318
2.75k
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop), StartLoc,
1319
2.75k
      EndLoc, CollapsedNum);
1320
2.75k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1321
2.75k
  Dir->setLastIteration(Exprs.LastIteration);
1322
2.75k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1323
2.75k
  Dir->setPreCond(Exprs.PreCond);
1324
2.75k
  Dir->setCond(Exprs.Cond);
1325
2.75k
  Dir->setInit(Exprs.Init);
1326
2.75k
  Dir->setInc(Exprs.Inc);
1327
2.75k
  Dir->setIsLastIterVariable(Exprs.IL);
1328
2.75k
  Dir->setLowerBoundVariable(Exprs.LB);
1329
2.75k
  Dir->setUpperBoundVariable(Exprs.UB);
1330
2.75k
  Dir->setStrideVariable(Exprs.ST);
1331
2.75k
  Dir->setEnsureUpperBound(Exprs.EUB);
1332
2.75k
  Dir->setNextLowerBound(Exprs.NLB);
1333
2.75k
  Dir->setNextUpperBound(Exprs.NUB);
1334
2.75k
  Dir->setNumIterations(Exprs.NumIterations);
1335
2.75k
  Dir->setCounters(Exprs.Counters);
1336
2.75k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1337
2.75k
  Dir->setInits(Exprs.Inits);
1338
2.75k
  Dir->setUpdates(Exprs.Updates);
1339
2.75k
  Dir->setFinals(Exprs.Finals);
1340
2.75k
  Dir->setDependentCounters(Exprs.DependentCounters);
1341
2.75k
  Dir->setDependentInits(Exprs.DependentInits);
1342
2.75k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1343
2.75k
  Dir->setPreInits(Exprs.PreInits);
1344
2.75k
  Dir->setHasCancel(HasCancel);
1345
2.75k
  return Dir;
1346
2.75k
}
1347
1348
OMPParallelMasterTaskLoopDirective *
1349
OMPParallelMasterTaskLoopDirective::CreateEmpty(const ASTContext &C,
1350
                                                unsigned NumClauses,
1351
                                                unsigned CollapsedNum,
1352
30
                                                EmptyShell) {
1353
30
  return createEmptyDirective<OMPParallelMasterTaskLoopDirective>(
1354
30
      C, NumClauses, /*HasAssociatedStmt=*/true,
1355
30
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop),
1356
30
      CollapsedNum);
1357
30
}
1358
1359
OMPParallelMaskedTaskLoopDirective *OMPParallelMaskedTaskLoopDirective::Create(
1360
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1361
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1362
2.53k
    const HelperExprs &Exprs, bool HasCancel) {
1363
2.53k
  auto *Dir = createDirective<OMPParallelMaskedTaskLoopDirective>(
1364
2.53k
      C, Clauses, AssociatedStmt,
1365
2.53k
      numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop), StartLoc,
1366
2.53k
      EndLoc, CollapsedNum);
1367
2.53k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1368
2.53k
  Dir->setLastIteration(Exprs.LastIteration);
1369
2.53k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1370
2.53k
  Dir->setPreCond(Exprs.PreCond);
1371
2.53k
  Dir->setCond(Exprs.Cond);
1372
2.53k
  Dir->setInit(Exprs.Init);
1373
2.53k
  Dir->setInc(Exprs.Inc);
1374
2.53k
  Dir->setIsLastIterVariable(Exprs.IL);
1375
2.53k
  Dir->setLowerBoundVariable(Exprs.LB);
1376
2.53k
  Dir->setUpperBoundVariable(Exprs.UB);
1377
2.53k
  Dir->setStrideVariable(Exprs.ST);
1378
2.53k
  Dir->setEnsureUpperBound(Exprs.EUB);
1379
2.53k
  Dir->setNextLowerBound(Exprs.NLB);
1380
2.53k
  Dir->setNextUpperBound(Exprs.NUB);
1381
2.53k
  Dir->setNumIterations(Exprs.NumIterations);
1382
2.53k
  Dir->setCounters(Exprs.Counters);
1383
2.53k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1384
2.53k
  Dir->setInits(Exprs.Inits);
1385
2.53k
  Dir->setUpdates(Exprs.Updates);
1386
2.53k
  Dir->setFinals(Exprs.Finals);
1387
2.53k
  Dir->setDependentCounters(Exprs.DependentCounters);
1388
2.53k
  Dir->setDependentInits(Exprs.DependentInits);
1389
2.53k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1390
2.53k
  Dir->setPreInits(Exprs.PreInits);
1391
2.53k
  Dir->setHasCancel(HasCancel);
1392
2.53k
  return Dir;
1393
2.53k
}
1394
1395
OMPParallelMaskedTaskLoopDirective *
1396
OMPParallelMaskedTaskLoopDirective::CreateEmpty(const ASTContext &C,
1397
                                                unsigned NumClauses,
1398
                                                unsigned CollapsedNum,
1399
8
                                                EmptyShell) {
1400
8
  return createEmptyDirective<OMPParallelMaskedTaskLoopDirective>(
1401
8
      C, NumClauses, /*HasAssociatedStmt=*/true,
1402
8
      numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop),
1403
8
      CollapsedNum);
1404
8
}
1405
1406
OMPParallelMasterTaskLoopSimdDirective *
1407
OMPParallelMasterTaskLoopSimdDirective::Create(
1408
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1409
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1410
3.64k
    const HelperExprs &Exprs) {
1411
3.64k
  auto *Dir = createDirective<OMPParallelMasterTaskLoopSimdDirective>(
1412
3.64k
      C, Clauses, AssociatedStmt,
1413
3.64k
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd),
1414
3.64k
      StartLoc, EndLoc, CollapsedNum);
1415
3.64k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1416
3.64k
  Dir->setLastIteration(Exprs.LastIteration);
1417
3.64k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1418
3.64k
  Dir->setPreCond(Exprs.PreCond);
1419
3.64k
  Dir->setCond(Exprs.Cond);
1420
3.64k
  Dir->setInit(Exprs.Init);
1421
3.64k
  Dir->setInc(Exprs.Inc);
1422
3.64k
  Dir->setIsLastIterVariable(Exprs.IL);
1423
3.64k
  Dir->setLowerBoundVariable(Exprs.LB);
1424
3.64k
  Dir->setUpperBoundVariable(Exprs.UB);
1425
3.64k
  Dir->setStrideVariable(Exprs.ST);
1426
3.64k
  Dir->setEnsureUpperBound(Exprs.EUB);
1427
3.64k
  Dir->setNextLowerBound(Exprs.NLB);
1428
3.64k
  Dir->setNextUpperBound(Exprs.NUB);
1429
3.64k
  Dir->setNumIterations(Exprs.NumIterations);
1430
3.64k
  Dir->setCounters(Exprs.Counters);
1431
3.64k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1432
3.64k
  Dir->setInits(Exprs.Inits);
1433
3.64k
  Dir->setUpdates(Exprs.Updates);
1434
3.64k
  Dir->setFinals(Exprs.Finals);
1435
3.64k
  Dir->setDependentCounters(Exprs.DependentCounters);
1436
3.64k
  Dir->setDependentInits(Exprs.DependentInits);
1437
3.64k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1438
3.64k
  Dir->setPreInits(Exprs.PreInits);
1439
3.64k
  return Dir;
1440
3.64k
}
1441
1442
OMPParallelMasterTaskLoopSimdDirective *
1443
OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1444
                                                    unsigned NumClauses,
1445
                                                    unsigned CollapsedNum,
1446
44
                                                    EmptyShell) {
1447
44
  return createEmptyDirective<OMPParallelMasterTaskLoopSimdDirective>(
1448
44
      C, NumClauses, /*HasAssociatedStmt=*/true,
1449
44
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd),
1450
44
      CollapsedNum);
1451
44
}
1452
1453
OMPParallelMaskedTaskLoopSimdDirective *
1454
OMPParallelMaskedTaskLoopSimdDirective::Create(
1455
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1456
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1457
3.27k
    const HelperExprs &Exprs) {
1458
3.27k
  auto *Dir = createDirective<OMPParallelMaskedTaskLoopSimdDirective>(
1459
3.27k
      C, Clauses, AssociatedStmt,
1460
3.27k
      numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop_simd),
1461
3.27k
      StartLoc, EndLoc, CollapsedNum);
1462
3.27k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1463
3.27k
  Dir->setLastIteration(Exprs.LastIteration);
1464
3.27k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1465
3.27k
  Dir->setPreCond(Exprs.PreCond);
1466
3.27k
  Dir->setCond(Exprs.Cond);
1467
3.27k
  Dir->setInit(Exprs.Init);
1468
3.27k
  Dir->setInc(Exprs.Inc);
1469
3.27k
  Dir->setIsLastIterVariable(Exprs.IL);
1470
3.27k
  Dir->setLowerBoundVariable(Exprs.LB);
1471
3.27k
  Dir->setUpperBoundVariable(Exprs.UB);
1472
3.27k
  Dir->setStrideVariable(Exprs.ST);
1473
3.27k
  Dir->setEnsureUpperBound(Exprs.EUB);
1474
3.27k
  Dir->setNextLowerBound(Exprs.NLB);
1475
3.27k
  Dir->setNextUpperBound(Exprs.NUB);
1476
3.27k
  Dir->setNumIterations(Exprs.NumIterations);
1477
3.27k
  Dir->setCounters(Exprs.Counters);
1478
3.27k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1479
3.27k
  Dir->setInits(Exprs.Inits);
1480
3.27k
  Dir->setUpdates(Exprs.Updates);
1481
3.27k
  Dir->setFinals(Exprs.Finals);
1482
3.27k
  Dir->setDependentCounters(Exprs.DependentCounters);
1483
3.27k
  Dir->setDependentInits(Exprs.DependentInits);
1484
3.27k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1485
3.27k
  Dir->setPreInits(Exprs.PreInits);
1486
3.27k
  return Dir;
1487
3.27k
}
1488
1489
OMPParallelMaskedTaskLoopSimdDirective *
1490
OMPParallelMaskedTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1491
                                                    unsigned NumClauses,
1492
                                                    unsigned CollapsedNum,
1493
16
                                                    EmptyShell) {
1494
16
  return createEmptyDirective<OMPParallelMaskedTaskLoopSimdDirective>(
1495
16
      C, NumClauses, /*HasAssociatedStmt=*/true,
1496
16
      numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop_simd),
1497
16
      CollapsedNum);
1498
16
}
1499
1500
OMPDistributeDirective *OMPDistributeDirective::Create(
1501
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1502
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1503
1.81k
    const HelperExprs &Exprs) {
1504
1.81k
  auto *Dir = createDirective<OMPDistributeDirective>(
1505
1.81k
      C, Clauses, AssociatedStmt,
1506
1.81k
      numLoopChildren(CollapsedNum, OMPD_distribute), StartLoc, EndLoc,
1507
1.81k
      CollapsedNum);
1508
1.81k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1509
1.81k
  Dir->setLastIteration(Exprs.LastIteration);
1510
1.81k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1511
1.81k
  Dir->setPreCond(Exprs.PreCond);
1512
1.81k
  Dir->setCond(Exprs.Cond);
1513
1.81k
  Dir->setInit(Exprs.Init);
1514
1.81k
  Dir->setInc(Exprs.Inc);
1515
1.81k
  Dir->setIsLastIterVariable(Exprs.IL);
1516
1.81k
  Dir->setLowerBoundVariable(Exprs.LB);
1517
1.81k
  Dir->setUpperBoundVariable(Exprs.UB);
1518
1.81k
  Dir->setStrideVariable(Exprs.ST);
1519
1.81k
  Dir->setEnsureUpperBound(Exprs.EUB);
1520
1.81k
  Dir->setNextLowerBound(Exprs.NLB);
1521
1.81k
  Dir->setNextUpperBound(Exprs.NUB);
1522
1.81k
  Dir->setNumIterations(Exprs.NumIterations);
1523
1.81k
  Dir->setCounters(Exprs.Counters);
1524
1.81k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1525
1.81k
  Dir->setInits(Exprs.Inits);
1526
1.81k
  Dir->setUpdates(Exprs.Updates);
1527
1.81k
  Dir->setFinals(Exprs.Finals);
1528
1.81k
  Dir->setDependentCounters(Exprs.DependentCounters);
1529
1.81k
  Dir->setDependentInits(Exprs.DependentInits);
1530
1.81k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1531
1.81k
  Dir->setPreInits(Exprs.PreInits);
1532
1.81k
  return Dir;
1533
1.81k
}
1534
1535
OMPDistributeDirective *
1536
OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1537
140
                                    unsigned CollapsedNum, EmptyShell) {
1538
140
  return createEmptyDirective<OMPDistributeDirective>(
1539
140
      C, NumClauses, /*HasAssociatedStmt=*/true,
1540
140
      numLoopChildren(CollapsedNum, OMPD_distribute), CollapsedNum);
1541
140
}
1542
1543
OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create(
1544
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1545
3.79k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1546
3.79k
  return createDirective<OMPTargetUpdateDirective>(C, Clauses, AssociatedStmt,
1547
3.79k
                                                   /*NumChildren=*/0, StartLoc,
1548
3.79k
                                                   EndLoc);
1549
3.79k
}
1550
1551
OMPTargetUpdateDirective *
1552
OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1553
404
                                      EmptyShell) {
1554
404
  return createEmptyDirective<OMPTargetUpdateDirective>(
1555
404
      C, NumClauses, /*HasAssociatedStmt=*/true);
1556
404
}
1557
1558
OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1559
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1560
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1561
4.95k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1562
4.95k
  auto *Dir = createDirective<OMPDistributeParallelForDirective>(
1563
4.95k
      C, Clauses, AssociatedStmt,
1564
4.95k
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1, StartLoc,
1565
4.95k
      EndLoc, CollapsedNum);
1566
4.95k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1567
4.95k
  Dir->setLastIteration(Exprs.LastIteration);
1568
4.95k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1569
4.95k
  Dir->setPreCond(Exprs.PreCond);
1570
4.95k
  Dir->setCond(Exprs.Cond);
1571
4.95k
  Dir->setInit(Exprs.Init);
1572
4.95k
  Dir->setInc(Exprs.Inc);
1573
4.95k
  Dir->setIsLastIterVariable(Exprs.IL);
1574
4.95k
  Dir->setLowerBoundVariable(Exprs.LB);
1575
4.95k
  Dir->setUpperBoundVariable(Exprs.UB);
1576
4.95k
  Dir->setStrideVariable(Exprs.ST);
1577
4.95k
  Dir->setEnsureUpperBound(Exprs.EUB);
1578
4.95k
  Dir->setNextLowerBound(Exprs.NLB);
1579
4.95k
  Dir->setNextUpperBound(Exprs.NUB);
1580
4.95k
  Dir->setNumIterations(Exprs.NumIterations);
1581
4.95k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1582
4.95k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1583
4.95k
  Dir->setDistInc(Exprs.DistInc);
1584
4.95k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1585
4.95k
  Dir->setCounters(Exprs.Counters);
1586
4.95k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1587
4.95k
  Dir->setInits(Exprs.Inits);
1588
4.95k
  Dir->setUpdates(Exprs.Updates);
1589
4.95k
  Dir->setFinals(Exprs.Finals);
1590
4.95k
  Dir->setDependentCounters(Exprs.DependentCounters);
1591
4.95k
  Dir->setDependentInits(Exprs.DependentInits);
1592
4.95k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1593
4.95k
  Dir->setPreInits(Exprs.PreInits);
1594
4.95k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1595
4.95k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1596
4.95k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1597
4.95k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1598
4.95k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1599
4.95k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1600
4.95k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1601
4.95k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1602
4.95k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1603
4.95k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1604
4.95k
  Dir->HasCancel = HasCancel;
1605
4.95k
  return Dir;
1606
4.95k
}
1607
1608
OMPDistributeParallelForDirective *
1609
OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1610
                                               unsigned NumClauses,
1611
                                               unsigned CollapsedNum,
1612
280
                                               EmptyShell) {
1613
280
  return createEmptyDirective<OMPDistributeParallelForDirective>(
1614
280
      C, NumClauses, /*HasAssociatedStmt=*/true,
1615
280
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1,
1616
280
      CollapsedNum);
1617
280
}
1618
1619
OMPDistributeParallelForSimdDirective *
1620
OMPDistributeParallelForSimdDirective::Create(
1621
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1622
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1623
5.89k
    const HelperExprs &Exprs) {
1624
5.89k
  auto *Dir = createDirective<OMPDistributeParallelForSimdDirective>(
1625
5.89k
      C, Clauses, AssociatedStmt,
1626
5.89k
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1627
5.89k
      StartLoc, EndLoc, CollapsedNum);
1628
5.89k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1629
5.89k
  Dir->setLastIteration(Exprs.LastIteration);
1630
5.89k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1631
5.89k
  Dir->setPreCond(Exprs.PreCond);
1632
5.89k
  Dir->setCond(Exprs.Cond);
1633
5.89k
  Dir->setInit(Exprs.Init);
1634
5.89k
  Dir->setInc(Exprs.Inc);
1635
5.89k
  Dir->setIsLastIterVariable(Exprs.IL);
1636
5.89k
  Dir->setLowerBoundVariable(Exprs.LB);
1637
5.89k
  Dir->setUpperBoundVariable(Exprs.UB);
1638
5.89k
  Dir->setStrideVariable(Exprs.ST);
1639
5.89k
  Dir->setEnsureUpperBound(Exprs.EUB);
1640
5.89k
  Dir->setNextLowerBound(Exprs.NLB);
1641
5.89k
  Dir->setNextUpperBound(Exprs.NUB);
1642
5.89k
  Dir->setNumIterations(Exprs.NumIterations);
1643
5.89k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1644
5.89k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1645
5.89k
  Dir->setDistInc(Exprs.DistInc);
1646
5.89k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1647
5.89k
  Dir->setCounters(Exprs.Counters);
1648
5.89k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1649
5.89k
  Dir->setInits(Exprs.Inits);
1650
5.89k
  Dir->setUpdates(Exprs.Updates);
1651
5.89k
  Dir->setFinals(Exprs.Finals);
1652
5.89k
  Dir->setDependentCounters(Exprs.DependentCounters);
1653
5.89k
  Dir->setDependentInits(Exprs.DependentInits);
1654
5.89k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1655
5.89k
  Dir->setPreInits(Exprs.PreInits);
1656
5.89k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1657
5.89k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1658
5.89k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1659
5.89k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1660
5.89k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1661
5.89k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1662
5.89k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1663
5.89k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1664
5.89k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1665
5.89k
  return Dir;
1666
5.89k
}
1667
1668
OMPDistributeParallelForSimdDirective *
1669
OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1670
                                                   unsigned NumClauses,
1671
                                                   unsigned CollapsedNum,
1672
262
                                                   EmptyShell) {
1673
262
  return createEmptyDirective<OMPDistributeParallelForSimdDirective>(
1674
262
      C, NumClauses, /*HasAssociatedStmt=*/true,
1675
262
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1676
262
      CollapsedNum);
1677
262
}
1678
1679
OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1680
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1681
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1682
4.44k
    const HelperExprs &Exprs) {
1683
4.44k
  auto *Dir = createDirective<OMPDistributeSimdDirective>(
1684
4.44k
      C, Clauses, AssociatedStmt,
1685
4.44k
      numLoopChildren(CollapsedNum, OMPD_distribute_simd), StartLoc, EndLoc,
1686
4.44k
      CollapsedNum);
1687
4.44k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1688
4.44k
  Dir->setLastIteration(Exprs.LastIteration);
1689
4.44k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1690
4.44k
  Dir->setPreCond(Exprs.PreCond);
1691
4.44k
  Dir->setCond(Exprs.Cond);
1692
4.44k
  Dir->setInit(Exprs.Init);
1693
4.44k
  Dir->setInc(Exprs.Inc);
1694
4.44k
  Dir->setIsLastIterVariable(Exprs.IL);
1695
4.44k
  Dir->setLowerBoundVariable(Exprs.LB);
1696
4.44k
  Dir->setUpperBoundVariable(Exprs.UB);
1697
4.44k
  Dir->setStrideVariable(Exprs.ST);
1698
4.44k
  Dir->setEnsureUpperBound(Exprs.EUB);
1699
4.44k
  Dir->setNextLowerBound(Exprs.NLB);
1700
4.44k
  Dir->setNextUpperBound(Exprs.NUB);
1701
4.44k
  Dir->setNumIterations(Exprs.NumIterations);
1702
4.44k
  Dir->setCounters(Exprs.Counters);
1703
4.44k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1704
4.44k
  Dir->setInits(Exprs.Inits);
1705
4.44k
  Dir->setUpdates(Exprs.Updates);
1706
4.44k
  Dir->setFinals(Exprs.Finals);
1707
4.44k
  Dir->setDependentCounters(Exprs.DependentCounters);
1708
4.44k
  Dir->setDependentInits(Exprs.DependentInits);
1709
4.44k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1710
4.44k
  Dir->setPreInits(Exprs.PreInits);
1711
4.44k
  return Dir;
1712
4.44k
}
1713
1714
OMPDistributeSimdDirective *
1715
OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1716
                                        unsigned NumClauses,
1717
166
                                        unsigned CollapsedNum, EmptyShell) {
1718
166
  return createEmptyDirective<OMPDistributeSimdDirective>(
1719
166
      C, NumClauses, /*HasAssociatedStmt=*/true,
1720
166
      numLoopChildren(CollapsedNum, OMPD_distribute_simd), CollapsedNum);
1721
166
}
1722
1723
OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1724
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1725
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1726
7.62k
    const HelperExprs &Exprs) {
1727
7.62k
  auto *Dir = createDirective<OMPTargetParallelForSimdDirective>(
1728
7.62k
      C, Clauses, AssociatedStmt,
1729
7.62k
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd), StartLoc,
1730
7.62k
      EndLoc, CollapsedNum);
1731
7.62k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1732
7.62k
  Dir->setLastIteration(Exprs.LastIteration);
1733
7.62k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1734
7.62k
  Dir->setPreCond(Exprs.PreCond);
1735
7.62k
  Dir->setCond(Exprs.Cond);
1736
7.62k
  Dir->setInit(Exprs.Init);
1737
7.62k
  Dir->setInc(Exprs.Inc);
1738
7.62k
  Dir->setIsLastIterVariable(Exprs.IL);
1739
7.62k
  Dir->setLowerBoundVariable(Exprs.LB);
1740
7.62k
  Dir->setUpperBoundVariable(Exprs.UB);
1741
7.62k
  Dir->setStrideVariable(Exprs.ST);
1742
7.62k
  Dir->setEnsureUpperBound(Exprs.EUB);
1743
7.62k
  Dir->setNextLowerBound(Exprs.NLB);
1744
7.62k
  Dir->setNextUpperBound(Exprs.NUB);
1745
7.62k
  Dir->setNumIterations(Exprs.NumIterations);
1746
7.62k
  Dir->setCounters(Exprs.Counters);
1747
7.62k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1748
7.62k
  Dir->setInits(Exprs.Inits);
1749
7.62k
  Dir->setUpdates(Exprs.Updates);
1750
7.62k
  Dir->setFinals(Exprs.Finals);
1751
7.62k
  Dir->setDependentCounters(Exprs.DependentCounters);
1752
7.62k
  Dir->setDependentInits(Exprs.DependentInits);
1753
7.62k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1754
7.62k
  Dir->setPreInits(Exprs.PreInits);
1755
7.62k
  return Dir;
1756
7.62k
}
1757
1758
OMPTargetParallelForSimdDirective *
1759
OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1760
                                               unsigned NumClauses,
1761
                                               unsigned CollapsedNum,
1762
523
                                               EmptyShell) {
1763
523
  return createEmptyDirective<OMPTargetParallelForSimdDirective>(
1764
523
      C, NumClauses, /*HasAssociatedStmt=*/true,
1765
523
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd),
1766
523
      CollapsedNum);
1767
523
}
1768
1769
OMPTargetSimdDirective *
1770
OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1771
                               SourceLocation EndLoc, unsigned CollapsedNum,
1772
                               ArrayRef<OMPClause *> Clauses,
1773
7.96k
                               Stmt *AssociatedStmt, const HelperExprs &Exprs) {
1774
7.96k
  auto *Dir = createDirective<OMPTargetSimdDirective>(
1775
7.96k
      C, Clauses, AssociatedStmt,
1776
7.96k
      numLoopChildren(CollapsedNum, OMPD_target_simd), StartLoc, EndLoc,
1777
7.96k
      CollapsedNum);
1778
7.96k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1779
7.96k
  Dir->setLastIteration(Exprs.LastIteration);
1780
7.96k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1781
7.96k
  Dir->setPreCond(Exprs.PreCond);
1782
7.96k
  Dir->setCond(Exprs.Cond);
1783
7.96k
  Dir->setInit(Exprs.Init);
1784
7.96k
  Dir->setInc(Exprs.Inc);
1785
7.96k
  Dir->setCounters(Exprs.Counters);
1786
7.96k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1787
7.96k
  Dir->setInits(Exprs.Inits);
1788
7.96k
  Dir->setUpdates(Exprs.Updates);
1789
7.96k
  Dir->setFinals(Exprs.Finals);
1790
7.96k
  Dir->setDependentCounters(Exprs.DependentCounters);
1791
7.96k
  Dir->setDependentInits(Exprs.DependentInits);
1792
7.96k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1793
7.96k
  Dir->setPreInits(Exprs.PreInits);
1794
7.96k
  return Dir;
1795
7.96k
}
1796
1797
OMPTargetSimdDirective *
1798
OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1799
495
                                    unsigned CollapsedNum, EmptyShell) {
1800
495
  return createEmptyDirective<OMPTargetSimdDirective>(
1801
495
      C, NumClauses, /*HasAssociatedStmt=*/true,
1802
495
      numLoopChildren(CollapsedNum, OMPD_target_simd), CollapsedNum);
1803
495
}
1804
1805
OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1806
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1807
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1808
4.16k
    const HelperExprs &Exprs) {
1809
4.16k
  auto *Dir = createDirective<OMPTeamsDistributeDirective>(
1810
4.16k
      C, Clauses, AssociatedStmt,
1811
4.16k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute), StartLoc, EndLoc,
1812
4.16k
      CollapsedNum);
1813
4.16k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1814
4.16k
  Dir->setLastIteration(Exprs.LastIteration);
1815
4.16k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1816
4.16k
  Dir->setPreCond(Exprs.PreCond);
1817
4.16k
  Dir->setCond(Exprs.Cond);
1818
4.16k
  Dir->setInit(Exprs.Init);
1819
4.16k
  Dir->setInc(Exprs.Inc);
1820
4.16k
  Dir->setIsLastIterVariable(Exprs.IL);
1821
4.16k
  Dir->setLowerBoundVariable(Exprs.LB);
1822
4.16k
  Dir->setUpperBoundVariable(Exprs.UB);
1823
4.16k
  Dir->setStrideVariable(Exprs.ST);
1824
4.16k
  Dir->setEnsureUpperBound(Exprs.EUB);
1825
4.16k
  Dir->setNextLowerBound(Exprs.NLB);
1826
4.16k
  Dir->setNextUpperBound(Exprs.NUB);
1827
4.16k
  Dir->setNumIterations(Exprs.NumIterations);
1828
4.16k
  Dir->setCounters(Exprs.Counters);
1829
4.16k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1830
4.16k
  Dir->setInits(Exprs.Inits);
1831
4.16k
  Dir->setUpdates(Exprs.Updates);
1832
4.16k
  Dir->setFinals(Exprs.Finals);
1833
4.16k
  Dir->setDependentCounters(Exprs.DependentCounters);
1834
4.16k
  Dir->setDependentInits(Exprs.DependentInits);
1835
4.16k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1836
4.16k
  Dir->setPreInits(Exprs.PreInits);
1837
4.16k
  return Dir;
1838
4.16k
}
1839
1840
OMPTeamsDistributeDirective *
1841
OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1842
                                         unsigned NumClauses,
1843
142
                                         unsigned CollapsedNum, EmptyShell) {
1844
142
  return createEmptyDirective<OMPTeamsDistributeDirective>(
1845
142
      C, NumClauses, /*HasAssociatedStmt=*/true,
1846
142
      numLoopChildren(CollapsedNum, OMPD_teams_distribute), CollapsedNum);
1847
142
}
1848
1849
OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1850
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1851
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1852
4.64k
    const HelperExprs &Exprs) {
1853
4.64k
  auto *Dir = createDirective<OMPTeamsDistributeSimdDirective>(
1854
4.64k
      C, Clauses, AssociatedStmt,
1855
4.64k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), StartLoc,
1856
4.64k
      EndLoc, CollapsedNum);
1857
4.64k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1858
4.64k
  Dir->setLastIteration(Exprs.LastIteration);
1859
4.64k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1860
4.64k
  Dir->setPreCond(Exprs.PreCond);
1861
4.64k
  Dir->setCond(Exprs.Cond);
1862
4.64k
  Dir->setInit(Exprs.Init);
1863
4.64k
  Dir->setInc(Exprs.Inc);
1864
4.64k
  Dir->setIsLastIterVariable(Exprs.IL);
1865
4.64k
  Dir->setLowerBoundVariable(Exprs.LB);
1866
4.64k
  Dir->setUpperBoundVariable(Exprs.UB);
1867
4.64k
  Dir->setStrideVariable(Exprs.ST);
1868
4.64k
  Dir->setEnsureUpperBound(Exprs.EUB);
1869
4.64k
  Dir->setNextLowerBound(Exprs.NLB);
1870
4.64k
  Dir->setNextUpperBound(Exprs.NUB);
1871
4.64k
  Dir->setNumIterations(Exprs.NumIterations);
1872
4.64k
  Dir->setCounters(Exprs.Counters);
1873
4.64k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1874
4.64k
  Dir->setInits(Exprs.Inits);
1875
4.64k
  Dir->setUpdates(Exprs.Updates);
1876
4.64k
  Dir->setFinals(Exprs.Finals);
1877
4.64k
  Dir->setDependentCounters(Exprs.DependentCounters);
1878
4.64k
  Dir->setDependentInits(Exprs.DependentInits);
1879
4.64k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1880
4.64k
  Dir->setPreInits(Exprs.PreInits);
1881
4.64k
  return Dir;
1882
4.64k
}
1883
1884
OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1885
    const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1886
206
    EmptyShell) {
1887
206
  return createEmptyDirective<OMPTeamsDistributeSimdDirective>(
1888
206
      C, NumClauses, /*HasAssociatedStmt=*/true,
1889
206
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), CollapsedNum);
1890
206
}
1891
1892
OMPTeamsDistributeParallelForSimdDirective *
1893
OMPTeamsDistributeParallelForSimdDirective::Create(
1894
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1895
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1896
5.46k
    const HelperExprs &Exprs) {
1897
5.46k
  auto *Dir = createDirective<OMPTeamsDistributeParallelForSimdDirective>(
1898
5.46k
      C, Clauses, AssociatedStmt,
1899
5.46k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
1900
5.46k
      StartLoc, EndLoc, CollapsedNum);
1901
5.46k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1902
5.46k
  Dir->setLastIteration(Exprs.LastIteration);
1903
5.46k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1904
5.46k
  Dir->setPreCond(Exprs.PreCond);
1905
5.46k
  Dir->setCond(Exprs.Cond);
1906
5.46k
  Dir->setInit(Exprs.Init);
1907
5.46k
  Dir->setInc(Exprs.Inc);
1908
5.46k
  Dir->setIsLastIterVariable(Exprs.IL);
1909
5.46k
  Dir->setLowerBoundVariable(Exprs.LB);
1910
5.46k
  Dir->setUpperBoundVariable(Exprs.UB);
1911
5.46k
  Dir->setStrideVariable(Exprs.ST);
1912
5.46k
  Dir->setEnsureUpperBound(Exprs.EUB);
1913
5.46k
  Dir->setNextLowerBound(Exprs.NLB);
1914
5.46k
  Dir->setNextUpperBound(Exprs.NUB);
1915
5.46k
  Dir->setNumIterations(Exprs.NumIterations);
1916
5.46k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1917
5.46k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1918
5.46k
  Dir->setDistInc(Exprs.DistInc);
1919
5.46k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1920
5.46k
  Dir->setCounters(Exprs.Counters);
1921
5.46k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1922
5.46k
  Dir->setInits(Exprs.Inits);
1923
5.46k
  Dir->setUpdates(Exprs.Updates);
1924
5.46k
  Dir->setFinals(Exprs.Finals);
1925
5.46k
  Dir->setDependentCounters(Exprs.DependentCounters);
1926
5.46k
  Dir->setDependentInits(Exprs.DependentInits);
1927
5.46k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1928
5.46k
  Dir->setPreInits(Exprs.PreInits);
1929
5.46k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1930
5.46k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1931
5.46k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1932
5.46k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1933
5.46k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1934
5.46k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1935
5.46k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1936
5.46k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1937
5.46k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1938
5.46k
  return Dir;
1939
5.46k
}
1940
1941
OMPTeamsDistributeParallelForSimdDirective *
1942
OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1943
                                                        unsigned NumClauses,
1944
                                                        unsigned CollapsedNum,
1945
370
                                                        EmptyShell) {
1946
370
  return createEmptyDirective<OMPTeamsDistributeParallelForSimdDirective>(
1947
370
      C, NumClauses, /*HasAssociatedStmt=*/true,
1948
370
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
1949
370
      CollapsedNum);
1950
370
}
1951
1952
OMPTeamsDistributeParallelForDirective *
1953
OMPTeamsDistributeParallelForDirective::Create(
1954
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1955
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1956
4.65k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1957
4.65k
  auto *Dir = createDirective<OMPTeamsDistributeParallelForDirective>(
1958
4.65k
      C, Clauses, AssociatedStmt,
1959
4.65k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
1960
4.65k
      StartLoc, EndLoc, CollapsedNum);
1961
4.65k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1962
4.65k
  Dir->setLastIteration(Exprs.LastIteration);
1963
4.65k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1964
4.65k
  Dir->setPreCond(Exprs.PreCond);
1965
4.65k
  Dir->setCond(Exprs.Cond);
1966
4.65k
  Dir->setInit(Exprs.Init);
1967
4.65k
  Dir->setInc(Exprs.Inc);
1968
4.65k
  Dir->setIsLastIterVariable(Exprs.IL);
1969
4.65k
  Dir->setLowerBoundVariable(Exprs.LB);
1970
4.65k
  Dir->setUpperBoundVariable(Exprs.UB);
1971
4.65k
  Dir->setStrideVariable(Exprs.ST);
1972
4.65k
  Dir->setEnsureUpperBound(Exprs.EUB);
1973
4.65k
  Dir->setNextLowerBound(Exprs.NLB);
1974
4.65k
  Dir->setNextUpperBound(Exprs.NUB);
1975
4.65k
  Dir->setNumIterations(Exprs.NumIterations);
1976
4.65k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1977
4.65k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1978
4.65k
  Dir->setDistInc(Exprs.DistInc);
1979
4.65k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1980
4.65k
  Dir->setCounters(Exprs.Counters);
1981
4.65k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1982
4.65k
  Dir->setInits(Exprs.Inits);
1983
4.65k
  Dir->setUpdates(Exprs.Updates);
1984
4.65k
  Dir->setFinals(Exprs.Finals);
1985
4.65k
  Dir->setDependentCounters(Exprs.DependentCounters);
1986
4.65k
  Dir->setDependentInits(Exprs.DependentInits);
1987
4.65k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1988
4.65k
  Dir->setPreInits(Exprs.PreInits);
1989
4.65k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1990
4.65k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1991
4.65k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1992
4.65k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1993
4.65k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1994
4.65k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1995
4.65k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1996
4.65k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1997
4.65k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1998
4.65k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1999
4.65k
  Dir->HasCancel = HasCancel;
2000
4.65k
  return Dir;
2001
4.65k
}
2002
2003
OMPTeamsDistributeParallelForDirective *
2004
OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
2005
                                                    unsigned NumClauses,
2006
                                                    unsigned CollapsedNum,
2007
334
                                                    EmptyShell) {
2008
334
  return createEmptyDirective<OMPTeamsDistributeParallelForDirective>(
2009
334
      C, NumClauses, /*HasAssociatedStmt=*/true,
2010
334
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
2011
334
      CollapsedNum);
2012
334
}
2013
2014
OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
2015
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2016
7.53k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
2017
7.53k
  return createDirective<OMPTargetTeamsDirective>(C, Clauses, AssociatedStmt,
2018
7.53k
                                                  /*NumChildren=*/0, StartLoc,
2019
7.53k
                                                  EndLoc);
2020
7.53k
}
2021
2022
OMPTargetTeamsDirective *
2023
OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
2024
737
                                     EmptyShell) {
2025
737
  return createEmptyDirective<OMPTargetTeamsDirective>(
2026
737
      C, NumClauses, /*HasAssociatedStmt=*/true);
2027
737
}
2028
2029
OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
2030
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2031
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2032
6.86k
    const HelperExprs &Exprs) {
2033
6.86k
  auto *Dir = createDirective<OMPTargetTeamsDistributeDirective>(
2034
6.86k
      C, Clauses, AssociatedStmt,
2035
6.86k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute), StartLoc,
2036
6.86k
      EndLoc, CollapsedNum);
2037
6.86k
  Dir->setIterationVariable(Exprs.IterationVarRef);
2038
6.86k
  Dir->setLastIteration(Exprs.LastIteration);
2039
6.86k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2040
6.86k
  Dir->setPreCond(Exprs.PreCond);
2041
6.86k
  Dir->setCond(Exprs.Cond);
2042
6.86k
  Dir->setInit(Exprs.Init);
2043
6.86k
  Dir->setInc(Exprs.Inc);
2044
6.86k
  Dir->setIsLastIterVariable(Exprs.IL);
2045
6.86k
  Dir->setLowerBoundVariable(Exprs.LB);
2046
6.86k
  Dir->setUpperBoundVariable(Exprs.UB);
2047
6.86k
  Dir->setStrideVariable(Exprs.ST);
2048
6.86k
  Dir->setEnsureUpperBound(Exprs.EUB);
2049
6.86k
  Dir->setNextLowerBound(Exprs.NLB);
2050
6.86k
  Dir->setNextUpperBound(Exprs.NUB);
2051
6.86k
  Dir->setNumIterations(Exprs.NumIterations);
2052
6.86k
  Dir->setCounters(Exprs.Counters);
2053
6.86k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2054
6.86k
  Dir->setInits(Exprs.Inits);
2055
6.86k
  Dir->setUpdates(Exprs.Updates);
2056
6.86k
  Dir->setFinals(Exprs.Finals);
2057
6.86k
  Dir->setDependentCounters(Exprs.DependentCounters);
2058
6.86k
  Dir->setDependentInits(Exprs.DependentInits);
2059
6.86k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2060
6.86k
  Dir->setPreInits(Exprs.PreInits);
2061
6.86k
  return Dir;
2062
6.86k
}
2063
2064
OMPTargetTeamsDistributeDirective *
2065
OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
2066
                                               unsigned NumClauses,
2067
                                               unsigned CollapsedNum,
2068
475
                                               EmptyShell) {
2069
475
  return createEmptyDirective<OMPTargetTeamsDistributeDirective>(
2070
475
      C, NumClauses, /*HasAssociatedStmt=*/true,
2071
475
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute),
2072
475
      CollapsedNum);
2073
475
}
2074
2075
OMPTargetTeamsDistributeParallelForDirective *
2076
OMPTargetTeamsDistributeParallelForDirective::Create(
2077
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2078
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2079
7.26k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
2080
7.26k
  auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForDirective>(
2081
7.26k
      C, Clauses, AssociatedStmt,
2082
7.26k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
2083
7.26k
          1,
2084
7.26k
      StartLoc, EndLoc, CollapsedNum);
2085
7.26k
  Dir->setIterationVariable(Exprs.IterationVarRef);
2086
7.26k
  Dir->setLastIteration(Exprs.LastIteration);
2087
7.26k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2088
7.26k
  Dir->setPreCond(Exprs.PreCond);
2089
7.26k
  Dir->setCond(Exprs.Cond);
2090
7.26k
  Dir->setInit(Exprs.Init);
2091
7.26k
  Dir->setInc(Exprs.Inc);
2092
7.26k
  Dir->setIsLastIterVariable(Exprs.IL);
2093
7.26k
  Dir->setLowerBoundVariable(Exprs.LB);
2094
7.26k
  Dir->setUpperBoundVariable(Exprs.UB);
2095
7.26k
  Dir->setStrideVariable(Exprs.ST);
2096
7.26k
  Dir->setEnsureUpperBound(Exprs.EUB);
2097
7.26k
  Dir->setNextLowerBound(Exprs.NLB);
2098
7.26k
  Dir->setNextUpperBound(Exprs.NUB);
2099
7.26k
  Dir->setNumIterations(Exprs.NumIterations);
2100
7.26k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2101
7.26k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2102
7.26k
  Dir->setDistInc(Exprs.DistInc);
2103
7.26k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2104
7.26k
  Dir->setCounters(Exprs.Counters);
2105
7.26k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2106
7.26k
  Dir->setInits(Exprs.Inits);
2107
7.26k
  Dir->setUpdates(Exprs.Updates);
2108
7.26k
  Dir->setFinals(Exprs.Finals);
2109
7.26k
  Dir->setDependentCounters(Exprs.DependentCounters);
2110
7.26k
  Dir->setDependentInits(Exprs.DependentInits);
2111
7.26k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2112
7.26k
  Dir->setPreInits(Exprs.PreInits);
2113
7.26k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2114
7.26k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2115
7.26k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2116
7.26k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2117
7.26k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2118
7.26k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2119
7.26k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2120
7.26k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2121
7.26k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2122
7.26k
  Dir->setTaskReductionRefExpr(TaskRedRef);
2123
7.26k
  Dir->HasCancel = HasCancel;
2124
7.26k
  return Dir;
2125
7.26k
}
2126
2127
OMPTargetTeamsDistributeParallelForDirective *
2128
OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
2129
                                                          unsigned NumClauses,
2130
                                                          unsigned CollapsedNum,
2131
448
                                                          EmptyShell) {
2132
448
  return createEmptyDirective<OMPTargetTeamsDistributeParallelForDirective>(
2133
448
      C, NumClauses, /*HasAssociatedStmt=*/true,
2134
448
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
2135
448
          1,
2136
448
      CollapsedNum);
2137
448
}
2138
2139
OMPTargetTeamsDistributeParallelForSimdDirective *
2140
OMPTargetTeamsDistributeParallelForSimdDirective::Create(
2141
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2142
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2143
9.05k
    const HelperExprs &Exprs) {
2144
9.05k
  auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
2145
9.05k
      C, Clauses, AssociatedStmt,
2146
9.05k
      numLoopChildren(CollapsedNum,
2147
9.05k
                      OMPD_target_teams_distribute_parallel_for_simd),
2148
9.05k
      StartLoc, EndLoc, CollapsedNum);
2149
9.05k
  Dir->setIterationVariable(Exprs.IterationVarRef);
2150
9.05k
  Dir->setLastIteration(Exprs.LastIteration);
2151
9.05k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2152
9.05k
  Dir->setPreCond(Exprs.PreCond);
2153
9.05k
  Dir->setCond(Exprs.Cond);
2154
9.05k
  Dir->setInit(Exprs.Init);
2155
9.05k
  Dir->setInc(Exprs.Inc);
2156
9.05k
  Dir->setIsLastIterVariable(Exprs.IL);
2157
9.05k
  Dir->setLowerBoundVariable(Exprs.LB);
2158
9.05k
  Dir->setUpperBoundVariable(Exprs.UB);
2159
9.05k
  Dir->setStrideVariable(Exprs.ST);
2160
9.05k
  Dir->setEnsureUpperBound(Exprs.EUB);
2161
9.05k
  Dir->setNextLowerBound(Exprs.NLB);
2162
9.05k
  Dir->setNextUpperBound(Exprs.NUB);
2163
9.05k
  Dir->setNumIterations(Exprs.NumIterations);
2164
9.05k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
2165
9.05k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
2166
9.05k
  Dir->setDistInc(Exprs.DistInc);
2167
9.05k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
2168
9.05k
  Dir->setCounters(Exprs.Counters);
2169
9.05k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2170
9.05k
  Dir->setInits(Exprs.Inits);
2171
9.05k
  Dir->setUpdates(Exprs.Updates);
2172
9.05k
  Dir->setFinals(Exprs.Finals);
2173
9.05k
  Dir->setDependentCounters(Exprs.DependentCounters);
2174
9.05k
  Dir->setDependentInits(Exprs.DependentInits);
2175
9.05k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2176
9.05k
  Dir->setPreInits(Exprs.PreInits);
2177
9.05k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
2178
9.05k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
2179
9.05k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
2180
9.05k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
2181
9.05k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
2182
9.05k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
2183
9.05k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
2184
9.05k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
2185
9.05k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
2186
9.05k
  return Dir;
2187
9.05k
}
2188
2189
OMPTargetTeamsDistributeParallelForSimdDirective *
2190
OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
2191
    const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
2192
569
    EmptyShell) {
2193
569
  return createEmptyDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
2194
569
      C, NumClauses, /*HasAssociatedStmt=*/true,
2195
569
      numLoopChildren(CollapsedNum,
2196
569
                      OMPD_target_teams_distribute_parallel_for_simd),
2197
569
      CollapsedNum);
2198
569
}
2199
2200
OMPTargetTeamsDistributeSimdDirective *
2201
OMPTargetTeamsDistributeSimdDirective::Create(
2202
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2203
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2204
8.60k
    const HelperExprs &Exprs) {
2205
8.60k
  auto *Dir = createDirective<OMPTargetTeamsDistributeSimdDirective>(
2206
8.60k
      C, Clauses, AssociatedStmt,
2207
8.60k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
2208
8.60k
      StartLoc, EndLoc, CollapsedNum);
2209
8.60k
  Dir->setIterationVariable(Exprs.IterationVarRef);
2210
8.60k
  Dir->setLastIteration(Exprs.LastIteration);
2211
8.60k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2212
8.60k
  Dir->setPreCond(Exprs.PreCond);
2213
8.60k
  Dir->setCond(Exprs.Cond);
2214
8.60k
  Dir->setInit(Exprs.Init);
2215
8.60k
  Dir->setInc(Exprs.Inc);
2216
8.60k
  Dir->setIsLastIterVariable(Exprs.IL);
2217
8.60k
  Dir->setLowerBoundVariable(Exprs.LB);
2218
8.60k
  Dir->setUpperBoundVariable(Exprs.UB);
2219
8.60k
  Dir->setStrideVariable(Exprs.ST);
2220
8.60k
  Dir->setEnsureUpperBound(Exprs.EUB);
2221
8.60k
  Dir->setNextLowerBound(Exprs.NLB);
2222
8.60k
  Dir->setNextUpperBound(Exprs.NUB);
2223
8.60k
  Dir->setNumIterations(Exprs.NumIterations);
2224
8.60k
  Dir->setCounters(Exprs.Counters);
2225
8.60k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2226
8.60k
  Dir->setInits(Exprs.Inits);
2227
8.60k
  Dir->setUpdates(Exprs.Updates);
2228
8.60k
  Dir->setFinals(Exprs.Finals);
2229
8.60k
  Dir->setDependentCounters(Exprs.DependentCounters);
2230
8.60k
  Dir->setDependentInits(Exprs.DependentInits);
2231
8.60k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2232
8.60k
  Dir->setPreInits(Exprs.PreInits);
2233
8.60k
  return Dir;
2234
8.60k
}
2235
2236
OMPTargetTeamsDistributeSimdDirective *
2237
OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
2238
                                                   unsigned NumClauses,
2239
                                                   unsigned CollapsedNum,
2240
547
                                                   EmptyShell) {
2241
547
  return createEmptyDirective<OMPTargetTeamsDistributeSimdDirective>(
2242
547
      C, NumClauses, /*HasAssociatedStmt=*/true,
2243
547
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
2244
547
      CollapsedNum);
2245
547
}
2246
2247
OMPInteropDirective *
2248
OMPInteropDirective::Create(const ASTContext &C, SourceLocation StartLoc,
2249
                            SourceLocation EndLoc,
2250
149
                            ArrayRef<OMPClause *> Clauses) {
2251
149
  return createDirective<OMPInteropDirective>(
2252
149
      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
2253
149
      EndLoc);
2254
149
}
2255
2256
OMPInteropDirective *OMPInteropDirective::CreateEmpty(const ASTContext &C,
2257
                                                      unsigned NumClauses,
2258
48
                                                      EmptyShell) {
2259
48
  return createEmptyDirective<OMPInteropDirective>(C, NumClauses);
2260
48
}
2261
2262
OMPDispatchDirective *OMPDispatchDirective::Create(
2263
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2264
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2265
128
    SourceLocation TargetCallLoc) {
2266
128
  auto *Dir = createDirective<OMPDispatchDirective>(
2267
128
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
2268
128
  Dir->setTargetCallLoc(TargetCallLoc);
2269
128
  return Dir;
2270
128
}
2271
2272
OMPDispatchDirective *OMPDispatchDirective::CreateEmpty(const ASTContext &C,
2273
                                                        unsigned NumClauses,
2274
40
                                                        EmptyShell) {
2275
40
  return createEmptyDirective<OMPDispatchDirective>(C, NumClauses,
2276
40
                                                    /*HasAssociatedStmt=*/true,
2277
40
                                                    /*NumChildren=*/0);
2278
40
}
2279
2280
OMPMaskedDirective *OMPMaskedDirective::Create(const ASTContext &C,
2281
                                               SourceLocation StartLoc,
2282
                                               SourceLocation EndLoc,
2283
                                               ArrayRef<OMPClause *> Clauses,
2284
120
                                               Stmt *AssociatedStmt) {
2285
120
  return createDirective<OMPMaskedDirective>(C, Clauses, AssociatedStmt,
2286
120
                                             /*NumChildren=*/0, StartLoc,
2287
120
                                             EndLoc);
2288
120
}
2289
2290
OMPMaskedDirective *OMPMaskedDirective::CreateEmpty(const ASTContext &C,
2291
                                                    unsigned NumClauses,
2292
30
                                                    EmptyShell) {
2293
30
  return createEmptyDirective<OMPMaskedDirective>(C, NumClauses,
2294
30
                                                  /*HasAssociatedStmt=*/true);
2295
30
}
2296
2297
OMPGenericLoopDirective *OMPGenericLoopDirective::Create(
2298
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2299
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2300
46
    const HelperExprs &Exprs) {
2301
46
  auto *Dir = createDirective<OMPGenericLoopDirective>(
2302
46
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_loop),
2303
46
      StartLoc, EndLoc, CollapsedNum);
2304
46
  Dir->setIterationVariable(Exprs.IterationVarRef);
2305
46
  Dir->setLastIteration(Exprs.LastIteration);
2306
46
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2307
46
  Dir->setPreCond(Exprs.PreCond);
2308
46
  Dir->setCond(Exprs.Cond);
2309
46
  Dir->setInit(Exprs.Init);
2310
46
  Dir->setInc(Exprs.Inc);
2311
46
  Dir->setIsLastIterVariable(Exprs.IL);
2312
46
  Dir->setLowerBoundVariable(Exprs.LB);
2313
46
  Dir->setUpperBoundVariable(Exprs.UB);
2314
46
  Dir->setStrideVariable(Exprs.ST);
2315
46
  Dir->setEnsureUpperBound(Exprs.EUB);
2316
46
  Dir->setNextLowerBound(Exprs.NLB);
2317
46
  Dir->setNextUpperBound(Exprs.NUB);
2318
46
  Dir->setNumIterations(Exprs.NumIterations);
2319
46
  Dir->setCounters(Exprs.Counters);
2320
46
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2321
46
  Dir->setInits(Exprs.Inits);
2322
46
  Dir->setUpdates(Exprs.Updates);
2323
46
  Dir->setFinals(Exprs.Finals);
2324
46
  Dir->setDependentCounters(Exprs.DependentCounters);
2325
46
  Dir->setDependentInits(Exprs.DependentInits);
2326
46
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2327
46
  Dir->setPreInits(Exprs.PreInits);
2328
46
  return Dir;
2329
46
}
2330
2331
OMPGenericLoopDirective *
2332
OMPGenericLoopDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
2333
14
                                     unsigned CollapsedNum, EmptyShell) {
2334
14
  return createEmptyDirective<OMPGenericLoopDirective>(
2335
14
      C, NumClauses, /*HasAssociatedStmt=*/true,
2336
14
      numLoopChildren(CollapsedNum, OMPD_loop), CollapsedNum);
2337
14
}
2338
2339
OMPTeamsGenericLoopDirective *OMPTeamsGenericLoopDirective::Create(
2340
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2341
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2342
35
    const HelperExprs &Exprs) {
2343
35
  auto *Dir = createDirective<OMPTeamsGenericLoopDirective>(
2344
35
      C, Clauses, AssociatedStmt,
2345
35
      numLoopChildren(CollapsedNum, OMPD_teams_loop), StartLoc, EndLoc,
2346
35
      CollapsedNum);
2347
35
  Dir->setIterationVariable(Exprs.IterationVarRef);
2348
35
  Dir->setLastIteration(Exprs.LastIteration);
2349
35
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2350
35
  Dir->setPreCond(Exprs.PreCond);
2351
35
  Dir->setCond(Exprs.Cond);
2352
35
  Dir->setInit(Exprs.Init);
2353
35
  Dir->setInc(Exprs.Inc);
2354
35
  Dir->setIsLastIterVariable(Exprs.IL);
2355
35
  Dir->setLowerBoundVariable(Exprs.LB);
2356
35
  Dir->setUpperBoundVariable(Exprs.UB);
2357
35
  Dir->setStrideVariable(Exprs.ST);
2358
35
  Dir->setEnsureUpperBound(Exprs.EUB);
2359
35
  Dir->setNextLowerBound(Exprs.NLB);
2360
35
  Dir->setNextUpperBound(Exprs.NUB);
2361
35
  Dir->setNumIterations(Exprs.NumIterations);
2362
35
  Dir->setCounters(Exprs.Counters);
2363
35
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2364
35
  Dir->setInits(Exprs.Inits);
2365
35
  Dir->setUpdates(Exprs.Updates);
2366
35
  Dir->setFinals(Exprs.Finals);
2367
35
  Dir->setDependentCounters(Exprs.DependentCounters);
2368
35
  Dir->setDependentInits(Exprs.DependentInits);
2369
35
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2370
35
  Dir->setPreInits(Exprs.PreInits);
2371
35
  return Dir;
2372
35
}
2373
2374
OMPTeamsGenericLoopDirective *
2375
OMPTeamsGenericLoopDirective::CreateEmpty(const ASTContext &C,
2376
                                          unsigned NumClauses,
2377
6
                                          unsigned CollapsedNum, EmptyShell) {
2378
6
  return createEmptyDirective<OMPTeamsGenericLoopDirective>(
2379
6
      C, NumClauses, /*HasAssociatedStmt=*/true,
2380
6
      numLoopChildren(CollapsedNum, OMPD_teams_loop), CollapsedNum);
2381
6
}
2382
2383
OMPTargetTeamsGenericLoopDirective *OMPTargetTeamsGenericLoopDirective::Create(
2384
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2385
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2386
43
    const HelperExprs &Exprs) {
2387
43
  auto *Dir = createDirective<OMPTargetTeamsGenericLoopDirective>(
2388
43
      C, Clauses, AssociatedStmt,
2389
43
      numLoopChildren(CollapsedNum, OMPD_target_teams_loop), StartLoc, EndLoc,
2390
43
      CollapsedNum);
2391
43
  Dir->setIterationVariable(Exprs.IterationVarRef);
2392
43
  Dir->setLastIteration(Exprs.LastIteration);
2393
43
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2394
43
  Dir->setPreCond(Exprs.PreCond);
2395
43
  Dir->setCond(Exprs.Cond);
2396
43
  Dir->setInit(Exprs.Init);
2397
43
  Dir->setInc(Exprs.Inc);
2398
43
  Dir->setIsLastIterVariable(Exprs.IL);
2399
43
  Dir->setLowerBoundVariable(Exprs.LB);
2400
43
  Dir->setUpperBoundVariable(Exprs.UB);
2401
43
  Dir->setStrideVariable(Exprs.ST);
2402
43
  Dir->setEnsureUpperBound(Exprs.EUB);
2403
43
  Dir->setNextLowerBound(Exprs.NLB);
2404
43
  Dir->setNextUpperBound(Exprs.NUB);
2405
43
  Dir->setNumIterations(Exprs.NumIterations);
2406
43
  Dir->setCounters(Exprs.Counters);
2407
43
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2408
43
  Dir->setInits(Exprs.Inits);
2409
43
  Dir->setUpdates(Exprs.Updates);
2410
43
  Dir->setFinals(Exprs.Finals);
2411
43
  Dir->setDependentCounters(Exprs.DependentCounters);
2412
43
  Dir->setDependentInits(Exprs.DependentInits);
2413
43
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2414
43
  Dir->setPreInits(Exprs.PreInits);
2415
43
  return Dir;
2416
43
}
2417
2418
OMPTargetTeamsGenericLoopDirective *
2419
OMPTargetTeamsGenericLoopDirective::CreateEmpty(const ASTContext &C,
2420
                                                unsigned NumClauses,
2421
                                                unsigned CollapsedNum,
2422
8
                                                EmptyShell) {
2423
8
  return createEmptyDirective<OMPTargetTeamsGenericLoopDirective>(
2424
8
      C, NumClauses, /*HasAssociatedStmt=*/true,
2425
8
      numLoopChildren(CollapsedNum, OMPD_target_teams_loop), CollapsedNum);
2426
8
}
2427
2428
OMPParallelGenericLoopDirective *OMPParallelGenericLoopDirective::Create(
2429
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2430
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2431
40
    const HelperExprs &Exprs) {
2432
40
  auto *Dir = createDirective<OMPParallelGenericLoopDirective>(
2433
40
      C, Clauses, AssociatedStmt,
2434
40
      numLoopChildren(CollapsedNum, OMPD_parallel_loop), StartLoc, EndLoc,
2435
40
      CollapsedNum);
2436
40
  Dir->setIterationVariable(Exprs.IterationVarRef);
2437
40
  Dir->setLastIteration(Exprs.LastIteration);
2438
40
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2439
40
  Dir->setPreCond(Exprs.PreCond);
2440
40
  Dir->setCond(Exprs.Cond);
2441
40
  Dir->setInit(Exprs.Init);
2442
40
  Dir->setInc(Exprs.Inc);
2443
40
  Dir->setIsLastIterVariable(Exprs.IL);
2444
40
  Dir->setLowerBoundVariable(Exprs.LB);
2445
40
  Dir->setUpperBoundVariable(Exprs.UB);
2446
40
  Dir->setStrideVariable(Exprs.ST);
2447
40
  Dir->setEnsureUpperBound(Exprs.EUB);
2448
40
  Dir->setNextLowerBound(Exprs.NLB);
2449
40
  Dir->setNextUpperBound(Exprs.NUB);
2450
40
  Dir->setNumIterations(Exprs.NumIterations);
2451
40
  Dir->setCounters(Exprs.Counters);
2452
40
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2453
40
  Dir->setInits(Exprs.Inits);
2454
40
  Dir->setUpdates(Exprs.Updates);
2455
40
  Dir->setFinals(Exprs.Finals);
2456
40
  Dir->setDependentCounters(Exprs.DependentCounters);
2457
40
  Dir->setDependentInits(Exprs.DependentInits);
2458
40
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2459
40
  Dir->setPreInits(Exprs.PreInits);
2460
40
  return Dir;
2461
40
}
2462
2463
OMPParallelGenericLoopDirective *OMPParallelGenericLoopDirective::CreateEmpty(
2464
    const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
2465
7
    EmptyShell) {
2466
7
  return createEmptyDirective<OMPParallelGenericLoopDirective>(
2467
7
      C, NumClauses, /*HasAssociatedStmt=*/true,
2468
7
      numLoopChildren(CollapsedNum, OMPD_parallel_loop), CollapsedNum);
2469
7
}
2470
2471
OMPTargetParallelGenericLoopDirective *
2472
OMPTargetParallelGenericLoopDirective::Create(
2473
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2474
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2475
45
    const HelperExprs &Exprs) {
2476
45
  auto *Dir = createDirective<OMPTargetParallelGenericLoopDirective>(
2477
45
      C, Clauses, AssociatedStmt,
2478
45
      numLoopChildren(CollapsedNum, OMPD_target_parallel_loop), StartLoc,
2479
45
      EndLoc, CollapsedNum);
2480
45
  Dir->setIterationVariable(Exprs.IterationVarRef);
2481
45
  Dir->setLastIteration(Exprs.LastIteration);
2482
45
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2483
45
  Dir->setPreCond(Exprs.PreCond);
2484
45
  Dir->setCond(Exprs.Cond);
2485
45
  Dir->setInit(Exprs.Init);
2486
45
  Dir->setInc(Exprs.Inc);
2487
45
  Dir->setIsLastIterVariable(Exprs.IL);
2488
45
  Dir->setLowerBoundVariable(Exprs.LB);
2489
45
  Dir->setUpperBoundVariable(Exprs.UB);
2490
45
  Dir->setStrideVariable(Exprs.ST);
2491
45
  Dir->setEnsureUpperBound(Exprs.EUB);
2492
45
  Dir->setNextLowerBound(Exprs.NLB);
2493
45
  Dir->setNextUpperBound(Exprs.NUB);
2494
45
  Dir->setNumIterations(Exprs.NumIterations);
2495
45
  Dir->setCounters(Exprs.Counters);
2496
45
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2497
45
  Dir->setInits(Exprs.Inits);
2498
45
  Dir->setUpdates(Exprs.Updates);
2499
45
  Dir->setFinals(Exprs.Finals);
2500
45
  Dir->setDependentCounters(Exprs.DependentCounters);
2501
45
  Dir->setDependentInits(Exprs.DependentInits);
2502
45
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2503
45
  Dir->setPreInits(Exprs.PreInits);
2504
45
  return Dir;
2505
45
}
2506
2507
OMPTargetParallelGenericLoopDirective *
2508
OMPTargetParallelGenericLoopDirective::CreateEmpty(const ASTContext &C,
2509
                                                   unsigned NumClauses,
2510
                                                   unsigned CollapsedNum,
2511
8
                                                   EmptyShell) {
2512
8
  return createEmptyDirective<OMPTargetParallelGenericLoopDirective>(
2513
8
      C, NumClauses, /*HasAssociatedStmt=*/true,
2514
8
      numLoopChildren(CollapsedNum, OMPD_target_parallel_loop), CollapsedNum);
2515
8
}