clang  10.0.0svn
StmtOpenMP.h
Go to the documentation of this file.
1 //===- StmtOpenMP.h - Classes for OpenMP directives ------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 /// This file defines OpenMP AST classes for executable directives and
10 /// clauses.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_STMTOPENMP_H
15 #define LLVM_CLANG_AST_STMTOPENMP_H
16 
17 #include "clang/AST/Expr.h"
18 #include "clang/AST/OpenMPClause.h"
19 #include "clang/AST/Stmt.h"
20 #include "clang/AST/StmtCXX.h"
23 
24 namespace clang {
25 
26 //===----------------------------------------------------------------------===//
27 // AST classes for directives.
28 //===----------------------------------------------------------------------===//
29 
30 /// This is a basic class for representing single OpenMP executable
31 /// directive.
32 ///
33 class OMPExecutableDirective : public Stmt {
34  friend class ASTStmtReader;
35  /// Kind of the directive.
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;
50 
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);
56  }
57 
58 protected:
59  /// Build instance of directive of class \a K.
60  ///
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.
65  ///
66  template <typename T>
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 *))) {}
74 
75  /// Sets the list of variables for this clause.
76  ///
77  /// \param Clauses The list of clauses for the directive.
78  ///
79  void setClauses(ArrayRef<OMPClause *> Clauses);
80 
81  /// Set the associated statement for the directive.
82  ///
83  /// /param S Associated statement.
84  ///
86  assert(hasAssociatedStmt() && "no associated statement.");
87  *child_begin() = S;
88  }
89 
90 public:
91  /// Iterates over expressions/statements used in the construct.
93  : public llvm::iterator_adaptor_base<
94  used_clauses_child_iterator, ArrayRef<OMPClause *>::iterator,
95  std::forward_iterator_tag, Stmt *, ptrdiff_t, Stmt *, Stmt *> {
97  OMPClause::child_iterator ChildI, ChildEnd;
98 
99  void MoveToNext() {
100  if (ChildI != ChildEnd)
101  return;
102  while (this->I != End) {
103  ++this->I;
104  if (this->I != End) {
105  ChildI = (*this->I)->used_children().begin();
106  ChildEnd = (*this->I)->used_children().end();
107  if (ChildI != ChildEnd)
108  return;
109  }
110  }
111  }
112 
113  public:
115  : used_clauses_child_iterator::iterator_adaptor_base(Clauses.begin()),
116  End(Clauses.end()) {
117  if (this->I != End) {
118  ChildI = (*this->I)->used_children().begin();
119  ChildEnd = (*this->I)->used_children().end();
120  MoveToNext();
121  }
122  }
123  Stmt *operator*() const { return *ChildI; }
124  Stmt *operator->() const { return **this; }
125 
127  ++ChildI;
128  if (ChildI != ChildEnd)
129  return *this;
130  if (this->I != End) {
131  ++this->I;
132  if (this->I != End) {
133  ChildI = (*this->I)->used_children().begin();
134  ChildEnd = (*this->I)->used_children().end();
135  }
136  }
137  MoveToNext();
138  return *this;
139  }
140  };
141 
142  static llvm::iterator_range<used_clauses_child_iterator>
144  return {used_clauses_child_iterator(Clauses),
145  used_clauses_child_iterator(llvm::makeArrayRef(Clauses.end(), 0))};
146  }
147 
148  /// Iterates over a filtered subrange of clauses applied to a
149  /// directive.
150  ///
151  /// This iterator visits only clauses of type SpecificClause.
152  template <typename SpecificClause>
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 *> {
160 
161  void SkipToNextClause() {
162  while (this->I != End && !isa<SpecificClause>(*this->I))
163  ++this->I;
164  }
165 
166  public:
168  : specific_clause_iterator::iterator_adaptor_base(Clauses.begin()),
169  End(Clauses.end()) {
170  SkipToNextClause();
171  }
172 
173  const SpecificClause *operator*() const {
174  return cast<SpecificClause>(*this->I);
175  }
176  const SpecificClause *operator->() const { return **this; }
177 
179  ++this->I;
180  SkipToNextClause();
181  return *this;
182  }
183  };
184 
185  template <typename SpecificClause>
186  static llvm::iterator_range<specific_clause_iterator<SpecificClause>>
190  llvm::makeArrayRef(Clauses.end(), 0))};
191  }
192 
193  template <typename SpecificClause>
194  llvm::iterator_range<specific_clause_iterator<SpecificClause>>
196  return getClausesOfKind<SpecificClause>(clauses());
197  }
198 
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
203  /// the directive.
204  template <typename SpecificClause>
205  const SpecificClause *getSingleClause() const {
206  auto Clauses = getClausesOfKind<SpecificClause>();
207 
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();
212  }
213  return nullptr;
214  }
215 
216  /// Returns true if the current directive has one or more clauses of a
217  /// specific kind.
218  template <typename SpecificClause>
219  bool hasClausesOfKind() const {
220  auto Clauses = getClausesOfKind<SpecificClause>();
221  return Clauses.begin() != Clauses.end();
222  }
223 
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; }
228 
229  /// Set starting location of directive kind.
230  ///
231  /// \param Loc New starting location of directive.
232  ///
233  void setLocStart(SourceLocation Loc) { StartLoc = Loc; }
234  /// Set ending location of directive.
235  ///
236  /// \param Loc New ending location of directive.
237  ///
238  void setLocEnd(SourceLocation Loc) { EndLoc = Loc; }
239 
240  /// Get number of clauses.
241  unsigned getNumClauses() const { return NumClauses; }
242 
243  /// Returns specified clause.
244  ///
245  /// \param i Number of clause.
246  ///
247  OMPClause *getClause(unsigned i) const { return clauses()[i]; }
248 
249  /// Returns true if directive has associated statement.
250  bool hasAssociatedStmt() const { return NumChildren > 0; }
251 
252  /// Returns statement associated with the directive.
253  const Stmt *getAssociatedStmt() const {
254  assert(hasAssociatedStmt() && "no associated statement.");
255  return *child_begin();
256  }
258  assert(hasAssociatedStmt() && "no associated statement.");
259  return *child_begin();
260  }
261 
262  /// Returns the captured statement associated with the
263  /// component region within the (combined) directive.
264  //
265  // \param RegionKind Component region kind.
268  getOpenMPCaptureRegions(CaptureRegions, getDirectiveKind());
269  assert(std::any_of(
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)
276  return CS;
277  CS = cast<CapturedStmt>(CS->getCapturedStmt());
278  }
279  llvm_unreachable("Incorrect RegionKind specified for directive.");
280  }
281 
282  /// Get innermost captured statement for the construct.
284  assert(hasAssociatedStmt() && getAssociatedStmt() &&
285  "Must have associated statement.");
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());
293  return CS;
294  }
295 
297  return const_cast<OMPExecutableDirective *>(this)
299  }
300 
301  OpenMPDirectiveKind getDirectiveKind() const { return Kind; }
302 
303  static bool classof(const Stmt *S) {
304  return S->getStmtClass() >= firstOMPExecutableDirectiveConstant &&
305  S->getStmtClass() <= lastOMPExecutableDirectiveConstant;
306  }
307 
309  if (!hasAssociatedStmt())
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);
315  }
316 
318  if (!hasAssociatedStmt())
320  Stmt **ChildStorage = reinterpret_cast<Stmt **>(
321  const_cast<OMPExecutableDirective *>(this)->getClauses().end());
322  return const_child_range(ChildStorage, ChildStorage + 1);
323  }
324 
325  ArrayRef<OMPClause *> clauses() { return getClauses(); }
326 
328  return const_cast<OMPExecutableDirective *>(this)->getClauses();
329  }
330 
331  /// Returns whether or not this is a Standalone directive.
332  ///
333  /// Stand-alone directives are executable directives
334  /// that have no associated user code.
335  bool isStandaloneDirective() const;
336 
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;
341 
343  return const_cast<Stmt *>(
344  const_cast<const OMPExecutableDirective *>(this)->getStructuredBlock());
345  }
346 };
347 
348 /// This represents '#pragma omp parallel' directive.
349 ///
350 /// \code
351 /// #pragma omp parallel private(a,b) reduction(+: c,d)
352 /// \endcode
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'.
356 ///
358  friend class ASTStmtReader;
359  /// true if the construct has inner cancel directive.
360  bool HasCancel;
361 
362  /// Build directive with the given start and end location.
363  ///
364  /// \param StartLoc Starting location of the directive (directive keyword).
365  /// \param EndLoc Ending Location of the directive.
366  ///
368  unsigned NumClauses)
369  : OMPExecutableDirective(this, OMPParallelDirectiveClass, OMPD_parallel,
370  StartLoc, EndLoc, NumClauses, 1),
371  HasCancel(false) {}
372 
373  /// Build an empty directive.
374  ///
375  /// \param NumClauses Number of clauses.
376  ///
377  explicit OMPParallelDirective(unsigned NumClauses)
378  : OMPExecutableDirective(this, OMPParallelDirectiveClass, OMPD_parallel,
379  SourceLocation(), SourceLocation(), NumClauses,
380  1),
381  HasCancel(false) {}
382 
383  /// Set cancel state.
384  void setHasCancel(bool Has) { HasCancel = Has; }
385 
386 public:
387  /// Creates directive with a list of \a Clauses.
388  ///
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.
395  ///
396  static OMPParallelDirective *
397  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
398  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel);
399 
400  /// Creates an empty directive with the place for \a N clauses.
401  ///
402  /// \param C AST context.
403  /// \param NumClauses Number of clauses.
404  ///
406  unsigned NumClauses, EmptyShell);
407 
408  /// Return true if current directive has inner cancel directive.
409  bool hasCancel() const { return HasCancel; }
410 
411  static bool classof(const Stmt *T) {
412  return T->getStmtClass() == OMPParallelDirectiveClass;
413  }
414 };
415 
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.
418 ///
420  friend class ASTStmtReader;
421  /// Number of collapsed loops as specified by 'collapse' clause.
422  unsigned CollapsedNum;
423 
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')
439  ///
440  enum {
441  AssociatedStmtOffset = 0,
442  IterationVariableOffset = 1,
443  LastIterationOffset = 2,
444  CalcLastIterationOffset = 3,
445  PreConditionOffset = 4,
446  CondOffset = 5,
447  InitOffset = 6,
448  IncOffset = 7,
449  PreInitsOffset = 8,
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
453  // arrays).
454  DefaultEnd = 9,
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.
465  WorksharingEnd = 17,
466  PrevLowerBoundVariableOffset = 17,
467  PrevUpperBoundVariableOffset = 18,
468  DistIncOffset = 19,
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,
483  };
484 
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);
490  }
491 
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);
497  }
498 
499  /// Get the updates storage.
501  Expr **Storage = reinterpret_cast<Expr **>(
502  &*std::next(child_begin(),
503  getArraysOffset(getDirectiveKind()) + 2 * CollapsedNum));
504  return MutableArrayRef<Expr *>(Storage, CollapsedNum);
505  }
506 
507  /// Get the updates storage.
509  Expr **Storage = reinterpret_cast<Expr **>(
510  &*std::next(child_begin(),
511  getArraysOffset(getDirectiveKind()) + 3 * CollapsedNum));
512  return MutableArrayRef<Expr *>(Storage, CollapsedNum);
513  }
514 
515  /// Get the final counter updates storage.
517  Expr **Storage = reinterpret_cast<Expr **>(
518  &*std::next(child_begin(),
519  getArraysOffset(getDirectiveKind()) + 4 * CollapsedNum));
520  return MutableArrayRef<Expr *>(Storage, CollapsedNum);
521  }
522 
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);
529  }
530 
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);
537  }
538 
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);
545  }
546 
547 protected:
548  /// Build instance of loop directive of class \a Kind.
549  ///
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.
557  ///
558  template <typename T>
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) +
565  NumSpecialChildren),
566  CollapsedNum(CollapsedNum) {}
567 
568  /// Offset to the start of children expression arrays.
571  return CombinedDistributeEnd;
574  return WorksharingEnd;
575  return DefaultEnd;
576  }
577 
578  /// Children number.
579  static unsigned numLoopChildren(unsigned CollapsedNum,
581  return getArraysOffset(Kind) +
582  8 * CollapsedNum; // Counters, PrivateCounters, Inits,
583  // Updates, Finals, DependentCounters,
584  // DependentInits, FinalsConditions.
585  }
586 
588  *std::next(child_begin(), IterationVariableOffset) = IV;
589  }
590  void setLastIteration(Expr *LI) {
591  *std::next(child_begin(), LastIterationOffset) = LI;
592  }
594  *std::next(child_begin(), CalcLastIterationOffset) = CLI;
595  }
596  void setPreCond(Expr *PC) {
597  *std::next(child_begin(), PreConditionOffset) = PC;
598  }
599  void setCond(Expr *Cond) {
600  *std::next(child_begin(), CondOffset) = Cond;
601  }
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;
606  }
611  "expected worksharing loop directive");
612  *std::next(child_begin(), IsLastIterVariableOffset) = IL;
613  }
618  "expected worksharing loop directive");
619  *std::next(child_begin(), LowerBoundVariableOffset) = LB;
620  }
625  "expected worksharing loop directive");
626  *std::next(child_begin(), UpperBoundVariableOffset) = UB;
627  }
632  "expected worksharing loop directive");
633  *std::next(child_begin(), StrideVariableOffset) = ST;
634  }
639  "expected worksharing loop directive");
640  *std::next(child_begin(), EnsureUpperBoundOffset) = EUB;
641  }
642  void setNextLowerBound(Expr *NLB) {
646  "expected worksharing loop directive");
647  *std::next(child_begin(), NextLowerBoundOffset) = NLB;
648  }
649  void setNextUpperBound(Expr *NUB) {
653  "expected worksharing loop directive");
654  *std::next(child_begin(), NextUpperBoundOffset) = NUB;
655  }
656  void setNumIterations(Expr *NI) {
660  "expected worksharing loop directive");
661  *std::next(child_begin(), NumIterationsOffset) = NI;
662  }
665  "expected loop bound sharing directive");
666  *std::next(child_begin(), PrevLowerBoundVariableOffset) = PrevLB;
667  }
670  "expected loop bound sharing directive");
671  *std::next(child_begin(), PrevUpperBoundVariableOffset) = PrevUB;
672  }
673  void setDistInc(Expr *DistInc) {
675  "expected loop bound sharing directive");
676  *std::next(child_begin(), DistIncOffset) = DistInc;
677  }
678  void setPrevEnsureUpperBound(Expr *PrevEUB) {
680  "expected loop bound sharing directive");
681  *std::next(child_begin(), PrevEnsureUpperBoundOffset) = PrevEUB;
682  }
685  "expected loop bound sharing directive");
686  *std::next(child_begin(), CombinedLowerBoundVariableOffset) = CombLB;
687  }
690  "expected loop bound sharing directive");
691  *std::next(child_begin(), CombinedUpperBoundVariableOffset) = CombUB;
692  }
695  "expected loop bound sharing directive");
696  *std::next(child_begin(), CombinedEnsureUpperBoundOffset) = CombEUB;
697  }
698  void setCombinedInit(Expr *CombInit) {
700  "expected loop bound sharing directive");
701  *std::next(child_begin(), CombinedInitOffset) = CombInit;
702  }
703  void setCombinedCond(Expr *CombCond) {
705  "expected loop bound sharing directive");
706  *std::next(child_begin(), CombinedConditionOffset) = CombCond;
707  }
710  "expected loop bound sharing directive");
711  *std::next(child_begin(), CombinedNextLowerBoundOffset) = CombNLB;
712  }
715  "expected loop bound sharing directive");
716  *std::next(child_begin(), CombinedNextUpperBoundOffset) = CombNUB;
717  }
718  void setCombinedDistCond(Expr *CombDistCond) {
720  "expected loop bound distribute sharing directive");
721  *std::next(child_begin(), CombinedDistConditionOffset) = CombDistCond;
722  }
723  void setCombinedParForInDistCond(Expr *CombParForInDistCond) {
725  "expected loop bound distribute sharing directive");
726  *std::next(child_begin(),
727  CombinedParForInDistConditionOffset) = CombParForInDistCond;
728  }
729  void setCounters(ArrayRef<Expr *> A);
730  void setPrivateCounters(ArrayRef<Expr *> A);
731  void setInits(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);
737 
738 public:
739  /// The expressions built to support OpenMP loops in combined/composite
740  /// pragmas (e.g. pragma omp distribute parallel for)
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
752  /// distribute'
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.
771  };
772 
773  /// The expressions built for the OpenMP loop CodeGen for the
774  /// whole collapsed loop nest.
775  struct HelperExprs {
776  /// Loop iteration variable.
778  /// Loop last iteration number.
780  /// Loop number of iterations.
782  /// Calculation of last iteration.
784  /// Loop pre-condition.
786  /// Loop condition.
788  /// Loop iteration variable init.
790  /// Loop increment.
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.
824  /// PrivateCounters Loop counters.
826  /// Expressions for loop counters inits for CodeGen.
828  /// Expressions for loop counters update for CodeGen.
830  /// Final loop counter values for GodeGen.
832  /// List of counters required for the generation of the non-rectangular
833  /// loops.
835  /// List of initializers required for the generation of the non-rectangular
836  /// loops.
838  /// List of final conditions required for the generation of the
839  /// non-rectangular loops.
841  /// Init statement for all captured expressions.
843 
844  /// Expressions used when combining OpenMP loop pragmas
846 
847  /// Check if all the expressions are built (does not check the
848  /// worksharing ones).
849  bool builtAll() {
850  return IterationVarRef != nullptr && LastIteration != nullptr &&
851  NumIterations != nullptr && PreCond != nullptr &&
852  Cond != nullptr && Init != nullptr && Inc != nullptr;
853  }
854 
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
858  /// arrays.
859  void clear(unsigned Size) {
860  IterationVarRef = nullptr;
861  LastIteration = nullptr;
862  CalcLastIteration = nullptr;
863  PreCond = nullptr;
864  Cond = nullptr;
865  Init = nullptr;
866  Inc = nullptr;
867  IL = nullptr;
868  LB = nullptr;
869  UB = nullptr;
870  ST = nullptr;
871  EUB = nullptr;
872  NLB = nullptr;
873  NUB = nullptr;
874  NumIterations = nullptr;
875  PrevLB = nullptr;
876  PrevUB = nullptr;
877  DistInc = nullptr;
878  PrevEUB = nullptr;
879  Counters.resize(Size);
880  PrivateCounters.resize(Size);
881  Inits.resize(Size);
882  Updates.resize(Size);
883  Finals.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;
890  Inits[i] = nullptr;
891  Updates[i] = nullptr;
892  Finals[i] = nullptr;
893  DependentCounters[i] = nullptr;
894  DependentInits[i] = nullptr;
895  FinalsConditions[i] = nullptr;
896  }
897  PreInits = 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;
907  }
908  };
909 
910  /// Get number of collapsed loops.
911  unsigned getCollapsedNumber() const { return CollapsedNum; }
912 
914  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
915  *std::next(child_begin(), IterationVariableOffset)));
916  }
918  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
919  *std::next(child_begin(), LastIterationOffset)));
920  }
922  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
923  *std::next(child_begin(), CalcLastIterationOffset)));
924  }
925  Expr *getPreCond() const {
926  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
927  *std::next(child_begin(), PreConditionOffset)));
928  }
929  Expr *getCond() const {
930  return const_cast<Expr *>(
931  reinterpret_cast<const Expr *>(*std::next(child_begin(), CondOffset)));
932  }
933  Expr *getInit() const {
934  return const_cast<Expr *>(
935  reinterpret_cast<const Expr *>(*std::next(child_begin(), InitOffset)));
936  }
937  Expr *getInc() const {
938  return const_cast<Expr *>(
939  reinterpret_cast<const Expr *>(*std::next(child_begin(), IncOffset)));
940  }
941  const Stmt *getPreInits() const {
942  return *std::next(child_begin(), PreInitsOffset);
943  }
944  Stmt *getPreInits() { return *std::next(child_begin(), PreInitsOffset); }
949  "expected worksharing loop directive");
950  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
951  *std::next(child_begin(), IsLastIterVariableOffset)));
952  }
957  "expected worksharing loop directive");
958  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
959  *std::next(child_begin(), LowerBoundVariableOffset)));
960  }
965  "expected worksharing loop directive");
966  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
967  *std::next(child_begin(), UpperBoundVariableOffset)));
968  }
973  "expected worksharing loop directive");
974  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
975  *std::next(child_begin(), StrideVariableOffset)));
976  }
981  "expected worksharing loop directive");
982  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
983  *std::next(child_begin(), EnsureUpperBoundOffset)));
984  }
989  "expected worksharing loop directive");
990  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
991  *std::next(child_begin(), NextLowerBoundOffset)));
992  }
997  "expected worksharing loop directive");
998  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
999  *std::next(child_begin(), NextUpperBoundOffset)));
1000  }
1005  "expected worksharing loop directive");
1006  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1007  *std::next(child_begin(), NumIterationsOffset)));
1008  }
1011  "expected loop bound sharing directive");
1012  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1013  *std::next(child_begin(), PrevLowerBoundVariableOffset)));
1014  }
1017  "expected loop bound sharing directive");
1018  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1019  *std::next(child_begin(), PrevUpperBoundVariableOffset)));
1020  }
1021  Expr *getDistInc() const {
1023  "expected loop bound sharing directive");
1024  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1025  *std::next(child_begin(), DistIncOffset)));
1026  }
1029  "expected loop bound sharing directive");
1030  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1031  *std::next(child_begin(), PrevEnsureUpperBoundOffset)));
1032  }
1035  "expected loop bound sharing directive");
1036  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1037  *std::next(child_begin(), CombinedLowerBoundVariableOffset)));
1038  }
1041  "expected loop bound sharing directive");
1042  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1043  *std::next(child_begin(), CombinedUpperBoundVariableOffset)));
1044  }
1047  "expected loop bound sharing directive");
1048  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1049  *std::next(child_begin(), CombinedEnsureUpperBoundOffset)));
1050  }
1053  "expected loop bound sharing directive");
1054  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1055  *std::next(child_begin(), CombinedInitOffset)));
1056  }
1059  "expected loop bound sharing directive");
1060  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1061  *std::next(child_begin(), CombinedConditionOffset)));
1062  }
1065  "expected loop bound sharing directive");
1066  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1067  *std::next(child_begin(), CombinedNextLowerBoundOffset)));
1068  }
1071  "expected loop bound sharing directive");
1072  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1073  *std::next(child_begin(), CombinedNextUpperBoundOffset)));
1074  }
1077  "expected loop bound distribute sharing directive");
1078  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1079  *std::next(child_begin(), CombinedDistConditionOffset)));
1080  }
1083  "expected loop bound distribute sharing directive");
1084  return const_cast<Expr *>(reinterpret_cast<const Expr *>(
1085  *std::next(child_begin(), CombinedParForInDistConditionOffset)));
1086  }
1087  const Stmt *getBody() const {
1088  // This relies on the loop form is already checked by Sema.
1089  const Stmt *Body =
1091  if (auto *For = dyn_cast<ForStmt>(Body)) {
1092  Body = For->getBody();
1093  } else {
1094  assert(isa<CXXForRangeStmt>(Body) &&
1095  "Expected canonical for loop or range-based for loop.");
1096  Body = cast<CXXForRangeStmt>(Body)->getBody();
1097  }
1098  for (unsigned Cnt = 1; Cnt < CollapsedNum; ++Cnt) {
1099  Body = Body->IgnoreContainers();
1100  if (auto *For = dyn_cast<ForStmt>(Body)) {
1101  Body = For->getBody();
1102  } else {
1103  assert(isa<CXXForRangeStmt>(Body) &&
1104  "Expected canonical for loop or range-based for loop.");
1105  Body = cast<CXXForRangeStmt>(Body)->getBody();
1106  }
1107  }
1108  return Body;
1109  }
1110 
1111  ArrayRef<Expr *> counters() { return getCounters(); }
1112 
1114  return const_cast<OMPLoopDirective *>(this)->getCounters();
1115  }
1116 
1117  ArrayRef<Expr *> private_counters() { return getPrivateCounters(); }
1118 
1120  return const_cast<OMPLoopDirective *>(this)->getPrivateCounters();
1121  }
1122 
1124 
1126  return const_cast<OMPLoopDirective *>(this)->getInits();
1127  }
1128 
1130 
1132  return const_cast<OMPLoopDirective *>(this)->getUpdates();
1133  }
1134 
1136 
1138  return const_cast<OMPLoopDirective *>(this)->getFinals();
1139  }
1140 
1141  ArrayRef<Expr *> dependent_counters() { return getDependentCounters(); }
1142 
1144  return const_cast<OMPLoopDirective *>(this)->getDependentCounters();
1145  }
1146 
1147  ArrayRef<Expr *> dependent_inits() { return getDependentInits(); }
1148 
1150  return const_cast<OMPLoopDirective *>(this)->getDependentInits();
1151  }
1152 
1153  ArrayRef<Expr *> finals_conditions() { return getFinalsConditions(); }
1154 
1156  return const_cast<OMPLoopDirective *>(this)->getFinalsConditions();
1157  }
1158 
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() == OMPParallelMasterTaskLoopDirectiveClass ||
1169  T->getStmtClass() == OMPDistributeDirectiveClass ||
1170  T->getStmtClass() == OMPTargetParallelForDirectiveClass ||
1171  T->getStmtClass() == OMPDistributeParallelForDirectiveClass ||
1172  T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass ||
1173  T->getStmtClass() == OMPDistributeSimdDirectiveClass ||
1174  T->getStmtClass() == OMPTargetParallelForSimdDirectiveClass ||
1175  T->getStmtClass() == OMPTargetSimdDirectiveClass ||
1176  T->getStmtClass() == OMPTeamsDistributeDirectiveClass ||
1177  T->getStmtClass() == OMPTeamsDistributeSimdDirectiveClass ||
1178  T->getStmtClass() ==
1179  OMPTeamsDistributeParallelForSimdDirectiveClass ||
1180  T->getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass ||
1181  T->getStmtClass() ==
1182  OMPTargetTeamsDistributeParallelForDirectiveClass ||
1183  T->getStmtClass() ==
1184  OMPTargetTeamsDistributeParallelForSimdDirectiveClass ||
1185  T->getStmtClass() == OMPTargetTeamsDistributeDirectiveClass ||
1186  T->getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
1187  }
1188 };
1189 
1190 /// This represents '#pragma omp simd' directive.
1191 ///
1192 /// \code
1193 /// #pragma omp simd private(a,b) linear(i,j:s) reduction(+:c,d)
1194 /// \endcode
1195 /// In this example directive '#pragma omp simd' has clauses 'private'
1196 /// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and
1197 /// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'.
1198 ///
1200  friend class ASTStmtReader;
1201  /// Build directive with the given start and end location.
1202  ///
1203  /// \param StartLoc Starting location of the directive kind.
1204  /// \param EndLoc Ending location of the directive.
1205  /// \param CollapsedNum Number of collapsed nested loops.
1206  /// \param NumClauses Number of clauses.
1207  ///
1209  unsigned CollapsedNum, unsigned NumClauses)
1210  : OMPLoopDirective(this, OMPSimdDirectiveClass, OMPD_simd, StartLoc,
1211  EndLoc, CollapsedNum, NumClauses) {}
1212 
1213  /// Build an empty directive.
1214  ///
1215  /// \param CollapsedNum Number of collapsed nested loops.
1216  /// \param NumClauses Number of clauses.
1217  ///
1218  explicit OMPSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
1219  : OMPLoopDirective(this, OMPSimdDirectiveClass, OMPD_simd,
1220  SourceLocation(), SourceLocation(), CollapsedNum,
1221  NumClauses) {}
1222 
1223 public:
1224  /// Creates directive with a list of \a Clauses.
1225  ///
1226  /// \param C AST context.
1227  /// \param StartLoc Starting location of the directive kind.
1228  /// \param EndLoc Ending Location of the directive.
1229  /// \param CollapsedNum Number of collapsed loops.
1230  /// \param Clauses List of clauses.
1231  /// \param AssociatedStmt Statement, associated with the directive.
1232  /// \param Exprs Helper expressions for CodeGen.
1233  ///
1234  static OMPSimdDirective *Create(const ASTContext &C, SourceLocation StartLoc,
1235  SourceLocation EndLoc, unsigned CollapsedNum,
1236  ArrayRef<OMPClause *> Clauses,
1237  Stmt *AssociatedStmt,
1238  const HelperExprs &Exprs);
1239 
1240  /// Creates an empty directive with the place
1241  /// for \a NumClauses clauses.
1242  ///
1243  /// \param C AST context.
1244  /// \param CollapsedNum Number of collapsed nested loops.
1245  /// \param NumClauses Number of clauses.
1246  ///
1247  static OMPSimdDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
1248  unsigned CollapsedNum, EmptyShell);
1249 
1250  static bool classof(const Stmt *T) {
1251  return T->getStmtClass() == OMPSimdDirectiveClass;
1252  }
1253 };
1254 
1255 /// This represents '#pragma omp for' directive.
1256 ///
1257 /// \code
1258 /// #pragma omp for private(a,b) reduction(+:c,d)
1259 /// \endcode
1260 /// In this example directive '#pragma omp for' has clauses 'private' with the
1261 /// variables 'a' and 'b' and 'reduction' with operator '+' and variables 'c'
1262 /// and 'd'.
1263 ///
1265  friend class ASTStmtReader;
1266 
1267  /// true if current directive has inner cancel directive.
1268  bool HasCancel;
1269 
1270  /// Build directive with the given start and end location.
1271  ///
1272  /// \param StartLoc Starting location of the directive kind.
1273  /// \param EndLoc Ending location of the directive.
1274  /// \param CollapsedNum Number of collapsed nested loops.
1275  /// \param NumClauses Number of clauses.
1276  ///
1278  unsigned CollapsedNum, unsigned NumClauses)
1279  : OMPLoopDirective(this, OMPForDirectiveClass, OMPD_for, StartLoc, EndLoc,
1280  CollapsedNum, NumClauses),
1281  HasCancel(false) {}
1282 
1283  /// Build an empty directive.
1284  ///
1285  /// \param CollapsedNum Number of collapsed nested loops.
1286  /// \param NumClauses Number of clauses.
1287  ///
1288  explicit OMPForDirective(unsigned CollapsedNum, unsigned NumClauses)
1289  : OMPLoopDirective(this, OMPForDirectiveClass, OMPD_for, SourceLocation(),
1290  SourceLocation(), CollapsedNum, NumClauses),
1291  HasCancel(false) {}
1292 
1293  /// Set cancel state.
1294  void setHasCancel(bool Has) { HasCancel = Has; }
1295 
1296 public:
1297  /// Creates directive with a list of \a Clauses.
1298  ///
1299  /// \param C AST context.
1300  /// \param StartLoc Starting location of the directive kind.
1301  /// \param EndLoc Ending Location of the directive.
1302  /// \param CollapsedNum Number of collapsed loops.
1303  /// \param Clauses List of clauses.
1304  /// \param AssociatedStmt Statement, associated with the directive.
1305  /// \param Exprs Helper expressions for CodeGen.
1306  /// \param HasCancel true if current directive has inner cancel directive.
1307  ///
1308  static OMPForDirective *Create(const ASTContext &C, SourceLocation StartLoc,
1309  SourceLocation EndLoc, unsigned CollapsedNum,
1310  ArrayRef<OMPClause *> Clauses,
1311  Stmt *AssociatedStmt, const HelperExprs &Exprs,
1312  bool HasCancel);
1313 
1314  /// Creates an empty directive with the place
1315  /// for \a NumClauses clauses.
1316  ///
1317  /// \param C AST context.
1318  /// \param CollapsedNum Number of collapsed nested loops.
1319  /// \param NumClauses Number of clauses.
1320  ///
1321  static OMPForDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
1322  unsigned CollapsedNum, EmptyShell);
1323 
1324  /// Return true if current directive has inner cancel directive.
1325  bool hasCancel() const { return HasCancel; }
1326 
1327  static bool classof(const Stmt *T) {
1328  return T->getStmtClass() == OMPForDirectiveClass;
1329  }
1330 };
1331 
1332 /// This represents '#pragma omp for simd' directive.
1333 ///
1334 /// \code
1335 /// #pragma omp for simd private(a,b) linear(i,j:s) reduction(+:c,d)
1336 /// \endcode
1337 /// In this example directive '#pragma omp for simd' has clauses 'private'
1338 /// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and
1339 /// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'.
1340 ///
1342  friend class ASTStmtReader;
1343  /// Build directive with the given start and end location.
1344  ///
1345  /// \param StartLoc Starting location of the directive kind.
1346  /// \param EndLoc Ending location of the directive.
1347  /// \param CollapsedNum Number of collapsed nested loops.
1348  /// \param NumClauses Number of clauses.
1349  ///
1351  unsigned CollapsedNum, unsigned NumClauses)
1352  : OMPLoopDirective(this, OMPForSimdDirectiveClass, OMPD_for_simd,
1353  StartLoc, EndLoc, CollapsedNum, NumClauses) {}
1354 
1355  /// Build an empty directive.
1356  ///
1357  /// \param CollapsedNum Number of collapsed nested loops.
1358  /// \param NumClauses Number of clauses.
1359  ///
1360  explicit OMPForSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
1361  : OMPLoopDirective(this, OMPForSimdDirectiveClass, OMPD_for_simd,
1362  SourceLocation(), SourceLocation(), CollapsedNum,
1363  NumClauses) {}
1364 
1365 public:
1366  /// Creates directive with a list of \a Clauses.
1367  ///
1368  /// \param C AST context.
1369  /// \param StartLoc Starting location of the directive kind.
1370  /// \param EndLoc Ending Location of the directive.
1371  /// \param CollapsedNum Number of collapsed loops.
1372  /// \param Clauses List of clauses.
1373  /// \param AssociatedStmt Statement, associated with the directive.
1374  /// \param Exprs Helper expressions for CodeGen.
1375  ///
1376  static OMPForSimdDirective *
1377  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1378  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
1379  Stmt *AssociatedStmt, const HelperExprs &Exprs);
1380 
1381  /// Creates an empty directive with the place
1382  /// for \a NumClauses clauses.
1383  ///
1384  /// \param C AST context.
1385  /// \param CollapsedNum Number of collapsed nested loops.
1386  /// \param NumClauses Number of clauses.
1387  ///
1389  unsigned NumClauses,
1390  unsigned CollapsedNum, EmptyShell);
1391 
1392  static bool classof(const Stmt *T) {
1393  return T->getStmtClass() == OMPForSimdDirectiveClass;
1394  }
1395 };
1396 
1397 /// This represents '#pragma omp sections' directive.
1398 ///
1399 /// \code
1400 /// #pragma omp sections private(a,b) reduction(+:c,d)
1401 /// \endcode
1402 /// In this example directive '#pragma omp sections' has clauses 'private' with
1403 /// the variables 'a' and 'b' and 'reduction' with operator '+' and variables
1404 /// 'c' and 'd'.
1405 ///
1407  friend class ASTStmtReader;
1408 
1409  /// true if current directive has inner cancel directive.
1410  bool HasCancel;
1411 
1412  /// Build directive with the given start and end location.
1413  ///
1414  /// \param StartLoc Starting location of the directive kind.
1415  /// \param EndLoc Ending location of the directive.
1416  /// \param NumClauses Number of clauses.
1417  ///
1419  unsigned NumClauses)
1420  : OMPExecutableDirective(this, OMPSectionsDirectiveClass, OMPD_sections,
1421  StartLoc, EndLoc, NumClauses, 1),
1422  HasCancel(false) {}
1423 
1424  /// Build an empty directive.
1425  ///
1426  /// \param NumClauses Number of clauses.
1427  ///
1428  explicit OMPSectionsDirective(unsigned NumClauses)
1429  : OMPExecutableDirective(this, OMPSectionsDirectiveClass, OMPD_sections,
1430  SourceLocation(), SourceLocation(), NumClauses,
1431  1),
1432  HasCancel(false) {}
1433 
1434  /// Set cancel state.
1435  void setHasCancel(bool Has) { HasCancel = Has; }
1436 
1437 public:
1438  /// Creates directive with a list of \a Clauses.
1439  ///
1440  /// \param C AST context.
1441  /// \param StartLoc Starting location of the directive kind.
1442  /// \param EndLoc Ending Location of the directive.
1443  /// \param Clauses List of clauses.
1444  /// \param AssociatedStmt Statement, associated with the directive.
1445  /// \param HasCancel true if current directive has inner directive.
1446  ///
1447  static OMPSectionsDirective *
1448  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1449  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel);
1450 
1451  /// Creates an empty directive with the place for \a NumClauses
1452  /// clauses.
1453  ///
1454  /// \param C AST context.
1455  /// \param NumClauses Number of clauses.
1456  ///
1458  unsigned NumClauses, EmptyShell);
1459 
1460  /// Return true if current directive has inner cancel directive.
1461  bool hasCancel() const { return HasCancel; }
1462 
1463  static bool classof(const Stmt *T) {
1464  return T->getStmtClass() == OMPSectionsDirectiveClass;
1465  }
1466 };
1467 
1468 /// This represents '#pragma omp section' directive.
1469 ///
1470 /// \code
1471 /// #pragma omp section
1472 /// \endcode
1473 ///
1475  friend class ASTStmtReader;
1476 
1477  /// true if current directive has inner cancel directive.
1478  bool HasCancel;
1479 
1480  /// Build directive with the given start and end location.
1481  ///
1482  /// \param StartLoc Starting location of the directive kind.
1483  /// \param EndLoc Ending location of the directive.
1484  ///
1486  : OMPExecutableDirective(this, OMPSectionDirectiveClass, OMPD_section,
1487  StartLoc, EndLoc, 0, 1),
1488  HasCancel(false) {}
1489 
1490  /// Build an empty directive.
1491  ///
1492  explicit OMPSectionDirective()
1493  : OMPExecutableDirective(this, OMPSectionDirectiveClass, OMPD_section,
1494  SourceLocation(), SourceLocation(), 0, 1),
1495  HasCancel(false) {}
1496 
1497 public:
1498  /// Creates directive.
1499  ///
1500  /// \param C AST context.
1501  /// \param StartLoc Starting location of the directive kind.
1502  /// \param EndLoc Ending Location of the directive.
1503  /// \param AssociatedStmt Statement, associated with the directive.
1504  /// \param HasCancel true if current directive has inner directive.
1505  ///
1506  static OMPSectionDirective *Create(const ASTContext &C,
1507  SourceLocation StartLoc,
1508  SourceLocation EndLoc,
1509  Stmt *AssociatedStmt, bool HasCancel);
1510 
1511  /// Creates an empty directive.
1512  ///
1513  /// \param C AST context.
1514  ///
1516 
1517  /// Set cancel state.
1518  void setHasCancel(bool Has) { HasCancel = Has; }
1519 
1520  /// Return true if current directive has inner cancel directive.
1521  bool hasCancel() const { return HasCancel; }
1522 
1523  static bool classof(const Stmt *T) {
1524  return T->getStmtClass() == OMPSectionDirectiveClass;
1525  }
1526 };
1527 
1528 /// This represents '#pragma omp single' directive.
1529 ///
1530 /// \code
1531 /// #pragma omp single private(a,b) copyprivate(c,d)
1532 /// \endcode
1533 /// In this example directive '#pragma omp single' has clauses 'private' with
1534 /// the variables 'a' and 'b' and 'copyprivate' with variables 'c' and 'd'.
1535 ///
1537  friend class ASTStmtReader;
1538  /// Build directive with the given start and end location.
1539  ///
1540  /// \param StartLoc Starting location of the directive kind.
1541  /// \param EndLoc Ending location of the directive.
1542  /// \param NumClauses Number of clauses.
1543  ///
1545  unsigned NumClauses)
1546  : OMPExecutableDirective(this, OMPSingleDirectiveClass, OMPD_single,
1547  StartLoc, EndLoc, NumClauses, 1) {}
1548 
1549  /// Build an empty directive.
1550  ///
1551  /// \param NumClauses Number of clauses.
1552  ///
1553  explicit OMPSingleDirective(unsigned NumClauses)
1554  : OMPExecutableDirective(this, OMPSingleDirectiveClass, OMPD_single,
1555  SourceLocation(), SourceLocation(), NumClauses,
1556  1) {}
1557 
1558 public:
1559  /// Creates directive with a list of \a Clauses.
1560  ///
1561  /// \param C AST context.
1562  /// \param StartLoc Starting location of the directive kind.
1563  /// \param EndLoc Ending Location of the directive.
1564  /// \param Clauses List of clauses.
1565  /// \param AssociatedStmt Statement, associated with the directive.
1566  ///
1567  static OMPSingleDirective *
1568  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1569  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
1570 
1571  /// Creates an empty directive with the place for \a NumClauses
1572  /// clauses.
1573  ///
1574  /// \param C AST context.
1575  /// \param NumClauses Number of clauses.
1576  ///
1577  static OMPSingleDirective *CreateEmpty(const ASTContext &C,
1578  unsigned NumClauses, EmptyShell);
1579 
1580  static bool classof(const Stmt *T) {
1581  return T->getStmtClass() == OMPSingleDirectiveClass;
1582  }
1583 };
1584 
1585 /// This represents '#pragma omp master' directive.
1586 ///
1587 /// \code
1588 /// #pragma omp master
1589 /// \endcode
1590 ///
1592  friend class ASTStmtReader;
1593  /// Build directive with the given start and end location.
1594  ///
1595  /// \param StartLoc Starting location of the directive kind.
1596  /// \param EndLoc Ending location of the directive.
1597  ///
1599  : OMPExecutableDirective(this, OMPMasterDirectiveClass, OMPD_master,
1600  StartLoc, EndLoc, 0, 1) {}
1601 
1602  /// Build an empty directive.
1603  ///
1604  explicit OMPMasterDirective()
1605  : OMPExecutableDirective(this, OMPMasterDirectiveClass, OMPD_master,
1606  SourceLocation(), SourceLocation(), 0, 1) {}
1607 
1608 public:
1609  /// Creates directive.
1610  ///
1611  /// \param C AST context.
1612  /// \param StartLoc Starting location of the directive kind.
1613  /// \param EndLoc Ending Location of the directive.
1614  /// \param AssociatedStmt Statement, associated with the directive.
1615  ///
1616  static OMPMasterDirective *Create(const ASTContext &C,
1617  SourceLocation StartLoc,
1618  SourceLocation EndLoc,
1619  Stmt *AssociatedStmt);
1620 
1621  /// Creates an empty directive.
1622  ///
1623  /// \param C AST context.
1624  ///
1626 
1627  static bool classof(const Stmt *T) {
1628  return T->getStmtClass() == OMPMasterDirectiveClass;
1629  }
1630 };
1631 
1632 /// This represents '#pragma omp critical' directive.
1633 ///
1634 /// \code
1635 /// #pragma omp critical
1636 /// \endcode
1637 ///
1639  friend class ASTStmtReader;
1640  /// Name of the directive.
1641  DeclarationNameInfo DirName;
1642  /// Build directive with the given start and end location.
1643  ///
1644  /// \param Name Name of the directive.
1645  /// \param StartLoc Starting location of the directive kind.
1646  /// \param EndLoc Ending location of the directive.
1647  /// \param NumClauses Number of clauses.
1648  ///
1650  SourceLocation EndLoc, unsigned NumClauses)
1651  : OMPExecutableDirective(this, OMPCriticalDirectiveClass, OMPD_critical,
1652  StartLoc, EndLoc, NumClauses, 1),
1653  DirName(Name) {}
1654 
1655  /// Build an empty directive.
1656  ///
1657  /// \param NumClauses Number of clauses.
1658  ///
1659  explicit OMPCriticalDirective(unsigned NumClauses)
1660  : OMPExecutableDirective(this, OMPCriticalDirectiveClass, OMPD_critical,
1661  SourceLocation(), SourceLocation(), NumClauses,
1662  1),
1663  DirName() {}
1664 
1665  /// Set name of the directive.
1666  ///
1667  /// \param Name Name of the directive.
1668  ///
1669  void setDirectiveName(const DeclarationNameInfo &Name) { DirName = Name; }
1670 
1671 public:
1672  /// Creates directive.
1673  ///
1674  /// \param C AST context.
1675  /// \param Name Name of the directive.
1676  /// \param StartLoc Starting location of the directive kind.
1677  /// \param EndLoc Ending Location of the directive.
1678  /// \param Clauses List of clauses.
1679  /// \param AssociatedStmt Statement, associated with the directive.
1680  ///
1681  static OMPCriticalDirective *
1682  Create(const ASTContext &C, const DeclarationNameInfo &Name,
1683  SourceLocation StartLoc, SourceLocation EndLoc,
1684  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
1685 
1686  /// Creates an empty directive.
1687  ///
1688  /// \param C AST context.
1689  /// \param NumClauses Number of clauses.
1690  ///
1692  unsigned NumClauses, EmptyShell);
1693 
1694  /// Return name of the directive.
1695  ///
1696  DeclarationNameInfo getDirectiveName() const { return DirName; }
1697 
1698  static bool classof(const Stmt *T) {
1699  return T->getStmtClass() == OMPCriticalDirectiveClass;
1700  }
1701 };
1702 
1703 /// This represents '#pragma omp parallel for' directive.
1704 ///
1705 /// \code
1706 /// #pragma omp parallel for private(a,b) reduction(+:c,d)
1707 /// \endcode
1708 /// In this example directive '#pragma omp parallel for' has clauses 'private'
1709 /// with the variables 'a' and 'b' and 'reduction' with operator '+' and
1710 /// variables 'c' and 'd'.
1711 ///
1713  friend class ASTStmtReader;
1714 
1715  /// true if current region has inner cancel directive.
1716  bool HasCancel;
1717 
1718  /// Build directive with the given start and end location.
1719  ///
1720  /// \param StartLoc Starting location of the directive kind.
1721  /// \param EndLoc Ending location of the directive.
1722  /// \param CollapsedNum Number of collapsed nested loops.
1723  /// \param NumClauses Number of clauses.
1724  ///
1726  unsigned CollapsedNum, unsigned NumClauses)
1727  : OMPLoopDirective(this, OMPParallelForDirectiveClass, OMPD_parallel_for,
1728  StartLoc, EndLoc, CollapsedNum, NumClauses),
1729  HasCancel(false) {}
1730 
1731  /// Build an empty directive.
1732  ///
1733  /// \param CollapsedNum Number of collapsed nested loops.
1734  /// \param NumClauses Number of clauses.
1735  ///
1736  explicit OMPParallelForDirective(unsigned CollapsedNum, unsigned NumClauses)
1737  : OMPLoopDirective(this, OMPParallelForDirectiveClass, OMPD_parallel_for,
1738  SourceLocation(), SourceLocation(), CollapsedNum,
1739  NumClauses),
1740  HasCancel(false) {}
1741 
1742  /// Set cancel state.
1743  void setHasCancel(bool Has) { HasCancel = Has; }
1744 
1745 public:
1746  /// Creates directive with a list of \a Clauses.
1747  ///
1748  /// \param C AST context.
1749  /// \param StartLoc Starting location of the directive kind.
1750  /// \param EndLoc Ending Location of the directive.
1751  /// \param CollapsedNum Number of collapsed loops.
1752  /// \param Clauses List of clauses.
1753  /// \param AssociatedStmt Statement, associated with the directive.
1754  /// \param Exprs Helper expressions for CodeGen.
1755  /// \param HasCancel true if current directive has inner cancel directive.
1756  ///
1757  static OMPParallelForDirective *
1758  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1759  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
1760  Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
1761 
1762  /// Creates an empty directive with the place
1763  /// for \a NumClauses clauses.
1764  ///
1765  /// \param C AST context.
1766  /// \param CollapsedNum Number of collapsed nested loops.
1767  /// \param NumClauses Number of clauses.
1768  ///
1770  unsigned NumClauses,
1771  unsigned CollapsedNum,
1772  EmptyShell);
1773 
1774  /// Return true if current directive has inner cancel directive.
1775  bool hasCancel() const { return HasCancel; }
1776 
1777  static bool classof(const Stmt *T) {
1778  return T->getStmtClass() == OMPParallelForDirectiveClass;
1779  }
1780 };
1781 
1782 /// This represents '#pragma omp parallel for simd' directive.
1783 ///
1784 /// \code
1785 /// #pragma omp parallel for simd private(a,b) linear(i,j:s) reduction(+:c,d)
1786 /// \endcode
1787 /// In this example directive '#pragma omp parallel for simd' has clauses
1788 /// 'private' with the variables 'a' and 'b', 'linear' with variables 'i', 'j'
1789 /// and linear step 's', 'reduction' with operator '+' and variables 'c' and
1790 /// 'd'.
1791 ///
1793  friend class ASTStmtReader;
1794  /// Build directive with the given start and end location.
1795  ///
1796  /// \param StartLoc Starting location of the directive kind.
1797  /// \param EndLoc Ending location of the directive.
1798  /// \param CollapsedNum Number of collapsed nested loops.
1799  /// \param NumClauses Number of clauses.
1800  ///
1802  unsigned CollapsedNum, unsigned NumClauses)
1803  : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass,
1804  OMPD_parallel_for_simd, StartLoc, EndLoc, CollapsedNum,
1805  NumClauses) {}
1806 
1807  /// Build an empty directive.
1808  ///
1809  /// \param CollapsedNum Number of collapsed nested loops.
1810  /// \param NumClauses Number of clauses.
1811  ///
1812  explicit OMPParallelForSimdDirective(unsigned CollapsedNum,
1813  unsigned NumClauses)
1814  : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass,
1815  OMPD_parallel_for_simd, SourceLocation(),
1816  SourceLocation(), CollapsedNum, NumClauses) {}
1817 
1818 public:
1819  /// Creates directive with a list of \a Clauses.
1820  ///
1821  /// \param C AST context.
1822  /// \param StartLoc Starting location of the directive kind.
1823  /// \param EndLoc Ending Location of the directive.
1824  /// \param CollapsedNum Number of collapsed loops.
1825  /// \param Clauses List of clauses.
1826  /// \param AssociatedStmt Statement, associated with the directive.
1827  /// \param Exprs Helper expressions for CodeGen.
1828  ///
1830  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1831  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
1832  Stmt *AssociatedStmt, const HelperExprs &Exprs);
1833 
1834  /// Creates an empty directive with the place
1835  /// for \a NumClauses clauses.
1836  ///
1837  /// \param C AST context.
1838  /// \param CollapsedNum Number of collapsed nested loops.
1839  /// \param NumClauses Number of clauses.
1840  ///
1842  unsigned NumClauses,
1843  unsigned CollapsedNum,
1844  EmptyShell);
1845 
1846  static bool classof(const Stmt *T) {
1847  return T->getStmtClass() == OMPParallelForSimdDirectiveClass;
1848  }
1849 };
1850 
1851 /// This represents '#pragma omp parallel sections' directive.
1852 ///
1853 /// \code
1854 /// #pragma omp parallel sections private(a,b) reduction(+:c,d)
1855 /// \endcode
1856 /// In this example directive '#pragma omp parallel sections' has clauses
1857 /// 'private' with the variables 'a' and 'b' and 'reduction' with operator '+'
1858 /// and variables 'c' and 'd'.
1859 ///
1861  friend class ASTStmtReader;
1862 
1863  /// true if current directive has inner cancel directive.
1864  bool HasCancel;
1865 
1866  /// Build directive with the given start and end location.
1867  ///
1868  /// \param StartLoc Starting location of the directive kind.
1869  /// \param EndLoc Ending location of the directive.
1870  /// \param NumClauses Number of clauses.
1871  ///
1873  unsigned NumClauses)
1874  : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass,
1875  OMPD_parallel_sections, StartLoc, EndLoc,
1876  NumClauses, 1),
1877  HasCancel(false) {}
1878 
1879  /// Build an empty directive.
1880  ///
1881  /// \param NumClauses Number of clauses.
1882  ///
1883  explicit OMPParallelSectionsDirective(unsigned NumClauses)
1884  : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass,
1885  OMPD_parallel_sections, SourceLocation(),
1886  SourceLocation(), NumClauses, 1),
1887  HasCancel(false) {}
1888 
1889  /// Set cancel state.
1890  void setHasCancel(bool Has) { HasCancel = Has; }
1891 
1892 public:
1893  /// Creates directive with a list of \a Clauses.
1894  ///
1895  /// \param C AST context.
1896  /// \param StartLoc Starting location of the directive kind.
1897  /// \param EndLoc Ending Location of the directive.
1898  /// \param Clauses List of clauses.
1899  /// \param AssociatedStmt Statement, associated with the directive.
1900  /// \param HasCancel true if current directive has inner cancel directive.
1901  ///
1903  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1904  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel);
1905 
1906  /// Creates an empty directive with the place for \a NumClauses
1907  /// clauses.
1908  ///
1909  /// \param C AST context.
1910  /// \param NumClauses Number of clauses.
1911  ///
1913  CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
1914 
1915  /// Return true if current directive has inner cancel directive.
1916  bool hasCancel() const { return HasCancel; }
1917 
1918  static bool classof(const Stmt *T) {
1919  return T->getStmtClass() == OMPParallelSectionsDirectiveClass;
1920  }
1921 };
1922 
1923 /// This represents '#pragma omp task' directive.
1924 ///
1925 /// \code
1926 /// #pragma omp task private(a,b) final(d)
1927 /// \endcode
1928 /// In this example directive '#pragma omp task' has clauses 'private' with the
1929 /// variables 'a' and 'b' and 'final' with condition 'd'.
1930 ///
1932  friend class ASTStmtReader;
1933  /// true if this directive has inner cancel directive.
1934  bool HasCancel;
1935 
1936  /// Build directive with the given start and end location.
1937  ///
1938  /// \param StartLoc Starting location of the directive kind.
1939  /// \param EndLoc Ending location of the directive.
1940  /// \param NumClauses Number of clauses.
1941  ///
1943  unsigned NumClauses)
1944  : OMPExecutableDirective(this, OMPTaskDirectiveClass, OMPD_task, StartLoc,
1945  EndLoc, NumClauses, 1),
1946  HasCancel(false) {}
1947 
1948  /// Build an empty directive.
1949  ///
1950  /// \param NumClauses Number of clauses.
1951  ///
1952  explicit OMPTaskDirective(unsigned NumClauses)
1953  : OMPExecutableDirective(this, OMPTaskDirectiveClass, OMPD_task,
1954  SourceLocation(), SourceLocation(), NumClauses,
1955  1),
1956  HasCancel(false) {}
1957 
1958  /// Set cancel state.
1959  void setHasCancel(bool Has) { HasCancel = Has; }
1960 
1961 public:
1962  /// Creates directive with a list of \a Clauses.
1963  ///
1964  /// \param C AST context.
1965  /// \param StartLoc Starting location of the directive kind.
1966  /// \param EndLoc Ending Location of the directive.
1967  /// \param Clauses List of clauses.
1968  /// \param AssociatedStmt Statement, associated with the directive.
1969  /// \param HasCancel true, if current directive has inner cancel directive.
1970  ///
1971  static OMPTaskDirective *Create(const ASTContext &C, SourceLocation StartLoc,
1972  SourceLocation EndLoc,
1973  ArrayRef<OMPClause *> Clauses,
1974  Stmt *AssociatedStmt, bool HasCancel);
1975 
1976  /// Creates an empty directive with the place for \a NumClauses
1977  /// clauses.
1978  ///
1979  /// \param C AST context.
1980  /// \param NumClauses Number of clauses.
1981  ///
1982  static OMPTaskDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
1983  EmptyShell);
1984 
1985  /// Return true if current directive has inner cancel directive.
1986  bool hasCancel() const { return HasCancel; }
1987 
1988  static bool classof(const Stmt *T) {
1989  return T->getStmtClass() == OMPTaskDirectiveClass;
1990  }
1991 };
1992 
1993 /// This represents '#pragma omp taskyield' directive.
1994 ///
1995 /// \code
1996 /// #pragma omp taskyield
1997 /// \endcode
1998 ///
2000  friend class ASTStmtReader;
2001  /// Build directive with the given start and end location.
2002  ///
2003  /// \param StartLoc Starting location of the directive kind.
2004  /// \param EndLoc Ending location of the directive.
2005  ///
2007  : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, OMPD_taskyield,
2008  StartLoc, EndLoc, 0, 0) {}
2009 
2010  /// Build an empty directive.
2011  ///
2012  explicit OMPTaskyieldDirective()
2013  : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, OMPD_taskyield,
2014  SourceLocation(), SourceLocation(), 0, 0) {}
2015 
2016 public:
2017  /// Creates directive.
2018  ///
2019  /// \param C AST context.
2020  /// \param StartLoc Starting location of the directive kind.
2021  /// \param EndLoc Ending Location of the directive.
2022  ///
2023  static OMPTaskyieldDirective *
2024  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
2025 
2026  /// Creates an empty directive.
2027  ///
2028  /// \param C AST context.
2029  ///
2031 
2032  static bool classof(const Stmt *T) {
2033  return T->getStmtClass() == OMPTaskyieldDirectiveClass;
2034  }
2035 };
2036 
2037 /// This represents '#pragma omp barrier' directive.
2038 ///
2039 /// \code
2040 /// #pragma omp barrier
2041 /// \endcode
2042 ///
2044  friend class ASTStmtReader;
2045  /// Build directive with the given start and end location.
2046  ///
2047  /// \param StartLoc Starting location of the directive kind.
2048  /// \param EndLoc Ending location of the directive.
2049  ///
2051  : OMPExecutableDirective(this, OMPBarrierDirectiveClass, OMPD_barrier,
2052  StartLoc, EndLoc, 0, 0) {}
2053 
2054  /// Build an empty directive.
2055  ///
2056  explicit OMPBarrierDirective()
2057  : OMPExecutableDirective(this, OMPBarrierDirectiveClass, OMPD_barrier,
2058  SourceLocation(), SourceLocation(), 0, 0) {}
2059 
2060 public:
2061  /// Creates directive.
2062  ///
2063  /// \param C AST context.
2064  /// \param StartLoc Starting location of the directive kind.
2065  /// \param EndLoc Ending Location of the directive.
2066  ///
2067  static OMPBarrierDirective *
2068  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
2069 
2070  /// Creates an empty directive.
2071  ///
2072  /// \param C AST context.
2073  ///
2075 
2076  static bool classof(const Stmt *T) {
2077  return T->getStmtClass() == OMPBarrierDirectiveClass;
2078  }
2079 };
2080 
2081 /// This represents '#pragma omp taskwait' directive.
2082 ///
2083 /// \code
2084 /// #pragma omp taskwait
2085 /// \endcode
2086 ///
2088  friend class ASTStmtReader;
2089  /// Build directive with the given start and end location.
2090  ///
2091  /// \param StartLoc Starting location of the directive kind.
2092  /// \param EndLoc Ending location of the directive.
2093  ///
2095  : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, OMPD_taskwait,
2096  StartLoc, EndLoc, 0, 0) {}
2097 
2098  /// Build an empty directive.
2099  ///
2100  explicit OMPTaskwaitDirective()
2101  : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, OMPD_taskwait,
2102  SourceLocation(), SourceLocation(), 0, 0) {}
2103 
2104 public:
2105  /// Creates directive.
2106  ///
2107  /// \param C AST context.
2108  /// \param StartLoc Starting location of the directive kind.
2109  /// \param EndLoc Ending Location of the directive.
2110  ///
2111  static OMPTaskwaitDirective *
2112  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
2113 
2114  /// Creates an empty directive.
2115  ///
2116  /// \param C AST context.
2117  ///
2119 
2120  static bool classof(const Stmt *T) {
2121  return T->getStmtClass() == OMPTaskwaitDirectiveClass;
2122  }
2123 };
2124 
2125 /// This represents '#pragma omp taskgroup' directive.
2126 ///
2127 /// \code
2128 /// #pragma omp taskgroup
2129 /// \endcode
2130 ///
2132  friend class ASTStmtReader;
2133  /// Build directive with the given start and end location.
2134  ///
2135  /// \param StartLoc Starting location of the directive kind.
2136  /// \param EndLoc Ending location of the directive.
2137  /// \param NumClauses Number of clauses.
2138  ///
2140  unsigned NumClauses)
2141  : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, OMPD_taskgroup,
2142  StartLoc, EndLoc, NumClauses, 2) {}
2143 
2144  /// Build an empty directive.
2145  /// \param NumClauses Number of clauses.
2146  ///
2147  explicit OMPTaskgroupDirective(unsigned NumClauses)
2148  : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, OMPD_taskgroup,
2149  SourceLocation(), SourceLocation(), NumClauses,
2150  2) {}
2151 
2152  /// Sets the task_reduction return variable.
2153  void setReductionRef(Expr *RR) {
2154  *std::next(child_begin(), 1) = RR;
2155  }
2156 
2157 public:
2158  /// Creates directive.
2159  ///
2160  /// \param C AST context.
2161  /// \param StartLoc Starting location of the directive kind.
2162  /// \param EndLoc Ending Location of the directive.
2163  /// \param Clauses List of clauses.
2164  /// \param AssociatedStmt Statement, associated with the directive.
2165  /// \param ReductionRef Reference to the task_reduction return variable.
2166  ///
2167  static OMPTaskgroupDirective *
2168  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2169  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2170  Expr *ReductionRef);
2171 
2172  /// Creates an empty directive.
2173  ///
2174  /// \param C AST context.
2175  /// \param NumClauses Number of clauses.
2176  ///
2178  unsigned NumClauses, EmptyShell);
2179 
2180 
2181  /// Returns reference to the task_reduction return variable.
2182  const Expr *getReductionRef() const {
2183  return static_cast<const Expr *>(*std::next(child_begin(), 1));
2184  }
2186  return static_cast<Expr *>(*std::next(child_begin(), 1));
2187  }
2188 
2189  static bool classof(const Stmt *T) {
2190  return T->getStmtClass() == OMPTaskgroupDirectiveClass;
2191  }
2192 };
2193 
2194 /// This represents '#pragma omp flush' directive.
2195 ///
2196 /// \code
2197 /// #pragma omp flush(a,b)
2198 /// \endcode
2199 /// In this example directive '#pragma omp flush' has 2 arguments- variables 'a'
2200 /// and 'b'.
2201 /// 'omp flush' directive does not have clauses but have an optional list of
2202 /// variables to flush. This list of variables is stored within some fake clause
2203 /// FlushClause.
2205  friend class ASTStmtReader;
2206  /// Build directive with the given start and end location.
2207  ///
2208  /// \param StartLoc Starting location of the directive kind.
2209  /// \param EndLoc Ending location of the directive.
2210  /// \param NumClauses Number of clauses.
2211  ///
2213  unsigned NumClauses)
2214  : OMPExecutableDirective(this, OMPFlushDirectiveClass, OMPD_flush,
2215  StartLoc, EndLoc, NumClauses, 0) {}
2216 
2217  /// Build an empty directive.
2218  ///
2219  /// \param NumClauses Number of clauses.
2220  ///
2221  explicit OMPFlushDirective(unsigned NumClauses)
2222  : OMPExecutableDirective(this, OMPFlushDirectiveClass, OMPD_flush,
2223  SourceLocation(), SourceLocation(), NumClauses,
2224  0) {}
2225 
2226 public:
2227  /// Creates directive with a list of \a Clauses.
2228  ///
2229  /// \param C AST context.
2230  /// \param StartLoc Starting location of the directive kind.
2231  /// \param EndLoc Ending Location of the directive.
2232  /// \param Clauses List of clauses (only single OMPFlushClause clause is
2233  /// allowed).
2234  ///
2235  static OMPFlushDirective *Create(const ASTContext &C, SourceLocation StartLoc,
2236  SourceLocation EndLoc,
2237  ArrayRef<OMPClause *> Clauses);
2238 
2239  /// Creates an empty directive with the place for \a NumClauses
2240  /// clauses.
2241  ///
2242  /// \param C AST context.
2243  /// \param NumClauses Number of clauses.
2244  ///
2245  static OMPFlushDirective *CreateEmpty(const ASTContext &C,
2246  unsigned NumClauses, EmptyShell);
2247 
2248  static bool classof(const Stmt *T) {
2249  return T->getStmtClass() == OMPFlushDirectiveClass;
2250  }
2251 };
2252 
2253 /// This represents '#pragma omp ordered' directive.
2254 ///
2255 /// \code
2256 /// #pragma omp ordered
2257 /// \endcode
2258 ///
2260  friend class ASTStmtReader;
2261  /// Build directive with the given start and end location.
2262  ///
2263  /// \param StartLoc Starting location of the directive kind.
2264  /// \param EndLoc Ending location of the directive.
2265  /// \param NumClauses Number of clauses.
2266  ///
2268  unsigned NumClauses)
2269  : OMPExecutableDirective(this, OMPOrderedDirectiveClass, OMPD_ordered,
2270  StartLoc, EndLoc, NumClauses, 1) {}
2271 
2272  /// Build an empty directive.
2273  ///
2274  /// \param NumClauses Number of clauses.
2275  ///
2276  explicit OMPOrderedDirective(unsigned NumClauses)
2277  : OMPExecutableDirective(this, OMPOrderedDirectiveClass, OMPD_ordered,
2278  SourceLocation(), SourceLocation(), NumClauses,
2279  1) {}
2280 
2281 public:
2282  /// Creates directive.
2283  ///
2284  /// \param C AST context.
2285  /// \param StartLoc Starting location of the directive kind.
2286  /// \param EndLoc Ending Location of the directive.
2287  /// \param Clauses List of clauses.
2288  /// \param AssociatedStmt Statement, associated with the directive.
2289  ///
2290  static OMPOrderedDirective *
2291  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2292  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2293 
2294  /// Creates an empty directive.
2295  ///
2296  /// \param C AST context.
2297  /// \param NumClauses Number of clauses.
2298  ///
2300  unsigned NumClauses, EmptyShell);
2301 
2302  static bool classof(const Stmt *T) {
2303  return T->getStmtClass() == OMPOrderedDirectiveClass;
2304  }
2305 };
2306 
2307 /// This represents '#pragma omp atomic' directive.
2308 ///
2309 /// \code
2310 /// #pragma omp atomic capture
2311 /// \endcode
2312 /// In this example directive '#pragma omp atomic' has clause 'capture'.
2313 ///
2315  friend class ASTStmtReader;
2316  /// Used for 'atomic update' or 'atomic capture' constructs. They may
2317  /// have atomic expressions of forms
2318  /// \code
2319  /// x = x binop expr;
2320  /// x = expr binop x;
2321  /// \endcode
2322  /// This field is true for the first form of the expression and false for the
2323  /// second. Required for correct codegen of non-associative operations (like
2324  /// << or >>).
2325  bool IsXLHSInRHSPart;
2326  /// Used for 'atomic update' or 'atomic capture' constructs. They may
2327  /// have atomic expressions of forms
2328  /// \code
2329  /// v = x; <update x>;
2330  /// <update x>; v = x;
2331  /// \endcode
2332  /// This field is true for the first(postfix) form of the expression and false
2333  /// otherwise.
2334  bool IsPostfixUpdate;
2335 
2336  /// Build directive with the given start and end location.
2337  ///
2338  /// \param StartLoc Starting location of the directive kind.
2339  /// \param EndLoc Ending location of the directive.
2340  /// \param NumClauses Number of clauses.
2341  ///
2343  unsigned NumClauses)
2344  : OMPExecutableDirective(this, OMPAtomicDirectiveClass, OMPD_atomic,
2345  StartLoc, EndLoc, NumClauses, 5),
2346  IsXLHSInRHSPart(false), IsPostfixUpdate(false) {}
2347 
2348  /// Build an empty directive.
2349  ///
2350  /// \param NumClauses Number of clauses.
2351  ///
2352  explicit OMPAtomicDirective(unsigned NumClauses)
2353  : OMPExecutableDirective(this, OMPAtomicDirectiveClass, OMPD_atomic,
2354  SourceLocation(), SourceLocation(), NumClauses,
2355  5),
2356  IsXLHSInRHSPart(false), IsPostfixUpdate(false) {}
2357 
2358  /// Set 'x' part of the associated expression/statement.
2359  void setX(Expr *X) { *std::next(child_begin()) = X; }
2360  /// Set helper expression of the form
2361  /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or
2362  /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
2363  void setUpdateExpr(Expr *UE) { *std::next(child_begin(), 2) = UE; }
2364  /// Set 'v' part of the associated expression/statement.
2365  void setV(Expr *V) { *std::next(child_begin(), 3) = V; }
2366  /// Set 'expr' part of the associated expression/statement.
2367  void setExpr(Expr *E) { *std::next(child_begin(), 4) = E; }
2368 
2369 public:
2370  /// Creates directive with a list of \a Clauses and 'x', 'v' and 'expr'
2371  /// parts of the atomic construct (see Section 2.12.6, atomic Construct, for
2372  /// detailed description of 'x', 'v' and 'expr').
2373  ///
2374  /// \param C AST context.
2375  /// \param StartLoc Starting location of the directive kind.
2376  /// \param EndLoc Ending Location of the directive.
2377  /// \param Clauses List of clauses.
2378  /// \param AssociatedStmt Statement, associated with the directive.
2379  /// \param X 'x' part of the associated expression/statement.
2380  /// \param V 'v' part of the associated expression/statement.
2381  /// \param E 'expr' part of the associated expression/statement.
2382  /// \param UE Helper expression of the form
2383  /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or
2384  /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
2385  /// \param IsXLHSInRHSPart true if \a UE has the first form and false if the
2386  /// second.
2387  /// \param IsPostfixUpdate true if original value of 'x' must be stored in
2388  /// 'v', not an updated one.
2389  static OMPAtomicDirective *
2390  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2391  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
2392  Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate);
2393 
2394  /// Creates an empty directive with the place for \a NumClauses
2395  /// clauses.
2396  ///
2397  /// \param C AST context.
2398  /// \param NumClauses Number of clauses.
2399  ///
2400  static OMPAtomicDirective *CreateEmpty(const ASTContext &C,
2401  unsigned NumClauses, EmptyShell);
2402 
2403  /// Get 'x' part of the associated expression/statement.
2404  Expr *getX() { return cast_or_null<Expr>(*std::next(child_begin())); }
2405  const Expr *getX() const {
2406  return cast_or_null<Expr>(*std::next(child_begin()));
2407  }
2408  /// Get helper expression of the form
2409  /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or
2410  /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
2412  return cast_or_null<Expr>(*std::next(child_begin(), 2));
2413  }
2414  const Expr *getUpdateExpr() const {
2415  return cast_or_null<Expr>(*std::next(child_begin(), 2));
2416  }
2417  /// Return true if helper update expression has form
2418  /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' and false if it has form
2419  /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
2420  bool isXLHSInRHSPart() const { return IsXLHSInRHSPart; }
2421  /// Return true if 'v' expression must be updated to original value of
2422  /// 'x', false if 'v' must be updated to the new value of 'x'.
2423  bool isPostfixUpdate() const { return IsPostfixUpdate; }
2424  /// Get 'v' part of the associated expression/statement.
2425  Expr *getV() { return cast_or_null<Expr>(*std::next(child_begin(), 3)); }
2426  const Expr *getV() const {
2427  return cast_or_null<Expr>(*std::next(child_begin(), 3));
2428  }
2429  /// Get 'expr' part of the associated expression/statement.
2430  Expr *getExpr() { return cast_or_null<Expr>(*std::next(child_begin(), 4)); }
2431  const Expr *getExpr() const {
2432  return cast_or_null<Expr>(*std::next(child_begin(), 4));
2433  }
2434 
2435  static bool classof(const Stmt *T) {
2436  return T->getStmtClass() == OMPAtomicDirectiveClass;
2437  }
2438 };
2439 
2440 /// This represents '#pragma omp target' directive.
2441 ///
2442 /// \code
2443 /// #pragma omp target if(a)
2444 /// \endcode
2445 /// In this example directive '#pragma omp target' has clause 'if' with
2446 /// condition 'a'.
2447 ///
2449  friend class ASTStmtReader;
2450  /// Build directive with the given start and end location.
2451  ///
2452  /// \param StartLoc Starting location of the directive kind.
2453  /// \param EndLoc Ending location of the directive.
2454  /// \param NumClauses Number of clauses.
2455  ///
2457  unsigned NumClauses)
2458  : OMPExecutableDirective(this, OMPTargetDirectiveClass, OMPD_target,
2459  StartLoc, EndLoc, NumClauses, 1) {}
2460 
2461  /// Build an empty directive.
2462  ///
2463  /// \param NumClauses Number of clauses.
2464  ///
2465  explicit OMPTargetDirective(unsigned NumClauses)
2466  : OMPExecutableDirective(this, OMPTargetDirectiveClass, OMPD_target,
2467  SourceLocation(), SourceLocation(), NumClauses,
2468  1) {}
2469 
2470 public:
2471  /// Creates directive with a list of \a Clauses.
2472  ///
2473  /// \param C AST context.
2474  /// \param StartLoc Starting location of the directive kind.
2475  /// \param EndLoc Ending Location of the directive.
2476  /// \param Clauses List of clauses.
2477  /// \param AssociatedStmt Statement, associated with the directive.
2478  ///
2479  static OMPTargetDirective *
2480  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2481  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2482 
2483  /// Creates an empty directive with the place for \a NumClauses
2484  /// clauses.
2485  ///
2486  /// \param C AST context.
2487  /// \param NumClauses Number of clauses.
2488  ///
2489  static OMPTargetDirective *CreateEmpty(const ASTContext &C,
2490  unsigned NumClauses, EmptyShell);
2491 
2492  static bool classof(const Stmt *T) {
2493  return T->getStmtClass() == OMPTargetDirectiveClass;
2494  }
2495 };
2496 
2497 /// This represents '#pragma omp target data' directive.
2498 ///
2499 /// \code
2500 /// #pragma omp target data device(0) if(a) map(b[:])
2501 /// \endcode
2502 /// In this example directive '#pragma omp target data' has clauses 'device'
2503 /// with the value '0', 'if' with condition 'a' and 'map' with array
2504 /// section 'b[:]'.
2505 ///
2507  friend class ASTStmtReader;
2508  /// Build directive with the given start and end location.
2509  ///
2510  /// \param StartLoc Starting location of the directive kind.
2511  /// \param EndLoc Ending Location of the directive.
2512  /// \param NumClauses The number of clauses.
2513  ///
2515  unsigned NumClauses)
2516  : OMPExecutableDirective(this, OMPTargetDataDirectiveClass,
2517  OMPD_target_data, StartLoc, EndLoc, NumClauses,
2518  1) {}
2519 
2520  /// Build an empty directive.
2521  ///
2522  /// \param NumClauses Number of clauses.
2523  ///
2524  explicit OMPTargetDataDirective(unsigned NumClauses)
2525  : OMPExecutableDirective(this, OMPTargetDataDirectiveClass,
2526  OMPD_target_data, SourceLocation(),
2527  SourceLocation(), NumClauses, 1) {}
2528 
2529 public:
2530  /// Creates directive with a list of \a Clauses.
2531  ///
2532  /// \param C AST context.
2533  /// \param StartLoc Starting location of the directive kind.
2534  /// \param EndLoc Ending Location of the directive.
2535  /// \param Clauses List of clauses.
2536  /// \param AssociatedStmt Statement, associated with the directive.
2537  ///
2538  static OMPTargetDataDirective *
2539  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2540  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2541 
2542  /// Creates an empty directive with the place for \a N clauses.
2543  ///
2544  /// \param C AST context.
2545  /// \param N The number of clauses.
2546  ///
2547  static OMPTargetDataDirective *CreateEmpty(const ASTContext &C, unsigned N,
2548  EmptyShell);
2549 
2550  static bool classof(const Stmt *T) {
2551  return T->getStmtClass() == OMPTargetDataDirectiveClass;
2552  }
2553 };
2554 
2555 /// This represents '#pragma omp target enter data' directive.
2556 ///
2557 /// \code
2558 /// #pragma omp target enter data device(0) if(a) map(b[:])
2559 /// \endcode
2560 /// In this example directive '#pragma omp target enter data' has clauses
2561 /// 'device' with the value '0', 'if' with condition 'a' and 'map' with array
2562 /// section 'b[:]'.
2563 ///
2565  friend class ASTStmtReader;
2566  /// Build directive with the given start and end location.
2567  ///
2568  /// \param StartLoc Starting location of the directive kind.
2569  /// \param EndLoc Ending Location of the directive.
2570  /// \param NumClauses The number of clauses.
2571  ///
2573  unsigned NumClauses)
2574  : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass,
2575  OMPD_target_enter_data, StartLoc, EndLoc,
2576  NumClauses, /*NumChildren=*/1) {}
2577 
2578  /// Build an empty directive.
2579  ///
2580  /// \param NumClauses Number of clauses.
2581  ///
2582  explicit OMPTargetEnterDataDirective(unsigned NumClauses)
2583  : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass,
2584  OMPD_target_enter_data, SourceLocation(),
2585  SourceLocation(), NumClauses,
2586  /*NumChildren=*/1) {}
2587 
2588 public:
2589  /// Creates directive with a list of \a Clauses.
2590  ///
2591  /// \param C AST context.
2592  /// \param StartLoc Starting location of the directive kind.
2593  /// \param EndLoc Ending Location of the directive.
2594  /// \param Clauses List of clauses.
2595  /// \param AssociatedStmt Statement, associated with the directive.
2596  ///
2598  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2599  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2600 
2601  /// Creates an empty directive with the place for \a N clauses.
2602  ///
2603  /// \param C AST context.
2604  /// \param N The number of clauses.
2605  ///
2607  unsigned N, EmptyShell);
2608 
2609  static bool classof(const Stmt *T) {
2610  return T->getStmtClass() == OMPTargetEnterDataDirectiveClass;
2611  }
2612 };
2613 
2614 /// This represents '#pragma omp target exit data' directive.
2615 ///
2616 /// \code
2617 /// #pragma omp target exit data device(0) if(a) map(b[:])
2618 /// \endcode
2619 /// In this example directive '#pragma omp target exit data' has clauses
2620 /// 'device' with the value '0', 'if' with condition 'a' and 'map' with array
2621 /// section 'b[:]'.
2622 ///
2624  friend class ASTStmtReader;
2625  /// Build directive with the given start and end location.
2626  ///
2627  /// \param StartLoc Starting location of the directive kind.
2628  /// \param EndLoc Ending Location of the directive.
2629  /// \param NumClauses The number of clauses.
2630  ///
2632  unsigned NumClauses)
2633  : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass,
2634  OMPD_target_exit_data, StartLoc, EndLoc,
2635  NumClauses, /*NumChildren=*/1) {}
2636 
2637  /// Build an empty directive.
2638  ///
2639  /// \param NumClauses Number of clauses.
2640  ///
2641  explicit OMPTargetExitDataDirective(unsigned NumClauses)
2642  : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass,
2643  OMPD_target_exit_data, SourceLocation(),
2644  SourceLocation(), NumClauses,
2645  /*NumChildren=*/1) {}
2646 
2647 public:
2648  /// Creates directive with a list of \a Clauses.
2649  ///
2650  /// \param C AST context.
2651  /// \param StartLoc Starting location of the directive kind.
2652  /// \param EndLoc Ending Location of the directive.
2653  /// \param Clauses List of clauses.
2654  /// \param AssociatedStmt Statement, associated with the directive.
2655  ///
2657  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2658  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2659 
2660  /// Creates an empty directive with the place for \a N clauses.
2661  ///
2662  /// \param C AST context.
2663  /// \param N The number of clauses.
2664  ///
2666  unsigned N, EmptyShell);
2667 
2668  static bool classof(const Stmt *T) {
2669  return T->getStmtClass() == OMPTargetExitDataDirectiveClass;
2670  }
2671 };
2672 
2673 /// This represents '#pragma omp target parallel' directive.
2674 ///
2675 /// \code
2676 /// #pragma omp target parallel if(a)
2677 /// \endcode
2678 /// In this example directive '#pragma omp target parallel' has clause 'if' with
2679 /// condition 'a'.
2680 ///
2682  friend class ASTStmtReader;
2683  /// Build directive with the given start and end location.
2684  ///
2685  /// \param StartLoc Starting location of the directive kind.
2686  /// \param EndLoc Ending location of the directive.
2687  /// \param NumClauses Number of clauses.
2688  ///
2690  unsigned NumClauses)
2691  : OMPExecutableDirective(this, OMPTargetParallelDirectiveClass,
2692  OMPD_target_parallel, StartLoc, EndLoc,
2693  NumClauses, /*NumChildren=*/1) {}
2694 
2695  /// Build an empty directive.
2696  ///
2697  /// \param NumClauses Number of clauses.
2698  ///
2699  explicit OMPTargetParallelDirective(unsigned NumClauses)
2700  : OMPExecutableDirective(this, OMPTargetParallelDirectiveClass,
2701  OMPD_target_parallel, SourceLocation(),
2702  SourceLocation(), NumClauses,
2703  /*NumChildren=*/1) {}
2704 
2705 public:
2706  /// Creates directive with a list of \a Clauses.
2707  ///
2708  /// \param C AST context.
2709  /// \param StartLoc Starting location of the directive kind.
2710  /// \param EndLoc Ending Location of the directive.
2711  /// \param Clauses List of clauses.
2712  /// \param AssociatedStmt Statement, associated with the directive.
2713  ///
2715  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2716  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2717 
2718  /// Creates an empty directive with the place for \a NumClauses
2719  /// clauses.
2720  ///
2721  /// \param C AST context.
2722  /// \param NumClauses Number of clauses.
2723  ///
2725  CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
2726 
2727  static bool classof(const Stmt *T) {
2728  return T->getStmtClass() == OMPTargetParallelDirectiveClass;
2729  }
2730 };
2731 
2732 /// This represents '#pragma omp target parallel for' directive.
2733 ///
2734 /// \code
2735 /// #pragma omp target parallel for private(a,b) reduction(+:c,d)
2736 /// \endcode
2737 /// In this example directive '#pragma omp target parallel for' has clauses
2738 /// 'private' with the variables 'a' and 'b' and 'reduction' with operator '+'
2739 /// and variables 'c' and 'd'.
2740 ///
2742  friend class ASTStmtReader;
2743 
2744  /// true if current region has inner cancel directive.
2745  bool HasCancel;
2746 
2747  /// Build directive with the given start and end location.
2748  ///
2749  /// \param StartLoc Starting location of the directive kind.
2750  /// \param EndLoc Ending location of the directive.
2751  /// \param CollapsedNum Number of collapsed nested loops.
2752  /// \param NumClauses Number of clauses.
2753  ///
2755  unsigned CollapsedNum, unsigned NumClauses)
2756  : OMPLoopDirective(this, OMPTargetParallelForDirectiveClass,
2757  OMPD_target_parallel_for, StartLoc, EndLoc,
2758  CollapsedNum, NumClauses),
2759  HasCancel(false) {}
2760 
2761  /// Build an empty directive.
2762  ///
2763  /// \param CollapsedNum Number of collapsed nested loops.
2764  /// \param NumClauses Number of clauses.
2765  ///
2766  explicit OMPTargetParallelForDirective(unsigned CollapsedNum,
2767  unsigned NumClauses)
2768  : OMPLoopDirective(this, OMPTargetParallelForDirectiveClass,
2769  OMPD_target_parallel_for, SourceLocation(),
2770  SourceLocation(), CollapsedNum, NumClauses),
2771  HasCancel(false) {}
2772 
2773  /// Set cancel state.
2774  void setHasCancel(bool Has) { HasCancel = Has; }
2775 
2776 public:
2777  /// Creates directive with a list of \a Clauses.
2778  ///
2779  /// \param C AST context.
2780  /// \param StartLoc Starting location of the directive kind.
2781  /// \param EndLoc Ending Location of the directive.
2782  /// \param CollapsedNum Number of collapsed loops.
2783  /// \param Clauses List of clauses.
2784  /// \param AssociatedStmt Statement, associated with the directive.
2785  /// \param Exprs Helper expressions for CodeGen.
2786  /// \param HasCancel true if current directive has inner cancel directive.
2787  ///
2789  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2790  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
2791  Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
2792 
2793  /// Creates an empty directive with the place
2794  /// for \a NumClauses clauses.
2795  ///
2796  /// \param C AST context.
2797  /// \param CollapsedNum Number of collapsed nested loops.
2798  /// \param NumClauses Number of clauses.
2799  ///
2801  unsigned NumClauses,
2802  unsigned CollapsedNum,
2803  EmptyShell);
2804 
2805  /// Return true if current directive has inner cancel directive.
2806  bool hasCancel() const { return HasCancel; }
2807 
2808  static bool classof(const Stmt *T) {
2809  return T->getStmtClass() == OMPTargetParallelForDirectiveClass;
2810  }
2811 };
2812 
2813 /// This represents '#pragma omp teams' directive.
2814 ///
2815 /// \code
2816 /// #pragma omp teams if(a)
2817 /// \endcode
2818 /// In this example directive '#pragma omp teams' has clause 'if' with
2819 /// condition 'a'.
2820 ///
2822  friend class ASTStmtReader;
2823  /// Build directive with the given start and end location.
2824  ///
2825  /// \param StartLoc Starting location of the directive kind.
2826  /// \param EndLoc Ending location of the directive.
2827  /// \param NumClauses Number of clauses.
2828  ///
2830  unsigned NumClauses)
2831  : OMPExecutableDirective(this, OMPTeamsDirectiveClass, OMPD_teams,
2832  StartLoc, EndLoc, NumClauses, 1) {}
2833 
2834  /// Build an empty directive.
2835  ///
2836  /// \param NumClauses Number of clauses.
2837  ///
2838  explicit OMPTeamsDirective(unsigned NumClauses)
2839  : OMPExecutableDirective(this, OMPTeamsDirectiveClass, OMPD_teams,
2840  SourceLocation(), SourceLocation(), NumClauses,
2841  1) {}
2842 
2843 public:
2844  /// Creates directive with a list of \a Clauses.
2845  ///
2846  /// \param C AST context.
2847  /// \param StartLoc Starting location of the directive kind.
2848  /// \param EndLoc Ending Location of the directive.
2849  /// \param Clauses List of clauses.
2850  /// \param AssociatedStmt Statement, associated with the directive.
2851  ///
2852  static OMPTeamsDirective *Create(const ASTContext &C, SourceLocation StartLoc,
2853  SourceLocation EndLoc,
2854  ArrayRef<OMPClause *> Clauses,
2855  Stmt *AssociatedStmt);
2856 
2857  /// Creates an empty directive with the place for \a NumClauses
2858  /// clauses.
2859  ///
2860  /// \param C AST context.
2861  /// \param NumClauses Number of clauses.
2862  ///
2863  static OMPTeamsDirective *CreateEmpty(const ASTContext &C,
2864  unsigned NumClauses, EmptyShell);
2865 
2866  static bool classof(const Stmt *T) {
2867  return T->getStmtClass() == OMPTeamsDirectiveClass;
2868  }
2869 };
2870 
2871 /// This represents '#pragma omp cancellation point' directive.
2872 ///
2873 /// \code
2874 /// #pragma omp cancellation point for
2875 /// \endcode
2876 ///
2877 /// In this example a cancellation point is created for innermost 'for' region.
2879  friend class ASTStmtReader;
2880  OpenMPDirectiveKind CancelRegion;
2881  /// Build directive with the given start and end location.
2882  ///
2883  /// \param StartLoc Starting location of the directive kind.
2884  /// \param EndLoc Ending location of the directive.
2885  ///
2887  : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
2888  OMPD_cancellation_point, StartLoc, EndLoc, 0, 0),
2889  CancelRegion(OMPD_unknown) {}
2890 
2891  /// Build an empty directive.
2892  ///
2894  : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
2895  OMPD_cancellation_point, SourceLocation(),
2896  SourceLocation(), 0, 0),
2897  CancelRegion(OMPD_unknown) {}
2898 
2899  /// Set cancel region for current cancellation point.
2900  /// \param CR Cancellation region.
2901  void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
2902 
2903 public:
2904  /// Creates directive.
2905  ///
2906  /// \param C AST context.
2907  /// \param StartLoc Starting location of the directive kind.
2908  /// \param EndLoc Ending Location of the directive.
2909  ///
2911  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2912  OpenMPDirectiveKind CancelRegion);
2913 
2914  /// Creates an empty directive.
2915  ///
2916  /// \param C AST context.
2917  ///
2919  EmptyShell);
2920 
2921  /// Get cancellation region for the current cancellation point.
2922  OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; }
2923 
2924  static bool classof(const Stmt *T) {
2925  return T->getStmtClass() == OMPCancellationPointDirectiveClass;
2926  }
2927 };
2928 
2929 /// This represents '#pragma omp cancel' directive.
2930 ///
2931 /// \code
2932 /// #pragma omp cancel for
2933 /// \endcode
2934 ///
2935 /// In this example a cancel is created for innermost 'for' region.
2937  friend class ASTStmtReader;
2938  OpenMPDirectiveKind CancelRegion;
2939  /// Build directive with the given start and end location.
2940  ///
2941  /// \param StartLoc Starting location of the directive kind.
2942  /// \param EndLoc Ending location of the directive.
2943  /// \param NumClauses Number of clauses.
2944  ///
2946  unsigned NumClauses)
2947  : OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
2948  StartLoc, EndLoc, NumClauses, 0),
2949  CancelRegion(OMPD_unknown) {}
2950 
2951  /// Build an empty directive.
2952  ///
2953  /// \param NumClauses Number of clauses.
2954  explicit OMPCancelDirective(unsigned NumClauses)
2955  : OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
2956  SourceLocation(), SourceLocation(), NumClauses,
2957  0),
2958  CancelRegion(OMPD_unknown) {}
2959 
2960  /// Set cancel region for current cancellation point.
2961  /// \param CR Cancellation region.
2962  void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
2963 
2964 public:
2965  /// Creates directive.
2966  ///
2967  /// \param C AST context.
2968  /// \param StartLoc Starting location of the directive kind.
2969  /// \param EndLoc Ending Location of the directive.
2970  /// \param Clauses List of clauses.
2971  ///
2972  static OMPCancelDirective *
2973  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2974  ArrayRef<OMPClause *> Clauses, OpenMPDirectiveKind CancelRegion);
2975 
2976  /// Creates an empty directive.
2977  ///
2978  /// \param C AST context.
2979  /// \param NumClauses Number of clauses.
2980  ///
2981  static OMPCancelDirective *CreateEmpty(const ASTContext &C,
2982  unsigned NumClauses, EmptyShell);
2983 
2984  /// Get cancellation region for the current cancellation point.
2985  OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; }
2986 
2987  static bool classof(const Stmt *T) {
2988  return T->getStmtClass() == OMPCancelDirectiveClass;
2989  }
2990 };
2991 
2992 /// This represents '#pragma omp taskloop' directive.
2993 ///
2994 /// \code
2995 /// #pragma omp taskloop private(a,b) grainsize(val) num_tasks(num)
2996 /// \endcode
2997 /// In this example directive '#pragma omp taskloop' has clauses 'private'
2998 /// with the variables 'a' and 'b', 'grainsize' with expression 'val' and
2999 /// 'num_tasks' with expression 'num'.
3000 ///
3002  friend class ASTStmtReader;
3003  /// Build directive with the given start and end location.
3004  ///
3005  /// \param StartLoc Starting location of the directive kind.
3006  /// \param EndLoc Ending location of the directive.
3007  /// \param CollapsedNum Number of collapsed nested loops.
3008  /// \param NumClauses Number of clauses.
3009  ///
3011  unsigned CollapsedNum, unsigned NumClauses)
3012  : OMPLoopDirective(this, OMPTaskLoopDirectiveClass, OMPD_taskloop,
3013  StartLoc, EndLoc, CollapsedNum, NumClauses) {}
3014 
3015  /// Build an empty directive.
3016  ///
3017  /// \param CollapsedNum Number of collapsed nested loops.
3018  /// \param NumClauses Number of clauses.
3019  ///
3020  explicit OMPTaskLoopDirective(unsigned CollapsedNum, unsigned NumClauses)
3021  : OMPLoopDirective(this, OMPTaskLoopDirectiveClass, OMPD_taskloop,
3022  SourceLocation(), SourceLocation(), CollapsedNum,
3023  NumClauses) {}
3024 
3025 public:
3026  /// Creates directive with a list of \a Clauses.
3027  ///
3028  /// \param C AST context.
3029  /// \param StartLoc Starting location of the directive kind.
3030  /// \param EndLoc Ending Location of the directive.
3031  /// \param CollapsedNum Number of collapsed loops.
3032  /// \param Clauses List of clauses.
3033  /// \param AssociatedStmt Statement, associated with the directive.
3034  /// \param Exprs Helper expressions for CodeGen.
3035  ///
3036  static OMPTaskLoopDirective *
3037  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3038  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3039  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3040 
3041  /// Creates an empty directive with the place
3042  /// for \a NumClauses clauses.
3043  ///
3044  /// \param C AST context.
3045  /// \param CollapsedNum Number of collapsed nested loops.
3046  /// \param NumClauses Number of clauses.
3047  ///
3049  unsigned NumClauses,
3050  unsigned CollapsedNum, EmptyShell);
3051 
3052  static bool classof(const Stmt *T) {
3053  return T->getStmtClass() == OMPTaskLoopDirectiveClass;
3054  }
3055 };
3056 
3057 /// This represents '#pragma omp taskloop simd' directive.
3058 ///
3059 /// \code
3060 /// #pragma omp taskloop simd private(a,b) grainsize(val) num_tasks(num)
3061 /// \endcode
3062 /// In this example directive '#pragma omp taskloop simd' has clauses 'private'
3063 /// with the variables 'a' and 'b', 'grainsize' with expression 'val' and
3064 /// 'num_tasks' with expression 'num'.
3065 ///
3067  friend class ASTStmtReader;
3068  /// Build directive with the given start and end location.
3069  ///
3070  /// \param StartLoc Starting location of the directive kind.
3071  /// \param EndLoc Ending location of the directive.
3072  /// \param CollapsedNum Number of collapsed nested loops.
3073  /// \param NumClauses Number of clauses.
3074  ///
3076  unsigned CollapsedNum, unsigned NumClauses)
3077  : OMPLoopDirective(this, OMPTaskLoopSimdDirectiveClass,
3078  OMPD_taskloop_simd, StartLoc, EndLoc, CollapsedNum,
3079  NumClauses) {}
3080 
3081  /// Build an empty directive.
3082  ///
3083  /// \param CollapsedNum Number of collapsed nested loops.
3084  /// \param NumClauses Number of clauses.
3085  ///
3086  explicit OMPTaskLoopSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
3087  : OMPLoopDirective(this, OMPTaskLoopSimdDirectiveClass,
3088  OMPD_taskloop_simd, SourceLocation(), SourceLocation(),
3089  CollapsedNum, NumClauses) {}
3090 
3091 public:
3092  /// Creates directive with a list of \a Clauses.
3093  ///
3094  /// \param C AST context.
3095  /// \param StartLoc Starting location of the directive kind.
3096  /// \param EndLoc Ending Location of the directive.
3097  /// \param CollapsedNum Number of collapsed loops.
3098  /// \param Clauses List of clauses.
3099  /// \param AssociatedStmt Statement, associated with the directive.
3100  /// \param Exprs Helper expressions for CodeGen.
3101  ///
3102  static OMPTaskLoopSimdDirective *
3103  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3104  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3105  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3106 
3107  /// Creates an empty directive with the place
3108  /// for \a NumClauses clauses.
3109  ///
3110  /// \param C AST context.
3111  /// \param CollapsedNum Number of collapsed nested loops.
3112  /// \param NumClauses Number of clauses.
3113  ///
3115  unsigned NumClauses,
3116  unsigned CollapsedNum,
3117  EmptyShell);
3118 
3119  static bool classof(const Stmt *T) {
3120  return T->getStmtClass() == OMPTaskLoopSimdDirectiveClass;
3121  }
3122 };
3123 
3124 /// This represents '#pragma omp master taskloop' directive.
3125 ///
3126 /// \code
3127 /// #pragma omp master taskloop private(a,b) grainsize(val) num_tasks(num)
3128 /// \endcode
3129 /// In this example directive '#pragma omp master taskloop' has clauses
3130 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
3131 /// and 'num_tasks' with expression 'num'.
3132 ///
3134  friend class ASTStmtReader;
3135  /// Build directive with the given start and end location.
3136  ///
3137  /// \param StartLoc Starting location of the directive kind.
3138  /// \param EndLoc Ending location of the directive.
3139  /// \param CollapsedNum Number of collapsed nested loops.
3140  /// \param NumClauses Number of clauses.
3141  ///
3143  unsigned CollapsedNum, unsigned NumClauses)
3144  : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass,
3145  OMPD_master_taskloop, StartLoc, EndLoc, CollapsedNum,
3146  NumClauses) {}
3147 
3148  /// Build an empty directive.
3149  ///
3150  /// \param CollapsedNum Number of collapsed nested loops.
3151  /// \param NumClauses Number of clauses.
3152  ///
3153  explicit OMPMasterTaskLoopDirective(unsigned CollapsedNum,
3154  unsigned NumClauses)
3155  : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass,
3156  OMPD_master_taskloop, SourceLocation(),
3157  SourceLocation(), CollapsedNum, NumClauses) {}
3158 
3159 public:
3160  /// Creates directive with a list of \a Clauses.
3161  ///
3162  /// \param C AST context.
3163  /// \param StartLoc Starting location of the directive kind.
3164  /// \param EndLoc Ending Location of the directive.
3165  /// \param CollapsedNum Number of collapsed loops.
3166  /// \param Clauses List of clauses.
3167  /// \param AssociatedStmt Statement, associated with the directive.
3168  /// \param Exprs Helper expressions for CodeGen.
3169  ///
3171  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3172  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3173  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3174 
3175  /// Creates an empty directive with the place
3176  /// for \a NumClauses clauses.
3177  ///
3178  /// \param C AST context.
3179  /// \param CollapsedNum Number of collapsed nested loops.
3180  /// \param NumClauses Number of clauses.
3181  ///
3183  unsigned NumClauses,
3184  unsigned CollapsedNum,
3185  EmptyShell);
3186 
3187  static bool classof(const Stmt *T) {
3188  return T->getStmtClass() == OMPMasterTaskLoopDirectiveClass;
3189  }
3190 };
3191 
3192 /// This represents '#pragma omp parallel master taskloop' directive.
3193 ///
3194 /// \code
3195 /// #pragma omp parallel master taskloop private(a,b) grainsize(val)
3196 /// num_tasks(num)
3197 /// \endcode
3198 /// In this example directive '#pragma omp parallel master taskloop' has clauses
3199 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
3200 /// and 'num_tasks' with expression 'num'.
3201 ///
3203  friend class ASTStmtReader;
3204  /// Build directive with the given start and end location.
3205  ///
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.
3210  ///
3212  SourceLocation EndLoc,
3213  unsigned CollapsedNum, unsigned NumClauses)
3214  : OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass,
3215  OMPD_parallel_master_taskloop, StartLoc, EndLoc,
3216  CollapsedNum, NumClauses) {}
3217 
3218  /// Build an empty directive.
3219  ///
3220  /// \param CollapsedNum Number of collapsed nested loops.
3221  /// \param NumClauses Number of clauses.
3222  ///
3223  explicit OMPParallelMasterTaskLoopDirective(unsigned CollapsedNum,
3224  unsigned NumClauses)
3225  : OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass,
3226  OMPD_parallel_master_taskloop, SourceLocation(),
3227  SourceLocation(), CollapsedNum, NumClauses) {}
3228 
3229 public:
3230  /// Creates directive with a list of \a Clauses.
3231  ///
3232  /// \param C AST context.
3233  /// \param StartLoc Starting location of the directive kind.
3234  /// \param EndLoc Ending Location of the directive.
3235  /// \param CollapsedNum Number of collapsed loops.
3236  /// \param Clauses List of clauses.
3237  /// \param AssociatedStmt Statement, associated with the directive.
3238  /// \param Exprs Helper expressions for CodeGen.
3239  ///
3241  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3242  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3243  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3244 
3245  /// Creates an empty directive with the place
3246  /// for \a NumClauses clauses.
3247  ///
3248  /// \param C AST context.
3249  /// \param CollapsedNum Number of collapsed nested loops.
3250  /// \param NumClauses Number of clauses.
3251  ///
3253  unsigned NumClauses,
3254  unsigned CollapsedNum,
3255  EmptyShell);
3256 
3257  static bool classof(const Stmt *T) {
3258  return T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass;
3259  }
3260 };
3261 
3262 /// This represents '#pragma omp distribute' directive.
3263 ///
3264 /// \code
3265 /// #pragma omp distribute private(a,b)
3266 /// \endcode
3267 /// In this example directive '#pragma omp distribute' has clauses 'private'
3268 /// with the variables 'a' and 'b'
3269 ///
3271  friend class ASTStmtReader;
3272 
3273  /// Build directive with the given start and end location.
3274  ///
3275  /// \param StartLoc Starting location of the directive kind.
3276  /// \param EndLoc Ending location of the directive.
3277  /// \param CollapsedNum Number of collapsed nested loops.
3278  /// \param NumClauses Number of clauses.
3279  ///
3281  unsigned CollapsedNum, unsigned NumClauses)
3282  : OMPLoopDirective(this, OMPDistributeDirectiveClass, OMPD_distribute,
3283  StartLoc, EndLoc, CollapsedNum, NumClauses)
3284  {}
3285 
3286  /// Build an empty directive.
3287  ///
3288  /// \param CollapsedNum Number of collapsed nested loops.
3289  /// \param NumClauses Number of clauses.
3290  ///
3291  explicit OMPDistributeDirective(unsigned CollapsedNum, unsigned NumClauses)
3292  : OMPLoopDirective(this, OMPDistributeDirectiveClass, OMPD_distribute,
3293  SourceLocation(), SourceLocation(), CollapsedNum,
3294  NumClauses)
3295  {}
3296 
3297 public:
3298  /// Creates directive with a list of \a Clauses.
3299  ///
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.
3307  ///
3308  static OMPDistributeDirective *
3309  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3310  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3311  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3312 
3313  /// Creates an empty directive with the place
3314  /// for \a NumClauses clauses.
3315  ///
3316  /// \param C AST context.
3317  /// \param CollapsedNum Number of collapsed nested loops.
3318  /// \param NumClauses Number of clauses.
3319  ///
3321  unsigned NumClauses,
3322  unsigned CollapsedNum, EmptyShell);
3323 
3324  static bool classof(const Stmt *T) {
3325  return T->getStmtClass() == OMPDistributeDirectiveClass;
3326  }
3327 };
3328 
3329 /// This represents '#pragma omp target update' directive.
3330 ///
3331 /// \code
3332 /// #pragma omp target update to(a) from(b) device(1)
3333 /// \endcode
3334 /// In this example directive '#pragma omp target update' has clause 'to' with
3335 /// argument 'a', clause 'from' with argument 'b' and clause 'device' with
3336 /// argument '1'.
3337 ///
3339  friend class ASTStmtReader;
3340  /// Build directive with the given start and end location.
3341  ///
3342  /// \param StartLoc Starting location of the directive kind.
3343  /// \param EndLoc Ending Location of the directive.
3344  /// \param NumClauses The number of clauses.
3345  ///
3347  unsigned NumClauses)
3348  : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass,
3349  OMPD_target_update, StartLoc, EndLoc, NumClauses,
3350  1) {}
3351 
3352  /// Build an empty directive.
3353  ///
3354  /// \param NumClauses Number of clauses.
3355  ///
3356  explicit OMPTargetUpdateDirective(unsigned NumClauses)
3357  : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass,
3358  OMPD_target_update, SourceLocation(),
3359  SourceLocation(), NumClauses, 1) {}
3360 
3361 public:
3362  /// Creates directive with a list of \a Clauses.
3363  ///
3364  /// \param C AST context.
3365  /// \param StartLoc Starting location of the directive kind.
3366  /// \param EndLoc Ending Location of the directive.
3367  /// \param Clauses List of clauses.
3368  /// \param AssociatedStmt Statement, associated with the directive.
3369  ///
3370  static OMPTargetUpdateDirective *
3371  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3372  ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3373 
3374  /// Creates an empty directive with the place for \a NumClauses
3375  /// clauses.
3376  ///
3377  /// \param C AST context.
3378  /// \param NumClauses The number of clauses.
3379  ///
3381  unsigned NumClauses, EmptyShell);
3382 
3383  static bool classof(const Stmt *T) {
3384  return T->getStmtClass() == OMPTargetUpdateDirectiveClass;
3385  }
3386 };
3387 
3388 /// This represents '#pragma omp distribute parallel for' composite
3389 /// directive.
3390 ///
3391 /// \code
3392 /// #pragma omp distribute parallel for private(a,b)
3393 /// \endcode
3394 /// In this example directive '#pragma omp distribute parallel for' has clause
3395 /// 'private' with the variables 'a' and 'b'
3396 ///
3398  friend class ASTStmtReader;
3399  /// true if the construct has inner cancel directive.
3400  bool HasCancel = false;
3401 
3402  /// Build directive with the given start and end location.
3403  ///
3404  /// \param StartLoc Starting location of the directive kind.
3405  /// \param EndLoc Ending location of the directive.
3406  /// \param CollapsedNum Number of collapsed nested loops.
3407  /// \param NumClauses Number of clauses.
3408  ///
3410  SourceLocation EndLoc,
3411  unsigned CollapsedNum, unsigned NumClauses)
3412  : OMPLoopDirective(this, OMPDistributeParallelForDirectiveClass,
3413  OMPD_distribute_parallel_for, StartLoc, EndLoc,
3414  CollapsedNum, NumClauses), HasCancel(false) {}
3415 
3416  /// Build an empty directive.
3417  ///
3418  /// \param CollapsedNum Number of collapsed nested loops.
3419  /// \param NumClauses Number of clauses.
3420  ///
3421  explicit OMPDistributeParallelForDirective(unsigned CollapsedNum,
3422  unsigned NumClauses)
3423  : OMPLoopDirective(this, OMPDistributeParallelForDirectiveClass,
3424  OMPD_distribute_parallel_for, SourceLocation(),
3425  SourceLocation(), CollapsedNum, NumClauses),
3426  HasCancel(false) {}
3427 
3428  /// Set cancel state.
3429  void setHasCancel(bool Has) { HasCancel = Has; }
3430 
3431 public:
3432  /// Creates directive with a list of \a Clauses.
3433  ///
3434  /// \param C AST context.
3435  /// \param StartLoc Starting location of the directive kind.
3436  /// \param EndLoc Ending Location of the directive.
3437  /// \param CollapsedNum Number of collapsed loops.
3438  /// \param Clauses List of clauses.
3439  /// \param AssociatedStmt Statement, associated with the directive.
3440  /// \param Exprs Helper expressions for CodeGen.
3441  /// \param HasCancel true if this directive has inner cancel directive.
3442  ///
3444  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3445  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3446  Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
3447 
3448  /// Creates an empty directive with the place
3449  /// for \a NumClauses clauses.
3450  ///
3451  /// \param C AST context.
3452  /// \param CollapsedNum Number of collapsed nested loops.
3453  /// \param NumClauses Number of clauses.
3454  ///
3456  unsigned NumClauses,
3457  unsigned CollapsedNum,
3458  EmptyShell);
3459 
3460  /// Return true if current directive has inner cancel directive.
3461  bool hasCancel() const { return HasCancel; }
3462 
3463  static bool classof(const Stmt *T) {
3464  return T->getStmtClass() == OMPDistributeParallelForDirectiveClass;
3465  }
3466 };
3467 
3468 /// This represents '#pragma omp distribute parallel for simd' composite
3469 /// directive.
3470 ///
3471 /// \code
3472 /// #pragma omp distribute parallel for simd private(x)
3473 /// \endcode
3474 /// In this example directive '#pragma omp distribute parallel for simd' has
3475 /// clause 'private' with the variables 'x'
3476 ///
3478  friend class ASTStmtReader;
3479 
3480  /// Build directive with the given start and end location.
3481  ///
3482  /// \param StartLoc Starting location of the directive kind.
3483  /// \param EndLoc Ending location of the directive.
3484  /// \param CollapsedNum Number of collapsed nested loops.
3485  /// \param NumClauses Number of clauses.
3486  ///
3488  SourceLocation EndLoc,
3489  unsigned CollapsedNum,
3490  unsigned NumClauses)
3491  : OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass,
3492  OMPD_distribute_parallel_for_simd, StartLoc,
3493  EndLoc, CollapsedNum, NumClauses) {}
3494 
3495  /// Build an empty directive.
3496  ///
3497  /// \param CollapsedNum Number of collapsed nested loops.
3498  /// \param NumClauses Number of clauses.
3499  ///
3500  explicit OMPDistributeParallelForSimdDirective(unsigned CollapsedNum,
3501  unsigned NumClauses)
3502  : OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass,
3503  OMPD_distribute_parallel_for_simd,
3504  SourceLocation(), SourceLocation(), CollapsedNum,
3505  NumClauses) {}
3506 
3507 public:
3508  /// Creates directive with a list of \a Clauses.
3509  ///
3510  /// \param C AST context.
3511  /// \param StartLoc Starting location of the directive kind.
3512  /// \param EndLoc Ending Location of the directive.
3513  /// \param CollapsedNum Number of collapsed loops.
3514  /// \param Clauses List of clauses.
3515  /// \param AssociatedStmt Statement, associated with the directive.
3516  /// \param Exprs Helper expressions for CodeGen.
3517  ///
3519  const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3520  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3521  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3522 
3523  /// Creates an empty directive with the place for \a NumClauses clauses.
3524  ///
3525  /// \param C AST context.
3526  /// \param CollapsedNum Number of collapsed nested loops.
3527  /// \param NumClauses Number of clauses.
3528  ///
3530  const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
3531  EmptyShell);
3532 
3533  static bool classof(const Stmt *T) {
3534  return T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass;
3535  }
3536 };
3537 
3538 /// This represents '#pragma omp distribute simd' composite directive.
3539 ///
3540 /// \code
3541 /// #pragma omp distribute simd private(x)
3542 /// \endcode
3543 /// In this example directive '#pragma omp distribute simd' has clause
3544 /// 'private' with the variables 'x'
3545 ///
3547  friend class ASTStmtReader;
3548 
3549  /// Build directive with the given start and end location.
3550  ///
3551  /// \param StartLoc Starting location of the directive kind.
3552  /// \param EndLoc Ending location of the directive.
3553  /// \param CollapsedNum Number of collapsed nested loops.
3554  /// \param NumClauses Number of clauses.
3555  ///
3557  unsigned CollapsedNum, unsigned NumClauses)
3558  : OMPLoopDirective(this, OMPDistributeSimdDirectiveClass,
3559  OMPD_distribute_simd, StartLoc, EndLoc, CollapsedNum,
3560  NumClauses) {}
3561 
3562  /// Build an empty directive.
3563  ///
3564  /// \param CollapsedNum Number of collapsed nested loops.
3565  /// \param NumClauses Number of clauses.
3566  ///
3567  explicit OMPDistributeSimdDirective(unsigned CollapsedNum,
3568  unsigned NumClauses)
3569  : OMPLoopDirective(this, OMPDistributeSimdDirectiveClass,
3570  OMPD_distribute_simd, SourceLocation(),
3571  SourceLocation(), CollapsedNum, NumClauses) {}
3572 
3573 public:
3574  /// Creates directive with a list of \a Clauses.
3575  ///
3576  /// \param C AST context.
3577  /// \param StartLoc Starting location of the directive kind.
3578  /// \param EndLoc Ending Location of the directive.
3579  /// \param CollapsedNum Number of collapsed loops.
3580  /// \param Clauses List of clauses.
3581  /// \param AssociatedStmt Statement, associated with the directive.
3582  /// \param Exprs Helper expressions for CodeGen.
3583  ///
3585  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3586  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3587  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3588 
3589  /// Creates an empty directive with the place for \a NumClauses clauses.
3590  ///
3591  /// \param C AST context.
3592  /// \param CollapsedNum Number of collapsed nested loops.
3593  /// \param NumClauses Number of clauses.
3594  ///
3596  unsigned NumClauses,
3597  unsigned CollapsedNum,
3598  EmptyShell);
3599 
3600  static bool classof(const Stmt *T) {
3601  return T->getStmtClass() == OMPDistributeSimdDirectiveClass;
3602  }
3603 };
3604 
3605 /// This represents '#pragma omp target parallel for simd' directive.
3606 ///
3607 /// \code
3608 /// #pragma omp target parallel for simd private(a) map(b) safelen(c)
3609 /// \endcode
3610 /// In this example directive '#pragma omp target parallel for simd' has clauses
3611 /// 'private' with the variable 'a', 'map' with the variable 'b' and 'safelen'
3612 /// with the variable 'c'.
3613 ///
3615  friend class ASTStmtReader;
3616 
3617  /// Build directive with the given start and end location.
3618  ///
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.
3623  ///
3625  unsigned CollapsedNum, unsigned NumClauses)
3626  : OMPLoopDirective(this, OMPTargetParallelForSimdDirectiveClass,
3627  OMPD_target_parallel_for_simd, StartLoc, EndLoc,
3628  CollapsedNum, NumClauses) {}
3629 
3630  /// Build an empty directive.
3631  ///
3632  /// \param CollapsedNum Number of collapsed nested loops.
3633  /// \param NumClauses Number of clauses.
3634  ///
3635  explicit OMPTargetParallelForSimdDirective(unsigned CollapsedNum,
3636  unsigned NumClauses)
3637  : OMPLoopDirective(this, OMPTargetParallelForSimdDirectiveClass,
3638  OMPD_target_parallel_for_simd, SourceLocation(),
3639  SourceLocation(), CollapsedNum, NumClauses) {}
3640 
3641 public:
3642  /// Creates directive with a list of \a Clauses.
3643  ///
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.
3651  ///
3653  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3654  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3655  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3656 
3657  /// Creates an empty directive with the place for \a NumClauses clauses.
3658  ///
3659  /// \param C AST context.
3660  /// \param CollapsedNum Number of collapsed nested loops.
3661  /// \param NumClauses Number of clauses.
3662  ///
3664  unsigned NumClauses,
3665  unsigned CollapsedNum,
3666  EmptyShell);
3667 
3668  static bool classof(const Stmt *T) {
3669  return T->getStmtClass() == OMPTargetParallelForSimdDirectiveClass;
3670  }
3671 };
3672 
3673 /// This represents '#pragma omp target simd' directive.
3674 ///
3675 /// \code
3676 /// #pragma omp target simd private(a) map(b) safelen(c)
3677 /// \endcode
3678 /// In this example directive '#pragma omp target simd' has clauses 'private'
3679 /// with the variable 'a', 'map' with the variable 'b' and 'safelen' with
3680 /// the variable 'c'.
3681 ///
3683  friend class ASTStmtReader;
3684 
3685  /// Build directive with the given start and end location.
3686  ///
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.
3691  ///
3693  unsigned CollapsedNum, unsigned NumClauses)
3694  : OMPLoopDirective(this, OMPTargetSimdDirectiveClass,
3695  OMPD_target_simd, StartLoc, EndLoc, CollapsedNum,
3696  NumClauses) {}
3697 
3698  /// Build an empty directive.
3699  ///
3700  /// \param CollapsedNum Number of collapsed nested loops.
3701  /// \param NumClauses Number of clauses.
3702  ///
3703  explicit OMPTargetSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
3704  : OMPLoopDirective(this, OMPTargetSimdDirectiveClass, OMPD_target_simd,
3705  SourceLocation(),SourceLocation(), CollapsedNum,
3706  NumClauses) {}
3707 
3708 public:
3709  /// Creates directive with a list of \a Clauses.
3710  ///
3711  /// \param C AST context.
3712  /// \param StartLoc Starting location of the directive kind.
3713  /// \param EndLoc Ending Location of the directive.
3714  /// \param CollapsedNum Number of collapsed loops.
3715  /// \param Clauses List of clauses.
3716  /// \param AssociatedStmt Statement, associated with the directive.
3717  /// \param Exprs Helper expressions for CodeGen.
3718  ///
3719  static OMPTargetSimdDirective *
3720  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3721  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3722  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3723 
3724  /// Creates an empty directive with the place for \a NumClauses clauses.
3725  ///
3726  /// \param C AST context.
3727  /// \param CollapsedNum Number of collapsed nested loops.
3728  /// \param NumClauses Number of clauses.
3729  ///
3731  unsigned NumClauses,
3732  unsigned CollapsedNum,
3733  EmptyShell);
3734 
3735  static bool classof(const Stmt *T) {
3736  return T->getStmtClass() == OMPTargetSimdDirectiveClass;
3737  }
3738 };
3739 
3740 /// This represents '#pragma omp teams distribute' directive.
3741 ///
3742 /// \code
3743 /// #pragma omp teams distribute private(a,b)
3744 /// \endcode
3745 /// In this example directive '#pragma omp teams distribute' has clauses
3746 /// 'private' with the variables 'a' and 'b'
3747 ///
3749  friend class ASTStmtReader;
3750 
3751  /// Build directive with the given start and end location.
3752  ///
3753  /// \param StartLoc Starting location of the directive kind.
3754  /// \param EndLoc Ending location of the directive.
3755  /// \param CollapsedNum Number of collapsed nested loops.
3756  /// \param NumClauses Number of clauses.
3757  ///
3759  unsigned CollapsedNum, unsigned NumClauses)
3760  : OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass,
3761  OMPD_teams_distribute, StartLoc, EndLoc,
3762  CollapsedNum, NumClauses) {}
3763 
3764  /// Build an empty directive.
3765  ///
3766  /// \param CollapsedNum Number of collapsed nested loops.
3767  /// \param NumClauses Number of clauses.
3768  ///
3769  explicit OMPTeamsDistributeDirective(unsigned CollapsedNum,
3770  unsigned NumClauses)
3771  : OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass,
3772  OMPD_teams_distribute, SourceLocation(),
3773  SourceLocation(), CollapsedNum, NumClauses) {}
3774 
3775 public:
3776  /// Creates directive with a list of \a Clauses.
3777  ///
3778  /// \param C AST context.
3779  /// \param StartLoc Starting location of the directive kind.
3780  /// \param EndLoc Ending Location of the directive.
3781  /// \param CollapsedNum Number of collapsed loops.
3782  /// \param Clauses List of clauses.
3783  /// \param AssociatedStmt Statement, associated with the directive.
3784  /// \param Exprs Helper expressions for CodeGen.
3785  ///
3787  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3788  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3789  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3790 
3791  /// Creates an empty directive with the place for \a NumClauses clauses.
3792  ///
3793  /// \param C AST context.
3794  /// \param CollapsedNum Number of collapsed nested loops.
3795  /// \param NumClauses Number of clauses.
3796  ///
3798  unsigned NumClauses,
3799  unsigned CollapsedNum,
3800  EmptyShell);
3801 
3802  static bool classof(const Stmt *T) {
3803  return T->getStmtClass() == OMPTeamsDistributeDirectiveClass;
3804  }
3805 };
3806 
3807 /// This represents '#pragma omp teams distribute simd'
3808 /// combined directive.
3809 ///
3810 /// \code
3811 /// #pragma omp teams distribute simd private(a,b)
3812 /// \endcode
3813 /// In this example directive '#pragma omp teams distribute simd'
3814 /// has clause 'private' with the variables 'a' and 'b'
3815 ///
3817  friend class ASTStmtReader;
3818 
3819  /// Build directive with the given start and end location.
3820  ///
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.
3825  ///
3827  SourceLocation EndLoc, unsigned CollapsedNum,
3828  unsigned NumClauses)
3829  : OMPLoopDirective(this, OMPTeamsDistributeSimdDirectiveClass,
3830  OMPD_teams_distribute_simd, StartLoc, EndLoc,
3831  CollapsedNum, NumClauses) {}
3832 
3833  /// Build an empty directive.
3834  ///
3835  /// \param CollapsedNum Number of collapsed nested loops.
3836  /// \param NumClauses Number of clauses.
3837  ///
3838  explicit OMPTeamsDistributeSimdDirective(unsigned CollapsedNum,
3839  unsigned NumClauses)
3840  : OMPLoopDirective(this, OMPTeamsDistributeSimdDirectiveClass,
3841  OMPD_teams_distribute_simd, SourceLocation(),
3842  SourceLocation(), CollapsedNum, NumClauses) {}
3843 
3844 public:
3845  /// Creates directive with a list of \a Clauses.
3846  ///
3847  /// \param C AST context.
3848  /// \param StartLoc Starting location of the directive kind.
3849  /// \param EndLoc Ending Location of the directive.
3850  /// \param CollapsedNum Number of collapsed loops.
3851  /// \param Clauses List of clauses.
3852  /// \param AssociatedStmt Statement, associated with the directive.
3853  /// \param Exprs Helper expressions for CodeGen.
3854  ///
3856  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3857  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3858  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3859 
3860  /// Creates an empty directive with the place
3861  /// for \a NumClauses clauses.
3862  ///
3863  /// \param C AST context.
3864  /// \param CollapsedNum Number of collapsed nested loops.
3865  /// \param NumClauses Number of clauses.
3866  ///
3868  unsigned NumClauses,
3869  unsigned CollapsedNum,
3870  EmptyShell);
3871 
3872  static bool classof(const Stmt *T) {
3873  return T->getStmtClass() == OMPTeamsDistributeSimdDirectiveClass;
3874  }
3875 };
3876 
3877 /// This represents '#pragma omp teams distribute parallel for simd' composite
3878 /// directive.
3879 ///
3880 /// \code
3881 /// #pragma omp teams distribute parallel for simd private(x)
3882 /// \endcode
3883 /// In this example directive '#pragma omp teams distribute parallel for simd'
3884 /// has clause 'private' with the variables 'x'
3885 ///
3887  : public OMPLoopDirective {
3888  friend class ASTStmtReader;
3889 
3890  /// Build directive with the given start and end location.
3891  ///
3892  /// \param StartLoc Starting location of the directive kind.
3893  /// \param EndLoc Ending location of the directive.
3894  /// \param CollapsedNum Number of collapsed nested loops.
3895  /// \param NumClauses Number of clauses.
3896  ///
3898  SourceLocation EndLoc,
3899  unsigned CollapsedNum,
3900  unsigned NumClauses)
3901  : OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass,
3902  OMPD_teams_distribute_parallel_for_simd, StartLoc,
3903  EndLoc, CollapsedNum, NumClauses) {}
3904 
3905  /// Build an empty directive.
3906  ///
3907  /// \param CollapsedNum Number of collapsed nested loops.
3908  /// \param NumClauses Number of clauses.
3909  ///
3910  explicit OMPTeamsDistributeParallelForSimdDirective(unsigned CollapsedNum,
3911  unsigned NumClauses)
3912  : OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass,
3913  OMPD_teams_distribute_parallel_for_simd,
3914  SourceLocation(), SourceLocation(), CollapsedNum,
3915  NumClauses) {}
3916 
3917 public:
3918  /// Creates directive with a list of \a Clauses.
3919  ///
3920  /// \param C AST context.
3921  /// \param StartLoc Starting location of the directive kind.
3922  /// \param EndLoc Ending Location of the directive.
3923  /// \param CollapsedNum Number of collapsed loops.
3924  /// \param Clauses List of clauses.
3925  /// \param AssociatedStmt Statement, associated with the directive.
3926  /// \param Exprs Helper expressions for CodeGen.
3927  ///
3929  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3930  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3931  Stmt *AssociatedStmt, const HelperExprs &Exprs);
3932 
3933  /// Creates an empty directive with the place for \a NumClauses clauses.
3934  ///
3935  /// \param C AST context.
3936  /// \param CollapsedNum Number of collapsed nested loops.
3937  /// \param NumClauses Number of clauses.
3938  ///
3940  CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
3941  EmptyShell);
3942 
3943  static bool classof(const Stmt *T) {
3944  return T->getStmtClass() == OMPTeamsDistributeParallelForSimdDirectiveClass;
3945  }
3946 };
3947 
3948 /// This represents '#pragma omp teams distribute parallel for' composite
3949 /// directive.
3950 ///
3951 /// \code
3952 /// #pragma omp teams distribute parallel for private(x)
3953 /// \endcode
3954 /// In this example directive '#pragma omp teams distribute parallel for'
3955 /// has clause 'private' with the variables 'x'
3956 ///
3958  friend class ASTStmtReader;
3959  /// true if the construct has inner cancel directive.
3960  bool HasCancel = false;
3961 
3962  /// Build directive with the given start and end location.
3963  ///
3964  /// \param StartLoc Starting location of the directive kind.
3965  /// \param EndLoc Ending location of the directive.
3966  /// \param CollapsedNum Number of collapsed nested loops.
3967  /// \param NumClauses Number of clauses.
3968  ///
3970  SourceLocation EndLoc,
3971  unsigned CollapsedNum,
3972  unsigned NumClauses)
3973  : OMPLoopDirective(this, OMPTeamsDistributeParallelForDirectiveClass,
3974  OMPD_teams_distribute_parallel_for, StartLoc, EndLoc,
3975  CollapsedNum, NumClauses), HasCancel(false) {}
3976 
3977  /// Build an empty directive.
3978  ///
3979  /// \param CollapsedNum Number of collapsed nested loops.
3980  /// \param NumClauses Number of clauses.
3981  ///
3982  explicit OMPTeamsDistributeParallelForDirective(unsigned CollapsedNum,
3983  unsigned NumClauses)
3984  : OMPLoopDirective(this, OMPTeamsDistributeParallelForDirectiveClass,
3985  OMPD_teams_distribute_parallel_for, SourceLocation(),
3986  SourceLocation(), CollapsedNum, NumClauses),
3987  HasCancel(false) {}
3988 
3989  /// Set cancel state.
3990  void setHasCancel(bool Has) { HasCancel = Has; }
3991 
3992 public:
3993  /// Creates directive with a list of \a Clauses.
3994  ///
3995  /// \param C AST context.
3996  /// \param StartLoc Starting location of the directive kind.
3997  /// \param EndLoc Ending Location of the directive.
3998  /// \param CollapsedNum Number of collapsed loops.
3999  /// \param Clauses List of clauses.
4000  /// \param AssociatedStmt Statement, associated with the directive.
4001  /// \param Exprs Helper expressions for CodeGen.
4002  /// \param HasCancel true if this directive has inner cancel directive.
4003  ///
4005  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4006  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4007  Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
4008 
4009  /// Creates an empty directive with the place for \a NumClauses clauses.
4010  ///
4011  /// \param C AST context.
4012  /// \param CollapsedNum Number of collapsed nested loops.
4013  /// \param NumClauses Number of clauses.
4014  ///
4016  CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4017  EmptyShell);
4018 
4019  /// Return true if current directive has inner cancel directive.
4020  bool hasCancel() const { return HasCancel; }
4021 
4022  static bool classof(const Stmt *T) {
4023  return T->getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass;
4024  }
4025 };
4026 
4027 /// This represents '#pragma omp target teams' directive.
4028 ///
4029 /// \code
4030 /// #pragma omp target teams if(a>0)
4031 /// \endcode
4032 /// In this example directive '#pragma omp target teams' has clause 'if' with
4033 /// condition 'a>0'.
4034 ///
4036  friend class ASTStmtReader;
4037  /// Build directive with the given start and end location.
4038  ///
4039  /// \param StartLoc Starting location of the directive kind.
4040  /// \param EndLoc Ending location of the directive.
4041  /// \param NumClauses Number of clauses.
4042  ///
4044  unsigned NumClauses)
4045  : OMPExecutableDirective(this, OMPTargetTeamsDirectiveClass,
4046  OMPD_target_teams, StartLoc, EndLoc, NumClauses,
4047  1) {}
4048 
4049  /// Build an empty directive.
4050  ///
4051  /// \param NumClauses Number of clauses.
4052  ///
4053  explicit OMPTargetTeamsDirective(unsigned NumClauses)
4054  : OMPExecutableDirective(this, OMPTargetTeamsDirectiveClass,
4055  OMPD_target_teams, SourceLocation(),
4056  SourceLocation(), NumClauses, 1) {}
4057 
4058 public:
4059  /// Creates directive with a list of \a Clauses.
4060  ///
4061  /// \param C AST context.
4062  /// \param StartLoc Starting location of the directive kind.
4063  /// \param EndLoc Ending Location of the directive.
4064  /// \param Clauses List of clauses.
4065  /// \param AssociatedStmt Statement, associated with the directive.
4066  ///
4067  static OMPTargetTeamsDirective *Create(const ASTContext &C,
4068  SourceLocation StartLoc,
4069  SourceLocation EndLoc,
4070  ArrayRef<OMPClause *> Clauses,
4071  Stmt *AssociatedStmt);
4072 
4073  /// Creates an empty directive with the place for \a NumClauses clauses.
4074  ///
4075  /// \param C AST context.
4076  /// \param NumClauses Number of clauses.
4077  ///
4079  unsigned NumClauses, EmptyShell);
4080 
4081  static bool classof(const Stmt *T) {
4082  return T->getStmtClass() == OMPTargetTeamsDirectiveClass;
4083  }
4084 };
4085 
4086 /// This represents '#pragma omp target teams distribute' combined directive.
4087 ///
4088 /// \code
4089 /// #pragma omp target teams distribute private(x)
4090 /// \endcode
4091 /// In this example directive '#pragma omp target teams distribute' has clause
4092 /// 'private' with the variables 'x'
4093 ///
4095  friend class ASTStmtReader;
4096 
4097  /// Build directive with the given start and end location.
4098  ///
4099  /// \param StartLoc Starting location of the directive kind.
4100  /// \param EndLoc Ending location of the directive.
4101  /// \param CollapsedNum Number of collapsed nested loops.
4102  /// \param NumClauses Number of clauses.
4103  ///
4105  SourceLocation EndLoc,
4106  unsigned CollapsedNum, unsigned NumClauses)
4107  : OMPLoopDirective(this, OMPTargetTeamsDistributeDirectiveClass,
4108  OMPD_target_teams_distribute, StartLoc, EndLoc,
4109  CollapsedNum, NumClauses) {}
4110 
4111  /// Build an empty directive.
4112  ///
4113  /// \param CollapsedNum Number of collapsed nested loops.
4114  /// \param NumClauses Number of clauses.
4115  ///
4116  explicit OMPTargetTeamsDistributeDirective(unsigned CollapsedNum,
4117  unsigned NumClauses)
4118  : OMPLoopDirective(this, OMPTargetTeamsDistributeDirectiveClass,
4119  OMPD_target_teams_distribute, SourceLocation(),
4120  SourceLocation(), CollapsedNum, NumClauses) {}
4121 
4122 public:
4123  /// Creates directive with a list of \a Clauses.
4124  ///
4125  /// \param C AST context.
4126  /// \param StartLoc Starting location of the directive kind.
4127  /// \param EndLoc Ending Location of the directive.
4128  /// \param CollapsedNum Number of collapsed loops.
4129  /// \param Clauses List of clauses.
4130  /// \param AssociatedStmt Statement, associated with the directive.
4131  /// \param Exprs Helper expressions for CodeGen.
4132  ///
4134  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4135  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4136  Stmt *AssociatedStmt, const HelperExprs &Exprs);
4137 
4138  /// Creates an empty directive with the place for \a NumClauses clauses.
4139  ///
4140  /// \param C AST context.
4141  /// \param CollapsedNum Number of collapsed nested loops.
4142  /// \param NumClauses Number of clauses.
4143  ///
4145  CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4146  EmptyShell);
4147 
4148  static bool classof(const Stmt *T) {
4149  return T->getStmtClass() == OMPTargetTeamsDistributeDirectiveClass;
4150  }
4151 };
4152 
4153 /// This represents '#pragma omp target teams distribute parallel for' combined
4154 /// directive.
4155 ///
4156 /// \code
4157 /// #pragma omp target teams distribute parallel for private(x)
4158 /// \endcode
4159 /// In this example directive '#pragma omp target teams distribute parallel
4160 /// for' has clause 'private' with the variables 'x'
4161 ///
4163  : public OMPLoopDirective {
4164  friend class ASTStmtReader;
4165  /// true if the construct has inner cancel directive.
4166  bool HasCancel = false;
4167 
4168  /// Build directive with the given start and end location.
4169  ///
4170  /// \param StartLoc Starting location of the directive kind.
4171  /// \param EndLoc Ending location of the directive.
4172  /// \param CollapsedNum Number of collapsed nested loops.
4173  /// \param NumClauses Number of clauses.
4174  ///
4176  SourceLocation EndLoc,
4177  unsigned CollapsedNum,
4178  unsigned NumClauses)
4179  : OMPLoopDirective(this,
4180  OMPTargetTeamsDistributeParallelForDirectiveClass,
4181  OMPD_target_teams_distribute_parallel_for, StartLoc,
4182  EndLoc, CollapsedNum, NumClauses),
4183  HasCancel(false) {}
4184 
4185  /// Build an empty directive.
4186  ///
4187  /// \param CollapsedNum Number of collapsed nested loops.
4188  /// \param NumClauses Number of clauses.
4189  ///
4190  explicit OMPTargetTeamsDistributeParallelForDirective(unsigned CollapsedNum,
4191  unsigned NumClauses)
4192  : OMPLoopDirective(
4193  this, OMPTargetTeamsDistributeParallelForDirectiveClass,
4194  OMPD_target_teams_distribute_parallel_for, SourceLocation(),
4195  SourceLocation(), CollapsedNum, NumClauses),
4196  HasCancel(false) {}
4197 
4198  /// Set cancel state.
4199  void setHasCancel(bool Has) { HasCancel = Has; }
4200 
4201 public:
4202  /// Creates directive with a list of \a Clauses.
4203  ///
4204  /// \param C AST context.
4205  /// \param StartLoc Starting location of the directive kind.
4206  /// \param EndLoc Ending Location of the directive.
4207  /// \param CollapsedNum Number of collapsed loops.
4208  /// \param Clauses List of clauses.
4209  /// \param AssociatedStmt Statement, associated with the directive.
4210  /// \param Exprs Helper expressions for CodeGen.
4211  /// \param HasCancel true if this directive has inner cancel directive.
4212  ///
4214  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4215  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4216  Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel);
4217 
4218  /// Creates an empty directive with the place for \a NumClauses clauses.
4219  ///
4220  /// \param C AST context.
4221  /// \param CollapsedNum Number of collapsed nested loops.
4222  /// \param NumClauses Number of clauses.
4223  ///
4225  CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4226  EmptyShell);
4227 
4228  /// Return true if current directive has inner cancel directive.
4229  bool hasCancel() const { return HasCancel; }
4230 
4231  static bool classof(const Stmt *T) {
4232  return T->getStmtClass() ==
4233  OMPTargetTeamsDistributeParallelForDirectiveClass;
4234  }
4235 };
4236 
4237 /// This represents '#pragma omp target teams distribute parallel for simd'
4238 /// combined directive.
4239 ///
4240 /// \code
4241 /// #pragma omp target teams distribute parallel for simd private(x)
4242 /// \endcode
4243 /// In this example directive '#pragma omp target teams distribute parallel
4244 /// for simd' has clause 'private' with the variables 'x'
4245 ///
4247  : public OMPLoopDirective {
4248  friend class ASTStmtReader;
4249 
4250  /// Build directive with the given start and end location.
4251  ///
4252  /// \param StartLoc Starting location of the directive kind.
4253  /// \param EndLoc Ending location of the directive.
4254  /// \param CollapsedNum Number of collapsed nested loops.
4255  /// \param NumClauses Number of clauses.
4256  ///
4258  SourceLocation EndLoc,
4259  unsigned CollapsedNum,
4260  unsigned NumClauses)
4261  : OMPLoopDirective(this,
4262  OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
4263  OMPD_target_teams_distribute_parallel_for_simd,
4264  StartLoc, EndLoc, CollapsedNum, NumClauses) {}
4265 
4266  /// Build an empty directive.
4267  ///
4268  /// \param CollapsedNum Number of collapsed nested loops.
4269  /// \param NumClauses Number of clauses.
4270  ///
4272  unsigned CollapsedNum, unsigned NumClauses)
4273  : OMPLoopDirective(
4274  this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
4275  OMPD_target_teams_distribute_parallel_for_simd, SourceLocation(),
4276  SourceLocation(), CollapsedNum, NumClauses) {}
4277 
4278 public:
4279  /// Creates directive with a list of \a Clauses.
4280  ///
4281  /// \param C AST context.
4282  /// \param StartLoc Starting location of the directive kind.
4283  /// \param EndLoc Ending Location of the directive.
4284  /// \param CollapsedNum Number of collapsed loops.
4285  /// \param Clauses List of clauses.
4286  /// \param AssociatedStmt Statement, associated with the directive.
4287  /// \param Exprs Helper expressions for CodeGen.
4288  ///
4290  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4291  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4292  Stmt *AssociatedStmt, const HelperExprs &Exprs);
4293 
4294  /// Creates an empty directive with the place for \a NumClauses clauses.
4295  ///
4296  /// \param C AST context.
4297  /// \param CollapsedNum Number of collapsed nested loops.
4298  /// \param NumClauses Number of clauses.
4299  ///
4301  CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4302  EmptyShell);
4303 
4304  static bool classof(const Stmt *T) {
4305  return T->getStmtClass() ==
4306  OMPTargetTeamsDistributeParallelForSimdDirectiveClass;
4307  }
4308 };
4309 
4310 /// This represents '#pragma omp target teams distribute simd' combined
4311 /// directive.
4312 ///
4313 /// \code
4314 /// #pragma omp target teams distribute simd private(x)
4315 /// \endcode
4316 /// In this example directive '#pragma omp target teams distribute simd'
4317 /// has clause 'private' with the variables 'x'
4318 ///
4320  friend class ASTStmtReader;
4321 
4322  /// Build directive with the given start and end location.
4323  ///
4324  /// \param StartLoc Starting location of the directive kind.
4325  /// \param EndLoc Ending location of the directive.
4326  /// \param CollapsedNum Number of collapsed nested loops.
4327  /// \param NumClauses Number of clauses.
4328  ///
4330  SourceLocation EndLoc,
4331  unsigned CollapsedNum,
4332  unsigned NumClauses)
4333  : OMPLoopDirective(this, OMPTargetTeamsDistributeSimdDirectiveClass,
4334  OMPD_target_teams_distribute_simd, StartLoc, EndLoc,
4335  CollapsedNum, NumClauses) {}
4336 
4337  /// Build an empty directive.
4338  ///
4339  /// \param CollapsedNum Number of collapsed nested loops.
4340  /// \param NumClauses Number of clauses.
4341  ///
4342  explicit OMPTargetTeamsDistributeSimdDirective(unsigned CollapsedNum,
4343  unsigned NumClauses)
4344  : OMPLoopDirective(this, OMPTargetTeamsDistributeSimdDirectiveClass,
4345  OMPD_target_teams_distribute_simd, SourceLocation(),
4346  SourceLocation(), CollapsedNum, NumClauses) {}
4347 
4348 public:
4349  /// Creates directive with a list of \a Clauses.
4350  ///
4351  /// \param C AST context.
4352  /// \param StartLoc Starting location of the directive kind.
4353  /// \param EndLoc Ending Location of the directive.
4354  /// \param CollapsedNum Number of collapsed loops.
4355  /// \param Clauses List of clauses.
4356  /// \param AssociatedStmt Statement, associated with the directive.
4357  /// \param Exprs Helper expressions for CodeGen.
4358  ///
4360  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4361  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4362  Stmt *AssociatedStmt, const HelperExprs &Exprs);
4363 
4364  /// Creates an empty directive with the place for \a NumClauses clauses.
4365  ///
4366  /// \param C AST context.
4367  /// \param CollapsedNum Number of collapsed nested loops.
4368  /// \param NumClauses Number of clauses.
4369  ///
4371  CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum,
4372  EmptyShell);
4373 
4374  static bool classof(const Stmt *T) {
4375  return T->getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
4376  }
4377 };
4378 
4379 } // end namespace clang
4380 
4381 #endif
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3257
void setPreInits(Stmt *PreInits)
Definition: StmtOpenMP.h:604
void setCombinedParForInDistCond(Expr *CombParForInDistCond)
Definition: StmtOpenMP.h:723
child_iterator child_begin()
Definition: Stmt.h:1168
Expr * NLB
Update of LowerBound for statically scheduled &#39;omp for&#39; loops.
Definition: StmtOpenMP.h:803
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:409
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2302
This represents &#39;#pragma omp distribute simd&#39; composite directive.
Definition: StmtOpenMP.h:3546
Expr * getNextUpperBound() const
Definition: StmtOpenMP.h:993
SmallVector< Expr *, 4 > Finals
Final loop counter values for GodeGen.
Definition: StmtOpenMP.h:831
This represents &#39;#pragma omp master&#39; directive.
Definition: StmtOpenMP.h:1591
Expr * NUB
Update of UpperBound for statically scheduled omp loops for outer loop in combined constructs (e...
Definition: StmtOpenMP.h:763
SmallVector< Expr *, 4 > Updates
Expressions for loop counters update for CodeGen.
Definition: StmtOpenMP.h:829
This represents &#39;#pragma omp task&#39; directive.
Definition: StmtOpenMP.h:1931
void setEnsureUpperBound(Expr *EUB)
Definition: StmtOpenMP.h:635
static llvm::iterator_range< used_clauses_child_iterator > used_clauses_children(ArrayRef< OMPClause *> Clauses)
Definition: StmtOpenMP.h:143
Expr * getUpperBoundVariable() const
Definition: StmtOpenMP.h:961
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1580
ArrayRef< Expr * > inits() const
Definition: StmtOpenMP.h:1125
ArrayRef< OMPClause * > clauses()
Definition: StmtOpenMP.h:325
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1159
OMPLoopDirective(const T *That, StmtClass SC, OpenMPDirectiveKind Kind, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, unsigned NumClauses, unsigned NumSpecialChildren=0)
Build instance of loop directive of class Kind.
Definition: StmtOpenMP.h:559
ArrayRef< Expr * > dependent_counters()
Definition: StmtOpenMP.h:1141
void setCombinedCond(Expr *CombCond)
Definition: StmtOpenMP.h:703
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2609
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
Definition: Dominators.h:30
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3187
const Expr * getV() const
Definition: StmtOpenMP.h:2426
void setCombinedLowerBoundVariable(Expr *CombLB)
Definition: StmtOpenMP.h:683
void setHasCancel(bool Has)
Set cancel state.
Definition: StmtOpenMP.h:1518
Stmt - This represents one statement.
Definition: Stmt.h:66
void setLastIteration(Expr *LI)
Definition: StmtOpenMP.h:590
Expr * getLowerBoundVariable() const
Definition: StmtOpenMP.h:953
bool isStandaloneDirective() const
Returns whether or not this is a Standalone directive.
Definition: StmtOpenMP.cpp:25
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3383
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2492
This represents &#39;#pragma omp for simd&#39; directive.
Definition: StmtOpenMP.h:1341
Expr * EUB
EnsureUpperBound – expression UB = min(UB, NumIterations).
Definition: StmtOpenMP.h:801
Expr * DistInc
DistInc - increment expression for distribute loop when found combined with a further loop level (e...
Definition: StmtOpenMP.h:815
This represents &#39;#pragma omp teams distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:3957
SourceLocation getBeginLoc() const
Returns starting location of directive kind.
Definition: StmtOpenMP.h:225
void setPrevEnsureUpperBound(Expr *PrevEUB)
Definition: StmtOpenMP.h:678
CapturedStmt * getInnermostCapturedStmt()
Get innermost captured statement for the construct.
Definition: StmtOpenMP.h:283
void setUpperBoundVariable(Expr *UB)
Definition: StmtOpenMP.h:621
void setNumIterations(Expr *NI)
Definition: StmtOpenMP.h:656
This represents &#39;#pragma omp target teams distribute&#39; combined directive.
Definition: StmtOpenMP.h:4094
void setNextLowerBound(Expr *NLB)
Definition: StmtOpenMP.h:642
llvm::iterator_range< child_iterator > child_range
Definition: Stmt.h:1158
Expr * getCombinedParForInDistCond() const
Definition: StmtOpenMP.h:1081
This represents &#39;#pragma omp parallel for&#39; directive.
Definition: StmtOpenMP.h:1712
This represents &#39;#pragma omp target teams distribute parallel for&#39; combined directive.
Definition: StmtOpenMP.h:4162
Expr * getCombinedEnsureUpperBound() const
Definition: StmtOpenMP.h:1045
void setIsLastIterVariable(Expr *IL)
Definition: StmtOpenMP.h:607
Expr * PrevLB
PreviousLowerBound - local variable passed to runtime in the enclosing schedule or null if that does ...
Definition: StmtOpenMP.h:808
SourceLocation getEndLoc() const
Returns ending location of directive.
Definition: StmtOpenMP.h:227
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:1916
This represents &#39;#pragma omp target exit data&#39; directive.
Definition: StmtOpenMP.h:2623
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:2806
ArrayRef< Expr * > dependent_inits()
Definition: StmtOpenMP.h:1147
const Stmt * getBody() const
Definition: StmtOpenMP.h:1087
Expr * getCombinedUpperBoundVariable() const
Definition: StmtOpenMP.h:1039
void setUpdates(ArrayRef< Expr *> UL)
Sets the list of update expressions for linear variables.
void setCombinedDistCond(Expr *CombDistCond)
Definition: StmtOpenMP.h:718
Expr * getCalcLastIteration() const
Definition: StmtOpenMP.h:921
void setInit(Expr *Init)
Definition: StmtOpenMP.h:602
ArrayRef< Expr * > dependent_counters() const
Definition: StmtOpenMP.h:1143
The expressions built to support OpenMP loops in combined/composite pragmas (e.g. ...
Definition: StmtOpenMP.h:741
bool isXLHSInRHSPart() const
Return true if helper update expression has form &#39;OpaqueValueExpr(x) binop OpaqueValueExpr(expr)&#39; and...
Definition: StmtOpenMP.h:2420
const Expr * getUpdateExpr() const
Definition: StmtOpenMP.h:2414
ArrayRef< Expr * > finals() const
Definition: StmtOpenMP.h:1137
Expr * LastIteration
Loop last iteration number.
Definition: StmtOpenMP.h:779
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1988
const Stmt * getStructuredBlock() const
Returns the AST node representing OpenMP structured-block of this OpenMP executable directive...
Definition: StmtOpenMP.cpp:36
This represents &#39;#pragma omp parallel&#39; directive.
Definition: StmtOpenMP.h:357
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3600
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:160
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2808
Expr * getEnsureUpperBound() const
Definition: StmtOpenMP.h:977
const CapturedStmt * getCapturedStmt(OpenMPDirectiveKind RegionKind) const
Returns the captured statement associated with the component region within the (combined) directive...
Definition: StmtOpenMP.h:266
Definition: Format.h:2392
Expr * getInc() const
Definition: StmtOpenMP.h:937
ArrayRef< Expr * > updates()
Definition: StmtOpenMP.h:1129
This represents &#39;#pragma omp target simd&#39; directive.
Definition: StmtOpenMP.h:3682
static unsigned getArraysOffset(OpenMPDirectiveKind Kind)
Offset to the start of children expression arrays.
Definition: StmtOpenMP.h:569
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2032
Defines some OpenMP-specific enums and functions.
OpenMPDirectiveKind getDirectiveKind() const
Definition: StmtOpenMP.h:301
This represents &#39;#pragma omp barrier&#39; directive.
Definition: StmtOpenMP.h:2043
This is a common base class for loop directives (&#39;omp simd&#39;, &#39;omp for&#39;, &#39;omp for simd&#39; etc...
Definition: StmtOpenMP.h:419
This represents &#39;#pragma omp critical&#39; directive.
Definition: StmtOpenMP.h:1638
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Definition: StmtOpenMP.h:2922
void setCond(Expr *Cond)
Definition: StmtOpenMP.h:599
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3735
This represents &#39;#pragma omp distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:3397
This represents &#39;#pragma omp teams distribute parallel for simd&#39; composite directive.
Definition: StmtOpenMP.h:3886
ArrayRef< Expr * > finals_conditions() const
Definition: StmtOpenMP.h:1155
ArrayRef< Expr * > finals()
Definition: StmtOpenMP.h:1135
Expr * getIsLastIterVariable() const
Definition: StmtOpenMP.h:945
Expr * LB
DistributeLowerBound - used when composing &#39;omp distribute&#39; with &#39;omp for&#39; in a same construct...
Definition: StmtOpenMP.h:744
Expr * EUB
DistributeEnsureUpperBound - used when composing &#39;omp distribute&#39; with &#39;omp for&#39; in a same construct...
Definition: StmtOpenMP.h:750
Expr * getX()
Get &#39;x&#39; part of the associated expression/statement.
Definition: StmtOpenMP.h:2404
Expr * getIterationVariable() const
Definition: StmtOpenMP.h:913
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:3461
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3802
used_clauses_child_iterator(ArrayRef< OMPClause *> Clauses)
Definition: StmtOpenMP.h:114
static bool classof(const Stmt *S)
Definition: StmtOpenMP.h:303
This represents &#39;#pragma omp cancellation point&#39; directive.
Definition: StmtOpenMP.h:2878
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2189
void setCombinedInit(Expr *CombInit)
Definition: StmtOpenMP.h:698
MutableArrayRef< Expr * > getFinals()
Sets the list of final update expressions for linear variables.
This represents &#39;#pragma omp teams&#39; directive.
Definition: StmtOpenMP.h:2821
Expr * getInit() const
Definition: StmtOpenMP.h:933
Expr * CalcLastIteration
Calculation of last iteration.
Definition: StmtOpenMP.h:783
This represents &#39;#pragma omp teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:3816
SmallVector< Expr *, 4 > FinalsConditions
List of final conditions required for the generation of the non-rectangular loops.
Definition: StmtOpenMP.h:840
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2727
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:411
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1463
StmtClass
Definition: Stmt.h:68
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1918
void setFinals(ArrayRef< Expr *> FL)
Sets the list of final update expressions for linear variables.
Expr * NUB
Update of UpperBound for statically scheduled &#39;omp for&#39; loops.
Definition: StmtOpenMP.h:805
Expr * Cond
Loop condition.
Definition: StmtOpenMP.h:787
Expr * PreCond
Loop pre-condition.
Definition: StmtOpenMP.h:785
This represents &#39;#pragma omp target parallel for simd&#39; directive.
Definition: StmtOpenMP.h:3614
ArrayRef< Expr * > private_counters()
Definition: StmtOpenMP.h:1117
The expressions built for the OpenMP loop CodeGen for the whole collapsed loop nest.
Definition: StmtOpenMP.h:775
llvm::iterator_range< const_child_iterator > const_child_range
Definition: Stmt.h:1159
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:1521
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1777
This represents &#39;#pragma omp taskgroup&#39; directive.
Definition: StmtOpenMP.h:2131
child_range used_children()
Expr * getCombinedLowerBoundVariable() const
Definition: StmtOpenMP.h:1033
Expr * DistCond
Distribute Loop condition used when composing &#39;omp distribute&#39; with &#39;omp for&#39; in a same construct whe...
Definition: StmtOpenMP.h:766
Expr * IterationVarRef
Loop iteration variable.
Definition: StmtOpenMP.h:777
Expr * Init
Distribute loop iteration variable init used when composing &#39;omp distribute&#39; with &#39;omp for&#39; in a same...
Definition: StmtOpenMP.h:754
ConstStmtIterator const_child_iterator
Definition: Stmt.h:1156
This represents &#39;#pragma omp distribute&#39; directive.
Definition: StmtOpenMP.h:3270
const Stmt * getAssociatedStmt() const
Returns statement associated with the directive.
Definition: StmtOpenMP.h:253
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:1775
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:4020
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3052
This represents one expression.
Definition: Expr.h:108
MutableArrayRef< Expr * > getUpdates()
Sets the list of update expressions for linear variables.
static unsigned numLoopChildren(unsigned CollapsedNum, OpenMPDirectiveKind Kind)
Children number.
Definition: StmtOpenMP.h:579
Stmt * IgnoreContainers(bool IgnoreCaptured=false)
Skip no-op (attributed, compound) container stmts and skip captured stmt at the top, if IgnoreCaptured is true.
Definition: Stmt.cpp:133
SmallVector< Expr *, 4 > DependentInits
List of initializers required for the generation of the non-rectangular loops.
Definition: StmtOpenMP.h:837
ArrayRef< OMPClause * > clauses() const
Definition: StmtOpenMP.h:327
This represents &#39;#pragma omp master taskloop&#39; directive.
Definition: StmtOpenMP.h:3133
#define V(N, I)
Definition: ASTContext.h:2921
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:1325
This represents &#39;#pragma omp target teams distribute parallel for simd&#39; combined directive.
Definition: StmtOpenMP.h:4246
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2076
static llvm::iterator_range< specific_clause_iterator< SpecificClause > > getClausesOfKind(ArrayRef< OMPClause *> Clauses)
Definition: StmtOpenMP.h:187
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3324
This represents &#39;#pragma omp target teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:4319
bool builtAll()
Check if all the expressions are built (does not check the worksharing ones).
Definition: StmtOpenMP.h:849
unsigned getNumClauses() const
Get number of clauses.
Definition: StmtOpenMP.h:241
Expr * getDistInc() const
Definition: StmtOpenMP.h:1021
Expr * getNextLowerBound() const
Definition: StmtOpenMP.h:985
Expr * PrevUB
PreviousUpperBound - local variable passed to runtime in the enclosing schedule or null if that does ...
Definition: StmtOpenMP.h:811
Expr * getPrevEnsureUpperBound() const
Definition: StmtOpenMP.h:1027
This represents &#39;#pragma omp for&#39; directive.
Definition: StmtOpenMP.h:1264
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2987
ArrayRef< Expr * > counters() const
Definition: StmtOpenMP.h:1113
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
This represents &#39;#pragma omp target teams&#39; directive.
Definition: StmtOpenMP.h:4035
void setAssociatedStmt(Stmt *S)
Set the associated statement for the directive.
Definition: StmtOpenMP.h:85
Expr * ParForInDistCond
&#39;omp parallel for&#39; loop condition used when composed with &#39;omp distribute&#39; in the same construct and ...
Definition: StmtOpenMP.h:770
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1327
StmtIterator child_iterator
Child Iterators: All subclasses must implement &#39;children&#39; to permit easy iteration over the substatem...
Definition: Stmt.h:1155
This represents &#39;#pragma omp cancel&#39; directive.
Definition: StmtOpenMP.h:2936
void setDistInc(Expr *DistInc)
Definition: StmtOpenMP.h:673
Expr * NLB
Update of LowerBound for statically scheduled omp loops for outer loop in combined constructs (e...
Definition: StmtOpenMP.h:760
void setClauses(ArrayRef< OMPClause *> Clauses)
Sets the list of variables for this clause.
Definition: StmtOpenMP.cpp:19
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2668
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2248
This file defines OpenMP AST classes for clauses.
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2435
This represents &#39;#pragma omp flush&#39; directive.
Definition: StmtOpenMP.h:2204
bool hasClausesOfKind() const
Returns true if the current directive has one or more clauses of a specific kind. ...
Definition: StmtOpenMP.h:219
This represents &#39;#pragma omp parallel for simd&#39; directive.
Definition: StmtOpenMP.h:1792
Expr * NumIterations
Loop number of iterations.
Definition: StmtOpenMP.h:781
void setLocStart(SourceLocation Loc)
Set starting location of directive kind.
Definition: StmtOpenMP.h:233
Expr * ST
Stride - local variable passed to runtime.
Definition: StmtOpenMP.h:799
This represents &#39;#pragma omp parallel master taskloop&#39; directive.
Definition: StmtOpenMP.h:3202
Expr * getLastIteration() const
Definition: StmtOpenMP.h:917
const SpecificClause * getSingleClause() const
Gets a single clause of the specified kind associated with the current directive iff there is only on...
Definition: StmtOpenMP.h:205
bool isPostfixUpdate() const
Return true if &#39;v&#39; expression must be updated to original value of &#39;x&#39;, false if &#39;v&#39; must be updated ...
Definition: StmtOpenMP.h:2423
This represents &#39;#pragma omp target enter data&#39; directive.
Definition: StmtOpenMP.h:2564
SmallVector< Expr *, 4 > PrivateCounters
PrivateCounters Loop counters.
Definition: StmtOpenMP.h:825
void setLowerBoundVariable(Expr *LB)
Definition: StmtOpenMP.h:614
Expr * getStrideVariable() const
Definition: StmtOpenMP.h:969
ArrayRef< Expr * > updates() const
Definition: StmtOpenMP.h:1131
Expr * getCombinedDistCond() const
Definition: StmtOpenMP.h:1075
const Stmt * getPreInits() const
Definition: StmtOpenMP.h:941
#define false
Definition: stdbool.h:17
Kind
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2924
This captures a statement into a function.
Definition: Stmt.h:3350
SmallVector< Expr *, 4 > Counters
Counters Loop counters.
Definition: StmtOpenMP.h:823
specific_clause_iterator(ArrayRef< OMPClause *> Clauses)
Definition: StmtOpenMP.h:167
This represents &#39;#pragma omp single&#39; directive.
Definition: StmtOpenMP.h:1536
Encodes a location in the source.
void setPrevLowerBoundVariable(Expr *PrevLB)
Definition: StmtOpenMP.h:663
void setIterationVariable(Expr *IV)
Definition: StmtOpenMP.h:587
MutableArrayRef< Expr * > getInits()
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:33
void setCombinedNextLowerBound(Expr *CombNLB)
Definition: StmtOpenMP.h:708
OMPClause * getClause(unsigned i) const
Returns specified clause.
Definition: StmtOpenMP.h:247
Expr * getExpr()
Get &#39;expr&#39; part of the associated expression/statement.
Definition: StmtOpenMP.h:2430
OpenMPDirectiveKind
OpenMP directives.
Definition: OpenMPKinds.h:22
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2866
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
Definition: StmtOpenMP.h:1696
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1523
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2120
This represents &#39;#pragma omp taskwait&#39; directive.
Definition: StmtOpenMP.h:2087
Expr * PrevEUB
PrevEUB - expression similar to EUB but to be used when loop scheduling uses PrevLB and PrevUB (e...
Definition: StmtOpenMP.h:821
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:50
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of the composite or combined directives that need loop ...
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:4081
llvm::iterator_range< specific_clause_iterator< SpecificClause > > getClausesOfKind() const
Definition: StmtOpenMP.h:195
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition: Stmt.h:3451
This represents &#39;#pragma omp target&#39; directive.
Definition: StmtOpenMP.h:2448
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:1986
Expr * getV()
Get &#39;v&#39; part of the associated expression/statement.
Definition: StmtOpenMP.h:2425
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1698
DistCombinedHelperExprs DistCombinedFields
Expressions used when combining OpenMP loop pragmas.
Definition: StmtOpenMP.h:845
This represents &#39;#pragma omp ordered&#39; directive.
Definition: StmtOpenMP.h:2259
Expr * LB
LowerBound - local variable passed to runtime.
Definition: StmtOpenMP.h:795
void clear(unsigned Size)
Initialize all the fields to null.
Definition: StmtOpenMP.h:859
This represents &#39;#pragma omp target update&#39; directive.
Definition: StmtOpenMP.h:3338
Expr * Init
Loop iteration variable init.
Definition: StmtOpenMP.h:789
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
Definition: Stmt.h:1034
ArrayRef< Expr * > private_counters() const
Definition: StmtOpenMP.h:1119
ArrayRef< Expr * > finals_conditions()
Definition: StmtOpenMP.h:1153
#define alignof
Definition: stdalign.h:15
void setPrevUpperBoundVariable(Expr *PrevUB)
Definition: StmtOpenMP.h:668
void setCombinedEnsureUpperBound(Expr *CombEUB)
Definition: StmtOpenMP.h:693
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3668
Dataflow Directional Tag Classes.
Expr * getPrevUpperBoundVariable() const
Definition: StmtOpenMP.h:1015
const CapturedStmt * getInnermostCapturedStmt() const
Definition: StmtOpenMP.h:296
SmallVector< Expr *, 4 > Inits
Expressions for loop counters inits for CodeGen.
Definition: StmtOpenMP.h:827
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3119
void setCombinedUpperBoundVariable(Expr *CombUB)
Definition: StmtOpenMP.h:688
Expr * getCond() const
Definition: StmtOpenMP.h:929
This represents &#39;#pragma omp section&#39; directive.
Definition: StmtOpenMP.h:1474
SmallVector< Expr *, 4 > DependentCounters
List of counters required for the generation of the non-rectangular loops.
Definition: StmtOpenMP.h:834
This represents &#39;#pragma omp teams distribute&#39; directive.
Definition: StmtOpenMP.h:3748
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:4229
This represents &#39;#pragma omp simd&#39; directive.
Definition: StmtOpenMP.h:1199
StmtClass getStmtClass() const
Definition: Stmt.h:1087
const Expr * getReductionRef() const
Returns reference to the task_reduction return variable.
Definition: StmtOpenMP.h:2182
Expr * getUpdateExpr()
Get helper expression of the form &#39;OpaqueValueExpr(x) binop OpaqueValueExpr(expr)&#39; or &#39;OpaqueValueExp...
Definition: StmtOpenMP.h:2411
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:4148
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
This represents &#39;#pragma omp atomic&#39; directive.
Definition: StmtOpenMP.h:2314
const_child_range children() const
Definition: StmtOpenMP.h:317
Expr * getCombinedInit() const
Definition: StmtOpenMP.h:1051
unsigned getCollapsedNumber() const
Get number of collapsed loops.
Definition: StmtOpenMP.h:911
Expr * getCombinedNextLowerBound() const
Definition: StmtOpenMP.h:1063
ArrayRef< Expr * > counters()
Definition: StmtOpenMP.h:1111
Expr * getCombinedNextUpperBound() const
Definition: StmtOpenMP.h:1069
Iterates over a filtered subrange of clauses applied to a directive.
Definition: StmtOpenMP.h:153
void getOpenMPCaptureRegions(llvm::SmallVectorImpl< OpenMPDirectiveKind > &CaptureRegions, OpenMPDirectiveKind DKind)
Return the captured regions of an OpenMP directive.
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
ArrayRef< Expr * > inits()
Definition: StmtOpenMP.h:1123
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:2550
Expr * Inc
Loop increment.
Definition: StmtOpenMP.h:791
const Expr * getExpr() const
Definition: StmtOpenMP.h:2431
Expr * getNumIterations() const
Definition: StmtOpenMP.h:1001
bool hasAssociatedStmt() const
Returns true if directive has associated statement.
Definition: StmtOpenMP.h:250
Expr * getPrevLowerBoundVariable() const
Definition: StmtOpenMP.h:1009
Iterates over expressions/statements used in the construct.
Definition: StmtOpenMP.h:92
Expr * UB
DistributeUpperBound - used when composing &#39;omp distribute&#39; with &#39;omp for&#39; in a same construct...
Definition: StmtOpenMP.h:747
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Definition: SemaDecl.cpp:14652
Expr * UB
UpperBound - local variable passed to runtime.
Definition: StmtOpenMP.h:797
Defines the clang::SourceLocation class and associated facilities.
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1846
This represents &#39;#pragma omp target parallel&#39; directive.
Definition: StmtOpenMP.h:2681
void setStrideVariable(Expr *ST)
Definition: StmtOpenMP.h:628
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1250
Expr * getCombinedCond() const
Definition: StmtOpenMP.h:1057
ArrayRef< Expr * > dependent_inits() const
Definition: StmtOpenMP.h:1149
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1627
This represents &#39;#pragma omp taskloop simd&#39; directive.
Definition: StmtOpenMP.h:3066
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3463
Expr * getPreCond() const
Definition: StmtOpenMP.h:925
void setPreCond(Expr *PC)
Definition: StmtOpenMP.h:596
OMPExecutableDirective(const T *, StmtClass SC, OpenMPDirectiveKind K, SourceLocation StartLoc, SourceLocation EndLoc, unsigned NumClauses, unsigned NumChildren)
Build instance of directive of class K.
Definition: StmtOpenMP.h:67
This represents &#39;#pragma omp sections&#39; directive.
Definition: StmtOpenMP.h:1406
Expr * Cond
Distribute Loop condition used when composing &#39;omp distribute&#39; with &#39;omp for&#39; in a same construct...
Definition: StmtOpenMP.h:757
Stmt * PreInits
Init statement for all captured expressions.
Definition: StmtOpenMP.h:842
void setInits(ArrayRef< Expr *> IL)
Sets the list of the initial values for linear variables.
This represents &#39;#pragma omp target data&#39; directive.
Definition: StmtOpenMP.h:2506
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Definition: StmtOpenMP.h:2985
void setNextUpperBound(Expr *NUB)
Definition: StmtOpenMP.h:649
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:3872
const Expr * getX() const
Definition: StmtOpenMP.h:2405
void setInc(Expr *Inc)
Definition: StmtOpenMP.h:603
Expr * IL
IsLastIteration - local flag variable passed to runtime.
Definition: StmtOpenMP.h:793
This represents &#39;#pragma omp taskyield&#39; directive.
Definition: StmtOpenMP.h:1999
This represents &#39;#pragma omp distribute parallel for simd&#39; composite directive.
Definition: StmtOpenMP.h:3477
This represents &#39;#pragma omp parallel sections&#39; directive.
Definition: StmtOpenMP.h:1860
void setCalcLastIteration(Expr *CLI)
Definition: StmtOpenMP.h:593
void setCombinedNextUpperBound(Expr *CombNUB)
Definition: StmtOpenMP.h:713
bool hasCancel() const
Return true if current directive has inner cancel directive.
Definition: StmtOpenMP.h:1461
void setLocEnd(SourceLocation Loc)
Set ending location of directive.
Definition: StmtOpenMP.h:238
static bool classof(const Stmt *T)
Definition: StmtOpenMP.h:1392
This represents &#39;#pragma omp target parallel for&#39; directive.
Definition: StmtOpenMP.h:2741
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
This represents &#39;#pragma omp taskloop&#39; directive.
Definition: StmtOpenMP.h:3001