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);
1999 Expr *DimsModifierExpr,
Stmt *PreInit) {
2001 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
2002 OMPNumThreadsClause *Clause =
2003 new (Mem) OMPNumThreadsClause(
C, StartLoc, LParenLoc, EndLoc, VL.size());
2004 Clause->setVarRefs(VL);
2005 Clause->setPrescriptivenessModifier(PrescriptivenessModifier);
2006 Clause->setPrescriptivenessModifierLoc(PrescriptivenessModifierLoc);
2007 Clause->setDimsModifier(DimsModifier);
2008 Clause->setDimsModifierExpr(DimsModifierExpr);
2009 Clause->setDimsModifierLoc(DimsModifierLoc);
2010 Clause->setPreInitStmt(PreInit, CaptureRegion);
2017 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
2018 return new (Mem) OMPNumThreadsClause(N);
2025void OMPClausePrinter::VisitOMPIfClause(
OMPIfClause *Node) {
2028 OS << getOpenMPDirectiveName(Node->
getNameModifier(), Version) <<
": ";
2033void OMPClausePrinter::VisitOMPFinalClause(
OMPFinalClause *Node) {
2041 OS <<
"num_threads";
2042 bool HasPrescriptiveness =
2045 if (HasPrescriptiveness || HasDims) {
2047 if (HasPrescriptiveness)
2050 if (HasPrescriptiveness && HasDims)
2058 VisitOMPClauseList(Node,
' ');
2060 VisitOMPClauseList(Node,
'(');
2066void OMPClausePrinter::VisitOMPAlignClause(
OMPAlignClause *Node) {
2084void OMPClausePrinter::VisitOMPSizesClause(
OMPSizesClause *Node) {
2090 Size->printPretty(OS,
nullptr, Policy, 0);
2100 llvm::interleaveComma(llvm::seq<unsigned>(Refs.size()), OS, [&](
unsigned I) {
2101 if (FillIdx && I == *FillIdx)
2104 Refs[I]->printPretty(OS, nullptr, Policy, 0);
2110 OS <<
"permutation(";
2112 E->printPretty(OS, nullptr, Policy, 0);
2117void OMPClausePrinter::VisitOMPFullClause(
OMPFullClause *Node) {
OS <<
"full"; }
2124 Factor->printPretty(OS,
nullptr, Policy, 0);
2135 if (
First && Count) {
2137 First->printPretty(OS,
nullptr, Policy, 0);
2156void OMPClausePrinter::VisitOMPDetachClause(OMPDetachClause *Node) {
2166 if (Version >= 60 && Node->
getDefaultVC() != OMPC_DEFAULT_VC_all) {
2181void OMPClausePrinter::VisitOMPTransparentClause(OMPTransparentClause *Node) {
2182 OS <<
"transparent(";
2183 if (Node->getImpexType())
2184 Node->getImpexType()->printPretty(OS,
nullptr, Policy, 0);
2190void OMPClausePrinter::VisitOMPProcBindClause(OMPProcBindClause *Node) {
2193 unsigned(Node->getProcBindKind()))
2197void OMPClausePrinter::VisitOMPUnifiedAddressClause(OMPUnifiedAddressClause *) {
2198 OS <<
"unified_address";
2201void OMPClausePrinter::VisitOMPUnifiedSharedMemoryClause(
2202 OMPUnifiedSharedMemoryClause *) {
2203 OS <<
"unified_shared_memory";
2206void OMPClausePrinter::VisitOMPReverseOffloadClause(OMPReverseOffloadClause *) {
2207 OS <<
"reverse_offload";
2210void OMPClausePrinter::VisitOMPDynamicAllocatorsClause(
2211 OMPDynamicAllocatorsClause *) {
2212 OS <<
"dynamic_allocators";
2215void OMPClausePrinter::VisitOMPAtomicDefaultMemOrderClause(
2216 OMPAtomicDefaultMemOrderClause *Node) {
2217 OS <<
"atomic_default_mem_order("
2219 Node->getAtomicDefaultMemOrderKind())
2223void OMPClausePrinter::VisitOMPSelfMapsClause(OMPSelfMapsClause *) {
2227void OMPClausePrinter::VisitOMPAtClause(OMPAtClause *Node) {
2232void OMPClausePrinter::VisitOMPSeverityClause(OMPSeverityClause *Node) {
2238void OMPClausePrinter::VisitOMPMessageClause(OMPMessageClause *Node) {
2240 if (
Expr *E = Node->getMessageString())
2241 E->printPretty(OS,
nullptr, Policy);
2245void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
2249 Node->getFirstScheduleModifier());
2253 Node->getSecondScheduleModifier());
2258 if (
auto *E = Node->getChunkSize()) {
2260 E->printPretty(OS,
nullptr, Policy);
2265void OMPClausePrinter::VisitOMPOrderedClause(OMPOrderedClause *Node) {
2267 if (
auto *
Num = Node->getNumForLoops()) {
2269 Num->printPretty(OS,
nullptr, Policy, 0);
2274void OMPClausePrinter::VisitOMPNowaitClause(OMPNowaitClause *Node) {
2276 if (
auto *Cond = Node->getCondition()) {
2278 Cond->printPretty(OS,
nullptr, Policy, 0);
2283void OMPClausePrinter::VisitOMPUntiedClause(OMPUntiedClause *) {
2287void OMPClausePrinter::VisitOMPNogroupClause(OMPNogroupClause *) {
2291void OMPClausePrinter::VisitOMPMergeableClause(OMPMergeableClause *) {
2295void OMPClausePrinter::VisitOMPReadClause(OMPReadClause *) {
OS <<
"read"; }
2297void OMPClausePrinter::VisitOMPWriteClause(OMPWriteClause *) {
OS <<
"write"; }
2299void OMPClausePrinter::VisitOMPUpdateClause(OMPUpdateClause *) {
2303void OMPClausePrinter::VisitOMPUpdateDependObjectsClause(
2304 OMPUpdateDependObjectsClause *Node) {
2307 Node->getDependencyKind());
2311void OMPClausePrinter::VisitOMPCaptureClause(OMPCaptureClause *) {
2315void OMPClausePrinter::VisitOMPCompareClause(OMPCompareClause *) {
2319void OMPClausePrinter::VisitOMPFailClause(OMPFailClause *Node) {
2324 Node->getClauseKind(),
static_cast<int>(Node->getFailParameter()));
2329void OMPClausePrinter::VisitOMPAbsentClause(OMPAbsentClause *Node) {
2332 for (
auto &D : Node->getDirectiveKinds()) {
2335 OS << getOpenMPDirectiveName(D, Version);
2341void OMPClausePrinter::VisitOMPHoldsClause(OMPHoldsClause *Node) {
2343 Node->getExpr()->printPretty(OS,
nullptr, Policy, 0);
2347void OMPClausePrinter::VisitOMPContainsClause(OMPContainsClause *Node) {
2350 for (
auto &D : Node->getDirectiveKinds()) {
2353 OS << getOpenMPDirectiveName(D, Version);
2359void OMPClausePrinter::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {
2363void OMPClausePrinter::VisitOMPNoOpenMPRoutinesClause(
2364 OMPNoOpenMPRoutinesClause *) {
2365 OS <<
"no_openmp_routines";
2368void OMPClausePrinter::VisitOMPNoOpenMPConstructsClause(
2369 OMPNoOpenMPConstructsClause *) {
2370 OS <<
"no_openmp_constructs";
2373void OMPClausePrinter::VisitOMPNoParallelismClause(OMPNoParallelismClause *) {
2374 OS <<
"no_parallelism";
2377void OMPClausePrinter::VisitOMPSeqCstClause(OMPSeqCstClause *) {
2381void OMPClausePrinter::VisitOMPAcqRelClause(OMPAcqRelClause *) {
2385void OMPClausePrinter::VisitOMPAcquireClause(OMPAcquireClause *) {
2389void OMPClausePrinter::VisitOMPReleaseClause(OMPReleaseClause *) {
2393void OMPClausePrinter::VisitOMPRelaxedClause(OMPRelaxedClause *) {
2397void OMPClausePrinter::VisitOMPWeakClause(OMPWeakClause *) {
OS <<
"weak"; }
2399void OMPClausePrinter::VisitOMPThreadsClause(OMPThreadsClause *) {
2403void OMPClausePrinter::VisitOMPSIMDClause(OMPSIMDClause *) {
OS <<
"simd"; }
2405void OMPClausePrinter::VisitOMPDeviceClause(OMPDeviceClause *Node) {
2416void OMPClausePrinter::VisitOMPNumTeamsClause(OMPNumTeamsClause *Node) {
2417 if (!Node->varlist_empty()) {
2426 VisitOMPClauseList(Node,
':');
2428 VisitOMPClauseList(Node,
'(');
2434void OMPClausePrinter::VisitOMPThreadLimitClause(OMPThreadLimitClause *Node) {
2435 if (!Node->varlist_empty()) {
2436 OS <<
"thread_limit";
2437 if (Node->
getModifier() == OMPC_THREADLIMIT_dims) {
2441 VisitOMPClauseList(Node,
':');
2443 VisitOMPClauseList(Node,
'(');
2449void OMPClausePrinter::VisitOMPPriorityClause(OMPPriorityClause *Node) {
2455void OMPClausePrinter::VisitOMPGrainsizeClause(OMPGrainsizeClause *Node) {
2466void OMPClausePrinter::VisitOMPNumTasksClause(OMPNumTasksClause *Node) {
2477void OMPClausePrinter::VisitOMPHintClause(OMPHintClause *Node) {
2483void OMPClausePrinter::VisitOMPInitClause(OMPInitClause *Node) {
2485 if (!Node->
prefs().empty()) {
2486 OS <<
"prefer_type(";
2489 llvm::interleaveComma(Node->
prefs(), OS, [&](OMPInitClause::PrefView P) {
2493 P.Fr->printPretty(OS, nullptr, Policy);
2495 if (!P.Attrs.empty())
2500 llvm::interleaveComma(P.Attrs, OS, [&](const Expr *A) {
2501 A->printPretty(OS, nullptr, Policy);
2510 [&](OMPInitClause::PrefView P) {
2512 P.Fr->printPretty(OS, nullptr, Policy);
2530void OMPClausePrinter::VisitOMPUseClause(OMPUseClause *Node) {
2536void OMPClausePrinter::VisitOMPDestroyClause(OMPDestroyClause *Node) {
2540 E->printPretty(OS,
nullptr, Policy);
2545void OMPClausePrinter::VisitOMPNovariantsClause(OMPNovariantsClause *Node) {
2549 E->printPretty(OS,
nullptr, Policy, 0);
2554void OMPClausePrinter::VisitOMPNocontextClause(OMPNocontextClause *Node) {
2558 E->printPretty(OS,
nullptr, Policy, 0);
2564void OMPClausePrinter::VisitOMPClauseList(
T *Node,
char StartSym) {
2565 for (
typename T::varlist_iterator I = Node->varlist_begin(),
2566 E = Node->varlist_end();
2568 assert(*I &&
"Expected non-null Stmt");
2569 OS << (I == Node->varlist_begin() ? StartSym :
',');
2570 if (
auto *DRE = dyn_cast<DeclRefExpr>(*I)) {
2572 DRE->printPretty(OS,
nullptr, Policy, 0);
2574 DRE->getDecl()->printQualifiedName(OS);
2576 (*I)->printPretty(OS,
nullptr, Policy, 0);
2584 Expr *FirstModifier =
nullptr;
2585 Expr *SecondModifier =
nullptr;
2590 if (FirstAllocMod == OMPC_ALLOCATE_allocator ||
2601 if (FirstModifier) {
2603 if (!FirstUnknown) {
2607 FirstModifier->
printPretty(OS,
nullptr, Policy, 0);
2610 if (SecondModifier) {
2612 if (!SecondUnknown) {
2617 SecondModifier->
printPretty(OS,
nullptr, Policy, 0);
2622 VisitOMPClauseList(Node,
' ');
2625 VisitOMPClauseList(Node,
'(');
2630void OMPClausePrinter::VisitOMPPrivateClause(OMPPrivateClause *Node) {
2631 if (!Node->varlist_empty()) {
2633 VisitOMPClauseList(Node,
'(');
2638void OMPClausePrinter::VisitOMPFirstprivateClause(OMPFirstprivateClause *Node) {
2639 if (!Node->varlist_empty()) {
2640 OS <<
"firstprivate";
2641 VisitOMPClauseList(Node,
'(');
2646void OMPClausePrinter::VisitOMPLastprivateClause(OMPLastprivateClause *Node) {
2647 if (!Node->varlist_empty()) {
2648 OS <<
"lastprivate";
2660void OMPClausePrinter::VisitOMPSharedClause(OMPSharedClause *Node) {
2661 if (!Node->varlist_empty()) {
2663 VisitOMPClauseList(Node,
'(');
2668void OMPClausePrinter::VisitOMPReductionClause(OMPReductionClause *Node) {
2669 if (!Node->varlist_empty()) {
2671 if (Node->getModifierLoc().isValid())
2675 Node->getQualifierLoc().getNestedNameSpecifier();
2677 Node->getNameInfo().getName().getCXXOverloadedOperator();
2678 if (!Qualifier && OOK !=
OO_None) {
2684 OS << Node->getNameInfo();
2687 VisitOMPClauseList(Node,
' ');
2692void OMPClausePrinter::VisitOMPTaskReductionClause(
2693 OMPTaskReductionClause *Node) {
2694 if (!Node->varlist_empty()) {
2695 OS <<
"task_reduction(";
2697 Node->getQualifierLoc().getNestedNameSpecifier();
2699 Node->getNameInfo().getName().getCXXOverloadedOperator();
2700 if (!Qualifier && OOK !=
OO_None) {
2706 OS << Node->getNameInfo();
2709 VisitOMPClauseList(Node,
' ');
2714void OMPClausePrinter::VisitOMPInReductionClause(OMPInReductionClause *Node) {
2715 if (!Node->varlist_empty()) {
2716 OS <<
"in_reduction(";
2718 Node->getQualifierLoc().getNestedNameSpecifier();
2720 Node->getNameInfo().getName().getCXXOverloadedOperator();
2721 if (!Qualifier && OOK !=
OO_None) {
2727 OS << Node->getNameInfo();
2730 VisitOMPClauseList(Node,
' ');
2735void OMPClausePrinter::VisitOMPLinearClause(OMPLinearClause *Node) {
2736 if (!Node->varlist_empty()) {
2738 VisitOMPClauseList(Node,
'(');
2739 if (Node->getModifierLoc().isValid() || Node->getStep() !=
nullptr) {
2742 if (Node->getModifierLoc().isValid()) {
2745 if (Node->getStep() !=
nullptr) {
2746 if (Node->getModifierLoc().isValid()) {
2750 Node->getStep()->printPretty(OS,
nullptr, Policy, 0);
2757void OMPClausePrinter::VisitOMPAlignedClause(OMPAlignedClause *Node) {
2758 if (!Node->varlist_empty()) {
2760 VisitOMPClauseList(Node,
'(');
2769void OMPClausePrinter::VisitOMPCopyinClause(OMPCopyinClause *Node) {
2770 if (!Node->varlist_empty()) {
2772 VisitOMPClauseList(Node,
'(');
2777void OMPClausePrinter::VisitOMPCopyprivateClause(OMPCopyprivateClause *Node) {
2778 if (!Node->varlist_empty()) {
2779 OS <<
"copyprivate";
2780 VisitOMPClauseList(Node,
'(');
2785void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) {
2786 if (!Node->varlist_empty()) {
2787 VisitOMPClauseList(Node,
'(');
2792void OMPClausePrinter::VisitOMPDepobjClause(OMPDepobjClause *Node) {
2798void OMPClausePrinter::VisitOMPDependClause(OMPDependClause *Node) {
2806 bool IsOmpAllMemory =
false;
2807 if (PrintKind == OMPC_DEPEND_outallmemory) {
2808 PrintKind = OMPC_DEPEND_out;
2809 IsOmpAllMemory =
true;
2810 }
else if (PrintKind == OMPC_DEPEND_inoutallmemory) {
2811 PrintKind = OMPC_DEPEND_inout;
2812 IsOmpAllMemory =
true;
2815 if (!Node->varlist_empty() || IsOmpAllMemory)
2817 VisitOMPClauseList(Node,
' ');
2818 if (IsOmpAllMemory) {
2819 OS << (Node->varlist_empty() ?
" " :
",");
2820 OS <<
"omp_all_memory";
2825template <
typename T>
2830 Node->getMapperQualifierLoc().getNestedNameSpecifier();
2831 MapperNNS.
print(OS, Policy);
2832 OS << Node->getMapperIdInfo() <<
')';
2835template <
typename T>
2838 if (
Expr *IteratorModifier = Node->getIteratorModifier())
2839 IteratorModifier->printPretty(OS,
nullptr, Policy);
2842void OMPClausePrinter::VisitOMPMapClause(OMPMapClause *Node) {
2843 if (!Node->varlist_empty()) {
2862 VisitOMPClauseList(Node,
' ');
2867template <
typename T>
void OMPClausePrinter::VisitOMPMotionClause(
T *Node) {
2868 if (Node->varlist_empty())
2870 OS << getOpenMPClauseName(Node->getClauseKind());
2871 unsigned ModifierCount = 0;
2876 if (ModifierCount) {
2880 if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator) {
2884 Node->getMotionModifier(I));
2885 if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)
2887 if (I < ModifierCount - 1)
2893 VisitOMPClauseList(Node,
' ');
2895 VisitOMPClauseList(Node,
'(');
2900void OMPClausePrinter::VisitOMPToClause(OMPToClause *Node) {
2901 VisitOMPMotionClause(Node);
2904void OMPClausePrinter::VisitOMPFromClause(OMPFromClause *Node) {
2905 VisitOMPMotionClause(Node);
2908void OMPClausePrinter::VisitOMPDistScheduleClause(OMPDistScheduleClause *Node) {
2913 E->printPretty(OS,
nullptr, Policy);
2918void OMPClausePrinter::VisitOMPDefaultmapClause(OMPDefaultmapClause *Node) {
2919 OS <<
"defaultmap(";
2930void OMPClausePrinter::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *Node) {
2931 if (!Node->varlist_empty()) {
2932 OS <<
"use_device_ptr";
2938 VisitOMPClauseList(Node,
' ');
2940 VisitOMPClauseList(Node,
'(');
2946void OMPClausePrinter::VisitOMPUseDeviceAddrClause(
2947 OMPUseDeviceAddrClause *Node) {
2948 if (!Node->varlist_empty()) {
2949 OS <<
"use_device_addr";
2950 VisitOMPClauseList(Node,
'(');
2955void OMPClausePrinter::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *Node) {
2956 if (!Node->varlist_empty()) {
2957 OS <<
"is_device_ptr";
2958 VisitOMPClauseList(Node,
'(');
2963void OMPClausePrinter::VisitOMPHasDeviceAddrClause(OMPHasDeviceAddrClause *Node) {
2964 if (!Node->varlist_empty()) {
2965 OS <<
"has_device_addr";
2966 VisitOMPClauseList(Node,
'(');
2971void OMPClausePrinter::VisitOMPNontemporalClause(OMPNontemporalClause *Node) {
2972 if (!Node->varlist_empty()) {
2973 OS <<
"nontemporal";
2974 VisitOMPClauseList(Node,
'(');
2979void OMPClausePrinter::VisitOMPOrderClause(OMPOrderClause *Node) {
2988void OMPClausePrinter::VisitOMPInclusiveClause(OMPInclusiveClause *Node) {
2989 if (!Node->varlist_empty()) {
2991 VisitOMPClauseList(Node,
'(');
2996void OMPClausePrinter::VisitOMPExclusiveClause(OMPExclusiveClause *Node) {
2997 if (!Node->varlist_empty()) {
2999 VisitOMPClauseList(Node,
'(');
3004void OMPClausePrinter::VisitOMPUsesAllocatorsClause(
3005 OMPUsesAllocatorsClause *Node) {
3008 OS <<
"uses_allocators(";
3011 Data.Allocator->printPretty(OS,
nullptr, Policy);
3012 if (
Data.AllocatorTraits) {
3014 Data.AllocatorTraits->printPretty(OS,
nullptr, Policy);
3023void OMPClausePrinter::VisitOMPAffinityClause(OMPAffinityClause *Node) {
3024 if (Node->varlist_empty())
3027 char StartSym =
'(';
3030 Modifier->printPretty(OS,
nullptr, Policy);
3034 VisitOMPClauseList(Node, StartSym);
3038void OMPClausePrinter::VisitOMPFilterClause(OMPFilterClause *Node) {
3044void OMPClausePrinter::VisitOMPBindClause(OMPBindClause *Node) {
3050void OMPClausePrinter::VisitOMPXDynCGroupMemClause(
3051 OMPXDynCGroupMemClause *Node) {
3052 OS <<
"ompx_dyn_cgroup_mem(";
3057void OMPClausePrinter::VisitOMPDynGroupprivateClause(
3058 OMPDynGroupprivateClause *Node) {
3059 OS <<
"dyn_groupprivate(";
3075void OMPClausePrinter::VisitOMPDoacrossClause(OMPDoacrossClause *Node) {
3080 case OMPC_DOACROSS_source:
3083 case OMPC_DOACROSS_sink:
3086 case OMPC_DOACROSS_source_omp_cur_iteration:
3087 OS <<
"source: omp_cur_iteration";
3089 case OMPC_DOACROSS_sink_omp_cur_iteration:
3090 OS <<
"sink: omp_cur_iteration - 1";
3093 llvm_unreachable(
"unknown docaross modifier");
3095 VisitOMPClauseList(Node,
' ');
3099void OMPClausePrinter::VisitOMPXAttributeClause(OMPXAttributeClause *Node) {
3100 OS <<
"ompx_attribute(";
3111void OMPClausePrinter::VisitOMPXBareClause(OMPXBareClause *Node) {
3116 VariantMatchInfo &VMI)
const {
3121 if (
Selector.Kind == TraitSelector::user_condition) {
3122 assert(
Selector.ScoreOrCondition &&
3123 "Ill-formed user condition, expected condition expression!");
3124 assert(
Selector.Properties.size() == 1 &&
3125 Selector.Properties.front().Kind ==
3126 TraitProperty::user_condition_unknown &&
3127 "Ill-formed user condition, expected unknown trait property!");
3129 if (std::optional<APSInt> CondVal =
3130 Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx))
3131 VMI.addTrait(CondVal->isZero() ? TraitProperty::user_condition_false
3132 : TraitProperty::user_condition_true,
3135 VMI.addTrait(TraitProperty::user_condition_false,
"<condition>");
3139 std::optional<llvm::APSInt> Score;
3140 llvm::APInt *ScorePtr =
nullptr;
3142 if ((Score =
Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx)))
3145 VMI.addTrait(TraitProperty::user_condition_false,
3146 "<non-constant-score>");
3150 VMI.addTrait(
Set.Kind, Property.Kind, Property.RawString, ScorePtr);
3152 if (
Set.Kind != TraitSet::construct)
3156 assert(
Selector.Properties.size() == 1 &&
3157 Selector.Properties.front().Kind ==
3158 getOpenMPContextTraitPropertyForSelector(
3160 "Ill-formed construct selector!");
3167 bool FirstSet =
true;
3172 OS << getOpenMPContextTraitSetName(
Set.Kind) <<
"={";
3174 bool FirstSelector =
true;
3178 FirstSelector =
false;
3179 OS << getOpenMPContextTraitSelectorName(
Selector.Kind);
3181 bool AllowsTraitScore =
false;
3182 bool RequiresProperty =
false;
3183 isValidTraitSelectorForTraitSet(
3184 Selector.Kind,
Set.Kind, AllowsTraitScore, RequiresProperty);
3186 if (!RequiresProperty)
3190 if (
Selector.Kind == TraitSelector::user_condition) {
3192 Selector.ScoreOrCondition->printPretty(OS,
nullptr, Policy);
3199 Selector.ScoreOrCondition->printPretty(OS,
nullptr, Policy);
3203 bool FirstProperty =
true;
3207 FirstProperty =
false;
3208 OS << getOpenMPContextTraitPropertyName(Property.Kind,
3209 Property.RawString);
3219 std::string MangledName;
3220 llvm::raw_string_ostream OS(MangledName);
3225 bool AllowsTraitScore =
false;
3226 bool RequiresProperty =
false;
3227 isValidTraitSelectorForTraitSet(
3228 Selector.Kind,
Set.Kind, AllowsTraitScore, RequiresProperty);
3231 if (!RequiresProperty ||
3232 Selector.Kind == TraitSelector::user_condition)
3237 << getOpenMPContextTraitPropertyName(Property.Kind,
3238 Property.RawString);
3244OMPTraitInfo::OMPTraitInfo(StringRef MangledName) {
3247 if (!MangledName.consume_front(
"$S"))
3249 if (MangledName.consumeInteger(10,
U))
3253 Set.Kind = TraitSet(
U);
3255 if (!MangledName.consume_front(
"$s"))
3257 if (MangledName.consumeInteger(10,
U))
3263 if (!MangledName.consume_front(
"$P"))
3267 std::pair<StringRef, StringRef> PropRestPair = MangledName.split(
'$');
3268 Property.RawString = PropRestPair.first;
3269 Property.Kind = getOpenMPContextTraitPropertyKind(
3271 MangledName = MangledName.drop_front(PropRestPair.first.size());
3281 TI.
print(OS, Policy);
3286 return TI ? OS << *TI : OS;
3293 : OMPContext(ASTCtx.getLangOpts().OpenMPIsTargetDevice,
3295 ASTCtx.getLangOpts().OMPTargetTriples.empty()
3297 : ASTCtx.getLangOpts().OMPTargetTriples[0],
3299 FeatureValidityCheck([&](StringRef FeatureName) {
3300 return ASTCtx.
getTargetInfo().isValidFeatureName(FeatureName);
3302 DiagUnknownTrait(std::move(DiagUnknownTrait)) {
3305 for (llvm::omp::TraitProperty Property : ConstructTraits)
3310 auto It = FeatureMap.find(RawString);
3311 if (It != FeatureMap.end())
3313 if (!FeatureValidityCheck(RawString))
3314 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.
Expr * getDimsModifierExpr()
Returns the dims modifier expression if present.
OpenMPNumThreadsClauseModifier getDimsModifier() const
Returns the dims modifier.
OpenMPNumThreadsClauseModifier getPrescriptivenessModifier() const
Returns the prescriptiveness modifier.
static OMPNumThreadsClause * Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, OpenMPNumThreadsClauseModifier PrescriptivenessModifier, OpenMPNumThreadsClauseModifier DimsModifier, SourceLocation PrescriptivenessModifierLoc, SourceLocation DimsModifierLoc, Expr *DimsModifierExpr, Stmt *PreInit)
Creates clause with a list of variables/expressions.
static OMPNumThreadsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N expressions.
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.