1276479Sdim//===- StmtOpenMP.h - Classes for OpenMP directives ------------*- C++ -*-===// 2259701Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6259701Sdim// 7259701Sdim//===----------------------------------------------------------------------===// 8259701Sdim/// \file 9341825Sdim/// This file defines OpenMP AST classes for executable directives and 10259701Sdim/// clauses. 11259701Sdim/// 12259701Sdim//===----------------------------------------------------------------------===// 13259701Sdim 14259701Sdim#ifndef LLVM_CLANG_AST_STMTOPENMP_H 15259701Sdim#define LLVM_CLANG_AST_STMTOPENMP_H 16259701Sdim 17276479Sdim#include "clang/AST/Expr.h" 18276479Sdim#include "clang/AST/OpenMPClause.h" 19276479Sdim#include "clang/AST/Stmt.h" 20360784Sdim#include "clang/AST/StmtCXX.h" 21259701Sdim#include "clang/Basic/OpenMPKinds.h" 22259701Sdim#include "clang/Basic/SourceLocation.h" 23259701Sdim 24259701Sdimnamespace clang { 25259701Sdim 26259701Sdim//===----------------------------------------------------------------------===// 27276479Sdim// AST classes for directives. 28259701Sdim//===----------------------------------------------------------------------===// 29259701Sdim 30341825Sdim/// This is a basic class for representing single OpenMP executable 31276479Sdim/// directive. 32259701Sdim/// 33276479Sdimclass OMPExecutableDirective : public Stmt { 34276479Sdim friend class ASTStmtReader; 35341825Sdim /// Kind of the directive. 36276479Sdim OpenMPDirectiveKind Kind; 37341825Sdim /// Starting location of the directive (directive keyword). 38259701Sdim SourceLocation StartLoc; 39341825Sdim /// Ending location of the directive. 40259701Sdim SourceLocation EndLoc; 41341825Sdim /// Numbers of clauses. 42276479Sdim const unsigned NumClauses; 43341825Sdim /// Number of child expressions/stmts. 44276479Sdim const unsigned NumChildren; 45341825Sdim /// Offset from this to the start of clauses. 46276479Sdim /// There are NumClauses pointers to clauses, they are followed by 47276479Sdim /// NumChildren pointers to child stmts/exprs (if the directive type 48276479Sdim /// requires an associated stmt, then it has to be the first of them). 49276479Sdim const unsigned ClausesOffset; 50276479Sdim 51341825Sdim /// Get the clauses storage. 52276479Sdim MutableArrayRef<OMPClause *> getClauses() { 53276479Sdim OMPClause **ClauseStorage = reinterpret_cast<OMPClause **>( 54276479Sdim reinterpret_cast<char *>(this) + ClausesOffset); 55276479Sdim return MutableArrayRef<OMPClause *>(ClauseStorage, NumClauses); 56276479Sdim } 57276479Sdim 58259701Sdimprotected: 59341825Sdim /// Build instance of directive of class \a K. 60276479Sdim /// 61276479Sdim /// \param SC Statement class. 62276479Sdim /// \param K Kind of OpenMP directive. 63276479Sdim /// \param StartLoc Starting location of the directive (directive keyword). 64276479Sdim /// \param EndLoc Ending location of the directive. 65276479Sdim /// 66276479Sdim template <typename T> 67276479Sdim OMPExecutableDirective(const T *, StmtClass SC, OpenMPDirectiveKind K, 68276479Sdim SourceLocation StartLoc, SourceLocation EndLoc, 69276479Sdim unsigned NumClauses, unsigned NumChildren) 70276479Sdim : Stmt(SC), Kind(K), StartLoc(std::move(StartLoc)), 71276479Sdim EndLoc(std::move(EndLoc)), NumClauses(NumClauses), 72276479Sdim NumChildren(NumChildren), 73314564Sdim ClausesOffset(llvm::alignTo(sizeof(T), alignof(OMPClause *))) {} 74259701Sdim 75341825Sdim /// Sets the list of variables for this clause. 76276479Sdim /// 77276479Sdim /// \param Clauses The list of clauses for the directive. 78276479Sdim /// 79276479Sdim void setClauses(ArrayRef<OMPClause *> Clauses); 80276479Sdim 81341825Sdim /// Set the associated statement for the directive. 82276479Sdim /// 83276479Sdim /// /param S Associated statement. 84276479Sdim /// 85276479Sdim void setAssociatedStmt(Stmt *S) { 86276479Sdim assert(hasAssociatedStmt() && "no associated statement."); 87276479Sdim *child_begin() = S; 88276479Sdim } 89276479Sdim 90259701Sdimpublic: 91353358Sdim /// Iterates over expressions/statements used in the construct. 92353358Sdim class used_clauses_child_iterator 93353358Sdim : public llvm::iterator_adaptor_base< 94353358Sdim used_clauses_child_iterator, ArrayRef<OMPClause *>::iterator, 95353358Sdim std::forward_iterator_tag, Stmt *, ptrdiff_t, Stmt *, Stmt *> { 96353358Sdim ArrayRef<OMPClause *>::iterator End; 97353358Sdim OMPClause::child_iterator ChildI, ChildEnd; 98353358Sdim 99353358Sdim void MoveToNext() { 100353358Sdim if (ChildI != ChildEnd) 101353358Sdim return; 102353358Sdim while (this->I != End) { 103353358Sdim ++this->I; 104353358Sdim if (this->I != End) { 105353358Sdim ChildI = (*this->I)->used_children().begin(); 106353358Sdim ChildEnd = (*this->I)->used_children().end(); 107353358Sdim if (ChildI != ChildEnd) 108353358Sdim return; 109353358Sdim } 110353358Sdim } 111353358Sdim } 112353358Sdim 113353358Sdim public: 114353358Sdim explicit used_clauses_child_iterator(ArrayRef<OMPClause *> Clauses) 115353358Sdim : used_clauses_child_iterator::iterator_adaptor_base(Clauses.begin()), 116353358Sdim End(Clauses.end()) { 117353358Sdim if (this->I != End) { 118353358Sdim ChildI = (*this->I)->used_children().begin(); 119353358Sdim ChildEnd = (*this->I)->used_children().end(); 120353358Sdim MoveToNext(); 121353358Sdim } 122353358Sdim } 123353358Sdim Stmt *operator*() const { return *ChildI; } 124353358Sdim Stmt *operator->() const { return **this; } 125353358Sdim 126353358Sdim used_clauses_child_iterator &operator++() { 127353358Sdim ++ChildI; 128353358Sdim if (ChildI != ChildEnd) 129353358Sdim return *this; 130353358Sdim if (this->I != End) { 131353358Sdim ++this->I; 132353358Sdim if (this->I != End) { 133353358Sdim ChildI = (*this->I)->used_children().begin(); 134353358Sdim ChildEnd = (*this->I)->used_children().end(); 135353358Sdim } 136353358Sdim } 137353358Sdim MoveToNext(); 138353358Sdim return *this; 139353358Sdim } 140353358Sdim }; 141353358Sdim 142353358Sdim static llvm::iterator_range<used_clauses_child_iterator> 143353358Sdim used_clauses_children(ArrayRef<OMPClause *> Clauses) { 144353358Sdim return {used_clauses_child_iterator(Clauses), 145353358Sdim used_clauses_child_iterator(llvm::makeArrayRef(Clauses.end(), 0))}; 146353358Sdim } 147353358Sdim 148341825Sdim /// Iterates over a filtered subrange of clauses applied to a 149276479Sdim /// directive. 150276479Sdim /// 151296417Sdim /// This iterator visits only clauses of type SpecificClause. 152296417Sdim template <typename SpecificClause> 153296417Sdim class specific_clause_iterator 154296417Sdim : public llvm::iterator_adaptor_base< 155296417Sdim specific_clause_iterator<SpecificClause>, 156296417Sdim ArrayRef<OMPClause *>::const_iterator, std::forward_iterator_tag, 157296417Sdim const SpecificClause *, ptrdiff_t, const SpecificClause *, 158296417Sdim const SpecificClause *> { 159276479Sdim ArrayRef<OMPClause *>::const_iterator End; 160296417Sdim 161276479Sdim void SkipToNextClause() { 162296417Sdim while (this->I != End && !isa<SpecificClause>(*this->I)) 163296417Sdim ++this->I; 164276479Sdim } 165259701Sdim 166276479Sdim public: 167296417Sdim explicit specific_clause_iterator(ArrayRef<OMPClause *> Clauses) 168296417Sdim : specific_clause_iterator::iterator_adaptor_base(Clauses.begin()), 169296417Sdim End(Clauses.end()) { 170276479Sdim SkipToNextClause(); 171276479Sdim } 172296417Sdim 173296417Sdim const SpecificClause *operator*() const { 174296417Sdim return cast<SpecificClause>(*this->I); 175296417Sdim } 176296417Sdim const SpecificClause *operator->() const { return **this; } 177296417Sdim 178296417Sdim specific_clause_iterator &operator++() { 179296417Sdim ++this->I; 180276479Sdim SkipToNextClause(); 181276479Sdim return *this; 182276479Sdim } 183276479Sdim }; 184276479Sdim 185296417Sdim template <typename SpecificClause> 186296417Sdim static llvm::iterator_range<specific_clause_iterator<SpecificClause>> 187296417Sdim getClausesOfKind(ArrayRef<OMPClause *> Clauses) { 188296417Sdim return {specific_clause_iterator<SpecificClause>(Clauses), 189296417Sdim specific_clause_iterator<SpecificClause>( 190296417Sdim llvm::makeArrayRef(Clauses.end(), 0))}; 191288943Sdim } 192296417Sdim 193296417Sdim template <typename SpecificClause> 194296417Sdim llvm::iterator_range<specific_clause_iterator<SpecificClause>> 195296417Sdim getClausesOfKind() const { 196296417Sdim return getClausesOfKind<SpecificClause>(clauses()); 197288943Sdim } 198288943Sdim 199296417Sdim /// Gets a single clause of the specified kind associated with the 200280031Sdim /// current directive iff there is only one clause of this kind (and assertion 201280031Sdim /// is fired if there is more than one clause is associated with the 202296417Sdim /// directive). Returns nullptr if no clause of this kind is associated with 203280031Sdim /// the directive. 204296417Sdim template <typename SpecificClause> 205296417Sdim const SpecificClause *getSingleClause() const { 206296417Sdim auto Clauses = getClausesOfKind<SpecificClause>(); 207280031Sdim 208296417Sdim if (Clauses.begin() != Clauses.end()) { 209296417Sdim assert(std::next(Clauses.begin()) == Clauses.end() && 210296417Sdim "There are at least 2 clauses of the specified kind"); 211296417Sdim return *Clauses.begin(); 212296417Sdim } 213296417Sdim return nullptr; 214296417Sdim } 215296417Sdim 216296417Sdim /// Returns true if the current directive has one or more clauses of a 217296417Sdim /// specific kind. 218296417Sdim template <typename SpecificClause> 219296417Sdim bool hasClausesOfKind() const { 220296417Sdim auto Clauses = getClausesOfKind<SpecificClause>(); 221296417Sdim return Clauses.begin() != Clauses.end(); 222296417Sdim } 223296417Sdim 224341825Sdim /// Returns starting location of directive kind. 225341825Sdim SourceLocation getBeginLoc() const { return StartLoc; } 226341825Sdim /// Returns ending location of directive. 227341825Sdim SourceLocation getEndLoc() const { return EndLoc; } 228259701Sdim 229341825Sdim /// Set starting location of directive kind. 230276479Sdim /// 231276479Sdim /// \param Loc New starting location of directive. 232276479Sdim /// 233259701Sdim void setLocStart(SourceLocation Loc) { StartLoc = Loc; } 234341825Sdim /// Set ending location of directive. 235276479Sdim /// 236276479Sdim /// \param Loc New ending location of directive. 237276479Sdim /// 238259701Sdim void setLocEnd(SourceLocation Loc) { EndLoc = Loc; } 239259701Sdim 240341825Sdim /// Get number of clauses. 241276479Sdim unsigned getNumClauses() const { return NumClauses; } 242259701Sdim 243341825Sdim /// Returns specified clause. 244276479Sdim /// 245276479Sdim /// \param i Number of clause. 246276479Sdim /// 247276479Sdim OMPClause *getClause(unsigned i) const { return clauses()[i]; } 248259701Sdim 249341825Sdim /// Returns true if directive has associated statement. 250276479Sdim bool hasAssociatedStmt() const { return NumChildren > 0; } 251276479Sdim 252341825Sdim /// Returns statement associated with the directive. 253327952Sdim const Stmt *getAssociatedStmt() const { 254276479Sdim assert(hasAssociatedStmt() && "no associated statement."); 255327952Sdim return *child_begin(); 256259701Sdim } 257327952Sdim Stmt *getAssociatedStmt() { 258327952Sdim assert(hasAssociatedStmt() && "no associated statement."); 259327952Sdim return *child_begin(); 260327952Sdim } 261276479Sdim 262341825Sdim /// Returns the captured statement associated with the 263321369Sdim /// component region within the (combined) directive. 264321369Sdim // 265321369Sdim // \param RegionKind Component region kind. 266327952Sdim const CapturedStmt *getCapturedStmt(OpenMPDirectiveKind RegionKind) const { 267321369Sdim SmallVector<OpenMPDirectiveKind, 4> CaptureRegions; 268321369Sdim getOpenMPCaptureRegions(CaptureRegions, getDirectiveKind()); 269321369Sdim assert(std::any_of( 270321369Sdim CaptureRegions.begin(), CaptureRegions.end(), 271321369Sdim [=](const OpenMPDirectiveKind K) { return K == RegionKind; }) && 272321369Sdim "RegionKind not found in OpenMP CaptureRegions."); 273321369Sdim auto *CS = cast<CapturedStmt>(getAssociatedStmt()); 274321369Sdim for (auto ThisCaptureRegion : CaptureRegions) { 275321369Sdim if (ThisCaptureRegion == RegionKind) 276321369Sdim return CS; 277321369Sdim CS = cast<CapturedStmt>(CS->getCapturedStmt()); 278321369Sdim } 279321369Sdim llvm_unreachable("Incorrect RegionKind specified for directive."); 280321369Sdim } 281321369Sdim 282341825Sdim /// Get innermost captured statement for the construct. 283341825Sdim CapturedStmt *getInnermostCapturedStmt() { 284341825Sdim assert(hasAssociatedStmt() && getAssociatedStmt() && 285341825Sdim "Must have associated statement."); 286341825Sdim SmallVector<OpenMPDirectiveKind, 4> CaptureRegions; 287341825Sdim getOpenMPCaptureRegions(CaptureRegions, getDirectiveKind()); 288341825Sdim assert(!CaptureRegions.empty() && 289341825Sdim "At least one captured statement must be provided."); 290341825Sdim auto *CS = cast<CapturedStmt>(getAssociatedStmt()); 291341825Sdim for (unsigned Level = CaptureRegions.size(); Level > 1; --Level) 292341825Sdim CS = cast<CapturedStmt>(CS->getCapturedStmt()); 293341825Sdim return CS; 294341825Sdim } 295341825Sdim 296341825Sdim const CapturedStmt *getInnermostCapturedStmt() const { 297341825Sdim return const_cast<OMPExecutableDirective *>(this) 298341825Sdim ->getInnermostCapturedStmt(); 299341825Sdim } 300341825Sdim 301276479Sdim OpenMPDirectiveKind getDirectiveKind() const { return Kind; } 302276479Sdim 303276479Sdim static bool classof(const Stmt *S) { 304276479Sdim return S->getStmtClass() >= firstOMPExecutableDirectiveConstant && 305276479Sdim S->getStmtClass() <= lastOMPExecutableDirectiveConstant; 306259701Sdim } 307259701Sdim 308276479Sdim child_range children() { 309276479Sdim if (!hasAssociatedStmt()) 310296417Sdim return child_range(child_iterator(), child_iterator()); 311276479Sdim Stmt **ChildStorage = reinterpret_cast<Stmt **>(getClauses().end()); 312341825Sdim /// Do not mark all the special expression/statements as children, except 313341825Sdim /// for the associated statement. 314341825Sdim return child_range(ChildStorage, ChildStorage + 1); 315259701Sdim } 316259701Sdim 317353358Sdim const_child_range children() const { 318353358Sdim if (!hasAssociatedStmt()) 319353358Sdim return const_child_range(const_child_iterator(), const_child_iterator()); 320353358Sdim Stmt **ChildStorage = reinterpret_cast<Stmt **>( 321353358Sdim const_cast<OMPExecutableDirective *>(this)->getClauses().end()); 322353358Sdim return const_child_range(ChildStorage, ChildStorage + 1); 323353358Sdim } 324353358Sdim 325276479Sdim ArrayRef<OMPClause *> clauses() { return getClauses(); } 326276479Sdim 327276479Sdim ArrayRef<OMPClause *> clauses() const { 328276479Sdim return const_cast<OMPExecutableDirective *>(this)->getClauses(); 329259701Sdim } 330353358Sdim 331353358Sdim /// Returns whether or not this is a Standalone directive. 332353358Sdim /// 333353358Sdim /// Stand-alone directives are executable directives 334353358Sdim /// that have no associated user code. 335353358Sdim bool isStandaloneDirective() const; 336353358Sdim 337353358Sdim /// Returns the AST node representing OpenMP structured-block of this 338353358Sdim /// OpenMP executable directive, 339353358Sdim /// Prerequisite: Executable Directive must not be Standalone directive. 340353358Sdim const Stmt *getStructuredBlock() const; 341353358Sdim 342353358Sdim Stmt *getStructuredBlock() { 343353358Sdim return const_cast<Stmt *>( 344353358Sdim const_cast<const OMPExecutableDirective *>(this)->getStructuredBlock()); 345353358Sdim } 346276479Sdim}; 347259701Sdim 348341825Sdim/// This represents '#pragma omp parallel' directive. 349276479Sdim/// 350276479Sdim/// \code 351276479Sdim/// #pragma omp parallel private(a,b) reduction(+: c,d) 352276479Sdim/// \endcode 353276479Sdim/// In this example directive '#pragma omp parallel' has clauses 'private' 354276479Sdim/// with the variables 'a' and 'b' and 'reduction' with operator '+' and 355276479Sdim/// variables 'c' and 'd'. 356276479Sdim/// 357276479Sdimclass OMPParallelDirective : public OMPExecutableDirective { 358296417Sdim friend class ASTStmtReader; 359341825Sdim /// true if the construct has inner cancel directive. 360296417Sdim bool HasCancel; 361296417Sdim 362341825Sdim /// Build directive with the given start and end location. 363259701Sdim /// 364276479Sdim /// \param StartLoc Starting location of the directive (directive keyword). 365276479Sdim /// \param EndLoc Ending Location of the directive. 366259701Sdim /// 367276479Sdim OMPParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc, 368276479Sdim unsigned NumClauses) 369360784Sdim : OMPExecutableDirective(this, OMPParallelDirectiveClass, 370360784Sdim llvm::omp::OMPD_parallel, StartLoc, EndLoc, 371360784Sdim NumClauses, 1), 372296417Sdim HasCancel(false) {} 373276479Sdim 374341825Sdim /// Build an empty directive. 375276479Sdim /// 376276479Sdim /// \param NumClauses Number of clauses. 377276479Sdim /// 378276479Sdim explicit OMPParallelDirective(unsigned NumClauses) 379360784Sdim : OMPExecutableDirective(this, OMPParallelDirectiveClass, 380360784Sdim llvm::omp::OMPD_parallel, SourceLocation(), 381360784Sdim SourceLocation(), NumClauses, 1), 382296417Sdim HasCancel(false) {} 383276479Sdim 384341825Sdim /// Set cancel state. 385296417Sdim void setHasCancel(bool Has) { HasCancel = Has; } 386296417Sdim 387259701Sdimpublic: 388341825Sdim /// Creates directive with a list of \a Clauses. 389276479Sdim /// 390276479Sdim /// \param C AST context. 391276479Sdim /// \param StartLoc Starting location of the directive kind. 392276479Sdim /// \param EndLoc Ending Location of the directive. 393276479Sdim /// \param Clauses List of clauses. 394276479Sdim /// \param AssociatedStmt Statement associated with the directive. 395296417Sdim /// \param HasCancel true if this directive has inner cancel directive. 396276479Sdim /// 397276479Sdim static OMPParallelDirective * 398276479Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 399296417Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel); 400259701Sdim 401341825Sdim /// Creates an empty directive with the place for \a N clauses. 402276479Sdim /// 403276479Sdim /// \param C AST context. 404276479Sdim /// \param NumClauses Number of clauses. 405276479Sdim /// 406276479Sdim static OMPParallelDirective *CreateEmpty(const ASTContext &C, 407276479Sdim unsigned NumClauses, EmptyShell); 408259701Sdim 409341825Sdim /// Return true if current directive has inner cancel directive. 410296417Sdim bool hasCancel() const { return HasCancel; } 411296417Sdim 412276479Sdim static bool classof(const Stmt *T) { 413276479Sdim return T->getStmtClass() == OMPParallelDirectiveClass; 414259701Sdim } 415259701Sdim}; 416259701Sdim 417341825Sdim/// This is a common base class for loop directives ('omp simd', 'omp 418280031Sdim/// for', 'omp for simd' etc.). It is responsible for the loop code generation. 419280031Sdim/// 420280031Sdimclass OMPLoopDirective : public OMPExecutableDirective { 421280031Sdim friend class ASTStmtReader; 422341825Sdim /// Number of collapsed loops as specified by 'collapse' clause. 423280031Sdim unsigned CollapsedNum; 424280031Sdim 425341825Sdim /// Offsets to the stored exprs. 426280031Sdim /// This enumeration contains offsets to all the pointers to children 427280031Sdim /// expressions stored in OMPLoopDirective. 428321369Sdim /// The first 9 children are necessary for all the loop directives, 429321369Sdim /// the next 8 are specific to the worksharing ones, and the next 11 are 430321369Sdim /// used for combined constructs containing two pragmas associated to loops. 431280031Sdim /// After the fixed children, three arrays of length CollapsedNum are 432280031Sdim /// allocated: loop counters, their updates and final values. 433309124Sdim /// PrevLowerBound and PrevUpperBound are used to communicate blocking 434309124Sdim /// information in composite constructs which require loop blocking 435321369Sdim /// DistInc is used to generate the increment expression for the distribute 436321369Sdim /// loop when combined with a further nested loop 437321369Sdim /// PrevEnsureUpperBound is used as the EnsureUpperBound expression for the 438321369Sdim /// for loop when combined with a previous distribute loop in the same pragma 439321369Sdim /// (e.g. 'distribute parallel for') 440280031Sdim /// 441280031Sdim enum { 442280031Sdim AssociatedStmtOffset = 0, 443280031Sdim IterationVariableOffset = 1, 444280031Sdim LastIterationOffset = 2, 445280031Sdim CalcLastIterationOffset = 3, 446280031Sdim PreConditionOffset = 4, 447280031Sdim CondOffset = 5, 448288943Sdim InitOffset = 6, 449288943Sdim IncOffset = 7, 450309124Sdim PreInitsOffset = 8, 451280031Sdim // The '...End' enumerators do not correspond to child expressions - they 452280031Sdim // specify the offset to the end (and start of the following counters/ 453360784Sdim // updates/finals/dependent_counters/dependent_inits/finals_conditions 454360784Sdim // arrays). 455309124Sdim DefaultEnd = 9, 456321369Sdim // The following 8 exprs are used by worksharing and distribute loops only. 457309124Sdim IsLastIterVariableOffset = 9, 458309124Sdim LowerBoundVariableOffset = 10, 459309124Sdim UpperBoundVariableOffset = 11, 460309124Sdim StrideVariableOffset = 12, 461309124Sdim EnsureUpperBoundOffset = 13, 462309124Sdim NextLowerBoundOffset = 14, 463309124Sdim NextUpperBoundOffset = 15, 464309124Sdim NumIterationsOffset = 16, 465321369Sdim // Offset to the end for worksharing loop directives. 466321369Sdim WorksharingEnd = 17, 467309124Sdim PrevLowerBoundVariableOffset = 17, 468309124Sdim PrevUpperBoundVariableOffset = 18, 469321369Sdim DistIncOffset = 19, 470321369Sdim PrevEnsureUpperBoundOffset = 20, 471321369Sdim CombinedLowerBoundVariableOffset = 21, 472321369Sdim CombinedUpperBoundVariableOffset = 22, 473321369Sdim CombinedEnsureUpperBoundOffset = 23, 474321369Sdim CombinedInitOffset = 24, 475321369Sdim CombinedConditionOffset = 25, 476321369Sdim CombinedNextLowerBoundOffset = 26, 477321369Sdim CombinedNextUpperBoundOffset = 27, 478344779Sdim CombinedDistConditionOffset = 28, 479344779Sdim CombinedParForInDistConditionOffset = 29, 480360784Sdim // Offset to the end (and start of the following 481360784Sdim // counters/updates/finals/dependent_counters/dependent_inits/finals_conditions 482321369Sdim // arrays) for combined distribute loop directives. 483344779Sdim CombinedDistributeEnd = 30, 484280031Sdim }; 485280031Sdim 486341825Sdim /// Get the counters storage. 487280031Sdim MutableArrayRef<Expr *> getCounters() { 488280031Sdim Expr **Storage = reinterpret_cast<Expr **>( 489280031Sdim &(*(std::next(child_begin(), getArraysOffset(getDirectiveKind()))))); 490280031Sdim return MutableArrayRef<Expr *>(Storage, CollapsedNum); 491280031Sdim } 492280031Sdim 493341825Sdim /// Get the private counters storage. 494296417Sdim MutableArrayRef<Expr *> getPrivateCounters() { 495296417Sdim Expr **Storage = reinterpret_cast<Expr **>(&*std::next( 496296417Sdim child_begin(), getArraysOffset(getDirectiveKind()) + CollapsedNum)); 497296417Sdim return MutableArrayRef<Expr *>(Storage, CollapsedNum); 498296417Sdim } 499296417Sdim 500341825Sdim /// Get the updates storage. 501288943Sdim MutableArrayRef<Expr *> getInits() { 502280031Sdim Expr **Storage = reinterpret_cast<Expr **>( 503280031Sdim &*std::next(child_begin(), 504296417Sdim getArraysOffset(getDirectiveKind()) + 2 * CollapsedNum)); 505280031Sdim return MutableArrayRef<Expr *>(Storage, CollapsedNum); 506280031Sdim } 507280031Sdim 508341825Sdim /// Get the updates storage. 509288943Sdim MutableArrayRef<Expr *> getUpdates() { 510288943Sdim Expr **Storage = reinterpret_cast<Expr **>( 511288943Sdim &*std::next(child_begin(), 512296417Sdim getArraysOffset(getDirectiveKind()) + 3 * CollapsedNum)); 513288943Sdim return MutableArrayRef<Expr *>(Storage, CollapsedNum); 514288943Sdim } 515288943Sdim 516341825Sdim /// Get the final counter updates storage. 517280031Sdim MutableArrayRef<Expr *> getFinals() { 518280031Sdim Expr **Storage = reinterpret_cast<Expr **>( 519280031Sdim &*std::next(child_begin(), 520296417Sdim getArraysOffset(getDirectiveKind()) + 4 * CollapsedNum)); 521280031Sdim return MutableArrayRef<Expr *>(Storage, CollapsedNum); 522280031Sdim } 523280031Sdim 524360784Sdim /// Get the dependent counters storage. 525360784Sdim MutableArrayRef<Expr *> getDependentCounters() { 526360784Sdim Expr **Storage = reinterpret_cast<Expr **>( 527360784Sdim &*std::next(child_begin(), 528360784Sdim getArraysOffset(getDirectiveKind()) + 5 * CollapsedNum)); 529360784Sdim return MutableArrayRef<Expr *>(Storage, CollapsedNum); 530360784Sdim } 531360784Sdim 532360784Sdim /// Get the dependent inits storage. 533360784Sdim MutableArrayRef<Expr *> getDependentInits() { 534360784Sdim Expr **Storage = reinterpret_cast<Expr **>( 535360784Sdim &*std::next(child_begin(), 536360784Sdim getArraysOffset(getDirectiveKind()) + 6 * CollapsedNum)); 537360784Sdim return MutableArrayRef<Expr *>(Storage, CollapsedNum); 538360784Sdim } 539360784Sdim 540360784Sdim /// Get the finals conditions storage. 541360784Sdim MutableArrayRef<Expr *> getFinalsConditions() { 542360784Sdim Expr **Storage = reinterpret_cast<Expr **>( 543360784Sdim &*std::next(child_begin(), 544360784Sdim getArraysOffset(getDirectiveKind()) + 7 * CollapsedNum)); 545360784Sdim return MutableArrayRef<Expr *>(Storage, CollapsedNum); 546360784Sdim } 547360784Sdim 548280031Sdimprotected: 549341825Sdim /// Build instance of loop directive of class \a Kind. 550280031Sdim /// 551280031Sdim /// \param SC Statement class. 552280031Sdim /// \param Kind Kind of OpenMP directive. 553280031Sdim /// \param StartLoc Starting location of the directive (directive keyword). 554280031Sdim /// \param EndLoc Ending location of the directive. 555280031Sdim /// \param CollapsedNum Number of collapsed loops from 'collapse' clause. 556280031Sdim /// \param NumClauses Number of clauses. 557280031Sdim /// \param NumSpecialChildren Number of additional directive-specific stmts. 558280031Sdim /// 559280031Sdim template <typename T> 560280031Sdim OMPLoopDirective(const T *That, StmtClass SC, OpenMPDirectiveKind Kind, 561280031Sdim SourceLocation StartLoc, SourceLocation EndLoc, 562280031Sdim unsigned CollapsedNum, unsigned NumClauses, 563280031Sdim unsigned NumSpecialChildren = 0) 564280031Sdim : OMPExecutableDirective(That, SC, Kind, StartLoc, EndLoc, NumClauses, 565280031Sdim numLoopChildren(CollapsedNum, Kind) + 566280031Sdim NumSpecialChildren), 567280031Sdim CollapsedNum(CollapsedNum) {} 568280031Sdim 569341825Sdim /// Offset to the start of children expression arrays. 570280031Sdim static unsigned getArraysOffset(OpenMPDirectiveKind Kind) { 571321369Sdim if (isOpenMPLoopBoundSharingDirective(Kind)) 572321369Sdim return CombinedDistributeEnd; 573321369Sdim if (isOpenMPWorksharingDirective(Kind) || isOpenMPTaskLoopDirective(Kind) || 574321369Sdim isOpenMPDistributeDirective(Kind)) 575321369Sdim return WorksharingEnd; 576321369Sdim return DefaultEnd; 577280031Sdim } 578280031Sdim 579341825Sdim /// Children number. 580280031Sdim static unsigned numLoopChildren(unsigned CollapsedNum, 581280031Sdim OpenMPDirectiveKind Kind) { 582360784Sdim return getArraysOffset(Kind) + 583360784Sdim 8 * CollapsedNum; // Counters, PrivateCounters, Inits, 584360784Sdim // Updates, Finals, DependentCounters, 585360784Sdim // DependentInits, FinalsConditions. 586280031Sdim } 587280031Sdim 588280031Sdim void setIterationVariable(Expr *IV) { 589280031Sdim *std::next(child_begin(), IterationVariableOffset) = IV; 590280031Sdim } 591280031Sdim void setLastIteration(Expr *LI) { 592280031Sdim *std::next(child_begin(), LastIterationOffset) = LI; 593280031Sdim } 594280031Sdim void setCalcLastIteration(Expr *CLI) { 595280031Sdim *std::next(child_begin(), CalcLastIterationOffset) = CLI; 596280031Sdim } 597280031Sdim void setPreCond(Expr *PC) { 598280031Sdim *std::next(child_begin(), PreConditionOffset) = PC; 599280031Sdim } 600288943Sdim void setCond(Expr *Cond) { 601280031Sdim *std::next(child_begin(), CondOffset) = Cond; 602280031Sdim } 603280031Sdim void setInit(Expr *Init) { *std::next(child_begin(), InitOffset) = Init; } 604280031Sdim void setInc(Expr *Inc) { *std::next(child_begin(), IncOffset) = Inc; } 605309124Sdim void setPreInits(Stmt *PreInits) { 606309124Sdim *std::next(child_begin(), PreInitsOffset) = PreInits; 607309124Sdim } 608280031Sdim void setIsLastIterVariable(Expr *IL) { 609296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 610296417Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 611296417Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 612280031Sdim "expected worksharing loop directive"); 613280031Sdim *std::next(child_begin(), IsLastIterVariableOffset) = IL; 614280031Sdim } 615280031Sdim void setLowerBoundVariable(Expr *LB) { 616296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 617296417Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 618296417Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 619280031Sdim "expected worksharing loop directive"); 620280031Sdim *std::next(child_begin(), LowerBoundVariableOffset) = LB; 621280031Sdim } 622280031Sdim void setUpperBoundVariable(Expr *UB) { 623296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 624296417Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 625296417Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 626280031Sdim "expected worksharing loop directive"); 627280031Sdim *std::next(child_begin(), UpperBoundVariableOffset) = UB; 628280031Sdim } 629280031Sdim void setStrideVariable(Expr *ST) { 630296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 631296417Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 632296417Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 633280031Sdim "expected worksharing loop directive"); 634280031Sdim *std::next(child_begin(), StrideVariableOffset) = ST; 635280031Sdim } 636280031Sdim void setEnsureUpperBound(Expr *EUB) { 637296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 638296417Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 639296417Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 640280031Sdim "expected worksharing loop directive"); 641280031Sdim *std::next(child_begin(), EnsureUpperBoundOffset) = EUB; 642280031Sdim } 643280031Sdim void setNextLowerBound(Expr *NLB) { 644296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 645296417Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 646296417Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 647280031Sdim "expected worksharing loop directive"); 648280031Sdim *std::next(child_begin(), NextLowerBoundOffset) = NLB; 649280031Sdim } 650280031Sdim void setNextUpperBound(Expr *NUB) { 651296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 652296417Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 653296417Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 654280031Sdim "expected worksharing loop directive"); 655280031Sdim *std::next(child_begin(), NextUpperBoundOffset) = NUB; 656280031Sdim } 657309124Sdim void setNumIterations(Expr *NI) { 658309124Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 659309124Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 660309124Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 661309124Sdim "expected worksharing loop directive"); 662309124Sdim *std::next(child_begin(), NumIterationsOffset) = NI; 663309124Sdim } 664309124Sdim void setPrevLowerBoundVariable(Expr *PrevLB) { 665321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 666321369Sdim "expected loop bound sharing directive"); 667309124Sdim *std::next(child_begin(), PrevLowerBoundVariableOffset) = PrevLB; 668309124Sdim } 669309124Sdim void setPrevUpperBoundVariable(Expr *PrevUB) { 670321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 671321369Sdim "expected loop bound sharing directive"); 672309124Sdim *std::next(child_begin(), PrevUpperBoundVariableOffset) = PrevUB; 673309124Sdim } 674321369Sdim void setDistInc(Expr *DistInc) { 675321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 676321369Sdim "expected loop bound sharing directive"); 677321369Sdim *std::next(child_begin(), DistIncOffset) = DistInc; 678321369Sdim } 679321369Sdim void setPrevEnsureUpperBound(Expr *PrevEUB) { 680321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 681321369Sdim "expected loop bound sharing directive"); 682321369Sdim *std::next(child_begin(), PrevEnsureUpperBoundOffset) = PrevEUB; 683321369Sdim } 684321369Sdim void setCombinedLowerBoundVariable(Expr *CombLB) { 685321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 686321369Sdim "expected loop bound sharing directive"); 687321369Sdim *std::next(child_begin(), CombinedLowerBoundVariableOffset) = CombLB; 688321369Sdim } 689321369Sdim void setCombinedUpperBoundVariable(Expr *CombUB) { 690321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 691321369Sdim "expected loop bound sharing directive"); 692321369Sdim *std::next(child_begin(), CombinedUpperBoundVariableOffset) = CombUB; 693321369Sdim } 694321369Sdim void setCombinedEnsureUpperBound(Expr *CombEUB) { 695321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 696321369Sdim "expected loop bound sharing directive"); 697321369Sdim *std::next(child_begin(), CombinedEnsureUpperBoundOffset) = CombEUB; 698321369Sdim } 699321369Sdim void setCombinedInit(Expr *CombInit) { 700321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 701321369Sdim "expected loop bound sharing directive"); 702321369Sdim *std::next(child_begin(), CombinedInitOffset) = CombInit; 703321369Sdim } 704321369Sdim void setCombinedCond(Expr *CombCond) { 705321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 706321369Sdim "expected loop bound sharing directive"); 707321369Sdim *std::next(child_begin(), CombinedConditionOffset) = CombCond; 708321369Sdim } 709321369Sdim void setCombinedNextLowerBound(Expr *CombNLB) { 710321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 711321369Sdim "expected loop bound sharing directive"); 712321369Sdim *std::next(child_begin(), CombinedNextLowerBoundOffset) = CombNLB; 713321369Sdim } 714321369Sdim void setCombinedNextUpperBound(Expr *CombNUB) { 715321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 716321369Sdim "expected loop bound sharing directive"); 717321369Sdim *std::next(child_begin(), CombinedNextUpperBoundOffset) = CombNUB; 718321369Sdim } 719344779Sdim void setCombinedDistCond(Expr *CombDistCond) { 720344779Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 721344779Sdim "expected loop bound distribute sharing directive"); 722344779Sdim *std::next(child_begin(), CombinedDistConditionOffset) = CombDistCond; 723344779Sdim } 724344779Sdim void setCombinedParForInDistCond(Expr *CombParForInDistCond) { 725344779Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 726344779Sdim "expected loop bound distribute sharing directive"); 727344779Sdim *std::next(child_begin(), 728344779Sdim CombinedParForInDistConditionOffset) = CombParForInDistCond; 729344779Sdim } 730280031Sdim void setCounters(ArrayRef<Expr *> A); 731296417Sdim void setPrivateCounters(ArrayRef<Expr *> A); 732288943Sdim void setInits(ArrayRef<Expr *> A); 733280031Sdim void setUpdates(ArrayRef<Expr *> A); 734280031Sdim void setFinals(ArrayRef<Expr *> A); 735360784Sdim void setDependentCounters(ArrayRef<Expr *> A); 736360784Sdim void setDependentInits(ArrayRef<Expr *> A); 737360784Sdim void setFinalsConditions(ArrayRef<Expr *> A); 738280031Sdim 739280031Sdimpublic: 740321369Sdim /// The expressions built to support OpenMP loops in combined/composite 741321369Sdim /// pragmas (e.g. pragma omp distribute parallel for) 742321369Sdim struct DistCombinedHelperExprs { 743321369Sdim /// DistributeLowerBound - used when composing 'omp distribute' with 744321369Sdim /// 'omp for' in a same construct. 745321369Sdim Expr *LB; 746321369Sdim /// DistributeUpperBound - used when composing 'omp distribute' with 747321369Sdim /// 'omp for' in a same construct. 748321369Sdim Expr *UB; 749321369Sdim /// DistributeEnsureUpperBound - used when composing 'omp distribute' 750321369Sdim /// with 'omp for' in a same construct, EUB depends on DistUB 751321369Sdim Expr *EUB; 752321369Sdim /// Distribute loop iteration variable init used when composing 'omp 753321369Sdim /// distribute' 754321369Sdim /// with 'omp for' in a same construct 755321369Sdim Expr *Init; 756321369Sdim /// Distribute Loop condition used when composing 'omp distribute' 757321369Sdim /// with 'omp for' in a same construct 758321369Sdim Expr *Cond; 759341825Sdim /// Update of LowerBound for statically scheduled omp loops for 760321369Sdim /// outer loop in combined constructs (e.g. 'distribute parallel for') 761321369Sdim Expr *NLB; 762341825Sdim /// Update of UpperBound for statically scheduled omp loops for 763321369Sdim /// outer loop in combined constructs (e.g. 'distribute parallel for') 764321369Sdim Expr *NUB; 765344779Sdim /// Distribute Loop condition used when composing 'omp distribute' 766344779Sdim /// with 'omp for' in a same construct when schedule is chunked. 767344779Sdim Expr *DistCond; 768344779Sdim /// 'omp parallel for' loop condition used when composed with 769344779Sdim /// 'omp distribute' in the same construct and when schedule is 770344779Sdim /// chunked and the chunk size is 1. 771344779Sdim Expr *ParForInDistCond; 772321369Sdim }; 773321369Sdim 774341825Sdim /// The expressions built for the OpenMP loop CodeGen for the 775280031Sdim /// whole collapsed loop nest. 776280031Sdim struct HelperExprs { 777341825Sdim /// Loop iteration variable. 778280031Sdim Expr *IterationVarRef; 779341825Sdim /// Loop last iteration number. 780280031Sdim Expr *LastIteration; 781341825Sdim /// Loop number of iterations. 782288943Sdim Expr *NumIterations; 783341825Sdim /// Calculation of last iteration. 784280031Sdim Expr *CalcLastIteration; 785341825Sdim /// Loop pre-condition. 786280031Sdim Expr *PreCond; 787341825Sdim /// Loop condition. 788280031Sdim Expr *Cond; 789341825Sdim /// Loop iteration variable init. 790280031Sdim Expr *Init; 791341825Sdim /// Loop increment. 792280031Sdim Expr *Inc; 793341825Sdim /// IsLastIteration - local flag variable passed to runtime. 794280031Sdim Expr *IL; 795341825Sdim /// LowerBound - local variable passed to runtime. 796280031Sdim Expr *LB; 797341825Sdim /// UpperBound - local variable passed to runtime. 798280031Sdim Expr *UB; 799341825Sdim /// Stride - local variable passed to runtime. 800280031Sdim Expr *ST; 801341825Sdim /// EnsureUpperBound -- expression UB = min(UB, NumIterations). 802280031Sdim Expr *EUB; 803341825Sdim /// Update of LowerBound for statically scheduled 'omp for' loops. 804280031Sdim Expr *NLB; 805341825Sdim /// Update of UpperBound for statically scheduled 'omp for' loops. 806280031Sdim Expr *NUB; 807341825Sdim /// PreviousLowerBound - local variable passed to runtime in the 808309124Sdim /// enclosing schedule or null if that does not apply. 809309124Sdim Expr *PrevLB; 810341825Sdim /// PreviousUpperBound - local variable passed to runtime in the 811309124Sdim /// enclosing schedule or null if that does not apply. 812309124Sdim Expr *PrevUB; 813341825Sdim /// DistInc - increment expression for distribute loop when found 814321369Sdim /// combined with a further loop level (e.g. in 'distribute parallel for') 815321369Sdim /// expression IV = IV + ST 816321369Sdim Expr *DistInc; 817341825Sdim /// PrevEUB - expression similar to EUB but to be used when loop 818321369Sdim /// scheduling uses PrevLB and PrevUB (e.g. in 'distribute parallel for' 819321369Sdim /// when ensuring that the UB is either the calculated UB by the runtime or 820321369Sdim /// the end of the assigned distribute chunk) 821321369Sdim /// expression UB = min (UB, PrevUB) 822321369Sdim Expr *PrevEUB; 823341825Sdim /// Counters Loop counters. 824280031Sdim SmallVector<Expr *, 4> Counters; 825341825Sdim /// PrivateCounters Loop counters. 826296417Sdim SmallVector<Expr *, 4> PrivateCounters; 827341825Sdim /// Expressions for loop counters inits for CodeGen. 828288943Sdim SmallVector<Expr *, 4> Inits; 829341825Sdim /// Expressions for loop counters update for CodeGen. 830280031Sdim SmallVector<Expr *, 4> Updates; 831341825Sdim /// Final loop counter values for GodeGen. 832280031Sdim SmallVector<Expr *, 4> Finals; 833360784Sdim /// List of counters required for the generation of the non-rectangular 834360784Sdim /// loops. 835360784Sdim SmallVector<Expr *, 4> DependentCounters; 836360784Sdim /// List of initializers required for the generation of the non-rectangular 837360784Sdim /// loops. 838360784Sdim SmallVector<Expr *, 4> DependentInits; 839360784Sdim /// List of final conditions required for the generation of the 840360784Sdim /// non-rectangular loops. 841360784Sdim SmallVector<Expr *, 4> FinalsConditions; 842309124Sdim /// Init statement for all captured expressions. 843309124Sdim Stmt *PreInits; 844280031Sdim 845321369Sdim /// Expressions used when combining OpenMP loop pragmas 846321369Sdim DistCombinedHelperExprs DistCombinedFields; 847321369Sdim 848341825Sdim /// Check if all the expressions are built (does not check the 849280031Sdim /// worksharing ones). 850280031Sdim bool builtAll() { 851280031Sdim return IterationVarRef != nullptr && LastIteration != nullptr && 852288943Sdim NumIterations != nullptr && PreCond != nullptr && 853288943Sdim Cond != nullptr && Init != nullptr && Inc != nullptr; 854280031Sdim } 855280031Sdim 856341825Sdim /// Initialize all the fields to null. 857360784Sdim /// \param Size Number of elements in the 858360784Sdim /// counters/finals/updates/dependent_counters/dependent_inits/finals_conditions 859360784Sdim /// arrays. 860280031Sdim void clear(unsigned Size) { 861280031Sdim IterationVarRef = nullptr; 862280031Sdim LastIteration = nullptr; 863280031Sdim CalcLastIteration = nullptr; 864280031Sdim PreCond = nullptr; 865280031Sdim Cond = nullptr; 866280031Sdim Init = nullptr; 867280031Sdim Inc = nullptr; 868280031Sdim IL = nullptr; 869280031Sdim LB = nullptr; 870280031Sdim UB = nullptr; 871280031Sdim ST = nullptr; 872280031Sdim EUB = nullptr; 873280031Sdim NLB = nullptr; 874280031Sdim NUB = nullptr; 875309124Sdim NumIterations = nullptr; 876309124Sdim PrevLB = nullptr; 877309124Sdim PrevUB = nullptr; 878321369Sdim DistInc = nullptr; 879321369Sdim PrevEUB = nullptr; 880280031Sdim Counters.resize(Size); 881296417Sdim PrivateCounters.resize(Size); 882288943Sdim Inits.resize(Size); 883280031Sdim Updates.resize(Size); 884280031Sdim Finals.resize(Size); 885360784Sdim DependentCounters.resize(Size); 886360784Sdim DependentInits.resize(Size); 887360784Sdim FinalsConditions.resize(Size); 888280031Sdim for (unsigned i = 0; i < Size; ++i) { 889280031Sdim Counters[i] = nullptr; 890296417Sdim PrivateCounters[i] = nullptr; 891288943Sdim Inits[i] = nullptr; 892280031Sdim Updates[i] = nullptr; 893280031Sdim Finals[i] = nullptr; 894360784Sdim DependentCounters[i] = nullptr; 895360784Sdim DependentInits[i] = nullptr; 896360784Sdim FinalsConditions[i] = nullptr; 897280031Sdim } 898309124Sdim PreInits = nullptr; 899321369Sdim DistCombinedFields.LB = nullptr; 900321369Sdim DistCombinedFields.UB = nullptr; 901321369Sdim DistCombinedFields.EUB = nullptr; 902321369Sdim DistCombinedFields.Init = nullptr; 903321369Sdim DistCombinedFields.Cond = nullptr; 904321369Sdim DistCombinedFields.NLB = nullptr; 905321369Sdim DistCombinedFields.NUB = nullptr; 906344779Sdim DistCombinedFields.DistCond = nullptr; 907344779Sdim DistCombinedFields.ParForInDistCond = nullptr; 908280031Sdim } 909280031Sdim }; 910280031Sdim 911341825Sdim /// Get number of collapsed loops. 912280031Sdim unsigned getCollapsedNumber() const { return CollapsedNum; } 913280031Sdim 914280031Sdim Expr *getIterationVariable() const { 915280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 916280031Sdim *std::next(child_begin(), IterationVariableOffset))); 917280031Sdim } 918280031Sdim Expr *getLastIteration() const { 919280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 920280031Sdim *std::next(child_begin(), LastIterationOffset))); 921280031Sdim } 922280031Sdim Expr *getCalcLastIteration() const { 923280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 924280031Sdim *std::next(child_begin(), CalcLastIterationOffset))); 925280031Sdim } 926280031Sdim Expr *getPreCond() const { 927280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 928280031Sdim *std::next(child_begin(), PreConditionOffset))); 929280031Sdim } 930288943Sdim Expr *getCond() const { 931288943Sdim return const_cast<Expr *>( 932288943Sdim reinterpret_cast<const Expr *>(*std::next(child_begin(), CondOffset))); 933280031Sdim } 934280031Sdim Expr *getInit() const { 935280031Sdim return const_cast<Expr *>( 936280031Sdim reinterpret_cast<const Expr *>(*std::next(child_begin(), InitOffset))); 937280031Sdim } 938280031Sdim Expr *getInc() const { 939280031Sdim return const_cast<Expr *>( 940280031Sdim reinterpret_cast<const Expr *>(*std::next(child_begin(), IncOffset))); 941280031Sdim } 942309124Sdim const Stmt *getPreInits() const { 943309124Sdim return *std::next(child_begin(), PreInitsOffset); 944309124Sdim } 945309124Sdim Stmt *getPreInits() { return *std::next(child_begin(), PreInitsOffset); } 946280031Sdim Expr *getIsLastIterVariable() const { 947296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 948309124Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 949309124Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 950280031Sdim "expected worksharing loop directive"); 951280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 952280031Sdim *std::next(child_begin(), IsLastIterVariableOffset))); 953280031Sdim } 954280031Sdim Expr *getLowerBoundVariable() const { 955296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 956309124Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 957309124Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 958280031Sdim "expected worksharing loop directive"); 959280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 960280031Sdim *std::next(child_begin(), LowerBoundVariableOffset))); 961280031Sdim } 962280031Sdim Expr *getUpperBoundVariable() const { 963296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 964309124Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 965309124Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 966280031Sdim "expected worksharing loop directive"); 967280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 968280031Sdim *std::next(child_begin(), UpperBoundVariableOffset))); 969280031Sdim } 970280031Sdim Expr *getStrideVariable() const { 971296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 972309124Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 973309124Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 974280031Sdim "expected worksharing loop directive"); 975280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 976280031Sdim *std::next(child_begin(), StrideVariableOffset))); 977280031Sdim } 978280031Sdim Expr *getEnsureUpperBound() const { 979296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 980309124Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 981309124Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 982280031Sdim "expected worksharing loop directive"); 983280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 984280031Sdim *std::next(child_begin(), EnsureUpperBoundOffset))); 985280031Sdim } 986280031Sdim Expr *getNextLowerBound() const { 987296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 988309124Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 989309124Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 990280031Sdim "expected worksharing loop directive"); 991280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 992280031Sdim *std::next(child_begin(), NextLowerBoundOffset))); 993280031Sdim } 994280031Sdim Expr *getNextUpperBound() const { 995296417Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 996309124Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 997309124Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 998280031Sdim "expected worksharing loop directive"); 999280031Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1000280031Sdim *std::next(child_begin(), NextUpperBoundOffset))); 1001280031Sdim } 1002309124Sdim Expr *getNumIterations() const { 1003309124Sdim assert((isOpenMPWorksharingDirective(getDirectiveKind()) || 1004309124Sdim isOpenMPTaskLoopDirective(getDirectiveKind()) || 1005309124Sdim isOpenMPDistributeDirective(getDirectiveKind())) && 1006309124Sdim "expected worksharing loop directive"); 1007309124Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1008309124Sdim *std::next(child_begin(), NumIterationsOffset))); 1009309124Sdim } 1010309124Sdim Expr *getPrevLowerBoundVariable() const { 1011321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1012321369Sdim "expected loop bound sharing directive"); 1013309124Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1014309124Sdim *std::next(child_begin(), PrevLowerBoundVariableOffset))); 1015309124Sdim } 1016309124Sdim Expr *getPrevUpperBoundVariable() const { 1017321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1018321369Sdim "expected loop bound sharing directive"); 1019309124Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1020309124Sdim *std::next(child_begin(), PrevUpperBoundVariableOffset))); 1021309124Sdim } 1022321369Sdim Expr *getDistInc() const { 1023321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1024321369Sdim "expected loop bound sharing directive"); 1025321369Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1026321369Sdim *std::next(child_begin(), DistIncOffset))); 1027321369Sdim } 1028321369Sdim Expr *getPrevEnsureUpperBound() const { 1029321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1030321369Sdim "expected loop bound sharing directive"); 1031321369Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1032321369Sdim *std::next(child_begin(), PrevEnsureUpperBoundOffset))); 1033321369Sdim } 1034321369Sdim Expr *getCombinedLowerBoundVariable() const { 1035321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1036321369Sdim "expected loop bound sharing directive"); 1037321369Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1038321369Sdim *std::next(child_begin(), CombinedLowerBoundVariableOffset))); 1039321369Sdim } 1040321369Sdim Expr *getCombinedUpperBoundVariable() const { 1041321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1042321369Sdim "expected loop bound sharing directive"); 1043321369Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1044321369Sdim *std::next(child_begin(), CombinedUpperBoundVariableOffset))); 1045321369Sdim } 1046321369Sdim Expr *getCombinedEnsureUpperBound() const { 1047321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1048321369Sdim "expected loop bound sharing directive"); 1049321369Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1050321369Sdim *std::next(child_begin(), CombinedEnsureUpperBoundOffset))); 1051321369Sdim } 1052321369Sdim Expr *getCombinedInit() const { 1053321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1054321369Sdim "expected loop bound sharing directive"); 1055321369Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1056321369Sdim *std::next(child_begin(), CombinedInitOffset))); 1057321369Sdim } 1058321369Sdim Expr *getCombinedCond() const { 1059321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1060321369Sdim "expected loop bound sharing directive"); 1061321369Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1062321369Sdim *std::next(child_begin(), CombinedConditionOffset))); 1063321369Sdim } 1064321369Sdim Expr *getCombinedNextLowerBound() const { 1065321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1066321369Sdim "expected loop bound sharing directive"); 1067321369Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1068321369Sdim *std::next(child_begin(), CombinedNextLowerBoundOffset))); 1069321369Sdim } 1070321369Sdim Expr *getCombinedNextUpperBound() const { 1071321369Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1072321369Sdim "expected loop bound sharing directive"); 1073321369Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1074321369Sdim *std::next(child_begin(), CombinedNextUpperBoundOffset))); 1075321369Sdim } 1076344779Sdim Expr *getCombinedDistCond() const { 1077344779Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1078344779Sdim "expected loop bound distribute sharing directive"); 1079344779Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1080344779Sdim *std::next(child_begin(), CombinedDistConditionOffset))); 1081344779Sdim } 1082344779Sdim Expr *getCombinedParForInDistCond() const { 1083344779Sdim assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && 1084344779Sdim "expected loop bound distribute sharing directive"); 1085344779Sdim return const_cast<Expr *>(reinterpret_cast<const Expr *>( 1086344779Sdim *std::next(child_begin(), CombinedParForInDistConditionOffset))); 1087344779Sdim } 1088360784Sdim /// Try to find the next loop sub-statement in the specified statement \p 1089360784Sdim /// CurStmt. 1090360784Sdim /// \param TryImperfectlyNestedLoops true, if we need to try to look for the 1091360784Sdim /// imperfectly nested loop. 1092360784Sdim static Stmt *tryToFindNextInnerLoop(Stmt *CurStmt, 1093360784Sdim bool TryImperfectlyNestedLoops); 1094360784Sdim static const Stmt *tryToFindNextInnerLoop(const Stmt *CurStmt, 1095360784Sdim bool TryImperfectlyNestedLoops) { 1096360784Sdim return tryToFindNextInnerLoop(const_cast<Stmt *>(CurStmt), 1097360784Sdim TryImperfectlyNestedLoops); 1098360784Sdim } 1099360784Sdim Stmt *getBody(); 1100280031Sdim const Stmt *getBody() const { 1101360784Sdim return const_cast<OMPLoopDirective *>(this)->getBody(); 1102280031Sdim } 1103280031Sdim 1104280031Sdim ArrayRef<Expr *> counters() { return getCounters(); } 1105280031Sdim 1106280031Sdim ArrayRef<Expr *> counters() const { 1107280031Sdim return const_cast<OMPLoopDirective *>(this)->getCounters(); 1108280031Sdim } 1109280031Sdim 1110296417Sdim ArrayRef<Expr *> private_counters() { return getPrivateCounters(); } 1111296417Sdim 1112296417Sdim ArrayRef<Expr *> private_counters() const { 1113296417Sdim return const_cast<OMPLoopDirective *>(this)->getPrivateCounters(); 1114296417Sdim } 1115296417Sdim 1116288943Sdim ArrayRef<Expr *> inits() { return getInits(); } 1117288943Sdim 1118288943Sdim ArrayRef<Expr *> inits() const { 1119288943Sdim return const_cast<OMPLoopDirective *>(this)->getInits(); 1120288943Sdim } 1121288943Sdim 1122280031Sdim ArrayRef<Expr *> updates() { return getUpdates(); } 1123280031Sdim 1124280031Sdim ArrayRef<Expr *> updates() const { 1125280031Sdim return const_cast<OMPLoopDirective *>(this)->getUpdates(); 1126280031Sdim } 1127280031Sdim 1128280031Sdim ArrayRef<Expr *> finals() { return getFinals(); } 1129280031Sdim 1130280031Sdim ArrayRef<Expr *> finals() const { 1131280031Sdim return const_cast<OMPLoopDirective *>(this)->getFinals(); 1132280031Sdim } 1133280031Sdim 1134360784Sdim ArrayRef<Expr *> dependent_counters() { return getDependentCounters(); } 1135360784Sdim 1136360784Sdim ArrayRef<Expr *> dependent_counters() const { 1137360784Sdim return const_cast<OMPLoopDirective *>(this)->getDependentCounters(); 1138360784Sdim } 1139360784Sdim 1140360784Sdim ArrayRef<Expr *> dependent_inits() { return getDependentInits(); } 1141360784Sdim 1142360784Sdim ArrayRef<Expr *> dependent_inits() const { 1143360784Sdim return const_cast<OMPLoopDirective *>(this)->getDependentInits(); 1144360784Sdim } 1145360784Sdim 1146360784Sdim ArrayRef<Expr *> finals_conditions() { return getFinalsConditions(); } 1147360784Sdim 1148360784Sdim ArrayRef<Expr *> finals_conditions() const { 1149360784Sdim return const_cast<OMPLoopDirective *>(this)->getFinalsConditions(); 1150360784Sdim } 1151360784Sdim 1152280031Sdim static bool classof(const Stmt *T) { 1153280031Sdim return T->getStmtClass() == OMPSimdDirectiveClass || 1154280031Sdim T->getStmtClass() == OMPForDirectiveClass || 1155280031Sdim T->getStmtClass() == OMPForSimdDirectiveClass || 1156280031Sdim T->getStmtClass() == OMPParallelForDirectiveClass || 1157296417Sdim T->getStmtClass() == OMPParallelForSimdDirectiveClass || 1158296417Sdim T->getStmtClass() == OMPTaskLoopDirectiveClass || 1159296417Sdim T->getStmtClass() == OMPTaskLoopSimdDirectiveClass || 1160360784Sdim T->getStmtClass() == OMPMasterTaskLoopDirectiveClass || 1161360784Sdim T->getStmtClass() == OMPMasterTaskLoopSimdDirectiveClass || 1162360784Sdim T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass || 1163360784Sdim T->getStmtClass() == OMPParallelMasterTaskLoopSimdDirectiveClass || 1164309124Sdim T->getStmtClass() == OMPDistributeDirectiveClass || 1165309124Sdim T->getStmtClass() == OMPTargetParallelForDirectiveClass || 1166309124Sdim T->getStmtClass() == OMPDistributeParallelForDirectiveClass || 1167309124Sdim T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass || 1168309124Sdim T->getStmtClass() == OMPDistributeSimdDirectiveClass || 1169314564Sdim T->getStmtClass() == OMPTargetParallelForSimdDirectiveClass || 1170314564Sdim T->getStmtClass() == OMPTargetSimdDirectiveClass || 1171314564Sdim T->getStmtClass() == OMPTeamsDistributeDirectiveClass || 1172314564Sdim T->getStmtClass() == OMPTeamsDistributeSimdDirectiveClass || 1173327952Sdim T->getStmtClass() == 1174327952Sdim OMPTeamsDistributeParallelForSimdDirectiveClass || 1175327952Sdim T->getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass || 1176327952Sdim T->getStmtClass() == 1177327952Sdim OMPTargetTeamsDistributeParallelForDirectiveClass || 1178327952Sdim T->getStmtClass() == 1179327952Sdim OMPTargetTeamsDistributeParallelForSimdDirectiveClass || 1180327952Sdim T->getStmtClass() == OMPTargetTeamsDistributeDirectiveClass || 1181327952Sdim T->getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass; 1182280031Sdim } 1183280031Sdim}; 1184280031Sdim 1185341825Sdim/// This represents '#pragma omp simd' directive. 1186259701Sdim/// 1187259701Sdim/// \code 1188276479Sdim/// #pragma omp simd private(a,b) linear(i,j:s) reduction(+:c,d) 1189259701Sdim/// \endcode 1190276479Sdim/// In this example directive '#pragma omp simd' has clauses 'private' 1191276479Sdim/// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and 1192276479Sdim/// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'. 1193259701Sdim/// 1194280031Sdimclass OMPSimdDirective : public OMPLoopDirective { 1195276479Sdim friend class ASTStmtReader; 1196341825Sdim /// Build directive with the given start and end location. 1197259701Sdim /// 1198276479Sdim /// \param StartLoc Starting location of the directive kind. 1199276479Sdim /// \param EndLoc Ending location of the directive. 1200276479Sdim /// \param CollapsedNum Number of collapsed nested loops. 1201276479Sdim /// \param NumClauses Number of clauses. 1202259701Sdim /// 1203276479Sdim OMPSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, 1204276479Sdim unsigned CollapsedNum, unsigned NumClauses) 1205360784Sdim : OMPLoopDirective(this, OMPSimdDirectiveClass, llvm::omp::OMPD_simd, 1206360784Sdim StartLoc, EndLoc, CollapsedNum, NumClauses) {} 1207259701Sdim 1208341825Sdim /// Build an empty directive. 1209259701Sdim /// 1210276479Sdim /// \param CollapsedNum Number of collapsed nested loops. 1211276479Sdim /// \param NumClauses Number of clauses. 1212259701Sdim /// 1213276479Sdim explicit OMPSimdDirective(unsigned CollapsedNum, unsigned NumClauses) 1214360784Sdim : OMPLoopDirective(this, OMPSimdDirectiveClass, llvm::omp::OMPD_simd, 1215280031Sdim SourceLocation(), SourceLocation(), CollapsedNum, 1216280031Sdim NumClauses) {} 1217276479Sdim 1218259701Sdimpublic: 1219341825Sdim /// Creates directive with a list of \a Clauses. 1220259701Sdim /// 1221276479Sdim /// \param C AST context. 1222276479Sdim /// \param StartLoc Starting location of the directive kind. 1223276479Sdim /// \param EndLoc Ending Location of the directive. 1224276479Sdim /// \param CollapsedNum Number of collapsed loops. 1225276479Sdim /// \param Clauses List of clauses. 1226276479Sdim /// \param AssociatedStmt Statement, associated with the directive. 1227280031Sdim /// \param Exprs Helper expressions for CodeGen. 1228259701Sdim /// 1229276479Sdim static OMPSimdDirective *Create(const ASTContext &C, SourceLocation StartLoc, 1230276479Sdim SourceLocation EndLoc, unsigned CollapsedNum, 1231276479Sdim ArrayRef<OMPClause *> Clauses, 1232280031Sdim Stmt *AssociatedStmt, 1233280031Sdim const HelperExprs &Exprs); 1234259701Sdim 1235341825Sdim /// Creates an empty directive with the place 1236276479Sdim /// for \a NumClauses clauses. 1237259701Sdim /// 1238276479Sdim /// \param C AST context. 1239276479Sdim /// \param CollapsedNum Number of collapsed nested loops. 1240276479Sdim /// \param NumClauses Number of clauses. 1241276479Sdim /// 1242276479Sdim static OMPSimdDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses, 1243276479Sdim unsigned CollapsedNum, EmptyShell); 1244259701Sdim 1245276479Sdim static bool classof(const Stmt *T) { 1246276479Sdim return T->getStmtClass() == OMPSimdDirectiveClass; 1247276479Sdim } 1248276479Sdim}; 1249259701Sdim 1250341825Sdim/// This represents '#pragma omp for' directive. 1251276479Sdim/// 1252276479Sdim/// \code 1253276479Sdim/// #pragma omp for private(a,b) reduction(+:c,d) 1254276479Sdim/// \endcode 1255276479Sdim/// In this example directive '#pragma omp for' has clauses 'private' with the 1256276479Sdim/// variables 'a' and 'b' and 'reduction' with operator '+' and variables 'c' 1257276479Sdim/// and 'd'. 1258276479Sdim/// 1259280031Sdimclass OMPForDirective : public OMPLoopDirective { 1260276479Sdim friend class ASTStmtReader; 1261296417Sdim 1262341825Sdim /// true if current directive has inner cancel directive. 1263296417Sdim bool HasCancel; 1264296417Sdim 1265341825Sdim /// Build directive with the given start and end location. 1266276479Sdim /// 1267276479Sdim /// \param StartLoc Starting location of the directive kind. 1268276479Sdim /// \param EndLoc Ending location of the directive. 1269276479Sdim /// \param CollapsedNum Number of collapsed nested loops. 1270276479Sdim /// \param NumClauses Number of clauses. 1271276479Sdim /// 1272276479Sdim OMPForDirective(SourceLocation StartLoc, SourceLocation EndLoc, 1273276479Sdim unsigned CollapsedNum, unsigned NumClauses) 1274360784Sdim : OMPLoopDirective(this, OMPForDirectiveClass, llvm::omp::OMPD_for, 1275360784Sdim StartLoc, EndLoc, CollapsedNum, NumClauses), 1276296417Sdim HasCancel(false) {} 1277259701Sdim 1278341825Sdim /// Build an empty directive. 1279276479Sdim /// 1280276479Sdim /// \param CollapsedNum Number of collapsed nested loops. 1281276479Sdim /// \param NumClauses Number of clauses. 1282276479Sdim /// 1283276479Sdim explicit OMPForDirective(unsigned CollapsedNum, unsigned NumClauses) 1284360784Sdim : OMPLoopDirective(this, OMPForDirectiveClass, llvm::omp::OMPD_for, 1285360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, 1286360784Sdim NumClauses), 1287296417Sdim HasCancel(false) {} 1288259701Sdim 1289341825Sdim /// Set cancel state. 1290296417Sdim void setHasCancel(bool Has) { HasCancel = Has; } 1291296417Sdim 1292276479Sdimpublic: 1293341825Sdim /// Creates directive with a list of \a Clauses. 1294276479Sdim /// 1295276479Sdim /// \param C AST context. 1296276479Sdim /// \param StartLoc Starting location of the directive kind. 1297276479Sdim /// \param EndLoc Ending Location of the directive. 1298276479Sdim /// \param CollapsedNum Number of collapsed loops. 1299276479Sdim /// \param Clauses List of clauses. 1300276479Sdim /// \param AssociatedStmt Statement, associated with the directive. 1301280031Sdim /// \param Exprs Helper expressions for CodeGen. 1302296417Sdim /// \param HasCancel true if current directive has inner cancel directive. 1303276479Sdim /// 1304276479Sdim static OMPForDirective *Create(const ASTContext &C, SourceLocation StartLoc, 1305276479Sdim SourceLocation EndLoc, unsigned CollapsedNum, 1306276479Sdim ArrayRef<OMPClause *> Clauses, 1307296417Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs, 1308296417Sdim bool HasCancel); 1309276479Sdim 1310341825Sdim /// Creates an empty directive with the place 1311276479Sdim /// for \a NumClauses clauses. 1312276479Sdim /// 1313276479Sdim /// \param C AST context. 1314276479Sdim /// \param CollapsedNum Number of collapsed nested loops. 1315276479Sdim /// \param NumClauses Number of clauses. 1316276479Sdim /// 1317276479Sdim static OMPForDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses, 1318276479Sdim unsigned CollapsedNum, EmptyShell); 1319276479Sdim 1320341825Sdim /// Return true if current directive has inner cancel directive. 1321296417Sdim bool hasCancel() const { return HasCancel; } 1322296417Sdim 1323276479Sdim static bool classof(const Stmt *T) { 1324276479Sdim return T->getStmtClass() == OMPForDirectiveClass; 1325259701Sdim } 1326259701Sdim}; 1327259701Sdim 1328341825Sdim/// This represents '#pragma omp for simd' directive. 1329280031Sdim/// 1330280031Sdim/// \code 1331280031Sdim/// #pragma omp for simd private(a,b) linear(i,j:s) reduction(+:c,d) 1332280031Sdim/// \endcode 1333280031Sdim/// In this example directive '#pragma omp for simd' has clauses 'private' 1334280031Sdim/// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and 1335280031Sdim/// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'. 1336280031Sdim/// 1337280031Sdimclass OMPForSimdDirective : public OMPLoopDirective { 1338280031Sdim friend class ASTStmtReader; 1339341825Sdim /// Build directive with the given start and end location. 1340280031Sdim /// 1341280031Sdim /// \param StartLoc Starting location of the directive kind. 1342280031Sdim /// \param EndLoc Ending location of the directive. 1343280031Sdim /// \param CollapsedNum Number of collapsed nested loops. 1344280031Sdim /// \param NumClauses Number of clauses. 1345280031Sdim /// 1346280031Sdim OMPForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, 1347280031Sdim unsigned CollapsedNum, unsigned NumClauses) 1348360784Sdim : OMPLoopDirective(this, OMPForSimdDirectiveClass, 1349360784Sdim llvm::omp::OMPD_for_simd, StartLoc, EndLoc, 1350360784Sdim CollapsedNum, NumClauses) {} 1351280031Sdim 1352341825Sdim /// Build an empty directive. 1353280031Sdim /// 1354280031Sdim /// \param CollapsedNum Number of collapsed nested loops. 1355280031Sdim /// \param NumClauses Number of clauses. 1356280031Sdim /// 1357280031Sdim explicit OMPForSimdDirective(unsigned CollapsedNum, unsigned NumClauses) 1358360784Sdim : OMPLoopDirective(this, OMPForSimdDirectiveClass, 1359360784Sdim llvm::omp::OMPD_for_simd, SourceLocation(), 1360360784Sdim SourceLocation(), CollapsedNum, NumClauses) {} 1361280031Sdim 1362280031Sdimpublic: 1363341825Sdim /// Creates directive with a list of \a Clauses. 1364280031Sdim /// 1365280031Sdim /// \param C AST context. 1366280031Sdim /// \param StartLoc Starting location of the directive kind. 1367280031Sdim /// \param EndLoc Ending Location of the directive. 1368280031Sdim /// \param CollapsedNum Number of collapsed loops. 1369280031Sdim /// \param Clauses List of clauses. 1370280031Sdim /// \param AssociatedStmt Statement, associated with the directive. 1371280031Sdim /// \param Exprs Helper expressions for CodeGen. 1372280031Sdim /// 1373280031Sdim static OMPForSimdDirective * 1374280031Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1375280031Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 1376280031Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 1377280031Sdim 1378341825Sdim /// Creates an empty directive with the place 1379280031Sdim /// for \a NumClauses clauses. 1380280031Sdim /// 1381280031Sdim /// \param C AST context. 1382280031Sdim /// \param CollapsedNum Number of collapsed nested loops. 1383280031Sdim /// \param NumClauses Number of clauses. 1384280031Sdim /// 1385280031Sdim static OMPForSimdDirective *CreateEmpty(const ASTContext &C, 1386280031Sdim unsigned NumClauses, 1387280031Sdim unsigned CollapsedNum, EmptyShell); 1388280031Sdim 1389280031Sdim static bool classof(const Stmt *T) { 1390280031Sdim return T->getStmtClass() == OMPForSimdDirectiveClass; 1391280031Sdim } 1392280031Sdim}; 1393280031Sdim 1394341825Sdim/// This represents '#pragma omp sections' directive. 1395259701Sdim/// 1396259701Sdim/// \code 1397276479Sdim/// #pragma omp sections private(a,b) reduction(+:c,d) 1398259701Sdim/// \endcode 1399276479Sdim/// In this example directive '#pragma omp sections' has clauses 'private' with 1400276479Sdim/// the variables 'a' and 'b' and 'reduction' with operator '+' and variables 1401276479Sdim/// 'c' and 'd'. 1402259701Sdim/// 1403276479Sdimclass OMPSectionsDirective : public OMPExecutableDirective { 1404276479Sdim friend class ASTStmtReader; 1405296417Sdim 1406341825Sdim /// true if current directive has inner cancel directive. 1407296417Sdim bool HasCancel; 1408296417Sdim 1409341825Sdim /// Build directive with the given start and end location. 1410259701Sdim /// 1411276479Sdim /// \param StartLoc Starting location of the directive kind. 1412276479Sdim /// \param EndLoc Ending location of the directive. 1413276479Sdim /// \param NumClauses Number of clauses. 1414259701Sdim /// 1415276479Sdim OMPSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc, 1416276479Sdim unsigned NumClauses) 1417360784Sdim : OMPExecutableDirective(this, OMPSectionsDirectiveClass, 1418360784Sdim llvm::omp::OMPD_sections, StartLoc, EndLoc, 1419360784Sdim NumClauses, 1), 1420296417Sdim HasCancel(false) {} 1421259701Sdim 1422341825Sdim /// Build an empty directive. 1423259701Sdim /// 1424276479Sdim /// \param NumClauses Number of clauses. 1425259701Sdim /// 1426276479Sdim explicit OMPSectionsDirective(unsigned NumClauses) 1427360784Sdim : OMPExecutableDirective(this, OMPSectionsDirectiveClass, 1428360784Sdim llvm::omp::OMPD_sections, SourceLocation(), 1429360784Sdim SourceLocation(), NumClauses, 1), 1430296417Sdim HasCancel(false) {} 1431276479Sdim 1432341825Sdim /// Set cancel state. 1433296417Sdim void setHasCancel(bool Has) { HasCancel = Has; } 1434296417Sdim 1435259701Sdimpublic: 1436341825Sdim /// Creates directive with a list of \a Clauses. 1437259701Sdim /// 1438259701Sdim /// \param C AST context. 1439276479Sdim /// \param StartLoc Starting location of the directive kind. 1440276479Sdim /// \param EndLoc Ending Location of the directive. 1441276479Sdim /// \param Clauses List of clauses. 1442276479Sdim /// \param AssociatedStmt Statement, associated with the directive. 1443296417Sdim /// \param HasCancel true if current directive has inner directive. 1444259701Sdim /// 1445276479Sdim static OMPSectionsDirective * 1446276479Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1447296417Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel); 1448276479Sdim 1449341825Sdim /// Creates an empty directive with the place for \a NumClauses 1450276479Sdim /// clauses. 1451259701Sdim /// 1452259701Sdim /// \param C AST context. 1453276479Sdim /// \param NumClauses Number of clauses. 1454259701Sdim /// 1455276479Sdim static OMPSectionsDirective *CreateEmpty(const ASTContext &C, 1456276479Sdim unsigned NumClauses, EmptyShell); 1457259701Sdim 1458341825Sdim /// Return true if current directive has inner cancel directive. 1459296417Sdim bool hasCancel() const { return HasCancel; } 1460296417Sdim 1461276479Sdim static bool classof(const Stmt *T) { 1462276479Sdim return T->getStmtClass() == OMPSectionsDirectiveClass; 1463259701Sdim } 1464276479Sdim}; 1465259701Sdim 1466341825Sdim/// This represents '#pragma omp section' directive. 1467276479Sdim/// 1468276479Sdim/// \code 1469276479Sdim/// #pragma omp section 1470276479Sdim/// \endcode 1471276479Sdim/// 1472276479Sdimclass OMPSectionDirective : public OMPExecutableDirective { 1473276479Sdim friend class ASTStmtReader; 1474296417Sdim 1475341825Sdim /// true if current directive has inner cancel directive. 1476296417Sdim bool HasCancel; 1477296417Sdim 1478341825Sdim /// Build directive with the given start and end location. 1479276479Sdim /// 1480276479Sdim /// \param StartLoc Starting location of the directive kind. 1481276479Sdim /// \param EndLoc Ending location of the directive. 1482276479Sdim /// 1483276479Sdim OMPSectionDirective(SourceLocation StartLoc, SourceLocation EndLoc) 1484360784Sdim : OMPExecutableDirective(this, OMPSectionDirectiveClass, 1485360784Sdim llvm::omp::OMPD_section, StartLoc, EndLoc, 0, 1), 1486296417Sdim HasCancel(false) {} 1487276479Sdim 1488341825Sdim /// Build an empty directive. 1489276479Sdim /// 1490276479Sdim explicit OMPSectionDirective() 1491360784Sdim : OMPExecutableDirective(this, OMPSectionDirectiveClass, 1492360784Sdim llvm::omp::OMPD_section, SourceLocation(), 1493360784Sdim SourceLocation(), 0, 1), 1494296417Sdim HasCancel(false) {} 1495276479Sdim 1496276479Sdimpublic: 1497341825Sdim /// Creates directive. 1498276479Sdim /// 1499276479Sdim /// \param C AST context. 1500276479Sdim /// \param StartLoc Starting location of the directive kind. 1501276479Sdim /// \param EndLoc Ending Location of the directive. 1502276479Sdim /// \param AssociatedStmt Statement, associated with the directive. 1503296417Sdim /// \param HasCancel true if current directive has inner directive. 1504276479Sdim /// 1505276479Sdim static OMPSectionDirective *Create(const ASTContext &C, 1506276479Sdim SourceLocation StartLoc, 1507276479Sdim SourceLocation EndLoc, 1508296417Sdim Stmt *AssociatedStmt, bool HasCancel); 1509276479Sdim 1510341825Sdim /// Creates an empty directive. 1511276479Sdim /// 1512276479Sdim /// \param C AST context. 1513276479Sdim /// 1514276479Sdim static OMPSectionDirective *CreateEmpty(const ASTContext &C, EmptyShell); 1515276479Sdim 1516341825Sdim /// Set cancel state. 1517296417Sdim void setHasCancel(bool Has) { HasCancel = Has; } 1518296417Sdim 1519341825Sdim /// Return true if current directive has inner cancel directive. 1520296417Sdim bool hasCancel() const { return HasCancel; } 1521296417Sdim 1522276479Sdim static bool classof(const Stmt *T) { 1523276479Sdim return T->getStmtClass() == OMPSectionDirectiveClass; 1524259701Sdim } 1525259701Sdim}; 1526259701Sdim 1527341825Sdim/// This represents '#pragma omp single' directive. 1528259701Sdim/// 1529259701Sdim/// \code 1530276479Sdim/// #pragma omp single private(a,b) copyprivate(c,d) 1531259701Sdim/// \endcode 1532276479Sdim/// In this example directive '#pragma omp single' has clauses 'private' with 1533276479Sdim/// the variables 'a' and 'b' and 'copyprivate' with variables 'c' and 'd'. 1534259701Sdim/// 1535276479Sdimclass OMPSingleDirective : public OMPExecutableDirective { 1536276479Sdim friend class ASTStmtReader; 1537341825Sdim /// Build directive with the given start and end location. 1538259701Sdim /// 1539276479Sdim /// \param StartLoc Starting location of the directive kind. 1540276479Sdim /// \param EndLoc Ending location of the directive. 1541276479Sdim /// \param NumClauses Number of clauses. 1542259701Sdim /// 1543276479Sdim OMPSingleDirective(SourceLocation StartLoc, SourceLocation EndLoc, 1544276479Sdim unsigned NumClauses) 1545360784Sdim : OMPExecutableDirective(this, OMPSingleDirectiveClass, 1546360784Sdim llvm::omp::OMPD_single, StartLoc, EndLoc, 1547360784Sdim NumClauses, 1) {} 1548259701Sdim 1549341825Sdim /// Build an empty directive. 1550259701Sdim /// 1551276479Sdim /// \param NumClauses Number of clauses. 1552259701Sdim /// 1553276479Sdim explicit OMPSingleDirective(unsigned NumClauses) 1554360784Sdim : OMPExecutableDirective(this, OMPSingleDirectiveClass, 1555360784Sdim llvm::omp::OMPD_single, SourceLocation(), 1556360784Sdim SourceLocation(), NumClauses, 1) {} 1557276479Sdim 1558259701Sdimpublic: 1559341825Sdim /// Creates directive with a list of \a Clauses. 1560259701Sdim /// 1561259701Sdim /// \param C AST context. 1562276479Sdim /// \param StartLoc Starting location of the directive kind. 1563276479Sdim /// \param EndLoc Ending Location of the directive. 1564276479Sdim /// \param Clauses List of clauses. 1565276479Sdim /// \param AssociatedStmt Statement, associated with the directive. 1566259701Sdim /// 1567276479Sdim static OMPSingleDirective * 1568276479Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1569276479Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); 1570276479Sdim 1571341825Sdim /// Creates an empty directive with the place for \a NumClauses 1572276479Sdim /// clauses. 1573259701Sdim /// 1574259701Sdim /// \param C AST context. 1575276479Sdim /// \param NumClauses Number of clauses. 1576259701Sdim /// 1577276479Sdim static OMPSingleDirective *CreateEmpty(const ASTContext &C, 1578276479Sdim unsigned NumClauses, EmptyShell); 1579259701Sdim 1580276479Sdim static bool classof(const Stmt *T) { 1581276479Sdim return T->getStmtClass() == OMPSingleDirectiveClass; 1582259701Sdim } 1583276479Sdim}; 1584259701Sdim 1585341825Sdim/// This represents '#pragma omp master' directive. 1586276479Sdim/// 1587276479Sdim/// \code 1588276479Sdim/// #pragma omp master 1589276479Sdim/// \endcode 1590276479Sdim/// 1591276479Sdimclass OMPMasterDirective : public OMPExecutableDirective { 1592276479Sdim friend class ASTStmtReader; 1593341825Sdim /// Build directive with the given start and end location. 1594276479Sdim /// 1595276479Sdim /// \param StartLoc Starting location of the directive kind. 1596276479Sdim /// \param EndLoc Ending location of the directive. 1597276479Sdim /// 1598276479Sdim OMPMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc) 1599360784Sdim : OMPExecutableDirective(this, OMPMasterDirectiveClass, 1600360784Sdim llvm::omp::OMPD_master, StartLoc, EndLoc, 0, 1) { 1601360784Sdim } 1602276479Sdim 1603341825Sdim /// Build an empty directive. 1604276479Sdim /// 1605276479Sdim explicit OMPMasterDirective() 1606360784Sdim : OMPExecutableDirective(this, OMPMasterDirectiveClass, 1607360784Sdim llvm::omp::OMPD_master, SourceLocation(), 1608360784Sdim SourceLocation(), 0, 1) {} 1609276479Sdim 1610276479Sdimpublic: 1611341825Sdim /// Creates directive. 1612276479Sdim /// 1613276479Sdim /// \param C AST context. 1614276479Sdim /// \param StartLoc Starting location of the directive kind. 1615276479Sdim /// \param EndLoc Ending Location of the directive. 1616276479Sdim /// \param AssociatedStmt Statement, associated with the directive. 1617276479Sdim /// 1618276479Sdim static OMPMasterDirective *Create(const ASTContext &C, 1619276479Sdim SourceLocation StartLoc, 1620276479Sdim SourceLocation EndLoc, 1621276479Sdim Stmt *AssociatedStmt); 1622276479Sdim 1623341825Sdim /// Creates an empty directive. 1624276479Sdim /// 1625276479Sdim /// \param C AST context. 1626276479Sdim /// 1627276479Sdim static OMPMasterDirective *CreateEmpty(const ASTContext &C, EmptyShell); 1628276479Sdim 1629276479Sdim static bool classof(const Stmt *T) { 1630276479Sdim return T->getStmtClass() == OMPMasterDirectiveClass; 1631259701Sdim } 1632259701Sdim}; 1633259701Sdim 1634341825Sdim/// This represents '#pragma omp critical' directive. 1635259701Sdim/// 1636259701Sdim/// \code 1637276479Sdim/// #pragma omp critical 1638259701Sdim/// \endcode 1639259701Sdim/// 1640276479Sdimclass OMPCriticalDirective : public OMPExecutableDirective { 1641276479Sdim friend class ASTStmtReader; 1642341825Sdim /// Name of the directive. 1643276479Sdim DeclarationNameInfo DirName; 1644341825Sdim /// Build directive with the given start and end location. 1645259701Sdim /// 1646276479Sdim /// \param Name Name of the directive. 1647276479Sdim /// \param StartLoc Starting location of the directive kind. 1648276479Sdim /// \param EndLoc Ending location of the directive. 1649296417Sdim /// \param NumClauses Number of clauses. 1650259701Sdim /// 1651276479Sdim OMPCriticalDirective(const DeclarationNameInfo &Name, SourceLocation StartLoc, 1652296417Sdim SourceLocation EndLoc, unsigned NumClauses) 1653360784Sdim : OMPExecutableDirective(this, OMPCriticalDirectiveClass, 1654360784Sdim llvm::omp::OMPD_critical, StartLoc, EndLoc, 1655360784Sdim NumClauses, 1), 1656276479Sdim DirName(Name) {} 1657259701Sdim 1658341825Sdim /// Build an empty directive. 1659259701Sdim /// 1660296417Sdim /// \param NumClauses Number of clauses. 1661296417Sdim /// 1662296417Sdim explicit OMPCriticalDirective(unsigned NumClauses) 1663360784Sdim : OMPExecutableDirective(this, OMPCriticalDirectiveClass, 1664360784Sdim llvm::omp::OMPD_critical, SourceLocation(), 1665360784Sdim SourceLocation(), NumClauses, 1), 1666276479Sdim DirName() {} 1667276479Sdim 1668341825Sdim /// Set name of the directive. 1669259701Sdim /// 1670276479Sdim /// \param Name Name of the directive. 1671276479Sdim /// 1672276479Sdim void setDirectiveName(const DeclarationNameInfo &Name) { DirName = Name; } 1673276479Sdim 1674259701Sdimpublic: 1675341825Sdim /// Creates directive. 1676259701Sdim /// 1677259701Sdim /// \param C AST context. 1678276479Sdim /// \param Name Name of the directive. 1679276479Sdim /// \param StartLoc Starting location of the directive kind. 1680276479Sdim /// \param EndLoc Ending Location of the directive. 1681296417Sdim /// \param Clauses List of clauses. 1682276479Sdim /// \param AssociatedStmt Statement, associated with the directive. 1683259701Sdim /// 1684276479Sdim static OMPCriticalDirective * 1685276479Sdim Create(const ASTContext &C, const DeclarationNameInfo &Name, 1686296417Sdim SourceLocation StartLoc, SourceLocation EndLoc, 1687296417Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); 1688276479Sdim 1689341825Sdim /// Creates an empty directive. 1690259701Sdim /// 1691259701Sdim /// \param C AST context. 1692296417Sdim /// \param NumClauses Number of clauses. 1693259701Sdim /// 1694296417Sdim static OMPCriticalDirective *CreateEmpty(const ASTContext &C, 1695296417Sdim unsigned NumClauses, EmptyShell); 1696259701Sdim 1697341825Sdim /// Return name of the directive. 1698276479Sdim /// 1699276479Sdim DeclarationNameInfo getDirectiveName() const { return DirName; } 1700259701Sdim 1701276479Sdim static bool classof(const Stmt *T) { 1702276479Sdim return T->getStmtClass() == OMPCriticalDirectiveClass; 1703259701Sdim } 1704259701Sdim}; 1705259701Sdim 1706341825Sdim/// This represents '#pragma omp parallel for' directive. 1707259701Sdim/// 1708276479Sdim/// \code 1709276479Sdim/// #pragma omp parallel for private(a,b) reduction(+:c,d) 1710276479Sdim/// \endcode 1711276479Sdim/// In this example directive '#pragma omp parallel for' has clauses 'private' 1712276479Sdim/// with the variables 'a' and 'b' and 'reduction' with operator '+' and 1713276479Sdim/// variables 'c' and 'd'. 1714276479Sdim/// 1715280031Sdimclass OMPParallelForDirective : public OMPLoopDirective { 1716259701Sdim friend class ASTStmtReader; 1717296417Sdim 1718341825Sdim /// true if current region has inner cancel directive. 1719296417Sdim bool HasCancel; 1720296417Sdim 1721341825Sdim /// Build directive with the given start and end location. 1722259701Sdim /// 1723276479Sdim /// \param StartLoc Starting location of the directive kind. 1724259701Sdim /// \param EndLoc Ending location of the directive. 1725276479Sdim /// \param CollapsedNum Number of collapsed nested loops. 1726276479Sdim /// \param NumClauses Number of clauses. 1727259701Sdim /// 1728276479Sdim OMPParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc, 1729276479Sdim unsigned CollapsedNum, unsigned NumClauses) 1730360784Sdim : OMPLoopDirective(this, OMPParallelForDirectiveClass, 1731360784Sdim llvm::omp::OMPD_parallel_for, StartLoc, EndLoc, 1732360784Sdim CollapsedNum, NumClauses), 1733296417Sdim HasCancel(false) {} 1734259701Sdim 1735341825Sdim /// Build an empty directive. 1736259701Sdim /// 1737276479Sdim /// \param CollapsedNum Number of collapsed nested loops. 1738276479Sdim /// \param NumClauses Number of clauses. 1739259701Sdim /// 1740276479Sdim explicit OMPParallelForDirective(unsigned CollapsedNum, unsigned NumClauses) 1741360784Sdim : OMPLoopDirective(this, OMPParallelForDirectiveClass, 1742360784Sdim llvm::omp::OMPD_parallel_for, SourceLocation(), 1743360784Sdim SourceLocation(), CollapsedNum, NumClauses), 1744296417Sdim HasCancel(false) {} 1745259701Sdim 1746341825Sdim /// Set cancel state. 1747296417Sdim void setHasCancel(bool Has) { HasCancel = Has; } 1748296417Sdim 1749276479Sdimpublic: 1750341825Sdim /// Creates directive with a list of \a Clauses. 1751259701Sdim /// 1752276479Sdim /// \param C AST context. 1753276479Sdim /// \param StartLoc Starting location of the directive kind. 1754276479Sdim /// \param EndLoc Ending Location of the directive. 1755276479Sdim /// \param CollapsedNum Number of collapsed loops. 1756276479Sdim /// \param Clauses List of clauses. 1757276479Sdim /// \param AssociatedStmt Statement, associated with the directive. 1758280031Sdim /// \param Exprs Helper expressions for CodeGen. 1759296417Sdim /// \param HasCancel true if current directive has inner cancel directive. 1760259701Sdim /// 1761276479Sdim static OMPParallelForDirective * 1762276479Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1763276479Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 1764296417Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel); 1765276479Sdim 1766341825Sdim /// Creates an empty directive with the place 1767276479Sdim /// for \a NumClauses clauses. 1768276479Sdim /// 1769276479Sdim /// \param C AST context. 1770276479Sdim /// \param CollapsedNum Number of collapsed nested loops. 1771276479Sdim /// \param NumClauses Number of clauses. 1772276479Sdim /// 1773276479Sdim static OMPParallelForDirective *CreateEmpty(const ASTContext &C, 1774276479Sdim unsigned NumClauses, 1775276479Sdim unsigned CollapsedNum, 1776276479Sdim EmptyShell); 1777276479Sdim 1778341825Sdim /// Return true if current directive has inner cancel directive. 1779296417Sdim bool hasCancel() const { return HasCancel; } 1780296417Sdim 1781276479Sdim static bool classof(const Stmt *T) { 1782276479Sdim return T->getStmtClass() == OMPParallelForDirectiveClass; 1783259701Sdim } 1784276479Sdim}; 1785259701Sdim 1786341825Sdim/// This represents '#pragma omp parallel for simd' directive. 1787280031Sdim/// 1788280031Sdim/// \code 1789280031Sdim/// #pragma omp parallel for simd private(a,b) linear(i,j:s) reduction(+:c,d) 1790280031Sdim/// \endcode 1791280031Sdim/// In this example directive '#pragma omp parallel for simd' has clauses 1792280031Sdim/// 'private' with the variables 'a' and 'b', 'linear' with variables 'i', 'j' 1793280031Sdim/// and linear step 's', 'reduction' with operator '+' and variables 'c' and 1794280031Sdim/// 'd'. 1795280031Sdim/// 1796280031Sdimclass OMPParallelForSimdDirective : public OMPLoopDirective { 1797280031Sdim friend class ASTStmtReader; 1798341825Sdim /// Build directive with the given start and end location. 1799280031Sdim /// 1800280031Sdim /// \param StartLoc Starting location of the directive kind. 1801280031Sdim /// \param EndLoc Ending location of the directive. 1802280031Sdim /// \param CollapsedNum Number of collapsed nested loops. 1803280031Sdim /// \param NumClauses Number of clauses. 1804280031Sdim /// 1805280031Sdim OMPParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, 1806280031Sdim unsigned CollapsedNum, unsigned NumClauses) 1807280031Sdim : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass, 1808360784Sdim llvm::omp::OMPD_parallel_for_simd, StartLoc, EndLoc, 1809360784Sdim CollapsedNum, NumClauses) {} 1810280031Sdim 1811341825Sdim /// Build an empty directive. 1812280031Sdim /// 1813280031Sdim /// \param CollapsedNum Number of collapsed nested loops. 1814280031Sdim /// \param NumClauses Number of clauses. 1815280031Sdim /// 1816280031Sdim explicit OMPParallelForSimdDirective(unsigned CollapsedNum, 1817280031Sdim unsigned NumClauses) 1818280031Sdim : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass, 1819360784Sdim llvm::omp::OMPD_parallel_for_simd, SourceLocation(), 1820280031Sdim SourceLocation(), CollapsedNum, NumClauses) {} 1821280031Sdim 1822280031Sdimpublic: 1823341825Sdim /// Creates directive with a list of \a Clauses. 1824280031Sdim /// 1825280031Sdim /// \param C AST context. 1826280031Sdim /// \param StartLoc Starting location of the directive kind. 1827280031Sdim /// \param EndLoc Ending Location of the directive. 1828280031Sdim /// \param CollapsedNum Number of collapsed loops. 1829280031Sdim /// \param Clauses List of clauses. 1830280031Sdim /// \param AssociatedStmt Statement, associated with the directive. 1831280031Sdim /// \param Exprs Helper expressions for CodeGen. 1832280031Sdim /// 1833280031Sdim static OMPParallelForSimdDirective * 1834280031Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1835280031Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 1836280031Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 1837280031Sdim 1838341825Sdim /// Creates an empty directive with the place 1839280031Sdim /// for \a NumClauses clauses. 1840280031Sdim /// 1841280031Sdim /// \param C AST context. 1842280031Sdim /// \param CollapsedNum Number of collapsed nested loops. 1843280031Sdim /// \param NumClauses Number of clauses. 1844280031Sdim /// 1845280031Sdim static OMPParallelForSimdDirective *CreateEmpty(const ASTContext &C, 1846280031Sdim unsigned NumClauses, 1847280031Sdim unsigned CollapsedNum, 1848280031Sdim EmptyShell); 1849280031Sdim 1850280031Sdim static bool classof(const Stmt *T) { 1851280031Sdim return T->getStmtClass() == OMPParallelForSimdDirectiveClass; 1852280031Sdim } 1853280031Sdim}; 1854280031Sdim 1855360784Sdim/// This represents '#pragma omp parallel master' directive. 1856360784Sdim/// 1857360784Sdim/// \code 1858360784Sdim/// #pragma omp parallel master private(a,b) 1859360784Sdim/// \endcode 1860360784Sdim/// In this example directive '#pragma omp parallel master' has clauses 1861360784Sdim/// 'private' with the variables 'a' and 'b' 1862360784Sdim/// 1863360784Sdimclass OMPParallelMasterDirective : public OMPExecutableDirective { 1864360784Sdim friend class ASTStmtReader; 1865360784Sdim 1866360784Sdim OMPParallelMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc, 1867360784Sdim unsigned NumClauses) 1868360784Sdim : OMPExecutableDirective(this, OMPParallelMasterDirectiveClass, 1869360784Sdim llvm::omp::OMPD_parallel_master, StartLoc, 1870360784Sdim EndLoc, NumClauses, 1) {} 1871360784Sdim 1872360784Sdim explicit OMPParallelMasterDirective(unsigned NumClauses) 1873360784Sdim : OMPExecutableDirective(this, OMPParallelMasterDirectiveClass, 1874360784Sdim llvm::omp::OMPD_parallel_master, 1875360784Sdim SourceLocation(), SourceLocation(), NumClauses, 1876360784Sdim 1) {} 1877360784Sdim 1878360784Sdimpublic: 1879360784Sdim /// Creates directive with a list of \a Clauses. 1880360784Sdim /// 1881360784Sdim /// \param C AST context. 1882360784Sdim /// \param StartLoc Starting location of the directive kind. 1883360784Sdim /// \param EndLoc Ending Location of the directive. 1884360784Sdim /// \param Clauses List of clauses. 1885360784Sdim /// \param AssociatedStmt Statement, associated with the directive. 1886360784Sdim /// 1887360784Sdim static OMPParallelMasterDirective * 1888360784Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1889360784Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); 1890360784Sdim 1891360784Sdim /// Creates an empty directive with the place for \a NumClauses 1892360784Sdim /// clauses. 1893360784Sdim /// 1894360784Sdim /// \param C AST context. 1895360784Sdim /// \param NumClauses Number of clauses. 1896360784Sdim /// 1897360784Sdim static OMPParallelMasterDirective * 1898360784Sdim CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell); 1899360784Sdim 1900360784Sdim static bool classof(const Stmt *T) { 1901360784Sdim return T->getStmtClass() == OMPParallelMasterDirectiveClass; 1902360784Sdim } 1903360784Sdim}; 1904360784Sdim 1905341825Sdim/// This represents '#pragma omp parallel sections' directive. 1906276479Sdim/// 1907276479Sdim/// \code 1908276479Sdim/// #pragma omp parallel sections private(a,b) reduction(+:c,d) 1909276479Sdim/// \endcode 1910276479Sdim/// In this example directive '#pragma omp parallel sections' has clauses 1911276479Sdim/// 'private' with the variables 'a' and 'b' and 'reduction' with operator '+' 1912276479Sdim/// and variables 'c' and 'd'. 1913276479Sdim/// 1914276479Sdimclass OMPParallelSectionsDirective : public OMPExecutableDirective { 1915276479Sdim friend class ASTStmtReader; 1916296417Sdim 1917341825Sdim /// true if current directive has inner cancel directive. 1918296417Sdim bool HasCancel; 1919296417Sdim 1920341825Sdim /// Build directive with the given start and end location. 1921276479Sdim /// 1922276479Sdim /// \param StartLoc Starting location of the directive kind. 1923276479Sdim /// \param EndLoc Ending location of the directive. 1924276479Sdim /// \param NumClauses Number of clauses. 1925276479Sdim /// 1926276479Sdim OMPParallelSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc, 1927276479Sdim unsigned NumClauses) 1928276479Sdim : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass, 1929360784Sdim llvm::omp::OMPD_parallel_sections, StartLoc, 1930360784Sdim EndLoc, NumClauses, 1), 1931296417Sdim HasCancel(false) {} 1932276479Sdim 1933341825Sdim /// Build an empty directive. 1934276479Sdim /// 1935276479Sdim /// \param NumClauses Number of clauses. 1936276479Sdim /// 1937276479Sdim explicit OMPParallelSectionsDirective(unsigned NumClauses) 1938276479Sdim : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass, 1939360784Sdim llvm::omp::OMPD_parallel_sections, 1940360784Sdim SourceLocation(), SourceLocation(), NumClauses, 1941360784Sdim 1), 1942296417Sdim HasCancel(false) {} 1943276479Sdim 1944341825Sdim /// Set cancel state. 1945296417Sdim void setHasCancel(bool Has) { HasCancel = Has; } 1946296417Sdim 1947259701Sdimpublic: 1948341825Sdim /// Creates directive with a list of \a Clauses. 1949276479Sdim /// 1950276479Sdim /// \param C AST context. 1951276479Sdim /// \param StartLoc Starting location of the directive kind. 1952276479Sdim /// \param EndLoc Ending Location of the directive. 1953276479Sdim /// \param Clauses List of clauses. 1954276479Sdim /// \param AssociatedStmt Statement, associated with the directive. 1955296417Sdim /// \param HasCancel true if current directive has inner cancel directive. 1956276479Sdim /// 1957276479Sdim static OMPParallelSectionsDirective * 1958276479Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 1959296417Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel); 1960259701Sdim 1961341825Sdim /// Creates an empty directive with the place for \a NumClauses 1962276479Sdim /// clauses. 1963259701Sdim /// 1964276479Sdim /// \param C AST context. 1965276479Sdim /// \param NumClauses Number of clauses. 1966259701Sdim /// 1967276479Sdim static OMPParallelSectionsDirective * 1968276479Sdim CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell); 1969276479Sdim 1970341825Sdim /// Return true if current directive has inner cancel directive. 1971296417Sdim bool hasCancel() const { return HasCancel; } 1972296417Sdim 1973276479Sdim static bool classof(const Stmt *T) { 1974276479Sdim return T->getStmtClass() == OMPParallelSectionsDirectiveClass; 1975276479Sdim } 1976276479Sdim}; 1977276479Sdim 1978341825Sdim/// This represents '#pragma omp task' directive. 1979276479Sdim/// 1980276479Sdim/// \code 1981276479Sdim/// #pragma omp task private(a,b) final(d) 1982276479Sdim/// \endcode 1983276479Sdim/// In this example directive '#pragma omp task' has clauses 'private' with the 1984276479Sdim/// variables 'a' and 'b' and 'final' with condition 'd'. 1985276479Sdim/// 1986276479Sdimclass OMPTaskDirective : public OMPExecutableDirective { 1987276479Sdim friend class ASTStmtReader; 1988341825Sdim /// true if this directive has inner cancel directive. 1989296417Sdim bool HasCancel; 1990296417Sdim 1991341825Sdim /// Build directive with the given start and end location. 1992259701Sdim /// 1993276479Sdim /// \param StartLoc Starting location of the directive kind. 1994276479Sdim /// \param EndLoc Ending location of the directive. 1995276479Sdim /// \param NumClauses Number of clauses. 1996259701Sdim /// 1997276479Sdim OMPTaskDirective(SourceLocation StartLoc, SourceLocation EndLoc, 1998276479Sdim unsigned NumClauses) 1999360784Sdim : OMPExecutableDirective(this, OMPTaskDirectiveClass, 2000360784Sdim llvm::omp::OMPD_task, StartLoc, EndLoc, 2001360784Sdim NumClauses, 1), 2002296417Sdim HasCancel(false) {} 2003259701Sdim 2004341825Sdim /// Build an empty directive. 2005276479Sdim /// 2006276479Sdim /// \param NumClauses Number of clauses. 2007276479Sdim /// 2008276479Sdim explicit OMPTaskDirective(unsigned NumClauses) 2009360784Sdim : OMPExecutableDirective(this, OMPTaskDirectiveClass, 2010360784Sdim llvm::omp::OMPD_task, SourceLocation(), 2011360784Sdim SourceLocation(), NumClauses, 1), 2012296417Sdim HasCancel(false) {} 2013259701Sdim 2014341825Sdim /// Set cancel state. 2015296417Sdim void setHasCancel(bool Has) { HasCancel = Has; } 2016296417Sdim 2017276479Sdimpublic: 2018341825Sdim /// Creates directive with a list of \a Clauses. 2019259701Sdim /// 2020276479Sdim /// \param C AST context. 2021276479Sdim /// \param StartLoc Starting location of the directive kind. 2022276479Sdim /// \param EndLoc Ending Location of the directive. 2023276479Sdim /// \param Clauses List of clauses. 2024276479Sdim /// \param AssociatedStmt Statement, associated with the directive. 2025296417Sdim /// \param HasCancel true, if current directive has inner cancel directive. 2026259701Sdim /// 2027276479Sdim static OMPTaskDirective *Create(const ASTContext &C, SourceLocation StartLoc, 2028276479Sdim SourceLocation EndLoc, 2029276479Sdim ArrayRef<OMPClause *> Clauses, 2030296417Sdim Stmt *AssociatedStmt, bool HasCancel); 2031259701Sdim 2032341825Sdim /// Creates an empty directive with the place for \a NumClauses 2033276479Sdim /// clauses. 2034276479Sdim /// 2035276479Sdim /// \param C AST context. 2036276479Sdim /// \param NumClauses Number of clauses. 2037276479Sdim /// 2038276479Sdim static OMPTaskDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses, 2039276479Sdim EmptyShell); 2040276479Sdim 2041341825Sdim /// Return true if current directive has inner cancel directive. 2042296417Sdim bool hasCancel() const { return HasCancel; } 2043296417Sdim 2044276479Sdim static bool classof(const Stmt *T) { 2045276479Sdim return T->getStmtClass() == OMPTaskDirectiveClass; 2046259701Sdim } 2047276479Sdim}; 2048259701Sdim 2049341825Sdim/// This represents '#pragma omp taskyield' directive. 2050276479Sdim/// 2051276479Sdim/// \code 2052276479Sdim/// #pragma omp taskyield 2053276479Sdim/// \endcode 2054276479Sdim/// 2055276479Sdimclass OMPTaskyieldDirective : public OMPExecutableDirective { 2056276479Sdim friend class ASTStmtReader; 2057341825Sdim /// Build directive with the given start and end location. 2058276479Sdim /// 2059276479Sdim /// \param StartLoc Starting location of the directive kind. 2060276479Sdim /// \param EndLoc Ending location of the directive. 2061276479Sdim /// 2062276479Sdim OMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc) 2063360784Sdim : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, 2064360784Sdim llvm::omp::OMPD_taskyield, StartLoc, EndLoc, 0, 2065360784Sdim 0) {} 2066259701Sdim 2067341825Sdim /// Build an empty directive. 2068276479Sdim /// 2069276479Sdim explicit OMPTaskyieldDirective() 2070360784Sdim : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, 2071360784Sdim llvm::omp::OMPD_taskyield, SourceLocation(), 2072360784Sdim SourceLocation(), 0, 0) {} 2073259701Sdim 2074276479Sdimpublic: 2075341825Sdim /// Creates directive. 2076276479Sdim /// 2077276479Sdim /// \param C AST context. 2078276479Sdim /// \param StartLoc Starting location of the directive kind. 2079276479Sdim /// \param EndLoc Ending Location of the directive. 2080276479Sdim /// 2081276479Sdim static OMPTaskyieldDirective * 2082276479Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc); 2083276479Sdim 2084341825Sdim /// Creates an empty directive. 2085276479Sdim /// 2086276479Sdim /// \param C AST context. 2087276479Sdim /// 2088276479Sdim static OMPTaskyieldDirective *CreateEmpty(const ASTContext &C, EmptyShell); 2089276479Sdim 2090276479Sdim static bool classof(const Stmt *T) { 2091276479Sdim return T->getStmtClass() == OMPTaskyieldDirectiveClass; 2092259701Sdim } 2093276479Sdim}; 2094259701Sdim 2095341825Sdim/// This represents '#pragma omp barrier' directive. 2096276479Sdim/// 2097276479Sdim/// \code 2098276479Sdim/// #pragma omp barrier 2099276479Sdim/// \endcode 2100276479Sdim/// 2101276479Sdimclass OMPBarrierDirective : public OMPExecutableDirective { 2102276479Sdim friend class ASTStmtReader; 2103341825Sdim /// Build directive with the given start and end location. 2104276479Sdim /// 2105276479Sdim /// \param StartLoc Starting location of the directive kind. 2106276479Sdim /// \param EndLoc Ending location of the directive. 2107276479Sdim /// 2108276479Sdim OMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc) 2109360784Sdim : OMPExecutableDirective(this, OMPBarrierDirectiveClass, 2110360784Sdim llvm::omp::OMPD_barrier, StartLoc, EndLoc, 0, 2111360784Sdim 0) {} 2112259701Sdim 2113341825Sdim /// Build an empty directive. 2114276479Sdim /// 2115276479Sdim explicit OMPBarrierDirective() 2116360784Sdim : OMPExecutableDirective(this, OMPBarrierDirectiveClass, 2117360784Sdim llvm::omp::OMPD_barrier, SourceLocation(), 2118360784Sdim SourceLocation(), 0, 0) {} 2119276479Sdim 2120276479Sdimpublic: 2121341825Sdim /// Creates directive. 2122276479Sdim /// 2123276479Sdim /// \param C AST context. 2124276479Sdim /// \param StartLoc Starting location of the directive kind. 2125276479Sdim /// \param EndLoc Ending Location of the directive. 2126276479Sdim /// 2127276479Sdim static OMPBarrierDirective * 2128276479Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc); 2129276479Sdim 2130341825Sdim /// Creates an empty directive. 2131276479Sdim /// 2132276479Sdim /// \param C AST context. 2133276479Sdim /// 2134276479Sdim static OMPBarrierDirective *CreateEmpty(const ASTContext &C, EmptyShell); 2135276479Sdim 2136276479Sdim static bool classof(const Stmt *T) { 2137276479Sdim return T->getStmtClass() == OMPBarrierDirectiveClass; 2138276479Sdim } 2139259701Sdim}; 2140259701Sdim 2141341825Sdim/// This represents '#pragma omp taskwait' directive. 2142259701Sdim/// 2143259701Sdim/// \code 2144276479Sdim/// #pragma omp taskwait 2145259701Sdim/// \endcode 2146259701Sdim/// 2147276479Sdimclass OMPTaskwaitDirective : public OMPExecutableDirective { 2148276479Sdim friend class ASTStmtReader; 2149341825Sdim /// Build directive with the given start and end location. 2150259701Sdim /// 2151276479Sdim /// \param StartLoc Starting location of the directive kind. 2152276479Sdim /// \param EndLoc Ending location of the directive. 2153276479Sdim /// 2154276479Sdim OMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc) 2155360784Sdim : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, 2156360784Sdim llvm::omp::OMPD_taskwait, StartLoc, EndLoc, 0, 2157360784Sdim 0) {} 2158276479Sdim 2159341825Sdim /// Build an empty directive. 2160276479Sdim /// 2161276479Sdim explicit OMPTaskwaitDirective() 2162360784Sdim : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, 2163360784Sdim llvm::omp::OMPD_taskwait, SourceLocation(), 2164360784Sdim SourceLocation(), 0, 0) {} 2165276479Sdim 2166276479Sdimpublic: 2167341825Sdim /// Creates directive. 2168276479Sdim /// 2169276479Sdim /// \param C AST context. 2170276479Sdim /// \param StartLoc Starting location of the directive kind. 2171259701Sdim /// \param EndLoc Ending Location of the directive. 2172259701Sdim /// 2173276479Sdim static OMPTaskwaitDirective * 2174276479Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc); 2175259701Sdim 2176341825Sdim /// Creates an empty directive. 2177276479Sdim /// 2178276479Sdim /// \param C AST context. 2179276479Sdim /// 2180276479Sdim static OMPTaskwaitDirective *CreateEmpty(const ASTContext &C, EmptyShell); 2181276479Sdim 2182276479Sdim static bool classof(const Stmt *T) { 2183276479Sdim return T->getStmtClass() == OMPTaskwaitDirectiveClass; 2184276479Sdim } 2185276479Sdim}; 2186276479Sdim 2187321369Sdim/// This represents '#pragma omp taskgroup' directive. 2188288943Sdim/// 2189288943Sdim/// \code 2190288943Sdim/// #pragma omp taskgroup 2191288943Sdim/// \endcode 2192288943Sdim/// 2193288943Sdimclass OMPTaskgroupDirective : public OMPExecutableDirective { 2194288943Sdim friend class ASTStmtReader; 2195321369Sdim /// Build directive with the given start and end location. 2196288943Sdim /// 2197288943Sdim /// \param StartLoc Starting location of the directive kind. 2198288943Sdim /// \param EndLoc Ending location of the directive. 2199321369Sdim /// \param NumClauses Number of clauses. 2200288943Sdim /// 2201321369Sdim OMPTaskgroupDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2202321369Sdim unsigned NumClauses) 2203360784Sdim : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, 2204360784Sdim llvm::omp::OMPD_taskgroup, StartLoc, EndLoc, 2205360784Sdim NumClauses, 2) {} 2206288943Sdim 2207321369Sdim /// Build an empty directive. 2208321369Sdim /// \param NumClauses Number of clauses. 2209288943Sdim /// 2210321369Sdim explicit OMPTaskgroupDirective(unsigned NumClauses) 2211360784Sdim : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, 2212360784Sdim llvm::omp::OMPD_taskgroup, SourceLocation(), 2213360784Sdim SourceLocation(), NumClauses, 2) {} 2214288943Sdim 2215327952Sdim /// Sets the task_reduction return variable. 2216327952Sdim void setReductionRef(Expr *RR) { 2217327952Sdim *std::next(child_begin(), 1) = RR; 2218327952Sdim } 2219327952Sdim 2220288943Sdimpublic: 2221321369Sdim /// Creates directive. 2222288943Sdim /// 2223288943Sdim /// \param C AST context. 2224288943Sdim /// \param StartLoc Starting location of the directive kind. 2225288943Sdim /// \param EndLoc Ending Location of the directive. 2226321369Sdim /// \param Clauses List of clauses. 2227288943Sdim /// \param AssociatedStmt Statement, associated with the directive. 2228327952Sdim /// \param ReductionRef Reference to the task_reduction return variable. 2229288943Sdim /// 2230321369Sdim static OMPTaskgroupDirective * 2231321369Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2232327952Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, 2233327952Sdim Expr *ReductionRef); 2234288943Sdim 2235321369Sdim /// Creates an empty directive. 2236288943Sdim /// 2237288943Sdim /// \param C AST context. 2238321369Sdim /// \param NumClauses Number of clauses. 2239288943Sdim /// 2240321369Sdim static OMPTaskgroupDirective *CreateEmpty(const ASTContext &C, 2241321369Sdim unsigned NumClauses, EmptyShell); 2242288943Sdim 2243327952Sdim 2244327952Sdim /// Returns reference to the task_reduction return variable. 2245327952Sdim const Expr *getReductionRef() const { 2246327952Sdim return static_cast<const Expr *>(*std::next(child_begin(), 1)); 2247327952Sdim } 2248327952Sdim Expr *getReductionRef() { 2249327952Sdim return static_cast<Expr *>(*std::next(child_begin(), 1)); 2250327952Sdim } 2251327952Sdim 2252288943Sdim static bool classof(const Stmt *T) { 2253288943Sdim return T->getStmtClass() == OMPTaskgroupDirectiveClass; 2254288943Sdim } 2255288943Sdim}; 2256288943Sdim 2257341825Sdim/// This represents '#pragma omp flush' directive. 2258276479Sdim/// 2259276479Sdim/// \code 2260276479Sdim/// #pragma omp flush(a,b) 2261276479Sdim/// \endcode 2262276479Sdim/// In this example directive '#pragma omp flush' has 2 arguments- variables 'a' 2263276479Sdim/// and 'b'. 2264276479Sdim/// 'omp flush' directive does not have clauses but have an optional list of 2265276479Sdim/// variables to flush. This list of variables is stored within some fake clause 2266276479Sdim/// FlushClause. 2267276479Sdimclass OMPFlushDirective : public OMPExecutableDirective { 2268276479Sdim friend class ASTStmtReader; 2269341825Sdim /// Build directive with the given start and end location. 2270276479Sdim /// 2271276479Sdim /// \param StartLoc Starting location of the directive kind. 2272276479Sdim /// \param EndLoc Ending location of the directive. 2273276479Sdim /// \param NumClauses Number of clauses. 2274276479Sdim /// 2275276479Sdim OMPFlushDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2276276479Sdim unsigned NumClauses) 2277360784Sdim : OMPExecutableDirective(this, OMPFlushDirectiveClass, 2278360784Sdim llvm::omp::OMPD_flush, StartLoc, EndLoc, 2279360784Sdim NumClauses, 0) {} 2280276479Sdim 2281341825Sdim /// Build an empty directive. 2282259701Sdim /// 2283276479Sdim /// \param NumClauses Number of clauses. 2284259701Sdim /// 2285276479Sdim explicit OMPFlushDirective(unsigned NumClauses) 2286360784Sdim : OMPExecutableDirective(this, OMPFlushDirectiveClass, 2287360784Sdim llvm::omp::OMPD_flush, SourceLocation(), 2288360784Sdim SourceLocation(), NumClauses, 0) {} 2289276479Sdim 2290259701Sdimpublic: 2291341825Sdim /// Creates directive with a list of \a Clauses. 2292259701Sdim /// 2293259701Sdim /// \param C AST context. 2294259701Sdim /// \param StartLoc Starting location of the directive kind. 2295259701Sdim /// \param EndLoc Ending Location of the directive. 2296276479Sdim /// \param Clauses List of clauses (only single OMPFlushClause clause is 2297276479Sdim /// allowed). 2298259701Sdim /// 2299276479Sdim static OMPFlushDirective *Create(const ASTContext &C, SourceLocation StartLoc, 2300276479Sdim SourceLocation EndLoc, 2301276479Sdim ArrayRef<OMPClause *> Clauses); 2302259701Sdim 2303341825Sdim /// Creates an empty directive with the place for \a NumClauses 2304276479Sdim /// clauses. 2305259701Sdim /// 2306259701Sdim /// \param C AST context. 2307276479Sdim /// \param NumClauses Number of clauses. 2308259701Sdim /// 2309276479Sdim static OMPFlushDirective *CreateEmpty(const ASTContext &C, 2310276479Sdim unsigned NumClauses, EmptyShell); 2311259701Sdim 2312259701Sdim static bool classof(const Stmt *T) { 2313276479Sdim return T->getStmtClass() == OMPFlushDirectiveClass; 2314259701Sdim } 2315259701Sdim}; 2316259701Sdim 2317341825Sdim/// This represents '#pragma omp ordered' directive. 2318280031Sdim/// 2319280031Sdim/// \code 2320280031Sdim/// #pragma omp ordered 2321280031Sdim/// \endcode 2322280031Sdim/// 2323280031Sdimclass OMPOrderedDirective : public OMPExecutableDirective { 2324280031Sdim friend class ASTStmtReader; 2325341825Sdim /// Build directive with the given start and end location. 2326280031Sdim /// 2327280031Sdim /// \param StartLoc Starting location of the directive kind. 2328280031Sdim /// \param EndLoc Ending location of the directive. 2329296417Sdim /// \param NumClauses Number of clauses. 2330280031Sdim /// 2331296417Sdim OMPOrderedDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2332296417Sdim unsigned NumClauses) 2333360784Sdim : OMPExecutableDirective(this, OMPOrderedDirectiveClass, 2334360784Sdim llvm::omp::OMPD_ordered, StartLoc, EndLoc, 2335360784Sdim NumClauses, 1) {} 2336280031Sdim 2337341825Sdim /// Build an empty directive. 2338280031Sdim /// 2339296417Sdim /// \param NumClauses Number of clauses. 2340296417Sdim /// 2341296417Sdim explicit OMPOrderedDirective(unsigned NumClauses) 2342360784Sdim : OMPExecutableDirective(this, OMPOrderedDirectiveClass, 2343360784Sdim llvm::omp::OMPD_ordered, SourceLocation(), 2344360784Sdim SourceLocation(), NumClauses, 1) {} 2345280031Sdim 2346280031Sdimpublic: 2347341825Sdim /// Creates directive. 2348280031Sdim /// 2349280031Sdim /// \param C AST context. 2350280031Sdim /// \param StartLoc Starting location of the directive kind. 2351280031Sdim /// \param EndLoc Ending Location of the directive. 2352296417Sdim /// \param Clauses List of clauses. 2353280031Sdim /// \param AssociatedStmt Statement, associated with the directive. 2354280031Sdim /// 2355296417Sdim static OMPOrderedDirective * 2356296417Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2357296417Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); 2358280031Sdim 2359341825Sdim /// Creates an empty directive. 2360280031Sdim /// 2361280031Sdim /// \param C AST context. 2362296417Sdim /// \param NumClauses Number of clauses. 2363280031Sdim /// 2364296417Sdim static OMPOrderedDirective *CreateEmpty(const ASTContext &C, 2365296417Sdim unsigned NumClauses, EmptyShell); 2366280031Sdim 2367280031Sdim static bool classof(const Stmt *T) { 2368280031Sdim return T->getStmtClass() == OMPOrderedDirectiveClass; 2369280031Sdim } 2370280031Sdim}; 2371280031Sdim 2372341825Sdim/// This represents '#pragma omp atomic' directive. 2373280031Sdim/// 2374280031Sdim/// \code 2375280031Sdim/// #pragma omp atomic capture 2376280031Sdim/// \endcode 2377280031Sdim/// In this example directive '#pragma omp atomic' has clause 'capture'. 2378280031Sdim/// 2379280031Sdimclass OMPAtomicDirective : public OMPExecutableDirective { 2380280031Sdim friend class ASTStmtReader; 2381341825Sdim /// Used for 'atomic update' or 'atomic capture' constructs. They may 2382288943Sdim /// have atomic expressions of forms 2383288943Sdim /// \code 2384288943Sdim /// x = x binop expr; 2385288943Sdim /// x = expr binop x; 2386288943Sdim /// \endcode 2387288943Sdim /// This field is true for the first form of the expression and false for the 2388288943Sdim /// second. Required for correct codegen of non-associative operations (like 2389288943Sdim /// << or >>). 2390288943Sdim bool IsXLHSInRHSPart; 2391341825Sdim /// Used for 'atomic update' or 'atomic capture' constructs. They may 2392288943Sdim /// have atomic expressions of forms 2393288943Sdim /// \code 2394288943Sdim /// v = x; <update x>; 2395288943Sdim /// <update x>; v = x; 2396288943Sdim /// \endcode 2397288943Sdim /// This field is true for the first(postfix) form of the expression and false 2398288943Sdim /// otherwise. 2399288943Sdim bool IsPostfixUpdate; 2400288943Sdim 2401341825Sdim /// Build directive with the given start and end location. 2402280031Sdim /// 2403280031Sdim /// \param StartLoc Starting location of the directive kind. 2404280031Sdim /// \param EndLoc Ending location of the directive. 2405280031Sdim /// \param NumClauses Number of clauses. 2406280031Sdim /// 2407280031Sdim OMPAtomicDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2408280031Sdim unsigned NumClauses) 2409360784Sdim : OMPExecutableDirective(this, OMPAtomicDirectiveClass, 2410360784Sdim llvm::omp::OMPD_atomic, StartLoc, EndLoc, 2411360784Sdim NumClauses, 5), 2412288943Sdim IsXLHSInRHSPart(false), IsPostfixUpdate(false) {} 2413280031Sdim 2414341825Sdim /// Build an empty directive. 2415280031Sdim /// 2416280031Sdim /// \param NumClauses Number of clauses. 2417280031Sdim /// 2418280031Sdim explicit OMPAtomicDirective(unsigned NumClauses) 2419360784Sdim : OMPExecutableDirective(this, OMPAtomicDirectiveClass, 2420360784Sdim llvm::omp::OMPD_atomic, SourceLocation(), 2421360784Sdim SourceLocation(), NumClauses, 5), 2422288943Sdim IsXLHSInRHSPart(false), IsPostfixUpdate(false) {} 2423280031Sdim 2424341825Sdim /// Set 'x' part of the associated expression/statement. 2425280031Sdim void setX(Expr *X) { *std::next(child_begin()) = X; } 2426341825Sdim /// Set helper expression of the form 2427288943Sdim /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or 2428288943Sdim /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'. 2429288943Sdim void setUpdateExpr(Expr *UE) { *std::next(child_begin(), 2) = UE; } 2430341825Sdim /// Set 'v' part of the associated expression/statement. 2431288943Sdim void setV(Expr *V) { *std::next(child_begin(), 3) = V; } 2432341825Sdim /// Set 'expr' part of the associated expression/statement. 2433288943Sdim void setExpr(Expr *E) { *std::next(child_begin(), 4) = E; } 2434280031Sdim 2435280031Sdimpublic: 2436341825Sdim /// Creates directive with a list of \a Clauses and 'x', 'v' and 'expr' 2437280031Sdim /// parts of the atomic construct (see Section 2.12.6, atomic Construct, for 2438280031Sdim /// detailed description of 'x', 'v' and 'expr'). 2439280031Sdim /// 2440280031Sdim /// \param C AST context. 2441280031Sdim /// \param StartLoc Starting location of the directive kind. 2442280031Sdim /// \param EndLoc Ending Location of the directive. 2443280031Sdim /// \param Clauses List of clauses. 2444280031Sdim /// \param AssociatedStmt Statement, associated with the directive. 2445280031Sdim /// \param X 'x' part of the associated expression/statement. 2446280031Sdim /// \param V 'v' part of the associated expression/statement. 2447280031Sdim /// \param E 'expr' part of the associated expression/statement. 2448288943Sdim /// \param UE Helper expression of the form 2449288943Sdim /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or 2450288943Sdim /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'. 2451288943Sdim /// \param IsXLHSInRHSPart true if \a UE has the first form and false if the 2452288943Sdim /// second. 2453288943Sdim /// \param IsPostfixUpdate true if original value of 'x' must be stored in 2454288943Sdim /// 'v', not an updated one. 2455280031Sdim static OMPAtomicDirective * 2456280031Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2457280031Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V, 2458288943Sdim Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate); 2459280031Sdim 2460341825Sdim /// Creates an empty directive with the place for \a NumClauses 2461280031Sdim /// clauses. 2462280031Sdim /// 2463280031Sdim /// \param C AST context. 2464280031Sdim /// \param NumClauses Number of clauses. 2465280031Sdim /// 2466280031Sdim static OMPAtomicDirective *CreateEmpty(const ASTContext &C, 2467280031Sdim unsigned NumClauses, EmptyShell); 2468280031Sdim 2469341825Sdim /// Get 'x' part of the associated expression/statement. 2470280031Sdim Expr *getX() { return cast_or_null<Expr>(*std::next(child_begin())); } 2471280031Sdim const Expr *getX() const { 2472280031Sdim return cast_or_null<Expr>(*std::next(child_begin())); 2473280031Sdim } 2474341825Sdim /// Get helper expression of the form 2475288943Sdim /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or 2476288943Sdim /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'. 2477288943Sdim Expr *getUpdateExpr() { 2478288943Sdim return cast_or_null<Expr>(*std::next(child_begin(), 2)); 2479288943Sdim } 2480288943Sdim const Expr *getUpdateExpr() const { 2481288943Sdim return cast_or_null<Expr>(*std::next(child_begin(), 2)); 2482288943Sdim } 2483341825Sdim /// Return true if helper update expression has form 2484288943Sdim /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' and false if it has form 2485288943Sdim /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'. 2486288943Sdim bool isXLHSInRHSPart() const { return IsXLHSInRHSPart; } 2487341825Sdim /// Return true if 'v' expression must be updated to original value of 2488288943Sdim /// 'x', false if 'v' must be updated to the new value of 'x'. 2489288943Sdim bool isPostfixUpdate() const { return IsPostfixUpdate; } 2490341825Sdim /// Get 'v' part of the associated expression/statement. 2491288943Sdim Expr *getV() { return cast_or_null<Expr>(*std::next(child_begin(), 3)); } 2492280031Sdim const Expr *getV() const { 2493288943Sdim return cast_or_null<Expr>(*std::next(child_begin(), 3)); 2494280031Sdim } 2495341825Sdim /// Get 'expr' part of the associated expression/statement. 2496288943Sdim Expr *getExpr() { return cast_or_null<Expr>(*std::next(child_begin(), 4)); } 2497280031Sdim const Expr *getExpr() const { 2498288943Sdim return cast_or_null<Expr>(*std::next(child_begin(), 4)); 2499280031Sdim } 2500280031Sdim 2501280031Sdim static bool classof(const Stmt *T) { 2502280031Sdim return T->getStmtClass() == OMPAtomicDirectiveClass; 2503280031Sdim } 2504280031Sdim}; 2505280031Sdim 2506341825Sdim/// This represents '#pragma omp target' directive. 2507280031Sdim/// 2508280031Sdim/// \code 2509280031Sdim/// #pragma omp target if(a) 2510280031Sdim/// \endcode 2511280031Sdim/// In this example directive '#pragma omp target' has clause 'if' with 2512280031Sdim/// condition 'a'. 2513280031Sdim/// 2514280031Sdimclass OMPTargetDirective : public OMPExecutableDirective { 2515280031Sdim friend class ASTStmtReader; 2516341825Sdim /// Build directive with the given start and end location. 2517280031Sdim /// 2518280031Sdim /// \param StartLoc Starting location of the directive kind. 2519280031Sdim /// \param EndLoc Ending location of the directive. 2520280031Sdim /// \param NumClauses Number of clauses. 2521280031Sdim /// 2522280031Sdim OMPTargetDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2523280031Sdim unsigned NumClauses) 2524360784Sdim : OMPExecutableDirective(this, OMPTargetDirectiveClass, 2525360784Sdim llvm::omp::OMPD_target, StartLoc, EndLoc, 2526360784Sdim NumClauses, 1) {} 2527280031Sdim 2528341825Sdim /// Build an empty directive. 2529280031Sdim /// 2530280031Sdim /// \param NumClauses Number of clauses. 2531280031Sdim /// 2532280031Sdim explicit OMPTargetDirective(unsigned NumClauses) 2533360784Sdim : OMPExecutableDirective(this, OMPTargetDirectiveClass, 2534360784Sdim llvm::omp::OMPD_target, SourceLocation(), 2535360784Sdim SourceLocation(), NumClauses, 1) {} 2536280031Sdim 2537280031Sdimpublic: 2538341825Sdim /// Creates directive with a list of \a Clauses. 2539280031Sdim /// 2540280031Sdim /// \param C AST context. 2541280031Sdim /// \param StartLoc Starting location of the directive kind. 2542280031Sdim /// \param EndLoc Ending Location of the directive. 2543280031Sdim /// \param Clauses List of clauses. 2544280031Sdim /// \param AssociatedStmt Statement, associated with the directive. 2545280031Sdim /// 2546280031Sdim static OMPTargetDirective * 2547280031Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2548280031Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); 2549280031Sdim 2550341825Sdim /// Creates an empty directive with the place for \a NumClauses 2551280031Sdim /// clauses. 2552280031Sdim /// 2553280031Sdim /// \param C AST context. 2554280031Sdim /// \param NumClauses Number of clauses. 2555280031Sdim /// 2556280031Sdim static OMPTargetDirective *CreateEmpty(const ASTContext &C, 2557280031Sdim unsigned NumClauses, EmptyShell); 2558280031Sdim 2559280031Sdim static bool classof(const Stmt *T) { 2560280031Sdim return T->getStmtClass() == OMPTargetDirectiveClass; 2561280031Sdim } 2562280031Sdim}; 2563280031Sdim 2564341825Sdim/// This represents '#pragma omp target data' directive. 2565296417Sdim/// 2566296417Sdim/// \code 2567296417Sdim/// #pragma omp target data device(0) if(a) map(b[:]) 2568296417Sdim/// \endcode 2569296417Sdim/// In this example directive '#pragma omp target data' has clauses 'device' 2570296417Sdim/// with the value '0', 'if' with condition 'a' and 'map' with array 2571296417Sdim/// section 'b[:]'. 2572296417Sdim/// 2573296417Sdimclass OMPTargetDataDirective : public OMPExecutableDirective { 2574296417Sdim friend class ASTStmtReader; 2575341825Sdim /// Build directive with the given start and end location. 2576296417Sdim /// 2577296417Sdim /// \param StartLoc Starting location of the directive kind. 2578296417Sdim /// \param EndLoc Ending Location of the directive. 2579296417Sdim /// \param NumClauses The number of clauses. 2580296417Sdim /// 2581296417Sdim OMPTargetDataDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2582296417Sdim unsigned NumClauses) 2583341825Sdim : OMPExecutableDirective(this, OMPTargetDataDirectiveClass, 2584360784Sdim llvm::omp::OMPD_target_data, StartLoc, EndLoc, 2585360784Sdim NumClauses, 1) {} 2586296417Sdim 2587341825Sdim /// Build an empty directive. 2588296417Sdim /// 2589296417Sdim /// \param NumClauses Number of clauses. 2590296417Sdim /// 2591296417Sdim explicit OMPTargetDataDirective(unsigned NumClauses) 2592341825Sdim : OMPExecutableDirective(this, OMPTargetDataDirectiveClass, 2593360784Sdim llvm::omp::OMPD_target_data, SourceLocation(), 2594296417Sdim SourceLocation(), NumClauses, 1) {} 2595296417Sdim 2596296417Sdimpublic: 2597341825Sdim /// Creates directive with a list of \a Clauses. 2598296417Sdim /// 2599296417Sdim /// \param C AST context. 2600296417Sdim /// \param StartLoc Starting location of the directive kind. 2601296417Sdim /// \param EndLoc Ending Location of the directive. 2602296417Sdim /// \param Clauses List of clauses. 2603296417Sdim /// \param AssociatedStmt Statement, associated with the directive. 2604296417Sdim /// 2605296417Sdim static OMPTargetDataDirective * 2606296417Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2607296417Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); 2608296417Sdim 2609341825Sdim /// Creates an empty directive with the place for \a N clauses. 2610296417Sdim /// 2611296417Sdim /// \param C AST context. 2612296417Sdim /// \param N The number of clauses. 2613296417Sdim /// 2614296417Sdim static OMPTargetDataDirective *CreateEmpty(const ASTContext &C, unsigned N, 2615296417Sdim EmptyShell); 2616296417Sdim 2617296417Sdim static bool classof(const Stmt *T) { 2618296417Sdim return T->getStmtClass() == OMPTargetDataDirectiveClass; 2619296417Sdim } 2620296417Sdim}; 2621296417Sdim 2622341825Sdim/// This represents '#pragma omp target enter data' directive. 2623309124Sdim/// 2624309124Sdim/// \code 2625309124Sdim/// #pragma omp target enter data device(0) if(a) map(b[:]) 2626309124Sdim/// \endcode 2627309124Sdim/// In this example directive '#pragma omp target enter data' has clauses 2628309124Sdim/// 'device' with the value '0', 'if' with condition 'a' and 'map' with array 2629309124Sdim/// section 'b[:]'. 2630309124Sdim/// 2631309124Sdimclass OMPTargetEnterDataDirective : public OMPExecutableDirective { 2632309124Sdim friend class ASTStmtReader; 2633341825Sdim /// Build directive with the given start and end location. 2634309124Sdim /// 2635309124Sdim /// \param StartLoc Starting location of the directive kind. 2636309124Sdim /// \param EndLoc Ending Location of the directive. 2637309124Sdim /// \param NumClauses The number of clauses. 2638309124Sdim /// 2639309124Sdim OMPTargetEnterDataDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2640309124Sdim unsigned NumClauses) 2641309124Sdim : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass, 2642360784Sdim llvm::omp::OMPD_target_enter_data, StartLoc, 2643360784Sdim EndLoc, NumClauses, /*NumChildren=*/1) {} 2644309124Sdim 2645341825Sdim /// Build an empty directive. 2646309124Sdim /// 2647309124Sdim /// \param NumClauses Number of clauses. 2648309124Sdim /// 2649309124Sdim explicit OMPTargetEnterDataDirective(unsigned NumClauses) 2650309124Sdim : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass, 2651360784Sdim llvm::omp::OMPD_target_enter_data, 2652360784Sdim SourceLocation(), SourceLocation(), NumClauses, 2653327952Sdim /*NumChildren=*/1) {} 2654309124Sdim 2655309124Sdimpublic: 2656341825Sdim /// Creates directive with a list of \a Clauses. 2657309124Sdim /// 2658309124Sdim /// \param C AST context. 2659309124Sdim /// \param StartLoc Starting location of the directive kind. 2660309124Sdim /// \param EndLoc Ending Location of the directive. 2661309124Sdim /// \param Clauses List of clauses. 2662327952Sdim /// \param AssociatedStmt Statement, associated with the directive. 2663309124Sdim /// 2664327952Sdim static OMPTargetEnterDataDirective * 2665327952Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2666327952Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); 2667309124Sdim 2668341825Sdim /// Creates an empty directive with the place for \a N clauses. 2669309124Sdim /// 2670309124Sdim /// \param C AST context. 2671309124Sdim /// \param N The number of clauses. 2672309124Sdim /// 2673309124Sdim static OMPTargetEnterDataDirective *CreateEmpty(const ASTContext &C, 2674309124Sdim unsigned N, EmptyShell); 2675309124Sdim 2676309124Sdim static bool classof(const Stmt *T) { 2677309124Sdim return T->getStmtClass() == OMPTargetEnterDataDirectiveClass; 2678309124Sdim } 2679309124Sdim}; 2680309124Sdim 2681341825Sdim/// This represents '#pragma omp target exit data' directive. 2682309124Sdim/// 2683309124Sdim/// \code 2684309124Sdim/// #pragma omp target exit data device(0) if(a) map(b[:]) 2685309124Sdim/// \endcode 2686309124Sdim/// In this example directive '#pragma omp target exit data' has clauses 2687309124Sdim/// 'device' with the value '0', 'if' with condition 'a' and 'map' with array 2688309124Sdim/// section 'b[:]'. 2689309124Sdim/// 2690309124Sdimclass OMPTargetExitDataDirective : public OMPExecutableDirective { 2691309124Sdim friend class ASTStmtReader; 2692341825Sdim /// Build directive with the given start and end location. 2693309124Sdim /// 2694309124Sdim /// \param StartLoc Starting location of the directive kind. 2695309124Sdim /// \param EndLoc Ending Location of the directive. 2696309124Sdim /// \param NumClauses The number of clauses. 2697309124Sdim /// 2698309124Sdim OMPTargetExitDataDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2699309124Sdim unsigned NumClauses) 2700309124Sdim : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass, 2701360784Sdim llvm::omp::OMPD_target_exit_data, StartLoc, 2702360784Sdim EndLoc, NumClauses, /*NumChildren=*/1) {} 2703309124Sdim 2704341825Sdim /// Build an empty directive. 2705309124Sdim /// 2706309124Sdim /// \param NumClauses Number of clauses. 2707309124Sdim /// 2708309124Sdim explicit OMPTargetExitDataDirective(unsigned NumClauses) 2709309124Sdim : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass, 2710360784Sdim llvm::omp::OMPD_target_exit_data, 2711360784Sdim SourceLocation(), SourceLocation(), NumClauses, 2712327952Sdim /*NumChildren=*/1) {} 2713309124Sdim 2714309124Sdimpublic: 2715341825Sdim /// Creates directive with a list of \a Clauses. 2716309124Sdim /// 2717309124Sdim /// \param C AST context. 2718309124Sdim /// \param StartLoc Starting location of the directive kind. 2719309124Sdim /// \param EndLoc Ending Location of the directive. 2720309124Sdim /// \param Clauses List of clauses. 2721327952Sdim /// \param AssociatedStmt Statement, associated with the directive. 2722309124Sdim /// 2723327952Sdim static OMPTargetExitDataDirective * 2724327952Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2725327952Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); 2726309124Sdim 2727341825Sdim /// Creates an empty directive with the place for \a N clauses. 2728309124Sdim /// 2729309124Sdim /// \param C AST context. 2730309124Sdim /// \param N The number of clauses. 2731309124Sdim /// 2732309124Sdim static OMPTargetExitDataDirective *CreateEmpty(const ASTContext &C, 2733309124Sdim unsigned N, EmptyShell); 2734309124Sdim 2735309124Sdim static bool classof(const Stmt *T) { 2736309124Sdim return T->getStmtClass() == OMPTargetExitDataDirectiveClass; 2737309124Sdim } 2738309124Sdim}; 2739309124Sdim 2740341825Sdim/// This represents '#pragma omp target parallel' directive. 2741309124Sdim/// 2742309124Sdim/// \code 2743309124Sdim/// #pragma omp target parallel if(a) 2744309124Sdim/// \endcode 2745309124Sdim/// In this example directive '#pragma omp target parallel' has clause 'if' with 2746309124Sdim/// condition 'a'. 2747309124Sdim/// 2748309124Sdimclass OMPTargetParallelDirective : public OMPExecutableDirective { 2749309124Sdim friend class ASTStmtReader; 2750341825Sdim /// Build directive with the given start and end location. 2751309124Sdim /// 2752309124Sdim /// \param StartLoc Starting location of the directive kind. 2753309124Sdim /// \param EndLoc Ending location of the directive. 2754309124Sdim /// \param NumClauses Number of clauses. 2755309124Sdim /// 2756309124Sdim OMPTargetParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2757309124Sdim unsigned NumClauses) 2758309124Sdim : OMPExecutableDirective(this, OMPTargetParallelDirectiveClass, 2759360784Sdim llvm::omp::OMPD_target_parallel, StartLoc, 2760360784Sdim EndLoc, NumClauses, /*NumChildren=*/1) {} 2761309124Sdim 2762341825Sdim /// Build an empty directive. 2763309124Sdim /// 2764309124Sdim /// \param NumClauses Number of clauses. 2765309124Sdim /// 2766309124Sdim explicit OMPTargetParallelDirective(unsigned NumClauses) 2767309124Sdim : OMPExecutableDirective(this, OMPTargetParallelDirectiveClass, 2768360784Sdim llvm::omp::OMPD_target_parallel, 2769360784Sdim SourceLocation(), SourceLocation(), NumClauses, 2770309124Sdim /*NumChildren=*/1) {} 2771309124Sdim 2772309124Sdimpublic: 2773341825Sdim /// Creates directive with a list of \a Clauses. 2774309124Sdim /// 2775309124Sdim /// \param C AST context. 2776309124Sdim /// \param StartLoc Starting location of the directive kind. 2777309124Sdim /// \param EndLoc Ending Location of the directive. 2778309124Sdim /// \param Clauses List of clauses. 2779309124Sdim /// \param AssociatedStmt Statement, associated with the directive. 2780309124Sdim /// 2781309124Sdim static OMPTargetParallelDirective * 2782309124Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2783309124Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); 2784309124Sdim 2785341825Sdim /// Creates an empty directive with the place for \a NumClauses 2786309124Sdim /// clauses. 2787309124Sdim /// 2788309124Sdim /// \param C AST context. 2789309124Sdim /// \param NumClauses Number of clauses. 2790309124Sdim /// 2791309124Sdim static OMPTargetParallelDirective * 2792309124Sdim CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell); 2793309124Sdim 2794309124Sdim static bool classof(const Stmt *T) { 2795309124Sdim return T->getStmtClass() == OMPTargetParallelDirectiveClass; 2796309124Sdim } 2797309124Sdim}; 2798309124Sdim 2799341825Sdim/// This represents '#pragma omp target parallel for' directive. 2800309124Sdim/// 2801309124Sdim/// \code 2802309124Sdim/// #pragma omp target parallel for private(a,b) reduction(+:c,d) 2803309124Sdim/// \endcode 2804309124Sdim/// In this example directive '#pragma omp target parallel for' has clauses 2805309124Sdim/// 'private' with the variables 'a' and 'b' and 'reduction' with operator '+' 2806309124Sdim/// and variables 'c' and 'd'. 2807309124Sdim/// 2808309124Sdimclass OMPTargetParallelForDirective : public OMPLoopDirective { 2809309124Sdim friend class ASTStmtReader; 2810309124Sdim 2811341825Sdim /// true if current region has inner cancel directive. 2812309124Sdim bool HasCancel; 2813309124Sdim 2814341825Sdim /// Build directive with the given start and end location. 2815309124Sdim /// 2816309124Sdim /// \param StartLoc Starting location of the directive kind. 2817309124Sdim /// \param EndLoc Ending location of the directive. 2818309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 2819309124Sdim /// \param NumClauses Number of clauses. 2820309124Sdim /// 2821309124Sdim OMPTargetParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2822309124Sdim unsigned CollapsedNum, unsigned NumClauses) 2823309124Sdim : OMPLoopDirective(this, OMPTargetParallelForDirectiveClass, 2824360784Sdim llvm::omp::OMPD_target_parallel_for, StartLoc, EndLoc, 2825309124Sdim CollapsedNum, NumClauses), 2826309124Sdim HasCancel(false) {} 2827309124Sdim 2828341825Sdim /// Build an empty directive. 2829309124Sdim /// 2830309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 2831309124Sdim /// \param NumClauses Number of clauses. 2832309124Sdim /// 2833309124Sdim explicit OMPTargetParallelForDirective(unsigned CollapsedNum, 2834309124Sdim unsigned NumClauses) 2835309124Sdim : OMPLoopDirective(this, OMPTargetParallelForDirectiveClass, 2836360784Sdim llvm::omp::OMPD_target_parallel_for, SourceLocation(), 2837309124Sdim SourceLocation(), CollapsedNum, NumClauses), 2838309124Sdim HasCancel(false) {} 2839309124Sdim 2840341825Sdim /// Set cancel state. 2841309124Sdim void setHasCancel(bool Has) { HasCancel = Has; } 2842309124Sdim 2843309124Sdimpublic: 2844341825Sdim /// Creates directive with a list of \a Clauses. 2845309124Sdim /// 2846309124Sdim /// \param C AST context. 2847309124Sdim /// \param StartLoc Starting location of the directive kind. 2848309124Sdim /// \param EndLoc Ending Location of the directive. 2849309124Sdim /// \param CollapsedNum Number of collapsed loops. 2850309124Sdim /// \param Clauses List of clauses. 2851309124Sdim /// \param AssociatedStmt Statement, associated with the directive. 2852309124Sdim /// \param Exprs Helper expressions for CodeGen. 2853309124Sdim /// \param HasCancel true if current directive has inner cancel directive. 2854309124Sdim /// 2855309124Sdim static OMPTargetParallelForDirective * 2856309124Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2857309124Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 2858309124Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel); 2859309124Sdim 2860341825Sdim /// Creates an empty directive with the place 2861309124Sdim /// for \a NumClauses clauses. 2862309124Sdim /// 2863309124Sdim /// \param C AST context. 2864309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 2865309124Sdim /// \param NumClauses Number of clauses. 2866309124Sdim /// 2867309124Sdim static OMPTargetParallelForDirective *CreateEmpty(const ASTContext &C, 2868309124Sdim unsigned NumClauses, 2869309124Sdim unsigned CollapsedNum, 2870309124Sdim EmptyShell); 2871309124Sdim 2872341825Sdim /// Return true if current directive has inner cancel directive. 2873309124Sdim bool hasCancel() const { return HasCancel; } 2874309124Sdim 2875309124Sdim static bool classof(const Stmt *T) { 2876309124Sdim return T->getStmtClass() == OMPTargetParallelForDirectiveClass; 2877309124Sdim } 2878309124Sdim}; 2879309124Sdim 2880341825Sdim/// This represents '#pragma omp teams' directive. 2881280031Sdim/// 2882280031Sdim/// \code 2883280031Sdim/// #pragma omp teams if(a) 2884280031Sdim/// \endcode 2885280031Sdim/// In this example directive '#pragma omp teams' has clause 'if' with 2886280031Sdim/// condition 'a'. 2887280031Sdim/// 2888280031Sdimclass OMPTeamsDirective : public OMPExecutableDirective { 2889280031Sdim friend class ASTStmtReader; 2890341825Sdim /// Build directive with the given start and end location. 2891280031Sdim /// 2892280031Sdim /// \param StartLoc Starting location of the directive kind. 2893280031Sdim /// \param EndLoc Ending location of the directive. 2894280031Sdim /// \param NumClauses Number of clauses. 2895280031Sdim /// 2896280031Sdim OMPTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc, 2897280031Sdim unsigned NumClauses) 2898360784Sdim : OMPExecutableDirective(this, OMPTeamsDirectiveClass, 2899360784Sdim llvm::omp::OMPD_teams, StartLoc, EndLoc, 2900360784Sdim NumClauses, 1) {} 2901280031Sdim 2902341825Sdim /// Build an empty directive. 2903280031Sdim /// 2904280031Sdim /// \param NumClauses Number of clauses. 2905280031Sdim /// 2906280031Sdim explicit OMPTeamsDirective(unsigned NumClauses) 2907360784Sdim : OMPExecutableDirective(this, OMPTeamsDirectiveClass, 2908360784Sdim llvm::omp::OMPD_teams, SourceLocation(), 2909360784Sdim SourceLocation(), NumClauses, 1) {} 2910280031Sdim 2911280031Sdimpublic: 2912341825Sdim /// Creates directive with a list of \a Clauses. 2913280031Sdim /// 2914280031Sdim /// \param C AST context. 2915280031Sdim /// \param StartLoc Starting location of the directive kind. 2916280031Sdim /// \param EndLoc Ending Location of the directive. 2917280031Sdim /// \param Clauses List of clauses. 2918280031Sdim /// \param AssociatedStmt Statement, associated with the directive. 2919280031Sdim /// 2920280031Sdim static OMPTeamsDirective *Create(const ASTContext &C, SourceLocation StartLoc, 2921280031Sdim SourceLocation EndLoc, 2922280031Sdim ArrayRef<OMPClause *> Clauses, 2923280031Sdim Stmt *AssociatedStmt); 2924280031Sdim 2925341825Sdim /// Creates an empty directive with the place for \a NumClauses 2926280031Sdim /// clauses. 2927280031Sdim /// 2928280031Sdim /// \param C AST context. 2929280031Sdim /// \param NumClauses Number of clauses. 2930280031Sdim /// 2931280031Sdim static OMPTeamsDirective *CreateEmpty(const ASTContext &C, 2932280031Sdim unsigned NumClauses, EmptyShell); 2933280031Sdim 2934280031Sdim static bool classof(const Stmt *T) { 2935280031Sdim return T->getStmtClass() == OMPTeamsDirectiveClass; 2936280031Sdim } 2937280031Sdim}; 2938280031Sdim 2939341825Sdim/// This represents '#pragma omp cancellation point' directive. 2940288943Sdim/// 2941288943Sdim/// \code 2942288943Sdim/// #pragma omp cancellation point for 2943288943Sdim/// \endcode 2944288943Sdim/// 2945288943Sdim/// In this example a cancellation point is created for innermost 'for' region. 2946288943Sdimclass OMPCancellationPointDirective : public OMPExecutableDirective { 2947288943Sdim friend class ASTStmtReader; 2948288943Sdim OpenMPDirectiveKind CancelRegion; 2949341825Sdim /// Build directive with the given start and end location. 2950288943Sdim /// 2951288943Sdim /// \param StartLoc Starting location of the directive kind. 2952288943Sdim /// \param EndLoc Ending location of the directive. 2953288943Sdim /// 2954288943Sdim OMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc) 2955288943Sdim : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass, 2956360784Sdim llvm::omp::OMPD_cancellation_point, StartLoc, 2957360784Sdim EndLoc, 0, 0), 2958360784Sdim CancelRegion(llvm::omp::OMPD_unknown) {} 2959288943Sdim 2960341825Sdim /// Build an empty directive. 2961288943Sdim /// 2962288943Sdim explicit OMPCancellationPointDirective() 2963288943Sdim : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass, 2964360784Sdim llvm::omp::OMPD_cancellation_point, 2965360784Sdim SourceLocation(), SourceLocation(), 0, 0), 2966360784Sdim CancelRegion(llvm::omp::OMPD_unknown) {} 2967288943Sdim 2968341825Sdim /// Set cancel region for current cancellation point. 2969288943Sdim /// \param CR Cancellation region. 2970288943Sdim void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; } 2971288943Sdim 2972288943Sdimpublic: 2973341825Sdim /// Creates directive. 2974288943Sdim /// 2975288943Sdim /// \param C AST context. 2976288943Sdim /// \param StartLoc Starting location of the directive kind. 2977288943Sdim /// \param EndLoc Ending Location of the directive. 2978288943Sdim /// 2979288943Sdim static OMPCancellationPointDirective * 2980288943Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 2981288943Sdim OpenMPDirectiveKind CancelRegion); 2982288943Sdim 2983341825Sdim /// Creates an empty directive. 2984288943Sdim /// 2985288943Sdim /// \param C AST context. 2986288943Sdim /// 2987288943Sdim static OMPCancellationPointDirective *CreateEmpty(const ASTContext &C, 2988288943Sdim EmptyShell); 2989288943Sdim 2990341825Sdim /// Get cancellation region for the current cancellation point. 2991288943Sdim OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; } 2992288943Sdim 2993288943Sdim static bool classof(const Stmt *T) { 2994288943Sdim return T->getStmtClass() == OMPCancellationPointDirectiveClass; 2995288943Sdim } 2996288943Sdim}; 2997288943Sdim 2998341825Sdim/// This represents '#pragma omp cancel' directive. 2999288943Sdim/// 3000288943Sdim/// \code 3001288943Sdim/// #pragma omp cancel for 3002288943Sdim/// \endcode 3003288943Sdim/// 3004288943Sdim/// In this example a cancel is created for innermost 'for' region. 3005288943Sdimclass OMPCancelDirective : public OMPExecutableDirective { 3006288943Sdim friend class ASTStmtReader; 3007288943Sdim OpenMPDirectiveKind CancelRegion; 3008341825Sdim /// Build directive with the given start and end location. 3009288943Sdim /// 3010288943Sdim /// \param StartLoc Starting location of the directive kind. 3011288943Sdim /// \param EndLoc Ending location of the directive. 3012296417Sdim /// \param NumClauses Number of clauses. 3013288943Sdim /// 3014296417Sdim OMPCancelDirective(SourceLocation StartLoc, SourceLocation EndLoc, 3015296417Sdim unsigned NumClauses) 3016360784Sdim : OMPExecutableDirective(this, OMPCancelDirectiveClass, 3017360784Sdim llvm::omp::OMPD_cancel, StartLoc, EndLoc, 3018360784Sdim NumClauses, 0), 3019360784Sdim CancelRegion(llvm::omp::OMPD_unknown) {} 3020288943Sdim 3021341825Sdim /// Build an empty directive. 3022288943Sdim /// 3023296417Sdim /// \param NumClauses Number of clauses. 3024296417Sdim explicit OMPCancelDirective(unsigned NumClauses) 3025360784Sdim : OMPExecutableDirective(this, OMPCancelDirectiveClass, 3026360784Sdim llvm::omp::OMPD_cancel, SourceLocation(), 3027360784Sdim SourceLocation(), NumClauses, 0), 3028360784Sdim CancelRegion(llvm::omp::OMPD_unknown) {} 3029288943Sdim 3030341825Sdim /// Set cancel region for current cancellation point. 3031288943Sdim /// \param CR Cancellation region. 3032288943Sdim void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; } 3033288943Sdim 3034288943Sdimpublic: 3035341825Sdim /// Creates directive. 3036288943Sdim /// 3037288943Sdim /// \param C AST context. 3038288943Sdim /// \param StartLoc Starting location of the directive kind. 3039288943Sdim /// \param EndLoc Ending Location of the directive. 3040296417Sdim /// \param Clauses List of clauses. 3041288943Sdim /// 3042296417Sdim static OMPCancelDirective * 3043296417Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3044296417Sdim ArrayRef<OMPClause *> Clauses, OpenMPDirectiveKind CancelRegion); 3045288943Sdim 3046341825Sdim /// Creates an empty directive. 3047288943Sdim /// 3048288943Sdim /// \param C AST context. 3049296417Sdim /// \param NumClauses Number of clauses. 3050288943Sdim /// 3051296417Sdim static OMPCancelDirective *CreateEmpty(const ASTContext &C, 3052296417Sdim unsigned NumClauses, EmptyShell); 3053288943Sdim 3054341825Sdim /// Get cancellation region for the current cancellation point. 3055288943Sdim OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; } 3056288943Sdim 3057288943Sdim static bool classof(const Stmt *T) { 3058288943Sdim return T->getStmtClass() == OMPCancelDirectiveClass; 3059288943Sdim } 3060288943Sdim}; 3061288943Sdim 3062341825Sdim/// This represents '#pragma omp taskloop' directive. 3063296417Sdim/// 3064296417Sdim/// \code 3065296417Sdim/// #pragma omp taskloop private(a,b) grainsize(val) num_tasks(num) 3066296417Sdim/// \endcode 3067296417Sdim/// In this example directive '#pragma omp taskloop' has clauses 'private' 3068296417Sdim/// with the variables 'a' and 'b', 'grainsize' with expression 'val' and 3069296417Sdim/// 'num_tasks' with expression 'num'. 3070296417Sdim/// 3071296417Sdimclass OMPTaskLoopDirective : public OMPLoopDirective { 3072296417Sdim friend class ASTStmtReader; 3073341825Sdim /// Build directive with the given start and end location. 3074296417Sdim /// 3075296417Sdim /// \param StartLoc Starting location of the directive kind. 3076296417Sdim /// \param EndLoc Ending location of the directive. 3077296417Sdim /// \param CollapsedNum Number of collapsed nested loops. 3078296417Sdim /// \param NumClauses Number of clauses. 3079296417Sdim /// 3080296417Sdim OMPTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc, 3081296417Sdim unsigned CollapsedNum, unsigned NumClauses) 3082360784Sdim : OMPLoopDirective(this, OMPTaskLoopDirectiveClass, 3083360784Sdim llvm::omp::OMPD_taskloop, StartLoc, EndLoc, 3084360784Sdim CollapsedNum, NumClauses) {} 3085296417Sdim 3086341825Sdim /// Build an empty directive. 3087296417Sdim /// 3088296417Sdim /// \param CollapsedNum Number of collapsed nested loops. 3089296417Sdim /// \param NumClauses Number of clauses. 3090296417Sdim /// 3091296417Sdim explicit OMPTaskLoopDirective(unsigned CollapsedNum, unsigned NumClauses) 3092360784Sdim : OMPLoopDirective(this, OMPTaskLoopDirectiveClass, 3093360784Sdim llvm::omp::OMPD_taskloop, SourceLocation(), 3094360784Sdim SourceLocation(), CollapsedNum, NumClauses) {} 3095296417Sdim 3096296417Sdimpublic: 3097341825Sdim /// Creates directive with a list of \a Clauses. 3098296417Sdim /// 3099296417Sdim /// \param C AST context. 3100296417Sdim /// \param StartLoc Starting location of the directive kind. 3101296417Sdim /// \param EndLoc Ending Location of the directive. 3102296417Sdim /// \param CollapsedNum Number of collapsed loops. 3103296417Sdim /// \param Clauses List of clauses. 3104296417Sdim /// \param AssociatedStmt Statement, associated with the directive. 3105296417Sdim /// \param Exprs Helper expressions for CodeGen. 3106296417Sdim /// 3107296417Sdim static OMPTaskLoopDirective * 3108296417Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3109296417Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3110296417Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3111296417Sdim 3112341825Sdim /// Creates an empty directive with the place 3113296417Sdim /// for \a NumClauses clauses. 3114296417Sdim /// 3115296417Sdim /// \param C AST context. 3116296417Sdim /// \param CollapsedNum Number of collapsed nested loops. 3117296417Sdim /// \param NumClauses Number of clauses. 3118296417Sdim /// 3119296417Sdim static OMPTaskLoopDirective *CreateEmpty(const ASTContext &C, 3120296417Sdim unsigned NumClauses, 3121296417Sdim unsigned CollapsedNum, EmptyShell); 3122296417Sdim 3123296417Sdim static bool classof(const Stmt *T) { 3124296417Sdim return T->getStmtClass() == OMPTaskLoopDirectiveClass; 3125296417Sdim } 3126296417Sdim}; 3127296417Sdim 3128341825Sdim/// This represents '#pragma omp taskloop simd' directive. 3129296417Sdim/// 3130296417Sdim/// \code 3131296417Sdim/// #pragma omp taskloop simd private(a,b) grainsize(val) num_tasks(num) 3132296417Sdim/// \endcode 3133296417Sdim/// In this example directive '#pragma omp taskloop simd' has clauses 'private' 3134296417Sdim/// with the variables 'a' and 'b', 'grainsize' with expression 'val' and 3135296417Sdim/// 'num_tasks' with expression 'num'. 3136296417Sdim/// 3137296417Sdimclass OMPTaskLoopSimdDirective : public OMPLoopDirective { 3138296417Sdim friend class ASTStmtReader; 3139341825Sdim /// Build directive with the given start and end location. 3140296417Sdim /// 3141296417Sdim /// \param StartLoc Starting location of the directive kind. 3142296417Sdim /// \param EndLoc Ending location of the directive. 3143296417Sdim /// \param CollapsedNum Number of collapsed nested loops. 3144296417Sdim /// \param NumClauses Number of clauses. 3145296417Sdim /// 3146296417Sdim OMPTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, 3147296417Sdim unsigned CollapsedNum, unsigned NumClauses) 3148296417Sdim : OMPLoopDirective(this, OMPTaskLoopSimdDirectiveClass, 3149360784Sdim llvm::omp::OMPD_taskloop_simd, StartLoc, EndLoc, 3150360784Sdim CollapsedNum, NumClauses) {} 3151296417Sdim 3152341825Sdim /// Build an empty directive. 3153296417Sdim /// 3154296417Sdim /// \param CollapsedNum Number of collapsed nested loops. 3155296417Sdim /// \param NumClauses Number of clauses. 3156296417Sdim /// 3157296417Sdim explicit OMPTaskLoopSimdDirective(unsigned CollapsedNum, unsigned NumClauses) 3158296417Sdim : OMPLoopDirective(this, OMPTaskLoopSimdDirectiveClass, 3159360784Sdim llvm::omp::OMPD_taskloop_simd, SourceLocation(), 3160360784Sdim SourceLocation(), CollapsedNum, NumClauses) {} 3161296417Sdim 3162296417Sdimpublic: 3163341825Sdim /// Creates directive with a list of \a Clauses. 3164296417Sdim /// 3165296417Sdim /// \param C AST context. 3166296417Sdim /// \param StartLoc Starting location of the directive kind. 3167296417Sdim /// \param EndLoc Ending Location of the directive. 3168296417Sdim /// \param CollapsedNum Number of collapsed loops. 3169296417Sdim /// \param Clauses List of clauses. 3170296417Sdim /// \param AssociatedStmt Statement, associated with the directive. 3171296417Sdim /// \param Exprs Helper expressions for CodeGen. 3172296417Sdim /// 3173296417Sdim static OMPTaskLoopSimdDirective * 3174296417Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3175296417Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3176296417Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3177296417Sdim 3178341825Sdim /// Creates an empty directive with the place 3179296417Sdim /// for \a NumClauses clauses. 3180296417Sdim /// 3181296417Sdim /// \param C AST context. 3182296417Sdim /// \param CollapsedNum Number of collapsed nested loops. 3183296417Sdim /// \param NumClauses Number of clauses. 3184296417Sdim /// 3185296417Sdim static OMPTaskLoopSimdDirective *CreateEmpty(const ASTContext &C, 3186296417Sdim unsigned NumClauses, 3187296417Sdim unsigned CollapsedNum, 3188296417Sdim EmptyShell); 3189296417Sdim 3190296417Sdim static bool classof(const Stmt *T) { 3191296417Sdim return T->getStmtClass() == OMPTaskLoopSimdDirectiveClass; 3192296417Sdim } 3193296417Sdim}; 3194296417Sdim 3195360784Sdim/// This represents '#pragma omp master taskloop' directive. 3196360784Sdim/// 3197360784Sdim/// \code 3198360784Sdim/// #pragma omp master taskloop private(a,b) grainsize(val) num_tasks(num) 3199360784Sdim/// \endcode 3200360784Sdim/// In this example directive '#pragma omp master taskloop' has clauses 3201360784Sdim/// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val' 3202360784Sdim/// and 'num_tasks' with expression 'num'. 3203360784Sdim/// 3204360784Sdimclass OMPMasterTaskLoopDirective : public OMPLoopDirective { 3205360784Sdim friend class ASTStmtReader; 3206360784Sdim /// Build directive with the given start and end location. 3207360784Sdim /// 3208360784Sdim /// \param StartLoc Starting location of the directive kind. 3209360784Sdim /// \param EndLoc Ending location of the directive. 3210360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3211360784Sdim /// \param NumClauses Number of clauses. 3212360784Sdim /// 3213360784Sdim OMPMasterTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc, 3214360784Sdim unsigned CollapsedNum, unsigned NumClauses) 3215360784Sdim : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass, 3216360784Sdim llvm::omp::OMPD_master_taskloop, StartLoc, EndLoc, 3217360784Sdim CollapsedNum, NumClauses) {} 3218360784Sdim 3219360784Sdim /// Build an empty directive. 3220360784Sdim /// 3221360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3222360784Sdim /// \param NumClauses Number of clauses. 3223360784Sdim /// 3224360784Sdim explicit OMPMasterTaskLoopDirective(unsigned CollapsedNum, 3225360784Sdim unsigned NumClauses) 3226360784Sdim : OMPLoopDirective(this, OMPMasterTaskLoopDirectiveClass, 3227360784Sdim llvm::omp::OMPD_master_taskloop, SourceLocation(), 3228360784Sdim SourceLocation(), CollapsedNum, NumClauses) {} 3229360784Sdim 3230360784Sdimpublic: 3231360784Sdim /// Creates directive with a list of \a Clauses. 3232360784Sdim /// 3233360784Sdim /// \param C AST context. 3234360784Sdim /// \param StartLoc Starting location of the directive kind. 3235360784Sdim /// \param EndLoc Ending Location of the directive. 3236360784Sdim /// \param CollapsedNum Number of collapsed loops. 3237360784Sdim /// \param Clauses List of clauses. 3238360784Sdim /// \param AssociatedStmt Statement, associated with the directive. 3239360784Sdim /// \param Exprs Helper expressions for CodeGen. 3240360784Sdim /// 3241360784Sdim static OMPMasterTaskLoopDirective * 3242360784Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3243360784Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3244360784Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3245360784Sdim 3246360784Sdim /// Creates an empty directive with the place 3247360784Sdim /// for \a NumClauses clauses. 3248360784Sdim /// 3249360784Sdim /// \param C AST context. 3250360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3251360784Sdim /// \param NumClauses Number of clauses. 3252360784Sdim /// 3253360784Sdim static OMPMasterTaskLoopDirective *CreateEmpty(const ASTContext &C, 3254360784Sdim unsigned NumClauses, 3255360784Sdim unsigned CollapsedNum, 3256360784Sdim EmptyShell); 3257360784Sdim 3258360784Sdim static bool classof(const Stmt *T) { 3259360784Sdim return T->getStmtClass() == OMPMasterTaskLoopDirectiveClass; 3260360784Sdim } 3261360784Sdim}; 3262360784Sdim 3263360784Sdim/// This represents '#pragma omp master taskloop simd' directive. 3264360784Sdim/// 3265360784Sdim/// \code 3266360784Sdim/// #pragma omp master taskloop simd private(a,b) grainsize(val) num_tasks(num) 3267360784Sdim/// \endcode 3268360784Sdim/// In this example directive '#pragma omp master taskloop simd' has clauses 3269360784Sdim/// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val' 3270360784Sdim/// and 'num_tasks' with expression 'num'. 3271360784Sdim/// 3272360784Sdimclass OMPMasterTaskLoopSimdDirective : public OMPLoopDirective { 3273360784Sdim friend class ASTStmtReader; 3274360784Sdim /// Build directive with the given start and end location. 3275360784Sdim /// 3276360784Sdim /// \param StartLoc Starting location of the directive kind. 3277360784Sdim /// \param EndLoc Ending location of the directive. 3278360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3279360784Sdim /// \param NumClauses Number of clauses. 3280360784Sdim /// 3281360784Sdim OMPMasterTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, 3282360784Sdim unsigned CollapsedNum, unsigned NumClauses) 3283360784Sdim : OMPLoopDirective(this, OMPMasterTaskLoopSimdDirectiveClass, 3284360784Sdim llvm::omp::OMPD_master_taskloop_simd, StartLoc, EndLoc, 3285360784Sdim CollapsedNum, NumClauses) {} 3286360784Sdim 3287360784Sdim /// Build an empty directive. 3288360784Sdim /// 3289360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3290360784Sdim /// \param NumClauses Number of clauses. 3291360784Sdim /// 3292360784Sdim explicit OMPMasterTaskLoopSimdDirective(unsigned CollapsedNum, 3293360784Sdim unsigned NumClauses) 3294360784Sdim : OMPLoopDirective(this, OMPMasterTaskLoopSimdDirectiveClass, 3295360784Sdim llvm::omp::OMPD_master_taskloop_simd, SourceLocation(), 3296360784Sdim SourceLocation(), CollapsedNum, NumClauses) {} 3297360784Sdim 3298360784Sdimpublic: 3299360784Sdim /// Creates directive with a list of \p Clauses. 3300360784Sdim /// 3301360784Sdim /// \param C AST context. 3302360784Sdim /// \param StartLoc Starting location of the directive kind. 3303360784Sdim /// \param EndLoc Ending Location of the directive. 3304360784Sdim /// \param CollapsedNum Number of collapsed loops. 3305360784Sdim /// \param Clauses List of clauses. 3306360784Sdim /// \param AssociatedStmt Statement, associated with the directive. 3307360784Sdim /// \param Exprs Helper expressions for CodeGen. 3308360784Sdim /// 3309360784Sdim static OMPMasterTaskLoopSimdDirective * 3310360784Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3311360784Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3312360784Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3313360784Sdim 3314360784Sdim /// Creates an empty directive with the place for \p NumClauses clauses. 3315360784Sdim /// 3316360784Sdim /// \param C AST context. 3317360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3318360784Sdim /// \param NumClauses Number of clauses. 3319360784Sdim /// 3320360784Sdim static OMPMasterTaskLoopSimdDirective *CreateEmpty(const ASTContext &C, 3321360784Sdim unsigned NumClauses, 3322360784Sdim unsigned CollapsedNum, 3323360784Sdim EmptyShell); 3324360784Sdim 3325360784Sdim static bool classof(const Stmt *T) { 3326360784Sdim return T->getStmtClass() == OMPMasterTaskLoopSimdDirectiveClass; 3327360784Sdim } 3328360784Sdim}; 3329360784Sdim 3330360784Sdim/// This represents '#pragma omp parallel master taskloop' directive. 3331360784Sdim/// 3332360784Sdim/// \code 3333360784Sdim/// #pragma omp parallel master taskloop private(a,b) grainsize(val) 3334360784Sdim/// num_tasks(num) 3335360784Sdim/// \endcode 3336360784Sdim/// In this example directive '#pragma omp parallel master taskloop' has clauses 3337360784Sdim/// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val' 3338360784Sdim/// and 'num_tasks' with expression 'num'. 3339360784Sdim/// 3340360784Sdimclass OMPParallelMasterTaskLoopDirective : public OMPLoopDirective { 3341360784Sdim friend class ASTStmtReader; 3342360784Sdim /// Build directive with the given start and end location. 3343360784Sdim /// 3344360784Sdim /// \param StartLoc Starting location of the directive kind. 3345360784Sdim /// \param EndLoc Ending location of the directive. 3346360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3347360784Sdim /// \param NumClauses Number of clauses. 3348360784Sdim /// 3349360784Sdim OMPParallelMasterTaskLoopDirective(SourceLocation StartLoc, 3350360784Sdim SourceLocation EndLoc, 3351360784Sdim unsigned CollapsedNum, unsigned NumClauses) 3352360784Sdim : OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass, 3353360784Sdim llvm::omp::OMPD_parallel_master_taskloop, StartLoc, 3354360784Sdim EndLoc, CollapsedNum, NumClauses) {} 3355360784Sdim 3356360784Sdim /// Build an empty directive. 3357360784Sdim /// 3358360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3359360784Sdim /// \param NumClauses Number of clauses. 3360360784Sdim /// 3361360784Sdim explicit OMPParallelMasterTaskLoopDirective(unsigned CollapsedNum, 3362360784Sdim unsigned NumClauses) 3363360784Sdim : OMPLoopDirective(this, OMPParallelMasterTaskLoopDirectiveClass, 3364360784Sdim llvm::omp::OMPD_parallel_master_taskloop, 3365360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, 3366360784Sdim NumClauses) {} 3367360784Sdim 3368360784Sdimpublic: 3369360784Sdim /// Creates directive with a list of \a Clauses. 3370360784Sdim /// 3371360784Sdim /// \param C AST context. 3372360784Sdim /// \param StartLoc Starting location of the directive kind. 3373360784Sdim /// \param EndLoc Ending Location of the directive. 3374360784Sdim /// \param CollapsedNum Number of collapsed loops. 3375360784Sdim /// \param Clauses List of clauses. 3376360784Sdim /// \param AssociatedStmt Statement, associated with the directive. 3377360784Sdim /// \param Exprs Helper expressions for CodeGen. 3378360784Sdim /// 3379360784Sdim static OMPParallelMasterTaskLoopDirective * 3380360784Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3381360784Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3382360784Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3383360784Sdim 3384360784Sdim /// Creates an empty directive with the place 3385360784Sdim /// for \a NumClauses clauses. 3386360784Sdim /// 3387360784Sdim /// \param C AST context. 3388360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3389360784Sdim /// \param NumClauses Number of clauses. 3390360784Sdim /// 3391360784Sdim static OMPParallelMasterTaskLoopDirective *CreateEmpty(const ASTContext &C, 3392360784Sdim unsigned NumClauses, 3393360784Sdim unsigned CollapsedNum, 3394360784Sdim EmptyShell); 3395360784Sdim 3396360784Sdim static bool classof(const Stmt *T) { 3397360784Sdim return T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass; 3398360784Sdim } 3399360784Sdim}; 3400360784Sdim 3401360784Sdim/// This represents '#pragma omp parallel master taskloop simd' directive. 3402360784Sdim/// 3403360784Sdim/// \code 3404360784Sdim/// #pragma omp parallel master taskloop simd private(a,b) grainsize(val) 3405360784Sdim/// num_tasks(num) 3406360784Sdim/// \endcode 3407360784Sdim/// In this example directive '#pragma omp parallel master taskloop simd' has 3408360784Sdim/// clauses 'private' with the variables 'a' and 'b', 'grainsize' with 3409360784Sdim/// expression 'val' and 'num_tasks' with expression 'num'. 3410360784Sdim/// 3411360784Sdimclass OMPParallelMasterTaskLoopSimdDirective : public OMPLoopDirective { 3412360784Sdim friend class ASTStmtReader; 3413360784Sdim /// Build directive with the given start and end location. 3414360784Sdim /// 3415360784Sdim /// \param StartLoc Starting location of the directive kind. 3416360784Sdim /// \param EndLoc Ending location of the directive. 3417360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3418360784Sdim /// \param NumClauses Number of clauses. 3419360784Sdim /// 3420360784Sdim OMPParallelMasterTaskLoopSimdDirective(SourceLocation StartLoc, 3421360784Sdim SourceLocation EndLoc, 3422360784Sdim unsigned CollapsedNum, 3423360784Sdim unsigned NumClauses) 3424360784Sdim : OMPLoopDirective(this, OMPParallelMasterTaskLoopSimdDirectiveClass, 3425360784Sdim llvm::omp::OMPD_parallel_master_taskloop_simd, 3426360784Sdim StartLoc, EndLoc, CollapsedNum, NumClauses) {} 3427360784Sdim 3428360784Sdim /// Build an empty directive. 3429360784Sdim /// 3430360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3431360784Sdim /// \param NumClauses Number of clauses. 3432360784Sdim /// 3433360784Sdim explicit OMPParallelMasterTaskLoopSimdDirective(unsigned CollapsedNum, 3434360784Sdim unsigned NumClauses) 3435360784Sdim : OMPLoopDirective(this, OMPParallelMasterTaskLoopSimdDirectiveClass, 3436360784Sdim llvm::omp::OMPD_parallel_master_taskloop_simd, 3437360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, 3438360784Sdim NumClauses) {} 3439360784Sdim 3440360784Sdimpublic: 3441360784Sdim /// Creates directive with a list of \p Clauses. 3442360784Sdim /// 3443360784Sdim /// \param C AST context. 3444360784Sdim /// \param StartLoc Starting location of the directive kind. 3445360784Sdim /// \param EndLoc Ending Location of the directive. 3446360784Sdim /// \param CollapsedNum Number of collapsed loops. 3447360784Sdim /// \param Clauses List of clauses. 3448360784Sdim /// \param AssociatedStmt Statement, associated with the directive. 3449360784Sdim /// \param Exprs Helper expressions for CodeGen. 3450360784Sdim /// 3451360784Sdim static OMPParallelMasterTaskLoopSimdDirective * 3452360784Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3453360784Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3454360784Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3455360784Sdim 3456360784Sdim /// Creates an empty directive with the place 3457360784Sdim /// for \a NumClauses clauses. 3458360784Sdim /// 3459360784Sdim /// \param C AST context. 3460360784Sdim /// \param CollapsedNum Number of collapsed nested loops. 3461360784Sdim /// \param NumClauses Number of clauses. 3462360784Sdim /// 3463360784Sdim static OMPParallelMasterTaskLoopSimdDirective * 3464360784Sdim CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 3465360784Sdim EmptyShell); 3466360784Sdim 3467360784Sdim static bool classof(const Stmt *T) { 3468360784Sdim return T->getStmtClass() == OMPParallelMasterTaskLoopSimdDirectiveClass; 3469360784Sdim } 3470360784Sdim}; 3471360784Sdim 3472341825Sdim/// This represents '#pragma omp distribute' directive. 3473296417Sdim/// 3474296417Sdim/// \code 3475296417Sdim/// #pragma omp distribute private(a,b) 3476296417Sdim/// \endcode 3477296417Sdim/// In this example directive '#pragma omp distribute' has clauses 'private' 3478296417Sdim/// with the variables 'a' and 'b' 3479296417Sdim/// 3480296417Sdimclass OMPDistributeDirective : public OMPLoopDirective { 3481296417Sdim friend class ASTStmtReader; 3482296417Sdim 3483341825Sdim /// Build directive with the given start and end location. 3484296417Sdim /// 3485296417Sdim /// \param StartLoc Starting location of the directive kind. 3486296417Sdim /// \param EndLoc Ending location of the directive. 3487296417Sdim /// \param CollapsedNum Number of collapsed nested loops. 3488296417Sdim /// \param NumClauses Number of clauses. 3489296417Sdim /// 3490296417Sdim OMPDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc, 3491296417Sdim unsigned CollapsedNum, unsigned NumClauses) 3492360784Sdim : OMPLoopDirective(this, OMPDistributeDirectiveClass, 3493360784Sdim llvm::omp::OMPD_distribute, StartLoc, EndLoc, 3494360784Sdim CollapsedNum, NumClauses) {} 3495296417Sdim 3496341825Sdim /// Build an empty directive. 3497296417Sdim /// 3498296417Sdim /// \param CollapsedNum Number of collapsed nested loops. 3499296417Sdim /// \param NumClauses Number of clauses. 3500296417Sdim /// 3501296417Sdim explicit OMPDistributeDirective(unsigned CollapsedNum, unsigned NumClauses) 3502360784Sdim : OMPLoopDirective(this, OMPDistributeDirectiveClass, 3503360784Sdim llvm::omp::OMPD_distribute, SourceLocation(), 3504360784Sdim SourceLocation(), CollapsedNum, NumClauses) {} 3505296417Sdim 3506296417Sdimpublic: 3507341825Sdim /// Creates directive with a list of \a Clauses. 3508296417Sdim /// 3509296417Sdim /// \param C AST context. 3510296417Sdim /// \param StartLoc Starting location of the directive kind. 3511296417Sdim /// \param EndLoc Ending Location of the directive. 3512296417Sdim /// \param CollapsedNum Number of collapsed loops. 3513296417Sdim /// \param Clauses List of clauses. 3514296417Sdim /// \param AssociatedStmt Statement, associated with the directive. 3515296417Sdim /// \param Exprs Helper expressions for CodeGen. 3516309124Sdim /// 3517296417Sdim static OMPDistributeDirective * 3518296417Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3519296417Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3520296417Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3521296417Sdim 3522341825Sdim /// Creates an empty directive with the place 3523296417Sdim /// for \a NumClauses clauses. 3524296417Sdim /// 3525296417Sdim /// \param C AST context. 3526296417Sdim /// \param CollapsedNum Number of collapsed nested loops. 3527296417Sdim /// \param NumClauses Number of clauses. 3528296417Sdim /// 3529296417Sdim static OMPDistributeDirective *CreateEmpty(const ASTContext &C, 3530296417Sdim unsigned NumClauses, 3531296417Sdim unsigned CollapsedNum, EmptyShell); 3532296417Sdim 3533296417Sdim static bool classof(const Stmt *T) { 3534296417Sdim return T->getStmtClass() == OMPDistributeDirectiveClass; 3535296417Sdim } 3536296417Sdim}; 3537296417Sdim 3538341825Sdim/// This represents '#pragma omp target update' directive. 3539309124Sdim/// 3540309124Sdim/// \code 3541309124Sdim/// #pragma omp target update to(a) from(b) device(1) 3542309124Sdim/// \endcode 3543309124Sdim/// In this example directive '#pragma omp target update' has clause 'to' with 3544309124Sdim/// argument 'a', clause 'from' with argument 'b' and clause 'device' with 3545309124Sdim/// argument '1'. 3546309124Sdim/// 3547309124Sdimclass OMPTargetUpdateDirective : public OMPExecutableDirective { 3548309124Sdim friend class ASTStmtReader; 3549341825Sdim /// Build directive with the given start and end location. 3550309124Sdim /// 3551309124Sdim /// \param StartLoc Starting location of the directive kind. 3552309124Sdim /// \param EndLoc Ending Location of the directive. 3553309124Sdim /// \param NumClauses The number of clauses. 3554309124Sdim /// 3555309124Sdim OMPTargetUpdateDirective(SourceLocation StartLoc, SourceLocation EndLoc, 3556309124Sdim unsigned NumClauses) 3557309124Sdim : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass, 3558360784Sdim llvm::omp::OMPD_target_update, StartLoc, EndLoc, 3559360784Sdim NumClauses, 1) {} 3560309124Sdim 3561341825Sdim /// Build an empty directive. 3562309124Sdim /// 3563309124Sdim /// \param NumClauses Number of clauses. 3564309124Sdim /// 3565309124Sdim explicit OMPTargetUpdateDirective(unsigned NumClauses) 3566309124Sdim : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass, 3567360784Sdim llvm::omp::OMPD_target_update, SourceLocation(), 3568327952Sdim SourceLocation(), NumClauses, 1) {} 3569309124Sdim 3570309124Sdimpublic: 3571341825Sdim /// Creates directive with a list of \a Clauses. 3572309124Sdim /// 3573309124Sdim /// \param C AST context. 3574309124Sdim /// \param StartLoc Starting location of the directive kind. 3575309124Sdim /// \param EndLoc Ending Location of the directive. 3576309124Sdim /// \param Clauses List of clauses. 3577327952Sdim /// \param AssociatedStmt Statement, associated with the directive. 3578309124Sdim /// 3579327952Sdim static OMPTargetUpdateDirective * 3580327952Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3581327952Sdim ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); 3582309124Sdim 3583341825Sdim /// Creates an empty directive with the place for \a NumClauses 3584309124Sdim /// clauses. 3585309124Sdim /// 3586309124Sdim /// \param C AST context. 3587309124Sdim /// \param NumClauses The number of clauses. 3588309124Sdim /// 3589309124Sdim static OMPTargetUpdateDirective *CreateEmpty(const ASTContext &C, 3590309124Sdim unsigned NumClauses, EmptyShell); 3591309124Sdim 3592309124Sdim static bool classof(const Stmt *T) { 3593309124Sdim return T->getStmtClass() == OMPTargetUpdateDirectiveClass; 3594309124Sdim } 3595309124Sdim}; 3596309124Sdim 3597341825Sdim/// This represents '#pragma omp distribute parallel for' composite 3598309124Sdim/// directive. 3599309124Sdim/// 3600309124Sdim/// \code 3601309124Sdim/// #pragma omp distribute parallel for private(a,b) 3602309124Sdim/// \endcode 3603309124Sdim/// In this example directive '#pragma omp distribute parallel for' has clause 3604309124Sdim/// 'private' with the variables 'a' and 'b' 3605309124Sdim/// 3606309124Sdimclass OMPDistributeParallelForDirective : public OMPLoopDirective { 3607309124Sdim friend class ASTStmtReader; 3608327952Sdim /// true if the construct has inner cancel directive. 3609327952Sdim bool HasCancel = false; 3610309124Sdim 3611341825Sdim /// Build directive with the given start and end location. 3612309124Sdim /// 3613309124Sdim /// \param StartLoc Starting location of the directive kind. 3614309124Sdim /// \param EndLoc Ending location of the directive. 3615309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3616309124Sdim /// \param NumClauses Number of clauses. 3617309124Sdim /// 3618309124Sdim OMPDistributeParallelForDirective(SourceLocation StartLoc, 3619309124Sdim SourceLocation EndLoc, 3620309124Sdim unsigned CollapsedNum, unsigned NumClauses) 3621309124Sdim : OMPLoopDirective(this, OMPDistributeParallelForDirectiveClass, 3622360784Sdim llvm::omp::OMPD_distribute_parallel_for, StartLoc, 3623360784Sdim EndLoc, CollapsedNum, NumClauses), 3624360784Sdim HasCancel(false) {} 3625309124Sdim 3626341825Sdim /// Build an empty directive. 3627309124Sdim /// 3628309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3629309124Sdim /// \param NumClauses Number of clauses. 3630309124Sdim /// 3631309124Sdim explicit OMPDistributeParallelForDirective(unsigned CollapsedNum, 3632309124Sdim unsigned NumClauses) 3633309124Sdim : OMPLoopDirective(this, OMPDistributeParallelForDirectiveClass, 3634360784Sdim llvm::omp::OMPD_distribute_parallel_for, 3635360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, 3636360784Sdim NumClauses), 3637327952Sdim HasCancel(false) {} 3638309124Sdim 3639327952Sdim /// Set cancel state. 3640327952Sdim void setHasCancel(bool Has) { HasCancel = Has; } 3641327952Sdim 3642309124Sdimpublic: 3643341825Sdim /// Creates directive with a list of \a Clauses. 3644309124Sdim /// 3645309124Sdim /// \param C AST context. 3646309124Sdim /// \param StartLoc Starting location of the directive kind. 3647309124Sdim /// \param EndLoc Ending Location of the directive. 3648309124Sdim /// \param CollapsedNum Number of collapsed loops. 3649309124Sdim /// \param Clauses List of clauses. 3650309124Sdim /// \param AssociatedStmt Statement, associated with the directive. 3651309124Sdim /// \param Exprs Helper expressions for CodeGen. 3652327952Sdim /// \param HasCancel true if this directive has inner cancel directive. 3653309124Sdim /// 3654309124Sdim static OMPDistributeParallelForDirective * 3655309124Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3656309124Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3657327952Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel); 3658309124Sdim 3659341825Sdim /// Creates an empty directive with the place 3660309124Sdim /// for \a NumClauses clauses. 3661309124Sdim /// 3662309124Sdim /// \param C AST context. 3663309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3664309124Sdim /// \param NumClauses Number of clauses. 3665309124Sdim /// 3666309124Sdim static OMPDistributeParallelForDirective *CreateEmpty(const ASTContext &C, 3667309124Sdim unsigned NumClauses, 3668309124Sdim unsigned CollapsedNum, 3669309124Sdim EmptyShell); 3670309124Sdim 3671327952Sdim /// Return true if current directive has inner cancel directive. 3672327952Sdim bool hasCancel() const { return HasCancel; } 3673327952Sdim 3674309124Sdim static bool classof(const Stmt *T) { 3675309124Sdim return T->getStmtClass() == OMPDistributeParallelForDirectiveClass; 3676309124Sdim } 3677309124Sdim}; 3678309124Sdim 3679309124Sdim/// This represents '#pragma omp distribute parallel for simd' composite 3680309124Sdim/// directive. 3681309124Sdim/// 3682309124Sdim/// \code 3683309124Sdim/// #pragma omp distribute parallel for simd private(x) 3684309124Sdim/// \endcode 3685309124Sdim/// In this example directive '#pragma omp distribute parallel for simd' has 3686309124Sdim/// clause 'private' with the variables 'x' 3687309124Sdim/// 3688309124Sdimclass OMPDistributeParallelForSimdDirective final : public OMPLoopDirective { 3689309124Sdim friend class ASTStmtReader; 3690309124Sdim 3691309124Sdim /// Build directive with the given start and end location. 3692309124Sdim /// 3693309124Sdim /// \param StartLoc Starting location of the directive kind. 3694309124Sdim /// \param EndLoc Ending location of the directive. 3695309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3696309124Sdim /// \param NumClauses Number of clauses. 3697309124Sdim /// 3698309124Sdim OMPDistributeParallelForSimdDirective(SourceLocation StartLoc, 3699309124Sdim SourceLocation EndLoc, 3700309124Sdim unsigned CollapsedNum, 3701309124Sdim unsigned NumClauses) 3702309124Sdim : OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass, 3703360784Sdim llvm::omp::OMPD_distribute_parallel_for_simd, StartLoc, 3704309124Sdim EndLoc, CollapsedNum, NumClauses) {} 3705309124Sdim 3706309124Sdim /// Build an empty directive. 3707309124Sdim /// 3708309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3709309124Sdim /// \param NumClauses Number of clauses. 3710309124Sdim /// 3711309124Sdim explicit OMPDistributeParallelForSimdDirective(unsigned CollapsedNum, 3712309124Sdim unsigned NumClauses) 3713309124Sdim : OMPLoopDirective(this, OMPDistributeParallelForSimdDirectiveClass, 3714360784Sdim llvm::omp::OMPD_distribute_parallel_for_simd, 3715309124Sdim SourceLocation(), SourceLocation(), CollapsedNum, 3716309124Sdim NumClauses) {} 3717309124Sdim 3718309124Sdimpublic: 3719309124Sdim /// Creates directive with a list of \a Clauses. 3720309124Sdim /// 3721309124Sdim /// \param C AST context. 3722309124Sdim /// \param StartLoc Starting location of the directive kind. 3723309124Sdim /// \param EndLoc Ending Location of the directive. 3724309124Sdim /// \param CollapsedNum Number of collapsed loops. 3725309124Sdim /// \param Clauses List of clauses. 3726309124Sdim /// \param AssociatedStmt Statement, associated with the directive. 3727309124Sdim /// \param Exprs Helper expressions for CodeGen. 3728309124Sdim /// 3729309124Sdim static OMPDistributeParallelForSimdDirective *Create( 3730309124Sdim const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3731309124Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3732309124Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3733309124Sdim 3734309124Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 3735309124Sdim /// 3736309124Sdim /// \param C AST context. 3737309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3738309124Sdim /// \param NumClauses Number of clauses. 3739309124Sdim /// 3740309124Sdim static OMPDistributeParallelForSimdDirective *CreateEmpty( 3741309124Sdim const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 3742309124Sdim EmptyShell); 3743309124Sdim 3744309124Sdim static bool classof(const Stmt *T) { 3745309124Sdim return T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass; 3746309124Sdim } 3747309124Sdim}; 3748309124Sdim 3749309124Sdim/// This represents '#pragma omp distribute simd' composite directive. 3750309124Sdim/// 3751309124Sdim/// \code 3752309124Sdim/// #pragma omp distribute simd private(x) 3753309124Sdim/// \endcode 3754309124Sdim/// In this example directive '#pragma omp distribute simd' has clause 3755309124Sdim/// 'private' with the variables 'x' 3756309124Sdim/// 3757309124Sdimclass OMPDistributeSimdDirective final : public OMPLoopDirective { 3758309124Sdim friend class ASTStmtReader; 3759309124Sdim 3760309124Sdim /// Build directive with the given start and end location. 3761309124Sdim /// 3762309124Sdim /// \param StartLoc Starting location of the directive kind. 3763309124Sdim /// \param EndLoc Ending location of the directive. 3764309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3765309124Sdim /// \param NumClauses Number of clauses. 3766309124Sdim /// 3767309124Sdim OMPDistributeSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, 3768309124Sdim unsigned CollapsedNum, unsigned NumClauses) 3769309124Sdim : OMPLoopDirective(this, OMPDistributeSimdDirectiveClass, 3770360784Sdim llvm::omp::OMPD_distribute_simd, StartLoc, EndLoc, 3771360784Sdim CollapsedNum, NumClauses) {} 3772309124Sdim 3773309124Sdim /// Build an empty directive. 3774309124Sdim /// 3775309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3776309124Sdim /// \param NumClauses Number of clauses. 3777309124Sdim /// 3778341825Sdim explicit OMPDistributeSimdDirective(unsigned CollapsedNum, 3779309124Sdim unsigned NumClauses) 3780309124Sdim : OMPLoopDirective(this, OMPDistributeSimdDirectiveClass, 3781360784Sdim llvm::omp::OMPD_distribute_simd, SourceLocation(), 3782309124Sdim SourceLocation(), CollapsedNum, NumClauses) {} 3783309124Sdim 3784309124Sdimpublic: 3785309124Sdim /// Creates directive with a list of \a Clauses. 3786309124Sdim /// 3787309124Sdim /// \param C AST context. 3788309124Sdim /// \param StartLoc Starting location of the directive kind. 3789309124Sdim /// \param EndLoc Ending Location of the directive. 3790309124Sdim /// \param CollapsedNum Number of collapsed loops. 3791309124Sdim /// \param Clauses List of clauses. 3792309124Sdim /// \param AssociatedStmt Statement, associated with the directive. 3793309124Sdim /// \param Exprs Helper expressions for CodeGen. 3794309124Sdim /// 3795309124Sdim static OMPDistributeSimdDirective * 3796309124Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3797309124Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3798309124Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3799309124Sdim 3800309124Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 3801309124Sdim /// 3802309124Sdim /// \param C AST context. 3803309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3804309124Sdim /// \param NumClauses Number of clauses. 3805309124Sdim /// 3806309124Sdim static OMPDistributeSimdDirective *CreateEmpty(const ASTContext &C, 3807309124Sdim unsigned NumClauses, 3808309124Sdim unsigned CollapsedNum, 3809309124Sdim EmptyShell); 3810309124Sdim 3811309124Sdim static bool classof(const Stmt *T) { 3812309124Sdim return T->getStmtClass() == OMPDistributeSimdDirectiveClass; 3813309124Sdim } 3814309124Sdim}; 3815309124Sdim 3816309124Sdim/// This represents '#pragma omp target parallel for simd' directive. 3817309124Sdim/// 3818309124Sdim/// \code 3819309124Sdim/// #pragma omp target parallel for simd private(a) map(b) safelen(c) 3820309124Sdim/// \endcode 3821309124Sdim/// In this example directive '#pragma omp target parallel for simd' has clauses 3822309124Sdim/// 'private' with the variable 'a', 'map' with the variable 'b' and 'safelen' 3823309124Sdim/// with the variable 'c'. 3824309124Sdim/// 3825309124Sdimclass OMPTargetParallelForSimdDirective final : public OMPLoopDirective { 3826309124Sdim friend class ASTStmtReader; 3827309124Sdim 3828309124Sdim /// Build directive with the given start and end location. 3829309124Sdim /// 3830309124Sdim /// \param StartLoc Starting location of the directive kind. 3831309124Sdim /// \param EndLoc Ending location of the directive. 3832309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3833309124Sdim /// \param NumClauses Number of clauses. 3834309124Sdim /// 3835360784Sdim OMPTargetParallelForSimdDirective(SourceLocation StartLoc, 3836360784Sdim SourceLocation EndLoc, 3837360784Sdim unsigned CollapsedNum, unsigned NumClauses) 3838309124Sdim : OMPLoopDirective(this, OMPTargetParallelForSimdDirectiveClass, 3839360784Sdim llvm::omp::OMPD_target_parallel_for_simd, StartLoc, 3840360784Sdim EndLoc, CollapsedNum, NumClauses) {} 3841309124Sdim 3842309124Sdim /// Build an empty directive. 3843309124Sdim /// 3844309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3845309124Sdim /// \param NumClauses Number of clauses. 3846309124Sdim /// 3847309124Sdim explicit OMPTargetParallelForSimdDirective(unsigned CollapsedNum, 3848309124Sdim unsigned NumClauses) 3849309124Sdim : OMPLoopDirective(this, OMPTargetParallelForSimdDirectiveClass, 3850360784Sdim llvm::omp::OMPD_target_parallel_for_simd, 3851360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, 3852360784Sdim NumClauses) {} 3853309124Sdim 3854309124Sdimpublic: 3855309124Sdim /// Creates directive with a list of \a Clauses. 3856309124Sdim /// 3857309124Sdim /// \param C AST context. 3858309124Sdim /// \param StartLoc Starting location of the directive kind. 3859309124Sdim /// \param EndLoc Ending Location of the directive. 3860309124Sdim /// \param CollapsedNum Number of collapsed loops. 3861309124Sdim /// \param Clauses List of clauses. 3862309124Sdim /// \param AssociatedStmt Statement, associated with the directive. 3863309124Sdim /// \param Exprs Helper expressions for CodeGen. 3864309124Sdim /// 3865309124Sdim static OMPTargetParallelForSimdDirective * 3866309124Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3867309124Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3868309124Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3869309124Sdim 3870309124Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 3871309124Sdim /// 3872309124Sdim /// \param C AST context. 3873309124Sdim /// \param CollapsedNum Number of collapsed nested loops. 3874309124Sdim /// \param NumClauses Number of clauses. 3875309124Sdim /// 3876309124Sdim static OMPTargetParallelForSimdDirective *CreateEmpty(const ASTContext &C, 3877309124Sdim unsigned NumClauses, 3878309124Sdim unsigned CollapsedNum, 3879309124Sdim EmptyShell); 3880309124Sdim 3881309124Sdim static bool classof(const Stmt *T) { 3882309124Sdim return T->getStmtClass() == OMPTargetParallelForSimdDirectiveClass; 3883309124Sdim } 3884309124Sdim}; 3885309124Sdim 3886314564Sdim/// This represents '#pragma omp target simd' directive. 3887314564Sdim/// 3888314564Sdim/// \code 3889314564Sdim/// #pragma omp target simd private(a) map(b) safelen(c) 3890314564Sdim/// \endcode 3891314564Sdim/// In this example directive '#pragma omp target simd' has clauses 'private' 3892314564Sdim/// with the variable 'a', 'map' with the variable 'b' and 'safelen' with 3893314564Sdim/// the variable 'c'. 3894314564Sdim/// 3895314564Sdimclass OMPTargetSimdDirective final : public OMPLoopDirective { 3896314564Sdim friend class ASTStmtReader; 3897314564Sdim 3898314564Sdim /// Build directive with the given start and end location. 3899314564Sdim /// 3900314564Sdim /// \param StartLoc Starting location of the directive kind. 3901314564Sdim /// \param EndLoc Ending location of the directive. 3902314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 3903314564Sdim /// \param NumClauses Number of clauses. 3904314564Sdim /// 3905314564Sdim OMPTargetSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc, 3906314564Sdim unsigned CollapsedNum, unsigned NumClauses) 3907314564Sdim : OMPLoopDirective(this, OMPTargetSimdDirectiveClass, 3908360784Sdim llvm::omp::OMPD_target_simd, StartLoc, EndLoc, 3909360784Sdim CollapsedNum, NumClauses) {} 3910314564Sdim 3911314564Sdim /// Build an empty directive. 3912314564Sdim /// 3913314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 3914314564Sdim /// \param NumClauses Number of clauses. 3915314564Sdim /// 3916314564Sdim explicit OMPTargetSimdDirective(unsigned CollapsedNum, unsigned NumClauses) 3917360784Sdim : OMPLoopDirective(this, OMPTargetSimdDirectiveClass, 3918360784Sdim llvm::omp::OMPD_target_simd, SourceLocation(), 3919360784Sdim SourceLocation(), CollapsedNum, NumClauses) {} 3920314564Sdim 3921314564Sdimpublic: 3922314564Sdim /// Creates directive with a list of \a Clauses. 3923314564Sdim /// 3924314564Sdim /// \param C AST context. 3925314564Sdim /// \param StartLoc Starting location of the directive kind. 3926314564Sdim /// \param EndLoc Ending Location of the directive. 3927314564Sdim /// \param CollapsedNum Number of collapsed loops. 3928314564Sdim /// \param Clauses List of clauses. 3929314564Sdim /// \param AssociatedStmt Statement, associated with the directive. 3930314564Sdim /// \param Exprs Helper expressions for CodeGen. 3931314564Sdim /// 3932314564Sdim static OMPTargetSimdDirective * 3933314564Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 3934314564Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 3935314564Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 3936314564Sdim 3937314564Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 3938314564Sdim /// 3939314564Sdim /// \param C AST context. 3940314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 3941314564Sdim /// \param NumClauses Number of clauses. 3942314564Sdim /// 3943314564Sdim static OMPTargetSimdDirective *CreateEmpty(const ASTContext &C, 3944314564Sdim unsigned NumClauses, 3945314564Sdim unsigned CollapsedNum, 3946314564Sdim EmptyShell); 3947314564Sdim 3948314564Sdim static bool classof(const Stmt *T) { 3949314564Sdim return T->getStmtClass() == OMPTargetSimdDirectiveClass; 3950314564Sdim } 3951314564Sdim}; 3952314564Sdim 3953314564Sdim/// This represents '#pragma omp teams distribute' directive. 3954314564Sdim/// 3955314564Sdim/// \code 3956314564Sdim/// #pragma omp teams distribute private(a,b) 3957314564Sdim/// \endcode 3958314564Sdim/// In this example directive '#pragma omp teams distribute' has clauses 3959314564Sdim/// 'private' with the variables 'a' and 'b' 3960314564Sdim/// 3961314564Sdimclass OMPTeamsDistributeDirective final : public OMPLoopDirective { 3962314564Sdim friend class ASTStmtReader; 3963314564Sdim 3964314564Sdim /// Build directive with the given start and end location. 3965314564Sdim /// 3966314564Sdim /// \param StartLoc Starting location of the directive kind. 3967314564Sdim /// \param EndLoc Ending location of the directive. 3968314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 3969314564Sdim /// \param NumClauses Number of clauses. 3970314564Sdim /// 3971314564Sdim OMPTeamsDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc, 3972314564Sdim unsigned CollapsedNum, unsigned NumClauses) 3973341825Sdim : OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass, 3974360784Sdim llvm::omp::OMPD_teams_distribute, StartLoc, EndLoc, 3975314564Sdim CollapsedNum, NumClauses) {} 3976314564Sdim 3977314564Sdim /// Build an empty directive. 3978314564Sdim /// 3979314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 3980314564Sdim /// \param NumClauses Number of clauses. 3981314564Sdim /// 3982314564Sdim explicit OMPTeamsDistributeDirective(unsigned CollapsedNum, 3983314564Sdim unsigned NumClauses) 3984314564Sdim : OMPLoopDirective(this, OMPTeamsDistributeDirectiveClass, 3985360784Sdim llvm::omp::OMPD_teams_distribute, SourceLocation(), 3986314564Sdim SourceLocation(), CollapsedNum, NumClauses) {} 3987314564Sdim 3988314564Sdimpublic: 3989314564Sdim /// Creates directive with a list of \a Clauses. 3990314564Sdim /// 3991314564Sdim /// \param C AST context. 3992314564Sdim /// \param StartLoc Starting location of the directive kind. 3993314564Sdim /// \param EndLoc Ending Location of the directive. 3994314564Sdim /// \param CollapsedNum Number of collapsed loops. 3995314564Sdim /// \param Clauses List of clauses. 3996314564Sdim /// \param AssociatedStmt Statement, associated with the directive. 3997314564Sdim /// \param Exprs Helper expressions for CodeGen. 3998314564Sdim /// 3999314564Sdim static OMPTeamsDistributeDirective * 4000314564Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 4001314564Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 4002314564Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 4003314564Sdim 4004314564Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 4005314564Sdim /// 4006314564Sdim /// \param C AST context. 4007314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4008314564Sdim /// \param NumClauses Number of clauses. 4009314564Sdim /// 4010314564Sdim static OMPTeamsDistributeDirective *CreateEmpty(const ASTContext &C, 4011314564Sdim unsigned NumClauses, 4012314564Sdim unsigned CollapsedNum, 4013314564Sdim EmptyShell); 4014314564Sdim 4015314564Sdim static bool classof(const Stmt *T) { 4016314564Sdim return T->getStmtClass() == OMPTeamsDistributeDirectiveClass; 4017314564Sdim } 4018314564Sdim}; 4019314564Sdim 4020314564Sdim/// This represents '#pragma omp teams distribute simd' 4021314564Sdim/// combined directive. 4022314564Sdim/// 4023314564Sdim/// \code 4024314564Sdim/// #pragma omp teams distribute simd private(a,b) 4025314564Sdim/// \endcode 4026314564Sdim/// In this example directive '#pragma omp teams distribute simd' 4027314564Sdim/// has clause 'private' with the variables 'a' and 'b' 4028314564Sdim/// 4029314564Sdimclass OMPTeamsDistributeSimdDirective final : public OMPLoopDirective { 4030314564Sdim friend class ASTStmtReader; 4031314564Sdim 4032314564Sdim /// Build directive with the given start and end location. 4033314564Sdim /// 4034314564Sdim /// \param StartLoc Starting location of the directive kind. 4035314564Sdim /// \param EndLoc Ending location of the directive. 4036314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4037314564Sdim /// \param NumClauses Number of clauses. 4038314564Sdim /// 4039314564Sdim OMPTeamsDistributeSimdDirective(SourceLocation StartLoc, 4040314564Sdim SourceLocation EndLoc, unsigned CollapsedNum, 4041314564Sdim unsigned NumClauses) 4042314564Sdim : OMPLoopDirective(this, OMPTeamsDistributeSimdDirectiveClass, 4043360784Sdim llvm::omp::OMPD_teams_distribute_simd, StartLoc, 4044360784Sdim EndLoc, CollapsedNum, NumClauses) {} 4045314564Sdim 4046314564Sdim /// Build an empty directive. 4047314564Sdim /// 4048314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4049314564Sdim /// \param NumClauses Number of clauses. 4050314564Sdim /// 4051314564Sdim explicit OMPTeamsDistributeSimdDirective(unsigned CollapsedNum, 4052314564Sdim unsigned NumClauses) 4053314564Sdim : OMPLoopDirective(this, OMPTeamsDistributeSimdDirectiveClass, 4054360784Sdim llvm::omp::OMPD_teams_distribute_simd, 4055360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, 4056360784Sdim NumClauses) {} 4057314564Sdim 4058314564Sdimpublic: 4059314564Sdim /// Creates directive with a list of \a Clauses. 4060314564Sdim /// 4061314564Sdim /// \param C AST context. 4062314564Sdim /// \param StartLoc Starting location of the directive kind. 4063314564Sdim /// \param EndLoc Ending Location of the directive. 4064314564Sdim /// \param CollapsedNum Number of collapsed loops. 4065314564Sdim /// \param Clauses List of clauses. 4066314564Sdim /// \param AssociatedStmt Statement, associated with the directive. 4067314564Sdim /// \param Exprs Helper expressions for CodeGen. 4068314564Sdim /// 4069314564Sdim static OMPTeamsDistributeSimdDirective * 4070314564Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 4071314564Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 4072314564Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 4073314564Sdim 4074314564Sdim /// Creates an empty directive with the place 4075314564Sdim /// for \a NumClauses clauses. 4076314564Sdim /// 4077314564Sdim /// \param C AST context. 4078314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4079314564Sdim /// \param NumClauses Number of clauses. 4080314564Sdim /// 4081314564Sdim static OMPTeamsDistributeSimdDirective *CreateEmpty(const ASTContext &C, 4082314564Sdim unsigned NumClauses, 4083314564Sdim unsigned CollapsedNum, 4084314564Sdim EmptyShell); 4085314564Sdim 4086314564Sdim static bool classof(const Stmt *T) { 4087314564Sdim return T->getStmtClass() == OMPTeamsDistributeSimdDirectiveClass; 4088314564Sdim } 4089314564Sdim}; 4090314564Sdim 4091314564Sdim/// This represents '#pragma omp teams distribute parallel for simd' composite 4092314564Sdim/// directive. 4093314564Sdim/// 4094314564Sdim/// \code 4095314564Sdim/// #pragma omp teams distribute parallel for simd private(x) 4096314564Sdim/// \endcode 4097314564Sdim/// In this example directive '#pragma omp teams distribute parallel for simd' 4098314564Sdim/// has clause 'private' with the variables 'x' 4099314564Sdim/// 4100314564Sdimclass OMPTeamsDistributeParallelForSimdDirective final 4101314564Sdim : public OMPLoopDirective { 4102314564Sdim friend class ASTStmtReader; 4103314564Sdim 4104314564Sdim /// Build directive with the given start and end location. 4105314564Sdim /// 4106314564Sdim /// \param StartLoc Starting location of the directive kind. 4107314564Sdim /// \param EndLoc Ending location of the directive. 4108314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4109314564Sdim /// \param NumClauses Number of clauses. 4110314564Sdim /// 4111314564Sdim OMPTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc, 4112314564Sdim SourceLocation EndLoc, 4113314564Sdim unsigned CollapsedNum, 4114314564Sdim unsigned NumClauses) 4115314564Sdim : OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass, 4116360784Sdim llvm::omp::OMPD_teams_distribute_parallel_for_simd, 4117360784Sdim StartLoc, EndLoc, CollapsedNum, NumClauses) {} 4118314564Sdim 4119314564Sdim /// Build an empty directive. 4120314564Sdim /// 4121314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4122314564Sdim /// \param NumClauses Number of clauses. 4123314564Sdim /// 4124314564Sdim explicit OMPTeamsDistributeParallelForSimdDirective(unsigned CollapsedNum, 4125314564Sdim unsigned NumClauses) 4126314564Sdim : OMPLoopDirective(this, OMPTeamsDistributeParallelForSimdDirectiveClass, 4127360784Sdim llvm::omp::OMPD_teams_distribute_parallel_for_simd, 4128314564Sdim SourceLocation(), SourceLocation(), CollapsedNum, 4129314564Sdim NumClauses) {} 4130314564Sdim 4131314564Sdimpublic: 4132314564Sdim /// Creates directive with a list of \a Clauses. 4133314564Sdim /// 4134314564Sdim /// \param C AST context. 4135314564Sdim /// \param StartLoc Starting location of the directive kind. 4136314564Sdim /// \param EndLoc Ending Location of the directive. 4137314564Sdim /// \param CollapsedNum Number of collapsed loops. 4138314564Sdim /// \param Clauses List of clauses. 4139314564Sdim /// \param AssociatedStmt Statement, associated with the directive. 4140314564Sdim /// \param Exprs Helper expressions for CodeGen. 4141314564Sdim /// 4142314564Sdim static OMPTeamsDistributeParallelForSimdDirective * 4143314564Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 4144314564Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 4145314564Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 4146314564Sdim 4147314564Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 4148314564Sdim /// 4149314564Sdim /// \param C AST context. 4150314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4151314564Sdim /// \param NumClauses Number of clauses. 4152314564Sdim /// 4153314564Sdim static OMPTeamsDistributeParallelForSimdDirective * 4154314564Sdim CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 4155314564Sdim EmptyShell); 4156314564Sdim 4157314564Sdim static bool classof(const Stmt *T) { 4158314564Sdim return T->getStmtClass() == OMPTeamsDistributeParallelForSimdDirectiveClass; 4159314564Sdim } 4160314564Sdim}; 4161314564Sdim 4162314564Sdim/// This represents '#pragma omp teams distribute parallel for' composite 4163314564Sdim/// directive. 4164314564Sdim/// 4165314564Sdim/// \code 4166314564Sdim/// #pragma omp teams distribute parallel for private(x) 4167314564Sdim/// \endcode 4168314564Sdim/// In this example directive '#pragma omp teams distribute parallel for' 4169314564Sdim/// has clause 'private' with the variables 'x' 4170314564Sdim/// 4171314564Sdimclass OMPTeamsDistributeParallelForDirective final : public OMPLoopDirective { 4172314564Sdim friend class ASTStmtReader; 4173327952Sdim /// true if the construct has inner cancel directive. 4174327952Sdim bool HasCancel = false; 4175314564Sdim 4176314564Sdim /// Build directive with the given start and end location. 4177314564Sdim /// 4178314564Sdim /// \param StartLoc Starting location of the directive kind. 4179314564Sdim /// \param EndLoc Ending location of the directive. 4180314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4181314564Sdim /// \param NumClauses Number of clauses. 4182314564Sdim /// 4183314564Sdim OMPTeamsDistributeParallelForDirective(SourceLocation StartLoc, 4184314564Sdim SourceLocation EndLoc, 4185314564Sdim unsigned CollapsedNum, 4186314564Sdim unsigned NumClauses) 4187314564Sdim : OMPLoopDirective(this, OMPTeamsDistributeParallelForDirectiveClass, 4188360784Sdim llvm::omp::OMPD_teams_distribute_parallel_for, 4189360784Sdim StartLoc, EndLoc, CollapsedNum, NumClauses), 4190360784Sdim HasCancel(false) {} 4191314564Sdim 4192314564Sdim /// Build an empty directive. 4193314564Sdim /// 4194314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4195314564Sdim /// \param NumClauses Number of clauses. 4196314564Sdim /// 4197314564Sdim explicit OMPTeamsDistributeParallelForDirective(unsigned CollapsedNum, 4198314564Sdim unsigned NumClauses) 4199314564Sdim : OMPLoopDirective(this, OMPTeamsDistributeParallelForDirectiveClass, 4200360784Sdim llvm::omp::OMPD_teams_distribute_parallel_for, 4201360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, 4202360784Sdim NumClauses), 4203327952Sdim HasCancel(false) {} 4204314564Sdim 4205327952Sdim /// Set cancel state. 4206327952Sdim void setHasCancel(bool Has) { HasCancel = Has; } 4207327952Sdim 4208314564Sdimpublic: 4209314564Sdim /// Creates directive with a list of \a Clauses. 4210314564Sdim /// 4211314564Sdim /// \param C AST context. 4212314564Sdim /// \param StartLoc Starting location of the directive kind. 4213314564Sdim /// \param EndLoc Ending Location of the directive. 4214314564Sdim /// \param CollapsedNum Number of collapsed loops. 4215314564Sdim /// \param Clauses List of clauses. 4216314564Sdim /// \param AssociatedStmt Statement, associated with the directive. 4217314564Sdim /// \param Exprs Helper expressions for CodeGen. 4218327952Sdim /// \param HasCancel true if this directive has inner cancel directive. 4219314564Sdim /// 4220314564Sdim static OMPTeamsDistributeParallelForDirective * 4221314564Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 4222314564Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 4223327952Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel); 4224314564Sdim 4225314564Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 4226314564Sdim /// 4227314564Sdim /// \param C AST context. 4228314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4229314564Sdim /// \param NumClauses Number of clauses. 4230314564Sdim /// 4231314564Sdim static OMPTeamsDistributeParallelForDirective * 4232314564Sdim CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 4233314564Sdim EmptyShell); 4234314564Sdim 4235327952Sdim /// Return true if current directive has inner cancel directive. 4236327952Sdim bool hasCancel() const { return HasCancel; } 4237327952Sdim 4238314564Sdim static bool classof(const Stmt *T) { 4239314564Sdim return T->getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass; 4240314564Sdim } 4241314564Sdim}; 4242314564Sdim 4243314564Sdim/// This represents '#pragma omp target teams' directive. 4244314564Sdim/// 4245314564Sdim/// \code 4246314564Sdim/// #pragma omp target teams if(a>0) 4247314564Sdim/// \endcode 4248314564Sdim/// In this example directive '#pragma omp target teams' has clause 'if' with 4249314564Sdim/// condition 'a>0'. 4250314564Sdim/// 4251314564Sdimclass OMPTargetTeamsDirective final : public OMPExecutableDirective { 4252314564Sdim friend class ASTStmtReader; 4253314564Sdim /// Build directive with the given start and end location. 4254314564Sdim /// 4255314564Sdim /// \param StartLoc Starting location of the directive kind. 4256314564Sdim /// \param EndLoc Ending location of the directive. 4257314564Sdim /// \param NumClauses Number of clauses. 4258314564Sdim /// 4259314564Sdim OMPTargetTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc, 4260314564Sdim unsigned NumClauses) 4261314564Sdim : OMPExecutableDirective(this, OMPTargetTeamsDirectiveClass, 4262360784Sdim llvm::omp::OMPD_target_teams, StartLoc, EndLoc, 4263360784Sdim NumClauses, 1) {} 4264314564Sdim 4265314564Sdim /// Build an empty directive. 4266314564Sdim /// 4267314564Sdim /// \param NumClauses Number of clauses. 4268314564Sdim /// 4269314564Sdim explicit OMPTargetTeamsDirective(unsigned NumClauses) 4270314564Sdim : OMPExecutableDirective(this, OMPTargetTeamsDirectiveClass, 4271360784Sdim llvm::omp::OMPD_target_teams, SourceLocation(), 4272314564Sdim SourceLocation(), NumClauses, 1) {} 4273314564Sdim 4274314564Sdimpublic: 4275314564Sdim /// Creates directive with a list of \a Clauses. 4276314564Sdim /// 4277314564Sdim /// \param C AST context. 4278314564Sdim /// \param StartLoc Starting location of the directive kind. 4279314564Sdim /// \param EndLoc Ending Location of the directive. 4280314564Sdim /// \param Clauses List of clauses. 4281314564Sdim /// \param AssociatedStmt Statement, associated with the directive. 4282314564Sdim /// 4283314564Sdim static OMPTargetTeamsDirective *Create(const ASTContext &C, 4284314564Sdim SourceLocation StartLoc, 4285314564Sdim SourceLocation EndLoc, 4286314564Sdim ArrayRef<OMPClause *> Clauses, 4287314564Sdim Stmt *AssociatedStmt); 4288314564Sdim 4289314564Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 4290314564Sdim /// 4291314564Sdim /// \param C AST context. 4292314564Sdim /// \param NumClauses Number of clauses. 4293314564Sdim /// 4294314564Sdim static OMPTargetTeamsDirective *CreateEmpty(const ASTContext &C, 4295314564Sdim unsigned NumClauses, EmptyShell); 4296314564Sdim 4297314564Sdim static bool classof(const Stmt *T) { 4298314564Sdim return T->getStmtClass() == OMPTargetTeamsDirectiveClass; 4299314564Sdim } 4300314564Sdim}; 4301314564Sdim 4302314564Sdim/// This represents '#pragma omp target teams distribute' combined directive. 4303314564Sdim/// 4304314564Sdim/// \code 4305314564Sdim/// #pragma omp target teams distribute private(x) 4306314564Sdim/// \endcode 4307314564Sdim/// In this example directive '#pragma omp target teams distribute' has clause 4308314564Sdim/// 'private' with the variables 'x' 4309314564Sdim/// 4310314564Sdimclass OMPTargetTeamsDistributeDirective final : public OMPLoopDirective { 4311314564Sdim friend class ASTStmtReader; 4312314564Sdim 4313314564Sdim /// Build directive with the given start and end location. 4314314564Sdim /// 4315314564Sdim /// \param StartLoc Starting location of the directive kind. 4316314564Sdim /// \param EndLoc Ending location of the directive. 4317314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4318314564Sdim /// \param NumClauses Number of clauses. 4319314564Sdim /// 4320314564Sdim OMPTargetTeamsDistributeDirective(SourceLocation StartLoc, 4321314564Sdim SourceLocation EndLoc, 4322314564Sdim unsigned CollapsedNum, unsigned NumClauses) 4323314564Sdim : OMPLoopDirective(this, OMPTargetTeamsDistributeDirectiveClass, 4324360784Sdim llvm::omp::OMPD_target_teams_distribute, StartLoc, 4325360784Sdim EndLoc, CollapsedNum, NumClauses) {} 4326314564Sdim 4327314564Sdim /// Build an empty directive. 4328314564Sdim /// 4329314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4330314564Sdim /// \param NumClauses Number of clauses. 4331314564Sdim /// 4332314564Sdim explicit OMPTargetTeamsDistributeDirective(unsigned CollapsedNum, 4333314564Sdim unsigned NumClauses) 4334314564Sdim : OMPLoopDirective(this, OMPTargetTeamsDistributeDirectiveClass, 4335360784Sdim llvm::omp::OMPD_target_teams_distribute, 4336360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, 4337360784Sdim NumClauses) {} 4338314564Sdim 4339314564Sdimpublic: 4340314564Sdim /// Creates directive with a list of \a Clauses. 4341314564Sdim /// 4342314564Sdim /// \param C AST context. 4343314564Sdim /// \param StartLoc Starting location of the directive kind. 4344314564Sdim /// \param EndLoc Ending Location of the directive. 4345314564Sdim /// \param CollapsedNum Number of collapsed loops. 4346314564Sdim /// \param Clauses List of clauses. 4347314564Sdim /// \param AssociatedStmt Statement, associated with the directive. 4348314564Sdim /// \param Exprs Helper expressions for CodeGen. 4349314564Sdim /// 4350314564Sdim static OMPTargetTeamsDistributeDirective * 4351314564Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 4352314564Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 4353314564Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 4354314564Sdim 4355314564Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 4356314564Sdim /// 4357314564Sdim /// \param C AST context. 4358314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4359314564Sdim /// \param NumClauses Number of clauses. 4360314564Sdim /// 4361314564Sdim static OMPTargetTeamsDistributeDirective * 4362314564Sdim CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 4363314564Sdim EmptyShell); 4364314564Sdim 4365314564Sdim static bool classof(const Stmt *T) { 4366314564Sdim return T->getStmtClass() == OMPTargetTeamsDistributeDirectiveClass; 4367314564Sdim } 4368314564Sdim}; 4369314564Sdim 4370314564Sdim/// This represents '#pragma omp target teams distribute parallel for' combined 4371314564Sdim/// directive. 4372314564Sdim/// 4373314564Sdim/// \code 4374314564Sdim/// #pragma omp target teams distribute parallel for private(x) 4375314564Sdim/// \endcode 4376314564Sdim/// In this example directive '#pragma omp target teams distribute parallel 4377314564Sdim/// for' has clause 'private' with the variables 'x' 4378314564Sdim/// 4379314564Sdimclass OMPTargetTeamsDistributeParallelForDirective final 4380314564Sdim : public OMPLoopDirective { 4381314564Sdim friend class ASTStmtReader; 4382327952Sdim /// true if the construct has inner cancel directive. 4383327952Sdim bool HasCancel = false; 4384314564Sdim 4385314564Sdim /// Build directive with the given start and end location. 4386314564Sdim /// 4387314564Sdim /// \param StartLoc Starting location of the directive kind. 4388314564Sdim /// \param EndLoc Ending location of the directive. 4389314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4390314564Sdim /// \param NumClauses Number of clauses. 4391314564Sdim /// 4392314564Sdim OMPTargetTeamsDistributeParallelForDirective(SourceLocation StartLoc, 4393314564Sdim SourceLocation EndLoc, 4394314564Sdim unsigned CollapsedNum, 4395314564Sdim unsigned NumClauses) 4396314564Sdim : OMPLoopDirective(this, 4397314564Sdim OMPTargetTeamsDistributeParallelForDirectiveClass, 4398360784Sdim llvm::omp::OMPD_target_teams_distribute_parallel_for, 4399360784Sdim StartLoc, EndLoc, CollapsedNum, NumClauses), 4400327952Sdim HasCancel(false) {} 4401314564Sdim 4402314564Sdim /// Build an empty directive. 4403314564Sdim /// 4404314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4405314564Sdim /// \param NumClauses Number of clauses. 4406314564Sdim /// 4407314564Sdim explicit OMPTargetTeamsDistributeParallelForDirective(unsigned CollapsedNum, 4408314564Sdim unsigned NumClauses) 4409314564Sdim : OMPLoopDirective( 4410314564Sdim this, OMPTargetTeamsDistributeParallelForDirectiveClass, 4411360784Sdim llvm::omp::OMPD_target_teams_distribute_parallel_for, 4412360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, NumClauses), 4413327952Sdim HasCancel(false) {} 4414314564Sdim 4415327952Sdim /// Set cancel state. 4416327952Sdim void setHasCancel(bool Has) { HasCancel = Has; } 4417327952Sdim 4418314564Sdimpublic: 4419314564Sdim /// Creates directive with a list of \a Clauses. 4420314564Sdim /// 4421314564Sdim /// \param C AST context. 4422314564Sdim /// \param StartLoc Starting location of the directive kind. 4423314564Sdim /// \param EndLoc Ending Location of the directive. 4424314564Sdim /// \param CollapsedNum Number of collapsed loops. 4425314564Sdim /// \param Clauses List of clauses. 4426314564Sdim /// \param AssociatedStmt Statement, associated with the directive. 4427314564Sdim /// \param Exprs Helper expressions for CodeGen. 4428327952Sdim /// \param HasCancel true if this directive has inner cancel directive. 4429314564Sdim /// 4430314564Sdim static OMPTargetTeamsDistributeParallelForDirective * 4431314564Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 4432314564Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 4433327952Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel); 4434314564Sdim 4435314564Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 4436314564Sdim /// 4437314564Sdim /// \param C AST context. 4438314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4439314564Sdim /// \param NumClauses Number of clauses. 4440314564Sdim /// 4441314564Sdim static OMPTargetTeamsDistributeParallelForDirective * 4442314564Sdim CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 4443314564Sdim EmptyShell); 4444314564Sdim 4445327952Sdim /// Return true if current directive has inner cancel directive. 4446327952Sdim bool hasCancel() const { return HasCancel; } 4447327952Sdim 4448314564Sdim static bool classof(const Stmt *T) { 4449314564Sdim return T->getStmtClass() == 4450314564Sdim OMPTargetTeamsDistributeParallelForDirectiveClass; 4451314564Sdim } 4452314564Sdim}; 4453314564Sdim 4454314564Sdim/// This represents '#pragma omp target teams distribute parallel for simd' 4455314564Sdim/// combined directive. 4456314564Sdim/// 4457314564Sdim/// \code 4458314564Sdim/// #pragma omp target teams distribute parallel for simd private(x) 4459314564Sdim/// \endcode 4460314564Sdim/// In this example directive '#pragma omp target teams distribute parallel 4461314564Sdim/// for simd' has clause 'private' with the variables 'x' 4462314564Sdim/// 4463314564Sdimclass OMPTargetTeamsDistributeParallelForSimdDirective final 4464314564Sdim : public OMPLoopDirective { 4465314564Sdim friend class ASTStmtReader; 4466314564Sdim 4467314564Sdim /// Build directive with the given start and end location. 4468314564Sdim /// 4469314564Sdim /// \param StartLoc Starting location of the directive kind. 4470314564Sdim /// \param EndLoc Ending location of the directive. 4471314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4472314564Sdim /// \param NumClauses Number of clauses. 4473314564Sdim /// 4474314564Sdim OMPTargetTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc, 4475314564Sdim SourceLocation EndLoc, 4476314564Sdim unsigned CollapsedNum, 4477314564Sdim unsigned NumClauses) 4478360784Sdim : OMPLoopDirective( 4479360784Sdim this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass, 4480360784Sdim llvm::omp::OMPD_target_teams_distribute_parallel_for_simd, StartLoc, 4481360784Sdim EndLoc, CollapsedNum, NumClauses) {} 4482314564Sdim 4483314564Sdim /// Build an empty directive. 4484314564Sdim /// 4485314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4486314564Sdim /// \param NumClauses Number of clauses. 4487314564Sdim /// 4488314564Sdim explicit OMPTargetTeamsDistributeParallelForSimdDirective( 4489314564Sdim unsigned CollapsedNum, unsigned NumClauses) 4490314564Sdim : OMPLoopDirective( 4491314564Sdim this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass, 4492360784Sdim llvm::omp::OMPD_target_teams_distribute_parallel_for_simd, 4493360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, NumClauses) {} 4494314564Sdim 4495314564Sdimpublic: 4496314564Sdim /// Creates directive with a list of \a Clauses. 4497314564Sdim /// 4498314564Sdim /// \param C AST context. 4499314564Sdim /// \param StartLoc Starting location of the directive kind. 4500314564Sdim /// \param EndLoc Ending Location of the directive. 4501314564Sdim /// \param CollapsedNum Number of collapsed loops. 4502314564Sdim /// \param Clauses List of clauses. 4503314564Sdim /// \param AssociatedStmt Statement, associated with the directive. 4504314564Sdim /// \param Exprs Helper expressions for CodeGen. 4505314564Sdim /// 4506314564Sdim static OMPTargetTeamsDistributeParallelForSimdDirective * 4507314564Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 4508314564Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 4509314564Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 4510314564Sdim 4511314564Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 4512314564Sdim /// 4513314564Sdim /// \param C AST context. 4514314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4515314564Sdim /// \param NumClauses Number of clauses. 4516314564Sdim /// 4517314564Sdim static OMPTargetTeamsDistributeParallelForSimdDirective * 4518314564Sdim CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 4519314564Sdim EmptyShell); 4520314564Sdim 4521314564Sdim static bool classof(const Stmt *T) { 4522314564Sdim return T->getStmtClass() == 4523314564Sdim OMPTargetTeamsDistributeParallelForSimdDirectiveClass; 4524314564Sdim } 4525314564Sdim}; 4526314564Sdim 4527314564Sdim/// This represents '#pragma omp target teams distribute simd' combined 4528314564Sdim/// directive. 4529314564Sdim/// 4530314564Sdim/// \code 4531314564Sdim/// #pragma omp target teams distribute simd private(x) 4532314564Sdim/// \endcode 4533314564Sdim/// In this example directive '#pragma omp target teams distribute simd' 4534314564Sdim/// has clause 'private' with the variables 'x' 4535314564Sdim/// 4536314564Sdimclass OMPTargetTeamsDistributeSimdDirective final : public OMPLoopDirective { 4537314564Sdim friend class ASTStmtReader; 4538314564Sdim 4539314564Sdim /// Build directive with the given start and end location. 4540314564Sdim /// 4541314564Sdim /// \param StartLoc Starting location of the directive kind. 4542314564Sdim /// \param EndLoc Ending location of the directive. 4543314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4544314564Sdim /// \param NumClauses Number of clauses. 4545314564Sdim /// 4546314564Sdim OMPTargetTeamsDistributeSimdDirective(SourceLocation StartLoc, 4547314564Sdim SourceLocation EndLoc, 4548314564Sdim unsigned CollapsedNum, 4549314564Sdim unsigned NumClauses) 4550314564Sdim : OMPLoopDirective(this, OMPTargetTeamsDistributeSimdDirectiveClass, 4551360784Sdim llvm::omp::OMPD_target_teams_distribute_simd, StartLoc, 4552360784Sdim EndLoc, CollapsedNum, NumClauses) {} 4553314564Sdim 4554314564Sdim /// Build an empty directive. 4555314564Sdim /// 4556314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4557314564Sdim /// \param NumClauses Number of clauses. 4558314564Sdim /// 4559314564Sdim explicit OMPTargetTeamsDistributeSimdDirective(unsigned CollapsedNum, 4560314564Sdim unsigned NumClauses) 4561314564Sdim : OMPLoopDirective(this, OMPTargetTeamsDistributeSimdDirectiveClass, 4562360784Sdim llvm::omp::OMPD_target_teams_distribute_simd, 4563360784Sdim SourceLocation(), SourceLocation(), CollapsedNum, 4564360784Sdim NumClauses) {} 4565314564Sdim 4566314564Sdimpublic: 4567314564Sdim /// Creates directive with a list of \a Clauses. 4568314564Sdim /// 4569314564Sdim /// \param C AST context. 4570314564Sdim /// \param StartLoc Starting location of the directive kind. 4571314564Sdim /// \param EndLoc Ending Location of the directive. 4572314564Sdim /// \param CollapsedNum Number of collapsed loops. 4573314564Sdim /// \param Clauses List of clauses. 4574314564Sdim /// \param AssociatedStmt Statement, associated with the directive. 4575314564Sdim /// \param Exprs Helper expressions for CodeGen. 4576314564Sdim /// 4577314564Sdim static OMPTargetTeamsDistributeSimdDirective * 4578314564Sdim Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, 4579314564Sdim unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, 4580314564Sdim Stmt *AssociatedStmt, const HelperExprs &Exprs); 4581314564Sdim 4582314564Sdim /// Creates an empty directive with the place for \a NumClauses clauses. 4583314564Sdim /// 4584314564Sdim /// \param C AST context. 4585314564Sdim /// \param CollapsedNum Number of collapsed nested loops. 4586314564Sdim /// \param NumClauses Number of clauses. 4587314564Sdim /// 4588314564Sdim static OMPTargetTeamsDistributeSimdDirective * 4589314564Sdim CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, 4590314564Sdim EmptyShell); 4591314564Sdim 4592314564Sdim static bool classof(const Stmt *T) { 4593314564Sdim return T->getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass; 4594314564Sdim } 4595314564Sdim}; 4596314564Sdim 4597276479Sdim} // end namespace clang 4598259701Sdim 4599259701Sdim#endif 4600