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