71 return new (Mem)
OpenACCIfClause(BeginLoc, LParenLoc, ConditionExpr, EndLoc);
78 ConditionExpr, EndLoc) {
79 assert(ConditionExpr &&
"if clause requires condition expr");
82 "Condition expression type not scalar/dependent");
99 ConditionExpr, EndLoc) {
102 "Condition expression type not scalar/dependent");
108 assert(
false &&
"Clause children function not implemented");
110#define VISIT_CLAUSE(CLAUSE_NAME) \
111 case OpenACCClauseKind::CLAUSE_NAME: \
112 return cast<OpenACC##CLAUSE_NAME##Clause>(this)->children();
113#define CLAUSE_ALIAS(ALIAS_NAME, CLAUSE_NAME, DEPRECATED) \
114 case OpenACCClauseKind::ALIAS_NAME: \
115 return cast<OpenACC##CLAUSE_NAME##Clause>(this)->children();
117#include "clang/Basic/OpenACCClauses.def"
122OpenACCNumWorkersClause::OpenACCNumWorkersClause(
SourceLocation BeginLoc,
127 LParenLoc, IntExpr, EndLoc) {
130 "Condition expression type not scalar/dependent");
140 assert(GangKinds.size() == IntExprs.size() &&
"Mismatch exprs/kind?");
141 std::uninitialized_copy(IntExprs.begin(), IntExprs.end(),
142 getTrailingObjects<Expr *>());
144 std::uninitialized_copy(GangKinds.begin(), GangKinds.end(),
145 getTrailingObjects<OpenACCGangKind>());
158OpenACCCollapseClause::OpenACCCollapseClause(
SourceLocation BeginLoc,
160 bool HasForce,
Expr *LoopCount,
163 LParenLoc, LoopCount, EndLoc),
165 assert(LoopCount &&
"LoopCount required");
175 "Loop count not constant expression");
182OpenACCVectorLengthClause::OpenACCVectorLengthClause(
SourceLocation BeginLoc,
187 LParenLoc, IntExpr, EndLoc) {
190 "Condition expression type not scalar/dependent");
207 LParenLoc, IntExpr, EndLoc) {
210 "Condition expression type not scalar/dependent");
223OpenACCDeviceNumClause::OpenACCDeviceNumClause(
SourceLocation BeginLoc,
227 LParenLoc, IntExpr, EndLoc) {
230 "device_num expression type not scalar/dependent");
243OpenACCDefaultAsyncClause::OpenACCDefaultAsyncClause(
SourceLocation BeginLoc,
248 LParenLoc, IntExpr, EndLoc) {
251 "default_async expression type not scalar/dependent");
270 void *Mem =
C.Allocate(
271 OpenACCWaitClause::totalSizeToAlloc<Expr *>(QueueIdExprs.size() + 1));
273 QueueIdExprs, EndLoc);
281 void *Mem =
C.Allocate(
282 OpenACCNumGangsClause::totalSizeToAlloc<Expr *>(IntExprs.size()));
292 C.Allocate(OpenACCTileClause::totalSizeToAlloc<Expr *>(SizeExprs.size()));
301 void *Mem =
C.Allocate(
302 OpenACCPrivateClause::totalSizeToAlloc<Expr *>(VarList.size()));
309 void *Mem =
C.Allocate(
310 OpenACCFirstPrivateClause::totalSizeToAlloc<Expr *>(VarList.size()));
321 C.Allocate(OpenACCAttachClause::totalSizeToAlloc<Expr *>(VarList.size()));
331 C.Allocate(OpenACCDetachClause::totalSizeToAlloc<Expr *>(VarList.size()));
341 C.Allocate(OpenACCDeleteClause::totalSizeToAlloc<Expr *>(VarList.size()));
350 void *Mem =
C.Allocate(
351 OpenACCUseDeviceClause::totalSizeToAlloc<Expr *>(VarList.size()));
360 void *Mem =
C.Allocate(
361 OpenACCDevicePtrClause::totalSizeToAlloc<Expr *>(VarList.size()));
370 void *Mem =
C.Allocate(
371 OpenACCNoCreateClause::totalSizeToAlloc<Expr *>(VarList.size()));
380 void *Mem =
C.Allocate(
381 OpenACCPresentClause::totalSizeToAlloc<Expr *>(VarList.size()));
390 C.Allocate(OpenACCCopyClause::totalSizeToAlloc<Expr *>(VarList.size()));
401 C.Allocate(OpenACCCopyInClause::totalSizeToAlloc<Expr *>(VarList.size()));
403 IsReadOnly, VarList, EndLoc);
411 void *Mem =
C.Allocate(
412 OpenACCCopyOutClause::totalSizeToAlloc<Expr *>(VarList.size()));
423 C.Allocate(OpenACCCreateClause::totalSizeToAlloc<Expr *>(VarList.size()));
433 C.Allocate(OpenACCDeviceTypeClause::totalSizeToAlloc<DeviceTypeArgument>(
443 void *Mem =
C.Allocate(
444 OpenACCReductionClause::totalSizeToAlloc<Expr *>(VarList.size()));
476 C.Allocate(OpenACCGangClause::totalSizeToAlloc<Expr *, OpenACCGangKind>(
477 IntExprs.size(), GangKinds.size()));
486 LParenLoc, IntExpr, EndLoc) {
489 "Int expression type not scalar/dependent");
506 LParenLoc, IntExpr, EndLoc) {
509 "Int expression type not scalar/dependent");
542void OpenACCClausePrinter::printExpr(
const Expr *
E) {
547 OS <<
"default(" <<
C.getDefaultClauseKind() <<
")";
552 printExpr(
C.getConditionExpr());
558 if (
const Expr *CondExpr =
C.getConditionExpr()) {
567 llvm::interleaveComma(
C.getIntExprs(), OS,
568 [&](
const Expr *
E) { printExpr(E); });
574 llvm::interleaveComma(
C.getSizeExprs(), OS,
575 [&](
const Expr *
E) { printExpr(E); });
579void OpenACCClausePrinter::VisitNumWorkersClause(
581 OS <<
"num_workers(";
582 printExpr(
C.getIntExpr());
586void OpenACCClausePrinter::VisitVectorLengthClause(
588 OS <<
"vector_length(";
589 printExpr(
C.getIntExpr());
593void OpenACCClausePrinter::VisitDeviceNumClause(
596 printExpr(
C.getIntExpr());
600void OpenACCClausePrinter::VisitDefaultAsyncClause(
602 OS <<
"default_async(";
603 printExpr(
C.getIntExpr());
609 if (
C.hasIntExpr()) {
611 printExpr(
C.getIntExpr());
618 llvm::interleaveComma(
C.getVarList(), OS,
619 [&](
const Expr *
E) { printExpr(E); });
623void OpenACCClausePrinter::VisitFirstPrivateClause(
625 OS <<
"firstprivate(";
626 llvm::interleaveComma(
C.getVarList(), OS,
627 [&](
const Expr *
E) { printExpr(E); });
633 llvm::interleaveComma(
C.getVarList(), OS,
634 [&](
const Expr *
E) { printExpr(E); });
640 llvm::interleaveComma(
C.getVarList(), OS,
641 [&](
const Expr *
E) { printExpr(E); });
647 llvm::interleaveComma(
C.getVarList(), OS,
648 [&](
const Expr *
E) { printExpr(E); });
652void OpenACCClausePrinter::VisitUseDeviceClause(
655 llvm::interleaveComma(
C.getVarList(), OS,
656 [&](
const Expr *
E) { printExpr(E); });
660void OpenACCClausePrinter::VisitDevicePtrClause(
663 llvm::interleaveComma(
C.getVarList(), OS,
664 [&](
const Expr *
E) { printExpr(E); });
670 llvm::interleaveComma(
C.getVarList(), OS,
671 [&](
const Expr *
E) { printExpr(E); });
677 llvm::interleaveComma(
C.getVarList(), OS,
678 [&](
const Expr *
E) { printExpr(E); });
683 OS <<
C.getClauseKind() <<
'(';
684 llvm::interleaveComma(
C.getVarList(), OS,
685 [&](
const Expr *
E) { printExpr(E); });
690 OS <<
C.getClauseKind() <<
'(';
693 llvm::interleaveComma(
C.getVarList(), OS,
694 [&](
const Expr *
E) { printExpr(E); });
699 OS <<
C.getClauseKind() <<
'(';
702 llvm::interleaveComma(
C.getVarList(), OS,
703 [&](
const Expr *
E) { printExpr(E); });
708 OS <<
C.getClauseKind() <<
'(';
711 llvm::interleaveComma(
C.getVarList(), OS,
712 [&](
const Expr *
E) { printExpr(E); });
716void OpenACCClausePrinter::VisitReductionClause(
718 OS <<
"reduction(" <<
C.getReductionOp() <<
": ";
719 llvm::interleaveComma(
C.getVarList(), OS,
720 [&](
const Expr *
E) { printExpr(E); });
726 if (!
C.getLParenLoc().isInvalid()) {
728 if (
C.hasDevNumExpr()) {
730 printExpr(
C.getDevNumExpr());
734 if (
C.hasQueuesTag())
737 llvm::interleaveComma(
C.getQueueIdExprs(), OS,
738 [&](
const Expr *
E) { printExpr(E); });
743void OpenACCClausePrinter::VisitDeviceTypeClause(
745 OS <<
C.getClauseKind();
747 llvm::interleaveComma(
C.getArchitectures(), OS,
749 if (Arch.first == nullptr)
752 OS << Arch.first->getName();
761void OpenACCClausePrinter::VisitIndependentClause(
774 printExpr(
C.getLoopCount());
781 if (
C.getNumExprs() > 0) {
784 for (
unsigned I = 0; I <
C.getNumExprs(); ++I) {
789 OS <<
C.getExpr(I).first <<
": ";
790 printExpr(
C.getExpr(I).second);
799 if (
C.hasIntExpr()) {
801 printExpr(
C.getIntExpr());
809 if (
C.hasIntExpr()) {
811 printExpr(
C.getIntExpr());
820void 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)
static bool classof(const OpenACCClause *C)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, 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.
@ DefaultAsync
'default_async' clause, allowed on 'set' construct.
@ 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