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::makeMutableArrayRef(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, llvm::None, 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, llvm::None, 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 OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C, 748 SourceLocation StartLoc, 749 SourceLocation EndLoc) { 750 return new (C) OMPBarrierDirective(StartLoc, EndLoc); 751 } 752 753 OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C, 754 EmptyShell) { 755 return new (C) OMPBarrierDirective(); 756 } 757 758 OMPTaskwaitDirective * 759 OMPTaskwaitDirective::Create(const ASTContext &C, SourceLocation StartLoc, 760 SourceLocation EndLoc, 761 ArrayRef<OMPClause *> Clauses) { 762 return createDirective<OMPTaskwaitDirective>( 763 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc, 764 EndLoc); 765 } 766 767 OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C, 768 unsigned NumClauses, 769 EmptyShell) { 770 return createEmptyDirective<OMPTaskwaitDirective>(C, NumClauses); 771 } 772 773 OMPTaskgroupDirective *OMPTaskgroupDirective::Create( 774 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 775 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) { 776 auto *Dir = createDirective<OMPTaskgroupDirective>( 777 C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc); 778 Dir->setReductionRef(ReductionRef); 779 return Dir; 780 } 781 782 OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C, 783 unsigned NumClauses, 784 EmptyShell) { 785 return createEmptyDirective<OMPTaskgroupDirective>( 786 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1); 787 } 788 789 OMPCancellationPointDirective *OMPCancellationPointDirective::Create( 790 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 791 OpenMPDirectiveKind CancelRegion) { 792 auto *Dir = new (C) OMPCancellationPointDirective(StartLoc, EndLoc); 793 Dir->setCancelRegion(CancelRegion); 794 return Dir; 795 } 796 797 OMPCancellationPointDirective * 798 OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) { 799 return new (C) OMPCancellationPointDirective(); 800 } 801 802 OMPCancelDirective * 803 OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc, 804 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, 805 OpenMPDirectiveKind CancelRegion) { 806 auto *Dir = createDirective<OMPCancelDirective>( 807 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc, 808 EndLoc); 809 Dir->setCancelRegion(CancelRegion); 810 return Dir; 811 } 812 813 OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C, 814 unsigned NumClauses, 815 EmptyShell) { 816 return createEmptyDirective<OMPCancelDirective>(C, NumClauses); 817 } 818 819 OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C, 820 SourceLocation StartLoc, 821 SourceLocation EndLoc, 822 ArrayRef<OMPClause *> Clauses) { 823 return createDirective<OMPFlushDirective>( 824 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc, 825 EndLoc); 826 } 827 828 OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C, 829 unsigned NumClauses, 830 EmptyShell) { 831 return createEmptyDirective<OMPFlushDirective>(C, NumClauses); 832 } 833 834 OMPDepobjDirective *OMPDepobjDirective::Create(const ASTContext &C, 835 SourceLocation StartLoc, 836 SourceLocation EndLoc, 837 ArrayRef<OMPClause *> Clauses) { 838 return createDirective<OMPDepobjDirective>( 839 C, Clauses, /*AssociatedStmt=*/nullptr, 840 /*NumChildren=*/0, StartLoc, EndLoc); 841 } 842 843 OMPDepobjDirective *OMPDepobjDirective::CreateEmpty(const ASTContext &C, 844 unsigned NumClauses, 845 EmptyShell) { 846 return createEmptyDirective<OMPDepobjDirective>(C, NumClauses); 847 } 848 849 OMPScanDirective *OMPScanDirective::Create(const ASTContext &C, 850 SourceLocation StartLoc, 851 SourceLocation EndLoc, 852 ArrayRef<OMPClause *> Clauses) { 853 return createDirective<OMPScanDirective>(C, Clauses, 854 /*AssociatedStmt=*/nullptr, 855 /*NumChildren=*/0, StartLoc, EndLoc); 856 } 857 858 OMPScanDirective *OMPScanDirective::CreateEmpty(const ASTContext &C, 859 unsigned NumClauses, 860 EmptyShell) { 861 return createEmptyDirective<OMPScanDirective>(C, NumClauses); 862 } 863 864 OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C, 865 SourceLocation StartLoc, 866 SourceLocation EndLoc, 867 ArrayRef<OMPClause *> Clauses, 868 Stmt *AssociatedStmt) { 869 return createDirective<OMPOrderedDirective>( 870 C, Clauses, cast_or_null<CapturedStmt>(AssociatedStmt), 871 /*NumChildren=*/0, StartLoc, EndLoc); 872 } 873 874 OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C, 875 unsigned NumClauses, 876 bool IsStandalone, 877 EmptyShell) { 878 return createEmptyDirective<OMPOrderedDirective>(C, NumClauses, 879 !IsStandalone); 880 } 881 882 OMPAtomicDirective * 883 OMPAtomicDirective::Create(const ASTContext &C, SourceLocation StartLoc, 884 SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, 885 Stmt *AssociatedStmt, Expressions Exprs) { 886 auto *Dir = createDirective<OMPAtomicDirective>( 887 C, Clauses, AssociatedStmt, /*NumChildren=*/7, StartLoc, EndLoc); 888 Dir->setX(Exprs.X); 889 Dir->setV(Exprs.V); 890 Dir->setR(Exprs.R); 891 Dir->setExpr(Exprs.E); 892 Dir->setUpdateExpr(Exprs.UE); 893 Dir->setD(Exprs.D); 894 Dir->setCond(Exprs.Cond); 895 Dir->Flags.IsXLHSInRHSPart = Exprs.IsXLHSInRHSPart ? 1 : 0; 896 Dir->Flags.IsPostfixUpdate = Exprs.IsPostfixUpdate ? 1 : 0; 897 Dir->Flags.IsFailOnly = Exprs.IsFailOnly ? 1 : 0; 898 return Dir; 899 } 900 901 OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C, 902 unsigned NumClauses, 903 EmptyShell) { 904 return createEmptyDirective<OMPAtomicDirective>( 905 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/7); 906 } 907 908 OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C, 909 SourceLocation StartLoc, 910 SourceLocation EndLoc, 911 ArrayRef<OMPClause *> Clauses, 912 Stmt *AssociatedStmt) { 913 return createDirective<OMPTargetDirective>( 914 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc); 915 } 916 917 OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C, 918 unsigned NumClauses, 919 EmptyShell) { 920 return createEmptyDirective<OMPTargetDirective>(C, NumClauses, 921 /*HasAssociatedStmt=*/true); 922 } 923 924 OMPTargetParallelDirective *OMPTargetParallelDirective::Create( 925 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 926 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef, 927 bool HasCancel) { 928 auto *Dir = createDirective<OMPTargetParallelDirective>( 929 C, Clauses, AssociatedStmt, /*NumChildren=*/1, StartLoc, EndLoc); 930 Dir->setTaskReductionRefExpr(TaskRedRef); 931 Dir->setHasCancel(HasCancel); 932 return Dir; 933 } 934 935 OMPTargetParallelDirective * 936 OMPTargetParallelDirective::CreateEmpty(const ASTContext &C, 937 unsigned NumClauses, EmptyShell) { 938 return createEmptyDirective<OMPTargetParallelDirective>( 939 C, NumClauses, /*HasAssociatedStmt=*/true, /*NumChildren=*/1); 940 } 941 942 OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create( 943 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 944 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 945 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) { 946 auto *Dir = createDirective<OMPTargetParallelForDirective>( 947 C, Clauses, AssociatedStmt, 948 numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1, StartLoc, 949 EndLoc, CollapsedNum); 950 Dir->setIterationVariable(Exprs.IterationVarRef); 951 Dir->setLastIteration(Exprs.LastIteration); 952 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 953 Dir->setPreCond(Exprs.PreCond); 954 Dir->setCond(Exprs.Cond); 955 Dir->setInit(Exprs.Init); 956 Dir->setInc(Exprs.Inc); 957 Dir->setIsLastIterVariable(Exprs.IL); 958 Dir->setLowerBoundVariable(Exprs.LB); 959 Dir->setUpperBoundVariable(Exprs.UB); 960 Dir->setStrideVariable(Exprs.ST); 961 Dir->setEnsureUpperBound(Exprs.EUB); 962 Dir->setNextLowerBound(Exprs.NLB); 963 Dir->setNextUpperBound(Exprs.NUB); 964 Dir->setNumIterations(Exprs.NumIterations); 965 Dir->setCounters(Exprs.Counters); 966 Dir->setPrivateCounters(Exprs.PrivateCounters); 967 Dir->setInits(Exprs.Inits); 968 Dir->setUpdates(Exprs.Updates); 969 Dir->setFinals(Exprs.Finals); 970 Dir->setDependentCounters(Exprs.DependentCounters); 971 Dir->setDependentInits(Exprs.DependentInits); 972 Dir->setFinalsConditions(Exprs.FinalsConditions); 973 Dir->setPreInits(Exprs.PreInits); 974 Dir->setTaskReductionRefExpr(TaskRedRef); 975 Dir->setHasCancel(HasCancel); 976 return Dir; 977 } 978 979 OMPTargetParallelForDirective * 980 OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C, 981 unsigned NumClauses, 982 unsigned CollapsedNum, EmptyShell) { 983 return createEmptyDirective<OMPTargetParallelForDirective>( 984 C, NumClauses, /*HasAssociatedStmt=*/true, 985 numLoopChildren(CollapsedNum, OMPD_target_parallel_for) + 1, 986 CollapsedNum); 987 } 988 989 OMPTargetDataDirective *OMPTargetDataDirective::Create( 990 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 991 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { 992 return createDirective<OMPTargetDataDirective>( 993 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc); 994 } 995 996 OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C, 997 unsigned N, 998 EmptyShell) { 999 return createEmptyDirective<OMPTargetDataDirective>( 1000 C, N, /*HasAssociatedStmt=*/true); 1001 } 1002 1003 OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create( 1004 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1005 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { 1006 return createDirective<OMPTargetEnterDataDirective>( 1007 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc); 1008 } 1009 1010 OMPTargetEnterDataDirective * 1011 OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N, 1012 EmptyShell) { 1013 return createEmptyDirective<OMPTargetEnterDataDirective>( 1014 C, N, /*HasAssociatedStmt=*/true); 1015 } 1016 1017 OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create( 1018 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1019 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { 1020 return createDirective<OMPTargetExitDataDirective>( 1021 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc); 1022 } 1023 1024 OMPTargetExitDataDirective * 1025 OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N, 1026 EmptyShell) { 1027 return createEmptyDirective<OMPTargetExitDataDirective>( 1028 C, N, /*HasAssociatedStmt=*/true); 1029 } 1030 1031 OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C, 1032 SourceLocation StartLoc, 1033 SourceLocation EndLoc, 1034 ArrayRef<OMPClause *> Clauses, 1035 Stmt *AssociatedStmt) { 1036 return createDirective<OMPTeamsDirective>( 1037 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc); 1038 } 1039 1040 OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C, 1041 unsigned NumClauses, 1042 EmptyShell) { 1043 return createEmptyDirective<OMPTeamsDirective>(C, NumClauses, 1044 /*HasAssociatedStmt=*/true); 1045 } 1046 1047 OMPTaskLoopDirective *OMPTaskLoopDirective::Create( 1048 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1049 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1050 const HelperExprs &Exprs, bool HasCancel) { 1051 auto *Dir = createDirective<OMPTaskLoopDirective>( 1052 C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_taskloop), 1053 StartLoc, EndLoc, CollapsedNum); 1054 Dir->setIterationVariable(Exprs.IterationVarRef); 1055 Dir->setLastIteration(Exprs.LastIteration); 1056 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1057 Dir->setPreCond(Exprs.PreCond); 1058 Dir->setCond(Exprs.Cond); 1059 Dir->setInit(Exprs.Init); 1060 Dir->setInc(Exprs.Inc); 1061 Dir->setIsLastIterVariable(Exprs.IL); 1062 Dir->setLowerBoundVariable(Exprs.LB); 1063 Dir->setUpperBoundVariable(Exprs.UB); 1064 Dir->setStrideVariable(Exprs.ST); 1065 Dir->setEnsureUpperBound(Exprs.EUB); 1066 Dir->setNextLowerBound(Exprs.NLB); 1067 Dir->setNextUpperBound(Exprs.NUB); 1068 Dir->setNumIterations(Exprs.NumIterations); 1069 Dir->setCounters(Exprs.Counters); 1070 Dir->setPrivateCounters(Exprs.PrivateCounters); 1071 Dir->setInits(Exprs.Inits); 1072 Dir->setUpdates(Exprs.Updates); 1073 Dir->setFinals(Exprs.Finals); 1074 Dir->setDependentCounters(Exprs.DependentCounters); 1075 Dir->setDependentInits(Exprs.DependentInits); 1076 Dir->setFinalsConditions(Exprs.FinalsConditions); 1077 Dir->setPreInits(Exprs.PreInits); 1078 Dir->setHasCancel(HasCancel); 1079 return Dir; 1080 } 1081 1082 OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C, 1083 unsigned NumClauses, 1084 unsigned CollapsedNum, 1085 EmptyShell) { 1086 return createEmptyDirective<OMPTaskLoopDirective>( 1087 C, NumClauses, /*HasAssociatedStmt=*/true, 1088 numLoopChildren(CollapsedNum, OMPD_taskloop), CollapsedNum); 1089 } 1090 1091 OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create( 1092 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1093 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1094 const HelperExprs &Exprs) { 1095 auto *Dir = createDirective<OMPTaskLoopSimdDirective>( 1096 C, Clauses, AssociatedStmt, 1097 numLoopChildren(CollapsedNum, OMPD_taskloop_simd), StartLoc, EndLoc, 1098 CollapsedNum); 1099 Dir->setIterationVariable(Exprs.IterationVarRef); 1100 Dir->setLastIteration(Exprs.LastIteration); 1101 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1102 Dir->setPreCond(Exprs.PreCond); 1103 Dir->setCond(Exprs.Cond); 1104 Dir->setInit(Exprs.Init); 1105 Dir->setInc(Exprs.Inc); 1106 Dir->setIsLastIterVariable(Exprs.IL); 1107 Dir->setLowerBoundVariable(Exprs.LB); 1108 Dir->setUpperBoundVariable(Exprs.UB); 1109 Dir->setStrideVariable(Exprs.ST); 1110 Dir->setEnsureUpperBound(Exprs.EUB); 1111 Dir->setNextLowerBound(Exprs.NLB); 1112 Dir->setNextUpperBound(Exprs.NUB); 1113 Dir->setNumIterations(Exprs.NumIterations); 1114 Dir->setCounters(Exprs.Counters); 1115 Dir->setPrivateCounters(Exprs.PrivateCounters); 1116 Dir->setInits(Exprs.Inits); 1117 Dir->setUpdates(Exprs.Updates); 1118 Dir->setFinals(Exprs.Finals); 1119 Dir->setDependentCounters(Exprs.DependentCounters); 1120 Dir->setDependentInits(Exprs.DependentInits); 1121 Dir->setFinalsConditions(Exprs.FinalsConditions); 1122 Dir->setPreInits(Exprs.PreInits); 1123 return Dir; 1124 } 1125 1126 OMPTaskLoopSimdDirective * 1127 OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, 1128 unsigned CollapsedNum, EmptyShell) { 1129 return createEmptyDirective<OMPTaskLoopSimdDirective>( 1130 C, NumClauses, /*HasAssociatedStmt=*/true, 1131 numLoopChildren(CollapsedNum, OMPD_taskloop_simd), CollapsedNum); 1132 } 1133 1134 OMPMasterTaskLoopDirective *OMPMasterTaskLoopDirective::Create( 1135 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1136 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1137 const HelperExprs &Exprs, bool HasCancel) { 1138 auto *Dir = createDirective<OMPMasterTaskLoopDirective>( 1139 C, Clauses, AssociatedStmt, 1140 numLoopChildren(CollapsedNum, OMPD_master_taskloop), StartLoc, EndLoc, 1141 CollapsedNum); 1142 Dir->setIterationVariable(Exprs.IterationVarRef); 1143 Dir->setLastIteration(Exprs.LastIteration); 1144 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1145 Dir->setPreCond(Exprs.PreCond); 1146 Dir->setCond(Exprs.Cond); 1147 Dir->setInit(Exprs.Init); 1148 Dir->setInc(Exprs.Inc); 1149 Dir->setIsLastIterVariable(Exprs.IL); 1150 Dir->setLowerBoundVariable(Exprs.LB); 1151 Dir->setUpperBoundVariable(Exprs.UB); 1152 Dir->setStrideVariable(Exprs.ST); 1153 Dir->setEnsureUpperBound(Exprs.EUB); 1154 Dir->setNextLowerBound(Exprs.NLB); 1155 Dir->setNextUpperBound(Exprs.NUB); 1156 Dir->setNumIterations(Exprs.NumIterations); 1157 Dir->setCounters(Exprs.Counters); 1158 Dir->setPrivateCounters(Exprs.PrivateCounters); 1159 Dir->setInits(Exprs.Inits); 1160 Dir->setUpdates(Exprs.Updates); 1161 Dir->setFinals(Exprs.Finals); 1162 Dir->setDependentCounters(Exprs.DependentCounters); 1163 Dir->setDependentInits(Exprs.DependentInits); 1164 Dir->setFinalsConditions(Exprs.FinalsConditions); 1165 Dir->setPreInits(Exprs.PreInits); 1166 Dir->setHasCancel(HasCancel); 1167 return Dir; 1168 } 1169 1170 OMPMasterTaskLoopDirective * 1171 OMPMasterTaskLoopDirective::CreateEmpty(const ASTContext &C, 1172 unsigned NumClauses, 1173 unsigned CollapsedNum, EmptyShell) { 1174 return createEmptyDirective<OMPMasterTaskLoopDirective>( 1175 C, NumClauses, /*HasAssociatedStmt=*/true, 1176 numLoopChildren(CollapsedNum, OMPD_master_taskloop), CollapsedNum); 1177 } 1178 1179 OMPMaskedTaskLoopDirective *OMPMaskedTaskLoopDirective::Create( 1180 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1181 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1182 const HelperExprs &Exprs, bool HasCancel) { 1183 auto *Dir = createDirective<OMPMaskedTaskLoopDirective>( 1184 C, Clauses, AssociatedStmt, 1185 numLoopChildren(CollapsedNum, OMPD_masked_taskloop), StartLoc, EndLoc, 1186 CollapsedNum); 1187 Dir->setIterationVariable(Exprs.IterationVarRef); 1188 Dir->setLastIteration(Exprs.LastIteration); 1189 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1190 Dir->setPreCond(Exprs.PreCond); 1191 Dir->setCond(Exprs.Cond); 1192 Dir->setInit(Exprs.Init); 1193 Dir->setInc(Exprs.Inc); 1194 Dir->setIsLastIterVariable(Exprs.IL); 1195 Dir->setLowerBoundVariable(Exprs.LB); 1196 Dir->setUpperBoundVariable(Exprs.UB); 1197 Dir->setStrideVariable(Exprs.ST); 1198 Dir->setEnsureUpperBound(Exprs.EUB); 1199 Dir->setNextLowerBound(Exprs.NLB); 1200 Dir->setNextUpperBound(Exprs.NUB); 1201 Dir->setNumIterations(Exprs.NumIterations); 1202 Dir->setCounters(Exprs.Counters); 1203 Dir->setPrivateCounters(Exprs.PrivateCounters); 1204 Dir->setInits(Exprs.Inits); 1205 Dir->setUpdates(Exprs.Updates); 1206 Dir->setFinals(Exprs.Finals); 1207 Dir->setDependentCounters(Exprs.DependentCounters); 1208 Dir->setDependentInits(Exprs.DependentInits); 1209 Dir->setFinalsConditions(Exprs.FinalsConditions); 1210 Dir->setPreInits(Exprs.PreInits); 1211 Dir->setHasCancel(HasCancel); 1212 return Dir; 1213 } 1214 1215 OMPMaskedTaskLoopDirective * 1216 OMPMaskedTaskLoopDirective::CreateEmpty(const ASTContext &C, 1217 unsigned NumClauses, 1218 unsigned CollapsedNum, EmptyShell) { 1219 return createEmptyDirective<OMPMaskedTaskLoopDirective>( 1220 C, NumClauses, /*HasAssociatedStmt=*/true, 1221 numLoopChildren(CollapsedNum, OMPD_masked_taskloop), CollapsedNum); 1222 } 1223 1224 OMPMasterTaskLoopSimdDirective *OMPMasterTaskLoopSimdDirective::Create( 1225 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1226 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1227 const HelperExprs &Exprs) { 1228 auto *Dir = createDirective<OMPMasterTaskLoopSimdDirective>( 1229 C, Clauses, AssociatedStmt, 1230 numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), StartLoc, 1231 EndLoc, CollapsedNum); 1232 Dir->setIterationVariable(Exprs.IterationVarRef); 1233 Dir->setLastIteration(Exprs.LastIteration); 1234 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1235 Dir->setPreCond(Exprs.PreCond); 1236 Dir->setCond(Exprs.Cond); 1237 Dir->setInit(Exprs.Init); 1238 Dir->setInc(Exprs.Inc); 1239 Dir->setIsLastIterVariable(Exprs.IL); 1240 Dir->setLowerBoundVariable(Exprs.LB); 1241 Dir->setUpperBoundVariable(Exprs.UB); 1242 Dir->setStrideVariable(Exprs.ST); 1243 Dir->setEnsureUpperBound(Exprs.EUB); 1244 Dir->setNextLowerBound(Exprs.NLB); 1245 Dir->setNextUpperBound(Exprs.NUB); 1246 Dir->setNumIterations(Exprs.NumIterations); 1247 Dir->setCounters(Exprs.Counters); 1248 Dir->setPrivateCounters(Exprs.PrivateCounters); 1249 Dir->setInits(Exprs.Inits); 1250 Dir->setUpdates(Exprs.Updates); 1251 Dir->setFinals(Exprs.Finals); 1252 Dir->setDependentCounters(Exprs.DependentCounters); 1253 Dir->setDependentInits(Exprs.DependentInits); 1254 Dir->setFinalsConditions(Exprs.FinalsConditions); 1255 Dir->setPreInits(Exprs.PreInits); 1256 return Dir; 1257 } 1258 1259 OMPMasterTaskLoopSimdDirective * 1260 OMPMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, 1261 unsigned NumClauses, 1262 unsigned CollapsedNum, EmptyShell) { 1263 return createEmptyDirective<OMPMasterTaskLoopSimdDirective>( 1264 C, NumClauses, /*HasAssociatedStmt=*/true, 1265 numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd), CollapsedNum); 1266 } 1267 1268 OMPMaskedTaskLoopSimdDirective *OMPMaskedTaskLoopSimdDirective::Create( 1269 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1270 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1271 const HelperExprs &Exprs) { 1272 auto *Dir = createDirective<OMPMaskedTaskLoopSimdDirective>( 1273 C, Clauses, AssociatedStmt, 1274 numLoopChildren(CollapsedNum, OMPD_masked_taskloop_simd), StartLoc, 1275 EndLoc, CollapsedNum); 1276 Dir->setIterationVariable(Exprs.IterationVarRef); 1277 Dir->setLastIteration(Exprs.LastIteration); 1278 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1279 Dir->setPreCond(Exprs.PreCond); 1280 Dir->setCond(Exprs.Cond); 1281 Dir->setInit(Exprs.Init); 1282 Dir->setInc(Exprs.Inc); 1283 Dir->setIsLastIterVariable(Exprs.IL); 1284 Dir->setLowerBoundVariable(Exprs.LB); 1285 Dir->setUpperBoundVariable(Exprs.UB); 1286 Dir->setStrideVariable(Exprs.ST); 1287 Dir->setEnsureUpperBound(Exprs.EUB); 1288 Dir->setNextLowerBound(Exprs.NLB); 1289 Dir->setNextUpperBound(Exprs.NUB); 1290 Dir->setNumIterations(Exprs.NumIterations); 1291 Dir->setCounters(Exprs.Counters); 1292 Dir->setPrivateCounters(Exprs.PrivateCounters); 1293 Dir->setInits(Exprs.Inits); 1294 Dir->setUpdates(Exprs.Updates); 1295 Dir->setFinals(Exprs.Finals); 1296 Dir->setDependentCounters(Exprs.DependentCounters); 1297 Dir->setDependentInits(Exprs.DependentInits); 1298 Dir->setFinalsConditions(Exprs.FinalsConditions); 1299 Dir->setPreInits(Exprs.PreInits); 1300 return Dir; 1301 } 1302 1303 OMPMaskedTaskLoopSimdDirective * 1304 OMPMaskedTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, 1305 unsigned NumClauses, 1306 unsigned CollapsedNum, EmptyShell) { 1307 return createEmptyDirective<OMPMaskedTaskLoopSimdDirective>( 1308 C, NumClauses, /*HasAssociatedStmt=*/true, 1309 numLoopChildren(CollapsedNum, OMPD_masked_taskloop_simd), CollapsedNum); 1310 } 1311 1312 OMPParallelMasterTaskLoopDirective *OMPParallelMasterTaskLoopDirective::Create( 1313 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1314 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1315 const HelperExprs &Exprs, bool HasCancel) { 1316 auto *Dir = createDirective<OMPParallelMasterTaskLoopDirective>( 1317 C, Clauses, AssociatedStmt, 1318 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop), StartLoc, 1319 EndLoc, CollapsedNum); 1320 Dir->setIterationVariable(Exprs.IterationVarRef); 1321 Dir->setLastIteration(Exprs.LastIteration); 1322 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1323 Dir->setPreCond(Exprs.PreCond); 1324 Dir->setCond(Exprs.Cond); 1325 Dir->setInit(Exprs.Init); 1326 Dir->setInc(Exprs.Inc); 1327 Dir->setIsLastIterVariable(Exprs.IL); 1328 Dir->setLowerBoundVariable(Exprs.LB); 1329 Dir->setUpperBoundVariable(Exprs.UB); 1330 Dir->setStrideVariable(Exprs.ST); 1331 Dir->setEnsureUpperBound(Exprs.EUB); 1332 Dir->setNextLowerBound(Exprs.NLB); 1333 Dir->setNextUpperBound(Exprs.NUB); 1334 Dir->setNumIterations(Exprs.NumIterations); 1335 Dir->setCounters(Exprs.Counters); 1336 Dir->setPrivateCounters(Exprs.PrivateCounters); 1337 Dir->setInits(Exprs.Inits); 1338 Dir->setUpdates(Exprs.Updates); 1339 Dir->setFinals(Exprs.Finals); 1340 Dir->setDependentCounters(Exprs.DependentCounters); 1341 Dir->setDependentInits(Exprs.DependentInits); 1342 Dir->setFinalsConditions(Exprs.FinalsConditions); 1343 Dir->setPreInits(Exprs.PreInits); 1344 Dir->setHasCancel(HasCancel); 1345 return Dir; 1346 } 1347 1348 OMPParallelMasterTaskLoopDirective * 1349 OMPParallelMasterTaskLoopDirective::CreateEmpty(const ASTContext &C, 1350 unsigned NumClauses, 1351 unsigned CollapsedNum, 1352 EmptyShell) { 1353 return createEmptyDirective<OMPParallelMasterTaskLoopDirective>( 1354 C, NumClauses, /*HasAssociatedStmt=*/true, 1355 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop), 1356 CollapsedNum); 1357 } 1358 1359 OMPParallelMaskedTaskLoopDirective *OMPParallelMaskedTaskLoopDirective::Create( 1360 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1361 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1362 const HelperExprs &Exprs, bool HasCancel) { 1363 auto *Dir = createDirective<OMPParallelMaskedTaskLoopDirective>( 1364 C, Clauses, AssociatedStmt, 1365 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop), StartLoc, 1366 EndLoc, CollapsedNum); 1367 Dir->setIterationVariable(Exprs.IterationVarRef); 1368 Dir->setLastIteration(Exprs.LastIteration); 1369 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1370 Dir->setPreCond(Exprs.PreCond); 1371 Dir->setCond(Exprs.Cond); 1372 Dir->setInit(Exprs.Init); 1373 Dir->setInc(Exprs.Inc); 1374 Dir->setIsLastIterVariable(Exprs.IL); 1375 Dir->setLowerBoundVariable(Exprs.LB); 1376 Dir->setUpperBoundVariable(Exprs.UB); 1377 Dir->setStrideVariable(Exprs.ST); 1378 Dir->setEnsureUpperBound(Exprs.EUB); 1379 Dir->setNextLowerBound(Exprs.NLB); 1380 Dir->setNextUpperBound(Exprs.NUB); 1381 Dir->setNumIterations(Exprs.NumIterations); 1382 Dir->setCounters(Exprs.Counters); 1383 Dir->setPrivateCounters(Exprs.PrivateCounters); 1384 Dir->setInits(Exprs.Inits); 1385 Dir->setUpdates(Exprs.Updates); 1386 Dir->setFinals(Exprs.Finals); 1387 Dir->setDependentCounters(Exprs.DependentCounters); 1388 Dir->setDependentInits(Exprs.DependentInits); 1389 Dir->setFinalsConditions(Exprs.FinalsConditions); 1390 Dir->setPreInits(Exprs.PreInits); 1391 Dir->setHasCancel(HasCancel); 1392 return Dir; 1393 } 1394 1395 OMPParallelMaskedTaskLoopDirective * 1396 OMPParallelMaskedTaskLoopDirective::CreateEmpty(const ASTContext &C, 1397 unsigned NumClauses, 1398 unsigned CollapsedNum, 1399 EmptyShell) { 1400 return createEmptyDirective<OMPParallelMaskedTaskLoopDirective>( 1401 C, NumClauses, /*HasAssociatedStmt=*/true, 1402 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop), 1403 CollapsedNum); 1404 } 1405 1406 OMPParallelMasterTaskLoopSimdDirective * 1407 OMPParallelMasterTaskLoopSimdDirective::Create( 1408 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1409 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1410 const HelperExprs &Exprs) { 1411 auto *Dir = createDirective<OMPParallelMasterTaskLoopSimdDirective>( 1412 C, Clauses, AssociatedStmt, 1413 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd), 1414 StartLoc, EndLoc, CollapsedNum); 1415 Dir->setIterationVariable(Exprs.IterationVarRef); 1416 Dir->setLastIteration(Exprs.LastIteration); 1417 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1418 Dir->setPreCond(Exprs.PreCond); 1419 Dir->setCond(Exprs.Cond); 1420 Dir->setInit(Exprs.Init); 1421 Dir->setInc(Exprs.Inc); 1422 Dir->setIsLastIterVariable(Exprs.IL); 1423 Dir->setLowerBoundVariable(Exprs.LB); 1424 Dir->setUpperBoundVariable(Exprs.UB); 1425 Dir->setStrideVariable(Exprs.ST); 1426 Dir->setEnsureUpperBound(Exprs.EUB); 1427 Dir->setNextLowerBound(Exprs.NLB); 1428 Dir->setNextUpperBound(Exprs.NUB); 1429 Dir->setNumIterations(Exprs.NumIterations); 1430 Dir->setCounters(Exprs.Counters); 1431 Dir->setPrivateCounters(Exprs.PrivateCounters); 1432 Dir->setInits(Exprs.Inits); 1433 Dir->setUpdates(Exprs.Updates); 1434 Dir->setFinals(Exprs.Finals); 1435 Dir->setDependentCounters(Exprs.DependentCounters); 1436 Dir->setDependentInits(Exprs.DependentInits); 1437 Dir->setFinalsConditions(Exprs.FinalsConditions); 1438 Dir->setPreInits(Exprs.PreInits); 1439 return Dir; 1440 } 1441 1442 OMPParallelMasterTaskLoopSimdDirective * 1443 OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, 1444 unsigned NumClauses, 1445 unsigned CollapsedNum, 1446 EmptyShell) { 1447 return createEmptyDirective<OMPParallelMasterTaskLoopSimdDirective>( 1448 C, NumClauses, /*HasAssociatedStmt=*/true, 1449 numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd), 1450 CollapsedNum); 1451 } 1452 1453 OMPParallelMaskedTaskLoopSimdDirective * 1454 OMPParallelMaskedTaskLoopSimdDirective::Create( 1455 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1456 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1457 const HelperExprs &Exprs) { 1458 auto *Dir = createDirective<OMPParallelMaskedTaskLoopSimdDirective>( 1459 C, Clauses, AssociatedStmt, 1460 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop_simd), 1461 StartLoc, EndLoc, CollapsedNum); 1462 Dir->setIterationVariable(Exprs.IterationVarRef); 1463 Dir->setLastIteration(Exprs.LastIteration); 1464 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1465 Dir->setPreCond(Exprs.PreCond); 1466 Dir->setCond(Exprs.Cond); 1467 Dir->setInit(Exprs.Init); 1468 Dir->setInc(Exprs.Inc); 1469 Dir->setIsLastIterVariable(Exprs.IL); 1470 Dir->setLowerBoundVariable(Exprs.LB); 1471 Dir->setUpperBoundVariable(Exprs.UB); 1472 Dir->setStrideVariable(Exprs.ST); 1473 Dir->setEnsureUpperBound(Exprs.EUB); 1474 Dir->setNextLowerBound(Exprs.NLB); 1475 Dir->setNextUpperBound(Exprs.NUB); 1476 Dir->setNumIterations(Exprs.NumIterations); 1477 Dir->setCounters(Exprs.Counters); 1478 Dir->setPrivateCounters(Exprs.PrivateCounters); 1479 Dir->setInits(Exprs.Inits); 1480 Dir->setUpdates(Exprs.Updates); 1481 Dir->setFinals(Exprs.Finals); 1482 Dir->setDependentCounters(Exprs.DependentCounters); 1483 Dir->setDependentInits(Exprs.DependentInits); 1484 Dir->setFinalsConditions(Exprs.FinalsConditions); 1485 Dir->setPreInits(Exprs.PreInits); 1486 return Dir; 1487 } 1488 1489 OMPParallelMaskedTaskLoopSimdDirective * 1490 OMPParallelMaskedTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, 1491 unsigned NumClauses, 1492 unsigned CollapsedNum, 1493 EmptyShell) { 1494 return createEmptyDirective<OMPParallelMaskedTaskLoopSimdDirective>( 1495 C, NumClauses, /*HasAssociatedStmt=*/true, 1496 numLoopChildren(CollapsedNum, OMPD_parallel_masked_taskloop_simd), 1497 CollapsedNum); 1498 } 1499 1500 OMPDistributeDirective *OMPDistributeDirective::Create( 1501 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1502 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1503 const HelperExprs &Exprs) { 1504 auto *Dir = createDirective<OMPDistributeDirective>( 1505 C, Clauses, AssociatedStmt, 1506 numLoopChildren(CollapsedNum, OMPD_distribute), StartLoc, EndLoc, 1507 CollapsedNum); 1508 Dir->setIterationVariable(Exprs.IterationVarRef); 1509 Dir->setLastIteration(Exprs.LastIteration); 1510 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1511 Dir->setPreCond(Exprs.PreCond); 1512 Dir->setCond(Exprs.Cond); 1513 Dir->setInit(Exprs.Init); 1514 Dir->setInc(Exprs.Inc); 1515 Dir->setIsLastIterVariable(Exprs.IL); 1516 Dir->setLowerBoundVariable(Exprs.LB); 1517 Dir->setUpperBoundVariable(Exprs.UB); 1518 Dir->setStrideVariable(Exprs.ST); 1519 Dir->setEnsureUpperBound(Exprs.EUB); 1520 Dir->setNextLowerBound(Exprs.NLB); 1521 Dir->setNextUpperBound(Exprs.NUB); 1522 Dir->setNumIterations(Exprs.NumIterations); 1523 Dir->setCounters(Exprs.Counters); 1524 Dir->setPrivateCounters(Exprs.PrivateCounters); 1525 Dir->setInits(Exprs.Inits); 1526 Dir->setUpdates(Exprs.Updates); 1527 Dir->setFinals(Exprs.Finals); 1528 Dir->setDependentCounters(Exprs.DependentCounters); 1529 Dir->setDependentInits(Exprs.DependentInits); 1530 Dir->setFinalsConditions(Exprs.FinalsConditions); 1531 Dir->setPreInits(Exprs.PreInits); 1532 return Dir; 1533 } 1534 1535 OMPDistributeDirective * 1536 OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, 1537 unsigned CollapsedNum, EmptyShell) { 1538 return createEmptyDirective<OMPDistributeDirective>( 1539 C, NumClauses, /*HasAssociatedStmt=*/true, 1540 numLoopChildren(CollapsedNum, OMPD_distribute), CollapsedNum); 1541 } 1542 1543 OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create( 1544 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1545 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { 1546 return createDirective<OMPTargetUpdateDirective>(C, Clauses, AssociatedStmt, 1547 /*NumChildren=*/0, StartLoc, 1548 EndLoc); 1549 } 1550 1551 OMPTargetUpdateDirective * 1552 OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, 1553 EmptyShell) { 1554 return createEmptyDirective<OMPTargetUpdateDirective>( 1555 C, NumClauses, /*HasAssociatedStmt=*/true); 1556 } 1557 1558 OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create( 1559 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1560 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1561 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) { 1562 auto *Dir = createDirective<OMPDistributeParallelForDirective>( 1563 C, Clauses, AssociatedStmt, 1564 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1, StartLoc, 1565 EndLoc, CollapsedNum); 1566 Dir->setIterationVariable(Exprs.IterationVarRef); 1567 Dir->setLastIteration(Exprs.LastIteration); 1568 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1569 Dir->setPreCond(Exprs.PreCond); 1570 Dir->setCond(Exprs.Cond); 1571 Dir->setInit(Exprs.Init); 1572 Dir->setInc(Exprs.Inc); 1573 Dir->setIsLastIterVariable(Exprs.IL); 1574 Dir->setLowerBoundVariable(Exprs.LB); 1575 Dir->setUpperBoundVariable(Exprs.UB); 1576 Dir->setStrideVariable(Exprs.ST); 1577 Dir->setEnsureUpperBound(Exprs.EUB); 1578 Dir->setNextLowerBound(Exprs.NLB); 1579 Dir->setNextUpperBound(Exprs.NUB); 1580 Dir->setNumIterations(Exprs.NumIterations); 1581 Dir->setPrevLowerBoundVariable(Exprs.PrevLB); 1582 Dir->setPrevUpperBoundVariable(Exprs.PrevUB); 1583 Dir->setDistInc(Exprs.DistInc); 1584 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); 1585 Dir->setCounters(Exprs.Counters); 1586 Dir->setPrivateCounters(Exprs.PrivateCounters); 1587 Dir->setInits(Exprs.Inits); 1588 Dir->setUpdates(Exprs.Updates); 1589 Dir->setFinals(Exprs.Finals); 1590 Dir->setDependentCounters(Exprs.DependentCounters); 1591 Dir->setDependentInits(Exprs.DependentInits); 1592 Dir->setFinalsConditions(Exprs.FinalsConditions); 1593 Dir->setPreInits(Exprs.PreInits); 1594 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); 1595 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); 1596 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); 1597 Dir->setCombinedInit(Exprs.DistCombinedFields.Init); 1598 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); 1599 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); 1600 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); 1601 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); 1602 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); 1603 Dir->setTaskReductionRefExpr(TaskRedRef); 1604 Dir->HasCancel = HasCancel; 1605 return Dir; 1606 } 1607 1608 OMPDistributeParallelForDirective * 1609 OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C, 1610 unsigned NumClauses, 1611 unsigned CollapsedNum, 1612 EmptyShell) { 1613 return createEmptyDirective<OMPDistributeParallelForDirective>( 1614 C, NumClauses, /*HasAssociatedStmt=*/true, 1615 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for) + 1, 1616 CollapsedNum); 1617 } 1618 1619 OMPDistributeParallelForSimdDirective * 1620 OMPDistributeParallelForSimdDirective::Create( 1621 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1622 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1623 const HelperExprs &Exprs) { 1624 auto *Dir = createDirective<OMPDistributeParallelForSimdDirective>( 1625 C, Clauses, AssociatedStmt, 1626 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd), 1627 StartLoc, EndLoc, CollapsedNum); 1628 Dir->setIterationVariable(Exprs.IterationVarRef); 1629 Dir->setLastIteration(Exprs.LastIteration); 1630 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1631 Dir->setPreCond(Exprs.PreCond); 1632 Dir->setCond(Exprs.Cond); 1633 Dir->setInit(Exprs.Init); 1634 Dir->setInc(Exprs.Inc); 1635 Dir->setIsLastIterVariable(Exprs.IL); 1636 Dir->setLowerBoundVariable(Exprs.LB); 1637 Dir->setUpperBoundVariable(Exprs.UB); 1638 Dir->setStrideVariable(Exprs.ST); 1639 Dir->setEnsureUpperBound(Exprs.EUB); 1640 Dir->setNextLowerBound(Exprs.NLB); 1641 Dir->setNextUpperBound(Exprs.NUB); 1642 Dir->setNumIterations(Exprs.NumIterations); 1643 Dir->setPrevLowerBoundVariable(Exprs.PrevLB); 1644 Dir->setPrevUpperBoundVariable(Exprs.PrevUB); 1645 Dir->setDistInc(Exprs.DistInc); 1646 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); 1647 Dir->setCounters(Exprs.Counters); 1648 Dir->setPrivateCounters(Exprs.PrivateCounters); 1649 Dir->setInits(Exprs.Inits); 1650 Dir->setUpdates(Exprs.Updates); 1651 Dir->setFinals(Exprs.Finals); 1652 Dir->setDependentCounters(Exprs.DependentCounters); 1653 Dir->setDependentInits(Exprs.DependentInits); 1654 Dir->setFinalsConditions(Exprs.FinalsConditions); 1655 Dir->setPreInits(Exprs.PreInits); 1656 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); 1657 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); 1658 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); 1659 Dir->setCombinedInit(Exprs.DistCombinedFields.Init); 1660 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); 1661 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); 1662 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); 1663 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); 1664 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); 1665 return Dir; 1666 } 1667 1668 OMPDistributeParallelForSimdDirective * 1669 OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C, 1670 unsigned NumClauses, 1671 unsigned CollapsedNum, 1672 EmptyShell) { 1673 return createEmptyDirective<OMPDistributeParallelForSimdDirective>( 1674 C, NumClauses, /*HasAssociatedStmt=*/true, 1675 numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd), 1676 CollapsedNum); 1677 } 1678 1679 OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create( 1680 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1681 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1682 const HelperExprs &Exprs) { 1683 auto *Dir = createDirective<OMPDistributeSimdDirective>( 1684 C, Clauses, AssociatedStmt, 1685 numLoopChildren(CollapsedNum, OMPD_distribute_simd), StartLoc, EndLoc, 1686 CollapsedNum); 1687 Dir->setIterationVariable(Exprs.IterationVarRef); 1688 Dir->setLastIteration(Exprs.LastIteration); 1689 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1690 Dir->setPreCond(Exprs.PreCond); 1691 Dir->setCond(Exprs.Cond); 1692 Dir->setInit(Exprs.Init); 1693 Dir->setInc(Exprs.Inc); 1694 Dir->setIsLastIterVariable(Exprs.IL); 1695 Dir->setLowerBoundVariable(Exprs.LB); 1696 Dir->setUpperBoundVariable(Exprs.UB); 1697 Dir->setStrideVariable(Exprs.ST); 1698 Dir->setEnsureUpperBound(Exprs.EUB); 1699 Dir->setNextLowerBound(Exprs.NLB); 1700 Dir->setNextUpperBound(Exprs.NUB); 1701 Dir->setNumIterations(Exprs.NumIterations); 1702 Dir->setCounters(Exprs.Counters); 1703 Dir->setPrivateCounters(Exprs.PrivateCounters); 1704 Dir->setInits(Exprs.Inits); 1705 Dir->setUpdates(Exprs.Updates); 1706 Dir->setFinals(Exprs.Finals); 1707 Dir->setDependentCounters(Exprs.DependentCounters); 1708 Dir->setDependentInits(Exprs.DependentInits); 1709 Dir->setFinalsConditions(Exprs.FinalsConditions); 1710 Dir->setPreInits(Exprs.PreInits); 1711 return Dir; 1712 } 1713 1714 OMPDistributeSimdDirective * 1715 OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C, 1716 unsigned NumClauses, 1717 unsigned CollapsedNum, EmptyShell) { 1718 return createEmptyDirective<OMPDistributeSimdDirective>( 1719 C, NumClauses, /*HasAssociatedStmt=*/true, 1720 numLoopChildren(CollapsedNum, OMPD_distribute_simd), CollapsedNum); 1721 } 1722 1723 OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create( 1724 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1725 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1726 const HelperExprs &Exprs) { 1727 auto *Dir = createDirective<OMPTargetParallelForSimdDirective>( 1728 C, Clauses, AssociatedStmt, 1729 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd), StartLoc, 1730 EndLoc, CollapsedNum); 1731 Dir->setIterationVariable(Exprs.IterationVarRef); 1732 Dir->setLastIteration(Exprs.LastIteration); 1733 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1734 Dir->setPreCond(Exprs.PreCond); 1735 Dir->setCond(Exprs.Cond); 1736 Dir->setInit(Exprs.Init); 1737 Dir->setInc(Exprs.Inc); 1738 Dir->setIsLastIterVariable(Exprs.IL); 1739 Dir->setLowerBoundVariable(Exprs.LB); 1740 Dir->setUpperBoundVariable(Exprs.UB); 1741 Dir->setStrideVariable(Exprs.ST); 1742 Dir->setEnsureUpperBound(Exprs.EUB); 1743 Dir->setNextLowerBound(Exprs.NLB); 1744 Dir->setNextUpperBound(Exprs.NUB); 1745 Dir->setNumIterations(Exprs.NumIterations); 1746 Dir->setCounters(Exprs.Counters); 1747 Dir->setPrivateCounters(Exprs.PrivateCounters); 1748 Dir->setInits(Exprs.Inits); 1749 Dir->setUpdates(Exprs.Updates); 1750 Dir->setFinals(Exprs.Finals); 1751 Dir->setDependentCounters(Exprs.DependentCounters); 1752 Dir->setDependentInits(Exprs.DependentInits); 1753 Dir->setFinalsConditions(Exprs.FinalsConditions); 1754 Dir->setPreInits(Exprs.PreInits); 1755 return Dir; 1756 } 1757 1758 OMPTargetParallelForSimdDirective * 1759 OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C, 1760 unsigned NumClauses, 1761 unsigned CollapsedNum, 1762 EmptyShell) { 1763 return createEmptyDirective<OMPTargetParallelForSimdDirective>( 1764 C, NumClauses, /*HasAssociatedStmt=*/true, 1765 numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd), 1766 CollapsedNum); 1767 } 1768 1769 OMPTargetSimdDirective * 1770 OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc, 1771 SourceLocation EndLoc, unsigned CollapsedNum, 1772 ArrayRef<OMPClause *> Clauses, 1773 Stmt *AssociatedStmt, const HelperExprs &Exprs) { 1774 auto *Dir = createDirective<OMPTargetSimdDirective>( 1775 C, Clauses, AssociatedStmt, 1776 numLoopChildren(CollapsedNum, OMPD_target_simd), StartLoc, EndLoc, 1777 CollapsedNum); 1778 Dir->setIterationVariable(Exprs.IterationVarRef); 1779 Dir->setLastIteration(Exprs.LastIteration); 1780 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1781 Dir->setPreCond(Exprs.PreCond); 1782 Dir->setCond(Exprs.Cond); 1783 Dir->setInit(Exprs.Init); 1784 Dir->setInc(Exprs.Inc); 1785 Dir->setCounters(Exprs.Counters); 1786 Dir->setPrivateCounters(Exprs.PrivateCounters); 1787 Dir->setInits(Exprs.Inits); 1788 Dir->setUpdates(Exprs.Updates); 1789 Dir->setFinals(Exprs.Finals); 1790 Dir->setDependentCounters(Exprs.DependentCounters); 1791 Dir->setDependentInits(Exprs.DependentInits); 1792 Dir->setFinalsConditions(Exprs.FinalsConditions); 1793 Dir->setPreInits(Exprs.PreInits); 1794 return Dir; 1795 } 1796 1797 OMPTargetSimdDirective * 1798 OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, 1799 unsigned CollapsedNum, EmptyShell) { 1800 return createEmptyDirective<OMPTargetSimdDirective>( 1801 C, NumClauses, /*HasAssociatedStmt=*/true, 1802 numLoopChildren(CollapsedNum, OMPD_target_simd), CollapsedNum); 1803 } 1804 1805 OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create( 1806 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1807 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1808 const HelperExprs &Exprs) { 1809 auto *Dir = createDirective<OMPTeamsDistributeDirective>( 1810 C, Clauses, AssociatedStmt, 1811 numLoopChildren(CollapsedNum, OMPD_teams_distribute), StartLoc, EndLoc, 1812 CollapsedNum); 1813 Dir->setIterationVariable(Exprs.IterationVarRef); 1814 Dir->setLastIteration(Exprs.LastIteration); 1815 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1816 Dir->setPreCond(Exprs.PreCond); 1817 Dir->setCond(Exprs.Cond); 1818 Dir->setInit(Exprs.Init); 1819 Dir->setInc(Exprs.Inc); 1820 Dir->setIsLastIterVariable(Exprs.IL); 1821 Dir->setLowerBoundVariable(Exprs.LB); 1822 Dir->setUpperBoundVariable(Exprs.UB); 1823 Dir->setStrideVariable(Exprs.ST); 1824 Dir->setEnsureUpperBound(Exprs.EUB); 1825 Dir->setNextLowerBound(Exprs.NLB); 1826 Dir->setNextUpperBound(Exprs.NUB); 1827 Dir->setNumIterations(Exprs.NumIterations); 1828 Dir->setCounters(Exprs.Counters); 1829 Dir->setPrivateCounters(Exprs.PrivateCounters); 1830 Dir->setInits(Exprs.Inits); 1831 Dir->setUpdates(Exprs.Updates); 1832 Dir->setFinals(Exprs.Finals); 1833 Dir->setDependentCounters(Exprs.DependentCounters); 1834 Dir->setDependentInits(Exprs.DependentInits); 1835 Dir->setFinalsConditions(Exprs.FinalsConditions); 1836 Dir->setPreInits(Exprs.PreInits); 1837 return Dir; 1838 } 1839 1840 OMPTeamsDistributeDirective * 1841 OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C, 1842 unsigned NumClauses, 1843 unsigned CollapsedNum, EmptyShell) { 1844 return createEmptyDirective<OMPTeamsDistributeDirective>( 1845 C, NumClauses, /*HasAssociatedStmt=*/true, 1846 numLoopChildren(CollapsedNum, OMPD_teams_distribute), CollapsedNum); 1847 } 1848 1849 OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create( 1850 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1851 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1852 const HelperExprs &Exprs) { 1853 auto *Dir = createDirective<OMPTeamsDistributeSimdDirective>( 1854 C, Clauses, AssociatedStmt, 1855 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), StartLoc, 1856 EndLoc, CollapsedNum); 1857 Dir->setIterationVariable(Exprs.IterationVarRef); 1858 Dir->setLastIteration(Exprs.LastIteration); 1859 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1860 Dir->setPreCond(Exprs.PreCond); 1861 Dir->setCond(Exprs.Cond); 1862 Dir->setInit(Exprs.Init); 1863 Dir->setInc(Exprs.Inc); 1864 Dir->setIsLastIterVariable(Exprs.IL); 1865 Dir->setLowerBoundVariable(Exprs.LB); 1866 Dir->setUpperBoundVariable(Exprs.UB); 1867 Dir->setStrideVariable(Exprs.ST); 1868 Dir->setEnsureUpperBound(Exprs.EUB); 1869 Dir->setNextLowerBound(Exprs.NLB); 1870 Dir->setNextUpperBound(Exprs.NUB); 1871 Dir->setNumIterations(Exprs.NumIterations); 1872 Dir->setCounters(Exprs.Counters); 1873 Dir->setPrivateCounters(Exprs.PrivateCounters); 1874 Dir->setInits(Exprs.Inits); 1875 Dir->setUpdates(Exprs.Updates); 1876 Dir->setFinals(Exprs.Finals); 1877 Dir->setDependentCounters(Exprs.DependentCounters); 1878 Dir->setDependentInits(Exprs.DependentInits); 1879 Dir->setFinalsConditions(Exprs.FinalsConditions); 1880 Dir->setPreInits(Exprs.PreInits); 1881 return Dir; 1882 } 1883 1884 OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty( 1885 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 1886 EmptyShell) { 1887 return createEmptyDirective<OMPTeamsDistributeSimdDirective>( 1888 C, NumClauses, /*HasAssociatedStmt=*/true, 1889 numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd), CollapsedNum); 1890 } 1891 1892 OMPTeamsDistributeParallelForSimdDirective * 1893 OMPTeamsDistributeParallelForSimdDirective::Create( 1894 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1895 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1896 const HelperExprs &Exprs) { 1897 auto *Dir = createDirective<OMPTeamsDistributeParallelForSimdDirective>( 1898 C, Clauses, AssociatedStmt, 1899 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd), 1900 StartLoc, EndLoc, CollapsedNum); 1901 Dir->setIterationVariable(Exprs.IterationVarRef); 1902 Dir->setLastIteration(Exprs.LastIteration); 1903 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1904 Dir->setPreCond(Exprs.PreCond); 1905 Dir->setCond(Exprs.Cond); 1906 Dir->setInit(Exprs.Init); 1907 Dir->setInc(Exprs.Inc); 1908 Dir->setIsLastIterVariable(Exprs.IL); 1909 Dir->setLowerBoundVariable(Exprs.LB); 1910 Dir->setUpperBoundVariable(Exprs.UB); 1911 Dir->setStrideVariable(Exprs.ST); 1912 Dir->setEnsureUpperBound(Exprs.EUB); 1913 Dir->setNextLowerBound(Exprs.NLB); 1914 Dir->setNextUpperBound(Exprs.NUB); 1915 Dir->setNumIterations(Exprs.NumIterations); 1916 Dir->setPrevLowerBoundVariable(Exprs.PrevLB); 1917 Dir->setPrevUpperBoundVariable(Exprs.PrevUB); 1918 Dir->setDistInc(Exprs.DistInc); 1919 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); 1920 Dir->setCounters(Exprs.Counters); 1921 Dir->setPrivateCounters(Exprs.PrivateCounters); 1922 Dir->setInits(Exprs.Inits); 1923 Dir->setUpdates(Exprs.Updates); 1924 Dir->setFinals(Exprs.Finals); 1925 Dir->setDependentCounters(Exprs.DependentCounters); 1926 Dir->setDependentInits(Exprs.DependentInits); 1927 Dir->setFinalsConditions(Exprs.FinalsConditions); 1928 Dir->setPreInits(Exprs.PreInits); 1929 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); 1930 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); 1931 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); 1932 Dir->setCombinedInit(Exprs.DistCombinedFields.Init); 1933 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); 1934 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); 1935 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); 1936 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); 1937 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); 1938 return Dir; 1939 } 1940 1941 OMPTeamsDistributeParallelForSimdDirective * 1942 OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C, 1943 unsigned NumClauses, 1944 unsigned CollapsedNum, 1945 EmptyShell) { 1946 return createEmptyDirective<OMPTeamsDistributeParallelForSimdDirective>( 1947 C, NumClauses, /*HasAssociatedStmt=*/true, 1948 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for_simd), 1949 CollapsedNum); 1950 } 1951 1952 OMPTeamsDistributeParallelForDirective * 1953 OMPTeamsDistributeParallelForDirective::Create( 1954 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1955 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 1956 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) { 1957 auto *Dir = createDirective<OMPTeamsDistributeParallelForDirective>( 1958 C, Clauses, AssociatedStmt, 1959 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1, 1960 StartLoc, EndLoc, CollapsedNum); 1961 Dir->setIterationVariable(Exprs.IterationVarRef); 1962 Dir->setLastIteration(Exprs.LastIteration); 1963 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 1964 Dir->setPreCond(Exprs.PreCond); 1965 Dir->setCond(Exprs.Cond); 1966 Dir->setInit(Exprs.Init); 1967 Dir->setInc(Exprs.Inc); 1968 Dir->setIsLastIterVariable(Exprs.IL); 1969 Dir->setLowerBoundVariable(Exprs.LB); 1970 Dir->setUpperBoundVariable(Exprs.UB); 1971 Dir->setStrideVariable(Exprs.ST); 1972 Dir->setEnsureUpperBound(Exprs.EUB); 1973 Dir->setNextLowerBound(Exprs.NLB); 1974 Dir->setNextUpperBound(Exprs.NUB); 1975 Dir->setNumIterations(Exprs.NumIterations); 1976 Dir->setPrevLowerBoundVariable(Exprs.PrevLB); 1977 Dir->setPrevUpperBoundVariable(Exprs.PrevUB); 1978 Dir->setDistInc(Exprs.DistInc); 1979 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); 1980 Dir->setCounters(Exprs.Counters); 1981 Dir->setPrivateCounters(Exprs.PrivateCounters); 1982 Dir->setInits(Exprs.Inits); 1983 Dir->setUpdates(Exprs.Updates); 1984 Dir->setFinals(Exprs.Finals); 1985 Dir->setDependentCounters(Exprs.DependentCounters); 1986 Dir->setDependentInits(Exprs.DependentInits); 1987 Dir->setFinalsConditions(Exprs.FinalsConditions); 1988 Dir->setPreInits(Exprs.PreInits); 1989 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); 1990 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); 1991 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); 1992 Dir->setCombinedInit(Exprs.DistCombinedFields.Init); 1993 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); 1994 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); 1995 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); 1996 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); 1997 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); 1998 Dir->setTaskReductionRefExpr(TaskRedRef); 1999 Dir->HasCancel = HasCancel; 2000 return Dir; 2001 } 2002 2003 OMPTeamsDistributeParallelForDirective * 2004 OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C, 2005 unsigned NumClauses, 2006 unsigned CollapsedNum, 2007 EmptyShell) { 2008 return createEmptyDirective<OMPTeamsDistributeParallelForDirective>( 2009 C, NumClauses, /*HasAssociatedStmt=*/true, 2010 numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for) + 1, 2011 CollapsedNum); 2012 } 2013 2014 OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create( 2015 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2016 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { 2017 return createDirective<OMPTargetTeamsDirective>(C, Clauses, AssociatedStmt, 2018 /*NumChildren=*/0, StartLoc, 2019 EndLoc); 2020 } 2021 2022 OMPTargetTeamsDirective * 2023 OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, 2024 EmptyShell) { 2025 return createEmptyDirective<OMPTargetTeamsDirective>( 2026 C, NumClauses, /*HasAssociatedStmt=*/true); 2027 } 2028 2029 OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create( 2030 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2031 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2032 const HelperExprs &Exprs) { 2033 auto *Dir = createDirective<OMPTargetTeamsDistributeDirective>( 2034 C, Clauses, AssociatedStmt, 2035 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute), StartLoc, 2036 EndLoc, CollapsedNum); 2037 Dir->setIterationVariable(Exprs.IterationVarRef); 2038 Dir->setLastIteration(Exprs.LastIteration); 2039 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 2040 Dir->setPreCond(Exprs.PreCond); 2041 Dir->setCond(Exprs.Cond); 2042 Dir->setInit(Exprs.Init); 2043 Dir->setInc(Exprs.Inc); 2044 Dir->setIsLastIterVariable(Exprs.IL); 2045 Dir->setLowerBoundVariable(Exprs.LB); 2046 Dir->setUpperBoundVariable(Exprs.UB); 2047 Dir->setStrideVariable(Exprs.ST); 2048 Dir->setEnsureUpperBound(Exprs.EUB); 2049 Dir->setNextLowerBound(Exprs.NLB); 2050 Dir->setNextUpperBound(Exprs.NUB); 2051 Dir->setNumIterations(Exprs.NumIterations); 2052 Dir->setCounters(Exprs.Counters); 2053 Dir->setPrivateCounters(Exprs.PrivateCounters); 2054 Dir->setInits(Exprs.Inits); 2055 Dir->setUpdates(Exprs.Updates); 2056 Dir->setFinals(Exprs.Finals); 2057 Dir->setDependentCounters(Exprs.DependentCounters); 2058 Dir->setDependentInits(Exprs.DependentInits); 2059 Dir->setFinalsConditions(Exprs.FinalsConditions); 2060 Dir->setPreInits(Exprs.PreInits); 2061 return Dir; 2062 } 2063 2064 OMPTargetTeamsDistributeDirective * 2065 OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C, 2066 unsigned NumClauses, 2067 unsigned CollapsedNum, 2068 EmptyShell) { 2069 return createEmptyDirective<OMPTargetTeamsDistributeDirective>( 2070 C, NumClauses, /*HasAssociatedStmt=*/true, 2071 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute), 2072 CollapsedNum); 2073 } 2074 2075 OMPTargetTeamsDistributeParallelForDirective * 2076 OMPTargetTeamsDistributeParallelForDirective::Create( 2077 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2078 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2079 const HelperExprs &Exprs, Expr *TaskRedRef, bool HasCancel) { 2080 auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForDirective>( 2081 C, Clauses, AssociatedStmt, 2082 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) + 2083 1, 2084 StartLoc, EndLoc, CollapsedNum); 2085 Dir->setIterationVariable(Exprs.IterationVarRef); 2086 Dir->setLastIteration(Exprs.LastIteration); 2087 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 2088 Dir->setPreCond(Exprs.PreCond); 2089 Dir->setCond(Exprs.Cond); 2090 Dir->setInit(Exprs.Init); 2091 Dir->setInc(Exprs.Inc); 2092 Dir->setIsLastIterVariable(Exprs.IL); 2093 Dir->setLowerBoundVariable(Exprs.LB); 2094 Dir->setUpperBoundVariable(Exprs.UB); 2095 Dir->setStrideVariable(Exprs.ST); 2096 Dir->setEnsureUpperBound(Exprs.EUB); 2097 Dir->setNextLowerBound(Exprs.NLB); 2098 Dir->setNextUpperBound(Exprs.NUB); 2099 Dir->setNumIterations(Exprs.NumIterations); 2100 Dir->setPrevLowerBoundVariable(Exprs.PrevLB); 2101 Dir->setPrevUpperBoundVariable(Exprs.PrevUB); 2102 Dir->setDistInc(Exprs.DistInc); 2103 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); 2104 Dir->setCounters(Exprs.Counters); 2105 Dir->setPrivateCounters(Exprs.PrivateCounters); 2106 Dir->setInits(Exprs.Inits); 2107 Dir->setUpdates(Exprs.Updates); 2108 Dir->setFinals(Exprs.Finals); 2109 Dir->setDependentCounters(Exprs.DependentCounters); 2110 Dir->setDependentInits(Exprs.DependentInits); 2111 Dir->setFinalsConditions(Exprs.FinalsConditions); 2112 Dir->setPreInits(Exprs.PreInits); 2113 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); 2114 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); 2115 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); 2116 Dir->setCombinedInit(Exprs.DistCombinedFields.Init); 2117 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); 2118 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); 2119 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); 2120 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); 2121 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); 2122 Dir->setTaskReductionRefExpr(TaskRedRef); 2123 Dir->HasCancel = HasCancel; 2124 return Dir; 2125 } 2126 2127 OMPTargetTeamsDistributeParallelForDirective * 2128 OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C, 2129 unsigned NumClauses, 2130 unsigned CollapsedNum, 2131 EmptyShell) { 2132 return createEmptyDirective<OMPTargetTeamsDistributeParallelForDirective>( 2133 C, NumClauses, /*HasAssociatedStmt=*/true, 2134 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_parallel_for) + 2135 1, 2136 CollapsedNum); 2137 } 2138 2139 OMPTargetTeamsDistributeParallelForSimdDirective * 2140 OMPTargetTeamsDistributeParallelForSimdDirective::Create( 2141 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2142 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2143 const HelperExprs &Exprs) { 2144 auto *Dir = createDirective<OMPTargetTeamsDistributeParallelForSimdDirective>( 2145 C, Clauses, AssociatedStmt, 2146 numLoopChildren(CollapsedNum, 2147 OMPD_target_teams_distribute_parallel_for_simd), 2148 StartLoc, EndLoc, CollapsedNum); 2149 Dir->setIterationVariable(Exprs.IterationVarRef); 2150 Dir->setLastIteration(Exprs.LastIteration); 2151 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 2152 Dir->setPreCond(Exprs.PreCond); 2153 Dir->setCond(Exprs.Cond); 2154 Dir->setInit(Exprs.Init); 2155 Dir->setInc(Exprs.Inc); 2156 Dir->setIsLastIterVariable(Exprs.IL); 2157 Dir->setLowerBoundVariable(Exprs.LB); 2158 Dir->setUpperBoundVariable(Exprs.UB); 2159 Dir->setStrideVariable(Exprs.ST); 2160 Dir->setEnsureUpperBound(Exprs.EUB); 2161 Dir->setNextLowerBound(Exprs.NLB); 2162 Dir->setNextUpperBound(Exprs.NUB); 2163 Dir->setNumIterations(Exprs.NumIterations); 2164 Dir->setPrevLowerBoundVariable(Exprs.PrevLB); 2165 Dir->setPrevUpperBoundVariable(Exprs.PrevUB); 2166 Dir->setDistInc(Exprs.DistInc); 2167 Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); 2168 Dir->setCounters(Exprs.Counters); 2169 Dir->setPrivateCounters(Exprs.PrivateCounters); 2170 Dir->setInits(Exprs.Inits); 2171 Dir->setUpdates(Exprs.Updates); 2172 Dir->setFinals(Exprs.Finals); 2173 Dir->setDependentCounters(Exprs.DependentCounters); 2174 Dir->setDependentInits(Exprs.DependentInits); 2175 Dir->setFinalsConditions(Exprs.FinalsConditions); 2176 Dir->setPreInits(Exprs.PreInits); 2177 Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); 2178 Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); 2179 Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); 2180 Dir->setCombinedInit(Exprs.DistCombinedFields.Init); 2181 Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); 2182 Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); 2183 Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); 2184 Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); 2185 Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); 2186 return Dir; 2187 } 2188 2189 OMPTargetTeamsDistributeParallelForSimdDirective * 2190 OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty( 2191 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 2192 EmptyShell) { 2193 return createEmptyDirective<OMPTargetTeamsDistributeParallelForSimdDirective>( 2194 C, NumClauses, /*HasAssociatedStmt=*/true, 2195 numLoopChildren(CollapsedNum, 2196 OMPD_target_teams_distribute_parallel_for_simd), 2197 CollapsedNum); 2198 } 2199 2200 OMPTargetTeamsDistributeSimdDirective * 2201 OMPTargetTeamsDistributeSimdDirective::Create( 2202 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2203 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2204 const HelperExprs &Exprs) { 2205 auto *Dir = createDirective<OMPTargetTeamsDistributeSimdDirective>( 2206 C, Clauses, AssociatedStmt, 2207 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd), 2208 StartLoc, EndLoc, CollapsedNum); 2209 Dir->setIterationVariable(Exprs.IterationVarRef); 2210 Dir->setLastIteration(Exprs.LastIteration); 2211 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 2212 Dir->setPreCond(Exprs.PreCond); 2213 Dir->setCond(Exprs.Cond); 2214 Dir->setInit(Exprs.Init); 2215 Dir->setInc(Exprs.Inc); 2216 Dir->setIsLastIterVariable(Exprs.IL); 2217 Dir->setLowerBoundVariable(Exprs.LB); 2218 Dir->setUpperBoundVariable(Exprs.UB); 2219 Dir->setStrideVariable(Exprs.ST); 2220 Dir->setEnsureUpperBound(Exprs.EUB); 2221 Dir->setNextLowerBound(Exprs.NLB); 2222 Dir->setNextUpperBound(Exprs.NUB); 2223 Dir->setNumIterations(Exprs.NumIterations); 2224 Dir->setCounters(Exprs.Counters); 2225 Dir->setPrivateCounters(Exprs.PrivateCounters); 2226 Dir->setInits(Exprs.Inits); 2227 Dir->setUpdates(Exprs.Updates); 2228 Dir->setFinals(Exprs.Finals); 2229 Dir->setDependentCounters(Exprs.DependentCounters); 2230 Dir->setDependentInits(Exprs.DependentInits); 2231 Dir->setFinalsConditions(Exprs.FinalsConditions); 2232 Dir->setPreInits(Exprs.PreInits); 2233 return Dir; 2234 } 2235 2236 OMPTargetTeamsDistributeSimdDirective * 2237 OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C, 2238 unsigned NumClauses, 2239 unsigned CollapsedNum, 2240 EmptyShell) { 2241 return createEmptyDirective<OMPTargetTeamsDistributeSimdDirective>( 2242 C, NumClauses, /*HasAssociatedStmt=*/true, 2243 numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd), 2244 CollapsedNum); 2245 } 2246 2247 OMPInteropDirective * 2248 OMPInteropDirective::Create(const ASTContext &C, SourceLocation StartLoc, 2249 SourceLocation EndLoc, 2250 ArrayRef<OMPClause *> Clauses) { 2251 return createDirective<OMPInteropDirective>( 2252 C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc, 2253 EndLoc); 2254 } 2255 2256 OMPInteropDirective *OMPInteropDirective::CreateEmpty(const ASTContext &C, 2257 unsigned NumClauses, 2258 EmptyShell) { 2259 return createEmptyDirective<OMPInteropDirective>(C, NumClauses); 2260 } 2261 2262 OMPDispatchDirective *OMPDispatchDirective::Create( 2263 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2264 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2265 SourceLocation TargetCallLoc) { 2266 auto *Dir = createDirective<OMPDispatchDirective>( 2267 C, Clauses, AssociatedStmt, /*NumChildren=*/0, StartLoc, EndLoc); 2268 Dir->setTargetCallLoc(TargetCallLoc); 2269 return Dir; 2270 } 2271 2272 OMPDispatchDirective *OMPDispatchDirective::CreateEmpty(const ASTContext &C, 2273 unsigned NumClauses, 2274 EmptyShell) { 2275 return createEmptyDirective<OMPDispatchDirective>(C, NumClauses, 2276 /*HasAssociatedStmt=*/true, 2277 /*NumChildren=*/0); 2278 } 2279 2280 OMPMaskedDirective *OMPMaskedDirective::Create(const ASTContext &C, 2281 SourceLocation StartLoc, 2282 SourceLocation EndLoc, 2283 ArrayRef<OMPClause *> Clauses, 2284 Stmt *AssociatedStmt) { 2285 return createDirective<OMPMaskedDirective>(C, Clauses, AssociatedStmt, 2286 /*NumChildren=*/0, StartLoc, 2287 EndLoc); 2288 } 2289 2290 OMPMaskedDirective *OMPMaskedDirective::CreateEmpty(const ASTContext &C, 2291 unsigned NumClauses, 2292 EmptyShell) { 2293 return createEmptyDirective<OMPMaskedDirective>(C, NumClauses, 2294 /*HasAssociatedStmt=*/true); 2295 } 2296 2297 OMPGenericLoopDirective *OMPGenericLoopDirective::Create( 2298 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2299 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2300 const HelperExprs &Exprs) { 2301 auto *Dir = createDirective<OMPGenericLoopDirective>( 2302 C, Clauses, AssociatedStmt, numLoopChildren(CollapsedNum, OMPD_loop), 2303 StartLoc, EndLoc, CollapsedNum); 2304 Dir->setIterationVariable(Exprs.IterationVarRef); 2305 Dir->setLastIteration(Exprs.LastIteration); 2306 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 2307 Dir->setPreCond(Exprs.PreCond); 2308 Dir->setCond(Exprs.Cond); 2309 Dir->setInit(Exprs.Init); 2310 Dir->setInc(Exprs.Inc); 2311 Dir->setIsLastIterVariable(Exprs.IL); 2312 Dir->setLowerBoundVariable(Exprs.LB); 2313 Dir->setUpperBoundVariable(Exprs.UB); 2314 Dir->setStrideVariable(Exprs.ST); 2315 Dir->setEnsureUpperBound(Exprs.EUB); 2316 Dir->setNextLowerBound(Exprs.NLB); 2317 Dir->setNextUpperBound(Exprs.NUB); 2318 Dir->setNumIterations(Exprs.NumIterations); 2319 Dir->setCounters(Exprs.Counters); 2320 Dir->setPrivateCounters(Exprs.PrivateCounters); 2321 Dir->setInits(Exprs.Inits); 2322 Dir->setUpdates(Exprs.Updates); 2323 Dir->setFinals(Exprs.Finals); 2324 Dir->setDependentCounters(Exprs.DependentCounters); 2325 Dir->setDependentInits(Exprs.DependentInits); 2326 Dir->setFinalsConditions(Exprs.FinalsConditions); 2327 Dir->setPreInits(Exprs.PreInits); 2328 return Dir; 2329 } 2330 2331 OMPGenericLoopDirective * 2332 OMPGenericLoopDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, 2333 unsigned CollapsedNum, EmptyShell) { 2334 return createEmptyDirective<OMPGenericLoopDirective>( 2335 C, NumClauses, /*HasAssociatedStmt=*/true, 2336 numLoopChildren(CollapsedNum, OMPD_loop), CollapsedNum); 2337 } 2338 2339 OMPTeamsGenericLoopDirective *OMPTeamsGenericLoopDirective::Create( 2340 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2341 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2342 const HelperExprs &Exprs) { 2343 auto *Dir = createDirective<OMPTeamsGenericLoopDirective>( 2344 C, Clauses, AssociatedStmt, 2345 numLoopChildren(CollapsedNum, OMPD_teams_loop), StartLoc, EndLoc, 2346 CollapsedNum); 2347 Dir->setIterationVariable(Exprs.IterationVarRef); 2348 Dir->setLastIteration(Exprs.LastIteration); 2349 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 2350 Dir->setPreCond(Exprs.PreCond); 2351 Dir->setCond(Exprs.Cond); 2352 Dir->setInit(Exprs.Init); 2353 Dir->setInc(Exprs.Inc); 2354 Dir->setIsLastIterVariable(Exprs.IL); 2355 Dir->setLowerBoundVariable(Exprs.LB); 2356 Dir->setUpperBoundVariable(Exprs.UB); 2357 Dir->setStrideVariable(Exprs.ST); 2358 Dir->setEnsureUpperBound(Exprs.EUB); 2359 Dir->setNextLowerBound(Exprs.NLB); 2360 Dir->setNextUpperBound(Exprs.NUB); 2361 Dir->setNumIterations(Exprs.NumIterations); 2362 Dir->setCounters(Exprs.Counters); 2363 Dir->setPrivateCounters(Exprs.PrivateCounters); 2364 Dir->setInits(Exprs.Inits); 2365 Dir->setUpdates(Exprs.Updates); 2366 Dir->setFinals(Exprs.Finals); 2367 Dir->setDependentCounters(Exprs.DependentCounters); 2368 Dir->setDependentInits(Exprs.DependentInits); 2369 Dir->setFinalsConditions(Exprs.FinalsConditions); 2370 Dir->setPreInits(Exprs.PreInits); 2371 return Dir; 2372 } 2373 2374 OMPTeamsGenericLoopDirective * 2375 OMPTeamsGenericLoopDirective::CreateEmpty(const ASTContext &C, 2376 unsigned NumClauses, 2377 unsigned CollapsedNum, EmptyShell) { 2378 return createEmptyDirective<OMPTeamsGenericLoopDirective>( 2379 C, NumClauses, /*HasAssociatedStmt=*/true, 2380 numLoopChildren(CollapsedNum, OMPD_teams_loop), CollapsedNum); 2381 } 2382 2383 OMPTargetTeamsGenericLoopDirective *OMPTargetTeamsGenericLoopDirective::Create( 2384 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2385 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2386 const HelperExprs &Exprs) { 2387 auto *Dir = createDirective<OMPTargetTeamsGenericLoopDirective>( 2388 C, Clauses, AssociatedStmt, 2389 numLoopChildren(CollapsedNum, OMPD_target_teams_loop), StartLoc, EndLoc, 2390 CollapsedNum); 2391 Dir->setIterationVariable(Exprs.IterationVarRef); 2392 Dir->setLastIteration(Exprs.LastIteration); 2393 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 2394 Dir->setPreCond(Exprs.PreCond); 2395 Dir->setCond(Exprs.Cond); 2396 Dir->setInit(Exprs.Init); 2397 Dir->setInc(Exprs.Inc); 2398 Dir->setIsLastIterVariable(Exprs.IL); 2399 Dir->setLowerBoundVariable(Exprs.LB); 2400 Dir->setUpperBoundVariable(Exprs.UB); 2401 Dir->setStrideVariable(Exprs.ST); 2402 Dir->setEnsureUpperBound(Exprs.EUB); 2403 Dir->setNextLowerBound(Exprs.NLB); 2404 Dir->setNextUpperBound(Exprs.NUB); 2405 Dir->setNumIterations(Exprs.NumIterations); 2406 Dir->setCounters(Exprs.Counters); 2407 Dir->setPrivateCounters(Exprs.PrivateCounters); 2408 Dir->setInits(Exprs.Inits); 2409 Dir->setUpdates(Exprs.Updates); 2410 Dir->setFinals(Exprs.Finals); 2411 Dir->setDependentCounters(Exprs.DependentCounters); 2412 Dir->setDependentInits(Exprs.DependentInits); 2413 Dir->setFinalsConditions(Exprs.FinalsConditions); 2414 Dir->setPreInits(Exprs.PreInits); 2415 return Dir; 2416 } 2417 2418 OMPTargetTeamsGenericLoopDirective * 2419 OMPTargetTeamsGenericLoopDirective::CreateEmpty(const ASTContext &C, 2420 unsigned NumClauses, 2421 unsigned CollapsedNum, 2422 EmptyShell) { 2423 return createEmptyDirective<OMPTargetTeamsGenericLoopDirective>( 2424 C, NumClauses, /*HasAssociatedStmt=*/true, 2425 numLoopChildren(CollapsedNum, OMPD_target_teams_loop), CollapsedNum); 2426 } 2427 2428 OMPParallelGenericLoopDirective *OMPParallelGenericLoopDirective::Create( 2429 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2430 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2431 const HelperExprs &Exprs) { 2432 auto *Dir = createDirective<OMPParallelGenericLoopDirective>( 2433 C, Clauses, AssociatedStmt, 2434 numLoopChildren(CollapsedNum, OMPD_parallel_loop), StartLoc, EndLoc, 2435 CollapsedNum); 2436 Dir->setIterationVariable(Exprs.IterationVarRef); 2437 Dir->setLastIteration(Exprs.LastIteration); 2438 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 2439 Dir->setPreCond(Exprs.PreCond); 2440 Dir->setCond(Exprs.Cond); 2441 Dir->setInit(Exprs.Init); 2442 Dir->setInc(Exprs.Inc); 2443 Dir->setIsLastIterVariable(Exprs.IL); 2444 Dir->setLowerBoundVariable(Exprs.LB); 2445 Dir->setUpperBoundVariable(Exprs.UB); 2446 Dir->setStrideVariable(Exprs.ST); 2447 Dir->setEnsureUpperBound(Exprs.EUB); 2448 Dir->setNextLowerBound(Exprs.NLB); 2449 Dir->setNextUpperBound(Exprs.NUB); 2450 Dir->setNumIterations(Exprs.NumIterations); 2451 Dir->setCounters(Exprs.Counters); 2452 Dir->setPrivateCounters(Exprs.PrivateCounters); 2453 Dir->setInits(Exprs.Inits); 2454 Dir->setUpdates(Exprs.Updates); 2455 Dir->setFinals(Exprs.Finals); 2456 Dir->setDependentCounters(Exprs.DependentCounters); 2457 Dir->setDependentInits(Exprs.DependentInits); 2458 Dir->setFinalsConditions(Exprs.FinalsConditions); 2459 Dir->setPreInits(Exprs.PreInits); 2460 return Dir; 2461 } 2462 2463 OMPParallelGenericLoopDirective *OMPParallelGenericLoopDirective::CreateEmpty( 2464 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 2465 EmptyShell) { 2466 return createEmptyDirective<OMPParallelGenericLoopDirective>( 2467 C, NumClauses, /*HasAssociatedStmt=*/true, 2468 numLoopChildren(CollapsedNum, OMPD_parallel_loop), CollapsedNum); 2469 } 2470 2471 OMPTargetParallelGenericLoopDirective * 2472 OMPTargetParallelGenericLoopDirective::Create( 2473 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2474 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2475 const HelperExprs &Exprs) { 2476 auto *Dir = createDirective<OMPTargetParallelGenericLoopDirective>( 2477 C, Clauses, AssociatedStmt, 2478 numLoopChildren(CollapsedNum, OMPD_target_parallel_loop), StartLoc, 2479 EndLoc, CollapsedNum); 2480 Dir->setIterationVariable(Exprs.IterationVarRef); 2481 Dir->setLastIteration(Exprs.LastIteration); 2482 Dir->setCalcLastIteration(Exprs.CalcLastIteration); 2483 Dir->setPreCond(Exprs.PreCond); 2484 Dir->setCond(Exprs.Cond); 2485 Dir->setInit(Exprs.Init); 2486 Dir->setInc(Exprs.Inc); 2487 Dir->setIsLastIterVariable(Exprs.IL); 2488 Dir->setLowerBoundVariable(Exprs.LB); 2489 Dir->setUpperBoundVariable(Exprs.UB); 2490 Dir->setStrideVariable(Exprs.ST); 2491 Dir->setEnsureUpperBound(Exprs.EUB); 2492 Dir->setNextLowerBound(Exprs.NLB); 2493 Dir->setNextUpperBound(Exprs.NUB); 2494 Dir->setNumIterations(Exprs.NumIterations); 2495 Dir->setCounters(Exprs.Counters); 2496 Dir->setPrivateCounters(Exprs.PrivateCounters); 2497 Dir->setInits(Exprs.Inits); 2498 Dir->setUpdates(Exprs.Updates); 2499 Dir->setFinals(Exprs.Finals); 2500 Dir->setDependentCounters(Exprs.DependentCounters); 2501 Dir->setDependentInits(Exprs.DependentInits); 2502 Dir->setFinalsConditions(Exprs.FinalsConditions); 2503 Dir->setPreInits(Exprs.PreInits); 2504 return Dir; 2505 } 2506 2507 OMPTargetParallelGenericLoopDirective * 2508 OMPTargetParallelGenericLoopDirective::CreateEmpty(const ASTContext &C, 2509 unsigned NumClauses, 2510 unsigned CollapsedNum, 2511 EmptyShell) { 2512 return createEmptyDirective<OMPTargetParallelGenericLoopDirective>( 2513 C, NumClauses, /*HasAssociatedStmt=*/true, 2514 numLoopChildren(CollapsedNum, OMPD_target_parallel_loop), CollapsedNum); 2515 } 2516