14 #ifndef LLVM_CLANG_AST_STMTOPENMP_H 15 #define LLVM_CLANG_AST_STMTOPENMP_H 41 const unsigned NumClauses;
43 const unsigned NumChildren;
48 const unsigned ClausesOffset;
53 reinterpret_cast<char *
>(
this) + ClausesOffset);
68 unsigned NumClauses,
unsigned NumChildren)
69 :
Stmt(SC), Kind(K), StartLoc(
std::move(StartLoc)),
70 EndLoc(
std::move(EndLoc)), NumClauses(NumClauses),
71 NumChildren(NumChildren),
92 :
public llvm::iterator_adaptor_base<
93 used_clauses_child_iterator, ArrayRef<OMPClause *>::iterator,
94 std::forward_iterator_tag, Stmt *, ptrdiff_t, Stmt *, Stmt *> {
99 if (ChildI != ChildEnd)
101 while (this->I != End) {
103 if (this->I != End) {
106 if (ChildI != ChildEnd)
116 if (this->I != End) {
127 if (ChildI != ChildEnd)
129 if (this->I != End) {
131 if (this->I != End) {
141 static llvm::iterator_range<used_clauses_child_iterator>
151 template <
typename SpecificClause>
153 :
public llvm::iterator_adaptor_base<
154 specific_clause_iterator<SpecificClause>,
155 ArrayRef<OMPClause *>::const_iterator, std::forward_iterator_tag,
156 const SpecificClause *, ptrdiff_t, const SpecificClause *,
157 const SpecificClause *> {
160 void SkipToNextClause() {
161 while (this->I != End && !isa<SpecificClause>(*this->I))
173 return cast<SpecificClause>(*this->I);
184 template <
typename SpecificClause>
185 static llvm::iterator_range<specific_clause_iterator<SpecificClause>>
189 llvm::makeArrayRef(Clauses.end(), 0))};
192 template <
typename SpecificClause>
193 llvm::iterator_range<specific_clause_iterator<SpecificClause>>
195 return getClausesOfKind<SpecificClause>(
clauses());
203 template <
typename SpecificClause>
205 auto Clauses = getClausesOfKind<SpecificClause>();
207 if (Clauses.begin() != Clauses.end()) {
208 assert(std::next(Clauses.begin()) == Clauses.end() &&
209 "There are at least 2 clauses of the specified kind");
210 return *Clauses.begin();
217 template <
typename SpecificClause>
219 auto Clauses = getClausesOfKind<SpecificClause>();
220 return Clauses.begin() != Clauses.end();
269 CaptureRegions.begin(), CaptureRegions.end(),
271 "RegionKind not found in OpenMP CaptureRegions.");
273 for (
auto ThisCaptureRegion : CaptureRegions) {
274 if (ThisCaptureRegion == RegionKind)
276 CS = cast<CapturedStmt>(CS->getCapturedStmt());
278 llvm_unreachable(
"Incorrect RegionKind specified for directive.");
284 "Must have associated statement.");
287 assert(!CaptureRegions.empty() &&
288 "At least one captured statement must be provided.");
291 CS = cast<CapturedStmt>(CS->getCapturedStmt());
303 return S->
getStmtClass() >= firstOMPExecutableDirectiveConstant &&
304 S->
getStmtClass() <= lastOMPExecutableDirectiveConstant;
310 Stmt **ChildStorage =
reinterpret_cast<Stmt **
>(getClauses().end());
313 return child_range(ChildStorage, ChildStorage + 1);
319 Stmt **ChildStorage =
reinterpret_cast<Stmt **
>(
342 return const_cast<Stmt *
>(
369 StartLoc, EndLoc, NumClauses, 1),
383 void setHasCancel(
bool Has) { HasCancel = Has; }
421 unsigned CollapsedNum;
440 AssociatedStmtOffset = 0,
441 IterationVariableOffset = 1,
442 LastIterationOffset = 2,
443 CalcLastIterationOffset = 3,
444 PreConditionOffset = 4,
454 IsLastIterVariableOffset = 9,
455 LowerBoundVariableOffset = 10,
456 UpperBoundVariableOffset = 11,
457 StrideVariableOffset = 12,
458 EnsureUpperBoundOffset = 13,
459 NextLowerBoundOffset = 14,
460 NextUpperBoundOffset = 15,
461 NumIterationsOffset = 16,
464 PrevLowerBoundVariableOffset = 17,
465 PrevUpperBoundVariableOffset = 18,
467 PrevEnsureUpperBoundOffset = 20,
468 CombinedLowerBoundVariableOffset = 21,
469 CombinedUpperBoundVariableOffset = 22,
470 CombinedEnsureUpperBoundOffset = 23,
471 CombinedInitOffset = 24,
472 CombinedConditionOffset = 25,
473 CombinedNextLowerBoundOffset = 26,
474 CombinedNextUpperBoundOffset = 27,
475 CombinedDistConditionOffset = 28,
476 CombinedParForInDistConditionOffset = 29,
479 CombinedDistributeEnd = 30,
484 Expr **Storage =
reinterpret_cast<Expr **
>(
491 Expr **Storage =
reinterpret_cast<Expr **
>(&*std::next(
498 Expr **Storage =
reinterpret_cast<Expr **
>(
506 Expr **Storage =
reinterpret_cast<Expr **
>(
514 Expr **Storage =
reinterpret_cast<Expr **
>(
531 template <
typename T>
534 unsigned CollapsedNum,
unsigned NumClauses,
535 unsigned NumSpecialChildren = 0)
537 numLoopChildren(CollapsedNum, Kind) +
539 CollapsedNum(CollapsedNum) {}
544 return CombinedDistributeEnd;
547 return WorksharingEnd;
554 return getArraysOffset(Kind) + 5 * CollapsedNum;
560 *std::next(
child_begin(), IterationVariableOffset) = IV;
563 *std::next(
child_begin(), LastIterationOffset) = LI;
566 *std::next(
child_begin(), CalcLastIterationOffset) = CLI;
569 *std::next(
child_begin(), PreConditionOffset) = PC;
577 *std::next(
child_begin(), PreInitsOffset) = PreInits;
583 "expected worksharing loop directive");
584 *std::next(
child_begin(), IsLastIterVariableOffset) = IL;
590 "expected worksharing loop directive");
591 *std::next(
child_begin(), LowerBoundVariableOffset) = LB;
597 "expected worksharing loop directive");
598 *std::next(
child_begin(), UpperBoundVariableOffset) = UB;
604 "expected worksharing loop directive");
605 *std::next(
child_begin(), StrideVariableOffset) = ST;
611 "expected worksharing loop directive");
612 *std::next(
child_begin(), EnsureUpperBoundOffset) = EUB;
618 "expected worksharing loop directive");
619 *std::next(
child_begin(), NextLowerBoundOffset) = NLB;
625 "expected worksharing loop directive");
626 *std::next(
child_begin(), NextUpperBoundOffset) = NUB;
632 "expected worksharing loop directive");
633 *std::next(
child_begin(), NumIterationsOffset) = NI;
637 "expected loop bound sharing directive");
638 *std::next(
child_begin(), PrevLowerBoundVariableOffset) = PrevLB;
642 "expected loop bound sharing directive");
643 *std::next(
child_begin(), PrevUpperBoundVariableOffset) = PrevUB;
647 "expected loop bound sharing directive");
648 *std::next(
child_begin(), DistIncOffset) = DistInc;
652 "expected loop bound sharing directive");
653 *std::next(
child_begin(), PrevEnsureUpperBoundOffset) = PrevEUB;
657 "expected loop bound sharing directive");
658 *std::next(
child_begin(), CombinedLowerBoundVariableOffset) = CombLB;
662 "expected loop bound sharing directive");
663 *std::next(
child_begin(), CombinedUpperBoundVariableOffset) = CombUB;
667 "expected loop bound sharing directive");
668 *std::next(
child_begin(), CombinedEnsureUpperBoundOffset) = CombEUB;
672 "expected loop bound sharing directive");
673 *std::next(
child_begin(), CombinedInitOffset) = CombInit;
677 "expected loop bound sharing directive");
678 *std::next(
child_begin(), CombinedConditionOffset) = CombCond;
682 "expected loop bound sharing directive");
683 *std::next(
child_begin(), CombinedNextLowerBoundOffset) = CombNLB;
687 "expected loop bound sharing directive");
688 *std::next(
child_begin(), CombinedNextUpperBoundOffset) = CombNUB;
692 "expected loop bound distribute sharing directive");
693 *std::next(
child_begin(), CombinedDistConditionOffset) = CombDistCond;
697 "expected loop bound distribute sharing directive");
699 CombinedParForInDistConditionOffset) = CombParForInDistCond;
810 return IterationVarRef !=
nullptr && LastIteration !=
nullptr &&
811 NumIterations !=
nullptr && PreCond !=
nullptr &&
812 Cond !=
nullptr && Init !=
nullptr && Inc !=
nullptr;
818 IterationVarRef =
nullptr;
819 LastIteration =
nullptr;
820 CalcLastIteration =
nullptr;
832 NumIterations =
nullptr;
837 Counters.resize(Size);
838 PrivateCounters.resize(Size);
840 Updates.resize(Size);
842 for (
unsigned i = 0;
i < Size; ++
i) {
843 Counters[
i] =
nullptr;
844 PrivateCounters[
i] =
nullptr;
846 Updates[
i] =
nullptr;
850 DistCombinedFields.
LB =
nullptr;
851 DistCombinedFields.
UB =
nullptr;
852 DistCombinedFields.
EUB =
nullptr;
853 DistCombinedFields.
Init =
nullptr;
854 DistCombinedFields.
Cond =
nullptr;
855 DistCombinedFields.
NLB =
nullptr;
856 DistCombinedFields.
NUB =
nullptr;
857 DistCombinedFields.
DistCond =
nullptr;
866 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
867 *std::next(
child_begin(), IterationVariableOffset)));
870 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
874 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
875 *std::next(
child_begin(), CalcLastIterationOffset)));
878 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
882 return const_cast<Expr *
>(
883 reinterpret_cast<const Expr *
>(*std::next(
child_begin(), CondOffset)));
886 return const_cast<Expr *
>(
887 reinterpret_cast<const Expr *
>(*std::next(
child_begin(), InitOffset)));
890 return const_cast<Expr *
>(
901 "expected worksharing loop directive");
902 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
903 *std::next(
child_begin(), IsLastIterVariableOffset)));
909 "expected worksharing loop directive");
910 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
911 *std::next(
child_begin(), LowerBoundVariableOffset)));
917 "expected worksharing loop directive");
918 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
919 *std::next(
child_begin(), UpperBoundVariableOffset)));
925 "expected worksharing loop directive");
926 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
933 "expected worksharing loop directive");
934 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
935 *std::next(
child_begin(), EnsureUpperBoundOffset)));
941 "expected worksharing loop directive");
942 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
949 "expected worksharing loop directive");
950 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
957 "expected worksharing loop directive");
958 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
963 "expected loop bound sharing directive");
964 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
965 *std::next(
child_begin(), PrevLowerBoundVariableOffset)));
969 "expected loop bound sharing directive");
970 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
971 *std::next(
child_begin(), PrevUpperBoundVariableOffset)));
975 "expected loop bound sharing directive");
976 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
981 "expected loop bound sharing directive");
982 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
983 *std::next(
child_begin(), PrevEnsureUpperBoundOffset)));
987 "expected loop bound sharing directive");
988 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
989 *std::next(
child_begin(), CombinedLowerBoundVariableOffset)));
993 "expected loop bound sharing directive");
994 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
995 *std::next(
child_begin(), CombinedUpperBoundVariableOffset)));
999 "expected loop bound sharing directive");
1000 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
1001 *std::next(
child_begin(), CombinedEnsureUpperBoundOffset)));
1005 "expected loop bound sharing directive");
1006 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
1011 "expected loop bound sharing directive");
1012 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
1013 *std::next(
child_begin(), CombinedConditionOffset)));
1017 "expected loop bound sharing directive");
1018 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
1019 *std::next(
child_begin(), CombinedNextLowerBoundOffset)));
1023 "expected loop bound sharing directive");
1024 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
1025 *std::next(
child_begin(), CombinedNextUpperBoundOffset)));
1029 "expected loop bound distribute sharing directive");
1030 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
1031 *std::next(
child_begin(), CombinedDistConditionOffset)));
1035 "expected loop bound distribute sharing directive");
1036 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
1037 *std::next(
child_begin(), CombinedParForInDistConditionOffset)));
1043 Body = cast<ForStmt>(Body)->getBody();
1044 for (
unsigned Cnt = 1; Cnt < CollapsedNum; ++Cnt) {
1046 Body = cast<ForStmt>(Body)->getBody();
1086 T->
getStmtClass() == OMPParallelForSimdDirectiveClass ||
1090 T->
getStmtClass() == OMPTargetParallelForDirectiveClass ||
1091 T->
getStmtClass() == OMPDistributeParallelForDirectiveClass ||
1092 T->
getStmtClass() == OMPDistributeParallelForSimdDirectiveClass ||
1093 T->
getStmtClass() == OMPDistributeSimdDirectiveClass ||
1094 T->
getStmtClass() == OMPTargetParallelForSimdDirectiveClass ||
1096 T->
getStmtClass() == OMPTeamsDistributeDirectiveClass ||
1097 T->
getStmtClass() == OMPTeamsDistributeSimdDirectiveClass ||
1099 OMPTeamsDistributeParallelForSimdDirectiveClass ||
1100 T->
getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass ||
1102 OMPTargetTeamsDistributeParallelForDirectiveClass ||
1104 OMPTargetTeamsDistributeParallelForSimdDirectiveClass ||
1105 T->
getStmtClass() == OMPTargetTeamsDistributeDirectiveClass ||
1106 T->
getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
1129 unsigned CollapsedNum,
unsigned NumClauses)
1131 EndLoc, CollapsedNum, NumClauses) {}
1157 Stmt *AssociatedStmt,
1198 unsigned CollapsedNum,
unsigned NumClauses)
1200 CollapsedNum, NumClauses),
1214 void setHasCancel(
bool Has) { HasCancel = Has; }
1271 unsigned CollapsedNum,
unsigned NumClauses)
1273 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
1309 unsigned NumClauses,
1339 unsigned NumClauses)
1341 StartLoc, EndLoc, NumClauses, 1),
1355 void setHasCancel(
bool Has) { HasCancel = Has; }
1407 StartLoc, EndLoc, 0, 1),
1429 Stmt *AssociatedStmt,
bool HasCancel);
1465 unsigned NumClauses)
1467 StartLoc, EndLoc, NumClauses, 1) {}
1520 StartLoc, EndLoc, 0, 1) {}
1539 Stmt *AssociatedStmt);
1572 StartLoc, EndLoc, NumClauses, 1),
1646 unsigned CollapsedNum,
unsigned NumClauses)
1648 StartLoc, EndLoc, CollapsedNum, NumClauses),
1663 void setHasCancel(
bool Has) { HasCancel = Has; }
1690 unsigned NumClauses,
1691 unsigned CollapsedNum,
1698 return T->
getStmtClass() == OMPParallelForDirectiveClass;
1722 unsigned CollapsedNum,
unsigned NumClauses)
1724 OMPD_parallel_for_simd, StartLoc, EndLoc, CollapsedNum,
1733 unsigned NumClauses)
1762 unsigned NumClauses,
1763 unsigned CollapsedNum,
1767 return T->
getStmtClass() == OMPParallelForSimdDirectiveClass;
1793 unsigned NumClauses)
1795 OMPD_parallel_sections, StartLoc, EndLoc,
1810 void setHasCancel(
bool Has) { HasCancel = Has; }
1839 return T->
getStmtClass() == OMPParallelSectionsDirectiveClass;
1863 unsigned NumClauses)
1865 EndLoc, NumClauses, 1),
1879 void setHasCancel(
bool Has) { HasCancel = Has; }
1894 Stmt *AssociatedStmt,
bool HasCancel);
1928 StartLoc, EndLoc, 0, 0) {}
1953 return T->
getStmtClass() == OMPTaskyieldDirectiveClass;
1972 StartLoc, EndLoc, 0, 0) {}
2016 StartLoc, EndLoc, 0, 0) {}
2060 unsigned NumClauses)
2062 StartLoc, EndLoc, NumClauses, 2) {}
2073 void setReductionRef(
Expr *RR) {
2090 Expr *ReductionRef);
2110 return T->
getStmtClass() == OMPTaskgroupDirectiveClass;
2133 unsigned NumClauses)
2135 StartLoc, EndLoc, NumClauses, 0) {}
2188 unsigned NumClauses)
2190 StartLoc, EndLoc, NumClauses, 1) {}
2245 bool IsXLHSInRHSPart;
2254 bool IsPostfixUpdate;
2263 unsigned NumClauses)
2265 StartLoc, EndLoc, NumClauses, 5),
2266 IsXLHSInRHSPart(
false), IsPostfixUpdate(
false) {}
2276 IsXLHSInRHSPart(
false), IsPostfixUpdate(
false) {}
2312 Expr *E,
Expr *UE,
bool IsXLHSInRHSPart,
bool IsPostfixUpdate);
2326 return cast_or_null<Expr>(*std::next(
child_begin()));
2332 return cast_or_null<Expr>(*std::next(
child_begin(), 2));
2335 return cast_or_null<Expr>(*std::next(
child_begin(), 2));
2347 return cast_or_null<Expr>(*std::next(
child_begin(), 3));
2352 return cast_or_null<Expr>(*std::next(
child_begin(), 4));
2377 unsigned NumClauses)
2379 StartLoc, EndLoc, NumClauses, 1) {}
2435 unsigned NumClauses)
2437 OMPD_target_data, StartLoc, EndLoc, NumClauses,
2471 return T->
getStmtClass() == OMPTargetDataDirectiveClass;
2493 unsigned NumClauses)
2495 OMPD_target_enter_data, StartLoc, EndLoc,
2530 return T->
getStmtClass() == OMPTargetEnterDataDirectiveClass;
2552 unsigned NumClauses)
2554 OMPD_target_exit_data, StartLoc, EndLoc,
2589 return T->
getStmtClass() == OMPTargetExitDataDirectiveClass;
2610 unsigned NumClauses)
2612 OMPD_target_parallel, StartLoc, EndLoc,
2648 return T->
getStmtClass() == OMPTargetParallelDirectiveClass;
2675 unsigned CollapsedNum,
unsigned NumClauses)
2677 OMPD_target_parallel_for, StartLoc, EndLoc,
2678 CollapsedNum, NumClauses),
2687 unsigned NumClauses)
2694 void setHasCancel(
bool Has) { HasCancel = Has; }
2721 unsigned NumClauses,
2722 unsigned CollapsedNum,
2729 return T->
getStmtClass() == OMPTargetParallelForDirectiveClass;
2750 unsigned NumClauses)
2752 StartLoc, EndLoc, NumClauses, 1) {}
2775 Stmt *AssociatedStmt);
2808 OMPD_cancellation_point, StartLoc, EndLoc, 0, 0),
2845 return T->
getStmtClass() == OMPCancellationPointDirectiveClass;
2866 unsigned NumClauses)
2868 StartLoc, EndLoc, NumClauses, 0),
2931 unsigned CollapsedNum,
unsigned NumClauses)
2933 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
2969 unsigned NumClauses,
2996 unsigned CollapsedNum,
unsigned NumClauses)
2998 OMPD_taskloop_simd, StartLoc, EndLoc, CollapsedNum,
3009 CollapsedNum, NumClauses) {}
3035 unsigned NumClauses,
3036 unsigned CollapsedNum,
3040 return T->
getStmtClass() == OMPTaskLoopSimdDirectiveClass;
3063 unsigned CollapsedNum,
unsigned NumClauses)
3065 StartLoc, EndLoc, CollapsedNum, NumClauses)
3103 unsigned NumClauses,
3107 return T->
getStmtClass() == OMPDistributeDirectiveClass;
3129 unsigned NumClauses)
3131 OMPD_target_update, StartLoc, EndLoc, NumClauses,
3166 return T->
getStmtClass() == OMPTargetUpdateDirectiveClass;
3182 bool HasCancel =
false;
3193 unsigned CollapsedNum,
unsigned NumClauses)
3195 OMPD_distribute_parallel_for, StartLoc, EndLoc,
3196 CollapsedNum, NumClauses), HasCancel(
false) {}
3204 unsigned NumClauses)
3211 void setHasCancel(
bool Has) { HasCancel = Has; }
3238 unsigned NumClauses,
3239 unsigned CollapsedNum,
3246 return T->
getStmtClass() == OMPDistributeParallelForDirectiveClass;
3271 unsigned CollapsedNum,
3272 unsigned NumClauses)
3274 OMPD_distribute_parallel_for_simd, StartLoc,
3275 EndLoc, CollapsedNum, NumClauses) {}
3283 unsigned NumClauses)
3285 OMPD_distribute_parallel_for_simd,
3312 const ASTContext &
C,
unsigned NumClauses,
unsigned CollapsedNum,
3316 return T->
getStmtClass() == OMPDistributeParallelForSimdDirectiveClass;
3339 unsigned CollapsedNum,
unsigned NumClauses)
3341 OMPD_distribute_simd, StartLoc, EndLoc, CollapsedNum,
3350 unsigned NumClauses)
3378 unsigned NumClauses,
3379 unsigned CollapsedNum,
3383 return T->
getStmtClass() == OMPDistributeSimdDirectiveClass;
3407 unsigned CollapsedNum,
unsigned NumClauses)
3409 OMPD_target_parallel_for_simd, StartLoc, EndLoc,
3410 CollapsedNum, NumClauses) {}
3418 unsigned NumClauses)
3446 unsigned NumClauses,
3447 unsigned CollapsedNum,
3451 return T->
getStmtClass() == OMPTargetParallelForSimdDirectiveClass;
3475 unsigned CollapsedNum,
unsigned NumClauses)
3477 OMPD_target_simd, StartLoc, EndLoc, CollapsedNum,
3513 unsigned NumClauses,
3514 unsigned CollapsedNum,
3518 return T->
getStmtClass() == OMPTargetSimdDirectiveClass;
3541 unsigned CollapsedNum,
unsigned NumClauses)
3543 OMPD_teams_distribute, StartLoc, EndLoc,
3544 CollapsedNum, NumClauses) {}
3552 unsigned NumClauses)
3580 unsigned NumClauses,
3581 unsigned CollapsedNum,
3585 return T->
getStmtClass() == OMPTeamsDistributeDirectiveClass;
3610 unsigned NumClauses)
3612 OMPD_teams_distribute_simd, StartLoc, EndLoc,
3613 CollapsedNum, NumClauses) {}
3621 unsigned NumClauses)
3650 unsigned NumClauses,
3651 unsigned CollapsedNum,
3655 return T->
getStmtClass() == OMPTeamsDistributeSimdDirectiveClass;
3681 unsigned CollapsedNum,
3682 unsigned NumClauses)
3684 OMPD_teams_distribute_parallel_for_simd, StartLoc,
3685 EndLoc, CollapsedNum, NumClauses) {}
3693 unsigned NumClauses)
3695 OMPD_teams_distribute_parallel_for_simd,
3726 return T->
getStmtClass() == OMPTeamsDistributeParallelForSimdDirectiveClass;
3742 bool HasCancel =
false;
3753 unsigned CollapsedNum,
3754 unsigned NumClauses)
3756 OMPD_teams_distribute_parallel_for, StartLoc, EndLoc,
3757 CollapsedNum, NumClauses), HasCancel(
false) {}
3765 unsigned NumClauses)
3772 void setHasCancel(
bool Has) { HasCancel = Has; }
3805 return T->
getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass;
3826 unsigned NumClauses)
3828 OMPD_target_teams, StartLoc, EndLoc, NumClauses,
3853 Stmt *AssociatedStmt);
3864 return T->
getStmtClass() == OMPTargetTeamsDirectiveClass;
3888 unsigned CollapsedNum,
unsigned NumClauses)
3890 OMPD_target_teams_distribute, StartLoc, EndLoc,
3891 CollapsedNum, NumClauses) {}
3899 unsigned NumClauses)
3931 return T->
getStmtClass() == OMPTargetTeamsDistributeDirectiveClass;
3948 bool HasCancel =
false;
3959 unsigned CollapsedNum,
3960 unsigned NumClauses)
3962 OMPTargetTeamsDistributeParallelForDirectiveClass,
3963 OMPD_target_teams_distribute_parallel_for, StartLoc,
3964 EndLoc, CollapsedNum, NumClauses),
3973 unsigned NumClauses)
3975 this, OMPTargetTeamsDistributeParallelForDirectiveClass,
3981 void setHasCancel(
bool Has) { HasCancel = Has; }
4015 OMPTargetTeamsDistributeParallelForDirectiveClass;
4041 unsigned CollapsedNum,
4042 unsigned NumClauses)
4044 OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
4045 OMPD_target_teams_distribute_parallel_for_simd,
4046 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
4054 unsigned CollapsedNum,
unsigned NumClauses)
4056 this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
4057 OMPD_target_teams_distribute_parallel_for_simd,
SourceLocation(),
4088 OMPTargetTeamsDistributeParallelForSimdDirectiveClass;
4113 unsigned CollapsedNum,
4114 unsigned NumClauses)
4116 OMPD_target_teams_distribute_simd, StartLoc, EndLoc,
4117 CollapsedNum, NumClauses) {}
4125 unsigned NumClauses)
4157 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)
static llvm::iterator_range< used_clauses_child_iterator > used_clauses_children(ArrayRef< OMPClause *> Clauses)
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)
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
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
bool isStandaloneDirective() const
Returns whether or not this is a Standalone directive.
static bool classof(const Stmt *T)
Stmt * operator->() const
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...
used_clauses_child_iterator & operator++()
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)
const Stmt * getStructuredBlock() const
Returns the AST node representing OpenMP structured-block of this OpenMP executable directive...
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)
used_clauses_child_iterator(ArrayRef< OMPClause *> Clauses)
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.
llvm::iterator_range< const_child_iterator > const_child_range
bool hasCancel() const
Return true if current directive has inner cancel directive.
static bool classof(const Stmt *T)
This represents '#pragma omp taskgroup' directive.
child_range used_children()
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...
ConstStmtIterator const_child_iterator
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.
Stmt * getStructuredBlock()
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.
const_child_range children() const
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
Iterates over expressions/statements used in the construct.
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.