23#include "llvm/ADT/Sequence.h"
24#include "llvm/ADT/SmallPtrSet.h"
25#include "llvm/Support/ErrorHandling.h"
38#define GEN_CLANG_CLAUSE_CLASS
39#define CLAUSE_CLASS(Enum, Str, Class) \
41 return static_cast<Class *>(this)->children();
42#include "llvm/Frontend/OpenMP/OMP.inc"
44 llvm_unreachable(
"unknown OMPClause");
49#define GEN_CLANG_CLAUSE_CLASS
50#define CLAUSE_CLASS(Enum, Str, Class) \
52 return static_cast<Class *>(this)->used_children();
53#define CLAUSE_NO_CLASS(Enum, Str) \
56#include "llvm/Frontend/OpenMP/OMP.inc"
58 llvm_unreachable(
"unknown OMPClause");
67 switch (
C->getClauseKind()) {
69 return static_cast<const OMPScheduleClause *
>(
C);
70 case OMPC_dist_schedule:
72 case OMPC_firstprivate:
73 return static_cast<const OMPFirstprivateClause *
>(
C);
74 case OMPC_lastprivate:
75 return static_cast<const OMPLastprivateClause *
>(
C);
77 return static_cast<const OMPReductionClause *
>(
C);
78 case OMPC_task_reduction:
79 return static_cast<const OMPTaskReductionClause *
>(
C);
80 case OMPC_in_reduction:
81 return static_cast<const OMPInReductionClause *
>(
C);
83 return static_cast<const OMPLinearClause *
>(
C);
86 case OMPC_num_threads:
90 case OMPC_thread_limit:
102 case OMPC_novariants:
108 case OMPC_ompx_dyn_cgroup_mem:
110 case OMPC_dyn_groupprivate:
113 return static_cast<const OMPMessageClause *
>(
C);
114 case OMPC_transparent:
115 return static_cast<const OMPTransparentClause *
>(
C);
128 case OMPC_copyprivate:
134 case OMPC_threadprivate:
135 case OMPC_groupprivate:
155 case OMPC_defaultmap:
160 case OMPC_use_device_ptr:
161 case OMPC_use_device_addr:
162 case OMPC_is_device_ptr:
163 case OMPC_has_device_addr:
164 case OMPC_unified_address:
165 case OMPC_unified_shared_memory:
166 case OMPC_reverse_offload:
167 case OMPC_dynamic_allocators:
168 case OMPC_atomic_default_mem_order:
172 case OMPC_device_type:
174 case OMPC_nontemporal:
180 case OMPC_uses_allocators:
199 switch (
C->getClauseKind()) {
200 case OMPC_lastprivate:
201 return static_cast<const OMPLastprivateClause *
>(
C);
203 return static_cast<const OMPReductionClause *
>(
C);
204 case OMPC_task_reduction:
205 return static_cast<const OMPTaskReductionClause *
>(
C);
206 case OMPC_in_reduction:
207 return static_cast<const OMPInReductionClause *
>(
C);
209 return static_cast<const OMPLinearClause *
>(
C);
211 case OMPC_dist_schedule:
212 case OMPC_firstprivate:
217 case OMPC_num_threads:
228 case OMPC_copyprivate:
233 case OMPC_threadprivate:
234 case OMPC_groupprivate:
254 case OMPC_thread_limit:
260 case OMPC_defaultmap:
265 case OMPC_use_device_ptr:
266 case OMPC_use_device_addr:
267 case OMPC_is_device_ptr:
268 case OMPC_has_device_addr:
269 case OMPC_unified_address:
270 case OMPC_unified_shared_memory:
271 case OMPC_reverse_offload:
272 case OMPC_dynamic_allocators:
273 case OMPC_atomic_default_mem_order:
278 case OMPC_device_type:
280 case OMPC_nontemporal:
283 case OMPC_novariants:
288 case OMPC_uses_allocators:
305 if (
auto *DS = dyn_cast<DeclStmt>(S)) {
306 assert(DS->isSingleDecl() &&
"Only single expression must be captured.");
307 if (
auto *OED = dyn_cast<OMPCapturedExprDecl>(DS->getSingleDecl()))
308 return OED->getInitAddress();
327 return child_range(
C,
C + 1);
328 return child_range(&Grainsize, &Grainsize + 1);
333 return child_range(
C,
C + 1);
334 return child_range(&NumTasks, &NumTasks + 1);
345 return child_range(
C,
C + 1);
346 return child_range(&Priority, &Priority + 1);
351 return child_range(
C,
C + 1);
357 return child_range(
C,
C + 1);
366 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops));
368 new (Mem) OMPOrderedClause(
Num, NumLoops, StartLoc, LParenLoc, EndLoc);
369 for (
unsigned I = 0; I < NumLoops; ++I) {
370 Clause->setLoopNumIterations(I,
nullptr);
371 Clause->setLoopCounter(I,
nullptr);
376OMPOrderedClause *OMPOrderedClause::CreateEmpty(
const ASTContext &
C,
378 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops));
379 auto *Clause =
new (Mem) OMPOrderedClause(NumLoops);
380 for (
unsigned I = 0; I < NumLoops; ++I) {
381 Clause->setLoopNumIterations(I,
nullptr);
382 Clause->setLoopCounter(I,
nullptr);
387void OMPOrderedClause::setLoopNumIterations(
unsigned NumLoop,
388 Expr *NumIterations) {
389 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
390 getTrailingObjects()[NumLoop] = NumIterations;
394 return getTrailingObjects(NumberOfLoops);
397void OMPOrderedClause::setLoopCounter(
unsigned NumLoop,
Expr *Counter) {
398 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
399 getTrailingObjects()[NumberOfLoops + NumLoop] = Counter;
402Expr *OMPOrderedClause::getLoopCounter(
unsigned NumLoop) {
403 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
404 return getTrailingObjects()[NumberOfLoops + NumLoop];
407const Expr *OMPOrderedClause::getLoopCounter(
unsigned NumLoop)
const {
408 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
409 return getTrailingObjects()[NumberOfLoops + NumLoop];
412OMPUpdateDependObjectsClause *OMPUpdateDependObjectsClause::Create(
417 C.Allocate(totalSizeToAlloc<SourceLocation, OpenMPDependClauseKind>(2, 1),
418 alignof(OMPUpdateDependObjectsClause));
419 auto *Clause =
new (Mem) OMPUpdateDependObjectsClause(StartLoc, EndLoc);
420 Clause->setLParenLoc(LParenLoc);
421 Clause->setArgumentLoc(ArgumentLoc);
422 Clause->setDependencyKind(DK);
426OMPUpdateDependObjectsClause *
427OMPUpdateDependObjectsClause::CreateEmpty(
const ASTContext &
C) {
429 C.Allocate(totalSizeToAlloc<SourceLocation, OpenMPDependClauseKind>(2, 1),
430 alignof(OMPUpdateDependObjectsClause));
431 auto *Clause =
new (Mem) OMPUpdateDependObjectsClause();
436 assert(VL.size() == varlist_size() &&
437 "Number of private copies is not the same as the preallocated buffer");
438 llvm::copy(VL, varlist_end());
446 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
447 OMPPrivateClause *Clause =
448 new (Mem) OMPPrivateClause(StartLoc, LParenLoc, EndLoc, VL.size());
449 Clause->setVarRefs(VL);
450 Clause->setPrivateCopies(PrivateVL);
454OMPPrivateClause *OMPPrivateClause::CreateEmpty(
const ASTContext &
C,
456 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * N));
457 return new (Mem) OMPPrivateClause(N);
461 assert(VL.size() == varlist_size() &&
462 "Number of private copies is not the same as the preallocated buffer");
463 llvm::copy(VL, varlist_end());
467 assert(VL.size() == varlist_size() &&
468 "Number of inits is not the same as the preallocated buffer");
469 llvm::copy(VL, getPrivateCopies().end());
472OMPFirstprivateClause *
477 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(3 * VL.size()));
478 OMPFirstprivateClause *Clause =
479 new (Mem) OMPFirstprivateClause(StartLoc, LParenLoc, EndLoc, VL.size());
480 Clause->setVarRefs(VL);
481 Clause->setPrivateCopies(PrivateVL);
482 Clause->setInits(InitVL);
483 Clause->setPreInitStmt(PreInit);
487OMPFirstprivateClause *OMPFirstprivateClause::CreateEmpty(
const ASTContext &
C,
489 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(3 * N));
490 return new (Mem) OMPFirstprivateClause(N);
493void OMPLastprivateClause::setPrivateCopies(
ArrayRef<Expr *> PrivateCopies) {
494 assert(PrivateCopies.size() == varlist_size() &&
495 "Number of private copies is not the same as the preallocated buffer");
496 llvm::copy(PrivateCopies, varlist_end());
500 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
501 "not the same as the "
502 "preallocated buffer");
503 llvm::copy(SrcExprs, getPrivateCopies().end());
507 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
508 "expressions is not the same as "
509 "the preallocated buffer");
510 llvm::copy(DstExprs, getSourceExprs().end());
513void OMPLastprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
514 assert(AssignmentOps.size() == varlist_size() &&
515 "Number of assignment expressions is not the same as the preallocated "
517 llvm::copy(AssignmentOps, getDestinationExprs().end());
520OMPLastprivateClause *OMPLastprivateClause::Create(
526 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
527 OMPLastprivateClause *Clause =
new (Mem) OMPLastprivateClause(
528 StartLoc, LParenLoc, EndLoc, LPKind, LPKindLoc, ColonLoc, VL.size());
529 Clause->setVarRefs(VL);
530 Clause->setSourceExprs(SrcExprs);
531 Clause->setDestinationExprs(DstExprs);
532 Clause->setAssignmentOps(AssignmentOps);
533 Clause->setPreInitStmt(PreInit);
534 Clause->setPostUpdateExpr(PostUpdate);
538OMPLastprivateClause *OMPLastprivateClause::CreateEmpty(
const ASTContext &
C,
540 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * N));
541 return new (Mem) OMPLastprivateClause(N);
544OMPSharedClause *OMPSharedClause::Create(
const ASTContext &
C,
549 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
550 OMPSharedClause *Clause =
551 new (Mem) OMPSharedClause(StartLoc, LParenLoc, EndLoc, VL.size());
552 Clause->setVarRefs(VL);
556OMPSharedClause *OMPSharedClause::CreateEmpty(
const ASTContext &
C,
unsigned N) {
557 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
558 return new (Mem) OMPSharedClause(N);
562 assert(PL.size() == varlist_size() &&
563 "Number of privates is not the same as the preallocated buffer");
564 llvm::copy(PL, varlist_end());
568 assert(IL.size() == varlist_size() &&
569 "Number of inits is not the same as the preallocated buffer");
574 assert(UL.size() == varlist_size() &&
575 "Number of updates is not the same as the preallocated buffer");
580 assert(FL.size() == varlist_size() &&
581 "Number of final updates is not the same as the preallocated buffer");
587 UE.size() == varlist_size() + 1 &&
588 "Number of used expressions is not the same as the preallocated buffer");
592OMPLinearClause *OMPLinearClause::Create(
602 C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2 + VL.size() + 1));
603 OMPLinearClause *Clause =
604 new (Mem) OMPLinearClause(StartLoc, LParenLoc, Modifier, ModifierLoc,
605 ColonLoc, StepModifierLoc, EndLoc, VL.size());
606 Clause->setVarRefs(VL);
607 Clause->setPrivates(PL);
608 Clause->setInits(IL);
611 std::fill(Clause->getInits().end(), Clause->getInits().end() + VL.size(),
613 std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(),
615 std::fill(Clause->getUsedExprs().begin(), Clause->getUsedExprs().end(),
617 Clause->setStep(Step);
618 Clause->setCalcStep(CalcStep);
619 Clause->setPreInitStmt(PreInit);
620 Clause->setPostUpdateExpr(PostUpdate);
624OMPLinearClause *OMPLinearClause::CreateEmpty(
const ASTContext &
C,
628 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2 + NumVars +1));
629 return new (Mem) OMPLinearClause(NumVars);
643 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
644 OMPAlignedClause *Clause =
new (Mem)
645 OMPAlignedClause(StartLoc, LParenLoc, ColonLoc, EndLoc, VL.size());
646 Clause->setVarRefs(VL);
647 Clause->setAlignment(A);
653 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumVars + 1));
654 return new (Mem) OMPAlignedClause(NumVars);
661 return new (
C) OMPAlignClause(A, StartLoc, LParenLoc, EndLoc);
665 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
666 "not the same as the "
667 "preallocated buffer");
668 llvm::copy(SrcExprs, varlist_end());
672 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
673 "expressions is not the same as "
674 "the preallocated buffer");
675 llvm::copy(DstExprs, getSourceExprs().end());
679 assert(AssignmentOps.size() == varlist_size() &&
680 "Number of assignment expressions is not the same as the preallocated "
682 llvm::copy(AssignmentOps, getDestinationExprs().end());
689 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
690 OMPCopyinClause *Clause =
691 new (Mem) OMPCopyinClause(StartLoc, LParenLoc, EndLoc, VL.size());
692 Clause->setVarRefs(VL);
693 Clause->setSourceExprs(SrcExprs);
694 Clause->setDestinationExprs(DstExprs);
695 Clause->setAssignmentOps(AssignmentOps);
700 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * N));
701 return new (Mem) OMPCopyinClause(N);
705 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
706 "not the same as the "
707 "preallocated buffer");
708 llvm::copy(SrcExprs, varlist_end());
712 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
713 "expressions is not the same as "
714 "the preallocated buffer");
715 llvm::copy(DstExprs, getSourceExprs().end());
718void OMPCopyprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
719 assert(AssignmentOps.size() == varlist_size() &&
720 "Number of assignment expressions is not the same as the preallocated "
722 llvm::copy(AssignmentOps, getDestinationExprs().end());
729 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
730 OMPCopyprivateClause *Clause =
731 new (Mem) OMPCopyprivateClause(StartLoc, LParenLoc, EndLoc, VL.size());
732 Clause->setVarRefs(VL);
733 Clause->setSourceExprs(SrcExprs);
734 Clause->setDestinationExprs(DstExprs);
735 Clause->setAssignmentOps(AssignmentOps);
741 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * N));
742 return new (Mem) OMPCopyprivateClause(N);
746 assert(
Privates.size() == varlist_size() &&
747 "Number of private copies is not the same as the preallocated buffer");
748 llvm::copy(
Privates, varlist_end());
753 LHSExprs.size() == varlist_size() &&
754 "Number of LHS expressions is not the same as the preallocated buffer");
760 RHSExprs.size() == varlist_size() &&
761 "Number of RHS expressions is not the same as the preallocated buffer");
762 llvm::copy(RHSExprs, getLHSExprs().end());
766 assert(ReductionOps.size() == varlist_size() &&
"Number of reduction "
767 "expressions is not the same "
768 "as the preallocated buffer");
769 llvm::copy(ReductionOps, getRHSExprs().end());
773 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
774 assert(Ops.size() == varlist_size() &&
"Number of copy "
775 "expressions is not the same "
776 "as the preallocated buffer");
777 llvm::copy(Ops, getReductionOps().end());
780void OMPReductionClause::setInscanCopyArrayTemps(
782 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
783 assert(CopyArrayTemps.size() == varlist_size() &&
784 "Number of copy temp expressions is not the same as the preallocated "
786 llvm::copy(CopyArrayTemps, getInscanCopyOps().end());
789void OMPReductionClause::setInscanCopyArrayElems(
791 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
792 assert(CopyArrayElems.size() == varlist_size() &&
793 "Number of copy temp expressions is not the same as the preallocated "
795 llvm::copy(CopyArrayElems, getInscanCopyArrayTemps().end());
798OMPReductionClause *OMPReductionClause::Create(
809 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, bool>(
810 (Modifier == OMPC_REDUCTION_inscan ? 8 : 5) * VL.size(), VL.size()));
811 auto *Clause =
new (Mem) OMPReductionClause(
812 StartLoc, LParenLoc, ModifierLoc, EndLoc, ColonLoc, Modifier,
813 OrignalSharingModifier, VL.size(), QualifierLoc, NameInfo);
814 Clause->setVarRefs(VL);
816 Clause->setLHSExprs(LHSExprs);
817 Clause->setRHSExprs(RHSExprs);
818 Clause->setReductionOps(ReductionOps);
819 Clause->setPreInitStmt(PreInit);
820 Clause->setPostUpdateExpr(PostUpdate);
821 Clause->setPrivateVariableReductionFlags(IsPrivateVarReduction);
822 if (Modifier == OMPC_REDUCTION_inscan) {
823 Clause->setInscanCopyOps(CopyOps);
824 Clause->setInscanCopyArrayTemps(CopyArrayTemps);
825 Clause->setInscanCopyArrayElems(CopyArrayElems);
827 assert(CopyOps.empty() &&
828 "copy operations are expected in inscan reductions only.");
829 assert(CopyArrayTemps.empty() &&
830 "copy array temps are expected in inscan reductions only.");
831 assert(CopyArrayElems.empty() &&
832 "copy array temps are expected in inscan reductions only.");
838OMPReductionClause::CreateEmpty(
const ASTContext &
C,
unsigned N,
840 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, bool>(
841 (Modifier == OMPC_REDUCTION_inscan ? 8 : 5) * N, N));
842 auto *Clause =
new (Mem) OMPReductionClause(N);
843 Clause->setModifier(Modifier);
848 assert(
Privates.size() == varlist_size() &&
849 "Number of private copies is not the same as the preallocated buffer");
850 llvm::copy(
Privates, varlist_end());
855 LHSExprs.size() == varlist_size() &&
856 "Number of LHS expressions is not the same as the preallocated buffer");
862 RHSExprs.size() == varlist_size() &&
863 "Number of RHS expressions is not the same as the preallocated buffer");
864 llvm::copy(RHSExprs, getLHSExprs().end());
867void OMPTaskReductionClause::setReductionOps(
ArrayRef<Expr *> ReductionOps) {
868 assert(ReductionOps.size() == varlist_size() &&
"Number of task reduction "
869 "expressions is not the same "
870 "as the preallocated buffer");
871 llvm::copy(ReductionOps, getRHSExprs().end());
874OMPTaskReductionClause *OMPTaskReductionClause::Create(
881 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
882 OMPTaskReductionClause *Clause =
new (Mem) OMPTaskReductionClause(
883 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
884 Clause->setVarRefs(VL);
886 Clause->setLHSExprs(LHSExprs);
887 Clause->setRHSExprs(RHSExprs);
888 Clause->setReductionOps(ReductionOps);
889 Clause->setPreInitStmt(PreInit);
890 Clause->setPostUpdateExpr(PostUpdate);
894OMPTaskReductionClause *OMPTaskReductionClause::CreateEmpty(
const ASTContext &
C,
896 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * N));
897 return new (Mem) OMPTaskReductionClause(N);
901 assert(
Privates.size() == varlist_size() &&
902 "Number of private copies is not the same as the preallocated buffer");
903 llvm::copy(
Privates, varlist_end());
908 LHSExprs.size() == varlist_size() &&
909 "Number of LHS expressions is not the same as the preallocated buffer");
915 RHSExprs.size() == varlist_size() &&
916 "Number of RHS expressions is not the same as the preallocated buffer");
917 llvm::copy(RHSExprs, getLHSExprs().end());
921 assert(ReductionOps.size() == varlist_size() &&
"Number of in reduction "
922 "expressions is not the same "
923 "as the preallocated buffer");
924 llvm::copy(ReductionOps, getRHSExprs().end());
927void OMPInReductionClause::setTaskgroupDescriptors(
929 assert(TaskgroupDescriptors.size() == varlist_size() &&
930 "Number of in reduction descriptors is not the same as the "
931 "preallocated buffer");
932 llvm::copy(TaskgroupDescriptors, getReductionOps().end());
935OMPInReductionClause *OMPInReductionClause::Create(
942 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(6 * VL.size()));
943 OMPInReductionClause *Clause =
new (Mem) OMPInReductionClause(
944 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
945 Clause->setVarRefs(VL);
947 Clause->setLHSExprs(LHSExprs);
948 Clause->setRHSExprs(RHSExprs);
949 Clause->setReductionOps(ReductionOps);
950 Clause->setTaskgroupDescriptors(TaskgroupDescriptors);
951 Clause->setPreInitStmt(PreInit);
952 Clause->setPostUpdateExpr(PostUpdate);
956OMPInReductionClause *OMPInReductionClause::CreateEmpty(
const ASTContext &
C,
958 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(6 * N));
959 return new (Mem) OMPInReductionClause(N);
968 Clause->setLocStart(StartLoc);
969 Clause->setLParenLoc(LParenLoc);
970 Clause->setLocEnd(EndLoc);
971 Clause->setSizesRefs(Sizes);
977 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumSizes));
978 return new (Mem) OMPSizesClause(NumSizes);
985 OMPCountsClause *Clause =
CreateEmpty(
C, Counts.size());
986 Clause->setLocStart(StartLoc);
987 Clause->setLParenLoc(LParenLoc);
988 Clause->setLocEnd(EndLoc);
989 Clause->setCountsRefs(Counts);
990 Clause->setOmpFillIndex(FillIdx);
991 Clause->setOmpFillLoc(FillLoc);
996 unsigned NumCounts) {
997 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumCounts));
998 return new (Mem) OMPCountsClause(NumCounts);
1006 OMPPermutationClause *Clause =
CreateEmpty(
C, Args.size());
1007 Clause->setLocStart(StartLoc);
1008 Clause->setLParenLoc(LParenLoc);
1009 Clause->setLocEnd(EndLoc);
1010 Clause->setArgRefs(Args);
1015 unsigned NumLoops) {
1016 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumLoops));
1017 return new (Mem) OMPPermutationClause(NumLoops);
1024 Clause->setLocStart(StartLoc);
1025 Clause->setLocEnd(EndLoc);
1030 return new (
C) OMPFullClause();
1039 Clause->setLocStart(StartLoc);
1040 Clause->setLParenLoc(LParenLoc);
1041 Clause->setLocEnd(EndLoc);
1042 Clause->setFactor(Factor);
1047 return new (
C) OMPPartialClause();
1056 Clause->setLocStart(StartLoc);
1057 Clause->setLParenLoc(LParenLoc);
1058 Clause->setFirstLoc(FirstLoc);
1059 Clause->setCountLoc(CountLoc);
1060 Clause->setLocEnd(EndLoc);
1061 Clause->setFirst(
First);
1062 Clause->setCount(Count);
1067 return new (
C) OMPLoopRangeClause();
1078 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1079 auto *Clause =
new (Mem) OMPAllocateClause(
1080 StartLoc, LParenLoc, Allocator, Alignment, ColonLoc, Modifier1,
1081 Modifier1Loc, Modifier2, Modifier2Loc, EndLoc, VL.size());
1083 Clause->setVarRefs(VL);
1089 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1090 return new (Mem) OMPAllocateClause(N);
1098 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1099 OMPFlushClause *Clause =
1100 new (Mem) OMPFlushClause(StartLoc, LParenLoc, EndLoc, VL.size());
1101 Clause->setVarRefs(VL);
1106 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1107 return new (Mem) OMPFlushClause(N);
1115 auto *Clause =
new (
C) OMPDepobjClause(StartLoc, LParenLoc, RParenLoc);
1116 Clause->setDepobj(Depobj);
1121 return new (
C) OMPDepobjClause();
1129 void *Mem =
C.Allocate(
1130 totalSizeToAlloc<Expr *>(VL.size() + 1 + NumLoops),
1131 alignof(OMPDependClause));
1132 OMPDependClause *Clause =
new (Mem)
1133 OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops);
1134 Clause->setDependencyKind(Data.DepKind);
1135 Clause->setDependencyLoc(Data.DepLoc);
1136 Clause->setColonLoc(Data.ColonLoc);
1137 Clause->setOmpAllMemoryLoc(Data.OmpAllMemoryLoc);
1138 Clause->setModifier(DepModifier);
1139 Clause->setVarRefs(VL);
1140 for (
unsigned I = 0 ; I < NumLoops; ++I)
1141 Clause->setLoopData(I,
nullptr);
1146 unsigned NumLoops) {
1148 C.Allocate(totalSizeToAlloc<Expr *>(N + 1 + NumLoops),
1149 alignof(OMPDependClause));
1150 return new (Mem) OMPDependClause(N, NumLoops);
1156 NumLoop < NumLoops &&
1157 "Expected sink or source depend + loop index must be less number of "
1159 auto *It = std::next(getVarRefs().end(), NumLoop + 1);
1166 NumLoop < NumLoops &&
1167 "Expected sink or source depend + loop index must be less number of "
1169 auto *It = std::next(getVarRefs().end(), NumLoop + 1);
1176 NumLoop < NumLoops &&
1177 "Expected sink or source depend + loop index must be less number of "
1179 const auto *It = std::next(getVarRefs().end(), NumLoop + 1);
1183void OMPDependClause::setModifier(
Expr *DepModifier) {
1184 *getVarRefs().end() = DepModifier;
1190 unsigned TotalNum = 0u;
1191 for (
auto &
C : ComponentLists)
1192 TotalNum +=
C.size();
1199 for (
const ValueDecl *D : Declarations) {
1201 UniqueDecls.insert(VD);
1203 return UniqueDecls.size();
1209 "Cannot get element-type from array-shaping expr.");
1223 if (
const auto *ATy = BaseType->getAsArrayTypeUnsafe())
1224 ElemTy = ATy->getElementType();
1232std::pair<const Expr *, std::optional<size_t>>
1238 if (Components.size() < 2)
1239 return {
nullptr, std::nullopt};
1244 if (Components.back().isNonContiguous() && CurDirKind == OMPD_target_update)
1245 return {
nullptr, std::nullopt};
1251 for (
auto [I, Component] : llvm::enumerate(Components)) {
1256 const Expr *CurExpr = Component.getAssociatedExpression();
1271 return {CurExpr, Components.size() - I};
1274 return {
nullptr, std::nullopt};
1301 void *Mem =
C.Allocate(
1307 OMPMapClause *Clause =
new (Mem)
1308 OMPMapClause(MapModifiers, MapModifiersLoc, UDMQualifierLoc, MapperId,
1311 Clause->setVarRefs(Vars);
1312 Clause->setUDMapperRefs(UDMapperRefs);
1313 Clause->setIteratorModifier(IteratorModifier);
1314 Clause->setClauseInfo(Declarations, ComponentLists);
1315 Clause->setMapType(
Type);
1323 void *Mem =
C.Allocate(
1329 OMPMapClause *Clause =
new (Mem) OMPMapClause(Sizes);
1330 Clause->setIteratorModifier(
nullptr);
1357 void *Mem =
C.Allocate(
1364 auto *Clause =
new (Mem) OMPToClause(MotionModifiers, MotionModifiersLoc,
1365 UDMQualifierLoc, MapperId, Locs, Sizes);
1367 Clause->setVarRefs(Vars);
1368 Clause->setUDMapperRefs(UDMapperRefs);
1369 Clause->setClauseInfo(Declarations, ComponentLists);
1370 Clause->setIteratorModifier(IteratorModifier);
1376 void *Mem =
C.Allocate(
1382 OMPToClause *Clause =
new (Mem) OMPToClause(Sizes);
1383 Clause->setIteratorModifier(
nullptr);
1410 void *Mem =
C.Allocate(
1418 new (Mem) OMPFromClause(MotionModifiers, MotionModifiersLoc,
1419 UDMQualifierLoc, MapperId, Locs, Sizes);
1421 Clause->setVarRefs(Vars);
1422 Clause->setUDMapperRefs(UDMapperRefs);
1423 Clause->setClauseInfo(Declarations, ComponentLists);
1424 Clause->setIteratorModifier(IteratorModifier);
1431 void *Mem =
C.Allocate(
1437 OMPFromClause *Clause =
new (Mem) OMPFromClause(Sizes);
1438 Clause->setIteratorModifier(
nullptr);
1443 assert(VL.size() == varlist_size() &&
1444 "Number of private copies is not the same as the preallocated buffer");
1445 llvm::copy(VL, varlist_end());
1449 assert(VL.size() == varlist_size() &&
1450 "Number of inits is not the same as the preallocated buffer");
1451 llvm::copy(VL, getPrivateCopies().end());
1477 void *Mem =
C.Allocate(
1484 OMPUseDevicePtrClause *Clause =
new (Mem)
1485 OMPUseDevicePtrClause(Locs, Sizes, FallbackModifier, FallbackModifierLoc);
1487 Clause->setVarRefs(Vars);
1488 Clause->setPrivateCopies(PrivateVars);
1489 Clause->setInits(
Inits);
1490 Clause->setClauseInfo(Declarations, ComponentLists);
1497 void *Mem =
C.Allocate(
1503 return new (Mem) OMPUseDevicePtrClause(Sizes);
1527 void *Mem =
C.Allocate(
1534 auto *Clause =
new (Mem) OMPUseDeviceAddrClause(Locs, Sizes);
1536 Clause->setVarRefs(Vars);
1537 Clause->setClauseInfo(Declarations, ComponentLists);
1544 void *Mem =
C.Allocate(
1550 return new (Mem) OMPUseDeviceAddrClause(Sizes);
1574 void *Mem =
C.Allocate(
1581 OMPIsDevicePtrClause *Clause =
new (Mem) OMPIsDevicePtrClause(Locs, Sizes);
1583 Clause->setVarRefs(Vars);
1584 Clause->setClauseInfo(Declarations, ComponentLists);
1591 void *Mem =
C.Allocate(
1597 return new (Mem) OMPIsDevicePtrClause(Sizes);
1621 void *Mem =
C.Allocate(
1628 auto *Clause =
new (Mem) OMPHasDeviceAddrClause(Locs, Sizes);
1630 Clause->setVarRefs(Vars);
1631 Clause->setClauseInfo(Declarations, ComponentLists);
1638 void *Mem =
C.Allocate(
1644 return new (Mem) OMPHasDeviceAddrClause(Sizes);
1653 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
1655 new (Mem) OMPNontemporalClause(StartLoc, LParenLoc, EndLoc, VL.size());
1656 Clause->setVarRefs(VL);
1662 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * N));
1663 return new (Mem) OMPNontemporalClause(N);
1667 assert(VL.size() == varlist_size() &&
"Number of private references is not "
1668 "the same as the preallocated buffer");
1669 llvm::copy(VL, varlist_end());
1677 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1679 new (Mem) OMPInclusiveClause(StartLoc, LParenLoc, EndLoc, VL.size());
1680 Clause->setVarRefs(VL);
1686 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1687 return new (Mem) OMPInclusiveClause(N);
1695 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1697 new (Mem) OMPExclusiveClause(StartLoc, LParenLoc, EndLoc, VL.size());
1698 Clause->setVarRefs(VL);
1704 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1705 return new (Mem) OMPExclusiveClause(N);
1708void OMPUsesAllocatorsClause::setAllocatorsData(
1710 assert(
Data.size() == NumOfAllocators &&
1711 "Size of allocators data is not the same as the preallocated buffer.");
1712 for (
unsigned I = 0, E =
Data.size(); I < E; ++I) {
1714 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1715 static_cast<int>(ExprOffsets::Allocator)] =
1717 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1719 ExprOffsets::AllocatorTraits)] =
1722 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1723 static_cast<int>(ParenLocsOffsets::LParen)] =
1726 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1727 static_cast<int>(ParenLocsOffsets::RParen)] =
1732OMPUsesAllocatorsClause::Data
1736 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1737 static_cast<int>(ExprOffsets::Allocator)];
1739 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1741 ExprOffsets::AllocatorTraits)];
1743 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1744 static_cast<int>(ParenLocsOffsets::LParen)];
1746 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1747 static_cast<int>(ParenLocsOffsets::RParen)];
1755 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, SourceLocation>(
1756 static_cast<int>(ExprOffsets::Total) *
Data.size(),
1757 static_cast<int>(ParenLocsOffsets::Total) *
Data.size()));
1758 auto *Clause =
new (Mem)
1759 OMPUsesAllocatorsClause(StartLoc, LParenLoc, EndLoc,
Data.size());
1760 Clause->setAllocatorsData(
Data);
1766 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, SourceLocation>(
1767 static_cast<int>(ExprOffsets::Total) * N,
1768 static_cast<int>(ParenLocsOffsets::Total) * N));
1769 return new (Mem) OMPUsesAllocatorsClause(N);
1777 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(Locators.size() + 1));
1778 auto *Clause =
new (Mem)
1779 OMPAffinityClause(StartLoc, LParenLoc, ColonLoc, EndLoc, Locators.size());
1780 Clause->setModifier(Modifier);
1781 Clause->setVarRefs(Locators);
1787 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1788 return new (Mem) OMPAffinityClause(N);
1798 unsigned NumPrefs = InteropInfo.
Prefs.size();
1799 unsigned NumAttrs = 0;
1801 NumAttrs += P.
Attrs.size();
1804 void *Mem =
C.Allocate(
1805 totalSizeToAlloc<Expr *, unsigned>(1 + NumPrefs + NumAttrs, NumPrefs));
1806 auto *Clause =
new (Mem)
1808 LParenLoc, VarLoc, EndLoc, 1 + NumPrefs);
1809 Clause->NumAttrs = NumAttrs;
1812 Expr **E = Clause->getTrailingObjects<
Expr *>();
1814 for (
unsigned I = 0; I < NumPrefs; ++I)
1815 E[1 + I] = InteropInfo.
Prefs[I].Fr;
1816 unsigned *AttrEnds = Clause->getTrailingObjects<
unsigned>();
1817 unsigned AttrBase = 1 + NumPrefs;
1818 unsigned AttrPos = AttrBase;
1819 for (
unsigned I = 0; I < NumPrefs; ++I) {
1820 for (
Expr *A : InteropInfo.
Prefs[I].Attrs)
1822 AttrEnds[I] = AttrPos - AttrBase;
1829 unsigned NumAttrs) {
1830 void *Mem =
C.Allocate(
1831 totalSizeToAlloc<Expr *, unsigned>(1 + NumPrefs + NumAttrs, NumPrefs));
1832 auto *Clause =
new (Mem) OMPInitClause(1 + NumPrefs);
1833 Clause->NumAttrs = NumAttrs;
1839 assert(Counts.size() == getNumPrefs() &&
1840 "attr-count vector size must match number of pref-specs");
1841 assert(Attrs.size() == NumAttrs &&
1842 "attr-expr count must match preallocated NumAttrs");
1844 unsigned *AttrEnds = getTrailingObjects<unsigned>();
1846 for (
unsigned I = 0, E = Counts.size(); I < E; ++I) {
1850 llvm::copy(Attrs, getTrailingObjects<Expr *>() + varlist_size());
1857 return new (
C) OMPBindClause(K, KLoc, StartLoc, LParenLoc, EndLoc);
1861 return new (
C) OMPBindClause();
1870 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + NumLoops),
1871 alignof(OMPDoacrossClause));
1872 OMPDoacrossClause *Clause =
new (Mem)
1873 OMPDoacrossClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops);
1874 Clause->setDependenceType(DepType);
1875 Clause->setDependenceLoc(DepLoc);
1876 Clause->setColonLoc(ColonLoc);
1877 Clause->setVarRefs(VL);
1878 for (
unsigned I = 0; I < NumLoops; ++I)
1879 Clause->setLoopData(I,
nullptr);
1885 unsigned NumLoops) {
1886 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + NumLoops),
1887 alignof(OMPDoacrossClause));
1888 return new (Mem) OMPDoacrossClause(N, NumLoops);
1892 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1893 auto *It = std::next(getVarRefs().end(), NumLoop);
1898 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1899 auto *It = std::next(getVarRefs().end(), NumLoop);
1904 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1905 const auto *It = std::next(getVarRefs().end(), NumLoop);
1909OMPAbsentClause *OMPAbsentClause::Create(
const ASTContext &
C,
1914 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(DKVec.size()),
1915 alignof(OMPAbsentClause));
1916 auto *AC =
new (Mem) OMPAbsentClause(Loc, LLoc, RLoc, DKVec.size());
1917 AC->setDirectiveKinds(DKVec);
1921OMPAbsentClause *OMPAbsentClause::CreateEmpty(
const ASTContext &
C,
unsigned K) {
1922 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(K),
1923 alignof(OMPAbsentClause));
1924 return new (Mem) OMPAbsentClause(K);
1927OMPContainsClause *OMPContainsClause::Create(
1930 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(DKVec.size()),
1931 alignof(OMPContainsClause));
1932 auto *CC =
new (Mem) OMPContainsClause(Loc, LLoc, RLoc, DKVec.size());
1933 CC->setDirectiveKinds(DKVec);
1937OMPContainsClause *OMPContainsClause::CreateEmpty(
const ASTContext &
C,
1939 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(K),
1940 alignof(OMPContainsClause));
1941 return new (Mem) OMPContainsClause(K);
1950 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1951 OMPNumTeamsClause *Clause =
1952 new (Mem) OMPNumTeamsClause(
C, StartLoc, LParenLoc, EndLoc, VL.size());
1953 Clause->setVarRefs(VL);
1954 Clause->setModifier(Modifier);
1955 Clause->setModifierExpr(ModifierExpr);
1956 Clause->setModifierLoc(ModifierLoc);
1957 Clause->setPreInitStmt(PreInit, CaptureRegion);
1964 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1965 return new (Mem) OMPNumTeamsClause(N);
1974 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1975 OMPThreadLimitClause *Clause =
1976 new (Mem) OMPThreadLimitClause(
C, StartLoc, LParenLoc, EndLoc, VL.size());
1977 Clause->setVarRefs(VL);
1978 Clause->setModifier(Modifier);
1979 Clause->setModifierExpr(ModifierExpr);
1980 Clause->setModifierLoc(ModifierLoc);
1981 Clause->setPreInitStmt(PreInit, CaptureRegion);
1988 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1989 return new (Mem) OMPThreadLimitClause(N);
1996void OMPClausePrinter::VisitOMPIfClause(
OMPIfClause *Node) {
1999 OS << getOpenMPDirectiveName(Node->
getNameModifier(), Version) <<
": ";
2004void OMPClausePrinter::VisitOMPFinalClause(
OMPFinalClause *Node) {
2011 OS <<
"num_threads(";
2021void OMPClausePrinter::VisitOMPAlignClause(
OMPAlignClause *Node) {
2039void OMPClausePrinter::VisitOMPSizesClause(
OMPSizesClause *Node) {
2045 Size->printPretty(OS,
nullptr, Policy, 0);
2055 llvm::interleaveComma(llvm::seq<unsigned>(Refs.size()), OS, [&](
unsigned I) {
2056 if (FillIdx && I == *FillIdx)
2059 Refs[I]->printPretty(OS, nullptr, Policy, 0);
2065 OS <<
"permutation(";
2067 E->printPretty(OS, nullptr, Policy, 0);
2072void OMPClausePrinter::VisitOMPFullClause(
OMPFullClause *Node) {
OS <<
"full"; }
2079 Factor->printPretty(OS,
nullptr, Policy, 0);
2090 if (
First && Count) {
2092 First->printPretty(OS,
nullptr, Policy, 0);
2111void OMPClausePrinter::VisitOMPDetachClause(OMPDetachClause *Node) {
2121 if (Version >= 60 && Node->
getDefaultVC() != OMPC_DEFAULT_VC_all) {
2136void OMPClausePrinter::VisitOMPTransparentClause(OMPTransparentClause *Node) {
2137 OS <<
"transparent(";
2138 if (Node->getImpexType())
2139 Node->getImpexType()->printPretty(OS,
nullptr, Policy, 0);
2145void OMPClausePrinter::VisitOMPProcBindClause(OMPProcBindClause *Node) {
2148 unsigned(Node->getProcBindKind()))
2152void OMPClausePrinter::VisitOMPUnifiedAddressClause(OMPUnifiedAddressClause *) {
2153 OS <<
"unified_address";
2156void OMPClausePrinter::VisitOMPUnifiedSharedMemoryClause(
2157 OMPUnifiedSharedMemoryClause *) {
2158 OS <<
"unified_shared_memory";
2161void OMPClausePrinter::VisitOMPReverseOffloadClause(OMPReverseOffloadClause *) {
2162 OS <<
"reverse_offload";
2165void OMPClausePrinter::VisitOMPDynamicAllocatorsClause(
2166 OMPDynamicAllocatorsClause *) {
2167 OS <<
"dynamic_allocators";
2170void OMPClausePrinter::VisitOMPAtomicDefaultMemOrderClause(
2171 OMPAtomicDefaultMemOrderClause *Node) {
2172 OS <<
"atomic_default_mem_order("
2174 Node->getAtomicDefaultMemOrderKind())
2178void OMPClausePrinter::VisitOMPSelfMapsClause(OMPSelfMapsClause *) {
2182void OMPClausePrinter::VisitOMPAtClause(OMPAtClause *Node) {
2187void OMPClausePrinter::VisitOMPSeverityClause(OMPSeverityClause *Node) {
2193void OMPClausePrinter::VisitOMPMessageClause(OMPMessageClause *Node) {
2195 if (
Expr *E = Node->getMessageString())
2196 E->printPretty(OS,
nullptr, Policy);
2200void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
2204 Node->getFirstScheduleModifier());
2208 Node->getSecondScheduleModifier());
2213 if (
auto *E = Node->getChunkSize()) {
2215 E->printPretty(OS,
nullptr, Policy);
2220void OMPClausePrinter::VisitOMPOrderedClause(OMPOrderedClause *Node) {
2222 if (
auto *
Num = Node->getNumForLoops()) {
2224 Num->printPretty(OS,
nullptr, Policy, 0);
2229void OMPClausePrinter::VisitOMPNowaitClause(OMPNowaitClause *Node) {
2231 if (
auto *
Cond = Node->getCondition()) {
2233 Cond->printPretty(OS,
nullptr, Policy, 0);
2238void OMPClausePrinter::VisitOMPUntiedClause(OMPUntiedClause *) {
2242void OMPClausePrinter::VisitOMPNogroupClause(OMPNogroupClause *) {
2246void OMPClausePrinter::VisitOMPMergeableClause(OMPMergeableClause *) {
2250void OMPClausePrinter::VisitOMPReadClause(OMPReadClause *) {
OS <<
"read"; }
2252void OMPClausePrinter::VisitOMPWriteClause(OMPWriteClause *) {
OS <<
"write"; }
2254void OMPClausePrinter::VisitOMPUpdateClause(OMPUpdateClause *) {
2258void OMPClausePrinter::VisitOMPUpdateDependObjectsClause(
2259 OMPUpdateDependObjectsClause *Node) {
2262 Node->getDependencyKind());
2266void OMPClausePrinter::VisitOMPCaptureClause(OMPCaptureClause *) {
2270void OMPClausePrinter::VisitOMPCompareClause(OMPCompareClause *) {
2274void OMPClausePrinter::VisitOMPFailClause(OMPFailClause *Node) {
2279 Node->getClauseKind(),
static_cast<int>(Node->getFailParameter()));
2284void OMPClausePrinter::VisitOMPAbsentClause(OMPAbsentClause *Node) {
2287 for (
auto &D : Node->getDirectiveKinds()) {
2290 OS << getOpenMPDirectiveName(D, Version);
2296void OMPClausePrinter::VisitOMPHoldsClause(OMPHoldsClause *Node) {
2298 Node->getExpr()->printPretty(OS,
nullptr, Policy, 0);
2302void OMPClausePrinter::VisitOMPContainsClause(OMPContainsClause *Node) {
2305 for (
auto &D : Node->getDirectiveKinds()) {
2308 OS << getOpenMPDirectiveName(D, Version);
2314void OMPClausePrinter::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {
2318void OMPClausePrinter::VisitOMPNoOpenMPRoutinesClause(
2319 OMPNoOpenMPRoutinesClause *) {
2320 OS <<
"no_openmp_routines";
2323void OMPClausePrinter::VisitOMPNoOpenMPConstructsClause(
2324 OMPNoOpenMPConstructsClause *) {
2325 OS <<
"no_openmp_constructs";
2328void OMPClausePrinter::VisitOMPNoParallelismClause(OMPNoParallelismClause *) {
2329 OS <<
"no_parallelism";
2332void OMPClausePrinter::VisitOMPSeqCstClause(OMPSeqCstClause *) {
2336void OMPClausePrinter::VisitOMPAcqRelClause(OMPAcqRelClause *) {
2340void OMPClausePrinter::VisitOMPAcquireClause(OMPAcquireClause *) {
2344void OMPClausePrinter::VisitOMPReleaseClause(OMPReleaseClause *) {
2348void OMPClausePrinter::VisitOMPRelaxedClause(OMPRelaxedClause *) {
2352void OMPClausePrinter::VisitOMPWeakClause(OMPWeakClause *) {
OS <<
"weak"; }
2354void OMPClausePrinter::VisitOMPThreadsClause(OMPThreadsClause *) {
2358void OMPClausePrinter::VisitOMPSIMDClause(OMPSIMDClause *) {
OS <<
"simd"; }
2360void OMPClausePrinter::VisitOMPDeviceClause(OMPDeviceClause *Node) {
2371void OMPClausePrinter::VisitOMPNumTeamsClause(OMPNumTeamsClause *Node) {
2372 if (!Node->varlist_empty()) {
2381 VisitOMPClauseList(Node,
':');
2383 VisitOMPClauseList(Node,
'(');
2389void OMPClausePrinter::VisitOMPThreadLimitClause(OMPThreadLimitClause *Node) {
2390 if (!Node->varlist_empty()) {
2391 OS <<
"thread_limit";
2392 if (Node->
getModifier() == OMPC_THREADLIMIT_dims) {
2396 VisitOMPClauseList(Node,
':');
2398 VisitOMPClauseList(Node,
'(');
2404void OMPClausePrinter::VisitOMPPriorityClause(OMPPriorityClause *Node) {
2410void OMPClausePrinter::VisitOMPGrainsizeClause(OMPGrainsizeClause *Node) {
2421void OMPClausePrinter::VisitOMPNumTasksClause(OMPNumTasksClause *Node) {
2432void OMPClausePrinter::VisitOMPHintClause(OMPHintClause *Node) {
2438void OMPClausePrinter::VisitOMPInitClause(OMPInitClause *Node) {
2440 if (!Node->
prefs().empty()) {
2441 OS <<
"prefer_type(";
2444 llvm::interleaveComma(Node->
prefs(), OS, [&](OMPInitClause::PrefView P) {
2448 P.Fr->printPretty(OS, nullptr, Policy);
2450 if (!P.Attrs.empty())
2455 llvm::interleaveComma(P.Attrs, OS, [&](const Expr *A) {
2456 A->printPretty(OS, nullptr, Policy);
2465 [&](OMPInitClause::PrefView P) {
2467 P.Fr->printPretty(OS, nullptr, Policy);
2485void OMPClausePrinter::VisitOMPUseClause(OMPUseClause *Node) {
2491void OMPClausePrinter::VisitOMPDestroyClause(OMPDestroyClause *Node) {
2495 E->printPretty(OS,
nullptr, Policy);
2500void OMPClausePrinter::VisitOMPNovariantsClause(OMPNovariantsClause *Node) {
2504 E->printPretty(OS,
nullptr, Policy, 0);
2509void OMPClausePrinter::VisitOMPNocontextClause(OMPNocontextClause *Node) {
2513 E->printPretty(OS,
nullptr, Policy, 0);
2519void OMPClausePrinter::VisitOMPClauseList(
T *Node,
char StartSym) {
2520 for (
typename T::varlist_iterator I = Node->varlist_begin(),
2521 E = Node->varlist_end();
2523 assert(*I &&
"Expected non-null Stmt");
2524 OS << (I == Node->varlist_begin() ? StartSym :
',');
2525 if (
auto *DRE = dyn_cast<DeclRefExpr>(*I)) {
2527 DRE->printPretty(OS,
nullptr, Policy, 0);
2529 DRE->getDecl()->printQualifiedName(OS);
2531 (*I)->printPretty(OS,
nullptr, Policy, 0);
2539 Expr *FirstModifier =
nullptr;
2540 Expr *SecondModifier =
nullptr;
2545 if (FirstAllocMod == OMPC_ALLOCATE_allocator ||
2556 if (FirstModifier) {
2558 if (!FirstUnknown) {
2562 FirstModifier->
printPretty(OS,
nullptr, Policy, 0);
2565 if (SecondModifier) {
2567 if (!SecondUnknown) {
2572 SecondModifier->
printPretty(OS,
nullptr, Policy, 0);
2577 VisitOMPClauseList(Node,
' ');
2580 VisitOMPClauseList(Node,
'(');
2585void OMPClausePrinter::VisitOMPPrivateClause(OMPPrivateClause *Node) {
2586 if (!Node->varlist_empty()) {
2588 VisitOMPClauseList(Node,
'(');
2593void OMPClausePrinter::VisitOMPFirstprivateClause(OMPFirstprivateClause *Node) {
2594 if (!Node->varlist_empty()) {
2595 OS <<
"firstprivate";
2596 VisitOMPClauseList(Node,
'(');
2601void OMPClausePrinter::VisitOMPLastprivateClause(OMPLastprivateClause *Node) {
2602 if (!Node->varlist_empty()) {
2603 OS <<
"lastprivate";
2615void OMPClausePrinter::VisitOMPSharedClause(OMPSharedClause *Node) {
2616 if (!Node->varlist_empty()) {
2618 VisitOMPClauseList(Node,
'(');
2623void OMPClausePrinter::VisitOMPReductionClause(OMPReductionClause *Node) {
2624 if (!Node->varlist_empty()) {
2626 if (Node->getModifierLoc().isValid())
2630 Node->getQualifierLoc().getNestedNameSpecifier();
2632 Node->getNameInfo().getName().getCXXOverloadedOperator();
2633 if (!Qualifier && OOK !=
OO_None) {
2639 OS << Node->getNameInfo();
2642 VisitOMPClauseList(Node,
' ');
2647void OMPClausePrinter::VisitOMPTaskReductionClause(
2648 OMPTaskReductionClause *Node) {
2649 if (!Node->varlist_empty()) {
2650 OS <<
"task_reduction(";
2652 Node->getQualifierLoc().getNestedNameSpecifier();
2654 Node->getNameInfo().getName().getCXXOverloadedOperator();
2655 if (!Qualifier && OOK !=
OO_None) {
2661 OS << Node->getNameInfo();
2664 VisitOMPClauseList(Node,
' ');
2669void OMPClausePrinter::VisitOMPInReductionClause(OMPInReductionClause *Node) {
2670 if (!Node->varlist_empty()) {
2671 OS <<
"in_reduction(";
2673 Node->getQualifierLoc().getNestedNameSpecifier();
2675 Node->getNameInfo().getName().getCXXOverloadedOperator();
2676 if (!Qualifier && OOK !=
OO_None) {
2682 OS << Node->getNameInfo();
2685 VisitOMPClauseList(Node,
' ');
2690void OMPClausePrinter::VisitOMPLinearClause(OMPLinearClause *Node) {
2691 if (!Node->varlist_empty()) {
2693 VisitOMPClauseList(Node,
'(');
2694 if (Node->getModifierLoc().isValid() || Node->getStep() !=
nullptr) {
2697 if (Node->getModifierLoc().isValid()) {
2700 if (Node->getStep() !=
nullptr) {
2701 if (Node->getModifierLoc().isValid()) {
2705 Node->getStep()->printPretty(OS,
nullptr, Policy, 0);
2712void OMPClausePrinter::VisitOMPAlignedClause(OMPAlignedClause *Node) {
2713 if (!Node->varlist_empty()) {
2715 VisitOMPClauseList(Node,
'(');
2724void OMPClausePrinter::VisitOMPCopyinClause(OMPCopyinClause *Node) {
2725 if (!Node->varlist_empty()) {
2727 VisitOMPClauseList(Node,
'(');
2732void OMPClausePrinter::VisitOMPCopyprivateClause(OMPCopyprivateClause *Node) {
2733 if (!Node->varlist_empty()) {
2734 OS <<
"copyprivate";
2735 VisitOMPClauseList(Node,
'(');
2740void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) {
2741 if (!Node->varlist_empty()) {
2742 VisitOMPClauseList(Node,
'(');
2747void OMPClausePrinter::VisitOMPDepobjClause(OMPDepobjClause *Node) {
2753void OMPClausePrinter::VisitOMPDependClause(OMPDependClause *Node) {
2761 bool IsOmpAllMemory =
false;
2762 if (PrintKind == OMPC_DEPEND_outallmemory) {
2763 PrintKind = OMPC_DEPEND_out;
2764 IsOmpAllMemory =
true;
2765 }
else if (PrintKind == OMPC_DEPEND_inoutallmemory) {
2766 PrintKind = OMPC_DEPEND_inout;
2767 IsOmpAllMemory =
true;
2770 if (!Node->varlist_empty() || IsOmpAllMemory)
2772 VisitOMPClauseList(Node,
' ');
2773 if (IsOmpAllMemory) {
2774 OS << (Node->varlist_empty() ?
" " :
",");
2775 OS <<
"omp_all_memory";
2780template <
typename T>
2785 Node->getMapperQualifierLoc().getNestedNameSpecifier();
2786 MapperNNS.
print(OS, Policy);
2787 OS << Node->getMapperIdInfo() <<
')';
2790template <
typename T>
2793 if (
Expr *IteratorModifier = Node->getIteratorModifier())
2794 IteratorModifier->printPretty(OS,
nullptr, Policy);
2797void OMPClausePrinter::VisitOMPMapClause(OMPMapClause *Node) {
2798 if (!Node->varlist_empty()) {
2817 VisitOMPClauseList(Node,
' ');
2822template <
typename T>
void OMPClausePrinter::VisitOMPMotionClause(
T *Node) {
2823 if (Node->varlist_empty())
2825 OS << getOpenMPClauseName(Node->getClauseKind());
2826 unsigned ModifierCount = 0;
2831 if (ModifierCount) {
2835 if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator) {
2839 Node->getMotionModifier(I));
2840 if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)
2842 if (I < ModifierCount - 1)
2848 VisitOMPClauseList(Node,
' ');
2850 VisitOMPClauseList(Node,
'(');
2855void OMPClausePrinter::VisitOMPToClause(OMPToClause *Node) {
2856 VisitOMPMotionClause(Node);
2859void OMPClausePrinter::VisitOMPFromClause(OMPFromClause *Node) {
2860 VisitOMPMotionClause(Node);
2863void OMPClausePrinter::VisitOMPDistScheduleClause(OMPDistScheduleClause *Node) {
2868 E->printPretty(OS,
nullptr, Policy);
2873void OMPClausePrinter::VisitOMPDefaultmapClause(OMPDefaultmapClause *Node) {
2874 OS <<
"defaultmap(";
2885void OMPClausePrinter::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *Node) {
2886 if (!Node->varlist_empty()) {
2887 OS <<
"use_device_ptr";
2893 VisitOMPClauseList(Node,
' ');
2895 VisitOMPClauseList(Node,
'(');
2901void OMPClausePrinter::VisitOMPUseDeviceAddrClause(
2902 OMPUseDeviceAddrClause *Node) {
2903 if (!Node->varlist_empty()) {
2904 OS <<
"use_device_addr";
2905 VisitOMPClauseList(Node,
'(');
2910void OMPClausePrinter::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *Node) {
2911 if (!Node->varlist_empty()) {
2912 OS <<
"is_device_ptr";
2913 VisitOMPClauseList(Node,
'(');
2918void OMPClausePrinter::VisitOMPHasDeviceAddrClause(OMPHasDeviceAddrClause *Node) {
2919 if (!Node->varlist_empty()) {
2920 OS <<
"has_device_addr";
2921 VisitOMPClauseList(Node,
'(');
2926void OMPClausePrinter::VisitOMPNontemporalClause(OMPNontemporalClause *Node) {
2927 if (!Node->varlist_empty()) {
2928 OS <<
"nontemporal";
2929 VisitOMPClauseList(Node,
'(');
2934void OMPClausePrinter::VisitOMPOrderClause(OMPOrderClause *Node) {
2943void OMPClausePrinter::VisitOMPInclusiveClause(OMPInclusiveClause *Node) {
2944 if (!Node->varlist_empty()) {
2946 VisitOMPClauseList(Node,
'(');
2951void OMPClausePrinter::VisitOMPExclusiveClause(OMPExclusiveClause *Node) {
2952 if (!Node->varlist_empty()) {
2954 VisitOMPClauseList(Node,
'(');
2959void OMPClausePrinter::VisitOMPUsesAllocatorsClause(
2960 OMPUsesAllocatorsClause *Node) {
2963 OS <<
"uses_allocators(";
2966 Data.Allocator->printPretty(OS,
nullptr, Policy);
2967 if (
Data.AllocatorTraits) {
2969 Data.AllocatorTraits->printPretty(OS,
nullptr, Policy);
2978void OMPClausePrinter::VisitOMPAffinityClause(OMPAffinityClause *Node) {
2979 if (Node->varlist_empty())
2982 char StartSym =
'(';
2985 Modifier->printPretty(OS,
nullptr, Policy);
2989 VisitOMPClauseList(Node, StartSym);
2993void OMPClausePrinter::VisitOMPFilterClause(OMPFilterClause *Node) {
2999void OMPClausePrinter::VisitOMPBindClause(OMPBindClause *Node) {
3005void OMPClausePrinter::VisitOMPXDynCGroupMemClause(
3006 OMPXDynCGroupMemClause *Node) {
3007 OS <<
"ompx_dyn_cgroup_mem(";
3012void OMPClausePrinter::VisitOMPDynGroupprivateClause(
3013 OMPDynGroupprivateClause *Node) {
3014 OS <<
"dyn_groupprivate(";
3030void OMPClausePrinter::VisitOMPDoacrossClause(OMPDoacrossClause *Node) {
3035 case OMPC_DOACROSS_source:
3038 case OMPC_DOACROSS_sink:
3041 case OMPC_DOACROSS_source_omp_cur_iteration:
3042 OS <<
"source: omp_cur_iteration";
3044 case OMPC_DOACROSS_sink_omp_cur_iteration:
3045 OS <<
"sink: omp_cur_iteration - 1";
3048 llvm_unreachable(
"unknown docaross modifier");
3050 VisitOMPClauseList(Node,
' ');
3054void OMPClausePrinter::VisitOMPXAttributeClause(OMPXAttributeClause *Node) {
3055 OS <<
"ompx_attribute(";
3066void OMPClausePrinter::VisitOMPXBareClause(OMPXBareClause *Node) {
3071 VariantMatchInfo &VMI)
const {
3076 if (
Selector.Kind == TraitSelector::user_condition) {
3077 assert(
Selector.ScoreOrCondition &&
3078 "Ill-formed user condition, expected condition expression!");
3079 assert(
Selector.Properties.size() == 1 &&
3080 Selector.Properties.front().Kind ==
3081 TraitProperty::user_condition_unknown &&
3082 "Ill-formed user condition, expected unknown trait property!");
3084 if (std::optional<APSInt> CondVal =
3085 Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx))
3086 VMI.addTrait(CondVal->isZero() ? TraitProperty::user_condition_false
3087 : TraitProperty::user_condition_true,
3090 VMI.addTrait(TraitProperty::user_condition_false,
"<condition>");
3094 std::optional<llvm::APSInt> Score;
3095 llvm::APInt *ScorePtr =
nullptr;
3097 if ((Score =
Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx)))
3100 VMI.addTrait(TraitProperty::user_condition_false,
3101 "<non-constant-score>");
3105 VMI.addTrait(
Set.Kind, Property.Kind, Property.RawString, ScorePtr);
3107 if (
Set.Kind != TraitSet::construct)
3111 assert(
Selector.Properties.size() == 1 &&
3112 Selector.Properties.front().Kind ==
3113 getOpenMPContextTraitPropertyForSelector(
3115 "Ill-formed construct selector!");
3122 bool FirstSet =
true;
3127 OS << getOpenMPContextTraitSetName(
Set.Kind) <<
"={";
3129 bool FirstSelector =
true;
3133 FirstSelector =
false;
3134 OS << getOpenMPContextTraitSelectorName(
Selector.Kind);
3136 bool AllowsTraitScore =
false;
3137 bool RequiresProperty =
false;
3138 isValidTraitSelectorForTraitSet(
3139 Selector.Kind,
Set.Kind, AllowsTraitScore, RequiresProperty);
3141 if (!RequiresProperty)
3145 if (
Selector.Kind == TraitSelector::user_condition) {
3147 Selector.ScoreOrCondition->printPretty(OS,
nullptr, Policy);
3154 Selector.ScoreOrCondition->printPretty(OS,
nullptr, Policy);
3158 bool FirstProperty =
true;
3162 FirstProperty =
false;
3163 OS << getOpenMPContextTraitPropertyName(Property.Kind,
3164 Property.RawString);
3174 std::string MangledName;
3175 llvm::raw_string_ostream OS(MangledName);
3180 bool AllowsTraitScore =
false;
3181 bool RequiresProperty =
false;
3182 isValidTraitSelectorForTraitSet(
3183 Selector.Kind,
Set.Kind, AllowsTraitScore, RequiresProperty);
3186 if (!RequiresProperty ||
3187 Selector.Kind == TraitSelector::user_condition)
3192 << getOpenMPContextTraitPropertyName(Property.Kind,
3193 Property.RawString);
3199OMPTraitInfo::OMPTraitInfo(StringRef MangledName) {
3202 if (!MangledName.consume_front(
"$S"))
3204 if (MangledName.consumeInteger(10,
U))
3208 Set.Kind = TraitSet(
U);
3210 if (!MangledName.consume_front(
"$s"))
3212 if (MangledName.consumeInteger(10,
U))
3218 if (!MangledName.consume_front(
"$P"))
3222 std::pair<StringRef, StringRef> PropRestPair = MangledName.split(
'$');
3223 Property.RawString = PropRestPair.first;
3224 Property.Kind = getOpenMPContextTraitPropertyKind(
3226 MangledName = MangledName.drop_front(PropRestPair.first.size());
3236 TI.
print(OS, Policy);
3241 return TI ? OS << *TI : OS;
3248 : OMPContext(ASTCtx.getLangOpts().OpenMPIsTargetDevice,
3250 ASTCtx.getLangOpts().OMPTargetTriples.empty()
3252 : ASTCtx.getLangOpts().OMPTargetTriples[0],
3254 FeatureValidityCheck([&](StringRef FeatureName) {
3255 return ASTCtx.
getTargetInfo().isValidFeatureName(FeatureName);
3257 DiagUnknownTrait(std::move(DiagUnknownTrait)) {
3260 for (llvm::omp::TraitProperty Property : ConstructTraits)
3265 auto It = FeatureMap.find(RawString);
3266 if (It != FeatureMap.end())
3268 if (!FeatureValidityCheck(RawString))
3269 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 StringRef getTriple(const Command &Job)
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.
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.
Expr * getModifier()
Gets affinity modifier.
static OMPAffinityClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N locator items.
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.
Expr * getAlignment()
Returns alignment.
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.
OpenMPBindClauseKind getBindKind() const
Returns kind of the clause.
Class that represents a component of a mappable expression. E.g. for an expression S....
static unsigned getUniqueDeclarationsTotalNumber(ArrayRef< const ValueDecl * > Declarations)
static unsigned getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists)
ArrayRef< MappableExprComponentList > MappableExprComponentListsRef
static std::pair< const Expr *, std::optional< size_t > > findAttachPtrExpr(MappableExprComponentListRef Components, OpenMPDirectiveKind CurDirKind)
Find the attach pointer expression from a list of mappable expression components.
static QualType getComponentExprElementType(const Expr *Exp)
Get the type of an element of a ComponentList Expr Exp.
ArrayRef< MappableComponent > MappableExprComponentListRef
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.
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.
OpenMPDefaultmapClauseKind getDefaultmapKind() const
Get kind of the clause.
OpenMPDefaultmapClauseModifier getDefaultmapModifier() const
Get the modifier of the clause.
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.
static OMPDepobjClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Depobj)
Creates clause.
Expr * getDepobj()
Returns depobj expression associated with the clause.
static OMPDepobjClause * CreateEmpty(const ASTContext &C)
Creates an empty clause.
Expr * getInteropVar() const
Returns the interop variable.
Expr * getEventHandler() const
Returns event-handler expression.
This represents 'device' clause in the 'pragma omp ...' directive.
OpenMPDeviceClauseModifier getModifier() const
Gets modifier.
Expr * getDevice()
Return device number.
This represents 'dist_schedule' clause in the 'pragma omp ...' directive.
Expr * getChunkSize()
Get chunk size.
OpenMPDistScheduleClauseKind getDistScheduleKind() const
Get kind of the clause.
This represents the 'doacross' clause for the 'pragma omp ordered' directive.
void setLoopData(unsigned NumLoop, Expr *Cnt)
Set the loop data.
OpenMPDoacrossClauseModifier getDependenceType() const
Get dependence type.
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 'dyn_groupprivate' clause in 'pragma omp target ...' and 'pragma omp teams ....
Expr * getSize()
Get size.
OpenMPDynGroupprivateClauseFallbackModifier getDynGroupprivateFallbackModifier() const
Get the second modifier of the clause.
OpenMPDynGroupprivateClauseModifier getDynGroupprivateModifier() const
Get the first modifier of the clause.
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 'filter' clause in the 'pragma omp ...' directive.
Expr * getThreadID() const
Return thread identifier.
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 * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef< Expr * > UDMapperRefs, Expr *IteratorExpr, ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId)
Creates clause with a list of variables Vars.
static OMPFromClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents 'grainsize' clause in the 'pragma omp ...' directive.
OpenMPGrainsizeClauseModifier getModifier() const
Gets modifier.
Expr * getGrainsize() const
Return safe iteration space distance.
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.
Expr * getHint() const
Returns number of threads.
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.
bool getIsTarget() const
Returns true is interop-type 'target' is used.
static OMPInitClause * CreateEmpty(const ASTContext &C, unsigned NumPrefs, unsigned NumAttrs)
Creates an empty clause sized for NumPrefs pref-specs and NumAttrs total attr() exprs across them.
bool hasPreferAttrs() const
Returns true if OMP 6.0 {fr/attr} syntax is used.
Expr * getInteropVar()
Returns the interop variable.
static OMPInitClause * Create(const ASTContext &C, Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Creates a fully specified clause.
bool getIsTargetSync() const
Returns true is interop-type 'targetsync' is used.
auto prefs() const
Returns a range of PrefView objects, one per preference-specification, each carrying the fr() express...
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 'map' in the 'pragma omp ...' directives.
OpenMPMapClauseKind getMapType() const LLVM_READONLY
Fetches mapping kind for the clause.
OpenMPMapModifierKind getMapTypeModifier(unsigned Cnt) const LLVM_READONLY
Fetches the map-type-modifier at 'Cnt' index of array of modifiers.
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...
This represents 'nocontext' clause in the 'pragma omp ...' directive.
Expr * getCondition() const
Returns condition.
child_range used_children()
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.
Expr * getCondition() const
Returns condition.
child_range used_children()
This represents 'num_tasks' clause in the 'pragma omp ...' directive.
OpenMPNumTasksClauseModifier getModifier() const
Gets modifier.
child_range used_children()
Expr * getNumTasks() const
Return safe iteration space distance.
This represents 'num_teams' clause in the 'pragma omp ...' directive.
OpenMPNumTeamsClauseModifier getModifier() const
Get the modifier.
static OMPNumTeamsClause * Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, Stmt *PreInit)
Creates clause with a list of variables VL.
const Expr * getModifierExpr() const
Get the expression of the modifier.
static OMPNumTeamsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
OpenMPOrderClauseKind getKind() const
Returns kind of the clause.
OpenMPOrderClauseModifier getModifier() const
Returns Modifier of the clause.
This represents 'priority' clause in the 'pragma omp ...' directive.
child_range used_children()
Expr * getPriority()
Return Priority number.
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, OpenMPThreadLimitClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, Stmt *PreInit)
Creates clause with a list of variables VL.
const Expr * getModifierExpr() const
Get the expression of the modifier.
OpenMPThreadLimitClauseModifier getModifier() const
Get the modifier.
static OMPThreadLimitClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
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, Expr *IteratorModifier, ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId)
Creates clause with a list of variables Vars.
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.
Expr * getInteropVar() const
Returns the interop variable.
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, OpenMPUseDevicePtrFallbackModifier FallbackModifier, SourceLocation FallbackModifierLoc)
Creates clause with a list of variables Vars.
OpenMPUseDevicePtrFallbackModifier getFallbackModifier() const
Get the fallback modifier for the clause.
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.
unsigned getNumberOfAllocators() const
Returns number of allocators associated with the clause.
ArrayRef< const Attr * > getAttrs() const
Returned the attributes parsed from this clause.
This represents 'ompx_dyn_cgroup_mem' clause in the 'pragma omp target ...' directive.
Expr * getSize()
Return the size expression.
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
static QualType getBaseOriginalType(const Expr *Base)
Return original type of the base expression for array section.
Attr - This represents one attribute.
void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const
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 'align' clause in the 'pragma omp allocate' directive.
Expr * getAlignment() const
Returns alignment.
static OMPAlignClause * Create(const ASTContext &C, Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'align' clause with the given alignment.
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.
OpenMPAllocateClauseModifier getSecondAllocateModifier() const
Get the second modifier of the clause.
Expr * getAlignment() const
Returns the alignment expression or nullptr, if no alignment specified.
OpenMPAllocateClauseModifier getFirstAllocateModifier() const
Get the first modifier of the clause.
Expr * getAllocator() const
Returns the allocator expression or nullptr, if no allocator is specified.
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.
Expr * getAllocator() const
Returns allocator.
static OMPClauseWithPostUpdate * get(OMPClause *C)
OMPClauseWithPostUpdate(const OMPClause *This)
const Stmt * getPreInitStmt() const
Get pre-initialization statement for the clause.
OMPClauseWithPreInit(const OMPClause *This)
static OMPClauseWithPreInit * get(OMPClause *C)
This is a basic class for representing single OpenMP clause.
child_range used_children()
Get the iterator range for the expressions used in the clauses.
llvm::iterator_range< child_iterator > child_range
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
Expr * getNumForLoops() const
Return the number of associated for-loops.
This represents the 'counts' clause in the 'pragma omp split' directive.
std::optional< unsigned > getOmpFillIndex() const
static OMPCountsClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > Counts, std::optional< unsigned > FillIdx, SourceLocation FillLoc)
Build a 'counts' AST node.
static OMPCountsClause * CreateEmpty(const ASTContext &C, unsigned NumCounts)
Build an empty 'counts' AST node for deserialization.
MutableArrayRef< Expr * > getCountsRefs()
Returns the count expressions.
This represents 'default' clause in the 'pragma omp ...' directive.
llvm::omp::DefaultKind getDefaultKind() const
Returns kind of the clause.
OpenMPDefaultClauseVariableCategory getDefaultVC() const
This represents 'final' clause in the 'pragma omp ...' directive.
child_range used_children()
Expr * getCondition() const
Returns condition.
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 'if' clause in the 'pragma omp ...' directive.
child_range used_children()
Expr * getCondition() const
Returns condition.
OpenMPDirectiveKind getNameModifier() const
Return directive name modifier associated with the clause.
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
Expr * getFirst() const
Get looprange 'first' expression.
static OMPLoopRangeClause * CreateEmpty(const ASTContext &C)
Build an empty 'looprange' clause node.
static OMPLoopRangeClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc, Expr *First, Expr *Count)
Build a 'looprange' clause AST node.
Expr * getCount() const
Get looprange 'count' expression.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
OpenMPNumThreadsClauseModifier getModifier() const
Gets modifier.
Expr * getNumThreads() const
Returns number of threads.
llvm::iterator_range< child_iterator > child_range
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.
Expr * getFactor() const
Returns the argument of the clause or nullptr if not set.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
MutableArrayRef< Expr * > getArgsRefs()
Returns the permutation index expressions.
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 'safelen' clause in the 'pragma omp ...' directive.
Expr * getSafelen() const
Return safe iteration space distance.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
Expr * getSimdlen() const
Return safe iteration space distance.
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.
MutableArrayRef< Expr * > getSizesRefs()
Returns the tile size expressions.
static OMPSizesClause * CreateEmpty(const ASTContext &C, unsigned NumSizes)
Build an empty 'sizes' AST node for deserialization.
This represents 'threadset' clause in the 'pragma omp task ...' directive.
OpenMPThreadsetKind getThreadsetKind() const
Returns kind of the clause.
bool varlist_empty() const
A (possibly-)qualified type.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getCanonicalType() const
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
Base wrapper for a particular "section" of type source info.
The base class of the type hierarchy.
bool isPointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Defines the clang::TargetInfo interface.
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
Top level wrappers for InstallAPI frontend operations.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
Privates[]
This class represents the 'transparent' clause in the 'pragma omp task' directive.
bool isa(CodeGen::Address addr)
MutableArrayRef< Expr * > getFinals()
Sets the list of final update expressions for linear variables.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
@ OMPC_ORDER_MODIFIER_unknown
MutableArrayRef< Expr * > getPrivates()
Finals[]; Step; CalcStep; }.
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)
OpenMPNumTeamsClauseModifier
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
static constexpr unsigned NumberOfOMPMapClauseModifiers
Number of allowed map-type-modifiers.
@ OMPC_DYN_GROUPPRIVATE_FALLBACK_unknown
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
const FunctionProtoType * T
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
@ OMPC_LASTPRIVATE_unknown
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
OpenMPGrainsizeClauseModifier
OpenMPNumTasksClauseModifier
OpenMPUseDevicePtrFallbackModifier
OpenMP 6.1 use_device_ptr fallback modifier.
@ OMPC_USE_DEVICE_PTR_FALLBACK_unknown
MutableArrayRef< Expr * > getUsedExprs()
Gets the list of used expressions for linear variables.
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.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
@ OMPC_DYN_GROUPPRIVATE_unknown
MutableArrayRef< Expr * > getUpdates()
Sets the list of update expressions for linear variables.
OpenMPThreadLimitClauseModifier
MutableArrayRef< Expr * > getInits()
OpenMPNumThreadsClauseModifier
@ OMPC_NUMTHREADS_unknown
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
const char * getOperatorSpelling(OverloadedOperatorKind Operator)
Retrieve the spelling of the given overloaded operator, without the preceding "operator" keyword.
U cast(CodeGen::Address addr)
const char * getOpenMPDefaultVariableCategoryName(unsigned VC)
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
ArrayRef< Expr * > Attrs
attr() string-literal expressions. Empty for fr-only or OMP 5.1 flat specs.
This structure contains all sizes needed for by an OMPMappableExprListClause.
unsigned NumComponents
Total number of expression components.
unsigned NumUniqueDeclarations
Number of unique base declarations.
unsigned NumVars
Number of expressions listed.
unsigned NumComponentLists
Number of component lists.
Data for list of allocators.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
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.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
llvm::SmallVector< OMPInteropPref, 4 > Prefs
One entry of a prefer_type list.
llvm::SmallVector< Expr *, 2 > Attrs
This structure contains most locations needed for by an OMPVarListClause.
Describes how types, statements, expressions, and declarations should be printed.