18 #include "llvm/ADT/SmallPtrSet.h" 19 #include "llvm/Support/Casting.h" 20 #include "llvm/Support/ErrorHandling.h" 24 using namespace clang;
30 #define OPENMP_CLAUSE(Name, Class) \ 32 return static_cast<Class *>(this)->children(); 33 #include "clang/Basic/OpenMPKinds.def" 35 llvm_unreachable(
"unknown OMPClause");
47 case OMPC_dist_schedule:
49 case OMPC_firstprivate:
51 case OMPC_lastprivate:
55 case OMPC_task_reduction:
57 case OMPC_in_reduction:
63 case OMPC_num_threads:
67 case OMPC_thread_limit:
81 case OMPC_copyprivate:
102 case OMPC_defaultmap:
107 case OMPC_use_device_ptr:
108 case OMPC_is_device_ptr:
122 case OMPC_lastprivate:
126 case OMPC_task_reduction:
128 case OMPC_in_reduction:
133 case OMPC_dist_schedule:
134 case OMPC_firstprivate:
139 case OMPC_num_threads:
147 case OMPC_copyprivate:
165 case OMPC_thread_limit:
171 case OMPC_defaultmap:
176 case OMPC_use_device_ptr:
177 case OMPC_is_device_ptr:
189 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops));
192 for (
unsigned I = 0; I < NumLoops; ++I) {
194 Clause->setLoopCounter(I,
nullptr);
201 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops));
203 for (
unsigned I = 0; I < NumLoops; ++I) {
205 Clause->setLoopCounter(I,
nullptr);
211 Expr *NumIterations) {
212 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
213 getTrailingObjects<Expr *>()[NumLoop] = NumIterations;
217 return llvm::makeArrayRef(getTrailingObjects<Expr *>(), NumberOfLoops);
221 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
222 getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop] = Counter;
226 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
227 return getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop];
231 assert(NumLoop < NumberOfLoops &&
"out of loops number.");
232 return getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop];
236 assert(VL.size() == varlist_size() &&
237 "Number of private copies is not the same as the preallocated buffer");
238 std::copy(VL.begin(), VL.end(), varlist_end());
246 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
250 Clause->setPrivateCopies(PrivateVL);
256 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(2 * N));
261 assert(VL.size() == varlist_size() &&
262 "Number of private copies is not the same as the preallocated buffer");
263 std::copy(VL.begin(), VL.end(), varlist_end());
267 assert(VL.size() == varlist_size() &&
268 "Number of inits is not the same as the preallocated buffer");
269 std::copy(VL.begin(), VL.end(), getPrivateCopies().end());
277 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(3 * VL.size()));
281 Clause->setPrivateCopies(PrivateVL);
282 Clause->setInits(InitVL);
289 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(3 * N));
294 assert(PrivateCopies.size() == varlist_size() &&
295 "Number of private copies is not the same as the preallocated buffer");
296 std::copy(PrivateCopies.begin(), PrivateCopies.end(), varlist_end());
300 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is " 301 "not the same as the " 302 "preallocated buffer");
303 std::copy(SrcExprs.begin(), SrcExprs.end(), getPrivateCopies().end());
307 assert(DstExprs.size() == varlist_size() &&
"Number of destination " 308 "expressions is not the same as " 309 "the preallocated buffer");
310 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
313 void OMPLastprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
314 assert(AssignmentOps.size() == varlist_size() &&
315 "Number of assignment expressions is not the same as the preallocated " 317 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
318 getDestinationExprs().end());
326 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
330 Clause->setSourceExprs(SrcExprs);
331 Clause->setDestinationExprs(DstExprs);
332 Clause->setAssignmentOps(AssignmentOps);
340 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * N));
349 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size()));
357 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(N));
362 assert(PL.size() == varlist_size() &&
363 "Number of privates is not the same as the preallocated buffer");
364 std::copy(PL.begin(), PL.end(), varlist_end());
368 assert(IL.size() == varlist_size() &&
369 "Number of inits is not the same as the preallocated buffer");
370 std::copy(IL.begin(), IL.end(),
getPrivates().end());
374 assert(UL.size() == varlist_size() &&
375 "Number of updates is not the same as the preallocated buffer");
376 std::copy(UL.begin(), UL.end(),
getInits().end());
380 assert(FL.size() == varlist_size() &&
381 "Number of final updates is not the same as the preallocated buffer");
382 std::copy(FL.begin(), FL.end(),
getUpdates().end());
393 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2));
395 StartLoc, LParenLoc,
Modifier, ModifierLoc, ColonLoc, EndLoc, VL.size());
397 Clause->setPrivates(PL);
398 Clause->setInits(IL);
401 std::fill(Clause->getInits().end(), Clause->getInits().end() + VL.size(),
403 std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(),
405 Clause->setStep(Step);
406 Clause->setCalcStep(CalcStep);
416 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2));
424 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
427 Clause->setVarRefs(VL);
428 Clause->setAlignment(A);
434 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(NumVars + 1));
439 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is " 440 "not the same as the " 441 "preallocated buffer");
442 std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end());
446 assert(DstExprs.size() == varlist_size() &&
"Number of destination " 447 "expressions is not the same as " 448 "the preallocated buffer");
449 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
453 assert(AssignmentOps.size() == varlist_size() &&
454 "Number of assignment expressions is not the same as the preallocated " 456 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
457 getDestinationExprs().end());
462 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
463 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps) {
464 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
467 Clause->setVarRefs(VL);
468 Clause->setSourceExprs(SrcExprs);
469 Clause->setDestinationExprs(DstExprs);
470 Clause->setAssignmentOps(AssignmentOps);
475 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * N));
479 void OMPCopyprivateClause::setSourceExprs(ArrayRef<Expr *> SrcExprs) {
480 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is " 481 "not the same as the " 482 "preallocated buffer");
483 std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end());
486 void OMPCopyprivateClause::setDestinationExprs(ArrayRef<Expr *> DstExprs) {
487 assert(DstExprs.size() == varlist_size() &&
"Number of destination " 488 "expressions is not the same as " 489 "the preallocated buffer");
490 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
493 void OMPCopyprivateClause::setAssignmentOps(ArrayRef<Expr *> AssignmentOps) {
494 assert(AssignmentOps.size() == varlist_size() &&
495 "Number of assignment expressions is not the same as the preallocated " 497 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
498 getDestinationExprs().end());
503 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
504 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps) {
505 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
508 Clause->setVarRefs(VL);
509 Clause->setSourceExprs(SrcExprs);
510 Clause->setDestinationExprs(DstExprs);
511 Clause->setAssignmentOps(AssignmentOps);
517 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * N));
521 void OMPReductionClause::setPrivates(ArrayRef<Expr *>
Privates) {
522 assert(Privates.size() == varlist_size() &&
523 "Number of private copies is not the same as the preallocated buffer");
524 std::copy(Privates.begin(), Privates.end(), varlist_end());
527 void OMPReductionClause::setLHSExprs(ArrayRef<Expr *> LHSExprs) {
529 LHSExprs.size() == varlist_size() &&
530 "Number of LHS expressions is not the same as the preallocated buffer");
531 std::copy(LHSExprs.begin(), LHSExprs.end(),
getPrivates().end());
534 void OMPReductionClause::setRHSExprs(ArrayRef<Expr *> RHSExprs) {
536 RHSExprs.size() == varlist_size() &&
537 "Number of RHS expressions is not the same as the preallocated buffer");
538 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());
541 void OMPReductionClause::setReductionOps(ArrayRef<Expr *> ReductionOps) {
542 assert(ReductionOps.size() == varlist_size() &&
"Number of reduction " 543 "expressions is not the same " 544 "as the preallocated buffer");
545 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());
555 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
557 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
559 Clause->setPrivates(Privates);
560 Clause->setLHSExprs(LHSExprs);
561 Clause->setRHSExprs(RHSExprs);
562 Clause->setReductionOps(ReductionOps);
570 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * N));
575 assert(Privates.size() == varlist_size() &&
576 "Number of private copies is not the same as the preallocated buffer");
577 std::copy(Privates.begin(), Privates.end(), varlist_end());
582 LHSExprs.size() == varlist_size() &&
583 "Number of LHS expressions is not the same as the preallocated buffer");
584 std::copy(LHSExprs.begin(), LHSExprs.end(),
getPrivates().end());
589 RHSExprs.size() == varlist_size() &&
590 "Number of RHS expressions is not the same as the preallocated buffer");
591 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());
594 void OMPTaskReductionClause::setReductionOps(
ArrayRef<Expr *> ReductionOps) {
595 assert(ReductionOps.size() == varlist_size() &&
"Number of task reduction " 596 "expressions is not the same " 597 "as the preallocated buffer");
598 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());
608 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
610 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
612 Clause->setPrivates(Privates);
613 Clause->setLHSExprs(LHSExprs);
614 Clause->setRHSExprs(RHSExprs);
615 Clause->setReductionOps(ReductionOps);
623 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * N));
628 assert(Privates.size() == varlist_size() &&
629 "Number of private copies is not the same as the preallocated buffer");
630 std::copy(Privates.begin(), Privates.end(), varlist_end());
635 LHSExprs.size() == varlist_size() &&
636 "Number of LHS expressions is not the same as the preallocated buffer");
637 std::copy(LHSExprs.begin(), LHSExprs.end(),
getPrivates().end());
642 RHSExprs.size() == varlist_size() &&
643 "Number of RHS expressions is not the same as the preallocated buffer");
644 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());
648 assert(ReductionOps.size() == varlist_size() &&
"Number of in reduction " 649 "expressions is not the same " 650 "as the preallocated buffer");
651 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());
654 void OMPInReductionClause::setTaskgroupDescriptors(
656 assert(TaskgroupDescriptors.size() == varlist_size() &&
657 "Number of in reduction descriptors is not the same as the " 658 "preallocated buffer");
659 std::copy(TaskgroupDescriptors.begin(), TaskgroupDescriptors.end(),
660 getReductionOps().end());
670 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(6 * VL.size()));
672 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
674 Clause->setPrivates(Privates);
675 Clause->setLHSExprs(LHSExprs);
676 Clause->setRHSExprs(RHSExprs);
677 Clause->setReductionOps(ReductionOps);
678 Clause->setTaskgroupDescriptors(TaskgroupDescriptors);
686 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(6 * N));
695 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
698 Clause->setVarRefs(VL);
703 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(N));
713 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size() + NumLoops));
716 Clause->setVarRefs(VL);
717 Clause->setDependencyKind(DepKind);
718 Clause->setDependencyLoc(DepLoc);
719 Clause->setColonLoc(ColonLoc);
720 for (
unsigned I = 0 ; I < NumLoops; ++I)
727 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(N + NumLoops));
732 assert((getDependencyKind() == OMPC_DEPEND_sink ||
733 getDependencyKind() == OMPC_DEPEND_source) &&
734 NumLoop < NumLoops &&
735 "Expected sink or source depend + loop index must be less number of " 737 auto It = std::next(getVarRefs().end(), NumLoop);
742 assert((getDependencyKind() == OMPC_DEPEND_sink ||
743 getDependencyKind() == OMPC_DEPEND_source) &&
744 NumLoop < NumLoops &&
745 "Expected sink or source depend + loop index must be less number of " 747 auto It = std::next(getVarRefs().end(), NumLoop);
752 assert((getDependencyKind() == OMPC_DEPEND_sink ||
753 getDependencyKind() == OMPC_DEPEND_source) &&
754 NumLoop < NumLoops &&
755 "Expected sink or source depend + loop index must be less number of " 757 auto It = std::next(getVarRefs().end(), NumLoop);
763 unsigned TotalNum = 0u;
764 for (
auto &C : ComponentLists)
765 TotalNum += C.size();
770 ArrayRef<const ValueDecl *> Declarations) {
771 unsigned TotalNum = 0u;
772 llvm::SmallPtrSet<const ValueDecl *, 8>
Cache;
773 for (
const ValueDecl *D : Declarations) {
774 const ValueDecl *VD = D ? cast<ValueDecl>(D->getCanonicalDecl()) :
nullptr;
790 unsigned NumVars = Vars.size();
791 unsigned NumUniqueDeclarations =
792 getUniqueDeclarationsTotalNumber(Declarations);
793 unsigned NumComponentLists = ComponentLists.size();
794 unsigned NumComponents = getComponentsTotalNumber(ComponentLists);
809 NumVars, NumUniqueDeclarations,
810 NumUniqueDeclarations + NumComponentLists, NumComponents));
812 TypeModifier, Type, TypeIsImplicit, TypeLoc, StartLoc, LParenLoc, EndLoc,
813 NumVars, NumUniqueDeclarations, NumComponentLists, NumComponents);
815 Clause->setVarRefs(Vars);
817 Clause->setMapTypeModifier(TypeModifier);
818 Clause->setMapType(Type);
819 Clause->setMapLoc(TypeLoc);
824 unsigned NumUniqueDeclarations,
825 unsigned NumComponentLists,
826 unsigned NumComponents) {
830 NumVars, NumUniqueDeclarations,
831 NumUniqueDeclarations + NumComponentLists, NumComponents));
832 return new (Mem)
OMPMapClause(NumVars, NumUniqueDeclarations,
833 NumComponentLists, NumComponents);
841 unsigned NumVars = Vars.size();
842 unsigned NumUniqueDeclarations =
843 getUniqueDeclarationsTotalNumber(Declarations);
844 unsigned NumComponentLists = ComponentLists.size();
845 unsigned NumComponents = getComponentsTotalNumber(ComponentLists);
860 NumVars, NumUniqueDeclarations,
861 NumUniqueDeclarations + NumComponentLists, NumComponents));
864 OMPToClause(StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations,
865 NumComponentLists, NumComponents);
867 Clause->setVarRefs(Vars);
873 unsigned NumUniqueDeclarations,
874 unsigned NumComponentLists,
875 unsigned NumComponents) {
879 NumVars, NumUniqueDeclarations,
880 NumUniqueDeclarations + NumComponentLists, NumComponents));
881 return new (Mem)
OMPToClause(NumVars, NumUniqueDeclarations,
882 NumComponentLists, NumComponents);
890 unsigned NumVars = Vars.size();
891 unsigned NumUniqueDeclarations =
892 getUniqueDeclarationsTotalNumber(Declarations);
893 unsigned NumComponentLists = ComponentLists.size();
894 unsigned NumComponents = getComponentsTotalNumber(ComponentLists);
909 NumVars, NumUniqueDeclarations,
910 NumUniqueDeclarations + NumComponentLists, NumComponents));
913 OMPFromClause(StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations,
914 NumComponentLists, NumComponents);
916 Clause->setVarRefs(Vars);
922 unsigned NumUniqueDeclarations,
923 unsigned NumComponentLists,
924 unsigned NumComponents) {
928 NumVars, NumUniqueDeclarations,
929 NumUniqueDeclarations + NumComponentLists, NumComponents));
930 return new (Mem)
OMPFromClause(NumVars, NumUniqueDeclarations,
931 NumComponentLists, NumComponents);
935 assert(VL.size() == varlist_size() &&
936 "Number of private copies is not the same as the preallocated buffer");
937 std::copy(VL.begin(), VL.end(), varlist_end());
941 assert(VL.size() == varlist_size() &&
942 "Number of inits is not the same as the preallocated buffer");
943 std::copy(VL.begin(), VL.end(), getPrivateCopies().end());
948 SourceLocation EndLoc, ArrayRef<Expr *> Vars, ArrayRef<Expr *> PrivateVars,
949 ArrayRef<Expr *>
Inits, ArrayRef<ValueDecl *> Declarations,
951 unsigned NumVars = Vars.size();
952 unsigned NumUniqueDeclarations =
953 getUniqueDeclarationsTotalNumber(Declarations);
954 unsigned NumComponentLists = ComponentLists.size();
955 unsigned NumComponents = getComponentsTotalNumber(ComponentLists);
970 3 * NumVars, NumUniqueDeclarations,
971 NumUniqueDeclarations + NumComponentLists, NumComponents));
974 StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations,
975 NumComponentLists, NumComponents);
977 Clause->setVarRefs(Vars);
978 Clause->setPrivateCopies(PrivateVars);
979 Clause->setInits(Inits);
985 const ASTContext &C,
unsigned NumVars,
unsigned NumUniqueDeclarations,
986 unsigned NumComponentLists,
unsigned NumComponents) {
990 3 * NumVars, NumUniqueDeclarations,
991 NumUniqueDeclarations + NumComponentLists, NumComponents));
993 NumComponentLists, NumComponents);
1002 unsigned NumVars = Vars.size();
1003 unsigned NumUniqueDeclarations =
1004 getUniqueDeclarationsTotalNumber(Declarations);
1005 unsigned NumComponentLists = ComponentLists.size();
1006 unsigned NumComponents = getComponentsTotalNumber(ComponentLists);
1021 NumVars, NumUniqueDeclarations,
1022 NumUniqueDeclarations + NumComponentLists, NumComponents));
1025 StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations,
1026 NumComponentLists, NumComponents);
1028 Clause->setVarRefs(Vars);
1034 const ASTContext &C,
unsigned NumVars,
unsigned NumUniqueDeclarations,
1035 unsigned NumComponentLists,
unsigned NumComponents) {
1039 NumVars, NumUniqueDeclarations,
1040 NumUniqueDeclarations + NumComponentLists, NumComponents));
1042 NumComponentLists, NumComponents);
static OMPTaskReductionClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, ArrayRef< Expr *> Privates, ArrayRef< Expr *> LHSExprs, ArrayRef< Expr *> RHSExprs, ArrayRef< Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL.
Defines the clang::ASTContext interface.
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
static OMPCopyinClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents clause 'copyin' in the '#pragma omp ...' directives.
static OMPUseDevicePtrClause * CreateEmpty(const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, unsigned NumComponentLists, unsigned NumComponents)
Creates an empty clause with the place for NumVars 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.
TypePropertyCache< Private > Cache
static OMPClauseWithPreInit * get(OMPClause *C)
Stmt - This represents one statement.
This represents clause 'in_reduction' in the '#pragma omp task' directives.
Expr * getLoopData(unsigned NumLoop)
Get the loop data.
Class that handles pre-initialization statement for some clauses, like 'shedule', 'firstprivate' etc...
static OMPFirstprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static OMPUseDevicePtrClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr *> Vars, ArrayRef< Expr *> PrivateVars, ArrayRef< Expr *> Inits, ArrayRef< ValueDecl *> Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
This represents 'if' clause in the '#pragma omp ...' directive.
static OMPMapClause * CreateEmpty(const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, unsigned NumComponentLists, unsigned NumComponents)
Creates an empty clause with the place for NumVars original expressions, NumUniqueDeclarations declar...
The base class of the type hierarchy.
static OMPReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static OMPToClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr *> Vars, ArrayRef< ValueDecl *> Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
This represents clause 'private' in the '#pragma omp ...' directives.
This represents 'num_threads' clause in the '#pragma omp ...' directive.
void setUpdates(ArrayRef< Expr *> UL)
Sets the list of update expressions for linear variables.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
static OMPTaskReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static OMPOrderedClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty clause.
Base wrapper for a particular "section" of type source info.
static OMPReductionClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, ArrayRef< Expr *> Privates, ArrayRef< Expr *> LHSExprs, ArrayRef< Expr *> RHSExprs, ArrayRef< Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL.
static OMPIsDevicePtrClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr *> Vars, ArrayRef< ValueDecl *> Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
static OMPInReductionClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, ArrayRef< Expr *> Privates, ArrayRef< Expr *> LHSExprs, ArrayRef< Expr *> RHSExprs, ArrayRef< Expr *> ReductionOps, ArrayRef< Expr *> TaskgroupDescriptors, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL.
clang::OMPLinearClause OMPVarListClause, OMPClauseWithPostUpdate, llvm::TrailingObjects getPrivates()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
void setLoopNumIterations(unsigned NumLoop, Expr *NumIterations)
Set number of iterations for the specified loop.
This represents clause 'map' in the '#pragma omp ...' directives.
This represents clause 'to' in the '#pragma omp ...' directives.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
void setLoopCounter(unsigned NumLoop, Expr *Counter)
Set loop counter for the specified loop.
static OMPIsDevicePtrClause * CreateEmpty(const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, unsigned NumComponentLists, unsigned NumComponents)
Creates an empty clause with the place for NumVars variables.
static OMPInReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
static OMPLastprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> SrcExprs, ArrayRef< Expr *> DstExprs, ArrayRef< Expr *> AssignmentOps, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL.
static unsigned getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists)
static OMPToClause * CreateEmpty(const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, unsigned NumComponentLists, unsigned NumComponents)
Creates an empty clause with the place for NumVars variables.
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc...
This represents clause 'reduction' in the '#pragma omp ...' directives.
void setPrivates(ArrayRef< Expr *> PL)
Sets the list of the copies of original linear variables.
This represents clause 'is_device_ptr' in the '#pragma omp ...' directives.
void setFinals(ArrayRef< Expr *> FL)
Sets the list of final update expressions for linear variables.
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 OMPDependClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, OpenMPDependClauseKind DepKind, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr *> VL, unsigned NumLoops)
Creates clause with a list of variables VL.
This represents clause 'from' in the '#pragma omp ...' directives.
OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, unsigned NumVars)
Build 'linear' clause with given number of variables NumVars.
This represents clause 'aligned' in the '#pragma omp ...' directives.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
static OMPAlignedClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
static OMPOrderedClause * Create(const ASTContext &C, Expr *Num, unsigned NumLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'ordered' clause.
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Expr - This represents one expression.
MutableArrayRef< Expr * > getUpdates()
Sets the list of update expressions for linear variables.
static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)
Creates an empty clause with N variables.
This represents 'ordered' clause in the '#pragma omp ...' directive.
static OMPFlushClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
static OMPPrivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
This file defines OpenMP AST classes for clauses.
ArrayRef< Expr * > getLoopNumIterations() const
Get number of iterations for all the loops.
void setPostUpdateExpr(Expr *S)
Set pre-initialization statement for the clause.
This represents 'num_teams' clause in the '#pragma omp ...' directive.
llvm::iterator_range< child_iterator > child_range
Encodes a location in the source.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
MutableArrayRef< Expr * > getInits()
static OMPMapClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr *> Vars, ArrayRef< ValueDecl *> Declarations, MappableExprComponentListsRef ComponentLists, OpenMPMapClauseKind TypeModifier, OpenMPMapClauseKind Type, bool TypeIsImplicit, SourceLocation TypeLoc)
Creates clause with a list of variables VL.
This represents 'schedule' clause in the '#pragma omp ...' directive.
This represents clause 'shared' in the '#pragma omp ...' directives.
OpenMPLinearClauseKind Modifier
Modifier of 'linear' clause.
static OMPSharedClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL)
Creates clause with a list of variables VL.
void setPrivateCopies(ArrayRef< Expr *> PrivateCopies)
Set list of helper expressions, required for generation of private copies of original lastprivate var...
This is a basic class for representing single OpenMP clause.
void setVarRefs(ArrayRef< Expr *> VL)
Sets the list of variables for this clause.
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 OMPPrivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PrivateVL)
Creates clause with a list of variables VL.
void * Allocate(size_t Size, unsigned Align=8) const
Expr * getLoopCunter(unsigned NumLoop)
Get loops counter for the specified loop.
Dataflow Directional Tag Classes.
This represents 'device' clause in the '#pragma omp ...' directive.
SourceLocation ModifierLoc
Location of linear modifier if any.
This represents clause 'linear' in the '#pragma omp ...' directives.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
static OMPFirstprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PrivateVL, ArrayRef< Expr *> InitVL, Stmt *PreInit)
Creates clause with a list of variables VL.
ArrayRef< MappableExprComponentList > MappableExprComponentListsRef
static OMPSharedClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
static OMPFromClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr *> Vars, ArrayRef< ValueDecl *> Declarations, MappableExprComponentListsRef ComponentLists)
Creates clause with a list of variables Vars.
Class that represents a component of a mappable expression.
static unsigned getUniqueDeclarationsTotalNumber(ArrayRef< const ValueDecl *> Declarations)
static OMPCopyprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
void setLoopData(unsigned NumLoop, Expr *Cnt)
Set the loop data for the depend clauses with 'sink|source' kind of dependency.
void setClauseInfo(ArrayRef< ValueDecl *> Declarations, MappableExprComponentListsRef ComponentLists)
Fill the clause information from the list of declarations and associated component lists...
Privates[]
Gets the list of initial values for linear variables.
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
void setPreInitStmt(Stmt *S, OpenMPDirectiveKind ThisRegion=OMPD_unknown)
Set pre-initialization statement for the clause.
This represents 'dist_schedule' clause in the '#pragma omp ...' directive.
static OMPFromClause * CreateEmpty(const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, unsigned NumComponentLists, unsigned NumComponents)
Creates an empty clause with the place for NumVars variables.
void setInits(ArrayRef< Expr *> IL)
Sets the list of the initial values for linear variables.
static OMPFlushClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL)
Creates clause with a list of variables VL.
static OMPClauseWithPostUpdate * get(OMPClause *C)
static OMPLastprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
SourceLocation ColonLoc
Location of ':'.
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.