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