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