15 #ifndef LLVM_CLANG_AST_STMTOPENMP_H 16 #define LLVM_CLANG_AST_STMTOPENMP_H 42 const unsigned NumClauses;
44 const unsigned NumChildren;
49 const unsigned ClausesOffset;
54 reinterpret_cast<char *
>(
this) + ClausesOffset);
69 unsigned NumClauses,
unsigned NumChildren)
70 :
Stmt(SC), Kind(K), StartLoc(
std::move(StartLoc)),
71 EndLoc(
std::move(EndLoc)), NumClauses(NumClauses),
72 NumChildren(NumChildren),
95 template <
typename SpecificClause>
97 :
public llvm::iterator_adaptor_base<
98 specific_clause_iterator<SpecificClause>,
99 ArrayRef<OMPClause *>::const_iterator, std::forward_iterator_tag,
100 const SpecificClause *, ptrdiff_t, const SpecificClause *,
101 const SpecificClause *> {
104 void SkipToNextClause() {
105 while (this->I != End && !isa<SpecificClause>(*this->I))
117 return cast<SpecificClause>(*this->I);
128 template <
typename SpecificClause>
129 static llvm::iterator_range<specific_clause_iterator<SpecificClause>>
133 llvm::makeArrayRef(Clauses.end(), 0))};
136 template <
typename SpecificClause>
137 llvm::iterator_range<specific_clause_iterator<SpecificClause>>
139 return getClausesOfKind<SpecificClause>(
clauses());
147 template <
typename SpecificClause>
149 auto Clauses = getClausesOfKind<SpecificClause>();
151 if (Clauses.begin() != Clauses.end()) {
152 assert(std::next(Clauses.begin()) == Clauses.end() &&
153 "There are at least 2 clauses of the specified kind");
154 return *Clauses.begin();
161 template <
typename SpecificClause>
163 auto Clauses = getClausesOfKind<SpecificClause>();
164 return Clauses.begin() != Clauses.end();
213 CaptureRegions.begin(), CaptureRegions.end(),
215 "RegionKind not found in OpenMP CaptureRegions.");
217 for (
auto ThisCaptureRegion : CaptureRegions) {
218 if (ThisCaptureRegion == RegionKind)
220 CS = cast<CapturedStmt>(CS->getCapturedStmt());
222 llvm_unreachable(
"Incorrect RegionKind specified for directive.");
228 "Must have associated statement.");
231 assert(!CaptureRegions.empty() &&
232 "At least one captured statement must be provided.");
235 CS = cast<CapturedStmt>(CS->getCapturedStmt());
247 return S->
getStmtClass() >= firstOMPExecutableDirectiveConstant &&
248 S->
getStmtClass() <= lastOMPExecutableDirectiveConstant;
254 Stmt **ChildStorage =
reinterpret_cast<Stmt **
>(getClauses().end());
257 return child_range(ChildStorage, ChildStorage + 1);
289 StartLoc, EndLoc, NumClauses, 1),
303 void setHasCancel(
bool Has) { HasCancel = Has; }
341 unsigned CollapsedNum;
360 AssociatedStmtOffset = 0,
361 IterationVariableOffset = 1,
362 LastIterationOffset = 2,
363 CalcLastIterationOffset = 3,
364 PreConditionOffset = 4,
374 IsLastIterVariableOffset = 9,
375 LowerBoundVariableOffset = 10,
376 UpperBoundVariableOffset = 11,
377 StrideVariableOffset = 12,
378 EnsureUpperBoundOffset = 13,
379 NextLowerBoundOffset = 14,
380 NextUpperBoundOffset = 15,
381 NumIterationsOffset = 16,
384 PrevLowerBoundVariableOffset = 17,
385 PrevUpperBoundVariableOffset = 18,
387 PrevEnsureUpperBoundOffset = 20,
388 CombinedLowerBoundVariableOffset = 21,
389 CombinedUpperBoundVariableOffset = 22,
390 CombinedEnsureUpperBoundOffset = 23,
391 CombinedInitOffset = 24,
392 CombinedConditionOffset = 25,
393 CombinedNextLowerBoundOffset = 26,
394 CombinedNextUpperBoundOffset = 27,
395 CombinedDistConditionOffset = 28,
396 CombinedParForInDistConditionOffset = 29,
399 CombinedDistributeEnd = 30,
404 Expr **Storage =
reinterpret_cast<Expr **
>(
411 Expr **Storage =
reinterpret_cast<Expr **
>(&*std::next(
418 Expr **Storage =
reinterpret_cast<Expr **
>(
426 Expr **Storage =
reinterpret_cast<Expr **
>(
434 Expr **Storage =
reinterpret_cast<Expr **
>(
451 template <
typename T>
454 unsigned CollapsedNum,
unsigned NumClauses,
455 unsigned NumSpecialChildren = 0)
457 numLoopChildren(CollapsedNum, Kind) +
459 CollapsedNum(CollapsedNum) {}
464 return CombinedDistributeEnd;
467 return WorksharingEnd;
474 return getArraysOffset(Kind) + 5 * CollapsedNum;
480 *std::next(
child_begin(), IterationVariableOffset) = IV;
483 *std::next(
child_begin(), LastIterationOffset) = LI;
486 *std::next(
child_begin(), CalcLastIterationOffset) = CLI;
489 *std::next(
child_begin(), PreConditionOffset) = PC;
497 *std::next(
child_begin(), PreInitsOffset) = PreInits;
503 "expected worksharing loop directive");
504 *std::next(
child_begin(), IsLastIterVariableOffset) = IL;
510 "expected worksharing loop directive");
511 *std::next(
child_begin(), LowerBoundVariableOffset) = LB;
517 "expected worksharing loop directive");
518 *std::next(
child_begin(), UpperBoundVariableOffset) = UB;
524 "expected worksharing loop directive");
525 *std::next(
child_begin(), StrideVariableOffset) = ST;
531 "expected worksharing loop directive");
532 *std::next(
child_begin(), EnsureUpperBoundOffset) = EUB;
538 "expected worksharing loop directive");
539 *std::next(
child_begin(), NextLowerBoundOffset) = NLB;
545 "expected worksharing loop directive");
546 *std::next(
child_begin(), NextUpperBoundOffset) = NUB;
552 "expected worksharing loop directive");
553 *std::next(
child_begin(), NumIterationsOffset) = NI;
557 "expected loop bound sharing directive");
558 *std::next(
child_begin(), PrevLowerBoundVariableOffset) = PrevLB;
562 "expected loop bound sharing directive");
563 *std::next(
child_begin(), PrevUpperBoundVariableOffset) = PrevUB;
567 "expected loop bound sharing directive");
568 *std::next(
child_begin(), DistIncOffset) = DistInc;
572 "expected loop bound sharing directive");
573 *std::next(
child_begin(), PrevEnsureUpperBoundOffset) = PrevEUB;
577 "expected loop bound sharing directive");
578 *std::next(
child_begin(), CombinedLowerBoundVariableOffset) = CombLB;
582 "expected loop bound sharing directive");
583 *std::next(
child_begin(), CombinedUpperBoundVariableOffset) = CombUB;
587 "expected loop bound sharing directive");
588 *std::next(
child_begin(), CombinedEnsureUpperBoundOffset) = CombEUB;
592 "expected loop bound sharing directive");
593 *std::next(
child_begin(), CombinedInitOffset) = CombInit;
597 "expected loop bound sharing directive");
598 *std::next(
child_begin(), CombinedConditionOffset) = CombCond;
602 "expected loop bound sharing directive");
603 *std::next(
child_begin(), CombinedNextLowerBoundOffset) = CombNLB;
607 "expected loop bound sharing directive");
608 *std::next(
child_begin(), CombinedNextUpperBoundOffset) = CombNUB;
612 "expected loop bound distribute sharing directive");
613 *std::next(
child_begin(), CombinedDistConditionOffset) = CombDistCond;
617 "expected loop bound distribute sharing directive");
619 CombinedParForInDistConditionOffset) = CombParForInDistCond;
730 return IterationVarRef !=
nullptr && LastIteration !=
nullptr &&
731 NumIterations !=
nullptr && PreCond !=
nullptr &&
732 Cond !=
nullptr && Init !=
nullptr && Inc !=
nullptr;
738 IterationVarRef =
nullptr;
739 LastIteration =
nullptr;
740 CalcLastIteration =
nullptr;
752 NumIterations =
nullptr;
757 Counters.resize(Size);
758 PrivateCounters.resize(Size);
760 Updates.resize(Size);
762 for (
unsigned i = 0; i < Size; ++i) {
763 Counters[i] =
nullptr;
764 PrivateCounters[i] =
nullptr;
766 Updates[i] =
nullptr;
770 DistCombinedFields.
LB =
nullptr;
771 DistCombinedFields.
UB =
nullptr;
772 DistCombinedFields.
EUB =
nullptr;
773 DistCombinedFields.
Init =
nullptr;
774 DistCombinedFields.
Cond =
nullptr;
775 DistCombinedFields.
NLB =
nullptr;
776 DistCombinedFields.
NUB =
nullptr;
777 DistCombinedFields.
DistCond =
nullptr;
786 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
787 *std::next(
child_begin(), IterationVariableOffset)));
790 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
794 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
795 *std::next(
child_begin(), CalcLastIterationOffset)));
798 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
802 return const_cast<Expr *
>(
803 reinterpret_cast<const Expr *
>(*std::next(
child_begin(), CondOffset)));
806 return const_cast<Expr *
>(
807 reinterpret_cast<const Expr *
>(*std::next(
child_begin(), InitOffset)));
810 return const_cast<Expr *
>(
821 "expected worksharing loop directive");
822 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
823 *std::next(
child_begin(), IsLastIterVariableOffset)));
829 "expected worksharing loop directive");
830 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
831 *std::next(
child_begin(), LowerBoundVariableOffset)));
837 "expected worksharing loop directive");
838 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
839 *std::next(
child_begin(), UpperBoundVariableOffset)));
845 "expected worksharing loop directive");
846 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
853 "expected worksharing loop directive");
854 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
855 *std::next(
child_begin(), EnsureUpperBoundOffset)));
861 "expected worksharing loop directive");
862 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
869 "expected worksharing loop directive");
870 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
877 "expected worksharing loop directive");
878 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
883 "expected loop bound sharing directive");
884 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
885 *std::next(
child_begin(), PrevLowerBoundVariableOffset)));
889 "expected loop bound sharing directive");
890 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
891 *std::next(
child_begin(), PrevUpperBoundVariableOffset)));
895 "expected loop bound sharing directive");
896 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
901 "expected loop bound sharing directive");
902 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
903 *std::next(
child_begin(), PrevEnsureUpperBoundOffset)));
907 "expected loop bound sharing directive");
908 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
909 *std::next(
child_begin(), CombinedLowerBoundVariableOffset)));
913 "expected loop bound sharing directive");
914 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
915 *std::next(
child_begin(), CombinedUpperBoundVariableOffset)));
919 "expected loop bound sharing directive");
920 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
921 *std::next(
child_begin(), CombinedEnsureUpperBoundOffset)));
925 "expected loop bound sharing directive");
926 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
931 "expected loop bound sharing directive");
932 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
933 *std::next(
child_begin(), CombinedConditionOffset)));
937 "expected loop bound sharing directive");
938 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
939 *std::next(
child_begin(), CombinedNextLowerBoundOffset)));
943 "expected loop bound sharing directive");
944 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
945 *std::next(
child_begin(), CombinedNextUpperBoundOffset)));
949 "expected loop bound distribute sharing directive");
950 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
951 *std::next(
child_begin(), CombinedDistConditionOffset)));
955 "expected loop bound distribute sharing directive");
956 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
957 *std::next(
child_begin(), CombinedParForInDistConditionOffset)));
963 Body = cast<ForStmt>(Body)->getBody();
964 for (
unsigned Cnt = 1; Cnt < CollapsedNum; ++Cnt) {
966 Body = cast<ForStmt>(Body)->getBody();
1006 T->
getStmtClass() == OMPParallelForSimdDirectiveClass ||
1010 T->
getStmtClass() == OMPTargetParallelForDirectiveClass ||
1011 T->
getStmtClass() == OMPDistributeParallelForDirectiveClass ||
1012 T->
getStmtClass() == OMPDistributeParallelForSimdDirectiveClass ||
1013 T->
getStmtClass() == OMPDistributeSimdDirectiveClass ||
1014 T->
getStmtClass() == OMPTargetParallelForSimdDirectiveClass ||
1016 T->
getStmtClass() == OMPTeamsDistributeDirectiveClass ||
1017 T->
getStmtClass() == OMPTeamsDistributeSimdDirectiveClass ||
1019 OMPTeamsDistributeParallelForSimdDirectiveClass ||
1020 T->
getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass ||
1022 OMPTargetTeamsDistributeParallelForDirectiveClass ||
1024 OMPTargetTeamsDistributeParallelForSimdDirectiveClass ||
1025 T->
getStmtClass() == OMPTargetTeamsDistributeDirectiveClass ||
1026 T->
getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
1049 unsigned CollapsedNum,
unsigned NumClauses)
1051 EndLoc, CollapsedNum, NumClauses) {}
1077 Stmt *AssociatedStmt,
1118 unsigned CollapsedNum,
unsigned NumClauses)
1120 CollapsedNum, NumClauses),
1134 void setHasCancel(
bool Has) { HasCancel = Has; }
1191 unsigned CollapsedNum,
unsigned NumClauses)
1193 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
1229 unsigned NumClauses,
1259 unsigned NumClauses)
1261 StartLoc, EndLoc, NumClauses, 1),
1275 void setHasCancel(
bool Has) { HasCancel = Has; }
1327 StartLoc, EndLoc, 0, 1),
1349 Stmt *AssociatedStmt,
bool HasCancel);
1385 unsigned NumClauses)
1387 StartLoc, EndLoc, NumClauses, 1) {}
1440 StartLoc, EndLoc, 0, 1) {}
1459 Stmt *AssociatedStmt);
1492 StartLoc, EndLoc, NumClauses, 1),
1566 unsigned CollapsedNum,
unsigned NumClauses)
1568 StartLoc, EndLoc, CollapsedNum, NumClauses),
1583 void setHasCancel(
bool Has) { HasCancel = Has; }
1610 unsigned NumClauses,
1611 unsigned CollapsedNum,
1618 return T->
getStmtClass() == OMPParallelForDirectiveClass;
1642 unsigned CollapsedNum,
unsigned NumClauses)
1644 OMPD_parallel_for_simd, StartLoc, EndLoc, CollapsedNum,
1653 unsigned NumClauses)
1682 unsigned NumClauses,
1683 unsigned CollapsedNum,
1687 return T->
getStmtClass() == OMPParallelForSimdDirectiveClass;
1713 unsigned NumClauses)
1715 OMPD_parallel_sections, StartLoc, EndLoc,
1730 void setHasCancel(
bool Has) { HasCancel = Has; }
1759 return T->
getStmtClass() == OMPParallelSectionsDirectiveClass;
1783 unsigned NumClauses)
1785 EndLoc, NumClauses, 1),
1799 void setHasCancel(
bool Has) { HasCancel = Has; }
1814 Stmt *AssociatedStmt,
bool HasCancel);
1848 StartLoc, EndLoc, 0, 0) {}
1873 return T->
getStmtClass() == OMPTaskyieldDirectiveClass;
1892 StartLoc, EndLoc, 0, 0) {}
1936 StartLoc, EndLoc, 0, 0) {}
1980 unsigned NumClauses)
1982 StartLoc, EndLoc, NumClauses, 2) {}
1993 void setReductionRef(
Expr *RR) {
2010 Expr *ReductionRef);
2030 return T->
getStmtClass() == OMPTaskgroupDirectiveClass;
2053 unsigned NumClauses)
2055 StartLoc, EndLoc, NumClauses, 0) {}
2108 unsigned NumClauses)
2110 StartLoc, EndLoc, NumClauses, 1) {}
2165 bool IsXLHSInRHSPart;
2174 bool IsPostfixUpdate;
2183 unsigned NumClauses)
2185 StartLoc, EndLoc, NumClauses, 5),
2186 IsXLHSInRHSPart(
false), IsPostfixUpdate(
false) {}
2196 IsXLHSInRHSPart(
false), IsPostfixUpdate(
false) {}
2232 Expr *E,
Expr *UE,
bool IsXLHSInRHSPart,
bool IsPostfixUpdate);
2246 return cast_or_null<Expr>(*std::next(
child_begin()));
2252 return cast_or_null<Expr>(*std::next(
child_begin(), 2));
2255 return cast_or_null<Expr>(*std::next(
child_begin(), 2));
2267 return cast_or_null<Expr>(*std::next(
child_begin(), 3));
2272 return cast_or_null<Expr>(*std::next(
child_begin(), 4));
2297 unsigned NumClauses)
2299 StartLoc, EndLoc, NumClauses, 1) {}
2355 unsigned NumClauses)
2357 OMPD_target_data, StartLoc, EndLoc, NumClauses,
2391 return T->
getStmtClass() == OMPTargetDataDirectiveClass;
2413 unsigned NumClauses)
2415 OMPD_target_enter_data, StartLoc, EndLoc,
2450 return T->
getStmtClass() == OMPTargetEnterDataDirectiveClass;
2472 unsigned NumClauses)
2474 OMPD_target_exit_data, StartLoc, EndLoc,
2509 return T->
getStmtClass() == OMPTargetExitDataDirectiveClass;
2530 unsigned NumClauses)
2532 OMPD_target_parallel, StartLoc, EndLoc,
2568 return T->
getStmtClass() == OMPTargetParallelDirectiveClass;
2595 unsigned CollapsedNum,
unsigned NumClauses)
2597 OMPD_target_parallel_for, StartLoc, EndLoc,
2598 CollapsedNum, NumClauses),
2607 unsigned NumClauses)
2614 void setHasCancel(
bool Has) { HasCancel = Has; }
2641 unsigned NumClauses,
2642 unsigned CollapsedNum,
2649 return T->
getStmtClass() == OMPTargetParallelForDirectiveClass;
2670 unsigned NumClauses)
2672 StartLoc, EndLoc, NumClauses, 1) {}
2695 Stmt *AssociatedStmt);
2728 OMPD_cancellation_point, StartLoc, EndLoc, 0, 0),
2765 return T->
getStmtClass() == OMPCancellationPointDirectiveClass;
2786 unsigned NumClauses)
2788 StartLoc, EndLoc, NumClauses, 0),
2851 unsigned CollapsedNum,
unsigned NumClauses)
2853 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
2889 unsigned NumClauses,
2916 unsigned CollapsedNum,
unsigned NumClauses)
2918 OMPD_taskloop_simd, StartLoc, EndLoc, CollapsedNum,
2929 CollapsedNum, NumClauses) {}
2955 unsigned NumClauses,
2956 unsigned CollapsedNum,
2960 return T->
getStmtClass() == OMPTaskLoopSimdDirectiveClass;
2983 unsigned CollapsedNum,
unsigned NumClauses)
2985 StartLoc, EndLoc, CollapsedNum, NumClauses)
3023 unsigned NumClauses,
3027 return T->
getStmtClass() == OMPDistributeDirectiveClass;
3049 unsigned NumClauses)
3051 OMPD_target_update, StartLoc, EndLoc, NumClauses,
3086 return T->
getStmtClass() == OMPTargetUpdateDirectiveClass;
3102 bool HasCancel =
false;
3113 unsigned CollapsedNum,
unsigned NumClauses)
3115 OMPD_distribute_parallel_for, StartLoc, EndLoc,
3116 CollapsedNum, NumClauses), HasCancel(
false) {}
3124 unsigned NumClauses)
3131 void setHasCancel(
bool Has) { HasCancel = Has; }
3158 unsigned NumClauses,
3159 unsigned CollapsedNum,
3166 return T->
getStmtClass() == OMPDistributeParallelForDirectiveClass;
3191 unsigned CollapsedNum,
3192 unsigned NumClauses)
3194 OMPD_distribute_parallel_for_simd, StartLoc,
3195 EndLoc, CollapsedNum, NumClauses) {}
3203 unsigned NumClauses)
3205 OMPD_distribute_parallel_for_simd,
3232 const ASTContext &
C,
unsigned NumClauses,
unsigned CollapsedNum,
3236 return T->
getStmtClass() == OMPDistributeParallelForSimdDirectiveClass;
3259 unsigned CollapsedNum,
unsigned NumClauses)
3261 OMPD_distribute_simd, StartLoc, EndLoc, CollapsedNum,
3270 unsigned NumClauses)
3298 unsigned NumClauses,
3299 unsigned CollapsedNum,
3303 return T->
getStmtClass() == OMPDistributeSimdDirectiveClass;
3327 unsigned CollapsedNum,
unsigned NumClauses)
3329 OMPD_target_parallel_for_simd, StartLoc, EndLoc,
3330 CollapsedNum, NumClauses) {}
3338 unsigned NumClauses)
3366 unsigned NumClauses,
3367 unsigned CollapsedNum,
3371 return T->
getStmtClass() == OMPTargetParallelForSimdDirectiveClass;
3395 unsigned CollapsedNum,
unsigned NumClauses)
3397 OMPD_target_simd, StartLoc, EndLoc, CollapsedNum,
3433 unsigned NumClauses,
3434 unsigned CollapsedNum,
3438 return T->
getStmtClass() == OMPTargetSimdDirectiveClass;
3461 unsigned CollapsedNum,
unsigned NumClauses)
3463 OMPD_teams_distribute, StartLoc, EndLoc,
3464 CollapsedNum, NumClauses) {}
3472 unsigned NumClauses)
3500 unsigned NumClauses,
3501 unsigned CollapsedNum,
3505 return T->
getStmtClass() == OMPTeamsDistributeDirectiveClass;
3530 unsigned NumClauses)
3532 OMPD_teams_distribute_simd, StartLoc, EndLoc,
3533 CollapsedNum, NumClauses) {}
3541 unsigned NumClauses)
3570 unsigned NumClauses,
3571 unsigned CollapsedNum,
3575 return T->
getStmtClass() == OMPTeamsDistributeSimdDirectiveClass;
3601 unsigned CollapsedNum,
3602 unsigned NumClauses)
3604 OMPD_teams_distribute_parallel_for_simd, StartLoc,
3605 EndLoc, CollapsedNum, NumClauses) {}
3613 unsigned NumClauses)
3615 OMPD_teams_distribute_parallel_for_simd,
3646 return T->
getStmtClass() == OMPTeamsDistributeParallelForSimdDirectiveClass;
3662 bool HasCancel =
false;
3673 unsigned CollapsedNum,
3674 unsigned NumClauses)
3676 OMPD_teams_distribute_parallel_for, StartLoc, EndLoc,
3677 CollapsedNum, NumClauses), HasCancel(
false) {}
3685 unsigned NumClauses)
3692 void setHasCancel(
bool Has) { HasCancel = Has; }
3725 return T->
getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass;
3746 unsigned NumClauses)
3748 OMPD_target_teams, StartLoc, EndLoc, NumClauses,
3773 Stmt *AssociatedStmt);
3784 return T->
getStmtClass() == OMPTargetTeamsDirectiveClass;
3808 unsigned CollapsedNum,
unsigned NumClauses)
3810 OMPD_target_teams_distribute, StartLoc, EndLoc,
3811 CollapsedNum, NumClauses) {}
3819 unsigned NumClauses)
3851 return T->
getStmtClass() == OMPTargetTeamsDistributeDirectiveClass;
3868 bool HasCancel =
false;
3879 unsigned CollapsedNum,
3880 unsigned NumClauses)
3882 OMPTargetTeamsDistributeParallelForDirectiveClass,
3883 OMPD_target_teams_distribute_parallel_for, StartLoc,
3884 EndLoc, CollapsedNum, NumClauses),
3893 unsigned NumClauses)
3895 this, OMPTargetTeamsDistributeParallelForDirectiveClass,
3901 void setHasCancel(
bool Has) { HasCancel = Has; }
3935 OMPTargetTeamsDistributeParallelForDirectiveClass;
3961 unsigned CollapsedNum,
3962 unsigned NumClauses)
3964 OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
3965 OMPD_target_teams_distribute_parallel_for_simd,
3966 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
3974 unsigned CollapsedNum,
unsigned NumClauses)
3976 this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
3977 OMPD_target_teams_distribute_parallel_for_simd,
SourceLocation(),
4008 OMPTargetTeamsDistributeParallelForSimdDirectiveClass;
4033 unsigned CollapsedNum,
4034 unsigned NumClauses)
4036 OMPD_target_teams_distribute_simd, StartLoc, EndLoc,
4037 CollapsedNum, NumClauses) {}
4045 unsigned NumClauses)
4077 return T->
getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
void setPreInits(Stmt *PreInits)
void setCombinedParForInDistCond(Expr *CombParForInDistCond)
child_iterator child_begin()
Expr * NLB
Update of LowerBound for statically scheduled 'omp for' loops.
bool hasCancel() const
Return true if current directive has inner cancel directive.
static bool classof(const Stmt *T)
This represents '#pragma omp distribute simd' composite directive.
Expr * getNextUpperBound() const
SmallVector< Expr *, 4 > Finals
Final loop counter values for GodeGen.
This represents '#pragma omp master' directive.
Expr * NUB
Update of UpperBound for statically scheduled omp loops for outer loop in combined constructs (e...
SmallVector< Expr *, 4 > Updates
Expressions for loop counters update for CodeGen.
This represents '#pragma omp task' directive.
void setEnsureUpperBound(Expr *EUB)
Expr * getUpperBoundVariable() const
static bool classof(const Stmt *T)
ArrayRef< Expr * > inits() const
ArrayRef< OMPClause * > clauses()
static bool classof(const Stmt *T)
OMPLoopDirective(const T *That, StmtClass SC, OpenMPDirectiveKind Kind, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, unsigned NumClauses, unsigned NumSpecialChildren=0)
Build instance of loop directive of class Kind.
void setCombinedCond(Expr *CombCond)
static bool classof(const Stmt *T)
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
const Expr * getV() const
void setCombinedLowerBoundVariable(Expr *CombLB)
void setHasCancel(bool Has)
Set cancel state.
Stmt - This represents one statement.
void setLastIteration(Expr *LI)
Expr * getLowerBoundVariable() const
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
This represents '#pragma omp for simd' directive.
Expr * EUB
EnsureUpperBound – expression UB = min(UB, NumIterations).
Expr * DistInc
DistInc - increment expression for distribute loop when found combined with a further loop level (e...
This represents '#pragma omp teams distribute parallel for' composite directive.
SourceLocation getBeginLoc() const
Returns starting location of directive kind.
void setPrevEnsureUpperBound(Expr *PrevEUB)
CapturedStmt * getInnermostCapturedStmt()
Get innermost captured statement for the construct.
void setUpperBoundVariable(Expr *UB)
void setNumIterations(Expr *NI)
This represents '#pragma omp target teams distribute' combined directive.
void setNextLowerBound(Expr *NLB)
llvm::iterator_range< child_iterator > child_range
Expr * getCombinedParForInDistCond() const
This represents '#pragma omp parallel for' directive.
This represents '#pragma omp target teams distribute parallel for' combined directive.
Expr * getCombinedEnsureUpperBound() const
void setIsLastIterVariable(Expr *IL)
Expr * PrevLB
PreviousLowerBound - local variable passed to runtime in the enclosing schedule or null if that does ...
SourceLocation getEndLoc() const
Returns ending location of directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
This represents '#pragma omp target exit data' directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
const Stmt * getBody() const
Expr * getCombinedUpperBoundVariable() const
void setUpdates(ArrayRef< Expr *> UL)
Sets the list of update expressions for linear variables.
void setCombinedDistCond(Expr *CombDistCond)
Expr * getCalcLastIteration() const
The expressions built to support OpenMP loops in combined/composite pragmas (e.g. ...
bool isXLHSInRHSPart() const
Return true if helper update expression has form 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' and...
const Expr * getUpdateExpr() const
ArrayRef< Expr * > finals() const
Expr * LastIteration
Loop last iteration number.
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
This represents '#pragma omp parallel' directive.
static bool classof(const Stmt *T)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static bool classof(const Stmt *T)
Expr * getEnsureUpperBound() const
const CapturedStmt * getCapturedStmt(OpenMPDirectiveKind RegionKind) const
Returns the captured statement associated with the component region within the (combined) directive...
ArrayRef< Expr * > updates()
This represents '#pragma omp target simd' directive.
static unsigned getArraysOffset(OpenMPDirectiveKind Kind)
Offset to the start of children expression arrays.
static bool classof(const Stmt *T)
Defines some OpenMP-specific enums and functions.
OpenMPDirectiveKind getDirectiveKind() const
This represents '#pragma omp barrier' directive.
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc...
This represents '#pragma omp critical' directive.
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
static bool classof(const Stmt *T)
This represents '#pragma omp distribute parallel for' composite directive.
This represents '#pragma omp teams distribute parallel for simd' composite directive.
ArrayRef< Expr * > finals()
Expr * getIsLastIterVariable() const
Expr * LB
DistributeLowerBound - used when composing 'omp distribute' with 'omp for' in a same construct...
Expr * EUB
DistributeEnsureUpperBound - used when composing 'omp distribute' with 'omp for' in a same construct...
Expr * getX()
Get 'x' part of the associated expression/statement.
Expr * getIterationVariable() const
bool hasCancel() const
Return true if current directive has inner cancel directive.
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
static bool classof(const Stmt *S)
This represents '#pragma omp cancellation point' directive.
const SpecificClause * operator*() const
static bool classof(const Stmt *T)
void setCombinedInit(Expr *CombInit)
MutableArrayRef< Expr * > getFinals()
Sets the list of final update expressions for linear variables.
This represents '#pragma omp teams' directive.
Expr * CalcLastIteration
Calculation of last iteration.
This represents '#pragma omp teams distribute simd' combined directive.
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
void setFinals(ArrayRef< Expr *> FL)
Sets the list of final update expressions for linear variables.
Expr * NUB
Update of UpperBound for statically scheduled 'omp for' loops.
Expr * Cond
Loop condition.
Expr * PreCond
Loop pre-condition.
This represents '#pragma omp target parallel for simd' directive.
ArrayRef< Expr * > private_counters()
The expressions built for the OpenMP loop CodeGen for the whole collapsed loop nest.
bool hasCancel() const
Return true if current directive has inner cancel directive.
static bool classof(const Stmt *T)
This represents '#pragma omp taskgroup' directive.
Expr * getCombinedLowerBoundVariable() const
Expr * DistCond
Distribute Loop condition used when composing 'omp distribute' with 'omp for' in a same construct whe...
Expr * IterationVarRef
Loop iteration variable.
Expr * Init
Distribute loop iteration variable init used when composing 'omp distribute' with 'omp for' in a same...
This represents '#pragma omp distribute' directive.
const Stmt * getAssociatedStmt() const
Returns statement associated with the directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
static bool classof(const Stmt *T)
This represents one expression.
MutableArrayRef< Expr * > getUpdates()
Sets the list of update expressions for linear variables.
static unsigned numLoopChildren(unsigned CollapsedNum, OpenMPDirectiveKind Kind)
Children number.
Stmt * IgnoreContainers(bool IgnoreCaptured=false)
Skip no-op (attributed, compound) container stmts and skip captured stmt at the top, if IgnoreCaptured is true.
ArrayRef< OMPClause * > clauses() const
bool hasCancel() const
Return true if current directive has inner cancel directive.
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
static bool classof(const Stmt *T)
static llvm::iterator_range< specific_clause_iterator< SpecificClause > > getClausesOfKind(ArrayRef< OMPClause *> Clauses)
static bool classof(const Stmt *T)
This represents '#pragma omp target teams distribute simd' combined directive.
bool builtAll()
Check if all the expressions are built (does not check the worksharing ones).
unsigned getNumClauses() const
Get number of clauses.
Expr * getDistInc() const
Expr * getNextLowerBound() const
Expr * PrevUB
PreviousUpperBound - local variable passed to runtime in the enclosing schedule or null if that does ...
Expr * getPrevEnsureUpperBound() const
This represents '#pragma omp for' directive.
static bool classof(const Stmt *T)
ArrayRef< Expr * > counters() const
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
This represents '#pragma omp target teams' directive.
void setAssociatedStmt(Stmt *S)
Set the associated statement for the directive.
Expr * ParForInDistCond
'omp parallel for' loop condition used when composed with 'omp distribute' in the same construct and ...
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
static bool classof(const Stmt *T)
StmtIterator child_iterator
Child Iterators: All subclasses must implement 'children' to permit easy iteration over the substatem...
This represents '#pragma omp cancel' directive.
void setDistInc(Expr *DistInc)
Expr * NLB
Update of LowerBound for statically scheduled omp loops for outer loop in combined constructs (e...
void setClauses(ArrayRef< OMPClause *> Clauses)
Sets the list of variables for this clause.
specific_clause_iterator & operator++()
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
This file defines OpenMP AST classes for clauses.
static bool classof(const Stmt *T)
This represents '#pragma omp flush' directive.
bool hasClausesOfKind() const
Returns true if the current directive has one or more clauses of a specific kind. ...
This represents '#pragma omp parallel for simd' directive.
Expr * NumIterations
Loop number of iterations.
void setLocStart(SourceLocation Loc)
Set starting location of directive kind.
Expr * ST
Stride - local variable passed to runtime.
Expr * getLastIteration() const
const SpecificClause * getSingleClause() const
Gets a single clause of the specified kind associated with the current directive iff there is only on...
bool isPostfixUpdate() const
Return true if 'v' expression must be updated to original value of 'x', false if 'v' must be updated ...
This represents '#pragma omp target enter data' directive.
static bool classof(const Stmt *T)
SmallVector< Expr *, 4 > PrivateCounters
PrivateCounters Loop counters.
void setLowerBoundVariable(Expr *LB)
Expr * getStrideVariable() const
ArrayRef< Expr * > updates() const
Expr * getCombinedDistCond() const
const Stmt * getPreInits() const
static bool classof(const Stmt *T)
This captures a statement into a function.
SmallVector< Expr *, 4 > Counters
Counters Loop counters.
specific_clause_iterator(ArrayRef< OMPClause *> Clauses)
This represents '#pragma omp single' directive.
Encodes a location in the source.
void setPrevLowerBoundVariable(Expr *PrevLB)
void setIterationVariable(Expr *IV)
Stmt * getAssociatedStmt()
MutableArrayRef< Expr * > getInits()
This is a basic class for representing single OpenMP executable directive.
void setCombinedNextLowerBound(Expr *CombNLB)
OMPClause * getClause(unsigned i) const
Returns specified clause.
Expr * getExpr()
Get 'expr' part of the associated expression/statement.
OpenMPDirectiveKind
OpenMP directives.
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
static bool classof(const Stmt *T)
static bool classof(const Stmt *T)
This represents '#pragma omp taskwait' directive.
Expr * PrevEUB
PrevEUB - expression similar to EUB but to be used when loop scheduling uses PrevLB and PrevUB (e...
This is a basic class for representing single OpenMP clause.
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of the composite or combined directives that need loop ...
static bool classof(const Stmt *T)
llvm::iterator_range< specific_clause_iterator< SpecificClause > > getClausesOfKind() const
Stmt * getCapturedStmt()
Retrieve the statement being captured.
This represents '#pragma omp target' directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
Expr * getV()
Get 'v' part of the associated expression/statement.
static bool classof(const Stmt *T)
DistCombinedHelperExprs DistCombinedFields
Expressions used when combining OpenMP loop pragmas.
This represents '#pragma omp ordered' directive.
Expr * LB
LowerBound - local variable passed to runtime.
void clear(unsigned Size)
Initialize all the fields to null.
This represents '#pragma omp target update' directive.
Expr * Init
Loop iteration variable init.
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
ArrayRef< Expr * > private_counters() const
void setPrevUpperBoundVariable(Expr *PrevUB)
void setCombinedEnsureUpperBound(Expr *CombEUB)
static bool classof(const Stmt *T)
Dataflow Directional Tag Classes.
Expr * getPrevUpperBoundVariable() const
const CapturedStmt * getInnermostCapturedStmt() const
SmallVector< Expr *, 4 > Inits
Expressions for loop counters inits for CodeGen.
static bool classof(const Stmt *T)
void setCombinedUpperBoundVariable(Expr *CombUB)
static bool classof(const Stmt *T)
This represents '#pragma omp section' directive.
This represents '#pragma omp teams distribute' directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
This represents '#pragma omp simd' directive.
StmtClass getStmtClass() const
const Expr * getReductionRef() const
Returns reference to the task_reduction return variable.
Expr * getUpdateExpr()
Get helper expression of the form 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or 'OpaqueValueExp...
static bool classof(const Stmt *T)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
This represents '#pragma omp atomic' directive.
Expr * getCombinedInit() const
unsigned getCollapsedNumber() const
Get number of collapsed loops.
Expr * getCombinedNextLowerBound() const
ArrayRef< Expr * > counters()
Expr * getCombinedNextUpperBound() const
Iterates over a filtered subrange of clauses applied to a directive.
void getOpenMPCaptureRegions(llvm::SmallVectorImpl< OpenMPDirectiveKind > &CaptureRegions, OpenMPDirectiveKind DKind)
Return the captured regions of an OpenMP directive.
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
static bool classof(const Stmt *T)
ArrayRef< Expr * > inits()
static bool classof(const Stmt *T)
Expr * Inc
Loop increment.
const Expr * getExpr() const
Expr * getNumIterations() const
bool hasAssociatedStmt() const
Returns true if directive has associated statement.
Expr * getPrevLowerBoundVariable() const
Expr * UB
DistributeUpperBound - used when composing 'omp distribute' with 'omp for' in a same construct...
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Expr * UB
UpperBound - local variable passed to runtime.
Defines the clang::SourceLocation class and associated facilities.
static bool classof(const Stmt *T)
This represents '#pragma omp target parallel' directive.
void setStrideVariable(Expr *ST)
static bool classof(const Stmt *T)
Expr * getCombinedCond() const
static bool classof(const Stmt *T)
This represents '#pragma omp taskloop simd' directive.
static bool classof(const Stmt *T)
Expr * getPreCond() const
void setPreCond(Expr *PC)
OMPExecutableDirective(const T *, StmtClass SC, OpenMPDirectiveKind K, SourceLocation StartLoc, SourceLocation EndLoc, unsigned NumClauses, unsigned NumChildren)
Build instance of directive of class K.
This represents '#pragma omp sections' directive.
Expr * Cond
Distribute Loop condition used when composing 'omp distribute' with 'omp for' in a same construct...
Stmt * PreInits
Init statement for all captured expressions.
void setInits(ArrayRef< Expr *> IL)
Sets the list of the initial values for linear variables.
This represents '#pragma omp target data' directive.
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
void setNextUpperBound(Expr *NUB)
static bool classof(const Stmt *T)
const Expr * getX() const
Expr * IL
IsLastIteration - local flag variable passed to runtime.
This represents '#pragma omp taskyield' directive.
This represents '#pragma omp distribute parallel for simd' composite directive.
const SpecificClause * operator->() const
This represents '#pragma omp parallel sections' directive.
void setCalcLastIteration(Expr *CLI)
void setCombinedNextUpperBound(Expr *CombNUB)
bool hasCancel() const
Return true if current directive has inner cancel directive.
void setLocEnd(SourceLocation Loc)
Set ending location of directive.
static bool classof(const Stmt *T)
This represents '#pragma omp target parallel for' directive.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
This represents '#pragma omp taskloop' directive.