23#include "llvm/ADT/Sequence.h"
24#include "llvm/ADT/SmallPtrSet.h"
25#include "llvm/Support/ErrorHandling.h"
38 void *Mem =
C.Allocate(totalSizeToAlloc<OMPAdjustArgsItem>(Items.size()));
39 auto *Desc =
new (Mem)
41 llvm::copy(Items, Desc->getTrailingObjects());
49#define GEN_CLANG_CLAUSE_CLASS
50#define CLAUSE_CLASS(Enum, Str, Class) \
52 return static_cast<Class *>(this)->children();
53#include "llvm/Frontend/OpenMP/OMP.inc"
55 llvm_unreachable(
"unknown OMPClause");
60#define GEN_CLANG_CLAUSE_CLASS
61#define CLAUSE_CLASS(Enum, Str, Class) \
63 return static_cast<Class *>(this)->used_children();
64#define CLAUSE_NO_CLASS(Enum, Str) \
67#include "llvm/Frontend/OpenMP/OMP.inc"
69 llvm_unreachable(
"unknown OMPClause");
78 switch (
C->getClauseKind()) {
80 return static_cast<const OMPScheduleClause *
>(
C);
81 case OMPC_dist_schedule:
83 case OMPC_firstprivate:
84 return static_cast<const OMPFirstprivateClause *
>(
C);
85 case OMPC_lastprivate:
86 return static_cast<const OMPLastprivateClause *
>(
C);
88 return static_cast<const OMPReductionClause *
>(
C);
89 case OMPC_task_reduction:
90 return static_cast<const OMPTaskReductionClause *
>(
C);
91 case OMPC_in_reduction:
92 return static_cast<const OMPInReductionClause *
>(
C);
94 return static_cast<const OMPLinearClause *
>(
C);
97 case OMPC_num_threads:
101 case OMPC_thread_limit:
113 case OMPC_novariants:
119 case OMPC_ompx_dyn_cgroup_mem:
121 case OMPC_dyn_groupprivate:
124 return static_cast<const OMPMessageClause *
>(
C);
125 case OMPC_transparent:
126 return static_cast<const OMPTransparentClause *
>(
C);
139 case OMPC_copyprivate:
145 case OMPC_threadprivate:
146 case OMPC_groupprivate:
166 case OMPC_defaultmap:
171 case OMPC_use_device_ptr:
172 case OMPC_use_device_addr:
173 case OMPC_is_device_ptr:
174 case OMPC_has_device_addr:
175 case OMPC_unified_address:
176 case OMPC_unified_shared_memory:
177 case OMPC_reverse_offload:
178 case OMPC_dynamic_allocators:
179 case OMPC_atomic_default_mem_order:
183 case OMPC_device_type:
185 case OMPC_nontemporal:
191 case OMPC_uses_allocators:
210 switch (
C->getClauseKind()) {
211 case OMPC_lastprivate:
212 return static_cast<const OMPLastprivateClause *
>(
C);
214 return static_cast<const OMPReductionClause *
>(
C);
215 case OMPC_task_reduction:
216 return static_cast<const OMPTaskReductionClause *
>(
C);
217 case OMPC_in_reduction:
218 return static_cast<const OMPInReductionClause *
>(
C);
220 return static_cast<const OMPLinearClause *
>(
C);
222 case OMPC_dist_schedule:
223 case OMPC_firstprivate:
228 case OMPC_num_threads:
239 case OMPC_copyprivate:
244 case OMPC_threadprivate:
245 case OMPC_groupprivate:
265 case OMPC_thread_limit:
271 case OMPC_defaultmap:
276 case OMPC_use_device_ptr:
277 case OMPC_use_device_addr:
278 case OMPC_is_device_ptr:
279 case OMPC_has_device_addr:
280 case OMPC_unified_address:
281 case OMPC_unified_shared_memory:
282 case OMPC_reverse_offload:
283 case OMPC_dynamic_allocators:
284 case OMPC_atomic_default_mem_order:
289 case OMPC_device_type:
291 case OMPC_nontemporal:
294 case OMPC_novariants:
299 case OMPC_uses_allocators:
316 if (
auto *DS = dyn_cast<DeclStmt>(S)) {
317 assert(DS->isSingleDecl() &&
"Only single expression must be captured.");
318 if (
auto *OED = dyn_cast<OMPCapturedExprDecl>(DS->getSingleDecl()))
319 return OED->getInitAddress();
338 return child_range(
C,
C + 1);
339 return child_range(&Grainsize, &Grainsize + 1);
344 return child_range(
C,
C + 1);
345 return child_range(&NumTasks, &NumTasks + 1);
356 return child_range(
C,
C + 1);
357 return child_range(&Priority, &Priority + 1);
362 return child_range(
C,
C + 1);
368 return child_range(
C,
C + 1);
377 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops));
379 new (Mem) OMPOrderedClause(
Num, NumLoops, StartLoc, LParenLoc, EndLoc);
380 for (
unsigned I = 0; I < NumLoops; ++I) {
381 Clause->setLoopNumIterations(I,
nullptr);
382 Clause->setLoopCounter(I,
nullptr);
387OMPOrderedClause *OMPOrderedClause::CreateEmpty(
const ASTContext &
C,
389 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops));
390 auto *Clause =
new (Mem) OMPOrderedClause(NumLoops);
391 for (
unsigned I = 0; I < NumLoops; ++I) {
392 Clause->setLoopNumIterations(I,
nullptr);
393 Clause->setLoopCounter(I,
nullptr);
398void OMPOrderedClause::setLoopNumIterations(
unsigned NumLoop,
399 Expr *NumIterations) {
400 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
401 getTrailingObjects()[NumLoop] = NumIterations;
405 return getTrailingObjects(NumberOfLoops);
408void OMPOrderedClause::setLoopCounter(
unsigned NumLoop,
Expr *Counter) {
409 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
410 getTrailingObjects()[NumberOfLoops + NumLoop] = Counter;
413Expr *OMPOrderedClause::getLoopCounter(
unsigned NumLoop) {
414 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
415 return getTrailingObjects()[NumberOfLoops + NumLoop];
418const Expr *OMPOrderedClause::getLoopCounter(
unsigned NumLoop)
const {
419 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
420 return getTrailingObjects()[NumberOfLoops + NumLoop];
423OMPUpdateDependObjectsClause *OMPUpdateDependObjectsClause::Create(
428 C.Allocate(totalSizeToAlloc<SourceLocation, OpenMPDependClauseKind>(2, 1),
429 alignof(OMPUpdateDependObjectsClause));
430 auto *Clause =
new (Mem) OMPUpdateDependObjectsClause(StartLoc, EndLoc);
431 Clause->setLParenLoc(LParenLoc);
432 Clause->setArgumentLoc(ArgumentLoc);
433 Clause->setDependencyKind(DK);
437OMPUpdateDependObjectsClause *
438OMPUpdateDependObjectsClause::CreateEmpty(
const ASTContext &
C) {
440 C.Allocate(totalSizeToAlloc<SourceLocation, OpenMPDependClauseKind>(2, 1),
441 alignof(OMPUpdateDependObjectsClause));
442 auto *Clause =
new (Mem) OMPUpdateDependObjectsClause();
447 assert(VL.size() == varlist_size() &&
448 "Number of private copies is not the same as the preallocated buffer");
449 llvm::copy(VL, varlist_end());
457 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
458 OMPPrivateClause *Clause =
459 new (Mem) OMPPrivateClause(StartLoc, LParenLoc, EndLoc, VL.size());
460 Clause->setVarRefs(VL);
461 Clause->setPrivateCopies(PrivateVL);
465OMPPrivateClause *OMPPrivateClause::CreateEmpty(
const ASTContext &
C,
467 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * N));
468 return new (Mem) OMPPrivateClause(N);
472 assert(VL.size() == varlist_size() &&
473 "Number of private copies is not the same as the preallocated buffer");
474 llvm::copy(VL, varlist_end());
478 assert(VL.size() == varlist_size() &&
479 "Number of inits is not the same as the preallocated buffer");
480 llvm::copy(VL, getPrivateCopies().end());
483OMPFirstprivateClause *
488 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(3 * VL.size()));
489 OMPFirstprivateClause *Clause =
490 new (Mem) OMPFirstprivateClause(StartLoc, LParenLoc, EndLoc, VL.size());
491 Clause->setVarRefs(VL);
492 Clause->setPrivateCopies(PrivateVL);
493 Clause->setInits(InitVL);
494 Clause->setPreInitStmt(PreInit);
498OMPFirstprivateClause *OMPFirstprivateClause::CreateEmpty(
const ASTContext &
C,
500 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(3 * N));
501 return new (Mem) OMPFirstprivateClause(N);
504void OMPLastprivateClause::setPrivateCopies(
ArrayRef<Expr *> PrivateCopies) {
505 assert(PrivateCopies.size() == varlist_size() &&
506 "Number of private copies is not the same as the preallocated buffer");
507 llvm::copy(PrivateCopies, varlist_end());
511 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
512 "not the same as the "
513 "preallocated buffer");
514 llvm::copy(SrcExprs, getPrivateCopies().end());
518 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
519 "expressions is not the same as "
520 "the preallocated buffer");
521 llvm::copy(DstExprs, getSourceExprs().end());
524void OMPLastprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
525 assert(AssignmentOps.size() == varlist_size() &&
526 "Number of assignment expressions is not the same as the preallocated "
528 llvm::copy(AssignmentOps, getDestinationExprs().end());
531OMPLastprivateClause *OMPLastprivateClause::Create(
537 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
538 OMPLastprivateClause *Clause =
new (Mem) OMPLastprivateClause(
539 StartLoc, LParenLoc, EndLoc, LPKind, LPKindLoc, ColonLoc, VL.size());
540 Clause->setVarRefs(VL);
541 Clause->setSourceExprs(SrcExprs);
542 Clause->setDestinationExprs(DstExprs);
543 Clause->setAssignmentOps(AssignmentOps);
544 Clause->setPreInitStmt(PreInit);
545 Clause->setPostUpdateExpr(PostUpdate);
549OMPLastprivateClause *OMPLastprivateClause::CreateEmpty(
const ASTContext &
C,
551 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * N));
552 return new (Mem) OMPLastprivateClause(N);
555OMPSharedClause *OMPSharedClause::Create(
const ASTContext &
C,
560 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
561 OMPSharedClause *Clause =
562 new (Mem) OMPSharedClause(StartLoc, LParenLoc, EndLoc, VL.size());
563 Clause->setVarRefs(VL);
567OMPSharedClause *OMPSharedClause::CreateEmpty(
const ASTContext &
C,
unsigned N) {
568 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
569 return new (Mem) OMPSharedClause(N);
573 assert(PL.size() == varlist_size() &&
574 "Number of privates is not the same as the preallocated buffer");
575 llvm::copy(PL, varlist_end());
579 assert(IL.size() == varlist_size() &&
580 "Number of inits is not the same as the preallocated buffer");
585 assert(UL.size() == varlist_size() &&
586 "Number of updates is not the same as the preallocated buffer");
591 assert(FL.size() == varlist_size() &&
592 "Number of final updates is not the same as the preallocated buffer");
598 UE.size() == varlist_size() + 1 &&
599 "Number of used expressions is not the same as the preallocated buffer");
603OMPLinearClause *OMPLinearClause::Create(
613 C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2 + VL.size() + 1));
614 OMPLinearClause *Clause =
615 new (Mem) OMPLinearClause(StartLoc, LParenLoc, Modifier, ModifierLoc,
616 ColonLoc, StepModifierLoc, EndLoc, VL.size());
617 Clause->setVarRefs(VL);
618 Clause->setPrivates(PL);
619 Clause->setInits(IL);
622 std::fill(Clause->getInits().end(), Clause->getInits().end() + VL.size(),
624 std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(),
626 std::fill(Clause->getUsedExprs().begin(), Clause->getUsedExprs().end(),
628 Clause->setStep(Step);
629 Clause->setCalcStep(CalcStep);
630 Clause->setPreInitStmt(PreInit);
631 Clause->setPostUpdateExpr(PostUpdate);
635OMPLinearClause *OMPLinearClause::CreateEmpty(
const ASTContext &
C,
639 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2 + NumVars +1));
640 return new (Mem) OMPLinearClause(NumVars);
654 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
655 OMPAlignedClause *Clause =
new (Mem)
656 OMPAlignedClause(StartLoc, LParenLoc, ColonLoc, EndLoc, VL.size());
657 Clause->setVarRefs(VL);
658 Clause->setAlignment(A);
664 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumVars + 1));
665 return new (Mem) OMPAlignedClause(NumVars);
669 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
670 "not the same as the "
671 "preallocated buffer");
672 llvm::copy(SrcExprs, varlist_end());
676 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
677 "expressions is not the same as "
678 "the preallocated buffer");
679 llvm::copy(DstExprs, getSourceExprs().end());
683 assert(AssignmentOps.size() == varlist_size() &&
684 "Number of assignment expressions is not the same as the preallocated "
686 llvm::copy(AssignmentOps, getDestinationExprs().end());
693 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
694 OMPCopyinClause *Clause =
695 new (Mem) OMPCopyinClause(StartLoc, LParenLoc, EndLoc, VL.size());
696 Clause->setVarRefs(VL);
697 Clause->setSourceExprs(SrcExprs);
698 Clause->setDestinationExprs(DstExprs);
699 Clause->setAssignmentOps(AssignmentOps);
704 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * N));
705 return new (Mem) OMPCopyinClause(N);
709 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
710 "not the same as the "
711 "preallocated buffer");
712 llvm::copy(SrcExprs, varlist_end());
716 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
717 "expressions is not the same as "
718 "the preallocated buffer");
719 llvm::copy(DstExprs, getSourceExprs().end());
722void OMPCopyprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
723 assert(AssignmentOps.size() == varlist_size() &&
724 "Number of assignment expressions is not the same as the preallocated "
726 llvm::copy(AssignmentOps, getDestinationExprs().end());
733 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
734 OMPCopyprivateClause *Clause =
735 new (Mem) OMPCopyprivateClause(StartLoc, LParenLoc, EndLoc, VL.size());
736 Clause->setVarRefs(VL);
737 Clause->setSourceExprs(SrcExprs);
738 Clause->setDestinationExprs(DstExprs);
739 Clause->setAssignmentOps(AssignmentOps);
745 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * N));
746 return new (Mem) OMPCopyprivateClause(N);
750 assert(
Privates.size() == varlist_size() &&
751 "Number of private copies is not the same as the preallocated buffer");
752 llvm::copy(
Privates, varlist_end());
757 LHSExprs.size() == varlist_size() &&
758 "Number of LHS expressions is not the same as the preallocated buffer");
764 RHSExprs.size() == varlist_size() &&
765 "Number of RHS expressions is not the same as the preallocated buffer");
766 llvm::copy(RHSExprs, getLHSExprs().end());
770 assert(ReductionOps.size() == varlist_size() &&
"Number of reduction "
771 "expressions is not the same "
772 "as the preallocated buffer");
773 llvm::copy(ReductionOps, getRHSExprs().end());
777 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
778 assert(Ops.size() == varlist_size() &&
"Number of copy "
779 "expressions is not the same "
780 "as the preallocated buffer");
781 llvm::copy(Ops, getReductionOps().end());
784void OMPReductionClause::setInscanCopyArrayTemps(
786 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
787 assert(CopyArrayTemps.size() == varlist_size() &&
788 "Number of copy temp expressions is not the same as the preallocated "
790 llvm::copy(CopyArrayTemps, getInscanCopyOps().end());
793void OMPReductionClause::setInscanCopyArrayElems(
795 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
796 assert(CopyArrayElems.size() == varlist_size() &&
797 "Number of copy temp expressions is not the same as the preallocated "
799 llvm::copy(CopyArrayElems, getInscanCopyArrayTemps().end());
802OMPReductionClause *OMPReductionClause::Create(
813 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, bool>(
814 (Modifier == OMPC_REDUCTION_inscan ? 8 : 5) * VL.size(), VL.size()));
815 auto *Clause =
new (Mem) OMPReductionClause(
816 StartLoc, LParenLoc, ModifierLoc, EndLoc, ColonLoc, Modifier,
817 OrignalSharingModifier, VL.size(), QualifierLoc, NameInfo);
818 Clause->setVarRefs(VL);
820 Clause->setLHSExprs(LHSExprs);
821 Clause->setRHSExprs(RHSExprs);
822 Clause->setReductionOps(ReductionOps);
823 Clause->setPreInitStmt(PreInit);
824 Clause->setPostUpdateExpr(PostUpdate);
825 Clause->setPrivateVariableReductionFlags(IsPrivateVarReduction);
826 if (Modifier == OMPC_REDUCTION_inscan) {
827 Clause->setInscanCopyOps(CopyOps);
828 Clause->setInscanCopyArrayTemps(CopyArrayTemps);
829 Clause->setInscanCopyArrayElems(CopyArrayElems);
831 assert(CopyOps.empty() &&
832 "copy operations are expected in inscan reductions only.");
833 assert(CopyArrayTemps.empty() &&
834 "copy array temps are expected in inscan reductions only.");
835 assert(CopyArrayElems.empty() &&
836 "copy array temps are expected in inscan reductions only.");
842OMPReductionClause::CreateEmpty(
const ASTContext &
C,
unsigned N,
844 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, bool>(
845 (Modifier == OMPC_REDUCTION_inscan ? 8 : 5) * N, N));
846 auto *Clause =
new (Mem) OMPReductionClause(N);
847 Clause->setModifier(Modifier);
852 assert(
Privates.size() == varlist_size() &&
853 "Number of private copies is not the same as the preallocated buffer");
854 llvm::copy(
Privates, varlist_end());
859 LHSExprs.size() == varlist_size() &&
860 "Number of LHS expressions is not the same as the preallocated buffer");
866 RHSExprs.size() == varlist_size() &&
867 "Number of RHS expressions is not the same as the preallocated buffer");
868 llvm::copy(RHSExprs, getLHSExprs().end());
871void OMPTaskReductionClause::setReductionOps(
ArrayRef<Expr *> ReductionOps) {
872 assert(ReductionOps.size() == varlist_size() &&
"Number of task reduction "
873 "expressions is not the same "
874 "as the preallocated buffer");
875 llvm::copy(ReductionOps, getRHSExprs().end());
878OMPTaskReductionClause *OMPTaskReductionClause::Create(
885 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
886 OMPTaskReductionClause *Clause =
new (Mem) OMPTaskReductionClause(
887 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
888 Clause->setVarRefs(VL);
890 Clause->setLHSExprs(LHSExprs);
891 Clause->setRHSExprs(RHSExprs);
892 Clause->setReductionOps(ReductionOps);
893 Clause->setPreInitStmt(PreInit);
894 Clause->setPostUpdateExpr(PostUpdate);
898OMPTaskReductionClause *OMPTaskReductionClause::CreateEmpty(
const ASTContext &
C,
900 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * N));
901 return new (Mem) OMPTaskReductionClause(N);
905 assert(
Privates.size() == varlist_size() &&
906 "Number of private copies is not the same as the preallocated buffer");
907 llvm::copy(
Privates, varlist_end());
912 LHSExprs.size() == varlist_size() &&
913 "Number of LHS expressions is not the same as the preallocated buffer");
919 RHSExprs.size() == varlist_size() &&
920 "Number of RHS expressions is not the same as the preallocated buffer");
921 llvm::copy(RHSExprs, getLHSExprs().end());
925 assert(ReductionOps.size() == varlist_size() &&
"Number of in reduction "
926 "expressions is not the same "
927 "as the preallocated buffer");
928 llvm::copy(ReductionOps, getRHSExprs().end());
931void OMPInReductionClause::setTaskgroupDescriptors(
933 assert(TaskgroupDescriptors.size() == varlist_size() &&
934 "Number of in reduction descriptors is not the same as the "
935 "preallocated buffer");
936 llvm::copy(TaskgroupDescriptors, getReductionOps().end());
939OMPInReductionClause *OMPInReductionClause::Create(
946 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(6 * VL.size()));
947 OMPInReductionClause *Clause =
new (Mem) OMPInReductionClause(
948 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
949 Clause->setVarRefs(VL);
951 Clause->setLHSExprs(LHSExprs);
952 Clause->setRHSExprs(RHSExprs);
953 Clause->setReductionOps(ReductionOps);
954 Clause->setTaskgroupDescriptors(TaskgroupDescriptors);
955 Clause->setPreInitStmt(PreInit);
956 Clause->setPostUpdateExpr(PostUpdate);
960OMPInReductionClause *OMPInReductionClause::CreateEmpty(
const ASTContext &
C,
962 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(6 * N));
963 return new (Mem) OMPInReductionClause(N);
972 Clause->setLocStart(StartLoc);
973 Clause->setLParenLoc(LParenLoc);
974 Clause->setLocEnd(EndLoc);
975 Clause->setSizesRefs(Sizes);
981 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumSizes));
982 return new (Mem) OMPSizesClause(NumSizes);
989 OMPCountsClause *Clause =
CreateEmpty(
C, Counts.size());
990 Clause->setLocStart(StartLoc);
991 Clause->setLParenLoc(LParenLoc);
992 Clause->setLocEnd(EndLoc);
993 Clause->setCountsRefs(Counts);
994 Clause->setOmpFillIndex(FillIdx);
995 Clause->setOmpFillLoc(FillLoc);
1000 unsigned NumCounts) {
1001 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumCounts));
1002 return new (Mem) OMPCountsClause(NumCounts);
1010 OMPPermutationClause *Clause =
CreateEmpty(
C, Args.size());
1011 Clause->setLocStart(StartLoc);
1012 Clause->setLParenLoc(LParenLoc);
1013 Clause->setLocEnd(EndLoc);
1014 Clause->setArgRefs(Args);
1019 unsigned NumLoops) {
1020 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumLoops));
1021 return new (Mem) OMPPermutationClause(NumLoops);
1032 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1033 auto *Clause =
new (Mem) OMPAllocateClause(
1034 StartLoc, LParenLoc, Allocator, Alignment, ColonLoc, Modifier1,
1035 Modifier1Loc, Modifier2, Modifier2Loc, EndLoc, VL.size());
1037 Clause->setVarRefs(VL);
1043 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1044 return new (Mem) OMPAllocateClause(N);
1052 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1053 OMPFlushClause *Clause =
1054 new (Mem) OMPFlushClause(StartLoc, LParenLoc, EndLoc, VL.size());
1055 Clause->setVarRefs(VL);
1060 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1061 return new (Mem) OMPFlushClause(N);
1069 void *Mem =
C.Allocate(
1070 totalSizeToAlloc<Expr *>(VL.size() + 1 + NumLoops),
1071 alignof(OMPDependClause));
1072 OMPDependClause *Clause =
new (Mem)
1073 OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops);
1074 Clause->setDependencyKind(Data.DepKind);
1075 Clause->setDependencyLoc(Data.DepLoc);
1076 Clause->setColonLoc(Data.ColonLoc);
1077 Clause->setOmpAllMemoryLoc(Data.OmpAllMemoryLoc);
1078 Clause->setModifier(DepModifier);
1079 Clause->setVarRefs(VL);
1080 for (
unsigned I = 0 ; I < NumLoops; ++I)
1081 Clause->setLoopData(I,
nullptr);
1086 unsigned NumLoops) {
1088 C.Allocate(totalSizeToAlloc<Expr *>(N + 1 + NumLoops),
1089 alignof(OMPDependClause));
1090 return new (Mem) OMPDependClause(N, NumLoops);
1096 NumLoop < NumLoops &&
1097 "Expected sink or source depend + loop index must be less number of "
1099 auto *It = std::next(getVarRefs().end(), NumLoop + 1);
1106 NumLoop < NumLoops &&
1107 "Expected sink or source depend + loop index must be less number of "
1109 auto *It = std::next(getVarRefs().end(), NumLoop + 1);
1116 NumLoop < NumLoops &&
1117 "Expected sink or source depend + loop index must be less number of "
1119 const auto *It = std::next(getVarRefs().end(), NumLoop + 1);
1123void OMPDependClause::setModifier(
Expr *DepModifier) {
1124 *getVarRefs().end() = DepModifier;
1130 unsigned TotalNum = 0u;
1131 for (
auto &
C : ComponentLists)
1132 TotalNum +=
C.size();
1139 for (
const ValueDecl *D : Declarations) {
1141 UniqueDecls.insert(VD);
1143 return UniqueDecls.size();
1149 "Cannot get element-type from array-shaping expr.");
1163 if (
const auto *ATy = BaseType->getAsArrayTypeUnsafe())
1164 ElemTy = ATy->getElementType();
1172std::pair<const Expr *, std::optional<size_t>>
1178 if (Components.size() < 2)
1179 return {
nullptr, std::nullopt};
1184 if (Components.back().isNonContiguous() && CurDirKind == OMPD_target_update)
1185 return {
nullptr, std::nullopt};
1191 for (
auto [I, Component] : llvm::enumerate(Components)) {
1196 const Expr *CurExpr = Component.getAssociatedExpression();
1211 return {CurExpr, Components.size() - I};
1214 return {
nullptr, std::nullopt};
1241 void *Mem =
C.Allocate(
1247 OMPMapClause *Clause =
new (Mem)
1248 OMPMapClause(MapModifiers, MapModifiersLoc, UDMQualifierLoc, MapperId,
1251 Clause->setVarRefs(Vars);
1252 Clause->setUDMapperRefs(UDMapperRefs);
1253 Clause->setIteratorModifier(IteratorModifier);
1254 Clause->setClauseInfo(Declarations, ComponentLists);
1255 Clause->setMapType(
Type);
1263 void *Mem =
C.Allocate(
1269 OMPMapClause *Clause =
new (Mem) OMPMapClause(Sizes);
1270 Clause->setIteratorModifier(
nullptr);
1297 void *Mem =
C.Allocate(
1304 auto *Clause =
new (Mem) OMPToClause(MotionModifiers, MotionModifiersLoc,
1305 UDMQualifierLoc, MapperId, Locs, Sizes);
1307 Clause->setVarRefs(Vars);
1308 Clause->setUDMapperRefs(UDMapperRefs);
1309 Clause->setClauseInfo(Declarations, ComponentLists);
1310 Clause->setIteratorModifier(IteratorModifier);
1316 void *Mem =
C.Allocate(
1322 OMPToClause *Clause =
new (Mem) OMPToClause(Sizes);
1323 Clause->setIteratorModifier(
nullptr);
1350 void *Mem =
C.Allocate(
1358 new (Mem) OMPFromClause(MotionModifiers, MotionModifiersLoc,
1359 UDMQualifierLoc, MapperId, Locs, Sizes);
1361 Clause->setVarRefs(Vars);
1362 Clause->setUDMapperRefs(UDMapperRefs);
1363 Clause->setClauseInfo(Declarations, ComponentLists);
1364 Clause->setIteratorModifier(IteratorModifier);
1371 void *Mem =
C.Allocate(
1377 OMPFromClause *Clause =
new (Mem) OMPFromClause(Sizes);
1378 Clause->setIteratorModifier(
nullptr);
1383 assert(VL.size() == varlist_size() &&
1384 "Number of private copies is not the same as the preallocated buffer");
1385 llvm::copy(VL, varlist_end());
1389 assert(VL.size() == varlist_size() &&
1390 "Number of inits is not the same as the preallocated buffer");
1391 llvm::copy(VL, getPrivateCopies().end());
1417 void *Mem =
C.Allocate(
1424 OMPUseDevicePtrClause *Clause =
new (Mem)
1425 OMPUseDevicePtrClause(Locs, Sizes, FallbackModifier, FallbackModifierLoc);
1427 Clause->setVarRefs(Vars);
1428 Clause->setPrivateCopies(PrivateVars);
1429 Clause->setInits(
Inits);
1430 Clause->setClauseInfo(Declarations, ComponentLists);
1437 void *Mem =
C.Allocate(
1443 return new (Mem) OMPUseDevicePtrClause(Sizes);
1467 void *Mem =
C.Allocate(
1474 auto *Clause =
new (Mem) OMPUseDeviceAddrClause(Locs, Sizes);
1476 Clause->setVarRefs(Vars);
1477 Clause->setClauseInfo(Declarations, ComponentLists);
1484 void *Mem =
C.Allocate(
1490 return new (Mem) OMPUseDeviceAddrClause(Sizes);
1514 void *Mem =
C.Allocate(
1521 OMPIsDevicePtrClause *Clause =
new (Mem) OMPIsDevicePtrClause(Locs, Sizes);
1523 Clause->setVarRefs(Vars);
1524 Clause->setClauseInfo(Declarations, ComponentLists);
1531 void *Mem =
C.Allocate(
1537 return new (Mem) OMPIsDevicePtrClause(Sizes);
1561 void *Mem =
C.Allocate(
1568 auto *Clause =
new (Mem) OMPHasDeviceAddrClause(Locs, Sizes);
1570 Clause->setVarRefs(Vars);
1571 Clause->setClauseInfo(Declarations, ComponentLists);
1578 void *Mem =
C.Allocate(
1584 return new (Mem) OMPHasDeviceAddrClause(Sizes);
1593 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
1595 new (Mem) OMPNontemporalClause(StartLoc, LParenLoc, EndLoc, VL.size());
1596 Clause->setVarRefs(VL);
1602 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * N));
1603 return new (Mem) OMPNontemporalClause(N);
1607 assert(VL.size() == varlist_size() &&
"Number of private references is not "
1608 "the same as the preallocated buffer");
1609 llvm::copy(VL, varlist_end());
1617 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1619 new (Mem) OMPInclusiveClause(StartLoc, LParenLoc, EndLoc, VL.size());
1620 Clause->setVarRefs(VL);
1626 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1627 return new (Mem) OMPInclusiveClause(N);
1635 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1637 new (Mem) OMPExclusiveClause(StartLoc, LParenLoc, EndLoc, VL.size());
1638 Clause->setVarRefs(VL);
1644 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1645 return new (Mem) OMPExclusiveClause(N);
1648void OMPUsesAllocatorsClause::setAllocatorsData(
1650 assert(
Data.size() == NumOfAllocators &&
1651 "Size of allocators data is not the same as the preallocated buffer.");
1652 for (
unsigned I = 0, E =
Data.size(); I < E; ++I) {
1654 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1655 static_cast<int>(ExprOffsets::Allocator)] =
1657 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1659 ExprOffsets::AllocatorTraits)] =
1662 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1663 static_cast<int>(ParenLocsOffsets::LParen)] =
1666 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1667 static_cast<int>(ParenLocsOffsets::RParen)] =
1672OMPUsesAllocatorsClause::Data
1676 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1677 static_cast<int>(ExprOffsets::Allocator)];
1679 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1681 ExprOffsets::AllocatorTraits)];
1683 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1684 static_cast<int>(ParenLocsOffsets::LParen)];
1686 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1687 static_cast<int>(ParenLocsOffsets::RParen)];
1695 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, SourceLocation>(
1696 static_cast<int>(ExprOffsets::Total) *
Data.size(),
1697 static_cast<int>(ParenLocsOffsets::Total) *
Data.size()));
1698 auto *Clause =
new (Mem)
1699 OMPUsesAllocatorsClause(StartLoc, LParenLoc, EndLoc,
Data.size());
1700 Clause->setAllocatorsData(
Data);
1706 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, SourceLocation>(
1707 static_cast<int>(ExprOffsets::Total) * N,
1708 static_cast<int>(ParenLocsOffsets::Total) * N));
1709 return new (Mem) OMPUsesAllocatorsClause(N);
1717 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(Locators.size() + 1));
1718 auto *Clause =
new (Mem)
1719 OMPAffinityClause(StartLoc, LParenLoc, ColonLoc, EndLoc, Locators.size());
1720 Clause->setModifier(Modifier);
1721 Clause->setVarRefs(Locators);
1727 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1728 return new (Mem) OMPAffinityClause(N);
1738 unsigned NumPrefs = InteropInfo.
Prefs.size();
1739 unsigned NumAttrs = 0;
1741 NumAttrs += P.
Attrs.size();
1744 void *Mem =
C.Allocate(
1745 totalSizeToAlloc<Expr *, unsigned>(1 + NumPrefs + NumAttrs, NumPrefs));
1746 auto *Clause =
new (Mem)
1748 LParenLoc, VarLoc, EndLoc, 1 + NumPrefs);
1749 Clause->NumAttrs = NumAttrs;
1752 Expr **E = Clause->getTrailingObjects<
Expr *>();
1754 for (
unsigned I = 0; I < NumPrefs; ++I)
1755 E[1 + I] = InteropInfo.
Prefs[I].Fr;
1756 unsigned *AttrEnds = Clause->getTrailingObjects<
unsigned>();
1757 unsigned AttrBase = 1 + NumPrefs;
1758 unsigned AttrPos = AttrBase;
1759 for (
unsigned I = 0; I < NumPrefs; ++I) {
1760 for (
Expr *A : InteropInfo.
Prefs[I].Attrs)
1762 AttrEnds[I] = AttrPos - AttrBase;
1769 unsigned NumAttrs) {
1770 void *Mem =
C.Allocate(
1771 totalSizeToAlloc<Expr *, unsigned>(1 + NumPrefs + NumAttrs, NumPrefs));
1772 auto *Clause =
new (Mem) OMPInitClause(1 + NumPrefs);
1773 Clause->NumAttrs = NumAttrs;
1779 assert(Counts.size() == getNumPrefs() &&
1780 "attr-count vector size must match number of pref-specs");
1781 assert(Attrs.size() == NumAttrs &&
1782 "attr-expr count must match preallocated NumAttrs");
1784 unsigned *AttrEnds = getTrailingObjects<unsigned>();
1786 for (
unsigned I = 0, E = Counts.size(); I < E; ++I) {
1790 llvm::copy(Attrs, getTrailingObjects<Expr *>() + varlist_size());
1799 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + NumLoops),
1800 alignof(OMPDoacrossClause));
1801 OMPDoacrossClause *Clause =
new (Mem)
1802 OMPDoacrossClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops);
1803 Clause->setDependenceType(DepType);
1804 Clause->setDependenceLoc(DepLoc);
1805 Clause->setColonLoc(ColonLoc);
1806 Clause->setVarRefs(VL);
1807 for (
unsigned I = 0; I < NumLoops; ++I)
1808 Clause->setLoopData(I,
nullptr);
1814 unsigned NumLoops) {
1815 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + NumLoops),
1816 alignof(OMPDoacrossClause));
1817 return new (Mem) OMPDoacrossClause(N, NumLoops);
1821 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1822 auto *It = std::next(getVarRefs().end(), NumLoop);
1827 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1828 auto *It = std::next(getVarRefs().end(), NumLoop);
1833 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1834 const auto *It = std::next(getVarRefs().end(), NumLoop);
1838OMPAbsentClause *OMPAbsentClause::Create(
const ASTContext &
C,
1843 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(DKVec.size()),
1844 alignof(OMPAbsentClause));
1845 auto *AC =
new (Mem) OMPAbsentClause(Loc, LLoc, RLoc, DKVec.size());
1846 AC->setDirectiveKinds(DKVec);
1850OMPAbsentClause *OMPAbsentClause::CreateEmpty(
const ASTContext &
C,
unsigned K) {
1851 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(K),
1852 alignof(OMPAbsentClause));
1853 return new (Mem) OMPAbsentClause(K);
1856OMPContainsClause *OMPContainsClause::Create(
1859 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(DKVec.size()),
1860 alignof(OMPContainsClause));
1861 auto *CC =
new (Mem) OMPContainsClause(Loc, LLoc, RLoc, DKVec.size());
1862 CC->setDirectiveKinds(DKVec);
1866OMPContainsClause *OMPContainsClause::CreateEmpty(
const ASTContext &
C,
1868 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(K),
1869 alignof(OMPContainsClause));
1870 return new (Mem) OMPContainsClause(K);
1879 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1880 OMPNumTeamsClause *Clause =
1881 new (Mem) OMPNumTeamsClause(
C, StartLoc, LParenLoc, EndLoc, VL.size());
1882 Clause->setVarRefs(VL);
1883 Clause->setModifier(Modifier);
1884 Clause->setModifierExpr(ModifierExpr);
1885 Clause->setModifierLoc(ModifierLoc);
1886 Clause->setPreInitStmt(PreInit, CaptureRegion);
1893 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1894 return new (Mem) OMPNumTeamsClause(N);
1903 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1904 OMPThreadLimitClause *Clause =
1905 new (Mem) OMPThreadLimitClause(
C, StartLoc, LParenLoc, EndLoc, VL.size());
1906 Clause->setVarRefs(VL);
1907 Clause->setModifier(Modifier);
1908 Clause->setModifierExpr(ModifierExpr);
1909 Clause->setModifierLoc(ModifierLoc);
1910 Clause->setPreInitStmt(PreInit, CaptureRegion);
1917 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1918 return new (Mem) OMPThreadLimitClause(N);
1928 Expr *DimsModifierExpr,
Stmt *PreInit) {
1930 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1931 OMPNumThreadsClause *Clause =
1932 new (Mem) OMPNumThreadsClause(
C, StartLoc, LParenLoc, EndLoc, VL.size());
1933 Clause->setVarRefs(VL);
1934 Clause->setPrescriptivenessModifier(PrescriptivenessModifier);
1935 Clause->setPrescriptivenessModifierLoc(PrescriptivenessModifierLoc);
1936 Clause->setDimsModifier(DimsModifier);
1937 Clause->setDimsModifierExpr(DimsModifierExpr);
1938 Clause->setDimsModifierLoc(DimsModifierLoc);
1939 Clause->setPreInitStmt(PreInit, CaptureRegion);
1946 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1947 return new (Mem) OMPNumThreadsClause(N);
1954void OMPClausePrinter::VisitOMPIfClause(
OMPIfClause *Node) {
1957 OS << getOpenMPDirectiveName(Node->
getNameModifier(), Version) <<
": ";
1962void OMPClausePrinter::VisitOMPFinalClause(
OMPFinalClause *Node) {
1970 OS <<
"num_threads";
1971 bool HasPrescriptiveness =
1974 if (HasPrescriptiveness || HasDims) {
1976 if (HasPrescriptiveness)
1979 if (HasPrescriptiveness && HasDims)
1987 VisitOMPClauseList(Node,
' ');
1989 VisitOMPClauseList(Node,
'(');
1995void OMPClausePrinter::VisitOMPAlignClause(
OMPAlignClause *Node) {
2013void OMPClausePrinter::VisitOMPSizesClause(
OMPSizesClause *Node) {
2019 Size->printPretty(OS,
nullptr, Policy, 0);
2029 llvm::interleaveComma(llvm::seq<unsigned>(Refs.size()), OS, [&](
unsigned I) {
2030 if (FillIdx && I == *FillIdx)
2033 Refs[I]->printPretty(OS, nullptr, Policy, 0);
2039 OS <<
"permutation(";
2041 E->printPretty(OS, nullptr, Policy, 0);
2046void OMPClausePrinter::VisitOMPFullClause(
OMPFullClause *Node) {
OS <<
"full"; }
2048void OMPClausePrinter::VisitOMPDepthClause(
OMPDepthClause *Node) {
2052 Depth->printPretty(OS,
nullptr, Policy, 0);
2062 Factor->printPretty(OS,
nullptr, Policy, 0);
2073 if (
First && Count) {
2075 First->printPretty(OS,
nullptr, Policy, 0);
2094void OMPClausePrinter::VisitOMPDetachClause(OMPDetachClause *Node) {
2104 if (Version >= 60 && Node->
getDefaultVC() != OMPC_DEFAULT_VC_all) {
2119void OMPClausePrinter::VisitOMPTransparentClause(OMPTransparentClause *Node) {
2120 OS <<
"transparent(";
2121 if (Node->getImpexType())
2122 Node->getImpexType()->printPretty(OS,
nullptr, Policy, 0);
2128void OMPClausePrinter::VisitOMPProcBindClause(OMPProcBindClause *Node) {
2131 unsigned(Node->getProcBindKind()))
2135void OMPClausePrinter::VisitOMPUnifiedAddressClause(OMPUnifiedAddressClause *) {
2136 OS <<
"unified_address";
2139void OMPClausePrinter::VisitOMPUnifiedSharedMemoryClause(
2140 OMPUnifiedSharedMemoryClause *) {
2141 OS <<
"unified_shared_memory";
2144void OMPClausePrinter::VisitOMPReverseOffloadClause(OMPReverseOffloadClause *) {
2145 OS <<
"reverse_offload";
2148void OMPClausePrinter::VisitOMPDynamicAllocatorsClause(
2149 OMPDynamicAllocatorsClause *) {
2150 OS <<
"dynamic_allocators";
2153void OMPClausePrinter::VisitOMPAtomicDefaultMemOrderClause(
2154 OMPAtomicDefaultMemOrderClause *Node) {
2155 OS <<
"atomic_default_mem_order("
2157 Node->getAtomicDefaultMemOrderKind())
2161void OMPClausePrinter::VisitOMPSelfMapsClause(OMPSelfMapsClause *) {
2165void OMPClausePrinter::VisitOMPAtClause(OMPAtClause *Node) {
2170void OMPClausePrinter::VisitOMPSeverityClause(OMPSeverityClause *Node) {
2176void OMPClausePrinter::VisitOMPMessageClause(OMPMessageClause *Node) {
2178 if (
Expr *E = Node->getMessageString())
2179 E->printPretty(OS,
nullptr, Policy);
2183void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
2187 Node->getFirstScheduleModifier());
2191 Node->getSecondScheduleModifier());
2196 if (
auto *E = Node->getChunkSize()) {
2198 E->printPretty(OS,
nullptr, Policy);
2203void OMPClausePrinter::VisitOMPOrderedClause(OMPOrderedClause *Node) {
2205 if (
auto *
Num = Node->getNumForLoops()) {
2207 Num->printPretty(OS,
nullptr, Policy, 0);
2212void OMPClausePrinter::VisitOMPNowaitClause(OMPNowaitClause *Node) {
2214 if (
auto *Cond = Node->getCondition()) {
2216 Cond->printPretty(OS,
nullptr, Policy, 0);
2221void OMPClausePrinter::VisitOMPUntiedClause(OMPUntiedClause *) {
2225void OMPClausePrinter::VisitOMPNogroupClause(OMPNogroupClause *) {
2229void OMPClausePrinter::VisitOMPMergeableClause(OMPMergeableClause *) {
2233void OMPClausePrinter::VisitOMPReadClause(OMPReadClause *) {
OS <<
"read"; }
2235void OMPClausePrinter::VisitOMPWriteClause(OMPWriteClause *) {
OS <<
"write"; }
2237void OMPClausePrinter::VisitOMPUpdateClause(OMPUpdateClause *) {
2241void OMPClausePrinter::VisitOMPUpdateDependObjectsClause(
2242 OMPUpdateDependObjectsClause *Node) {
2245 Node->getDependencyKind());
2249void OMPClausePrinter::VisitOMPCaptureClause(OMPCaptureClause *) {
2253void OMPClausePrinter::VisitOMPCompareClause(OMPCompareClause *) {
2257void OMPClausePrinter::VisitOMPFailClause(OMPFailClause *Node) {
2262 Node->getClauseKind(),
static_cast<int>(Node->getFailParameter()));
2267void OMPClausePrinter::VisitOMPAbsentClause(OMPAbsentClause *Node) {
2270 for (
auto &D : Node->getDirectiveKinds()) {
2273 OS << getOpenMPDirectiveName(D, Version);
2279void OMPClausePrinter::VisitOMPHoldsClause(OMPHoldsClause *Node) {
2281 Node->getExpr()->printPretty(OS,
nullptr, Policy, 0);
2285void OMPClausePrinter::VisitOMPContainsClause(OMPContainsClause *Node) {
2288 for (
auto &D : Node->getDirectiveKinds()) {
2291 OS << getOpenMPDirectiveName(D, Version);
2297void OMPClausePrinter::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {
2301void OMPClausePrinter::VisitOMPNoOpenMPRoutinesClause(
2302 OMPNoOpenMPRoutinesClause *) {
2303 OS <<
"no_openmp_routines";
2306void OMPClausePrinter::VisitOMPNoOpenMPConstructsClause(
2307 OMPNoOpenMPConstructsClause *) {
2308 OS <<
"no_openmp_constructs";
2311void OMPClausePrinter::VisitOMPNoParallelismClause(OMPNoParallelismClause *) {
2312 OS <<
"no_parallelism";
2315void OMPClausePrinter::VisitOMPSeqCstClause(OMPSeqCstClause *) {
2319void OMPClausePrinter::VisitOMPAcqRelClause(OMPAcqRelClause *) {
2323void OMPClausePrinter::VisitOMPAcquireClause(OMPAcquireClause *) {
2327void OMPClausePrinter::VisitOMPReleaseClause(OMPReleaseClause *) {
2331void OMPClausePrinter::VisitOMPRelaxedClause(OMPRelaxedClause *) {
2335void OMPClausePrinter::VisitOMPWeakClause(OMPWeakClause *) {
OS <<
"weak"; }
2337void OMPClausePrinter::VisitOMPThreadsClause(OMPThreadsClause *) {
2341void OMPClausePrinter::VisitOMPSIMDClause(OMPSIMDClause *) {
OS <<
"simd"; }
2343void OMPClausePrinter::VisitOMPDeviceClause(OMPDeviceClause *Node) {
2354void OMPClausePrinter::VisitOMPNumTeamsClause(OMPNumTeamsClause *Node) {
2355 if (!Node->varlist_empty()) {
2364 VisitOMPClauseList(Node,
':');
2366 VisitOMPClauseList(Node,
'(');
2372void OMPClausePrinter::VisitOMPThreadLimitClause(OMPThreadLimitClause *Node) {
2373 if (!Node->varlist_empty()) {
2374 OS <<
"thread_limit";
2375 if (Node->
getModifier() == OMPC_THREADLIMIT_dims) {
2379 VisitOMPClauseList(Node,
':');
2381 VisitOMPClauseList(Node,
'(');
2387void OMPClausePrinter::VisitOMPPriorityClause(OMPPriorityClause *Node) {
2393void OMPClausePrinter::VisitOMPGrainsizeClause(OMPGrainsizeClause *Node) {
2404void OMPClausePrinter::VisitOMPNumTasksClause(OMPNumTasksClause *Node) {
2415void OMPClausePrinter::VisitOMPHintClause(OMPHintClause *Node) {
2421void OMPClausePrinter::VisitOMPInitClause(OMPInitClause *Node) {
2423 if (!Node->
prefs().empty()) {
2424 OS <<
"prefer_type(";
2427 llvm::interleaveComma(Node->
prefs(), OS, [&](OMPInitClause::PrefView P) {
2431 P.Fr->printPretty(OS, nullptr, Policy);
2433 if (!P.Attrs.empty())
2438 llvm::interleaveComma(P.Attrs, OS, [&](const Expr *A) {
2439 A->printPretty(OS, nullptr, Policy);
2448 [&](OMPInitClause::PrefView P) {
2450 P.Fr->printPretty(OS, nullptr, Policy);
2468void OMPClausePrinter::VisitOMPUseClause(OMPUseClause *Node) {
2474void OMPClausePrinter::VisitOMPDestroyClause(OMPDestroyClause *Node) {
2478 E->printPretty(OS,
nullptr, Policy);
2483void OMPClausePrinter::VisitOMPNovariantsClause(OMPNovariantsClause *Node) {
2487 E->printPretty(OS,
nullptr, Policy, 0);
2492void OMPClausePrinter::VisitOMPNocontextClause(OMPNocontextClause *Node) {
2496 E->printPretty(OS,
nullptr, Policy, 0);
2502void OMPClausePrinter::VisitOMPClauseList(
T *Node,
char StartSym) {
2503 for (
typename T::varlist_iterator I = Node->varlist_begin(),
2504 E = Node->varlist_end();
2506 assert(*I &&
"Expected non-null Stmt");
2507 OS << (I == Node->varlist_begin() ? StartSym :
',');
2508 if (
auto *DRE = dyn_cast<DeclRefExpr>(*I)) {
2510 DRE->printPretty(OS,
nullptr, Policy, 0);
2512 DRE->getDecl()->printQualifiedName(OS);
2514 (*I)->printPretty(OS,
nullptr, Policy, 0);
2522 Expr *FirstModifier =
nullptr;
2523 Expr *SecondModifier =
nullptr;
2528 if (FirstAllocMod == OMPC_ALLOCATE_allocator ||
2539 if (FirstModifier) {
2541 if (!FirstUnknown) {
2545 FirstModifier->
printPretty(OS,
nullptr, Policy, 0);
2548 if (SecondModifier) {
2550 if (!SecondUnknown) {
2555 SecondModifier->
printPretty(OS,
nullptr, Policy, 0);
2560 VisitOMPClauseList(Node,
' ');
2563 VisitOMPClauseList(Node,
'(');
2568void OMPClausePrinter::VisitOMPPrivateClause(OMPPrivateClause *Node) {
2569 if (!Node->varlist_empty()) {
2571 VisitOMPClauseList(Node,
'(');
2576void OMPClausePrinter::VisitOMPFirstprivateClause(OMPFirstprivateClause *Node) {
2577 if (!Node->varlist_empty()) {
2578 OS <<
"firstprivate";
2579 VisitOMPClauseList(Node,
'(');
2584void OMPClausePrinter::VisitOMPLastprivateClause(OMPLastprivateClause *Node) {
2585 if (!Node->varlist_empty()) {
2586 OS <<
"lastprivate";
2598void OMPClausePrinter::VisitOMPSharedClause(OMPSharedClause *Node) {
2599 if (!Node->varlist_empty()) {
2601 VisitOMPClauseList(Node,
'(');
2606void OMPClausePrinter::VisitOMPReductionClause(OMPReductionClause *Node) {
2607 if (!Node->varlist_empty()) {
2609 if (Node->getModifierLoc().isValid())
2613 Node->getQualifierLoc().getNestedNameSpecifier();
2615 Node->getNameInfo().getName().getCXXOverloadedOperator();
2616 if (!Qualifier && OOK !=
OO_None) {
2622 OS << Node->getNameInfo();
2625 VisitOMPClauseList(Node,
' ');
2630void OMPClausePrinter::VisitOMPTaskReductionClause(
2631 OMPTaskReductionClause *Node) {
2632 if (!Node->varlist_empty()) {
2633 OS <<
"task_reduction(";
2635 Node->getQualifierLoc().getNestedNameSpecifier();
2637 Node->getNameInfo().getName().getCXXOverloadedOperator();
2638 if (!Qualifier && OOK !=
OO_None) {
2644 OS << Node->getNameInfo();
2647 VisitOMPClauseList(Node,
' ');
2652void OMPClausePrinter::VisitOMPInReductionClause(OMPInReductionClause *Node) {
2653 if (!Node->varlist_empty()) {
2654 OS <<
"in_reduction(";
2656 Node->getQualifierLoc().getNestedNameSpecifier();
2658 Node->getNameInfo().getName().getCXXOverloadedOperator();
2659 if (!Qualifier && OOK !=
OO_None) {
2665 OS << Node->getNameInfo();
2668 VisitOMPClauseList(Node,
' ');
2673void OMPClausePrinter::VisitOMPLinearClause(OMPLinearClause *Node) {
2674 if (!Node->varlist_empty()) {
2676 VisitOMPClauseList(Node,
'(');
2677 if (Node->getModifierLoc().isValid() || Node->getStep() !=
nullptr) {
2680 if (Node->getModifierLoc().isValid()) {
2683 if (Node->getStep() !=
nullptr) {
2684 if (Node->getModifierLoc().isValid()) {
2688 Node->getStep()->printPretty(OS,
nullptr, Policy, 0);
2695void OMPClausePrinter::VisitOMPAlignedClause(OMPAlignedClause *Node) {
2696 if (!Node->varlist_empty()) {
2698 VisitOMPClauseList(Node,
'(');
2707void OMPClausePrinter::VisitOMPCopyinClause(OMPCopyinClause *Node) {
2708 if (!Node->varlist_empty()) {
2710 VisitOMPClauseList(Node,
'(');
2715void OMPClausePrinter::VisitOMPCopyprivateClause(OMPCopyprivateClause *Node) {
2716 if (!Node->varlist_empty()) {
2717 OS <<
"copyprivate";
2718 VisitOMPClauseList(Node,
'(');
2723void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) {
2724 if (!Node->varlist_empty()) {
2725 VisitOMPClauseList(Node,
'(');
2730void OMPClausePrinter::VisitOMPDepobjClause(OMPDepobjClause *Node) {
2736void OMPClausePrinter::VisitOMPDependClause(OMPDependClause *Node) {
2744 bool IsOmpAllMemory =
false;
2745 if (PrintKind == OMPC_DEPEND_outallmemory) {
2746 PrintKind = OMPC_DEPEND_out;
2747 IsOmpAllMemory =
true;
2748 }
else if (PrintKind == OMPC_DEPEND_inoutallmemory) {
2749 PrintKind = OMPC_DEPEND_inout;
2750 IsOmpAllMemory =
true;
2753 if (!Node->varlist_empty() || IsOmpAllMemory)
2755 VisitOMPClauseList(Node,
' ');
2756 if (IsOmpAllMemory) {
2757 OS << (Node->varlist_empty() ?
" " :
",");
2758 OS <<
"omp_all_memory";
2763template <
typename T>
2768 Node->getMapperQualifierLoc().getNestedNameSpecifier();
2769 MapperNNS.
print(OS, Policy);
2770 OS << Node->getMapperIdInfo() <<
')';
2773template <
typename T>
2776 if (
Expr *IteratorModifier = Node->getIteratorModifier())
2777 IteratorModifier->printPretty(OS,
nullptr, Policy);
2780void OMPClausePrinter::VisitOMPMapClause(OMPMapClause *Node) {
2781 if (!Node->varlist_empty()) {
2800 VisitOMPClauseList(Node,
' ');
2805template <
typename T>
void OMPClausePrinter::VisitOMPMotionClause(
T *Node) {
2806 if (Node->varlist_empty())
2808 OS << getOpenMPClauseName(Node->getClauseKind());
2809 unsigned ModifierCount = 0;
2814 if (ModifierCount) {
2818 if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator) {
2822 Node->getMotionModifier(I));
2823 if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)
2825 if (I < ModifierCount - 1)
2831 VisitOMPClauseList(Node,
' ');
2833 VisitOMPClauseList(Node,
'(');
2838void OMPClausePrinter::VisitOMPToClause(OMPToClause *Node) {
2839 VisitOMPMotionClause(Node);
2842void OMPClausePrinter::VisitOMPFromClause(OMPFromClause *Node) {
2843 VisitOMPMotionClause(Node);
2846void OMPClausePrinter::VisitOMPDistScheduleClause(OMPDistScheduleClause *Node) {
2851 E->printPretty(OS,
nullptr, Policy);
2856void OMPClausePrinter::VisitOMPDefaultmapClause(OMPDefaultmapClause *Node) {
2857 OS <<
"defaultmap(";
2868void OMPClausePrinter::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *Node) {
2869 if (!Node->varlist_empty()) {
2870 OS <<
"use_device_ptr";
2876 VisitOMPClauseList(Node,
' ');
2878 VisitOMPClauseList(Node,
'(');
2884void OMPClausePrinter::VisitOMPUseDeviceAddrClause(
2885 OMPUseDeviceAddrClause *Node) {
2886 if (!Node->varlist_empty()) {
2887 OS <<
"use_device_addr";
2888 VisitOMPClauseList(Node,
'(');
2893void OMPClausePrinter::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *Node) {
2894 if (!Node->varlist_empty()) {
2895 OS <<
"is_device_ptr";
2896 VisitOMPClauseList(Node,
'(');
2901void OMPClausePrinter::VisitOMPHasDeviceAddrClause(OMPHasDeviceAddrClause *Node) {
2902 if (!Node->varlist_empty()) {
2903 OS <<
"has_device_addr";
2904 VisitOMPClauseList(Node,
'(');
2909void OMPClausePrinter::VisitOMPNontemporalClause(OMPNontemporalClause *Node) {
2910 if (!Node->varlist_empty()) {
2911 OS <<
"nontemporal";
2912 VisitOMPClauseList(Node,
'(');
2917void OMPClausePrinter::VisitOMPOrderClause(OMPOrderClause *Node) {
2926void OMPClausePrinter::VisitOMPInclusiveClause(OMPInclusiveClause *Node) {
2927 if (!Node->varlist_empty()) {
2929 VisitOMPClauseList(Node,
'(');
2934void OMPClausePrinter::VisitOMPExclusiveClause(OMPExclusiveClause *Node) {
2935 if (!Node->varlist_empty()) {
2937 VisitOMPClauseList(Node,
'(');
2942void OMPClausePrinter::VisitOMPUsesAllocatorsClause(
2943 OMPUsesAllocatorsClause *Node) {
2946 OS <<
"uses_allocators(";
2949 Data.Allocator->printPretty(OS,
nullptr, Policy);
2950 if (
Data.AllocatorTraits) {
2952 Data.AllocatorTraits->printPretty(OS,
nullptr, Policy);
2961void OMPClausePrinter::VisitOMPAffinityClause(OMPAffinityClause *Node) {
2962 if (Node->varlist_empty())
2965 char StartSym =
'(';
2968 Modifier->printPretty(OS,
nullptr, Policy);
2972 VisitOMPClauseList(Node, StartSym);
2976void OMPClausePrinter::VisitOMPFilterClause(OMPFilterClause *Node) {
2982void OMPClausePrinter::VisitOMPBindClause(OMPBindClause *Node) {
2988void OMPClausePrinter::VisitOMPXDynCGroupMemClause(
2989 OMPXDynCGroupMemClause *Node) {
2990 OS <<
"ompx_dyn_cgroup_mem(";
2995void OMPClausePrinter::VisitOMPDynGroupprivateClause(
2996 OMPDynGroupprivateClause *Node) {
2997 OS <<
"dyn_groupprivate(";
3013void OMPClausePrinter::VisitOMPDoacrossClause(OMPDoacrossClause *Node) {
3018 case OMPC_DOACROSS_source:
3021 case OMPC_DOACROSS_sink:
3024 case OMPC_DOACROSS_source_omp_cur_iteration:
3025 OS <<
"source: omp_cur_iteration";
3027 case OMPC_DOACROSS_sink_omp_cur_iteration:
3028 OS <<
"sink: omp_cur_iteration - 1";
3031 llvm_unreachable(
"unknown docaross modifier");
3033 VisitOMPClauseList(Node,
' ');
3037void OMPClausePrinter::VisitOMPXAttributeClause(OMPXAttributeClause *Node) {
3038 OS <<
"ompx_attribute(";
3049void OMPClausePrinter::VisitOMPXBareClause(OMPXBareClause *Node) {
3054 VariantMatchInfo &VMI)
const {
3059 if (
Selector.Kind == TraitSelector::user_condition) {
3060 assert(
Selector.ScoreOrCondition &&
3061 "Ill-formed user condition, expected condition expression!");
3062 assert(
Selector.Properties.size() == 1 &&
3063 Selector.Properties.front().Kind ==
3064 TraitProperty::user_condition_unknown &&
3065 "Ill-formed user condition, expected unknown trait property!");
3067 if (std::optional<APSInt> CondVal =
3068 Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx))
3069 VMI.addTrait(CondVal->isZero() ? TraitProperty::user_condition_false
3070 : TraitProperty::user_condition_true,
3073 VMI.addTrait(TraitProperty::user_condition_false,
"<condition>");
3077 std::optional<llvm::APSInt> Score;
3078 llvm::APInt *ScorePtr =
nullptr;
3080 if ((Score =
Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx)))
3083 VMI.addTrait(TraitProperty::user_condition_false,
3084 "<non-constant-score>");
3088 VMI.addTrait(
Set.Kind, Property.Kind, Property.RawString, ScorePtr);
3090 if (
Set.Kind != TraitSet::construct)
3094 assert(
Selector.Properties.size() == 1 &&
3095 Selector.Properties.front().Kind ==
3096 getOpenMPContextTraitPropertyForSelector(
3098 "Ill-formed construct selector!");
3105 bool FirstSet =
true;
3110 OS << getOpenMPContextTraitSetName(
Set.Kind) <<
"={";
3112 bool FirstSelector =
true;
3116 FirstSelector =
false;
3117 OS << getOpenMPContextTraitSelectorName(
Selector.Kind);
3119 bool AllowsTraitScore =
false;
3120 bool RequiresProperty =
false;
3121 isValidTraitSelectorForTraitSet(
3122 Selector.Kind,
Set.Kind, AllowsTraitScore, RequiresProperty);
3124 if (!RequiresProperty)
3128 if (
Selector.Kind == TraitSelector::user_condition) {
3130 Selector.ScoreOrCondition->printPretty(OS,
nullptr, Policy);
3137 Selector.ScoreOrCondition->printPretty(OS,
nullptr, Policy);
3141 bool FirstProperty =
true;
3145 FirstProperty =
false;
3146 OS << getOpenMPContextTraitPropertyName(Property.Kind,
3147 Property.RawString);
3157 std::string MangledName;
3158 llvm::raw_string_ostream OS(MangledName);
3163 bool AllowsTraitScore =
false;
3164 bool RequiresProperty =
false;
3165 isValidTraitSelectorForTraitSet(
3166 Selector.Kind,
Set.Kind, AllowsTraitScore, RequiresProperty);
3169 if (!RequiresProperty ||
3170 Selector.Kind == TraitSelector::user_condition)
3175 << getOpenMPContextTraitPropertyName(Property.Kind,
3176 Property.RawString);
3182OMPTraitInfo::OMPTraitInfo(StringRef MangledName) {
3185 if (!MangledName.consume_front(
"$S"))
3187 if (MangledName.consumeInteger(10,
U))
3191 Set.Kind = TraitSet(
U);
3193 if (!MangledName.consume_front(
"$s"))
3195 if (MangledName.consumeInteger(10,
U))
3201 if (!MangledName.consume_front(
"$P"))
3205 std::pair<StringRef, StringRef> PropRestPair = MangledName.split(
'$');
3206 Property.RawString = PropRestPair.first;
3207 Property.Kind = getOpenMPContextTraitPropertyKind(
3209 MangledName = MangledName.drop_front(PropRestPair.first.size());
3219 TI.
print(OS, Policy);
3224 return TI ? OS << *TI : OS;
3231 : OMPContext(ASTCtx.getLangOpts().OpenMPIsTargetDevice,
3233 ASTCtx.getLangOpts().OMPTargetTriples.empty()
3235 : ASTCtx.getLangOpts().OMPTargetTriples[0],
3237 FeatureValidityCheck([&](StringRef FeatureName) {
3238 return ASTCtx.
getTargetInfo().isValidFeatureName(FeatureName);
3240 DiagUnknownTrait(std::move(DiagUnknownTrait)) {
3243 for (llvm::omp::TraitProperty Property : ConstructTraits)
3248 auto It = FeatureMap.find(RawString);
3249 if (It != FeatureMap.end())
3251 if (!FeatureValidityCheck(RawString))
3252 DiagUnknownTrait(RawString);
3267 if (
const Expr *OffsetExpr = Bound.
E) {
3268 if (OffsetExpr->isValueDependent())
3270 std::optional<llvm::APSInt> Val = OffsetExpr->getIntegerConstantExpr(Ctx);
3273 Offset = Val->getLimitedValue(INT32_MAX);
3287 Result = Val->getLimitedValue(INT32_MAX);
3295 auto AppendIfInRange = [&](
int64_t Pos) {
3296 if (Pos >= 1 && Pos <=
static_cast<int64_t>(NumArgs))
3297 Positions.push_back(
static_cast<unsigned>(Pos));
3310 Lower = std::max<int64_t>(Lower, 1);
3311 Upper = std::min<int64_t>(Upper, NumArgs);
3314 for (
int64_t Pos : llvm::seq_inclusive<int64_t>(Lower, Upper))
3315 AppendIfInRange(Pos);
3324 if (
const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
3325 if (
const auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
3326 unsigned Index = PVD->getFunctionScopeIndex();
3330 AppendIfInRange(
static_cast<int64_t>(Index) + 1);
3342 AppendIfInRange(Val->getLimitedValue(INT32_MAX));
Defines the clang::ASTContext interface.
This file defines OpenMP nodes for declarative directives.
Result
Implement __builtin_bit_cast and related operations.
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 bool evalOMPAdjustArgsBound(const OMPAdjustArgsItem::Bound &Bound, unsigned NumArgs, const ASTContext &Ctx, int64_t &Result)
Evaluate one bound of an 'adjust_args' parameter range: either an 'omp_num_args [+- logical_offset]' ...
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.
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.
Expr * getDepobj()
Returns depobj expression associated with the 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.
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.
bool isValueDependent() const
Determines whether the value of this expression depends on.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, bool AllowRelaxedEval=false) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
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.
OpenMPNeedDevicePtrModifier NeedDevicePtrModifier
OpenMPAdjustArgsOpKind AdjustOp
static OMPAdjustArgsDescriptor * Create(const ASTContext &C, OpenMPAdjustArgsOpKind AdjustOp, OpenMPNeedDevicePtrModifier NeedDevicePtrModifier, ArrayRef< OMPAdjustArgsItem > Items)
This represents the 'align' clause in the 'pragma omp allocate' directive.
Expr * getAlignment() const
Returns 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 the 'depth' clause on the 'pragma omp flatten' (and 'pragma omp fuse') loop-transform...
Expr * getDepth() const
Returns the depth expression or nullptr if not set.
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.
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.
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.
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
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
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 ...
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
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; }.
OpenMPNeedDevicePtrModifier
OpenMP 6.1 need_device modifier.
OpenMPAdjustArgsOpKind
OpenMP adjust-op kinds for 'adjust_args' clause.
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
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
__builtin_bitreverse32 uint32_t __builtin_riscv_aaddu_u32 __builtin_riscv_asubu_u32 __builtin_elementwise_add_sat __builtin_elementwise_sub_sat int32_t uint32_t uint32_t __builtin_riscv_mhacc_i32 __builtin_riscv_mhaccu_u32 __builtin_riscv_mhaccsu_i32 __builtin_riscv_mulq_i32 int64_t
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...
One bound of a parameter range.
Expr * E
The bound expression, or the logical offset for a NumArgs bound.
One item in an OpenMP 'adjust_args' parameter list.
Expr * E
A named parameter or positional expression for a Single item.
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.