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