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