18 using namespace clang;
24 #define OPENMP_CLAUSE(Name, Class) \
26 return static_cast<Class *>(this)->children();
27 #include "clang/Basic/OpenMPKinds.def"
29 llvm_unreachable(
"unknown OMPClause");
34 "Number of private copies is not the same as the preallocated buffer");
43 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));
47 Clause->setPrivateCopies(PrivateVL);
53 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(2 * N));
59 "Number of private copies is not the same as the preallocated buffer");
65 "Number of inits is not the same as the preallocated buffer");
66 std::copy(VL.begin(), VL.end(), getPrivateCopies().end());
74 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(3 * VL.size()));
78 Clause->setPrivateCopies(PrivateVL);
79 Clause->setInits(InitVL);
85 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(3 * N));
91 "Number of private copies is not the same as the preallocated buffer");
92 std::copy(PrivateCopies.begin(), PrivateCopies.end(),
varlist_end());
96 assert(SrcExprs.size() ==
varlist_size() &&
"Number of source expressions is "
97 "not the same as the "
98 "preallocated buffer");
99 std::copy(SrcExprs.begin(), SrcExprs.end(), getPrivateCopies().end());
103 assert(DstExprs.size() ==
varlist_size() &&
"Number of destination "
104 "expressions is not the same as "
105 "the preallocated buffer");
106 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
109 void OMPLastprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
111 "Number of assignment expressions is not the same as the preallocated "
113 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
114 getDestinationExprs().end());
121 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
125 Clause->setSourceExprs(SrcExprs);
126 Clause->setDestinationExprs(DstExprs);
127 Clause->setAssignmentOps(AssignmentOps);
133 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * N));
142 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size()));
150 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(N));
156 "Number of privates is not the same as the preallocated buffer");
162 "Number of inits is not the same as the preallocated buffer");
163 std::copy(IL.begin(), IL.end(),
getPrivates().end());
168 "Number of updates is not the same as the preallocated buffer");
169 std::copy(UL.begin(), UL.end(),
getInits().end());
174 "Number of final updates is not the same as the preallocated buffer");
175 std::copy(FL.begin(), FL.end(),
getUpdates().end());
185 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2));
187 StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc, EndLoc, VL.size());
189 Clause->setPrivates(PL);
190 Clause->setInits(IL);
193 std::fill(Clause->getInits().end(), Clause->getInits().end() + VL.size(),
195 std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(),
197 Clause->setStep(Step);
198 Clause->setCalcStep(CalcStep);
206 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2));
214 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));
217 Clause->setVarRefs(VL);
218 Clause->setAlignment(A);
224 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(NumVars + 1));
229 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
230 "not the same as the "
231 "preallocated buffer");
232 std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end());
236 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
237 "expressions is not the same as "
238 "the preallocated buffer");
239 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
243 assert(AssignmentOps.size() == varlist_size() &&
244 "Number of assignment expressions is not the same as the preallocated "
246 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
247 getDestinationExprs().end());
252 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
253 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps) {
254 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
257 Clause->setVarRefs(VL);
258 Clause->setSourceExprs(SrcExprs);
259 Clause->setDestinationExprs(DstExprs);
260 Clause->setAssignmentOps(AssignmentOps);
265 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * N));
270 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
271 "not the same as the "
272 "preallocated buffer");
273 std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end());
277 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
278 "expressions is not the same as "
279 "the preallocated buffer");
280 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
283 void OMPCopyprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
284 assert(AssignmentOps.size() == varlist_size() &&
285 "Number of assignment expressions is not the same as the preallocated "
287 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
288 getDestinationExprs().end());
293 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
294 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps) {
295 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));
298 Clause->setVarRefs(VL);
299 Clause->setSourceExprs(SrcExprs);
300 Clause->setDestinationExprs(DstExprs);
301 Clause->setAssignmentOps(AssignmentOps);
307 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(4 * N));
313 "Number of private copies is not the same as the preallocated buffer");
314 std::copy(Privates.begin(), Privates.end(),
varlist_end());
320 "Number of LHS expressions is not the same as the preallocated buffer");
321 std::copy(LHSExprs.begin(), LHSExprs.end(), getPrivates().end());
327 "Number of RHS expressions is not the same as the preallocated buffer");
328 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());
332 assert(ReductionOps.size() ==
varlist_size() &&
"Number of reduction "
333 "expressions is not the same "
334 "as the preallocated buffer");
335 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());
344 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
346 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
348 Clause->setPrivates(Privates);
349 Clause->setLHSExprs(LHSExprs);
350 Clause->setRHSExprs(RHSExprs);
351 Clause->setReductionOps(ReductionOps);
357 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(5 * N));
366 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size()));
369 Clause->setVarRefs(VL);
374 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(N));
383 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size()));
386 Clause->setVarRefs(VL);
387 Clause->setDependencyKind(DepKind);
388 Clause->setDependencyLoc(DepLoc);
389 Clause->setColonLoc(ColonLoc);
394 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(N));
404 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(VL.size()));
406 TypeModifier, Type, TypeLoc, StartLoc, LParenLoc, EndLoc, VL.size());
407 Clause->setVarRefs(VL);
408 Clause->setMapTypeModifier(TypeModifier);
409 Clause->setMapType(Type);
410 Clause->setMapLoc(TypeLoc);
415 void *Mem = C.
Allocate(totalSizeToAlloc<Expr *>(N));
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.
static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
Defines the clang::ASTContext interface.
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 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 OMPFirstprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
llvm::iterator_range< child_iterator > child_range
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.
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.
This represents clause 'private' in the '#pragma omp ...' directives.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
Base wrapper for a particular "section" of type source info.
static OMPSharedClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
static OMPFirstprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PrivateVL, ArrayRef< Expr * > InitVL)
Creates clause with a list of variables VL.
clang::OMPLinearClause OMPVarListClause, 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 setUpdates(ArrayRef< Expr * > UL)
Sets the list of update expressions for linear variables.
This represents clause 'map' in the '#pragma omp ...' directives.
static OMPMapClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
void setFinals(ArrayRef< Expr * > FL)
Sets the list of final update expressions for linear variables.
This represents clause 'reduction' in the '#pragma omp ...' directives.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
This represents clause 'aligned' in the '#pragma omp ...' directives.
static OMPAlignedClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
static OMPFlushClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
Expr - This represents one expression.
static OMPMapClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, OpenMPMapClauseKind TypeModifier, OpenMPMapClauseKind Type, SourceLocation TypeLoc)
Creates clause with a list of variables VL.
MutableArrayRef< Expr * > getUpdates()
Sets the list of update expressions for linear variables.
void setInits(ArrayRef< Expr * > IL)
Sets the list of the initial values for linear variables.
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)
Creates clause with a list of variables VL.
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.
void setPrivateCopies(ArrayRef< Expr * > PrivateCopies)
Set list of helper expressions, required for generation of private copies of original lastprivate var...
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)
Creates clause with a list of variables VL and a linear step Step.
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.
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 file defines OpenMP AST classes for clauses.
Encodes a location in the source.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
MutableArrayRef< Expr * > getInits()
void setVarRefs(ArrayRef< Expr * > VL)
Sets the list of variables for this clause.
This represents clause 'shared' in the '#pragma omp ...' directives.
OpenMPLinearClauseKind Modifier
Modifier of 'linear' 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.
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 OMPSharedClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
static OMPCopyprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
varlist_iterator varlist_end()
Privates[]
Gets the list of initial values for linear variables.
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
void * Allocate(size_t Size, unsigned Align=8) const
void setPrivates(ArrayRef< Expr * > PL)
Sets the list of the copies of original linear variables.
static OMPLastprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
SourceLocation ColonLoc
Location of ':'.
unsigned varlist_size() const
static OMPLastprivateClause * 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.