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