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:
185 assert(VL.size() == varlist_size() &&
186 "Number of private copies is not the same as the preallocated buffer");
187 std::copy(VL.begin(), VL.end(), varlist_end());
195 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
199 Clause->setPrivateCopies(PrivateVL);
205 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(2 * N));
210 assert(VL.size() == varlist_size() &&
211 "Number of private copies is not the same as the preallocated buffer");
212 std::copy(VL.begin(), VL.end(), varlist_end());
216 assert(VL.size() == varlist_size() &&
217 "Number of inits is not the same as the preallocated buffer");
218 std::copy(VL.begin(), VL.end(), getPrivateCopies().end());
226 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(3 * VL.size()));
230 Clause->setPrivateCopies(PrivateVL);
231 Clause->setInits(InitVL);
238 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(3 * N));
243 assert(PrivateCopies.size() == varlist_size() &&
244 "Number of private copies is not the same as the preallocated buffer");
245 std::copy(PrivateCopies.begin(), PrivateCopies.end(), varlist_end());
249 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is " 250 "not the same as the " 251 "preallocated buffer");
252 std::copy(SrcExprs.begin(), SrcExprs.end(), getPrivateCopies().end());
256 assert(DstExprs.size() == varlist_size() &&
"Number of destination " 257 "expressions is not the same as " 258 "the preallocated buffer");
259 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
262 void OMPLastprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
263 assert(AssignmentOps.size() == varlist_size() &&
264 "Number of assignment expressions is not the same as the preallocated " 266 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
267 getDestinationExprs().end());
275 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
279 Clause->setSourceExprs(SrcExprs);
280 Clause->setDestinationExprs(DstExprs);
281 Clause->setAssignmentOps(AssignmentOps);
289 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * N));
298 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size()));
306 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(N));
311 assert(PL.size() == varlist_size() &&
312 "Number of privates is not the same as the preallocated buffer");
313 std::copy(PL.begin(), PL.end(), varlist_end());
317 assert(IL.size() == varlist_size() &&
318 "Number of inits is not the same as the preallocated buffer");
319 std::copy(IL.begin(), IL.end(),
getPrivates().end());
323 assert(UL.size() == varlist_size() &&
324 "Number of updates is not the same as the preallocated buffer");
325 std::copy(UL.begin(), UL.end(),
getInits().end());
329 assert(FL.size() == varlist_size() &&
330 "Number of final updates is not the same as the preallocated buffer");
331 std::copy(FL.begin(), FL.end(),
getUpdates().end());
342 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2));
344 StartLoc, LParenLoc,
Modifier, ModifierLoc, ColonLoc, EndLoc, VL.size());
346 Clause->setPrivates(PL);
347 Clause->setInits(IL);
350 std::fill(Clause->getInits().end(), Clause->getInits().end() + VL.size(),
352 std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(),
354 Clause->setStep(Step);
355 Clause->setCalcStep(CalcStep);
365 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2));
373 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
376 Clause->setVarRefs(VL);
377 Clause->setAlignment(A);
383 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(NumVars + 1));
388 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is " 389 "not the same as the " 390 "preallocated buffer");
391 std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end());
395 assert(DstExprs.size() == varlist_size() &&
"Number of destination " 396 "expressions is not the same as " 397 "the preallocated buffer");
398 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
402 assert(AssignmentOps.size() == varlist_size() &&
403 "Number of assignment expressions is not the same as the preallocated " 405 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
406 getDestinationExprs().end());
411 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
412 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps) {
413 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
416 Clause->setVarRefs(VL);
417 Clause->setSourceExprs(SrcExprs);
418 Clause->setDestinationExprs(DstExprs);
419 Clause->setAssignmentOps(AssignmentOps);
424 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * N));
428 void OMPCopyprivateClause::setSourceExprs(ArrayRef<Expr *> SrcExprs) {
429 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is " 430 "not the same as the " 431 "preallocated buffer");
432 std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end());
435 void OMPCopyprivateClause::setDestinationExprs(ArrayRef<Expr *> DstExprs) {
436 assert(DstExprs.size() == varlist_size() &&
"Number of destination " 437 "expressions is not the same as " 438 "the preallocated buffer");
439 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
442 void OMPCopyprivateClause::setAssignmentOps(ArrayRef<Expr *> AssignmentOps) {
443 assert(AssignmentOps.size() == varlist_size() &&
444 "Number of assignment expressions is not the same as the preallocated " 446 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
447 getDestinationExprs().end());
452 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
453 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps) {
454 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
457 Clause->setVarRefs(VL);
458 Clause->setSourceExprs(SrcExprs);
459 Clause->setDestinationExprs(DstExprs);
460 Clause->setAssignmentOps(AssignmentOps);
466 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * N));
470 void OMPReductionClause::setPrivates(ArrayRef<Expr *>
Privates) {
471 assert(Privates.size() == varlist_size() &&
472 "Number of private copies is not the same as the preallocated buffer");
473 std::copy(Privates.begin(), Privates.end(), varlist_end());
476 void OMPReductionClause::setLHSExprs(ArrayRef<Expr *> LHSExprs) {
478 LHSExprs.size() == varlist_size() &&
479 "Number of LHS expressions is not the same as the preallocated buffer");
480 std::copy(LHSExprs.begin(), LHSExprs.end(),
getPrivates().end());
483 void OMPReductionClause::setRHSExprs(ArrayRef<Expr *> RHSExprs) {
485 RHSExprs.size() == varlist_size() &&
486 "Number of RHS expressions is not the same as the preallocated buffer");
487 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());
490 void OMPReductionClause::setReductionOps(ArrayRef<Expr *> ReductionOps) {
491 assert(ReductionOps.size() == varlist_size() &&
"Number of reduction " 492 "expressions is not the same " 493 "as the preallocated buffer");
494 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());
504 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
506 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
508 Clause->setPrivates(Privates);
509 Clause->setLHSExprs(LHSExprs);
510 Clause->setRHSExprs(RHSExprs);
511 Clause->setReductionOps(ReductionOps);
519 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * N));
524 assert(Privates.size() == varlist_size() &&
525 "Number of private copies is not the same as the preallocated buffer");
526 std::copy(Privates.begin(), Privates.end(), varlist_end());
531 LHSExprs.size() == varlist_size() &&
532 "Number of LHS expressions is not the same as the preallocated buffer");
533 std::copy(LHSExprs.begin(), LHSExprs.end(),
getPrivates().end());
538 RHSExprs.size() == varlist_size() &&
539 "Number of RHS expressions is not the same as the preallocated buffer");
540 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());
543 void OMPTaskReductionClause::setReductionOps(
ArrayRef<Expr *> ReductionOps) {
544 assert(ReductionOps.size() == varlist_size() &&
"Number of task reduction " 545 "expressions is not the same " 546 "as the preallocated buffer");
547 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());
557 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
559 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
561 Clause->setPrivates(Privates);
562 Clause->setLHSExprs(LHSExprs);
563 Clause->setRHSExprs(RHSExprs);
564 Clause->setReductionOps(ReductionOps);
572 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * N));
577 assert(Privates.size() == varlist_size() &&
578 "Number of private copies is not the same as the preallocated buffer");
579 std::copy(Privates.begin(), Privates.end(), varlist_end());
584 LHSExprs.size() == varlist_size() &&
585 "Number of LHS expressions is not the same as the preallocated buffer");
586 std::copy(LHSExprs.begin(), LHSExprs.end(),
getPrivates().end());
591 RHSExprs.size() == varlist_size() &&
592 "Number of RHS expressions is not the same as the preallocated buffer");
593 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());
597 assert(ReductionOps.size() == varlist_size() &&
"Number of in reduction " 598 "expressions is not the same " 599 "as the preallocated buffer");
600 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());
603 void OMPInReductionClause::setTaskgroupDescriptors(
605 assert(TaskgroupDescriptors.size() == varlist_size() &&
606 "Number of in reduction descriptors is not the same as the " 607 "preallocated buffer");
608 std::copy(TaskgroupDescriptors.begin(), TaskgroupDescriptors.end(),
609 getReductionOps().end());
619 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(6 * VL.size()));
621 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
623 Clause->setPrivates(Privates);
624 Clause->setLHSExprs(LHSExprs);
625 Clause->setRHSExprs(RHSExprs);
626 Clause->setReductionOps(ReductionOps);
627 Clause->setTaskgroupDescriptors(TaskgroupDescriptors);
635 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(6 * N));
644 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
647 Clause->setVarRefs(VL);
652 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(N));
660 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
663 Clause->setVarRefs(VL);
664 Clause->setDependencyKind(DepKind);
665 Clause->setDependencyLoc(DepLoc);
666 Clause->setColonLoc(ColonLoc);
672 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(N + 1));
677 assert(getDependencyKind() == OMPC_DEPEND_sink ||
678 getDependencyKind() == OMPC_DEPEND_source || V ==
nullptr);
679 *getVarRefs().end() = V;
683 auto *V = *getVarRefs().end();
684 assert(getDependencyKind() == OMPC_DEPEND_sink ||
685 getDependencyKind() == OMPC_DEPEND_source || V ==
nullptr);
690 auto *V = *getVarRefs().end();
691 assert(getDependencyKind() == OMPC_DEPEND_sink ||
692 getDependencyKind() == OMPC_DEPEND_source || V ==
nullptr);
698 unsigned TotalNum = 0u;
699 for (
auto &C : ComponentLists)
700 TotalNum += C.size();
705 ArrayRef<ValueDecl *> Declarations) {
706 unsigned TotalNum = 0u;
707 llvm::SmallPtrSet<const ValueDecl *, 8>
Cache;
708 for (
auto *D : Declarations) {
709 const ValueDecl *VD = D ? cast<ValueDecl>(D->getCanonicalDecl()) :
nullptr;
725 unsigned NumVars = Vars.size();
726 unsigned NumUniqueDeclarations =
727 getUniqueDeclarationsTotalNumber(Declarations);
728 unsigned NumComponentLists = ComponentLists.size();
729 unsigned NumComponents = getComponentsTotalNumber(ComponentLists);
744 NumVars, NumUniqueDeclarations,
745 NumUniqueDeclarations + NumComponentLists, NumComponents));
747 TypeModifier, Type, TypeIsImplicit, TypeLoc, StartLoc, LParenLoc, EndLoc,
748 NumVars, NumUniqueDeclarations, NumComponentLists, NumComponents);
750 Clause->setVarRefs(Vars);
752 Clause->setMapTypeModifier(TypeModifier);
753 Clause->setMapType(Type);
754 Clause->setMapLoc(TypeLoc);
759 unsigned NumUniqueDeclarations,
760 unsigned NumComponentLists,
761 unsigned NumComponents) {
765 NumVars, NumUniqueDeclarations,
766 NumUniqueDeclarations + NumComponentLists, NumComponents));
767 return new (Mem)
OMPMapClause(NumVars, NumUniqueDeclarations,
768 NumComponentLists, NumComponents);
776 unsigned NumVars = Vars.size();
777 unsigned NumUniqueDeclarations =
778 getUniqueDeclarationsTotalNumber(Declarations);
779 unsigned NumComponentLists = ComponentLists.size();
780 unsigned NumComponents = getComponentsTotalNumber(ComponentLists);
795 NumVars, NumUniqueDeclarations,
796 NumUniqueDeclarations + NumComponentLists, NumComponents));
799 OMPToClause(StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations,
800 NumComponentLists, NumComponents);
802 Clause->setVarRefs(Vars);
808 unsigned NumUniqueDeclarations,
809 unsigned NumComponentLists,
810 unsigned NumComponents) {
814 NumVars, NumUniqueDeclarations,
815 NumUniqueDeclarations + NumComponentLists, NumComponents));
816 return new (Mem)
OMPToClause(NumVars, NumUniqueDeclarations,
817 NumComponentLists, NumComponents);
825 unsigned NumVars = Vars.size();
826 unsigned NumUniqueDeclarations =
827 getUniqueDeclarationsTotalNumber(Declarations);
828 unsigned NumComponentLists = ComponentLists.size();
829 unsigned NumComponents = getComponentsTotalNumber(ComponentLists);
844 NumVars, NumUniqueDeclarations,
845 NumUniqueDeclarations + NumComponentLists, NumComponents));
848 OMPFromClause(StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations,
849 NumComponentLists, NumComponents);
851 Clause->setVarRefs(Vars);
857 unsigned NumUniqueDeclarations,
858 unsigned NumComponentLists,
859 unsigned NumComponents) {
863 NumVars, NumUniqueDeclarations,
864 NumUniqueDeclarations + NumComponentLists, NumComponents));
865 return new (Mem)
OMPFromClause(NumVars, NumUniqueDeclarations,
866 NumComponentLists, NumComponents);
870 assert(VL.size() == varlist_size() &&
871 "Number of private copies is not the same as the preallocated buffer");
872 std::copy(VL.begin(), VL.end(), varlist_end());
876 assert(VL.size() == varlist_size() &&
877 "Number of inits is not the same as the preallocated buffer");
878 std::copy(VL.begin(), VL.end(), getPrivateCopies().end());
883 SourceLocation EndLoc, ArrayRef<Expr *> Vars, ArrayRef<Expr *> PrivateVars,
884 ArrayRef<Expr *>
Inits, ArrayRef<ValueDecl *> Declarations,
886 unsigned NumVars = Vars.size();
887 unsigned NumUniqueDeclarations =
888 getUniqueDeclarationsTotalNumber(Declarations);
889 unsigned NumComponentLists = ComponentLists.size();
890 unsigned NumComponents = getComponentsTotalNumber(ComponentLists);
905 3 * NumVars, NumUniqueDeclarations,
906 NumUniqueDeclarations + NumComponentLists, NumComponents));
909 StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations,
910 NumComponentLists, NumComponents);
912 Clause->setVarRefs(Vars);
913 Clause->setPrivateCopies(PrivateVars);
914 Clause->setInits(Inits);
920 const ASTContext &C,
unsigned NumVars,
unsigned NumUniqueDeclarations,
921 unsigned NumComponentLists,
unsigned NumComponents) {
925 3 * NumVars, NumUniqueDeclarations,
926 NumUniqueDeclarations + NumComponentLists, NumComponents));
928 NumComponentLists, NumComponents);
937 unsigned NumVars = Vars.size();
938 unsigned NumUniqueDeclarations =
939 getUniqueDeclarationsTotalNumber(Declarations);
940 unsigned NumComponentLists = ComponentLists.size();
941 unsigned NumComponents = getComponentsTotalNumber(ComponentLists);
956 NumVars, NumUniqueDeclarations,
957 NumUniqueDeclarations + NumComponentLists, NumComponents));
960 StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations,
961 NumComponentLists, NumComponents);
963 Clause->setVarRefs(Vars);
969 const ASTContext &C,
unsigned NumVars,
unsigned NumUniqueDeclarations,
970 unsigned NumComponentLists,
unsigned NumComponents) {
974 NumVars, NumUniqueDeclarations,
975 NumUniqueDeclarations + NumComponentLists, NumComponents));
977 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.
static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
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.
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 for NumVars original expressions, NumUniqueDeclarations de...
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.
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.
This represents clause 'map' in the '#pragma omp ...' directives.
This represents clause 'to' in the '#pragma omp ...' directives.
Expr * getCounterValue()
Get the loop counter value.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
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.
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 OMPDependClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, OpenMPDependClauseKind DepKind, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr *> VL)
Creates clause with a list of variables VL.
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
MutableArrayRef< Expr * > getUpdates()
Sets the list of update expressions for linear variables.
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.
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
Dataflow Directional Tag Classes.
static unsigned getUniqueDeclarationsTotalNumber(ArrayRef< ValueDecl *> Declarations)
This represents 'device' clause in the '#pragma omp ...' directive.
SourceLocation ModifierLoc
Location of linear modifier if any.
void setCounterValue(Expr *V)
Set the loop counter value for the depend clauses with 'sink|source' kind of dependency.
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.
static OMPCopyprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
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.