1 //===- StmtOpenMP.h - Classes for OpenMP directives ------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 /// This file defines OpenMP AST classes for executable directives and
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_AST_STMTOPENMP_H
15 #define LLVM_CLANG_AST_STMTOPENMP_H
17 #include "clang/AST/Expr.h"
18 #include "clang/AST/OpenMPClause.h"
19 #include "clang/AST/Stmt.h"
20 #include "clang/AST/StmtCXX.h"
21 #include "clang/Basic/OpenMPKinds.h"
22 #include "clang/Basic/SourceLocation.h"
26 //===----------------------------------------------------------------------===//
27 // AST classes for directives.
28 //===----------------------------------------------------------------------===//
30 /// This is a basic class for representing single OpenMP executable
33 class OMPExecutableDirective : public Stmt {
34 friend class ASTStmtReader;
35 /// Kind of the directive.
36 OpenMPDirectiveKind Kind;
37 /// Starting location of the directive (directive keyword).
38 SourceLocation StartLoc;
39 /// Ending location of the directive.
40 SourceLocation EndLoc;
41 /// Numbers of clauses.
42 const unsigned NumClauses;
43 /// Number of child expressions/stmts.
44 const unsigned NumChildren;
45 /// Offset from this to the start of clauses.
46 /// There are NumClauses pointers to clauses, they are followed by
47 /// NumChildren pointers to child stmts/exprs (if the directive type
48 /// requires an associated stmt, then it has to be the first of them).
49 const unsigned ClausesOffset;
51 /// Get the clauses storage.
52 MutableArrayRef<OMPClause *> getClauses() {
53 OMPClause **ClauseStorage = reinterpret_cast<OMPClause **>(
54 reinterpret_cast<char *>(this) + ClausesOffset);
55 return MutableArrayRef<OMPClause *>(ClauseStorage, NumClauses);
59 /// Build instance of directive of class \a K.
61 /// \param SC Statement class.
62 /// \param K Kind of OpenMP directive.
63 /// \param StartLoc Starting location of the directive (directive keyword).
64 /// \param EndLoc Ending location of the directive.
67 OMPExecutableDirective(const T *, StmtClass SC, OpenMPDirectiveKind K,
68 SourceLocation StartLoc, SourceLocation EndLoc,
69 unsigned NumClauses, unsigned NumChildren)
70 : Stmt(SC), Kind(K), StartLoc(std::move(StartLoc)),
71 EndLoc(std::move(EndLoc)), NumClauses(NumClauses),
72 NumChildren(NumChildren),
73 ClausesOffset(llvm::alignTo(sizeof(T), alignof(OMPClause *))) {}
75 /// Sets the list of variables for this clause.
77 /// \param Clauses The list of clauses for the directive.
79 void setClauses(ArrayRef<OMPClause *> Clauses);
81 /// Set the associated statement for the directive.
83 /// /param S Associated statement.
85 void setAssociatedStmt(Stmt *S) {
86 assert(hasAssociatedStmt() && "no associated statement.");
91 /// Iterates over expressions/statements used in the construct.
92 class used_clauses_child_iterator
93 : public llvm::iterator_adaptor_base<
94 used_clauses_child_iterator, ArrayRef<OMPClause *>::iterator,
95 std::forward_iterator_tag, Stmt *, ptrdiff_t, Stmt *, Stmt *> {
96 ArrayRef<OMPClause *>::iterator End;
97 OMPClause::child_iterator ChildI, ChildEnd;
100 if (ChildI != ChildEnd)
102 while (this->I != End) {
104 if (this->I != End) {
105 ChildI = (*this->I)->used_children().begin();
106 ChildEnd = (*this->I)->used_children().end();
107 if (ChildI != ChildEnd)
114 explicit used_clauses_child_iterator(ArrayRef<OMPClause *> Clauses)
115 : used_clauses_child_iterator::iterator_adaptor_base(Clauses.begin()),
117 if (this->I != End) {
118 ChildI = (*this->I)->used_children().begin();
119 ChildEnd = (*this->I)->used_children().end();
123 Stmt *operator*() const { return *ChildI; }
124 Stmt *operator->() const { return **this; }
126 used_clauses_child_iterator &operator++() {
128 if (ChildI != ChildEnd)
130 if (this->I != End) {
132 if (this->I != End) {
133 ChildI = (*this->I)->used_children().begin();
134 ChildEnd = (*this->I)->used_children().end();
142 static llvm::iterator_range<used_clauses_child_iterator>
143 used_clauses_children(ArrayRef<OMPClause *> Clauses) {
144 return {used_clauses_child_iterator(Clauses),
145 used_clauses_child_iterator(llvm::makeArrayRef(Clauses.end(), 0))};
148 /// Iterates over a filtered subrange of clauses applied to a
151 /// This iterator visits only clauses of type SpecificClause.
152 template <typename SpecificClause>
153 class specific_clause_iterator
154 : public llvm::iterator_adaptor_base<
155 specific_clause_iterator<SpecificClause>,
156 ArrayRef<OMPClause *>::const_iterator, std::forward_iterator_tag,
157 const SpecificClause *, ptrdiff_t, const SpecificClause *,
158 const SpecificClause *> {
159 ArrayRef<OMPClause *>::const_iterator End;
161 void SkipToNextClause() {
162 while (this->I != End && !isa<SpecificClause>(*this->I))
167 explicit specific_clause_iterator(ArrayRef<OMPClause *> Clauses)
168 : specific_clause_iterator::iterator_adaptor_base(Clauses.begin()),
173 const SpecificClause *operator*() const {
174 return cast<SpecificClause>(*this->I);
176 const SpecificClause *operator->() const { return **this; }
178 specific_clause_iterator &operator++() {
185 template <typename SpecificClause>
186 static llvm::iterator_range<specific_clause_iterator<SpecificClause>>
187 getClausesOfKind(ArrayRef<OMPClause *> Clauses) {
188 return {specific_clause_iterator<SpecificClause>(Clauses),
189 specific_clause_iterator<SpecificClause>(
190 llvm::makeArrayRef(Clauses.end(), 0))};
193 template <typename SpecificClause>
194 llvm::iterator_range<specific_clause_iterator<SpecificClause>>
195 getClausesOfKind() const {
196 return getClausesOfKind<SpecificClause>(clauses());
199 /// Gets a single clause of the specified kind associated with the
200 /// current directive iff there is only one clause of this kind (and assertion
201 /// is fired if there is more than one clause is associated with the
202 /// directive). Returns nullptr if no clause of this kind is associated with
204 template <typename SpecificClause>
205 const SpecificClause *getSingleClause() const {
206 auto Clauses = getClausesOfKind<SpecificClause>();
208 if (Clauses.begin() != Clauses.end()) {
209 assert(std::next(Clauses.begin()) == Clauses.end() &&
210 "There are at least 2 clauses of the specified kind");
211 return *Clauses.begin();
216 /// Returns true if the current directive has one or more clauses of a
218 template <typename SpecificClause>
219 bool hasClausesOfKind() const {
220 auto Clauses = getClausesOfKind<SpecificClause>();
221 return Clauses.begin() != Clauses.end();
224 /// Returns starting location of directive kind.
225 SourceLocation getBeginLoc() const { return StartLoc; }
226 /// Returns ending location of directive.
227 SourceLocation getEndLoc() const { return EndLoc; }
229 /// Set starting location of directive kind.
231 /// \param Loc New starting location of directive.
233 void setLocStart(SourceLocation Loc) { StartLoc = Loc; }
234 /// Set ending location of directive.
236 /// \param Loc New ending location of directive.
238 void setLocEnd(SourceLocation Loc) { EndLoc = Loc; }
240 /// Get number of clauses.
241 unsigned getNumClauses() const { return NumClauses; }
243 /// Returns specified clause.
245 /// \param i Number of clause.
247 OMPClause *getClause(unsigned i) const { return clauses()[i]; }
249 /// Returns true if directive has associated statement.
250 bool hasAssociatedStmt() const { return NumChildren > 0; }
252 /// Returns statement associated with the directive.
253 const Stmt *getAssociatedStmt() const {
254 assert(hasAssociatedStmt() && "no associated statement.");
255 return *child_begin();
257 Stmt *getAssociatedStmt() {
258 assert(hasAssociatedStmt() && "no associated statement.");
259 return *child_begin();
262 /// Returns the captured statement associated with the
263 /// component region within the (combined) directive.
265 // \param RegionKind Component region kind.
266 const CapturedStmt *getCapturedStmt(OpenMPDirectiveKind RegionKind) const {
267 SmallVector<OpenMPDirectiveKind, 4> CaptureRegions;
268 getOpenMPCaptureRegions(CaptureRegions, getDirectiveKind());
270 CaptureRegions.begin(), CaptureRegions.end(),
271 [=](const OpenMPDirectiveKind K) { return K == RegionKind; }) &&
272 "RegionKind not found in OpenMP CaptureRegions.");
273 auto *CS = cast<CapturedStmt>(getAssociatedStmt());
274 for (auto ThisCaptureRegion : CaptureRegions) {
275 if (ThisCaptureRegion == RegionKind)
277 CS = cast<CapturedStmt>(CS->getCapturedStmt());
279 llvm_unreachable("Incorrect RegionKind specified for directive.");
282 /// Get innermost captured statement for the construct.
283 CapturedStmt *getInnermostCapturedStmt() {
284 assert(hasAssociatedStmt() && getAssociatedStmt() &&
285 "Must have associated statement.");
286 SmallVector<OpenMPDirectiveKind, 4> CaptureRegions;
287 getOpenMPCaptureRegions(CaptureRegions, getDirectiveKind());
288 assert(!CaptureRegions.empty() &&
289 "At least one captured statement must be provided.");
290 auto *CS = cast<CapturedStmt>(getAssociatedStmt());
291 for (unsigned Level = CaptureRegions.size(); Level > 1; --Level)
292 CS = cast<CapturedStmt>(CS->getCapturedStmt());
296 const CapturedStmt *getInnermostCapturedStmt() const {
297 return const_cast<OMPExecutableDirective *>(this)
298 ->getInnermostCapturedStmt();
301 OpenMPDirectiveKind getDirectiveKind() const { return Kind; }
303 static bool classof(const Stmt *S) {
304 return S->getStmtClass() >= firstOMPExecutableDirectiveConstant &&
305 S->getStmtClass() <= lastOMPExecutableDirectiveConstant;
308 child_range children() {
309 if (!hasAssociatedStmt())
310 return child_range(child_iterator(), child_iterator());
311 Stmt **ChildStorage = reinterpret_cast<Stmt **>(getClauses().end());
312 /// Do not mark all the special expression/statements as children, except
313 /// for the associated statement.
314 return child_range(ChildStorage, ChildStorage + 1);
317 const_child_range children() const {
318 if (!hasAssociatedStmt())
319 return const_child_range(const_child_iterator(), const_child_iterator());
320 Stmt **ChildStorage = reinterpret_cast<Stmt **>(
321 const_cast<OMPExecutableDirective *>(this)->getClauses().end());
322 return const_child_range(ChildStorage, ChildStorage + 1);
325 ArrayRef<OMPClause *> clauses() { return getClauses(); }
327 ArrayRef<OMPClause *> clauses() const {
328 return const_cast<OMPExecutableDirective *>(this)->getClauses();
331 /// Returns whether or not this is a Standalone directive.
333 /// Stand-alone directives are executable directives
334 /// that have no associated user code.
335 bool isStandaloneDirective() const;
337 /// Returns the AST node representing OpenMP structured-block of this
338 /// OpenMP executable directive,
339 /// Prerequisite: Executable Directive must not be Standalone directive.
340 const Stmt *getStructuredBlock() const;
342 Stmt *getStructuredBlock() {
343 return const_cast<Stmt *>(
344 const_cast<const OMPExecutableDirective *>(this)->getStructuredBlock());
348 /// This represents '#pragma omp parallel' directive.
351 /// #pragma omp parallel private(a,b) reduction(+: c,d)
353 /// In this example directive '#pragma omp parallel' has clauses 'private'
354 /// with the variables 'a' and 'b' and 'reduction' with operator '+' and
355 /// variables 'c' and 'd'.
357 class OMPParallelDirective : public OMPExecutableDirective {
358 friend class ASTStmtReader;
359 /// true if the construct has inner cancel directive.
362 /// Build directive with the given start and end location.
364 /// \param StartLoc Starting location of the directive (directive keyword).
365 /// \param EndLoc Ending Location of the directive.
367 OMPParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc,
369 : OMPExecutableDirective(this, OMPParallelDirectiveClass, OMPD_parallel,
370 StartLoc, EndLoc, NumClauses, 1),
373 /// Build an empty directive.
375 /// \param NumClauses Number of clauses.
377 explicit OMPParallelDirective(unsigned NumClauses)
378 : OMPExecutableDirective(this, OMPParallelDirectiveClass, OMPD_parallel,
379 SourceLocation(), SourceLocation(), NumClauses,
383 /// Set cancel state.
384 void setHasCancel(bool Has) { HasCancel = Has; }
387 /// Creates directive with a list of \a Clauses.
389 /// \param C AST context.
390 /// \param StartLoc Starting location of the directive kind.
391 /// \param EndLoc Ending Location of the directive.
392 /// \param Clauses List of clauses.
393 /// \param AssociatedStmt Statement associated with the directive.
394 /// \param HasCancel true if this directive has inner cancel directive.
396 static OMPParallelDirective *
397 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
398 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel);
400 /// Creates an empty directive with the place for \a N clauses.
402 /// \param C AST context.
403 /// \param NumClauses Number of clauses.
405 static OMPParallelDirective *CreateEmpty(const ASTContext &C,
406 unsigned NumClauses, EmptyShell);
408 /// Return true if current directive has inner cancel directive.
409 bool hasCancel() const { return HasCancel; }
411 static bool classof(const Stmt *T) {
412 return T->getStmtClass() == OMPParallelDirectiveClass;
416 /// This is a common base class for loop directives ('omp simd', 'omp
417 /// for', 'omp for simd' etc.). It is responsible for the loop code generation.
419 class OMPLoopDirective : public OMPExecutableDirective {
420 friend class ASTStmtReader;
421 /// Number of collapsed loops as specified by 'collapse' clause.
422 unsigned CollapsedNum;
424 /// Offsets to the stored exprs.
425 /// This enumeration contains offsets to all the pointers to children
426 /// expressions stored in OMPLoopDirective.
427 /// The first 9 children are necessary for all the loop directives,
428 /// the next 8 are specific to the worksharing ones, and the next 11 are
429 /// used for combined constructs containing two pragmas associated to loops.
430 /// After the fixed children, three arrays of length CollapsedNum are
431 /// allocated: loop counters, their updates and final values.
432 /// PrevLowerBound and PrevUpperBound are used to communicate blocking
433 /// information in composite constructs which require loop blocking
434 /// DistInc is used to generate the increment expression for the distribute
435 /// loop when combined with a further nested loop
436 /// PrevEnsureUpperBound is used as the EnsureUpperBound expression for the
437 /// for loop when combined with a previous distribute loop in the same pragma
438 /// (e.g. 'distribute parallel for')
441 AssociatedStmtOffset = 0,
442 IterationVariableOffset = 1,
443 LastIterationOffset = 2,
444 CalcLastIterationOffset = 3,
445 PreConditionOffset = 4,
450 // The '...End' enumerators do not correspond to child expressions - they
451 // specify the offset to the end (and start of the following counters/
452 // updates/finals/dependent_counters/dependent_inits/finals_conditions
455 // The following 8 exprs are used by worksharing and distribute loops only.
456 IsLastIterVariableOffset = 9,
457 LowerBoundVariableOffset = 10,
458 UpperBoundVariableOffset = 11,
459 StrideVariableOffset = 12,
460 EnsureUpperBoundOffset = 13,
461 NextLowerBoundOffset = 14,
462 NextUpperBoundOffset = 15,
463 NumIterationsOffset = 16,
464 // Offset to the end for worksharing loop directives.
466 PrevLowerBoundVariableOffset = 17,
467 PrevUpperBoundVariableOffset = 18,
469 PrevEnsureUpperBoundOffset = 20,
470 CombinedLowerBoundVariableOffset = 21,
471 CombinedUpperBoundVariableOffset = 22,
472 CombinedEnsureUpperBoundOffset = 23,
473 CombinedInitOffset = 24,
474 CombinedConditionOffset = 25,
475 CombinedNextLowerBoundOffset = 26,
476 CombinedNextUpperBoundOffset = 27,
477 CombinedDistConditionOffset = 28,
478 CombinedParForInDistConditionOffset = 29,
479 // Offset to the end (and start of the following
480 // counters/updates/finals/dependent_counters/dependent_inits/finals_conditions
481 // arrays) for combined distribute loop directives.
482 CombinedDistributeEnd = 30,
485 /// Get the counters storage.
486 MutableArrayRef<Expr *> getCounters() {
487 Expr **Storage = reinterpret_cast<Expr **>(
488 &(*(std::next(child_begin(), getArraysOffset(getDirectiveKind())))));
489 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
492 /// Get the private counters storage.
493 MutableArrayRef<Expr *> getPrivateCounters() {
494 Expr **Storage = reinterpret_cast<Expr **>(&*std::next(
495 child_begin(), getArraysOffset(getDirectiveKind()) + CollapsedNum));
496 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
499 /// Get the updates storage.
500 MutableArrayRef<Expr *> getInits() {
501 Expr **Storage = reinterpret_cast<Expr **>(
502 &*std::next(child_begin(),
503 getArraysOffset(getDirectiveKind()) + 2 * CollapsedNum));
504 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
507 /// Get the updates storage.
508 MutableArrayRef<Expr *> getUpdates() {
509 Expr **Storage = reinterpret_cast<Expr **>(
510 &*std::next(child_begin(),
511 getArraysOffset(getDirectiveKind()) + 3 * CollapsedNum));
512 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
515 /// Get the final counter updates storage.
516 MutableArrayRef<Expr *> getFinals() {
517 Expr **Storage = reinterpret_cast<Expr **>(
518 &*std::next(child_begin(),
519 getArraysOffset(getDirectiveKind()) + 4 * CollapsedNum));
520 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
523 /// Get the dependent counters storage.
524 MutableArrayRef<Expr *> getDependentCounters() {
525 Expr **Storage = reinterpret_cast<Expr **>(
526 &*std::next(child_begin(),
527 getArraysOffset(getDirectiveKind()) + 5 * CollapsedNum));
528 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
531 /// Get the dependent inits storage.
532 MutableArrayRef<Expr *> getDependentInits() {
533 Expr **Storage = reinterpret_cast<Expr **>(
534 &*std::next(child_begin(),
535 getArraysOffset(getDirectiveKind()) + 6 * CollapsedNum));
536 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
539 /// Get the finals conditions storage.
540 MutableArrayRef<Expr *> getFinalsConditions() {
541 Expr **Storage = reinterpret_cast<Expr **>(
542 &*std::next(child_begin(),
543 getArraysOffset(getDirectiveKind()) + 7 * CollapsedNum));
544 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
548 /// Build instance of loop directive of class \a Kind.
550 /// \param SC Statement class.
551 /// \param Kind Kind of OpenMP directive.
552 /// \param StartLoc Starting location of the directive (directive keyword).
553 /// \param EndLoc Ending location of the directive.
554 /// \param CollapsedNum Number of collapsed loops from 'collapse' clause.
555 /// \param NumClauses Number of clauses.
556 /// \param NumSpecialChildren Number of additional directive-specific stmts.
558 template <typename T>
559 OMPLoopDirective(const T *That, StmtClass SC, OpenMPDirectiveKind Kind,
560 SourceLocation StartLoc, SourceLocation EndLoc,
561 unsigned CollapsedNum, unsigned NumClauses,
562 unsigned NumSpecialChildren = 0)
563 : OMPExecutableDirective(That, SC, Kind, StartLoc, EndLoc, NumClauses,
564 numLoopChildren(CollapsedNum, Kind) +
566 CollapsedNum(CollapsedNum) {}
568 /// Offset to the start of children expression arrays.
569 static unsigned getArraysOffset(OpenMPDirectiveKind Kind) {
570 if (isOpenMPLoopBoundSharingDirective(Kind))
571 return CombinedDistributeEnd;
572 if (isOpenMPWorksharingDirective(Kind) || isOpenMPTaskLoopDirective(Kind) ||
573 isOpenMPDistributeDirective(Kind))
574 return WorksharingEnd;
579 static unsigned numLoopChildren(unsigned CollapsedNum,
580 OpenMPDirectiveKind Kind) {
581 return getArraysOffset(Kind) +
582 8 * CollapsedNum; // Counters, PrivateCounters, Inits,
583 // Updates, Finals, DependentCounters,
584 // DependentInits, FinalsConditions.
587 void setIterationVariable(Expr *IV) {
588 *std::next(child_begin(), IterationVariableOffset) = IV;
590 void setLastIteration(Expr *LI) {
591 *std::next(child_begin(), LastIterationOffset) = LI;
593 void setCalcLastIteration(Expr *CLI) {
594 *std::next(child_begin(), CalcLastIterationOffset) = CLI;
596 void setPreCond(Expr *PC) {
597 *std::next(child_begin(), PreConditionOffset) = PC;
599 void setCond(Expr *Cond) {
600 *std::next(child_begin(), CondOffset) = Cond;
602 void setInit(Expr *Init) { *std::next(child_begin(), InitOffset) = Init; }
603 void setInc(Expr *Inc) { *std::next(child_begin(), IncOffset) = Inc; }
604 void setPreInits(Stmt *PreInits) {
605 *std::next(child_begin(), PreInitsOffset) = PreInits;
607 void setIsLastIterVariable(Expr *IL) {
608 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
609 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
610 isOpenMPDistributeDirective(getDirectiveKind())) &&
611 "expected worksharing loop directive");
612 *std::next(child_begin(), IsLastIterVariableOffset) = IL;
614 void setLowerBoundVariable(Expr *LB) {
615 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
616 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
617 isOpenMPDistributeDirective(getDirectiveKind())) &&
618 "expected worksharing loop directive");
619 *std::next(child_begin(), LowerBoundVariableOffset) = LB;
621 void setUpperBoundVariable(Expr *UB) {
622 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
623 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
624 isOpenMPDistributeDirective(getDirectiveKind())) &&
625 "expected worksharing loop directive");
626 *std::next(child_begin(), UpperBoundVariableOffset) = UB;
628 void setStrideVariable(Expr *ST) {
629 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
630 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
631 isOpenMPDistributeDirective(getDirectiveKind())) &&
632 "expected worksharing loop directive");
633 *std::next(child_begin(), StrideVariableOffset) = ST;
635 void setEnsureUpperBound(Expr *EUB) {
636 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
637 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
638 isOpenMPDistributeDirective(getDirectiveKind())) &&
639 "expected worksharing loop directive");
640 *std::next(child_begin(), EnsureUpperBoundOffset) = EUB;
642 void setNextLowerBound(Expr *NLB) {
643 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
644 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
645 isOpenMPDistributeDirective(getDirectiveKind())) &&
646 "expected worksharing loop directive");
647 *std::next(child_begin(), NextLowerBoundOffset) = NLB;
649 void setNextUpperBound(Expr *NUB) {
650 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
651 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
652 isOpenMPDistributeDirective(getDirectiveKind())) &&
653 "expected worksharing loop directive");
654 *std::next(child_begin(), NextUpperBoundOffset) = NUB;
656 void setNumIterations(Expr *NI) {
657 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
658 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
659 isOpenMPDistributeDirective(getDirectiveKind())) &&
660 "expected worksharing loop directive");
661 *std::next(child_begin(), NumIterationsOffset) = NI;
663 void setPrevLowerBoundVariable(Expr *PrevLB) {
664 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
665 "expected loop bound sharing directive");
666 *std::next(child_begin(), PrevLowerBoundVariableOffset) = PrevLB;
668 void setPrevUpperBoundVariable(Expr *PrevUB) {
669 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
670 "expected loop bound sharing directive");
671 *std::next(child_begin(), PrevUpperBoundVariableOffset) = PrevUB;
673 void setDistInc(Expr *DistInc) {
674 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
675 "expected loop bound sharing directive");
676 *std::next(child_begin(), DistIncOffset) = DistInc;
678 void setPrevEnsureUpperBound(Expr *PrevEUB) {
679 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
680 "expected loop bound sharing directive");
681 *std::next(child_begin(), PrevEnsureUpperBoundOffset) = PrevEUB;
683 void setCombinedLowerBoundVariable(Expr *CombLB) {
684 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
685 "expected loop bound sharing directive");
686 *std::next(child_begin(), CombinedLowerBoundVariableOffset) = CombLB;
688 void setCombinedUpperBoundVariable(Expr *CombUB) {
689 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
690 "expected loop bound sharing directive");
691 *std::next(child_begin(), CombinedUpperBoundVariableOffset) = CombUB;
693 void setCombinedEnsureUpperBound(Expr *CombEUB) {
694 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
695 "expected loop bound sharing directive");
696 *std::next(child_begin(), CombinedEnsureUpperBoundOffset) = CombEUB;
698 void setCombinedInit(Expr *CombInit) {
699 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
700 "expected loop bound sharing directive");
701 *std::next(child_begin(), CombinedInitOffset) = CombInit;
703 void setCombinedCond(Expr *CombCond) {
704 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
705 "expected loop bound sharing directive");
706 *std::next(child_begin(), CombinedConditionOffset) = CombCond;
708 void setCombinedNextLowerBound(Expr *CombNLB) {
709 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
710 "expected loop bound sharing directive");
711 *std::next(child_begin(), CombinedNextLowerBoundOffset) = CombNLB;
713 void setCombinedNextUpperBound(Expr *CombNUB) {
714 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
715 "expected loop bound sharing directive");
716 *std::next(child_begin(), CombinedNextUpperBoundOffset) = CombNUB;
718 void setCombinedDistCond(Expr *CombDistCond) {
719 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
720 "expected loop bound distribute sharing directive");
721 *std::next(child_begin(), CombinedDistConditionOffset) = CombDistCond;
723 void setCombinedParForInDistCond(Expr *CombParForInDistCond) {
724 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
725 "expected loop bound distribute sharing directive");
726 *std::next(child_begin(),
727 CombinedParForInDistConditionOffset) = CombParForInDistCond;
729 void setCounters(ArrayRef<Expr *> A);
730 void setPrivateCounters(ArrayRef<Expr *> A);
731 void setInits(ArrayRef<Expr *> A);
732 void setUpdates(ArrayRef<Expr *> A);
733 void setFinals(ArrayRef<Expr *> A);
734 void setDependentCounters(ArrayRef<Expr *> A);
735 void setDependentInits(ArrayRef<Expr *> A);
736 void setFinalsConditions(ArrayRef<Expr *> A);
739 /// The expressions built to support OpenMP loops in combined/composite
740 /// pragmas (e.g. pragma omp distribute parallel for)
741 struct DistCombinedHelperExprs {
742 /// DistributeLowerBound - used when composing 'omp distribute' with
743 /// 'omp for' in a same construct.
745 /// DistributeUpperBound - used when composing 'omp distribute' with
746 /// 'omp for' in a same construct.
748 /// DistributeEnsureUpperBound - used when composing 'omp distribute'
749 /// with 'omp for' in a same construct, EUB depends on DistUB
751 /// Distribute loop iteration variable init used when composing 'omp
753 /// with 'omp for' in a same construct
755 /// Distribute Loop condition used when composing 'omp distribute'
756 /// with 'omp for' in a same construct
758 /// Update of LowerBound for statically scheduled omp loops for
759 /// outer loop in combined constructs (e.g. 'distribute parallel for')
761 /// Update of UpperBound for statically scheduled omp loops for
762 /// outer loop in combined constructs (e.g. 'distribute parallel for')
764 /// Distribute Loop condition used when composing 'omp distribute'
765 /// with 'omp for' in a same construct when schedule is chunked.
767 /// 'omp parallel for' loop condition used when composed with
768 /// 'omp distribute' in the same construct and when schedule is
769 /// chunked and the chunk size is 1.
770 Expr *ParForInDistCond;
773 /// The expressions built for the OpenMP loop CodeGen for the
774 /// whole collapsed loop nest.
776 /// Loop iteration variable.
777 Expr *IterationVarRef;
778 /// Loop last iteration number.
780 /// Loop number of iterations.
782 /// Calculation of last iteration.
783 Expr *CalcLastIteration;
784 /// Loop pre-condition.
788 /// Loop iteration variable init.
792 /// IsLastIteration - local flag variable passed to runtime.
794 /// LowerBound - local variable passed to runtime.
796 /// UpperBound - local variable passed to runtime.
798 /// Stride - local variable passed to runtime.
800 /// EnsureUpperBound -- expression UB = min(UB, NumIterations).
802 /// Update of LowerBound for statically scheduled 'omp for' loops.
804 /// Update of UpperBound for statically scheduled 'omp for' loops.
806 /// PreviousLowerBound - local variable passed to runtime in the
807 /// enclosing schedule or null if that does not apply.
809 /// PreviousUpperBound - local variable passed to runtime in the
810 /// enclosing schedule or null if that does not apply.
812 /// DistInc - increment expression for distribute loop when found
813 /// combined with a further loop level (e.g. in 'distribute parallel for')
814 /// expression IV = IV + ST
816 /// PrevEUB - expression similar to EUB but to be used when loop
817 /// scheduling uses PrevLB and PrevUB (e.g. in 'distribute parallel for'
818 /// when ensuring that the UB is either the calculated UB by the runtime or
819 /// the end of the assigned distribute chunk)
820 /// expression UB = min (UB, PrevUB)
822 /// Counters Loop counters.
823 SmallVector<Expr *, 4> Counters;
824 /// PrivateCounters Loop counters.
825 SmallVector<Expr *, 4> PrivateCounters;
826 /// Expressions for loop counters inits for CodeGen.
827 SmallVector<Expr *, 4> Inits;
828 /// Expressions for loop counters update for CodeGen.
829 SmallVector<Expr *, 4> Updates;
830 /// Final loop counter values for GodeGen.
831 SmallVector<Expr *, 4> Finals;
832 /// List of counters required for the generation of the non-rectangular
834 SmallVector<Expr *, 4> DependentCounters;
835 /// List of initializers required for the generation of the non-rectangular
837 SmallVector<Expr *, 4> DependentInits;
838 /// List of final conditions required for the generation of the
839 /// non-rectangular loops.
840 SmallVector<Expr *, 4> FinalsConditions;
841 /// Init statement for all captured expressions.
844 /// Expressions used when combining OpenMP loop pragmas
845 DistCombinedHelperExprs DistCombinedFields;
847 /// Check if all the expressions are built (does not check the
848 /// worksharing ones).
850 return IterationVarRef != nullptr && LastIteration != nullptr &&
851 NumIterations != nullptr && PreCond != nullptr &&
852 Cond != nullptr && Init != nullptr && Inc != nullptr;
855 /// Initialize all the fields to null.
856 /// \param Size Number of elements in the
857 /// counters/finals/updates/dependent_counters/dependent_inits/finals_conditions
859 void clear(unsigned Size) {
860 IterationVarRef = nullptr;
861 LastIteration = nullptr;
862 CalcLastIteration = nullptr;
874 NumIterations = nullptr;
879 Counters.resize(Size);
880 PrivateCounters.resize(Size);
882 Updates.resize(Size);
884 DependentCounters.resize(Size);
885 DependentInits.resize(Size);
886 FinalsConditions.resize(Size);
887 for (unsigned i = 0; i < Size; ++i) {
888 Counters[i] = nullptr;
889 PrivateCounters[i] = nullptr;
891 Updates[i] = nullptr;
893 DependentCounters[i] = nullptr;
894 DependentInits[i] = nullptr;
895 FinalsConditions[i] = nullptr;
898 DistCombinedFields.LB = nullptr;
899 DistCombinedFields.UB = nullptr;
900 DistCombinedFields.EUB = nullptr;
901 DistCombinedFields.Init = nullptr;
902 DistCombinedFields.Cond = nullptr;
903 DistCombinedFields.NLB = nullptr;
904 DistCombinedFields.NUB = nullptr;
905 DistCombinedFields.DistCond = nullptr;
906 DistCombinedFields.ParForInDistCond = nullptr;
910 /// Get number of collapsed loops.
911 unsigned getCollapsedNumber() const { return CollapsedNum; }
913 Expr *getIterationVariable() const {
914 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
915 *std::next(child_begin(), IterationVariableOffset)));
917 Expr *getLastIteration() const {
918 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
919 *std::next(child_begin(), LastIterationOffset)));
921 Expr *getCalcLastIteration() const {
922 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
923 *std::next(child_begin(), CalcLastIterationOffset)));
925 Expr *getPreCond() const {
926 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
927 *std::next(child_begin(), PreConditionOffset)));
929 Expr *getCond() const {
930 return const_cast<Expr *>(
931 reinterpret_cast<const Expr *>(*std::next(child_begin(), CondOffset)));
933 Expr *getInit() const {
934 return const_cast<Expr *>(
935 reinterpret_cast<const Expr *>(*std::next(child_begin(), InitOffset)));
937 Expr *getInc() const {
938 return const_cast<Expr *>(
939 reinterpret_cast<const Expr *>(*std::next(child_begin(), IncOffset)));
941 const Stmt *getPreInits() const {
942 return *std::next(child_begin(), PreInitsOffset);
944 Stmt *getPreInits() { return *std::next(child_begin(), PreInitsOffset); }
945 Expr *getIsLastIterVariable() const {
946 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
947 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
948 isOpenMPDistributeDirective(getDirectiveKind())) &&
949 "expected worksharing loop directive");
950 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
951 *std::next(child_begin(), IsLastIterVariableOffset)));
953 Expr *getLowerBoundVariable() const {
954 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
955 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
956 isOpenMPDistributeDirective(getDirectiveKind())) &&
957 "expected worksharing loop directive");
958 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
959 *std::next(child_begin(), LowerBoundVariableOffset)));
961 Expr *getUpperBoundVariable() const {
962 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
963 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
964 isOpenMPDistributeDirective(getDirectiveKind())) &&
965 "expected worksharing loop directive");
966 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
967 *std::next(child_begin(), UpperBoundVariableOffset)));
969 Expr *getStrideVariable() const {
970 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
971 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
972 isOpenMPDistributeDirective(getDirectiveKind())) &&
973 "expected worksharing loop directive");
974 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
975 *std::next(child_begin(), StrideVariableOffset)));
977 Expr *getEnsureUpperBound() const {
978 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
979 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
980 isOpenMPDistributeDirective(getDirectiveKind())) &&
981 "expected worksharing loop directive");
982 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
983 *std::next(child_begin(), EnsureUpperBoundOffset)));
985 Expr *getNextLowerBound() const {
986 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
987 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
988 isOpenMPDistributeDirective(getDirectiveKind())) &&
989 "expected worksharing loop directive");
990 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
991 *std::next(child_begin(), NextLowerBoundOffset)));
993 Expr *getNextUpperBound() const {
994 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
995 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
996 isOpenMPDistributeDirective(getDirectiveKind())) &&
997 "expected worksharing loop directive");
998 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
999 *std::next(child_begin(), NextUpperBoundOffset)));
1001 Expr *getNumIterations() const {
1002 assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
1003 isOpenMPTaskLoopDirective(getDirectiveKind()) ||
1004 isOpenMPDistributeDirective(getDirectiveKind())) &&
1005 "expected worksharing loop directive");
1006 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1007 *std::next(child_begin(), NumIterationsOffset)));
1009 Expr *getPrevLowerBoundVariable() const {
1010 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1011 "expected loop bound sharing directive");
1012 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1013 *std::next(child_begin(), PrevLowerBoundVariableOffset)));
1015 Expr *getPrevUpperBoundVariable() const {
1016 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1017 "expected loop bound sharing directive");
1018 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1019 *std::next(child_begin(), PrevUpperBoundVariableOffset)));
1021 Expr *getDistInc() const {
1022 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1023 "expected loop bound sharing directive");
1024 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1025 *std::next(child_begin(), DistIncOffset)));
1027 Expr *getPrevEnsureUpperBound() const {
1028 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1029 "expected loop bound sharing directive");
1030 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1031 *std::next(child_begin(), PrevEnsureUpperBoundOffset)));
1033 Expr *getCombinedLowerBoundVariable() const {
1034 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1035 "expected loop bound sharing directive");
1036 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1037 *std::next(child_begin(), CombinedLowerBoundVariableOffset)));
1039 Expr *getCombinedUpperBoundVariable() const {
1040 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1041 "expected loop bound sharing directive");
1042 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1043 *std::next(child_begin(), CombinedUpperBoundVariableOffset)));
1045 Expr *getCombinedEnsureUpperBound() const {
1046 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1047 "expected loop bound sharing directive");
1048 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1049 *std::next(child_begin(), CombinedEnsureUpperBoundOffset)));
1051 Expr *getCombinedInit() const {
1052 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1053 "expected loop bound sharing directive");
1054 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1055 *std::next(child_begin(), CombinedInitOffset)));
1057 Expr *getCombinedCond() const {
1058 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1059 "expected loop bound sharing directive");
1060 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1061 *std::next(child_begin(), CombinedConditionOffset)));
1063 Expr *getCombinedNextLowerBound() const {
1064 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1065 "expected loop bound sharing directive");
1066 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1067 *std::next(child_begin(), CombinedNextLowerBoundOffset)));
1069 Expr *getCombinedNextUpperBound() const {
1070 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1071 "expected loop bound sharing directive");
1072 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1073 *std::next(child_begin(), CombinedNextUpperBoundOffset)));
1075 Expr *getCombinedDistCond() const {
1076 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1077 "expected loop bound distribute sharing directive");
1078 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1079 *std::next(child_begin(), CombinedDistConditionOffset)));
1081 Expr *getCombinedParForInDistCond() const {
1082 assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) &&
1083 "expected loop bound distribute sharing directive");
1084 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1085 *std::next(child_begin(), CombinedParForInDistConditionOffset)));
1087 const Stmt *getBody() const {
1088 // This relies on the loop form is already checked by Sema.
1090 getInnermostCapturedStmt()->getCapturedStmt()->IgnoreContainers();
1091 if (auto *For = dyn_cast<ForStmt>(Body)) {
1092 Body = For->getBody();
1094 assert(isa<CXXForRangeStmt>(Body) &&
1095 "Expected canonical for loop or range-based for loop.");
1096 Body = cast<CXXForRangeStmt>(Body)->getBody();
1098 for (unsigned Cnt = 1; Cnt < CollapsedNum; ++Cnt) {
1099 Body = Body->IgnoreContainers();
1100 if (auto *For = dyn_cast<ForStmt>(Body)) {
1101 Body = For->getBody();
1103 assert(isa<CXXForRangeStmt>(Body) &&
1104 "Expected canonical for loop or range-based for loop.");
1105 Body = cast<CXXForRangeStmt>(Body)->getBody();
1111 ArrayRef<Expr *> counters() { return getCounters(); }
1113 ArrayRef<Expr *> counters() const {
1114 return const_cast<OMPLoopDirective *>(this)->getCounters();
1117 ArrayRef<Expr *> private_counters() { return getPrivateCounters(); }
1119 ArrayRef<Expr *> private_counters() const {
1120 return const_cast<OMPLoopDirective *>(this)->getPrivateCounters();
1123 ArrayRef<Expr *> inits() { return getInits(); }
1125 ArrayRef<Expr *> inits() const {
1126 return const_cast<OMPLoopDirective *>(this)->getInits();
1129 ArrayRef<Expr *> updates() { return getUpdates(); }
1131 ArrayRef<Expr *> updates() const {
1132 return const_cast<OMPLoopDirective *>(this)->getUpdates();
1135 ArrayRef<Expr *> finals() { return getFinals(); }
1137 ArrayRef<Expr *> finals() const {
1138 return const_cast<OMPLoopDirective *>(this)->getFinals();
1141 ArrayRef<Expr *> dependent_counters() { return getDependentCounters(); }
1143 ArrayRef<Expr *> dependent_counters() const {
1144 return const_cast<OMPLoopDirective *>(this)->getDependentCounters();
1147 ArrayRef<Expr *> dependent_inits() { return getDependentInits(); }
1149 ArrayRef<Expr *> dependent_inits() const {
1150 return const_cast<OMPLoopDirective *>(this)->getDependentInits();
1153 ArrayRef<Expr *> finals_conditions() { return getFinalsConditions(); }
1155 ArrayRef<Expr *> finals_conditions() const {
1156 return const_cast<OMPLoopDirective *>(this)->getFinalsConditions();
1159 static bool classof(const Stmt *T) {
1160 return T->getStmtClass() == OMPSimdDirectiveClass ||
1161 T->getStmtClass() == OMPForDirectiveClass ||
1162 T->getStmtClass() == OMPForSimdDirectiveClass ||
1163 T->getStmtClass() == OMPParallelForDirectiveClass ||
1164 T->getStmtClass() == OMPParallelForSimdDirectiveClass ||
1165 T->getStmtClass() == OMPTaskLoopDirectiveClass ||
1166 T->getStmtClass() == OMPTaskLoopSimdDirectiveClass ||
1167 T->getStmtClass() == OMPMasterTaskLoopDirectiveClass ||
1168 T->getStmtClass() == OMPMasterTaskLoopSimdDirectiveClass ||
1169 T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass ||
1170 T->getStmtClass() == OMPDistributeDirectiveClass ||
1171 T->getStmtClass() == OMPTargetParallelForDirectiveClass ||
1172 T->getStmtClass() == OMPDistributeParallelForDirectiveClass ||
1173 T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass ||
1174 T->getStmtClass() == OMPDistributeSimdDirectiveClass ||
1175 T->getStmtClass() == OMPTargetParallelForSimdDirectiveClass ||
1176 T->getStmtClass() == OMPTargetSimdDirectiveClass ||
1177 T->getStmtClass() == OMPTeamsDistributeDirectiveClass ||
1178 T->getStmtClass() == OMPTeamsDistributeSimdDirectiveClass ||
1179 T->getStmtClass() ==
1180 OMPTeamsDistributeParallelForSimdDirectiveClass ||
1181 T->getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass ||
1182 T->getStmtClass() ==
1183 OMPTargetTeamsDistributeParallelForDirectiveClass ||
1184 T->getStmtClass() ==
1185 OMPTargetTeamsDistributeParallelForSimdDirectiveClass ||
1186 T->getStmtClass() == OMPTargetTeamsDistributeDirectiveClass ||
1187 T->getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
1191 /// This represents '#pragma omp simd' directive.
1194 /// #pragma omp simd private(a,b) linear(i,j:s) reduction(+:c,d)
1196 /// In this example directive '#pragma omp simd' has clauses 'private'
1197 /// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and
1198 /// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'.
1200 class OMPSimdDirective : public OMPLoopDirective {
1201 friend class ASTStmtReader;
1202 /// Build directive with the given start and end location.
1204 /// \param StartLoc Starting location of the directive kind.
1205 /// \param EndLoc Ending location of the directive.
1206 /// \param CollapsedNum Number of collapsed nested loops.
1207 /// \param NumClauses Number of clauses.
1209 OMPSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1210 unsigned CollapsedNum, unsigned NumClauses)
1211 : OMPLoopDirective(this, OMPSimdDirectiveClass, OMPD_simd, StartLoc,
1212 EndLoc, CollapsedNum, NumClauses) {}
1214 /// Build an empty directive.
1216 /// \param CollapsedNum Number of collapsed nested loops.
1217 /// \param NumClauses Number of clauses.
1219 explicit OMPSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
1220 : OMPLoopDirective(this, OMPSimdDirectiveClass, OMPD_simd,
1221 SourceLocation(), SourceLocation(), CollapsedNum,
1225 /// Creates directive with a list of \a Clauses.
1227 /// \param C AST context.
1228 /// \param StartLoc Starting location of the directive kind.
1229 /// \param EndLoc Ending Location of the directive.
1230 /// \param CollapsedNum Number of collapsed loops.
1231 /// \param Clauses List of clauses.
1232 /// \param AssociatedStmt Statement, associated with the directive.
1233 /// \param Exprs Helper expressions for CodeGen.
1235 static OMPSimdDirective *Create(const ASTContext &C, SourceLocation StartLoc,
1236 SourceLocation EndLoc, unsigned CollapsedNum,
1237 ArrayRef<OMPClause *> Clauses,
1238 Stmt *AssociatedStmt,
1239 const HelperExprs &Exprs);
1241 /// Creates an empty directive with the place
1242 /// for \a NumClauses clauses.
1244 /// \param C AST context.
1245 /// \param CollapsedNum Number of collapsed nested loops.
1246 /// \param NumClauses Number of clauses.
1248 static OMPSimdDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
1249 unsigned CollapsedNum, EmptyShell);
1251 static bool classof(const Stmt *T) {
1252 return T->getStmtClass() == OMPSimdDirectiveClass;
1256 /// This represents '#pragma omp for' directive.
1259 /// #pragma omp for private(a,b) reduction(+:c,d)
1261 /// In this example directive '#pragma omp for' has clauses 'private' with the
1262 /// variables 'a' and 'b' and 'reduction' with operator '+' and variables 'c'
1265 class OMPForDirective : public OMPLoopDirective {
1266 friend class ASTStmtReader;
1268 /// true if current directive has inner cancel directive.
1271 /// Build directive with the given start and end location.
1273 /// \param StartLoc Starting location of the directive kind.
1274 /// \param EndLoc Ending location of the directive.
1275 /// \param CollapsedNum Number of collapsed nested loops.
1276 /// \param NumClauses Number of clauses.
1278 OMPForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1279 unsigned CollapsedNum, unsigned NumClauses)
1280 : OMPLoopDirective(this, OMPForDirectiveClass, OMPD_for, StartLoc, EndLoc,
1281 CollapsedNum, NumClauses),
1284 /// Build an empty directive.
1286 /// \param CollapsedNum Number of collapsed nested loops.
1287 /// \param NumClauses Number of clauses.
1289 explicit OMPForDirective(unsigned CollapsedNum, unsigned NumClauses)
1290 : OMPLoopDirective(this, OMPForDirectiveClass, OMPD_for, SourceLocation(),
1291 SourceLocation(), CollapsedNum, NumClauses),
1294 /// Set cancel state.
1295 void setHasCancel(bool Has) { HasCancel = Has; }
1298 /// Creates directive with a list of \a Clauses.
1300 /// \param C AST context.
1301 /// \param StartLoc Starting location of the directive kind.
1302 /// \param EndLoc Ending Location of the directive.
1303 /// \param CollapsedNum Number of collapsed loops.
1304 /// \param Clauses List of clauses.
1305 /// \param AssociatedStmt Statement, associated with the directive.
1306 /// \param Exprs Helper expressions for CodeGen.
1307 /// \param HasCancel true if current directive has inner cancel directive.
1309 static OMPForDirective *Create(const ASTContext &C, SourceLocation StartLoc,
1310 SourceLocation EndLoc, unsigned CollapsedNum,
1311 ArrayRef<OMPClause *> Clauses,
1312 Stmt *AssociatedStmt, const HelperExprs &Exprs,
1315 /// Creates an empty directive with the place
1316 /// for \a NumClauses clauses.
1318 /// \param C AST context.
1319 /// \param CollapsedNum Number of collapsed nested loops.
1320 /// \param NumClauses Number of clauses.
1322 static OMPForDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
1323 unsigned CollapsedNum, EmptyShell);
1325 /// Return true if current directive has inner cancel directive.
1326 bool hasCancel() const { return HasCancel; }
1328 static bool classof(const Stmt *T) {
1329 return T->getStmtClass() == OMPForDirectiveClass;
1333 /// This represents '#pragma omp for simd' directive.
1336 /// #pragma omp for simd private(a,b) linear(i,j:s) reduction(+:c,d)
1338 /// In this example directive '#pragma omp for simd' has clauses 'private'
1339 /// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and
1340 /// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'.
1342 class OMPForSimdDirective : public OMPLoopDirective {
1343 friend class ASTStmtReader;
1344 /// Build directive with the given start and end location.
1346 /// \param StartLoc Starting location of the directive kind.
1347 /// \param EndLoc Ending location of the directive.
1348 /// \param CollapsedNum Number of collapsed nested loops.
1349 /// \param NumClauses Number of clauses.
1351 OMPForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1352 unsigned CollapsedNum, unsigned NumClauses)
1353 : OMPLoopDirective(this, OMPForSimdDirectiveClass, OMPD_for_simd,
1354 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
1356 /// Build an empty directive.
1358 /// \param CollapsedNum Number of collapsed nested loops.
1359 /// \param NumClauses Number of clauses.
1361 explicit OMPForSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
1362 : OMPLoopDirective(this, OMPForSimdDirectiveClass, OMPD_for_simd,
1363 SourceLocation(), SourceLocation(), CollapsedNum,
1367 /// Creates directive with a list of \a Clauses.
1369 /// \param C AST context.
1370 /// \param StartLoc Starting location of the directive kind.
1371 /// \param EndLoc Ending Location of the directive.
1372 /// \param CollapsedNum Number of collapsed loops.
1373 /// \param Clauses List of clauses.
1374 /// \param AssociatedStmt Statement, associated with the directive.
1375 /// \param Exprs Helper expressions for CodeGen.
1377 static OMPForSimdDirective *
1378 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1379 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
1380 Stmt *AssociatedStmt, const HelperExprs &Exprs);
1382 /// Creates an empty directive with the place
1383 /// for \a NumClauses clauses.
1385 /// \param C AST context.
1386 /// \param CollapsedNum Number of collapsed nested loops.
1387 /// \param NumClauses Number of clauses.
1389 static OMPForSimdDirective *CreateEmpty(const ASTContext &C,
1390 unsigned NumClauses,
1391 unsigned CollapsedNum, EmptyShell);
1393 static bool classof(const Stmt *T) {
1394 return T->getStmtClass() == OMPForSimdDirectiveClass;
1398 /// This represents '#pragma omp sections' directive.
1401 /// #pragma omp sections private(a,b) reduction(+:c,d)
1403 /// In this example directive '#pragma omp sections' has clauses 'private' with
1404 /// the variables 'a' and 'b' and 'reduction' with operator '+' and variables
1407 class OMPSectionsDirective : public OMPExecutableDirective {
1408 friend class ASTStmtReader;
1410 /// true if current directive has inner cancel directive.
1413 /// Build directive with the given start and end location.
1415 /// \param StartLoc Starting location of the directive kind.
1416 /// \param EndLoc Ending location of the directive.
1417 /// \param NumClauses Number of clauses.
1419 OMPSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1420 unsigned NumClauses)
1421 : OMPExecutableDirective(this, OMPSectionsDirectiveClass, OMPD_sections,
1422 StartLoc, EndLoc, NumClauses, 1),
1425 /// Build an empty directive.
1427 /// \param NumClauses Number of clauses.
1429 explicit OMPSectionsDirective(unsigned NumClauses)
1430 : OMPExecutableDirective(this, OMPSectionsDirectiveClass, OMPD_sections,
1431 SourceLocation(), SourceLocation(), NumClauses,
1435 /// Set cancel state.
1436 void setHasCancel(bool Has) { HasCancel = Has; }
1439 /// Creates directive with a list of \a Clauses.
1441 /// \param C AST context.
1442 /// \param StartLoc Starting location of the directive kind.
1443 /// \param EndLoc Ending Location of the directive.
1444 /// \param Clauses List of clauses.
1445 /// \param AssociatedStmt Statement, associated with the directive.
1446 /// \param HasCancel true if current directive has inner directive.
1448 static OMPSectionsDirective *
1449 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1450 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel);
1452 /// Creates an empty directive with the place for \a NumClauses
1455 /// \param C AST context.
1456 /// \param NumClauses Number of clauses.
1458 static OMPSectionsDirective *CreateEmpty(const ASTContext &C,
1459 unsigned NumClauses, EmptyShell);
1461 /// Return true if current directive has inner cancel directive.
1462 bool hasCancel() const { return HasCancel; }
1464 static bool classof(const Stmt *T) {
1465 return T->getStmtClass() == OMPSectionsDirectiveClass;
1469 /// This represents '#pragma omp section' directive.
1472 /// #pragma omp section
1475 class OMPSectionDirective : public OMPExecutableDirective {
1476 friend class ASTStmtReader;
1478 /// true if current directive has inner cancel directive.
1481 /// Build directive with the given start and end location.
1483 /// \param StartLoc Starting location of the directive kind.
1484 /// \param EndLoc Ending location of the directive.
1486 OMPSectionDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1487 : OMPExecutableDirective(this, OMPSectionDirectiveClass, OMPD_section,
1488 StartLoc, EndLoc, 0, 1),
1491 /// Build an empty directive.
1493 explicit OMPSectionDirective()
1494 : OMPExecutableDirective(this, OMPSectionDirectiveClass, OMPD_section,
1495 SourceLocation(), SourceLocation(), 0, 1),
1499 /// Creates directive.
1501 /// \param C AST context.
1502 /// \param StartLoc Starting location of the directive kind.
1503 /// \param EndLoc Ending Location of the directive.
1504 /// \param AssociatedStmt Statement, associated with the directive.
1505 /// \param HasCancel true if current directive has inner directive.
1507 static OMPSectionDirective *Create(const ASTContext &C,
1508 SourceLocation StartLoc,
1509 SourceLocation EndLoc,
1510 Stmt *AssociatedStmt, bool HasCancel);
1512 /// Creates an empty directive.
1514 /// \param C AST context.
1516 static OMPSectionDirective *CreateEmpty(const ASTContext &C, EmptyShell);
1518 /// Set cancel state.
1519 void setHasCancel(bool Has) { HasCancel = Has; }
1521 /// Return true if current directive has inner cancel directive.
1522 bool hasCancel() const { return HasCancel; }
1524 static bool classof(const Stmt *T) {
1525 return T->getStmtClass() == OMPSectionDirectiveClass;
1529 /// This represents '#pragma omp single' directive.
1532 /// #pragma omp single private(a,b) copyprivate(c,d)
1534 /// In this example directive '#pragma omp single' has clauses 'private' with
1535 /// the variables 'a' and 'b' and 'copyprivate' with variables 'c' and 'd'.
1537 class OMPSingleDirective : public OMPExecutableDirective {
1538 friend class ASTStmtReader;
1539 /// Build directive with the given start and end location.
1541 /// \param StartLoc Starting location of the directive kind.
1542 /// \param EndLoc Ending location of the directive.
1543 /// \param NumClauses Number of clauses.
1545 OMPSingleDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1546 unsigned NumClauses)
1547 : OMPExecutableDirective(this, OMPSingleDirectiveClass, OMPD_single,
1548 StartLoc, EndLoc, NumClauses, 1) {}
1550 /// Build an empty directive.
1552 /// \param NumClauses Number of clauses.
1554 explicit OMPSingleDirective(unsigned NumClauses)
1555 : OMPExecutableDirective(this, OMPSingleDirectiveClass, OMPD_single,
1556 SourceLocation(), SourceLocation(), NumClauses,
1560 /// Creates directive with a list of \a Clauses.
1562 /// \param C AST context.
1563 /// \param StartLoc Starting location of the directive kind.
1564 /// \param EndLoc Ending Location of the directive.
1565 /// \param Clauses List of clauses.
1566 /// \param AssociatedStmt Statement, associated with the directive.
1568 static OMPSingleDirective *
1569 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1570 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
1572 /// Creates an empty directive with the place for \a NumClauses
1575 /// \param C AST context.
1576 /// \param NumClauses Number of clauses.
1578 static OMPSingleDirective *CreateEmpty(const ASTContext &C,
1579 unsigned NumClauses, EmptyShell);
1581 static bool classof(const Stmt *T) {
1582 return T->getStmtClass() == OMPSingleDirectiveClass;
1586 /// This represents '#pragma omp master' directive.
1589 /// #pragma omp master
1592 class OMPMasterDirective : public OMPExecutableDirective {
1593 friend class ASTStmtReader;
1594 /// Build directive with the given start and end location.
1596 /// \param StartLoc Starting location of the directive kind.
1597 /// \param EndLoc Ending location of the directive.
1599 OMPMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1600 : OMPExecutableDirective(this, OMPMasterDirectiveClass, OMPD_master,
1601 StartLoc, EndLoc, 0, 1) {}
1603 /// Build an empty directive.
1605 explicit OMPMasterDirective()
1606 : OMPExecutableDirective(this, OMPMasterDirectiveClass, OMPD_master,
1607 SourceLocation(), SourceLocation(), 0, 1) {}
1610 /// Creates directive.
1612 /// \param C AST context.
1613 /// \param StartLoc Starting location of the directive kind.
1614 /// \param EndLoc Ending Location of the directive.
1615 /// \param AssociatedStmt Statement, associated with the directive.
1617 static OMPMasterDirective *Create(const ASTContext &C,
1618 SourceLocation StartLoc,
1619 SourceLocation EndLoc,
1620 Stmt *AssociatedStmt);
1622 /// Creates an empty directive.
1624 /// \param C AST context.
1626 static OMPMasterDirective *CreateEmpty(const ASTContext &C, EmptyShell);
1628 static bool classof(const Stmt *T) {
1629 return T->getStmtClass() == OMPMasterDirectiveClass;
1633 /// This represents '#pragma omp critical' directive.
1636 /// #pragma omp critical
1639 class OMPCriticalDirective : public OMPExecutableDirective {
1640 friend class ASTStmtReader;
1641 /// Name of the directive.
1642 DeclarationNameInfo DirName;
1643 /// Build directive with the given start and end location.
1645 /// \param Name Name of the directive.
1646 /// \param StartLoc Starting location of the directive kind.
1647 /// \param EndLoc Ending location of the directive.
1648 /// \param NumClauses Number of clauses.
1650 OMPCriticalDirective(const DeclarationNameInfo &Name, SourceLocation StartLoc,
1651 SourceLocation EndLoc, unsigned NumClauses)
1652 : OMPExecutableDirective(this, OMPCriticalDirectiveClass, OMPD_critical,
1653 StartLoc, EndLoc, NumClauses, 1),
1656 /// Build an empty directive.
1658 /// \param NumClauses Number of clauses.
1660 explicit OMPCriticalDirective(unsigned NumClauses)
1661 : OMPExecutableDirective(this, OMPCriticalDirectiveClass, OMPD_critical,
1662 SourceLocation(), SourceLocation(), NumClauses,
1666 /// Set name of the directive.
1668 /// \param Name Name of the directive.
1670 void setDirectiveName(const DeclarationNameInfo &Name) { DirName = Name; }
1673 /// Creates directive.
1675 /// \param C AST context.
1676 /// \param Name Name of the directive.
1677 /// \param StartLoc Starting location of the directive kind.
1678 /// \param EndLoc Ending Location of the directive.
1679 /// \param Clauses List of clauses.
1680 /// \param AssociatedStmt Statement, associated with the directive.
1682 static OMPCriticalDirective *
1683 Create(const ASTContext &C, const DeclarationNameInfo &Name,
1684 SourceLocation StartLoc, SourceLocation EndLoc,
1685 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
1687 /// Creates an empty directive.
1689 /// \param C AST context.
1690 /// \param NumClauses Number of clauses.
1692 static OMPCriticalDirective *CreateEmpty(const ASTContext &C,
1693 unsigned NumClauses, EmptyShell);
1695 /// Return name of the directive.
1697 DeclarationNameInfo getDirectiveName() const { return DirName; }
1699 static bool classof(const Stmt *T) {
1700 return T->getStmtClass() == OMPCriticalDirectiveClass;
1704 /// This represents '#pragma omp parallel for' directive.
1707 /// #pragma omp parallel for private(a,b) reduction(+:c,d)
1709 /// In this example directive '#pragma omp parallel for' has clauses 'private'
1710 /// with the variables 'a' and 'b' and 'reduction' with operator '+' and
1711 /// variables 'c' and 'd'.
1713 class OMPParallelForDirective : public OMPLoopDirective {
1714 friend class ASTStmtReader;
1716 /// true if current region has inner cancel directive.
1719 /// Build directive with the given start and end location.
1721 /// \param StartLoc Starting location of the directive kind.
1722 /// \param EndLoc Ending location of the directive.
1723 /// \param CollapsedNum Number of collapsed nested loops.
1724 /// \param NumClauses Number of clauses.
1726 OMPParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1727 unsigned CollapsedNum, unsigned NumClauses)
1728 : OMPLoopDirective(this, OMPParallelForDirectiveClass, OMPD_parallel_for,
1729 StartLoc, EndLoc, CollapsedNum, NumClauses),
1732 /// Build an empty directive.
1734 /// \param CollapsedNum Number of collapsed nested loops.
1735 /// \param NumClauses Number of clauses.
1737 explicit OMPParallelForDirective(unsigned CollapsedNum, unsigned NumClauses)
1738 : OMPLoopDirective(this, OMPParallelForDirectiveClass, OMPD_parallel_for,
1739 SourceLocation(), SourceLocation(), CollapsedNum,
1743 /// Set cancel state.
1744 void setHasCancel(bool Has) { HasCancel = Has; }
1747 /// Creates directive with a list of \a Clauses.
1749 /// \param C AST context.
1750 /// \param StartLoc Starting location of the directive kind.
1751 /// \param EndLoc Ending Location of the directive.
1752 /// \param CollapsedNum Number of collapsed loops.
1753 /// \param Clauses List of clauses.
1754 /// \param AssociatedStmt Statement, associated with the directive.
1755 /// \param Exprs Helper expressions for CodeGen.
1756 /// \param HasCancel true if current directive has inner cancel directive.
1758 static OMPParallelForDirective *
1759 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1760 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
1761 Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
1763 /// Creates an empty directive with the place
1764 /// for \a NumClauses clauses.
1766 /// \param C AST context.
1767 /// \param CollapsedNum Number of collapsed nested loops.
1768 /// \param NumClauses Number of clauses.
1770 static OMPParallelForDirective *CreateEmpty(const ASTContext &C,
1771 unsigned NumClauses,
1772 unsigned CollapsedNum,
1775 /// Return true if current directive has inner cancel directive.
1776 bool hasCancel() const { return HasCancel; }
1778 static bool classof(const Stmt *T) {
1779 return T->getStmtClass() == OMPParallelForDirectiveClass;
1783 /// This represents '#pragma omp parallel for simd' directive.
1786 /// #pragma omp parallel for simd private(a,b) linear(i,j:s) reduction(+:c,d)
1788 /// In this example directive '#pragma omp parallel for simd' has clauses
1789 /// 'private' with the variables 'a' and 'b', 'linear' with variables 'i', 'j'
1790 /// and linear step 's', 'reduction' with operator '+' and variables 'c' and
1793 class OMPParallelForSimdDirective : public OMPLoopDirective {
1794 friend class ASTStmtReader;
1795 /// Build directive with the given start and end location.
1797 /// \param StartLoc Starting location of the directive kind.
1798 /// \param EndLoc Ending location of the directive.
1799 /// \param CollapsedNum Number of collapsed nested loops.
1800 /// \param NumClauses Number of clauses.
1802 OMPParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1803 unsigned CollapsedNum, unsigned NumClauses)
1804 : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass,
1805 OMPD_parallel_for_simd, StartLoc, EndLoc, CollapsedNum,
1808 /// Build an empty directive.
1810 /// \param CollapsedNum Number of collapsed nested loops.
1811 /// \param NumClauses Number of clauses.
1813 explicit OMPParallelForSimdDirective(unsigned CollapsedNum,
1814 unsigned NumClauses)
1815 : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass,
1816 OMPD_parallel_for_simd, SourceLocation(),
1817 SourceLocation(), CollapsedNum, NumClauses) {}
1820 /// Creates directive with a list of \a Clauses.
1822 /// \param C AST context.
1823 /// \param StartLoc Starting location of the directive kind.
1824 /// \param EndLoc Ending Location of the directive.
1825 /// \param CollapsedNum Number of collapsed loops.
1826 /// \param Clauses List of clauses.
1827 /// \param AssociatedStmt Statement, associated with the directive.
1828 /// \param Exprs Helper expressions for CodeGen.
1830 static OMPParallelForSimdDirective *
1831 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1832 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
1833 Stmt *AssociatedStmt, const HelperExprs &Exprs);
1835 /// Creates an empty directive with the place
1836 /// for \a NumClauses clauses.
1838 /// \param C AST context.
1839 /// \param CollapsedNum Number of collapsed nested loops.
1840 /// \param NumClauses Number of clauses.
1842 static OMPParallelForSimdDirective *CreateEmpty(const ASTContext &C,
1843 unsigned NumClauses,
1844 unsigned CollapsedNum,
1847 static bool classof(const Stmt *T) {
1848 return T->getStmtClass() == OMPParallelForSimdDirectiveClass;
1852 /// This represents '#pragma omp parallel sections' directive.
1855 /// #pragma omp parallel sections private(a,b) reduction(+:c,d)
1857 /// In this example directive '#pragma omp parallel sections' has clauses
1858 /// 'private' with the variables 'a' and 'b' and 'reduction' with operator '+'
1859 /// and variables 'c' and 'd'.
1861 class OMPParallelSectionsDirective : public OMPExecutableDirective {
1862 friend class ASTStmtReader;
1864 /// true if current directive has inner cancel directive.
1867 /// Build directive with the given start and end location.
1869 /// \param StartLoc Starting location of the directive kind.
1870 /// \param EndLoc Ending location of the directive.
1871 /// \param NumClauses Number of clauses.
1873 OMPParallelSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1874 unsigned NumClauses)
1875 : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass,
1876 OMPD_parallel_sections, StartLoc, EndLoc,
1880 /// Build an empty directive.
1882 /// \param NumClauses Number of clauses.
1884 explicit OMPParallelSectionsDirective(unsigned NumClauses)
1885 : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass,
1886 OMPD_parallel_sections, SourceLocation(),
1887 SourceLocation(), NumClauses, 1),
1890 /// Set cancel state.
1891 void setHasCancel(bool Has) { HasCancel = Has; }
1894 /// Creates directive with a list of \a Clauses.
1896 /// \param C AST context.
1897 /// \param StartLoc Starting location of the directive kind.
1898 /// \param EndLoc Ending Location of the directive.
1899 /// \param Clauses List of clauses.
1900 /// \param AssociatedStmt Statement, associated with the directive.
1901 /// \param HasCancel true if current directive has inner cancel directive.
1903 static OMPParallelSectionsDirective *
1904 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1905 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel);
1907 /// Creates an empty directive with the place for \a NumClauses
1910 /// \param C AST context.
1911 /// \param NumClauses Number of clauses.
1913 static OMPParallelSectionsDirective *
1914 CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
1916 /// Return true if current directive has inner cancel directive.
1917 bool hasCancel() const { return HasCancel; }
1919 static bool classof(const Stmt *T) {
1920 return T->getStmtClass() == OMPParallelSectionsDirectiveClass;
1924 /// This represents '#pragma omp task' directive.
1927 /// #pragma omp task private(a,b) final(d)
1929 /// In this example directive '#pragma omp task' has clauses 'private' with the
1930 /// variables 'a' and 'b' and 'final' with condition 'd'.
1932 class OMPTaskDirective : public OMPExecutableDirective {
1933 friend class ASTStmtReader;
1934 /// true if this directive has inner cancel directive.
1937 /// Build directive with the given start and end location.
1939 /// \param StartLoc Starting location of the directive kind.
1940 /// \param EndLoc Ending location of the directive.
1941 /// \param NumClauses Number of clauses.
1943 OMPTaskDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1944 unsigned NumClauses)
1945 : OMPExecutableDirective(this, OMPTaskDirectiveClass, OMPD_task, StartLoc,
1946 EndLoc, NumClauses, 1),
1949 /// Build an empty directive.
1951 /// \param NumClauses Number of clauses.
1953 explicit OMPTaskDirective(unsigned NumClauses)
1954 : OMPExecutableDirective(this, OMPTaskDirectiveClass, OMPD_task,
1955 SourceLocation(), SourceLocation(), NumClauses,
1959 /// Set cancel state.
1960 void setHasCancel(bool Has) { HasCancel = Has; }
1963 /// Creates directive with a list of \a Clauses.
1965 /// \param C AST context.
1966 /// \param StartLoc Starting location of the directive kind.
1967 /// \param EndLoc Ending Location of the directive.
1968 /// \param Clauses List of clauses.
1969 /// \param AssociatedStmt Statement, associated with the directive.
1970 /// \param HasCancel true, if current directive has inner cancel directive.
1972 static OMPTaskDirective *Create(const ASTContext &C, SourceLocation StartLoc,
1973 SourceLocation EndLoc,
1974 ArrayRef<OMPClause *> Clauses,
1975 Stmt *AssociatedStmt, bool HasCancel);
1977 /// Creates an empty directive with the place for \a NumClauses
1980 /// \param C AST context.
1981 /// \param NumClauses Number of clauses.
1983 static OMPTaskDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
1986 /// Return true if current directive has inner cancel directive.
1987 bool hasCancel() const { return HasCancel; }
1989 static bool classof(const Stmt *T) {
1990 return T->getStmtClass() == OMPTaskDirectiveClass;
1994 /// This represents '#pragma omp taskyield' directive.
1997 /// #pragma omp taskyield
2000 class OMPTaskyieldDirective : public OMPExecutableDirective {
2001 friend class ASTStmtReader;
2002 /// Build directive with the given start and end location.
2004 /// \param StartLoc Starting location of the directive kind.
2005 /// \param EndLoc Ending location of the directive.
2007 OMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2008 : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, OMPD_taskyield,
2009 StartLoc, EndLoc, 0, 0) {}
2011 /// Build an empty directive.
2013 explicit OMPTaskyieldDirective()
2014 : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, OMPD_taskyield,
2015 SourceLocation(), SourceLocation(), 0, 0) {}
2018 /// Creates directive.
2020 /// \param C AST context.
2021 /// \param StartLoc Starting location of the directive kind.
2022 /// \param EndLoc Ending Location of the directive.
2024 static OMPTaskyieldDirective *
2025 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
2027 /// Creates an empty directive.
2029 /// \param C AST context.
2031 static OMPTaskyieldDirective *CreateEmpty(const ASTContext &C, EmptyShell);
2033 static bool classof(const Stmt *T) {
2034 return T->getStmtClass() == OMPTaskyieldDirectiveClass;
2038 /// This represents '#pragma omp barrier' directive.
2041 /// #pragma omp barrier
2044 class OMPBarrierDirective : public OMPExecutableDirective {
2045 friend class ASTStmtReader;
2046 /// Build directive with the given start and end location.
2048 /// \param StartLoc Starting location of the directive kind.
2049 /// \param EndLoc Ending location of the directive.
2051 OMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2052 : OMPExecutableDirective(this, OMPBarrierDirectiveClass, OMPD_barrier,
2053 StartLoc, EndLoc, 0, 0) {}
2055 /// Build an empty directive.
2057 explicit OMPBarrierDirective()
2058 : OMPExecutableDirective(this, OMPBarrierDirectiveClass, OMPD_barrier,
2059 SourceLocation(), SourceLocation(), 0, 0) {}
2062 /// Creates directive.
2064 /// \param C AST context.
2065 /// \param StartLoc Starting location of the directive kind.
2066 /// \param EndLoc Ending Location of the directive.
2068 static OMPBarrierDirective *
2069 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
2071 /// Creates an empty directive.
2073 /// \param C AST context.
2075 static OMPBarrierDirective *CreateEmpty(const ASTContext &C, EmptyShell);
2077 static bool classof(const Stmt *T) {
2078 return T->getStmtClass() == OMPBarrierDirectiveClass;
2082 /// This represents '#pragma omp taskwait' directive.
2085 /// #pragma omp taskwait
2088 class OMPTaskwaitDirective : public OMPExecutableDirective {
2089 friend class ASTStmtReader;
2090 /// Build directive with the given start and end location.
2092 /// \param StartLoc Starting location of the directive kind.
2093 /// \param EndLoc Ending location of the directive.
2095 OMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2096 : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, OMPD_taskwait,
2097 StartLoc, EndLoc, 0, 0) {}
2099 /// Build an empty directive.
2101 explicit OMPTaskwaitDirective()
2102 : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, OMPD_taskwait,
2103 SourceLocation(), SourceLocation(), 0, 0) {}
2106 /// Creates directive.
2108 /// \param C AST context.
2109 /// \param StartLoc Starting location of the directive kind.
2110 /// \param EndLoc Ending Location of the directive.
2112 static OMPTaskwaitDirective *
2113 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
2115 /// Creates an empty directive.
2117 /// \param C AST context.
2119 static OMPTaskwaitDirective *CreateEmpty(const ASTContext &C, EmptyShell);
2121 static bool classof(const Stmt *T) {
2122 return T->getStmtClass() == OMPTaskwaitDirectiveClass;
2126 /// This represents '#pragma omp taskgroup' directive.
2129 /// #pragma omp taskgroup
2132 class OMPTaskgroupDirective : public OMPExecutableDirective {
2133 friend class ASTStmtReader;
2134 /// Build directive with the given start and end location.
2136 /// \param StartLoc Starting location of the directive kind.
2137 /// \param EndLoc Ending location of the directive.
2138 /// \param NumClauses Number of clauses.
2140 OMPTaskgroupDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2141 unsigned NumClauses)
2142 : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, OMPD_taskgroup,
2143 StartLoc, EndLoc, NumClauses, 2) {}
2145 /// Build an empty directive.
2146 /// \param NumClauses Number of clauses.
2148 explicit OMPTaskgroupDirective(unsigned NumClauses)
2149 : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, OMPD_taskgroup,
2150 SourceLocation(), SourceLocation(), NumClauses,
2153 /// Sets the task_reduction return variable.
2154 void setReductionRef(Expr *RR) {
2155 *std::next(child_begin(), 1) = RR;
2159 /// Creates directive.
2161 /// \param C AST context.
2162 /// \param StartLoc Starting location of the directive kind.
2163 /// \param EndLoc Ending Location of the directive.
2164 /// \param Clauses List of clauses.
2165 /// \param AssociatedStmt Statement, associated with the directive.
2166 /// \param ReductionRef Reference to the task_reduction return variable.
2168 static OMPTaskgroupDirective *
2169 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2170 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2171 Expr *ReductionRef);
2173 /// Creates an empty directive.
2175 /// \param C AST context.
2176 /// \param NumClauses Number of clauses.
2178 static OMPTaskgroupDirective *CreateEmpty(const ASTContext &C,
2179 unsigned NumClauses, EmptyShell);
2182 /// Returns reference to the task_reduction return variable.
2183 const Expr *getReductionRef() const {
2184 return static_cast<const Expr *>(*std::next(child_begin(), 1));
2186 Expr *getReductionRef() {
2187 return static_cast<Expr *>(*std::next(child_begin(), 1));
2190 static bool classof(const Stmt *T) {
2191 return T->getStmtClass() == OMPTaskgroupDirectiveClass;
2195 /// This represents '#pragma omp flush' directive.
2198 /// #pragma omp flush(a,b)
2200 /// In this example directive '#pragma omp flush' has 2 arguments- variables 'a'
2202 /// 'omp flush' directive does not have clauses but have an optional list of
2203 /// variables to flush. This list of variables is stored within some fake clause
2205 class OMPFlushDirective : public OMPExecutableDirective {
2206 friend class ASTStmtReader;
2207 /// Build directive with the given start and end location.
2209 /// \param StartLoc Starting location of the directive kind.
2210 /// \param EndLoc Ending location of the directive.
2211 /// \param NumClauses Number of clauses.
2213 OMPFlushDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2214 unsigned NumClauses)
2215 : OMPExecutableDirective(this, OMPFlushDirectiveClass, OMPD_flush,
2216 StartLoc, EndLoc, NumClauses, 0) {}
2218 /// Build an empty directive.
2220 /// \param NumClauses Number of clauses.
2222 explicit OMPFlushDirective(unsigned NumClauses)
2223 : OMPExecutableDirective(this, OMPFlushDirectiveClass, OMPD_flush,
2224 SourceLocation(), SourceLocation(), NumClauses,
2228 /// Creates directive with a list of \a Clauses.
2230 /// \param C AST context.
2231 /// \param StartLoc Starting location of the directive kind.
2232 /// \param EndLoc Ending Location of the directive.
2233 /// \param Clauses List of clauses (only single OMPFlushClause clause is
2236 static OMPFlushDirective *Create(const ASTContext &C, SourceLocation StartLoc,
2237 SourceLocation EndLoc,
2238 ArrayRef<OMPClause *> Clauses);
2240 /// Creates an empty directive with the place for \a NumClauses
2243 /// \param C AST context.
2244 /// \param NumClauses Number of clauses.
2246 static OMPFlushDirective *CreateEmpty(const ASTContext &C,
2247 unsigned NumClauses, EmptyShell);
2249 static bool classof(const Stmt *T) {
2250 return T->getStmtClass() == OMPFlushDirectiveClass;
2254 /// This represents '#pragma omp ordered' directive.
2257 /// #pragma omp ordered
2260 class OMPOrderedDirective : public OMPExecutableDirective {
2261 friend class ASTStmtReader;
2262 /// Build directive with the given start and end location.
2264 /// \param StartLoc Starting location of the directive kind.
2265 /// \param EndLoc Ending location of the directive.
2266 /// \param NumClauses Number of clauses.
2268 OMPOrderedDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2269 unsigned NumClauses)
2270 : OMPExecutableDirective(this, OMPOrderedDirectiveClass, OMPD_ordered,
2271 StartLoc, EndLoc, NumClauses, 1) {}
2273 /// Build an empty directive.
2275 /// \param NumClauses Number of clauses.
2277 explicit OMPOrderedDirective(unsigned NumClauses)
2278 : OMPExecutableDirective(this, OMPOrderedDirectiveClass, OMPD_ordered,
2279 SourceLocation(), SourceLocation(), NumClauses,
2283 /// Creates directive.
2285 /// \param C AST context.
2286 /// \param StartLoc Starting location of the directive kind.
2287 /// \param EndLoc Ending Location of the directive.
2288 /// \param Clauses List of clauses.
2289 /// \param AssociatedStmt Statement, associated with the directive.
2291 static OMPOrderedDirective *
2292 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2293 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2295 /// Creates an empty directive.
2297 /// \param C AST context.
2298 /// \param NumClauses Number of clauses.
2300 static OMPOrderedDirective *CreateEmpty(const ASTContext &C,
2301 unsigned NumClauses, EmptyShell);
2303 static bool classof(const Stmt *T) {
2304 return T->getStmtClass() == OMPOrderedDirectiveClass;
2308 /// This represents '#pragma omp atomic' directive.
2311 /// #pragma omp atomic capture
2313 /// In this example directive '#pragma omp atomic' has clause 'capture'.
2315 class OMPAtomicDirective : public OMPExecutableDirective {
2316 friend class ASTStmtReader;
2317 /// Used for 'atomic update' or 'atomic capture' constructs. They may
2318 /// have atomic expressions of forms
2320 /// x = x binop expr;
2321 /// x = expr binop x;
2323 /// This field is true for the first form of the expression and false for the
2324 /// second. Required for correct codegen of non-associative operations (like
2326 bool IsXLHSInRHSPart;
2327 /// Used for 'atomic update' or 'atomic capture' constructs. They may
2328 /// have atomic expressions of forms
2330 /// v = x; <update x>;
2331 /// <update x>; v = x;
2333 /// This field is true for the first(postfix) form of the expression and false
2335 bool IsPostfixUpdate;
2337 /// Build directive with the given start and end location.
2339 /// \param StartLoc Starting location of the directive kind.
2340 /// \param EndLoc Ending location of the directive.
2341 /// \param NumClauses Number of clauses.
2343 OMPAtomicDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2344 unsigned NumClauses)
2345 : OMPExecutableDirective(this, OMPAtomicDirectiveClass, OMPD_atomic,
2346 StartLoc, EndLoc, NumClauses, 5),
2347 IsXLHSInRHSPart(false), IsPostfixUpdate(false) {}
2349 /// Build an empty directive.
2351 /// \param NumClauses Number of clauses.
2353 explicit OMPAtomicDirective(unsigned NumClauses)
2354 : OMPExecutableDirective(this, OMPAtomicDirectiveClass, OMPD_atomic,
2355 SourceLocation(), SourceLocation(), NumClauses,
2357 IsXLHSInRHSPart(false), IsPostfixUpdate(false) {}
2359 /// Set 'x' part of the associated expression/statement.
2360 void setX(Expr *X) { *std::next(child_begin()) = X; }
2361 /// Set helper expression of the form
2362 /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or
2363 /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
2364 void setUpdateExpr(Expr *UE) { *std::next(child_begin(), 2) = UE; }
2365 /// Set 'v' part of the associated expression/statement.
2366 void setV(Expr *V) { *std::next(child_begin(), 3) = V; }
2367 /// Set 'expr' part of the associated expression/statement.
2368 void setExpr(Expr *E) { *std::next(child_begin(), 4) = E; }
2371 /// Creates directive with a list of \a Clauses and 'x', 'v' and 'expr'
2372 /// parts of the atomic construct (see Section 2.12.6, atomic Construct, for
2373 /// detailed description of 'x', 'v' and 'expr').
2375 /// \param C AST context.
2376 /// \param StartLoc Starting location of the directive kind.
2377 /// \param EndLoc Ending Location of the directive.
2378 /// \param Clauses List of clauses.
2379 /// \param AssociatedStmt Statement, associated with the directive.
2380 /// \param X 'x' part of the associated expression/statement.
2381 /// \param V 'v' part of the associated expression/statement.
2382 /// \param E 'expr' part of the associated expression/statement.
2383 /// \param UE Helper expression of the form
2384 /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or
2385 /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
2386 /// \param IsXLHSInRHSPart true if \a UE has the first form and false if the
2388 /// \param IsPostfixUpdate true if original value of 'x' must be stored in
2389 /// 'v', not an updated one.
2390 static OMPAtomicDirective *
2391 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2392 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
2393 Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate);
2395 /// Creates an empty directive with the place for \a NumClauses
2398 /// \param C AST context.
2399 /// \param NumClauses Number of clauses.
2401 static OMPAtomicDirective *CreateEmpty(const ASTContext &C,
2402 unsigned NumClauses, EmptyShell);
2404 /// Get 'x' part of the associated expression/statement.
2405 Expr *getX() { return cast_or_null<Expr>(*std::next(child_begin())); }
2406 const Expr *getX() const {
2407 return cast_or_null<Expr>(*std::next(child_begin()));
2409 /// Get helper expression of the form
2410 /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or
2411 /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
2412 Expr *getUpdateExpr() {
2413 return cast_or_null<Expr>(*std::next(child_begin(), 2));
2415 const Expr *getUpdateExpr() const {
2416 return cast_or_null<Expr>(*std::next(child_begin(), 2));
2418 /// Return true if helper update expression has form
2419 /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' and false if it has form
2420 /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
2421 bool isXLHSInRHSPart() const { return IsXLHSInRHSPart; }
2422 /// Return true if 'v' expression must be updated to original value of
2423 /// 'x', false if 'v' must be updated to the new value of 'x'.
2424 bool isPostfixUpdate() const { return IsPostfixUpdate; }
2425 /// Get 'v' part of the associated expression/statement.
2426 Expr *getV() { return cast_or_null<Expr>(*std::next(child_begin(), 3)); }
2427 const Expr *getV() const {
2428 return cast_or_null<Expr>(*std::next(child_begin(), 3));
2430 /// Get 'expr' part of the associated expression/statement.
2431 Expr *getExpr() { return cast_or_null<Expr>(*std::next(child_begin(), 4)); }
2432 const Expr *getExpr() const {
2433 return cast_or_null<Expr>(*std::next(child_begin(), 4));
2436 static bool classof(const Stmt *T) {
2437 return T->getStmtClass() == OMPAtomicDirectiveClass;
2441 /// This represents '#pragma omp target' directive.
2444 /// #pragma omp target if(a)
2446 /// In this example directive '#pragma omp target' has clause 'if' with
2449 class OMPTargetDirective : public OMPExecutableDirective {
2450 friend class ASTStmtReader;
2451 /// Build directive with the given start and end location.
2453 /// \param StartLoc Starting location of the directive kind.
2454 /// \param EndLoc Ending location of the directive.
2455 /// \param NumClauses Number of clauses.
2457 OMPTargetDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2458 unsigned NumClauses)
2459 : OMPExecutableDirective(this, OMPTargetDirectiveClass, OMPD_target,
2460 StartLoc, EndLoc, NumClauses, 1) {}
2462 /// Build an empty directive.
2464 /// \param NumClauses Number of clauses.
2466 explicit OMPTargetDirective(unsigned NumClauses)
2467 : OMPExecutableDirective(this, OMPTargetDirectiveClass, OMPD_target,
2468 SourceLocation(), SourceLocation(), NumClauses,
2472 /// Creates directive with a list of \a Clauses.
2474 /// \param C AST context.
2475 /// \param StartLoc Starting location of the directive kind.
2476 /// \param EndLoc Ending Location of the directive.
2477 /// \param Clauses List of clauses.
2478 /// \param AssociatedStmt Statement, associated with the directive.
2480 static OMPTargetDirective *
2481 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2482 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2484 /// Creates an empty directive with the place for \a NumClauses
2487 /// \param C AST context.
2488 /// \param NumClauses Number of clauses.
2490 static OMPTargetDirective *CreateEmpty(const ASTContext &C,
2491 unsigned NumClauses, EmptyShell);
2493 static bool classof(const Stmt *T) {
2494 return T->getStmtClass() == OMPTargetDirectiveClass;
2498 /// This represents '#pragma omp target data' directive.
2501 /// #pragma omp target data device(0) if(a) map(b[:])
2503 /// In this example directive '#pragma omp target data' has clauses 'device'
2504 /// with the value '0', 'if' with condition 'a' and 'map' with array
2507 class OMPTargetDataDirective : public OMPExecutableDirective {
2508 friend class ASTStmtReader;
2509 /// Build directive with the given start and end location.
2511 /// \param StartLoc Starting location of the directive kind.
2512 /// \param EndLoc Ending Location of the directive.
2513 /// \param NumClauses The number of clauses.
2515 OMPTargetDataDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2516 unsigned NumClauses)
2517 : OMPExecutableDirective(this, OMPTargetDataDirectiveClass,
2518 OMPD_target_data, StartLoc, EndLoc, NumClauses,
2521 /// Build an empty directive.
2523 /// \param NumClauses Number of clauses.
2525 explicit OMPTargetDataDirective(unsigned NumClauses)
2526 : OMPExecutableDirective(this, OMPTargetDataDirectiveClass,
2527 OMPD_target_data, SourceLocation(),
2528 SourceLocation(), NumClauses, 1) {}
2531 /// Creates directive with a list of \a Clauses.
2533 /// \param C AST context.
2534 /// \param StartLoc Starting location of the directive kind.
2535 /// \param EndLoc Ending Location of the directive.
2536 /// \param Clauses List of clauses.
2537 /// \param AssociatedStmt Statement, associated with the directive.
2539 static OMPTargetDataDirective *
2540 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2541 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2543 /// Creates an empty directive with the place for \a N clauses.
2545 /// \param C AST context.
2546 /// \param N The number of clauses.
2548 static OMPTargetDataDirective *CreateEmpty(const ASTContext &C, unsigned N,
2551 static bool classof(const Stmt *T) {
2552 return T->getStmtClass() == OMPTargetDataDirectiveClass;
2556 /// This represents '#pragma omp target enter data' directive.
2559 /// #pragma omp target enter data device(0) if(a) map(b[:])
2561 /// In this example directive '#pragma omp target enter data' has clauses
2562 /// 'device' with the value '0', 'if' with condition 'a' and 'map' with array
2565 class OMPTargetEnterDataDirective : public OMPExecutableDirective {
2566 friend class ASTStmtReader;
2567 /// Build directive with the given start and end location.
2569 /// \param StartLoc Starting location of the directive kind.
2570 /// \param EndLoc Ending Location of the directive.
2571 /// \param NumClauses The number of clauses.
2573 OMPTargetEnterDataDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2574 unsigned NumClauses)
2575 : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass,
2576 OMPD_target_enter_data, StartLoc, EndLoc,
2577 NumClauses, /*NumChildren=*/1) {}
2579 /// Build an empty directive.
2581 /// \param NumClauses Number of clauses.
2583 explicit OMPTargetEnterDataDirective(unsigned NumClauses)
2584 : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass,
2585 OMPD_target_enter_data, SourceLocation(),
2586 SourceLocation(), NumClauses,
2587 /*NumChildren=*/1) {}
2590 /// Creates directive with a list of \a Clauses.
2592 /// \param C AST context.
2593 /// \param StartLoc Starting location of the directive kind.
2594 /// \param EndLoc Ending Location of the directive.
2595 /// \param Clauses List of clauses.
2596 /// \param AssociatedStmt Statement, associated with the directive.
2598 static OMPTargetEnterDataDirective *
2599 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2600 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2602 /// Creates an empty directive with the place for \a N clauses.
2604 /// \param C AST context.
2605 /// \param N The number of clauses.
2607 static OMPTargetEnterDataDirective *CreateEmpty(const ASTContext &C,
2608 unsigned N, EmptyShell);
2610 static bool classof(const Stmt *T) {
2611 return T->getStmtClass() == OMPTargetEnterDataDirectiveClass;
2615 /// This represents '#pragma omp target exit data' directive.
2618 /// #pragma omp target exit data device(0) if(a) map(b[:])
2620 /// In this example directive '#pragma omp target exit data' has clauses
2621 /// 'device' with the value '0', 'if' with condition 'a' and 'map' with array
2624 class OMPTargetExitDataDirective : public OMPExecutableDirective {
2625 friend class ASTStmtReader;
2626 /// Build directive with the given start and end location.
2628 /// \param StartLoc Starting location of the directive kind.
2629 /// \param EndLoc Ending Location of the directive.
2630 /// \param NumClauses The number of clauses.
2632 OMPTargetExitDataDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2633 unsigned NumClauses)
2634 : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass,
2635 OMPD_target_exit_data, StartLoc, EndLoc,
2636 NumClauses, /*NumChildren=*/1) {}
2638 /// Build an empty directive.
2640 /// \param NumClauses Number of clauses.
2642 explicit OMPTargetExitDataDirective(unsigned NumClauses)
2643 : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass,
2644 OMPD_target_exit_data, SourceLocation(),
2645 SourceLocation(), NumClauses,
2646 /*NumChildren=*/1) {}
2649 /// Creates directive with a list of \a Clauses.
2651 /// \param C AST context.
2652 /// \param StartLoc Starting location of the directive kind.
2653 /// \param EndLoc Ending Location of the directive.
2654 /// \param Clauses List of clauses.
2655 /// \param AssociatedStmt Statement, associated with the directive.
2657 static OMPTargetExitDataDirective *
2658 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2659 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2661 /// Creates an empty directive with the place for \a N clauses.
2663 /// \param C AST context.
2664 /// \param N The number of clauses.
2666 static OMPTargetExitDataDirective *CreateEmpty(const ASTContext &C,
2667 unsigned N, EmptyShell);
2669 static bool classof(const Stmt *T) {
2670 return T->getStmtClass() == OMPTargetExitDataDirectiveClass;
2674 /// This represents '#pragma omp target parallel' directive.
2677 /// #pragma omp target parallel if(a)
2679 /// In this example directive '#pragma omp target parallel' has clause 'if' with
2682 class OMPTargetParallelDirective : public OMPExecutableDirective {
2683 friend class ASTStmtReader;
2684 /// Build directive with the given start and end location.
2686 /// \param StartLoc Starting location of the directive kind.
2687 /// \param EndLoc Ending location of the directive.
2688 /// \param NumClauses Number of clauses.
2690 OMPTargetParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2691 unsigned NumClauses)
2692 : OMPExecutableDirective(this, OMPTargetParallelDirectiveClass,
2693 OMPD_target_parallel, StartLoc, EndLoc,
2694 NumClauses, /*NumChildren=*/1) {}
2696 /// Build an empty directive.
2698 /// \param NumClauses Number of clauses.
2700 explicit OMPTargetParallelDirective(unsigned NumClauses)
2701 : OMPExecutableDirective(this, OMPTargetParallelDirectiveClass,
2702 OMPD_target_parallel, SourceLocation(),
2703 SourceLocation(), NumClauses,
2704 /*NumChildren=*/1) {}
2707 /// Creates directive with a list of \a Clauses.
2709 /// \param C AST context.
2710 /// \param StartLoc Starting location of the directive kind.
2711 /// \param EndLoc Ending Location of the directive.
2712 /// \param Clauses List of clauses.
2713 /// \param AssociatedStmt Statement, associated with the directive.
2715 static OMPTargetParallelDirective *
2716 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2717 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2719 /// Creates an empty directive with the place for \a NumClauses
2722 /// \param C AST context.
2723 /// \param NumClauses Number of clauses.
2725 static OMPTargetParallelDirective *
2726 CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
2728 static bool classof(const Stmt *T) {
2729 return T->getStmtClass() == OMPTargetParallelDirectiveClass;
2733 /// This represents '#pragma omp target parallel for' directive.
2736 /// #pragma omp target parallel for private(a,b) reduction(+:c,d)
2738 /// In this example directive '#pragma omp target parallel for' has clauses
2739 /// 'private' with the variables 'a' and 'b' and 'reduction' with operator '+'
2740 /// and variables 'c' and 'd'.
2742 class OMPTargetParallelForDirective : public OMPLoopDirective {
2743 friend class ASTStmtReader;
2745 /// true if current region has inner cancel directive.
2748 /// Build directive with the given start and end location.
2750 /// \param StartLoc Starting location of the directive kind.
2751 /// \param EndLoc Ending location of the directive.
2752 /// \param CollapsedNum Number of collapsed nested loops.
2753 /// \param NumClauses Number of clauses.
2755 OMPTargetParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2756 unsigned CollapsedNum, unsigned NumClauses)
2757 : OMPLoopDirective(this, OMPTargetParallelForDirectiveClass,
2758 OMPD_target_parallel_for, StartLoc, EndLoc,
2759 CollapsedNum, NumClauses),
2762 /// Build an empty directive.
2764 /// \param CollapsedNum Number of collapsed nested loops.
2765 /// \param NumClauses Number of clauses.
2767 explicit OMPTargetParallelForDirective(unsigned CollapsedNum,
2768 unsigned NumClauses)
2769 : OMPLoopDirective(this, OMPTargetParallelForDirectiveClass,
2770 OMPD_target_parallel_for, SourceLocation(),
2771 SourceLocation(), CollapsedNum, NumClauses),
2774 /// Set cancel state.
2775 void setHasCancel(bool Has) { HasCancel = Has; }
2778 /// Creates directive with a list of \a Clauses.
2780 /// \param C AST context.
2781 /// \param StartLoc Starting location of the directive kind.
2782 /// \param EndLoc Ending Location of the directive.
2783 /// \param CollapsedNum Number of collapsed loops.
2784 /// \param Clauses List of clauses.
2785 /// \param AssociatedStmt Statement, associated with the directive.
2786 /// \param Exprs Helper expressions for CodeGen.
2787 /// \param HasCancel true if current directive has inner cancel directive.
2789 static OMPTargetParallelForDirective *
2790 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2791 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
2792 Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
2794 /// Creates an empty directive with the place
2795 /// for \a NumClauses clauses.
2797 /// \param C AST context.
2798 /// \param CollapsedNum Number of collapsed nested loops.
2799 /// \param NumClauses Number of clauses.
2801 static OMPTargetParallelForDirective *CreateEmpty(const ASTContext &C,
2802 unsigned NumClauses,
2803 unsigned CollapsedNum,
2806 /// Return true if current directive has inner cancel directive.
2807 bool hasCancel() const { return HasCancel; }
2809 static bool classof(const Stmt *T) {
2810 return T->getStmtClass() == OMPTargetParallelForDirectiveClass;
2814 /// This represents '#pragma omp teams' directive.
2817 /// #pragma omp teams if(a)
2819 /// In this example directive '#pragma omp teams' has clause 'if' with
2822 class OMPTeamsDirective : public OMPExecutableDirective {
2823 friend class ASTStmtReader;
2824 /// Build directive with the given start and end location.
2826 /// \param StartLoc Starting location of the directive kind.
2827 /// \param EndLoc Ending location of the directive.
2828 /// \param NumClauses Number of clauses.
2830 OMPTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2831 unsigned NumClauses)
2832 : OMPExecutableDirective(this, OMPTeamsDirectiveClass, OMPD_teams,
2833 StartLoc, EndLoc, NumClauses, 1) {}
2835 /// Build an empty directive.
2837 /// \param NumClauses Number of clauses.
2839 explicit OMPTeamsDirective(unsigned NumClauses)
2840 : OMPExecutableDirective(this, OMPTeamsDirectiveClass, OMPD_teams,
2841 SourceLocation(), SourceLocation(), NumClauses,
2845 /// Creates directive with a list of \a Clauses.
2847 /// \param C AST context.
2848 /// \param StartLoc Starting location of the directive kind.
2849 /// \param EndLoc Ending Location of the directive.
2850 /// \param Clauses List of clauses.
2851 /// \param AssociatedStmt Statement, associated with the directive.
2853 static OMPTeamsDirective *Create(const ASTContext &C, SourceLocation StartLoc,
2854 SourceLocation EndLoc,
2855 ArrayRef<OMPClause *> Clauses,
2856 Stmt *AssociatedStmt);
2858 /// Creates an empty directive with the place for \a NumClauses
2861 /// \param C AST context.
2862 /// \param NumClauses Number of clauses.
2864 static OMPTeamsDirective *CreateEmpty(const ASTContext &C,
2865 unsigned NumClauses, EmptyShell);
2867 static bool classof(const Stmt *T) {
2868 return T->getStmtClass() == OMPTeamsDirectiveClass;
2872 /// This represents '#pragma omp cancellation point' directive.
2875 /// #pragma omp cancellation point for
2878 /// In this example a cancellation point is created for innermost 'for' region.
2879 class OMPCancellationPointDirective : public OMPExecutableDirective {
2880 friend class ASTStmtReader;
2881 OpenMPDirectiveKind CancelRegion;
2882 /// Build directive with the given start and end location.
2884 /// \param StartLoc Starting location of the directive kind.
2885 /// \param EndLoc Ending location of the directive.
2887 OMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2888 : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
2889 OMPD_cancellation_point, StartLoc, EndLoc, 0, 0),
2890 CancelRegion(OMPD_unknown) {}
2892 /// Build an empty directive.
2894 explicit OMPCancellationPointDirective()
2895 : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
2896 OMPD_cancellation_point, SourceLocation(),
2897 SourceLocation(), 0, 0),
2898 CancelRegion(OMPD_unknown) {}
2900 /// Set cancel region for current cancellation point.
2901 /// \param CR Cancellation region.
2902 void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
2905 /// Creates directive.
2907 /// \param C AST context.
2908 /// \param StartLoc Starting location of the directive kind.
2909 /// \param EndLoc Ending Location of the directive.
2911 static OMPCancellationPointDirective *
2912 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2913 OpenMPDirectiveKind CancelRegion);
2915 /// Creates an empty directive.
2917 /// \param C AST context.
2919 static OMPCancellationPointDirective *CreateEmpty(const ASTContext &C,
2922 /// Get cancellation region for the current cancellation point.
2923 OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; }
2925 static bool classof(const Stmt *T) {
2926 return T->getStmtClass() == OMPCancellationPointDirectiveClass;
2930 /// This represents '#pragma omp cancel' directive.
2933 /// #pragma omp cancel for
2936 /// In this example a cancel is created for innermost 'for' region.
2937 class OMPCancelDirective : public OMPExecutableDirective {
2938 friend class ASTStmtReader;
2939 OpenMPDirectiveKind CancelRegion;
2940 /// Build directive with the given start and end location.
2942 /// \param StartLoc Starting location of the directive kind.
2943 /// \param EndLoc Ending location of the directive.
2944 /// \param NumClauses Number of clauses.
2946 OMPCancelDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2947 unsigned NumClauses)
2948 : OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
2949 StartLoc, EndLoc, NumClauses, 0),
2950 CancelRegion(OMPD_unknown) {}
2952 /// Build an empty directive.
2954 /// \param NumClauses Number of clauses.
2955 explicit OMPCancelDirective(unsigned NumClauses)
2956 : OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
2957 SourceLocation(), SourceLocation(), NumClauses,
2959 CancelRegion(OMPD_unknown) {}
2961 /// Set cancel region for current cancellation point.
2962 /// \param CR Cancellation region.
2963 void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
2966 /// Creates directive.
2968 /// \param C AST context.
2969 /// \param StartLoc Starting location of the directive kind.
2970 /// \param EndLoc Ending Location of the directive.
2971 /// \param Clauses List of clauses.
2973 static OMPCancelDirective *
2974 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2975 ArrayRef<OMPClause *> Clauses, OpenMPDirectiveKind CancelRegion);
2977 /// Creates an empty directive.
2979 /// \param C AST context.
2980 /// \param NumClauses Number of clauses.
2982 static OMPCancelDirective *CreateEmpty(const ASTContext &C,
2983 unsigned NumClauses, EmptyShell);
2985 /// Get cancellation region for the current cancellation point.
2986 OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; }
2988 static bool classof(const Stmt *T) {
2989 return T->getStmtClass() == OMPCancelDirectiveClass;
2993 /// This represents '#pragma omp taskloop' directive.
2996 /// #pragma omp taskloop private(a,b) grainsize(val) num_tasks(num)
2998 /// In this example directive '#pragma omp taskloop' has clauses 'private'
2999 /// with the variables 'a' and 'b', 'grainsize' with expression 'val' and
3000 /// 'num_tasks' with expression 'num'.
3002 class OMPTaskLoopDirective : public OMPLoopDirective {
3003 friend class ASTStmtReader;
3004 /// Build directive with the given start and end location.
3006 /// \param StartLoc Starting location of the directive kind.
3007 /// \param EndLoc Ending location of the directive.
3008 /// \param CollapsedNum Number of collapsed nested loops.
3009 /// \param NumClauses Number of clauses.
3011 OMPTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3012 unsigned CollapsedNum, unsigned NumClauses)
3013 : OMPLoopDirective(this, OMPTaskLoopDirectiveClass, OMPD_taskloop,
3014 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
3016 /// Build an empty directive.
3018 /// \param CollapsedNum Number of collapsed nested loops.
3019 /// \param NumClauses Number of clauses.
3021 explicit OMPTaskLoopDirective(unsigned CollapsedNum, unsigned NumClauses)
3022 : OMPLoopDirective(this, OMPTaskLoopDirectiveClass, OMPD_taskloop,
3023 SourceLocation(), SourceLocation(), CollapsedNum,
3027 /// Creates directive with a list of \a Clauses.
3029 /// \param C AST context.
3030 /// \param StartLoc Starting location of the directive kind.
3031 /// \param EndLoc Ending Location of the directive.
3032 /// \param CollapsedNum Number of collapsed loops.
3033 /// \param Clauses List of clauses.
3034 /// \param AssociatedStmt Statement, associated with the directive.
3035 /// \param Exprs Helper expressions for CodeGen.
3037 static OMPTaskLoopDirective *
3038 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3039 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3040 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3042 /// Creates an empty directive with the place
3043 /// for \a NumClauses clauses.
3045 /// \param C AST context.
3046 /// \param CollapsedNum Number of collapsed nested loops.
3047 /// \param NumClauses Number of clauses.
3049 static OMPTaskLoopDirective *CreateEmpty(const ASTContext &C,
3050 unsigned NumClauses,
3051 unsigned CollapsedNum, EmptyShell);
3053 static bool classof(const Stmt *T) {
3054 return T->getStmtClass() == OMPTaskLoopDirectiveClass;
3058 /// This represents '#pragma omp taskloop simd' directive.
3061 /// #pragma omp taskloop simd private(a,b) grainsize(val) num_tasks(num)
3063 /// In this example directive '#pragma omp taskloop simd' has clauses 'private'
3064 /// with the variables 'a' and 'b', 'grainsize' with expression 'val' and
3065 /// 'num_tasks' with expression 'num'.
3067 class OMPTaskLoopSimdDirective : public OMPLoopDirective {
3068 friend class ASTStmtReader;
3069 /// Build directive with the given start and end location.
3071 /// \param StartLoc Starting location of the directive kind.
3072 /// \param EndLoc Ending location of the directive.
3073 /// \param CollapsedNum Number of collapsed nested loops.
3074 /// \param NumClauses Number of clauses.
3076 OMPTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3077 unsigned CollapsedNum, unsigned NumClauses)
3078 : OMPLoopDirective(this, OMPTaskLoopSimdDirectiveClass,
3079 OMPD_taskloop_simd, StartLoc, EndLoc, CollapsedNum,
3082 /// Build an empty directive.
3084 /// \param CollapsedNum Number of collapsed nested loops.
3085 /// \param NumClauses Number of clauses.
3087 explicit OMPTaskLoopSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
3088 : OMPLoopDirective(this, OMPTaskLoopSimdDirectiveClass,
3089 OMPD_taskloop_simd, SourceLocation(), SourceLocation(),
3090 CollapsedNum, NumClauses) {}
3093 /// Creates directive with a list of \a Clauses.
3095 /// \param C AST context.
3096 /// \param StartLoc Starting location of the directive kind.
3097 /// \param EndLoc Ending Location of the directive.
3098 /// \param CollapsedNum Number of collapsed loops.
3099 /// \param Clauses List of clauses.
3100 /// \param AssociatedStmt Statement, associated with the directive.
3101 /// \param Exprs Helper expressions for CodeGen.
3103 static OMPTaskLoopSimdDirective *
3104 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3105 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3106 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3108 /// Creates an empty directive with the place
3109 /// for \a NumClauses clauses.
3111 /// \param C AST context.
3112 /// \param CollapsedNum Number of collapsed nested loops.
3113 /// \param NumClauses Number of clauses.
3115 static OMPTaskLoopSimdDirective *CreateEmpty(const ASTContext &C,
3116 unsigned NumClauses,
3117 unsigned CollapsedNum,
3120 static bool classof(const Stmt *T) {
3121 return T->getStmtClass() == OMPTaskLoopSimdDirectiveClass;
3125 /// This represents '#pragma omp master taskloop' directive.
3128 /// #pragma omp master taskloop private(a,b) grainsize(val) num_tasks(num)
3130 /// In this example directive '#pragma omp master taskloop' has clauses
3131 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
3132 /// and 'num_tasks' with expression 'num'.
3134 class OMPMasterTaskLoopDirective : public OMPLoopDirective {
3135 friend class ASTStmtReader;
3136 /// Build directive with the given start and end location.
3138 /// \param StartLoc Starting location of the directive kind.
3139 /// \param EndLoc Ending location of the directive.
3140 /// \param CollapsedNum Number of collapsed nested loops.
3141 /// \param NumClauses Number of clauses.
3143 OMPMasterTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3144 unsigned CollapsedNum, unsigned NumClauses)
3145 : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass,
3146 OMPD_master_taskloop, StartLoc, EndLoc, CollapsedNum,
3149 /// Build an empty directive.
3151 /// \param CollapsedNum Number of collapsed nested loops.
3152 /// \param NumClauses Number of clauses.
3154 explicit OMPMasterTaskLoopDirective(unsigned CollapsedNum,
3155 unsigned NumClauses)
3156 : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass,
3157 OMPD_master_taskloop, SourceLocation(),
3158 SourceLocation(), CollapsedNum, NumClauses) {}
3161 /// Creates directive with a list of \a Clauses.
3163 /// \param C AST context.
3164 /// \param StartLoc Starting location of the directive kind.
3165 /// \param EndLoc Ending Location of the directive.
3166 /// \param CollapsedNum Number of collapsed loops.
3167 /// \param Clauses List of clauses.
3168 /// \param AssociatedStmt Statement, associated with the directive.
3169 /// \param Exprs Helper expressions for CodeGen.
3171 static OMPMasterTaskLoopDirective *
3172 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3173 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3174 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3176 /// Creates an empty directive with the place
3177 /// for \a NumClauses clauses.
3179 /// \param C AST context.
3180 /// \param CollapsedNum Number of collapsed nested loops.
3181 /// \param NumClauses Number of clauses.
3183 static OMPMasterTaskLoopDirective *CreateEmpty(const ASTContext &C,
3184 unsigned NumClauses,
3185 unsigned CollapsedNum,
3188 static bool classof(const Stmt *T) {
3189 return T->getStmtClass() == OMPMasterTaskLoopDirectiveClass;
3193 /// This represents '#pragma omp master taskloop simd' directive.
3196 /// #pragma omp master taskloop simd private(a,b) grainsize(val) num_tasks(num)
3198 /// In this example directive '#pragma omp master taskloop simd' has clauses
3199 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
3200 /// and 'num_tasks' with expression 'num'.
3202 class OMPMasterTaskLoopSimdDirective : public OMPLoopDirective {
3203 friend class ASTStmtReader;
3204 /// Build directive with the given start and end location.
3206 /// \param StartLoc Starting location of the directive kind.
3207 /// \param EndLoc Ending location of the directive.
3208 /// \param CollapsedNum Number of collapsed nested loops.
3209 /// \param NumClauses Number of clauses.
3211 OMPMasterTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3212 unsigned CollapsedNum, unsigned NumClauses)
3213 : OMPLoopDirective(this, OMPMasterTaskLoopSimdDirectiveClass,
3214 OMPD_master_taskloop_simd, StartLoc, EndLoc,
3215 CollapsedNum, NumClauses) {}
3217 /// Build an empty directive.
3219 /// \param CollapsedNum Number of collapsed nested loops.
3220 /// \param NumClauses Number of clauses.
3222 explicit OMPMasterTaskLoopSimdDirective(unsigned CollapsedNum,
3223 unsigned NumClauses)
3224 : OMPLoopDirective(this, OMPMasterTaskLoopSimdDirectiveClass,
3225 OMPD_master_taskloop_simd, SourceLocation(),
3226 SourceLocation(), CollapsedNum, NumClauses) {}
3229 /// Creates directive with a list of \p Clauses.
3231 /// \param C AST context.
3232 /// \param StartLoc Starting location of the directive kind.
3233 /// \param EndLoc Ending Location of the directive.
3234 /// \param CollapsedNum Number of collapsed loops.
3235 /// \param Clauses List of clauses.
3236 /// \param AssociatedStmt Statement, associated with the directive.
3237 /// \param Exprs Helper expressions for CodeGen.
3239 static OMPMasterTaskLoopSimdDirective *
3240 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3241 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3242 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3244 /// Creates an empty directive with the place for \p NumClauses clauses.
3246 /// \param C AST context.
3247 /// \param CollapsedNum Number of collapsed nested loops.
3248 /// \param NumClauses Number of clauses.
3250 static OMPMasterTaskLoopSimdDirective *CreateEmpty(const ASTContext &C,
3251 unsigned NumClauses,
3252 unsigned CollapsedNum,
3255 static bool classof(const Stmt *T) {
3256 return T->getStmtClass() == OMPMasterTaskLoopSimdDirectiveClass;
3260 /// This represents '#pragma omp parallel master taskloop' directive.
3263 /// #pragma omp parallel master taskloop private(a,b) grainsize(val)
3266 /// In this example directive '#pragma omp parallel master taskloop' has clauses
3267 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
3268 /// and 'num_tasks' with expression 'num'.
3270 class OMPParallelMasterTaskLoopDirective : public OMPLoopDirective {
3271 friend class ASTStmtReader;
3272 /// Build directive with the given start and end location.
3274 /// \param StartLoc Starting location of the directive kind.
3275 /// \param EndLoc Ending location of the directive.
3276 /// \param CollapsedNum Number of collapsed nested loops.
3277 /// \param NumClauses Number of clauses.
3279 OMPParallelMasterTaskLoopDirective(SourceLocation StartLoc,
3280 SourceLocation EndLoc,
3281 unsigned CollapsedNum, unsigned NumClauses)
3282 : OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass,
3283 OMPD_parallel_master_taskloop, StartLoc, EndLoc,
3284 CollapsedNum, NumClauses) {}
3286 /// Build an empty directive.
3288 /// \param CollapsedNum Number of collapsed nested loops.
3289 /// \param NumClauses Number of clauses.
3291 explicit OMPParallelMasterTaskLoopDirective(unsigned CollapsedNum,
3292 unsigned NumClauses)
3293 : OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass,
3294 OMPD_parallel_master_taskloop, SourceLocation(),
3295 SourceLocation(), CollapsedNum, NumClauses) {}
3298 /// Creates directive with a list of \a Clauses.
3300 /// \param C AST context.
3301 /// \param StartLoc Starting location of the directive kind.
3302 /// \param EndLoc Ending Location of the directive.
3303 /// \param CollapsedNum Number of collapsed loops.
3304 /// \param Clauses List of clauses.
3305 /// \param AssociatedStmt Statement, associated with the directive.
3306 /// \param Exprs Helper expressions for CodeGen.
3308 static OMPParallelMasterTaskLoopDirective *
3309 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3310 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3311 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3313 /// Creates an empty directive with the place
3314 /// for \a NumClauses clauses.
3316 /// \param C AST context.
3317 /// \param CollapsedNum Number of collapsed nested loops.
3318 /// \param NumClauses Number of clauses.
3320 static OMPParallelMasterTaskLoopDirective *CreateEmpty(const ASTContext &C,
3321 unsigned NumClauses,
3322 unsigned CollapsedNum,
3325 static bool classof(const Stmt *T) {
3326 return T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass;
3330 /// This represents '#pragma omp distribute' directive.
3333 /// #pragma omp distribute private(a,b)
3335 /// In this example directive '#pragma omp distribute' has clauses 'private'
3336 /// with the variables 'a' and 'b'
3338 class OMPDistributeDirective : public OMPLoopDirective {
3339 friend class ASTStmtReader;
3341 /// Build directive with the given start and end location.
3343 /// \param StartLoc Starting location of the directive kind.
3344 /// \param EndLoc Ending location of the directive.
3345 /// \param CollapsedNum Number of collapsed nested loops.
3346 /// \param NumClauses Number of clauses.
3348 OMPDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3349 unsigned CollapsedNum, unsigned NumClauses)
3350 : OMPLoopDirective(this, OMPDistributeDirectiveClass, OMPD_distribute,
3351 StartLoc, EndLoc, CollapsedNum, NumClauses)
3354 /// Build an empty directive.
3356 /// \param CollapsedNum Number of collapsed nested loops.
3357 /// \param NumClauses Number of clauses.
3359 explicit OMPDistributeDirective(unsigned CollapsedNum, unsigned NumClauses)
3360 : OMPLoopDirective(this, OMPDistributeDirectiveClass, OMPD_distribute,
3361 SourceLocation(), SourceLocation(), CollapsedNum,
3366 /// Creates directive with a list of \a Clauses.
3368 /// \param C AST context.
3369 /// \param StartLoc Starting location of the directive kind.
3370 /// \param EndLoc Ending Location of the directive.
3371 /// \param CollapsedNum Number of collapsed loops.
3372 /// \param Clauses List of clauses.
3373 /// \param AssociatedStmt Statement, associated with the directive.
3374 /// \param Exprs Helper expressions for CodeGen.
3376 static OMPDistributeDirective *
3377 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3378 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3379 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3381 /// Creates an empty directive with the place
3382 /// for \a NumClauses clauses.
3384 /// \param C AST context.
3385 /// \param CollapsedNum Number of collapsed nested loops.
3386 /// \param NumClauses Number of clauses.
3388 static OMPDistributeDirective *CreateEmpty(const ASTContext &C,
3389 unsigned NumClauses,
3390 unsigned CollapsedNum, EmptyShell);
3392 static bool classof(const Stmt *T) {
3393 return T->getStmtClass() == OMPDistributeDirectiveClass;
3397 /// This represents '#pragma omp target update' directive.
3400 /// #pragma omp target update to(a) from(b) device(1)
3402 /// In this example directive '#pragma omp target update' has clause 'to' with
3403 /// argument 'a', clause 'from' with argument 'b' and clause 'device' with
3406 class OMPTargetUpdateDirective : public OMPExecutableDirective {
3407 friend class ASTStmtReader;
3408 /// Build directive with the given start and end location.
3410 /// \param StartLoc Starting location of the directive kind.
3411 /// \param EndLoc Ending Location of the directive.
3412 /// \param NumClauses The number of clauses.
3414 OMPTargetUpdateDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3415 unsigned NumClauses)
3416 : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass,
3417 OMPD_target_update, StartLoc, EndLoc, NumClauses,
3420 /// Build an empty directive.
3422 /// \param NumClauses Number of clauses.
3424 explicit OMPTargetUpdateDirective(unsigned NumClauses)
3425 : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass,
3426 OMPD_target_update, SourceLocation(),
3427 SourceLocation(), NumClauses, 1) {}
3430 /// Creates directive with a list of \a Clauses.
3432 /// \param C AST context.
3433 /// \param StartLoc Starting location of the directive kind.
3434 /// \param EndLoc Ending Location of the directive.
3435 /// \param Clauses List of clauses.
3436 /// \param AssociatedStmt Statement, associated with the directive.
3438 static OMPTargetUpdateDirective *
3439 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3440 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3442 /// Creates an empty directive with the place for \a NumClauses
3445 /// \param C AST context.
3446 /// \param NumClauses The number of clauses.
3448 static OMPTargetUpdateDirective *CreateEmpty(const ASTContext &C,
3449 unsigned NumClauses, EmptyShell);
3451 static bool classof(const Stmt *T) {
3452 return T->getStmtClass() == OMPTargetUpdateDirectiveClass;
3456 /// This represents '#pragma omp distribute parallel for' composite
3460 /// #pragma omp distribute parallel for private(a,b)
3462 /// In this example directive '#pragma omp distribute parallel for' has clause
3463 /// 'private' with the variables 'a' and 'b'
3465 class OMPDistributeParallelForDirective : public OMPLoopDirective {
3466 friend class ASTStmtReader;
3467 /// true if the construct has inner cancel directive.
3468 bool HasCancel = false;
3470 /// Build directive with the given start and end location.
3472 /// \param StartLoc Starting location of the directive kind.
3473 /// \param EndLoc Ending location of the directive.
3474 /// \param CollapsedNum Number of collapsed nested loops.
3475 /// \param NumClauses Number of clauses.
3477 OMPDistributeParallelForDirective(SourceLocation StartLoc,
3478 SourceLocation EndLoc,
3479 unsigned CollapsedNum, unsigned NumClauses)
3480 : OMPLoopDirective(this, OMPDistributeParallelForDirectiveClass,
3481 OMPD_distribute_parallel_for, StartLoc, EndLoc,
3482 CollapsedNum, NumClauses), HasCancel(false) {}
3484 /// Build an empty directive.
3486 /// \param CollapsedNum Number of collapsed nested loops.
3487 /// \param NumClauses Number of clauses.
3489 explicit OMPDistributeParallelForDirective(unsigned CollapsedNum,
3490 unsigned NumClauses)
3491 : OMPLoopDirective(this, OMPDistributeParallelForDirectiveClass,
3492 OMPD_distribute_parallel_for, SourceLocation(),
3493 SourceLocation(), CollapsedNum, NumClauses),
3496 /// Set cancel state.
3497 void setHasCancel(bool Has) { HasCancel = Has; }
3500 /// Creates directive with a list of \a Clauses.
3502 /// \param C AST context.
3503 /// \param StartLoc Starting location of the directive kind.
3504 /// \param EndLoc Ending Location of the directive.
3505 /// \param CollapsedNum Number of collapsed loops.
3506 /// \param Clauses List of clauses.
3507 /// \param AssociatedStmt Statement, associated with the directive.
3508 /// \param Exprs Helper expressions for CodeGen.
3509 /// \param HasCancel true if this directive has inner cancel directive.
3511 static OMPDistributeParallelForDirective *
3512 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3513 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3514 Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
3516 /// Creates an empty directive with the place
3517 /// for \a NumClauses clauses.
3519 /// \param C AST context.
3520 /// \param CollapsedNum Number of collapsed nested loops.
3521 /// \param NumClauses Number of clauses.
3523 static OMPDistributeParallelForDirective *CreateEmpty(const ASTContext &C,
3524 unsigned NumClauses,
3525 unsigned CollapsedNum,
3528 /// Return true if current directive has inner cancel directive.
3529 bool hasCancel() const { return HasCancel; }
3531 static bool classof(const Stmt *T) {
3532 return T->getStmtClass() == OMPDistributeParallelForDirectiveClass;
3536 /// This represents '#pragma omp distribute parallel for simd' composite
3540 /// #pragma omp distribute parallel for simd private(x)
3542 /// In this example directive '#pragma omp distribute parallel for simd' has
3543 /// clause 'private' with the variables 'x'
3545 class OMPDistributeParallelForSimdDirective final : public OMPLoopDirective {
3546 friend class ASTStmtReader;
3548 /// Build directive with the given start and end location.
3550 /// \param StartLoc Starting location of the directive kind.
3551 /// \param EndLoc Ending location of the directive.
3552 /// \param CollapsedNum Number of collapsed nested loops.
3553 /// \param NumClauses Number of clauses.
3555 OMPDistributeParallelForSimdDirective(SourceLocation StartLoc,
3556 SourceLocation EndLoc,
3557 unsigned CollapsedNum,
3558 unsigned NumClauses)
3559 : OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass,
3560 OMPD_distribute_parallel_for_simd, StartLoc,
3561 EndLoc, CollapsedNum, NumClauses) {}
3563 /// Build an empty directive.
3565 /// \param CollapsedNum Number of collapsed nested loops.
3566 /// \param NumClauses Number of clauses.
3568 explicit OMPDistributeParallelForSimdDirective(unsigned CollapsedNum,
3569 unsigned NumClauses)
3570 : OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass,
3571 OMPD_distribute_parallel_for_simd,
3572 SourceLocation(), SourceLocation(), CollapsedNum,
3576 /// Creates directive with a list of \a Clauses.
3578 /// \param C AST context.
3579 /// \param StartLoc Starting location of the directive kind.
3580 /// \param EndLoc Ending Location of the directive.
3581 /// \param CollapsedNum Number of collapsed loops.
3582 /// \param Clauses List of clauses.
3583 /// \param AssociatedStmt Statement, associated with the directive.
3584 /// \param Exprs Helper expressions for CodeGen.
3586 static OMPDistributeParallelForSimdDirective *Create(
3587 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3588 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3589 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3591 /// Creates an empty directive with the place for \a NumClauses clauses.
3593 /// \param C AST context.
3594 /// \param CollapsedNum Number of collapsed nested loops.
3595 /// \param NumClauses Number of clauses.
3597 static OMPDistributeParallelForSimdDirective *CreateEmpty(
3598 const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
3601 static bool classof(const Stmt *T) {
3602 return T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass;
3606 /// This represents '#pragma omp distribute simd' composite directive.
3609 /// #pragma omp distribute simd private(x)
3611 /// In this example directive '#pragma omp distribute simd' has clause
3612 /// 'private' with the variables 'x'
3614 class OMPDistributeSimdDirective final : public OMPLoopDirective {
3615 friend class ASTStmtReader;
3617 /// Build directive with the given start and end location.
3619 /// \param StartLoc Starting location of the directive kind.
3620 /// \param EndLoc Ending location of the directive.
3621 /// \param CollapsedNum Number of collapsed nested loops.
3622 /// \param NumClauses Number of clauses.
3624 OMPDistributeSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3625 unsigned CollapsedNum, unsigned NumClauses)
3626 : OMPLoopDirective(this, OMPDistributeSimdDirectiveClass,
3627 OMPD_distribute_simd, StartLoc, EndLoc, CollapsedNum,
3630 /// Build an empty directive.
3632 /// \param CollapsedNum Number of collapsed nested loops.
3633 /// \param NumClauses Number of clauses.
3635 explicit OMPDistributeSimdDirective(unsigned CollapsedNum,
3636 unsigned NumClauses)
3637 : OMPLoopDirective(this, OMPDistributeSimdDirectiveClass,
3638 OMPD_distribute_simd, SourceLocation(),
3639 SourceLocation(), CollapsedNum, NumClauses) {}
3642 /// Creates directive with a list of \a Clauses.
3644 /// \param C AST context.
3645 /// \param StartLoc Starting location of the directive kind.
3646 /// \param EndLoc Ending Location of the directive.
3647 /// \param CollapsedNum Number of collapsed loops.
3648 /// \param Clauses List of clauses.
3649 /// \param AssociatedStmt Statement, associated with the directive.
3650 /// \param Exprs Helper expressions for CodeGen.
3652 static OMPDistributeSimdDirective *
3653 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3654 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3655 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3657 /// Creates an empty directive with the place for \a NumClauses clauses.
3659 /// \param C AST context.
3660 /// \param CollapsedNum Number of collapsed nested loops.
3661 /// \param NumClauses Number of clauses.
3663 static OMPDistributeSimdDirective *CreateEmpty(const ASTContext &C,
3664 unsigned NumClauses,
3665 unsigned CollapsedNum,
3668 static bool classof(const Stmt *T) {
3669 return T->getStmtClass() == OMPDistributeSimdDirectiveClass;
3673 /// This represents '#pragma omp target parallel for simd' directive.
3676 /// #pragma omp target parallel for simd private(a) map(b) safelen(c)
3678 /// In this example directive '#pragma omp target parallel for simd' has clauses
3679 /// 'private' with the variable 'a', 'map' with the variable 'b' and 'safelen'
3680 /// with the variable 'c'.
3682 class OMPTargetParallelForSimdDirective final : public OMPLoopDirective {
3683 friend class ASTStmtReader;
3685 /// Build directive with the given start and end location.
3687 /// \param StartLoc Starting location of the directive kind.
3688 /// \param EndLoc Ending location of the directive.
3689 /// \param CollapsedNum Number of collapsed nested loops.
3690 /// \param NumClauses Number of clauses.
3692 OMPTargetParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3693 unsigned CollapsedNum, unsigned NumClauses)
3694 : OMPLoopDirective(this, OMPTargetParallelForSimdDirectiveClass,
3695 OMPD_target_parallel_for_simd, StartLoc, EndLoc,
3696 CollapsedNum, NumClauses) {}
3698 /// Build an empty directive.
3700 /// \param CollapsedNum Number of collapsed nested loops.
3701 /// \param NumClauses Number of clauses.
3703 explicit OMPTargetParallelForSimdDirective(unsigned CollapsedNum,
3704 unsigned NumClauses)
3705 : OMPLoopDirective(this, OMPTargetParallelForSimdDirectiveClass,
3706 OMPD_target_parallel_for_simd, SourceLocation(),
3707 SourceLocation(), CollapsedNum, NumClauses) {}
3710 /// Creates directive with a list of \a Clauses.
3712 /// \param C AST context.
3713 /// \param StartLoc Starting location of the directive kind.
3714 /// \param EndLoc Ending Location of the directive.
3715 /// \param CollapsedNum Number of collapsed loops.
3716 /// \param Clauses List of clauses.
3717 /// \param AssociatedStmt Statement, associated with the directive.
3718 /// \param Exprs Helper expressions for CodeGen.
3720 static OMPTargetParallelForSimdDirective *
3721 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3722 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3723 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3725 /// Creates an empty directive with the place for \a NumClauses clauses.
3727 /// \param C AST context.
3728 /// \param CollapsedNum Number of collapsed nested loops.
3729 /// \param NumClauses Number of clauses.
3731 static OMPTargetParallelForSimdDirective *CreateEmpty(const ASTContext &C,
3732 unsigned NumClauses,
3733 unsigned CollapsedNum,
3736 static bool classof(const Stmt *T) {
3737 return T->getStmtClass() == OMPTargetParallelForSimdDirectiveClass;
3741 /// This represents '#pragma omp target simd' directive.
3744 /// #pragma omp target simd private(a) map(b) safelen(c)
3746 /// In this example directive '#pragma omp target simd' has clauses 'private'
3747 /// with the variable 'a', 'map' with the variable 'b' and 'safelen' with
3748 /// the variable 'c'.
3750 class OMPTargetSimdDirective final : public OMPLoopDirective {
3751 friend class ASTStmtReader;
3753 /// Build directive with the given start and end location.
3755 /// \param StartLoc Starting location of the directive kind.
3756 /// \param EndLoc Ending location of the directive.
3757 /// \param CollapsedNum Number of collapsed nested loops.
3758 /// \param NumClauses Number of clauses.
3760 OMPTargetSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3761 unsigned CollapsedNum, unsigned NumClauses)
3762 : OMPLoopDirective(this, OMPTargetSimdDirectiveClass,
3763 OMPD_target_simd, StartLoc, EndLoc, CollapsedNum,
3766 /// Build an empty directive.
3768 /// \param CollapsedNum Number of collapsed nested loops.
3769 /// \param NumClauses Number of clauses.
3771 explicit OMPTargetSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
3772 : OMPLoopDirective(this, OMPTargetSimdDirectiveClass, OMPD_target_simd,
3773 SourceLocation(),SourceLocation(), CollapsedNum,
3777 /// Creates directive with a list of \a Clauses.
3779 /// \param C AST context.
3780 /// \param StartLoc Starting location of the directive kind.
3781 /// \param EndLoc Ending Location of the directive.
3782 /// \param CollapsedNum Number of collapsed loops.
3783 /// \param Clauses List of clauses.
3784 /// \param AssociatedStmt Statement, associated with the directive.
3785 /// \param Exprs Helper expressions for CodeGen.
3787 static OMPTargetSimdDirective *
3788 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3789 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3790 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3792 /// Creates an empty directive with the place for \a NumClauses clauses.
3794 /// \param C AST context.
3795 /// \param CollapsedNum Number of collapsed nested loops.
3796 /// \param NumClauses Number of clauses.
3798 static OMPTargetSimdDirective *CreateEmpty(const ASTContext &C,
3799 unsigned NumClauses,
3800 unsigned CollapsedNum,
3803 static bool classof(const Stmt *T) {
3804 return T->getStmtClass() == OMPTargetSimdDirectiveClass;
3808 /// This represents '#pragma omp teams distribute' directive.
3811 /// #pragma omp teams distribute private(a,b)
3813 /// In this example directive '#pragma omp teams distribute' has clauses
3814 /// 'private' with the variables 'a' and 'b'
3816 class OMPTeamsDistributeDirective final : public OMPLoopDirective {
3817 friend class ASTStmtReader;
3819 /// Build directive with the given start and end location.
3821 /// \param StartLoc Starting location of the directive kind.
3822 /// \param EndLoc Ending location of the directive.
3823 /// \param CollapsedNum Number of collapsed nested loops.
3824 /// \param NumClauses Number of clauses.
3826 OMPTeamsDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3827 unsigned CollapsedNum, unsigned NumClauses)
3828 : OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass,
3829 OMPD_teams_distribute, StartLoc, EndLoc,
3830 CollapsedNum, NumClauses) {}
3832 /// Build an empty directive.
3834 /// \param CollapsedNum Number of collapsed nested loops.
3835 /// \param NumClauses Number of clauses.
3837 explicit OMPTeamsDistributeDirective(unsigned CollapsedNum,
3838 unsigned NumClauses)
3839 : OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass,
3840 OMPD_teams_distribute, SourceLocation(),
3841 SourceLocation(), CollapsedNum, NumClauses) {}
3844 /// Creates directive with a list of \a Clauses.
3846 /// \param C AST context.
3847 /// \param StartLoc Starting location of the directive kind.
3848 /// \param EndLoc Ending Location of the directive.
3849 /// \param CollapsedNum Number of collapsed loops.
3850 /// \param Clauses List of clauses.
3851 /// \param AssociatedStmt Statement, associated with the directive.
3852 /// \param Exprs Helper expressions for CodeGen.
3854 static OMPTeamsDistributeDirective *
3855 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3856 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3857 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3859 /// Creates an empty directive with the place for \a NumClauses clauses.
3861 /// \param C AST context.
3862 /// \param CollapsedNum Number of collapsed nested loops.
3863 /// \param NumClauses Number of clauses.
3865 static OMPTeamsDistributeDirective *CreateEmpty(const ASTContext &C,
3866 unsigned NumClauses,
3867 unsigned CollapsedNum,
3870 static bool classof(const Stmt *T) {
3871 return T->getStmtClass() == OMPTeamsDistributeDirectiveClass;
3875 /// This represents '#pragma omp teams distribute simd'
3876 /// combined directive.
3879 /// #pragma omp teams distribute simd private(a,b)
3881 /// In this example directive '#pragma omp teams distribute simd'
3882 /// has clause 'private' with the variables 'a' and 'b'
3884 class OMPTeamsDistributeSimdDirective final : public OMPLoopDirective {
3885 friend class ASTStmtReader;
3887 /// Build directive with the given start and end location.
3889 /// \param StartLoc Starting location of the directive kind.
3890 /// \param EndLoc Ending location of the directive.
3891 /// \param CollapsedNum Number of collapsed nested loops.
3892 /// \param NumClauses Number of clauses.
3894 OMPTeamsDistributeSimdDirective(SourceLocation StartLoc,
3895 SourceLocation EndLoc, unsigned CollapsedNum,
3896 unsigned NumClauses)
3897 : OMPLoopDirective(this, OMPTeamsDistributeSimdDirectiveClass,
3898 OMPD_teams_distribute_simd, StartLoc, EndLoc,
3899 CollapsedNum, NumClauses) {}
3901 /// Build an empty directive.
3903 /// \param CollapsedNum Number of collapsed nested loops.
3904 /// \param NumClauses Number of clauses.
3906 explicit OMPTeamsDistributeSimdDirective(unsigned CollapsedNum,
3907 unsigned NumClauses)
3908 : OMPLoopDirective(this, OMPTeamsDistributeSimdDirectiveClass,
3909 OMPD_teams_distribute_simd, SourceLocation(),
3910 SourceLocation(), CollapsedNum, NumClauses) {}
3913 /// Creates directive with a list of \a Clauses.
3915 /// \param C AST context.
3916 /// \param StartLoc Starting location of the directive kind.
3917 /// \param EndLoc Ending Location of the directive.
3918 /// \param CollapsedNum Number of collapsed loops.
3919 /// \param Clauses List of clauses.
3920 /// \param AssociatedStmt Statement, associated with the directive.
3921 /// \param Exprs Helper expressions for CodeGen.
3923 static OMPTeamsDistributeSimdDirective *
3924 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3925 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3926 Stmt *AssociatedStmt, const HelperExprs &Exprs);
3928 /// Creates an empty directive with the place
3929 /// for \a NumClauses clauses.
3931 /// \param C AST context.
3932 /// \param CollapsedNum Number of collapsed nested loops.
3933 /// \param NumClauses Number of clauses.
3935 static OMPTeamsDistributeSimdDirective *CreateEmpty(const ASTContext &C,
3936 unsigned NumClauses,
3937 unsigned CollapsedNum,
3940 static bool classof(const Stmt *T) {
3941 return T->getStmtClass() == OMPTeamsDistributeSimdDirectiveClass;
3945 /// This represents '#pragma omp teams distribute parallel for simd' composite
3949 /// #pragma omp teams distribute parallel for simd private(x)
3951 /// In this example directive '#pragma omp teams distribute parallel for simd'
3952 /// has clause 'private' with the variables 'x'
3954 class OMPTeamsDistributeParallelForSimdDirective final
3955 : public OMPLoopDirective {
3956 friend class ASTStmtReader;
3958 /// Build directive with the given start and end location.
3960 /// \param StartLoc Starting location of the directive kind.
3961 /// \param EndLoc Ending location of the directive.
3962 /// \param CollapsedNum Number of collapsed nested loops.
3963 /// \param NumClauses Number of clauses.
3965 OMPTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc,
3966 SourceLocation EndLoc,
3967 unsigned CollapsedNum,
3968 unsigned NumClauses)
3969 : OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass,
3970 OMPD_teams_distribute_parallel_for_simd, StartLoc,
3971 EndLoc, CollapsedNum, NumClauses) {}
3973 /// Build an empty directive.
3975 /// \param CollapsedNum Number of collapsed nested loops.
3976 /// \param NumClauses Number of clauses.
3978 explicit OMPTeamsDistributeParallelForSimdDirective(unsigned CollapsedNum,
3979 unsigned NumClauses)
3980 : OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass,
3981 OMPD_teams_distribute_parallel_for_simd,
3982 SourceLocation(), SourceLocation(), CollapsedNum,
3986 /// Creates directive with a list of \a Clauses.
3988 /// \param C AST context.
3989 /// \param StartLoc Starting location of the directive kind.
3990 /// \param EndLoc Ending Location of the directive.
3991 /// \param CollapsedNum Number of collapsed loops.
3992 /// \param Clauses List of clauses.
3993 /// \param AssociatedStmt Statement, associated with the directive.
3994 /// \param Exprs Helper expressions for CodeGen.
3996 static OMPTeamsDistributeParallelForSimdDirective *
3997 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3998 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3999 Stmt *AssociatedStmt, const HelperExprs &Exprs);
4001 /// Creates an empty directive with the place for \a NumClauses clauses.
4003 /// \param C AST context.
4004 /// \param CollapsedNum Number of collapsed nested loops.
4005 /// \param NumClauses Number of clauses.
4007 static OMPTeamsDistributeParallelForSimdDirective *
4008 CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4011 static bool classof(const Stmt *T) {
4012 return T->getStmtClass() == OMPTeamsDistributeParallelForSimdDirectiveClass;
4016 /// This represents '#pragma omp teams distribute parallel for' composite
4020 /// #pragma omp teams distribute parallel for private(x)
4022 /// In this example directive '#pragma omp teams distribute parallel for'
4023 /// has clause 'private' with the variables 'x'
4025 class OMPTeamsDistributeParallelForDirective final : public OMPLoopDirective {
4026 friend class ASTStmtReader;
4027 /// true if the construct has inner cancel directive.
4028 bool HasCancel = false;
4030 /// Build directive with the given start and end location.
4032 /// \param StartLoc Starting location of the directive kind.
4033 /// \param EndLoc Ending location of the directive.
4034 /// \param CollapsedNum Number of collapsed nested loops.
4035 /// \param NumClauses Number of clauses.
4037 OMPTeamsDistributeParallelForDirective(SourceLocation StartLoc,
4038 SourceLocation EndLoc,
4039 unsigned CollapsedNum,
4040 unsigned NumClauses)
4041 : OMPLoopDirective(this, OMPTeamsDistributeParallelForDirectiveClass,
4042 OMPD_teams_distribute_parallel_for, StartLoc, EndLoc,
4043 CollapsedNum, NumClauses), HasCancel(false) {}
4045 /// Build an empty directive.
4047 /// \param CollapsedNum Number of collapsed nested loops.
4048 /// \param NumClauses Number of clauses.
4050 explicit OMPTeamsDistributeParallelForDirective(unsigned CollapsedNum,
4051 unsigned NumClauses)
4052 : OMPLoopDirective(this, OMPTeamsDistributeParallelForDirectiveClass,
4053 OMPD_teams_distribute_parallel_for, SourceLocation(),
4054 SourceLocation(), CollapsedNum, NumClauses),
4057 /// Set cancel state.
4058 void setHasCancel(bool Has) { HasCancel = Has; }
4061 /// Creates directive with a list of \a Clauses.
4063 /// \param C AST context.
4064 /// \param StartLoc Starting location of the directive kind.
4065 /// \param EndLoc Ending Location of the directive.
4066 /// \param CollapsedNum Number of collapsed loops.
4067 /// \param Clauses List of clauses.
4068 /// \param AssociatedStmt Statement, associated with the directive.
4069 /// \param Exprs Helper expressions for CodeGen.
4070 /// \param HasCancel true if this directive has inner cancel directive.
4072 static OMPTeamsDistributeParallelForDirective *
4073 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4074 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4075 Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
4077 /// Creates an empty directive with the place for \a NumClauses clauses.
4079 /// \param C AST context.
4080 /// \param CollapsedNum Number of collapsed nested loops.
4081 /// \param NumClauses Number of clauses.
4083 static OMPTeamsDistributeParallelForDirective *
4084 CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4087 /// Return true if current directive has inner cancel directive.
4088 bool hasCancel() const { return HasCancel; }
4090 static bool classof(const Stmt *T) {
4091 return T->getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass;
4095 /// This represents '#pragma omp target teams' directive.
4098 /// #pragma omp target teams if(a>0)
4100 /// In this example directive '#pragma omp target teams' has clause 'if' with
4101 /// condition 'a>0'.
4103 class OMPTargetTeamsDirective final : public OMPExecutableDirective {
4104 friend class ASTStmtReader;
4105 /// Build directive with the given start and end location.
4107 /// \param StartLoc Starting location of the directive kind.
4108 /// \param EndLoc Ending location of the directive.
4109 /// \param NumClauses Number of clauses.
4111 OMPTargetTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4112 unsigned NumClauses)
4113 : OMPExecutableDirective(this, OMPTargetTeamsDirectiveClass,
4114 OMPD_target_teams, StartLoc, EndLoc, NumClauses,
4117 /// Build an empty directive.
4119 /// \param NumClauses Number of clauses.
4121 explicit OMPTargetTeamsDirective(unsigned NumClauses)
4122 : OMPExecutableDirective(this, OMPTargetTeamsDirectiveClass,
4123 OMPD_target_teams, SourceLocation(),
4124 SourceLocation(), NumClauses, 1) {}
4127 /// Creates directive with a list of \a Clauses.
4129 /// \param C AST context.
4130 /// \param StartLoc Starting location of the directive kind.
4131 /// \param EndLoc Ending Location of the directive.
4132 /// \param Clauses List of clauses.
4133 /// \param AssociatedStmt Statement, associated with the directive.
4135 static OMPTargetTeamsDirective *Create(const ASTContext &C,
4136 SourceLocation StartLoc,
4137 SourceLocation EndLoc,
4138 ArrayRef<OMPClause *> Clauses,
4139 Stmt *AssociatedStmt);
4141 /// Creates an empty directive with the place for \a NumClauses clauses.
4143 /// \param C AST context.
4144 /// \param NumClauses Number of clauses.
4146 static OMPTargetTeamsDirective *CreateEmpty(const ASTContext &C,
4147 unsigned NumClauses, EmptyShell);
4149 static bool classof(const Stmt *T) {
4150 return T->getStmtClass() == OMPTargetTeamsDirectiveClass;
4154 /// This represents '#pragma omp target teams distribute' combined directive.
4157 /// #pragma omp target teams distribute private(x)
4159 /// In this example directive '#pragma omp target teams distribute' has clause
4160 /// 'private' with the variables 'x'
4162 class OMPTargetTeamsDistributeDirective final : public OMPLoopDirective {
4163 friend class ASTStmtReader;
4165 /// Build directive with the given start and end location.
4167 /// \param StartLoc Starting location of the directive kind.
4168 /// \param EndLoc Ending location of the directive.
4169 /// \param CollapsedNum Number of collapsed nested loops.
4170 /// \param NumClauses Number of clauses.
4172 OMPTargetTeamsDistributeDirective(SourceLocation StartLoc,
4173 SourceLocation EndLoc,
4174 unsigned CollapsedNum, unsigned NumClauses)
4175 : OMPLoopDirective(this, OMPTargetTeamsDistributeDirectiveClass,
4176 OMPD_target_teams_distribute, StartLoc, EndLoc,
4177 CollapsedNum, NumClauses) {}
4179 /// Build an empty directive.
4181 /// \param CollapsedNum Number of collapsed nested loops.
4182 /// \param NumClauses Number of clauses.
4184 explicit OMPTargetTeamsDistributeDirective(unsigned CollapsedNum,
4185 unsigned NumClauses)
4186 : OMPLoopDirective(this, OMPTargetTeamsDistributeDirectiveClass,
4187 OMPD_target_teams_distribute, SourceLocation(),
4188 SourceLocation(), CollapsedNum, NumClauses) {}
4191 /// Creates directive with a list of \a Clauses.
4193 /// \param C AST context.
4194 /// \param StartLoc Starting location of the directive kind.
4195 /// \param EndLoc Ending Location of the directive.
4196 /// \param CollapsedNum Number of collapsed loops.
4197 /// \param Clauses List of clauses.
4198 /// \param AssociatedStmt Statement, associated with the directive.
4199 /// \param Exprs Helper expressions for CodeGen.
4201 static OMPTargetTeamsDistributeDirective *
4202 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4203 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4204 Stmt *AssociatedStmt, const HelperExprs &Exprs);
4206 /// Creates an empty directive with the place for \a NumClauses clauses.
4208 /// \param C AST context.
4209 /// \param CollapsedNum Number of collapsed nested loops.
4210 /// \param NumClauses Number of clauses.
4212 static OMPTargetTeamsDistributeDirective *
4213 CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4216 static bool classof(const Stmt *T) {
4217 return T->getStmtClass() == OMPTargetTeamsDistributeDirectiveClass;
4221 /// This represents '#pragma omp target teams distribute parallel for' combined
4225 /// #pragma omp target teams distribute parallel for private(x)
4227 /// In this example directive '#pragma omp target teams distribute parallel
4228 /// for' has clause 'private' with the variables 'x'
4230 class OMPTargetTeamsDistributeParallelForDirective final
4231 : public OMPLoopDirective {
4232 friend class ASTStmtReader;
4233 /// true if the construct has inner cancel directive.
4234 bool HasCancel = false;
4236 /// Build directive with the given start and end location.
4238 /// \param StartLoc Starting location of the directive kind.
4239 /// \param EndLoc Ending location of the directive.
4240 /// \param CollapsedNum Number of collapsed nested loops.
4241 /// \param NumClauses Number of clauses.
4243 OMPTargetTeamsDistributeParallelForDirective(SourceLocation StartLoc,
4244 SourceLocation EndLoc,
4245 unsigned CollapsedNum,
4246 unsigned NumClauses)
4247 : OMPLoopDirective(this,
4248 OMPTargetTeamsDistributeParallelForDirectiveClass,
4249 OMPD_target_teams_distribute_parallel_for, StartLoc,
4250 EndLoc, CollapsedNum, NumClauses),
4253 /// Build an empty directive.
4255 /// \param CollapsedNum Number of collapsed nested loops.
4256 /// \param NumClauses Number of clauses.
4258 explicit OMPTargetTeamsDistributeParallelForDirective(unsigned CollapsedNum,
4259 unsigned NumClauses)
4261 this, OMPTargetTeamsDistributeParallelForDirectiveClass,
4262 OMPD_target_teams_distribute_parallel_for, SourceLocation(),
4263 SourceLocation(), CollapsedNum, NumClauses),
4266 /// Set cancel state.
4267 void setHasCancel(bool Has) { HasCancel = Has; }
4270 /// Creates directive with a list of \a Clauses.
4272 /// \param C AST context.
4273 /// \param StartLoc Starting location of the directive kind.
4274 /// \param EndLoc Ending Location of the directive.
4275 /// \param CollapsedNum Number of collapsed loops.
4276 /// \param Clauses List of clauses.
4277 /// \param AssociatedStmt Statement, associated with the directive.
4278 /// \param Exprs Helper expressions for CodeGen.
4279 /// \param HasCancel true if this directive has inner cancel directive.
4281 static OMPTargetTeamsDistributeParallelForDirective *
4282 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4283 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4284 Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
4286 /// Creates an empty directive with the place for \a NumClauses clauses.
4288 /// \param C AST context.
4289 /// \param CollapsedNum Number of collapsed nested loops.
4290 /// \param NumClauses Number of clauses.
4292 static OMPTargetTeamsDistributeParallelForDirective *
4293 CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4296 /// Return true if current directive has inner cancel directive.
4297 bool hasCancel() const { return HasCancel; }
4299 static bool classof(const Stmt *T) {
4300 return T->getStmtClass() ==
4301 OMPTargetTeamsDistributeParallelForDirectiveClass;
4305 /// This represents '#pragma omp target teams distribute parallel for simd'
4306 /// combined directive.
4309 /// #pragma omp target teams distribute parallel for simd private(x)
4311 /// In this example directive '#pragma omp target teams distribute parallel
4312 /// for simd' has clause 'private' with the variables 'x'
4314 class OMPTargetTeamsDistributeParallelForSimdDirective final
4315 : public OMPLoopDirective {
4316 friend class ASTStmtReader;
4318 /// Build directive with the given start and end location.
4320 /// \param StartLoc Starting location of the directive kind.
4321 /// \param EndLoc Ending location of the directive.
4322 /// \param CollapsedNum Number of collapsed nested loops.
4323 /// \param NumClauses Number of clauses.
4325 OMPTargetTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc,
4326 SourceLocation EndLoc,
4327 unsigned CollapsedNum,
4328 unsigned NumClauses)
4329 : OMPLoopDirective(this,
4330 OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
4331 OMPD_target_teams_distribute_parallel_for_simd,
4332 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
4334 /// Build an empty directive.
4336 /// \param CollapsedNum Number of collapsed nested loops.
4337 /// \param NumClauses Number of clauses.
4339 explicit OMPTargetTeamsDistributeParallelForSimdDirective(
4340 unsigned CollapsedNum, unsigned NumClauses)
4342 this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
4343 OMPD_target_teams_distribute_parallel_for_simd, SourceLocation(),
4344 SourceLocation(), CollapsedNum, NumClauses) {}
4347 /// Creates directive with a list of \a Clauses.
4349 /// \param C AST context.
4350 /// \param StartLoc Starting location of the directive kind.
4351 /// \param EndLoc Ending Location of the directive.
4352 /// \param CollapsedNum Number of collapsed loops.
4353 /// \param Clauses List of clauses.
4354 /// \param AssociatedStmt Statement, associated with the directive.
4355 /// \param Exprs Helper expressions for CodeGen.
4357 static OMPTargetTeamsDistributeParallelForSimdDirective *
4358 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4359 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4360 Stmt *AssociatedStmt, const HelperExprs &Exprs);
4362 /// Creates an empty directive with the place for \a NumClauses clauses.
4364 /// \param C AST context.
4365 /// \param CollapsedNum Number of collapsed nested loops.
4366 /// \param NumClauses Number of clauses.
4368 static OMPTargetTeamsDistributeParallelForSimdDirective *
4369 CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4372 static bool classof(const Stmt *T) {
4373 return T->getStmtClass() ==
4374 OMPTargetTeamsDistributeParallelForSimdDirectiveClass;
4378 /// This represents '#pragma omp target teams distribute simd' combined
4382 /// #pragma omp target teams distribute simd private(x)
4384 /// In this example directive '#pragma omp target teams distribute simd'
4385 /// has clause 'private' with the variables 'x'
4387 class OMPTargetTeamsDistributeSimdDirective final : public OMPLoopDirective {
4388 friend class ASTStmtReader;
4390 /// Build directive with the given start and end location.
4392 /// \param StartLoc Starting location of the directive kind.
4393 /// \param EndLoc Ending location of the directive.
4394 /// \param CollapsedNum Number of collapsed nested loops.
4395 /// \param NumClauses Number of clauses.
4397 OMPTargetTeamsDistributeSimdDirective(SourceLocation StartLoc,
4398 SourceLocation EndLoc,
4399 unsigned CollapsedNum,
4400 unsigned NumClauses)
4401 : OMPLoopDirective(this, OMPTargetTeamsDistributeSimdDirectiveClass,
4402 OMPD_target_teams_distribute_simd, StartLoc, EndLoc,
4403 CollapsedNum, NumClauses) {}
4405 /// Build an empty directive.
4407 /// \param CollapsedNum Number of collapsed nested loops.
4408 /// \param NumClauses Number of clauses.
4410 explicit OMPTargetTeamsDistributeSimdDirective(unsigned CollapsedNum,
4411 unsigned NumClauses)
4412 : OMPLoopDirective(this, OMPTargetTeamsDistributeSimdDirectiveClass,
4413 OMPD_target_teams_distribute_simd, SourceLocation(),
4414 SourceLocation(), CollapsedNum, NumClauses) {}
4417 /// Creates directive with a list of \a Clauses.
4419 /// \param C AST context.
4420 /// \param StartLoc Starting location of the directive kind.
4421 /// \param EndLoc Ending Location of the directive.
4422 /// \param CollapsedNum Number of collapsed loops.
4423 /// \param Clauses List of clauses.
4424 /// \param AssociatedStmt Statement, associated with the directive.
4425 /// \param Exprs Helper expressions for CodeGen.
4427 static OMPTargetTeamsDistributeSimdDirective *
4428 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4429 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4430 Stmt *AssociatedStmt, const HelperExprs &Exprs);
4432 /// Creates an empty directive with the place for \a NumClauses clauses.
4434 /// \param C AST context.
4435 /// \param CollapsedNum Number of collapsed nested loops.
4436 /// \param NumClauses Number of clauses.
4438 static OMPTargetTeamsDistributeSimdDirective *
4439 CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4442 static bool classof(const Stmt *T) {
4443 return T->getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
4447 } // end namespace clang