Coverage Report

Created: 2022-01-18 06:27

/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
314k
                         unsigned NumChildren) {
21
314k
  return llvm::alignTo(
22
314k
      totalSizeToAlloc<OMPClause *, Stmt *>(
23
314k
          NumClauses, NumChildren + (HasAssociatedStmt ? 
1306k
:
07.78k
)),
24
314k
      alignof(OMPChildren));
25
314k
}
26
27
317k
void OMPChildren::setClauses(ArrayRef<OMPClause *> Clauses) {
28
317k
  assert(Clauses.size() == NumClauses &&
29
317k
         "Number of clauses is not the same as the preallocated buffer");
30
0
  llvm::copy(Clauses, getTrailingObjects<OMPClause *>());
31
317k
}
32
33
4.53M
MutableArrayRef<Stmt *> OMPChildren::getChildren() {
34
4.53M
  return llvm::makeMutableArrayRef(getTrailingObjects<Stmt *>(), NumChildren);
35
4.53M
}
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
296k
                                 Stmt *S, unsigned NumChildren) {
45
296k
  auto *Data = CreateEmpty(Mem, Clauses.size(), S, NumChildren);
46
296k
  Data->setClauses(Clauses);
47
296k
  if (S)
48
289k
    Data->setAssociatedStmt(S);
49
296k
  return Data;
50
296k
}
51
52
OMPChildren *OMPChildren::CreateEmpty(void *Mem, unsigned NumClauses,
53
                                      bool HasAssociatedStmt,
54
314k
                                      unsigned NumChildren) {
55
314k
  return new (Mem) OMPChildren(NumClauses, NumChildren, HasAssociatedStmt);
56
314k
}
57
58
31.8k
bool OMPExecutableDirective::isStandaloneDirective() const {
59
  // Special case: 'omp target enter data', 'omp target exit data',
60
  // 'omp target update' are stand-alone directives, but for implementation
61
  // reasons they have empty synthetic structured block, to simplify codegen.
62
31.8k
  if (isa<OMPTargetEnterDataDirective>(this) ||
63
31.8k
      
isa<OMPTargetExitDataDirective>(this)31.3k
||
64
31.8k
      
isa<OMPTargetUpdateDirective>(this)30.9k
)
65
1.24k
    return true;
66
30.5k
  return !hasAssociatedStmt();
67
31.8k
}
68
69
5.79k
Stmt *OMPExecutableDirective::getStructuredBlock() {
70
5.79k
  assert(!isStandaloneDirective() &&
71
5.79k
         "Standalone Executable Directives don't have Structured Blocks.");
72
5.79k
  if (auto *LD = dyn_cast<OMPLoopDirective>(this))
73
2.80k
    return LD->getBody();
74
2.98k
  return getRawStmt();
75
5.79k
}
76
77
Stmt *
78
OMPLoopBasedDirective::tryToFindNextInnerLoop(Stmt *CurStmt,
79
175k
                                              bool TryImperfectlyNestedLoops) {
80
175k
  Stmt *OrigStmt = CurStmt;
81
175k
  CurStmt = CurStmt->IgnoreContainers();
82
  // Additional work for imperfectly nested loops, introduced in OpenMP 5.0.
83
175k
  if (TryImperfectlyNestedLoops) {
84
123k
    if (auto *CS = dyn_cast<CompoundStmt>(CurStmt)) {
85
13.8k
      CurStmt = nullptr;
86
13.8k
      SmallVector<CompoundStmt *, 4> Statements(1, CS);
87
13.8k
      SmallVector<CompoundStmt *, 4> NextStatements;
88
27.5k
      while (!Statements.empty()) {
89
13.8k
        CS = Statements.pop_back_val();
90
13.8k
        if (!CS)
91
0
          continue;
92
22.8k
        
for (Stmt *S : CS->body())13.8k
{
93
22.8k
          if (!S)
94
0
            continue;
95
22.8k
          if (auto *CanonLoop = dyn_cast<OMPCanonicalLoop>(S))
96
0
            S = CanonLoop->getLoopStmt();
97
22.8k
          if (isa<ForStmt>(S) || 
isa<CXXForRangeStmt>(S)22.6k
||
98
22.8k
              
(22.6k
isa<OMPLoopBasedDirective>(S)22.6k
&&
!isa<OMPLoopDirective>(S)37
)) {
99
            // Only single loop construct is allowed.
100
172
            if (CurStmt) {
101
18
              CurStmt = OrigStmt;
102
18
              break;
103
18
            }
104
154
            CurStmt = S;
105
154
            continue;
106
172
          }
107
22.6k
          S = S->IgnoreContainers();
108
22.6k
          if (auto *InnerCS = dyn_cast_or_null<CompoundStmt>(S))
109
18
            NextStatements.push_back(InnerCS);
110
22.6k
        }
111
13.8k
        if (Statements.empty()) {
112
          // Found single inner loop or multiple loops - exit.
113
13.8k
          if (CurStmt)
114
154
            break;
115
13.6k
          Statements.swap(NextStatements);
116
13.6k
        }
117
13.8k
      }
118
13.8k
      if (!CurStmt)
119
13.6k
        CurStmt = OrigStmt;
120
13.8k
    }
121
123k
  }
122
175k
  return CurStmt;
123
175k
}
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
166k
        OnTransformationCallback) {
130
166k
  CurStmt = CurStmt->IgnoreContainers();
131
330k
  for (unsigned Cnt = 0; Cnt < NumLoops; 
++Cnt163k
) {
132
170k
    while (true) {
133
170k
      auto *Dir = dyn_cast<OMPLoopTransformationDirective>(CurStmt);
134
170k
      if (!Dir)
135
170k
        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
170k
    if (auto *CanonLoop = dyn_cast<OMPCanonicalLoop>(CurStmt))
158
128
      CurStmt = CanonLoop->getLoopStmt();
159
170k
    if (Callback(Cnt, CurStmt))
160
7.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
163k
    if (auto *For = dyn_cast<ForStmt>(CurStmt)) {
167
163k
      CurStmt = For->getBody();
168
163k
    } else {
169
87
      assert(isa<CXXForRangeStmt>(CurStmt) &&
170
87
             "Expected canonical for or range-based for loops.");
171
0
      CurStmt = cast<CXXForRangeStmt>(CurStmt)->getBody();
172
87
    }
173
0
    CurStmt = OMPLoopBasedDirective::tryToFindNextInnerLoop(
174
163k
        CurStmt, TryImperfectlyNestedLoops);
175
163k
  }
176
159k
  return true;
177
166k
}
178
179
void OMPLoopBasedDirective::doForAllLoopsBodies(
180
    Stmt *CurStmt, bool TryImperfectlyNestedLoops, unsigned NumLoops,
181
2.82k
    llvm::function_ref<void(unsigned, Stmt *, Stmt *)> Callback) {
182
2.82k
  bool Res = OMPLoopBasedDirective::doForAllLoops(
183
2.82k
      CurStmt, TryImperfectlyNestedLoops, NumLoops,
184
2.86k
      [Callback](unsigned Cnt, Stmt *Loop) {
185
2.86k
        Stmt *Body = nullptr;
186
2.86k
        if (auto *For = dyn_cast<ForStmt>(Loop)) {
187
2.86k
          Body = For->getBody();
188
2.86k
        } 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.86k
        if (auto *CanonLoop = dyn_cast<OMPCanonicalLoop>(Body))
194
0
          Body = CanonLoop->getLoopStmt();
195
2.86k
        Callback(Cnt, Loop, Body);
196
2.86k
        return false;
197
2.86k
      });
198
2.82k
  assert(Res && "Expected only loops");
199
0
  (void)Res;
200
2.82k
}
201
202
2.82k
Stmt *OMPLoopDirective::getBody() {
203
  // This relies on the loop form is already checked by Sema.
204
2.82k
  Stmt *Body = nullptr;
205
2.82k
  OMPLoopBasedDirective::doForAllLoopsBodies(
206
2.82k
      Data->getRawStmt(), /*TryImperfectlyNestedLoops=*/true,
207
2.82k
      NumAssociatedLoops,
208
2.86k
      [&Body](unsigned, Stmt *, Stmt *BodyStmt) { Body = BodyStmt; });
209
2.82k
  return Body;
210
2.82k
}
211
212
139k
void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
213
139k
  assert(A.size() == getLoopsNumber() &&
214
139k
         "Number of loop counters is not the same as the collapsed number");
215
0
  llvm::copy(A, getCounters().begin());
216
139k
}
217
218
139k
void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
219
139k
  assert(A.size() == getLoopsNumber() && "Number of loop private counters "
220
139k
                                         "is not the same as the collapsed "
221
139k
                                         "number");
222
0
  llvm::copy(A, getPrivateCounters().begin());
223
139k
}
224
225
139k
void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
226
139k
  assert(A.size() == getLoopsNumber() &&
227
139k
         "Number of counter inits is not the same as the collapsed number");
228
0
  llvm::copy(A, getInits().begin());
229
139k
}
230
231
139k
void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
232
139k
  assert(A.size() == getLoopsNumber() &&
233
139k
         "Number of counter updates is not the same as the collapsed number");
234
0
  llvm::copy(A, getUpdates().begin());
235
139k
}
236
237
139k
void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
238
139k
  assert(A.size() == getLoopsNumber() &&
239
139k
         "Number of counter finals is not the same as the collapsed number");
240
0
  llvm::copy(A, getFinals().begin());
241
139k
}
242
243
139k
void OMPLoopDirective::setDependentCounters(ArrayRef<Expr *> A) {
244
139k
  assert(
245
139k
      A.size() == getLoopsNumber() &&
246
139k
      "Number of dependent counters is not the same as the collapsed number");
247
0
  llvm::copy(A, getDependentCounters().begin());
248
139k
}
249
250
139k
void OMPLoopDirective::setDependentInits(ArrayRef<Expr *> A) {
251
139k
  assert(A.size() == getLoopsNumber() &&
252
139k
         "Number of dependent inits is not the same as the collapsed number");
253
0
  llvm::copy(A, getDependentInits().begin());
254
139k
}
255
256
139k
void OMPLoopDirective::setFinalsConditions(ArrayRef<Expr *> A) {
257
139k
  assert(A.size() == getLoopsNumber() &&
258
139k
         "Number of finals conditions is not the same as the collapsed number");
259
0
  llvm::copy(A, getFinalsConditions().begin());
260
139k
}
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
24.0k
    bool HasCancel) {
285
24.0k
  auto *Dir = createDirective<OMPParallelDirective>(
286
24.0k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
287
24.0k
  Dir->setTaskReductionRefExpr(TaskRedRef);
288
24.0k
  Dir->setHasCancel(HasCancel);
289
24.0k
  return Dir;
290
24.0k
}
291
292
OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
293
                                                        unsigned NumClauses,
294
740
                                                        EmptyShell) {
295
740
  return createEmptyDirective<OMPParallelDirective>(C, NumClauses,
296
740
                                                    /*HasAssociatedStmt=*/true,
297
740
                                                    /*NumChildren=*/1);
298
740
}
299
300
OMPSimdDirective *
301
OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
302
                         SourceLocation EndLoc, unsigned CollapsedNum,
303
                         ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
304
5.73k
                         const HelperExprs &Exprs) {
305
5.73k
  auto *Dir = createDirective<OMPSimdDirective>(
306
5.73k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_simd),
307
5.73k
      StartLoc, EndLoc, CollapsedNum);
308
5.73k
  Dir->setIterationVariable(Exprs.IterationVarRef);
309
5.73k
  Dir->setLastIteration(Exprs.LastIteration);
310
5.73k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
311
5.73k
  Dir->setPreCond(Exprs.PreCond);
312
5.73k
  Dir->setCond(Exprs.Cond);
313
5.73k
  Dir->setInit(Exprs.Init);
314
5.73k
  Dir->setInc(Exprs.Inc);
315
5.73k
  Dir->setCounters(Exprs.Counters);
316
5.73k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
317
5.73k
  Dir->setInits(Exprs.Inits);
318
5.73k
  Dir->setUpdates(Exprs.Updates);
319
5.73k
  Dir->setFinals(Exprs.Finals);
320
5.73k
  Dir->setDependentCounters(Exprs.DependentCounters);
321
5.73k
  Dir->setDependentInits(Exprs.DependentInits);
322
5.73k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
323
5.73k
  Dir->setPreInits(Exprs.PreInits);
324
5.73k
  return Dir;
325
5.73k
}
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.49k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
340
6.49k
  auto *Dir = createDirective<OMPForDirective>(
341
6.49k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_for) + 1,
342
6.49k
      StartLoc, EndLoc, CollapsedNum);
343
6.49k
  Dir->setIterationVariable(Exprs.IterationVarRef);
344
6.49k
  Dir->setLastIteration(Exprs.LastIteration);
345
6.49k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
346
6.49k
  Dir->setPreCond(Exprs.PreCond);
347
6.49k
  Dir->setCond(Exprs.Cond);
348
6.49k
  Dir->setInit(Exprs.Init);
349
6.49k
  Dir->setInc(Exprs.Inc);
350
6.49k
  Dir->setIsLastIterVariable(Exprs.IL);
351
6.49k
  Dir->setLowerBoundVariable(Exprs.LB);
352
6.49k
  Dir->setUpperBoundVariable(Exprs.UB);
353
6.49k
  Dir->setStrideVariable(Exprs.ST);
354
6.49k
  Dir->setEnsureUpperBound(Exprs.EUB);
355
6.49k
  Dir->setNextLowerBound(Exprs.NLB);
356
6.49k
  Dir->setNextUpperBound(Exprs.NUB);
357
6.49k
  Dir->setNumIterations(Exprs.NumIterations);
358
6.49k
  Dir->setCounters(Exprs.Counters);
359
6.49k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
360
6.49k
  Dir->setInits(Exprs.Inits);
361
6.49k
  Dir->setUpdates(Exprs.Updates);
362
6.49k
  Dir->setFinals(Exprs.Finals);
363
6.49k
  Dir->setDependentCounters(Exprs.DependentCounters);
364
6.49k
  Dir->setDependentInits(Exprs.DependentInits);
365
6.49k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
366
6.49k
  Dir->setPreInits(Exprs.PreInits);
367
6.49k
  Dir->setTaskReductionRefExpr(TaskRedRef);
368
6.49k
  Dir->setHasCancel(HasCancel);
369
6.49k
  return Dir;
370
6.49k
}
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.27k
                            const HelperExprs &Exprs) {
455
5.27k
  auto *Dir = createDirective<OMPForSimdDirective>(
456
5.27k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_for_simd),
457
5.27k
      StartLoc, EndLoc, CollapsedNum);
458
5.27k
  Dir->setIterationVariable(Exprs.IterationVarRef);
459
5.27k
  Dir->setLastIteration(Exprs.LastIteration);
460
5.27k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
461
5.27k
  Dir->setPreCond(Exprs.PreCond);
462
5.27k
  Dir->setCond(Exprs.Cond);
463
5.27k
  Dir->setInit(Exprs.Init);
464
5.27k
  Dir->setInc(Exprs.Inc);
465
5.27k
  Dir->setIsLastIterVariable(Exprs.IL);
466
5.27k
  Dir->setLowerBoundVariable(Exprs.LB);
467
5.27k
  Dir->setUpperBoundVariable(Exprs.UB);
468
5.27k
  Dir->setStrideVariable(Exprs.ST);
469
5.27k
  Dir->setEnsureUpperBound(Exprs.EUB);
470
5.27k
  Dir->setNextLowerBound(Exprs.NLB);
471
5.27k
  Dir->setNextUpperBound(Exprs.NUB);
472
5.27k
  Dir->setNumIterations(Exprs.NumIterations);
473
5.27k
  Dir->setCounters(Exprs.Counters);
474
5.27k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
475
5.27k
  Dir->setInits(Exprs.Inits);
476
5.27k
  Dir->setUpdates(Exprs.Updates);
477
5.27k
  Dir->setFinals(Exprs.Finals);
478
5.27k
  Dir->setDependentCounters(Exprs.DependentCounters);
479
5.27k
  Dir->setDependentInits(Exprs.DependentInits);
480
5.27k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
481
5.27k
  Dir->setPreInits(Exprs.PreInits);
482
5.27k
  return Dir;
483
5.27k
}
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.48k
    bool HasCancel) {
498
3.48k
  auto *Dir = createDirective<OMPSectionsDirective>(C, Clauses, AssociatedStmt,
499
3.48k
                                                    /*NumChildren=*/1, StartLoc,
500
3.48k
                                                    EndLoc);
501
3.48k
  Dir->setTaskReductionRefExpr(TaskRedRef);
502
3.48k
  Dir->setHasCancel(HasCancel);
503
3.48k
  return Dir;
504
3.48k
}
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
855
                                                 bool HasCancel) {
519
855
  auto *Dir =
520
855
      createDirective<OMPSectionDirective>(C, llvm::None, AssociatedStmt,
521
855
                                           /*NumChildren=*/0, StartLoc, EndLoc);
522
855
  Dir->setHasCancel(HasCancel);
523
855
  return Dir;
524
855
}
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
1.79k
                                               Stmt *AssociatedStmt) {
537
1.79k
  return createDirective<OMPSingleDirective>(C, Clauses, AssociatedStmt,
538
1.79k
                                             /*NumChildren=*/0, StartLoc,
539
1.79k
                                             EndLoc);
540
1.79k
}
541
542
OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
543
                                                    unsigned NumClauses,
544
45
                                                    EmptyShell) {
545
45
  return createEmptyDirective<OMPSingleDirective>(C, NumClauses,
546
45
                                                  /*HasAssociatedStmt=*/true);
547
45
}
548
549
OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
550
                                               SourceLocation StartLoc,
551
                                               SourceLocation EndLoc,
552
1.08k
                                               Stmt *AssociatedStmt) {
553
1.08k
  return createDirective<OMPMasterDirective>(C, llvm::None, AssociatedStmt,
554
1.08k
                                             /*NumChildren=*/0, StartLoc,
555
1.08k
                                             EndLoc);
556
1.08k
}
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.62k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
568
1.62k
  return createDirective<OMPCriticalDirective>(C, Clauses, AssociatedStmt,
569
1.62k
                                               /*NumChildren=*/0, Name,
570
1.62k
                                               StartLoc, EndLoc);
571
1.62k
}
572
573
OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
574
                                                        unsigned NumClauses,
575
73
                                                        EmptyShell) {
576
73
  return createEmptyDirective<OMPCriticalDirective>(C, NumClauses,
577
73
                                                    /*HasAssociatedStmt=*/true);
578
73
}
579
580
OMPParallelForDirective *OMPParallelForDirective::Create(
581
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
582
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
583
4.51k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
584
4.51k
  auto *Dir = createDirective<OMPParallelForDirective>(
585
4.51k
      C, Clauses, AssociatedStmt,
586
4.51k
      numLoopChildren(CollapsedNum, OMPD_parallel_for) + 1, StartLoc, EndLoc,
587
4.51k
      CollapsedNum);
588
4.51k
  Dir->setIterationVariable(Exprs.IterationVarRef);
589
4.51k
  Dir->setLastIteration(Exprs.LastIteration);
590
4.51k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
591
4.51k
  Dir->setPreCond(Exprs.PreCond);
592
4.51k
  Dir->setCond(Exprs.Cond);
593
4.51k
  Dir->setInit(Exprs.Init);
594
4.51k
  Dir->setInc(Exprs.Inc);
595
4.51k
  Dir->setIsLastIterVariable(Exprs.IL);
596
4.51k
  Dir->setLowerBoundVariable(Exprs.LB);
597
4.51k
  Dir->setUpperBoundVariable(Exprs.UB);
598
4.51k
  Dir->setStrideVariable(Exprs.ST);
599
4.51k
  Dir->setEnsureUpperBound(Exprs.EUB);
600
4.51k
  Dir->setNextLowerBound(Exprs.NLB);
601
4.51k
  Dir->setNextUpperBound(Exprs.NUB);
602
4.51k
  Dir->setNumIterations(Exprs.NumIterations);
603
4.51k
  Dir->setCounters(Exprs.Counters);
604
4.51k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
605
4.51k
  Dir->setInits(Exprs.Inits);
606
4.51k
  Dir->setUpdates(Exprs.Updates);
607
4.51k
  Dir->setFinals(Exprs.Finals);
608
4.51k
  Dir->setDependentCounters(Exprs.DependentCounters);
609
4.51k
  Dir->setDependentInits(Exprs.DependentInits);
610
4.51k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
611
4.51k
  Dir->setPreInits(Exprs.PreInits);
612
4.51k
  Dir->setTaskReductionRefExpr(TaskRedRef);
613
4.51k
  Dir->setHasCancel(HasCancel);
614
4.51k
  return Dir;
615
4.51k
}
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.66k
    const HelperExprs &Exprs) {
629
5.66k
  auto *Dir = createDirective<OMPParallelForSimdDirective>(
630
5.66k
      C, Clauses, AssociatedStmt,
631
5.66k
      numLoopChildren(CollapsedNum, OMPD_parallel_for_simd), StartLoc, EndLoc,
632
5.66k
      CollapsedNum);
633
5.66k
  Dir->setIterationVariable(Exprs.IterationVarRef);
634
5.66k
  Dir->setLastIteration(Exprs.LastIteration);
635
5.66k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
636
5.66k
  Dir->setPreCond(Exprs.PreCond);
637
5.66k
  Dir->setCond(Exprs.Cond);
638
5.66k
  Dir->setInit(Exprs.Init);
639
5.66k
  Dir->setInc(Exprs.Inc);
640
5.66k
  Dir->setIsLastIterVariable(Exprs.IL);
641
5.66k
  Dir->setLowerBoundVariable(Exprs.LB);
642
5.66k
  Dir->setUpperBoundVariable(Exprs.UB);
643
5.66k
  Dir->setStrideVariable(Exprs.ST);
644
5.66k
  Dir->setEnsureUpperBound(Exprs.EUB);
645
5.66k
  Dir->setNextLowerBound(Exprs.NLB);
646
5.66k
  Dir->setNextUpperBound(Exprs.NUB);
647
5.66k
  Dir->setNumIterations(Exprs.NumIterations);
648
5.66k
  Dir->setCounters(Exprs.Counters);
649
5.66k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
650
5.66k
  Dir->setInits(Exprs.Inits);
651
5.66k
  Dir->setUpdates(Exprs.Updates);
652
5.66k
  Dir->setFinals(Exprs.Finals);
653
5.66k
  Dir->setDependentCounters(Exprs.DependentCounters);
654
5.66k
  Dir->setDependentInits(Exprs.DependentInits);
655
5.66k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
656
5.66k
  Dir->setPreInits(Exprs.PreInits);
657
5.66k
  return Dir;
658
5.66k
}
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
2.82k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef) {
672
2.82k
  auto *Dir = createDirective<OMPParallelMasterDirective>(
673
2.82k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
674
2.82k
  Dir->setTaskReductionRefExpr(TaskRedRef);
675
2.82k
  return Dir;
676
2.82k
}
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
OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
686
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
687
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
688
3.30k
    bool HasCancel) {
689
3.30k
  auto *Dir = createDirective<OMPParallelSectionsDirective>(
690
3.30k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
691
3.30k
  Dir->setTaskReductionRefExpr(TaskRedRef);
692
3.30k
  Dir->setHasCancel(HasCancel);
693
3.30k
  return Dir;
694
3.30k
}
695
696
OMPParallelSectionsDirective *
697
OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
698
32
                                          unsigned NumClauses, EmptyShell) {
699
32
  return createEmptyDirective<OMPParallelSectionsDirective>(
700
32
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
701
32
}
702
703
OMPTaskDirective *
704
OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc,
705
                         SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
706
3.61k
                         Stmt *AssociatedStmt, bool HasCancel) {
707
3.61k
  auto *Dir = createDirective<OMPTaskDirective>(
708
3.61k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
709
3.61k
  Dir->setHasCancel(HasCancel);
710
3.61k
  return Dir;
711
3.61k
}
712
713
OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
714
                                                unsigned NumClauses,
715
194
                                                EmptyShell) {
716
194
  return createEmptyDirective<OMPTaskDirective>(C, NumClauses,
717
194
                                                /*HasAssociatedStmt=*/true);
718
194
}
719
720
OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
721
                                                     SourceLocation StartLoc,
722
606
                                                     SourceLocation EndLoc) {
723
606
  return new (C) OMPTaskyieldDirective(StartLoc, EndLoc);
724
606
}
725
726
OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
727
13
                                                          EmptyShell) {
728
13
  return new (C) OMPTaskyieldDirective();
729
13
}
730
731
OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
732
                                                 SourceLocation StartLoc,
733
355
                                                 SourceLocation EndLoc) {
734
355
  return new (C) OMPBarrierDirective(StartLoc, EndLoc);
735
355
}
736
737
OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
738
30
                                                      EmptyShell) {
739
30
  return new (C) OMPBarrierDirective();
740
30
}
741
742
OMPTaskwaitDirective *
743
OMPTaskwaitDirective::Create(const ASTContext &C, SourceLocation StartLoc,
744
                             SourceLocation EndLoc,
745
645
                             ArrayRef<OMPClause *> Clauses) {
746
645
  return createDirective<OMPTaskwaitDirective>(
747
645
      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
748
645
      EndLoc);
749
645
}
750
751
OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
752
                                                        unsigned NumClauses,
753
19
                                                        EmptyShell) {
754
19
  return createEmptyDirective<OMPTaskwaitDirective>(C, NumClauses);
755
19
}
756
757
OMPTaskgroupDirective *OMPTaskgroupDirective::Create(
758
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
759
2.52k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) {
760
2.52k
  auto *Dir = createDirective<OMPTaskgroupDirective>(
761
2.52k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
762
2.52k
  Dir->setReductionRef(ReductionRef);
763
2.52k
  return Dir;
764
2.52k
}
765
766
OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
767
                                                          unsigned NumClauses,
768
88
                                                          EmptyShell) {
769
88
  return createEmptyDirective<OMPTaskgroupDirective>(
770
88
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
771
88
}
772
773
OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
774
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
775
179
    OpenMPDirectiveKind CancelRegion) {
776
179
  auto *Dir = new (C) OMPCancellationPointDirective(StartLoc, EndLoc);
777
179
  Dir->setCancelRegion(CancelRegion);
778
179
  return Dir;
779
179
}
780
781
OMPCancellationPointDirective *
782
66
OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
783
66
  return new (C) OMPCancellationPointDirective();
784
66
}
785
786
OMPCancelDirective *
787
OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
788
                           SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
789
624
                           OpenMPDirectiveKind CancelRegion) {
790
624
  auto *Dir = createDirective<OMPCancelDirective>(
791
624
      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
792
624
      EndLoc);
793
624
  Dir->setCancelRegion(CancelRegion);
794
624
  return Dir;
795
624
}
796
797
OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
798
                                                    unsigned NumClauses,
799
162
                                                    EmptyShell) {
800
162
  return createEmptyDirective<OMPCancelDirective>(C, NumClauses);
801
162
}
802
803
OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
804
                                             SourceLocation StartLoc,
805
                                             SourceLocation EndLoc,
806
917
                                             ArrayRef<OMPClause *> Clauses) {
807
917
  return createDirective<OMPFlushDirective>(
808
917
      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
809
917
      EndLoc);
810
917
}
811
812
OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
813
                                                  unsigned NumClauses,
814
50
                                                  EmptyShell) {
815
50
  return createEmptyDirective<OMPFlushDirective>(C, NumClauses);
816
50
}
817
818
OMPDepobjDirective *OMPDepobjDirective::Create(const ASTContext &C,
819
                                               SourceLocation StartLoc,
820
                                               SourceLocation EndLoc,
821
238
                                               ArrayRef<OMPClause *> Clauses) {
822
238
  return createDirective<OMPDepobjDirective>(
823
238
      C, Clauses, /*AssociatedStmt=*/nullptr,
824
238
      /*NumChildren=*/0, StartLoc, EndLoc);
825
238
}
826
827
OMPDepobjDirective *OMPDepobjDirective::CreateEmpty(const ASTContext &C,
828
                                                    unsigned NumClauses,
829
28
                                                    EmptyShell) {
830
28
  return createEmptyDirective<OMPDepobjDirective>(C, NumClauses);
831
28
}
832
833
OMPScanDirective *OMPScanDirective::Create(const ASTContext &C,
834
                                           SourceLocation StartLoc,
835
                                           SourceLocation EndLoc,
836
98
                                           ArrayRef<OMPClause *> Clauses) {
837
98
  return createDirective<OMPScanDirective>(C, Clauses,
838
98
                                           /*AssociatedStmt=*/nullptr,
839
98
                                           /*NumChildren=*/0, StartLoc, EndLoc);
840
98
}
841
842
OMPScanDirective *OMPScanDirective::CreateEmpty(const ASTContext &C,
843
                                                unsigned NumClauses,
844
24
                                                EmptyShell) {
845
24
  return createEmptyDirective<OMPScanDirective>(C, NumClauses);
846
24
}
847
848
OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
849
                                                 SourceLocation StartLoc,
850
                                                 SourceLocation EndLoc,
851
                                                 ArrayRef<OMPClause *> Clauses,
852
1.22k
                                                 Stmt *AssociatedStmt) {
853
1.22k
  return createDirective<OMPOrderedDirective>(
854
1.22k
      C, Clauses, cast_or_null<CapturedStmt>(AssociatedStmt),
855
1.22k
      /*NumChildren=*/0, StartLoc, EndLoc);
856
1.22k
}
857
858
OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
859
                                                      unsigned NumClauses,
860
                                                      bool IsStandalone,
861
82
                                                      EmptyShell) {
862
82
  return createEmptyDirective<OMPOrderedDirective>(C, NumClauses,
863
82
                                                   !IsStandalone);
864
82
}
865
866
OMPAtomicDirective *OMPAtomicDirective::Create(
867
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
868
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
869
4.11k
    Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) {
870
4.11k
  auto *Dir = createDirective<OMPAtomicDirective>(
871
4.11k
      C, Clauses, AssociatedStmt, /*NumChildren=*/4, StartLoc, EndLoc);
872
4.11k
  Dir->setX(X);
873
4.11k
  Dir->setV(V);
874
4.11k
  Dir->setExpr(E);
875
4.11k
  Dir->setUpdateExpr(UE);
876
4.11k
  Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
877
4.11k
  Dir->IsPostfixUpdate = IsPostfixUpdate;
878
4.11k
  return Dir;
879
4.11k
}
880
881
OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
882
                                                    unsigned NumClauses,
883
682
                                                    EmptyShell) {
884
682
  return createEmptyDirective<OMPAtomicDirective>(
885
682
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/4);
886
682
}
887
888
OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
889
                                               SourceLocation StartLoc,
890
                                               SourceLocation EndLoc,
891
                                               ArrayRef<OMPClause *> Clauses,
892
53.6k
                                               Stmt *AssociatedStmt) {
893
53.6k
  return createDirective<OMPTargetDirective>(
894
53.6k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
895
53.6k
}
896
897
OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
898
                                                    unsigned NumClauses,
899
4.58k
                                                    EmptyShell) {
900
4.58k
  return createEmptyDirective<OMPTargetDirective>(C, NumClauses,
901
4.58k
                                                  /*HasAssociatedStmt=*/true);
902
4.58k
}
903
904
OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
905
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
906
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
907
7.43k
    bool HasCancel) {
908
7.43k
  auto *Dir = createDirective<OMPTargetParallelDirective>(
909
7.43k
      C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc);
910
7.43k
  Dir->setTaskReductionRefExpr(TaskRedRef);
911
7.43k
  Dir->setHasCancel(HasCancel);
912
7.43k
  return Dir;
913
7.43k
}
914
915
OMPTargetParallelDirective *
916
OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
917
617
                                        unsigned NumClauses, EmptyShell) {
918
617
  return createEmptyDirective<OMPTargetParallelDirective>(
919
617
      C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1);
920
617
}
921
922
OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
923
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
924
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
925
7.45k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
926
7.45k
  auto *Dir = createDirective<OMPTargetParallelForDirective>(
927
7.45k
      C, Clauses, AssociatedStmt,
928
7.45k
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1, StartLoc,
929
7.45k
      EndLoc, CollapsedNum);
930
7.45k
  Dir->setIterationVariable(Exprs.IterationVarRef);
931
7.45k
  Dir->setLastIteration(Exprs.LastIteration);
932
7.45k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
933
7.45k
  Dir->setPreCond(Exprs.PreCond);
934
7.45k
  Dir->setCond(Exprs.Cond);
935
7.45k
  Dir->setInit(Exprs.Init);
936
7.45k
  Dir->setInc(Exprs.Inc);
937
7.45k
  Dir->setIsLastIterVariable(Exprs.IL);
938
7.45k
  Dir->setLowerBoundVariable(Exprs.LB);
939
7.45k
  Dir->setUpperBoundVariable(Exprs.UB);
940
7.45k
  Dir->setStrideVariable(Exprs.ST);
941
7.45k
  Dir->setEnsureUpperBound(Exprs.EUB);
942
7.45k
  Dir->setNextLowerBound(Exprs.NLB);
943
7.45k
  Dir->setNextUpperBound(Exprs.NUB);
944
7.45k
  Dir->setNumIterations(Exprs.NumIterations);
945
7.45k
  Dir->setCounters(Exprs.Counters);
946
7.45k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
947
7.45k
  Dir->setInits(Exprs.Inits);
948
7.45k
  Dir->setUpdates(Exprs.Updates);
949
7.45k
  Dir->setFinals(Exprs.Finals);
950
7.45k
  Dir->setDependentCounters(Exprs.DependentCounters);
951
7.45k
  Dir->setDependentInits(Exprs.DependentInits);
952
7.45k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
953
7.45k
  Dir->setPreInits(Exprs.PreInits);
954
7.45k
  Dir->setTaskReductionRefExpr(TaskRedRef);
955
7.45k
  Dir->setHasCancel(HasCancel);
956
7.45k
  return Dir;
957
7.45k
}
958
959
OMPTargetParallelForDirective *
960
OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
961
                                           unsigned NumClauses,
962
437
                                           unsigned CollapsedNum, EmptyShell) {
963
437
  return createEmptyDirective<OMPTargetParallelForDirective>(
964
437
      C, NumClauses, /*HasAssociatedStmt=*/true,
965
437
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1,
966
437
      CollapsedNum);
967
437
}
968
969
OMPTargetDataDirective *OMPTargetDataDirective::Create(
970
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
971
5.43k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
972
5.43k
  return createDirective<OMPTargetDataDirective>(
973
5.43k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
974
5.43k
}
975
976
OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
977
                                                            unsigned N,
978
254
                                                            EmptyShell) {
979
254
  return createEmptyDirective<OMPTargetDataDirective>(
980
254
      C, N, /*HasAssociatedStmt=*/true);
981
254
}
982
983
OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
984
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
985
1.80k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
986
1.80k
  return createDirective<OMPTargetEnterDataDirective>(
987
1.80k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
988
1.80k
}
989
990
OMPTargetEnterDataDirective *
991
OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
992
289
                                         EmptyShell) {
993
289
  return createEmptyDirective<OMPTargetEnterDataDirective>(
994
289
      C, N, /*HasAssociatedStmt=*/true);
995
289
}
996
997
OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create(
998
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
999
1.77k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1000
1.77k
  return createDirective<OMPTargetExitDataDirective>(
1001
1.77k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1002
1.77k
}
1003
1004
OMPTargetExitDataDirective *
1005
OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N,
1006
277
                                        EmptyShell) {
1007
277
  return createEmptyDirective<OMPTargetExitDataDirective>(
1008
277
      C, N, /*HasAssociatedStmt=*/true);
1009
277
}
1010
1011
OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
1012
                                             SourceLocation StartLoc,
1013
                                             SourceLocation EndLoc,
1014
                                             ArrayRef<OMPClause *> Clauses,
1015
18.3k
                                             Stmt *AssociatedStmt) {
1016
18.3k
  return createDirective<OMPTeamsDirective>(
1017
18.3k
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
1018
18.3k
}
1019
1020
OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
1021
                                                  unsigned NumClauses,
1022
958
                                                  EmptyShell) {
1023
958
  return createEmptyDirective<OMPTeamsDirective>(C, NumClauses,
1024
958
                                                 /*HasAssociatedStmt=*/true);
1025
958
}
1026
1027
OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
1028
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1029
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1030
4.83k
    const HelperExprs &Exprs, bool HasCancel) {
1031
4.83k
  auto *Dir = createDirective<OMPTaskLoopDirective>(
1032
4.83k
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_taskloop),
1033
4.83k
      StartLoc, EndLoc, CollapsedNum);
1034
4.83k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1035
4.83k
  Dir->setLastIteration(Exprs.LastIteration);
1036
4.83k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1037
4.83k
  Dir->setPreCond(Exprs.PreCond);
1038
4.83k
  Dir->setCond(Exprs.Cond);
1039
4.83k
  Dir->setInit(Exprs.Init);
1040
4.83k
  Dir->setInc(Exprs.Inc);
1041
4.83k
  Dir->setIsLastIterVariable(Exprs.IL);
1042
4.83k
  Dir->setLowerBoundVariable(Exprs.LB);
1043
4.83k
  Dir->setUpperBoundVariable(Exprs.UB);
1044
4.83k
  Dir->setStrideVariable(Exprs.ST);
1045
4.83k
  Dir->setEnsureUpperBound(Exprs.EUB);
1046
4.83k
  Dir->setNextLowerBound(Exprs.NLB);
1047
4.83k
  Dir->setNextUpperBound(Exprs.NUB);
1048
4.83k
  Dir->setNumIterations(Exprs.NumIterations);
1049
4.83k
  Dir->setCounters(Exprs.Counters);
1050
4.83k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1051
4.83k
  Dir->setInits(Exprs.Inits);
1052
4.83k
  Dir->setUpdates(Exprs.Updates);
1053
4.83k
  Dir->setFinals(Exprs.Finals);
1054
4.83k
  Dir->setDependentCounters(Exprs.DependentCounters);
1055
4.83k
  Dir->setDependentInits(Exprs.DependentInits);
1056
4.83k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1057
4.83k
  Dir->setPreInits(Exprs.PreInits);
1058
4.83k
  Dir->setHasCancel(HasCancel);
1059
4.83k
  return Dir;
1060
4.83k
}
1061
1062
OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
1063
                                                        unsigned NumClauses,
1064
                                                        unsigned CollapsedNum,
1065
36
                                                        EmptyShell) {
1066
36
  return createEmptyDirective<OMPTaskLoopDirective>(
1067
36
      C, NumClauses, /*HasAssociatedStmt=*/true,
1068
36
      numLoopChildren(CollapsedNum, OMPD_taskloop), CollapsedNum);
1069
36
}
1070
1071
OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
1072
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1073
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1074
4.30k
    const HelperExprs &Exprs) {
1075
4.30k
  auto *Dir = createDirective<OMPTaskLoopSimdDirective>(
1076
4.30k
      C, Clauses, AssociatedStmt,
1077
4.30k
      numLoopChildren(CollapsedNum, OMPD_taskloop_simd), StartLoc, EndLoc,
1078
4.30k
      CollapsedNum);
1079
4.30k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1080
4.30k
  Dir->setLastIteration(Exprs.LastIteration);
1081
4.30k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1082
4.30k
  Dir->setPreCond(Exprs.PreCond);
1083
4.30k
  Dir->setCond(Exprs.Cond);
1084
4.30k
  Dir->setInit(Exprs.Init);
1085
4.30k
  Dir->setInc(Exprs.Inc);
1086
4.30k
  Dir->setIsLastIterVariable(Exprs.IL);
1087
4.30k
  Dir->setLowerBoundVariable(Exprs.LB);
1088
4.30k
  Dir->setUpperBoundVariable(Exprs.UB);
1089
4.30k
  Dir->setStrideVariable(Exprs.ST);
1090
4.30k
  Dir->setEnsureUpperBound(Exprs.EUB);
1091
4.30k
  Dir->setNextLowerBound(Exprs.NLB);
1092
4.30k
  Dir->setNextUpperBound(Exprs.NUB);
1093
4.30k
  Dir->setNumIterations(Exprs.NumIterations);
1094
4.30k
  Dir->setCounters(Exprs.Counters);
1095
4.30k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1096
4.30k
  Dir->setInits(Exprs.Inits);
1097
4.30k
  Dir->setUpdates(Exprs.Updates);
1098
4.30k
  Dir->setFinals(Exprs.Finals);
1099
4.30k
  Dir->setDependentCounters(Exprs.DependentCounters);
1100
4.30k
  Dir->setDependentInits(Exprs.DependentInits);
1101
4.30k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1102
4.30k
  Dir->setPreInits(Exprs.PreInits);
1103
4.30k
  return Dir;
1104
4.30k
}
1105
1106
OMPTaskLoopSimdDirective *
1107
OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1108
46
                                      unsigned CollapsedNum, EmptyShell) {
1109
46
  return createEmptyDirective<OMPTaskLoopSimdDirective>(
1110
46
      C, NumClauses, /*HasAssociatedStmt=*/true,
1111
46
      numLoopChildren(CollapsedNum, OMPD_taskloop_simd), CollapsedNum);
1112
46
}
1113
1114
OMPMasterTaskLoopDirective *OMPMasterTaskLoopDirective::Create(
1115
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1116
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1117
3.39k
    const HelperExprs &Exprs, bool HasCancel) {
1118
3.39k
  auto *Dir = createDirective<OMPMasterTaskLoopDirective>(
1119
3.39k
      C, Clauses, AssociatedStmt,
1120
3.39k
      numLoopChildren(CollapsedNum, OMPD_master_taskloop), StartLoc, EndLoc,
1121
3.39k
      CollapsedNum);
1122
3.39k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1123
3.39k
  Dir->setLastIteration(Exprs.LastIteration);
1124
3.39k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1125
3.39k
  Dir->setPreCond(Exprs.PreCond);
1126
3.39k
  Dir->setCond(Exprs.Cond);
1127
3.39k
  Dir->setInit(Exprs.Init);
1128
3.39k
  Dir->setInc(Exprs.Inc);
1129
3.39k
  Dir->setIsLastIterVariable(Exprs.IL);
1130
3.39k
  Dir->setLowerBoundVariable(Exprs.LB);
1131
3.39k
  Dir->setUpperBoundVariable(Exprs.UB);
1132
3.39k
  Dir->setStrideVariable(Exprs.ST);
1133
3.39k
  Dir->setEnsureUpperBound(Exprs.EUB);
1134
3.39k
  Dir->setNextLowerBound(Exprs.NLB);
1135
3.39k
  Dir->setNextUpperBound(Exprs.NUB);
1136
3.39k
  Dir->setNumIterations(Exprs.NumIterations);
1137
3.39k
  Dir->setCounters(Exprs.Counters);
1138
3.39k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1139
3.39k
  Dir->setInits(Exprs.Inits);
1140
3.39k
  Dir->setUpdates(Exprs.Updates);
1141
3.39k
  Dir->setFinals(Exprs.Finals);
1142
3.39k
  Dir->setDependentCounters(Exprs.DependentCounters);
1143
3.39k
  Dir->setDependentInits(Exprs.DependentInits);
1144
3.39k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1145
3.39k
  Dir->setPreInits(Exprs.PreInits);
1146
3.39k
  Dir->setHasCancel(HasCancel);
1147
3.39k
  return Dir;
1148
3.39k
}
1149
1150
OMPMasterTaskLoopDirective *
1151
OMPMasterTaskLoopDirective::CreateEmpty(const ASTContext &C,
1152
                                        unsigned NumClauses,
1153
32
                                        unsigned CollapsedNum, EmptyShell) {
1154
32
  return createEmptyDirective<OMPMasterTaskLoopDirective>(
1155
32
      C, NumClauses, /*HasAssociatedStmt=*/true,
1156
32
      numLoopChildren(CollapsedNum, OMPD_master_taskloop), CollapsedNum);
1157
32
}
1158
1159
OMPMasterTaskLoopSimdDirective *OMPMasterTaskLoopSimdDirective::Create(
1160
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1161
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1162
4.28k
    const HelperExprs &Exprs) {
1163
4.28k
  auto *Dir = createDirective<OMPMasterTaskLoopSimdDirective>(
1164
4.28k
      C, Clauses, AssociatedStmt,
1165
4.28k
      numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), StartLoc,
1166
4.28k
      EndLoc, CollapsedNum);
1167
4.28k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1168
4.28k
  Dir->setLastIteration(Exprs.LastIteration);
1169
4.28k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1170
4.28k
  Dir->setPreCond(Exprs.PreCond);
1171
4.28k
  Dir->setCond(Exprs.Cond);
1172
4.28k
  Dir->setInit(Exprs.Init);
1173
4.28k
  Dir->setInc(Exprs.Inc);
1174
4.28k
  Dir->setIsLastIterVariable(Exprs.IL);
1175
4.28k
  Dir->setLowerBoundVariable(Exprs.LB);
1176
4.28k
  Dir->setUpperBoundVariable(Exprs.UB);
1177
4.28k
  Dir->setStrideVariable(Exprs.ST);
1178
4.28k
  Dir->setEnsureUpperBound(Exprs.EUB);
1179
4.28k
  Dir->setNextLowerBound(Exprs.NLB);
1180
4.28k
  Dir->setNextUpperBound(Exprs.NUB);
1181
4.28k
  Dir->setNumIterations(Exprs.NumIterations);
1182
4.28k
  Dir->setCounters(Exprs.Counters);
1183
4.28k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1184
4.28k
  Dir->setInits(Exprs.Inits);
1185
4.28k
  Dir->setUpdates(Exprs.Updates);
1186
4.28k
  Dir->setFinals(Exprs.Finals);
1187
4.28k
  Dir->setDependentCounters(Exprs.DependentCounters);
1188
4.28k
  Dir->setDependentInits(Exprs.DependentInits);
1189
4.28k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1190
4.28k
  Dir->setPreInits(Exprs.PreInits);
1191
4.28k
  return Dir;
1192
4.28k
}
1193
1194
OMPMasterTaskLoopSimdDirective *
1195
OMPMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1196
                                            unsigned NumClauses,
1197
46
                                            unsigned CollapsedNum, EmptyShell) {
1198
46
  return createEmptyDirective<OMPMasterTaskLoopSimdDirective>(
1199
46
      C, NumClauses, /*HasAssociatedStmt=*/true,
1200
46
      numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), CollapsedNum);
1201
46
}
1202
1203
OMPParallelMasterTaskLoopDirective *OMPParallelMasterTaskLoopDirective::Create(
1204
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1205
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1206
2.74k
    const HelperExprs &Exprs, bool HasCancel) {
1207
2.74k
  auto *Dir = createDirective<OMPParallelMasterTaskLoopDirective>(
1208
2.74k
      C, Clauses, AssociatedStmt,
1209
2.74k
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop), StartLoc,
1210
2.74k
      EndLoc, CollapsedNum);
1211
2.74k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1212
2.74k
  Dir->setLastIteration(Exprs.LastIteration);
1213
2.74k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1214
2.74k
  Dir->setPreCond(Exprs.PreCond);
1215
2.74k
  Dir->setCond(Exprs.Cond);
1216
2.74k
  Dir->setInit(Exprs.Init);
1217
2.74k
  Dir->setInc(Exprs.Inc);
1218
2.74k
  Dir->setIsLastIterVariable(Exprs.IL);
1219
2.74k
  Dir->setLowerBoundVariable(Exprs.LB);
1220
2.74k
  Dir->setUpperBoundVariable(Exprs.UB);
1221
2.74k
  Dir->setStrideVariable(Exprs.ST);
1222
2.74k
  Dir->setEnsureUpperBound(Exprs.EUB);
1223
2.74k
  Dir->setNextLowerBound(Exprs.NLB);
1224
2.74k
  Dir->setNextUpperBound(Exprs.NUB);
1225
2.74k
  Dir->setNumIterations(Exprs.NumIterations);
1226
2.74k
  Dir->setCounters(Exprs.Counters);
1227
2.74k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1228
2.74k
  Dir->setInits(Exprs.Inits);
1229
2.74k
  Dir->setUpdates(Exprs.Updates);
1230
2.74k
  Dir->setFinals(Exprs.Finals);
1231
2.74k
  Dir->setDependentCounters(Exprs.DependentCounters);
1232
2.74k
  Dir->setDependentInits(Exprs.DependentInits);
1233
2.74k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1234
2.74k
  Dir->setPreInits(Exprs.PreInits);
1235
2.74k
  Dir->setHasCancel(HasCancel);
1236
2.74k
  return Dir;
1237
2.74k
}
1238
1239
OMPParallelMasterTaskLoopDirective *
1240
OMPParallelMasterTaskLoopDirective::CreateEmpty(const ASTContext &C,
1241
                                                unsigned NumClauses,
1242
                                                unsigned CollapsedNum,
1243
30
                                                EmptyShell) {
1244
30
  return createEmptyDirective<OMPParallelMasterTaskLoopDirective>(
1245
30
      C, NumClauses, /*HasAssociatedStmt=*/true,
1246
30
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop),
1247
30
      CollapsedNum);
1248
30
}
1249
1250
OMPParallelMasterTaskLoopSimdDirective *
1251
OMPParallelMasterTaskLoopSimdDirective::Create(
1252
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1253
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1254
3.64k
    const HelperExprs &Exprs) {
1255
3.64k
  auto *Dir = createDirective<OMPParallelMasterTaskLoopSimdDirective>(
1256
3.64k
      C, Clauses, AssociatedStmt,
1257
3.64k
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd),
1258
3.64k
      StartLoc, EndLoc, CollapsedNum);
1259
3.64k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1260
3.64k
  Dir->setLastIteration(Exprs.LastIteration);
1261
3.64k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1262
3.64k
  Dir->setPreCond(Exprs.PreCond);
1263
3.64k
  Dir->setCond(Exprs.Cond);
1264
3.64k
  Dir->setInit(Exprs.Init);
1265
3.64k
  Dir->setInc(Exprs.Inc);
1266
3.64k
  Dir->setIsLastIterVariable(Exprs.IL);
1267
3.64k
  Dir->setLowerBoundVariable(Exprs.LB);
1268
3.64k
  Dir->setUpperBoundVariable(Exprs.UB);
1269
3.64k
  Dir->setStrideVariable(Exprs.ST);
1270
3.64k
  Dir->setEnsureUpperBound(Exprs.EUB);
1271
3.64k
  Dir->setNextLowerBound(Exprs.NLB);
1272
3.64k
  Dir->setNextUpperBound(Exprs.NUB);
1273
3.64k
  Dir->setNumIterations(Exprs.NumIterations);
1274
3.64k
  Dir->setCounters(Exprs.Counters);
1275
3.64k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1276
3.64k
  Dir->setInits(Exprs.Inits);
1277
3.64k
  Dir->setUpdates(Exprs.Updates);
1278
3.64k
  Dir->setFinals(Exprs.Finals);
1279
3.64k
  Dir->setDependentCounters(Exprs.DependentCounters);
1280
3.64k
  Dir->setDependentInits(Exprs.DependentInits);
1281
3.64k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1282
3.64k
  Dir->setPreInits(Exprs.PreInits);
1283
3.64k
  return Dir;
1284
3.64k
}
1285
1286
OMPParallelMasterTaskLoopSimdDirective *
1287
OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C,
1288
                                                    unsigned NumClauses,
1289
                                                    unsigned CollapsedNum,
1290
44
                                                    EmptyShell) {
1291
44
  return createEmptyDirective<OMPParallelMasterTaskLoopSimdDirective>(
1292
44
      C, NumClauses, /*HasAssociatedStmt=*/true,
1293
44
      numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd),
1294
44
      CollapsedNum);
1295
44
}
1296
1297
OMPDistributeDirective *OMPDistributeDirective::Create(
1298
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1299
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1300
1.68k
    const HelperExprs &Exprs) {
1301
1.68k
  auto *Dir = createDirective<OMPDistributeDirective>(
1302
1.68k
      C, Clauses, AssociatedStmt,
1303
1.68k
      numLoopChildren(CollapsedNum, OMPD_distribute), StartLoc, EndLoc,
1304
1.68k
      CollapsedNum);
1305
1.68k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1306
1.68k
  Dir->setLastIteration(Exprs.LastIteration);
1307
1.68k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1308
1.68k
  Dir->setPreCond(Exprs.PreCond);
1309
1.68k
  Dir->setCond(Exprs.Cond);
1310
1.68k
  Dir->setInit(Exprs.Init);
1311
1.68k
  Dir->setInc(Exprs.Inc);
1312
1.68k
  Dir->setIsLastIterVariable(Exprs.IL);
1313
1.68k
  Dir->setLowerBoundVariable(Exprs.LB);
1314
1.68k
  Dir->setUpperBoundVariable(Exprs.UB);
1315
1.68k
  Dir->setStrideVariable(Exprs.ST);
1316
1.68k
  Dir->setEnsureUpperBound(Exprs.EUB);
1317
1.68k
  Dir->setNextLowerBound(Exprs.NLB);
1318
1.68k
  Dir->setNextUpperBound(Exprs.NUB);
1319
1.68k
  Dir->setNumIterations(Exprs.NumIterations);
1320
1.68k
  Dir->setCounters(Exprs.Counters);
1321
1.68k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1322
1.68k
  Dir->setInits(Exprs.Inits);
1323
1.68k
  Dir->setUpdates(Exprs.Updates);
1324
1.68k
  Dir->setFinals(Exprs.Finals);
1325
1.68k
  Dir->setDependentCounters(Exprs.DependentCounters);
1326
1.68k
  Dir->setDependentInits(Exprs.DependentInits);
1327
1.68k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1328
1.68k
  Dir->setPreInits(Exprs.PreInits);
1329
1.68k
  return Dir;
1330
1.68k
}
1331
1332
OMPDistributeDirective *
1333
OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1334
140
                                    unsigned CollapsedNum, EmptyShell) {
1335
140
  return createEmptyDirective<OMPDistributeDirective>(
1336
140
      C, NumClauses, /*HasAssociatedStmt=*/true,
1337
140
      numLoopChildren(CollapsedNum, OMPD_distribute), CollapsedNum);
1338
140
}
1339
1340
OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create(
1341
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1342
3.53k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1343
3.53k
  return createDirective<OMPTargetUpdateDirective>(C, Clauses, AssociatedStmt,
1344
3.53k
                                                   /*NumChildren=*/0, StartLoc,
1345
3.53k
                                                   EndLoc);
1346
3.53k
}
1347
1348
OMPTargetUpdateDirective *
1349
OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1350
404
                                      EmptyShell) {
1351
404
  return createEmptyDirective<OMPTargetUpdateDirective>(
1352
404
      C, NumClauses, /*HasAssociatedStmt=*/true);
1353
404
}
1354
1355
OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1356
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1357
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1358
4.81k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1359
4.81k
  auto *Dir = createDirective<OMPDistributeParallelForDirective>(
1360
4.81k
      C, Clauses, AssociatedStmt,
1361
4.81k
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1, StartLoc,
1362
4.81k
      EndLoc, CollapsedNum);
1363
4.81k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1364
4.81k
  Dir->setLastIteration(Exprs.LastIteration);
1365
4.81k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1366
4.81k
  Dir->setPreCond(Exprs.PreCond);
1367
4.81k
  Dir->setCond(Exprs.Cond);
1368
4.81k
  Dir->setInit(Exprs.Init);
1369
4.81k
  Dir->setInc(Exprs.Inc);
1370
4.81k
  Dir->setIsLastIterVariable(Exprs.IL);
1371
4.81k
  Dir->setLowerBoundVariable(Exprs.LB);
1372
4.81k
  Dir->setUpperBoundVariable(Exprs.UB);
1373
4.81k
  Dir->setStrideVariable(Exprs.ST);
1374
4.81k
  Dir->setEnsureUpperBound(Exprs.EUB);
1375
4.81k
  Dir->setNextLowerBound(Exprs.NLB);
1376
4.81k
  Dir->setNextUpperBound(Exprs.NUB);
1377
4.81k
  Dir->setNumIterations(Exprs.NumIterations);
1378
4.81k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1379
4.81k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1380
4.81k
  Dir->setDistInc(Exprs.DistInc);
1381
4.81k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1382
4.81k
  Dir->setCounters(Exprs.Counters);
1383
4.81k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1384
4.81k
  Dir->setInits(Exprs.Inits);
1385
4.81k
  Dir->setUpdates(Exprs.Updates);
1386
4.81k
  Dir->setFinals(Exprs.Finals);
1387
4.81k
  Dir->setDependentCounters(Exprs.DependentCounters);
1388
4.81k
  Dir->setDependentInits(Exprs.DependentInits);
1389
4.81k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1390
4.81k
  Dir->setPreInits(Exprs.PreInits);
1391
4.81k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1392
4.81k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1393
4.81k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1394
4.81k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1395
4.81k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1396
4.81k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1397
4.81k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1398
4.81k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1399
4.81k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1400
4.81k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1401
4.81k
  Dir->HasCancel = HasCancel;
1402
4.81k
  return Dir;
1403
4.81k
}
1404
1405
OMPDistributeParallelForDirective *
1406
OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1407
                                               unsigned NumClauses,
1408
                                               unsigned CollapsedNum,
1409
280
                                               EmptyShell) {
1410
280
  return createEmptyDirective<OMPDistributeParallelForDirective>(
1411
280
      C, NumClauses, /*HasAssociatedStmt=*/true,
1412
280
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1,
1413
280
      CollapsedNum);
1414
280
}
1415
1416
OMPDistributeParallelForSimdDirective *
1417
OMPDistributeParallelForSimdDirective::Create(
1418
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1419
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1420
5.76k
    const HelperExprs &Exprs) {
1421
5.76k
  auto *Dir = createDirective<OMPDistributeParallelForSimdDirective>(
1422
5.76k
      C, Clauses, AssociatedStmt,
1423
5.76k
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1424
5.76k
      StartLoc, EndLoc, CollapsedNum);
1425
5.76k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1426
5.76k
  Dir->setLastIteration(Exprs.LastIteration);
1427
5.76k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1428
5.76k
  Dir->setPreCond(Exprs.PreCond);
1429
5.76k
  Dir->setCond(Exprs.Cond);
1430
5.76k
  Dir->setInit(Exprs.Init);
1431
5.76k
  Dir->setInc(Exprs.Inc);
1432
5.76k
  Dir->setIsLastIterVariable(Exprs.IL);
1433
5.76k
  Dir->setLowerBoundVariable(Exprs.LB);
1434
5.76k
  Dir->setUpperBoundVariable(Exprs.UB);
1435
5.76k
  Dir->setStrideVariable(Exprs.ST);
1436
5.76k
  Dir->setEnsureUpperBound(Exprs.EUB);
1437
5.76k
  Dir->setNextLowerBound(Exprs.NLB);
1438
5.76k
  Dir->setNextUpperBound(Exprs.NUB);
1439
5.76k
  Dir->setNumIterations(Exprs.NumIterations);
1440
5.76k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1441
5.76k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1442
5.76k
  Dir->setDistInc(Exprs.DistInc);
1443
5.76k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1444
5.76k
  Dir->setCounters(Exprs.Counters);
1445
5.76k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1446
5.76k
  Dir->setInits(Exprs.Inits);
1447
5.76k
  Dir->setUpdates(Exprs.Updates);
1448
5.76k
  Dir->setFinals(Exprs.Finals);
1449
5.76k
  Dir->setDependentCounters(Exprs.DependentCounters);
1450
5.76k
  Dir->setDependentInits(Exprs.DependentInits);
1451
5.76k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1452
5.76k
  Dir->setPreInits(Exprs.PreInits);
1453
5.76k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1454
5.76k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1455
5.76k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1456
5.76k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1457
5.76k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1458
5.76k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1459
5.76k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1460
5.76k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1461
5.76k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1462
5.76k
  return Dir;
1463
5.76k
}
1464
1465
OMPDistributeParallelForSimdDirective *
1466
OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1467
                                                   unsigned NumClauses,
1468
                                                   unsigned CollapsedNum,
1469
262
                                                   EmptyShell) {
1470
262
  return createEmptyDirective<OMPDistributeParallelForSimdDirective>(
1471
262
      C, NumClauses, /*HasAssociatedStmt=*/true,
1472
262
      numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd),
1473
262
      CollapsedNum);
1474
262
}
1475
1476
OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1477
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1478
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1479
4.38k
    const HelperExprs &Exprs) {
1480
4.38k
  auto *Dir = createDirective<OMPDistributeSimdDirective>(
1481
4.38k
      C, Clauses, AssociatedStmt,
1482
4.38k
      numLoopChildren(CollapsedNum, OMPD_distribute_simd), StartLoc, EndLoc,
1483
4.38k
      CollapsedNum);
1484
4.38k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1485
4.38k
  Dir->setLastIteration(Exprs.LastIteration);
1486
4.38k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1487
4.38k
  Dir->setPreCond(Exprs.PreCond);
1488
4.38k
  Dir->setCond(Exprs.Cond);
1489
4.38k
  Dir->setInit(Exprs.Init);
1490
4.38k
  Dir->setInc(Exprs.Inc);
1491
4.38k
  Dir->setIsLastIterVariable(Exprs.IL);
1492
4.38k
  Dir->setLowerBoundVariable(Exprs.LB);
1493
4.38k
  Dir->setUpperBoundVariable(Exprs.UB);
1494
4.38k
  Dir->setStrideVariable(Exprs.ST);
1495
4.38k
  Dir->setEnsureUpperBound(Exprs.EUB);
1496
4.38k
  Dir->setNextLowerBound(Exprs.NLB);
1497
4.38k
  Dir->setNextUpperBound(Exprs.NUB);
1498
4.38k
  Dir->setNumIterations(Exprs.NumIterations);
1499
4.38k
  Dir->setCounters(Exprs.Counters);
1500
4.38k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1501
4.38k
  Dir->setInits(Exprs.Inits);
1502
4.38k
  Dir->setUpdates(Exprs.Updates);
1503
4.38k
  Dir->setFinals(Exprs.Finals);
1504
4.38k
  Dir->setDependentCounters(Exprs.DependentCounters);
1505
4.38k
  Dir->setDependentInits(Exprs.DependentInits);
1506
4.38k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1507
4.38k
  Dir->setPreInits(Exprs.PreInits);
1508
4.38k
  return Dir;
1509
4.38k
}
1510
1511
OMPDistributeSimdDirective *
1512
OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1513
                                        unsigned NumClauses,
1514
166
                                        unsigned CollapsedNum, EmptyShell) {
1515
166
  return createEmptyDirective<OMPDistributeSimdDirective>(
1516
166
      C, NumClauses, /*HasAssociatedStmt=*/true,
1517
166
      numLoopChildren(CollapsedNum, OMPD_distribute_simd), CollapsedNum);
1518
166
}
1519
1520
OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1521
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1522
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1523
7.59k
    const HelperExprs &Exprs) {
1524
7.59k
  auto *Dir = createDirective<OMPTargetParallelForSimdDirective>(
1525
7.59k
      C, Clauses, AssociatedStmt,
1526
7.59k
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd), StartLoc,
1527
7.59k
      EndLoc, CollapsedNum);
1528
7.59k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1529
7.59k
  Dir->setLastIteration(Exprs.LastIteration);
1530
7.59k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1531
7.59k
  Dir->setPreCond(Exprs.PreCond);
1532
7.59k
  Dir->setCond(Exprs.Cond);
1533
7.59k
  Dir->setInit(Exprs.Init);
1534
7.59k
  Dir->setInc(Exprs.Inc);
1535
7.59k
  Dir->setIsLastIterVariable(Exprs.IL);
1536
7.59k
  Dir->setLowerBoundVariable(Exprs.LB);
1537
7.59k
  Dir->setUpperBoundVariable(Exprs.UB);
1538
7.59k
  Dir->setStrideVariable(Exprs.ST);
1539
7.59k
  Dir->setEnsureUpperBound(Exprs.EUB);
1540
7.59k
  Dir->setNextLowerBound(Exprs.NLB);
1541
7.59k
  Dir->setNextUpperBound(Exprs.NUB);
1542
7.59k
  Dir->setNumIterations(Exprs.NumIterations);
1543
7.59k
  Dir->setCounters(Exprs.Counters);
1544
7.59k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1545
7.59k
  Dir->setInits(Exprs.Inits);
1546
7.59k
  Dir->setUpdates(Exprs.Updates);
1547
7.59k
  Dir->setFinals(Exprs.Finals);
1548
7.59k
  Dir->setDependentCounters(Exprs.DependentCounters);
1549
7.59k
  Dir->setDependentInits(Exprs.DependentInits);
1550
7.59k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1551
7.59k
  Dir->setPreInits(Exprs.PreInits);
1552
7.59k
  return Dir;
1553
7.59k
}
1554
1555
OMPTargetParallelForSimdDirective *
1556
OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1557
                                               unsigned NumClauses,
1558
                                               unsigned CollapsedNum,
1559
523
                                               EmptyShell) {
1560
523
  return createEmptyDirective<OMPTargetParallelForSimdDirective>(
1561
523
      C, NumClauses, /*HasAssociatedStmt=*/true,
1562
523
      numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd),
1563
523
      CollapsedNum);
1564
523
}
1565
1566
OMPTargetSimdDirective *
1567
OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
1568
                               SourceLocation EndLoc, unsigned CollapsedNum,
1569
                               ArrayRef<OMPClause *> Clauses,
1570
7.72k
                               Stmt *AssociatedStmt, const HelperExprs &Exprs) {
1571
7.72k
  auto *Dir = createDirective<OMPTargetSimdDirective>(
1572
7.72k
      C, Clauses, AssociatedStmt,
1573
7.72k
      numLoopChildren(CollapsedNum, OMPD_target_simd), StartLoc, EndLoc,
1574
7.72k
      CollapsedNum);
1575
7.72k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1576
7.72k
  Dir->setLastIteration(Exprs.LastIteration);
1577
7.72k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1578
7.72k
  Dir->setPreCond(Exprs.PreCond);
1579
7.72k
  Dir->setCond(Exprs.Cond);
1580
7.72k
  Dir->setInit(Exprs.Init);
1581
7.72k
  Dir->setInc(Exprs.Inc);
1582
7.72k
  Dir->setCounters(Exprs.Counters);
1583
7.72k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1584
7.72k
  Dir->setInits(Exprs.Inits);
1585
7.72k
  Dir->setUpdates(Exprs.Updates);
1586
7.72k
  Dir->setFinals(Exprs.Finals);
1587
7.72k
  Dir->setDependentCounters(Exprs.DependentCounters);
1588
7.72k
  Dir->setDependentInits(Exprs.DependentInits);
1589
7.72k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1590
7.72k
  Dir->setPreInits(Exprs.PreInits);
1591
7.72k
  return Dir;
1592
7.72k
}
1593
1594
OMPTargetSimdDirective *
1595
OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1596
495
                                    unsigned CollapsedNum, EmptyShell) {
1597
495
  return createEmptyDirective<OMPTargetSimdDirective>(
1598
495
      C, NumClauses, /*HasAssociatedStmt=*/true,
1599
495
      numLoopChildren(CollapsedNum, OMPD_target_simd), CollapsedNum);
1600
495
}
1601
1602
OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1603
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1604
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1605
3.95k
    const HelperExprs &Exprs) {
1606
3.95k
  auto *Dir = createDirective<OMPTeamsDistributeDirective>(
1607
3.95k
      C, Clauses, AssociatedStmt,
1608
3.95k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute), StartLoc, EndLoc,
1609
3.95k
      CollapsedNum);
1610
3.95k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1611
3.95k
  Dir->setLastIteration(Exprs.LastIteration);
1612
3.95k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1613
3.95k
  Dir->setPreCond(Exprs.PreCond);
1614
3.95k
  Dir->setCond(Exprs.Cond);
1615
3.95k
  Dir->setInit(Exprs.Init);
1616
3.95k
  Dir->setInc(Exprs.Inc);
1617
3.95k
  Dir->setIsLastIterVariable(Exprs.IL);
1618
3.95k
  Dir->setLowerBoundVariable(Exprs.LB);
1619
3.95k
  Dir->setUpperBoundVariable(Exprs.UB);
1620
3.95k
  Dir->setStrideVariable(Exprs.ST);
1621
3.95k
  Dir->setEnsureUpperBound(Exprs.EUB);
1622
3.95k
  Dir->setNextLowerBound(Exprs.NLB);
1623
3.95k
  Dir->setNextUpperBound(Exprs.NUB);
1624
3.95k
  Dir->setNumIterations(Exprs.NumIterations);
1625
3.95k
  Dir->setCounters(Exprs.Counters);
1626
3.95k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1627
3.95k
  Dir->setInits(Exprs.Inits);
1628
3.95k
  Dir->setUpdates(Exprs.Updates);
1629
3.95k
  Dir->setFinals(Exprs.Finals);
1630
3.95k
  Dir->setDependentCounters(Exprs.DependentCounters);
1631
3.95k
  Dir->setDependentInits(Exprs.DependentInits);
1632
3.95k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1633
3.95k
  Dir->setPreInits(Exprs.PreInits);
1634
3.95k
  return Dir;
1635
3.95k
}
1636
1637
OMPTeamsDistributeDirective *
1638
OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1639
                                         unsigned NumClauses,
1640
142
                                         unsigned CollapsedNum, EmptyShell) {
1641
142
  return createEmptyDirective<OMPTeamsDistributeDirective>(
1642
142
      C, NumClauses, /*HasAssociatedStmt=*/true,
1643
142
      numLoopChildren(CollapsedNum, OMPD_teams_distribute), CollapsedNum);
1644
142
}
1645
1646
OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1647
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1648
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1649
4.50k
    const HelperExprs &Exprs) {
1650
4.50k
  auto *Dir = createDirective<OMPTeamsDistributeSimdDirective>(
1651
4.50k
      C, Clauses, AssociatedStmt,
1652
4.50k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), StartLoc,
1653
4.50k
      EndLoc, CollapsedNum);
1654
4.50k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1655
4.50k
  Dir->setLastIteration(Exprs.LastIteration);
1656
4.50k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1657
4.50k
  Dir->setPreCond(Exprs.PreCond);
1658
4.50k
  Dir->setCond(Exprs.Cond);
1659
4.50k
  Dir->setInit(Exprs.Init);
1660
4.50k
  Dir->setInc(Exprs.Inc);
1661
4.50k
  Dir->setIsLastIterVariable(Exprs.IL);
1662
4.50k
  Dir->setLowerBoundVariable(Exprs.LB);
1663
4.50k
  Dir->setUpperBoundVariable(Exprs.UB);
1664
4.50k
  Dir->setStrideVariable(Exprs.ST);
1665
4.50k
  Dir->setEnsureUpperBound(Exprs.EUB);
1666
4.50k
  Dir->setNextLowerBound(Exprs.NLB);
1667
4.50k
  Dir->setNextUpperBound(Exprs.NUB);
1668
4.50k
  Dir->setNumIterations(Exprs.NumIterations);
1669
4.50k
  Dir->setCounters(Exprs.Counters);
1670
4.50k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1671
4.50k
  Dir->setInits(Exprs.Inits);
1672
4.50k
  Dir->setUpdates(Exprs.Updates);
1673
4.50k
  Dir->setFinals(Exprs.Finals);
1674
4.50k
  Dir->setDependentCounters(Exprs.DependentCounters);
1675
4.50k
  Dir->setDependentInits(Exprs.DependentInits);
1676
4.50k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1677
4.50k
  Dir->setPreInits(Exprs.PreInits);
1678
4.50k
  return Dir;
1679
4.50k
}
1680
1681
OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1682
    const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1683
206
    EmptyShell) {
1684
206
  return createEmptyDirective<OMPTeamsDistributeSimdDirective>(
1685
206
      C, NumClauses, /*HasAssociatedStmt=*/true,
1686
206
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), CollapsedNum);
1687
206
}
1688
1689
OMPTeamsDistributeParallelForSimdDirective *
1690
OMPTeamsDistributeParallelForSimdDirective::Create(
1691
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1692
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1693
5.33k
    const HelperExprs &Exprs) {
1694
5.33k
  auto *Dir = createDirective<OMPTeamsDistributeParallelForSimdDirective>(
1695
5.33k
      C, Clauses, AssociatedStmt,
1696
5.33k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
1697
5.33k
      StartLoc, EndLoc, CollapsedNum);
1698
5.33k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1699
5.33k
  Dir->setLastIteration(Exprs.LastIteration);
1700
5.33k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1701
5.33k
  Dir->setPreCond(Exprs.PreCond);
1702
5.33k
  Dir->setCond(Exprs.Cond);
1703
5.33k
  Dir->setInit(Exprs.Init);
1704
5.33k
  Dir->setInc(Exprs.Inc);
1705
5.33k
  Dir->setIsLastIterVariable(Exprs.IL);
1706
5.33k
  Dir->setLowerBoundVariable(Exprs.LB);
1707
5.33k
  Dir->setUpperBoundVariable(Exprs.UB);
1708
5.33k
  Dir->setStrideVariable(Exprs.ST);
1709
5.33k
  Dir->setEnsureUpperBound(Exprs.EUB);
1710
5.33k
  Dir->setNextLowerBound(Exprs.NLB);
1711
5.33k
  Dir->setNextUpperBound(Exprs.NUB);
1712
5.33k
  Dir->setNumIterations(Exprs.NumIterations);
1713
5.33k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1714
5.33k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1715
5.33k
  Dir->setDistInc(Exprs.DistInc);
1716
5.33k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1717
5.33k
  Dir->setCounters(Exprs.Counters);
1718
5.33k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1719
5.33k
  Dir->setInits(Exprs.Inits);
1720
5.33k
  Dir->setUpdates(Exprs.Updates);
1721
5.33k
  Dir->setFinals(Exprs.Finals);
1722
5.33k
  Dir->setDependentCounters(Exprs.DependentCounters);
1723
5.33k
  Dir->setDependentInits(Exprs.DependentInits);
1724
5.33k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1725
5.33k
  Dir->setPreInits(Exprs.PreInits);
1726
5.33k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1727
5.33k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1728
5.33k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1729
5.33k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1730
5.33k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1731
5.33k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1732
5.33k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1733
5.33k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1734
5.33k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1735
5.33k
  return Dir;
1736
5.33k
}
1737
1738
OMPTeamsDistributeParallelForSimdDirective *
1739
OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1740
                                                        unsigned NumClauses,
1741
                                                        unsigned CollapsedNum,
1742
370
                                                        EmptyShell) {
1743
370
  return createEmptyDirective<OMPTeamsDistributeParallelForSimdDirective>(
1744
370
      C, NumClauses, /*HasAssociatedStmt=*/true,
1745
370
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd),
1746
370
      CollapsedNum);
1747
370
}
1748
1749
OMPTeamsDistributeParallelForDirective *
1750
OMPTeamsDistributeParallelForDirective::Create(
1751
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1752
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1753
4.52k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1754
4.52k
  auto *Dir = createDirective<OMPTeamsDistributeParallelForDirective>(
1755
4.52k
      C, Clauses, AssociatedStmt,
1756
4.52k
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
1757
4.52k
      StartLoc, EndLoc, CollapsedNum);
1758
4.52k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1759
4.52k
  Dir->setLastIteration(Exprs.LastIteration);
1760
4.52k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1761
4.52k
  Dir->setPreCond(Exprs.PreCond);
1762
4.52k
  Dir->setCond(Exprs.Cond);
1763
4.52k
  Dir->setInit(Exprs.Init);
1764
4.52k
  Dir->setInc(Exprs.Inc);
1765
4.52k
  Dir->setIsLastIterVariable(Exprs.IL);
1766
4.52k
  Dir->setLowerBoundVariable(Exprs.LB);
1767
4.52k
  Dir->setUpperBoundVariable(Exprs.UB);
1768
4.52k
  Dir->setStrideVariable(Exprs.ST);
1769
4.52k
  Dir->setEnsureUpperBound(Exprs.EUB);
1770
4.52k
  Dir->setNextLowerBound(Exprs.NLB);
1771
4.52k
  Dir->setNextUpperBound(Exprs.NUB);
1772
4.52k
  Dir->setNumIterations(Exprs.NumIterations);
1773
4.52k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1774
4.52k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1775
4.52k
  Dir->setDistInc(Exprs.DistInc);
1776
4.52k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1777
4.52k
  Dir->setCounters(Exprs.Counters);
1778
4.52k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1779
4.52k
  Dir->setInits(Exprs.Inits);
1780
4.52k
  Dir->setUpdates(Exprs.Updates);
1781
4.52k
  Dir->setFinals(Exprs.Finals);
1782
4.52k
  Dir->setDependentCounters(Exprs.DependentCounters);
1783
4.52k
  Dir->setDependentInits(Exprs.DependentInits);
1784
4.52k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1785
4.52k
  Dir->setPreInits(Exprs.PreInits);
1786
4.52k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1787
4.52k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1788
4.52k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1789
4.52k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1790
4.52k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1791
4.52k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1792
4.52k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1793
4.52k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1794
4.52k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1795
4.52k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1796
4.52k
  Dir->HasCancel = HasCancel;
1797
4.52k
  return Dir;
1798
4.52k
}
1799
1800
OMPTeamsDistributeParallelForDirective *
1801
OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1802
                                                    unsigned NumClauses,
1803
                                                    unsigned CollapsedNum,
1804
334
                                                    EmptyShell) {
1805
334
  return createEmptyDirective<OMPTeamsDistributeParallelForDirective>(
1806
334
      C, NumClauses, /*HasAssociatedStmt=*/true,
1807
334
      numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1,
1808
334
      CollapsedNum);
1809
334
}
1810
1811
OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1812
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1813
7.37k
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
1814
7.37k
  return createDirective<OMPTargetTeamsDirective>(C, Clauses, AssociatedStmt,
1815
7.37k
                                                  /*NumChildren=*/0, StartLoc,
1816
7.37k
                                                  EndLoc);
1817
7.37k
}
1818
1819
OMPTargetTeamsDirective *
1820
OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
1821
735
                                     EmptyShell) {
1822
735
  return createEmptyDirective<OMPTargetTeamsDirective>(
1823
735
      C, NumClauses, /*HasAssociatedStmt=*/true);
1824
735
}
1825
1826
OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
1827
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1828
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1829
6.62k
    const HelperExprs &Exprs) {
1830
6.62k
  auto *Dir = createDirective<OMPTargetTeamsDistributeDirective>(
1831
6.62k
      C, Clauses, AssociatedStmt,
1832
6.62k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute), StartLoc,
1833
6.62k
      EndLoc, CollapsedNum);
1834
6.62k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1835
6.62k
  Dir->setLastIteration(Exprs.LastIteration);
1836
6.62k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1837
6.62k
  Dir->setPreCond(Exprs.PreCond);
1838
6.62k
  Dir->setCond(Exprs.Cond);
1839
6.62k
  Dir->setInit(Exprs.Init);
1840
6.62k
  Dir->setInc(Exprs.Inc);
1841
6.62k
  Dir->setIsLastIterVariable(Exprs.IL);
1842
6.62k
  Dir->setLowerBoundVariable(Exprs.LB);
1843
6.62k
  Dir->setUpperBoundVariable(Exprs.UB);
1844
6.62k
  Dir->setStrideVariable(Exprs.ST);
1845
6.62k
  Dir->setEnsureUpperBound(Exprs.EUB);
1846
6.62k
  Dir->setNextLowerBound(Exprs.NLB);
1847
6.62k
  Dir->setNextUpperBound(Exprs.NUB);
1848
6.62k
  Dir->setNumIterations(Exprs.NumIterations);
1849
6.62k
  Dir->setCounters(Exprs.Counters);
1850
6.62k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1851
6.62k
  Dir->setInits(Exprs.Inits);
1852
6.62k
  Dir->setUpdates(Exprs.Updates);
1853
6.62k
  Dir->setFinals(Exprs.Finals);
1854
6.62k
  Dir->setDependentCounters(Exprs.DependentCounters);
1855
6.62k
  Dir->setDependentInits(Exprs.DependentInits);
1856
6.62k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1857
6.62k
  Dir->setPreInits(Exprs.PreInits);
1858
6.62k
  return Dir;
1859
6.62k
}
1860
1861
OMPTargetTeamsDistributeDirective *
1862
OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1863
                                               unsigned NumClauses,
1864
                                               unsigned CollapsedNum,
1865
475
                                               EmptyShell) {
1866
475
  return createEmptyDirective<OMPTargetTeamsDistributeDirective>(
1867
475
      C, NumClauses, /*HasAssociatedStmt=*/true,
1868
475
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute),
1869
475
      CollapsedNum);
1870
475
}
1871
1872
OMPTargetTeamsDistributeParallelForDirective *
1873
OMPTargetTeamsDistributeParallelForDirective::Create(
1874
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1875
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1876
7.01k
    const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) {
1877
7.01k
  auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForDirective>(
1878
7.01k
      C, Clauses, AssociatedStmt,
1879
7.01k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
1880
7.01k
          1,
1881
7.01k
      StartLoc, EndLoc, CollapsedNum);
1882
7.01k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1883
7.01k
  Dir->setLastIteration(Exprs.LastIteration);
1884
7.01k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1885
7.01k
  Dir->setPreCond(Exprs.PreCond);
1886
7.01k
  Dir->setCond(Exprs.Cond);
1887
7.01k
  Dir->setInit(Exprs.Init);
1888
7.01k
  Dir->setInc(Exprs.Inc);
1889
7.01k
  Dir->setIsLastIterVariable(Exprs.IL);
1890
7.01k
  Dir->setLowerBoundVariable(Exprs.LB);
1891
7.01k
  Dir->setUpperBoundVariable(Exprs.UB);
1892
7.01k
  Dir->setStrideVariable(Exprs.ST);
1893
7.01k
  Dir->setEnsureUpperBound(Exprs.EUB);
1894
7.01k
  Dir->setNextLowerBound(Exprs.NLB);
1895
7.01k
  Dir->setNextUpperBound(Exprs.NUB);
1896
7.01k
  Dir->setNumIterations(Exprs.NumIterations);
1897
7.01k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1898
7.01k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1899
7.01k
  Dir->setDistInc(Exprs.DistInc);
1900
7.01k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1901
7.01k
  Dir->setCounters(Exprs.Counters);
1902
7.01k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1903
7.01k
  Dir->setInits(Exprs.Inits);
1904
7.01k
  Dir->setUpdates(Exprs.Updates);
1905
7.01k
  Dir->setFinals(Exprs.Finals);
1906
7.01k
  Dir->setDependentCounters(Exprs.DependentCounters);
1907
7.01k
  Dir->setDependentInits(Exprs.DependentInits);
1908
7.01k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1909
7.01k
  Dir->setPreInits(Exprs.PreInits);
1910
7.01k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1911
7.01k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1912
7.01k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1913
7.01k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1914
7.01k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1915
7.01k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1916
7.01k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1917
7.01k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1918
7.01k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1919
7.01k
  Dir->setTaskReductionRefExpr(TaskRedRef);
1920
7.01k
  Dir->HasCancel = HasCancel;
1921
7.01k
  return Dir;
1922
7.01k
}
1923
1924
OMPTargetTeamsDistributeParallelForDirective *
1925
OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1926
                                                          unsigned NumClauses,
1927
                                                          unsigned CollapsedNum,
1928
447
                                                          EmptyShell) {
1929
447
  return createEmptyDirective<OMPTargetTeamsDistributeParallelForDirective>(
1930
447
      C, NumClauses, /*HasAssociatedStmt=*/true,
1931
447
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) +
1932
447
          1,
1933
447
      CollapsedNum);
1934
447
}
1935
1936
OMPTargetTeamsDistributeParallelForSimdDirective *
1937
OMPTargetTeamsDistributeParallelForSimdDirective::Create(
1938
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1939
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
1940
8.81k
    const HelperExprs &Exprs) {
1941
8.81k
  auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
1942
8.81k
      C, Clauses, AssociatedStmt,
1943
8.81k
      numLoopChildren(CollapsedNum,
1944
8.81k
                      OMPD_target_teams_distribute_parallel_for_simd),
1945
8.81k
      StartLoc, EndLoc, CollapsedNum);
1946
8.81k
  Dir->setIterationVariable(Exprs.IterationVarRef);
1947
8.81k
  Dir->setLastIteration(Exprs.LastIteration);
1948
8.81k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1949
8.81k
  Dir->setPreCond(Exprs.PreCond);
1950
8.81k
  Dir->setCond(Exprs.Cond);
1951
8.81k
  Dir->setInit(Exprs.Init);
1952
8.81k
  Dir->setInc(Exprs.Inc);
1953
8.81k
  Dir->setIsLastIterVariable(Exprs.IL);
1954
8.81k
  Dir->setLowerBoundVariable(Exprs.LB);
1955
8.81k
  Dir->setUpperBoundVariable(Exprs.UB);
1956
8.81k
  Dir->setStrideVariable(Exprs.ST);
1957
8.81k
  Dir->setEnsureUpperBound(Exprs.EUB);
1958
8.81k
  Dir->setNextLowerBound(Exprs.NLB);
1959
8.81k
  Dir->setNextUpperBound(Exprs.NUB);
1960
8.81k
  Dir->setNumIterations(Exprs.NumIterations);
1961
8.81k
  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1962
8.81k
  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1963
8.81k
  Dir->setDistInc(Exprs.DistInc);
1964
8.81k
  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1965
8.81k
  Dir->setCounters(Exprs.Counters);
1966
8.81k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
1967
8.81k
  Dir->setInits(Exprs.Inits);
1968
8.81k
  Dir->setUpdates(Exprs.Updates);
1969
8.81k
  Dir->setFinals(Exprs.Finals);
1970
8.81k
  Dir->setDependentCounters(Exprs.DependentCounters);
1971
8.81k
  Dir->setDependentInits(Exprs.DependentInits);
1972
8.81k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
1973
8.81k
  Dir->setPreInits(Exprs.PreInits);
1974
8.81k
  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1975
8.81k
  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1976
8.81k
  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1977
8.81k
  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1978
8.81k
  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1979
8.81k
  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1980
8.81k
  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1981
8.81k
  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1982
8.81k
  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1983
8.81k
  return Dir;
1984
8.81k
}
1985
1986
OMPTargetTeamsDistributeParallelForSimdDirective *
1987
OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
1988
    const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
1989
569
    EmptyShell) {
1990
569
  return createEmptyDirective<OMPTargetTeamsDistributeParallelForSimdDirective>(
1991
569
      C, NumClauses, /*HasAssociatedStmt=*/true,
1992
569
      numLoopChildren(CollapsedNum,
1993
569
                      OMPD_target_teams_distribute_parallel_for_simd),
1994
569
      CollapsedNum);
1995
569
}
1996
1997
OMPTargetTeamsDistributeSimdDirective *
1998
OMPTargetTeamsDistributeSimdDirective::Create(
1999
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2000
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2001
8.36k
    const HelperExprs &Exprs) {
2002
8.36k
  auto *Dir = createDirective<OMPTargetTeamsDistributeSimdDirective>(
2003
8.36k
      C, Clauses, AssociatedStmt,
2004
8.36k
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
2005
8.36k
      StartLoc, EndLoc, CollapsedNum);
2006
8.36k
  Dir->setIterationVariable(Exprs.IterationVarRef);
2007
8.36k
  Dir->setLastIteration(Exprs.LastIteration);
2008
8.36k
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2009
8.36k
  Dir->setPreCond(Exprs.PreCond);
2010
8.36k
  Dir->setCond(Exprs.Cond);
2011
8.36k
  Dir->setInit(Exprs.Init);
2012
8.36k
  Dir->setInc(Exprs.Inc);
2013
8.36k
  Dir->setIsLastIterVariable(Exprs.IL);
2014
8.36k
  Dir->setLowerBoundVariable(Exprs.LB);
2015
8.36k
  Dir->setUpperBoundVariable(Exprs.UB);
2016
8.36k
  Dir->setStrideVariable(Exprs.ST);
2017
8.36k
  Dir->setEnsureUpperBound(Exprs.EUB);
2018
8.36k
  Dir->setNextLowerBound(Exprs.NLB);
2019
8.36k
  Dir->setNextUpperBound(Exprs.NUB);
2020
8.36k
  Dir->setNumIterations(Exprs.NumIterations);
2021
8.36k
  Dir->setCounters(Exprs.Counters);
2022
8.36k
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2023
8.36k
  Dir->setInits(Exprs.Inits);
2024
8.36k
  Dir->setUpdates(Exprs.Updates);
2025
8.36k
  Dir->setFinals(Exprs.Finals);
2026
8.36k
  Dir->setDependentCounters(Exprs.DependentCounters);
2027
8.36k
  Dir->setDependentInits(Exprs.DependentInits);
2028
8.36k
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2029
8.36k
  Dir->setPreInits(Exprs.PreInits);
2030
8.36k
  return Dir;
2031
8.36k
}
2032
2033
OMPTargetTeamsDistributeSimdDirective *
2034
OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
2035
                                                   unsigned NumClauses,
2036
                                                   unsigned CollapsedNum,
2037
547
                                                   EmptyShell) {
2038
547
  return createEmptyDirective<OMPTargetTeamsDistributeSimdDirective>(
2039
547
      C, NumClauses, /*HasAssociatedStmt=*/true,
2040
547
      numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd),
2041
547
      CollapsedNum);
2042
547
}
2043
2044
OMPInteropDirective *
2045
OMPInteropDirective::Create(const ASTContext &C, SourceLocation StartLoc,
2046
                            SourceLocation EndLoc,
2047
143
                            ArrayRef<OMPClause *> Clauses) {
2048
143
  return createDirective<OMPInteropDirective>(
2049
143
      C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
2050
143
      EndLoc);
2051
143
}
2052
2053
OMPInteropDirective *OMPInteropDirective::CreateEmpty(const ASTContext &C,
2054
                                                      unsigned NumClauses,
2055
48
                                                      EmptyShell) {
2056
48
  return createEmptyDirective<OMPInteropDirective>(C, NumClauses);
2057
48
}
2058
2059
OMPDispatchDirective *OMPDispatchDirective::Create(
2060
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2061
    ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2062
126
    SourceLocation TargetCallLoc) {
2063
126
  auto *Dir = createDirective<OMPDispatchDirective>(
2064
126
      C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc);
2065
126
  Dir->setTargetCallLoc(TargetCallLoc);
2066
126
  return Dir;
2067
126
}
2068
2069
OMPDispatchDirective *OMPDispatchDirective::CreateEmpty(const ASTContext &C,
2070
                                                        unsigned NumClauses,
2071
40
                                                        EmptyShell) {
2072
40
  return createEmptyDirective<OMPDispatchDirective>(C, NumClauses,
2073
40
                                                    /*HasAssociatedStmt=*/true,
2074
40
                                                    /*NumChildren=*/0);
2075
40
}
2076
2077
OMPMaskedDirective *OMPMaskedDirective::Create(const ASTContext &C,
2078
                                               SourceLocation StartLoc,
2079
                                               SourceLocation EndLoc,
2080
                                               ArrayRef<OMPClause *> Clauses,
2081
120
                                               Stmt *AssociatedStmt) {
2082
120
  return createDirective<OMPMaskedDirective>(C, Clauses, AssociatedStmt,
2083
120
                                             /*NumChildren=*/0, StartLoc,
2084
120
                                             EndLoc);
2085
120
}
2086
2087
OMPMaskedDirective *OMPMaskedDirective::CreateEmpty(const ASTContext &C,
2088
                                                    unsigned NumClauses,
2089
30
                                                    EmptyShell) {
2090
30
  return createEmptyDirective<OMPMaskedDirective>(C, NumClauses,
2091
30
                                                  /*HasAssociatedStmt=*/true);
2092
30
}
2093
2094
OMPGenericLoopDirective *OMPGenericLoopDirective::Create(
2095
    const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2096
    unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2097
46
    const HelperExprs &Exprs) {
2098
46
  auto *Dir = createDirective<OMPGenericLoopDirective>(
2099
46
      C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_loop),
2100
46
      StartLoc, EndLoc, CollapsedNum);
2101
46
  Dir->setIterationVariable(Exprs.IterationVarRef);
2102
46
  Dir->setLastIteration(Exprs.LastIteration);
2103
46
  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
2104
46
  Dir->setPreCond(Exprs.PreCond);
2105
46
  Dir->setCond(Exprs.Cond);
2106
46
  Dir->setInit(Exprs.Init);
2107
46
  Dir->setInc(Exprs.Inc);
2108
46
  Dir->setIsLastIterVariable(Exprs.IL);
2109
46
  Dir->setLowerBoundVariable(Exprs.LB);
2110
46
  Dir->setUpperBoundVariable(Exprs.UB);
2111
46
  Dir->setStrideVariable(Exprs.ST);
2112
46
  Dir->setEnsureUpperBound(Exprs.EUB);
2113
46
  Dir->setNextLowerBound(Exprs.NLB);
2114
46
  Dir->setNextUpperBound(Exprs.NUB);
2115
46
  Dir->setNumIterations(Exprs.NumIterations);
2116
46
  Dir->setCounters(Exprs.Counters);
2117
46
  Dir->setPrivateCounters(Exprs.PrivateCounters);
2118
46
  Dir->setInits(Exprs.Inits);
2119
46
  Dir->setUpdates(Exprs.Updates);
2120
46
  Dir->setFinals(Exprs.Finals);
2121
46
  Dir->setDependentCounters(Exprs.DependentCounters);
2122
46
  Dir->setDependentInits(Exprs.DependentInits);
2123
46
  Dir->setFinalsConditions(Exprs.FinalsConditions);
2124
46
  Dir->setPreInits(Exprs.PreInits);
2125
46
  return Dir;
2126
46
}
2127
2128
OMPGenericLoopDirective *
2129
OMPGenericLoopDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
2130
14
                                     unsigned CollapsedNum, EmptyShell) {
2131
14
  return createEmptyDirective<OMPGenericLoopDirective>(
2132
14
      C, NumClauses, /*HasAssociatedStmt=*/true,
2133
14
      numLoopChildren(CollapsedNum, OMPD_loop), CollapsedNum);
2134
14
}