Coverage Report

Created: 2021-08-24 07:12

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