14#ifndef LLVM_CLANG_AST_STMTOPENMP_H
15#define LLVM_CLANG_AST_STMTOPENMP_H
24#include "llvm/Support/Casting.h"
143class OMPCanonicalLoop :
public Stmt {
144 friend class ASTStmtReader;
145 friend class ASTStmtWriter;
153 LastSubStmt = LOOPVAR_REF
158 Stmt *SubStmts[LastSubStmt + 1] = {};
160 OMPCanonicalLoop() : Stmt(StmtClass::OMPCanonicalLoopClass) {}
164 static OMPCanonicalLoop *
create(
const ASTContext &Ctx, Stmt *LoopStmt,
165 CapturedStmt *DistanceFunc,
166 CapturedStmt *LoopVarFunc,
167 DeclRefExpr *LoopVarRef) {
168 OMPCanonicalLoop *S =
new (Ctx) OMPCanonicalLoop();
169 S->setLoopStmt(LoopStmt);
170 S->setDistanceFunc(DistanceFunc);
171 S->setLoopVarFunc(LoopVarFunc);
172 S->setLoopVarRef(LoopVarRef);
177 static OMPCanonicalLoop *createEmpty(
const ASTContext &Ctx) {
178 return new (Ctx) OMPCanonicalLoop();
181 static bool classof(
const Stmt *S) {
182 return S->getStmtClass() == StmtClass::OMPCanonicalLoopClass;
185 SourceLocation getBeginLoc()
const {
return getLoopStmt()->getBeginLoc(); }
186 SourceLocation getEndLoc()
const {
return getLoopStmt()->getEndLoc(); }
190 child_range children() {
191 return child_range(&SubStmts[0], &SubStmts[0] + LastSubStmt + 1);
193 const_child_range children()
const {
194 return const_child_range(&SubStmts[0], &SubStmts[0] + LastSubStmt + 1);
200 Stmt *getLoopStmt() {
return SubStmts[LOOP_STMT]; }
201 const Stmt *getLoopStmt()
const {
return SubStmts[LOOP_STMT]; }
202 void setLoopStmt(Stmt *S) {
203 assert((isa<ForStmt>(S) || isa<CXXForRangeStmt>(S)) &&
204 "Canonical loop must be a for loop (range-based or otherwise)");
205 SubStmts[LOOP_STMT] = S;
216 CapturedStmt *getDistanceFunc() {
217 return cast<CapturedStmt>(SubStmts[DISTANCE_FUNC]);
219 const CapturedStmt *getDistanceFunc()
const {
220 return cast<CapturedStmt>(SubStmts[DISTANCE_FUNC]);
222 void setDistanceFunc(CapturedStmt *S) {
223 assert(S &&
"Expected non-null captured statement");
224 SubStmts[DISTANCE_FUNC] = S;
237 CapturedStmt *getLoopVarFunc() {
238 return cast<CapturedStmt>(SubStmts[LOOPVAR_FUNC]);
240 const CapturedStmt *getLoopVarFunc()
const {
241 return cast<CapturedStmt>(SubStmts[LOOPVAR_FUNC]);
243 void setLoopVarFunc(CapturedStmt *S) {
244 assert(S &&
"Expected non-null captured statement");
245 SubStmts[LOOPVAR_FUNC] = S;
251 DeclRefExpr *getLoopVarRef() {
252 return cast<DeclRefExpr>(SubStmts[LOOPVAR_REF]);
254 const DeclRefExpr *getLoopVarRef()
const {
255 return cast<DeclRefExpr>(SubStmts[LOOPVAR_REF]);
257 void setLoopVarRef(DeclRefExpr *E) {
258 assert(E &&
"Expected non-null loop variable");
259 SubStmts[LOOPVAR_REF] = E;
267class OMPExecutableDirective :
public Stmt {
268 friend class ASTStmtReader;
269 friend class ASTStmtWriter;
274 SourceLocation StartLoc;
276 SourceLocation EndLoc;
279 MutableArrayRef<OMPClause *> getClauses() {
282 return Data->getClauses();
287 OMPChildren *
Data =
nullptr;
296 OMPExecutableDirective(StmtClass SC, OpenMPDirectiveKind K,
297 SourceLocation StartLoc, SourceLocation EndLoc)
298 : Stmt(SC),
Kind(K), StartLoc(std::move(StartLoc)),
299 EndLoc(std::move(EndLoc)) {}
301 template <
typename T,
typename... Params>
302 static T *createDirective(
const ASTContext &C, ArrayRef<OMPClause *> Clauses,
303 Stmt *AssociatedStmt,
unsigned NumChildren,
306 C.Allocate(
sizeof(T) + OMPChildren::size(Clauses.size(), AssociatedStmt,
310 auto *
Data = OMPChildren::Create(
reinterpret_cast<T *
>(Mem) + 1, Clauses,
311 AssociatedStmt, NumChildren);
312 auto *Inst =
new (Mem)
T(std::forward<Params>(P)...);
317 template <
typename T,
typename... Params>
318 static T *createEmptyDirective(
const ASTContext &C,
unsigned NumClauses,
319 bool HasAssociatedStmt,
unsigned NumChildren,
322 C.Allocate(
sizeof(T) + OMPChildren::size(NumClauses, HasAssociatedStmt,
326 OMPChildren::CreateEmpty(
reinterpret_cast<T *
>(Mem) + 1, NumClauses,
327 HasAssociatedStmt, NumChildren);
328 auto *Inst =
new (Mem)
T(std::forward<Params>(P)...);
333 template <
typename T>
334 static T *createEmptyDirective(
const ASTContext &C,
unsigned NumClauses,
335 bool HasAssociatedStmt =
false,
336 unsigned NumChildren = 0) {
338 C.Allocate(
sizeof(T) + OMPChildren::size(NumClauses, HasAssociatedStmt,
342 OMPChildren::CreateEmpty(
reinterpret_cast<T *
>(Mem) + 1, NumClauses,
343 HasAssociatedStmt, NumChildren);
344 auto *Inst =
new (Mem) T;
351 class used_clauses_child_iterator
352 :
public llvm::iterator_adaptor_base<
353 used_clauses_child_iterator, ArrayRef<OMPClause *>::iterator,
354 std::forward_iterator_tag, Stmt *, ptrdiff_t, Stmt *, Stmt *> {
355 ArrayRef<OMPClause *>::iterator End;
356 OMPClause::child_iterator ChildI, ChildEnd;
359 if (ChildI != ChildEnd)
361 while (this->I != End) {
363 if (this->I != End) {
364 ChildI = (*this->I)->used_children().begin();
365 ChildEnd = (*this->I)->used_children().end();
366 if (ChildI != ChildEnd)
373 explicit used_clauses_child_iterator(ArrayRef<OMPClause *> Clauses)
374 : used_clauses_child_iterator::iterator_adaptor_base(Clauses.begin()),
376 if (this->I != End) {
377 ChildI = (*this->I)->used_children().begin();
378 ChildEnd = (*this->I)->used_children().end();
382 Stmt *
operator*()
const {
return *ChildI; }
383 Stmt *operator->()
const {
return **
this; }
385 used_clauses_child_iterator &operator++() {
387 if (ChildI != ChildEnd)
389 if (this->I != End) {
391 if (this->I != End) {
392 ChildI = (*this->I)->used_children().begin();
393 ChildEnd = (*this->I)->used_children().end();
401 static llvm::iterator_range<used_clauses_child_iterator>
402 used_clauses_children(ArrayRef<OMPClause *> Clauses) {
403 return {used_clauses_child_iterator(Clauses),
404 used_clauses_child_iterator(ArrayRef(Clauses.end(), (
size_t)0))};
411 template <
typename SpecificClause>
412 class specific_clause_iterator
413 :
public llvm::iterator_adaptor_base<
414 specific_clause_iterator<SpecificClause>,
415 ArrayRef<OMPClause *>::const_iterator, std::forward_iterator_tag,
416 const SpecificClause *, ptrdiff_t, const SpecificClause *,
417 const SpecificClause *> {
418 ArrayRef<OMPClause *>::const_iterator End;
420 void SkipToNextClause() {
421 while (this->I != End && !isa<SpecificClause>(*this->I))
426 explicit specific_clause_iterator(ArrayRef<OMPClause *> Clauses)
427 : specific_clause_iterator::iterator_adaptor_base(Clauses.begin()),
432 const SpecificClause *
operator*()
const {
433 return cast<SpecificClause>(*this->I);
435 const SpecificClause *operator->()
const {
return **
this; }
437 specific_clause_iterator &operator++() {
444 template <
typename SpecificClause>
445 static llvm::iterator_range<specific_clause_iterator<SpecificClause>>
446 getClausesOfKind(ArrayRef<OMPClause *> Clauses) {
447 return {specific_clause_iterator<SpecificClause>(Clauses),
448 specific_clause_iterator<SpecificClause>(
449 ArrayRef(Clauses.end(), (
size_t)0))};
452 template <
typename SpecificClause>
453 llvm::iterator_range<specific_clause_iterator<SpecificClause>>
454 getClausesOfKind()
const {
455 return getClausesOfKind<SpecificClause>(clauses());
463 template <
typename SpecificClause>
464 static const SpecificClause *getSingleClause(ArrayRef<OMPClause *> Clauses) {
465 auto ClausesOfKind = getClausesOfKind<SpecificClause>(Clauses);
467 if (ClausesOfKind.begin() != ClausesOfKind.end()) {
468 assert(std::next(ClausesOfKind.begin()) == ClausesOfKind.end() &&
469 "There are at least 2 clauses of the specified kind");
470 return *ClausesOfKind.begin();
475 template <
typename SpecificClause>
476 const SpecificClause *getSingleClause()
const {
477 return getSingleClause<SpecificClause>(clauses());
482 template <
typename SpecificClause>
483 bool hasClausesOfKind()
const {
484 auto Clauses = getClausesOfKind<SpecificClause>();
485 return Clauses.begin() != Clauses.end();
489 SourceLocation getBeginLoc()
const {
return StartLoc; }
491 SourceLocation getEndLoc()
const {
return EndLoc; }
497 void setLocStart(SourceLocation Loc) { StartLoc = Loc; }
502 void setLocEnd(SourceLocation Loc) { EndLoc = Loc; }
505 unsigned getNumClauses()
const {
508 return Data->getNumClauses();
515 OMPClause *getClause(
unsigned I)
const {
return clauses()[I]; }
518 bool hasAssociatedStmt()
const {
return Data &&
Data->hasAssociatedStmt(); }
521 const Stmt *getAssociatedStmt()
const {
522 return const_cast<OMPExecutableDirective *
>(
this)->getAssociatedStmt();
524 Stmt *getAssociatedStmt() {
525 assert(hasAssociatedStmt() &&
526 "Expected directive with the associated statement.");
527 return Data->getAssociatedStmt();
534 const CapturedStmt *getCapturedStmt(OpenMPDirectiveKind RegionKind)
const {
535 assert(hasAssociatedStmt() &&
536 "Expected directive with the associated statement.");
537 SmallVector<OpenMPDirectiveKind, 4> CaptureRegions;
539 return Data->getCapturedStmt(RegionKind, CaptureRegions);
543 CapturedStmt *getInnermostCapturedStmt() {
544 assert(hasAssociatedStmt() &&
545 "Expected directive with the associated statement.");
546 SmallVector<OpenMPDirectiveKind, 4> CaptureRegions;
548 return Data->getInnermostCapturedStmt(CaptureRegions);
551 const CapturedStmt *getInnermostCapturedStmt()
const {
552 return const_cast<OMPExecutableDirective *
>(
this)
553 ->getInnermostCapturedStmt();
558 static bool classof(
const Stmt *S) {
559 return S->getStmtClass() >= firstOMPExecutableDirectiveConstant &&
560 S->getStmtClass() <= lastOMPExecutableDirectiveConstant;
563 child_range children() {
565 return child_range(child_iterator(), child_iterator());
566 return Data->getAssociatedStmtAsRange();
569 const_child_range children()
const {
570 return const_cast<OMPExecutableDirective *
>(
this)->children();
573 ArrayRef<OMPClause *> clauses()
const {
576 return Data->getClauses();
583 bool isStandaloneDirective()
const;
593 const Stmt *getRawStmt()
const {
594 return const_cast<OMPExecutableDirective *
>(
this)->getRawStmt();
597 assert(hasAssociatedStmt() &&
598 "Expected directive with the associated statement.");
599 return Data->getRawStmt();
612class OMPParallelDirective :
public OMPExecutableDirective {
613 friend class ASTStmtReader;
614 friend class OMPExecutableDirective;
616 bool HasCancel =
false;
623 OMPParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc)
624 : OMPExecutableDirective(OMPParallelDirectiveClass,
625 llvm::omp::OMPD_parallel, StartLoc, EndLoc) {}
629 explicit OMPParallelDirective()
630 : OMPExecutableDirective(OMPParallelDirectiveClass,
631 llvm::omp::OMPD_parallel, SourceLocation(),
635 void setTaskReductionRefExpr(Expr *E) {
Data->getChildren()[0] = E; }
638 void setHasCancel(
bool Has) { HasCancel = Has; }
652 static OMPParallelDirective *
653 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
654 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
662 static OMPParallelDirective *
CreateEmpty(
const ASTContext &C,
663 unsigned NumClauses, EmptyShell);
666 Expr *getTaskReductionRefExpr() {
667 return cast_or_null<Expr>(
Data->getChildren()[0]);
669 const Expr *getTaskReductionRefExpr()
const {
670 return const_cast<OMPParallelDirective *
>(
this)->getTaskReductionRefExpr();
674 bool hasCancel()
const {
return HasCancel; }
676 static bool classof(
const Stmt *T) {
677 return T->getStmtClass() == OMPParallelDirectiveClass;
683class OMPLoopTransformationDirective;
687class OMPLoopBasedDirective :
public OMPExecutableDirective {
688 friend class ASTStmtReader;
692 unsigned NumAssociatedLoops = 0;
702 OMPLoopBasedDirective(StmtClass SC, OpenMPDirectiveKind Kind,
703 SourceLocation StartLoc, SourceLocation EndLoc,
704 unsigned NumAssociatedLoops)
705 : OMPExecutableDirective(SC,
Kind, StartLoc, EndLoc),
706 NumAssociatedLoops(NumAssociatedLoops) {}
711 struct DistCombinedHelperExprs {
740 Expr *ParForInDistCond;
747 Expr *IterationVarRef;
753 Expr *CalcLastIteration;
793 SmallVector<Expr *, 4> Counters;
795 SmallVector<Expr *, 4> PrivateCounters;
797 SmallVector<Expr *, 4> Inits;
799 SmallVector<Expr *, 4> Updates;
801 SmallVector<Expr *, 4> Finals;
804 SmallVector<Expr *, 4> DependentCounters;
807 SmallVector<Expr *, 4> DependentInits;
810 SmallVector<Expr *, 4> FinalsConditions;
815 DistCombinedHelperExprs DistCombinedFields;
820 return IterationVarRef !=
nullptr && LastIteration !=
nullptr &&
821 NumIterations !=
nullptr && PreCond !=
nullptr &&
822 Cond !=
nullptr &&
Init !=
nullptr &&
Inc !=
nullptr;
829 void clear(
unsigned Size) {
830 IterationVarRef =
nullptr;
831 LastIteration =
nullptr;
832 CalcLastIteration =
nullptr;
844 NumIterations =
nullptr;
849 Counters.resize(Size);
850 PrivateCounters.resize(Size);
852 Updates.resize(Size);
854 DependentCounters.resize(Size);
855 DependentInits.resize(Size);
856 FinalsConditions.resize(Size);
857 for (
unsigned I = 0; I <
Size; ++I) {
858 Counters[I] =
nullptr;
859 PrivateCounters[I] =
nullptr;
861 Updates[I] =
nullptr;
863 DependentCounters[I] =
nullptr;
864 DependentInits[I] =
nullptr;
865 FinalsConditions[I] =
nullptr;
868 DistCombinedFields.LB =
nullptr;
869 DistCombinedFields.UB =
nullptr;
870 DistCombinedFields.EUB =
nullptr;
871 DistCombinedFields.Init =
nullptr;
872 DistCombinedFields.Cond =
nullptr;
873 DistCombinedFields.NLB =
nullptr;
874 DistCombinedFields.NUB =
nullptr;
875 DistCombinedFields.DistCond =
nullptr;
876 DistCombinedFields.ParForInDistCond =
nullptr;
881 unsigned getLoopsNumber()
const {
return NumAssociatedLoops; }
887 static Stmt *tryToFindNextInnerLoop(Stmt *CurStmt,
888 bool TryImperfectlyNestedLoops);
889 static const Stmt *tryToFindNextInnerLoop(
const Stmt *CurStmt,
890 bool TryImperfectlyNestedLoops) {
891 return tryToFindNextInnerLoop(
const_cast<Stmt *
>(CurStmt),
892 TryImperfectlyNestedLoops);
898 doForAllLoops(Stmt *CurStmt,
bool TryImperfectlyNestedLoops,
900 llvm::function_ref<
bool(
unsigned, Stmt *)> Callback,
901 llvm::function_ref<
void(OMPLoopTransformationDirective *)>
902 OnTransformationCallback);
904 doForAllLoops(
const Stmt *CurStmt,
bool TryImperfectlyNestedLoops,
906 llvm::function_ref<
bool(
unsigned,
const Stmt *)> Callback,
907 llvm::function_ref<
void(
const OMPLoopTransformationDirective *)>
908 OnTransformationCallback) {
909 auto &&NewCallback = [Callback](
unsigned Cnt, Stmt *CurStmt) {
910 return Callback(Cnt, CurStmt);
912 auto &&NewTransformCb =
913 [OnTransformationCallback](OMPLoopTransformationDirective *A) {
914 OnTransformationCallback(A);
916 return doForAllLoops(
const_cast<Stmt *
>(CurStmt), TryImperfectlyNestedLoops,
917 NumLoops, NewCallback, NewTransformCb);
923 doForAllLoops(Stmt *CurStmt,
bool TryImperfectlyNestedLoops,
925 llvm::function_ref<
bool(
unsigned, Stmt *)> Callback) {
926 auto &&TransformCb = [](OMPLoopTransformationDirective *) {};
927 return doForAllLoops(CurStmt, TryImperfectlyNestedLoops, NumLoops, Callback,
931 doForAllLoops(
const Stmt *CurStmt,
bool TryImperfectlyNestedLoops,
933 llvm::function_ref<
bool(
unsigned,
const Stmt *)> Callback) {
934 auto &&NewCallback = [Callback](
unsigned Cnt,
const Stmt *CurStmt) {
935 return Callback(Cnt, CurStmt);
937 return doForAllLoops(
const_cast<Stmt *
>(CurStmt), TryImperfectlyNestedLoops,
938 NumLoops, NewCallback);
943 static void doForAllLoopsBodies(
944 Stmt *CurStmt,
bool TryImperfectlyNestedLoops,
unsigned NumLoops,
945 llvm::function_ref<
void(
unsigned, Stmt *, Stmt *)> Callback);
946 static void doForAllLoopsBodies(
947 const Stmt *CurStmt,
bool TryImperfectlyNestedLoops,
unsigned NumLoops,
948 llvm::function_ref<
void(
unsigned,
const Stmt *,
const Stmt *)> Callback) {
949 auto &&NewCallback = [Callback](
unsigned Cnt, Stmt *
Loop, Stmt *Body) {
950 Callback(Cnt, Loop, Body);
952 doForAllLoopsBodies(
const_cast<Stmt *
>(CurStmt), TryImperfectlyNestedLoops,
953 NumLoops, NewCallback);
956 static bool classof(
const Stmt *T) {
957 if (
auto *D = dyn_cast<OMPExecutableDirective>(T))
966class OMPLoopTransformationDirective {
967 friend class ASTStmtReader;
976 unsigned NumGeneratedTopLevelLoops = 1;
983 void setNumGeneratedTopLevelLoops(
unsigned N) {
984 NumGeneratedTopLevelLoops = N;
987 explicit OMPLoopTransformationDirective(Stmt *S) : S(S) {}
990 unsigned getNumGeneratedTopLevelLoops()
const {
991 return NumGeneratedTopLevelLoops;
995 Stmt *getDirective()
const {
return S; }
1002 Stmt *getTransformedStmt()
const;
1005 Stmt *getPreInits()
const;
1007 static bool classof(
const Stmt *T) {
1008 return isa<OMPCanonicalLoopNestTransformationDirective,
1009 OMPCanonicalLoopSequenceTransformationDirective>(
T);
1014class OMPCanonicalLoopNestTransformationDirective
1015 :
public OMPLoopBasedDirective,
1016 public OMPLoopTransformationDirective {
1017 friend class ASTStmtReader;
1020 explicit OMPCanonicalLoopNestTransformationDirective(
1021 StmtClass SC, OpenMPDirectiveKind Kind, SourceLocation StartLoc,
1022 SourceLocation EndLoc,
unsigned NumAssociatedLoops)
1023 : OMPLoopBasedDirective(SC,
Kind, StartLoc, EndLoc, NumAssociatedLoops),
1024 OMPLoopTransformationDirective(this) {}
1028 unsigned getNumAssociatedLoops()
const {
return getLoopsNumber(); }
1035 Stmt *getTransformedStmt()
const;
1038 Stmt *getPreInits()
const;
1040 static bool classof(
const Stmt *T) {
1041 Stmt::StmtClass
C =
T->getStmtClass();
1042 return C == OMPTileDirectiveClass ||
C == OMPUnrollDirectiveClass ||
1043 C == OMPReverseDirectiveClass ||
C == OMPInterchangeDirectiveClass ||
1044 C == OMPStripeDirectiveClass;
1051class OMPLoopDirective :
public OMPLoopBasedDirective {
1052 friend class ASTStmtReader;
1071 IterationVariableOffset = 0,
1072 LastIterationOffset = 1,
1073 CalcLastIterationOffset = 2,
1074 PreConditionOffset = 3,
1085 IsLastIterVariableOffset = 8,
1086 LowerBoundVariableOffset = 9,
1087 UpperBoundVariableOffset = 10,
1088 StrideVariableOffset = 11,
1089 EnsureUpperBoundOffset = 12,
1090 NextLowerBoundOffset = 13,
1091 NextUpperBoundOffset = 14,
1092 NumIterationsOffset = 15,
1094 WorksharingEnd = 16,
1095 PrevLowerBoundVariableOffset = 16,
1096 PrevUpperBoundVariableOffset = 17,
1098 PrevEnsureUpperBoundOffset = 19,
1099 CombinedLowerBoundVariableOffset = 20,
1100 CombinedUpperBoundVariableOffset = 21,
1101 CombinedEnsureUpperBoundOffset = 22,
1102 CombinedInitOffset = 23,
1103 CombinedConditionOffset = 24,
1104 CombinedNextLowerBoundOffset = 25,
1105 CombinedNextUpperBoundOffset = 26,
1106 CombinedDistConditionOffset = 27,
1107 CombinedParForInDistConditionOffset = 28,
1111 CombinedDistributeEnd = 29,
1115 MutableArrayRef<Expr *> getCounters() {
1116 auto **
Storage =
reinterpret_cast<Expr **
>(
1117 &
Data->getChildren()[getArraysOffset(getDirectiveKind())]);
1118 return {
Storage, getLoopsNumber()};
1122 MutableArrayRef<Expr *> getPrivateCounters() {
1123 auto **
Storage =
reinterpret_cast<Expr **
>(
1124 &
Data->getChildren()[getArraysOffset(getDirectiveKind()) +
1126 return {
Storage, getLoopsNumber()};
1130 MutableArrayRef<Expr *> getInits() {
1131 auto **
Storage =
reinterpret_cast<Expr **
>(
1132 &
Data->getChildren()[getArraysOffset(getDirectiveKind()) +
1133 2 * getLoopsNumber()]);
1134 return {
Storage, getLoopsNumber()};
1138 MutableArrayRef<Expr *> getUpdates() {
1139 auto **
Storage =
reinterpret_cast<Expr **
>(
1140 &
Data->getChildren()[getArraysOffset(getDirectiveKind()) +
1141 3 * getLoopsNumber()]);
1142 return {
Storage, getLoopsNumber()};
1146 MutableArrayRef<Expr *> getFinals() {
1147 auto **
Storage =
reinterpret_cast<Expr **
>(
1148 &
Data->getChildren()[getArraysOffset(getDirectiveKind()) +
1149 4 * getLoopsNumber()]);
1150 return {
Storage, getLoopsNumber()};
1154 MutableArrayRef<Expr *> getDependentCounters() {
1155 auto **
Storage =
reinterpret_cast<Expr **
>(
1156 &
Data->getChildren()[getArraysOffset(getDirectiveKind()) +
1157 5 * getLoopsNumber()]);
1158 return {
Storage, getLoopsNumber()};
1162 MutableArrayRef<Expr *> getDependentInits() {
1163 auto **
Storage =
reinterpret_cast<Expr **
>(
1164 &
Data->getChildren()[getArraysOffset(getDirectiveKind()) +
1165 6 * getLoopsNumber()]);
1166 return {
Storage, getLoopsNumber()};
1170 MutableArrayRef<Expr *> getFinalsConditions() {
1171 auto **
Storage =
reinterpret_cast<Expr **
>(
1172 &
Data->getChildren()[getArraysOffset(getDirectiveKind()) +
1173 7 * getLoopsNumber()]);
1174 return {
Storage, getLoopsNumber()};
1186 OMPLoopDirective(StmtClass SC, OpenMPDirectiveKind Kind,
1187 SourceLocation StartLoc, SourceLocation EndLoc,
1188 unsigned CollapsedNum)
1189 : OMPLoopBasedDirective(SC,
Kind, StartLoc, EndLoc, CollapsedNum) {}
1192 static unsigned getArraysOffset(OpenMPDirectiveKind Kind) {
1194 return CombinedDistributeEnd;
1197 return WorksharingEnd;
1202 static unsigned numLoopChildren(
unsigned CollapsedNum,
1203 OpenMPDirectiveKind Kind) {
1204 return getArraysOffset(Kind) +
1210 void setIterationVariable(Expr *IV) {
1211 Data->getChildren()[IterationVariableOffset] = IV;
1213 void setLastIteration(Expr *LI) {
1214 Data->getChildren()[LastIterationOffset] = LI;
1216 void setCalcLastIteration(Expr *CLI) {
1217 Data->getChildren()[CalcLastIterationOffset] = CLI;
1219 void setPreCond(Expr *PC) {
Data->getChildren()[PreConditionOffset] = PC; }
1220 void setCond(Expr *Cond) {
Data->getChildren()[CondOffset] =
Cond; }
1221 void setInit(Expr *Init) {
Data->getChildren()[InitOffset] =
Init; }
1222 void setInc(Expr *Inc) {
Data->getChildren()[IncOffset] =
Inc; }
1223 void setPreInits(Stmt *PreInits) {
1224 Data->getChildren()[PreInitsOffset] = PreInits;
1226 void setIsLastIterVariable(Expr *IL) {
1231 "expected worksharing loop directive");
1232 Data->getChildren()[IsLastIterVariableOffset] = IL;
1234 void setLowerBoundVariable(Expr *LB) {
1239 "expected worksharing loop directive");
1240 Data->getChildren()[LowerBoundVariableOffset] = LB;
1242 void setUpperBoundVariable(Expr *UB) {
1247 "expected worksharing loop directive");
1248 Data->getChildren()[UpperBoundVariableOffset] = UB;
1250 void setStrideVariable(Expr *ST) {
1255 "expected worksharing loop directive");
1256 Data->getChildren()[StrideVariableOffset] = ST;
1258 void setEnsureUpperBound(Expr *EUB) {
1263 "expected worksharing loop directive");
1264 Data->getChildren()[EnsureUpperBoundOffset] = EUB;
1266 void setNextLowerBound(Expr *NLB) {
1271 "expected worksharing loop directive");
1272 Data->getChildren()[NextLowerBoundOffset] = NLB;
1274 void setNextUpperBound(Expr *NUB) {
1279 "expected worksharing loop directive");
1280 Data->getChildren()[NextUpperBoundOffset] = NUB;
1282 void setNumIterations(Expr *NI) {
1287 "expected worksharing loop directive");
1288 Data->getChildren()[NumIterationsOffset] = NI;
1290 void setPrevLowerBoundVariable(Expr *PrevLB) {
1292 "expected loop bound sharing directive");
1293 Data->getChildren()[PrevLowerBoundVariableOffset] = PrevLB;
1295 void setPrevUpperBoundVariable(Expr *PrevUB) {
1297 "expected loop bound sharing directive");
1298 Data->getChildren()[PrevUpperBoundVariableOffset] = PrevUB;
1300 void setDistInc(Expr *DistInc) {
1302 "expected loop bound sharing directive");
1303 Data->getChildren()[DistIncOffset] = DistInc;
1305 void setPrevEnsureUpperBound(Expr *PrevEUB) {
1307 "expected loop bound sharing directive");
1308 Data->getChildren()[PrevEnsureUpperBoundOffset] = PrevEUB;
1310 void setCombinedLowerBoundVariable(Expr *CombLB) {
1312 "expected loop bound sharing directive");
1313 Data->getChildren()[CombinedLowerBoundVariableOffset] = CombLB;
1315 void setCombinedUpperBoundVariable(Expr *CombUB) {
1317 "expected loop bound sharing directive");
1318 Data->getChildren()[CombinedUpperBoundVariableOffset] = CombUB;
1320 void setCombinedEnsureUpperBound(Expr *CombEUB) {
1322 "expected loop bound sharing directive");
1323 Data->getChildren()[CombinedEnsureUpperBoundOffset] = CombEUB;
1325 void setCombinedInit(Expr *CombInit) {
1327 "expected loop bound sharing directive");
1328 Data->getChildren()[CombinedInitOffset] = CombInit;
1330 void setCombinedCond(Expr *CombCond) {
1332 "expected loop bound sharing directive");
1333 Data->getChildren()[CombinedConditionOffset] = CombCond;
1335 void setCombinedNextLowerBound(Expr *CombNLB) {
1337 "expected loop bound sharing directive");
1338 Data->getChildren()[CombinedNextLowerBoundOffset] = CombNLB;
1340 void setCombinedNextUpperBound(Expr *CombNUB) {
1342 "expected loop bound sharing directive");
1343 Data->getChildren()[CombinedNextUpperBoundOffset] = CombNUB;
1345 void setCombinedDistCond(Expr *CombDistCond) {
1347 "expected loop bound distribute sharing directive");
1348 Data->getChildren()[CombinedDistConditionOffset] = CombDistCond;
1350 void setCombinedParForInDistCond(Expr *CombParForInDistCond) {
1352 "expected loop bound distribute sharing directive");
1353 Data->getChildren()[CombinedParForInDistConditionOffset] =
1354 CombParForInDistCond;
1356 void setCounters(ArrayRef<Expr *> A);
1357 void setPrivateCounters(ArrayRef<Expr *> A);
1358 void setInits(ArrayRef<Expr *> A);
1359 void setUpdates(ArrayRef<Expr *> A);
1360 void setFinals(ArrayRef<Expr *> A);
1361 void setDependentCounters(ArrayRef<Expr *> A);
1362 void setDependentInits(ArrayRef<Expr *> A);
1363 void setFinalsConditions(ArrayRef<Expr *> A);
1366 Expr *getIterationVariable()
const {
1367 return cast<Expr>(
Data->getChildren()[IterationVariableOffset]);
1369 Expr *getLastIteration()
const {
1370 return cast<Expr>(
Data->getChildren()[LastIterationOffset]);
1372 Expr *getCalcLastIteration()
const {
1373 return cast<Expr>(
Data->getChildren()[CalcLastIterationOffset]);
1375 Expr *getPreCond()
const {
1376 return cast<Expr>(
Data->getChildren()[PreConditionOffset]);
1378 Expr *getCond()
const {
return cast<Expr>(
Data->getChildren()[CondOffset]); }
1379 Expr *getInit()
const {
return cast<Expr>(
Data->getChildren()[InitOffset]); }
1380 Expr *getInc()
const {
return cast<Expr>(
Data->getChildren()[IncOffset]); }
1381 const Stmt *getPreInits()
const {
1382 return Data->getChildren()[PreInitsOffset];
1384 Stmt *getPreInits() {
return Data->getChildren()[PreInitsOffset]; }
1385 Expr *getIsLastIterVariable()
const {
1390 "expected worksharing loop directive");
1391 return cast<Expr>(
Data->getChildren()[IsLastIterVariableOffset]);
1393 Expr *getLowerBoundVariable()
const {
1398 "expected worksharing loop directive");
1399 return cast<Expr>(
Data->getChildren()[LowerBoundVariableOffset]);
1401 Expr *getUpperBoundVariable()
const {
1406 "expected worksharing loop directive");
1407 return cast<Expr>(
Data->getChildren()[UpperBoundVariableOffset]);
1409 Expr *getStrideVariable()
const {
1414 "expected worksharing loop directive");
1415 return cast<Expr>(
Data->getChildren()[StrideVariableOffset]);
1417 Expr *getEnsureUpperBound()
const {
1422 "expected worksharing loop directive");
1423 return cast<Expr>(
Data->getChildren()[EnsureUpperBoundOffset]);
1425 Expr *getNextLowerBound()
const {
1430 "expected worksharing loop directive");
1431 return cast<Expr>(
Data->getChildren()[NextLowerBoundOffset]);
1433 Expr *getNextUpperBound()
const {
1438 "expected worksharing loop directive");
1439 return cast<Expr>(
Data->getChildren()[NextUpperBoundOffset]);
1441 Expr *getNumIterations()
const {
1446 "expected worksharing loop directive");
1447 return cast<Expr>(
Data->getChildren()[NumIterationsOffset]);
1449 Expr *getPrevLowerBoundVariable()
const {
1451 "expected loop bound sharing directive");
1452 return cast<Expr>(
Data->getChildren()[PrevLowerBoundVariableOffset]);
1454 Expr *getPrevUpperBoundVariable()
const {
1456 "expected loop bound sharing directive");
1457 return cast<Expr>(
Data->getChildren()[PrevUpperBoundVariableOffset]);
1459 Expr *getDistInc()
const {
1461 "expected loop bound sharing directive");
1462 return cast<Expr>(
Data->getChildren()[DistIncOffset]);
1464 Expr *getPrevEnsureUpperBound()
const {
1466 "expected loop bound sharing directive");
1467 return cast<Expr>(
Data->getChildren()[PrevEnsureUpperBoundOffset]);
1469 Expr *getCombinedLowerBoundVariable()
const {
1471 "expected loop bound sharing directive");
1472 return cast<Expr>(
Data->getChildren()[CombinedLowerBoundVariableOffset]);
1474 Expr *getCombinedUpperBoundVariable()
const {
1476 "expected loop bound sharing directive");
1477 return cast<Expr>(
Data->getChildren()[CombinedUpperBoundVariableOffset]);
1479 Expr *getCombinedEnsureUpperBound()
const {
1481 "expected loop bound sharing directive");
1482 return cast<Expr>(
Data->getChildren()[CombinedEnsureUpperBoundOffset]);
1484 Expr *getCombinedInit()
const {
1486 "expected loop bound sharing directive");
1487 return cast<Expr>(
Data->getChildren()[CombinedInitOffset]);
1489 Expr *getCombinedCond()
const {
1491 "expected loop bound sharing directive");
1492 return cast<Expr>(
Data->getChildren()[CombinedConditionOffset]);
1494 Expr *getCombinedNextLowerBound()
const {
1496 "expected loop bound sharing directive");
1497 return cast<Expr>(
Data->getChildren()[CombinedNextLowerBoundOffset]);
1499 Expr *getCombinedNextUpperBound()
const {
1501 "expected loop bound sharing directive");
1502 return cast<Expr>(
Data->getChildren()[CombinedNextUpperBoundOffset]);
1504 Expr *getCombinedDistCond()
const {
1506 "expected loop bound distribute sharing directive");
1507 return cast<Expr>(
Data->getChildren()[CombinedDistConditionOffset]);
1509 Expr *getCombinedParForInDistCond()
const {
1511 "expected loop bound distribute sharing directive");
1512 return cast<Expr>(
Data->getChildren()[CombinedParForInDistConditionOffset]);
1515 const Stmt *getBody()
const {
1516 return const_cast<OMPLoopDirective *
>(
this)->getBody();
1519 ArrayRef<Expr *> counters() {
return getCounters(); }
1521 ArrayRef<Expr *> counters()
const {
1522 return const_cast<OMPLoopDirective *
>(
this)->getCounters();
1525 ArrayRef<Expr *> private_counters() {
return getPrivateCounters(); }
1527 ArrayRef<Expr *> private_counters()
const {
1528 return const_cast<OMPLoopDirective *
>(
this)->getPrivateCounters();
1531 ArrayRef<Expr *> inits() {
return getInits(); }
1533 ArrayRef<Expr *> inits()
const {
1534 return const_cast<OMPLoopDirective *
>(
this)->getInits();
1537 ArrayRef<Expr *> updates() {
return getUpdates(); }
1539 ArrayRef<Expr *> updates()
const {
1540 return const_cast<OMPLoopDirective *
>(
this)->getUpdates();
1543 ArrayRef<Expr *> finals() {
return getFinals(); }
1545 ArrayRef<Expr *> finals()
const {
1546 return const_cast<OMPLoopDirective *
>(
this)->getFinals();
1549 ArrayRef<Expr *> dependent_counters() {
return getDependentCounters(); }
1551 ArrayRef<Expr *> dependent_counters()
const {
1552 return const_cast<OMPLoopDirective *
>(
this)->getDependentCounters();
1555 ArrayRef<Expr *> dependent_inits() {
return getDependentInits(); }
1557 ArrayRef<Expr *> dependent_inits()
const {
1558 return const_cast<OMPLoopDirective *
>(
this)->getDependentInits();
1561 ArrayRef<Expr *> finals_conditions() {
return getFinalsConditions(); }
1563 ArrayRef<Expr *> finals_conditions()
const {
1564 return const_cast<OMPLoopDirective *
>(
this)->getFinalsConditions();
1567 static bool classof(
const Stmt *T) {
1568 return T->getStmtClass() == OMPSimdDirectiveClass ||
1569 T->getStmtClass() == OMPForDirectiveClass ||
1570 T->getStmtClass() == OMPForSimdDirectiveClass ||
1571 T->getStmtClass() == OMPParallelForDirectiveClass ||
1572 T->getStmtClass() == OMPParallelForSimdDirectiveClass ||
1573 T->getStmtClass() == OMPTaskLoopDirectiveClass ||
1574 T->getStmtClass() == OMPTaskLoopSimdDirectiveClass ||
1575 T->getStmtClass() == OMPMaskedTaskLoopDirectiveClass ||
1576 T->getStmtClass() == OMPMaskedTaskLoopSimdDirectiveClass ||
1577 T->getStmtClass() == OMPMasterTaskLoopDirectiveClass ||
1578 T->getStmtClass() == OMPMasterTaskLoopSimdDirectiveClass ||
1579 T->getStmtClass() == OMPGenericLoopDirectiveClass ||
1580 T->getStmtClass() == OMPTeamsGenericLoopDirectiveClass ||
1581 T->getStmtClass() == OMPTargetTeamsGenericLoopDirectiveClass ||
1582 T->getStmtClass() == OMPParallelGenericLoopDirectiveClass ||
1583 T->getStmtClass() == OMPTargetParallelGenericLoopDirectiveClass ||
1584 T->getStmtClass() == OMPParallelMaskedTaskLoopDirectiveClass ||
1585 T->getStmtClass() == OMPParallelMaskedTaskLoopSimdDirectiveClass ||
1586 T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass ||
1587 T->getStmtClass() == OMPParallelMasterTaskLoopSimdDirectiveClass ||
1588 T->getStmtClass() == OMPDistributeDirectiveClass ||
1589 T->getStmtClass() == OMPTargetParallelForDirectiveClass ||
1590 T->getStmtClass() == OMPDistributeParallelForDirectiveClass ||
1591 T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass ||
1592 T->getStmtClass() == OMPDistributeSimdDirectiveClass ||
1593 T->getStmtClass() == OMPTargetParallelForSimdDirectiveClass ||
1594 T->getStmtClass() == OMPTargetSimdDirectiveClass ||
1595 T->getStmtClass() == OMPTeamsDistributeDirectiveClass ||
1596 T->getStmtClass() == OMPTeamsDistributeSimdDirectiveClass ||
1597 T->getStmtClass() ==
1598 OMPTeamsDistributeParallelForSimdDirectiveClass ||
1599 T->getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass ||
1600 T->getStmtClass() ==
1601 OMPTargetTeamsDistributeParallelForDirectiveClass ||
1602 T->getStmtClass() ==
1603 OMPTargetTeamsDistributeParallelForSimdDirectiveClass ||
1604 T->getStmtClass() == OMPTargetTeamsDistributeDirectiveClass ||
1605 T->getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
1618class OMPSimdDirective :
public OMPLoopDirective {
1619 friend class ASTStmtReader;
1620 friend class OMPExecutableDirective;
1627 OMPSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1628 unsigned CollapsedNum)
1629 : OMPLoopDirective(OMPSimdDirectiveClass, llvm::omp::OMPD_simd, StartLoc,
1630 EndLoc, CollapsedNum) {}
1636 explicit OMPSimdDirective(
unsigned CollapsedNum)
1637 : OMPLoopDirective(OMPSimdDirectiveClass, llvm::omp::OMPD_simd,
1638 SourceLocation(), SourceLocation(), CollapsedNum) {}
1651 static OMPSimdDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
1652 SourceLocation EndLoc,
unsigned CollapsedNum,
1653 ArrayRef<OMPClause *> Clauses,
1654 Stmt *AssociatedStmt,
1655 const HelperExprs &Exprs);
1664 static OMPSimdDirective *
CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
1665 unsigned CollapsedNum, EmptyShell);
1667 static bool classof(
const Stmt *T) {
1668 return T->getStmtClass() == OMPSimdDirectiveClass;
1681class OMPForDirective :
public OMPLoopDirective {
1682 friend class ASTStmtReader;
1683 friend class OMPExecutableDirective;
1685 bool HasCancel =
false;
1693 OMPForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1694 unsigned CollapsedNum)
1695 : OMPLoopDirective(OMPForDirectiveClass, llvm::omp::OMPD_for, StartLoc,
1696 EndLoc, CollapsedNum) {}
1702 explicit OMPForDirective(
unsigned CollapsedNum)
1703 : OMPLoopDirective(OMPForDirectiveClass, llvm::omp::OMPD_for,
1704 SourceLocation(), SourceLocation(), CollapsedNum) {}
1707 void setTaskReductionRefExpr(Expr *E) {
1708 Data->getChildren()[numLoopChildren(getLoopsNumber(),
1709 llvm::omp::OMPD_for)] = E;
1713 void setHasCancel(
bool Has) { HasCancel = Has; }
1729 static OMPForDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
1730 SourceLocation EndLoc,
unsigned CollapsedNum,
1731 ArrayRef<OMPClause *> Clauses,
1732 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
1733 Expr *TaskRedRef,
bool HasCancel);
1742 static OMPForDirective *
CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
1743 unsigned CollapsedNum, EmptyShell);
1746 Expr *getTaskReductionRefExpr() {
1747 return cast_or_null<Expr>(
Data->getChildren()[numLoopChildren(
1748 getLoopsNumber(), llvm::omp::OMPD_for)]);
1750 const Expr *getTaskReductionRefExpr()
const {
1751 return const_cast<OMPForDirective *
>(
this)->getTaskReductionRefExpr();
1755 bool hasCancel()
const {
return HasCancel; }
1757 static bool classof(
const Stmt *T) {
1758 return T->getStmtClass() == OMPForDirectiveClass;
1771class OMPForSimdDirective :
public OMPLoopDirective {
1772 friend class ASTStmtReader;
1773 friend class OMPExecutableDirective;
1780 OMPForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1781 unsigned CollapsedNum)
1782 : OMPLoopDirective(OMPForSimdDirectiveClass, llvm::omp::OMPD_for_simd,
1783 StartLoc, EndLoc, CollapsedNum) {}
1789 explicit OMPForSimdDirective(
unsigned CollapsedNum)
1790 : OMPLoopDirective(OMPForSimdDirectiveClass, llvm::omp::OMPD_for_simd,
1791 SourceLocation(), SourceLocation(), CollapsedNum) {}
1804 static OMPForSimdDirective *
1805 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1806 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
1807 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
1816 static OMPForSimdDirective *
CreateEmpty(
const ASTContext &C,
1817 unsigned NumClauses,
1818 unsigned CollapsedNum, EmptyShell);
1820 static bool classof(
const Stmt *T) {
1821 return T->getStmtClass() == OMPForSimdDirectiveClass;
1834class OMPSectionsDirective :
public OMPExecutableDirective {
1835 friend class ASTStmtReader;
1836 friend class OMPExecutableDirective;
1839 bool HasCancel =
false;
1846 OMPSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1847 : OMPExecutableDirective(OMPSectionsDirectiveClass,
1848 llvm::omp::OMPD_sections, StartLoc, EndLoc) {}
1852 explicit OMPSectionsDirective()
1853 : OMPExecutableDirective(OMPSectionsDirectiveClass,
1854 llvm::omp::OMPD_sections, SourceLocation(),
1855 SourceLocation()) {}
1858 void setTaskReductionRefExpr(Expr *E) {
Data->getChildren()[0] = E; }
1861 void setHasCancel(
bool Has) { HasCancel = Has; }
1875 static OMPSectionsDirective *
1876 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1877 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
1886 static OMPSectionsDirective *
CreateEmpty(
const ASTContext &C,
1887 unsigned NumClauses, EmptyShell);
1890 Expr *getTaskReductionRefExpr() {
1891 return cast_or_null<Expr>(
Data->getChildren()[0]);
1893 const Expr *getTaskReductionRefExpr()
const {
1894 return const_cast<OMPSectionsDirective *
>(
this)->getTaskReductionRefExpr();
1898 bool hasCancel()
const {
return HasCancel; }
1900 static bool classof(
const Stmt *T) {
1901 return T->getStmtClass() == OMPSectionsDirectiveClass;
1911class OMPSectionDirective :
public OMPExecutableDirective {
1912 friend class ASTStmtReader;
1913 friend class OMPExecutableDirective;
1916 bool HasCancel =
false;
1923 OMPSectionDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1924 : OMPExecutableDirective(OMPSectionDirectiveClass,
1925 llvm::omp::OMPD_section, StartLoc, EndLoc) {}
1929 explicit OMPSectionDirective()
1930 : OMPExecutableDirective(OMPSectionDirectiveClass,
1931 llvm::omp::OMPD_section, SourceLocation(),
1932 SourceLocation()) {}
1943 static OMPSectionDirective *
Create(
const ASTContext &C,
1944 SourceLocation StartLoc,
1945 SourceLocation EndLoc,
1946 Stmt *AssociatedStmt,
bool HasCancel);
1952 static OMPSectionDirective *
CreateEmpty(
const ASTContext &C, EmptyShell);
1955 void setHasCancel(
bool Has) { HasCancel = Has; }
1958 bool hasCancel()
const {
return HasCancel; }
1960 static bool classof(
const Stmt *T) {
1961 return T->getStmtClass() == OMPSectionDirectiveClass;
1972class OMPScopeDirective final :
public OMPExecutableDirective {
1973 friend class ASTStmtReader;
1974 friend class OMPExecutableDirective;
1981 OMPScopeDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1982 : OMPExecutableDirective(OMPScopeDirectiveClass, llvm::omp::OMPD_scope,
1983 StartLoc, EndLoc) {}
1987 explicit OMPScopeDirective()
1988 : OMPExecutableDirective(OMPScopeDirectiveClass, llvm::omp::OMPD_scope,
1989 SourceLocation(), SourceLocation()) {}
1999 static OMPScopeDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
2000 SourceLocation EndLoc,
2001 ArrayRef<OMPClause *> Clauses,
2002 Stmt *AssociatedStmt);
2008 static OMPScopeDirective *
CreateEmpty(
const ASTContext &C,
2009 unsigned NumClauses, EmptyShell);
2011 static bool classof(
const Stmt *T) {
2012 return T->getStmtClass() == OMPScopeDirectiveClass;
2024class OMPSingleDirective :
public OMPExecutableDirective {
2025 friend class ASTStmtReader;
2026 friend class OMPExecutableDirective;
2032 OMPSingleDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2033 : OMPExecutableDirective(OMPSingleDirectiveClass, llvm::omp::OMPD_single,
2034 StartLoc, EndLoc) {}
2038 explicit OMPSingleDirective()
2039 : OMPExecutableDirective(OMPSingleDirectiveClass, llvm::omp::OMPD_single,
2040 SourceLocation(), SourceLocation()) {}
2051 static OMPSingleDirective *
2052 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2053 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2061 static OMPSingleDirective *
CreateEmpty(
const ASTContext &C,
2062 unsigned NumClauses, EmptyShell);
2064 static bool classof(
const Stmt *T) {
2065 return T->getStmtClass() == OMPSingleDirectiveClass;
2075class OMPMasterDirective :
public OMPExecutableDirective {
2076 friend class ASTStmtReader;
2077 friend class OMPExecutableDirective;
2083 OMPMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2084 : OMPExecutableDirective(OMPMasterDirectiveClass, llvm::omp::OMPD_master,
2085 StartLoc, EndLoc) {}
2089 explicit OMPMasterDirective()
2090 : OMPExecutableDirective(OMPMasterDirectiveClass, llvm::omp::OMPD_master,
2091 SourceLocation(), SourceLocation()) {}
2101 static OMPMasterDirective *
Create(
const ASTContext &C,
2102 SourceLocation StartLoc,
2103 SourceLocation EndLoc,
2104 Stmt *AssociatedStmt);
2110 static OMPMasterDirective *
CreateEmpty(
const ASTContext &C, EmptyShell);
2112 static bool classof(
const Stmt *T) {
2113 return T->getStmtClass() == OMPMasterDirectiveClass;
2123class OMPCriticalDirective :
public OMPExecutableDirective {
2124 friend class ASTStmtReader;
2125 friend class OMPExecutableDirective;
2127 DeclarationNameInfo DirName;
2134 OMPCriticalDirective(
const DeclarationNameInfo &Name, SourceLocation StartLoc,
2135 SourceLocation EndLoc)
2136 : OMPExecutableDirective(OMPCriticalDirectiveClass,
2137 llvm::omp::OMPD_critical, StartLoc, EndLoc),
2142 explicit OMPCriticalDirective()
2143 : OMPExecutableDirective(OMPCriticalDirectiveClass,
2144 llvm::omp::OMPD_critical, SourceLocation(),
2145 SourceLocation()) {}
2151 void setDirectiveName(
const DeclarationNameInfo &Name) { DirName = Name; }
2163 static OMPCriticalDirective *
2164 Create(
const ASTContext &C,
const DeclarationNameInfo &Name,
2165 SourceLocation StartLoc, SourceLocation EndLoc,
2166 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2173 static OMPCriticalDirective *
CreateEmpty(
const ASTContext &C,
2174 unsigned NumClauses, EmptyShell);
2178 DeclarationNameInfo getDirectiveName()
const {
return DirName; }
2180 static bool classof(
const Stmt *T) {
2181 return T->getStmtClass() == OMPCriticalDirectiveClass;
2194class OMPParallelForDirective :
public OMPLoopDirective {
2195 friend class ASTStmtReader;
2196 friend class OMPExecutableDirective;
2199 bool HasCancel =
false;
2207 OMPParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2208 unsigned CollapsedNum)
2209 : OMPLoopDirective(OMPParallelForDirectiveClass,
2210 llvm::omp::OMPD_parallel_for, StartLoc, EndLoc,
2217 explicit OMPParallelForDirective(
unsigned CollapsedNum)
2218 : OMPLoopDirective(OMPParallelForDirectiveClass,
2219 llvm::omp::OMPD_parallel_for, SourceLocation(),
2220 SourceLocation(), CollapsedNum) {}
2223 void setTaskReductionRefExpr(Expr *E) {
2224 Data->getChildren()[numLoopChildren(getLoopsNumber(),
2225 llvm::omp::OMPD_parallel_for)] = E;
2229 void setHasCancel(
bool Has) { HasCancel = Has; }
2245 static OMPParallelForDirective *
2246 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2247 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
2248 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
2258 static OMPParallelForDirective *
CreateEmpty(
const ASTContext &C,
2259 unsigned NumClauses,
2260 unsigned CollapsedNum,
2264 Expr *getTaskReductionRefExpr() {
2265 return cast_or_null<Expr>(
Data->getChildren()[numLoopChildren(
2266 getLoopsNumber(), llvm::omp::OMPD_parallel_for)]);
2268 const Expr *getTaskReductionRefExpr()
const {
2269 return const_cast<OMPParallelForDirective *
>(
this)
2270 ->getTaskReductionRefExpr();
2274 bool hasCancel()
const {
return HasCancel; }
2276 static bool classof(
const Stmt *T) {
2277 return T->getStmtClass() == OMPParallelForDirectiveClass;
2291class OMPParallelForSimdDirective :
public OMPLoopDirective {
2292 friend class ASTStmtReader;
2293 friend class OMPExecutableDirective;
2300 OMPParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
2301 unsigned CollapsedNum)
2302 : OMPLoopDirective(OMPParallelForSimdDirectiveClass,
2303 llvm::omp::OMPD_parallel_for_simd, StartLoc, EndLoc,
2310 explicit OMPParallelForSimdDirective(
unsigned CollapsedNum)
2311 : OMPLoopDirective(OMPParallelForSimdDirectiveClass,
2312 llvm::omp::OMPD_parallel_for_simd, SourceLocation(),
2313 SourceLocation(), CollapsedNum) {}
2326 static OMPParallelForSimdDirective *
2327 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2328 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
2329 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
2338 static OMPParallelForSimdDirective *
CreateEmpty(
const ASTContext &C,
2339 unsigned NumClauses,
2340 unsigned CollapsedNum,
2343 static bool classof(
const Stmt *T) {
2344 return T->getStmtClass() == OMPParallelForSimdDirectiveClass;
2356class OMPParallelMasterDirective :
public OMPExecutableDirective {
2357 friend class ASTStmtReader;
2358 friend class OMPExecutableDirective;
2360 OMPParallelMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2361 : OMPExecutableDirective(OMPParallelMasterDirectiveClass,
2362 llvm::omp::OMPD_parallel_master, StartLoc,
2365 explicit OMPParallelMasterDirective()
2366 : OMPExecutableDirective(OMPParallelMasterDirectiveClass,
2367 llvm::omp::OMPD_parallel_master,
2368 SourceLocation(), SourceLocation()) {}
2371 void setTaskReductionRefExpr(Expr *E) {
Data->getChildren()[0] = E; }
2384 static OMPParallelMasterDirective *
2385 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2386 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef);
2394 static OMPParallelMasterDirective *
2395 CreateEmpty(
const ASTContext &C,
unsigned NumClauses, EmptyShell);
2398 Expr *getTaskReductionRefExpr() {
2399 return cast_or_null<Expr>(
Data->getChildren()[0]);
2401 const Expr *getTaskReductionRefExpr()
const {
2402 return const_cast<OMPParallelMasterDirective *
>(
this)
2403 ->getTaskReductionRefExpr();
2406 static bool classof(
const Stmt *T) {
2407 return T->getStmtClass() == OMPParallelMasterDirectiveClass;
2419class OMPParallelMaskedDirective final :
public OMPExecutableDirective {
2420 friend class ASTStmtReader;
2421 friend class OMPExecutableDirective;
2423 OMPParallelMaskedDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2424 : OMPExecutableDirective(OMPParallelMaskedDirectiveClass,
2425 llvm::omp::OMPD_parallel_masked, StartLoc,
2428 explicit OMPParallelMaskedDirective()
2429 : OMPExecutableDirective(OMPParallelMaskedDirectiveClass,
2430 llvm::omp::OMPD_parallel_masked,
2431 SourceLocation(), SourceLocation()) {}
2434 void setTaskReductionRefExpr(Expr *E) {
Data->getChildren()[0] = E; }
2447 static OMPParallelMaskedDirective *
2448 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2449 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef);
2457 static OMPParallelMaskedDirective *
2458 CreateEmpty(
const ASTContext &C,
unsigned NumClauses, EmptyShell);
2461 Expr *getTaskReductionRefExpr() {
2462 return cast_or_null<Expr>(
Data->getChildren()[0]);
2464 const Expr *getTaskReductionRefExpr()
const {
2465 return const_cast<OMPParallelMaskedDirective *
>(
this)
2466 ->getTaskReductionRefExpr();
2469 static bool classof(
const Stmt *T) {
2470 return T->getStmtClass() == OMPParallelMaskedDirectiveClass;
2483class OMPParallelSectionsDirective :
public OMPExecutableDirective {
2484 friend class ASTStmtReader;
2485 friend class OMPExecutableDirective;
2488 bool HasCancel =
false;
2495 OMPParallelSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2496 : OMPExecutableDirective(OMPParallelSectionsDirectiveClass,
2497 llvm::omp::OMPD_parallel_sections, StartLoc,
2502 explicit OMPParallelSectionsDirective()
2503 : OMPExecutableDirective(OMPParallelSectionsDirectiveClass,
2504 llvm::omp::OMPD_parallel_sections,
2505 SourceLocation(), SourceLocation()) {}
2508 void setTaskReductionRefExpr(Expr *E) {
Data->getChildren()[0] = E; }
2511 void setHasCancel(
bool Has) { HasCancel = Has; }
2525 static OMPParallelSectionsDirective *
2526 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2527 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
2536 static OMPParallelSectionsDirective *
2537 CreateEmpty(
const ASTContext &C,
unsigned NumClauses, EmptyShell);
2540 Expr *getTaskReductionRefExpr() {
2541 return cast_or_null<Expr>(
Data->getChildren()[0]);
2543 const Expr *getTaskReductionRefExpr()
const {
2544 return const_cast<OMPParallelSectionsDirective *
>(
this)
2545 ->getTaskReductionRefExpr();
2549 bool hasCancel()
const {
return HasCancel; }
2551 static bool classof(
const Stmt *T) {
2552 return T->getStmtClass() == OMPParallelSectionsDirectiveClass;
2564class OMPTaskDirective :
public OMPExecutableDirective {
2565 friend class ASTStmtReader;
2566 friend class OMPExecutableDirective;
2568 bool HasCancel =
false;
2575 OMPTaskDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2576 : OMPExecutableDirective(OMPTaskDirectiveClass, llvm::omp::OMPD_task,
2577 StartLoc, EndLoc) {}
2581 explicit OMPTaskDirective()
2582 : OMPExecutableDirective(OMPTaskDirectiveClass, llvm::omp::OMPD_task,
2583 SourceLocation(), SourceLocation()) {}
2586 void setHasCancel(
bool Has) { HasCancel = Has; }
2598 static OMPTaskDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
2599 SourceLocation EndLoc,
2600 ArrayRef<OMPClause *> Clauses,
2601 Stmt *AssociatedStmt,
bool HasCancel);
2609 static OMPTaskDirective *
CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
2613 bool hasCancel()
const {
return HasCancel; }
2615 static bool classof(
const Stmt *T) {
2616 return T->getStmtClass() == OMPTaskDirectiveClass;
2626class OMPTaskyieldDirective :
public OMPExecutableDirective {
2627 friend class ASTStmtReader;
2628 friend class OMPExecutableDirective;
2634 OMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2635 : OMPExecutableDirective(OMPTaskyieldDirectiveClass,
2636 llvm::omp::OMPD_taskyield, StartLoc, EndLoc) {}
2640 explicit OMPTaskyieldDirective()
2641 : OMPExecutableDirective(OMPTaskyieldDirectiveClass,
2642 llvm::omp::OMPD_taskyield, SourceLocation(),
2643 SourceLocation()) {}
2652 static OMPTaskyieldDirective *
2653 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
2659 static OMPTaskyieldDirective *
CreateEmpty(
const ASTContext &C, EmptyShell);
2661 static bool classof(
const Stmt *T) {
2662 return T->getStmtClass() == OMPTaskyieldDirectiveClass;
2672class OMPBarrierDirective :
public OMPExecutableDirective {
2673 friend class ASTStmtReader;
2674 friend class OMPExecutableDirective;
2680 OMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2681 : OMPExecutableDirective(OMPBarrierDirectiveClass,
2682 llvm::omp::OMPD_barrier, StartLoc, EndLoc) {}
2686 explicit OMPBarrierDirective()
2687 : OMPExecutableDirective(OMPBarrierDirectiveClass,
2688 llvm::omp::OMPD_barrier, SourceLocation(),
2689 SourceLocation()) {}
2698 static OMPBarrierDirective *
2699 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
2705 static OMPBarrierDirective *
CreateEmpty(
const ASTContext &C, EmptyShell);
2707 static bool classof(
const Stmt *T) {
2708 return T->getStmtClass() == OMPBarrierDirectiveClass;
2718class OMPTaskwaitDirective :
public OMPExecutableDirective {
2719 friend class ASTStmtReader;
2720 friend class OMPExecutableDirective;
2726 OMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2727 : OMPExecutableDirective(OMPTaskwaitDirectiveClass,
2728 llvm::omp::OMPD_taskwait, StartLoc, EndLoc) {}
2732 explicit OMPTaskwaitDirective()
2733 : OMPExecutableDirective(OMPTaskwaitDirectiveClass,
2734 llvm::omp::OMPD_taskwait, SourceLocation(),
2735 SourceLocation()) {}
2745 static OMPTaskwaitDirective *
Create(
const ASTContext &C,
2746 SourceLocation StartLoc,
2747 SourceLocation EndLoc,
2748 ArrayRef<OMPClause *> Clauses);
2755 static OMPTaskwaitDirective *
CreateEmpty(
const ASTContext &C,
2756 unsigned NumClauses, EmptyShell);
2758 static bool classof(
const Stmt *T) {
2759 return T->getStmtClass() == OMPTaskwaitDirectiveClass;
2769class OMPTaskgroupDirective :
public OMPExecutableDirective {
2770 friend class ASTStmtReader;
2771 friend class OMPExecutableDirective;
2777 OMPTaskgroupDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2778 : OMPExecutableDirective(OMPTaskgroupDirectiveClass,
2779 llvm::omp::OMPD_taskgroup, StartLoc, EndLoc) {}
2783 explicit OMPTaskgroupDirective()
2784 : OMPExecutableDirective(OMPTaskgroupDirectiveClass,
2785 llvm::omp::OMPD_taskgroup, SourceLocation(),
2786 SourceLocation()) {}
2789 void setReductionRef(Expr *RR) {
Data->getChildren()[0] = RR; }
2801 static OMPTaskgroupDirective *
2802 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2803 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
2804 Expr *ReductionRef);
2811 static OMPTaskgroupDirective *
CreateEmpty(
const ASTContext &C,
2812 unsigned NumClauses, EmptyShell);
2816 const Expr *getReductionRef()
const {
2817 return const_cast<OMPTaskgroupDirective *
>(
this)->getReductionRef();
2819 Expr *getReductionRef() {
return cast_or_null<Expr>(
Data->getChildren()[0]); }
2821 static bool classof(
const Stmt *T) {
2822 return T->getStmtClass() == OMPTaskgroupDirectiveClass;
2836class OMPFlushDirective :
public OMPExecutableDirective {
2837 friend class ASTStmtReader;
2838 friend class OMPExecutableDirective;
2844 OMPFlushDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2845 : OMPExecutableDirective(OMPFlushDirectiveClass, llvm::omp::OMPD_flush,
2846 StartLoc, EndLoc) {}
2850 explicit OMPFlushDirective()
2851 : OMPExecutableDirective(OMPFlushDirectiveClass, llvm::omp::OMPD_flush,
2852 SourceLocation(), SourceLocation()) {}
2863 static OMPFlushDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
2864 SourceLocation EndLoc,
2865 ArrayRef<OMPClause *> Clauses);
2873 static OMPFlushDirective *
CreateEmpty(
const ASTContext &C,
2874 unsigned NumClauses, EmptyShell);
2876 static bool classof(
const Stmt *T) {
2877 return T->getStmtClass() == OMPFlushDirectiveClass;
2888class OMPDepobjDirective final :
public OMPExecutableDirective {
2889 friend class ASTStmtReader;
2890 friend class OMPExecutableDirective;
2897 OMPDepobjDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2898 : OMPExecutableDirective(OMPDepobjDirectiveClass, llvm::omp::OMPD_depobj,
2899 StartLoc, EndLoc) {}
2903 explicit OMPDepobjDirective()
2904 : OMPExecutableDirective(OMPDepobjDirectiveClass, llvm::omp::OMPD_depobj,
2905 SourceLocation(), SourceLocation()) {}
2915 static OMPDepobjDirective *
Create(
const ASTContext &C,
2916 SourceLocation StartLoc,
2917 SourceLocation EndLoc,
2918 ArrayRef<OMPClause *> Clauses);
2926 static OMPDepobjDirective *
CreateEmpty(
const ASTContext &C,
2927 unsigned NumClauses, EmptyShell);
2929 static bool classof(
const Stmt *T) {
2930 return T->getStmtClass() == OMPDepobjDirectiveClass;
2940class OMPOrderedDirective :
public OMPExecutableDirective {
2941 friend class ASTStmtReader;
2942 friend class OMPExecutableDirective;
2948 OMPOrderedDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2949 : OMPExecutableDirective(OMPOrderedDirectiveClass,
2950 llvm::omp::OMPD_ordered, StartLoc, EndLoc) {}
2954 explicit OMPOrderedDirective()
2955 : OMPExecutableDirective(OMPOrderedDirectiveClass,
2956 llvm::omp::OMPD_ordered, SourceLocation(),
2957 SourceLocation()) {}
2968 static OMPOrderedDirective *
2969 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
2970 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
2978 static OMPOrderedDirective *
CreateEmpty(
const ASTContext &C,
2979 unsigned NumClauses,
2980 bool IsStandalone, EmptyShell);
2982 static bool classof(
const Stmt *T) {
2983 return T->getStmtClass() == OMPOrderedDirectiveClass;
2994class OMPAtomicDirective :
public OMPExecutableDirective {
2995 friend class ASTStmtReader;
2996 friend class OMPExecutableDirective;
3008 LLVM_PREFERRED_TYPE(
bool)
3018 LLVM_PREFERRED_TYPE(
bool)
3022 LLVM_PREFERRED_TYPE(
bool)
3031 OMPAtomicDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3032 : OMPExecutableDirective(OMPAtomicDirectiveClass, llvm::omp::OMPD_atomic,
3033 StartLoc, EndLoc) {}
3037 explicit OMPAtomicDirective()
3038 : OMPExecutableDirective(OMPAtomicDirectiveClass, llvm::omp::OMPD_atomic,
3039 SourceLocation(), SourceLocation()) {}
3041 enum DataPositionTy :
size_t {
3052 void setX(Expr *
X) {
Data->getChildren()[DataPositionTy::POS_X] =
X; }
3056 void setUpdateExpr(Expr *UE) {
3057 Data->getChildren()[DataPositionTy::POS_UpdateExpr] = UE;
3060 void setV(Expr *
V) {
Data->getChildren()[DataPositionTy::POS_V] =
V; }
3062 void setR(Expr *R) {
Data->getChildren()[DataPositionTy::POS_R] = R; }
3064 void setExpr(Expr *E) {
Data->getChildren()[DataPositionTy::POS_E] = E; }
3066 void setD(Expr *D) {
Data->getChildren()[DataPositionTy::POS_D] = D; }
3068 void setCond(Expr *C) {
Data->getChildren()[DataPositionTy::POS_Cond] =
C; }
3071 struct Expressions {
3108 SourceLocation StartLoc,
3109 SourceLocation EndLoc,
3111 Stmt *AssociatedStmt, Expressions Exprs);
3120 unsigned NumClauses, EmptyShell);
3124 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_X]);
3126 const Expr *
getX()
const {
3127 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_X]);
3133 return cast_or_null<Expr>(
3134 Data->getChildren()[DataPositionTy::POS_UpdateExpr]);
3137 return cast_or_null<Expr>(
3138 Data->getChildren()[DataPositionTy::POS_UpdateExpr]);
3152 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_V]);
3154 const Expr *
getV()
const {
3155 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_V]);
3159 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_R]);
3161 const Expr *
getR()
const {
3162 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_R]);
3166 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_E]);
3169 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_E]);
3173 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_D]);
3175 Expr *
getD()
const {
3176 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_D]);
3180 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_Cond]);
3183 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_Cond]);
3187 return T->getStmtClass() == OMPAtomicDirectiveClass;
3207 OMPTargetDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3209 StartLoc, EndLoc) {}
3215 SourceLocation(), SourceLocation()) {}
3226 static OMPTargetDirective *
3227 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3228 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3236 static OMPTargetDirective *
CreateEmpty(
const ASTContext &C,
3237 unsigned NumClauses, EmptyShell);
3240 return T->getStmtClass() == OMPTargetDirectiveClass;
3261 OMPTargetDataDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3263 llvm::omp::OMPD_target_data, StartLoc, EndLoc) {}
3269 llvm::omp::OMPD_target_data, SourceLocation(),
3270 SourceLocation()) {}
3281 static OMPTargetDataDirective *
3282 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3283 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3290 static OMPTargetDataDirective *
CreateEmpty(
const ASTContext &C,
unsigned N,
3294 return T->getStmtClass() == OMPTargetDataDirectiveClass;
3315 OMPTargetEnterDataDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3317 llvm::omp::OMPD_target_enter_data, StartLoc,
3324 llvm::omp::OMPD_target_enter_data,
3325 SourceLocation(), SourceLocation()) {}
3336 static OMPTargetEnterDataDirective *
3337 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3338 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3345 static OMPTargetEnterDataDirective *
CreateEmpty(
const ASTContext &C,
3346 unsigned N, EmptyShell);
3349 return T->getStmtClass() == OMPTargetEnterDataDirectiveClass;
3370 OMPTargetExitDataDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3372 llvm::omp::OMPD_target_exit_data, StartLoc,
3379 llvm::omp::OMPD_target_exit_data,
3380 SourceLocation(), SourceLocation()) {}
3391 static OMPTargetExitDataDirective *
3392 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3393 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3400 static OMPTargetExitDataDirective *
CreateEmpty(
const ASTContext &C,
3401 unsigned N, EmptyShell);
3404 return T->getStmtClass() == OMPTargetExitDataDirectiveClass;
3420 bool HasCancel =
false;
3427 OMPTargetParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3429 llvm::omp::OMPD_target_parallel, StartLoc,
3436 llvm::omp::OMPD_target_parallel,
3437 SourceLocation(), SourceLocation()) {}
3440 void setTaskReductionRefExpr(Expr *E) {
Data->getChildren()[0] = E; }
3442 void setHasCancel(
bool Has) { HasCancel = Has; }
3456 static OMPTargetParallelDirective *
3457 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3458 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
3467 static OMPTargetParallelDirective *
3468 CreateEmpty(
const ASTContext &C,
unsigned NumClauses, EmptyShell);
3472 return cast_or_null<Expr>(Data->getChildren()[0]);
3475 return const_cast<OMPTargetParallelDirective *
>(
this)
3483 return T->getStmtClass() == OMPTargetParallelDirectiveClass;
3501 bool HasCancel =
false;
3509 OMPTargetParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3510 unsigned CollapsedNum)
3512 llvm::omp::OMPD_target_parallel_for, StartLoc, EndLoc,
3521 llvm::omp::OMPD_target_parallel_for, SourceLocation(),
3522 SourceLocation(), CollapsedNum) {}
3525 void setTaskReductionRefExpr(Expr *E) {
3526 Data->getChildren()[numLoopChildren(
3527 getLoopsNumber(), llvm::omp::OMPD_target_parallel_for)] = E;
3531 void setHasCancel(
bool Has) { HasCancel = Has; }
3547 static OMPTargetParallelForDirective *
3548 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3549 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3550 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
3560 static OMPTargetParallelForDirective *
CreateEmpty(
const ASTContext &C,
3561 unsigned NumClauses,
3562 unsigned CollapsedNum,
3567 return cast_or_null<Expr>(Data->getChildren()[numLoopChildren(
3568 getLoopsNumber(), llvm::omp::OMPD_target_parallel_for)]);
3571 return const_cast<OMPTargetParallelForDirective *
>(
this)
3579 return T->getStmtClass() == OMPTargetParallelForDirectiveClass;
3599 OMPTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3601 StartLoc, EndLoc) {}
3607 SourceLocation(), SourceLocation()) {}
3618 static OMPTeamsDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
3619 SourceLocation EndLoc,
3620 ArrayRef<OMPClause *> Clauses,
3621 Stmt *AssociatedStmt);
3629 static OMPTeamsDirective *
CreateEmpty(
const ASTContext &C,
3630 unsigned NumClauses, EmptyShell);
3633 return T->getStmtClass() == OMPTeamsDirectiveClass;
3647 OpenMPDirectiveKind CancelRegion = llvm::omp::OMPD_unknown;
3654 OMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3656 llvm::omp::OMPD_cancellation_point, StartLoc,
3662 llvm::omp::OMPD_cancellation_point,
3663 SourceLocation(), SourceLocation()) {}
3667 void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
3676 static OMPCancellationPointDirective *
3677 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3678 OpenMPDirectiveKind CancelRegion);
3684 static OMPCancellationPointDirective *
CreateEmpty(
const ASTContext &C,
3691 return T->getStmtClass() == OMPCancellationPointDirectiveClass;
3705 OpenMPDirectiveKind CancelRegion = llvm::omp::OMPD_unknown;
3711 OMPCancelDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3713 StartLoc, EndLoc) {}
3719 SourceLocation(), SourceLocation()) {}
3723 void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
3733 static OMPCancelDirective *
3734 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3735 ArrayRef<OMPClause *> Clauses, OpenMPDirectiveKind CancelRegion);
3742 static OMPCancelDirective *
CreateEmpty(
const ASTContext &C,
3743 unsigned NumClauses, EmptyShell);
3749 return T->getStmtClass() == OMPCancelDirectiveClass;
3766 bool HasCancel =
false;
3774 OMPTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3775 unsigned CollapsedNum)
3777 StartLoc, EndLoc, CollapsedNum) {}
3785 SourceLocation(), SourceLocation(), CollapsedNum) {}
3788 void setHasCancel(
bool Has) { HasCancel = Has; }
3802 static OMPTaskLoopDirective *
3803 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3804 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3805 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
3814 static OMPTaskLoopDirective *
CreateEmpty(
const ASTContext &C,
3815 unsigned NumClauses,
3816 unsigned CollapsedNum, EmptyShell);
3822 return T->getStmtClass() == OMPTaskLoopDirectiveClass;
3844 OMPTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3845 unsigned CollapsedNum)
3847 llvm::omp::OMPD_taskloop_simd, StartLoc, EndLoc,
3856 llvm::omp::OMPD_taskloop_simd, SourceLocation(),
3857 SourceLocation(), CollapsedNum) {}
3870 static OMPTaskLoopSimdDirective *
3871 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3872 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3873 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
3882 static OMPTaskLoopSimdDirective *
CreateEmpty(
const ASTContext &C,
3883 unsigned NumClauses,
3884 unsigned CollapsedNum,
3888 return T->getStmtClass() == OMPTaskLoopSimdDirectiveClass;
3905 bool HasCancel =
false;
3913 OMPMasterTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3914 unsigned CollapsedNum)
3916 llvm::omp::OMPD_master_taskloop, StartLoc, EndLoc,
3925 llvm::omp::OMPD_master_taskloop, SourceLocation(),
3926 SourceLocation(), CollapsedNum) {}
3929 void setHasCancel(
bool Has) { HasCancel = Has; }
3943 static OMPMasterTaskLoopDirective *
3944 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3945 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3946 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
3955 static OMPMasterTaskLoopDirective *
CreateEmpty(
const ASTContext &C,
3956 unsigned NumClauses,
3957 unsigned CollapsedNum,
3964 return T->getStmtClass() == OMPMasterTaskLoopDirectiveClass;
3981 bool HasCancel =
false;
3989 OMPMaskedTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3990 unsigned CollapsedNum)
3992 llvm::omp::OMPD_masked_taskloop, StartLoc, EndLoc,
4001 llvm::omp::OMPD_masked_taskloop, SourceLocation(),
4002 SourceLocation(), CollapsedNum) {}
4005 void setHasCancel(
bool Has) { HasCancel = Has; }
4019 static OMPMaskedTaskLoopDirective *
4020 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4021 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4022 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
4031 static OMPMaskedTaskLoopDirective *
CreateEmpty(
const ASTContext &C,
4032 unsigned NumClauses,
4033 unsigned CollapsedNum,
4040 return T->getStmtClass() == OMPMaskedTaskLoopDirectiveClass;
4062 OMPMasterTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4063 unsigned CollapsedNum)
4065 llvm::omp::OMPD_master_taskloop_simd, StartLoc, EndLoc,
4074 llvm::omp::OMPD_master_taskloop_simd, SourceLocation(),
4075 SourceLocation(), CollapsedNum) {}
4088 static OMPMasterTaskLoopSimdDirective *
4089 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4090 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4091 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4099 static OMPMasterTaskLoopSimdDirective *
CreateEmpty(
const ASTContext &C,
4100 unsigned NumClauses,
4101 unsigned CollapsedNum,
4105 return T->getStmtClass() == OMPMasterTaskLoopSimdDirectiveClass;
4127 OMPMaskedTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4128 unsigned CollapsedNum)
4130 llvm::omp::OMPD_masked_taskloop_simd, StartLoc, EndLoc,
4139 llvm::omp::OMPD_masked_taskloop_simd, SourceLocation(),
4140 SourceLocation(), CollapsedNum) {}
4153 static OMPMaskedTaskLoopSimdDirective *
4154 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4155 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4156 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4164 static OMPMaskedTaskLoopSimdDirective *
CreateEmpty(
const ASTContext &C,
4165 unsigned NumClauses,
4166 unsigned CollapsedNum,
4170 return T->getStmtClass() == OMPMaskedTaskLoopSimdDirectiveClass;
4188 bool HasCancel =
false;
4196 OMPParallelMasterTaskLoopDirective(SourceLocation StartLoc,
4197 SourceLocation EndLoc,
4198 unsigned CollapsedNum)
4200 llvm::omp::OMPD_parallel_master_taskloop, StartLoc,
4201 EndLoc, CollapsedNum) {}
4209 llvm::omp::OMPD_parallel_master_taskloop,
4210 SourceLocation(), SourceLocation(), CollapsedNum) {}
4213 void setHasCancel(
bool Has) { HasCancel = Has; }
4227 static OMPParallelMasterTaskLoopDirective *
4228 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4229 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4230 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
4239 static OMPParallelMasterTaskLoopDirective *
CreateEmpty(
const ASTContext &C,
4240 unsigned NumClauses,
4241 unsigned CollapsedNum,
4248 return T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass;
4266 bool HasCancel =
false;
4274 OMPParallelMaskedTaskLoopDirective(SourceLocation StartLoc,
4275 SourceLocation EndLoc,
4276 unsigned CollapsedNum)
4278 llvm::omp::OMPD_parallel_masked_taskloop, StartLoc,
4279 EndLoc, CollapsedNum) {}
4287 llvm::omp::OMPD_parallel_masked_taskloop,
4288 SourceLocation(), SourceLocation(), CollapsedNum) {}
4291 void setHasCancel(
bool Has) { HasCancel = Has; }
4305 static OMPParallelMaskedTaskLoopDirective *
4306 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4307 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4308 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
4317 static OMPParallelMaskedTaskLoopDirective *
CreateEmpty(
const ASTContext &C,
4318 unsigned NumClauses,
4319 unsigned CollapsedNum,
4326 return T->getStmtClass() == OMPParallelMaskedTaskLoopDirectiveClass;
4349 OMPParallelMasterTaskLoopSimdDirective(SourceLocation StartLoc,
4350 SourceLocation EndLoc,
4351 unsigned CollapsedNum)
4353 llvm::omp::OMPD_parallel_master_taskloop_simd,
4354 StartLoc, EndLoc, CollapsedNum) {}
4362 llvm::omp::OMPD_parallel_master_taskloop_simd,
4363 SourceLocation(), SourceLocation(), CollapsedNum) {}
4376 static OMPParallelMasterTaskLoopSimdDirective *
4377 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4378 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4379 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4388 static OMPParallelMasterTaskLoopSimdDirective *
4389 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
4393 return T->getStmtClass() == OMPParallelMasterTaskLoopSimdDirectiveClass;
4416 OMPParallelMaskedTaskLoopSimdDirective(SourceLocation StartLoc,
4417 SourceLocation EndLoc,
4418 unsigned CollapsedNum)
4420 llvm::omp::OMPD_parallel_masked_taskloop_simd,
4421 StartLoc, EndLoc, CollapsedNum) {}
4429 llvm::omp::OMPD_parallel_masked_taskloop_simd,
4430 SourceLocation(), SourceLocation(), CollapsedNum) {}
4443 static OMPParallelMaskedTaskLoopSimdDirective *
4444 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4445 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4446 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4455 static OMPParallelMaskedTaskLoopSimdDirective *
4456 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
4460 return T->getStmtClass() == OMPParallelMaskedTaskLoopSimdDirectiveClass;
4482 OMPDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4483 unsigned CollapsedNum)
4485 llvm::omp::OMPD_distribute, StartLoc, EndLoc,
4494 llvm::omp::OMPD_distribute, SourceLocation(),
4495 SourceLocation(), CollapsedNum) {}
4508 static OMPDistributeDirective *
4509 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4510 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4511 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4520 static OMPDistributeDirective *
CreateEmpty(
const ASTContext &C,
4521 unsigned NumClauses,
4522 unsigned CollapsedNum, EmptyShell);
4525 return T->getStmtClass() == OMPDistributeDirectiveClass;
4546 OMPTargetUpdateDirective(SourceLocation StartLoc, SourceLocation EndLoc)
4548 llvm::omp::OMPD_target_update, StartLoc,
4555 llvm::omp::OMPD_target_update, SourceLocation(),
4556 SourceLocation()) {}
4567 static OMPTargetUpdateDirective *
4568 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4569 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
4577 static OMPTargetUpdateDirective *
CreateEmpty(
const ASTContext &C,
4578 unsigned NumClauses, EmptyShell);
4581 return T->getStmtClass() == OMPTargetUpdateDirectiveClass;
4598 bool HasCancel =
false;
4606 OMPDistributeParallelForDirective(SourceLocation StartLoc,
4607 SourceLocation EndLoc,
4608 unsigned CollapsedNum)
4610 llvm::omp::OMPD_distribute_parallel_for, StartLoc,
4611 EndLoc, CollapsedNum) {}
4619 llvm::omp::OMPD_distribute_parallel_for,
4620 SourceLocation(), SourceLocation(), CollapsedNum) {}
4623 void setTaskReductionRefExpr(Expr *E) {
4624 Data->getChildren()[numLoopChildren(
4625 getLoopsNumber(), llvm::omp::OMPD_distribute_parallel_for)] = E;
4629 void setHasCancel(
bool Has) { HasCancel = Has; }
4645 static OMPDistributeParallelForDirective *
4646 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4647 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4648 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
4658 static OMPDistributeParallelForDirective *
CreateEmpty(
const ASTContext &C,
4659 unsigned NumClauses,
4660 unsigned CollapsedNum,
4665 return cast_or_null<Expr>(Data->getChildren()[numLoopChildren(
4666 getLoopsNumber(), llvm::omp::OMPD_distribute_parallel_for)]);
4669 return const_cast<OMPDistributeParallelForDirective *
>(
this)
4677 return T->getStmtClass() == OMPDistributeParallelForDirectiveClass;
4700 OMPDistributeParallelForSimdDirective(SourceLocation StartLoc,
4701 SourceLocation EndLoc,
4702 unsigned CollapsedNum)
4704 llvm::omp::OMPD_distribute_parallel_for_simd, StartLoc,
4705 EndLoc, CollapsedNum) {}
4713 llvm::omp::OMPD_distribute_parallel_for_simd,
4714 SourceLocation(), SourceLocation(), CollapsedNum) {}
4727 static OMPDistributeParallelForSimdDirective *
Create(
4728 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4729 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4730 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4738 static OMPDistributeParallelForSimdDirective *
CreateEmpty(
4739 const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
4743 return T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass;
4765 OMPDistributeSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4766 unsigned CollapsedNum)
4768 llvm::omp::OMPD_distribute_simd, StartLoc, EndLoc,
4777 llvm::omp::OMPD_distribute_simd, SourceLocation(),
4778 SourceLocation(), CollapsedNum) {}
4791 static OMPDistributeSimdDirective *
4792 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4793 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4794 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4802 static OMPDistributeSimdDirective *
CreateEmpty(
const ASTContext &C,
4803 unsigned NumClauses,
4804 unsigned CollapsedNum,
4808 return T->getStmtClass() == OMPDistributeSimdDirectiveClass;
4831 OMPTargetParallelForSimdDirective(SourceLocation StartLoc,
4832 SourceLocation EndLoc,
4833 unsigned CollapsedNum)
4835 llvm::omp::OMPD_target_parallel_for_simd, StartLoc,
4836 EndLoc, CollapsedNum) {}
4844 llvm::omp::OMPD_target_parallel_for_simd,
4845 SourceLocation(), SourceLocation(), CollapsedNum) {}
4858 static OMPTargetParallelForSimdDirective *
4859 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4860 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4861 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4869 static OMPTargetParallelForSimdDirective *
CreateEmpty(
const ASTContext &C,
4870 unsigned NumClauses,
4871 unsigned CollapsedNum,
4875 return T->getStmtClass() == OMPTargetParallelForSimdDirectiveClass;
4898 OMPTargetSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4899 unsigned CollapsedNum)
4901 llvm::omp::OMPD_target_simd, StartLoc, EndLoc,
4910 llvm::omp::OMPD_target_simd, SourceLocation(),
4911 SourceLocation(), CollapsedNum) {}
4924 static OMPTargetSimdDirective *
4925 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4926 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4927 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4935 static OMPTargetSimdDirective *
CreateEmpty(
const ASTContext &C,
4936 unsigned NumClauses,
4937 unsigned CollapsedNum,
4941 return T->getStmtClass() == OMPTargetSimdDirectiveClass;
4963 OMPTeamsDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4964 unsigned CollapsedNum)
4966 llvm::omp::OMPD_teams_distribute, StartLoc, EndLoc,
4975 llvm::omp::OMPD_teams_distribute, SourceLocation(),
4976 SourceLocation(), CollapsedNum) {}
4989 static OMPTeamsDistributeDirective *
4990 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4991 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4992 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5000 static OMPTeamsDistributeDirective *
CreateEmpty(
const ASTContext &C,
5001 unsigned NumClauses,
5002 unsigned CollapsedNum,
5006 return T->getStmtClass() == OMPTeamsDistributeDirectiveClass;
5029 OMPTeamsDistributeSimdDirective(SourceLocation StartLoc,
5030 SourceLocation EndLoc,
unsigned CollapsedNum)
5032 llvm::omp::OMPD_teams_distribute_simd, StartLoc,
5033 EndLoc, CollapsedNum) {}
5041 llvm::omp::OMPD_teams_distribute_simd,
5042 SourceLocation(), SourceLocation(), CollapsedNum) {}
5055 static OMPTeamsDistributeSimdDirective *
5056 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5057 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5058 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5067 static OMPTeamsDistributeSimdDirective *
CreateEmpty(
const ASTContext &C,
5068 unsigned NumClauses,
5069 unsigned CollapsedNum,
5073 return T->getStmtClass() == OMPTeamsDistributeSimdDirectiveClass;
5086class OMPTeamsDistributeParallelForSimdDirective final
5097 OMPTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc,
5098 SourceLocation EndLoc,
5099 unsigned CollapsedNum)
5101 llvm::omp::OMPD_teams_distribute_parallel_for_simd,
5102 StartLoc, EndLoc, CollapsedNum) {}
5110 llvm::omp::OMPD_teams_distribute_parallel_for_simd,
5111 SourceLocation(), SourceLocation(), CollapsedNum) {}
5124 static OMPTeamsDistributeParallelForSimdDirective *
5125 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5126 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5127 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5135 static OMPTeamsDistributeParallelForSimdDirective *
5136 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5140 return T->getStmtClass() == OMPTeamsDistributeParallelForSimdDirectiveClass;
5157 bool HasCancel =
false;
5165 OMPTeamsDistributeParallelForDirective(SourceLocation StartLoc,
5166 SourceLocation EndLoc,
5167 unsigned CollapsedNum)
5169 llvm::omp::OMPD_teams_distribute_parallel_for,
5170 StartLoc, EndLoc, CollapsedNum) {}
5178 llvm::omp::OMPD_teams_distribute_parallel_for,
5179 SourceLocation(), SourceLocation(), CollapsedNum) {}
5182 void setTaskReductionRefExpr(Expr *E) {
5183 Data->getChildren()[numLoopChildren(
5184 getLoopsNumber(), llvm::omp::OMPD_teams_distribute_parallel_for)] = E;
5188 void setHasCancel(
bool Has) { HasCancel = Has; }
5204 static OMPTeamsDistributeParallelForDirective *
5205 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5206 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5207 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
5216 static OMPTeamsDistributeParallelForDirective *
5217 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5222 return cast_or_null<Expr>(Data->getChildren()[numLoopChildren(
5223 getLoopsNumber(), llvm::omp::OMPD_teams_distribute_parallel_for)]);
5226 return const_cast<OMPTeamsDistributeParallelForDirective *
>(
this)
5234 return T->getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass;
5254 OMPTargetTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc)
5256 llvm::omp::OMPD_target_teams, StartLoc, EndLoc) {
5263 llvm::omp::OMPD_target_teams, SourceLocation(),
5264 SourceLocation()) {}
5275 static OMPTargetTeamsDirective *
Create(
const ASTContext &C,
5276 SourceLocation StartLoc,
5277 SourceLocation EndLoc,
5278 ArrayRef<OMPClause *> Clauses,
5279 Stmt *AssociatedStmt);
5286 static OMPTargetTeamsDirective *
CreateEmpty(
const ASTContext &C,
5287 unsigned NumClauses, EmptyShell);
5290 return T->getStmtClass() == OMPTargetTeamsDirectiveClass;
5312 OMPTargetTeamsDistributeDirective(SourceLocation StartLoc,
5313 SourceLocation EndLoc,
5314 unsigned CollapsedNum)
5316 llvm::omp::OMPD_target_teams_distribute, StartLoc,
5317 EndLoc, CollapsedNum) {}
5325 llvm::omp::OMPD_target_teams_distribute,
5326 SourceLocation(), SourceLocation(), CollapsedNum) {}
5339 static OMPTargetTeamsDistributeDirective *
5340 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5341 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5342 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5350 static OMPTargetTeamsDistributeDirective *
5351 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5355 return T->getStmtClass() == OMPTargetTeamsDistributeDirectiveClass;
5368class OMPTargetTeamsDistributeParallelForDirective final
5373 bool HasCancel =
false;
5381 OMPTargetTeamsDistributeParallelForDirective(SourceLocation StartLoc,
5382 SourceLocation EndLoc,
5383 unsigned CollapsedNum)
5385 llvm::omp::OMPD_target_teams_distribute_parallel_for,
5386 StartLoc, EndLoc, CollapsedNum) {}
5394 llvm::omp::OMPD_target_teams_distribute_parallel_for,
5395 SourceLocation(), SourceLocation(), CollapsedNum) {}
5398 void setTaskReductionRefExpr(Expr *E) {
5399 Data->getChildren()[numLoopChildren(
5401 llvm::omp::OMPD_target_teams_distribute_parallel_for)] = E;
5405 void setHasCancel(
bool Has) { HasCancel = Has; }
5421 static OMPTargetTeamsDistributeParallelForDirective *
5422 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5423 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5424 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
5433 static OMPTargetTeamsDistributeParallelForDirective *
5434 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5439 return cast_or_null<Expr>(Data->getChildren()[numLoopChildren(
5441 llvm::omp::OMPD_target_teams_distribute_parallel_for)]);
5444 return const_cast<OMPTargetTeamsDistributeParallelForDirective *
>(
this)
5452 return T->getStmtClass() ==
5453 OMPTargetTeamsDistributeParallelForDirectiveClass;
5466class OMPTargetTeamsDistributeParallelForSimdDirective final
5477 OMPTargetTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc,
5478 SourceLocation EndLoc,
5479 unsigned CollapsedNum)
5481 OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
5482 llvm::omp::OMPD_target_teams_distribute_parallel_for_simd, StartLoc,
5483 EndLoc, CollapsedNum) {}
5490 unsigned CollapsedNum)
5492 OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
5493 llvm::omp::OMPD_target_teams_distribute_parallel_for_simd,
5494 SourceLocation(), SourceLocation(), CollapsedNum) {}
5507 static OMPTargetTeamsDistributeParallelForSimdDirective *
5508 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5509 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5510 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5518 static OMPTargetTeamsDistributeParallelForSimdDirective *
5519 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5523 return T->getStmtClass() ==
5524 OMPTargetTeamsDistributeParallelForSimdDirectiveClass;
5547 OMPTargetTeamsDistributeSimdDirective(SourceLocation StartLoc,
5548 SourceLocation EndLoc,
5549 unsigned CollapsedNum)
5551 llvm::omp::OMPD_target_teams_distribute_simd, StartLoc,
5552 EndLoc, CollapsedNum) {}
5560 llvm::omp::OMPD_target_teams_distribute_simd,
5561 SourceLocation(), SourceLocation(), CollapsedNum) {}
5574 static OMPTargetTeamsDistributeSimdDirective *
5575 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5576 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5577 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5585 static OMPTargetTeamsDistributeSimdDirective *
5586 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5590 return T->getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
5595class OMPTileDirective final
5603 TransformedStmtOffset,
5609 OMPTileDirectiveClass,
llvm::omp::OMPD_tile, StartLoc, EndLoc,
5612 void setPreInits(Stmt *PreInits) {
5613 Data->getChildren()[PreInitsOffset] = PreInits;
5616 void setTransformedStmt(Stmt *S) {
5617 Data->getChildren()[TransformedStmtOffset] = S;
5633 static OMPTileDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
5634 SourceLocation EndLoc,
5635 ArrayRef<OMPClause *> Clauses,
5636 unsigned NumLoops, Stmt *AssociatedStmt,
5637 Stmt *TransformedStmt, Stmt *PreInits);
5644 static OMPTileDirective *
CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
5659 return Data->getChildren()[TransformedStmtOffset];
5663 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
5666 return T->getStmtClass() == OMPTileDirectiveClass;
5671class OMPStripeDirective final
5679 TransformedStmtOffset,
5685 OMPStripeDirectiveClass,
llvm::omp::OMPD_stripe, StartLoc, EndLoc,
5688 void setPreInits(Stmt *PreInits) {
5689 Data->getChildren()[PreInitsOffset] = PreInits;
5692 void setTransformedStmt(Stmt *S) {
5693 Data->getChildren()[TransformedStmtOffset] = S;
5709 static OMPStripeDirective *
5710 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5711 ArrayRef<OMPClause *> Clauses,
unsigned NumLoops, Stmt *AssociatedStmt,
5712 Stmt *TransformedStmt, Stmt *PreInits);
5719 static OMPStripeDirective *
5720 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned NumLoops);
5733 return Data->getChildren()[TransformedStmtOffset];
5737 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
5740 return T->getStmtClass() == OMPStripeDirectiveClass;
5750class OMPUnrollDirective final
5758 TransformedStmtOffset,
5763 llvm::omp::OMPD_unroll,
5764 StartLoc, EndLoc, 1) {}
5767 void setPreInits(Stmt *PreInits) {
5768 Data->getChildren()[PreInitsOffset] = PreInits;
5772 void setTransformedStmt(Stmt *S) {
5773 Data->getChildren()[TransformedStmtOffset] = S;
5787 static OMPUnrollDirective *
5788 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5789 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
5790 unsigned NumGeneratedTopLevelLoops, Stmt *TransformedStmt,
5797 static OMPUnrollDirective *
CreateEmpty(
const ASTContext &C,
5798 unsigned NumClauses);
5808 return Data->getChildren()[TransformedStmtOffset];
5812 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
5815 return T->getStmtClass() == OMPUnrollDirectiveClass;
5826class OMPReverseDirective final
5834 TransformedStmtOffset,
5840 OMPReverseDirectiveClass,
llvm::omp::OMPD_reverse, StartLoc, EndLoc,
5843 void setPreInits(Stmt *PreInits) {
5844 Data->getChildren()[PreInitsOffset] = PreInits;
5847 void setTransformedStmt(Stmt *S) {
5848 Data->getChildren()[TransformedStmtOffset] = S;
5862 static OMPReverseDirective *
Create(
const ASTContext &C,
5863 SourceLocation StartLoc,
5864 SourceLocation EndLoc,
5865 Stmt *AssociatedStmt,
unsigned NumLoops,
5866 Stmt *TransformedStmt, Stmt *PreInits);
5872 static OMPReverseDirective *
CreateEmpty(
const ASTContext &C,
5878 return Data->getChildren()[TransformedStmtOffset];
5882 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
5885 return T->getStmtClass() == OMPReverseDirectiveClass;
5897class OMPInterchangeDirective final
5905 TransformedStmtOffset,
5909 SourceLocation EndLoc,
unsigned NumLoops)
5911 OMPInterchangeDirectiveClass,
llvm::omp::OMPD_interchange, StartLoc,
5912 EndLoc, NumLoops) {}
5914 void setPreInits(Stmt *PreInits) {
5915 Data->getChildren()[PreInitsOffset] = PreInits;
5918 void setTransformedStmt(Stmt *S) {
5919 Data->getChildren()[TransformedStmtOffset] = S;
5935 static OMPInterchangeDirective *
5936 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5937 ArrayRef<OMPClause *> Clauses,
unsigned NumLoops, Stmt *AssociatedStmt,
5938 Stmt *TransformedStmt, Stmt *PreInits);
5945 static OMPInterchangeDirective *
5946 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned NumLoops);
5951 return Data->getChildren()[TransformedStmtOffset];
5955 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
5958 return T->getStmtClass() == OMPInterchangeDirectiveClass;
5971 StmtClass SC, OpenMPDirectiveKind Kind, SourceLocation StartLoc,
5972 SourceLocation EndLoc)
5982 Stmt *getTransformedStmt()
const;
5985 Stmt *getPreInits()
const;
5988 Stmt::StmtClass C = T->getStmtClass();
5989 return C == OMPFuseDirectiveClass;
6003class OMPFuseDirective final
6011 TransformedStmtOffset,
6016 OMPFuseDirectiveClass,
llvm::omp::OMPD_fuse, StartLoc, EndLoc) {}
6018 void setPreInits(Stmt *PreInits) {
6019 Data->getChildren()[PreInitsOffset] = PreInits;
6022 void setTransformedStmt(Stmt *S) {
6023 Data->getChildren()[TransformedStmtOffset] = S;
6041 static OMPFuseDirective *
6042 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6043 ArrayRef<OMPClause *> Clauses,
unsigned NumGeneratedTopLevelLoops,
6044 Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits);
6051 static OMPFuseDirective *
CreateEmpty(
const ASTContext &C,
6052 unsigned NumClauses);
6057 return Data->getChildren()[TransformedStmtOffset];
6061 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
6064 return T->getStmtClass() == OMPFuseDirectiveClass;
6083 OMPScanDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6085 StartLoc, EndLoc) {}
6091 SourceLocation(), SourceLocation()) {}
6102 static OMPScanDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
6103 SourceLocation EndLoc,
6104 ArrayRef<OMPClause *> Clauses);
6112 static OMPScanDirective *
CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
6116 return T->getStmtClass() == OMPScanDirectiveClass;
6137 OMPInteropDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6139 llvm::omp::OMPD_interop, StartLoc, EndLoc) {}
6145 llvm::omp::OMPD_interop, SourceLocation(),
6146 SourceLocation()) {}
6156 static OMPInteropDirective *
Create(
const ASTContext &C,
6157 SourceLocation StartLoc,
6158 SourceLocation EndLoc,
6159 ArrayRef<OMPClause *> Clauses);
6165 static OMPInteropDirective *
CreateEmpty(
const ASTContext &C,
6166 unsigned NumClauses, EmptyShell);
6169 return T->getStmtClass() == OMPInteropDirectiveClass;
6186 SourceLocation TargetCallLoc;
6189 void setTargetCallLoc(SourceLocation Loc) { TargetCallLoc = Loc; }
6198 llvm::omp::OMPD_dispatch, StartLoc, EndLoc) {}
6202 explicit OMPDispatchDirective()
6203 : OMPExecutableDirective(OMPDispatchDirectiveClass,
6204 llvm::omp::OMPD_dispatch, SourceLocation(),
6205 SourceLocation()) {}
6217 static OMPDispatchDirective *
6218 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6219 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
6220 SourceLocation TargetCallLoc);
6228 static OMPDispatchDirective *
CreateEmpty(
const ASTContext &C,
6229 unsigned NumClauses, EmptyShell);
6235 return T->getStmtClass() == OMPDispatchDirectiveClass;
6255 OMPMaskedDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6257 StartLoc, EndLoc) {}
6263 SourceLocation(), SourceLocation()) {}
6273 static OMPMaskedDirective *
6274 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6275 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
6281 static OMPMaskedDirective *
CreateEmpty(
const ASTContext &C,
6282 unsigned NumClauses, EmptyShell);
6285 return T->getStmtClass() == OMPMaskedDirectiveClass;
6302 OMPMetaDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6304 llvm::omp::OMPD_metadirective, StartLoc,
6308 llvm::omp::OMPD_metadirective, SourceLocation(),
6309 SourceLocation()) {}
6311 void setIfStmt(Stmt *S) { IfStmt = S; }
6314 static OMPMetaDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
6315 SourceLocation EndLoc,
6316 ArrayRef<OMPClause *> Clauses,
6317 Stmt *AssociatedStmt, Stmt *IfStmt);
6318 static OMPMetaDirective *
CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
6323 return T->getStmtClass() == OMPMetaDirectiveClass;
6345 OMPGenericLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
6346 unsigned CollapsedNum)
6348 StartLoc, EndLoc, CollapsedNum) {}
6356 SourceLocation(), SourceLocation(), CollapsedNum) {}
6369 static OMPGenericLoopDirective *
6370 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6371 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
6372 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
6380 static OMPGenericLoopDirective *
CreateEmpty(
const ASTContext &C,
6381 unsigned NumClauses,
6382 unsigned CollapsedNum,
6386 return T->getStmtClass() == OMPGenericLoopDirectiveClass;
6407 OMPTeamsGenericLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
6408 unsigned CollapsedNum)
6410 llvm::omp::OMPD_teams_loop, StartLoc, EndLoc,
6419 llvm::omp::OMPD_teams_loop, SourceLocation(),
6420 SourceLocation(), CollapsedNum) {}
6433 static OMPTeamsGenericLoopDirective *
6434 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6435 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
6436 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
6445 static OMPTeamsGenericLoopDirective *
CreateEmpty(
const ASTContext &C,
6446 unsigned NumClauses,
6447 unsigned CollapsedNum,
6451 return T->getStmtClass() == OMPTeamsGenericLoopDirectiveClass;
6467 bool CanBeParallelFor =
false;
6474 OMPTargetTeamsGenericLoopDirective(SourceLocation StartLoc,
6475 SourceLocation EndLoc,
6476 unsigned CollapsedNum)
6478 llvm::omp::OMPD_target_teams_loop, StartLoc, EndLoc,
6487 llvm::omp::OMPD_target_teams_loop, SourceLocation(),
6488 SourceLocation(), CollapsedNum) {}
6491 void setCanBeParallelFor(
bool ParFor) { CanBeParallelFor = ParFor; }
6504 static OMPTargetTeamsGenericLoopDirective *
6505 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6506 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
6507 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool CanBeParallelFor);
6516 static OMPTargetTeamsGenericLoopDirective *
CreateEmpty(
const ASTContext &C,
6517 unsigned NumClauses,
6518 unsigned CollapsedNum,
6526 return T->getStmtClass() == OMPTargetTeamsGenericLoopDirectiveClass;
6547 OMPParallelGenericLoopDirective(SourceLocation StartLoc,
6548 SourceLocation EndLoc,
unsigned CollapsedNum)
6550 llvm::omp::OMPD_parallel_loop, StartLoc, EndLoc,
6559 llvm::omp::OMPD_parallel_loop, SourceLocation(),
6560 SourceLocation(), CollapsedNum) {}
6573 static OMPParallelGenericLoopDirective *
6574 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6575 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
6576 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
6585 static OMPParallelGenericLoopDirective *
CreateEmpty(
const ASTContext &C,
6586 unsigned NumClauses,
6587 unsigned CollapsedNum,
6591 return T->getStmtClass() == OMPParallelGenericLoopDirectiveClass;
6612 OMPTargetParallelGenericLoopDirective(SourceLocation StartLoc,
6613 SourceLocation EndLoc,
6614 unsigned CollapsedNum)
6616 llvm::omp::OMPD_target_parallel_loop, StartLoc, EndLoc,
6625 llvm::omp::OMPD_target_parallel_loop, SourceLocation(),
6626 SourceLocation(), CollapsedNum) {}
6639 static OMPTargetParallelGenericLoopDirective *
6640 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6641 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
6642 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
6651 static OMPTargetParallelGenericLoopDirective *
6652 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
6656 return T->getStmtClass() == OMPTargetParallelGenericLoopDirectiveClass;
6673 OMPErrorDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6675 StartLoc, EndLoc) {}
6680 SourceLocation(), SourceLocation()) {}
6689 static OMPErrorDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
6690 SourceLocation EndLoc,
6691 ArrayRef<OMPClause *> Clauses);
6697 static OMPErrorDirective *
CreateEmpty(
const ASTContext &C,
6698 unsigned NumClauses, EmptyShell);
6701 return T->getStmtClass() == OMPErrorDirectiveClass;
6712 OMPAssumeDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6714 StartLoc, EndLoc) {}
6718 SourceLocation(), SourceLocation()) {}
6721 static OMPAssumeDirective *
Create(
const ASTContext &Ctx,
6722 SourceLocation StartLoc,
6723 SourceLocation EndLoc,
6724 ArrayRef<OMPClause *> Clauses, Stmt *AStmt);
6726 static OMPAssumeDirective *
CreateEmpty(
const ASTContext &C,
6727 unsigned NumClauses, EmptyShell);
6730 return T->getStmtClass() == OMPAssumeDirectiveClass;
6745 clang::OMPLoopTransformationDirective *, clang::Stmt *,
6746 CastInfo<clang::OMPLoopTransformationDirective, clang::Stmt *>> {
6748 return clang::OMPLoopTransformationDirective::classof(T);
6753 dyn_cast<clang::OMPCanonicalLoopNestTransformationDirective>(T))
6754 return static_cast<clang::OMPLoopTransformationDirective *
>(D);
6756 dyn_cast<clang::OMPCanonicalLoopSequenceTransformationDirective>(T))
6757 return static_cast<clang::OMPLoopTransformationDirective *
>(D);
6758 llvm_unreachable(
"unexpected type");
6764 clang::OMPLoopTransformationDirective, const clang::Stmt *,
6765 CastInfo<clang::OMPLoopTransformationDirective, clang::Stmt *>> {};
Defines the clang::ASTContext interface.
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
Defines the clang::SourceLocation class and associated facilities.
Expr * getUpdateExpr()
Get helper expression of the form 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or 'OpaqueValueExp...
Expr * getV()
Get 'v' part of the associated expression/statement.
Expr * getR()
Get 'r' part of the associated expression/statement.
Expr * getD()
Get 'd' part of the associated expression/statement.
Expr * getX()
Get 'x' part of the associated expression/statement.
bool isFailOnly() const
Return true if 'v' is updated only when the condition is evaluated false (compare capture only).
bool isPostfixUpdate() const
Return true if 'v' expression must be updated to original value of 'x', false if 'v' must be updated ...
Expr * getExpr()
Get 'expr' part of the associated expression/statement.
bool isXLHSInRHSPart() const
Return true if helper update expression has form 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' and...
Expr * getCondExpr()
Get the 'cond' part of the source atomic expression.
static OMPAtomicDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, Expressions Exprs)
Creates directive with a list of Clauses and 'x', 'v' and 'expr' parts of the atomic construct (see S...
static bool classof(const Stmt *T)
static OMPAtomicDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp cancel' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
This represents 'pragma omp cancellation point' directive.
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp dispatch' directive.
SourceLocation getTargetCallLoc() const
Return location of target-call.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp distribute' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp distribute parallel for' composite directive.
static bool classof(const Stmt *T)
bool hasCancel() const
Return true if current directive has inner cancel directive.
const Expr * getTaskReductionRefExpr() const
friend class OMPExecutableDirective
friend class ASTStmtReader
Expr * getTaskReductionRefExpr()
Returns special task reduction reference expression.
This represents 'pragma omp distribute parallel for simd' composite directive.
friend class OMPExecutableDirective
friend class ASTStmtReader
static bool classof(const Stmt *T)
This represents 'pragma omp distribute simd' composite directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp error' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
Represents the 'pragma omp fuse' loop transformation directive.
static bool classof(const Stmt *T)
Stmt * getPreInits() const
Return preinits statement.
friend class OMPExecutableDirective
friend class ASTStmtReader
Stmt * getTransformedStmt() const
Gets the associated loops after the transformation.
This represents 'pragma omp loop' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
Represents the 'pragma omp interchange' loop transformation directive.
Stmt * getTransformedStmt() const
Gets the associated loops after the transformation.
Stmt * getPreInits() const
Return preinits statement.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp interop' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp masked' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp masked taskloop' directive.
static bool classof(const Stmt *T)
bool hasCancel() const
Return true if current directive has inner cancel directive.
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp masked taskloop simd' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp master taskloop' directive.
static bool classof(const Stmt *T)
bool hasCancel() const
Return true if current directive has inner cancel directive.
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp master taskloop simd' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp parallel loop' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp parallel masked taskloop' directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
friend class OMPExecutableDirective
friend class ASTStmtReader
static bool classof(const Stmt *T)
This represents 'pragma omp parallel masked taskloop simd' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp parallel master taskloop' directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp parallel master taskloop simd' directive.
friend class OMPExecutableDirective
static bool classof(const Stmt *T)
friend class ASTStmtReader
Represents the 'pragma omp reverse' loop transformation directive.
Stmt * getPreInits() const
Return preinits statement.
Stmt * getTransformedStmt() const
Gets/sets the associated loops after the transformation, i.e.
friend class OMPExecutableDirective
static bool classof(const Stmt *T)
friend class ASTStmtReader
This represents 'pragma omp scan' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents the 'pragma omp stripe' loop transformation directive.
static bool classof(const Stmt *T)
Stmt * getPreInits() const
Return preinits statement.
Stmt * getTransformedStmt() const
Gets/sets the associated loops after striping.
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp target data' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp target' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp target enter data' directive.
friend class OMPExecutableDirective
friend class ASTStmtReader
static bool classof(const Stmt *T)
This represents 'pragma omp target exit data' directive.
friend class OMPExecutableDirective
friend class ASTStmtReader
static bool classof(const Stmt *T)
This represents 'pragma omp target parallel' directive.
static bool classof(const Stmt *T)
bool hasCancel() const
Return true if current directive has inner cancel directive.
const Expr * getTaskReductionRefExpr() const
Expr * getTaskReductionRefExpr()
Returns special task reduction reference expression.
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp target parallel for' directive.
const Expr * getTaskReductionRefExpr() const
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
bool hasCancel() const
Return true if current directive has inner cancel directive.
Expr * getTaskReductionRefExpr()
Returns special task reduction reference expression.
This represents 'pragma omp target parallel for simd' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp target parallel loop' directive.
friend class OMPExecutableDirective
friend class ASTStmtReader
static bool classof(const Stmt *T)
This represents 'pragma omp target simd' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp target teams' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp target teams distribute' combined directive.
friend class OMPExecutableDirective
static bool classof(const Stmt *T)
friend class ASTStmtReader
This represents 'pragma omp target teams distribute parallel for' combined directive.
static bool classof(const Stmt *T)
Expr * getTaskReductionRefExpr()
Returns special task reduction reference expression.
bool hasCancel() const
Return true if current directive has inner cancel directive.
const Expr * getTaskReductionRefExpr() const
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp target teams distribute parallel for simd' combined directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp target teams distribute simd' combined directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp target teams loop' directive.
friend class OMPExecutableDirective
friend class ASTStmtReader
static bool classof(const Stmt *T)
bool canBeParallelFor() const
Return true if current loop directive's associated loop can be a parallel for.
This represents 'pragma omp target update' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp taskloop' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
bool hasCancel() const
Return true if current directive has inner cancel directive.
This represents 'pragma omp taskloop simd' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp teams' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp teams distribute' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp teams distribute parallel for' composite directive.
bool hasCancel() const
Return true if current directive has inner cancel directive.
static bool classof(const Stmt *T)
const Expr * getTaskReductionRefExpr() const
friend class OMPExecutableDirective
Expr * getTaskReductionRefExpr()
Returns special task reduction reference expression.
friend class ASTStmtReader
This represents 'pragma omp teams distribute parallel for simd' composite directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp teams distribute simd' combined directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents 'pragma omp teams loop' directive.
static bool classof(const Stmt *T)
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents the 'pragma omp tile' loop transformation directive.
static bool classof(const Stmt *T)
Stmt * getPreInits() const
Return preinits statement.
Stmt * getTransformedStmt() const
Gets/sets the associated loops after tiling.
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents the 'pragma omp unroll' loop transformation directive.
Stmt * getPreInits() const
Return the pre-init statements.
static bool classof(const Stmt *T)
Stmt * getTransformedStmt() const
Get the de-sugared associated loops after unrolling.
friend class OMPExecutableDirective
friend class ASTStmtReader
This represents one expression.
Stmt - This represents one statement.
bool Init(InterpState &S, CodePtr OpPC)
bool Inc(InterpState &S, CodePtr OpPC, bool CanOverflow)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions &DiagOpts, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
The JSON file list parser is used to communicate input to InstallAPI.
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
bool isa(CodeGen::Address addr)
Stmt * getStructuredBlock()
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
bool isOpenMPGenericLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive constitutes a 'loop' directive in the outermost nest.
const FunctionProtoType * T
bool IsXLHSInRHSPart
True if UE has the first form and false if the second.
bool IsPostfixUpdate
True if original value of 'x' must be stored in 'v', not an updated one.
bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a directive with an associated loop construct.
bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind)
Checks if the specified directive kind is one of the composite or combined directives that need loop ...
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
void getOpenMPCaptureRegions(llvm::SmallVectorImpl< OpenMPDirectiveKind > &CaptureRegions, OpenMPDirectiveKind DKind)
Return the captured regions of an OpenMP directive.
bool IsFailOnly
True if 'v' is updated only when the condition is false (compare capture only).
bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a taskloop directive.
Diagnostic wrappers for TextAPI types for error reporting.