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(); }
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) {
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) {
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) {
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;
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);
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;
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()};
1139 auto **
Storage =
reinterpret_cast<Expr **
>(
1140 &
Data->getChildren()[getArraysOffset(getDirectiveKind()) +
1141 3 * getLoopsNumber()]);
1142 return {
Storage, getLoopsNumber()};
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);
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();
1533 ArrayRef<Expr *>
inits()
const {
1534 return const_cast<OMPLoopDirective *
>(
this)->
getInits();
1539 ArrayRef<Expr *>
updates()
const {
1540 return const_cast<OMPLoopDirective *
>(
this)->
getUpdates();
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 OMPOrderedStandaloneDirective :
public OMPExecutableDirective {
2941 friend class ASTStmtReader;
2942 friend class OMPExecutableDirective;
2948 OMPOrderedStandaloneDirective(SourceLocation StartLoc, SourceLocation EndLoc)
2949 : OMPExecutableDirective(OMPOrderedStandaloneDirectiveClass,
2950 llvm::omp::OMPD_ordered_standalone, StartLoc,
2955 explicit OMPOrderedStandaloneDirective()
2956 : OMPExecutableDirective(OMPOrderedStandaloneDirectiveClass,
2957 llvm::omp::OMPD_ordered_standalone,
2958 SourceLocation(), SourceLocation()) {}
2968 static OMPOrderedStandaloneDirective *
Create(
const ASTContext &C,
2969 SourceLocation StartLoc,
2970 SourceLocation EndLoc,
2971 ArrayRef<OMPClause *> Clauses);
2978 static OMPOrderedStandaloneDirective *
2979 CreateEmpty(
const ASTContext &C,
unsigned NumClauses, EmptyShell);
2981 static bool classof(
const Stmt *T) {
2982 return T->getStmtClass() == OMPOrderedStandaloneDirectiveClass;
2993class OMPOrderedBlockAssocDirective :
public OMPExecutableDirective {
2994 friend class ASTStmtReader;
2995 friend class OMPExecutableDirective;
3001 OMPOrderedBlockAssocDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3002 : OMPExecutableDirective(OMPOrderedBlockAssocDirectiveClass,
3003 llvm::omp::OMPD_ordered_blockassoc, StartLoc,
3008 explicit OMPOrderedBlockAssocDirective()
3009 : OMPExecutableDirective(OMPOrderedBlockAssocDirectiveClass,
3010 llvm::omp::OMPD_ordered_blockassoc,
3011 SourceLocation(), SourceLocation()) {}
3022 static OMPOrderedBlockAssocDirective *
3023 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3024 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3031 static OMPOrderedBlockAssocDirective *
3032 CreateEmpty(
const ASTContext &C,
unsigned NumClauses, EmptyShell);
3034 static bool classof(
const Stmt *T) {
3035 return T->getStmtClass() == OMPOrderedBlockAssocDirectiveClass;
3046class OMPAtomicDirective :
public OMPExecutableDirective {
3047 friend class ASTStmtReader;
3048 friend class OMPExecutableDirective;
3060 LLVM_PREFERRED_TYPE(
bool)
3070 LLVM_PREFERRED_TYPE(
bool)
3074 LLVM_PREFERRED_TYPE(
bool)
3083 OMPAtomicDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3084 : OMPExecutableDirective(OMPAtomicDirectiveClass, llvm::omp::OMPD_atomic,
3085 StartLoc, EndLoc) {}
3089 explicit OMPAtomicDirective()
3090 : OMPExecutableDirective(OMPAtomicDirectiveClass, llvm::omp::OMPD_atomic,
3091 SourceLocation(), SourceLocation()) {}
3093 enum DataPositionTy :
size_t {
3104 void setX(Expr *
X) {
Data->getChildren()[DataPositionTy::POS_X] =
X; }
3108 void setUpdateExpr(Expr *UE) {
3109 Data->getChildren()[DataPositionTy::POS_UpdateExpr] = UE;
3112 void setV(Expr *
V) {
Data->getChildren()[DataPositionTy::POS_V] =
V; }
3114 void setR(Expr *R) {
Data->getChildren()[DataPositionTy::POS_R] =
R; }
3116 void setExpr(Expr *E) {
Data->getChildren()[DataPositionTy::POS_E] = E; }
3118 void setD(Expr *D) {
Data->getChildren()[DataPositionTy::POS_D] = D; }
3120 void setCond(Expr *C) {
Data->getChildren()[DataPositionTy::POS_Cond] =
C; }
3123 struct Expressions {
3160 SourceLocation StartLoc,
3161 SourceLocation EndLoc,
3163 Stmt *AssociatedStmt, Expressions Exprs);
3172 unsigned NumClauses, EmptyShell);
3176 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_X]);
3178 const Expr *
getX()
const {
3179 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_X]);
3185 return cast_or_null<Expr>(
3186 Data->getChildren()[DataPositionTy::POS_UpdateExpr]);
3189 return cast_or_null<Expr>(
3190 Data->getChildren()[DataPositionTy::POS_UpdateExpr]);
3204 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_V]);
3206 const Expr *
getV()
const {
3207 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_V]);
3211 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_R]);
3213 const Expr *
getR()
const {
3214 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_R]);
3218 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_E]);
3221 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_E]);
3225 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_D]);
3227 Expr *
getD()
const {
3228 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_D]);
3232 return cast_or_null<Expr>(Data->getChildren()[DataPositionTy::POS_Cond]);
3235 return cast_or_null<Expr>(
Data->getChildren()[DataPositionTy::POS_Cond]);
3239 return T->getStmtClass() == OMPAtomicDirectiveClass;
3259 OMPTargetDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3261 StartLoc, EndLoc) {}
3267 SourceLocation(), SourceLocation()) {}
3278 static OMPTargetDirective *
3279 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3280 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3288 static OMPTargetDirective *
CreateEmpty(
const ASTContext &C,
3289 unsigned NumClauses, EmptyShell);
3292 return T->getStmtClass() == OMPTargetDirectiveClass;
3313 OMPTargetDataDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3315 llvm::omp::OMPD_target_data, StartLoc, EndLoc) {}
3321 llvm::omp::OMPD_target_data, SourceLocation(),
3322 SourceLocation()) {}
3333 static OMPTargetDataDirective *
3334 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3335 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3342 static OMPTargetDataDirective *
CreateEmpty(
const ASTContext &C,
unsigned N,
3346 return T->getStmtClass() == OMPTargetDataDirectiveClass;
3367 OMPTargetEnterDataDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3369 llvm::omp::OMPD_target_enter_data, StartLoc,
3376 llvm::omp::OMPD_target_enter_data,
3377 SourceLocation(), SourceLocation()) {}
3388 static OMPTargetEnterDataDirective *
3389 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3390 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3397 static OMPTargetEnterDataDirective *
CreateEmpty(
const ASTContext &C,
3398 unsigned N, EmptyShell);
3401 return T->getStmtClass() == OMPTargetEnterDataDirectiveClass;
3422 OMPTargetExitDataDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3424 llvm::omp::OMPD_target_exit_data, StartLoc,
3431 llvm::omp::OMPD_target_exit_data,
3432 SourceLocation(), SourceLocation()) {}
3443 static OMPTargetExitDataDirective *
3444 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3445 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
3452 static OMPTargetExitDataDirective *
CreateEmpty(
const ASTContext &C,
3453 unsigned N, EmptyShell);
3456 return T->getStmtClass() == OMPTargetExitDataDirectiveClass;
3472 bool HasCancel =
false;
3479 OMPTargetParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3481 llvm::omp::OMPD_target_parallel, StartLoc,
3488 llvm::omp::OMPD_target_parallel,
3489 SourceLocation(), SourceLocation()) {}
3492 void setTaskReductionRefExpr(Expr *E) {
Data->getChildren()[0] = E; }
3494 void setHasCancel(
bool Has) { HasCancel = Has; }
3508 static OMPTargetParallelDirective *
3509 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3510 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *TaskRedRef,
3519 static OMPTargetParallelDirective *
3520 CreateEmpty(
const ASTContext &C,
unsigned NumClauses, EmptyShell);
3524 return cast_or_null<Expr>(Data->getChildren()[0]);
3527 return const_cast<OMPTargetParallelDirective *
>(
this)
3535 return T->getStmtClass() == OMPTargetParallelDirectiveClass;
3553 bool HasCancel =
false;
3561 OMPTargetParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3562 unsigned CollapsedNum)
3564 llvm::omp::OMPD_target_parallel_for, StartLoc, EndLoc,
3573 llvm::omp::OMPD_target_parallel_for, SourceLocation(),
3574 SourceLocation(), CollapsedNum) {}
3577 void setTaskReductionRefExpr(Expr *E) {
3578 Data->getChildren()[numLoopChildren(
3579 getLoopsNumber(), llvm::omp::OMPD_target_parallel_for)] = E;
3583 void setHasCancel(
bool Has) { HasCancel = Has; }
3599 static OMPTargetParallelForDirective *
3600 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3601 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3602 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
3612 static OMPTargetParallelForDirective *
CreateEmpty(
const ASTContext &C,
3613 unsigned NumClauses,
3614 unsigned CollapsedNum,
3619 return cast_or_null<Expr>(Data->getChildren()[numLoopChildren(
3620 getLoopsNumber(), llvm::omp::OMPD_target_parallel_for)]);
3623 return const_cast<OMPTargetParallelForDirective *
>(
this)
3631 return T->getStmtClass() == OMPTargetParallelForDirectiveClass;
3651 OMPTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3653 StartLoc, EndLoc) {}
3659 SourceLocation(), SourceLocation()) {}
3670 static OMPTeamsDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
3671 SourceLocation EndLoc,
3672 ArrayRef<OMPClause *> Clauses,
3673 Stmt *AssociatedStmt);
3681 static OMPTeamsDirective *
CreateEmpty(
const ASTContext &C,
3682 unsigned NumClauses, EmptyShell);
3685 return T->getStmtClass() == OMPTeamsDirectiveClass;
3699 OpenMPDirectiveKind CancelRegion = llvm::omp::OMPD_unknown;
3706 OMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3708 llvm::omp::OMPD_cancellation_point, StartLoc,
3714 llvm::omp::OMPD_cancellation_point,
3715 SourceLocation(), SourceLocation()) {}
3719 void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
3728 static OMPCancellationPointDirective *
3729 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3730 OpenMPDirectiveKind CancelRegion);
3736 static OMPCancellationPointDirective *
CreateEmpty(
const ASTContext &C,
3743 return T->getStmtClass() == OMPCancellationPointDirectiveClass;
3757 OpenMPDirectiveKind CancelRegion = llvm::omp::OMPD_unknown;
3763 OMPCancelDirective(SourceLocation StartLoc, SourceLocation EndLoc)
3765 StartLoc, EndLoc) {}
3771 SourceLocation(), SourceLocation()) {}
3775 void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
3785 static OMPCancelDirective *
3786 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3787 ArrayRef<OMPClause *> Clauses, OpenMPDirectiveKind CancelRegion);
3794 static OMPCancelDirective *
CreateEmpty(
const ASTContext &C,
3795 unsigned NumClauses, EmptyShell);
3801 return T->getStmtClass() == OMPCancelDirectiveClass;
3818 bool HasCancel =
false;
3826 OMPTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3827 unsigned CollapsedNum)
3829 StartLoc, EndLoc, CollapsedNum) {}
3837 SourceLocation(), SourceLocation(), CollapsedNum) {}
3840 void setHasCancel(
bool Has) { HasCancel = Has; }
3854 static OMPTaskLoopDirective *
3855 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3856 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3857 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
3866 static OMPTaskLoopDirective *
CreateEmpty(
const ASTContext &C,
3867 unsigned NumClauses,
3868 unsigned CollapsedNum, EmptyShell);
3874 return T->getStmtClass() == OMPTaskLoopDirectiveClass;
3896 OMPTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3897 unsigned CollapsedNum)
3899 llvm::omp::OMPD_taskloop_simd, StartLoc, EndLoc,
3908 llvm::omp::OMPD_taskloop_simd, SourceLocation(),
3909 SourceLocation(), CollapsedNum) {}
3922 static OMPTaskLoopSimdDirective *
3923 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3924 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3925 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
3934 static OMPTaskLoopSimdDirective *
CreateEmpty(
const ASTContext &C,
3935 unsigned NumClauses,
3936 unsigned CollapsedNum,
3940 return T->getStmtClass() == OMPTaskLoopSimdDirectiveClass;
3957 bool HasCancel =
false;
3965 OMPMasterTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
3966 unsigned CollapsedNum)
3968 llvm::omp::OMPD_master_taskloop, StartLoc, EndLoc,
3977 llvm::omp::OMPD_master_taskloop, SourceLocation(),
3978 SourceLocation(), CollapsedNum) {}
3981 void setHasCancel(
bool Has) { HasCancel = Has; }
3995 static OMPMasterTaskLoopDirective *
3996 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
3997 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
3998 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
4007 static OMPMasterTaskLoopDirective *
CreateEmpty(
const ASTContext &C,
4008 unsigned NumClauses,
4009 unsigned CollapsedNum,
4016 return T->getStmtClass() == OMPMasterTaskLoopDirectiveClass;
4033 bool HasCancel =
false;
4041 OMPMaskedTaskLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4042 unsigned CollapsedNum)
4044 llvm::omp::OMPD_masked_taskloop, StartLoc, EndLoc,
4053 llvm::omp::OMPD_masked_taskloop, SourceLocation(),
4054 SourceLocation(), CollapsedNum) {}
4057 void setHasCancel(
bool Has) { HasCancel = Has; }
4071 static OMPMaskedTaskLoopDirective *
4072 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4073 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4074 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
4083 static OMPMaskedTaskLoopDirective *
CreateEmpty(
const ASTContext &C,
4084 unsigned NumClauses,
4085 unsigned CollapsedNum,
4092 return T->getStmtClass() == OMPMaskedTaskLoopDirectiveClass;
4114 OMPMasterTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4115 unsigned CollapsedNum)
4117 llvm::omp::OMPD_master_taskloop_simd, StartLoc, EndLoc,
4126 llvm::omp::OMPD_master_taskloop_simd, SourceLocation(),
4127 SourceLocation(), CollapsedNum) {}
4140 static OMPMasterTaskLoopSimdDirective *
4141 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4142 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4143 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4151 static OMPMasterTaskLoopSimdDirective *
CreateEmpty(
const ASTContext &C,
4152 unsigned NumClauses,
4153 unsigned CollapsedNum,
4157 return T->getStmtClass() == OMPMasterTaskLoopSimdDirectiveClass;
4179 OMPMaskedTaskLoopSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4180 unsigned CollapsedNum)
4182 llvm::omp::OMPD_masked_taskloop_simd, StartLoc, EndLoc,
4191 llvm::omp::OMPD_masked_taskloop_simd, SourceLocation(),
4192 SourceLocation(), CollapsedNum) {}
4205 static OMPMaskedTaskLoopSimdDirective *
4206 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4207 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4208 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4216 static OMPMaskedTaskLoopSimdDirective *
CreateEmpty(
const ASTContext &C,
4217 unsigned NumClauses,
4218 unsigned CollapsedNum,
4222 return T->getStmtClass() == OMPMaskedTaskLoopSimdDirectiveClass;
4240 bool HasCancel =
false;
4248 OMPParallelMasterTaskLoopDirective(SourceLocation StartLoc,
4249 SourceLocation EndLoc,
4250 unsigned CollapsedNum)
4252 llvm::omp::OMPD_parallel_master_taskloop, StartLoc,
4253 EndLoc, CollapsedNum) {}
4261 llvm::omp::OMPD_parallel_master_taskloop,
4262 SourceLocation(), SourceLocation(), CollapsedNum) {}
4265 void setHasCancel(
bool Has) { HasCancel = Has; }
4279 static OMPParallelMasterTaskLoopDirective *
4280 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4281 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4282 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
4291 static OMPParallelMasterTaskLoopDirective *
CreateEmpty(
const ASTContext &C,
4292 unsigned NumClauses,
4293 unsigned CollapsedNum,
4300 return T->getStmtClass() == OMPParallelMasterTaskLoopDirectiveClass;
4318 bool HasCancel =
false;
4326 OMPParallelMaskedTaskLoopDirective(SourceLocation StartLoc,
4327 SourceLocation EndLoc,
4328 unsigned CollapsedNum)
4330 llvm::omp::OMPD_parallel_masked_taskloop, StartLoc,
4331 EndLoc, CollapsedNum) {}
4339 llvm::omp::OMPD_parallel_masked_taskloop,
4340 SourceLocation(), SourceLocation(), CollapsedNum) {}
4343 void setHasCancel(
bool Has) { HasCancel = Has; }
4357 static OMPParallelMaskedTaskLoopDirective *
4358 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4359 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4360 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool HasCancel);
4369 static OMPParallelMaskedTaskLoopDirective *
CreateEmpty(
const ASTContext &C,
4370 unsigned NumClauses,
4371 unsigned CollapsedNum,
4378 return T->getStmtClass() == OMPParallelMaskedTaskLoopDirectiveClass;
4401 OMPParallelMasterTaskLoopSimdDirective(SourceLocation StartLoc,
4402 SourceLocation EndLoc,
4403 unsigned CollapsedNum)
4405 llvm::omp::OMPD_parallel_master_taskloop_simd,
4406 StartLoc, EndLoc, CollapsedNum) {}
4414 llvm::omp::OMPD_parallel_master_taskloop_simd,
4415 SourceLocation(), SourceLocation(), CollapsedNum) {}
4428 static OMPParallelMasterTaskLoopSimdDirective *
4429 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4430 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4431 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4440 static OMPParallelMasterTaskLoopSimdDirective *
4441 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
4445 return T->getStmtClass() == OMPParallelMasterTaskLoopSimdDirectiveClass;
4468 OMPParallelMaskedTaskLoopSimdDirective(SourceLocation StartLoc,
4469 SourceLocation EndLoc,
4470 unsigned CollapsedNum)
4472 llvm::omp::OMPD_parallel_masked_taskloop_simd,
4473 StartLoc, EndLoc, CollapsedNum) {}
4481 llvm::omp::OMPD_parallel_masked_taskloop_simd,
4482 SourceLocation(), SourceLocation(), CollapsedNum) {}
4495 static OMPParallelMaskedTaskLoopSimdDirective *
4496 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4497 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4498 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4507 static OMPParallelMaskedTaskLoopSimdDirective *
4508 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
4512 return T->getStmtClass() == OMPParallelMaskedTaskLoopSimdDirectiveClass;
4534 OMPDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4535 unsigned CollapsedNum)
4537 llvm::omp::OMPD_distribute, StartLoc, EndLoc,
4546 llvm::omp::OMPD_distribute, SourceLocation(),
4547 SourceLocation(), CollapsedNum) {}
4560 static OMPDistributeDirective *
4561 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4562 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4563 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4572 static OMPDistributeDirective *
CreateEmpty(
const ASTContext &C,
4573 unsigned NumClauses,
4574 unsigned CollapsedNum, EmptyShell);
4577 return T->getStmtClass() == OMPDistributeDirectiveClass;
4598 OMPTargetUpdateDirective(SourceLocation StartLoc, SourceLocation EndLoc)
4600 llvm::omp::OMPD_target_update, StartLoc,
4607 llvm::omp::OMPD_target_update, SourceLocation(),
4608 SourceLocation()) {}
4619 static OMPTargetUpdateDirective *
4620 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4621 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
4629 static OMPTargetUpdateDirective *
CreateEmpty(
const ASTContext &C,
4630 unsigned NumClauses, EmptyShell);
4633 return T->getStmtClass() == OMPTargetUpdateDirectiveClass;
4650 bool HasCancel =
false;
4658 OMPDistributeParallelForDirective(SourceLocation StartLoc,
4659 SourceLocation EndLoc,
4660 unsigned CollapsedNum)
4662 llvm::omp::OMPD_distribute_parallel_for, StartLoc,
4663 EndLoc, CollapsedNum) {}
4671 llvm::omp::OMPD_distribute_parallel_for,
4672 SourceLocation(), SourceLocation(), CollapsedNum) {}
4675 void setTaskReductionRefExpr(Expr *E) {
4676 Data->getChildren()[numLoopChildren(
4677 getLoopsNumber(), llvm::omp::OMPD_distribute_parallel_for)] = E;
4681 void setHasCancel(
bool Has) { HasCancel = Has; }
4697 static OMPDistributeParallelForDirective *
4698 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4699 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4700 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
4710 static OMPDistributeParallelForDirective *
CreateEmpty(
const ASTContext &C,
4711 unsigned NumClauses,
4712 unsigned CollapsedNum,
4717 return cast_or_null<Expr>(Data->getChildren()[numLoopChildren(
4718 getLoopsNumber(), llvm::omp::OMPD_distribute_parallel_for)]);
4721 return const_cast<OMPDistributeParallelForDirective *
>(
this)
4729 return T->getStmtClass() == OMPDistributeParallelForDirectiveClass;
4752 OMPDistributeParallelForSimdDirective(SourceLocation StartLoc,
4753 SourceLocation EndLoc,
4754 unsigned CollapsedNum)
4756 llvm::omp::OMPD_distribute_parallel_for_simd, StartLoc,
4757 EndLoc, CollapsedNum) {}
4765 llvm::omp::OMPD_distribute_parallel_for_simd,
4766 SourceLocation(), SourceLocation(), CollapsedNum) {}
4779 static OMPDistributeParallelForSimdDirective *
Create(
4780 const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4781 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4782 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4790 static OMPDistributeParallelForSimdDirective *
CreateEmpty(
4791 const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
4795 return T->getStmtClass() == OMPDistributeParallelForSimdDirectiveClass;
4817 OMPDistributeSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4818 unsigned CollapsedNum)
4820 llvm::omp::OMPD_distribute_simd, StartLoc, EndLoc,
4829 llvm::omp::OMPD_distribute_simd, SourceLocation(),
4830 SourceLocation(), CollapsedNum) {}
4843 static OMPDistributeSimdDirective *
4844 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4845 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4846 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4854 static OMPDistributeSimdDirective *
CreateEmpty(
const ASTContext &C,
4855 unsigned NumClauses,
4856 unsigned CollapsedNum,
4860 return T->getStmtClass() == OMPDistributeSimdDirectiveClass;
4883 OMPTargetParallelForSimdDirective(SourceLocation StartLoc,
4884 SourceLocation EndLoc,
4885 unsigned CollapsedNum)
4887 llvm::omp::OMPD_target_parallel_for_simd, StartLoc,
4888 EndLoc, CollapsedNum) {}
4896 llvm::omp::OMPD_target_parallel_for_simd,
4897 SourceLocation(), SourceLocation(), CollapsedNum) {}
4910 static OMPTargetParallelForSimdDirective *
4911 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4912 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4913 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4921 static OMPTargetParallelForSimdDirective *
CreateEmpty(
const ASTContext &C,
4922 unsigned NumClauses,
4923 unsigned CollapsedNum,
4927 return T->getStmtClass() == OMPTargetParallelForSimdDirectiveClass;
4950 OMPTargetSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
4951 unsigned CollapsedNum)
4953 llvm::omp::OMPD_target_simd, StartLoc, EndLoc,
4962 llvm::omp::OMPD_target_simd, SourceLocation(),
4963 SourceLocation(), CollapsedNum) {}
4976 static OMPTargetSimdDirective *
4977 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
4978 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
4979 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
4987 static OMPTargetSimdDirective *
CreateEmpty(
const ASTContext &C,
4988 unsigned NumClauses,
4989 unsigned CollapsedNum,
4993 return T->getStmtClass() == OMPTargetSimdDirectiveClass;
5015 OMPTeamsDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,
5016 unsigned CollapsedNum)
5018 llvm::omp::OMPD_teams_distribute, StartLoc, EndLoc,
5027 llvm::omp::OMPD_teams_distribute, SourceLocation(),
5028 SourceLocation(), CollapsedNum) {}
5041 static OMPTeamsDistributeDirective *
5042 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5043 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5044 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5052 static OMPTeamsDistributeDirective *
CreateEmpty(
const ASTContext &C,
5053 unsigned NumClauses,
5054 unsigned CollapsedNum,
5058 return T->getStmtClass() == OMPTeamsDistributeDirectiveClass;
5081 OMPTeamsDistributeSimdDirective(SourceLocation StartLoc,
5082 SourceLocation EndLoc,
unsigned CollapsedNum)
5084 llvm::omp::OMPD_teams_distribute_simd, StartLoc,
5085 EndLoc, CollapsedNum) {}
5093 llvm::omp::OMPD_teams_distribute_simd,
5094 SourceLocation(), SourceLocation(), CollapsedNum) {}
5107 static OMPTeamsDistributeSimdDirective *
5108 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5109 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5110 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5119 static OMPTeamsDistributeSimdDirective *
CreateEmpty(
const ASTContext &C,
5120 unsigned NumClauses,
5121 unsigned CollapsedNum,
5125 return T->getStmtClass() == OMPTeamsDistributeSimdDirectiveClass;
5138class OMPTeamsDistributeParallelForSimdDirective final
5149 OMPTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc,
5150 SourceLocation EndLoc,
5151 unsigned CollapsedNum)
5153 llvm::omp::OMPD_teams_distribute_parallel_for_simd,
5154 StartLoc, EndLoc, CollapsedNum) {}
5162 llvm::omp::OMPD_teams_distribute_parallel_for_simd,
5163 SourceLocation(), SourceLocation(), CollapsedNum) {}
5176 static OMPTeamsDistributeParallelForSimdDirective *
5177 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5178 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5179 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5187 static OMPTeamsDistributeParallelForSimdDirective *
5188 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5192 return T->getStmtClass() == OMPTeamsDistributeParallelForSimdDirectiveClass;
5209 bool HasCancel =
false;
5217 OMPTeamsDistributeParallelForDirective(SourceLocation StartLoc,
5218 SourceLocation EndLoc,
5219 unsigned CollapsedNum)
5221 llvm::omp::OMPD_teams_distribute_parallel_for,
5222 StartLoc, EndLoc, CollapsedNum) {}
5230 llvm::omp::OMPD_teams_distribute_parallel_for,
5231 SourceLocation(), SourceLocation(), CollapsedNum) {}
5234 void setTaskReductionRefExpr(Expr *E) {
5235 Data->getChildren()[numLoopChildren(
5236 getLoopsNumber(), llvm::omp::OMPD_teams_distribute_parallel_for)] = E;
5240 void setHasCancel(
bool Has) { HasCancel = Has; }
5256 static OMPTeamsDistributeParallelForDirective *
5257 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5258 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5259 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
5268 static OMPTeamsDistributeParallelForDirective *
5269 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5274 return cast_or_null<Expr>(Data->getChildren()[numLoopChildren(
5275 getLoopsNumber(), llvm::omp::OMPD_teams_distribute_parallel_for)]);
5278 return const_cast<OMPTeamsDistributeParallelForDirective *
>(
this)
5286 return T->getStmtClass() == OMPTeamsDistributeParallelForDirectiveClass;
5306 OMPTargetTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc)
5308 llvm::omp::OMPD_target_teams, StartLoc, EndLoc) {
5315 llvm::omp::OMPD_target_teams, SourceLocation(),
5316 SourceLocation()) {}
5327 static OMPTargetTeamsDirective *
Create(
const ASTContext &C,
5328 SourceLocation StartLoc,
5329 SourceLocation EndLoc,
5330 ArrayRef<OMPClause *> Clauses,
5331 Stmt *AssociatedStmt);
5338 static OMPTargetTeamsDirective *
CreateEmpty(
const ASTContext &C,
5339 unsigned NumClauses, EmptyShell);
5342 return T->getStmtClass() == OMPTargetTeamsDirectiveClass;
5364 OMPTargetTeamsDistributeDirective(SourceLocation StartLoc,
5365 SourceLocation EndLoc,
5366 unsigned CollapsedNum)
5368 llvm::omp::OMPD_target_teams_distribute, StartLoc,
5369 EndLoc, CollapsedNum) {}
5377 llvm::omp::OMPD_target_teams_distribute,
5378 SourceLocation(), SourceLocation(), CollapsedNum) {}
5391 static OMPTargetTeamsDistributeDirective *
5392 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5393 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5394 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5402 static OMPTargetTeamsDistributeDirective *
5403 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5407 return T->getStmtClass() == OMPTargetTeamsDistributeDirectiveClass;
5420class OMPTargetTeamsDistributeParallelForDirective final
5425 bool HasCancel =
false;
5433 OMPTargetTeamsDistributeParallelForDirective(SourceLocation StartLoc,
5434 SourceLocation EndLoc,
5435 unsigned CollapsedNum)
5437 llvm::omp::OMPD_target_teams_distribute_parallel_for,
5438 StartLoc, EndLoc, CollapsedNum) {}
5446 llvm::omp::OMPD_target_teams_distribute_parallel_for,
5447 SourceLocation(), SourceLocation(), CollapsedNum) {}
5450 void setTaskReductionRefExpr(Expr *E) {
5451 Data->getChildren()[numLoopChildren(
5453 llvm::omp::OMPD_target_teams_distribute_parallel_for)] = E;
5457 void setHasCancel(
bool Has) { HasCancel = Has; }
5473 static OMPTargetTeamsDistributeParallelForDirective *
5474 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5475 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5476 Stmt *AssociatedStmt,
const HelperExprs &Exprs, Expr *TaskRedRef,
5485 static OMPTargetTeamsDistributeParallelForDirective *
5486 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5491 return cast_or_null<Expr>(Data->getChildren()[numLoopChildren(
5493 llvm::omp::OMPD_target_teams_distribute_parallel_for)]);
5496 return const_cast<OMPTargetTeamsDistributeParallelForDirective *
>(
this)
5504 return T->getStmtClass() ==
5505 OMPTargetTeamsDistributeParallelForDirectiveClass;
5518class OMPTargetTeamsDistributeParallelForSimdDirective final
5529 OMPTargetTeamsDistributeParallelForSimdDirective(SourceLocation StartLoc,
5530 SourceLocation EndLoc,
5531 unsigned CollapsedNum)
5533 OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
5534 llvm::omp::OMPD_target_teams_distribute_parallel_for_simd, StartLoc,
5535 EndLoc, CollapsedNum) {}
5542 unsigned CollapsedNum)
5544 OMPTargetTeamsDistributeParallelForSimdDirectiveClass,
5545 llvm::omp::OMPD_target_teams_distribute_parallel_for_simd,
5546 SourceLocation(), SourceLocation(), CollapsedNum) {}
5559 static OMPTargetTeamsDistributeParallelForSimdDirective *
5560 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5561 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5562 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5570 static OMPTargetTeamsDistributeParallelForSimdDirective *
5571 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5575 return T->getStmtClass() ==
5576 OMPTargetTeamsDistributeParallelForSimdDirectiveClass;
5599 OMPTargetTeamsDistributeSimdDirective(SourceLocation StartLoc,
5600 SourceLocation EndLoc,
5601 unsigned CollapsedNum)
5603 llvm::omp::OMPD_target_teams_distribute_simd, StartLoc,
5604 EndLoc, CollapsedNum) {}
5612 llvm::omp::OMPD_target_teams_distribute_simd,
5613 SourceLocation(), SourceLocation(), CollapsedNum) {}
5626 static OMPTargetTeamsDistributeSimdDirective *
5627 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5628 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
5629 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
5637 static OMPTargetTeamsDistributeSimdDirective *
5638 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
5642 return T->getStmtClass() == OMPTargetTeamsDistributeSimdDirectiveClass;
5647class OMPTileDirective final
5655 TransformedStmtOffset,
5661 OMPTileDirectiveClass,
llvm::omp::OMPD_tile, StartLoc, EndLoc,
5664 void setPreInits(Stmt *PreInits) {
5665 Data->getChildren()[PreInitsOffset] = PreInits;
5668 void setTransformedStmt(Stmt *S) {
5669 Data->getChildren()[TransformedStmtOffset] = S;
5685 static OMPTileDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
5686 SourceLocation EndLoc,
5687 ArrayRef<OMPClause *> Clauses,
5688 unsigned NumLoops, Stmt *AssociatedStmt,
5689 Stmt *TransformedStmt, Stmt *PreInits);
5696 static OMPTileDirective *
CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
5711 return Data->getChildren()[TransformedStmtOffset];
5715 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
5718 return T->getStmtClass() == OMPTileDirectiveClass;
5723class OMPStripeDirective final
5731 TransformedStmtOffset,
5737 OMPStripeDirectiveClass,
llvm::omp::OMPD_stripe, StartLoc, EndLoc,
5740 void setPreInits(Stmt *PreInits) {
5741 Data->getChildren()[PreInitsOffset] = PreInits;
5744 void setTransformedStmt(Stmt *S) {
5745 Data->getChildren()[TransformedStmtOffset] = S;
5761 static OMPStripeDirective *
5762 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5763 ArrayRef<OMPClause *> Clauses,
unsigned NumLoops, Stmt *AssociatedStmt,
5764 Stmt *TransformedStmt, Stmt *PreInits);
5771 static OMPStripeDirective *
5772 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned NumLoops);
5785 return Data->getChildren()[TransformedStmtOffset];
5789 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
5792 return T->getStmtClass() == OMPStripeDirectiveClass;
5802class OMPUnrollDirective final
5810 TransformedStmtOffset,
5815 llvm::omp::OMPD_unroll,
5816 StartLoc, EndLoc, 1) {}
5819 void setPreInits(Stmt *PreInits) {
5820 Data->getChildren()[PreInitsOffset] = PreInits;
5824 void setTransformedStmt(Stmt *S) {
5825 Data->getChildren()[TransformedStmtOffset] = S;
5839 static OMPUnrollDirective *
5840 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5841 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
5842 unsigned NumGeneratedTopLevelLoops, Stmt *TransformedStmt,
5849 static OMPUnrollDirective *
CreateEmpty(
const ASTContext &C,
5850 unsigned NumClauses);
5860 return Data->getChildren()[TransformedStmtOffset];
5864 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
5867 return T->getStmtClass() == OMPUnrollDirectiveClass;
5878class OMPReverseDirective final
5886 TransformedStmtOffset,
5892 OMPReverseDirectiveClass,
llvm::omp::OMPD_reverse, StartLoc, EndLoc,
5895 void setPreInits(Stmt *PreInits) {
5896 Data->getChildren()[PreInitsOffset] = PreInits;
5899 void setTransformedStmt(Stmt *S) {
5900 Data->getChildren()[TransformedStmtOffset] = S;
5914 static OMPReverseDirective *
Create(
const ASTContext &C,
5915 SourceLocation StartLoc,
5916 SourceLocation EndLoc,
5917 Stmt *AssociatedStmt,
unsigned NumLoops,
5918 Stmt *TransformedStmt, Stmt *PreInits);
5924 static OMPReverseDirective *
CreateEmpty(
const ASTContext &C,
5930 return Data->getChildren()[TransformedStmtOffset];
5934 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
5937 return T->getStmtClass() == OMPReverseDirectiveClass;
5949class OMPInterchangeDirective final
5957 TransformedStmtOffset,
5961 SourceLocation EndLoc,
unsigned NumLoops)
5963 OMPInterchangeDirectiveClass,
llvm::omp::OMPD_interchange, StartLoc,
5964 EndLoc, NumLoops) {}
5966 void setPreInits(Stmt *PreInits) {
5967 Data->getChildren()[PreInitsOffset] = PreInits;
5970 void setTransformedStmt(Stmt *S) {
5971 Data->getChildren()[TransformedStmtOffset] = S;
5987 static OMPInterchangeDirective *
5988 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
5989 ArrayRef<OMPClause *> Clauses,
unsigned NumLoops, Stmt *AssociatedStmt,
5990 Stmt *TransformedStmt, Stmt *PreInits);
5997 static OMPInterchangeDirective *
5998 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned NumLoops);
6003 return Data->getChildren()[TransformedStmtOffset];
6007 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
6010 return T->getStmtClass() == OMPInterchangeDirectiveClass;
6023 StmtClass SC, OpenMPDirectiveKind Kind, SourceLocation StartLoc,
6024 SourceLocation EndLoc)
6034 Stmt *getTransformedStmt()
const;
6037 Stmt *getPreInits()
const;
6040 Stmt::StmtClass C = T->getStmtClass();
6041 return C == OMPFuseDirectiveClass;
6055class OMPFuseDirective final
6063 TransformedStmtOffset,
6068 OMPFuseDirectiveClass,
llvm::omp::OMPD_fuse, StartLoc, EndLoc) {}
6070 void setPreInits(Stmt *PreInits) {
6071 Data->getChildren()[PreInitsOffset] = PreInits;
6074 void setTransformedStmt(Stmt *S) {
6075 Data->getChildren()[TransformedStmtOffset] = S;
6093 static OMPFuseDirective *
6094 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6095 ArrayRef<OMPClause *> Clauses,
unsigned NumGeneratedTopLevelLoops,
6096 Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits);
6103 static OMPFuseDirective *
CreateEmpty(
const ASTContext &C,
6104 unsigned NumClauses);
6109 return Data->getChildren()[TransformedStmtOffset];
6113 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
6116 return T->getStmtClass() == OMPFuseDirectiveClass;
6132class OMPSplitDirective final
6140 TransformedStmtOffset,
6146 OMPSplitDirectiveClass,
llvm::omp::OMPD_split, StartLoc, EndLoc,
6149 void setPreInits(Stmt *PreInits) {
6150 Data->getChildren()[PreInitsOffset] = PreInits;
6153 void setTransformedStmt(Stmt *S) {
6154 Data->getChildren()[TransformedStmtOffset] = S;
6170 static OMPSplitDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
6171 SourceLocation EndLoc,
6172 ArrayRef<OMPClause *> Clauses,
6173 unsigned NumLoops, Stmt *AssociatedStmt,
6174 Stmt *TransformedStmt, Stmt *PreInits);
6181 static OMPSplitDirective *
CreateEmpty(
const ASTContext &C,
6182 unsigned NumClauses,
unsigned NumLoops);
6187 return Data->getChildren()[TransformedStmtOffset];
6191 Stmt *
getPreInits()
const {
return Data->getChildren()[PreInitsOffset]; }
6194 return T->getStmtClass() == OMPSplitDirectiveClass;
6213 OMPScanDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6215 StartLoc, EndLoc) {}
6221 SourceLocation(), SourceLocation()) {}
6232 static OMPScanDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
6233 SourceLocation EndLoc,
6234 ArrayRef<OMPClause *> Clauses);
6242 static OMPScanDirective *
CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
6246 return T->getStmtClass() == OMPScanDirectiveClass;
6267 OMPInteropDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6269 llvm::omp::OMPD_interop, StartLoc, EndLoc) {}
6275 llvm::omp::OMPD_interop, SourceLocation(),
6276 SourceLocation()) {}
6286 static OMPInteropDirective *
Create(
const ASTContext &C,
6287 SourceLocation StartLoc,
6288 SourceLocation EndLoc,
6289 ArrayRef<OMPClause *> Clauses);
6295 static OMPInteropDirective *
CreateEmpty(
const ASTContext &C,
6296 unsigned NumClauses, EmptyShell);
6299 return T->getStmtClass() == OMPInteropDirectiveClass;
6316 SourceLocation TargetCallLoc;
6319 void setTargetCallLoc(SourceLocation Loc) { TargetCallLoc = Loc; }
6328 llvm::omp::OMPD_dispatch, StartLoc, EndLoc) {}
6332 explicit OMPDispatchDirective()
6333 : OMPExecutableDirective(OMPDispatchDirectiveClass,
6334 llvm::omp::OMPD_dispatch, SourceLocation(),
6335 SourceLocation()) {}
6347 static OMPDispatchDirective *
6348 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6349 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
6350 SourceLocation TargetCallLoc);
6358 static OMPDispatchDirective *
CreateEmpty(
const ASTContext &C,
6359 unsigned NumClauses, EmptyShell);
6365 return T->getStmtClass() == OMPDispatchDirectiveClass;
6385 OMPMaskedDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6387 StartLoc, EndLoc) {}
6393 SourceLocation(), SourceLocation()) {}
6403 static OMPMaskedDirective *
6404 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6405 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
6411 static OMPMaskedDirective *
CreateEmpty(
const ASTContext &C,
6412 unsigned NumClauses, EmptyShell);
6415 return T->getStmtClass() == OMPMaskedDirectiveClass;
6432 OMPMetaDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6434 llvm::omp::OMPD_metadirective, StartLoc,
6438 llvm::omp::OMPD_metadirective, SourceLocation(),
6439 SourceLocation()) {}
6441 void setIfStmt(Stmt *S) { IfStmt = S; }
6444 static OMPMetaDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
6445 SourceLocation EndLoc,
6446 ArrayRef<OMPClause *> Clauses,
6447 Stmt *AssociatedStmt, Stmt *IfStmt);
6448 static OMPMetaDirective *
CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
6453 return T->getStmtClass() == OMPMetaDirectiveClass;
6475 OMPGenericLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
6476 unsigned CollapsedNum)
6478 StartLoc, EndLoc, CollapsedNum) {}
6486 SourceLocation(), SourceLocation(), CollapsedNum) {}
6499 static OMPGenericLoopDirective *
6500 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6501 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
6502 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
6510 static OMPGenericLoopDirective *
CreateEmpty(
const ASTContext &C,
6511 unsigned NumClauses,
6512 unsigned CollapsedNum,
6516 return T->getStmtClass() == OMPGenericLoopDirectiveClass;
6537 OMPTeamsGenericLoopDirective(SourceLocation StartLoc, SourceLocation EndLoc,
6538 unsigned CollapsedNum)
6540 llvm::omp::OMPD_teams_loop, StartLoc, EndLoc,
6549 llvm::omp::OMPD_teams_loop, SourceLocation(),
6550 SourceLocation(), CollapsedNum) {}
6563 static OMPTeamsGenericLoopDirective *
6564 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6565 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
6566 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
6575 static OMPTeamsGenericLoopDirective *
CreateEmpty(
const ASTContext &C,
6576 unsigned NumClauses,
6577 unsigned CollapsedNum,
6581 return T->getStmtClass() == OMPTeamsGenericLoopDirectiveClass;
6597 bool CanBeParallelFor =
false;
6604 OMPTargetTeamsGenericLoopDirective(SourceLocation StartLoc,
6605 SourceLocation EndLoc,
6606 unsigned CollapsedNum)
6608 llvm::omp::OMPD_target_teams_loop, StartLoc, EndLoc,
6617 llvm::omp::OMPD_target_teams_loop, SourceLocation(),
6618 SourceLocation(), CollapsedNum) {}
6621 void setCanBeParallelFor(
bool ParFor) { CanBeParallelFor = ParFor; }
6634 static OMPTargetTeamsGenericLoopDirective *
6635 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6636 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
6637 Stmt *AssociatedStmt,
const HelperExprs &Exprs,
bool CanBeParallelFor);
6646 static OMPTargetTeamsGenericLoopDirective *
CreateEmpty(
const ASTContext &C,
6647 unsigned NumClauses,
6648 unsigned CollapsedNum,
6656 return T->getStmtClass() == OMPTargetTeamsGenericLoopDirectiveClass;
6677 OMPParallelGenericLoopDirective(SourceLocation StartLoc,
6678 SourceLocation EndLoc,
unsigned CollapsedNum)
6680 llvm::omp::OMPD_parallel_loop, StartLoc, EndLoc,
6689 llvm::omp::OMPD_parallel_loop, SourceLocation(),
6690 SourceLocation(), CollapsedNum) {}
6703 static OMPParallelGenericLoopDirective *
6704 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6705 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
6706 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
6715 static OMPParallelGenericLoopDirective *
CreateEmpty(
const ASTContext &C,
6716 unsigned NumClauses,
6717 unsigned CollapsedNum,
6721 return T->getStmtClass() == OMPParallelGenericLoopDirectiveClass;
6742 OMPTargetParallelGenericLoopDirective(SourceLocation StartLoc,
6743 SourceLocation EndLoc,
6744 unsigned CollapsedNum)
6746 llvm::omp::OMPD_target_parallel_loop, StartLoc, EndLoc,
6755 llvm::omp::OMPD_target_parallel_loop, SourceLocation(),
6756 SourceLocation(), CollapsedNum) {}
6769 static OMPTargetParallelGenericLoopDirective *
6770 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6771 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
6772 Stmt *AssociatedStmt,
const HelperExprs &Exprs);
6781 static OMPTargetParallelGenericLoopDirective *
6782 CreateEmpty(
const ASTContext &C,
unsigned NumClauses,
unsigned CollapsedNum,
6786 return T->getStmtClass() == OMPTargetParallelGenericLoopDirectiveClass;
6803 OMPErrorDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6805 StartLoc, EndLoc) {}
6810 SourceLocation(), SourceLocation()) {}
6819 static OMPErrorDirective *
Create(
const ASTContext &C, SourceLocation StartLoc,
6820 SourceLocation EndLoc,
6821 ArrayRef<OMPClause *> Clauses);
6827 static OMPErrorDirective *
CreateEmpty(
const ASTContext &C,
6828 unsigned NumClauses, EmptyShell);
6831 return T->getStmtClass() == OMPErrorDirectiveClass;
6842 OMPAssumeDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6844 StartLoc, EndLoc) {}
6848 SourceLocation(), SourceLocation()) {}
6851 static OMPAssumeDirective *
Create(
const ASTContext &Ctx,
6852 SourceLocation StartLoc,
6853 SourceLocation EndLoc,
6854 ArrayRef<OMPClause *> Clauses, Stmt *AStmt);
6856 static OMPAssumeDirective *
CreateEmpty(
const ASTContext &C,
6857 unsigned NumClauses, EmptyShell);
6860 return T->getStmtClass() == OMPAssumeDirectiveClass;
6875 clang::OMPLoopTransformationDirective *, clang::Stmt *,
6876 CastInfo<clang::OMPLoopTransformationDirective, clang::Stmt *>> {
6878 return clang::OMPLoopTransformationDirective::classof(T);
6883 dyn_cast<clang::OMPCanonicalLoopNestTransformationDirective>(T))
6884 return static_cast<clang::OMPLoopTransformationDirective *
>(D);
6886 dyn_cast<clang::OMPCanonicalLoopSequenceTransformationDirective>(T))
6887 return static_cast<clang::OMPLoopTransformationDirective *
>(D);
6888 llvm_unreachable(
"unexpected type");
6894 clang::OMPLoopTransformationDirective, const clang::Stmt *,
6895 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
Represents the 'pragma omp split' loop transformation directive.
Stmt * getPreInits() const
Return preinits statement.
Stmt * getTransformedStmt() const
Gets/sets the associated loops after the transformation, i.e.
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.
Top level wrappers for InstallAPI frontend operations.
bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a worksharing directive.
bool isa(CodeGen::Address addr)
MutableArrayRef< Expr * > getFinals()
Sets the list of final update expressions for linear variables.
Stmt * getStructuredBlock()
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind)
Checks if the specified directive is a distribute directive.
void setUpdates(ArrayRef< Expr * > UL)
Sets the list of update expressions for linear variables.
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.
child_range used_children()
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 ...
void setInits(ArrayRef< Expr * > IL)
Sets the list of the initial values for linear variables.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
MutableArrayRef< Expr * > getUpdates()
Sets the list of update expressions for linear variables.
void setFinals(ArrayRef< Expr * > FL)
Sets the list of final update expressions for linear variables.
void getOpenMPCaptureRegions(llvm::SmallVectorImpl< OpenMPDirectiveKind > &CaptureRegions, OpenMPDirectiveKind DKind)
Return the captured regions of an OpenMP directive.
MutableArrayRef< Expr * > getInits()
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.
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 uint8_t