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