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];
412OMPUpdateClause *OMPUpdateClause::Create(
const ASTContext &
C,
415 return new (
C) OMPUpdateClause(StartLoc, EndLoc,
false);
423 C.Allocate(totalSizeToAlloc<SourceLocation, OpenMPDependClauseKind>(2, 1),
424 alignof(OMPUpdateClause));
426 new (Mem) OMPUpdateClause(StartLoc, EndLoc,
true);
427 Clause->setLParenLoc(LParenLoc);
428 Clause->setArgumentLoc(ArgumentLoc);
429 Clause->setDependencyKind(DK);
433OMPUpdateClause *OMPUpdateClause::CreateEmpty(
const ASTContext &
C,
436 return new (
C) OMPUpdateClause(
false);
438 C.Allocate(totalSizeToAlloc<SourceLocation, OpenMPDependClauseKind>(2, 1),
439 alignof(OMPUpdateClause));
440 auto *Clause =
new (Mem) OMPUpdateClause(
true);
441 Clause->IsExtended =
true;
446 assert(VL.size() == varlist_size() &&
447 "Number of private copies is not the same as the preallocated buffer");
448 llvm::copy(VL, varlist_end());
456 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
457 OMPPrivateClause *Clause =
458 new (Mem) OMPPrivateClause(StartLoc, LParenLoc, EndLoc, VL.size());
459 Clause->setVarRefs(VL);
460 Clause->setPrivateCopies(PrivateVL);
464OMPPrivateClause *OMPPrivateClause::CreateEmpty(
const ASTContext &
C,
466 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * N));
467 return new (Mem) OMPPrivateClause(N);
471 assert(VL.size() == varlist_size() &&
472 "Number of private copies is not the same as the preallocated buffer");
473 llvm::copy(VL, varlist_end());
477 assert(VL.size() == varlist_size() &&
478 "Number of inits is not the same as the preallocated buffer");
479 llvm::copy(VL, getPrivateCopies().end());
482OMPFirstprivateClause *
487 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(3 * VL.size()));
488 OMPFirstprivateClause *Clause =
489 new (Mem) OMPFirstprivateClause(StartLoc, LParenLoc, EndLoc, VL.size());
490 Clause->setVarRefs(VL);
491 Clause->setPrivateCopies(PrivateVL);
492 Clause->setInits(InitVL);
493 Clause->setPreInitStmt(PreInit);
497OMPFirstprivateClause *OMPFirstprivateClause::CreateEmpty(
const ASTContext &
C,
499 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(3 * N));
500 return new (Mem) OMPFirstprivateClause(N);
503void OMPLastprivateClause::setPrivateCopies(
ArrayRef<Expr *> PrivateCopies) {
504 assert(PrivateCopies.size() == varlist_size() &&
505 "Number of private copies is not the same as the preallocated buffer");
506 llvm::copy(PrivateCopies, varlist_end());
510 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
511 "not the same as the "
512 "preallocated buffer");
513 llvm::copy(SrcExprs, getPrivateCopies().end());
517 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
518 "expressions is not the same as "
519 "the preallocated buffer");
520 llvm::copy(DstExprs, getSourceExprs().end());
523void OMPLastprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
524 assert(AssignmentOps.size() == varlist_size() &&
525 "Number of assignment expressions is not the same as the preallocated "
527 llvm::copy(AssignmentOps, getDestinationExprs().end());
530OMPLastprivateClause *OMPLastprivateClause::Create(
536 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
537 OMPLastprivateClause *Clause =
new (Mem) OMPLastprivateClause(
538 StartLoc, LParenLoc, EndLoc, LPKind, LPKindLoc, ColonLoc, VL.size());
539 Clause->setVarRefs(VL);
540 Clause->setSourceExprs(SrcExprs);
541 Clause->setDestinationExprs(DstExprs);
542 Clause->setAssignmentOps(AssignmentOps);
543 Clause->setPreInitStmt(PreInit);
544 Clause->setPostUpdateExpr(PostUpdate);
548OMPLastprivateClause *OMPLastprivateClause::CreateEmpty(
const ASTContext &
C,
550 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * N));
551 return new (Mem) OMPLastprivateClause(N);
554OMPSharedClause *OMPSharedClause::Create(
const ASTContext &
C,
559 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
560 OMPSharedClause *Clause =
561 new (Mem) OMPSharedClause(StartLoc, LParenLoc, EndLoc, VL.size());
562 Clause->setVarRefs(VL);
566OMPSharedClause *OMPSharedClause::CreateEmpty(
const ASTContext &
C,
unsigned N) {
567 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
568 return new (Mem) OMPSharedClause(N);
572 assert(PL.size() == varlist_size() &&
573 "Number of privates is not the same as the preallocated buffer");
574 llvm::copy(PL, varlist_end());
578 assert(IL.size() == varlist_size() &&
579 "Number of inits is not the same as the preallocated buffer");
584 assert(UL.size() == varlist_size() &&
585 "Number of updates is not the same as the preallocated buffer");
590 assert(FL.size() == varlist_size() &&
591 "Number of final updates is not the same as the preallocated buffer");
597 UE.size() == varlist_size() + 1 &&
598 "Number of used expressions is not the same as the preallocated buffer");
602OMPLinearClause *OMPLinearClause::Create(
612 C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2 + VL.size() + 1));
613 OMPLinearClause *Clause =
614 new (Mem) OMPLinearClause(StartLoc, LParenLoc, Modifier, ModifierLoc,
615 ColonLoc, StepModifierLoc, EndLoc, VL.size());
616 Clause->setVarRefs(VL);
617 Clause->setPrivates(PL);
618 Clause->setInits(IL);
621 std::fill(Clause->getInits().end(), Clause->getInits().end() + VL.size(),
623 std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(),
625 std::fill(Clause->getUsedExprs().begin(), Clause->getUsedExprs().end(),
627 Clause->setStep(Step);
628 Clause->setCalcStep(CalcStep);
629 Clause->setPreInitStmt(PreInit);
630 Clause->setPostUpdateExpr(PostUpdate);
634OMPLinearClause *OMPLinearClause::CreateEmpty(
const ASTContext &
C,
638 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2 + NumVars +1));
639 return new (Mem) OMPLinearClause(NumVars);
653 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
654 OMPAlignedClause *Clause =
new (Mem)
655 OMPAlignedClause(StartLoc, LParenLoc, ColonLoc, EndLoc, VL.size());
656 Clause->setVarRefs(VL);
657 Clause->setAlignment(A);
663 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumVars + 1));
664 return new (Mem) OMPAlignedClause(NumVars);
671 return new (
C) OMPAlignClause(A, StartLoc, LParenLoc, EndLoc);
675 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
676 "not the same as the "
677 "preallocated buffer");
678 llvm::copy(SrcExprs, varlist_end());
682 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
683 "expressions is not the same as "
684 "the preallocated buffer");
685 llvm::copy(DstExprs, getSourceExprs().end());
689 assert(AssignmentOps.size() == varlist_size() &&
690 "Number of assignment expressions is not the same as the preallocated "
692 llvm::copy(AssignmentOps, getDestinationExprs().end());
699 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
700 OMPCopyinClause *Clause =
701 new (Mem) OMPCopyinClause(StartLoc, LParenLoc, EndLoc, VL.size());
702 Clause->setVarRefs(VL);
703 Clause->setSourceExprs(SrcExprs);
704 Clause->setDestinationExprs(DstExprs);
705 Clause->setAssignmentOps(AssignmentOps);
710 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * N));
711 return new (Mem) OMPCopyinClause(N);
715 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
716 "not the same as the "
717 "preallocated buffer");
718 llvm::copy(SrcExprs, varlist_end());
722 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
723 "expressions is not the same as "
724 "the preallocated buffer");
725 llvm::copy(DstExprs, getSourceExprs().end());
728void OMPCopyprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
729 assert(AssignmentOps.size() == varlist_size() &&
730 "Number of assignment expressions is not the same as the preallocated "
732 llvm::copy(AssignmentOps, getDestinationExprs().end());
739 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
740 OMPCopyprivateClause *Clause =
741 new (Mem) OMPCopyprivateClause(StartLoc, LParenLoc, EndLoc, VL.size());
742 Clause->setVarRefs(VL);
743 Clause->setSourceExprs(SrcExprs);
744 Clause->setDestinationExprs(DstExprs);
745 Clause->setAssignmentOps(AssignmentOps);
751 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(4 * N));
752 return new (Mem) OMPCopyprivateClause(N);
756 assert(
Privates.size() == varlist_size() &&
757 "Number of private copies is not the same as the preallocated buffer");
758 llvm::copy(
Privates, varlist_end());
763 LHSExprs.size() == varlist_size() &&
764 "Number of LHS expressions is not the same as the preallocated buffer");
770 RHSExprs.size() == varlist_size() &&
771 "Number of RHS expressions is not the same as the preallocated buffer");
772 llvm::copy(RHSExprs, getLHSExprs().end());
776 assert(ReductionOps.size() == varlist_size() &&
"Number of reduction "
777 "expressions is not the same "
778 "as the preallocated buffer");
779 llvm::copy(ReductionOps, getRHSExprs().end());
783 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
784 assert(Ops.size() == varlist_size() &&
"Number of copy "
785 "expressions is not the same "
786 "as the preallocated buffer");
787 llvm::copy(Ops, getReductionOps().end());
790void OMPReductionClause::setInscanCopyArrayTemps(
792 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
793 assert(CopyArrayTemps.size() == varlist_size() &&
794 "Number of copy temp expressions is not the same as the preallocated "
796 llvm::copy(CopyArrayTemps, getInscanCopyOps().end());
799void OMPReductionClause::setInscanCopyArrayElems(
801 assert(Modifier == OMPC_REDUCTION_inscan &&
"Expected inscan reduction.");
802 assert(CopyArrayElems.size() == varlist_size() &&
803 "Number of copy temp expressions is not the same as the preallocated "
805 llvm::copy(CopyArrayElems, getInscanCopyArrayTemps().end());
808OMPReductionClause *OMPReductionClause::Create(
819 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, bool>(
820 (Modifier == OMPC_REDUCTION_inscan ? 8 : 5) * VL.size(), VL.size()));
821 auto *Clause =
new (Mem) OMPReductionClause(
822 StartLoc, LParenLoc, ModifierLoc, EndLoc, ColonLoc, Modifier,
823 OrignalSharingModifier, VL.size(), QualifierLoc, NameInfo);
824 Clause->setVarRefs(VL);
826 Clause->setLHSExprs(LHSExprs);
827 Clause->setRHSExprs(RHSExprs);
828 Clause->setReductionOps(ReductionOps);
829 Clause->setPreInitStmt(PreInit);
830 Clause->setPostUpdateExpr(PostUpdate);
831 Clause->setPrivateVariableReductionFlags(IsPrivateVarReduction);
832 if (Modifier == OMPC_REDUCTION_inscan) {
833 Clause->setInscanCopyOps(CopyOps);
834 Clause->setInscanCopyArrayTemps(CopyArrayTemps);
835 Clause->setInscanCopyArrayElems(CopyArrayElems);
837 assert(CopyOps.empty() &&
838 "copy operations are expected in inscan reductions only.");
839 assert(CopyArrayTemps.empty() &&
840 "copy array temps are expected in inscan reductions only.");
841 assert(CopyArrayElems.empty() &&
842 "copy array temps are expected in inscan reductions only.");
848OMPReductionClause::CreateEmpty(
const ASTContext &
C,
unsigned N,
850 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, bool>(
851 (Modifier == OMPC_REDUCTION_inscan ? 8 : 5) * N, N));
852 auto *Clause =
new (Mem) OMPReductionClause(N);
853 Clause->setModifier(Modifier);
858 assert(
Privates.size() == varlist_size() &&
859 "Number of private copies is not the same as the preallocated buffer");
860 llvm::copy(
Privates, varlist_end());
865 LHSExprs.size() == varlist_size() &&
866 "Number of LHS expressions is not the same as the preallocated buffer");
872 RHSExprs.size() == varlist_size() &&
873 "Number of RHS expressions is not the same as the preallocated buffer");
874 llvm::copy(RHSExprs, getLHSExprs().end());
877void OMPTaskReductionClause::setReductionOps(
ArrayRef<Expr *> ReductionOps) {
878 assert(ReductionOps.size() == varlist_size() &&
"Number of task reduction "
879 "expressions is not the same "
880 "as the preallocated buffer");
881 llvm::copy(ReductionOps, getRHSExprs().end());
884OMPTaskReductionClause *OMPTaskReductionClause::Create(
891 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
892 OMPTaskReductionClause *Clause =
new (Mem) OMPTaskReductionClause(
893 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
894 Clause->setVarRefs(VL);
896 Clause->setLHSExprs(LHSExprs);
897 Clause->setRHSExprs(RHSExprs);
898 Clause->setReductionOps(ReductionOps);
899 Clause->setPreInitStmt(PreInit);
900 Clause->setPostUpdateExpr(PostUpdate);
904OMPTaskReductionClause *OMPTaskReductionClause::CreateEmpty(
const ASTContext &
C,
906 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(5 * N));
907 return new (Mem) OMPTaskReductionClause(N);
911 assert(
Privates.size() == varlist_size() &&
912 "Number of private copies is not the same as the preallocated buffer");
913 llvm::copy(
Privates, varlist_end());
918 LHSExprs.size() == varlist_size() &&
919 "Number of LHS expressions is not the same as the preallocated buffer");
925 RHSExprs.size() == varlist_size() &&
926 "Number of RHS expressions is not the same as the preallocated buffer");
927 llvm::copy(RHSExprs, getLHSExprs().end());
931 assert(ReductionOps.size() == varlist_size() &&
"Number of in reduction "
932 "expressions is not the same "
933 "as the preallocated buffer");
934 llvm::copy(ReductionOps, getRHSExprs().end());
937void OMPInReductionClause::setTaskgroupDescriptors(
939 assert(TaskgroupDescriptors.size() == varlist_size() &&
940 "Number of in reduction descriptors is not the same as the "
941 "preallocated buffer");
942 llvm::copy(TaskgroupDescriptors, getReductionOps().end());
945OMPInReductionClause *OMPInReductionClause::Create(
952 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(6 * VL.size()));
953 OMPInReductionClause *Clause =
new (Mem) OMPInReductionClause(
954 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
955 Clause->setVarRefs(VL);
957 Clause->setLHSExprs(LHSExprs);
958 Clause->setRHSExprs(RHSExprs);
959 Clause->setReductionOps(ReductionOps);
960 Clause->setTaskgroupDescriptors(TaskgroupDescriptors);
961 Clause->setPreInitStmt(PreInit);
962 Clause->setPostUpdateExpr(PostUpdate);
966OMPInReductionClause *OMPInReductionClause::CreateEmpty(
const ASTContext &
C,
968 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(6 * N));
969 return new (Mem) OMPInReductionClause(N);
978 Clause->setLocStart(StartLoc);
979 Clause->setLParenLoc(LParenLoc);
980 Clause->setLocEnd(EndLoc);
981 Clause->setSizesRefs(Sizes);
987 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumSizes));
988 return new (Mem) OMPSizesClause(NumSizes);
995 OMPCountsClause *Clause =
CreateEmpty(
C, Counts.size());
996 Clause->setLocStart(StartLoc);
997 Clause->setLParenLoc(LParenLoc);
998 Clause->setLocEnd(EndLoc);
999 Clause->setCountsRefs(Counts);
1000 Clause->setOmpFillIndex(FillIdx);
1001 Clause->setOmpFillLoc(FillLoc);
1006 unsigned NumCounts) {
1007 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumCounts));
1008 return new (Mem) OMPCountsClause(NumCounts);
1016 OMPPermutationClause *Clause =
CreateEmpty(
C, Args.size());
1017 Clause->setLocStart(StartLoc);
1018 Clause->setLParenLoc(LParenLoc);
1019 Clause->setLocEnd(EndLoc);
1020 Clause->setArgRefs(Args);
1025 unsigned NumLoops) {
1026 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(NumLoops));
1027 return new (Mem) OMPPermutationClause(NumLoops);
1034 Clause->setLocStart(StartLoc);
1035 Clause->setLocEnd(EndLoc);
1040 return new (
C) OMPFullClause();
1049 Clause->setLocStart(StartLoc);
1050 Clause->setLParenLoc(LParenLoc);
1051 Clause->setLocEnd(EndLoc);
1052 Clause->setFactor(Factor);
1057 return new (
C) OMPPartialClause();
1066 Clause->setLocStart(StartLoc);
1067 Clause->setLParenLoc(LParenLoc);
1068 Clause->setFirstLoc(FirstLoc);
1069 Clause->setCountLoc(CountLoc);
1070 Clause->setLocEnd(EndLoc);
1071 Clause->setFirst(
First);
1072 Clause->setCount(Count);
1077 return new (
C) OMPLoopRangeClause();
1088 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1089 auto *Clause =
new (Mem) OMPAllocateClause(
1090 StartLoc, LParenLoc, Allocator, Alignment, ColonLoc, Modifier1,
1091 Modifier1Loc, Modifier2, Modifier2Loc, EndLoc, VL.size());
1093 Clause->setVarRefs(VL);
1099 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1100 return new (Mem) OMPAllocateClause(N);
1108 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1109 OMPFlushClause *Clause =
1110 new (Mem) OMPFlushClause(StartLoc, LParenLoc, EndLoc, VL.size());
1111 Clause->setVarRefs(VL);
1116 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1117 return new (Mem) OMPFlushClause(N);
1125 auto *Clause =
new (
C) OMPDepobjClause(StartLoc, LParenLoc, RParenLoc);
1126 Clause->setDepobj(Depobj);
1131 return new (
C) OMPDepobjClause();
1139 void *Mem =
C.Allocate(
1140 totalSizeToAlloc<Expr *>(VL.size() + 1 + NumLoops),
1141 alignof(OMPDependClause));
1142 OMPDependClause *Clause =
new (Mem)
1143 OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops);
1144 Clause->setDependencyKind(Data.DepKind);
1145 Clause->setDependencyLoc(Data.DepLoc);
1146 Clause->setColonLoc(Data.ColonLoc);
1147 Clause->setOmpAllMemoryLoc(Data.OmpAllMemoryLoc);
1148 Clause->setModifier(DepModifier);
1149 Clause->setVarRefs(VL);
1150 for (
unsigned I = 0 ; I < NumLoops; ++I)
1151 Clause->setLoopData(I,
nullptr);
1156 unsigned NumLoops) {
1158 C.Allocate(totalSizeToAlloc<Expr *>(N + 1 + NumLoops),
1159 alignof(OMPDependClause));
1160 return new (Mem) OMPDependClause(N, NumLoops);
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 auto *It = std::next(getVarRefs().end(), NumLoop + 1);
1186 NumLoop < NumLoops &&
1187 "Expected sink or source depend + loop index must be less number of "
1189 const auto *It = std::next(getVarRefs().end(), NumLoop + 1);
1193void OMPDependClause::setModifier(
Expr *DepModifier) {
1194 *getVarRefs().end() = DepModifier;
1200 unsigned TotalNum = 0u;
1201 for (
auto &
C : ComponentLists)
1202 TotalNum +=
C.size();
1209 for (
const ValueDecl *D : Declarations) {
1211 UniqueDecls.insert(VD);
1213 return UniqueDecls.size();
1219 "Cannot get element-type from array-shaping expr.");
1233 if (
const auto *ATy = BaseType->getAsArrayTypeUnsafe())
1234 ElemTy = ATy->getElementType();
1242std::pair<const Expr *, std::optional<size_t>>
1248 if (Components.size() < 2)
1249 return {
nullptr, std::nullopt};
1254 if (Components.back().isNonContiguous() && CurDirKind == OMPD_target_update)
1255 return {
nullptr, std::nullopt};
1261 for (
auto [I, Component] : llvm::enumerate(Components)) {
1266 const Expr *CurExpr = Component.getAssociatedExpression();
1281 return {CurExpr, Components.size() - I};
1284 return {
nullptr, std::nullopt};
1311 void *Mem =
C.Allocate(
1317 OMPMapClause *Clause =
new (Mem)
1318 OMPMapClause(MapModifiers, MapModifiersLoc, UDMQualifierLoc, MapperId,
1321 Clause->setVarRefs(Vars);
1322 Clause->setUDMapperRefs(UDMapperRefs);
1323 Clause->setIteratorModifier(IteratorModifier);
1324 Clause->setClauseInfo(Declarations, ComponentLists);
1325 Clause->setMapType(
Type);
1333 void *Mem =
C.Allocate(
1339 OMPMapClause *Clause =
new (Mem) OMPMapClause(Sizes);
1340 Clause->setIteratorModifier(
nullptr);
1367 void *Mem =
C.Allocate(
1374 auto *Clause =
new (Mem) OMPToClause(MotionModifiers, MotionModifiersLoc,
1375 UDMQualifierLoc, MapperId, Locs, Sizes);
1377 Clause->setVarRefs(Vars);
1378 Clause->setUDMapperRefs(UDMapperRefs);
1379 Clause->setClauseInfo(Declarations, ComponentLists);
1380 Clause->setIteratorModifier(IteratorModifier);
1386 void *Mem =
C.Allocate(
1392 OMPToClause *Clause =
new (Mem) OMPToClause(Sizes);
1393 Clause->setIteratorModifier(
nullptr);
1420 void *Mem =
C.Allocate(
1428 new (Mem) OMPFromClause(MotionModifiers, MotionModifiersLoc,
1429 UDMQualifierLoc, MapperId, Locs, Sizes);
1431 Clause->setVarRefs(Vars);
1432 Clause->setUDMapperRefs(UDMapperRefs);
1433 Clause->setClauseInfo(Declarations, ComponentLists);
1434 Clause->setIteratorModifier(IteratorModifier);
1441 void *Mem =
C.Allocate(
1447 OMPFromClause *Clause =
new (Mem) OMPFromClause(Sizes);
1448 Clause->setIteratorModifier(
nullptr);
1453 assert(VL.size() == varlist_size() &&
1454 "Number of private copies is not the same as the preallocated buffer");
1455 llvm::copy(VL, varlist_end());
1459 assert(VL.size() == varlist_size() &&
1460 "Number of inits is not the same as the preallocated buffer");
1461 llvm::copy(VL, getPrivateCopies().end());
1487 void *Mem =
C.Allocate(
1494 OMPUseDevicePtrClause *Clause =
new (Mem)
1495 OMPUseDevicePtrClause(Locs, Sizes, FallbackModifier, FallbackModifierLoc);
1497 Clause->setVarRefs(Vars);
1498 Clause->setPrivateCopies(PrivateVars);
1499 Clause->setInits(
Inits);
1500 Clause->setClauseInfo(Declarations, ComponentLists);
1507 void *Mem =
C.Allocate(
1513 return new (Mem) OMPUseDevicePtrClause(Sizes);
1537 void *Mem =
C.Allocate(
1544 auto *Clause =
new (Mem) OMPUseDeviceAddrClause(Locs, Sizes);
1546 Clause->setVarRefs(Vars);
1547 Clause->setClauseInfo(Declarations, ComponentLists);
1554 void *Mem =
C.Allocate(
1560 return new (Mem) OMPUseDeviceAddrClause(Sizes);
1584 void *Mem =
C.Allocate(
1591 OMPIsDevicePtrClause *Clause =
new (Mem) OMPIsDevicePtrClause(Locs, Sizes);
1593 Clause->setVarRefs(Vars);
1594 Clause->setClauseInfo(Declarations, ComponentLists);
1601 void *Mem =
C.Allocate(
1607 return new (Mem) OMPIsDevicePtrClause(Sizes);
1631 void *Mem =
C.Allocate(
1638 auto *Clause =
new (Mem) OMPHasDeviceAddrClause(Locs, Sizes);
1640 Clause->setVarRefs(Vars);
1641 Clause->setClauseInfo(Declarations, ComponentLists);
1648 void *Mem =
C.Allocate(
1654 return new (Mem) OMPHasDeviceAddrClause(Sizes);
1663 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
1665 new (Mem) OMPNontemporalClause(StartLoc, LParenLoc, EndLoc, VL.size());
1666 Clause->setVarRefs(VL);
1672 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(2 * N));
1673 return new (Mem) OMPNontemporalClause(N);
1677 assert(VL.size() == varlist_size() &&
"Number of private references is not "
1678 "the same as the preallocated buffer");
1679 llvm::copy(VL, varlist_end());
1687 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1689 new (Mem) OMPInclusiveClause(StartLoc, LParenLoc, EndLoc, VL.size());
1690 Clause->setVarRefs(VL);
1696 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1697 return new (Mem) OMPInclusiveClause(N);
1705 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
1707 new (Mem) OMPExclusiveClause(StartLoc, LParenLoc, EndLoc, VL.size());
1708 Clause->setVarRefs(VL);
1714 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N));
1715 return new (Mem) OMPExclusiveClause(N);
1718void OMPUsesAllocatorsClause::setAllocatorsData(
1720 assert(
Data.size() == NumOfAllocators &&
1721 "Size of allocators data is not the same as the preallocated buffer.");
1722 for (
unsigned I = 0, E =
Data.size(); I < E; ++I) {
1724 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1725 static_cast<int>(ExprOffsets::Allocator)] =
1727 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1729 ExprOffsets::AllocatorTraits)] =
1732 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1733 static_cast<int>(ParenLocsOffsets::LParen)] =
1736 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1737 static_cast<int>(ParenLocsOffsets::RParen)] =
1742OMPUsesAllocatorsClause::Data
1746 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1747 static_cast<int>(ExprOffsets::Allocator)];
1749 getTrailingObjects<Expr *>()[I *
static_cast<int>(ExprOffsets::Total) +
1751 ExprOffsets::AllocatorTraits)];
1753 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1754 static_cast<int>(ParenLocsOffsets::LParen)];
1756 SourceLocation>()[I *
static_cast<int>(ParenLocsOffsets::Total) +
1757 static_cast<int>(ParenLocsOffsets::RParen)];
1765 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, SourceLocation>(
1766 static_cast<int>(ExprOffsets::Total) *
Data.size(),
1767 static_cast<int>(ParenLocsOffsets::Total) *
Data.size()));
1768 auto *Clause =
new (Mem)
1769 OMPUsesAllocatorsClause(StartLoc, LParenLoc, EndLoc,
Data.size());
1770 Clause->setAllocatorsData(
Data);
1776 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *, SourceLocation>(
1777 static_cast<int>(ExprOffsets::Total) * N,
1778 static_cast<int>(ParenLocsOffsets::Total) * N));
1779 return new (Mem) OMPUsesAllocatorsClause(N);
1787 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(Locators.size() + 1));
1788 auto *Clause =
new (Mem)
1789 OMPAffinityClause(StartLoc, LParenLoc, ColonLoc, EndLoc, Locators.size());
1790 Clause->setModifier(Modifier);
1791 Clause->setVarRefs(Locators);
1797 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1798 return new (Mem) OMPAffinityClause(N);
1808 unsigned NumPrefs = InteropInfo.
Prefs.size();
1809 unsigned NumAttrs = 0;
1811 NumAttrs += P.
Attrs.size();
1814 void *Mem =
C.Allocate(
1815 totalSizeToAlloc<Expr *, unsigned>(1 + NumPrefs + NumAttrs, NumPrefs));
1816 auto *Clause =
new (Mem)
1818 LParenLoc, VarLoc, EndLoc, 1 + NumPrefs);
1819 Clause->NumAttrs = NumAttrs;
1822 Expr **E = Clause->getTrailingObjects<
Expr *>();
1824 for (
unsigned I = 0; I < NumPrefs; ++I)
1825 E[1 + I] = InteropInfo.
Prefs[I].Fr;
1826 unsigned *AttrEnds = Clause->getTrailingObjects<
unsigned>();
1827 unsigned AttrBase = 1 + NumPrefs;
1828 unsigned AttrPos = AttrBase;
1829 for (
unsigned I = 0; I < NumPrefs; ++I) {
1830 for (
Expr *A : InteropInfo.
Prefs[I].Attrs)
1832 AttrEnds[I] = AttrPos - AttrBase;
1839 unsigned NumAttrs) {
1840 void *Mem =
C.Allocate(
1841 totalSizeToAlloc<Expr *, unsigned>(1 + NumPrefs + NumAttrs, NumPrefs));
1842 auto *Clause =
new (Mem) OMPInitClause(1 + NumPrefs);
1843 Clause->NumAttrs = NumAttrs;
1849 assert(Counts.size() == getNumPrefs() &&
1850 "attr-count vector size must match number of pref-specs");
1851 assert(Attrs.size() == NumAttrs &&
1852 "attr-expr count must match preallocated NumAttrs");
1854 unsigned *AttrEnds = getTrailingObjects<unsigned>();
1856 for (
unsigned I = 0, E = Counts.size(); I < E; ++I) {
1860 llvm::copy(Attrs, getTrailingObjects<Expr *>() + varlist_size());
1867 return new (
C) OMPBindClause(K, KLoc, StartLoc, LParenLoc, EndLoc);
1871 return new (
C) OMPBindClause();
1880 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + NumLoops),
1881 alignof(OMPDoacrossClause));
1882 OMPDoacrossClause *Clause =
new (Mem)
1883 OMPDoacrossClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops);
1884 Clause->setDependenceType(DepType);
1885 Clause->setDependenceLoc(DepLoc);
1886 Clause->setColonLoc(ColonLoc);
1887 Clause->setVarRefs(VL);
1888 for (
unsigned I = 0; I < NumLoops; ++I)
1889 Clause->setLoopData(I,
nullptr);
1895 unsigned NumLoops) {
1896 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + NumLoops),
1897 alignof(OMPDoacrossClause));
1898 return new (Mem) OMPDoacrossClause(N, NumLoops);
1902 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1903 auto *It = std::next(getVarRefs().end(), NumLoop);
1908 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1909 auto *It = std::next(getVarRefs().end(), NumLoop);
1914 assert(NumLoop < NumLoops &&
"Loop index must be less number of loops.");
1915 const auto *It = std::next(getVarRefs().end(), NumLoop);
1919OMPAbsentClause *OMPAbsentClause::Create(
const ASTContext &
C,
1924 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(DKVec.size()),
1925 alignof(OMPAbsentClause));
1926 auto *AC =
new (Mem) OMPAbsentClause(Loc, LLoc, RLoc, DKVec.size());
1927 AC->setDirectiveKinds(DKVec);
1931OMPAbsentClause *OMPAbsentClause::CreateEmpty(
const ASTContext &
C,
unsigned K) {
1932 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(K),
1933 alignof(OMPAbsentClause));
1934 return new (Mem) OMPAbsentClause(K);
1937OMPContainsClause *OMPContainsClause::Create(
1940 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(DKVec.size()),
1941 alignof(OMPContainsClause));
1942 auto *CC =
new (Mem) OMPContainsClause(Loc, LLoc, RLoc, DKVec.size());
1943 CC->setDirectiveKinds(DKVec);
1947OMPContainsClause *OMPContainsClause::CreateEmpty(
const ASTContext &
C,
1949 void *Mem =
C.Allocate(totalSizeToAlloc<OpenMPDirectiveKind>(K),
1950 alignof(OMPContainsClause));
1951 return new (Mem) OMPContainsClause(K);
1960 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1961 OMPNumTeamsClause *Clause =
1962 new (Mem) OMPNumTeamsClause(
C, StartLoc, LParenLoc, EndLoc, VL.size());
1963 Clause->setVarRefs(VL);
1964 Clause->setModifier(Modifier);
1965 Clause->setModifierExpr(ModifierExpr);
1966 Clause->setModifierLoc(ModifierLoc);
1967 Clause->setPreInitStmt(PreInit, CaptureRegion);
1974 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1975 return new (Mem) OMPNumTeamsClause(N);
1984 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
1985 OMPThreadLimitClause *Clause =
1986 new (Mem) OMPThreadLimitClause(
C, StartLoc, LParenLoc, EndLoc, VL.size());
1987 Clause->setVarRefs(VL);
1988 Clause->setModifier(Modifier);
1989 Clause->setModifierExpr(ModifierExpr);
1990 Clause->setModifierLoc(ModifierLoc);
1991 Clause->setPreInitStmt(PreInit, CaptureRegion);
1998 void *Mem =
C.Allocate(totalSizeToAlloc<Expr *>(N + 1));
1999 return new (Mem) OMPThreadLimitClause(N);
2006void OMPClausePrinter::VisitOMPIfClause(
OMPIfClause *Node) {
2009 OS << getOpenMPDirectiveName(Node->
getNameModifier(), Version) <<
": ";
2014void OMPClausePrinter::VisitOMPFinalClause(
OMPFinalClause *Node) {
2021 OS <<
"num_threads(";
2031void OMPClausePrinter::VisitOMPAlignClause(
OMPAlignClause *Node) {
2049void OMPClausePrinter::VisitOMPSizesClause(
OMPSizesClause *Node) {
2055 Size->printPretty(OS,
nullptr, Policy, 0);
2065 llvm::interleaveComma(llvm::seq<unsigned>(Refs.size()), OS, [&](
unsigned I) {
2066 if (FillIdx && I == *FillIdx)
2069 Refs[I]->printPretty(OS, nullptr, Policy, 0);
2075 OS <<
"permutation(";
2077 E->printPretty(OS, nullptr, Policy, 0);
2082void OMPClausePrinter::VisitOMPFullClause(
OMPFullClause *Node) {
OS <<
"full"; }
2089 Factor->printPretty(OS,
nullptr, Policy, 0);
2100 if (
First && Count) {
2102 First->printPretty(OS,
nullptr, Policy, 0);
2121void OMPClausePrinter::VisitOMPDetachClause(OMPDetachClause *Node) {
2131 if (Version >= 60 && Node->
getDefaultVC() != OMPC_DEFAULT_VC_all) {
2146void OMPClausePrinter::VisitOMPTransparentClause(OMPTransparentClause *Node) {
2147 OS <<
"transparent(";
2148 if (Node->getImpexType())
2149 Node->getImpexType()->printPretty(OS,
nullptr, Policy, 0);
2155void OMPClausePrinter::VisitOMPProcBindClause(OMPProcBindClause *Node) {
2158 unsigned(Node->getProcBindKind()))
2162void OMPClausePrinter::VisitOMPUnifiedAddressClause(OMPUnifiedAddressClause *) {
2163 OS <<
"unified_address";
2166void OMPClausePrinter::VisitOMPUnifiedSharedMemoryClause(
2167 OMPUnifiedSharedMemoryClause *) {
2168 OS <<
"unified_shared_memory";
2171void OMPClausePrinter::VisitOMPReverseOffloadClause(OMPReverseOffloadClause *) {
2172 OS <<
"reverse_offload";
2175void OMPClausePrinter::VisitOMPDynamicAllocatorsClause(
2176 OMPDynamicAllocatorsClause *) {
2177 OS <<
"dynamic_allocators";
2180void OMPClausePrinter::VisitOMPAtomicDefaultMemOrderClause(
2181 OMPAtomicDefaultMemOrderClause *Node) {
2182 OS <<
"atomic_default_mem_order("
2184 Node->getAtomicDefaultMemOrderKind())
2188void OMPClausePrinter::VisitOMPSelfMapsClause(OMPSelfMapsClause *) {
2192void OMPClausePrinter::VisitOMPAtClause(OMPAtClause *Node) {
2197void OMPClausePrinter::VisitOMPSeverityClause(OMPSeverityClause *Node) {
2203void OMPClausePrinter::VisitOMPMessageClause(OMPMessageClause *Node) {
2205 if (
Expr *E = Node->getMessageString())
2206 E->printPretty(OS,
nullptr, Policy);
2210void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
2214 Node->getFirstScheduleModifier());
2218 Node->getSecondScheduleModifier());
2223 if (
auto *E = Node->getChunkSize()) {
2225 E->printPretty(OS,
nullptr, Policy);
2230void OMPClausePrinter::VisitOMPOrderedClause(OMPOrderedClause *Node) {
2232 if (
auto *
Num = Node->getNumForLoops()) {
2234 Num->printPretty(OS,
nullptr, Policy, 0);
2239void OMPClausePrinter::VisitOMPNowaitClause(OMPNowaitClause *Node) {
2241 if (
auto *
Cond = Node->getCondition()) {
2243 Cond->printPretty(OS,
nullptr, Policy, 0);
2248void OMPClausePrinter::VisitOMPUntiedClause(OMPUntiedClause *) {
2252void OMPClausePrinter::VisitOMPNogroupClause(OMPNogroupClause *) {
2256void OMPClausePrinter::VisitOMPMergeableClause(OMPMergeableClause *) {
2260void OMPClausePrinter::VisitOMPReadClause(OMPReadClause *) {
OS <<
"read"; }
2262void OMPClausePrinter::VisitOMPWriteClause(OMPWriteClause *) {
OS <<
"write"; }
2264void OMPClausePrinter::VisitOMPUpdateClause(OMPUpdateClause *Node) {
2266 if (Node->isExtended()) {
2269 Node->getDependencyKind());
2274void OMPClausePrinter::VisitOMPCaptureClause(OMPCaptureClause *) {
2278void OMPClausePrinter::VisitOMPCompareClause(OMPCompareClause *) {
2282void OMPClausePrinter::VisitOMPFailClause(OMPFailClause *Node) {
2287 Node->getClauseKind(),
static_cast<int>(Node->getFailParameter()));
2292void OMPClausePrinter::VisitOMPAbsentClause(OMPAbsentClause *Node) {
2295 for (
auto &D : Node->getDirectiveKinds()) {
2298 OS << getOpenMPDirectiveName(D, Version);
2304void OMPClausePrinter::VisitOMPHoldsClause(OMPHoldsClause *Node) {
2306 Node->getExpr()->printPretty(OS,
nullptr, Policy, 0);
2310void OMPClausePrinter::VisitOMPContainsClause(OMPContainsClause *Node) {
2313 for (
auto &D : Node->getDirectiveKinds()) {
2316 OS << getOpenMPDirectiveName(D, Version);
2322void OMPClausePrinter::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {
2326void OMPClausePrinter::VisitOMPNoOpenMPRoutinesClause(
2327 OMPNoOpenMPRoutinesClause *) {
2328 OS <<
"no_openmp_routines";
2331void OMPClausePrinter::VisitOMPNoOpenMPConstructsClause(
2332 OMPNoOpenMPConstructsClause *) {
2333 OS <<
"no_openmp_constructs";
2336void OMPClausePrinter::VisitOMPNoParallelismClause(OMPNoParallelismClause *) {
2337 OS <<
"no_parallelism";
2340void OMPClausePrinter::VisitOMPSeqCstClause(OMPSeqCstClause *) {
2344void OMPClausePrinter::VisitOMPAcqRelClause(OMPAcqRelClause *) {
2348void OMPClausePrinter::VisitOMPAcquireClause(OMPAcquireClause *) {
2352void OMPClausePrinter::VisitOMPReleaseClause(OMPReleaseClause *) {
2356void OMPClausePrinter::VisitOMPRelaxedClause(OMPRelaxedClause *) {
2360void OMPClausePrinter::VisitOMPWeakClause(OMPWeakClause *) {
OS <<
"weak"; }
2362void OMPClausePrinter::VisitOMPThreadsClause(OMPThreadsClause *) {
2366void OMPClausePrinter::VisitOMPSIMDClause(OMPSIMDClause *) {
OS <<
"simd"; }
2368void OMPClausePrinter::VisitOMPDeviceClause(OMPDeviceClause *Node) {
2379void OMPClausePrinter::VisitOMPNumTeamsClause(OMPNumTeamsClause *Node) {
2380 if (!Node->varlist_empty()) {
2389 VisitOMPClauseList(Node,
':');
2391 VisitOMPClauseList(Node,
'(');
2397void OMPClausePrinter::VisitOMPThreadLimitClause(OMPThreadLimitClause *Node) {
2398 if (!Node->varlist_empty()) {
2399 OS <<
"thread_limit";
2400 if (Node->
getModifier() == OMPC_THREADLIMIT_dims) {
2404 VisitOMPClauseList(Node,
':');
2406 VisitOMPClauseList(Node,
'(');
2412void OMPClausePrinter::VisitOMPPriorityClause(OMPPriorityClause *Node) {
2418void OMPClausePrinter::VisitOMPGrainsizeClause(OMPGrainsizeClause *Node) {
2429void OMPClausePrinter::VisitOMPNumTasksClause(OMPNumTasksClause *Node) {
2440void OMPClausePrinter::VisitOMPHintClause(OMPHintClause *Node) {
2446void OMPClausePrinter::VisitOMPInitClause(OMPInitClause *Node) {
2448 if (!Node->
prefs().empty()) {
2449 OS <<
"prefer_type(";
2452 llvm::interleaveComma(Node->
prefs(), OS, [&](OMPInitClause::PrefView P) {
2456 P.Fr->printPretty(OS, nullptr, Policy);
2458 if (!P.Attrs.empty())
2463 llvm::interleaveComma(P.Attrs, OS, [&](const Expr *A) {
2464 A->printPretty(OS, nullptr, Policy);
2473 [&](OMPInitClause::PrefView P) {
2475 P.Fr->printPretty(OS, nullptr, Policy);
2493void OMPClausePrinter::VisitOMPUseClause(OMPUseClause *Node) {
2499void OMPClausePrinter::VisitOMPDestroyClause(OMPDestroyClause *Node) {
2503 E->printPretty(OS,
nullptr, Policy);
2508void OMPClausePrinter::VisitOMPNovariantsClause(OMPNovariantsClause *Node) {
2512 E->printPretty(OS,
nullptr, Policy, 0);
2517void OMPClausePrinter::VisitOMPNocontextClause(OMPNocontextClause *Node) {
2521 E->printPretty(OS,
nullptr, Policy, 0);
2527void OMPClausePrinter::VisitOMPClauseList(
T *Node,
char StartSym) {
2528 for (
typename T::varlist_iterator I = Node->varlist_begin(),
2529 E = Node->varlist_end();
2531 assert(*I &&
"Expected non-null Stmt");
2532 OS << (I == Node->varlist_begin() ? StartSym :
',');
2533 if (
auto *DRE = dyn_cast<DeclRefExpr>(*I)) {
2535 DRE->printPretty(OS,
nullptr, Policy, 0);
2537 DRE->getDecl()->printQualifiedName(OS);
2539 (*I)->printPretty(OS,
nullptr, Policy, 0);
2547 Expr *FirstModifier =
nullptr;
2548 Expr *SecondModifier =
nullptr;
2553 if (FirstAllocMod == OMPC_ALLOCATE_allocator ||
2564 if (FirstModifier) {
2566 if (!FirstUnknown) {
2570 FirstModifier->
printPretty(OS,
nullptr, Policy, 0);
2573 if (SecondModifier) {
2575 if (!SecondUnknown) {
2580 SecondModifier->
printPretty(OS,
nullptr, Policy, 0);
2585 VisitOMPClauseList(Node,
' ');
2588 VisitOMPClauseList(Node,
'(');
2593void OMPClausePrinter::VisitOMPPrivateClause(OMPPrivateClause *Node) {
2594 if (!Node->varlist_empty()) {
2596 VisitOMPClauseList(Node,
'(');
2601void OMPClausePrinter::VisitOMPFirstprivateClause(OMPFirstprivateClause *Node) {
2602 if (!Node->varlist_empty()) {
2603 OS <<
"firstprivate";
2604 VisitOMPClauseList(Node,
'(');
2609void OMPClausePrinter::VisitOMPLastprivateClause(OMPLastprivateClause *Node) {
2610 if (!Node->varlist_empty()) {
2611 OS <<
"lastprivate";
2623void OMPClausePrinter::VisitOMPSharedClause(OMPSharedClause *Node) {
2624 if (!Node->varlist_empty()) {
2626 VisitOMPClauseList(Node,
'(');
2631void OMPClausePrinter::VisitOMPReductionClause(OMPReductionClause *Node) {
2632 if (!Node->varlist_empty()) {
2634 if (Node->getModifierLoc().isValid())
2638 Node->getQualifierLoc().getNestedNameSpecifier();
2640 Node->getNameInfo().getName().getCXXOverloadedOperator();
2641 if (!Qualifier && OOK !=
OO_None) {
2647 OS << Node->getNameInfo();
2650 VisitOMPClauseList(Node,
' ');
2655void OMPClausePrinter::VisitOMPTaskReductionClause(
2656 OMPTaskReductionClause *Node) {
2657 if (!Node->varlist_empty()) {
2658 OS <<
"task_reduction(";
2660 Node->getQualifierLoc().getNestedNameSpecifier();
2662 Node->getNameInfo().getName().getCXXOverloadedOperator();
2663 if (!Qualifier && OOK !=
OO_None) {
2669 OS << Node->getNameInfo();
2672 VisitOMPClauseList(Node,
' ');
2677void OMPClausePrinter::VisitOMPInReductionClause(OMPInReductionClause *Node) {
2678 if (!Node->varlist_empty()) {
2679 OS <<
"in_reduction(";
2681 Node->getQualifierLoc().getNestedNameSpecifier();
2683 Node->getNameInfo().getName().getCXXOverloadedOperator();
2684 if (!Qualifier && OOK !=
OO_None) {
2690 OS << Node->getNameInfo();
2693 VisitOMPClauseList(Node,
' ');
2698void OMPClausePrinter::VisitOMPLinearClause(OMPLinearClause *Node) {
2699 if (!Node->varlist_empty()) {
2701 VisitOMPClauseList(Node,
'(');
2702 if (Node->getModifierLoc().isValid() || Node->getStep() !=
nullptr) {
2705 if (Node->getModifierLoc().isValid()) {
2708 if (Node->getStep() !=
nullptr) {
2709 if (Node->getModifierLoc().isValid()) {
2713 Node->getStep()->printPretty(OS,
nullptr, Policy, 0);
2720void OMPClausePrinter::VisitOMPAlignedClause(OMPAlignedClause *Node) {
2721 if (!Node->varlist_empty()) {
2723 VisitOMPClauseList(Node,
'(');
2732void OMPClausePrinter::VisitOMPCopyinClause(OMPCopyinClause *Node) {
2733 if (!Node->varlist_empty()) {
2735 VisitOMPClauseList(Node,
'(');
2740void OMPClausePrinter::VisitOMPCopyprivateClause(OMPCopyprivateClause *Node) {
2741 if (!Node->varlist_empty()) {
2742 OS <<
"copyprivate";
2743 VisitOMPClauseList(Node,
'(');
2748void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) {
2749 if (!Node->varlist_empty()) {
2750 VisitOMPClauseList(Node,
'(');
2755void OMPClausePrinter::VisitOMPDepobjClause(OMPDepobjClause *Node) {
2761void OMPClausePrinter::VisitOMPDependClause(OMPDependClause *Node) {
2769 bool IsOmpAllMemory =
false;
2770 if (PrintKind == OMPC_DEPEND_outallmemory) {
2771 PrintKind = OMPC_DEPEND_out;
2772 IsOmpAllMemory =
true;
2773 }
else if (PrintKind == OMPC_DEPEND_inoutallmemory) {
2774 PrintKind = OMPC_DEPEND_inout;
2775 IsOmpAllMemory =
true;
2778 if (!Node->varlist_empty() || IsOmpAllMemory)
2780 VisitOMPClauseList(Node,
' ');
2781 if (IsOmpAllMemory) {
2782 OS << (Node->varlist_empty() ?
" " :
",");
2783 OS <<
"omp_all_memory";
2788template <
typename T>
2793 Node->getMapperQualifierLoc().getNestedNameSpecifier();
2794 MapperNNS.
print(OS, Policy);
2795 OS << Node->getMapperIdInfo() <<
')';
2798template <
typename T>
2801 if (
Expr *IteratorModifier = Node->getIteratorModifier())
2802 IteratorModifier->printPretty(OS,
nullptr, Policy);
2805void OMPClausePrinter::VisitOMPMapClause(OMPMapClause *Node) {
2806 if (!Node->varlist_empty()) {
2825 VisitOMPClauseList(Node,
' ');
2830template <
typename T>
void OMPClausePrinter::VisitOMPMotionClause(
T *Node) {
2831 if (Node->varlist_empty())
2833 OS << getOpenMPClauseName(Node->getClauseKind());
2834 unsigned ModifierCount = 0;
2839 if (ModifierCount) {
2843 if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator) {
2847 Node->getMotionModifier(I));
2848 if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)
2850 if (I < ModifierCount - 1)
2856 VisitOMPClauseList(Node,
' ');
2858 VisitOMPClauseList(Node,
'(');
2863void OMPClausePrinter::VisitOMPToClause(OMPToClause *Node) {
2864 VisitOMPMotionClause(Node);
2867void OMPClausePrinter::VisitOMPFromClause(OMPFromClause *Node) {
2868 VisitOMPMotionClause(Node);
2871void OMPClausePrinter::VisitOMPDistScheduleClause(OMPDistScheduleClause *Node) {
2876 E->printPretty(OS,
nullptr, Policy);
2881void OMPClausePrinter::VisitOMPDefaultmapClause(OMPDefaultmapClause *Node) {
2882 OS <<
"defaultmap(";
2893void OMPClausePrinter::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *Node) {
2894 if (!Node->varlist_empty()) {
2895 OS <<
"use_device_ptr";
2901 VisitOMPClauseList(Node,
' ');
2903 VisitOMPClauseList(Node,
'(');
2909void OMPClausePrinter::VisitOMPUseDeviceAddrClause(
2910 OMPUseDeviceAddrClause *Node) {
2911 if (!Node->varlist_empty()) {
2912 OS <<
"use_device_addr";
2913 VisitOMPClauseList(Node,
'(');
2918void OMPClausePrinter::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *Node) {
2919 if (!Node->varlist_empty()) {
2920 OS <<
"is_device_ptr";
2921 VisitOMPClauseList(Node,
'(');
2926void OMPClausePrinter::VisitOMPHasDeviceAddrClause(OMPHasDeviceAddrClause *Node) {
2927 if (!Node->varlist_empty()) {
2928 OS <<
"has_device_addr";
2929 VisitOMPClauseList(Node,
'(');
2934void OMPClausePrinter::VisitOMPNontemporalClause(OMPNontemporalClause *Node) {
2935 if (!Node->varlist_empty()) {
2936 OS <<
"nontemporal";
2937 VisitOMPClauseList(Node,
'(');
2942void OMPClausePrinter::VisitOMPOrderClause(OMPOrderClause *Node) {
2951void OMPClausePrinter::VisitOMPInclusiveClause(OMPInclusiveClause *Node) {
2952 if (!Node->varlist_empty()) {
2954 VisitOMPClauseList(Node,
'(');
2959void OMPClausePrinter::VisitOMPExclusiveClause(OMPExclusiveClause *Node) {
2960 if (!Node->varlist_empty()) {
2962 VisitOMPClauseList(Node,
'(');
2967void OMPClausePrinter::VisitOMPUsesAllocatorsClause(
2968 OMPUsesAllocatorsClause *Node) {
2971 OS <<
"uses_allocators(";
2974 Data.Allocator->printPretty(OS,
nullptr, Policy);
2975 if (
Data.AllocatorTraits) {
2977 Data.AllocatorTraits->printPretty(OS,
nullptr, Policy);
2986void OMPClausePrinter::VisitOMPAffinityClause(OMPAffinityClause *Node) {
2987 if (Node->varlist_empty())
2990 char StartSym =
'(';
2993 Modifier->printPretty(OS,
nullptr, Policy);
2997 VisitOMPClauseList(Node, StartSym);
3001void OMPClausePrinter::VisitOMPFilterClause(OMPFilterClause *Node) {
3007void OMPClausePrinter::VisitOMPBindClause(OMPBindClause *Node) {
3013void OMPClausePrinter::VisitOMPXDynCGroupMemClause(
3014 OMPXDynCGroupMemClause *Node) {
3015 OS <<
"ompx_dyn_cgroup_mem(";
3020void OMPClausePrinter::VisitOMPDynGroupprivateClause(
3021 OMPDynGroupprivateClause *Node) {
3022 OS <<
"dyn_groupprivate(";
3038void OMPClausePrinter::VisitOMPDoacrossClause(OMPDoacrossClause *Node) {
3043 case OMPC_DOACROSS_source:
3046 case OMPC_DOACROSS_sink:
3049 case OMPC_DOACROSS_source_omp_cur_iteration:
3050 OS <<
"source: omp_cur_iteration";
3052 case OMPC_DOACROSS_sink_omp_cur_iteration:
3053 OS <<
"sink: omp_cur_iteration - 1";
3056 llvm_unreachable(
"unknown docaross modifier");
3058 VisitOMPClauseList(Node,
' ');
3062void OMPClausePrinter::VisitOMPXAttributeClause(OMPXAttributeClause *Node) {
3063 OS <<
"ompx_attribute(";
3074void OMPClausePrinter::VisitOMPXBareClause(OMPXBareClause *Node) {
3079 VariantMatchInfo &VMI)
const {
3084 if (
Selector.Kind == TraitSelector::user_condition) {
3085 assert(
Selector.ScoreOrCondition &&
3086 "Ill-formed user condition, expected condition expression!");
3087 assert(
Selector.Properties.size() == 1 &&
3088 Selector.Properties.front().Kind ==
3089 TraitProperty::user_condition_unknown &&
3090 "Ill-formed user condition, expected unknown trait property!");
3092 if (std::optional<APSInt> CondVal =
3093 Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx))
3094 VMI.addTrait(CondVal->isZero() ? TraitProperty::user_condition_false
3095 : TraitProperty::user_condition_true,
3098 VMI.addTrait(TraitProperty::user_condition_false,
"<condition>");
3102 std::optional<llvm::APSInt> Score;
3103 llvm::APInt *ScorePtr =
nullptr;
3105 if ((Score =
Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx)))
3108 VMI.addTrait(TraitProperty::user_condition_false,
3109 "<non-constant-score>");
3113 VMI.addTrait(
Set.Kind, Property.Kind, Property.RawString, ScorePtr);
3115 if (
Set.Kind != TraitSet::construct)
3119 assert(
Selector.Properties.size() == 1 &&
3120 Selector.Properties.front().Kind ==
3121 getOpenMPContextTraitPropertyForSelector(
3123 "Ill-formed construct selector!");
3130 bool FirstSet =
true;
3135 OS << getOpenMPContextTraitSetName(
Set.Kind) <<
"={";
3137 bool FirstSelector =
true;
3141 FirstSelector =
false;
3142 OS << getOpenMPContextTraitSelectorName(
Selector.Kind);
3144 bool AllowsTraitScore =
false;
3145 bool RequiresProperty =
false;
3146 isValidTraitSelectorForTraitSet(
3147 Selector.Kind,
Set.Kind, AllowsTraitScore, RequiresProperty);
3149 if (!RequiresProperty)
3153 if (
Selector.Kind == TraitSelector::user_condition) {
3155 Selector.ScoreOrCondition->printPretty(OS,
nullptr, Policy);
3162 Selector.ScoreOrCondition->printPretty(OS,
nullptr, Policy);
3166 bool FirstProperty =
true;
3170 FirstProperty =
false;
3171 OS << getOpenMPContextTraitPropertyName(Property.Kind,
3172 Property.RawString);
3182 std::string MangledName;
3183 llvm::raw_string_ostream OS(MangledName);
3188 bool AllowsTraitScore =
false;
3189 bool RequiresProperty =
false;
3190 isValidTraitSelectorForTraitSet(
3191 Selector.Kind,
Set.Kind, AllowsTraitScore, RequiresProperty);
3194 if (!RequiresProperty ||
3195 Selector.Kind == TraitSelector::user_condition)
3200 << getOpenMPContextTraitPropertyName(Property.Kind,
3201 Property.RawString);
3207OMPTraitInfo::OMPTraitInfo(StringRef MangledName) {
3210 if (!MangledName.consume_front(
"$S"))
3212 if (MangledName.consumeInteger(10,
U))
3216 Set.Kind = TraitSet(
U);
3218 if (!MangledName.consume_front(
"$s"))
3220 if (MangledName.consumeInteger(10,
U))
3226 if (!MangledName.consume_front(
"$P"))
3230 std::pair<StringRef, StringRef> PropRestPair = MangledName.split(
'$');
3231 Property.RawString = PropRestPair.first;
3232 Property.Kind = getOpenMPContextTraitPropertyKind(
3234 MangledName = MangledName.drop_front(PropRestPair.first.size());
3244 TI.
print(OS, Policy);
3249 return TI ? OS << *TI : OS;
3256 : OMPContext(ASTCtx.getLangOpts().OpenMPIsTargetDevice,
3258 ASTCtx.getLangOpts().OMPTargetTriples.empty()
3260 : ASTCtx.getLangOpts().OMPTargetTriples[0],
3262 FeatureValidityCheck([&](StringRef FeatureName) {
3263 return ASTCtx.
getTargetInfo().isValidFeatureName(FeatureName);
3265 DiagUnknownTrait(std::move(DiagUnknownTrait)) {
3268 for (llvm::omp::TraitProperty Property : ConstructTraits)
3273 auto It = FeatureMap.find(RawString);
3274 if (It != FeatureMap.end())
3276 if (!FeatureValidityCheck(RawString))
3277 DiagUnknownTrait(RawString);
Defines the clang::ASTContext interface.
This file defines OpenMP nodes for declarative directives.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
static StringRef getTriple(const Command &Job)
static Stmt ** getAddrOfExprAsWritten(Stmt *S)
Gets the address of the original, non-captured, expression used in the clause as the preinitializer.
static void PrintIterator(raw_ostream &OS, T *Node, const PrintingPolicy &Policy)
static void PrintMapper(raw_ostream &OS, T *Node, const PrintingPolicy &Policy)
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
This represents clause 'affinity' in the 'pragma omp task'-based directives.
static OMPAffinityClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Creates clause with a modifier a list of locator items.
Expr * getModifier()
Gets affinity modifier.
static OMPAffinityClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N locator items.
static OMPAlignedClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, Expr *A)
Creates clause with a list of variables VL and alignment A.
static OMPAlignedClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
Expr * getAlignment()
Returns alignment.
static OMPBindClause * Create(const ASTContext &C, OpenMPBindClauseKind K, SourceLocation KLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'bind' clause with kind K ('teams', 'parallel', or 'thread').
static OMPBindClause * CreateEmpty(const ASTContext &C)
Build an empty 'bind' clause.
OpenMPBindClauseKind getBindKind() const
Returns kind of the clause.
Class that represents a component of a mappable expression. E.g. for an expression S....
static unsigned getUniqueDeclarationsTotalNumber(ArrayRef< const ValueDecl * > Declarations)
static unsigned getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists)
ArrayRef< MappableExprComponentList > MappableExprComponentListsRef
static std::pair< const Expr *, std::optional< size_t > > findAttachPtrExpr(MappableExprComponentListRef Components, OpenMPDirectiveKind CurDirKind)
Find the attach pointer expression from a list of mappable expression components.
static QualType getComponentExprElementType(const Expr *Exp)
Get the type of an element of a ComponentList Expr Exp.
ArrayRef< MappableComponent > MappableExprComponentListRef
static OMPCopyinClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps)
Creates clause with a list of variables VL.
static OMPCopyinClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
static OMPCopyprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps)
Creates clause with a list of variables VL.
static OMPCopyprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
OpenMPDefaultmapClauseKind getDefaultmapKind() const
Get kind of the clause.
OpenMPDefaultmapClauseModifier getDefaultmapModifier() const
Get the modifier of the clause.
This represents implicit clause 'depend' for the 'pragma omp task' directive.
static OMPDependClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, DependDataTy Data, Expr *DepModifier, ArrayRef< Expr * > VL, unsigned NumLoops)
Creates clause with a list of variables VL.
Expr * getModifier()
Return optional depend modifier.
Expr * getLoopData(unsigned NumLoop)
Get the loop data.
void setLoopData(unsigned NumLoop, Expr *Cnt)
Set the loop data for the depend clauses with 'sink|source' kind of dependency.
static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)
Creates an empty clause with N variables.
OpenMPDependClauseKind getDependencyKind() const
Get dependency type.
static OMPDepobjClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Depobj)
Creates clause.
Expr * getDepobj()
Returns depobj expression associated with the clause.
static OMPDepobjClause * CreateEmpty(const ASTContext &C)
Creates an empty clause.
Expr * getInteropVar() const
Returns the interop variable.
Expr * getEventHandler() const
Returns event-handler expression.
This represents 'device' clause in the 'pragma omp ...' directive.
OpenMPDeviceClauseModifier getModifier() const
Gets modifier.
Expr * getDevice()
Return device number.
This represents 'dist_schedule' clause in the 'pragma omp ...' directive.
Expr * getChunkSize()
Get chunk size.
OpenMPDistScheduleClauseKind getDistScheduleKind() const
Get kind of the clause.
This represents the 'doacross' clause for the 'pragma omp ordered' directive.
void setLoopData(unsigned NumLoop, Expr *Cnt)
Set the loop data.
OpenMPDoacrossClauseModifier getDependenceType() const
Get dependence type.
Expr * getLoopData(unsigned NumLoop)
Get the loop data.
static OMPDoacrossClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VL, unsigned NumLoops)
Creates clause with a list of expressions VL.
static OMPDoacrossClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)
Creates an empty clause with N expressions.
This represents 'dyn_groupprivate' clause in 'pragma omp target ...' and 'pragma omp teams ....
Expr * getSize()
Get size.
OpenMPDynGroupprivateClauseFallbackModifier getDynGroupprivateFallbackModifier() const
Get the second modifier of the clause.
OpenMPDynGroupprivateClauseModifier getDynGroupprivateModifier() const
Get the first modifier of the clause.
static OMPExclusiveClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static OMPExclusiveClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
This represents 'filter' clause in the 'pragma omp ...' directive.
Expr * getThreadID() const
Return thread identifier.
static OMPFlushClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
static OMPFlushClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
This represents clause 'from' in the 'pragma omp ...' directives.
static OMPFromClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef< Expr * > UDMapperRefs, Expr *IteratorExpr, ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId)
Creates clause with a list of variables Vars.
static OMPFromClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents 'grainsize' clause in the 'pragma omp ...' directive.
OpenMPGrainsizeClauseModifier getModifier() const
Gets modifier.
Expr * getGrainsize() const
Return safe iteration space distance.
child_range used_children()
This represents clause 'has_device_ptr' in the 'pragma omp ...' directives.
static OMPHasDeviceAddrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
static OMPHasDeviceAddrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
Expr * getHint() const
Returns number of threads.
static OMPInclusiveClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
static OMPInclusiveClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
bool getIsTarget() const
Returns true is interop-type 'target' is used.
static OMPInitClause * CreateEmpty(const ASTContext &C, unsigned NumPrefs, unsigned NumAttrs)
Creates an empty clause sized for NumPrefs pref-specs and NumAttrs total attr() exprs across them.
bool hasPreferAttrs() const
Returns true if OMP 6.0 {fr/attr} syntax is used.
Expr * getInteropVar()
Returns the interop variable.
static OMPInitClause * Create(const ASTContext &C, Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Creates a fully specified clause.
bool getIsTargetSync() const
Returns true is interop-type 'targetsync' is used.
auto prefs() const
Returns a range of PrefView objects, one per preference-specification, each carrying the fr() express...
This represents clause 'is_device_ptr' in the 'pragma omp ...' directives.
static OMPIsDevicePtrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
static OMPIsDevicePtrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'map' in the 'pragma omp ...' directives.
OpenMPMapClauseKind getMapType() const LLVM_READONLY
Fetches mapping kind for the clause.
OpenMPMapModifierKind getMapTypeModifier(unsigned Cnt) const LLVM_READONLY
Fetches the map-type-modifier at 'Cnt' index of array of modifiers.
static OMPMapClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef< Expr * > UDMapperRefs, Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapModifiers, ArrayRef< SourceLocation > MapModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId, OpenMPMapClauseKind Type, bool TypeIsImplicit, SourceLocation TypeLoc)
Creates clause with a list of variables VL.
static OMPMapClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars original expressions, NumUniqueDeclarations declar...
This represents 'nocontext' clause in the 'pragma omp ...' directive.
Expr * getCondition() const
Returns condition.
child_range used_children()
static OMPNontemporalClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static OMPNontemporalClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
void setPrivateRefs(ArrayRef< Expr * > VL)
Sets the list of references to private copies created in private clauses.
This represents 'novariants' clause in the 'pragma omp ...' directive.
Expr * getCondition() const
Returns condition.
child_range used_children()
This represents 'num_tasks' clause in the 'pragma omp ...' directive.
OpenMPNumTasksClauseModifier getModifier() const
Gets modifier.
child_range used_children()
Expr * getNumTasks() const
Return safe iteration space distance.
This represents 'num_teams' clause in the 'pragma omp ...' directive.
OpenMPNumTeamsClauseModifier getModifier() const
Get the modifier.
static OMPNumTeamsClause * Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, Stmt *PreInit)
Creates clause with a list of variables VL.
const Expr * getModifierExpr() const
Get the expression of the modifier.
static OMPNumTeamsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
OpenMPOrderClauseKind getKind() const
Returns kind of the clause.
OpenMPOrderClauseModifier getModifier() const
Returns Modifier of the clause.
This represents 'priority' clause in the 'pragma omp ...' directive.
child_range used_children()
Expr * getPriority()
Return Priority number.
This represents 'thread_limit' clause in the 'pragma omp ...' directive.
static OMPThreadLimitClause * Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, OpenMPThreadLimitClauseModifier Modifier, Expr *ModifierExpr, SourceLocation ModifierLoc, Stmt *PreInit)
Creates clause with a list of variables VL.
const Expr * getModifierExpr() const
Get the expression of the modifier.
OpenMPThreadLimitClauseModifier getModifier() const
Get the modifier.
static OMPThreadLimitClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
static OMPToClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
static OMPToClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef< Expr * > UDMapperRefs, Expr *IteratorModifier, ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId)
Creates clause with a list of variables Vars.
std::string getMangledName() const
Return a string representation identifying this context selector.
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const
Print a human readable representation into OS.
void getAsVariantMatchInfo(ASTContext &ASTCtx, llvm::omp::VariantMatchInfo &VMI) const
Create a variant match info object from this trait info object.
llvm::SmallVector< OMPTraitSet, 2 > Sets
The outermost level of selector sets.
Expr * getInteropVar() const
Returns the interop variable.
This represents clause 'use_device_addr' in the 'pragma omp ...' directives.
static OMPUseDeviceAddrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
static OMPUseDeviceAddrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'use_device_ptr' in the 'pragma omp ...' directives.
static OMPUseDevicePtrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< Expr * > PrivateVars, ArrayRef< Expr * > Inits, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, OpenMPUseDevicePtrFallbackModifier FallbackModifier, SourceLocation FallbackModifierLoc)
Creates clause with a list of variables Vars.
OpenMPUseDevicePtrFallbackModifier getFallbackModifier() const
Get the fallback modifier for the clause.
static OMPUseDevicePtrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)
Creates an empty clause with the place for NumVars variables.
This represents clause 'uses_allocators' in the 'pragma omp target'-based directives.
OMPUsesAllocatorsClause::Data getAllocatorData(unsigned I) const
Returns data for the specified allocator.
static OMPUsesAllocatorsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N allocators.
static OMPUsesAllocatorsClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< OMPUsesAllocatorsClause::Data > Data)
Creates clause with a list of allocators Data.
unsigned getNumberOfAllocators() const
Returns number of allocators associated with the clause.
ArrayRef< const Attr * > getAttrs() const
Returned the attributes parsed from this clause.
This represents 'ompx_dyn_cgroup_mem' clause in the 'pragma omp target ...' directive.
Expr * getSize()
Return the size expression.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const TargetInfo & getTargetInfo() const
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
static QualType getBaseOriginalType(const Expr *Base)
Return original type of the base expression for array section.
Attr - This represents one attribute.
void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const
This represents one expression.
Represents a function declaration or definition.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false, bool PrintFinalScopeResOp=true) const
Print this nested name specifier to the given output stream.
This represents the 'align' clause in the 'pragma omp allocate' directive.
Expr * getAlignment() const
Returns alignment.
static OMPAlignClause * Create(const ASTContext &C, Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'align' clause with the given alignment.
This represents clause 'allocate' in the 'pragma omp ...' directives.
static OMPAllocateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc, OpenMPAllocateClauseModifier Modifier1, SourceLocation Modifier1Loc, OpenMPAllocateClauseModifier Modifier2, SourceLocation Modifier2Loc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
OpenMPAllocateClauseModifier getSecondAllocateModifier() const
Get the second modifier of the clause.
Expr * getAlignment() const
Returns the alignment expression or nullptr, if no alignment specified.
OpenMPAllocateClauseModifier getFirstAllocateModifier() const
Get the first modifier of the clause.
Expr * getAllocator() const
Returns the allocator expression or nullptr, if no allocator is specified.
static OMPAllocateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents 'allocator' clause in the 'pragma omp ...' directive.
Expr * getAllocator() const
Returns allocator.
static OMPClauseWithPostUpdate * get(OMPClause *C)
OMPClauseWithPostUpdate(const OMPClause *This)
const Stmt * getPreInitStmt() const
Get pre-initialization statement for the clause.
OMPClauseWithPreInit(const OMPClause *This)
static OMPClauseWithPreInit * get(OMPClause *C)
This is a basic class for representing single OpenMP clause.
child_range used_children()
Get the iterator range for the expressions used in the clauses.
llvm::iterator_range< child_iterator > child_range
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents 'collapse' clause in the 'pragma omp ...' directive.
Expr * getNumForLoops() const
Return the number of associated for-loops.
This represents the 'counts' clause in the 'pragma omp split' directive.
std::optional< unsigned > getOmpFillIndex() const
static OMPCountsClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > Counts, std::optional< unsigned > FillIdx, SourceLocation FillLoc)
Build a 'counts' AST node.
static OMPCountsClause * CreateEmpty(const ASTContext &C, unsigned NumCounts)
Build an empty 'counts' AST node for deserialization.
MutableArrayRef< Expr * > getCountsRefs()
Returns the count expressions.
This represents 'default' clause in the 'pragma omp ...' directive.
llvm::omp::DefaultKind getDefaultKind() const
Returns kind of the clause.
OpenMPDefaultClauseVariableCategory getDefaultVC() const
This represents 'final' clause in the 'pragma omp ...' directive.
child_range used_children()
Expr * getCondition() const
Returns condition.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
static OMPFullClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc)
Build an AST node for a 'full' clause.
static OMPFullClause * CreateEmpty(const ASTContext &C)
Build an empty 'full' AST node for deserialization.
This represents 'if' clause in the 'pragma omp ...' directive.
child_range used_children()
Expr * getCondition() const
Returns condition.
OpenMPDirectiveKind getNameModifier() const
Return directive name modifier associated with the clause.
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
Expr * getFirst() const
Get looprange 'first' expression.
static OMPLoopRangeClause * CreateEmpty(const ASTContext &C)
Build an empty 'looprange' clause node.
static OMPLoopRangeClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc, Expr *First, Expr *Count)
Build a 'looprange' clause AST node.
Expr * getCount() const
Get looprange 'count' expression.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
OpenMPNumThreadsClauseModifier getModifier() const
Gets modifier.
Expr * getNumThreads() const
Returns number of threads.
llvm::iterator_range< child_iterator > child_range
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
static OMPPartialClause * CreateEmpty(const ASTContext &C)
Build an empty 'partial' AST node for deserialization.
static OMPPartialClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Factor)
Build an AST node for a 'partial' clause.
Expr * getFactor() const
Returns the argument of the clause or nullptr if not set.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
MutableArrayRef< Expr * > getArgsRefs()
Returns the permutation index expressions.
static OMPPermutationClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty 'permutation' AST node for deserialization.
static OMPPermutationClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > Args)
Build a 'permutation' clause AST node.
This represents 'safelen' clause in the 'pragma omp ...' directive.
Expr * getSafelen() const
Return safe iteration space distance.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
Expr * getSimdlen() const
Return safe iteration space distance.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
static OMPSizesClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > Sizes)
Build a 'sizes' AST node.
MutableArrayRef< Expr * > getSizesRefs()
Returns the tile size expressions.
static OMPSizesClause * CreateEmpty(const ASTContext &C, unsigned NumSizes)
Build an empty 'sizes' AST node for deserialization.
This represents 'threadset' clause in the 'pragma omp task ...' directive.
OpenMPThreadsetKind getThreadsetKind() const
Returns kind of the clause.
bool varlist_empty() const
A (possibly-)qualified type.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getCanonicalType() const
Smart pointer class that efficiently represents Objective-C method names.
Encodes a location in the source.
Stmt - This represents one statement.
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
Base wrapper for a particular "section" of type source info.
The base class of the type hierarchy.
bool isPointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Defines the clang::TargetInfo interface.
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
The JSON file list parser is used to communicate input to InstallAPI.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
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.