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 return S->
getStmtClass() >= firstOMPExecutableDirectiveConstant &&
229 S->
getStmtClass() <= lastOMPExecutableDirectiveConstant;
235 Stmt **ChildStorage =
reinterpret_cast<Stmt **
>(getClauses().end());
236 return child_range(ChildStorage, ChildStorage + NumChildren);
268 StartLoc, EndLoc, NumClauses, 1),
282 void setHasCancel(
bool Has) { HasCancel = Has; }
320 unsigned CollapsedNum;
339 AssociatedStmtOffset = 0,
340 IterationVariableOffset = 1,
341 LastIterationOffset = 2,
342 CalcLastIterationOffset = 3,
343 PreConditionOffset = 4,
353 IsLastIterVariableOffset = 9,
354 LowerBoundVariableOffset = 10,
355 UpperBoundVariableOffset = 11,
356 StrideVariableOffset = 12,
357 EnsureUpperBoundOffset = 13,
358 NextLowerBoundOffset = 14,
359 NextUpperBoundOffset = 15,
360 NumIterationsOffset = 16,
363 PrevLowerBoundVariableOffset = 17,
364 PrevUpperBoundVariableOffset = 18,
366 PrevEnsureUpperBoundOffset = 20,
367 CombinedLowerBoundVariableOffset = 21,
368 CombinedUpperBoundVariableOffset = 22,
369 CombinedEnsureUpperBoundOffset = 23,
370 CombinedInitOffset = 24,
371 CombinedConditionOffset = 25,
372 CombinedNextLowerBoundOffset = 26,
373 CombinedNextUpperBoundOffset = 27,
376 CombinedDistributeEnd = 28,
381 Expr **Storage =
reinterpret_cast<Expr **
>(
388 Expr **Storage =
reinterpret_cast<Expr **
>(&*std::next(
395 Expr **Storage =
reinterpret_cast<Expr **
>(
403 Expr **Storage =
reinterpret_cast<Expr **
>(
411 Expr **Storage =
reinterpret_cast<Expr **
>(
428 template <
typename T>
431 unsigned CollapsedNum,
unsigned NumClauses,
432 unsigned NumSpecialChildren = 0)
434 numLoopChildren(CollapsedNum, Kind) +
436 CollapsedNum(CollapsedNum) {}
441 return CombinedDistributeEnd;
444 return WorksharingEnd;
451 return getArraysOffset(Kind) + 5 * CollapsedNum;
457 *std::next(
child_begin(), IterationVariableOffset) = IV;
460 *std::next(
child_begin(), LastIterationOffset) = LI;
463 *std::next(
child_begin(), CalcLastIterationOffset) = CLI;
466 *std::next(
child_begin(), PreConditionOffset) = PC;
474 *std::next(
child_begin(), PreInitsOffset) = PreInits;
480 "expected worksharing loop directive");
481 *std::next(
child_begin(), IsLastIterVariableOffset) = IL;
487 "expected worksharing loop directive");
488 *std::next(
child_begin(), LowerBoundVariableOffset) = LB;
494 "expected worksharing loop directive");
495 *std::next(
child_begin(), UpperBoundVariableOffset) = UB;
501 "expected worksharing loop directive");
502 *std::next(
child_begin(), StrideVariableOffset) = ST;
508 "expected worksharing loop directive");
509 *std::next(
child_begin(), EnsureUpperBoundOffset) = EUB;
515 "expected worksharing loop directive");
516 *std::next(
child_begin(), NextLowerBoundOffset) = NLB;
522 "expected worksharing loop directive");
523 *std::next(
child_begin(), NextUpperBoundOffset) = NUB;
529 "expected worksharing loop directive");
530 *std::next(
child_begin(), NumIterationsOffset) = NI;
534 "expected loop bound sharing directive");
535 *std::next(
child_begin(), PrevLowerBoundVariableOffset) = PrevLB;
539 "expected loop bound sharing directive");
540 *std::next(
child_begin(), PrevUpperBoundVariableOffset) = PrevUB;
544 "expected loop bound sharing directive");
545 *std::next(
child_begin(), DistIncOffset) = DistInc;
549 "expected loop bound sharing directive");
550 *std::next(
child_begin(), PrevEnsureUpperBoundOffset) = PrevEUB;
554 "expected loop bound sharing directive");
555 *std::next(
child_begin(), CombinedLowerBoundVariableOffset) = CombLB;
559 "expected loop bound sharing directive");
560 *std::next(
child_begin(), CombinedUpperBoundVariableOffset) = CombUB;
564 "expected loop bound sharing directive");
565 *std::next(
child_begin(), CombinedEnsureUpperBoundOffset) = CombEUB;
569 "expected loop bound sharing directive");
570 *std::next(
child_begin(), CombinedInitOffset) = CombInit;
574 "expected loop bound sharing directive");
575 *std::next(
child_begin(), CombinedConditionOffset) = CombCond;
579 "expected loop bound sharing directive");
580 *std::next(
child_begin(), CombinedNextLowerBoundOffset) = CombNLB;
584 "expected loop bound sharing directive");
585 *std::next(
child_begin(), CombinedNextUpperBoundOffset) = CombNUB;
689 return IterationVarRef !=
nullptr && LastIteration !=
nullptr &&
690 NumIterations !=
nullptr && PreCond !=
nullptr &&
691 Cond !=
nullptr && Init !=
nullptr && Inc !=
nullptr;
697 IterationVarRef =
nullptr;
698 LastIteration =
nullptr;
699 CalcLastIteration =
nullptr;
711 NumIterations =
nullptr;
716 Counters.resize(Size);
717 PrivateCounters.resize(Size);
719 Updates.resize(Size);
721 for (
unsigned i = 0; i < Size; ++i) {
722 Counters[i] =
nullptr;
723 PrivateCounters[i] =
nullptr;
725 Updates[i] =
nullptr;
729 DistCombinedFields.
LB =
nullptr;
730 DistCombinedFields.
UB =
nullptr;
731 DistCombinedFields.
EUB =
nullptr;
732 DistCombinedFields.
Init =
nullptr;
733 DistCombinedFields.
Cond =
nullptr;
734 DistCombinedFields.
NLB =
nullptr;
735 DistCombinedFields.
NUB =
nullptr;
743 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
744 *std::next(
child_begin(), IterationVariableOffset)));
747 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
751 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
752 *std::next(
child_begin(), CalcLastIterationOffset)));
755 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
759 return const_cast<Expr *
>(
760 reinterpret_cast<const Expr *
>(*std::next(
child_begin(), CondOffset)));
763 return const_cast<Expr *
>(
764 reinterpret_cast<const Expr *
>(*std::next(
child_begin(), InitOffset)));
767 return const_cast<Expr *
>(
778 "expected worksharing loop directive");
779 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
780 *std::next(
child_begin(), IsLastIterVariableOffset)));
786 "expected worksharing loop directive");
787 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
788 *std::next(
child_begin(), LowerBoundVariableOffset)));
794 "expected worksharing loop directive");
795 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
796 *std::next(
child_begin(), UpperBoundVariableOffset)));
802 "expected worksharing loop directive");
803 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
810 "expected worksharing loop directive");
811 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
812 *std::next(
child_begin(), EnsureUpperBoundOffset)));
818 "expected worksharing loop directive");
819 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
826 "expected worksharing loop directive");
827 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
834 "expected worksharing loop directive");
835 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
840 "expected loop bound sharing directive");
841 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
842 *std::next(
child_begin(), PrevLowerBoundVariableOffset)));
846 "expected loop bound sharing directive");
847 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
848 *std::next(
child_begin(), PrevUpperBoundVariableOffset)));
852 "expected loop bound sharing directive");
853 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
858 "expected loop bound sharing directive");
859 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
860 *std::next(
child_begin(), PrevEnsureUpperBoundOffset)));
864 "expected loop bound sharing directive");
865 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
866 *std::next(
child_begin(), CombinedLowerBoundVariableOffset)));
870 "expected loop bound sharing directive");
871 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
872 *std::next(
child_begin(), CombinedUpperBoundVariableOffset)));
876 "expected loop bound sharing directive");
877 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
878 *std::next(
child_begin(), CombinedEnsureUpperBoundOffset)));
882 "expected loop bound sharing directive");
883 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
888 "expected loop bound sharing directive");
889 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
890 *std::next(
child_begin(), CombinedConditionOffset)));
894 "expected loop bound sharing directive");
895 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
896 *std::next(
child_begin(), CombinedNextLowerBoundOffset)));
900 "expected loop bound sharing directive");
901 return const_cast<Expr *
>(
reinterpret_cast<const Expr *
>(
902 *std::next(
child_begin(), CombinedNextUpperBoundOffset)));
907 while(
const auto *CS = dyn_cast<CapturedStmt>(Body))
908 Body = CS->getCapturedStmt();
909 Body = cast<ForStmt>(Body)->getBody();
910 for (
unsigned Cnt = 1; Cnt < CollapsedNum; ++Cnt) {
912 Body = cast<ForStmt>(Body)->getBody();
952 T->
getStmtClass() == OMPParallelForSimdDirectiveClass ||
956 T->
getStmtClass() == OMPTargetParallelForDirectiveClass ||
957 T->
getStmtClass() == OMPDistributeParallelForDirectiveClass ||
958 T->
getStmtClass() == OMPDistributeParallelForSimdDirectiveClass ||
960 T->
getStmtClass() == OMPTargetParallelForSimdDirectiveClass ||
962 T->
getStmtClass() == OMPTeamsDistributeDirectiveClass ||
963 T->
getStmtClass() == OMPTeamsDistributeSimdDirectiveClass ||
965 OMPTeamsDistributeParallelForSimdDirectiveClass ||
966 T->
getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass ||
968 OMPTargetTeamsDistributeParallelForDirectiveClass ||
970 OMPTargetTeamsDistributeParallelForSimdDirectiveClass ||
971 T->
getStmtClass() == OMPTargetTeamsDistributeDirectiveClass ||
972 T->
getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
995 unsigned CollapsedNum,
unsigned NumClauses)
997 EndLoc, CollapsedNum, NumClauses) {}
1023 Stmt *AssociatedStmt,
1064 unsigned CollapsedNum,
unsigned NumClauses)
1066 CollapsedNum, NumClauses),
1080 void setHasCancel(
bool Has) { HasCancel = Has; }
1137 unsigned CollapsedNum,
unsigned NumClauses)
1139 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
1175 unsigned NumClauses,
1205 unsigned NumClauses)
1207 StartLoc, EndLoc, NumClauses, 1),
1221 void setHasCancel(
bool Has) { HasCancel = Has; }
1273 StartLoc, EndLoc, 0, 1),
1295 Stmt *AssociatedStmt,
bool HasCancel);
1331 unsigned NumClauses)
1333 StartLoc, EndLoc, NumClauses, 1) {}
1386 StartLoc, EndLoc, 0, 1) {}
1405 Stmt *AssociatedStmt);
1438 StartLoc, EndLoc, NumClauses, 1),
1512 unsigned CollapsedNum,
unsigned NumClauses)
1514 StartLoc, EndLoc, CollapsedNum, NumClauses),
1529 void setHasCancel(
bool Has) { HasCancel = Has; }
1556 unsigned NumClauses,
1557 unsigned CollapsedNum,
1564 return T->
getStmtClass() == OMPParallelForDirectiveClass;
1588 unsigned CollapsedNum,
unsigned NumClauses)
1590 OMPD_parallel_for_simd, StartLoc, EndLoc, CollapsedNum,
1599 unsigned NumClauses)
1628 unsigned NumClauses,
1629 unsigned CollapsedNum,
1633 return T->
getStmtClass() == OMPParallelForSimdDirectiveClass;
1659 unsigned NumClauses)
1661 OMPD_parallel_sections, StartLoc, EndLoc,
1676 void setHasCancel(
bool Has) { HasCancel = Has; }
1705 return T->
getStmtClass() == OMPParallelSectionsDirectiveClass;
1729 unsigned NumClauses)
1731 EndLoc, NumClauses, 1),
1745 void setHasCancel(
bool Has) { HasCancel = Has; }
1760 Stmt *AssociatedStmt,
bool HasCancel);
1794 StartLoc, EndLoc, 0, 0) {}
1819 return T->
getStmtClass() == OMPTaskyieldDirectiveClass;
1838 StartLoc, EndLoc, 0, 0) {}
1882 StartLoc, EndLoc, 0, 0) {}
1926 unsigned NumClauses)
1928 StartLoc, EndLoc, NumClauses, 2) {}
1939 void setReductionRef(
Expr *RR) {
1956 Expr *ReductionRef);
1976 return T->
getStmtClass() == OMPTaskgroupDirectiveClass;
1999 unsigned NumClauses)
2001 StartLoc, EndLoc, NumClauses, 0) {}
2054 unsigned NumClauses)
2056 StartLoc, EndLoc, NumClauses, 1) {}
2111 bool IsXLHSInRHSPart;
2120 bool IsPostfixUpdate;
2129 unsigned NumClauses)
2131 StartLoc, EndLoc, NumClauses, 5),
2132 IsXLHSInRHSPart(
false), IsPostfixUpdate(
false) {}
2142 IsXLHSInRHSPart(
false), IsPostfixUpdate(
false) {}
2178 Expr *E,
Expr *UE,
bool IsXLHSInRHSPart,
bool IsPostfixUpdate);
2192 return cast_or_null<Expr>(*std::next(
child_begin()));
2198 return cast_or_null<Expr>(*std::next(
child_begin(), 2));
2201 return cast_or_null<Expr>(*std::next(
child_begin(), 2));
2213 return cast_or_null<Expr>(*std::next(
child_begin(), 3));
2218 return cast_or_null<Expr>(*std::next(
child_begin(), 4));
2243 unsigned NumClauses)
2245 StartLoc, EndLoc, NumClauses, 1) {}
2301 unsigned NumClauses)
2303 OMPD_target_data, StartLoc, EndLoc, NumClauses,
2337 return T->
getStmtClass() == OMPTargetDataDirectiveClass;
2359 unsigned NumClauses)
2361 OMPD_target_enter_data, StartLoc, EndLoc,
2396 return T->
getStmtClass() == OMPTargetEnterDataDirectiveClass;
2418 unsigned NumClauses)
2420 OMPD_target_exit_data, StartLoc, EndLoc,
2455 return T->
getStmtClass() == OMPTargetExitDataDirectiveClass;
2476 unsigned NumClauses)
2478 OMPD_target_parallel, StartLoc, EndLoc,
2514 return T->
getStmtClass() == OMPTargetParallelDirectiveClass;
2541 unsigned CollapsedNum,
unsigned NumClauses)
2543 OMPD_target_parallel_for, StartLoc, EndLoc,
2544 CollapsedNum, NumClauses),
2553 unsigned NumClauses)
2560 void setHasCancel(
bool Has) { HasCancel = Has; }
2587 unsigned NumClauses,
2588 unsigned CollapsedNum,
2595 return T->
getStmtClass() == OMPTargetParallelForDirectiveClass;
2616 unsigned NumClauses)
2618 StartLoc, EndLoc, NumClauses, 1) {}
2641 Stmt *AssociatedStmt);
2674 OMPD_cancellation_point, StartLoc, EndLoc, 0, 0),
2711 return T->
getStmtClass() == OMPCancellationPointDirectiveClass;
2732 unsigned NumClauses)
2734 StartLoc, EndLoc, NumClauses, 0),
2797 unsigned CollapsedNum,
unsigned NumClauses)
2799 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
2835 unsigned NumClauses,
2862 unsigned CollapsedNum,
unsigned NumClauses)
2864 OMPD_taskloop_simd, StartLoc, EndLoc, CollapsedNum,
2875 CollapsedNum, NumClauses) {}
2901 unsigned NumClauses,
2902 unsigned CollapsedNum,
2906 return T->
getStmtClass() == OMPTaskLoopSimdDirectiveClass;
2929 unsigned CollapsedNum,
unsigned NumClauses)
2931 StartLoc, EndLoc, CollapsedNum, NumClauses)
2969 unsigned NumClauses,
2973 return T->
getStmtClass() == OMPDistributeDirectiveClass;
2995 unsigned NumClauses)
2997 OMPD_target_update, StartLoc, EndLoc, NumClauses,
3032 return T->
getStmtClass() == OMPTargetUpdateDirectiveClass;
3048 bool HasCancel =
false;
3059 unsigned CollapsedNum,
unsigned NumClauses)
3061 OMPD_distribute_parallel_for, StartLoc, EndLoc,
3062 CollapsedNum, NumClauses), HasCancel(
false) {}
3070 unsigned NumClauses)
3077 void setHasCancel(
bool Has) { HasCancel = Has; }
3104 unsigned NumClauses,
3105 unsigned CollapsedNum,
3112 return T->
getStmtClass() == OMPDistributeParallelForDirectiveClass;
3137 unsigned CollapsedNum,
3138 unsigned NumClauses)
3140 OMPD_distribute_parallel_for_simd, StartLoc,
3141 EndLoc, CollapsedNum, NumClauses) {}
3149 unsigned NumClauses)
3151 OMPD_distribute_parallel_for_simd,
3178 const ASTContext &
C,
unsigned NumClauses,
unsigned CollapsedNum,
3182 return T->
getStmtClass() == OMPDistributeParallelForSimdDirectiveClass;
3205 unsigned CollapsedNum,
unsigned NumClauses)
3207 OMPD_distribute_simd, StartLoc, EndLoc, CollapsedNum,
3216 unsigned NumClauses)
3244 unsigned NumClauses,
3245 unsigned CollapsedNum,
3249 return T->
getStmtClass() == OMPDistributeSimdDirectiveClass;
3273 unsigned CollapsedNum,
unsigned NumClauses)
3275 OMPD_target_parallel_for_simd, StartLoc, EndLoc,
3276 CollapsedNum, NumClauses) {}
3284 unsigned NumClauses)
3312 unsigned NumClauses,
3313 unsigned CollapsedNum,
3317 return T->
getStmtClass() == OMPTargetParallelForSimdDirectiveClass;
3341 unsigned CollapsedNum,
unsigned NumClauses)
3343 OMPD_target_simd, StartLoc, EndLoc, CollapsedNum,
3379 unsigned NumClauses,
3380 unsigned CollapsedNum,
3384 return T->
getStmtClass() == OMPTargetSimdDirectiveClass;
3407 unsigned CollapsedNum,
unsigned NumClauses)
3409 OMPD_teams_distribute, StartLoc, EndLoc,
3410 CollapsedNum, NumClauses) {}
3418 unsigned NumClauses)
3446 unsigned NumClauses,
3447 unsigned CollapsedNum,
3451 return T->
getStmtClass() == OMPTeamsDistributeDirectiveClass;
3476 unsigned NumClauses)
3478 OMPD_teams_distribute_simd, StartLoc, EndLoc,
3479 CollapsedNum, NumClauses) {}
3487 unsigned NumClauses)
3516 unsigned NumClauses,
3517 unsigned CollapsedNum,
3521 return T->
getStmtClass() == OMPTeamsDistributeSimdDirectiveClass;
3547 unsigned CollapsedNum,
3548 unsigned NumClauses)
3550 OMPD_teams_distribute_parallel_for_simd, StartLoc,
3551 EndLoc, CollapsedNum, NumClauses) {}
3559 unsigned NumClauses)
3561 OMPD_teams_distribute_parallel_for_simd,
3592 return T->
getStmtClass() == OMPTeamsDistributeParallelForSimdDirectiveClass;
3608 bool HasCancel =
false;
3619 unsigned CollapsedNum,
3620 unsigned NumClauses)
3622 OMPD_teams_distribute_parallel_for, StartLoc, EndLoc,
3623 CollapsedNum, NumClauses), HasCancel(
false) {}
3631 unsigned NumClauses)
3638 void setHasCancel(
bool Has) { HasCancel = Has; }
3671 return T->
getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass;
3692 unsigned NumClauses)
3694 OMPD_target_teams, StartLoc, EndLoc, NumClauses,
3719 Stmt *AssociatedStmt);
3730 return T->
getStmtClass() == OMPTargetTeamsDirectiveClass;
3754 unsigned CollapsedNum,
unsigned NumClauses)
3756 OMPD_target_teams_distribute, StartLoc, EndLoc,
3757 CollapsedNum, NumClauses) {}
3765 unsigned NumClauses)
3797 return T->
getStmtClass() == OMPTargetTeamsDistributeDirectiveClass;
3814 bool HasCancel =
false;
3825 unsigned CollapsedNum,
3826 unsigned NumClauses)
3828 OMPTargetTeamsDistributeParallelForDirectiveClass,
3829 OMPD_target_teams_distribute_parallel_for, StartLoc,
3830 EndLoc, CollapsedNum, NumClauses),
3839 unsigned NumClauses)
3841 this, OMPTargetTeamsDistributeParallelForDirectiveClass,
3847 void setHasCancel(
bool Has) { HasCancel = Has; }
3881 OMPTargetTeamsDistributeParallelForDirectiveClass;
3907 unsigned CollapsedNum,
3908 unsigned NumClauses)
3910 OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
3911 OMPD_target_teams_distribute_parallel_for_simd,
3912 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
3920 unsigned CollapsedNum,
unsigned NumClauses)
3922 this, OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
3923 OMPD_target_teams_distribute_parallel_for_simd,
SourceLocation(),
3954 OMPTargetTeamsDistributeParallelForSimdDirectiveClass;
3979 unsigned CollapsedNum,
3980 unsigned NumClauses)
3982 OMPD_target_teams_distribute_simd, StartLoc, EndLoc,
3983 CollapsedNum, NumClauses) {}
3991 unsigned NumClauses)
4023 return T->
getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
void setPreInits(Stmt *PreInits)
child_iterator child_begin()
Expr * NLB
Update of LowerBound for statically sheduled '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 sheduled 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.
void setPrevEnsureUpperBound(Expr *PrevEUB)
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 ...
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.
SourceLocation getLocEnd() const
Returns ending location of 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 sheduled 'omp for' loops.
Expr * Cond
Loop condition.
SourceLocation getLocStart() const
Returns starting location of directive kind.
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.
const FunctionProtoType * T
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 sheduled 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
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
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.