James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 1 | //===--- StmtOpenMP.cpp - Classes for OpenMP directives -------------------===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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 | |
Roman Lebedev | b570060 | 2019-03-20 16:32:36 +0000 | [diff] [blame] | 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 | |
Alexey Bataev | 8bbf2e3 | 2019-11-04 09:59:11 -0500 | [diff] [blame] | 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 | |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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 | |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 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 | |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 162 | OMPParallelDirective *OMPParallelDirective::Create( |
| 163 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 164 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 165 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 166 | llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 180 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 181 | llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 192 | unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 212 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 213 | Dir->setDependentInits(Exprs.DependentInits); |
| 214 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 215 | Dir->setPreInits(Exprs.PreInits); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 216 | return Dir; |
| 217 | } |
| 218 | |
| 219 | OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C, |
| 220 | unsigned NumClauses, |
| 221 | unsigned CollapsedNum, |
| 222 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 223 | unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 235 | unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 257 | Dir->setNumIterations(Exprs.NumIterations); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 263 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 264 | Dir->setDependentInits(Exprs.DependentInits); |
| 265 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 266 | Dir->setPreInits(Exprs.PreInits); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 267 | Dir->setHasCancel(HasCancel); |
| 268 | return Dir; |
| 269 | } |
| 270 | |
| 271 | OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C, |
| 272 | unsigned NumClauses, |
| 273 | unsigned CollapsedNum, |
| 274 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 275 | unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 287 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 288 | llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 310 | Dir->setNumIterations(Exprs.NumIterations); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 316 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 317 | Dir->setDependentInits(Exprs.DependentInits); |
| 318 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 319 | Dir->setPreInits(Exprs.PreInits); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 320 | return Dir; |
| 321 | } |
| 322 | |
| 323 | OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C, |
| 324 | unsigned NumClauses, |
| 325 | unsigned CollapsedNum, |
| 326 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 327 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 328 | llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 338 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 339 | llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 353 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 354 | llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 365 | unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 375 | unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 385 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 386 | llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 399 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 400 | llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 410 | unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 419 | unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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, |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 426 | SourceLocation StartLoc, SourceLocation EndLoc, |
| 427 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 428 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 429 | llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *)); |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 430 | void *Mem = |
| 431 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 432 | OMPCriticalDirective *Dir = |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 433 | new (Mem) OMPCriticalDirective(Name, StartLoc, EndLoc, Clauses.size()); |
| 434 | Dir->setClauses(Clauses); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 435 | Dir->setAssociatedStmt(AssociatedStmt); |
| 436 | return Dir; |
| 437 | } |
| 438 | |
| 439 | OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C, |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 440 | unsigned NumClauses, |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 441 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 442 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 443 | llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *)); |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 444 | void *Mem = |
| 445 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 446 | return new (Mem) OMPCriticalDirective(NumClauses); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 453 | unsigned Size = |
| 454 | llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 476 | Dir->setNumIterations(Exprs.NumIterations); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 482 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 483 | Dir->setDependentInits(Exprs.DependentInits); |
| 484 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 485 | Dir->setPreInits(Exprs.PreInits); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 486 | Dir->setHasCancel(HasCancel); |
| 487 | return Dir; |
| 488 | } |
| 489 | |
| 490 | OMPParallelForDirective * |
| 491 | OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 492 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 493 | unsigned Size = |
| 494 | llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 505 | unsigned Size = |
| 506 | llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 528 | Dir->setNumIterations(Exprs.NumIterations); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 534 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 535 | Dir->setDependentInits(Exprs.DependentInits); |
| 536 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 537 | Dir->setPreInits(Exprs.PreInits); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 538 | return Dir; |
| 539 | } |
| 540 | |
| 541 | OMPParallelForSimdDirective * |
| 542 | OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C, |
| 543 | unsigned NumClauses, |
| 544 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 545 | unsigned Size = |
| 546 | llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 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 | |
cchen | 47d6094 | 2019-12-05 13:43:48 -0500 | [diff] [blame] | 553 | OMPParallelMasterDirective *OMPParallelMasterDirective::Create( |
| 554 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 555 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
| 556 | unsigned Size = |
| 557 | llvm::alignTo(sizeof(OMPParallelMasterDirective), alignof(OMPClause *)); |
| 558 | void *Mem = |
| 559 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 560 | auto *Dir = |
| 561 | new (Mem) OMPParallelMasterDirective(StartLoc, EndLoc, Clauses.size()); |
| 562 | Dir->setClauses(Clauses); |
| 563 | Dir->setAssociatedStmt(AssociatedStmt); |
| 564 | return Dir; |
| 565 | } |
| 566 | |
| 567 | OMPParallelMasterDirective *OMPParallelMasterDirective::CreateEmpty(const ASTContext &C, |
| 568 | unsigned NumClauses, |
| 569 | EmptyShell) { |
| 570 | unsigned Size = |
| 571 | llvm::alignTo(sizeof(OMPParallelMasterDirective), alignof(OMPClause *)); |
| 572 | void *Mem = |
| 573 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 574 | return new (Mem) OMPParallelMasterDirective(NumClauses); |
| 575 | } |
| 576 | |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 577 | OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create( |
| 578 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 579 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 580 | unsigned Size = |
| 581 | llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 582 | void *Mem = |
| 583 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 584 | OMPParallelSectionsDirective *Dir = |
| 585 | new (Mem) OMPParallelSectionsDirective(StartLoc, EndLoc, Clauses.size()); |
| 586 | Dir->setClauses(Clauses); |
| 587 | Dir->setAssociatedStmt(AssociatedStmt); |
| 588 | Dir->setHasCancel(HasCancel); |
| 589 | return Dir; |
| 590 | } |
| 591 | |
| 592 | OMPParallelSectionsDirective * |
| 593 | OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C, |
| 594 | unsigned NumClauses, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 595 | unsigned Size = |
| 596 | llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 597 | void *Mem = |
| 598 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 599 | return new (Mem) OMPParallelSectionsDirective(NumClauses); |
| 600 | } |
| 601 | |
| 602 | OMPTaskDirective * |
| 603 | OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc, |
| 604 | SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, |
| 605 | Stmt *AssociatedStmt, bool HasCancel) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 606 | unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 607 | void *Mem = |
| 608 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 609 | OMPTaskDirective *Dir = |
| 610 | new (Mem) OMPTaskDirective(StartLoc, EndLoc, Clauses.size()); |
| 611 | Dir->setClauses(Clauses); |
| 612 | Dir->setAssociatedStmt(AssociatedStmt); |
| 613 | Dir->setHasCancel(HasCancel); |
| 614 | return Dir; |
| 615 | } |
| 616 | |
| 617 | OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C, |
| 618 | unsigned NumClauses, |
| 619 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 620 | unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 621 | void *Mem = |
| 622 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 623 | return new (Mem) OMPTaskDirective(NumClauses); |
| 624 | } |
| 625 | |
| 626 | OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C, |
| 627 | SourceLocation StartLoc, |
| 628 | SourceLocation EndLoc) { |
| 629 | void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective)); |
| 630 | OMPTaskyieldDirective *Dir = |
| 631 | new (Mem) OMPTaskyieldDirective(StartLoc, EndLoc); |
| 632 | return Dir; |
| 633 | } |
| 634 | |
| 635 | OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C, |
| 636 | EmptyShell) { |
| 637 | void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective)); |
| 638 | return new (Mem) OMPTaskyieldDirective(); |
| 639 | } |
| 640 | |
| 641 | OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C, |
| 642 | SourceLocation StartLoc, |
| 643 | SourceLocation EndLoc) { |
| 644 | void *Mem = C.Allocate(sizeof(OMPBarrierDirective)); |
| 645 | OMPBarrierDirective *Dir = new (Mem) OMPBarrierDirective(StartLoc, EndLoc); |
| 646 | return Dir; |
| 647 | } |
| 648 | |
| 649 | OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C, |
| 650 | EmptyShell) { |
| 651 | void *Mem = C.Allocate(sizeof(OMPBarrierDirective)); |
| 652 | return new (Mem) OMPBarrierDirective(); |
| 653 | } |
| 654 | |
| 655 | OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C, |
| 656 | SourceLocation StartLoc, |
| 657 | SourceLocation EndLoc) { |
| 658 | void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective)); |
| 659 | OMPTaskwaitDirective *Dir = new (Mem) OMPTaskwaitDirective(StartLoc, EndLoc); |
| 660 | return Dir; |
| 661 | } |
| 662 | |
| 663 | OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C, |
| 664 | EmptyShell) { |
| 665 | void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective)); |
| 666 | return new (Mem) OMPTaskwaitDirective(); |
| 667 | } |
| 668 | |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 669 | OMPTaskgroupDirective *OMPTaskgroupDirective::Create( |
| 670 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
Alexey Bataev | 3b1b895 | 2017-07-25 15:53:26 +0000 | [diff] [blame] | 671 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *ReductionRef) { |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 672 | unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) + |
| 673 | sizeof(OMPClause *) * Clauses.size(), |
| 674 | alignof(Stmt *)); |
Alexey Bataev | 3b1b895 | 2017-07-25 15:53:26 +0000 | [diff] [blame] | 675 | void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 676 | OMPTaskgroupDirective *Dir = |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 677 | new (Mem) OMPTaskgroupDirective(StartLoc, EndLoc, Clauses.size()); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 678 | Dir->setAssociatedStmt(AssociatedStmt); |
Alexey Bataev | 3b1b895 | 2017-07-25 15:53:26 +0000 | [diff] [blame] | 679 | Dir->setReductionRef(ReductionRef); |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 680 | Dir->setClauses(Clauses); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 681 | return Dir; |
| 682 | } |
| 683 | |
| 684 | OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C, |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 685 | unsigned NumClauses, |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 686 | EmptyShell) { |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 687 | unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) + |
| 688 | sizeof(OMPClause *) * NumClauses, |
| 689 | alignof(Stmt *)); |
Alexey Bataev | 3b1b895 | 2017-07-25 15:53:26 +0000 | [diff] [blame] | 690 | void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *)); |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 691 | return new (Mem) OMPTaskgroupDirective(NumClauses); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 692 | } |
| 693 | |
| 694 | OMPCancellationPointDirective *OMPCancellationPointDirective::Create( |
| 695 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 696 | OpenMPDirectiveKind CancelRegion) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 697 | unsigned Size = |
| 698 | llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 699 | void *Mem = C.Allocate(Size); |
| 700 | OMPCancellationPointDirective *Dir = |
| 701 | new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc); |
| 702 | Dir->setCancelRegion(CancelRegion); |
| 703 | return Dir; |
| 704 | } |
| 705 | |
| 706 | OMPCancellationPointDirective * |
| 707 | OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 708 | unsigned Size = |
| 709 | llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 710 | void *Mem = C.Allocate(Size); |
| 711 | return new (Mem) OMPCancellationPointDirective(); |
| 712 | } |
| 713 | |
| 714 | OMPCancelDirective * |
| 715 | OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc, |
| 716 | SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, |
| 717 | OpenMPDirectiveKind CancelRegion) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 718 | unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) + |
| 719 | sizeof(OMPClause *) * Clauses.size(), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 720 | alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 721 | void *Mem = C.Allocate(Size); |
| 722 | OMPCancelDirective *Dir = |
| 723 | new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size()); |
| 724 | Dir->setClauses(Clauses); |
| 725 | Dir->setCancelRegion(CancelRegion); |
| 726 | return Dir; |
| 727 | } |
| 728 | |
| 729 | OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C, |
| 730 | unsigned NumClauses, |
| 731 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 732 | unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) + |
| 733 | sizeof(OMPClause *) * NumClauses, |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 734 | alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 735 | void *Mem = C.Allocate(Size); |
| 736 | return new (Mem) OMPCancelDirective(NumClauses); |
| 737 | } |
| 738 | |
| 739 | OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C, |
| 740 | SourceLocation StartLoc, |
| 741 | SourceLocation EndLoc, |
| 742 | ArrayRef<OMPClause *> Clauses) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 743 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 744 | llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 745 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size()); |
| 746 | OMPFlushDirective *Dir = |
| 747 | new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size()); |
| 748 | Dir->setClauses(Clauses); |
| 749 | return Dir; |
| 750 | } |
| 751 | |
| 752 | OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C, |
| 753 | unsigned NumClauses, |
| 754 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 755 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 756 | llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 757 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses); |
| 758 | return new (Mem) OMPFlushDirective(NumClauses); |
| 759 | } |
| 760 | |
| 761 | OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C, |
| 762 | SourceLocation StartLoc, |
| 763 | SourceLocation EndLoc, |
| 764 | ArrayRef<OMPClause *> Clauses, |
| 765 | Stmt *AssociatedStmt) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 766 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 767 | llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 768 | void *Mem = |
| 769 | C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size()); |
| 770 | OMPOrderedDirective *Dir = |
| 771 | new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size()); |
| 772 | Dir->setClauses(Clauses); |
| 773 | Dir->setAssociatedStmt(AssociatedStmt); |
| 774 | return Dir; |
| 775 | } |
| 776 | |
| 777 | OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C, |
| 778 | unsigned NumClauses, |
| 779 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 780 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 781 | llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 782 | void *Mem = |
| 783 | C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses); |
| 784 | return new (Mem) OMPOrderedDirective(NumClauses); |
| 785 | } |
| 786 | |
| 787 | OMPAtomicDirective *OMPAtomicDirective::Create( |
| 788 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 789 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V, |
| 790 | Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 791 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 792 | llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 793 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 794 | 5 * sizeof(Stmt *)); |
| 795 | OMPAtomicDirective *Dir = |
| 796 | new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size()); |
| 797 | Dir->setClauses(Clauses); |
| 798 | Dir->setAssociatedStmt(AssociatedStmt); |
| 799 | Dir->setX(X); |
| 800 | Dir->setV(V); |
| 801 | Dir->setExpr(E); |
| 802 | Dir->setUpdateExpr(UE); |
| 803 | Dir->IsXLHSInRHSPart = IsXLHSInRHSPart; |
| 804 | Dir->IsPostfixUpdate = IsPostfixUpdate; |
| 805 | return Dir; |
| 806 | } |
| 807 | |
| 808 | OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C, |
| 809 | unsigned NumClauses, |
| 810 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 811 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 812 | llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 813 | void *Mem = |
| 814 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *)); |
| 815 | return new (Mem) OMPAtomicDirective(NumClauses); |
| 816 | } |
| 817 | |
| 818 | OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C, |
| 819 | SourceLocation StartLoc, |
| 820 | SourceLocation EndLoc, |
| 821 | ArrayRef<OMPClause *> Clauses, |
| 822 | Stmt *AssociatedStmt) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 823 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 824 | llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 825 | void *Mem = |
| 826 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 827 | OMPTargetDirective *Dir = |
| 828 | new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size()); |
| 829 | Dir->setClauses(Clauses); |
| 830 | Dir->setAssociatedStmt(AssociatedStmt); |
| 831 | return Dir; |
| 832 | } |
| 833 | |
| 834 | OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C, |
| 835 | unsigned NumClauses, |
| 836 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 837 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 838 | llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 839 | void *Mem = |
| 840 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 841 | return new (Mem) OMPTargetDirective(NumClauses); |
| 842 | } |
| 843 | |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 844 | OMPTargetParallelDirective *OMPTargetParallelDirective::Create( |
| 845 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 846 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 847 | unsigned Size = |
| 848 | llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *)); |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 849 | void *Mem = |
| 850 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 851 | OMPTargetParallelDirective *Dir = |
| 852 | new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size()); |
| 853 | Dir->setClauses(Clauses); |
| 854 | Dir->setAssociatedStmt(AssociatedStmt); |
| 855 | return Dir; |
| 856 | } |
| 857 | |
| 858 | OMPTargetParallelDirective * |
| 859 | OMPTargetParallelDirective::CreateEmpty(const ASTContext &C, |
| 860 | unsigned NumClauses, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 861 | unsigned Size = |
| 862 | llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *)); |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 863 | void *Mem = |
| 864 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 865 | return new (Mem) OMPTargetParallelDirective(NumClauses); |
| 866 | } |
| 867 | |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 868 | OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create( |
| 869 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 870 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 871 | const HelperExprs &Exprs, bool HasCancel) { |
| 872 | unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 873 | alignof(OMPClause *)); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 874 | void *Mem = C.Allocate( |
| 875 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 876 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for)); |
| 877 | OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective( |
| 878 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 879 | Dir->setClauses(Clauses); |
| 880 | Dir->setAssociatedStmt(AssociatedStmt); |
| 881 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 882 | Dir->setLastIteration(Exprs.LastIteration); |
| 883 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 884 | Dir->setPreCond(Exprs.PreCond); |
| 885 | Dir->setCond(Exprs.Cond); |
| 886 | Dir->setInit(Exprs.Init); |
| 887 | Dir->setInc(Exprs.Inc); |
| 888 | Dir->setIsLastIterVariable(Exprs.IL); |
| 889 | Dir->setLowerBoundVariable(Exprs.LB); |
| 890 | Dir->setUpperBoundVariable(Exprs.UB); |
| 891 | Dir->setStrideVariable(Exprs.ST); |
| 892 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 893 | Dir->setNextLowerBound(Exprs.NLB); |
| 894 | Dir->setNextUpperBound(Exprs.NUB); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 895 | Dir->setNumIterations(Exprs.NumIterations); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 896 | Dir->setCounters(Exprs.Counters); |
| 897 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 898 | Dir->setInits(Exprs.Inits); |
| 899 | Dir->setUpdates(Exprs.Updates); |
| 900 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 901 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 902 | Dir->setDependentInits(Exprs.DependentInits); |
| 903 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 904 | Dir->setPreInits(Exprs.PreInits); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 905 | Dir->setHasCancel(HasCancel); |
| 906 | return Dir; |
| 907 | } |
| 908 | |
| 909 | OMPTargetParallelForDirective * |
| 910 | OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C, |
| 911 | unsigned NumClauses, |
| 912 | unsigned CollapsedNum, EmptyShell) { |
| 913 | unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 914 | alignof(OMPClause *)); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 915 | void *Mem = C.Allocate( |
| 916 | Size + sizeof(OMPClause *) * NumClauses + |
| 917 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for)); |
| 918 | return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses); |
| 919 | } |
| 920 | |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 921 | OMPTargetDataDirective *OMPTargetDataDirective::Create( |
| 922 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 923 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 924 | void *Mem = C.Allocate( |
| 925 | llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) + |
| 926 | sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 927 | OMPTargetDataDirective *Dir = |
| 928 | new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size()); |
| 929 | Dir->setClauses(Clauses); |
| 930 | Dir->setAssociatedStmt(AssociatedStmt); |
| 931 | return Dir; |
| 932 | } |
| 933 | |
| 934 | OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C, |
| 935 | unsigned N, |
| 936 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 937 | void *Mem = C.Allocate( |
| 938 | llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) + |
| 939 | sizeof(OMPClause *) * N + sizeof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 940 | return new (Mem) OMPTargetDataDirective(N); |
| 941 | } |
| 942 | |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 943 | OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create( |
| 944 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 945 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 946 | void *Mem = C.Allocate( |
| 947 | llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) + |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 948 | sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 949 | OMPTargetEnterDataDirective *Dir = |
| 950 | new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size()); |
| 951 | Dir->setClauses(Clauses); |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 952 | Dir->setAssociatedStmt(AssociatedStmt); |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 953 | return Dir; |
| 954 | } |
| 955 | |
| 956 | OMPTargetEnterDataDirective * |
| 957 | OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N, |
| 958 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 959 | void *Mem = C.Allocate( |
| 960 | llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) + |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 961 | sizeof(OMPClause *) * N + sizeof(Stmt *)); |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 962 | return new (Mem) OMPTargetEnterDataDirective(N); |
| 963 | } |
| 964 | |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 965 | OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create( |
| 966 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 967 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 968 | void *Mem = C.Allocate( |
| 969 | llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) + |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 970 | sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 971 | OMPTargetExitDataDirective *Dir = |
| 972 | new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size()); |
| 973 | Dir->setClauses(Clauses); |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 974 | Dir->setAssociatedStmt(AssociatedStmt); |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 975 | return Dir; |
| 976 | } |
| 977 | |
| 978 | OMPTargetExitDataDirective * |
| 979 | OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N, |
| 980 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 981 | void *Mem = C.Allocate( |
| 982 | llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) + |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 983 | sizeof(OMPClause *) * N + sizeof(Stmt *)); |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 984 | return new (Mem) OMPTargetExitDataDirective(N); |
| 985 | } |
| 986 | |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 987 | OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C, |
| 988 | SourceLocation StartLoc, |
| 989 | SourceLocation EndLoc, |
| 990 | ArrayRef<OMPClause *> Clauses, |
| 991 | Stmt *AssociatedStmt) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 992 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 993 | llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 994 | void *Mem = |
| 995 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 996 | OMPTeamsDirective *Dir = |
| 997 | new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size()); |
| 998 | Dir->setClauses(Clauses); |
| 999 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1000 | return Dir; |
| 1001 | } |
| 1002 | |
| 1003 | OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C, |
| 1004 | unsigned NumClauses, |
| 1005 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 1006 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1007 | llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 1008 | void *Mem = |
| 1009 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 1010 | return new (Mem) OMPTeamsDirective(NumClauses); |
| 1011 | } |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 1012 | |
| 1013 | OMPTaskLoopDirective *OMPTaskLoopDirective::Create( |
| 1014 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1015 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1016 | const HelperExprs &Exprs) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 1017 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1018 | llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *)); |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 1019 | void *Mem = |
| 1020 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 1021 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop)); |
| 1022 | OMPTaskLoopDirective *Dir = new (Mem) |
| 1023 | OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1024 | Dir->setClauses(Clauses); |
| 1025 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1026 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1027 | Dir->setLastIteration(Exprs.LastIteration); |
| 1028 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1029 | Dir->setPreCond(Exprs.PreCond); |
| 1030 | Dir->setCond(Exprs.Cond); |
| 1031 | Dir->setInit(Exprs.Init); |
| 1032 | Dir->setInc(Exprs.Inc); |
| 1033 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1034 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1035 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1036 | Dir->setStrideVariable(Exprs.ST); |
| 1037 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1038 | Dir->setNextLowerBound(Exprs.NLB); |
| 1039 | Dir->setNextUpperBound(Exprs.NUB); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 1040 | Dir->setNumIterations(Exprs.NumIterations); |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 1041 | Dir->setCounters(Exprs.Counters); |
| 1042 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1043 | Dir->setInits(Exprs.Inits); |
| 1044 | Dir->setUpdates(Exprs.Updates); |
| 1045 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1046 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1047 | Dir->setDependentInits(Exprs.DependentInits); |
| 1048 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 1049 | Dir->setPreInits(Exprs.PreInits); |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 1050 | return Dir; |
| 1051 | } |
| 1052 | |
| 1053 | OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C, |
| 1054 | unsigned NumClauses, |
| 1055 | unsigned CollapsedNum, |
| 1056 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 1057 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1058 | llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *)); |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 1059 | void *Mem = |
| 1060 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 1061 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop)); |
| 1062 | return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses); |
| 1063 | } |
| 1064 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 1065 | OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create( |
| 1066 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1067 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1068 | const HelperExprs &Exprs) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1069 | unsigned Size = |
| 1070 | llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *)); |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 1071 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 1072 | sizeof(Stmt *) * |
| 1073 | numLoopChildren(CollapsedNum, OMPD_taskloop_simd)); |
| 1074 | OMPTaskLoopSimdDirective *Dir = new (Mem) |
| 1075 | OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1076 | Dir->setClauses(Clauses); |
| 1077 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1078 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1079 | Dir->setLastIteration(Exprs.LastIteration); |
| 1080 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1081 | Dir->setPreCond(Exprs.PreCond); |
| 1082 | Dir->setCond(Exprs.Cond); |
| 1083 | Dir->setInit(Exprs.Init); |
| 1084 | Dir->setInc(Exprs.Inc); |
| 1085 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1086 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1087 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1088 | Dir->setStrideVariable(Exprs.ST); |
| 1089 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1090 | Dir->setNextLowerBound(Exprs.NLB); |
| 1091 | Dir->setNextUpperBound(Exprs.NUB); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 1092 | Dir->setNumIterations(Exprs.NumIterations); |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 1093 | Dir->setCounters(Exprs.Counters); |
| 1094 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1095 | Dir->setInits(Exprs.Inits); |
| 1096 | Dir->setUpdates(Exprs.Updates); |
| 1097 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1098 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1099 | Dir->setDependentInits(Exprs.DependentInits); |
| 1100 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 1101 | Dir->setPreInits(Exprs.PreInits); |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 1102 | return Dir; |
| 1103 | } |
| 1104 | |
| 1105 | OMPTaskLoopSimdDirective * |
| 1106 | OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 1107 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1108 | unsigned Size = |
| 1109 | llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *)); |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 1110 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 1111 | sizeof(Stmt *) * |
| 1112 | numLoopChildren(CollapsedNum, OMPD_taskloop_simd)); |
| 1113 | return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses); |
| 1114 | } |
| 1115 | |
Alexey Bataev | 60e51c4 | 2019-10-10 20:13:02 +0000 | [diff] [blame] | 1116 | OMPMasterTaskLoopDirective *OMPMasterTaskLoopDirective::Create( |
| 1117 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1118 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1119 | const HelperExprs &Exprs) { |
| 1120 | unsigned Size = |
| 1121 | llvm::alignTo(sizeof(OMPMasterTaskLoopDirective), alignof(OMPClause *)); |
| 1122 | void *Mem = C.Allocate( |
| 1123 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1124 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_master_taskloop)); |
| 1125 | OMPMasterTaskLoopDirective *Dir = new (Mem) OMPMasterTaskLoopDirective( |
| 1126 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1127 | Dir->setClauses(Clauses); |
| 1128 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1129 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1130 | Dir->setLastIteration(Exprs.LastIteration); |
| 1131 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1132 | Dir->setPreCond(Exprs.PreCond); |
| 1133 | Dir->setCond(Exprs.Cond); |
| 1134 | Dir->setInit(Exprs.Init); |
| 1135 | Dir->setInc(Exprs.Inc); |
| 1136 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1137 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1138 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1139 | Dir->setStrideVariable(Exprs.ST); |
| 1140 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1141 | Dir->setNextLowerBound(Exprs.NLB); |
| 1142 | Dir->setNextUpperBound(Exprs.NUB); |
| 1143 | Dir->setNumIterations(Exprs.NumIterations); |
| 1144 | Dir->setCounters(Exprs.Counters); |
| 1145 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1146 | Dir->setInits(Exprs.Inits); |
| 1147 | Dir->setUpdates(Exprs.Updates); |
| 1148 | Dir->setFinals(Exprs.Finals); |
| 1149 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1150 | Dir->setDependentInits(Exprs.DependentInits); |
| 1151 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
| 1152 | Dir->setPreInits(Exprs.PreInits); |
| 1153 | return Dir; |
| 1154 | } |
| 1155 | |
| 1156 | OMPMasterTaskLoopDirective * |
| 1157 | OMPMasterTaskLoopDirective::CreateEmpty(const ASTContext &C, |
| 1158 | unsigned NumClauses, |
| 1159 | unsigned CollapsedNum, EmptyShell) { |
| 1160 | unsigned Size = |
| 1161 | llvm::alignTo(sizeof(OMPMasterTaskLoopDirective), alignof(OMPClause *)); |
| 1162 | void *Mem = C.Allocate( |
| 1163 | Size + sizeof(OMPClause *) * NumClauses + |
| 1164 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_master_taskloop)); |
| 1165 | return new (Mem) OMPMasterTaskLoopDirective(CollapsedNum, NumClauses); |
| 1166 | } |
| 1167 | |
Alexey Bataev | b8552ab | 2019-10-18 16:47:35 +0000 | [diff] [blame] | 1168 | OMPMasterTaskLoopSimdDirective *OMPMasterTaskLoopSimdDirective::Create( |
| 1169 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1170 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1171 | const HelperExprs &Exprs) { |
| 1172 | unsigned Size = llvm::alignTo(sizeof(OMPMasterTaskLoopSimdDirective), |
| 1173 | alignof(OMPClause *)); |
| 1174 | void *Mem = |
| 1175 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 1176 | sizeof(Stmt *) * |
| 1177 | numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd)); |
| 1178 | auto *Dir = new (Mem) OMPMasterTaskLoopSimdDirective( |
| 1179 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1180 | Dir->setClauses(Clauses); |
| 1181 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1182 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1183 | Dir->setLastIteration(Exprs.LastIteration); |
| 1184 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1185 | Dir->setPreCond(Exprs.PreCond); |
| 1186 | Dir->setCond(Exprs.Cond); |
| 1187 | Dir->setInit(Exprs.Init); |
| 1188 | Dir->setInc(Exprs.Inc); |
| 1189 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1190 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1191 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1192 | Dir->setStrideVariable(Exprs.ST); |
| 1193 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1194 | Dir->setNextLowerBound(Exprs.NLB); |
| 1195 | Dir->setNextUpperBound(Exprs.NUB); |
| 1196 | Dir->setNumIterations(Exprs.NumIterations); |
| 1197 | Dir->setCounters(Exprs.Counters); |
| 1198 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1199 | Dir->setInits(Exprs.Inits); |
| 1200 | Dir->setUpdates(Exprs.Updates); |
| 1201 | Dir->setFinals(Exprs.Finals); |
| 1202 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1203 | Dir->setDependentInits(Exprs.DependentInits); |
| 1204 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
| 1205 | Dir->setPreInits(Exprs.PreInits); |
| 1206 | return Dir; |
| 1207 | } |
| 1208 | |
| 1209 | OMPMasterTaskLoopSimdDirective * |
| 1210 | OMPMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, |
| 1211 | unsigned NumClauses, |
| 1212 | unsigned CollapsedNum, EmptyShell) { |
| 1213 | unsigned Size = llvm::alignTo(sizeof(OMPMasterTaskLoopSimdDirective), |
| 1214 | alignof(OMPClause *)); |
| 1215 | void *Mem = |
| 1216 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 1217 | sizeof(Stmt *) * |
| 1218 | numLoopChildren(CollapsedNum, OMPD_master_taskloop_simd)); |
| 1219 | return new (Mem) OMPMasterTaskLoopSimdDirective(CollapsedNum, NumClauses); |
| 1220 | } |
| 1221 | |
Alexey Bataev | 5bbcead | 2019-10-14 17:17:41 +0000 | [diff] [blame] | 1222 | OMPParallelMasterTaskLoopDirective *OMPParallelMasterTaskLoopDirective::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(OMPParallelMasterTaskLoopDirective), |
| 1227 | alignof(OMPClause *)); |
| 1228 | void *Mem = C.Allocate( |
| 1229 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1230 | sizeof(Stmt *) * |
| 1231 | numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop)); |
| 1232 | auto *Dir = new (Mem) OMPParallelMasterTaskLoopDirective( |
| 1233 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1234 | Dir->setClauses(Clauses); |
| 1235 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1236 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1237 | Dir->setLastIteration(Exprs.LastIteration); |
| 1238 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1239 | Dir->setPreCond(Exprs.PreCond); |
| 1240 | Dir->setCond(Exprs.Cond); |
| 1241 | Dir->setInit(Exprs.Init); |
| 1242 | Dir->setInc(Exprs.Inc); |
| 1243 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1244 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1245 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1246 | Dir->setStrideVariable(Exprs.ST); |
| 1247 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1248 | Dir->setNextLowerBound(Exprs.NLB); |
| 1249 | Dir->setNextUpperBound(Exprs.NUB); |
| 1250 | Dir->setNumIterations(Exprs.NumIterations); |
| 1251 | Dir->setCounters(Exprs.Counters); |
| 1252 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1253 | Dir->setInits(Exprs.Inits); |
| 1254 | Dir->setUpdates(Exprs.Updates); |
| 1255 | Dir->setFinals(Exprs.Finals); |
| 1256 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1257 | Dir->setDependentInits(Exprs.DependentInits); |
| 1258 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
| 1259 | Dir->setPreInits(Exprs.PreInits); |
| 1260 | return Dir; |
| 1261 | } |
| 1262 | |
| 1263 | OMPParallelMasterTaskLoopDirective * |
| 1264 | OMPParallelMasterTaskLoopDirective::CreateEmpty(const ASTContext &C, |
| 1265 | unsigned NumClauses, |
| 1266 | unsigned CollapsedNum, |
| 1267 | EmptyShell) { |
| 1268 | unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopDirective), |
| 1269 | alignof(OMPClause *)); |
| 1270 | void *Mem = C.Allocate( |
| 1271 | Size + sizeof(OMPClause *) * NumClauses + |
| 1272 | sizeof(Stmt *) * |
| 1273 | numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop)); |
| 1274 | return new (Mem) OMPParallelMasterTaskLoopDirective(CollapsedNum, NumClauses); |
| 1275 | } |
| 1276 | |
Alexey Bataev | 14a388f | 2019-10-25 10:27:13 -0400 | [diff] [blame] | 1277 | OMPParallelMasterTaskLoopSimdDirective * |
| 1278 | OMPParallelMasterTaskLoopSimdDirective::Create( |
| 1279 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1280 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1281 | const HelperExprs &Exprs) { |
| 1282 | unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopSimdDirective), |
| 1283 | alignof(OMPClause *)); |
| 1284 | void *Mem = C.Allocate( |
| 1285 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1286 | sizeof(Stmt *) * |
| 1287 | numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd)); |
| 1288 | auto *Dir = new (Mem) OMPParallelMasterTaskLoopSimdDirective( |
| 1289 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1290 | Dir->setClauses(Clauses); |
| 1291 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1292 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1293 | Dir->setLastIteration(Exprs.LastIteration); |
| 1294 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1295 | Dir->setPreCond(Exprs.PreCond); |
| 1296 | Dir->setCond(Exprs.Cond); |
| 1297 | Dir->setInit(Exprs.Init); |
| 1298 | Dir->setInc(Exprs.Inc); |
| 1299 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1300 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1301 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1302 | Dir->setStrideVariable(Exprs.ST); |
| 1303 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1304 | Dir->setNextLowerBound(Exprs.NLB); |
| 1305 | Dir->setNextUpperBound(Exprs.NUB); |
| 1306 | Dir->setNumIterations(Exprs.NumIterations); |
| 1307 | Dir->setCounters(Exprs.Counters); |
| 1308 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1309 | Dir->setInits(Exprs.Inits); |
| 1310 | Dir->setUpdates(Exprs.Updates); |
| 1311 | Dir->setFinals(Exprs.Finals); |
| 1312 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1313 | Dir->setDependentInits(Exprs.DependentInits); |
| 1314 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
| 1315 | Dir->setPreInits(Exprs.PreInits); |
| 1316 | return Dir; |
| 1317 | } |
| 1318 | |
| 1319 | OMPParallelMasterTaskLoopSimdDirective * |
| 1320 | OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, |
| 1321 | unsigned NumClauses, |
| 1322 | unsigned CollapsedNum, |
| 1323 | EmptyShell) { |
| 1324 | unsigned Size = llvm::alignTo(sizeof(OMPParallelMasterTaskLoopSimdDirective), |
| 1325 | alignof(OMPClause *)); |
| 1326 | void *Mem = C.Allocate( |
| 1327 | Size + sizeof(OMPClause *) * NumClauses + |
| 1328 | sizeof(Stmt *) * |
| 1329 | numLoopChildren(CollapsedNum, OMPD_parallel_master_taskloop_simd)); |
| 1330 | return new (Mem) |
| 1331 | OMPParallelMasterTaskLoopSimdDirective(CollapsedNum, NumClauses); |
| 1332 | } |
| 1333 | |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 1334 | OMPDistributeDirective *OMPDistributeDirective::Create( |
| 1335 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1336 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1337 | const HelperExprs &Exprs) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1338 | unsigned Size = |
| 1339 | llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *)); |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 1340 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 1341 | sizeof(Stmt *) * |
| 1342 | numLoopChildren(CollapsedNum, OMPD_distribute)); |
| 1343 | OMPDistributeDirective *Dir = new (Mem) |
| 1344 | OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1345 | Dir->setClauses(Clauses); |
| 1346 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1347 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1348 | Dir->setLastIteration(Exprs.LastIteration); |
| 1349 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1350 | Dir->setPreCond(Exprs.PreCond); |
| 1351 | Dir->setCond(Exprs.Cond); |
| 1352 | Dir->setInit(Exprs.Init); |
| 1353 | Dir->setInc(Exprs.Inc); |
| 1354 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1355 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1356 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1357 | Dir->setStrideVariable(Exprs.ST); |
| 1358 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1359 | Dir->setNextLowerBound(Exprs.NLB); |
| 1360 | Dir->setNextUpperBound(Exprs.NUB); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 1361 | Dir->setNumIterations(Exprs.NumIterations); |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 1362 | Dir->setCounters(Exprs.Counters); |
| 1363 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1364 | Dir->setInits(Exprs.Inits); |
| 1365 | Dir->setUpdates(Exprs.Updates); |
| 1366 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1367 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1368 | Dir->setDependentInits(Exprs.DependentInits); |
| 1369 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 1370 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 1371 | return Dir; |
| 1372 | } |
| 1373 | |
| 1374 | OMPDistributeDirective * |
| 1375 | OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 1376 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1377 | unsigned Size = |
| 1378 | llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *)); |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 1379 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 1380 | sizeof(Stmt *) * |
| 1381 | numLoopChildren(CollapsedNum, OMPD_distribute)); |
| 1382 | return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses); |
| 1383 | } |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 1384 | |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 1385 | OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create( |
| 1386 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1387 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1388 | unsigned Size = |
| 1389 | llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *)); |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 1390 | void *Mem = |
| 1391 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 1392 | OMPTargetUpdateDirective *Dir = |
| 1393 | new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size()); |
| 1394 | Dir->setClauses(Clauses); |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 1395 | Dir->setAssociatedStmt(AssociatedStmt); |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 1396 | return Dir; |
| 1397 | } |
| 1398 | |
| 1399 | OMPTargetUpdateDirective * |
| 1400 | OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 1401 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1402 | unsigned Size = |
| 1403 | llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *)); |
Alexey Bataev | 7828b25 | 2017-11-21 17:08:48 +0000 | [diff] [blame] | 1404 | void *Mem = |
| 1405 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 1406 | return new (Mem) OMPTargetUpdateDirective(NumClauses); |
| 1407 | } |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1408 | |
| 1409 | OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create( |
| 1410 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1411 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
Alexey Bataev | dcb4b8fb | 2017-11-22 20:19:50 +0000 | [diff] [blame] | 1412 | const HelperExprs &Exprs, bool HasCancel) { |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1413 | unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1414 | alignof(OMPClause *)); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1415 | void *Mem = C.Allocate( |
| 1416 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1417 | sizeof(Stmt *) * |
| 1418 | numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for)); |
| 1419 | OMPDistributeParallelForDirective *Dir = |
| 1420 | new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc, |
| 1421 | CollapsedNum, Clauses.size()); |
| 1422 | Dir->setClauses(Clauses); |
| 1423 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1424 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1425 | Dir->setLastIteration(Exprs.LastIteration); |
| 1426 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1427 | Dir->setPreCond(Exprs.PreCond); |
| 1428 | Dir->setCond(Exprs.Cond); |
| 1429 | Dir->setInit(Exprs.Init); |
| 1430 | Dir->setInc(Exprs.Inc); |
| 1431 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1432 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1433 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1434 | Dir->setStrideVariable(Exprs.ST); |
| 1435 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1436 | Dir->setNextLowerBound(Exprs.NLB); |
| 1437 | Dir->setNextUpperBound(Exprs.NUB); |
| 1438 | Dir->setNumIterations(Exprs.NumIterations); |
| 1439 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 1440 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 1441 | Dir->setDistInc(Exprs.DistInc); |
| 1442 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1443 | Dir->setCounters(Exprs.Counters); |
| 1444 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1445 | Dir->setInits(Exprs.Inits); |
| 1446 | Dir->setUpdates(Exprs.Updates); |
| 1447 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1448 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1449 | Dir->setDependentInits(Exprs.DependentInits); |
| 1450 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1451 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 1452 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 1453 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 1454 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 1455 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 1456 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 1457 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 1458 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Gheorghe-Teodor Bercea | e925676 | 2018-10-29 15:45:47 +0000 | [diff] [blame] | 1459 | Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); |
| 1460 | Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); |
Alexey Bataev | dcb4b8fb | 2017-11-22 20:19:50 +0000 | [diff] [blame] | 1461 | Dir->HasCancel = HasCancel; |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1462 | return Dir; |
| 1463 | } |
| 1464 | |
| 1465 | OMPDistributeParallelForDirective * |
| 1466 | OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C, |
| 1467 | unsigned NumClauses, |
| 1468 | unsigned CollapsedNum, |
| 1469 | EmptyShell) { |
| 1470 | unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1471 | alignof(OMPClause *)); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1472 | void *Mem = C.Allocate( |
| 1473 | Size + sizeof(OMPClause *) * NumClauses + |
| 1474 | sizeof(Stmt *) * |
| 1475 | numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for)); |
| 1476 | return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses); |
| 1477 | } |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1478 | |
| 1479 | OMPDistributeParallelForSimdDirective * |
| 1480 | OMPDistributeParallelForSimdDirective::Create( |
| 1481 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1482 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1483 | const HelperExprs &Exprs) { |
| 1484 | unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1485 | alignof(OMPClause *)); |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1486 | void *Mem = C.Allocate( |
| 1487 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1488 | sizeof(Stmt *) * |
| 1489 | numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd)); |
| 1490 | OMPDistributeParallelForSimdDirective *Dir = new (Mem) |
| 1491 | OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum, |
| 1492 | Clauses.size()); |
| 1493 | Dir->setClauses(Clauses); |
| 1494 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1495 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1496 | Dir->setLastIteration(Exprs.LastIteration); |
| 1497 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1498 | Dir->setPreCond(Exprs.PreCond); |
| 1499 | Dir->setCond(Exprs.Cond); |
| 1500 | Dir->setInit(Exprs.Init); |
| 1501 | Dir->setInc(Exprs.Inc); |
| 1502 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1503 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1504 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1505 | Dir->setStrideVariable(Exprs.ST); |
| 1506 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1507 | Dir->setNextLowerBound(Exprs.NLB); |
| 1508 | Dir->setNextUpperBound(Exprs.NUB); |
| 1509 | Dir->setNumIterations(Exprs.NumIterations); |
| 1510 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 1511 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 1512 | Dir->setDistInc(Exprs.DistInc); |
| 1513 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1514 | Dir->setCounters(Exprs.Counters); |
| 1515 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1516 | Dir->setInits(Exprs.Inits); |
| 1517 | Dir->setUpdates(Exprs.Updates); |
| 1518 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1519 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1520 | Dir->setDependentInits(Exprs.DependentInits); |
| 1521 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1522 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 1523 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 1524 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 1525 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 1526 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 1527 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 1528 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 1529 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Gheorghe-Teodor Bercea | e925676 | 2018-10-29 15:45:47 +0000 | [diff] [blame] | 1530 | Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); |
| 1531 | Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1532 | return Dir; |
| 1533 | } |
| 1534 | |
| 1535 | OMPDistributeParallelForSimdDirective * |
| 1536 | OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C, |
| 1537 | unsigned NumClauses, |
| 1538 | unsigned CollapsedNum, |
| 1539 | EmptyShell) { |
| 1540 | unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1541 | alignof(OMPClause *)); |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1542 | void *Mem = C.Allocate( |
| 1543 | Size + sizeof(OMPClause *) * NumClauses + |
| 1544 | sizeof(Stmt *) * |
| 1545 | numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd)); |
| 1546 | return new (Mem) |
| 1547 | OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses); |
| 1548 | } |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 1549 | |
| 1550 | OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create( |
| 1551 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1552 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1553 | const HelperExprs &Exprs) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1554 | unsigned Size = |
| 1555 | llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *)); |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 1556 | void *Mem = C.Allocate( |
| 1557 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1558 | sizeof(Stmt *) * |
| 1559 | numLoopChildren(CollapsedNum, OMPD_distribute_simd)); |
| 1560 | OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective( |
| 1561 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1562 | Dir->setClauses(Clauses); |
| 1563 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1564 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1565 | Dir->setLastIteration(Exprs.LastIteration); |
| 1566 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1567 | Dir->setPreCond(Exprs.PreCond); |
| 1568 | Dir->setCond(Exprs.Cond); |
| 1569 | Dir->setInit(Exprs.Init); |
| 1570 | Dir->setInc(Exprs.Inc); |
| 1571 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1572 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1573 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1574 | Dir->setStrideVariable(Exprs.ST); |
| 1575 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1576 | Dir->setNextLowerBound(Exprs.NLB); |
| 1577 | Dir->setNextUpperBound(Exprs.NUB); |
| 1578 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 1579 | Dir->setCounters(Exprs.Counters); |
| 1580 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1581 | Dir->setInits(Exprs.Inits); |
| 1582 | Dir->setUpdates(Exprs.Updates); |
| 1583 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1584 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1585 | Dir->setDependentInits(Exprs.DependentInits); |
| 1586 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 1587 | Dir->setPreInits(Exprs.PreInits); |
| 1588 | return Dir; |
| 1589 | } |
| 1590 | |
| 1591 | OMPDistributeSimdDirective * |
| 1592 | OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C, |
| 1593 | unsigned NumClauses, |
| 1594 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1595 | unsigned Size = |
| 1596 | llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *)); |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 1597 | void *Mem = C.Allocate( |
| 1598 | Size + sizeof(OMPClause *) * NumClauses + |
| 1599 | sizeof(Stmt *) * |
| 1600 | numLoopChildren(CollapsedNum, OMPD_distribute_simd)); |
| 1601 | return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses); |
| 1602 | } |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1603 | |
| 1604 | OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create( |
| 1605 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1606 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1607 | const HelperExprs &Exprs) { |
| 1608 | unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1609 | alignof(OMPClause *)); |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1610 | void *Mem = C.Allocate( |
| 1611 | Size + sizeof(OMPClause *) * Clauses.size() + |
Fangrui Song | 6907ce2 | 2018-07-30 19:24:48 +0000 | [diff] [blame] | 1612 | sizeof(Stmt *) * |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1613 | numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd)); |
Fangrui Song | 6907ce2 | 2018-07-30 19:24:48 +0000 | [diff] [blame] | 1614 | OMPTargetParallelForSimdDirective *Dir = |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1615 | new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc, |
| 1616 | CollapsedNum, Clauses.size()); |
| 1617 | Dir->setClauses(Clauses); |
| 1618 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1619 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1620 | Dir->setLastIteration(Exprs.LastIteration); |
| 1621 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1622 | Dir->setPreCond(Exprs.PreCond); |
| 1623 | Dir->setCond(Exprs.Cond); |
| 1624 | Dir->setInit(Exprs.Init); |
| 1625 | Dir->setInc(Exprs.Inc); |
| 1626 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1627 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1628 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1629 | Dir->setStrideVariable(Exprs.ST); |
| 1630 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1631 | Dir->setNextLowerBound(Exprs.NLB); |
| 1632 | Dir->setNextUpperBound(Exprs.NUB); |
| 1633 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1634 | Dir->setCounters(Exprs.Counters); |
| 1635 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1636 | Dir->setInits(Exprs.Inits); |
| 1637 | Dir->setUpdates(Exprs.Updates); |
| 1638 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1639 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1640 | Dir->setDependentInits(Exprs.DependentInits); |
| 1641 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1642 | Dir->setPreInits(Exprs.PreInits); |
| 1643 | return Dir; |
| 1644 | } |
| 1645 | |
| 1646 | OMPTargetParallelForSimdDirective * |
| 1647 | OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C, |
| 1648 | unsigned NumClauses, |
| 1649 | unsigned CollapsedNum, |
| 1650 | EmptyShell) { |
| 1651 | unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1652 | alignof(OMPClause *)); |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1653 | void *Mem = C.Allocate( |
| 1654 | Size + sizeof(OMPClause *) * NumClauses + |
Fangrui Song | 6907ce2 | 2018-07-30 19:24:48 +0000 | [diff] [blame] | 1655 | sizeof(Stmt *) * |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1656 | numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd)); |
| 1657 | return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses); |
| 1658 | } |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 1659 | |
| 1660 | OMPTargetSimdDirective * |
Fangrui Song | 6907ce2 | 2018-07-30 19:24:48 +0000 | [diff] [blame] | 1661 | OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc, |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 1662 | SourceLocation EndLoc, unsigned CollapsedNum, |
| 1663 | ArrayRef<OMPClause *> Clauses, |
| 1664 | Stmt *AssociatedStmt, const HelperExprs &Exprs) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1665 | unsigned Size = |
| 1666 | llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *)); |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 1667 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
Fangrui Song | 6907ce2 | 2018-07-30 19:24:48 +0000 | [diff] [blame] | 1668 | sizeof(Stmt *) * |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 1669 | numLoopChildren(CollapsedNum, OMPD_target_simd)); |
| 1670 | OMPTargetSimdDirective *Dir = new (Mem) |
| 1671 | OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1672 | Dir->setClauses(Clauses); |
| 1673 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1674 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1675 | Dir->setLastIteration(Exprs.LastIteration); |
| 1676 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1677 | Dir->setPreCond(Exprs.PreCond); |
| 1678 | Dir->setCond(Exprs.Cond); |
| 1679 | Dir->setInit(Exprs.Init); |
| 1680 | Dir->setInc(Exprs.Inc); |
| 1681 | Dir->setCounters(Exprs.Counters); |
| 1682 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1683 | Dir->setInits(Exprs.Inits); |
| 1684 | Dir->setUpdates(Exprs.Updates); |
| 1685 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1686 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1687 | Dir->setDependentInits(Exprs.DependentInits); |
| 1688 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 1689 | Dir->setPreInits(Exprs.PreInits); |
| 1690 | return Dir; |
| 1691 | } |
| 1692 | |
| 1693 | OMPTargetSimdDirective * |
| 1694 | OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 1695 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1696 | unsigned Size = |
| 1697 | llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *)); |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 1698 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
Fangrui Song | 6907ce2 | 2018-07-30 19:24:48 +0000 | [diff] [blame] | 1699 | sizeof(Stmt *) * |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 1700 | numLoopChildren(CollapsedNum, OMPD_target_simd)); |
| 1701 | return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses); |
| 1702 | } |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 1703 | |
| 1704 | OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create( |
| 1705 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1706 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1707 | const HelperExprs &Exprs) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1708 | unsigned Size = |
| 1709 | llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *)); |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 1710 | void *Mem = C.Allocate( |
| 1711 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1712 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute)); |
| 1713 | OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective( |
| 1714 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1715 | Dir->setClauses(Clauses); |
| 1716 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1717 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1718 | Dir->setLastIteration(Exprs.LastIteration); |
| 1719 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1720 | Dir->setPreCond(Exprs.PreCond); |
| 1721 | Dir->setCond(Exprs.Cond); |
| 1722 | Dir->setInit(Exprs.Init); |
| 1723 | Dir->setInc(Exprs.Inc); |
| 1724 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1725 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1726 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1727 | Dir->setStrideVariable(Exprs.ST); |
| 1728 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1729 | Dir->setNextLowerBound(Exprs.NLB); |
| 1730 | Dir->setNextUpperBound(Exprs.NUB); |
| 1731 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 1732 | Dir->setCounters(Exprs.Counters); |
| 1733 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1734 | Dir->setInits(Exprs.Inits); |
| 1735 | Dir->setUpdates(Exprs.Updates); |
| 1736 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1737 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1738 | Dir->setDependentInits(Exprs.DependentInits); |
| 1739 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 1740 | Dir->setPreInits(Exprs.PreInits); |
| 1741 | return Dir; |
| 1742 | } |
| 1743 | |
| 1744 | OMPTeamsDistributeDirective * |
| 1745 | OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C, |
| 1746 | unsigned NumClauses, |
| 1747 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1748 | unsigned Size = |
| 1749 | llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *)); |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 1750 | void *Mem = C.Allocate( |
| 1751 | Size + sizeof(OMPClause *) * NumClauses + |
| 1752 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute)); |
| 1753 | return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses); |
| 1754 | } |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 1755 | |
| 1756 | OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create( |
| 1757 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1758 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1759 | const HelperExprs &Exprs) { |
| 1760 | unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective), |
| 1761 | alignof(OMPClause *)); |
| 1762 | void *Mem = |
| 1763 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 1764 | sizeof(Stmt *) * |
| 1765 | numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd)); |
| 1766 | OMPTeamsDistributeSimdDirective *Dir = |
| 1767 | new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum, |
| 1768 | Clauses.size()); |
| 1769 | Dir->setClauses(Clauses); |
| 1770 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1771 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1772 | Dir->setLastIteration(Exprs.LastIteration); |
| 1773 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1774 | Dir->setPreCond(Exprs.PreCond); |
| 1775 | Dir->setCond(Exprs.Cond); |
| 1776 | Dir->setInit(Exprs.Init); |
| 1777 | Dir->setInc(Exprs.Inc); |
| 1778 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1779 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1780 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1781 | Dir->setStrideVariable(Exprs.ST); |
| 1782 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1783 | Dir->setNextLowerBound(Exprs.NLB); |
| 1784 | Dir->setNextUpperBound(Exprs.NUB); |
| 1785 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 1786 | Dir->setCounters(Exprs.Counters); |
| 1787 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1788 | Dir->setInits(Exprs.Inits); |
| 1789 | Dir->setUpdates(Exprs.Updates); |
| 1790 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1791 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1792 | Dir->setDependentInits(Exprs.DependentInits); |
| 1793 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 1794 | Dir->setPreInits(Exprs.PreInits); |
| 1795 | return Dir; |
| 1796 | } |
| 1797 | |
| 1798 | OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty( |
| 1799 | const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, |
| 1800 | EmptyShell) { |
| 1801 | unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective), |
| 1802 | alignof(OMPClause *)); |
| 1803 | void *Mem = |
| 1804 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 1805 | sizeof(Stmt *) * |
| 1806 | numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd)); |
| 1807 | return new (Mem) OMPTeamsDistributeSimdDirective(CollapsedNum, NumClauses); |
| 1808 | } |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 1809 | |
| 1810 | OMPTeamsDistributeParallelForSimdDirective * |
| 1811 | OMPTeamsDistributeParallelForSimdDirective::Create( |
| 1812 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1813 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1814 | const HelperExprs &Exprs) { |
| 1815 | auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective), |
| 1816 | alignof(OMPClause *)); |
| 1817 | void *Mem = |
| 1818 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 1819 | sizeof(Stmt *) * |
| 1820 | numLoopChildren(CollapsedNum, |
| 1821 | OMPD_teams_distribute_parallel_for_simd)); |
| 1822 | OMPTeamsDistributeParallelForSimdDirective *Dir = new (Mem) |
| 1823 | OMPTeamsDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum, |
| 1824 | Clauses.size()); |
| 1825 | Dir->setClauses(Clauses); |
| 1826 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1827 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1828 | Dir->setLastIteration(Exprs.LastIteration); |
| 1829 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1830 | Dir->setPreCond(Exprs.PreCond); |
| 1831 | Dir->setCond(Exprs.Cond); |
| 1832 | Dir->setInit(Exprs.Init); |
| 1833 | Dir->setInc(Exprs.Inc); |
| 1834 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1835 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1836 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1837 | Dir->setStrideVariable(Exprs.ST); |
| 1838 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1839 | Dir->setNextLowerBound(Exprs.NLB); |
| 1840 | Dir->setNextUpperBound(Exprs.NUB); |
| 1841 | Dir->setNumIterations(Exprs.NumIterations); |
| 1842 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 1843 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 1844 | Dir->setDistInc(Exprs.DistInc); |
| 1845 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 1846 | Dir->setCounters(Exprs.Counters); |
| 1847 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1848 | Dir->setInits(Exprs.Inits); |
| 1849 | Dir->setUpdates(Exprs.Updates); |
| 1850 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1851 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1852 | Dir->setDependentInits(Exprs.DependentInits); |
| 1853 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 1854 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 1855 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 1856 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 1857 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 1858 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 1859 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 1860 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 1861 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Gheorghe-Teodor Bercea | e925676 | 2018-10-29 15:45:47 +0000 | [diff] [blame] | 1862 | Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); |
| 1863 | Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 1864 | return Dir; |
| 1865 | } |
| 1866 | |
| 1867 | OMPTeamsDistributeParallelForSimdDirective * |
| 1868 | OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C, |
| 1869 | unsigned NumClauses, |
| 1870 | unsigned CollapsedNum, |
| 1871 | EmptyShell) { |
| 1872 | auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective), |
| 1873 | alignof(OMPClause *)); |
| 1874 | void *Mem = |
| 1875 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 1876 | sizeof(Stmt *) * |
| 1877 | numLoopChildren(CollapsedNum, |
| 1878 | OMPD_teams_distribute_parallel_for_simd)); |
| 1879 | return new (Mem) |
| 1880 | OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses); |
| 1881 | } |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 1882 | |
| 1883 | OMPTeamsDistributeParallelForDirective * |
| 1884 | OMPTeamsDistributeParallelForDirective::Create( |
| 1885 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1886 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
Alexey Bataev | dcb4b8fb | 2017-11-22 20:19:50 +0000 | [diff] [blame] | 1887 | const HelperExprs &Exprs, bool HasCancel) { |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 1888 | auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective), |
| 1889 | alignof(OMPClause *)); |
| 1890 | void *Mem = C.Allocate( |
| 1891 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1892 | sizeof(Stmt *) * |
| 1893 | numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for)); |
| 1894 | OMPTeamsDistributeParallelForDirective *Dir = new (Mem) |
| 1895 | OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum, |
| 1896 | Clauses.size()); |
| 1897 | Dir->setClauses(Clauses); |
| 1898 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1899 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1900 | Dir->setLastIteration(Exprs.LastIteration); |
| 1901 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1902 | Dir->setPreCond(Exprs.PreCond); |
| 1903 | Dir->setCond(Exprs.Cond); |
| 1904 | Dir->setInit(Exprs.Init); |
| 1905 | Dir->setInc(Exprs.Inc); |
| 1906 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1907 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1908 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1909 | Dir->setStrideVariable(Exprs.ST); |
| 1910 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1911 | Dir->setNextLowerBound(Exprs.NLB); |
| 1912 | Dir->setNextUpperBound(Exprs.NUB); |
| 1913 | Dir->setNumIterations(Exprs.NumIterations); |
| 1914 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 1915 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 1916 | Dir->setDistInc(Exprs.DistInc); |
| 1917 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 1918 | Dir->setCounters(Exprs.Counters); |
| 1919 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1920 | Dir->setInits(Exprs.Inits); |
| 1921 | Dir->setUpdates(Exprs.Updates); |
| 1922 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 1923 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 1924 | Dir->setDependentInits(Exprs.DependentInits); |
| 1925 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 1926 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 1927 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 1928 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 1929 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 1930 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 1931 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 1932 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 1933 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Gheorghe-Teodor Bercea | e925676 | 2018-10-29 15:45:47 +0000 | [diff] [blame] | 1934 | Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); |
| 1935 | Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); |
Alexey Bataev | dcb4b8fb | 2017-11-22 20:19:50 +0000 | [diff] [blame] | 1936 | Dir->HasCancel = HasCancel; |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 1937 | return Dir; |
| 1938 | } |
| 1939 | |
| 1940 | OMPTeamsDistributeParallelForDirective * |
| 1941 | OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C, |
| 1942 | unsigned NumClauses, |
| 1943 | unsigned CollapsedNum, |
| 1944 | EmptyShell) { |
| 1945 | auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective), |
| 1946 | alignof(OMPClause *)); |
| 1947 | void *Mem = C.Allocate( |
| 1948 | Size + sizeof(OMPClause *) * NumClauses + |
| 1949 | sizeof(Stmt *) * |
| 1950 | numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for)); |
| 1951 | return new (Mem) |
| 1952 | OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses); |
| 1953 | } |
| 1954 | |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 1955 | OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create( |
| 1956 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1957 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
| 1958 | auto Size = |
| 1959 | llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *)); |
| 1960 | void *Mem = |
| 1961 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 1962 | OMPTargetTeamsDirective *Dir = |
| 1963 | new (Mem) OMPTargetTeamsDirective(StartLoc, EndLoc, Clauses.size()); |
| 1964 | Dir->setClauses(Clauses); |
| 1965 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1966 | return Dir; |
| 1967 | } |
| 1968 | |
| 1969 | OMPTargetTeamsDirective * |
| 1970 | OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 1971 | EmptyShell) { |
| 1972 | auto Size = |
| 1973 | llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *)); |
| 1974 | void *Mem = |
| 1975 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 1976 | return new (Mem) OMPTargetTeamsDirective(NumClauses); |
| 1977 | } |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 1978 | |
| 1979 | OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create( |
| 1980 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1981 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1982 | const HelperExprs &Exprs) { |
| 1983 | auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective), |
| 1984 | alignof(OMPClause *)); |
| 1985 | void *Mem = C.Allocate( |
| 1986 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1987 | sizeof(Stmt *) * |
| 1988 | numLoopChildren(CollapsedNum, OMPD_target_teams_distribute)); |
| 1989 | OMPTargetTeamsDistributeDirective *Dir = |
| 1990 | new (Mem) OMPTargetTeamsDistributeDirective(StartLoc, EndLoc, CollapsedNum, |
| 1991 | Clauses.size()); |
| 1992 | Dir->setClauses(Clauses); |
| 1993 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1994 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1995 | Dir->setLastIteration(Exprs.LastIteration); |
| 1996 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1997 | Dir->setPreCond(Exprs.PreCond); |
| 1998 | Dir->setCond(Exprs.Cond); |
| 1999 | Dir->setInit(Exprs.Init); |
| 2000 | Dir->setInc(Exprs.Inc); |
| 2001 | Dir->setIsLastIterVariable(Exprs.IL); |
| 2002 | Dir->setLowerBoundVariable(Exprs.LB); |
| 2003 | Dir->setUpperBoundVariable(Exprs.UB); |
| 2004 | Dir->setStrideVariable(Exprs.ST); |
| 2005 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 2006 | Dir->setNextLowerBound(Exprs.NLB); |
| 2007 | Dir->setNextUpperBound(Exprs.NUB); |
| 2008 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 2009 | Dir->setCounters(Exprs.Counters); |
| 2010 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 2011 | Dir->setInits(Exprs.Inits); |
| 2012 | Dir->setUpdates(Exprs.Updates); |
| 2013 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 2014 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 2015 | Dir->setDependentInits(Exprs.DependentInits); |
| 2016 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 2017 | Dir->setPreInits(Exprs.PreInits); |
| 2018 | return Dir; |
| 2019 | } |
| 2020 | |
| 2021 | OMPTargetTeamsDistributeDirective * |
| 2022 | OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C, |
| 2023 | unsigned NumClauses, |
| 2024 | unsigned CollapsedNum, |
| 2025 | EmptyShell) { |
| 2026 | auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective), |
| 2027 | alignof(OMPClause *)); |
| 2028 | void *Mem = C.Allocate( |
| 2029 | Size + sizeof(OMPClause *) * NumClauses + |
| 2030 | sizeof(Stmt *) * |
| 2031 | numLoopChildren(CollapsedNum, OMPD_target_teams_distribute)); |
| 2032 | return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses); |
| 2033 | } |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 2034 | |
| 2035 | OMPTargetTeamsDistributeParallelForDirective * |
| 2036 | OMPTargetTeamsDistributeParallelForDirective::Create( |
| 2037 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 2038 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
Alexey Bataev | 16e7988 | 2017-11-22 21:12:03 +0000 | [diff] [blame] | 2039 | const HelperExprs &Exprs, bool HasCancel) { |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 2040 | auto Size = |
| 2041 | llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective), |
| 2042 | alignof(OMPClause *)); |
| 2043 | void *Mem = C.Allocate( |
| 2044 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 2045 | sizeof(Stmt *) * |
| 2046 | numLoopChildren(CollapsedNum, |
| 2047 | OMPD_target_teams_distribute_parallel_for)); |
| 2048 | OMPTargetTeamsDistributeParallelForDirective *Dir = |
| 2049 | new (Mem) OMPTargetTeamsDistributeParallelForDirective( |
| 2050 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 2051 | Dir->setClauses(Clauses); |
| 2052 | Dir->setAssociatedStmt(AssociatedStmt); |
| 2053 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 2054 | Dir->setLastIteration(Exprs.LastIteration); |
| 2055 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 2056 | Dir->setPreCond(Exprs.PreCond); |
| 2057 | Dir->setCond(Exprs.Cond); |
| 2058 | Dir->setInit(Exprs.Init); |
| 2059 | Dir->setInc(Exprs.Inc); |
| 2060 | Dir->setIsLastIterVariable(Exprs.IL); |
| 2061 | Dir->setLowerBoundVariable(Exprs.LB); |
| 2062 | Dir->setUpperBoundVariable(Exprs.UB); |
| 2063 | Dir->setStrideVariable(Exprs.ST); |
| 2064 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 2065 | Dir->setNextLowerBound(Exprs.NLB); |
| 2066 | Dir->setNextUpperBound(Exprs.NUB); |
| 2067 | Dir->setNumIterations(Exprs.NumIterations); |
| 2068 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 2069 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 2070 | Dir->setDistInc(Exprs.DistInc); |
| 2071 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 2072 | Dir->setCounters(Exprs.Counters); |
| 2073 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 2074 | Dir->setInits(Exprs.Inits); |
| 2075 | Dir->setUpdates(Exprs.Updates); |
| 2076 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 2077 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 2078 | Dir->setDependentInits(Exprs.DependentInits); |
| 2079 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 2080 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 2081 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 2082 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 2083 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 2084 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 2085 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 2086 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 2087 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Gheorghe-Teodor Bercea | e925676 | 2018-10-29 15:45:47 +0000 | [diff] [blame] | 2088 | Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); |
| 2089 | Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); |
Alexey Bataev | 16e7988 | 2017-11-22 21:12:03 +0000 | [diff] [blame] | 2090 | Dir->HasCancel = HasCancel; |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 2091 | return Dir; |
| 2092 | } |
| 2093 | |
| 2094 | OMPTargetTeamsDistributeParallelForDirective * |
| 2095 | OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C, |
| 2096 | unsigned NumClauses, |
| 2097 | unsigned CollapsedNum, |
| 2098 | EmptyShell) { |
| 2099 | auto Size = |
| 2100 | llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective), |
| 2101 | alignof(OMPClause *)); |
| 2102 | void *Mem = C.Allocate( |
| 2103 | Size + sizeof(OMPClause *) * NumClauses + |
| 2104 | sizeof(Stmt *) * |
| 2105 | numLoopChildren(CollapsedNum, |
| 2106 | OMPD_target_teams_distribute_parallel_for)); |
| 2107 | return new (Mem) |
| 2108 | OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses); |
| 2109 | } |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 2110 | |
| 2111 | OMPTargetTeamsDistributeParallelForSimdDirective * |
| 2112 | OMPTargetTeamsDistributeParallelForSimdDirective::Create( |
| 2113 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 2114 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 2115 | const HelperExprs &Exprs) { |
| 2116 | auto Size = |
| 2117 | llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective), |
| 2118 | alignof(OMPClause *)); |
| 2119 | void *Mem = C.Allocate( |
| 2120 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 2121 | sizeof(Stmt *) * |
| 2122 | numLoopChildren(CollapsedNum, |
| 2123 | OMPD_target_teams_distribute_parallel_for_simd)); |
| 2124 | OMPTargetTeamsDistributeParallelForSimdDirective *Dir = |
| 2125 | new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective( |
| 2126 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 2127 | Dir->setClauses(Clauses); |
| 2128 | Dir->setAssociatedStmt(AssociatedStmt); |
| 2129 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 2130 | Dir->setLastIteration(Exprs.LastIteration); |
| 2131 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 2132 | Dir->setPreCond(Exprs.PreCond); |
| 2133 | Dir->setCond(Exprs.Cond); |
| 2134 | Dir->setInit(Exprs.Init); |
| 2135 | Dir->setInc(Exprs.Inc); |
| 2136 | Dir->setIsLastIterVariable(Exprs.IL); |
| 2137 | Dir->setLowerBoundVariable(Exprs.LB); |
| 2138 | Dir->setUpperBoundVariable(Exprs.UB); |
| 2139 | Dir->setStrideVariable(Exprs.ST); |
| 2140 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 2141 | Dir->setNextLowerBound(Exprs.NLB); |
| 2142 | Dir->setNextUpperBound(Exprs.NUB); |
| 2143 | Dir->setNumIterations(Exprs.NumIterations); |
| 2144 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 2145 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 2146 | Dir->setDistInc(Exprs.DistInc); |
| 2147 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 2148 | Dir->setCounters(Exprs.Counters); |
| 2149 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 2150 | Dir->setInits(Exprs.Inits); |
| 2151 | Dir->setUpdates(Exprs.Updates); |
| 2152 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 2153 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 2154 | Dir->setDependentInits(Exprs.DependentInits); |
| 2155 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 2156 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 2157 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 2158 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 2159 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 2160 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 2161 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 2162 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 2163 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Gheorghe-Teodor Bercea | e925676 | 2018-10-29 15:45:47 +0000 | [diff] [blame] | 2164 | Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond); |
| 2165 | Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond); |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 2166 | return Dir; |
| 2167 | } |
| 2168 | |
| 2169 | OMPTargetTeamsDistributeParallelForSimdDirective * |
| 2170 | OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty( |
| 2171 | const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, |
| 2172 | EmptyShell) { |
| 2173 | auto Size = |
| 2174 | llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective), |
| 2175 | alignof(OMPClause *)); |
| 2176 | void *Mem = C.Allocate( |
| 2177 | Size + sizeof(OMPClause *) * NumClauses + |
| 2178 | sizeof(Stmt *) * |
| 2179 | numLoopChildren(CollapsedNum, |
| 2180 | OMPD_target_teams_distribute_parallel_for_simd)); |
| 2181 | return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective( |
| 2182 | CollapsedNum, NumClauses); |
| 2183 | } |
| 2184 | |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 2185 | OMPTargetTeamsDistributeSimdDirective * |
| 2186 | OMPTargetTeamsDistributeSimdDirective::Create( |
| 2187 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 2188 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 2189 | const HelperExprs &Exprs) { |
| 2190 | auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective), |
| 2191 | alignof(OMPClause *)); |
| 2192 | void *Mem = C.Allocate( |
| 2193 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 2194 | sizeof(Stmt *) * |
| 2195 | numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd)); |
| 2196 | OMPTargetTeamsDistributeSimdDirective *Dir = new (Mem) |
| 2197 | OMPTargetTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum, |
| 2198 | Clauses.size()); |
| 2199 | Dir->setClauses(Clauses); |
| 2200 | Dir->setAssociatedStmt(AssociatedStmt); |
| 2201 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 2202 | Dir->setLastIteration(Exprs.LastIteration); |
| 2203 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 2204 | Dir->setPreCond(Exprs.PreCond); |
| 2205 | Dir->setCond(Exprs.Cond); |
| 2206 | Dir->setInit(Exprs.Init); |
| 2207 | Dir->setInc(Exprs.Inc); |
| 2208 | Dir->setIsLastIterVariable(Exprs.IL); |
| 2209 | Dir->setLowerBoundVariable(Exprs.LB); |
| 2210 | Dir->setUpperBoundVariable(Exprs.UB); |
| 2211 | Dir->setStrideVariable(Exprs.ST); |
| 2212 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 2213 | Dir->setNextLowerBound(Exprs.NLB); |
| 2214 | Dir->setNextUpperBound(Exprs.NUB); |
| 2215 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 2216 | Dir->setCounters(Exprs.Counters); |
| 2217 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 2218 | Dir->setInits(Exprs.Inits); |
| 2219 | Dir->setUpdates(Exprs.Updates); |
| 2220 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | f8be476 | 2019-08-14 19:30:06 +0000 | [diff] [blame] | 2221 | Dir->setDependentCounters(Exprs.DependentCounters); |
| 2222 | Dir->setDependentInits(Exprs.DependentInits); |
| 2223 | Dir->setFinalsConditions(Exprs.FinalsConditions); |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 2224 | Dir->setPreInits(Exprs.PreInits); |
| 2225 | return Dir; |
| 2226 | } |
| 2227 | |
| 2228 | OMPTargetTeamsDistributeSimdDirective * |
| 2229 | OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C, |
| 2230 | unsigned NumClauses, |
| 2231 | unsigned CollapsedNum, |
| 2232 | EmptyShell) { |
| 2233 | auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective), |
| 2234 | alignof(OMPClause *)); |
| 2235 | void *Mem = C.Allocate( |
| 2236 | Size + sizeof(OMPClause *) * NumClauses + |
| 2237 | sizeof(Stmt *) * |
| 2238 | numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd)); |
| 2239 | return new (Mem) |
| 2240 | OMPTargetTeamsDistributeSimdDirective(CollapsedNum, NumClauses); |
| 2241 | } |