21#include "llvm/ADT/SmallPtrSet.h"
22#include "llvm/Support/ErrorHandling.h"
35#define GEN_CLANG_CLAUSE_CLASS
36#define CLAUSE_CLASS(Enum, Str, Class) \
38 return static_cast<Class *>(this)->children();
39#include "llvm/Frontend/OpenMP/OMP.inc"
41 llvm_unreachable(
"unknown OMPClause");
46#define GEN_CLANG_CLAUSE_CLASS
47#define CLAUSE_CLASS(Enum, Str, Class) \
49 return static_cast<Class *>(this)->used_children();
50#define CLAUSE_NO_CLASS(Enum, Str) \
53#include "llvm/Frontend/OpenMP/OMP.inc"
55 llvm_unreachable(
"unknown OMPClause");
64 switch (
C->getClauseKind()) {
67 case OMPC_dist_schedule:
69 case OMPC_firstprivate:
71 case OMPC_lastprivate:
75 case OMPC_task_reduction:
77 case OMPC_in_reduction:
83 case OMPC_num_threads:
87 case OMPC_thread_limit:
105 case OMPC_ompx_dyn_cgroup_mem:
121 case OMPC_copyprivate:
126 case OMPC_threadprivate:
146 case OMPC_defaultmap:
151 case OMPC_use_device_ptr:
152 case OMPC_use_device_addr:
153 case OMPC_is_device_ptr:
154 case OMPC_has_device_addr:
155 case OMPC_unified_address:
156 case OMPC_unified_shared_memory:
157 case OMPC_reverse_offload:
158 case OMPC_dynamic_allocators:
159 case OMPC_atomic_default_mem_order:
163 case OMPC_device_type:
165 case OMPC_nontemporal:
171 case OMPC_uses_allocators:
190 switch (
C->getClauseKind()) {
191 case OMPC_lastprivate:
195 case OMPC_task_reduction:
197 case OMPC_in_reduction:
202 case OMPC_dist_schedule:
203 case OMPC_firstprivate:
208 case OMPC_num_threads:
219 case OMPC_copyprivate:
224 case OMPC_threadprivate:
244 case OMPC_thread_limit:
250 case OMPC_defaultmap:
255 case OMPC_use_device_ptr:
256 case OMPC_use_device_addr:
257 case OMPC_is_device_ptr:
258 case OMPC_has_device_addr:
259 case OMPC_unified_address:
260 case OMPC_unified_shared_memory:
261 case OMPC_reverse_offload:
262 case OMPC_dynamic_allocators:
263 case OMPC_atomic_default_mem_order:
268 case OMPC_device_type:
270 case OMPC_nontemporal:
273 case OMPC_novariants:
278 case OMPC_uses_allocators:
295 if (
auto *DS = dyn_cast<DeclStmt>(S)) {
296 assert(DS->isSingleDecl() &&
"Only single expression must be captured.");
297 if (
auto *OED = dyn_cast<OMPCapturedExprDecl>(DS->getSingleDecl()))
298 return OED->getInitAddress();
350 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops));
353 for (
unsigned I = 0; I < NumLoops; ++I) {
355 Clause->setLoopCounter(I,
nullptr);
362 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops));
364 for (
unsigned I = 0; I < NumLoops; ++I) {
366 Clause->setLoopCounter(I,
nullptr);
372 Expr *NumIterations) {
373 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
374 getTrailingObjects()[NumLoop] = NumIterations;
378 return getTrailingObjects(NumberOfLoops);
382 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
383 getTrailingObjects()[NumberOfLoops + NumLoop] = Counter;
387 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
388 return getTrailingObjects()[NumberOfLoops + NumLoop];
392 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
393 return getTrailingObjects()[NumberOfLoops + NumLoop];
407 C.Allocate(totalSizeToAlloc<SourceLocation, OpenMPDependClauseKind>(2, 1),
411 Clause->setLParenLoc(LParenLoc);
412 Clause->setArgumentLoc(ArgumentLoc);
413 Clause->setDependencyKind(DK);
422 C.Allocate(totalSizeToAlloc<SourceLocation, OpenMPDependClauseKind>(2, 1),
425 Clause->IsExtended =
true;
431 "Number of private copies is not the same as the preallocated buffer");
440 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
444 Clause->setPrivateCopies(PrivateVL);
450 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * N));
456 "Number of private copies is not the same as the preallocated buffer");
462 "Number of inits is not the same as the preallocated buffer");
463 llvm::copy(VL, getPrivateCopies().end());
471 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(3 * VL.size()));
475 Clause->setPrivateCopies(PrivateVL);
476 Clause->setInits(InitVL);
483 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(3 * N));
489 "Number of private copies is not the same as the preallocated buffer");
494 assert(SrcExprs.size() ==
varlist_size() &&
"Number of source expressions is "
495 "not the same as the "
496 "preallocated buffer");
497 llvm::copy(SrcExprs, getPrivateCopies().end());
501 assert(DstExprs.size() ==
varlist_size() &&
"Number of destination "
502 "expressions is not the same as "
503 "the preallocated buffer");
504 llvm::copy(DstExprs, getSourceExprs().end());
507void OMPLastprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
509 "Number of assignment expressions is not the same as the preallocated "
511 llvm::copy(AssignmentOps, getDestinationExprs().end());
520 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
522 StartLoc, LParenLoc, EndLoc, LPKind, LPKindLoc, ColonLoc, VL.size());
524 Clause->setSourceExprs(SrcExprs);
525 Clause->setDestinationExprs(DstExprs);
526 Clause->setAssignmentOps(AssignmentOps);
534 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * N));
543 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
551 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
557 "Number of privates is not the same as the preallocated buffer");
563 "Number of inits is not the same as the preallocated buffer");
564 llvm::copy(IL, getPrivates().end());
569 "Number of updates is not the same as the preallocated buffer");
570 llvm::copy(UL, getInits().end());
575 "Number of final updates is not the same as the preallocated buffer");
576 llvm::copy(FL, getUpdates().end());
582 "Number of used expressions is not the same as the preallocated buffer");
583 llvm::copy(UE, getFinals().end() + 2);
596 C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2 + VL.size() + 1));
599 ColonLoc, StepModifierLoc, EndLoc, VL.size());
601 Clause->setPrivates(PL);
602 Clause->setInits(IL);
605 std::fill(Clause->getInits().end(), Clause->getInits().end() + VL.size(),
607 std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(),
609 std::fill(Clause->getUsedExprs().begin(), Clause->getUsedExprs().end(),
611 Clause->setStep(Step);
612 Clause->setCalcStep(CalcStep);
622 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2 + NumVars +1));
629 reinterpret_cast<Stmt **
>(getUsedExprs().begin()),
630 reinterpret_cast<Stmt **
>(llvm::find(getUsedExprs(),
nullptr)));
637 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
641 Clause->setAlignment(A);
647 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumVars + 1));
659 assert(SrcExprs.size() ==
varlist_size() &&
"Number of source expressions is "
660 "not the same as the "
661 "preallocated buffer");
666 assert(DstExprs.size() ==
varlist_size() &&
"Number of destination "
667 "expressions is not the same as "
668 "the preallocated buffer");
669 llvm::copy(DstExprs, getSourceExprs().end());
674 "Number of assignment expressions is not the same as the preallocated "
676 llvm::copy(AssignmentOps, getDestinationExprs().end());
683 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
687 Clause->setSourceExprs(SrcExprs);
688 Clause->setDestinationExprs(DstExprs);
689 Clause->setAssignmentOps(AssignmentOps);
694 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * N));
699 assert(SrcExprs.size() ==
varlist_size() &&
"Number of source expressions is "
700 "not the same as the "
701 "preallocated buffer");
706 assert(DstExprs.size() ==
varlist_size() &&
"Number of destination "
707 "expressions is not the same as "
708 "the preallocated buffer");
709 llvm::copy(DstExprs, getSourceExprs().end());
712void OMPCopyprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
714 "Number of assignment expressions is not the same as the preallocated "
716 llvm::copy(AssignmentOps, getDestinationExprs().end());
723 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
727 Clause->setSourceExprs(SrcExprs);
728 Clause->setDestinationExprs(DstExprs);
729 Clause->setAssignmentOps(AssignmentOps);
735 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * N));
741 "Number of private copies is not the same as the preallocated buffer");
748 "Number of LHS expressions is not the same as the preallocated buffer");
749 llvm::copy(LHSExprs, getPrivates().end());
755 "Number of RHS expressions is not the same as the preallocated buffer");
756 llvm::copy(RHSExprs, getLHSExprs().end());
760 assert(ReductionOps.size() ==
varlist_size() &&
"Number of reduction "
761 "expressions is not the same "
762 "as the preallocated buffer");
763 llvm::copy(ReductionOps, getRHSExprs().end());
767 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
768 assert(Ops.size() ==
varlist_size() &&
"Number of copy "
769 "expressions is not the same "
770 "as the preallocated buffer");
771 llvm::copy(Ops, getReductionOps().end());
774void OMPReductionClause::setInscanCopyArrayTemps(
776 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
778 "Number of copy temp expressions is not the same as the preallocated "
780 llvm::copy(CopyArrayTemps, getInscanCopyOps().end());
783void OMPReductionClause::setInscanCopyArrayElems(
785 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
787 "Number of copy temp expressions is not the same as the preallocated "
789 llvm::copy(CopyArrayElems, getInscanCopyArrayTemps().end());
803 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, bool>(
804 (Modifier == OMPC_REDUCTION_inscan ? 8 : 5) * VL.size(), VL.size()));
806 StartLoc, LParenLoc, ModifierLoc, EndLoc, ColonLoc, Modifier,
807 OrignalSharingModifier, VL.size(), QualifierLoc, NameInfo);
809 Clause->setPrivates(Privates);
810 Clause->setLHSExprs(LHSExprs);
811 Clause->setRHSExprs(RHSExprs);
812 Clause->setReductionOps(ReductionOps);
813 Clause->setPreInitStmt(PreInit);
814 Clause->setPostUpdateExpr(PostUpdate);
815 Clause->setPrivateVariableReductionFlags(IsPrivateVarReduction);
816 if (Modifier == OMPC_REDUCTION_inscan) {
817 Clause->setInscanCopyOps(CopyOps);
818 Clause->setInscanCopyArrayTemps(CopyArrayTemps);
819 Clause->setInscanCopyArrayElems(CopyArrayElems);
821 assert(CopyOps.empty() &&
822 "copy operations are expected in inscan reductions only.");
823 assert(CopyArrayTemps.empty() &&
824 "copy array temps are expected in inscan reductions only.");
825 assert(CopyArrayElems.empty() &&
826 "copy array temps are expected in inscan reductions only.");
834 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, bool>(
835 (Modifier == OMPC_REDUCTION_inscan ? 8 : 5) * N, N));
837 Clause->setModifier(Modifier);
843 "Number of private copies is not the same as the preallocated buffer");
850 "Number of LHS expressions is not the same as the preallocated buffer");
851 llvm::copy(LHSExprs, getPrivates().end());
857 "Number of RHS expressions is not the same as the preallocated buffer");
858 llvm::copy(RHSExprs, getLHSExprs().end());
861void OMPTaskReductionClause::setReductionOps(
ArrayRef<Expr *> ReductionOps) {
862 assert(ReductionOps.size() ==
varlist_size() &&
"Number of task reduction "
863 "expressions is not the same "
864 "as the preallocated buffer");
865 llvm::copy(ReductionOps, getRHSExprs().end());
875 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
877 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
879 Clause->setPrivates(Privates);
880 Clause->setLHSExprs(LHSExprs);
881 Clause->setRHSExprs(RHSExprs);
882 Clause->setReductionOps(ReductionOps);
890 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * N));
896 "Number of private copies is not the same as the preallocated buffer");
903 "Number of LHS expressions is not the same as the preallocated buffer");
904 llvm::copy(LHSExprs, getPrivates().end());
910 "Number of RHS expressions is not the same as the preallocated buffer");
911 llvm::copy(RHSExprs, getLHSExprs().end());
915 assert(ReductionOps.size() ==
varlist_size() &&
"Number of in reduction "
916 "expressions is not the same "
917 "as the preallocated buffer");
918 llvm::copy(ReductionOps, getRHSExprs().end());
921void OMPInReductionClause::setTaskgroupDescriptors(
924 "Number of in reduction descriptors is not the same as the "
925 "preallocated buffer");
926 llvm::copy(TaskgroupDescriptors, getReductionOps().end());
936 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(6 * VL.size()));
938 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
940 Clause->setPrivates(Privates);
941 Clause->setLHSExprs(LHSExprs);
942 Clause->setRHSExprs(RHSExprs);
943 Clause->setReductionOps(ReductionOps);
944 Clause->setTaskgroupDescriptors(TaskgroupDescriptors);
952 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(6 * N));
971 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumSizes));
984 Clause->setArgRefs(Args);
990 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumLoops));
1014 Clause->setLParenLoc(LParenLoc);
1016 Clause->setFactor(Factor);
1032 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1034 StartLoc, LParenLoc, Allocator, Alignment, ColonLoc, Modifier1,
1035 Modifier1Loc, Modifier2, Modifier2Loc, EndLoc, VL.size());
1043 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1052 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1054 new (Mem)
OMPFlushClause(StartLoc, LParenLoc, EndLoc, VL.size());
1060 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1070 Clause->setDepobj(Depobj);
1083 void *Mem =
C.Allocate(
1084 totalSizeToAlloc<Expr *>(VL.size() + 1 + NumLoops),
1088 Clause->setDependencyKind(
Data.DepKind);
1089 Clause->setDependencyLoc(
Data.DepLoc);
1090 Clause->setColonLoc(
Data.ColonLoc);
1091 Clause->setOmpAllMemoryLoc(
Data.OmpAllMemoryLoc);
1092 Clause->setModifier(DepModifier);
1094 for (
unsigned I = 0 ; I < NumLoops; ++I)
1100 unsigned NumLoops) {
1102 C.Allocate(totalSizeToAlloc<Expr *>(N + 1 + NumLoops),
1110 NumLoop < NumLoops &&
1111 "Expected sink or source depend + loop index must be less number of "
1113 auto *It = std::next(
getVarRefs().end(), NumLoop + 1);
1120 NumLoop < NumLoops &&
1121 "Expected sink or source depend + loop index must be less number of "
1123 auto *It = std::next(
getVarRefs().end(), NumLoop + 1);
1130 NumLoop < NumLoops &&
1131 "Expected sink or source depend + loop index must be less number of "
1133 const auto *It = std::next(
getVarRefs().end(), NumLoop + 1);
1137void OMPDependClause::setModifier(
Expr *DepModifier) {
1144 unsigned TotalNum = 0u;
1145 for (
auto &
C : ComponentLists)
1146 TotalNum +=
C.size();
1155 UniqueDecls.insert(VD);
1157 return UniqueDecls.size();
1184 void *Mem =
C.Allocate(
1191 OMPMapClause(MapModifiers, MapModifiersLoc, UDMQualifierLoc, MapperId,
1196 Clause->setIteratorModifier(IteratorModifier);
1198 Clause->setMapType(
Type);
1206 void *Mem =
C.Allocate(
1213 Clause->setIteratorModifier(
nullptr);
1240 void *Mem =
C.Allocate(
1247 auto *Clause =
new (Mem)
OMPToClause(MotionModifiers, MotionModifiersLoc,
1248 UDMQualifierLoc, MapperId, Locs, Sizes);
1251 Clause->setUDMapperRefs(UDMapperRefs);
1252 Clause->setClauseInfo(Declarations, ComponentLists);
1258 void *Mem =
C.Allocate(
1290 void *Mem =
C.Allocate(
1298 new (Mem)
OMPFromClause(MotionModifiers, MotionModifiersLoc,
1299 UDMQualifierLoc, MapperId, Locs, Sizes);
1302 Clause->setUDMapperRefs(UDMapperRefs);
1303 Clause->setClauseInfo(Declarations, ComponentLists);
1310 void *Mem =
C.Allocate(
1321 "Number of private copies is not the same as the preallocated buffer");
1327 "Number of inits is not the same as the preallocated buffer");
1328 llvm::copy(VL, getPrivateCopies().end());
1352 void *Mem =
C.Allocate(
1362 Clause->setPrivateCopies(PrivateVars);
1363 Clause->setInits(Inits);
1371 void *Mem =
C.Allocate(
1401 void *Mem =
C.Allocate(
1411 Clause->setClauseInfo(Declarations, ComponentLists);
1418 void *Mem =
C.Allocate(
1448 void *Mem =
C.Allocate(
1465 void *Mem =
C.Allocate(
1495 void *Mem =
C.Allocate(
1505 Clause->setClauseInfo(Declarations, ComponentLists);
1512 void *Mem =
C.Allocate(
1527 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
1536 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * N));
1541 assert(VL.size() ==
varlist_size() &&
"Number of private references is not "
1542 "the same as the preallocated buffer");
1551 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1560 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1569 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1578 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1582void OMPUsesAllocatorsClause::setAllocatorsData(
1584 assert(
Data.size() == NumOfAllocators &&
1585 "Size of allocators data is not the same as the preallocated buffer.");
1586 for (
unsigned I = 0,
E =
Data.size(); I <
E; ++I) {
1588 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1589 static_cast<int>(ExprOffsets::Allocator)] =
1591 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1593 ExprOffsets::AllocatorTraits)] =
1596 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1597 static_cast<int>(ParenLocsOffsets::LParen)] =
1600 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1601 static_cast<int>(ParenLocsOffsets::RParen)] =
1610 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1611 static_cast<int>(ExprOffsets::Allocator)];
1613 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1615 ExprOffsets::AllocatorTraits)];
1617 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1618 static_cast<int>(ParenLocsOffsets::LParen)];
1620 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1621 static_cast<int>(ParenLocsOffsets::RParen)];
1629 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, SourceLocation>(
1630 static_cast<int>(ExprOffsets::Total) *
Data.size(),
1631 static_cast<int>(ParenLocsOffsets::Total) *
Data.size()));
1632 auto *Clause =
new (Mem)
1634 Clause->setAllocatorsData(
Data);
1640 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, SourceLocation>(
1641 static_cast<int>(ExprOffsets::Total) * N,
1642 static_cast<int>(ParenLocsOffsets::Total) * N));
1651 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(Locators.size() + 1));
1652 auto *Clause =
new (Mem)
1654 Clause->setModifier(Modifier);
1655 Clause->setVarRefs(Locators);
1661 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1673 C.Allocate(totalSizeToAlloc<Expr *>(InteropInfo.
PreferTypes.size() + 1));
1676 VarLoc, EndLoc, InteropInfo.
PreferTypes.size() + 1);
1677 Clause->setInteropVar(InteropVar);
1678 llvm::copy(InteropInfo.
PreferTypes, Clause->getTrailingObjects() + 1);
1683 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1691 return new (
C)
OMPBindClause(K, KLoc, StartLoc, LParenLoc, EndLoc);
1704 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + NumLoops),
1708 Clause->setDependenceType(DepType);
1709 Clause->setDependenceLoc(DepLoc);
1710 Clause->setColonLoc(ColonLoc);
1712 for (
unsigned I = 0; I < NumLoops; ++I)
1719 unsigned NumLoops) {
1720 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + NumLoops),
1726 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1727 auto *It = std::next(
getVarRefs().end(), NumLoop);
1732 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1733 auto *It = std::next(
getVarRefs().end(), NumLoop);
1738 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1739 const auto *It = std::next(
getVarRefs().end(), NumLoop);
1748 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(DKVec.size()),
1751 AC->setDirectiveKinds(DKVec);
1756 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(K),
1764 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(DKVec.size()),
1773 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(K),
1782 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1792 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1800 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1810 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1820 if (
Node->getNameModifier() != OMPD_unknown)
1821 OS << getOpenMPDirectiveName(
Node->getNameModifier(), Version) <<
": ";
1822 Node->getCondition()->printPretty(OS,
nullptr, Policy, 0);
1828 Node->getCondition()->printPretty(OS,
nullptr, Policy, 0);
1833 OS <<
"num_threads(";
1839 Node->getNumThreads()->printPretty(OS,
nullptr, Policy, 0);
1845 Node->getAlignment()->printPretty(OS,
nullptr, Policy, 0);
1851 Node->getSafelen()->printPretty(OS,
nullptr, Policy, 0);
1857 Node->getSimdlen()->printPretty(OS,
nullptr, Policy, 0);
1864 for (
auto *Size :
Node->getSizesRefs()) {
1867 Size->printPretty(OS,
nullptr, Policy, 0);
1874 OS <<
"permutation(";
1875 llvm::interleaveComma(
Node->getArgsRefs(), OS, [&](
const Expr *
E) {
1876 E->printPretty(OS, nullptr, Policy, 0);
1886 if (
Expr *Factor =
Node->getFactor()) {
1888 Factor->printPretty(OS,
nullptr, Policy, 0);
1895 Node->getAllocator()->printPretty(OS,
nullptr, Policy, 0);
1901 Node->getNumForLoops()->printPretty(OS,
nullptr, Policy, 0);
1907 Node->getEventHandler()->printPretty(OS,
nullptr, Policy, 0);
1914 unsigned(
Node->getDefaultKind()))
1921 unsigned(
Node->getProcBindKind()))
1926 OS <<
"unified_address";
1929void OMPClausePrinter::VisitOMPUnifiedSharedMemoryClause(
1931 OS <<
"unified_shared_memory";
1935 OS <<
"reverse_offload";
1938void OMPClausePrinter::VisitOMPDynamicAllocatorsClause(
1940 OS <<
"dynamic_allocators";
1943void OMPClausePrinter::VisitOMPAtomicDefaultMemOrderClause(
1945 OS <<
"atomic_default_mem_order("
1947 Node->getAtomicDefaultMemOrderKind())
1977 Node->getFirstScheduleModifier());
1981 Node->getSecondScheduleModifier());
1986 if (
auto *
E =
Node->getChunkSize()) {
1995 if (
auto *
Num =
Node->getNumForLoops()) {
1997 Num->printPretty(OS,
nullptr, Policy, 0);
2018void OMPClausePrinter::VisitOMPReadClause(
OMPReadClause *) { OS <<
"read"; }
2020void OMPClausePrinter::VisitOMPWriteClause(
OMPWriteClause *) { OS <<
"write"; }
2024 if (
Node->isExtended()) {
2027 Node->getDependencyKind());
2045 Node->getClauseKind(),
static_cast<int>(
Node->getFailParameter()));
2053 for (
auto &
D :
Node->getDirectiveKinds()) {
2056 OS << getOpenMPDirectiveName(
D, Version);
2064 Node->getExpr()->printPretty(OS,
nullptr, Policy, 0);
2071 for (
auto &
D :
Node->getDirectiveKinds()) {
2074 OS << getOpenMPDirectiveName(
D, Version);
2084void OMPClausePrinter::VisitOMPNoOpenMPRoutinesClause(
2086 OS <<
"no_openmp_routines";
2089void OMPClausePrinter::VisitOMPNoOpenMPConstructsClause(
2091 OS <<
"no_openmp_constructs";
2095 OS <<
"no_parallelism";
2118void OMPClausePrinter::VisitOMPWeakClause(
OMPWeakClause *) { OS <<
"weak"; }
2124void OMPClausePrinter::VisitOMPSIMDClause(
OMPSIMDClause *) { OS <<
"simd"; }
2133 Node->getDevice()->printPretty(OS,
nullptr, Policy, 0);
2138 if (!
Node->varlist_empty()) {
2140 VisitOMPClauseList(
Node,
'(');
2146 if (!
Node->varlist_empty()) {
2147 OS <<
"thread_limit";
2148 VisitOMPClauseList(
Node,
'(');
2155 Node->getPriority()->printPretty(OS,
nullptr, Policy, 0);
2166 Node->getGrainsize()->printPretty(OS,
nullptr, Policy, 0);
2177 Node->getNumTasks()->printPretty(OS,
nullptr, Policy, 0);
2183 Node->getHint()->printPretty(OS,
nullptr, Policy, 0);
2192 OS <<
"prefer_type(";
2200 if (
Node->getIsTarget())
2202 if (
Node->getIsTargetSync()) {
2203 if (
Node->getIsTarget())
2208 Node->getInteropVar()->printPretty(OS,
nullptr, Policy);
2214 Node->getInteropVar()->printPretty(OS,
nullptr, Policy);
2246void OMPClausePrinter::VisitOMPClauseList(
T *
Node,
char StartSym) {
2247 for (
typename T::varlist_iterator I =
Node->varlist_begin(),
2248 E =
Node->varlist_end();
2250 assert(*I &&
"Expected non-null Stmt");
2251 OS << (I ==
Node->varlist_begin() ? StartSym :
',');
2252 if (
auto *DRE = dyn_cast<DeclRefExpr>(*I)) {
2253 if (isa<OMPCapturedExprDecl>(DRE->getDecl()))
2254 DRE->printPretty(OS,
nullptr, Policy, 0);
2256 DRE->getDecl()->printQualifiedName(OS);
2258 (*I)->printPretty(OS,
nullptr, Policy, 0);
2263 if (
Node->varlist_empty())
2266 Expr *FirstModifier =
nullptr;
2267 Expr *SecondModifier =
nullptr;
2268 auto FirstAllocMod =
Node->getFirstAllocateModifier();
2269 auto SecondAllocMod =
Node->getSecondAllocateModifier();
2272 if (FirstAllocMod == OMPC_ALLOCATE_allocator ||
2274 FirstModifier =
Node->getAllocator();
2275 SecondModifier =
Node->getAlignment();
2277 FirstModifier =
Node->getAlignment();
2278 SecondModifier =
Node->getAllocator();
2283 if (FirstModifier) {
2285 if (!FirstUnknown) {
2289 FirstModifier->
printPretty(OS,
nullptr, Policy, 0);
2292 if (SecondModifier) {
2294 if (!SecondUnknown) {
2299 SecondModifier->
printPretty(OS,
nullptr, Policy, 0);
2304 VisitOMPClauseList(
Node,
' ');
2307 VisitOMPClauseList(
Node,
'(');
2313 if (!
Node->varlist_empty()) {
2315 VisitOMPClauseList(
Node,
'(');
2321 if (!
Node->varlist_empty()) {
2322 OS <<
"firstprivate";
2323 VisitOMPClauseList(
Node,
'(');
2329 if (!
Node->varlist_empty()) {
2330 OS <<
"lastprivate";
2343 if (!
Node->varlist_empty()) {
2345 VisitOMPClauseList(
Node,
'(');
2351 if (!
Node->varlist_empty()) {
2353 if (
Node->getModifierLoc().isValid())
2357 Node->getQualifierLoc().getNestedNameSpecifier();
2359 Node->getNameInfo().getName().getCXXOverloadedOperator();
2360 if (!Qualifier && OOK !=
OO_None) {
2366 OS <<
Node->getNameInfo();
2369 VisitOMPClauseList(
Node,
' ');
2374void OMPClausePrinter::VisitOMPTaskReductionClause(
2376 if (!
Node->varlist_empty()) {
2377 OS <<
"task_reduction(";
2379 Node->getQualifierLoc().getNestedNameSpecifier();
2381 Node->getNameInfo().getName().getCXXOverloadedOperator();
2382 if (!Qualifier && OOK !=
OO_None) {
2388 OS <<
Node->getNameInfo();
2391 VisitOMPClauseList(
Node,
' ');
2397 if (!
Node->varlist_empty()) {
2398 OS <<
"in_reduction(";
2400 Node->getQualifierLoc().getNestedNameSpecifier();
2402 Node->getNameInfo().getName().getCXXOverloadedOperator();
2403 if (!Qualifier && OOK !=
OO_None) {
2409 OS <<
Node->getNameInfo();
2412 VisitOMPClauseList(
Node,
' ');
2418 if (!
Node->varlist_empty()) {
2420 VisitOMPClauseList(
Node,
'(');
2421 if (
Node->getModifierLoc().isValid() ||
Node->getStep() !=
nullptr) {
2424 if (
Node->getModifierLoc().isValid()) {
2427 if (
Node->getStep() !=
nullptr) {
2428 if (
Node->getModifierLoc().isValid()) {
2432 Node->getStep()->printPretty(OS,
nullptr, Policy, 0);
2440 if (!
Node->varlist_empty()) {
2442 VisitOMPClauseList(
Node,
'(');
2443 if (
Node->getAlignment() !=
nullptr) {
2445 Node->getAlignment()->printPretty(OS,
nullptr, Policy, 0);
2452 if (!
Node->varlist_empty()) {
2454 VisitOMPClauseList(
Node,
'(');
2460 if (!
Node->varlist_empty()) {
2461 OS <<
"copyprivate";
2462 VisitOMPClauseList(
Node,
'(');
2468 if (!
Node->varlist_empty()) {
2469 VisitOMPClauseList(
Node,
'(');
2476 Node->getDepobj()->printPretty(OS,
nullptr, Policy, 0);
2482 if (
Expr *DepModifier =
Node->getModifier()) {
2488 bool IsOmpAllMemory =
false;
2489 if (PrintKind == OMPC_DEPEND_outallmemory) {
2490 PrintKind = OMPC_DEPEND_out;
2491 IsOmpAllMemory =
true;
2492 }
else if (PrintKind == OMPC_DEPEND_inoutallmemory) {
2493 PrintKind = OMPC_DEPEND_inout;
2494 IsOmpAllMemory =
true;
2497 if (!
Node->varlist_empty() || IsOmpAllMemory)
2499 VisitOMPClauseList(
Node,
' ');
2500 if (IsOmpAllMemory) {
2501 OS << (
Node->varlist_empty() ?
" " :
",");
2502 OS <<
"omp_all_memory";
2507template <
typename T>
2512 Node->getMapperQualifierLoc().getNestedNameSpecifier();
2513 MapperNNS.
print(OS, Policy);
2514 OS <<
Node->getMapperIdInfo() <<
')';
2517template <
typename T>
2520 if (
Expr *IteratorModifier =
Node->getIteratorModifier())
2521 IteratorModifier->printPretty(OS,
nullptr, Policy);
2525 if (!
Node->varlist_empty()) {
2530 if (
Node->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator) {
2534 Node->getMapTypeModifier(I));
2535 if (
Node->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_mapper)
2544 VisitOMPClauseList(
Node,
' ');
2549template <
typename T>
void OMPClausePrinter::VisitOMPMotionClause(
T *
Node) {
2550 if (
Node->varlist_empty())
2552 OS << getOpenMPClauseName(
Node->getClauseKind());
2553 unsigned ModifierCount = 0;
2558 if (ModifierCount) {
2563 Node->getMotionModifier(I));
2564 if (
Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)
2566 if (I < ModifierCount - 1)
2571 VisitOMPClauseList(
Node,
' ');
2573 VisitOMPClauseList(
Node,
'(');
2579 VisitOMPMotionClause(
Node);
2583 VisitOMPMotionClause(
Node);
2588 OMPC_dist_schedule,
Node->getDistScheduleKind());
2589 if (
auto *
E =
Node->getChunkSize()) {
2597 OS <<
"defaultmap(";
2599 Node->getDefaultmapModifier());
2603 Node->getDefaultmapKind());
2609 if (!
Node->varlist_empty()) {
2610 OS <<
"use_device_ptr";
2611 VisitOMPClauseList(
Node,
'(');
2616void OMPClausePrinter::VisitOMPUseDeviceAddrClause(
2618 if (!
Node->varlist_empty()) {
2619 OS <<
"use_device_addr";
2620 VisitOMPClauseList(
Node,
'(');
2626 if (!
Node->varlist_empty()) {
2627 OS <<
"is_device_ptr";
2628 VisitOMPClauseList(
Node,
'(');
2634 if (!
Node->varlist_empty()) {
2635 OS <<
"has_device_addr";
2636 VisitOMPClauseList(
Node,
'(');
2642 if (!
Node->varlist_empty()) {
2643 OS <<
"nontemporal";
2644 VisitOMPClauseList(
Node,
'(');
2659 if (!
Node->varlist_empty()) {
2661 VisitOMPClauseList(
Node,
'(');
2667 if (!
Node->varlist_empty()) {
2669 VisitOMPClauseList(
Node,
'(');
2674void OMPClausePrinter::VisitOMPUsesAllocatorsClause(
2676 if (
Node->getNumberOfAllocators() == 0)
2678 OS <<
"uses_allocators(";
2679 for (
unsigned I = 0,
E =
Node->getNumberOfAllocators(); I <
E; ++I) {
2681 Data.Allocator->printPretty(OS,
nullptr, Policy);
2682 if (
Data.AllocatorTraits) {
2684 Data.AllocatorTraits->printPretty(OS,
nullptr, Policy);
2694 if (
Node->varlist_empty())
2697 char StartSym =
'(';
2698 if (
Expr *Modifier =
Node->getModifier()) {
2700 Modifier->printPretty(OS,
nullptr, Policy);
2704 VisitOMPClauseList(
Node, StartSym);
2710 Node->getThreadID()->printPretty(OS,
nullptr, Policy, 0);
2720void OMPClausePrinter::VisitOMPXDynCGroupMemClause(
2722 OS <<
"ompx_dyn_cgroup_mem(";
2723 Node->getSize()->printPretty(OS,
nullptr, Policy, 0);
2732 case OMPC_DOACROSS_source:
2735 case OMPC_DOACROSS_sink:
2738 case OMPC_DOACROSS_source_omp_cur_iteration:
2739 OS <<
"source: omp_cur_iteration";
2741 case OMPC_DOACROSS_sink_omp_cur_iteration:
2742 OS <<
"sink: omp_cur_iteration - 1";
2745 llvm_unreachable(
"unknown docaross modifier");
2747 VisitOMPClauseList(
Node,
' ');
2752 OS <<
"ompx_attribute(";
2753 bool IsFirst =
true;
2754 for (
auto &
Attr :
Node->getAttrs()) {
2768 VariantMatchInfo &VMI)
const {
2773 if (
Selector.Kind == TraitSelector::user_condition) {
2774 assert(
Selector.ScoreOrCondition &&
2775 "Ill-formed user condition, expected condition expression!");
2776 assert(
Selector.Properties.size() == 1 &&
2777 Selector.Properties.front().Kind ==
2778 TraitProperty::user_condition_unknown &&
2779 "Ill-formed user condition, expected unknown trait property!");
2781 if (std::optional<APSInt> CondVal =
2782 Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx))
2783 VMI.addTrait(CondVal->isZero() ? TraitProperty::user_condition_false
2784 : TraitProperty::user_condition_true,
2787 VMI.addTrait(TraitProperty::user_condition_false,
"<condition>");
2791 std::optional<llvm::APSInt> Score;
2792 llvm::APInt *ScorePtr =
nullptr;
2794 if ((Score =
Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx)))
2797 VMI.addTrait(TraitProperty::user_condition_false,
2798 "<non-constant-score>");
2804 if (
Set.Kind != TraitSet::construct)
2808 assert(
Selector.Properties.size() == 1 &&
2809 Selector.Properties.front().Kind ==
2810 getOpenMPContextTraitPropertyForSelector(
2812 "Ill-formed construct selector!");
2819 bool FirstSet =
true;
2824 OS << getOpenMPContextTraitSetName(
Set.Kind) <<
"={";
2826 bool FirstSelector =
true;
2830 FirstSelector =
false;
2831 OS << getOpenMPContextTraitSelectorName(
Selector.Kind);
2833 bool AllowsTraitScore =
false;
2834 bool RequiresProperty =
false;
2835 isValidTraitSelectorForTraitSet(
2836 Selector.Kind,
Set.Kind, AllowsTraitScore, RequiresProperty);
2838 if (!RequiresProperty)
2842 if (
Selector.Kind == TraitSelector::user_condition) {
2844 Selector.ScoreOrCondition->printPretty(OS,
nullptr, Policy);
2851 Selector.ScoreOrCondition->printPretty(OS,
nullptr, Policy);
2855 bool FirstProperty =
true;
2859 FirstProperty =
false;
2860 OS << getOpenMPContextTraitPropertyName(
Property.Kind,
2871 std::string MangledName;
2872 llvm::raw_string_ostream OS(MangledName);
2877 bool AllowsTraitScore =
false;
2878 bool RequiresProperty =
false;
2879 isValidTraitSelectorForTraitSet(
2880 Selector.Kind,
Set.Kind, AllowsTraitScore, RequiresProperty);
2883 if (!RequiresProperty ||
2884 Selector.Kind == TraitSelector::user_condition)
2889 << getOpenMPContextTraitPropertyName(
Property.Kind,
2896OMPTraitInfo::OMPTraitInfo(StringRef MangledName) {
2899 if (!MangledName.consume_front(
"$S"))
2901 if (MangledName.consumeInteger(10,
U))
2905 Set.Kind = TraitSet(
U);
2907 if (!MangledName.consume_front(
"$s"))
2909 if (MangledName.consumeInteger(10,
U))
2915 if (!MangledName.consume_front(
"$P"))
2919 std::pair<StringRef, StringRef> PropRestPair = MangledName.split(
'$');
2920 Property.RawString = PropRestPair.first;
2921 Property.Kind = getOpenMPContextTraitPropertyKind(
2923 MangledName = MangledName.drop_front(PropRestPair.first.size());
2933 TI.
print(OS, Policy);
2938 return TI ? OS << *TI : OS;
2945 : OMPContext(ASTCtx.getLangOpts().OpenMPIsTargetDevice,
2946 ASTCtx.getTargetInfo().getTriple(),
2947 ASTCtx.getLangOpts().OMPTargetTriples.empty()
2949 : ASTCtx.getLangOpts().OMPTargetTriples[0],
2951 FeatureValidityCheck([&](StringRef FeatureName) {
2954 DiagUnknownTrait(std::move(DiagUnknownTrait)) {
2957 for (llvm::omp::TraitProperty
Property : ConstructTraits)
2962 auto It = FeatureMap.find(RawString);
2963 if (It != FeatureMap.end())
2965 if (!FeatureValidityCheck(RawString))
2966 DiagUnknownTrait(RawString);
Defines the clang::ASTContext interface.
This file defines OpenMP nodes for declarative directives.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
static Stmt ** getAddrOfExprAsWritten(Stmt *S)
Gets the address of the original, non-captured, expression used in the clause as the preinitializer.
static void PrintIterator(raw_ostream &OS, T *Node, const PrintingPolicy &Policy)
static void PrintMapper(raw_ostream &OS, T *Node, const PrintingPolicy &Policy)
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const TargetInfo & getTargetInfo() const
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
Attr - This represents one attribute.
void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
This represents one expression.
Represents a function declaration or definition.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false, bool PrintFinalScopeResOp=true) const
Print this nested name specifier to the given output stream.
This represents the 'absent' clause in the '#pragma omp assume' directive.
static OMPAbsentClause * CreateEmpty(const ASTContext &C, unsigned NumKinds)
static OMPAbsentClause * Create(const ASTContext &C, ArrayRef< OpenMPDirectiveKind > DKVec, SourceLocation Loc, SourceLocation LLoc, SourceLocation RLoc)
This represents 'acq_rel' clause in the '#pragma omp atomic|flush' directives.
This represents 'acquire' clause in the '#pragma omp atomic|flush' directives.
This represents clause 'affinity' in the '#pragma omp task'-based directives.
static OMPAffinityClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Creates clause with a modifier a list of locator items.
static OMPAffinityClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N locator items.
This represents the 'align' clause in the '#pragma omp allocate' directive.
static OMPAlignClause * Create(const ASTContext &C, Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'align' clause with the given alignment.
This represents clause 'aligned' in the '#pragma omp ...' directives.
static OMPAlignedClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, Expr *A)
Creates clause with a list of variables VL and alignment A.
static OMPAlignedClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
This represents clause 'allocate' in the '#pragma omp ...' directives.
static OMPAllocateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc, OpenMPAllocateClauseModifier Modifier1, SourceLocation Modifier1Loc, OpenMPAllocateClauseModifier Modifier2, SourceLocation Modifier2Loc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
static OMPAllocateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'allocator' clause in the '#pragma omp ...' directive.
This represents 'at' clause in the '#pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the '#pragma omp requires' directive.
This represents 'bind' clause in the '#pragma omp ...' directives.
static OMPBindClause * Create(const ASTContext &C, OpenMPBindClauseKind K, SourceLocation KLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'bind' clause with kind K ('teams', 'parallel', or 'thread').
static OMPBindClause * CreateEmpty(const ASTContext &C)
Build an empty 'bind' clause.
This represents 'capture' clause in the '#pragma omp atomic' directive.
Class that represents a component of a mappable expression.
static unsigned getUniqueDeclarationsTotalNumber(ArrayRef< const ValueDecl * > Declarations)
static unsigned getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists)
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
void setPostUpdateExpr(Expr *S)
Set pre-initialization statement for the clause.
static OMPClauseWithPostUpdate * get(OMPClause *C)
Class that handles pre-initialization statement for some clauses, like 'schedule',...
const Stmt * getPreInitStmt() const
Get pre-initialization statement for the clause.
static OMPClauseWithPreInit * get(OMPClause *C)
void setPreInitStmt(Stmt *S, OpenMPDirectiveKind ThisRegion=llvm::omp::OMPD_unknown)
Set pre-initialization statement for the clause.
This is a basic class for representing single OpenMP clause.
void setLocStart(SourceLocation Loc)
Sets the starting location of the clause.
child_range used_children()
Get the iterator range for the expressions used in the clauses.
llvm::iterator_range< child_iterator > child_range
void setLocEnd(SourceLocation Loc)
Sets the ending location of the clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the '#pragma omp ...' directive.
This represents 'compare' clause in the '#pragma omp atomic' directive.
This represents the 'contains' clause in the '#pragma omp assume' directive.
static OMPContainsClause * CreateEmpty(const ASTContext &C, unsigned NumKinds)
static OMPContainsClause * Create(const ASTContext &C, ArrayRef< OpenMPDirectiveKind > DKVec, SourceLocation Loc, SourceLocation LLoc, SourceLocation RLoc)
This represents clause 'copyin' in the '#pragma omp ...' directives.
static OMPCopyinClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps)
Creates clause with a list of variables VL.
static OMPCopyinClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
static OMPCopyprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps)
Creates clause with a list of variables VL.
static OMPCopyprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'default' clause in the '#pragma omp ...' directive.
This represents 'defaultmap' clause in the '#pragma omp ...' directive.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
static OMPDependClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, DependDataTy Data, Expr *DepModifier, ArrayRef< Expr * > VL, unsigned NumLoops)
Creates clause with a list of variables VL.
Expr * getModifier()
Return optional depend modifier.
Expr * getLoopData(unsigned NumLoop)
Get the loop data.
void setLoopData(unsigned NumLoop, Expr *Cnt)
Set the loop data for the depend clauses with 'sink|source' kind of dependency.
static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)
Creates an empty clause with N variables.
OpenMPDependClauseKind getDependencyKind() const
Get dependency type.
This represents implicit clause 'depobj' for the '#pragma omp depobj' directive.
static OMPDepobjClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Depobj)
Creates clause.
static OMPDepobjClause * CreateEmpty(const ASTContext &C)
Creates an empty clause.
This represents 'destroy' clause in the '#pragma omp depobj' directive or the '#pragma omp interop' d...
This represents 'detach' clause in the '#pragma omp task' directive.
This represents 'device' clause in the '#pragma omp ...' directive.
void setDirectiveKinds(ArrayRef< OpenMPDirectiveKind > DK)
This represents 'dist_schedule' clause in the '#pragma omp ...' directive.
This represents the 'doacross' clause for the '#pragma omp ordered' directive.
void setLoopData(unsigned NumLoop, Expr *Cnt)
Set the loop data.
Expr * getLoopData(unsigned NumLoop)
Get the loop data.
static OMPDoacrossClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VL, unsigned NumLoops)
Creates clause with a list of expressions VL.
static OMPDoacrossClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)
Creates an empty clause with N expressions.
This represents 'dynamic_allocators' clause in the '#pragma omp requires' directive.
This represents clause 'exclusive' in the '#pragma omp scan' directive.
static OMPExclusiveClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static OMPExclusiveClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
This represents 'fail' clause in the '#pragma omp atomic' directive.
This represents 'filter' clause in the '#pragma omp ...' directive.
This represents 'final' clause in the '#pragma omp ...' directive.
child_range used_children()
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
static OMPFirstprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PrivateVL, ArrayRef< Expr * > InitVL, Stmt *PreInit)
Creates clause with a list of variables VL.
static OMPFirstprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
static OMPFlushClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
static OMPFlushClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
This represents clause 'from' in the '#pragma omp ...' directives.
static OMPFromClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
static OMPFromClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef< Expr * > UDMapperRefs, ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId)
Creates clause with a list of variables Vars.
Representation of the 'full' clause of the '#pragma omp unroll' directive.
static OMPFullClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc)
Build an AST node for a 'full' clause.
static OMPFullClause * CreateEmpty(const ASTContext &C)
Build an empty 'full' AST node for deserialization.
This represents 'grainsize' clause in the '#pragma omp ...' directive.
child_range used_children()
This represents clause 'has_device_ptr' in the '#pragma omp ...' directives.
static OMPHasDeviceAddrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
static OMPHasDeviceAddrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents 'hint' clause in the '#pragma omp ...' directive.
This represents the 'holds' clause in the '#pragma omp assume' directive.
This represents 'if' clause in the '#pragma omp ...' directive.
child_range used_children()
This represents clause 'in_reduction' in the '#pragma omp task' directives.
static OMPInReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static OMPInReductionClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, ArrayRef< Expr * > Privates, ArrayRef< Expr * > LHSExprs, ArrayRef< Expr * > RHSExprs, ArrayRef< Expr * > ReductionOps, ArrayRef< Expr * > TaskgroupDescriptors, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL.
This represents clause 'inclusive' in the '#pragma omp scan' directive.
static OMPInclusiveClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
static OMPInclusiveClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents the 'init' clause in '#pragma omp ...' directives.
static OMPInitClause * Create(const ASTContext &C, Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Creates a fully specified clause.
static OMPInitClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N expressions.
This represents clause 'is_device_ptr' in the '#pragma omp ...' directives.
static OMPIsDevicePtrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
static OMPIsDevicePtrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
static OMPLastprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
void setPrivateCopies(ArrayRef< Expr * > PrivateCopies)
Set list of helper expressions, required for generation of private copies of original lastprivate var...
static OMPLastprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL.
This represents clause 'linear' in the '#pragma omp ...' directives.
child_range used_children()
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
void setUpdates(ArrayRef< Expr * > UL)
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 setUsedExprs(ArrayRef< Expr * > UE)
Sets the list of used expressions for the linear clause.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
This represents clause 'map' in the '#pragma omp ...' directives.
static OMPMapClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef< Expr * > UDMapperRefs, Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapModifiers, ArrayRef< SourceLocation > MapModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId, OpenMPMapClauseKind Type, bool TypeIsImplicit, SourceLocation TypeLoc)
Creates clause with a list of variables VL.
static OMPMapClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars original expressions, NumUniqueDeclarations declar...
void setUDMapperRefs(ArrayRef< Expr * > DMDs)
Set the user-defined mappers that are in the trailing objects of the class.
void setClauseInfo(ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)
Fill the clause information from the list of declarations and associated component lists.
This represents 'mergeable' clause in the '#pragma omp ...' directive.
This represents the 'message' clause in the '#pragma omp error' and the '#pragma omp parallel' direct...
This represents the 'no_openmp' clause in the '#pragma omp assume' directive.
This represents the 'no_openmp_constructs' clause in the.
This represents the 'no_openmp_routines' clause in the '#pragma omp assume' directive.
This represents the 'no_parallelism' clause in the '#pragma omp assume' directive.
This represents 'nocontext' clause in the '#pragma omp ...' directive.
child_range used_children()
This represents 'nogroup' clause in the '#pragma omp ...' directive.
This represents clause 'nontemporal' in the '#pragma omp ...' directives.
static OMPNontemporalClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static OMPNontemporalClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
void setPrivateRefs(ArrayRef< Expr * > VL)
Sets the list of references to private copies created in private clauses.
This represents 'novariants' clause in the '#pragma omp ...' directive.
child_range used_children()
This represents 'nowait' clause in the '#pragma omp ...' directive.
This represents 'num_tasks' clause in the '#pragma omp ...' directive.
child_range used_children()
This represents 'num_teams' clause in the '#pragma omp ...' directive.
static OMPNumTeamsClause * Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, Stmt *PreInit)
Creates clause with a list of variables VL.
static OMPNumTeamsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'num_threads' clause in the '#pragma omp ...' directive.
llvm::iterator_range< child_iterator > child_range
This represents 'order' clause in the '#pragma omp ...' directive.
This represents 'ordered' clause in the '#pragma omp ...' directive.
void setLoopCounter(unsigned NumLoop, Expr *Counter)
Set loop counter for the specified loop.
void setLoopNumIterations(unsigned NumLoop, Expr *NumIterations)
Set number of iterations for the specified loop.
ArrayRef< Expr * > getLoopNumIterations() const
Get number of iterations for all the loops.
static OMPOrderedClause * Create(const ASTContext &C, Expr *Num, unsigned NumLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'ordered' clause.
static OMPOrderedClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty clause.
Expr * getLoopCounter(unsigned NumLoop)
Get loops counter for the specified loop.
Representation of the 'partial' clause of the '#pragma omp unroll' directive.
static OMPPartialClause * CreateEmpty(const ASTContext &C)
Build an empty 'partial' AST node for deserialization.
static OMPPartialClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Factor)
Build an AST node for a 'partial' clause.
This class represents the 'permutation' clause in the '#pragma omp interchange' directive.
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
static OMPPermutationClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty 'permutation' AST node for deserialization.
static OMPPermutationClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > Args)
Build a 'permutation' clause AST node.
This represents 'priority' clause in the '#pragma omp ...' directive.
child_range used_children()
This represents clause 'private' in the '#pragma omp ...' directives.
static OMPPrivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PrivateVL)
Creates clause with a list of variables VL.
static OMPPrivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
This represents 'read' clause in the '#pragma omp atomic' directive.
This represents clause 'reduction' in the '#pragma omp ...' directives.
static OMPReductionClause * CreateEmpty(const ASTContext &C, unsigned N, OpenMPReductionClauseModifier Modifier)
Creates an empty clause with the place for N variables.
static OMPReductionClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, OpenMPReductionClauseModifier Modifier, ArrayRef< Expr * > VL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, ArrayRef< Expr * > Privates, ArrayRef< Expr * > LHSExprs, ArrayRef< Expr * > RHSExprs, ArrayRef< Expr * > ReductionOps, ArrayRef< Expr * > CopyOps, ArrayRef< Expr * > CopyArrayTemps, ArrayRef< Expr * > CopyArrayElems, Stmt *PreInit, Expr *PostUpdate, ArrayRef< bool > IsPrivateVarReduction, OpenMPOriginalSharingModifier OriginalSharingModifier)
Creates clause with a list of variables VL.
This represents 'relaxed' clause in the '#pragma omp atomic' directives.
This represents 'release' clause in the '#pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the '#pragma omp requires' directive.
This represents 'simd' clause in the '#pragma omp ...' directive.
This represents 'safelen' clause in the '#pragma omp ...' directive.
This represents 'schedule' clause in the '#pragma omp ...' directive.
This represents 'self_maps' clause in the '#pragma omp requires' directive.
This represents 'seq_cst' clause in the '#pragma omp atomic|flush' directives.
This represents the 'severity' clause in the '#pragma omp error' and the '#pragma omp parallel' direc...
This represents clause 'shared' in the '#pragma omp ...' directives.
static OMPSharedClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
static OMPSharedClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'simdlen' clause in the '#pragma omp ...' directive.
This represents the 'sizes' clause in the '#pragma omp tile' directive.
static OMPSizesClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > Sizes)
Build a 'sizes' AST node.
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
void setSizesRefs(ArrayRef< Expr * > VL)
Sets the tile size expressions.
static OMPSizesClause * CreateEmpty(const ASTContext &C, unsigned NumSizes)
Build an empty 'sizes' AST node for deserialization.
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
static OMPTaskReductionClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, ArrayRef< Expr * > Privates, ArrayRef< Expr * > LHSExprs, ArrayRef< Expr * > RHSExprs, ArrayRef< Expr * > ReductionOps, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL.
static OMPTaskReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
static OMPThreadLimitClause * Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, Stmt *PreInit)
Creates clause with a list of variables VL.
static OMPThreadLimitClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents 'threads' clause in the '#pragma omp ...' directive.
This represents clause 'to' in the '#pragma omp ...' directives.
static OMPToClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
static OMPToClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef< Expr * > UDMapperRefs, ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId)
Creates clause with a list of variables Vars.
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
std::string getMangledName() const
Return a string representation identifying this context selector.
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const
Print a human readable representation into OS.
void getAsVariantMatchInfo(ASTContext &ASTCtx, llvm::omp::VariantMatchInfo &VMI) const
Create a variant match info object from this trait info object.
llvm::SmallVector< OMPTraitSet, 2 > Sets
The outermost level of selector sets.
This represents 'unified_address' clause in the '#pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the '#pragma omp requires' directive.
This represents 'untied' clause in the '#pragma omp ...' directive.
This represents 'update' clause in the '#pragma omp atomic' directive.
static OMPUpdateClause * CreateEmpty(const ASTContext &C, bool IsExtended)
Creates an empty clause with the place for N variables.
static OMPUpdateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc)
Creates clause for 'atomic' directive.
This represents the 'use' clause in '#pragma omp ...' directives.
This represents clause 'use_device_addr' in the '#pragma omp ...' directives.
static OMPUseDeviceAddrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
static OMPUseDeviceAddrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
static OMPUseDevicePtrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< Expr * > PrivateVars, ArrayRef< Expr * > Inits, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
static OMPUseDevicePtrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'uses_allocators' in the '#pragma omp target'-based directives.
OMPUsesAllocatorsClause::Data getAllocatorData(unsigned I) const
Returns data for the specified allocator.
static OMPUsesAllocatorsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N allocators.
static OMPUsesAllocatorsClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< OMPUsesAllocatorsClause::Data > Data)
Creates clause with a list of allocators Data.
MutableArrayRef< Expr * > getVarRefs()
Fetches list of variables associated with this clause.
varlist_iterator varlist_end()
unsigned varlist_size() const
void setVarRefs(ArrayRef< Expr * > VL)
Sets the list of variables for this clause.
This represents 'weak' clause in the '#pragma omp atomic' directives.
This represents 'write' clause in the '#pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the '#pragma omp target teams ...' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the '#pragma omp target ...' directive.
Smart pointer class that efficiently represents Objective-C method names.
Encodes a location in the source.
Stmt - This represents one statement.
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
virtual bool isValidFeatureName(StringRef Feature) const
Determine whether this TargetInfo supports the given feature.
Base wrapper for a particular "section" of type source info.
The base class of the type hierarchy.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
@ OMPC_ORDER_MODIFIER_unknown
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
@ DeviceNum
'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
@ OMPC_SCHEDULE_MODIFIER_unknown
const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
static constexpr unsigned NumberOfOMPMapClauseModifiers
Number of allowed map-type-modifiers.
@ Property
The type of a property.
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ OMPC_LASTPRIVATE_unknown
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
static constexpr unsigned NumberOfOMPMotionModifiers
Number of allowed motion-modifiers.
@ OMPC_MOTION_MODIFIER_unknown
@ OMPC_DEFAULTMAP_unknown
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
const FunctionProtoType * T
OpenMPNumThreadsClauseModifier
@ OMPC_NUMTHREADS_unknown
const char * getOperatorSpelling(OverloadedOperatorKind Operator)
Retrieve the spelling of the given overloaded operator, without the preceding "operator" keyword.
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
@ OMPC_MAP_MODIFIER_unknown
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Diagnostic wrappers for TextAPI types for error reporting.
int const char * function
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
llvm::SmallVector< Expr *, 4 > PreferTypes
This structure contains all sizes needed for by an OMPMappableExprListClause.
unsigned NumComponentLists
Number of component lists.
unsigned NumVars
Number of expressions listed.
unsigned NumUniqueDeclarations
Number of unique base declarations.
unsigned NumComponents
Total number of expression components.
Data for list of allocators.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
This structure contains most locations needed for by an OMPVarListClause.
Describes how types, statements, expressions, and declarations should be printed.
TargetOMPContext(ASTContext &ASTCtx, std::function< void(StringRef)> &&DiagUnknownTrait, const FunctionDecl *CurrentFunctionDecl, ArrayRef< llvm::omp::TraitProperty > ConstructTraits, int DeviceNum)
bool matchesISATrait(StringRef RawString) const override
See llvm::omp::OMPContext::matchesISATrait.