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, |
| 527 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
| 528 | unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) + |
| 529 | sizeof(OMPClause *) * Clauses.size(), |
| 530 | alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 531 | void *Mem = C.Allocate(Size + sizeof(Stmt *)); |
| 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 | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame^] | 535 | Dir->setClauses(Clauses); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 536 | return Dir; |
| 537 | } |
| 538 | |
| 539 | OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C, |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame^] | 540 | unsigned NumClauses, |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 541 | EmptyShell) { |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame^] | 542 | unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) + |
| 543 | sizeof(OMPClause *) * NumClauses, |
| 544 | alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 545 | void *Mem = C.Allocate(Size + sizeof(Stmt *)); |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame^] | 546 | return new (Mem) OMPTaskgroupDirective(NumClauses); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 547 | } |
| 548 | |
| 549 | OMPCancellationPointDirective *OMPCancellationPointDirective::Create( |
| 550 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 551 | OpenMPDirectiveKind CancelRegion) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 552 | unsigned Size = |
| 553 | llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 554 | void *Mem = C.Allocate(Size); |
| 555 | OMPCancellationPointDirective *Dir = |
| 556 | new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc); |
| 557 | Dir->setCancelRegion(CancelRegion); |
| 558 | return Dir; |
| 559 | } |
| 560 | |
| 561 | OMPCancellationPointDirective * |
| 562 | OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 563 | unsigned Size = |
| 564 | llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 565 | void *Mem = C.Allocate(Size); |
| 566 | return new (Mem) OMPCancellationPointDirective(); |
| 567 | } |
| 568 | |
| 569 | OMPCancelDirective * |
| 570 | OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc, |
| 571 | SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, |
| 572 | OpenMPDirectiveKind CancelRegion) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 573 | unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) + |
| 574 | sizeof(OMPClause *) * Clauses.size(), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 575 | alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 576 | void *Mem = C.Allocate(Size); |
| 577 | OMPCancelDirective *Dir = |
| 578 | new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size()); |
| 579 | Dir->setClauses(Clauses); |
| 580 | Dir->setCancelRegion(CancelRegion); |
| 581 | return Dir; |
| 582 | } |
| 583 | |
| 584 | OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C, |
| 585 | unsigned NumClauses, |
| 586 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 587 | unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) + |
| 588 | sizeof(OMPClause *) * NumClauses, |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 589 | alignof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 590 | void *Mem = C.Allocate(Size); |
| 591 | return new (Mem) OMPCancelDirective(NumClauses); |
| 592 | } |
| 593 | |
| 594 | OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C, |
| 595 | SourceLocation StartLoc, |
| 596 | SourceLocation EndLoc, |
| 597 | ArrayRef<OMPClause *> Clauses) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 598 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 599 | llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 600 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size()); |
| 601 | OMPFlushDirective *Dir = |
| 602 | new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size()); |
| 603 | Dir->setClauses(Clauses); |
| 604 | return Dir; |
| 605 | } |
| 606 | |
| 607 | OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C, |
| 608 | unsigned NumClauses, |
| 609 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 610 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 611 | llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 612 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses); |
| 613 | return new (Mem) OMPFlushDirective(NumClauses); |
| 614 | } |
| 615 | |
| 616 | OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C, |
| 617 | SourceLocation StartLoc, |
| 618 | SourceLocation EndLoc, |
| 619 | ArrayRef<OMPClause *> Clauses, |
| 620 | Stmt *AssociatedStmt) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 621 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 622 | llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 623 | void *Mem = |
| 624 | C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size()); |
| 625 | OMPOrderedDirective *Dir = |
| 626 | new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size()); |
| 627 | Dir->setClauses(Clauses); |
| 628 | Dir->setAssociatedStmt(AssociatedStmt); |
| 629 | return Dir; |
| 630 | } |
| 631 | |
| 632 | OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C, |
| 633 | unsigned NumClauses, |
| 634 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 635 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 636 | llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 637 | void *Mem = |
| 638 | C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses); |
| 639 | return new (Mem) OMPOrderedDirective(NumClauses); |
| 640 | } |
| 641 | |
| 642 | OMPAtomicDirective *OMPAtomicDirective::Create( |
| 643 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 644 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V, |
| 645 | Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 646 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 647 | llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 648 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 649 | 5 * sizeof(Stmt *)); |
| 650 | OMPAtomicDirective *Dir = |
| 651 | new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size()); |
| 652 | Dir->setClauses(Clauses); |
| 653 | Dir->setAssociatedStmt(AssociatedStmt); |
| 654 | Dir->setX(X); |
| 655 | Dir->setV(V); |
| 656 | Dir->setExpr(E); |
| 657 | Dir->setUpdateExpr(UE); |
| 658 | Dir->IsXLHSInRHSPart = IsXLHSInRHSPart; |
| 659 | Dir->IsPostfixUpdate = IsPostfixUpdate; |
| 660 | return Dir; |
| 661 | } |
| 662 | |
| 663 | OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C, |
| 664 | unsigned NumClauses, |
| 665 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 666 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 667 | llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 668 | void *Mem = |
| 669 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *)); |
| 670 | return new (Mem) OMPAtomicDirective(NumClauses); |
| 671 | } |
| 672 | |
| 673 | OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C, |
| 674 | SourceLocation StartLoc, |
| 675 | SourceLocation EndLoc, |
| 676 | ArrayRef<OMPClause *> Clauses, |
| 677 | Stmt *AssociatedStmt) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 678 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 679 | llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 680 | void *Mem = |
| 681 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 682 | OMPTargetDirective *Dir = |
| 683 | new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size()); |
| 684 | Dir->setClauses(Clauses); |
| 685 | Dir->setAssociatedStmt(AssociatedStmt); |
| 686 | return Dir; |
| 687 | } |
| 688 | |
| 689 | OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C, |
| 690 | unsigned NumClauses, |
| 691 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 692 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 693 | llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 694 | void *Mem = |
| 695 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 696 | return new (Mem) OMPTargetDirective(NumClauses); |
| 697 | } |
| 698 | |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 699 | OMPTargetParallelDirective *OMPTargetParallelDirective::Create( |
| 700 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 701 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 702 | unsigned Size = |
| 703 | llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *)); |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 704 | void *Mem = |
| 705 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 706 | OMPTargetParallelDirective *Dir = |
| 707 | new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size()); |
| 708 | Dir->setClauses(Clauses); |
| 709 | Dir->setAssociatedStmt(AssociatedStmt); |
| 710 | return Dir; |
| 711 | } |
| 712 | |
| 713 | OMPTargetParallelDirective * |
| 714 | OMPTargetParallelDirective::CreateEmpty(const ASTContext &C, |
| 715 | unsigned NumClauses, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 716 | unsigned Size = |
| 717 | llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *)); |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 718 | void *Mem = |
| 719 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 720 | return new (Mem) OMPTargetParallelDirective(NumClauses); |
| 721 | } |
| 722 | |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 723 | OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create( |
| 724 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 725 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 726 | const HelperExprs &Exprs, bool HasCancel) { |
| 727 | unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 728 | alignof(OMPClause *)); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 729 | void *Mem = C.Allocate( |
| 730 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 731 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for)); |
| 732 | OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective( |
| 733 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 734 | Dir->setClauses(Clauses); |
| 735 | Dir->setAssociatedStmt(AssociatedStmt); |
| 736 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 737 | Dir->setLastIteration(Exprs.LastIteration); |
| 738 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 739 | Dir->setPreCond(Exprs.PreCond); |
| 740 | Dir->setCond(Exprs.Cond); |
| 741 | Dir->setInit(Exprs.Init); |
| 742 | Dir->setInc(Exprs.Inc); |
| 743 | Dir->setIsLastIterVariable(Exprs.IL); |
| 744 | Dir->setLowerBoundVariable(Exprs.LB); |
| 745 | Dir->setUpperBoundVariable(Exprs.UB); |
| 746 | Dir->setStrideVariable(Exprs.ST); |
| 747 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 748 | Dir->setNextLowerBound(Exprs.NLB); |
| 749 | Dir->setNextUpperBound(Exprs.NUB); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 750 | Dir->setNumIterations(Exprs.NumIterations); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 751 | Dir->setCounters(Exprs.Counters); |
| 752 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 753 | Dir->setInits(Exprs.Inits); |
| 754 | Dir->setUpdates(Exprs.Updates); |
| 755 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 756 | Dir->setPreInits(Exprs.PreInits); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 757 | Dir->setHasCancel(HasCancel); |
| 758 | return Dir; |
| 759 | } |
| 760 | |
| 761 | OMPTargetParallelForDirective * |
| 762 | OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C, |
| 763 | unsigned NumClauses, |
| 764 | unsigned CollapsedNum, EmptyShell) { |
| 765 | unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 766 | alignof(OMPClause *)); |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 767 | void *Mem = C.Allocate( |
| 768 | Size + sizeof(OMPClause *) * NumClauses + |
| 769 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for)); |
| 770 | return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses); |
| 771 | } |
| 772 | |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 773 | OMPTargetDataDirective *OMPTargetDataDirective::Create( |
| 774 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 775 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 776 | void *Mem = C.Allocate( |
| 777 | llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) + |
| 778 | sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 779 | OMPTargetDataDirective *Dir = |
| 780 | new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size()); |
| 781 | Dir->setClauses(Clauses); |
| 782 | Dir->setAssociatedStmt(AssociatedStmt); |
| 783 | return Dir; |
| 784 | } |
| 785 | |
| 786 | OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C, |
| 787 | unsigned N, |
| 788 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 789 | void *Mem = C.Allocate( |
| 790 | llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) + |
| 791 | sizeof(OMPClause *) * N + sizeof(Stmt *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 792 | return new (Mem) OMPTargetDataDirective(N); |
| 793 | } |
| 794 | |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 795 | OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create( |
| 796 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 797 | ArrayRef<OMPClause *> Clauses) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 798 | void *Mem = C.Allocate( |
| 799 | llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) + |
| 800 | sizeof(OMPClause *) * Clauses.size()); |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 801 | OMPTargetEnterDataDirective *Dir = |
| 802 | new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size()); |
| 803 | Dir->setClauses(Clauses); |
| 804 | return Dir; |
| 805 | } |
| 806 | |
| 807 | OMPTargetEnterDataDirective * |
| 808 | OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &C, unsigned N, |
| 809 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 810 | void *Mem = C.Allocate( |
| 811 | llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) + |
| 812 | sizeof(OMPClause *) * N); |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 813 | return new (Mem) OMPTargetEnterDataDirective(N); |
| 814 | } |
| 815 | |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 816 | OMPTargetExitDataDirective * |
| 817 | OMPTargetExitDataDirective::Create(const ASTContext &C, SourceLocation StartLoc, |
| 818 | SourceLocation EndLoc, |
| 819 | ArrayRef<OMPClause *> Clauses) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 820 | void *Mem = C.Allocate( |
| 821 | llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) + |
| 822 | sizeof(OMPClause *) * Clauses.size()); |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 823 | OMPTargetExitDataDirective *Dir = |
| 824 | new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size()); |
| 825 | Dir->setClauses(Clauses); |
| 826 | return Dir; |
| 827 | } |
| 828 | |
| 829 | OMPTargetExitDataDirective * |
| 830 | OMPTargetExitDataDirective::CreateEmpty(const ASTContext &C, unsigned N, |
| 831 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 832 | void *Mem = C.Allocate( |
| 833 | llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) + |
| 834 | sizeof(OMPClause *) * N); |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 835 | return new (Mem) OMPTargetExitDataDirective(N); |
| 836 | } |
| 837 | |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 838 | OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C, |
| 839 | SourceLocation StartLoc, |
| 840 | SourceLocation EndLoc, |
| 841 | ArrayRef<OMPClause *> Clauses, |
| 842 | Stmt *AssociatedStmt) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 843 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 844 | llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 845 | void *Mem = |
| 846 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 847 | OMPTeamsDirective *Dir = |
| 848 | new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size()); |
| 849 | Dir->setClauses(Clauses); |
| 850 | Dir->setAssociatedStmt(AssociatedStmt); |
| 851 | return Dir; |
| 852 | } |
| 853 | |
| 854 | OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C, |
| 855 | unsigned NumClauses, |
| 856 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 857 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 858 | llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *)); |
James Y Knight | b8bfd96 | 2015-10-02 13:41:04 +0000 | [diff] [blame] | 859 | void *Mem = |
| 860 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 861 | return new (Mem) OMPTeamsDirective(NumClauses); |
| 862 | } |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 863 | |
| 864 | OMPTaskLoopDirective *OMPTaskLoopDirective::Create( |
| 865 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 866 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 867 | const HelperExprs &Exprs) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 868 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 869 | llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *)); |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 870 | void *Mem = |
| 871 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 872 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop)); |
| 873 | OMPTaskLoopDirective *Dir = new (Mem) |
| 874 | OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 875 | Dir->setClauses(Clauses); |
| 876 | Dir->setAssociatedStmt(AssociatedStmt); |
| 877 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 878 | Dir->setLastIteration(Exprs.LastIteration); |
| 879 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 880 | Dir->setPreCond(Exprs.PreCond); |
| 881 | Dir->setCond(Exprs.Cond); |
| 882 | Dir->setInit(Exprs.Init); |
| 883 | Dir->setInc(Exprs.Inc); |
| 884 | Dir->setIsLastIterVariable(Exprs.IL); |
| 885 | Dir->setLowerBoundVariable(Exprs.LB); |
| 886 | Dir->setUpperBoundVariable(Exprs.UB); |
| 887 | Dir->setStrideVariable(Exprs.ST); |
| 888 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 889 | Dir->setNextLowerBound(Exprs.NLB); |
| 890 | Dir->setNextUpperBound(Exprs.NUB); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 891 | Dir->setNumIterations(Exprs.NumIterations); |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 892 | Dir->setCounters(Exprs.Counters); |
| 893 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 894 | Dir->setInits(Exprs.Inits); |
| 895 | Dir->setUpdates(Exprs.Updates); |
| 896 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 897 | Dir->setPreInits(Exprs.PreInits); |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 898 | return Dir; |
| 899 | } |
| 900 | |
| 901 | OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C, |
| 902 | unsigned NumClauses, |
| 903 | unsigned CollapsedNum, |
| 904 | EmptyShell) { |
Rui Ueyama | 83aa979 | 2016-01-14 21:00:27 +0000 | [diff] [blame] | 905 | unsigned Size = |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 906 | llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *)); |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 907 | void *Mem = |
| 908 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 909 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop)); |
| 910 | return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses); |
| 911 | } |
| 912 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 913 | OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create( |
| 914 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 915 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 916 | const HelperExprs &Exprs) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 917 | unsigned Size = |
| 918 | llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *)); |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 919 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 920 | sizeof(Stmt *) * |
| 921 | numLoopChildren(CollapsedNum, OMPD_taskloop_simd)); |
| 922 | OMPTaskLoopSimdDirective *Dir = new (Mem) |
| 923 | OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 924 | Dir->setClauses(Clauses); |
| 925 | Dir->setAssociatedStmt(AssociatedStmt); |
| 926 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 927 | Dir->setLastIteration(Exprs.LastIteration); |
| 928 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 929 | Dir->setPreCond(Exprs.PreCond); |
| 930 | Dir->setCond(Exprs.Cond); |
| 931 | Dir->setInit(Exprs.Init); |
| 932 | Dir->setInc(Exprs.Inc); |
| 933 | Dir->setIsLastIterVariable(Exprs.IL); |
| 934 | Dir->setLowerBoundVariable(Exprs.LB); |
| 935 | Dir->setUpperBoundVariable(Exprs.UB); |
| 936 | Dir->setStrideVariable(Exprs.ST); |
| 937 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 938 | Dir->setNextLowerBound(Exprs.NLB); |
| 939 | Dir->setNextUpperBound(Exprs.NUB); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 940 | Dir->setNumIterations(Exprs.NumIterations); |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 941 | Dir->setCounters(Exprs.Counters); |
| 942 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 943 | Dir->setInits(Exprs.Inits); |
| 944 | Dir->setUpdates(Exprs.Updates); |
| 945 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 946 | Dir->setPreInits(Exprs.PreInits); |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 947 | return Dir; |
| 948 | } |
| 949 | |
| 950 | OMPTaskLoopSimdDirective * |
| 951 | OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 952 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 953 | unsigned Size = |
| 954 | llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *)); |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 955 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 956 | sizeof(Stmt *) * |
| 957 | numLoopChildren(CollapsedNum, OMPD_taskloop_simd)); |
| 958 | return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses); |
| 959 | } |
| 960 | |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 961 | OMPDistributeDirective *OMPDistributeDirective::Create( |
| 962 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 963 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 964 | const HelperExprs &Exprs) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 965 | unsigned Size = |
| 966 | llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *)); |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 967 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 968 | sizeof(Stmt *) * |
| 969 | numLoopChildren(CollapsedNum, OMPD_distribute)); |
| 970 | OMPDistributeDirective *Dir = new (Mem) |
| 971 | OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 972 | Dir->setClauses(Clauses); |
| 973 | Dir->setAssociatedStmt(AssociatedStmt); |
| 974 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 975 | Dir->setLastIteration(Exprs.LastIteration); |
| 976 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 977 | Dir->setPreCond(Exprs.PreCond); |
| 978 | Dir->setCond(Exprs.Cond); |
| 979 | Dir->setInit(Exprs.Init); |
| 980 | Dir->setInc(Exprs.Inc); |
| 981 | Dir->setIsLastIterVariable(Exprs.IL); |
| 982 | Dir->setLowerBoundVariable(Exprs.LB); |
| 983 | Dir->setUpperBoundVariable(Exprs.UB); |
| 984 | Dir->setStrideVariable(Exprs.ST); |
| 985 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 986 | Dir->setNextLowerBound(Exprs.NLB); |
| 987 | Dir->setNextUpperBound(Exprs.NUB); |
Alexey Bataev | 8b42706 | 2016-05-25 12:36:08 +0000 | [diff] [blame] | 988 | Dir->setNumIterations(Exprs.NumIterations); |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 989 | Dir->setCounters(Exprs.Counters); |
| 990 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 991 | Dir->setInits(Exprs.Inits); |
| 992 | Dir->setUpdates(Exprs.Updates); |
| 993 | Dir->setFinals(Exprs.Finals); |
Alexey Bataev | 5a3af13 | 2016-03-29 08:58:54 +0000 | [diff] [blame] | 994 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 995 | return Dir; |
| 996 | } |
| 997 | |
| 998 | OMPDistributeDirective * |
| 999 | OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 1000 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1001 | unsigned Size = |
| 1002 | llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *)); |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 1003 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 1004 | sizeof(Stmt *) * |
| 1005 | numLoopChildren(CollapsedNum, OMPD_distribute)); |
| 1006 | return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses); |
| 1007 | } |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 1008 | |
| 1009 | OMPTargetUpdateDirective * |
| 1010 | OMPTargetUpdateDirective::Create(const ASTContext &C, SourceLocation StartLoc, |
| 1011 | SourceLocation EndLoc, |
| 1012 | ArrayRef<OMPClause *> Clauses) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1013 | unsigned Size = |
| 1014 | llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *)); |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 1015 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size()); |
| 1016 | OMPTargetUpdateDirective *Dir = |
| 1017 | new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size()); |
| 1018 | Dir->setClauses(Clauses); |
| 1019 | return Dir; |
| 1020 | } |
| 1021 | |
| 1022 | OMPTargetUpdateDirective * |
| 1023 | OMPTargetUpdateDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 1024 | EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1025 | unsigned Size = |
| 1026 | llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *)); |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 1027 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses); |
| 1028 | return new (Mem) OMPTargetUpdateDirective(NumClauses); |
| 1029 | } |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1030 | |
| 1031 | OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create( |
| 1032 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1033 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1034 | const HelperExprs &Exprs) { |
| 1035 | unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1036 | alignof(OMPClause *)); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1037 | void *Mem = C.Allocate( |
| 1038 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1039 | sizeof(Stmt *) * |
| 1040 | numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for)); |
| 1041 | OMPDistributeParallelForDirective *Dir = |
| 1042 | new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc, |
| 1043 | CollapsedNum, Clauses.size()); |
| 1044 | Dir->setClauses(Clauses); |
| 1045 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1046 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1047 | Dir->setLastIteration(Exprs.LastIteration); |
| 1048 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1049 | Dir->setPreCond(Exprs.PreCond); |
| 1050 | Dir->setCond(Exprs.Cond); |
| 1051 | Dir->setInit(Exprs.Init); |
| 1052 | Dir->setInc(Exprs.Inc); |
| 1053 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1054 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1055 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1056 | Dir->setStrideVariable(Exprs.ST); |
| 1057 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1058 | Dir->setNextLowerBound(Exprs.NLB); |
| 1059 | Dir->setNextUpperBound(Exprs.NUB); |
| 1060 | Dir->setNumIterations(Exprs.NumIterations); |
| 1061 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 1062 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 1063 | Dir->setDistInc(Exprs.DistInc); |
| 1064 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1065 | Dir->setCounters(Exprs.Counters); |
| 1066 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1067 | Dir->setInits(Exprs.Inits); |
| 1068 | Dir->setUpdates(Exprs.Updates); |
| 1069 | Dir->setFinals(Exprs.Finals); |
| 1070 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 1071 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 1072 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 1073 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 1074 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 1075 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 1076 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 1077 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1078 | return Dir; |
| 1079 | } |
| 1080 | |
| 1081 | OMPDistributeParallelForDirective * |
| 1082 | OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C, |
| 1083 | unsigned NumClauses, |
| 1084 | unsigned CollapsedNum, |
| 1085 | EmptyShell) { |
| 1086 | unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1087 | alignof(OMPClause *)); |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 1088 | void *Mem = C.Allocate( |
| 1089 | Size + sizeof(OMPClause *) * NumClauses + |
| 1090 | sizeof(Stmt *) * |
| 1091 | numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for)); |
| 1092 | return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses); |
| 1093 | } |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1094 | |
| 1095 | OMPDistributeParallelForSimdDirective * |
| 1096 | OMPDistributeParallelForSimdDirective::Create( |
| 1097 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1098 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1099 | const HelperExprs &Exprs) { |
| 1100 | unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1101 | alignof(OMPClause *)); |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1102 | void *Mem = C.Allocate( |
| 1103 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1104 | sizeof(Stmt *) * |
| 1105 | numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd)); |
| 1106 | OMPDistributeParallelForSimdDirective *Dir = new (Mem) |
| 1107 | OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum, |
| 1108 | Clauses.size()); |
| 1109 | Dir->setClauses(Clauses); |
| 1110 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1111 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1112 | Dir->setLastIteration(Exprs.LastIteration); |
| 1113 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1114 | Dir->setPreCond(Exprs.PreCond); |
| 1115 | Dir->setCond(Exprs.Cond); |
| 1116 | Dir->setInit(Exprs.Init); |
| 1117 | Dir->setInc(Exprs.Inc); |
| 1118 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1119 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1120 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1121 | Dir->setStrideVariable(Exprs.ST); |
| 1122 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1123 | Dir->setNextLowerBound(Exprs.NLB); |
| 1124 | Dir->setNextUpperBound(Exprs.NUB); |
| 1125 | Dir->setNumIterations(Exprs.NumIterations); |
| 1126 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 1127 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 1128 | Dir->setDistInc(Exprs.DistInc); |
| 1129 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1130 | Dir->setCounters(Exprs.Counters); |
| 1131 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1132 | Dir->setInits(Exprs.Inits); |
| 1133 | Dir->setUpdates(Exprs.Updates); |
| 1134 | Dir->setFinals(Exprs.Finals); |
| 1135 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 1136 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 1137 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 1138 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 1139 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 1140 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 1141 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 1142 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1143 | return Dir; |
| 1144 | } |
| 1145 | |
| 1146 | OMPDistributeParallelForSimdDirective * |
| 1147 | OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C, |
| 1148 | unsigned NumClauses, |
| 1149 | unsigned CollapsedNum, |
| 1150 | EmptyShell) { |
| 1151 | unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1152 | alignof(OMPClause *)); |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 1153 | void *Mem = C.Allocate( |
| 1154 | Size + sizeof(OMPClause *) * NumClauses + |
| 1155 | sizeof(Stmt *) * |
| 1156 | numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd)); |
| 1157 | return new (Mem) |
| 1158 | OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses); |
| 1159 | } |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 1160 | |
| 1161 | OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create( |
| 1162 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1163 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1164 | const HelperExprs &Exprs) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1165 | unsigned Size = |
| 1166 | llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *)); |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 1167 | void *Mem = C.Allocate( |
| 1168 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1169 | sizeof(Stmt *) * |
| 1170 | numLoopChildren(CollapsedNum, OMPD_distribute_simd)); |
| 1171 | OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective( |
| 1172 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1173 | Dir->setClauses(Clauses); |
| 1174 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1175 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1176 | Dir->setLastIteration(Exprs.LastIteration); |
| 1177 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1178 | Dir->setPreCond(Exprs.PreCond); |
| 1179 | Dir->setCond(Exprs.Cond); |
| 1180 | Dir->setInit(Exprs.Init); |
| 1181 | Dir->setInc(Exprs.Inc); |
| 1182 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1183 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1184 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1185 | Dir->setStrideVariable(Exprs.ST); |
| 1186 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1187 | Dir->setNextLowerBound(Exprs.NLB); |
| 1188 | Dir->setNextUpperBound(Exprs.NUB); |
| 1189 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 1190 | Dir->setCounters(Exprs.Counters); |
| 1191 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1192 | Dir->setInits(Exprs.Inits); |
| 1193 | Dir->setUpdates(Exprs.Updates); |
| 1194 | Dir->setFinals(Exprs.Finals); |
| 1195 | Dir->setPreInits(Exprs.PreInits); |
| 1196 | return Dir; |
| 1197 | } |
| 1198 | |
| 1199 | OMPDistributeSimdDirective * |
| 1200 | OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C, |
| 1201 | unsigned NumClauses, |
| 1202 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1203 | unsigned Size = |
| 1204 | llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *)); |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 1205 | void *Mem = C.Allocate( |
| 1206 | Size + sizeof(OMPClause *) * NumClauses + |
| 1207 | sizeof(Stmt *) * |
| 1208 | numLoopChildren(CollapsedNum, OMPD_distribute_simd)); |
| 1209 | return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses); |
| 1210 | } |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1211 | |
| 1212 | OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create( |
| 1213 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1214 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1215 | const HelperExprs &Exprs) { |
| 1216 | unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1217 | alignof(OMPClause *)); |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1218 | void *Mem = C.Allocate( |
| 1219 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1220 | sizeof(Stmt *) * |
| 1221 | numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd)); |
| 1222 | OMPTargetParallelForSimdDirective *Dir = |
| 1223 | new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc, |
| 1224 | CollapsedNum, Clauses.size()); |
| 1225 | Dir->setClauses(Clauses); |
| 1226 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1227 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1228 | Dir->setLastIteration(Exprs.LastIteration); |
| 1229 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1230 | Dir->setPreCond(Exprs.PreCond); |
| 1231 | Dir->setCond(Exprs.Cond); |
| 1232 | Dir->setInit(Exprs.Init); |
| 1233 | Dir->setInc(Exprs.Inc); |
| 1234 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1235 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1236 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1237 | Dir->setStrideVariable(Exprs.ST); |
| 1238 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1239 | Dir->setNextLowerBound(Exprs.NLB); |
| 1240 | Dir->setNextUpperBound(Exprs.NUB); |
| 1241 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1242 | Dir->setCounters(Exprs.Counters); |
| 1243 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1244 | Dir->setInits(Exprs.Inits); |
| 1245 | Dir->setUpdates(Exprs.Updates); |
| 1246 | Dir->setFinals(Exprs.Finals); |
| 1247 | Dir->setPreInits(Exprs.PreInits); |
| 1248 | return Dir; |
| 1249 | } |
| 1250 | |
| 1251 | OMPTargetParallelForSimdDirective * |
| 1252 | OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C, |
| 1253 | unsigned NumClauses, |
| 1254 | unsigned CollapsedNum, |
| 1255 | EmptyShell) { |
| 1256 | unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective), |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1257 | alignof(OMPClause *)); |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 1258 | void *Mem = C.Allocate( |
| 1259 | Size + sizeof(OMPClause *) * NumClauses + |
| 1260 | sizeof(Stmt *) * |
| 1261 | numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd)); |
| 1262 | return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses); |
| 1263 | } |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 1264 | |
| 1265 | OMPTargetSimdDirective * |
| 1266 | OMPTargetSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc, |
| 1267 | SourceLocation EndLoc, unsigned CollapsedNum, |
| 1268 | ArrayRef<OMPClause *> Clauses, |
| 1269 | Stmt *AssociatedStmt, const HelperExprs &Exprs) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1270 | unsigned Size = |
| 1271 | llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *)); |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 1272 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 1273 | sizeof(Stmt *) * |
| 1274 | numLoopChildren(CollapsedNum, OMPD_target_simd)); |
| 1275 | OMPTargetSimdDirective *Dir = new (Mem) |
| 1276 | OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1277 | Dir->setClauses(Clauses); |
| 1278 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1279 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1280 | Dir->setLastIteration(Exprs.LastIteration); |
| 1281 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1282 | Dir->setPreCond(Exprs.PreCond); |
| 1283 | Dir->setCond(Exprs.Cond); |
| 1284 | Dir->setInit(Exprs.Init); |
| 1285 | Dir->setInc(Exprs.Inc); |
| 1286 | Dir->setCounters(Exprs.Counters); |
| 1287 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1288 | Dir->setInits(Exprs.Inits); |
| 1289 | Dir->setUpdates(Exprs.Updates); |
| 1290 | Dir->setFinals(Exprs.Finals); |
| 1291 | Dir->setPreInits(Exprs.PreInits); |
| 1292 | return Dir; |
| 1293 | } |
| 1294 | |
| 1295 | OMPTargetSimdDirective * |
| 1296 | OMPTargetSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 1297 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1298 | unsigned Size = |
| 1299 | llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *)); |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 1300 | void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 1301 | sizeof(Stmt *) * |
| 1302 | numLoopChildren(CollapsedNum, OMPD_target_simd)); |
| 1303 | return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses); |
| 1304 | } |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 1305 | |
| 1306 | OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create( |
| 1307 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1308 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1309 | const HelperExprs &Exprs) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1310 | unsigned Size = |
| 1311 | llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *)); |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 1312 | void *Mem = C.Allocate( |
| 1313 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1314 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute)); |
| 1315 | OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective( |
| 1316 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1317 | Dir->setClauses(Clauses); |
| 1318 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1319 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1320 | Dir->setLastIteration(Exprs.LastIteration); |
| 1321 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1322 | Dir->setPreCond(Exprs.PreCond); |
| 1323 | Dir->setCond(Exprs.Cond); |
| 1324 | Dir->setInit(Exprs.Init); |
| 1325 | Dir->setInc(Exprs.Inc); |
| 1326 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1327 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1328 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1329 | Dir->setStrideVariable(Exprs.ST); |
| 1330 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1331 | Dir->setNextLowerBound(Exprs.NLB); |
| 1332 | Dir->setNextUpperBound(Exprs.NUB); |
| 1333 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 1334 | Dir->setCounters(Exprs.Counters); |
| 1335 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1336 | Dir->setInits(Exprs.Inits); |
| 1337 | Dir->setUpdates(Exprs.Updates); |
| 1338 | Dir->setFinals(Exprs.Finals); |
| 1339 | Dir->setPreInits(Exprs.PreInits); |
| 1340 | return Dir; |
| 1341 | } |
| 1342 | |
| 1343 | OMPTeamsDistributeDirective * |
| 1344 | OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C, |
| 1345 | unsigned NumClauses, |
| 1346 | unsigned CollapsedNum, EmptyShell) { |
Benjamin Kramer | c3f8925 | 2016-10-20 14:27:22 +0000 | [diff] [blame] | 1347 | unsigned Size = |
| 1348 | llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *)); |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 1349 | void *Mem = C.Allocate( |
| 1350 | Size + sizeof(OMPClause *) * NumClauses + |
| 1351 | sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute)); |
| 1352 | return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses); |
| 1353 | } |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 1354 | |
| 1355 | OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create( |
| 1356 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1357 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1358 | const HelperExprs &Exprs) { |
| 1359 | unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective), |
| 1360 | alignof(OMPClause *)); |
| 1361 | void *Mem = |
| 1362 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 1363 | sizeof(Stmt *) * |
| 1364 | numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd)); |
| 1365 | OMPTeamsDistributeSimdDirective *Dir = |
| 1366 | new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum, |
| 1367 | Clauses.size()); |
| 1368 | Dir->setClauses(Clauses); |
| 1369 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1370 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1371 | Dir->setLastIteration(Exprs.LastIteration); |
| 1372 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1373 | Dir->setPreCond(Exprs.PreCond); |
| 1374 | Dir->setCond(Exprs.Cond); |
| 1375 | Dir->setInit(Exprs.Init); |
| 1376 | Dir->setInc(Exprs.Inc); |
| 1377 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1378 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1379 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1380 | Dir->setStrideVariable(Exprs.ST); |
| 1381 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1382 | Dir->setNextLowerBound(Exprs.NLB); |
| 1383 | Dir->setNextUpperBound(Exprs.NUB); |
| 1384 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 1385 | Dir->setCounters(Exprs.Counters); |
| 1386 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1387 | Dir->setInits(Exprs.Inits); |
| 1388 | Dir->setUpdates(Exprs.Updates); |
| 1389 | Dir->setFinals(Exprs.Finals); |
| 1390 | Dir->setPreInits(Exprs.PreInits); |
| 1391 | return Dir; |
| 1392 | } |
| 1393 | |
| 1394 | OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty( |
| 1395 | const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, |
| 1396 | EmptyShell) { |
| 1397 | unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective), |
| 1398 | alignof(OMPClause *)); |
| 1399 | void *Mem = |
| 1400 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 1401 | sizeof(Stmt *) * |
| 1402 | numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd)); |
| 1403 | return new (Mem) OMPTeamsDistributeSimdDirective(CollapsedNum, NumClauses); |
| 1404 | } |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 1405 | |
| 1406 | OMPTeamsDistributeParallelForSimdDirective * |
| 1407 | OMPTeamsDistributeParallelForSimdDirective::Create( |
| 1408 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1409 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1410 | const HelperExprs &Exprs) { |
| 1411 | auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective), |
| 1412 | alignof(OMPClause *)); |
| 1413 | void *Mem = |
| 1414 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + |
| 1415 | sizeof(Stmt *) * |
| 1416 | numLoopChildren(CollapsedNum, |
| 1417 | OMPD_teams_distribute_parallel_for_simd)); |
| 1418 | OMPTeamsDistributeParallelForSimdDirective *Dir = new (Mem) |
| 1419 | OMPTeamsDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum, |
| 1420 | Clauses.size()); |
| 1421 | Dir->setClauses(Clauses); |
| 1422 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1423 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1424 | Dir->setLastIteration(Exprs.LastIteration); |
| 1425 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1426 | Dir->setPreCond(Exprs.PreCond); |
| 1427 | Dir->setCond(Exprs.Cond); |
| 1428 | Dir->setInit(Exprs.Init); |
| 1429 | Dir->setInc(Exprs.Inc); |
| 1430 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1431 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1432 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1433 | Dir->setStrideVariable(Exprs.ST); |
| 1434 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1435 | Dir->setNextLowerBound(Exprs.NLB); |
| 1436 | Dir->setNextUpperBound(Exprs.NUB); |
| 1437 | Dir->setNumIterations(Exprs.NumIterations); |
| 1438 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 1439 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 1440 | Dir->setDistInc(Exprs.DistInc); |
| 1441 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 1442 | Dir->setCounters(Exprs.Counters); |
| 1443 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1444 | Dir->setInits(Exprs.Inits); |
| 1445 | Dir->setUpdates(Exprs.Updates); |
| 1446 | Dir->setFinals(Exprs.Finals); |
| 1447 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 1448 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 1449 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 1450 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 1451 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 1452 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 1453 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 1454 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 1455 | return Dir; |
| 1456 | } |
| 1457 | |
| 1458 | OMPTeamsDistributeParallelForSimdDirective * |
| 1459 | OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C, |
| 1460 | unsigned NumClauses, |
| 1461 | unsigned CollapsedNum, |
| 1462 | EmptyShell) { |
| 1463 | auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective), |
| 1464 | alignof(OMPClause *)); |
| 1465 | void *Mem = |
| 1466 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + |
| 1467 | sizeof(Stmt *) * |
| 1468 | numLoopChildren(CollapsedNum, |
| 1469 | OMPD_teams_distribute_parallel_for_simd)); |
| 1470 | return new (Mem) |
| 1471 | OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses); |
| 1472 | } |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 1473 | |
| 1474 | OMPTeamsDistributeParallelForDirective * |
| 1475 | OMPTeamsDistributeParallelForDirective::Create( |
| 1476 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1477 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1478 | const HelperExprs &Exprs) { |
| 1479 | auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective), |
| 1480 | alignof(OMPClause *)); |
| 1481 | void *Mem = C.Allocate( |
| 1482 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1483 | sizeof(Stmt *) * |
| 1484 | numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for)); |
| 1485 | OMPTeamsDistributeParallelForDirective *Dir = new (Mem) |
| 1486 | OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum, |
| 1487 | Clauses.size()); |
| 1488 | Dir->setClauses(Clauses); |
| 1489 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1490 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1491 | Dir->setLastIteration(Exprs.LastIteration); |
| 1492 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1493 | Dir->setPreCond(Exprs.PreCond); |
| 1494 | Dir->setCond(Exprs.Cond); |
| 1495 | Dir->setInit(Exprs.Init); |
| 1496 | Dir->setInc(Exprs.Inc); |
| 1497 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1498 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1499 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1500 | Dir->setStrideVariable(Exprs.ST); |
| 1501 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1502 | Dir->setNextLowerBound(Exprs.NLB); |
| 1503 | Dir->setNextUpperBound(Exprs.NUB); |
| 1504 | Dir->setNumIterations(Exprs.NumIterations); |
| 1505 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 1506 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 1507 | Dir->setDistInc(Exprs.DistInc); |
| 1508 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 1509 | Dir->setCounters(Exprs.Counters); |
| 1510 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1511 | Dir->setInits(Exprs.Inits); |
| 1512 | Dir->setUpdates(Exprs.Updates); |
| 1513 | Dir->setFinals(Exprs.Finals); |
| 1514 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 1515 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 1516 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 1517 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 1518 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 1519 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 1520 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 1521 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 1522 | return Dir; |
| 1523 | } |
| 1524 | |
| 1525 | OMPTeamsDistributeParallelForDirective * |
| 1526 | OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C, |
| 1527 | unsigned NumClauses, |
| 1528 | unsigned CollapsedNum, |
| 1529 | EmptyShell) { |
| 1530 | auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective), |
| 1531 | alignof(OMPClause *)); |
| 1532 | void *Mem = C.Allocate( |
| 1533 | Size + sizeof(OMPClause *) * NumClauses + |
| 1534 | sizeof(Stmt *) * |
| 1535 | numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for)); |
| 1536 | return new (Mem) |
| 1537 | OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses); |
| 1538 | } |
| 1539 | |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 1540 | OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create( |
| 1541 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1542 | ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { |
| 1543 | auto Size = |
| 1544 | llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *)); |
| 1545 | void *Mem = |
| 1546 | C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); |
| 1547 | OMPTargetTeamsDirective *Dir = |
| 1548 | new (Mem) OMPTargetTeamsDirective(StartLoc, EndLoc, Clauses.size()); |
| 1549 | Dir->setClauses(Clauses); |
| 1550 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1551 | return Dir; |
| 1552 | } |
| 1553 | |
| 1554 | OMPTargetTeamsDirective * |
| 1555 | OMPTargetTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, |
| 1556 | EmptyShell) { |
| 1557 | auto Size = |
| 1558 | llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *)); |
| 1559 | void *Mem = |
| 1560 | C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); |
| 1561 | return new (Mem) OMPTargetTeamsDirective(NumClauses); |
| 1562 | } |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 1563 | |
| 1564 | OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create( |
| 1565 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1566 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1567 | const HelperExprs &Exprs) { |
| 1568 | auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective), |
| 1569 | alignof(OMPClause *)); |
| 1570 | void *Mem = C.Allocate( |
| 1571 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1572 | sizeof(Stmt *) * |
| 1573 | numLoopChildren(CollapsedNum, OMPD_target_teams_distribute)); |
| 1574 | OMPTargetTeamsDistributeDirective *Dir = |
| 1575 | new (Mem) OMPTargetTeamsDistributeDirective(StartLoc, EndLoc, CollapsedNum, |
| 1576 | Clauses.size()); |
| 1577 | Dir->setClauses(Clauses); |
| 1578 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1579 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1580 | Dir->setLastIteration(Exprs.LastIteration); |
| 1581 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1582 | Dir->setPreCond(Exprs.PreCond); |
| 1583 | Dir->setCond(Exprs.Cond); |
| 1584 | Dir->setInit(Exprs.Init); |
| 1585 | Dir->setInc(Exprs.Inc); |
| 1586 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1587 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1588 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1589 | Dir->setStrideVariable(Exprs.ST); |
| 1590 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1591 | Dir->setNextLowerBound(Exprs.NLB); |
| 1592 | Dir->setNextUpperBound(Exprs.NUB); |
| 1593 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 1594 | Dir->setCounters(Exprs.Counters); |
| 1595 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1596 | Dir->setInits(Exprs.Inits); |
| 1597 | Dir->setUpdates(Exprs.Updates); |
| 1598 | Dir->setFinals(Exprs.Finals); |
| 1599 | Dir->setPreInits(Exprs.PreInits); |
| 1600 | return Dir; |
| 1601 | } |
| 1602 | |
| 1603 | OMPTargetTeamsDistributeDirective * |
| 1604 | OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C, |
| 1605 | unsigned NumClauses, |
| 1606 | unsigned CollapsedNum, |
| 1607 | EmptyShell) { |
| 1608 | auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective), |
| 1609 | alignof(OMPClause *)); |
| 1610 | void *Mem = C.Allocate( |
| 1611 | Size + sizeof(OMPClause *) * NumClauses + |
| 1612 | sizeof(Stmt *) * |
| 1613 | numLoopChildren(CollapsedNum, OMPD_target_teams_distribute)); |
| 1614 | return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses); |
| 1615 | } |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 1616 | |
| 1617 | OMPTargetTeamsDistributeParallelForDirective * |
| 1618 | OMPTargetTeamsDistributeParallelForDirective::Create( |
| 1619 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1620 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1621 | const HelperExprs &Exprs) { |
| 1622 | auto Size = |
| 1623 | llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective), |
| 1624 | alignof(OMPClause *)); |
| 1625 | void *Mem = C.Allocate( |
| 1626 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1627 | sizeof(Stmt *) * |
| 1628 | numLoopChildren(CollapsedNum, |
| 1629 | OMPD_target_teams_distribute_parallel_for)); |
| 1630 | OMPTargetTeamsDistributeParallelForDirective *Dir = |
| 1631 | new (Mem) OMPTargetTeamsDistributeParallelForDirective( |
| 1632 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1633 | Dir->setClauses(Clauses); |
| 1634 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1635 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1636 | Dir->setLastIteration(Exprs.LastIteration); |
| 1637 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1638 | Dir->setPreCond(Exprs.PreCond); |
| 1639 | Dir->setCond(Exprs.Cond); |
| 1640 | Dir->setInit(Exprs.Init); |
| 1641 | Dir->setInc(Exprs.Inc); |
| 1642 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1643 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1644 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1645 | Dir->setStrideVariable(Exprs.ST); |
| 1646 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1647 | Dir->setNextLowerBound(Exprs.NLB); |
| 1648 | Dir->setNextUpperBound(Exprs.NUB); |
| 1649 | Dir->setNumIterations(Exprs.NumIterations); |
| 1650 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 1651 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 1652 | Dir->setDistInc(Exprs.DistInc); |
| 1653 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 1654 | Dir->setCounters(Exprs.Counters); |
| 1655 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1656 | Dir->setInits(Exprs.Inits); |
| 1657 | Dir->setUpdates(Exprs.Updates); |
| 1658 | Dir->setFinals(Exprs.Finals); |
| 1659 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 1660 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 1661 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 1662 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 1663 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 1664 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 1665 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 1666 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 1667 | return Dir; |
| 1668 | } |
| 1669 | |
| 1670 | OMPTargetTeamsDistributeParallelForDirective * |
| 1671 | OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C, |
| 1672 | unsigned NumClauses, |
| 1673 | unsigned CollapsedNum, |
| 1674 | EmptyShell) { |
| 1675 | auto Size = |
| 1676 | llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective), |
| 1677 | alignof(OMPClause *)); |
| 1678 | void *Mem = C.Allocate( |
| 1679 | Size + sizeof(OMPClause *) * NumClauses + |
| 1680 | sizeof(Stmt *) * |
| 1681 | numLoopChildren(CollapsedNum, |
| 1682 | OMPD_target_teams_distribute_parallel_for)); |
| 1683 | return new (Mem) |
| 1684 | OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses); |
| 1685 | } |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 1686 | |
| 1687 | OMPTargetTeamsDistributeParallelForSimdDirective * |
| 1688 | OMPTargetTeamsDistributeParallelForSimdDirective::Create( |
| 1689 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1690 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1691 | const HelperExprs &Exprs) { |
| 1692 | auto Size = |
| 1693 | llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective), |
| 1694 | alignof(OMPClause *)); |
| 1695 | void *Mem = C.Allocate( |
| 1696 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1697 | sizeof(Stmt *) * |
| 1698 | numLoopChildren(CollapsedNum, |
| 1699 | OMPD_target_teams_distribute_parallel_for_simd)); |
| 1700 | OMPTargetTeamsDistributeParallelForSimdDirective *Dir = |
| 1701 | new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective( |
| 1702 | StartLoc, EndLoc, CollapsedNum, Clauses.size()); |
| 1703 | Dir->setClauses(Clauses); |
| 1704 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1705 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1706 | Dir->setLastIteration(Exprs.LastIteration); |
| 1707 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1708 | Dir->setPreCond(Exprs.PreCond); |
| 1709 | Dir->setCond(Exprs.Cond); |
| 1710 | Dir->setInit(Exprs.Init); |
| 1711 | Dir->setInc(Exprs.Inc); |
| 1712 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1713 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1714 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1715 | Dir->setStrideVariable(Exprs.ST); |
| 1716 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1717 | Dir->setNextLowerBound(Exprs.NLB); |
| 1718 | Dir->setNextUpperBound(Exprs.NUB); |
| 1719 | Dir->setNumIterations(Exprs.NumIterations); |
| 1720 | Dir->setPrevLowerBoundVariable(Exprs.PrevLB); |
| 1721 | Dir->setPrevUpperBoundVariable(Exprs.PrevUB); |
Carlo Bertolli | 8429d81 | 2017-02-17 21:29:13 +0000 | [diff] [blame] | 1722 | Dir->setDistInc(Exprs.DistInc); |
| 1723 | Dir->setPrevEnsureUpperBound(Exprs.PrevEUB); |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 1724 | Dir->setCounters(Exprs.Counters); |
| 1725 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1726 | Dir->setInits(Exprs.Inits); |
| 1727 | Dir->setUpdates(Exprs.Updates); |
| 1728 | Dir->setFinals(Exprs.Finals); |
| 1729 | Dir->setPreInits(Exprs.PreInits); |
Carlo Bertolli | ffafe10 | 2017-04-20 00:39:39 +0000 | [diff] [blame] | 1730 | Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB); |
| 1731 | Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB); |
| 1732 | Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB); |
| 1733 | Dir->setCombinedInit(Exprs.DistCombinedFields.Init); |
| 1734 | Dir->setCombinedCond(Exprs.DistCombinedFields.Cond); |
| 1735 | Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB); |
| 1736 | Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB); |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 1737 | return Dir; |
| 1738 | } |
| 1739 | |
| 1740 | OMPTargetTeamsDistributeParallelForSimdDirective * |
| 1741 | OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty( |
| 1742 | const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, |
| 1743 | EmptyShell) { |
| 1744 | auto Size = |
| 1745 | llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective), |
| 1746 | alignof(OMPClause *)); |
| 1747 | void *Mem = C.Allocate( |
| 1748 | Size + sizeof(OMPClause *) * NumClauses + |
| 1749 | sizeof(Stmt *) * |
| 1750 | numLoopChildren(CollapsedNum, |
| 1751 | OMPD_target_teams_distribute_parallel_for_simd)); |
| 1752 | return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective( |
| 1753 | CollapsedNum, NumClauses); |
| 1754 | } |
| 1755 | |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 1756 | OMPTargetTeamsDistributeSimdDirective * |
| 1757 | OMPTargetTeamsDistributeSimdDirective::Create( |
| 1758 | const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, |
| 1759 | unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, |
| 1760 | const HelperExprs &Exprs) { |
| 1761 | auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective), |
| 1762 | alignof(OMPClause *)); |
| 1763 | void *Mem = C.Allocate( |
| 1764 | Size + sizeof(OMPClause *) * Clauses.size() + |
| 1765 | sizeof(Stmt *) * |
| 1766 | numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd)); |
| 1767 | OMPTargetTeamsDistributeSimdDirective *Dir = new (Mem) |
| 1768 | OMPTargetTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum, |
| 1769 | Clauses.size()); |
| 1770 | Dir->setClauses(Clauses); |
| 1771 | Dir->setAssociatedStmt(AssociatedStmt); |
| 1772 | Dir->setIterationVariable(Exprs.IterationVarRef); |
| 1773 | Dir->setLastIteration(Exprs.LastIteration); |
| 1774 | Dir->setCalcLastIteration(Exprs.CalcLastIteration); |
| 1775 | Dir->setPreCond(Exprs.PreCond); |
| 1776 | Dir->setCond(Exprs.Cond); |
| 1777 | Dir->setInit(Exprs.Init); |
| 1778 | Dir->setInc(Exprs.Inc); |
| 1779 | Dir->setIsLastIterVariable(Exprs.IL); |
| 1780 | Dir->setLowerBoundVariable(Exprs.LB); |
| 1781 | Dir->setUpperBoundVariable(Exprs.UB); |
| 1782 | Dir->setStrideVariable(Exprs.ST); |
| 1783 | Dir->setEnsureUpperBound(Exprs.EUB); |
| 1784 | Dir->setNextLowerBound(Exprs.NLB); |
| 1785 | Dir->setNextUpperBound(Exprs.NUB); |
| 1786 | Dir->setNumIterations(Exprs.NumIterations); |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 1787 | Dir->setCounters(Exprs.Counters); |
| 1788 | Dir->setPrivateCounters(Exprs.PrivateCounters); |
| 1789 | Dir->setInits(Exprs.Inits); |
| 1790 | Dir->setUpdates(Exprs.Updates); |
| 1791 | Dir->setFinals(Exprs.Finals); |
| 1792 | Dir->setPreInits(Exprs.PreInits); |
| 1793 | return Dir; |
| 1794 | } |
| 1795 | |
| 1796 | OMPTargetTeamsDistributeSimdDirective * |
| 1797 | OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C, |
| 1798 | unsigned NumClauses, |
| 1799 | unsigned CollapsedNum, |
| 1800 | EmptyShell) { |
| 1801 | auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective), |
| 1802 | alignof(OMPClause *)); |
| 1803 | void *Mem = C.Allocate( |
| 1804 | Size + sizeof(OMPClause *) * NumClauses + |
| 1805 | sizeof(Stmt *) * |
| 1806 | numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd)); |
| 1807 | return new (Mem) |
| 1808 | OMPTargetTeamsDistributeSimdDirective(CollapsedNum, NumClauses); |
| 1809 | } |