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();
215 CaptureRegions.begin(), CaptureRegions.end(),
217 "RegionKind not found in OpenMP CaptureRegions.");
219 for (
auto ThisCaptureRegion : CaptureRegions) {
220 if (ThisCaptureRegion == RegionKind)
222 CS = cast<CapturedStmt>(CS->getCapturedStmt());
224 llvm_unreachable(
"Incorrect RegionKind specified for directive.");
230 "Must have associated statement.");
233 assert(!CaptureRegions.empty() &&
234 "At least one captured statement must be provided.");
237 CS = cast<CapturedStmt>(CS->getCapturedStmt());
249 return S->
getStmtClass() >= firstOMPExecutableDirectiveConstant &&
250 S->
getStmtClass() <= lastOMPExecutableDirectiveConstant;
256 Stmt **ChildStorage =
reinterpret_cast<Stmt **
>(getClauses().end());
259 return child_range(ChildStorage, ChildStorage + 1);
291 StartLoc, EndLoc, NumClauses, 1),
305 void setHasCancel(
bool Has) { HasCancel = Has; }
343 unsigned CollapsedNum;
362 AssociatedStmtOffset = 0,
363 IterationVariableOffset = 1,
364 LastIterationOffset = 2,
365 CalcLastIterationOffset = 3,
366 PreConditionOffset = 4,
376 IsLastIterVariableOffset = 9,
377 LowerBoundVariableOffset = 10,
378 UpperBoundVariableOffset = 11,
379 StrideVariableOffset = 12,
380 EnsureUpperBoundOffset = 13,
381 NextLowerBoundOffset = 14,
382 NextUpperBoundOffset = 15,
383 NumIterationsOffset = 16,
386 PrevLowerBoundVariableOffset = 17,
387 PrevUpperBoundVariableOffset = 18,
389 PrevEnsureUpperBoundOffset = 20,
390 CombinedLowerBoundVariableOffset = 21,
391 CombinedUpperBoundVariableOffset = 22,
392 CombinedEnsureUpperBoundOffset = 23,
393 CombinedInitOffset = 24,
394 CombinedConditionOffset = 25,
395 CombinedNextLowerBoundOffset = 26,
396 CombinedNextUpperBoundOffset = 27,
399 CombinedDistributeEnd = 28,
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;
712 return IterationVarRef !=
nullptr && LastIteration !=
nullptr &&
713 NumIterations !=
nullptr && PreCond !=
nullptr &&
714 Cond !=
nullptr && Init !=
nullptr && Inc !=
nullptr;
720 IterationVarRef =
nullptr;
721 LastIteration =
nullptr;
722 CalcLastIteration =
nullptr;
734 NumIterations =
nullptr;
739 Counters.resize(Size);
740 PrivateCounters.resize(Size);
742 Updates.resize(Size);
744 for (
unsigned i = 0; i < Size; ++i) {
745 Counters[i] =
nullptr;
746 PrivateCounters[i] =
nullptr;
748 Updates[i] =
nullptr;
752 DistCombinedFields.
LB =
nullptr;
753 DistCombinedFields.
UB =
nullptr;
754 DistCombinedFields.
EUB =
nullptr;
755 DistCombinedFields.
Init =
nullptr;
756 DistCombinedFields.
Cond =
nullptr;
757 DistCombinedFields.
NLB =
nullptr;
758 DistCombinedFields.
NUB =
nullptr;
766 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
767 *std::next(
child_begin(), IterationVariableOffset)));
770 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
774 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
775 *std::next(
child_begin(), CalcLastIterationOffset)));
778 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
782 return const_cast<Expr *
>(
783 reinterpret_cast<const Expr *
>(*std::next(
child_begin(), CondOffset)));
786 return const_cast<Expr *
>(
787 reinterpret_cast<const Expr *
>(*std::next(
child_begin(), InitOffset)));
790 return const_cast<Expr *
>(
801 "expected worksharing loop directive");
802 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
803 *std::next(
child_begin(), IsLastIterVariableOffset)));
809 "expected worksharing loop directive");
810 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
811 *std::next(
child_begin(), LowerBoundVariableOffset)));
817 "expected worksharing loop directive");
818 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
819 *std::next(
child_begin(), UpperBoundVariableOffset)));
825 "expected worksharing loop directive");
826 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
833 "expected worksharing loop directive");
834 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
835 *std::next(
child_begin(), EnsureUpperBoundOffset)));
841 "expected worksharing loop directive");
842 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
849 "expected worksharing loop directive");
850 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
857 "expected worksharing loop directive");
858 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
863 "expected loop bound sharing directive");
864 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
865 *std::next(
child_begin(), PrevLowerBoundVariableOffset)));
869 "expected loop bound sharing directive");
870 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
871 *std::next(
child_begin(), PrevUpperBoundVariableOffset)));
875 "expected loop bound sharing directive");
876 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
881 "expected loop bound sharing directive");
882 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
883 *std::next(
child_begin(), PrevEnsureUpperBoundOffset)));
887 "expected loop bound sharing directive");
888 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
889 *std::next(
child_begin(), CombinedLowerBoundVariableOffset)));
893 "expected loop bound sharing directive");
894 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
895 *std::next(
child_begin(), CombinedUpperBoundVariableOffset)));
899 "expected loop bound sharing directive");
900 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
901 *std::next(
child_begin(), CombinedEnsureUpperBoundOffset)));
905 "expected loop bound sharing directive");
906 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
911 "expected loop bound sharing directive");
912 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
913 *std::next(
child_begin(), CombinedConditionOffset)));
917 "expected loop bound sharing directive");
918 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
919 *std::next(
child_begin(), CombinedNextLowerBoundOffset)));
923 "expected loop bound sharing directive");
924 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
925 *std::next(
child_begin(), CombinedNextUpperBoundOffset)));
931 Body = cast<ForStmt>(Body)->getBody();
932 for (
unsigned Cnt = 1; Cnt < CollapsedNum; ++Cnt) {
934 Body = cast<ForStmt>(Body)->getBody();
974 T->
getStmtClass() == OMPParallelForSimdDirectiveClass ||
978 T->
getStmtClass() == OMPTargetParallelForDirectiveClass ||
979 T->
getStmtClass() == OMPDistributeParallelForDirectiveClass ||
980 T->
getStmtClass() == OMPDistributeParallelForSimdDirectiveClass ||
982 T->
getStmtClass() == OMPTargetParallelForSimdDirectiveClass ||
984 T->
getStmtClass() == OMPTeamsDistributeDirectiveClass ||
985 T->
getStmtClass() == OMPTeamsDistributeSimdDirectiveClass ||
987 OMPTeamsDistributeParallelForSimdDirectiveClass ||
988 T->
getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass ||
990 OMPTargetTeamsDistributeParallelForDirectiveClass ||
992 OMPTargetTeamsDistributeParallelForSimdDirectiveClass ||
993 T->
getStmtClass() == OMPTargetTeamsDistributeDirectiveClass ||
994 T->
getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
1017 unsigned CollapsedNum,
unsigned NumClauses)
1019 EndLoc, CollapsedNum, NumClauses) {}
1045 Stmt *AssociatedStmt,
1086 unsigned CollapsedNum,
unsigned NumClauses)
1088 CollapsedNum, NumClauses),
1102 void setHasCancel(
bool Has) { HasCancel = Has; }
1159 unsigned CollapsedNum,
unsigned NumClauses)
1161 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
1197 unsigned NumClauses,
1227 unsigned NumClauses)
1229 StartLoc, EndLoc, NumClauses, 1),
1243 void setHasCancel(
bool Has) { HasCancel = Has; }
1295 StartLoc, EndLoc, 0, 1),
1317 Stmt *AssociatedStmt,
bool HasCancel);
1353 unsigned NumClauses)
1355 StartLoc, EndLoc, NumClauses, 1) {}
1408 StartLoc, EndLoc, 0, 1) {}
1427 Stmt *AssociatedStmt);
1460 StartLoc, EndLoc, NumClauses, 1),
1534 unsigned CollapsedNum,
unsigned NumClauses)
1536 StartLoc, EndLoc, CollapsedNum, NumClauses),
1551 void setHasCancel(
bool Has) { HasCancel = Has; }
1578 unsigned NumClauses,
1579 unsigned CollapsedNum,
1586 return T->
getStmtClass() == OMPParallelForDirectiveClass;
1610 unsigned CollapsedNum,
unsigned NumClauses)
1612 OMPD_parallel_for_simd, StartLoc, EndLoc, CollapsedNum,
1621 unsigned NumClauses)
1650 unsigned NumClauses,
1651 unsigned CollapsedNum,
1655 return T->
getStmtClass() == OMPParallelForSimdDirectiveClass;
1681 unsigned NumClauses)
1683 OMPD_parallel_sections, StartLoc, EndLoc,
1698 void setHasCancel(
bool Has) { HasCancel = Has; }
1727 return T->
getStmtClass() == OMPParallelSectionsDirectiveClass;
1751 unsigned NumClauses)
1753 EndLoc, NumClauses, 1),
1767 void setHasCancel(
bool Has) { HasCancel = Has; }
1782 Stmt *AssociatedStmt,
bool HasCancel);
1816 StartLoc, EndLoc, 0, 0) {}
1841 return T->
getStmtClass() == OMPTaskyieldDirectiveClass;
1860 StartLoc, EndLoc, 0, 0) {}
1904 StartLoc, EndLoc, 0, 0) {}
1948 unsigned NumClauses)
1950 StartLoc, EndLoc, NumClauses, 2) {}
1961 void setReductionRef(
Expr *RR) {
1978 Expr *ReductionRef);
1998 return T->
getStmtClass() == OMPTaskgroupDirectiveClass;
2021 unsigned NumClauses)
2023 StartLoc, EndLoc, NumClauses, 0) {}
2076 unsigned NumClauses)
2078 StartLoc, EndLoc, NumClauses, 1) {}
2133 bool IsXLHSInRHSPart;
2142 bool IsPostfixUpdate;
2151 unsigned NumClauses)
2153 StartLoc, EndLoc, NumClauses, 5),
2154 IsXLHSInRHSPart(
false), IsPostfixUpdate(
false) {}
2164 IsXLHSInRHSPart(
false), IsPostfixUpdate(
false) {}
2200 Expr *E,
Expr *UE,
bool IsXLHSInRHSPart,
bool IsPostfixUpdate);
2214 return cast_or_null<Expr>(*std::next(
child_begin()));
2220 return cast_or_null<Expr>(*std::next(
child_begin(), 2));
2223 return cast_or_null<Expr>(*std::next(
child_begin(), 2));
2235 return cast_or_null<Expr>(*std::next(
child_begin(), 3));
2240 return cast_or_null<Expr>(*std::next(
child_begin(), 4));
2265 unsigned NumClauses)
2267 StartLoc, EndLoc, NumClauses, 1) {}
2323 unsigned NumClauses)
2325 OMPD_target_data, StartLoc, EndLoc, NumClauses,
2359 return T->
getStmtClass() == OMPTargetDataDirectiveClass;
2381 unsigned NumClauses)
2383 OMPD_target_enter_data, StartLoc, EndLoc,
2418 return T->
getStmtClass() == OMPTargetEnterDataDirectiveClass;
2440 unsigned NumClauses)
2442 OMPD_target_exit_data, StartLoc, EndLoc,
2477 return T->
getStmtClass() == OMPTargetExitDataDirectiveClass;
2498 unsigned NumClauses)
2500 OMPD_target_parallel, StartLoc, EndLoc,
2536 return T->
getStmtClass() == OMPTargetParallelDirectiveClass;
2563 unsigned CollapsedNum,
unsigned NumClauses)
2565 OMPD_target_parallel_for, StartLoc, EndLoc,
2566 CollapsedNum, NumClauses),
2575 unsigned NumClauses)
2582 void setHasCancel(
bool Has) { HasCancel = Has; }
2609 unsigned NumClauses,
2610 unsigned CollapsedNum,
2617 return T->
getStmtClass() == OMPTargetParallelForDirectiveClass;
2638 unsigned NumClauses)
2640 StartLoc, EndLoc, NumClauses, 1) {}
2663 Stmt *AssociatedStmt);
2696 OMPD_cancellation_point, StartLoc, EndLoc, 0, 0),
2733 return T->
getStmtClass() == OMPCancellationPointDirectiveClass;
2754 unsigned NumClauses)
2756 StartLoc, EndLoc, NumClauses, 0),
2819 unsigned CollapsedNum,
unsigned NumClauses)
2821 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
2857 unsigned NumClauses,
2884 unsigned CollapsedNum,
unsigned NumClauses)
2886 OMPD_taskloop_simd, StartLoc, EndLoc, CollapsedNum,
2897 CollapsedNum, NumClauses) {}
2923 unsigned NumClauses,
2924 unsigned CollapsedNum,
2928 return T->
getStmtClass() == OMPTaskLoopSimdDirectiveClass;
2951 unsigned CollapsedNum,
unsigned NumClauses)
2953 StartLoc, EndLoc, CollapsedNum, NumClauses)
2991 unsigned NumClauses,
2995 return T->
getStmtClass() == OMPDistributeDirectiveClass;
3017 unsigned NumClauses)
3019 OMPD_target_update, StartLoc, EndLoc, NumClauses,
3054 return T->
getStmtClass() == OMPTargetUpdateDirectiveClass;
3070 bool HasCancel =
false;
3081 unsigned CollapsedNum,
unsigned NumClauses)
3083 OMPD_distribute_parallel_for, StartLoc, EndLoc,
3084 CollapsedNum, NumClauses), HasCancel(
false) {}
3092 unsigned NumClauses)
3099 void setHasCancel(
bool Has) { HasCancel = Has; }
3126 unsigned NumClauses,
3127 unsigned CollapsedNum,
3134 return T->
getStmtClass() == OMPDistributeParallelForDirectiveClass;
3159 unsigned CollapsedNum,
3160 unsigned NumClauses)
3162 OMPD_distribute_parallel_for_simd, StartLoc,
3163 EndLoc, CollapsedNum, NumClauses) {}
3171 unsigned NumClauses)
3173 OMPD_distribute_parallel_for_simd,
3200 const ASTContext &
C,
unsigned NumClauses,
unsigned CollapsedNum,
3204 return T->
getStmtClass() == OMPDistributeParallelForSimdDirectiveClass;
3227 unsigned CollapsedNum,
unsigned NumClauses)
3229 OMPD_distribute_simd, StartLoc, EndLoc, CollapsedNum,
3238 unsigned NumClauses)
3266 unsigned NumClauses,
3267 unsigned CollapsedNum,
3271 return T->
getStmtClass() == OMPDistributeSimdDirectiveClass;
3295 unsigned CollapsedNum,
unsigned NumClauses)
3297 OMPD_target_parallel_for_simd, StartLoc, EndLoc,
3298 CollapsedNum, NumClauses) {}
3306 unsigned NumClauses)
3334 unsigned NumClauses,
3335 unsigned CollapsedNum,
3339 return T->
getStmtClass() == OMPTargetParallelForSimdDirectiveClass;
3363 unsigned CollapsedNum,
unsigned NumClauses)
3365 OMPD_target_simd, StartLoc, EndLoc, CollapsedNum,
3401 unsigned NumClauses,
3402 unsigned CollapsedNum,
3406 return T->
getStmtClass() == OMPTargetSimdDirectiveClass;
3429 unsigned CollapsedNum,
unsigned NumClauses)
3431 OMPD_teams_distribute, StartLoc, EndLoc,
3432 CollapsedNum, NumClauses) {}
3440 unsigned NumClauses)
3468 unsigned NumClauses,
3469 unsigned CollapsedNum,
3473 return T->
getStmtClass() == OMPTeamsDistributeDirectiveClass;
3498 unsigned NumClauses)
3500 OMPD_teams_distribute_simd, StartLoc, EndLoc,
3501 CollapsedNum, NumClauses) {}
3509 unsigned NumClauses)
3538 unsigned NumClauses,
3539 unsigned CollapsedNum,
3543 return T->
getStmtClass() == OMPTeamsDistributeSimdDirectiveClass;
3569 unsigned CollapsedNum,
3570 unsigned NumClauses)
3572 OMPD_teams_distribute_parallel_for_simd, StartLoc,
3573 EndLoc, CollapsedNum, NumClauses) {}
3581 unsigned NumClauses)
3583 OMPD_teams_distribute_parallel_for_simd,
3614 return T->
getStmtClass() == OMPTeamsDistributeParallelForSimdDirectiveClass;
3630 bool HasCancel =
false;
3641 unsigned CollapsedNum,
3642 unsigned NumClauses)
3644 OMPD_teams_distribute_parallel_for, StartLoc, EndLoc,
3645 CollapsedNum, NumClauses), HasCancel(
false) {}
3653 unsigned NumClauses)
3660 void setHasCancel(
bool Has) { HasCancel = Has; }
3693 return T->
getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass;
3714 unsigned NumClauses)
3716 OMPD_target_teams, StartLoc, EndLoc, NumClauses,
3741 Stmt *AssociatedStmt);
3752 return T->
getStmtClass() == OMPTargetTeamsDirectiveClass;
3776 unsigned CollapsedNum,
unsigned NumClauses)
3778 OMPD_target_teams_distribute, StartLoc, EndLoc,
3779 CollapsedNum, NumClauses) {}
3787 unsigned NumClauses)
3819 return T->
getStmtClass() == OMPTargetTeamsDistributeDirectiveClass;
3836 bool HasCancel =
false;
3847 unsigned CollapsedNum,
3848 unsigned NumClauses)
3850 OMPTargetTeamsDistributeParallelForDirectiveClass,
3851 OMPD_target_teams_distribute_parallel_for, StartLoc,
3852 EndLoc, CollapsedNum, NumClauses),
3861 unsigned NumClauses)
3863 this, OMPTargetTeamsDistributeParallelForDirectiveClass,
3869 void setHasCancel(
bool Has) { HasCancel = Has; }
3903 OMPTargetTeamsDistributeParallelForDirectiveClass;
3929 unsigned CollapsedNum,
3930 unsigned NumClauses)
3932 OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
3933 OMPD_target_teams_distribute_parallel_for_simd,
3934 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
3942 unsigned CollapsedNum,
unsigned NumClauses)
3944 this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
3945 OMPD_target_teams_distribute_parallel_for_simd,
SourceLocation(),
3976 OMPTargetTeamsDistributeParallelForSimdDirectiveClass;
4001 unsigned CollapsedNum,
4002 unsigned NumClauses)
4004 OMPD_target_teams_distribute_simd, StartLoc, EndLoc,
4005 CollapsedNum, NumClauses) {}
4013 unsigned NumClauses)
4045 return T->
getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
void setPreInits(Stmt *PreInits)
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
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
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
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.
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.
SourceLocation getLocStart() const LLVM_READONLY
Returns starting location of directive kind.
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 * 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)
Expr - 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.
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
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.
SourceLocation getLocEnd() const LLVM_READONLY
Returns ending location of directive.
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.