14#ifndef LLVM_CLANG_AST_STMTOPENMP_H
15#define LLVM_CLANG_AST_STMTOPENMP_H
152 LastSubStmt = LOOPVAR_REF
157 Stmt *SubStmts[LastSubStmt + 1] = {};
159 OMPCanonicalLoop() :
Stmt(
StmtClass::OMPCanonicalLoopClass) {}
168 S->setLoopStmt(LoopStmt);
169 S->setDistanceFunc(DistanceFunc);
170 S->setLoopVarFunc(LoopVarFunc);
171 S->setLoopVarRef(LoopVarRef);
181 return S->getStmtClass() == StmtClass::OMPCanonicalLoopClass;
190 return child_range(&SubStmts[0], &SubStmts[0] + LastSubStmt + 1);
202 assert((isa<ForStmt>(S) || isa<CXXForRangeStmt>(S)) &&
203 "Canonical loop must be a for loop (range-based or otherwise)");
204 SubStmts[LOOP_STMT] = S;
216 return cast<CapturedStmt>(SubStmts[DISTANCE_FUNC]);
219 return cast<CapturedStmt>(SubStmts[DISTANCE_FUNC]);
222 assert(S &&
"Expected non-null captured statement");
223 SubStmts[DISTANCE_FUNC] = S;
237 return cast<CapturedStmt>(SubStmts[LOOPVAR_FUNC]);
240 return cast<CapturedStmt>(SubStmts[LOOPVAR_FUNC]);
243 assert(S &&
"Expected non-null captured statement");
244 SubStmts[LOOPVAR_FUNC] = S;
251 return cast<DeclRefExpr>(SubStmts[LOOPVAR_REF]);
254 return cast<DeclRefExpr>(SubStmts[LOOPVAR_REF]);
257 assert(
E &&
"Expected non-null loop variable");
258 SubStmts[LOOPVAR_REF] =
E;
297 :
Stmt(SC),
Kind(K), StartLoc(
std::move(StartLoc)),
298 EndLoc(
std::move(EndLoc)) {}
300 template <
typename T,
typename... Params>
302 Stmt *AssociatedStmt,
unsigned NumChildren,
305 C.Allocate(
sizeof(
T) + OMPChildren::size(Clauses.size(), AssociatedStmt,
309 auto *
Data = OMPChildren::Create(
reinterpret_cast<T *
>(Mem) + 1, Clauses,
310 AssociatedStmt, NumChildren);
311 auto *Inst =
new (Mem)
T(std::forward<Params>(
P)...);
316 template <
typename T,
typename... Params>
318 bool HasAssociatedStmt,
unsigned NumChildren,
321 C.Allocate(
sizeof(
T) + OMPChildren::size(NumClauses, HasAssociatedStmt,
325 OMPChildren::CreateEmpty(
reinterpret_cast<T *
>(Mem) + 1, NumClauses,
326 HasAssociatedStmt, NumChildren);
327 auto *Inst =
new (Mem)
T(std::forward<Params>(
P)...);
332 template <
typename T>
334 bool HasAssociatedStmt =
false,
335 unsigned NumChildren = 0) {
337 C.Allocate(
sizeof(
T) + OMPChildren::size(NumClauses, HasAssociatedStmt,
341 OMPChildren::CreateEmpty(
reinterpret_cast<T *
>(Mem) + 1, NumClauses,
342 HasAssociatedStmt, NumChildren);
343 auto *Inst =
new (Mem)
T;
351 :
public llvm::iterator_adaptor_base<
352 used_clauses_child_iterator, ArrayRef<OMPClause *>::iterator,
353 std::forward_iterator_tag, Stmt *, ptrdiff_t, Stmt *, Stmt *> {
358 if (ChildI != ChildEnd)
360 while (this->I != End) {
362 if (this->I != End) {
363 ChildI = (*this->I)->used_children().begin();
364 ChildEnd = (*this->I)->used_children().end();
365 if (ChildI != ChildEnd)
375 if (this->I != End) {
376 ChildI = (*this->I)->used_children().begin();
377 ChildEnd = (*this->I)->used_children().end();
386 if (ChildI != ChildEnd)
388 if (this->I != End) {
390 if (this->I != End) {
391 ChildI = (*this->I)->used_children().begin();
392 ChildEnd = (*this->I)->used_children().end();
400 static llvm::iterator_range<used_clauses_child_iterator>
411 template <
typename SpecificClause>
413 :
public llvm::iterator_adaptor_base<
414 specific_clause_iterator<SpecificClause>,
415 ArrayRef<OMPClause *>::const_iterator, std::forward_iterator_tag,
416 const SpecificClause *, ptrdiff_t, const SpecificClause *,
417 const SpecificClause *> {
420 void SkipToNextClause() {
421 while (this->I != End && !isa<SpecificClause>(*this->I))
433 return cast<SpecificClause>(*this->I);
444 template <
typename SpecificClause>
445 static llvm::iterator_range<specific_clause_iterator<SpecificClause>>
452 template <
typename SpecificClause>
453 llvm::iterator_range<specific_clause_iterator<SpecificClause>>
455 return getClausesOfKind<SpecificClause>(
clauses());
463 template <
typename SpecificClause>
465 auto ClausesOfKind = getClausesOfKind<SpecificClause>(Clauses);
467 if (ClausesOfKind.begin() != ClausesOfKind.end()) {
468 assert(std::next(ClausesOfKind.begin()) == ClausesOfKind.end() &&
469 "There are at least 2 clauses of the specified kind");
470 return *ClausesOfKind.begin();
475 template <
typename SpecificClause>
477 return getSingleClause<SpecificClause>(
clauses());
482 template <
typename SpecificClause>
484 auto Clauses = getClausesOfKind<SpecificClause>();
485 return Clauses.begin() != Clauses.end();
526 "Expected directive with the associated statement.");
536 "Expected directive with the associated statement.");
545 "Expected directive with the associated statement.");
559 return S->getStmtClass() >= firstOMPExecutableDirectiveConstant &&
560 S->getStmtClass() <= lastOMPExecutableDirectiveConstant;
598 "Expected directive with the associated statement.");
616 bool HasCancel =
false;
625 llvm::omp::OMPD_parallel, StartLoc, EndLoc) {}
638 void setHasCancel(
bool Has) { HasCancel = Has; }
652 static OMPParallelDirective *
653 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
654 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
662 static OMPParallelDirective *
CreateEmpty(
const ASTContext &
C,
663 unsigned NumClauses, EmptyShell);
677 return T->getStmtClass() == OMPParallelDirectiveClass;
818 Cond !=
nullptr &&
Init !=
nullptr &&
Inc !=
nullptr;
853 for (
unsigned I = 0; I < Size; ++I) {
884 bool TryImperfectlyNestedLoops);
886 bool TryImperfectlyNestedLoops) {
888 TryImperfectlyNestedLoops);
896 llvm::function_ref<
bool(
unsigned,
Stmt *)> Callback,
898 OnTransformationCallback);
902 llvm::function_ref<
bool(
unsigned,
const Stmt *)> Callback,
904 OnTransformationCallback) {
905 auto &&NewCallback = [Callback](
unsigned Cnt,
Stmt *CurStmt) {
906 return Callback(Cnt, CurStmt);
908 auto &&NewTransformCb =
910 OnTransformationCallback(A);
913 NumLoops, NewCallback, NewTransformCb);
921 llvm::function_ref<
bool(
unsigned,
Stmt *)> Callback) {
923 return doForAllLoops(CurStmt, TryImperfectlyNestedLoops, NumLoops, Callback,
929 llvm::function_ref<
bool(
unsigned,
const Stmt *)> Callback) {
930 auto &&NewCallback = [Callback](
unsigned Cnt,
const Stmt *CurStmt) {
931 return Callback(Cnt, CurStmt);
934 NumLoops, NewCallback);
940 Stmt *CurStmt,
bool TryImperfectlyNestedLoops,
unsigned NumLoops,
941 llvm::function_ref<
void(
unsigned,
Stmt *,
Stmt *)> Callback);
943 const Stmt *CurStmt,
bool TryImperfectlyNestedLoops,
unsigned NumLoops,
944 llvm::function_ref<
void(
unsigned,
const Stmt *,
const Stmt *)> Callback) {
945 auto &&NewCallback = [Callback](
unsigned Cnt,
Stmt *
Loop,
Stmt *Body) {
946 Callback(Cnt,
Loop, Body);
949 NumLoops, NewCallback);
953 if (
auto *
D = dyn_cast<OMPExecutableDirective>(
T))
964 unsigned NumGeneratedLoops = 0;
996 return C == OMPTileDirectiveClass ||
C == OMPUnrollDirectiveClass ||
997 C == OMPReverseDirectiveClass ||
C == OMPInterchangeDirectiveClass;
1024 IterationVariableOffset = 0,
1025 LastIterationOffset = 1,
1026 CalcLastIterationOffset = 2,
1027 PreConditionOffset = 3,
1038 IsLastIterVariableOffset = 8,
1039 LowerBoundVariableOffset = 9,
1040 UpperBoundVariableOffset = 10,
1041 StrideVariableOffset = 11,
1042 EnsureUpperBoundOffset = 12,
1043 NextLowerBoundOffset = 13,
1044 NextUpperBoundOffset = 14,
1045 NumIterationsOffset = 15,
1047 WorksharingEnd = 16,
1048 PrevLowerBoundVariableOffset = 16,
1049 PrevUpperBoundVariableOffset = 17,
1051 PrevEnsureUpperBoundOffset = 19,
1052 CombinedLowerBoundVariableOffset = 20,
1053 CombinedUpperBoundVariableOffset = 21,
1054 CombinedEnsureUpperBoundOffset = 22,
1055 CombinedInitOffset = 23,
1056 CombinedConditionOffset = 24,
1057 CombinedNextLowerBoundOffset = 25,
1058 CombinedNextUpperBoundOffset = 26,
1059 CombinedDistConditionOffset = 27,
1060 CombinedParForInDistConditionOffset = 28,
1064 CombinedDistributeEnd = 29,
1069 auto **Storage =
reinterpret_cast<Expr **
>(
1075 MutableArrayRef<Expr *> getPrivateCounters() {
1076 auto **Storage =
reinterpret_cast<Expr **
>(
1083 MutableArrayRef<Expr *> getInits() {
1084 auto **
Storage =
reinterpret_cast<Expr **
>(
1091 MutableArrayRef<Expr *> getUpdates() {
1092 auto **
Storage =
reinterpret_cast<Expr **
>(
1099 MutableArrayRef<Expr *> getFinals() {
1100 auto **
Storage =
reinterpret_cast<Expr **
>(
1107 MutableArrayRef<Expr *> getDependentCounters() {
1108 auto **
Storage =
reinterpret_cast<Expr **
>(
1115 MutableArrayRef<Expr *> getDependentInits() {
1116 auto **
Storage =
reinterpret_cast<Expr **
>(
1123 MutableArrayRef<Expr *> getFinalsConditions() {
1124 auto **
Storage =
reinterpret_cast<Expr **
>(
1141 unsigned CollapsedNum)
1147 return CombinedDistributeEnd;
1150 return WorksharingEnd;
1184 "expected worksharing loop directive");
1192 "expected worksharing loop directive");
1200 "expected worksharing loop directive");
1208 "expected worksharing loop directive");
1216 "expected worksharing loop directive");
1224 "expected worksharing loop directive");
1232 "expected worksharing loop directive");
1240 "expected worksharing loop directive");
1245 "expected loop bound sharing directive");
1250 "expected loop bound sharing directive");
1255 "expected loop bound sharing directive");
1260 "expected loop bound sharing directive");
1265 "expected loop bound sharing directive");
1270 "expected loop bound sharing directive");
1275 "expected loop bound sharing directive");
1280 "expected loop bound sharing directive");
1285 "expected loop bound sharing directive");
1290 "expected loop bound sharing directive");
1295 "expected loop bound sharing directive");
1300 "expected loop bound distribute sharing directive");
1305 "expected loop bound distribute sharing directive");
1307 CombParForInDistCond;
1343 "expected worksharing loop directive");
1351 "expected worksharing loop directive");
1359 "expected worksharing loop directive");
1367 "expected worksharing loop directive");
1375 "expected worksharing loop directive");
1383 "expected worksharing loop directive");
1391 "expected worksharing loop directive");
1399 "expected worksharing loop directive");
1404 "expected loop bound sharing directive");
1409 "expected loop bound sharing directive");
1414 "expected loop bound sharing directive");
1419 "expected loop bound sharing directive");
1424 "expected loop bound sharing directive");
1425 return cast<Expr>(
Data->
getChildren()[CombinedLowerBoundVariableOffset]);
1429 "expected loop bound sharing directive");
1430 return cast<Expr>(
Data->
getChildren()[CombinedUpperBoundVariableOffset]);
1434 "expected loop bound sharing directive");
1435 return cast<Expr>(
Data->
getChildren()[CombinedEnsureUpperBoundOffset]);
1439 "expected loop bound sharing directive");
1444 "expected loop bound sharing directive");
1449 "expected loop bound sharing directive");
1454 "expected loop bound sharing directive");
1459 "expected loop bound distribute sharing directive");
1464 "expected loop bound distribute sharing directive");
1465 return cast<Expr>(
Data->
getChildren()[CombinedParForInDistConditionOffset]);
1521 return T->getStmtClass() == OMPSimdDirectiveClass ||
1522 T->getStmtClass() == OMPForDirectiveClass ||
1523 T->getStmtClass() == OMPForSimdDirectiveClass ||
1524 T->getStmtClass() == OMPParallelForDirectiveClass ||
1525 T->getStmtClass() == OMPParallelForSimdDirectiveClass ||
1526 T->getStmtClass() == OMPTaskLoopDirectiveClass ||
1527 T->getStmtClass() == OMPTaskLoopSimdDirectiveClass ||
1528 T->getStmtClass() == OMPMaskedTaskLoopDirectiveClass ||
1529 T->getStmtClass() == OMPMaskedTaskLoopSimdDirectiveClass ||
1530 T->getStmtClass() == OMPMasterTaskLoopDirectiveClass ||
1531 T->getStmtClass() == OMPMasterTaskLoopSimdDirectiveClass ||
1532 T->getStmtClass() == OMPGenericLoopDirectiveClass ||
1533 T->getStmtClass() == OMPTeamsGenericLoopDirectiveClass ||
1534 T->getStmtClass() == OMPTargetTeamsGenericLoopDirectiveClass ||
1535 T->getStmtClass() == OMPParallelGenericLoopDirectiveClass ||
1536 T->getStmtClass() == OMPTargetParallelGenericLoopDirectiveClass ||
1537 T->getStmtClass() == OMPParallelMaskedTaskLoopDirectiveClass ||
1538 T->getStmtClass() == OMPParallelMaskedTaskLoopSimdDirectiveClass ||
1539 T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass ||
1540 T->getStmtClass() == OMPParallelMasterTaskLoopSimdDirectiveClass ||
1541 T->getStmtClass() == OMPDistributeDirectiveClass ||
1542 T->getStmtClass() == OMPTargetParallelForDirectiveClass ||
1543 T->getStmtClass() == OMPDistributeParallelForDirectiveClass ||
1544 T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass ||
1545 T->getStmtClass() == OMPDistributeSimdDirectiveClass ||
1546 T->getStmtClass() == OMPTargetParallelForSimdDirectiveClass ||
1547 T->getStmtClass() == OMPTargetSimdDirectiveClass ||
1548 T->getStmtClass() == OMPTeamsDistributeDirectiveClass ||
1549 T->getStmtClass() == OMPTeamsDistributeSimdDirectiveClass ||
1550 T->getStmtClass() ==
1551 OMPTeamsDistributeParallelForSimdDirectiveClass ||
1552 T->getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass ||
1553 T->getStmtClass() ==
1554 OMPTargetTeamsDistributeParallelForDirectiveClass ||
1555 T->getStmtClass() ==
1556 OMPTargetTeamsDistributeParallelForSimdDirectiveClass ||
1557 T->getStmtClass() == OMPTargetTeamsDistributeDirectiveClass ||
1558 T->getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
1581 unsigned CollapsedNum)
1583 EndLoc, CollapsedNum) {}
1604 static OMPSimdDirective *
Create(
const ASTContext &
C, SourceLocation StartLoc,
1605 SourceLocation EndLoc,
unsigned CollapsedNum,
1606 ArrayRef<OMPClause *> Clauses,
1607 Stmt *AssociatedStmt,
1608 const HelperExprs &Exprs);
1617 static OMPSimdDirective *
CreateEmpty(
const ASTContext &
C,
unsigned NumClauses,
1618 unsigned CollapsedNum, EmptyShell);
1621 return T->getStmtClass() == OMPSimdDirectiveClass;
1638 bool HasCancel =
false;
1647 unsigned CollapsedNum)
1649 EndLoc, CollapsedNum) {}
1660 void setTaskReductionRefExpr(Expr *
E) {
1662 llvm::omp::OMPD_for)] =
E;
1666 void setHasCancel(
bool Has) { HasCancel = Has; }
1682 static OMPForDirective *
Create(
const ASTContext &
C, SourceLocation StartLoc,
1683 SourceLocation EndLoc,
unsigned CollapsedNum,
1684 ArrayRef<OMPClause *> Clauses,
1685 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
1686 Expr *TaskRedRef,
bool HasCancel);
1695 static OMPForDirective *
CreateEmpty(
const ASTContext &
C,
unsigned NumClauses,
1696 unsigned CollapsedNum, EmptyShell);
1711 return T->getStmtClass() == OMPForDirectiveClass;
1734 unsigned CollapsedNum)
1736 StartLoc, EndLoc, CollapsedNum) {}
1757 static OMPForSimdDirective *
1758 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
1759 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
1760 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
1769 static OMPForSimdDirective *
CreateEmpty(
const ASTContext &
C,
1770 unsigned NumClauses,
1771 unsigned CollapsedNum, EmptyShell);
1774 return T->getStmtClass() == OMPForSimdDirectiveClass;
1792 bool HasCancel =
false;
1801 llvm::omp::OMPD_sections, StartLoc, EndLoc) {}
1814 void setHasCancel(
bool Has) { HasCancel = Has; }
1828 static OMPSectionsDirective *
1829 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
1830 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
1839 static OMPSectionsDirective *
CreateEmpty(
const ASTContext &
C,
1840 unsigned NumClauses, EmptyShell);
1854 return T->getStmtClass() == OMPSectionsDirectiveClass;
1869 bool HasCancel =
false;
1878 llvm::omp::OMPD_section, StartLoc, EndLoc) {}
1896 static OMPSectionDirective *
Create(
const ASTContext &
C,
1897 SourceLocation StartLoc,
1898 SourceLocation EndLoc,
1899 Stmt *AssociatedStmt,
bool HasCancel);
1905 static OMPSectionDirective *
CreateEmpty(
const ASTContext &
C, EmptyShell);
1914 return T->getStmtClass() == OMPSectionDirectiveClass;
1936 StartLoc, EndLoc) {}
1952 static OMPScopeDirective *
Create(
const ASTContext &
C, SourceLocation StartLoc,
1953 SourceLocation EndLoc,
1954 ArrayRef<OMPClause *> Clauses,
1955 Stmt *AssociatedStmt);
1961 static OMPScopeDirective *
CreateEmpty(
const ASTContext &
C,
1962 unsigned NumClauses, EmptyShell);
1965 return T->getStmtClass() == OMPScopeDirectiveClass;
1987 StartLoc, EndLoc) {}
2004 static OMPSingleDirective *
2005 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
2006 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2014 static OMPSingleDirective *
CreateEmpty(
const ASTContext &
C,
2015 unsigned NumClauses, EmptyShell);
2018 return T->getStmtClass() == OMPSingleDirectiveClass;
2038 StartLoc, EndLoc) {}
2054 static OMPMasterDirective *
Create(
const ASTContext &
C,
2055 SourceLocation StartLoc,
2056 SourceLocation EndLoc,
2057 Stmt *AssociatedStmt);
2063 static OMPMasterDirective *
CreateEmpty(
const ASTContext &
C, EmptyShell);
2066 return T->getStmtClass() == OMPMasterDirectiveClass;
2090 llvm::omp::OMPD_critical, StartLoc, EndLoc),
2104 void setDirectiveName(
const DeclarationNameInfo &Name) { DirName = Name; }
2116 static OMPCriticalDirective *
2117 Create(
const ASTContext &
C,
const DeclarationNameInfo &Name,
2118 SourceLocation StartLoc, SourceLocation EndLoc,
2119 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2126 static OMPCriticalDirective *
CreateEmpty(
const ASTContext &
C,
2127 unsigned NumClauses, EmptyShell);
2134 return T->getStmtClass() == OMPCriticalDirectiveClass;
2152 bool HasCancel =
false;
2161 unsigned CollapsedNum)
2163 llvm::omp::OMPD_parallel_for, StartLoc, EndLoc,
2176 void setTaskReductionRefExpr(Expr *
E) {
2178 llvm::omp::OMPD_parallel_for)] =
E;
2182 void setHasCancel(
bool Has) { HasCancel = Has; }
2198 static OMPParallelForDirective *
2199 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
2200 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
2201 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
2211 static OMPParallelForDirective *
CreateEmpty(
const ASTContext &
C,
2212 unsigned NumClauses,
2213 unsigned CollapsedNum,
2230 return T->getStmtClass() == OMPParallelForDirectiveClass;
2254 unsigned CollapsedNum)
2256 llvm::omp::OMPD_parallel_for_simd, StartLoc, EndLoc,
2279 static OMPParallelForSimdDirective *
2280 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
2281 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
2282 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
2291 static OMPParallelForSimdDirective *
CreateEmpty(
const ASTContext &
C,
2292 unsigned NumClauses,
2293 unsigned CollapsedNum,
2297 return T->getStmtClass() == OMPParallelForSimdDirectiveClass;
2315 llvm::omp::OMPD_parallel_master, StartLoc,
2320 llvm::omp::OMPD_parallel_master,
2337 static OMPParallelMasterDirective *
2338 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
2339 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef);
2347 static OMPParallelMasterDirective *
2348 CreateEmpty(
const ASTContext &
C,
unsigned NumClauses, EmptyShell);
2360 return T->getStmtClass() == OMPParallelMasterDirectiveClass;
2378 llvm::omp::OMPD_parallel_masked, StartLoc,
2383 llvm::omp::OMPD_parallel_masked,
2400 static OMPParallelMaskedDirective *
2401 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
2402 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef);
2410 static OMPParallelMaskedDirective *
2411 CreateEmpty(
const ASTContext &
C,
unsigned NumClauses, EmptyShell);
2423 return T->getStmtClass() == OMPParallelMaskedDirectiveClass;
2441 bool HasCancel =
false;
2450 llvm::omp::OMPD_parallel_sections, StartLoc,
2457 llvm::omp::OMPD_parallel_sections,
2464 void setHasCancel(
bool Has) { HasCancel = Has; }
2478 static OMPParallelSectionsDirective *
2479 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
2480 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
2489 static OMPParallelSectionsDirective *
2490 CreateEmpty(
const ASTContext &
C,
unsigned NumClauses, EmptyShell);
2505 return T->getStmtClass() == OMPParallelSectionsDirectiveClass;
2521 bool HasCancel =
false;
2530 StartLoc, EndLoc) {}
2539 void setHasCancel(
bool Has) { HasCancel = Has; }
2551 static OMPTaskDirective *
Create(
const ASTContext &
C, SourceLocation StartLoc,
2552 SourceLocation EndLoc,
2553 ArrayRef<OMPClause *> Clauses,
2554 Stmt *AssociatedStmt,
bool HasCancel);
2562 static OMPTaskDirective *
CreateEmpty(
const ASTContext &
C,
unsigned NumClauses,
2569 return T->getStmtClass() == OMPTaskDirectiveClass;
2589 llvm::omp::OMPD_taskyield, StartLoc, EndLoc) {}
2605 static OMPTaskyieldDirective *
2606 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc);
2612 static OMPTaskyieldDirective *
CreateEmpty(
const ASTContext &
C, EmptyShell);
2615 return T->getStmtClass() == OMPTaskyieldDirectiveClass;
2635 llvm::omp::OMPD_barrier, StartLoc, EndLoc) {}
2651 static OMPBarrierDirective *
2652 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc);
2658 static OMPBarrierDirective *
CreateEmpty(
const ASTContext &
C, EmptyShell);
2661 return T->getStmtClass() == OMPBarrierDirectiveClass;
2681 llvm::omp::OMPD_taskwait, StartLoc, EndLoc) {}
2698 static OMPTaskwaitDirective *
Create(
const ASTContext &
C,
2699 SourceLocation StartLoc,
2700 SourceLocation EndLoc,
2701 ArrayRef<OMPClause *> Clauses);
2708 static OMPTaskwaitDirective *
CreateEmpty(
const ASTContext &
C,
2709 unsigned NumClauses, EmptyShell);
2712 return T->getStmtClass() == OMPTaskwaitDirectiveClass;
2732 llvm::omp::OMPD_taskgroup, StartLoc, EndLoc) {}
2754 static OMPTaskgroupDirective *
2755 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
2756 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2757 Expr *ReductionRef);
2764 static OMPTaskgroupDirective *
CreateEmpty(
const ASTContext &
C,
2765 unsigned NumClauses, EmptyShell);
2775 return T->getStmtClass() == OMPTaskgroupDirectiveClass;
2799 StartLoc, EndLoc) {}
2816 static OMPFlushDirective *
Create(
const ASTContext &
C, SourceLocation StartLoc,
2817 SourceLocation EndLoc,
2818 ArrayRef<OMPClause *> Clauses);
2826 static OMPFlushDirective *
CreateEmpty(
const ASTContext &
C,
2827 unsigned NumClauses, EmptyShell);
2830 return T->getStmtClass() == OMPFlushDirectiveClass;
2852 StartLoc, EndLoc) {}
2868 static OMPDepobjDirective *
Create(
const ASTContext &
C,
2869 SourceLocation StartLoc,
2870 SourceLocation EndLoc,
2871 ArrayRef<OMPClause *> Clauses);
2879 static OMPDepobjDirective *
CreateEmpty(
const ASTContext &
C,
2880 unsigned NumClauses, EmptyShell);
2883 return T->getStmtClass() == OMPDepobjDirectiveClass;
2903 llvm::omp::OMPD_ordered, StartLoc, EndLoc) {}
2921 static OMPOrderedDirective *
2922 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
2923 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2931 static OMPOrderedDirective *
CreateEmpty(
const ASTContext &
C,
2932 unsigned NumClauses,
2933 bool IsStandalone, EmptyShell);
2936 return T->getStmtClass() == OMPOrderedDirectiveClass;
2961 LLVM_PREFERRED_TYPE(
bool)
2962 uint8_t IsXLHSInRHSPart : 1;
2971 LLVM_PREFERRED_TYPE(
bool)
2972 uint8_t IsPostfixUpdate : 1;
2975 LLVM_PREFERRED_TYPE(
bool)
2976 uint8_t IsFailOnly : 1;
2986 StartLoc, EndLoc) {}
2990 explicit OMPAtomicDirective()
2992 SourceLocation(), SourceLocation()) {}
2994 enum DataPositionTy :
size_t {
3009 void setUpdateExpr(Expr *UE) {
3015 void setR(Expr *R) {
Data->
getChildren()[DataPositionTy::POS_R] = R; }
3077 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_X]);
3080 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_X]);
3086 return cast_or_null<Expr>(
3090 return cast_or_null<Expr>(
3105 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_V]);
3108 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_V]);
3112 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_R]);
3115 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_R]);
3119 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_E]);
3122 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_E]);
3126 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_D]);
3129 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_D]);
3133 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_Cond]);
3136 return cast_or_null<Expr>(
Data->
getChildren()[DataPositionTy::POS_Cond]);
3140 return T->getStmtClass() == OMPAtomicDirectiveClass;
3162 StartLoc, EndLoc) {}
3179 static OMPTargetDirective *
3180 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3181 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3189 static OMPTargetDirective *
CreateEmpty(
const ASTContext &
C,
3190 unsigned NumClauses, EmptyShell);
3193 return T->getStmtClass() == OMPTargetDirectiveClass;
3216 llvm::omp::OMPD_target_data, StartLoc, EndLoc) {}
3234 static OMPTargetDataDirective *
3235 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3236 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3243 static OMPTargetDataDirective *
CreateEmpty(
const ASTContext &
C,
unsigned N,
3247 return T->getStmtClass() == OMPTargetDataDirectiveClass;
3270 llvm::omp::OMPD_target_enter_data, StartLoc,
3277 llvm::omp::OMPD_target_enter_data,
3289 static OMPTargetEnterDataDirective *
3290 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3291 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3298 static OMPTargetEnterDataDirective *
CreateEmpty(
const ASTContext &
C,
3299 unsigned N, EmptyShell);
3302 return T->getStmtClass() == OMPTargetEnterDataDirectiveClass;
3325 llvm::omp::OMPD_target_exit_data, StartLoc,
3332 llvm::omp::OMPD_target_exit_data,
3344 static OMPTargetExitDataDirective *
3345 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3346 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3353 static OMPTargetExitDataDirective *
CreateEmpty(
const ASTContext &
C,
3354 unsigned N, EmptyShell);
3357 return T->getStmtClass() == OMPTargetExitDataDirectiveClass;
3373 bool HasCancel =
false;
3382 llvm::omp::OMPD_target_parallel, StartLoc,
3389 llvm::omp::OMPD_target_parallel,
3395 void setHasCancel(
bool Has) { HasCancel = Has; }
3409 static OMPTargetParallelDirective *
3410 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3411 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
3420 static OMPTargetParallelDirective *
3421 CreateEmpty(
const ASTContext &
C,
unsigned NumClauses, EmptyShell);
3436 return T->getStmtClass() == OMPTargetParallelDirectiveClass;
3454 bool HasCancel =
false;
3463 unsigned CollapsedNum)
3465 llvm::omp::OMPD_target_parallel_for, StartLoc, EndLoc,
3478 void setTaskReductionRefExpr(Expr *
E) {
3484 void setHasCancel(
bool Has) { HasCancel = Has; }
3500 static OMPTargetParallelForDirective *
3501 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3502 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3503 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
3513 static OMPTargetParallelForDirective *
CreateEmpty(
const ASTContext &
C,
3514 unsigned NumClauses,
3515 unsigned CollapsedNum,
3532 return T->getStmtClass() == OMPTargetParallelForDirectiveClass;
3554 StartLoc, EndLoc) {}
3571 static OMPTeamsDirective *
Create(
const ASTContext &
C, SourceLocation StartLoc,
3572 SourceLocation EndLoc,
3573 ArrayRef<OMPClause *> Clauses,
3574 Stmt *AssociatedStmt);
3582 static OMPTeamsDirective *
CreateEmpty(
const ASTContext &
C,
3583 unsigned NumClauses, EmptyShell);
3586 return T->getStmtClass() == OMPTeamsDirectiveClass;
3609 llvm::omp::OMPD_cancellation_point, StartLoc,
3615 llvm::omp::OMPD_cancellation_point,
3629 static OMPCancellationPointDirective *
3630 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3637 static OMPCancellationPointDirective *
CreateEmpty(
const ASTContext &
C,
3644 return T->getStmtClass() == OMPCancellationPointDirectiveClass;
3666 StartLoc, EndLoc) {}
3686 static OMPCancelDirective *
3687 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3695 static OMPCancelDirective *
CreateEmpty(
const ASTContext &
C,
3696 unsigned NumClauses, EmptyShell);
3702 return T->getStmtClass() == OMPCancelDirectiveClass;
3719 bool HasCancel =
false;
3728 unsigned CollapsedNum)
3730 StartLoc, EndLoc, CollapsedNum) {}
3741 void setHasCancel(
bool Has) { HasCancel = Has; }
3755 static OMPTaskLoopDirective *
3756 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3757 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3758 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
3767 static OMPTaskLoopDirective *
CreateEmpty(
const ASTContext &
C,
3768 unsigned NumClauses,
3769 unsigned CollapsedNum, EmptyShell);
3775 return T->getStmtClass() == OMPTaskLoopDirectiveClass;
3798 unsigned CollapsedNum)
3800 llvm::omp::OMPD_taskloop_simd, StartLoc, EndLoc,
3823 static OMPTaskLoopSimdDirective *
3824 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3825 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3826 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
3835 static OMPTaskLoopSimdDirective *
CreateEmpty(
const ASTContext &
C,
3836 unsigned NumClauses,
3837 unsigned CollapsedNum,
3841 return T->getStmtClass() == OMPTaskLoopSimdDirectiveClass;
3858 bool HasCancel =
false;
3867 unsigned CollapsedNum)
3869 llvm::omp::OMPD_master_taskloop, StartLoc, EndLoc,
3882 void setHasCancel(
bool Has) { HasCancel = Has; }
3896 static OMPMasterTaskLoopDirective *
3897 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3898 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3899 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
3908 static OMPMasterTaskLoopDirective *
CreateEmpty(
const ASTContext &
C,
3909 unsigned NumClauses,
3910 unsigned CollapsedNum,
3917 return T->getStmtClass() == OMPMasterTaskLoopDirectiveClass;
3934 bool HasCancel =
false;
3943 unsigned CollapsedNum)
3945 llvm::omp::OMPD_masked_taskloop, StartLoc, EndLoc,
3958 void setHasCancel(
bool Has) { HasCancel = Has; }
3972 static OMPMaskedTaskLoopDirective *
3973 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
3974 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3975 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
3984 static OMPMaskedTaskLoopDirective *
CreateEmpty(
const ASTContext &
C,
3985 unsigned NumClauses,
3986 unsigned CollapsedNum,
3993 return T->getStmtClass() == OMPMaskedTaskLoopDirectiveClass;
4016 unsigned CollapsedNum)
4018 llvm::omp::OMPD_master_taskloop_simd, StartLoc, EndLoc,
4041 static OMPMasterTaskLoopSimdDirective *
4042 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4043 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4044 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4052 static OMPMasterTaskLoopSimdDirective *
CreateEmpty(
const ASTContext &
C,
4053 unsigned NumClauses,
4054 unsigned CollapsedNum,
4058 return T->getStmtClass() == OMPMasterTaskLoopSimdDirectiveClass;
4081 unsigned CollapsedNum)
4083 llvm::omp::OMPD_masked_taskloop_simd, StartLoc, EndLoc,
4106 static OMPMaskedTaskLoopSimdDirective *
4107 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4108 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4109 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4117 static OMPMaskedTaskLoopSimdDirective *
CreateEmpty(
const ASTContext &
C,
4118 unsigned NumClauses,
4119 unsigned CollapsedNum,
4123 return T->getStmtClass() == OMPMaskedTaskLoopSimdDirectiveClass;
4141 bool HasCancel =
false;
4151 unsigned CollapsedNum)
4153 llvm::omp::OMPD_parallel_master_taskloop, StartLoc,
4154 EndLoc, CollapsedNum) {}
4162 llvm::omp::OMPD_parallel_master_taskloop,
4166 void setHasCancel(
bool Has) { HasCancel = Has; }
4180 static OMPParallelMasterTaskLoopDirective *
4181 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4182 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4183 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
4192 static OMPParallelMasterTaskLoopDirective *
CreateEmpty(
const ASTContext &
C,
4193 unsigned NumClauses,
4194 unsigned CollapsedNum,
4201 return T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass;
4219 bool HasCancel =
false;
4229 unsigned CollapsedNum)
4231 llvm::omp::OMPD_parallel_masked_taskloop, StartLoc,
4232 EndLoc, CollapsedNum) {}
4240 llvm::omp::OMPD_parallel_masked_taskloop,
4244 void setHasCancel(
bool Has) { HasCancel = Has; }
4258 static OMPParallelMaskedTaskLoopDirective *
4259 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4260 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4261 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
4270 static OMPParallelMaskedTaskLoopDirective *
CreateEmpty(
const ASTContext &
C,
4271 unsigned NumClauses,
4272 unsigned CollapsedNum,
4279 return T->getStmtClass() == OMPParallelMaskedTaskLoopDirectiveClass;
4304 unsigned CollapsedNum)
4306 llvm::omp::OMPD_parallel_master_taskloop_simd,
4307 StartLoc, EndLoc, CollapsedNum) {}
4315 llvm::omp::OMPD_parallel_master_taskloop_simd,
4329 static OMPParallelMasterTaskLoopSimdDirective *
4330 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4331 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4332 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4341 static OMPParallelMasterTaskLoopSimdDirective *
4342 CreateEmpty(
const ASTContext &
C,
unsigned NumClauses,
unsigned CollapsedNum,
4346 return T->getStmtClass() == OMPParallelMasterTaskLoopSimdDirectiveClass;
4371 unsigned CollapsedNum)
4373 llvm::omp::OMPD_parallel_masked_taskloop_simd,
4374 StartLoc, EndLoc, CollapsedNum) {}
4382 llvm::omp::OMPD_parallel_masked_taskloop_simd,
4396 static OMPParallelMaskedTaskLoopSimdDirective *
4397 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4398 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4399 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4408 static OMPParallelMaskedTaskLoopSimdDirective *
4409 CreateEmpty(
const ASTContext &
C,
unsigned NumClauses,
unsigned CollapsedNum,
4413 return T->getStmtClass() == OMPParallelMaskedTaskLoopSimdDirectiveClass;
4436 unsigned CollapsedNum)
4438 llvm::omp::OMPD_distribute, StartLoc, EndLoc,
4461 static OMPDistributeDirective *
4462 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4463 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4464 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4473 static OMPDistributeDirective *
CreateEmpty(
const ASTContext &
C,
4474 unsigned NumClauses,
4475 unsigned CollapsedNum, EmptyShell);
4478 return T->getStmtClass() == OMPDistributeDirectiveClass;
4501 llvm::omp::OMPD_target_update, StartLoc,
4520 static OMPTargetUpdateDirective *
4521 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4522 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
4530 static OMPTargetUpdateDirective *
CreateEmpty(
const ASTContext &
C,
4531 unsigned NumClauses, EmptyShell);
4534 return T->getStmtClass() == OMPTargetUpdateDirectiveClass;
4551 bool HasCancel =
false;
4561 unsigned CollapsedNum)
4563 llvm::omp::OMPD_distribute_parallel_for, StartLoc,
4564 EndLoc, CollapsedNum) {}
4572 llvm::omp::OMPD_distribute_parallel_for,
4576 void setTaskReductionRefExpr(Expr *
E) {
4582 void setHasCancel(
bool Has) { HasCancel = Has; }
4598 static OMPDistributeParallelForDirective *
4599 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4600 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4601 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
4611 static OMPDistributeParallelForDirective *
CreateEmpty(
const ASTContext &
C,
4612 unsigned NumClauses,
4613 unsigned CollapsedNum,
4630 return T->getStmtClass() == OMPDistributeParallelForDirectiveClass;
4655 unsigned CollapsedNum)
4657 llvm::omp::OMPD_distribute_parallel_for_simd, StartLoc,
4658 EndLoc, CollapsedNum) {}
4666 llvm::omp::OMPD_distribute_parallel_for_simd,
4680 static OMPDistributeParallelForSimdDirective *
Create(
4681 const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4682 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4683 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4691 static OMPDistributeParallelForSimdDirective *
CreateEmpty(
4692 const ASTContext &
C,
unsigned NumClauses,
unsigned CollapsedNum,
4696 return T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass;
4719 unsigned CollapsedNum)
4721 llvm::omp::OMPD_distribute_simd, StartLoc, EndLoc,
4744 static OMPDistributeSimdDirective *
4745 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation EndLoc,
4746 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4747 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4755 static OMPDistributeSimdDirective *
CreateEmpty(
const ASTContext &
C,
4756 unsigned NumClauses,
4757 unsigned CollapsedNum,
4761 return T->getStmtClass() == OMPDistributeSimdDirectiveClass;
4786 unsigned CollapsedNum)
4788 llvm::omp::OMPD_target_parallel_for_simd, StartLoc,
4789 EndLoc, CollapsedNum) {}
4797 llvm::omp::OMPD_target_parallel_for_simd,