70 return new (Mem)
OpenACCIfClause(BeginLoc, LParenLoc, ConditionExpr, EndLoc);
77 ConditionExpr, EndLoc) {
78 assert(ConditionExpr &&
"if clause requires condition expr");
81 "Condition expression type not scalar/dependent");
98 ConditionExpr, EndLoc) {
101 "Condition expression type not scalar/dependent");
107 assert(
false &&
"Clause children function not implemented");
109#define VISIT_CLAUSE(CLAUSE_NAME) \
110 case OpenACCClauseKind::CLAUSE_NAME: \
111 return cast<OpenACC##CLAUSE_NAME##Clause>(this)->children();
112#define CLAUSE_ALIAS(ALIAS_NAME, CLAUSE_NAME, DEPRECATED) \
113 case OpenACCClauseKind::ALIAS_NAME: \
114 return cast<OpenACC##CLAUSE_NAME##Clause>(this)->children();
116#include "clang/Basic/OpenACCClauses.def"
121OpenACCNumWorkersClause::OpenACCNumWorkersClause(
SourceLocation BeginLoc,
126 LParenLoc, IntExpr, EndLoc) {
129 "Condition expression type not scalar/dependent");
139 assert(GangKinds.size() == IntExprs.size() &&
"Mismatch exprs/kind?");
140 std::uninitialized_copy(IntExprs.begin(), IntExprs.end(),
141 getTrailingObjects<Expr *>());
143 std::uninitialized_copy(GangKinds.begin(), GangKinds.end(),
144 getTrailingObjects<OpenACCGangKind>());
157OpenACCCollapseClause::OpenACCCollapseClause(
SourceLocation BeginLoc,
159 bool HasForce,
Expr *LoopCount,
162 LParenLoc, LoopCount, EndLoc),
164 assert(LoopCount &&
"LoopCount required");
174 "Loop count not constant expression");
181OpenACCVectorLengthClause::OpenACCVectorLengthClause(
SourceLocation BeginLoc,
186 LParenLoc, IntExpr, EndLoc) {
189 "Condition expression type not scalar/dependent");
206 LParenLoc, IntExpr, EndLoc) {
209 "Condition expression type not scalar/dependent");
222OpenACCDeviceNumClause::OpenACCDeviceNumClause(
SourceLocation BeginLoc,
226 LParenLoc, IntExpr, EndLoc) {
229 "device_num expression type not scalar/dependent");
248 void *Mem =
C.Allocate(
249 OpenACCWaitClause::totalSizeToAlloc<Expr *>(QueueIdExprs.size() + 1));
251 QueueIdExprs, EndLoc);
259 void *Mem =
C.Allocate(
260 OpenACCNumGangsClause::totalSizeToAlloc<Expr *>(IntExprs.size()));
270 C.Allocate(OpenACCTileClause::totalSizeToAlloc<Expr *>(SizeExprs.size()));
279 void *Mem =
C.Allocate(
280 OpenACCPrivateClause::totalSizeToAlloc<Expr *>(VarList.size()));
287 void *Mem =
C.Allocate(
288 OpenACCFirstPrivateClause::totalSizeToAlloc<Expr *>(VarList.size()));
299 C.Allocate(OpenACCAttachClause::totalSizeToAlloc<Expr *>(VarList.size()));
309 C.Allocate(OpenACCDetachClause::totalSizeToAlloc<Expr *>(VarList.size()));
319 C.Allocate(OpenACCDeleteClause::totalSizeToAlloc<Expr *>(VarList.size()));
328 void *Mem =
C.Allocate(
329 OpenACCUseDeviceClause::totalSizeToAlloc<Expr *>(VarList.size()));
338 void *Mem =
C.Allocate(
339 OpenACCDevicePtrClause::totalSizeToAlloc<Expr *>(VarList.size()));
348 void *Mem =
C.Allocate(
349 OpenACCNoCreateClause::totalSizeToAlloc<Expr *>(VarList.size()));
358 void *Mem =
C.Allocate(
359 OpenACCPresentClause::totalSizeToAlloc<Expr *>(VarList.size()));
368 C.Allocate(OpenACCCopyClause::totalSizeToAlloc<Expr *>(VarList.size()));
379 C.Allocate(OpenACCCopyInClause::totalSizeToAlloc<Expr *>(VarList.size()));
381 IsReadOnly, VarList, EndLoc);
389 void *Mem =
C.Allocate(
390 OpenACCCopyOutClause::totalSizeToAlloc<Expr *>(VarList.size()));
401 C.Allocate(OpenACCCreateClause::totalSizeToAlloc<Expr *>(VarList.size()));
411 C.Allocate(OpenACCDeviceTypeClause::totalSizeToAlloc<DeviceTypeArgument>(
421 void *Mem =
C.Allocate(
422 OpenACCReductionClause::totalSizeToAlloc<Expr *>(VarList.size()));
454 C.Allocate(OpenACCGangClause::totalSizeToAlloc<Expr *, OpenACCGangKind>(
455 IntExprs.size(), GangKinds.size()));
464 LParenLoc, IntExpr, EndLoc) {
467 "Int expression type not scalar/dependent");
484 LParenLoc, IntExpr, EndLoc) {
487 "Int expression type not scalar/dependent");
520void OpenACCClausePrinter::printExpr(
const Expr *
E) {
525 OS <<
"default(" <<
C.getDefaultClauseKind() <<
")";
530 printExpr(
C.getConditionExpr());
536 if (
const Expr *CondExpr =
C.getConditionExpr()) {
545 llvm::interleaveComma(
C.getIntExprs(), OS,
546 [&](
const Expr *
E) { printExpr(E); });
552 llvm::interleaveComma(
C.getSizeExprs(), OS,
553 [&](
const Expr *
E) { printExpr(E); });
557void OpenACCClausePrinter::VisitNumWorkersClause(
559 OS <<
"num_workers(";
560 printExpr(
C.getIntExpr());
564void OpenACCClausePrinter::VisitVectorLengthClause(
566 OS <<
"vector_length(";
567 printExpr(
C.getIntExpr());
571void OpenACCClausePrinter::VisitDeviceNumClause(
574 printExpr(
C.getIntExpr());
580 if (
C.hasIntExpr()) {
582 printExpr(
C.getIntExpr());
589 llvm::interleaveComma(
C.getVarList(), OS,
590 [&](
const Expr *
E) { printExpr(E); });
594void OpenACCClausePrinter::VisitFirstPrivateClause(
596 OS <<
"firstprivate(";
597 llvm::interleaveComma(
C.getVarList(), OS,
598 [&](
const Expr *
E) { printExpr(E); });
604 llvm::interleaveComma(
C.getVarList(), OS,
605 [&](
const Expr *
E) { printExpr(E); });
611 llvm::interleaveComma(
C.getVarList(), OS,
612 [&](
const Expr *
E) { printExpr(E); });
618 llvm::interleaveComma(
C.getVarList(), OS,
619 [&](
const Expr *
E) { printExpr(E); });
623void OpenACCClausePrinter::VisitUseDeviceClause(
626 llvm::interleaveComma(
C.getVarList(), OS,
627 [&](
const Expr *
E) { printExpr(E); });
631void OpenACCClausePrinter::VisitDevicePtrClause(
634 llvm::interleaveComma(
C.getVarList(), OS,
635 [&](
const Expr *
E) { printExpr(E); });
641 llvm::interleaveComma(
C.getVarList(), OS,
642 [&](
const Expr *
E) { printExpr(E); });
648 llvm::interleaveComma(
C.getVarList(), OS,
649 [&](
const Expr *
E) { printExpr(E); });
654 OS <<
C.getClauseKind() <<
'(';
655 llvm::interleaveComma(
C.getVarList(), OS,
656 [&](
const Expr *
E) { printExpr(E); });
661 OS <<
C.getClauseKind() <<
'(';
664 llvm::interleaveComma(
C.getVarList(), OS,
665 [&](
const Expr *
E) { printExpr(E); });
670 OS <<
C.getClauseKind() <<
'(';
673 llvm::interleaveComma(
C.getVarList(), OS,
674 [&](
const Expr *
E) { printExpr(E); });
679 OS <<
C.getClauseKind() <<
'(';
682 llvm::interleaveComma(
C.getVarList(), OS,
683 [&](
const Expr *
E) { printExpr(E); });
687void OpenACCClausePrinter::VisitReductionClause(
689 OS <<
"reduction(" <<
C.getReductionOp() <<
": ";
690 llvm::interleaveComma(
C.getVarList(), OS,
691 [&](
const Expr *
E) { printExpr(E); });
697 if (!
C.getLParenLoc().isInvalid()) {
699 if (
C.hasDevNumExpr()) {
701 printExpr(
C.getDevNumExpr());
705 if (
C.hasQueuesTag())
708 llvm::interleaveComma(
C.getQueueIdExprs(), OS,
709 [&](
const Expr *
E) { printExpr(E); });
714void OpenACCClausePrinter::VisitDeviceTypeClause(
716 OS <<
C.getClauseKind();
718 llvm::interleaveComma(
C.getArchitectures(), OS,
720 if (Arch.first == nullptr)
723 OS << Arch.first->getName();
732void OpenACCClausePrinter::VisitIndependentClause(
745 printExpr(
C.getLoopCount());
752 if (
C.getNumExprs() > 0) {
755 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
760 OS <<
C.getExpr(I).first <<
": ";
761 printExpr(
C.getExpr(I).second);
770 if (
C.hasIntExpr()) {
772 printExpr(
C.getIntExpr());
780 if (
C.hasIntExpr()) {
782 printExpr(
C.getIntExpr());
791void OpenACCClausePrinter::VisitIfPresentClause(
Defines the clang::ASTContext interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
This represents one expression.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
static bool classof(const OpenACCClause *C)
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
Represents one of the handful of classes that has an optional/required 'condition' expression as an a...
static bool classof(const OpenACCClause *C)
Represents a clause that has one or more expressions associated with it.
static bool classof(const OpenACCClause *C)
void setExprs(MutableArrayRef< Expr * > NewExprs)
Used only for initialization, the leaf class can initialize this to trailing storage.
static bool classof(const OpenACCClause *C)
Represents one of a handful of clauses that have a single integer expression.
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
This is the base type for all OpenACC Clauses.
StmtIterator child_iterator
OpenACCClauseKind getClauseKind() const
llvm::iterator_range< child_iterator > child_range
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCGangClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
OpenACCGangClause(SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
An 'if' clause, which has a required condition expression.
OpenACCIfClause(SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCReductionClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator Operator, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression.
static bool classof(const OpenACCClause *C)
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
OpenACCVectorClause(SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static bool classof(const OpenACCClause *C)
static bool classof(const OpenACCClause *C)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
OpenACCWorkerClause(SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
Encodes a location in the source.
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isScalarType() const
The JSON file list parser is used to communicate input to InstallAPI.
OpenACCClauseKind
Represents the kind of an OpenACC clause.
@ Gang
'gang' clause, allowed on 'loop' and Combined constructs.
@ VectorLength
'vector_length' clause, allowed on 'parallel', 'kernels', 'parallel loop', and 'kernels loop' constru...
@ Async
'async' clause, allowed on Compute, Data, 'update', 'wait', and Combined constructs.
@ Collapse
'collapse' clause, allowed on 'loop' and Combined constructs.
@ DeviceNum
'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Worker
'worker' clause, allowed on 'loop', Combined, and 'routine' directives.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ NumWorkers
'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs...
std::pair< IdentifierInfo *, SourceLocation > DeviceTypeArgument