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