mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 06:10:12 +00:00
[OPENMP]Redesign of OMPExecutableDirective/OMPDeclarativeDirective representation.
Summary: Introduced OMPChildren class to handle all associated clauses, statement and child expressions/statements. It allows to represent some directives more correctly (like flush, depobj etc. with pseudo clauses, ordered depend directives, which are standalone, and target data directives). Also, it will make easier to avoid using of CapturedStmt in directives, if required (atomic, tile etc. directives). Also, it simplifies serialization/deserialization of the executable/declarative directives. Reduces number of allocation operations for mapper declarations. Reviewers: jdoerfert Subscribers: yaxunl, guansong, jfb, cfe-commits, sstefan1, aaron.ballman, caomhin Tags: #clang Differential Revision: https://reviews.llvm.org/D83261
This commit is contained in:
parent
8f5b2cb828
commit
0af7835eae
@ -14,6 +14,7 @@
|
||||
#ifndef LLVM_CLANG_AST_DECLOPENMP_H
|
||||
#define LLVM_CLANG_AST_DECLOPENMP_H
|
||||
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "clang/AST/ExternalASTSource.h"
|
||||
@ -24,6 +25,79 @@
|
||||
|
||||
namespace clang {
|
||||
|
||||
/// This is a basic class for representing single OpenMP declarative directive.
|
||||
///
|
||||
template <typename U> class OMPDeclarativeDirective : public U {
|
||||
friend class ASTDeclReader;
|
||||
friend class ASTDeclWriter;
|
||||
|
||||
/// Get the clauses storage.
|
||||
MutableArrayRef<OMPClause *> getClauses() {
|
||||
if (!Data)
|
||||
return llvm::None;
|
||||
return Data->getClauses();
|
||||
}
|
||||
|
||||
protected:
|
||||
/// Data, associated with the directive.
|
||||
OMPChildren *Data = nullptr;
|
||||
|
||||
/// Build instance of directive.
|
||||
///
|
||||
/// \param StartLoc Starting location of the directive (directive keyword).
|
||||
///
|
||||
template <typename... Params>
|
||||
OMPDeclarativeDirective(Params &&... P) : U(std::forward<Params>(P)...) {}
|
||||
|
||||
template <typename T, typename... Params>
|
||||
static T *createDirective(const ASTContext &C, DeclContext *DC,
|
||||
ArrayRef<OMPClause *> Clauses, unsigned NumChildren,
|
||||
Params &&... P) {
|
||||
auto *Inst = new (C, DC, size(Clauses.size(), NumChildren))
|
||||
T(DC, std::forward<Params>(P)...);
|
||||
Inst->Data = OMPChildren::Create(Inst + 1, Clauses,
|
||||
/*AssociatedStmt=*/nullptr, NumChildren);
|
||||
Inst->Data->setClauses(Clauses);
|
||||
return Inst;
|
||||
}
|
||||
|
||||
template <typename T, typename... Params>
|
||||
static T *createEmptyDirective(const ASTContext &C, unsigned ID,
|
||||
unsigned NumClauses, unsigned NumChildren,
|
||||
Params &&... P) {
|
||||
auto *Inst = new (C, ID, size(NumClauses, NumChildren))
|
||||
T(nullptr, std::forward<Params>(P)...);
|
||||
Inst->Data = OMPChildren::CreateEmpty(
|
||||
Inst + 1, NumClauses, /*HasAssociatedStmt=*/false, NumChildren);
|
||||
return Inst;
|
||||
}
|
||||
|
||||
static size_t size(unsigned NumClauses, unsigned NumChildren) {
|
||||
return OMPChildren::size(NumClauses, /*HasAssociatedStmt=*/false,
|
||||
NumChildren);
|
||||
}
|
||||
|
||||
public:
|
||||
/// Get number of clauses.
|
||||
unsigned getNumClauses() const {
|
||||
if (!Data)
|
||||
return 0;
|
||||
return Data->getNumClauses();
|
||||
}
|
||||
|
||||
/// Returns specified clause.
|
||||
///
|
||||
/// \param I Number of clause.
|
||||
///
|
||||
OMPClause *getClause(unsigned I) const { return clauses()[I]; }
|
||||
|
||||
ArrayRef<OMPClause *> clauses() const {
|
||||
if (!Data)
|
||||
return llvm::None;
|
||||
return Data->getClauses();
|
||||
}
|
||||
};
|
||||
|
||||
/// This represents '#pragma omp threadprivate ...' directive.
|
||||
/// For example, in the following, both 'a' and 'A::b' are threadprivate:
|
||||
///
|
||||
@ -36,25 +110,23 @@ namespace clang {
|
||||
/// };
|
||||
/// \endcode
|
||||
///
|
||||
class OMPThreadPrivateDecl final
|
||||
: public Decl,
|
||||
private llvm::TrailingObjects<OMPThreadPrivateDecl, Expr *> {
|
||||
friend class ASTDeclReader;
|
||||
friend TrailingObjects;
|
||||
|
||||
unsigned NumVars;
|
||||
class OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> {
|
||||
friend class OMPDeclarativeDirective<Decl>;
|
||||
|
||||
virtual void anchor();
|
||||
|
||||
OMPThreadPrivateDecl(Kind DK, DeclContext *DC, SourceLocation L) :
|
||||
Decl(DK, DC, L), NumVars(0) { }
|
||||
OMPThreadPrivateDecl(DeclContext *DC = nullptr,
|
||||
SourceLocation L = SourceLocation())
|
||||
: OMPDeclarativeDirective<Decl>(OMPThreadPrivate, DC, L) {}
|
||||
|
||||
ArrayRef<const Expr *> getVars() const {
|
||||
return llvm::makeArrayRef(getTrailingObjects<Expr *>(), NumVars);
|
||||
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
|
||||
return llvm::makeArrayRef(Storage, Data->getNumChildren());
|
||||
}
|
||||
|
||||
MutableArrayRef<Expr *> getVars() {
|
||||
return MutableArrayRef<Expr *>(getTrailingObjects<Expr *>(), NumVars);
|
||||
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
|
||||
return llvm::makeMutableArrayRef(Storage, Data->getNumChildren());
|
||||
}
|
||||
|
||||
void setVars(ArrayRef<Expr *> VL);
|
||||
@ -71,8 +143,8 @@ public:
|
||||
typedef llvm::iterator_range<varlist_iterator> varlist_range;
|
||||
typedef llvm::iterator_range<varlist_const_iterator> varlist_const_range;
|
||||
|
||||
unsigned varlist_size() const { return NumVars; }
|
||||
bool varlist_empty() const { return NumVars == 0; }
|
||||
unsigned varlist_size() const { return Data->getNumChildren(); }
|
||||
bool varlist_empty() const { return Data->getChildren().empty(); }
|
||||
|
||||
varlist_range varlists() {
|
||||
return varlist_range(varlist_begin(), varlist_end());
|
||||
@ -214,11 +286,11 @@ public:
|
||||
/// \code
|
||||
/// #pragma omp declare mapper(mid: struct vec v) map(v.len, v.data[0:N])
|
||||
/// \endcode
|
||||
class OMPDeclareMapperDecl final : public ValueDecl, public DeclContext {
|
||||
class OMPDeclareMapperDecl final : public OMPDeclarativeDirective<ValueDecl>,
|
||||
public DeclContext {
|
||||
friend class OMPDeclarativeDirective<ValueDecl>;
|
||||
friend class ASTDeclReader;
|
||||
|
||||
/// Clauses associated with this mapper declaration
|
||||
MutableArrayRef<OMPClause *> Clauses;
|
||||
friend class ASTDeclWriter;
|
||||
|
||||
/// Mapper variable, which is 'v' in the example above
|
||||
Expr *MapperVarRef = nullptr;
|
||||
@ -230,42 +302,36 @@ class OMPDeclareMapperDecl final : public ValueDecl, public DeclContext {
|
||||
|
||||
void anchor() override;
|
||||
|
||||
OMPDeclareMapperDecl(Kind DK, DeclContext *DC, SourceLocation L,
|
||||
DeclarationName Name, QualType Ty,
|
||||
DeclarationName VarName,
|
||||
OMPDeclareMapperDecl(DeclContext *DC, SourceLocation L, DeclarationName Name,
|
||||
QualType Ty, DeclarationName VarName,
|
||||
OMPDeclareMapperDecl *PrevDeclInScope)
|
||||
: ValueDecl(DK, DC, L, Name, Ty), DeclContext(DK), VarName(VarName),
|
||||
: OMPDeclarativeDirective<ValueDecl>(OMPDeclareMapper, DC, L, Name, Ty),
|
||||
DeclContext(OMPDeclareMapper), VarName(VarName),
|
||||
PrevDeclInScope(PrevDeclInScope) {}
|
||||
|
||||
void setPrevDeclInScope(OMPDeclareMapperDecl *Prev) {
|
||||
PrevDeclInScope = Prev;
|
||||
}
|
||||
|
||||
/// Sets an array of clauses to this mapper declaration
|
||||
void setClauses(ArrayRef<OMPClause *> CL);
|
||||
|
||||
public:
|
||||
/// Creates declare mapper node.
|
||||
static OMPDeclareMapperDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L, DeclarationName Name,
|
||||
QualType T, DeclarationName VarName,
|
||||
ArrayRef<OMPClause *> Clauses,
|
||||
OMPDeclareMapperDecl *PrevDeclInScope);
|
||||
/// Creates deserialized declare mapper node.
|
||||
static OMPDeclareMapperDecl *CreateDeserialized(ASTContext &C, unsigned ID,
|
||||
unsigned N);
|
||||
|
||||
/// Creates an array of clauses to this mapper declaration and intializes
|
||||
/// them.
|
||||
void CreateClauses(ASTContext &C, ArrayRef<OMPClause *> CL);
|
||||
|
||||
using clauselist_iterator = MutableArrayRef<OMPClause *>::iterator;
|
||||
using clauselist_const_iterator = ArrayRef<const OMPClause *>::iterator;
|
||||
using clauselist_range = llvm::iterator_range<clauselist_iterator>;
|
||||
using clauselist_const_range =
|
||||
llvm::iterator_range<clauselist_const_iterator>;
|
||||
|
||||
unsigned clauselist_size() const { return Clauses.size(); }
|
||||
bool clauselist_empty() const { return Clauses.empty(); }
|
||||
unsigned clauselist_size() const { return Data->getNumClauses(); }
|
||||
bool clauselist_empty() const { return Data->getClauses().empty(); }
|
||||
|
||||
clauselist_range clauselists() {
|
||||
return clauselist_range(clauselist_begin(), clauselist_end());
|
||||
@ -273,16 +339,24 @@ public:
|
||||
clauselist_const_range clauselists() const {
|
||||
return clauselist_const_range(clauselist_begin(), clauselist_end());
|
||||
}
|
||||
clauselist_iterator clauselist_begin() { return Clauses.begin(); }
|
||||
clauselist_iterator clauselist_end() { return Clauses.end(); }
|
||||
clauselist_const_iterator clauselist_begin() const { return Clauses.begin(); }
|
||||
clauselist_const_iterator clauselist_end() const { return Clauses.end(); }
|
||||
clauselist_iterator clauselist_begin() { return Data->getClauses().begin(); }
|
||||
clauselist_iterator clauselist_end() { return Data->getClauses().end(); }
|
||||
clauselist_const_iterator clauselist_begin() const {
|
||||
return Data->getClauses().begin();
|
||||
}
|
||||
clauselist_const_iterator clauselist_end() const {
|
||||
return Data->getClauses().end();
|
||||
}
|
||||
|
||||
/// Get the variable declared in the mapper
|
||||
Expr *getMapperVarRef() { return MapperVarRef; }
|
||||
const Expr *getMapperVarRef() const { return MapperVarRef; }
|
||||
Expr *getMapperVarRef() { return cast_or_null<Expr>(Data->getChildren()[0]); }
|
||||
const Expr *getMapperVarRef() const {
|
||||
return cast_or_null<Expr>(Data->getChildren()[0]);
|
||||
}
|
||||
/// Set the variable declared in the mapper
|
||||
void setMapperVarRef(Expr *MapperVarRefE) { MapperVarRef = MapperVarRefE; }
|
||||
void setMapperVarRef(Expr *MapperVarRefE) {
|
||||
Data->getChildren()[0] = MapperVarRefE;
|
||||
}
|
||||
|
||||
/// Get the name of the variable declared in the mapper
|
||||
DeclarationName getVarName() { return VarName; }
|
||||
@ -342,34 +416,14 @@ public:
|
||||
/// #pragma omp requires unified_address
|
||||
/// \endcode
|
||||
///
|
||||
class OMPRequiresDecl final
|
||||
: public Decl,
|
||||
private llvm::TrailingObjects<OMPRequiresDecl, OMPClause *> {
|
||||
class OMPRequiresDecl final : public OMPDeclarativeDirective<Decl> {
|
||||
friend class OMPDeclarativeDirective<Decl>;
|
||||
friend class ASTDeclReader;
|
||||
friend TrailingObjects;
|
||||
|
||||
// Number of clauses associated with this requires declaration
|
||||
unsigned NumClauses = 0;
|
||||
|
||||
virtual void anchor();
|
||||
|
||||
OMPRequiresDecl(Kind DK, DeclContext *DC, SourceLocation L)
|
||||
: Decl(DK, DC, L), NumClauses(0) {}
|
||||
|
||||
/// Returns an array of immutable clauses associated with this requires
|
||||
/// declaration
|
||||
ArrayRef<const OMPClause *> getClauses() const {
|
||||
return llvm::makeArrayRef(getTrailingObjects<OMPClause *>(), NumClauses);
|
||||
}
|
||||
|
||||
/// Returns an array of clauses associated with this requires declaration
|
||||
MutableArrayRef<OMPClause *> getClauses() {
|
||||
return MutableArrayRef<OMPClause *>(getTrailingObjects<OMPClause *>(),
|
||||
NumClauses);
|
||||
}
|
||||
|
||||
/// Sets an array of clauses to this requires declaration
|
||||
void setClauses(ArrayRef<OMPClause *> CL);
|
||||
OMPRequiresDecl(DeclContext *DC, SourceLocation L)
|
||||
: OMPDeclarativeDirective<Decl>(OMPRequires, DC, L) {}
|
||||
|
||||
public:
|
||||
/// Create requires node.
|
||||
@ -384,8 +438,8 @@ public:
|
||||
using clauselist_range = llvm::iterator_range<clauselist_iterator>;
|
||||
using clauselist_const_range = llvm::iterator_range<clauselist_const_iterator>;
|
||||
|
||||
unsigned clauselist_size() const { return NumClauses; }
|
||||
bool clauselist_empty() const { return NumClauses == 0; }
|
||||
unsigned clauselist_size() const { return Data->getNumClauses(); }
|
||||
bool clauselist_empty() const { return Data->getClauses().empty(); }
|
||||
|
||||
clauselist_range clauselists() {
|
||||
return clauselist_range(clauselist_begin(), clauselist_end());
|
||||
@ -393,13 +447,13 @@ public:
|
||||
clauselist_const_range clauselists() const {
|
||||
return clauselist_const_range(clauselist_begin(), clauselist_end());
|
||||
}
|
||||
clauselist_iterator clauselist_begin() { return getClauses().begin(); }
|
||||
clauselist_iterator clauselist_end() { return getClauses().end(); }
|
||||
clauselist_iterator clauselist_begin() { return Data->getClauses().begin(); }
|
||||
clauselist_iterator clauselist_end() { return Data->getClauses().end(); }
|
||||
clauselist_const_iterator clauselist_begin() const {
|
||||
return getClauses().begin();
|
||||
return Data->getClauses().begin();
|
||||
}
|
||||
clauselist_const_iterator clauselist_end() const {
|
||||
return getClauses().end();
|
||||
return Data->getClauses().end();
|
||||
}
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
@ -419,53 +473,27 @@ public:
|
||||
/// };
|
||||
/// \endcode
|
||||
///
|
||||
class OMPAllocateDecl final
|
||||
: public Decl,
|
||||
private llvm::TrailingObjects<OMPAllocateDecl, Expr *, OMPClause *> {
|
||||
class OMPAllocateDecl final : public OMPDeclarativeDirective<Decl> {
|
||||
friend class OMPDeclarativeDirective<Decl>;
|
||||
friend class ASTDeclReader;
|
||||
friend TrailingObjects;
|
||||
|
||||
/// Number of variable within the allocate directive.
|
||||
unsigned NumVars = 0;
|
||||
/// Number of clauses associated with the allocate directive.
|
||||
unsigned NumClauses = 0;
|
||||
|
||||
size_t numTrailingObjects(OverloadToken<Expr *>) const {
|
||||
return NumVars;
|
||||
}
|
||||
size_t numTrailingObjects(OverloadToken<OMPClause *>) const {
|
||||
return NumClauses;
|
||||
}
|
||||
|
||||
virtual void anchor();
|
||||
|
||||
OMPAllocateDecl(Kind DK, DeclContext *DC, SourceLocation L)
|
||||
: Decl(DK, DC, L) {}
|
||||
OMPAllocateDecl(DeclContext *DC, SourceLocation L)
|
||||
: OMPDeclarativeDirective<Decl>(OMPAllocate, DC, L) {}
|
||||
|
||||
ArrayRef<const Expr *> getVars() const {
|
||||
return llvm::makeArrayRef(getTrailingObjects<Expr *>(), NumVars);
|
||||
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
|
||||
return llvm::makeArrayRef(Storage, Data->getNumChildren());
|
||||
}
|
||||
|
||||
MutableArrayRef<Expr *> getVars() {
|
||||
return MutableArrayRef<Expr *>(getTrailingObjects<Expr *>(), NumVars);
|
||||
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
|
||||
return llvm::makeMutableArrayRef(Storage, Data->getNumChildren());
|
||||
}
|
||||
|
||||
void setVars(ArrayRef<Expr *> VL);
|
||||
|
||||
/// Returns an array of immutable clauses associated with this directive.
|
||||
ArrayRef<OMPClause *> getClauses() const {
|
||||
return llvm::makeArrayRef(getTrailingObjects<OMPClause *>(), NumClauses);
|
||||
}
|
||||
|
||||
/// Returns an array of clauses associated with this directive.
|
||||
MutableArrayRef<OMPClause *> getClauses() {
|
||||
return MutableArrayRef<OMPClause *>(getTrailingObjects<OMPClause *>(),
|
||||
NumClauses);
|
||||
}
|
||||
|
||||
/// Sets an array of clauses to this requires declaration
|
||||
void setClauses(ArrayRef<OMPClause *> CL);
|
||||
|
||||
public:
|
||||
static OMPAllocateDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L, ArrayRef<Expr *> VL,
|
||||
@ -482,11 +510,10 @@ public:
|
||||
using clauselist_range = llvm::iterator_range<clauselist_iterator>;
|
||||
using clauselist_const_range = llvm::iterator_range<clauselist_const_iterator>;
|
||||
|
||||
|
||||
unsigned varlist_size() const { return NumVars; }
|
||||
bool varlist_empty() const { return NumVars == 0; }
|
||||
unsigned clauselist_size() const { return NumClauses; }
|
||||
bool clauselist_empty() const { return NumClauses == 0; }
|
||||
unsigned varlist_size() const { return Data->getNumChildren(); }
|
||||
bool varlist_empty() const { return Data->getChildren().empty(); }
|
||||
unsigned clauselist_size() const { return Data->getNumClauses(); }
|
||||
bool clauselist_empty() const { return Data->getClauses().empty(); }
|
||||
|
||||
varlist_range varlists() {
|
||||
return varlist_range(varlist_begin(), varlist_end());
|
||||
@ -505,13 +532,13 @@ public:
|
||||
clauselist_const_range clauselists() const {
|
||||
return clauselist_const_range(clauselist_begin(), clauselist_end());
|
||||
}
|
||||
clauselist_iterator clauselist_begin() { return getClauses().begin(); }
|
||||
clauselist_iterator clauselist_end() { return getClauses().end(); }
|
||||
clauselist_iterator clauselist_begin() { return Data->getClauses().begin(); }
|
||||
clauselist_iterator clauselist_end() { return Data->getClauses().end(); }
|
||||
clauselist_const_iterator clauselist_begin() const {
|
||||
return getClauses().begin();
|
||||
return Data->getClauses().begin();
|
||||
}
|
||||
clauselist_const_iterator clauselist_end() const {
|
||||
return getClauses().end();
|
||||
return Data->getClauses().end();
|
||||
}
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef LLVM_CLANG_AST_OPENMPCLAUSE_H
|
||||
#define LLVM_CLANG_AST_OPENMPCLAUSE_H
|
||||
|
||||
#include "clang/AST/ASTFwd.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclarationName.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
@ -7878,6 +7879,150 @@ private:
|
||||
llvm::StringMap<bool> FeatureMap;
|
||||
};
|
||||
|
||||
/// Contains data for OpenMP directives: clauses, children
|
||||
/// expressions/statements (helpers for codegen) and associated statement, if
|
||||
/// any.
|
||||
class OMPChildren final
|
||||
: private llvm::TrailingObjects<OMPChildren, OMPClause *, Stmt *> {
|
||||
friend class OMPClauseReader;
|
||||
friend class TrailingObjects;
|
||||
friend class OMPExecutableDirective;
|
||||
template <typename T> friend class OMPDeclarativeDirective;
|
||||
|
||||
/// Numbers of clauses.
|
||||
unsigned NumClauses = 0;
|
||||
/// Number of child expressions/stmts.
|
||||
unsigned NumChildren = 0;
|
||||
/// true if the directive has associated statement.
|
||||
bool HasAssociatedStmt = false;
|
||||
|
||||
/// Define the sizes of each trailing object array except the last one. This
|
||||
/// is required for TrailingObjects to work properly.
|
||||
size_t numTrailingObjects(OverloadToken<OMPClause *>) const {
|
||||
return NumClauses;
|
||||
}
|
||||
|
||||
OMPChildren() = delete;
|
||||
|
||||
OMPChildren(unsigned NumClauses, unsigned NumChildren, bool HasAssociatedStmt)
|
||||
: NumClauses(NumClauses), NumChildren(NumChildren),
|
||||
HasAssociatedStmt(HasAssociatedStmt) {}
|
||||
|
||||
static size_t size(unsigned NumClauses, bool HasAssociatedStmt,
|
||||
unsigned NumChildren);
|
||||
|
||||
static OMPChildren *Create(void *Mem, ArrayRef<OMPClause *> Clauses);
|
||||
static OMPChildren *Create(void *Mem, ArrayRef<OMPClause *> Clauses, Stmt *S,
|
||||
unsigned NumChildren = 0);
|
||||
static OMPChildren *CreateEmpty(void *Mem, unsigned NumClauses,
|
||||
bool HasAssociatedStmt = false,
|
||||
unsigned NumChildren = 0);
|
||||
|
||||
public:
|
||||
unsigned getNumClauses() const { return NumClauses; }
|
||||
unsigned getNumChildren() const { return NumChildren; }
|
||||
bool hasAssociatedStmt() const { return HasAssociatedStmt; }
|
||||
|
||||
/// Set associated statement.
|
||||
void setAssociatedStmt(Stmt *S) {
|
||||
getTrailingObjects<Stmt *>()[NumChildren] = S;
|
||||
}
|
||||
|
||||
void setChildren(ArrayRef<Stmt *> Children);
|
||||
|
||||
/// Sets the list of variables for this clause.
|
||||
///
|
||||
/// \param Clauses The list of clauses for the directive.
|
||||
///
|
||||
void setClauses(ArrayRef<OMPClause *> Clauses);
|
||||
|
||||
/// Returns statement associated with the directive.
|
||||
const Stmt *getAssociatedStmt() const {
|
||||
return const_cast<OMPChildren *>(this)->getAssociatedStmt();
|
||||
}
|
||||
Stmt *getAssociatedStmt() {
|
||||
assert(HasAssociatedStmt &&
|
||||
"Expected directive with the associated statement.");
|
||||
return getTrailingObjects<Stmt *>()[NumChildren];
|
||||
}
|
||||
|
||||
/// Get the clauses storage.
|
||||
MutableArrayRef<OMPClause *> getClauses() {
|
||||
return llvm::makeMutableArrayRef(getTrailingObjects<OMPClause *>(),
|
||||
NumClauses);
|
||||
}
|
||||
ArrayRef<OMPClause *> getClauses() const {
|
||||
return const_cast<OMPChildren *>(this)->getClauses();
|
||||
}
|
||||
|
||||
/// Returns the captured statement associated with the
|
||||
/// component region within the (combined) directive.
|
||||
///
|
||||
/// \param RegionKind Component region kind.
|
||||
const CapturedStmt *
|
||||
getCapturedStmt(OpenMPDirectiveKind RegionKind,
|
||||
ArrayRef<OpenMPDirectiveKind> CaptureRegions) const {
|
||||
assert(llvm::any_of(
|
||||
CaptureRegions,
|
||||
[=](const OpenMPDirectiveKind K) { return K == RegionKind; }) &&
|
||||
"RegionKind not found in OpenMP CaptureRegions.");
|
||||
auto *CS = cast<CapturedStmt>(getAssociatedStmt());
|
||||
for (auto ThisCaptureRegion : CaptureRegions) {
|
||||
if (ThisCaptureRegion == RegionKind)
|
||||
return CS;
|
||||
CS = cast<CapturedStmt>(CS->getCapturedStmt());
|
||||
}
|
||||
llvm_unreachable("Incorrect RegionKind specified for directive.");
|
||||
}
|
||||
|
||||
/// Get innermost captured statement for the construct.
|
||||
CapturedStmt *
|
||||
getInnermostCapturedStmt(ArrayRef<OpenMPDirectiveKind> CaptureRegions) {
|
||||
assert(hasAssociatedStmt() && "Must have associated captured statement.");
|
||||
assert(!CaptureRegions.empty() &&
|
||||
"At least one captured statement must be provided.");
|
||||
auto *CS = cast<CapturedStmt>(getAssociatedStmt());
|
||||
for (unsigned Level = CaptureRegions.size(); Level > 1; --Level)
|
||||
CS = cast<CapturedStmt>(CS->getCapturedStmt());
|
||||
return CS;
|
||||
}
|
||||
|
||||
const CapturedStmt *
|
||||
getInnermostCapturedStmt(ArrayRef<OpenMPDirectiveKind> CaptureRegions) const {
|
||||
return const_cast<OMPChildren *>(this)->getInnermostCapturedStmt(
|
||||
CaptureRegions);
|
||||
}
|
||||
|
||||
MutableArrayRef<Stmt *> getChildren();
|
||||
ArrayRef<Stmt *> getChildren() const {
|
||||
return const_cast<OMPChildren *>(this)->getChildren();
|
||||
}
|
||||
|
||||
Stmt *getRawStmt() {
|
||||
assert(HasAssociatedStmt &&
|
||||
"Expected directive with the associated statement.");
|
||||
if (auto *CS = dyn_cast<CapturedStmt>(getAssociatedStmt())) {
|
||||
Stmt *S = nullptr;
|
||||
do {
|
||||
S = CS->getCapturedStmt();
|
||||
CS = dyn_cast<CapturedStmt>(S);
|
||||
} while (CS);
|
||||
return S;
|
||||
}
|
||||
return getAssociatedStmt();
|
||||
}
|
||||
const Stmt *getRawStmt() const {
|
||||
return const_cast<OMPChildren *>(this)->getRawStmt();
|
||||
}
|
||||
|
||||
Stmt::child_range getAssociatedStmtAsRange() {
|
||||
if (!HasAssociatedStmt)
|
||||
return Stmt::child_range(Stmt::child_iterator(), Stmt::child_iterator());
|
||||
return Stmt::child_range(&getTrailingObjects<Stmt *>()[NumChildren],
|
||||
&getTrailingObjects<Stmt *>()[NumChildren + 1]);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace clang
|
||||
|
||||
#endif // LLVM_CLANG_AST_OPENMPCLAUSE_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -10167,19 +10167,18 @@ public:
|
||||
QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc,
|
||||
TypeResult ParsedType);
|
||||
/// Called on start of '#pragma omp declare mapper'.
|
||||
OMPDeclareMapperDecl *ActOnOpenMPDeclareMapperDirectiveStart(
|
||||
DeclGroupPtrTy ActOnOpenMPDeclareMapperDirective(
|
||||
Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
|
||||
SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS,
|
||||
Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses,
|
||||
Decl *PrevDeclInScope = nullptr);
|
||||
/// Build the mapper variable of '#pragma omp declare mapper'.
|
||||
void ActOnOpenMPDeclareMapperDirectiveVarDecl(OMPDeclareMapperDecl *DMD,
|
||||
Scope *S, QualType MapperType,
|
||||
SourceLocation StartLoc,
|
||||
DeclarationName VN);
|
||||
/// Called at the end of '#pragma omp declare mapper'.
|
||||
DeclGroupPtrTy
|
||||
ActOnOpenMPDeclareMapperDirectiveEnd(OMPDeclareMapperDecl *D, Scope *S,
|
||||
ArrayRef<OMPClause *> ClauseList);
|
||||
ExprResult ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S,
|
||||
QualType MapperType,
|
||||
SourceLocation StartLoc,
|
||||
DeclarationName VN);
|
||||
bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const;
|
||||
const ValueDecl *getOpenMPDeclareMapperVarName() const;
|
||||
|
||||
/// Called on the start of target region i.e. '#pragma omp declare target'.
|
||||
bool ActOnStartOpenMPDeclareTargetDirective(SourceLocation Loc);
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
namespace clang {
|
||||
class OMPTraitInfo;
|
||||
class OMPChildren;
|
||||
|
||||
/// An object for streaming information from a record.
|
||||
class ASTRecordReader
|
||||
@ -266,6 +267,9 @@ public:
|
||||
/// Read an OpenMP clause, advancing Idx.
|
||||
OMPClause *readOMPClause();
|
||||
|
||||
/// Read an OpenMP children, advancing Idx.
|
||||
void readOMPChildren(OMPChildren *Data);
|
||||
|
||||
/// Read a source location, advancing Idx.
|
||||
SourceLocation readSourceLocation() {
|
||||
return Reader->ReadSourceLocation(*F, Record, Idx);
|
||||
|
@ -271,6 +271,9 @@ public:
|
||||
|
||||
void writeOMPClause(OMPClause *C);
|
||||
|
||||
/// Writes data related to the OpenMP directives.
|
||||
void writeOMPChildren(OMPChildren *Data);
|
||||
|
||||
/// Emit a string.
|
||||
void AddString(StringRef Str) {
|
||||
return Writer->AddString(Str, *Record);
|
||||
|
@ -23,16 +23,14 @@ using namespace clang;
|
||||
// OMPThreadPrivateDecl Implementation.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void OMPThreadPrivateDecl::anchor() { }
|
||||
void OMPThreadPrivateDecl::anchor() {}
|
||||
|
||||
OMPThreadPrivateDecl *OMPThreadPrivateDecl::Create(ASTContext &C,
|
||||
DeclContext *DC,
|
||||
SourceLocation L,
|
||||
ArrayRef<Expr *> VL) {
|
||||
OMPThreadPrivateDecl *D =
|
||||
new (C, DC, additionalSizeToAlloc<Expr *>(VL.size()))
|
||||
OMPThreadPrivateDecl(OMPThreadPrivate, DC, L);
|
||||
D->NumVars = VL.size();
|
||||
auto *D = OMPDeclarativeDirective::createDirective<OMPThreadPrivateDecl>(
|
||||
C, DC, llvm::None, VL.size(), L);
|
||||
D->setVars(VL);
|
||||
return D;
|
||||
}
|
||||
@ -40,16 +38,14 @@ OMPThreadPrivateDecl *OMPThreadPrivateDecl::Create(ASTContext &C,
|
||||
OMPThreadPrivateDecl *OMPThreadPrivateDecl::CreateDeserialized(ASTContext &C,
|
||||
unsigned ID,
|
||||
unsigned N) {
|
||||
OMPThreadPrivateDecl *D = new (C, ID, additionalSizeToAlloc<Expr *>(N))
|
||||
OMPThreadPrivateDecl(OMPThreadPrivate, nullptr, SourceLocation());
|
||||
D->NumVars = N;
|
||||
return D;
|
||||
return OMPDeclarativeDirective::createEmptyDirective<OMPThreadPrivateDecl>(
|
||||
C, ID, 0, N);
|
||||
}
|
||||
|
||||
void OMPThreadPrivateDecl::setVars(ArrayRef<Expr *> VL) {
|
||||
assert(VL.size() == NumVars &&
|
||||
assert(VL.size() == Data->getNumChildren() &&
|
||||
"Number of variables is not the same as the preallocated buffer");
|
||||
std::uninitialized_copy(VL.begin(), VL.end(), getTrailingObjects<Expr *>());
|
||||
llvm::copy(VL, getVars().begin());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -61,38 +57,23 @@ void OMPAllocateDecl::anchor() { }
|
||||
OMPAllocateDecl *OMPAllocateDecl::Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L, ArrayRef<Expr *> VL,
|
||||
ArrayRef<OMPClause *> CL) {
|
||||
OMPAllocateDecl *D = new (
|
||||
C, DC, additionalSizeToAlloc<Expr *, OMPClause *>(VL.size(), CL.size()))
|
||||
OMPAllocateDecl(OMPAllocate, DC, L);
|
||||
D->NumVars = VL.size();
|
||||
auto *D = OMPDeclarativeDirective::createDirective<OMPAllocateDecl>(
|
||||
C, DC, CL, VL.size(), L);
|
||||
D->setVars(VL);
|
||||
D->NumClauses = CL.size();
|
||||
D->setClauses(CL);
|
||||
return D;
|
||||
}
|
||||
|
||||
OMPAllocateDecl *OMPAllocateDecl::CreateDeserialized(ASTContext &C, unsigned ID,
|
||||
unsigned NVars,
|
||||
unsigned NClauses) {
|
||||
OMPAllocateDecl *D =
|
||||
new (C, ID, additionalSizeToAlloc<Expr *, OMPClause *>(NVars, NClauses))
|
||||
OMPAllocateDecl(OMPAllocate, nullptr, SourceLocation());
|
||||
D->NumVars = NVars;
|
||||
D->NumClauses = NClauses;
|
||||
return D;
|
||||
return OMPDeclarativeDirective::createEmptyDirective<OMPAllocateDecl>(
|
||||
C, ID, NClauses, NVars, SourceLocation());
|
||||
}
|
||||
|
||||
void OMPAllocateDecl::setVars(ArrayRef<Expr *> VL) {
|
||||
assert(VL.size() == NumVars &&
|
||||
assert(VL.size() == Data->getNumChildren() &&
|
||||
"Number of variables is not the same as the preallocated buffer");
|
||||
std::uninitialized_copy(VL.begin(), VL.end(), getTrailingObjects<Expr *>());
|
||||
}
|
||||
|
||||
void OMPAllocateDecl::setClauses(ArrayRef<OMPClause *> CL) {
|
||||
assert(CL.size() == NumClauses &&
|
||||
"Number of variables is not the same as the preallocated buffer");
|
||||
std::uninitialized_copy(CL.begin(), CL.end(),
|
||||
getTrailingObjects<OMPClause *>());
|
||||
llvm::copy(VL, getVars().begin());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -104,27 +85,14 @@ void OMPRequiresDecl::anchor() {}
|
||||
OMPRequiresDecl *OMPRequiresDecl::Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L,
|
||||
ArrayRef<OMPClause *> CL) {
|
||||
OMPRequiresDecl *D =
|
||||
new (C, DC, additionalSizeToAlloc<OMPClause *>(CL.size()))
|
||||
OMPRequiresDecl(OMPRequires, DC, L);
|
||||
D->NumClauses = CL.size();
|
||||
D->setClauses(CL);
|
||||
return D;
|
||||
return OMPDeclarativeDirective::createDirective<OMPRequiresDecl>(C, DC, CL, 0,
|
||||
L);
|
||||
}
|
||||
|
||||
OMPRequiresDecl *OMPRequiresDecl::CreateDeserialized(ASTContext &C, unsigned ID,
|
||||
unsigned N) {
|
||||
OMPRequiresDecl *D = new (C, ID, additionalSizeToAlloc<OMPClause *>(N))
|
||||
OMPRequiresDecl(OMPRequires, nullptr, SourceLocation());
|
||||
D->NumClauses = N;
|
||||
return D;
|
||||
}
|
||||
|
||||
void OMPRequiresDecl::setClauses(ArrayRef<OMPClause *> CL) {
|
||||
assert(CL.size() == NumClauses &&
|
||||
"Number of clauses is not the same as the preallocated buffer");
|
||||
std::uninitialized_copy(CL.begin(), CL.end(),
|
||||
getTrailingObjects<OMPClause *>());
|
||||
return OMPDeclarativeDirective::createEmptyDirective<OMPRequiresDecl>(
|
||||
C, ID, N, 0, SourceLocation());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -171,48 +139,20 @@ OMPDeclareReductionDecl::getPrevDeclInScope() const {
|
||||
|
||||
void OMPDeclareMapperDecl::anchor() {}
|
||||
|
||||
OMPDeclareMapperDecl *
|
||||
OMPDeclareMapperDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
|
||||
DeclarationName Name, QualType T,
|
||||
DeclarationName VarName,
|
||||
OMPDeclareMapperDecl *PrevDeclInScope) {
|
||||
return new (C, DC) OMPDeclareMapperDecl(OMPDeclareMapper, DC, L, Name, T,
|
||||
VarName, PrevDeclInScope);
|
||||
OMPDeclareMapperDecl *OMPDeclareMapperDecl::Create(
|
||||
ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name,
|
||||
QualType T, DeclarationName VarName, ArrayRef<OMPClause *> Clauses,
|
||||
OMPDeclareMapperDecl *PrevDeclInScope) {
|
||||
return OMPDeclarativeDirective::createDirective<OMPDeclareMapperDecl>(
|
||||
C, DC, Clauses, 1, L, Name, T, VarName, PrevDeclInScope);
|
||||
}
|
||||
|
||||
OMPDeclareMapperDecl *OMPDeclareMapperDecl::CreateDeserialized(ASTContext &C,
|
||||
unsigned ID,
|
||||
unsigned N) {
|
||||
auto *D = new (C, ID)
|
||||
OMPDeclareMapperDecl(OMPDeclareMapper, /*DC=*/nullptr, SourceLocation(),
|
||||
DeclarationName(), QualType(), DeclarationName(),
|
||||
/*PrevDeclInScope=*/nullptr);
|
||||
if (N) {
|
||||
auto **ClauseStorage = C.Allocate<OMPClause *>(N);
|
||||
D->Clauses = llvm::makeMutableArrayRef<OMPClause *>(ClauseStorage, N);
|
||||
}
|
||||
return D;
|
||||
}
|
||||
|
||||
/// Creates an array of clauses to this mapper declaration and intializes
|
||||
/// them. The space used to store clause pointers is dynamically allocated,
|
||||
/// because we do not know the number of clauses when creating
|
||||
/// OMPDeclareMapperDecl
|
||||
void OMPDeclareMapperDecl::CreateClauses(ASTContext &C,
|
||||
ArrayRef<OMPClause *> CL) {
|
||||
assert(Clauses.empty() && "Number of clauses should be 0 on initialization");
|
||||
size_t NumClauses = CL.size();
|
||||
if (NumClauses) {
|
||||
auto **ClauseStorage = C.Allocate<OMPClause *>(NumClauses);
|
||||
Clauses = llvm::makeMutableArrayRef<OMPClause *>(ClauseStorage, NumClauses);
|
||||
setClauses(CL);
|
||||
}
|
||||
}
|
||||
|
||||
void OMPDeclareMapperDecl::setClauses(ArrayRef<OMPClause *> CL) {
|
||||
assert(CL.size() == Clauses.size() &&
|
||||
"Number of clauses is not the same as the preallocated buffer");
|
||||
std::uninitialized_copy(CL.begin(), CL.end(), Clauses.data());
|
||||
return OMPDeclarativeDirective::createEmptyDirective<OMPDeclareMapperDecl>(
|
||||
C, ID, N, 1, SourceLocation(), DeclarationName(), QualType(),
|
||||
DeclarationName(), /*PrevDeclInScope=*/nullptr);
|
||||
}
|
||||
|
||||
OMPDeclareMapperDecl *OMPDeclareMapperDecl::getPrevDeclInScope() {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4778,7 +4778,7 @@ static llvm::Function *emitOutlinedOrderedFunction(CodeGenModule &CGM,
|
||||
|
||||
void CodeGenFunction::EmitOMPOrderedDirective(const OMPOrderedDirective &S) {
|
||||
if (S.hasClausesOfKind<OMPDependClause>()) {
|
||||
assert(!S.getAssociatedStmt() &&
|
||||
assert(!S.hasAssociatedStmt() &&
|
||||
"No associated statement must be in ordered depend construct.");
|
||||
for (const auto *DC : S.getClausesOfKind<OMPDependClause>())
|
||||
CGM.getOpenMPRuntime().emitDoacrossOrdered(*this, DC);
|
||||
|
@ -568,9 +568,6 @@ Parser::ParseOpenMPDeclareMapperDirective(AccessSpecifier AS) {
|
||||
}
|
||||
|
||||
// Enter scope.
|
||||
OMPDeclareMapperDecl *DMD = Actions.ActOnOpenMPDeclareMapperDirectiveStart(
|
||||
getCurScope(), Actions.getCurLexicalContext(), MapperId, MapperType,
|
||||
Range.getBegin(), VName, AS);
|
||||
DeclarationNameInfo DirName;
|
||||
SourceLocation Loc = Tok.getLocation();
|
||||
unsigned ScopeFlags = Scope::FnScope | Scope::DeclScope |
|
||||
@ -579,8 +576,8 @@ Parser::ParseOpenMPDeclareMapperDirective(AccessSpecifier AS) {
|
||||
Actions.StartOpenMPDSABlock(OMPD_declare_mapper, DirName, getCurScope(), Loc);
|
||||
|
||||
// Add the mapper variable declaration.
|
||||
Actions.ActOnOpenMPDeclareMapperDirectiveVarDecl(
|
||||
DMD, getCurScope(), MapperType, Range.getBegin(), VName);
|
||||
ExprResult MapperVarRef = Actions.ActOnOpenMPDeclareMapperDirectiveVarDecl(
|
||||
getCurScope(), MapperType, Range.getBegin(), VName);
|
||||
|
||||
// Parse map clauses.
|
||||
SmallVector<OMPClause *, 6> Clauses;
|
||||
@ -590,7 +587,7 @@ Parser::ParseOpenMPDeclareMapperDirective(AccessSpecifier AS) {
|
||||
: getOpenMPClauseKind(PP.getSpelling(Tok));
|
||||
Actions.StartOpenMPClause(CKind);
|
||||
OMPClause *Clause =
|
||||
ParseOpenMPClause(OMPD_declare_mapper, CKind, Clauses.size() == 0);
|
||||
ParseOpenMPClause(OMPD_declare_mapper, CKind, Clauses.empty());
|
||||
if (Clause)
|
||||
Clauses.push_back(Clause);
|
||||
else
|
||||
@ -609,12 +606,13 @@ Parser::ParseOpenMPDeclareMapperDirective(AccessSpecifier AS) {
|
||||
// Exit scope.
|
||||
Actions.EndOpenMPDSABlock(nullptr);
|
||||
OMPDirectiveScope.Exit();
|
||||
|
||||
DeclGroupPtrTy DGP =
|
||||
Actions.ActOnOpenMPDeclareMapperDirectiveEnd(DMD, getCurScope(), Clauses);
|
||||
DeclGroupPtrTy DG = Actions.ActOnOpenMPDeclareMapperDirective(
|
||||
getCurScope(), Actions.getCurLexicalContext(), MapperId, MapperType,
|
||||
Range.getBegin(), VName, AS, MapperVarRef.get(), Clauses);
|
||||
if (!IsCorrect)
|
||||
return DeclGroupPtrTy();
|
||||
return DGP;
|
||||
|
||||
return DG;
|
||||
}
|
||||
|
||||
TypeResult Parser::parseOpenMPDeclareMapperVarDecl(SourceRange &Range,
|
||||
|
@ -339,11 +339,10 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
|
||||
// List-items in map clauses on this construct may only refer to the declared
|
||||
// variable var and entities that could be referenced by a procedure defined
|
||||
// at the same location
|
||||
auto *DMD = dyn_cast<OMPDeclareMapperDecl>(CurContext);
|
||||
if (LangOpts.OpenMP && DMD && !CurContext->containsDecl(D) &&
|
||||
isa<VarDecl>(D)) {
|
||||
if (LangOpts.OpenMP && isa<VarDecl>(D) &&
|
||||
!isOpenMPDeclareMapperVarDeclAllowed(cast<VarDecl>(D))) {
|
||||
Diag(Loc, diag::err_omp_declare_mapper_wrong_var)
|
||||
<< DMD->getVarName().getAsString();
|
||||
<< getOpenMPDeclareMapperVarName();
|
||||
Diag(D->getLocation(), diag::note_entity_declared_at) << D;
|
||||
return true;
|
||||
}
|
||||
|
@ -184,6 +184,7 @@ private:
|
||||
llvm::DenseSet<CanonicalDeclPtr<Decl>> UsedInScanDirective;
|
||||
llvm::DenseMap<CanonicalDeclPtr<const Decl>, UsesAllocatorsDeclKind>
|
||||
UsesAllocatorsDecls;
|
||||
Expr *DeclareMapperVar = nullptr;
|
||||
SharingMapTy(OpenMPDirectiveKind DKind, DeclarationNameInfo Name,
|
||||
Scope *CurScope, SourceLocation Loc)
|
||||
: Directive(DKind), DirectiveName(Name), CurScope(CurScope),
|
||||
@ -1072,6 +1073,15 @@ public:
|
||||
return None;
|
||||
return I->getSecond();
|
||||
}
|
||||
|
||||
void addDeclareMapperVarRef(Expr *Ref) {
|
||||
SharingMapTy &StackElem = getTopOfStack();
|
||||
StackElem.DeclareMapperVar = Ref;
|
||||
}
|
||||
const Expr *getDeclareMapperVarRef() const {
|
||||
const SharingMapTy *Top = getTopOfStackOrNull();
|
||||
return Top ? Top->DeclareMapperVar : nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
bool isImplicitTaskingRegion(OpenMPDirectiveKind DKind) {
|
||||
@ -17978,10 +17988,10 @@ QualType Sema::ActOnOpenMPDeclareMapperType(SourceLocation TyLoc,
|
||||
return MapperType;
|
||||
}
|
||||
|
||||
OMPDeclareMapperDecl *Sema::ActOnOpenMPDeclareMapperDirectiveStart(
|
||||
Sema::DeclGroupPtrTy Sema::ActOnOpenMPDeclareMapperDirective(
|
||||
Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
|
||||
SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS,
|
||||
Decl *PrevDeclInScope) {
|
||||
Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses, Decl *PrevDeclInScope) {
|
||||
LookupResult Lookup(*this, Name, SourceLocation(), LookupOMPMapperName,
|
||||
forRedeclarationInCurContext());
|
||||
// [OpenMP 5.0], 2.19.7.3 declare mapper Directive, Restrictions
|
||||
@ -18041,48 +18051,51 @@ OMPDeclareMapperDecl *Sema::ActOnOpenMPDeclareMapperDirectiveStart(
|
||||
Invalid = true;
|
||||
}
|
||||
auto *DMD = OMPDeclareMapperDecl::Create(Context, DC, StartLoc, Name,
|
||||
MapperType, VN, PrevDMD);
|
||||
DC->addDecl(DMD);
|
||||
MapperType, VN, Clauses, PrevDMD);
|
||||
if (S)
|
||||
PushOnScopeChains(DMD, S);
|
||||
else
|
||||
DC->addDecl(DMD);
|
||||
DMD->setAccess(AS);
|
||||
if (Invalid)
|
||||
DMD->setInvalidDecl();
|
||||
|
||||
// Enter new function scope.
|
||||
PushFunctionScope();
|
||||
setFunctionHasBranchProtectedScope();
|
||||
auto *VD = cast<DeclRefExpr>(MapperVarRef)->getDecl();
|
||||
VD->setDeclContext(DMD);
|
||||
VD->setLexicalDeclContext(DMD);
|
||||
DMD->addDecl(VD);
|
||||
DMD->setMapperVarRef(MapperVarRef);
|
||||
|
||||
CurContext = DMD;
|
||||
|
||||
return DMD;
|
||||
return DeclGroupPtrTy::make(DeclGroupRef(DMD));
|
||||
}
|
||||
|
||||
void Sema::ActOnOpenMPDeclareMapperDirectiveVarDecl(OMPDeclareMapperDecl *DMD,
|
||||
Scope *S,
|
||||
QualType MapperType,
|
||||
SourceLocation StartLoc,
|
||||
DeclarationName VN) {
|
||||
VarDecl *VD = buildVarDecl(*this, StartLoc, MapperType, VN.getAsString());
|
||||
ExprResult
|
||||
Sema::ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S, QualType MapperType,
|
||||
SourceLocation StartLoc,
|
||||
DeclarationName VN) {
|
||||
TypeSourceInfo *TInfo =
|
||||
Context.getTrivialTypeSourceInfo(MapperType, StartLoc);
|
||||
auto *VD = VarDecl::Create(Context, Context.getTranslationUnitDecl(),
|
||||
StartLoc, StartLoc, VN.getAsIdentifierInfo(),
|
||||
MapperType, TInfo, SC_None);
|
||||
if (S)
|
||||
PushOnScopeChains(VD, S);
|
||||
else
|
||||
DMD->addDecl(VD);
|
||||
Expr *MapperVarRefExpr = buildDeclRefExpr(*this, VD, MapperType, StartLoc);
|
||||
DMD->setMapperVarRef(MapperVarRefExpr);
|
||||
PushOnScopeChains(VD, S, /*AddToContext=*/false);
|
||||
Expr *E = buildDeclRefExpr(*this, VD, MapperType, StartLoc);
|
||||
DSAStack->addDeclareMapperVarRef(E);
|
||||
return E;
|
||||
}
|
||||
|
||||
Sema::DeclGroupPtrTy
|
||||
Sema::ActOnOpenMPDeclareMapperDirectiveEnd(OMPDeclareMapperDecl *D, Scope *S,
|
||||
ArrayRef<OMPClause *> ClauseList) {
|
||||
PopDeclContext();
|
||||
PopFunctionScopeInfo();
|
||||
bool Sema::isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const {
|
||||
assert(LangOpts.OpenMP && "Expected OpenMP mode.");
|
||||
const Expr *Ref = DSAStack->getDeclareMapperVarRef();
|
||||
if (const auto *DRE = cast_or_null<DeclRefExpr>(Ref))
|
||||
return VD->getCanonicalDecl() == DRE->getDecl()->getCanonicalDecl();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (D) {
|
||||
if (S)
|
||||
PushOnScopeChains(D, S, /*AddToContext=*/false);
|
||||
D->CreateClauses(Context, ClauseList);
|
||||
}
|
||||
|
||||
return DeclGroupPtrTy::make(DeclGroupRef(D));
|
||||
const ValueDecl *Sema::getOpenMPDeclareMapperVarName() const {
|
||||
assert(LangOpts.OpenMP && "Expected OpenMP mode.");
|
||||
return cast<DeclRefExpr>(DSAStack->getDeclareMapperVarRef())->getDecl();
|
||||
}
|
||||
|
||||
OMPClause *Sema::ActOnOpenMPNumTeamsClause(Expr *NumTeams,
|
||||
|
@ -3326,67 +3326,58 @@ TemplateDeclInstantiator::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {
|
||||
SemaRef.CurrentInstantiationScope->findInstantiationOf(PrevDeclInScope)
|
||||
->get<Decl *>());
|
||||
}
|
||||
OMPDeclareMapperDecl *NewDMD = SemaRef.ActOnOpenMPDeclareMapperDirectiveStart(
|
||||
/*S=*/nullptr, Owner, D->getDeclName(), SubstMapperTy, D->getLocation(),
|
||||
VN, D->getAccess(), PrevDeclInScope);
|
||||
SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewDMD);
|
||||
SmallVector<OMPClause *, 6> Clauses;
|
||||
bool IsCorrect = true;
|
||||
if (!RequiresInstantiation) {
|
||||
// Copy the mapper variable.
|
||||
NewDMD->setMapperVarRef(D->getMapperVarRef());
|
||||
// Copy map clauses from the original mapper.
|
||||
for (OMPClause *C : D->clauselists())
|
||||
Clauses.push_back(C);
|
||||
} else {
|
||||
// Instantiate the mapper variable.
|
||||
DeclarationNameInfo DirName;
|
||||
SemaRef.StartOpenMPDSABlock(llvm::omp::OMPD_declare_mapper, DirName,
|
||||
/*S=*/nullptr,
|
||||
(*D->clauselist_begin())->getBeginLoc());
|
||||
SemaRef.ActOnOpenMPDeclareMapperDirectiveVarDecl(
|
||||
NewDMD, /*S=*/nullptr, SubstMapperTy, D->getLocation(), VN);
|
||||
SemaRef.CurrentInstantiationScope->InstantiatedLocal(
|
||||
cast<DeclRefExpr>(D->getMapperVarRef())->getDecl(),
|
||||
cast<DeclRefExpr>(NewDMD->getMapperVarRef())->getDecl());
|
||||
auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(Owner);
|
||||
Sema::CXXThisScopeRAII ThisScope(SemaRef, ThisContext, Qualifiers(),
|
||||
ThisContext);
|
||||
// Instantiate map clauses.
|
||||
for (OMPClause *C : D->clauselists()) {
|
||||
auto *OldC = cast<OMPMapClause>(C);
|
||||
SmallVector<Expr *, 4> NewVars;
|
||||
for (Expr *OE : OldC->varlists()) {
|
||||
Expr *NE = SemaRef.SubstExpr(OE, TemplateArgs).get();
|
||||
if (!NE) {
|
||||
IsCorrect = false;
|
||||
break;
|
||||
}
|
||||
NewVars.push_back(NE);
|
||||
}
|
||||
if (!IsCorrect)
|
||||
SmallVector<OMPClause *, 6> Clauses;
|
||||
// Instantiate the mapper variable.
|
||||
DeclarationNameInfo DirName;
|
||||
SemaRef.StartOpenMPDSABlock(llvm::omp::OMPD_declare_mapper, DirName,
|
||||
/*S=*/nullptr,
|
||||
(*D->clauselist_begin())->getBeginLoc());
|
||||
ExprResult MapperVarRef = SemaRef.ActOnOpenMPDeclareMapperDirectiveVarDecl(
|
||||
/*S=*/nullptr, SubstMapperTy, D->getLocation(), VN);
|
||||
SemaRef.CurrentInstantiationScope->InstantiatedLocal(
|
||||
cast<DeclRefExpr>(D->getMapperVarRef())->getDecl(),
|
||||
cast<DeclRefExpr>(MapperVarRef.get())->getDecl());
|
||||
auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(Owner);
|
||||
Sema::CXXThisScopeRAII ThisScope(SemaRef, ThisContext, Qualifiers(),
|
||||
ThisContext);
|
||||
// Instantiate map clauses.
|
||||
for (OMPClause *C : D->clauselists()) {
|
||||
auto *OldC = cast<OMPMapClause>(C);
|
||||
SmallVector<Expr *, 4> NewVars;
|
||||
for (Expr *OE : OldC->varlists()) {
|
||||
Expr *NE = SemaRef.SubstExpr(OE, TemplateArgs).get();
|
||||
if (!NE) {
|
||||
IsCorrect = false;
|
||||
break;
|
||||
NestedNameSpecifierLoc NewQualifierLoc =
|
||||
SemaRef.SubstNestedNameSpecifierLoc(OldC->getMapperQualifierLoc(),
|
||||
TemplateArgs);
|
||||
CXXScopeSpec SS;
|
||||
SS.Adopt(NewQualifierLoc);
|
||||
DeclarationNameInfo NewNameInfo = SemaRef.SubstDeclarationNameInfo(
|
||||
OldC->getMapperIdInfo(), TemplateArgs);
|
||||
OMPVarListLocTy Locs(OldC->getBeginLoc(), OldC->getLParenLoc(),
|
||||
OldC->getEndLoc());
|
||||
OMPClause *NewC = SemaRef.ActOnOpenMPMapClause(
|
||||
OldC->getMapTypeModifiers(), OldC->getMapTypeModifiersLoc(), SS,
|
||||
NewNameInfo, OldC->getMapType(), OldC->isImplicitMapType(),
|
||||
OldC->getMapLoc(), OldC->getColonLoc(), NewVars, Locs);
|
||||
Clauses.push_back(NewC);
|
||||
}
|
||||
NewVars.push_back(NE);
|
||||
}
|
||||
SemaRef.EndOpenMPDSABlock(nullptr);
|
||||
if (!IsCorrect)
|
||||
break;
|
||||
NestedNameSpecifierLoc NewQualifierLoc =
|
||||
SemaRef.SubstNestedNameSpecifierLoc(OldC->getMapperQualifierLoc(),
|
||||
TemplateArgs);
|
||||
CXXScopeSpec SS;
|
||||
SS.Adopt(NewQualifierLoc);
|
||||
DeclarationNameInfo NewNameInfo =
|
||||
SemaRef.SubstDeclarationNameInfo(OldC->getMapperIdInfo(), TemplateArgs);
|
||||
OMPVarListLocTy Locs(OldC->getBeginLoc(), OldC->getLParenLoc(),
|
||||
OldC->getEndLoc());
|
||||
OMPClause *NewC = SemaRef.ActOnOpenMPMapClause(
|
||||
OldC->getMapTypeModifiers(), OldC->getMapTypeModifiersLoc(), SS,
|
||||
NewNameInfo, OldC->getMapType(), OldC->isImplicitMapType(),
|
||||
OldC->getMapLoc(), OldC->getColonLoc(), NewVars, Locs);
|
||||
Clauses.push_back(NewC);
|
||||
}
|
||||
(void)SemaRef.ActOnOpenMPDeclareMapperDirectiveEnd(NewDMD, /*S=*/nullptr,
|
||||
Clauses);
|
||||
SemaRef.EndOpenMPDSABlock(nullptr);
|
||||
if (!IsCorrect)
|
||||
return nullptr;
|
||||
Sema::DeclGroupPtrTy DG = SemaRef.ActOnOpenMPDeclareMapperDirective(
|
||||
/*S=*/nullptr, Owner, D->getDeclName(), SubstMapperTy, D->getLocation(),
|
||||
VN, D->getAccess(), MapperVarRef.get(), Clauses, PrevDeclInScope);
|
||||
Decl *NewDMD = DG.get().getSingleDecl();
|
||||
SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewDMD);
|
||||
return NewDMD;
|
||||
}
|
||||
|
||||
|
@ -12932,3 +12932,20 @@ OMPTraitInfo *ASTRecordReader::readOMPTraitInfo() {
|
||||
}
|
||||
return &TI;
|
||||
}
|
||||
|
||||
void ASTRecordReader::readOMPChildren(OMPChildren *Data) {
|
||||
if (!Data)
|
||||
return;
|
||||
if (Reader->ReadingKind == ASTReader::Read_Stmt) {
|
||||
// Skip NumClauses, NumChildren and HasAssociatedStmt fields.
|
||||
skipInts(3);
|
||||
}
|
||||
SmallVector<OMPClause *, 4> Clauses(Data->getNumClauses());
|
||||
for (unsigned I = 0, E = Data->getNumClauses(); I < E; ++I)
|
||||
Clauses[I] = readOMPClause();
|
||||
Data->setClauses(Clauses);
|
||||
if (Data->hasAssociatedStmt())
|
||||
Data->setAssociatedStmt(readStmt());
|
||||
for (unsigned I = 0, E = Data->getNumChildren(); I < E; ++I)
|
||||
Data->getChildren()[I] = readStmt();
|
||||
}
|
||||
|
@ -2652,41 +2652,18 @@ void ASTDeclReader::mergeMergeable(Mergeable<T> *D) {
|
||||
}
|
||||
|
||||
void ASTDeclReader::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) {
|
||||
Record.readOMPChildren(D->Data);
|
||||
VisitDecl(D);
|
||||
unsigned NumVars = D->varlist_size();
|
||||
SmallVector<Expr *, 16> Vars;
|
||||
Vars.reserve(NumVars);
|
||||
for (unsigned i = 0; i != NumVars; ++i) {
|
||||
Vars.push_back(Record.readExpr());
|
||||
}
|
||||
D->setVars(Vars);
|
||||
}
|
||||
|
||||
void ASTDeclReader::VisitOMPAllocateDecl(OMPAllocateDecl *D) {
|
||||
Record.readOMPChildren(D->Data);
|
||||
VisitDecl(D);
|
||||
unsigned NumVars = D->varlist_size();
|
||||
unsigned NumClauses = D->clauselist_size();
|
||||
SmallVector<Expr *, 16> Vars;
|
||||
Vars.reserve(NumVars);
|
||||
for (unsigned i = 0; i != NumVars; ++i) {
|
||||
Vars.push_back(Record.readExpr());
|
||||
}
|
||||
D->setVars(Vars);
|
||||
SmallVector<OMPClause *, 8> Clauses;
|
||||
Clauses.reserve(NumClauses);
|
||||
for (unsigned I = 0; I != NumClauses; ++I)
|
||||
Clauses.push_back(Record.readOMPClause());
|
||||
D->setClauses(Clauses);
|
||||
}
|
||||
|
||||
void ASTDeclReader::VisitOMPRequiresDecl(OMPRequiresDecl * D) {
|
||||
Record.readOMPChildren(D->Data);
|
||||
VisitDecl(D);
|
||||
unsigned NumClauses = D->clauselist_size();
|
||||
SmallVector<OMPClause *, 8> Clauses;
|
||||
Clauses.reserve(NumClauses);
|
||||
for (unsigned I = 0; I != NumClauses; ++I)
|
||||
Clauses.push_back(Record.readOMPClause());
|
||||
D->setClauses(Clauses);
|
||||
}
|
||||
|
||||
void ASTDeclReader::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
|
||||
@ -2707,18 +2684,10 @@ void ASTDeclReader::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
|
||||
}
|
||||
|
||||
void ASTDeclReader::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {
|
||||
Record.readOMPChildren(D->Data);
|
||||
VisitValueDecl(D);
|
||||
D->setLocation(readSourceLocation());
|
||||
Expr *MapperVarRefE = Record.readExpr();
|
||||
D->setMapperVarRef(MapperVarRefE);
|
||||
D->VarName = Record.readDeclarationName();
|
||||
D->PrevDeclInScope = readDeclID();
|
||||
unsigned NumClauses = D->clauselist_size();
|
||||
SmallVector<OMPClause *, 8> Clauses;
|
||||
Clauses.reserve(NumClauses);
|
||||
for (unsigned I = 0; I != NumClauses; ++I)
|
||||
Clauses.push_back(Record.readOMPClause());
|
||||
D->setClauses(Clauses);
|
||||
}
|
||||
|
||||
void ASTDeclReader::VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D) {
|
||||
@ -4007,24 +3976,35 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) {
|
||||
// locations.
|
||||
D = ImportDecl::CreateDeserialized(Context, ID, Record.back());
|
||||
break;
|
||||
case DECL_OMP_THREADPRIVATE:
|
||||
D = OMPThreadPrivateDecl::CreateDeserialized(Context, ID, Record.readInt());
|
||||
case DECL_OMP_THREADPRIVATE: {
|
||||
Record.skipInts(1);
|
||||
unsigned NumChildren = Record.readInt();
|
||||
Record.skipInts(1);
|
||||
D = OMPThreadPrivateDecl::CreateDeserialized(Context, ID, NumChildren);
|
||||
break;
|
||||
}
|
||||
case DECL_OMP_ALLOCATE: {
|
||||
unsigned NumVars = Record.readInt();
|
||||
unsigned NumClauses = Record.readInt();
|
||||
unsigned NumVars = Record.readInt();
|
||||
Record.skipInts(1);
|
||||
D = OMPAllocateDecl::CreateDeserialized(Context, ID, NumVars, NumClauses);
|
||||
break;
|
||||
}
|
||||
case DECL_OMP_REQUIRES:
|
||||
D = OMPRequiresDecl::CreateDeserialized(Context, ID, Record.readInt());
|
||||
case DECL_OMP_REQUIRES: {
|
||||
unsigned NumClauses = Record.readInt();
|
||||
Record.skipInts(2);
|
||||
D = OMPRequiresDecl::CreateDeserialized(Context, ID, NumClauses);
|
||||
break;
|
||||
}
|
||||
case DECL_OMP_DECLARE_REDUCTION:
|
||||
D = OMPDeclareReductionDecl::CreateDeserialized(Context, ID);
|
||||
break;
|
||||
case DECL_OMP_DECLARE_MAPPER:
|
||||
D = OMPDeclareMapperDecl::CreateDeserialized(Context, ID, Record.readInt());
|
||||
case DECL_OMP_DECLARE_MAPPER: {
|
||||
unsigned NumClauses = Record.readInt();
|
||||
Record.skipInts(2);
|
||||
D = OMPDeclareMapperDecl::CreateDeserialized(Context, ID, NumClauses);
|
||||
break;
|
||||
}
|
||||
case DECL_OMP_CAPTUREDEXPR:
|
||||
D = OMPCapturedExprDecl::CreateDeserialized(Context, ID);
|
||||
break;
|
||||
|
@ -2260,99 +2260,22 @@ void ASTStmtReader::VisitAsTypeExpr(AsTypeExpr *E) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ASTStmtReader::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
|
||||
Record.readOMPChildren(E->Data);
|
||||
E->setLocStart(readSourceLocation());
|
||||
E->setLocEnd(readSourceLocation());
|
||||
SmallVector<OMPClause *, 5> Clauses;
|
||||
for (unsigned i = 0; i < E->getNumClauses(); ++i)
|
||||
Clauses.push_back(Record.readOMPClause());
|
||||
E->setClauses(Clauses);
|
||||
if (E->hasAssociatedStmt())
|
||||
E->setAssociatedStmt(Record.readSubStmt());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPLoopDirective(OMPLoopDirective *D) {
|
||||
VisitStmt(D);
|
||||
// Two fields (NumClauses and CollapsedNum) were read in ReadStmtFromStream.
|
||||
Record.skipInts(2);
|
||||
// Field CollapsedNum was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setIterationVariable(Record.readSubExpr());
|
||||
D->setLastIteration(Record.readSubExpr());
|
||||
D->setCalcLastIteration(Record.readSubExpr());
|
||||
D->setPreCond(Record.readSubExpr());
|
||||
D->setCond(Record.readSubExpr());
|
||||
D->setInit(Record.readSubExpr());
|
||||
D->setInc(Record.readSubExpr());
|
||||
D->setPreInits(Record.readSubStmt());
|
||||
if (isOpenMPWorksharingDirective(D->getDirectiveKind()) ||
|
||||
isOpenMPTaskLoopDirective(D->getDirectiveKind()) ||
|
||||
isOpenMPDistributeDirective(D->getDirectiveKind())) {
|
||||
D->setIsLastIterVariable(Record.readSubExpr());
|
||||
D->setLowerBoundVariable(Record.readSubExpr());
|
||||
D->setUpperBoundVariable(Record.readSubExpr());
|
||||
D->setStrideVariable(Record.readSubExpr());
|
||||
D->setEnsureUpperBound(Record.readSubExpr());
|
||||
D->setNextLowerBound(Record.readSubExpr());
|
||||
D->setNextUpperBound(Record.readSubExpr());
|
||||
D->setNumIterations(Record.readSubExpr());
|
||||
}
|
||||
if (isOpenMPLoopBoundSharingDirective(D->getDirectiveKind())) {
|
||||
D->setPrevLowerBoundVariable(Record.readSubExpr());
|
||||
D->setPrevUpperBoundVariable(Record.readSubExpr());
|
||||
D->setDistInc(Record.readSubExpr());
|
||||
D->setPrevEnsureUpperBound(Record.readSubExpr());
|
||||
D->setCombinedLowerBoundVariable(Record.readSubExpr());
|
||||
D->setCombinedUpperBoundVariable(Record.readSubExpr());
|
||||
D->setCombinedEnsureUpperBound(Record.readSubExpr());
|
||||
D->setCombinedInit(Record.readSubExpr());
|
||||
D->setCombinedCond(Record.readSubExpr());
|
||||
D->setCombinedNextLowerBound(Record.readSubExpr());
|
||||
D->setCombinedNextUpperBound(Record.readSubExpr());
|
||||
D->setCombinedDistCond(Record.readSubExpr());
|
||||
D->setCombinedParForInDistCond(Record.readSubExpr());
|
||||
}
|
||||
SmallVector<Expr *, 4> Sub;
|
||||
unsigned CollapsedNum = D->getCollapsedNumber();
|
||||
Sub.reserve(CollapsedNum);
|
||||
for (unsigned i = 0; i < CollapsedNum; ++i)
|
||||
Sub.push_back(Record.readSubExpr());
|
||||
D->setCounters(Sub);
|
||||
Sub.clear();
|
||||
for (unsigned i = 0; i < CollapsedNum; ++i)
|
||||
Sub.push_back(Record.readSubExpr());
|
||||
D->setPrivateCounters(Sub);
|
||||
Sub.clear();
|
||||
for (unsigned i = 0; i < CollapsedNum; ++i)
|
||||
Sub.push_back(Record.readSubExpr());
|
||||
D->setInits(Sub);
|
||||
Sub.clear();
|
||||
for (unsigned i = 0; i < CollapsedNum; ++i)
|
||||
Sub.push_back(Record.readSubExpr());
|
||||
D->setUpdates(Sub);
|
||||
Sub.clear();
|
||||
for (unsigned i = 0; i < CollapsedNum; ++i)
|
||||
Sub.push_back(Record.readSubExpr());
|
||||
D->setFinals(Sub);
|
||||
Sub.clear();
|
||||
for (unsigned i = 0; i < CollapsedNum; ++i)
|
||||
Sub.push_back(Record.readSubExpr());
|
||||
D->setDependentCounters(Sub);
|
||||
Sub.clear();
|
||||
for (unsigned i = 0; i < CollapsedNum; ++i)
|
||||
Sub.push_back(Record.readSubExpr());
|
||||
D->setDependentInits(Sub);
|
||||
Sub.clear();
|
||||
for (unsigned i = 0; i < CollapsedNum; ++i)
|
||||
Sub.push_back(Record.readSubExpr());
|
||||
D->setFinalsConditions(Sub);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
|
||||
@ -2361,8 +2284,7 @@ void ASTStmtReader::VisitOMPSimdDirective(OMPSimdDirective *D) {
|
||||
|
||||
void ASTStmtReader::VisitOMPForDirective(OMPForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
|
||||
@ -2371,23 +2293,18 @@ void ASTStmtReader::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
|
||||
|
||||
void ASTStmtReader::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPSectionDirective(OMPSectionDirective *D) {
|
||||
VisitStmt(D);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPSingleDirective(OMPSingleDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
@ -2398,16 +2315,13 @@ void ASTStmtReader::VisitOMPMasterDirective(OMPMasterDirective *D) {
|
||||
|
||||
void ASTStmtReader::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->DirName = Record.readDeclarationNameInfo();
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPParallelForSimdDirective(
|
||||
@ -2418,28 +2332,20 @@ void ASTStmtReader::VisitOMPParallelForSimdDirective(
|
||||
void ASTStmtReader::VisitOMPParallelMasterDirective(
|
||||
OMPParallelMasterDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPParallelSectionsDirective(
|
||||
OMPParallelSectionsDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTaskDirective(OMPTaskDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) {
|
||||
@ -2459,100 +2365,73 @@ void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
|
||||
|
||||
void ASTStmtReader::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setReductionRef(Record.readSubExpr());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPFlushDirective(OMPFlushDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPScanDirective(OMPScanDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setX(Record.readSubExpr());
|
||||
D->setV(Record.readSubExpr());
|
||||
D->setExpr(Record.readSubExpr());
|
||||
D->setUpdateExpr(Record.readSubExpr());
|
||||
D->IsXLHSInRHSPart = Record.readInt() != 0;
|
||||
D->IsPostfixUpdate = Record.readInt() != 0;
|
||||
D->IsXLHSInRHSPart = Record.readBool();
|
||||
D->IsPostfixUpdate = Record.readBool();
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTargetDirective(OMPTargetDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTargetEnterDataDirective(
|
||||
OMPTargetEnterDataDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTargetExitDataDirective(
|
||||
OMPTargetExitDataDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTargetParallelDirective(
|
||||
OMPTargetParallelDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTargetParallelForDirective(
|
||||
OMPTargetParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
@ -2560,20 +2439,18 @@ void ASTStmtReader::VisitOMPCancellationPointDirective(
|
||||
OMPCancellationPointDirective *D) {
|
||||
VisitStmt(D);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt()));
|
||||
D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPCancelDirective(OMPCancelDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
D->setCancelRegion(static_cast<OpenMPDirectiveKind>(Record.readInt()));
|
||||
D->setCancelRegion(Record.readEnum<OpenMPDirectiveKind>());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
|
||||
@ -2583,7 +2460,7 @@ void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
|
||||
void ASTStmtReader::VisitOMPMasterTaskLoopDirective(
|
||||
OMPMasterTaskLoopDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
|
||||
@ -2594,7 +2471,7 @@ void ASTStmtReader::VisitOMPMasterTaskLoopSimdDirective(
|
||||
void ASTStmtReader::VisitOMPParallelMasterTaskLoopDirective(
|
||||
OMPParallelMasterTaskLoopDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPParallelMasterTaskLoopSimdDirective(
|
||||
@ -2608,15 +2485,13 @@ void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
|
||||
|
||||
void ASTStmtReader::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPDistributeParallelForDirective(
|
||||
OMPDistributeParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPDistributeParallelForSimdDirective(
|
||||
@ -2656,14 +2531,11 @@ void ASTStmtReader::VisitOMPTeamsDistributeParallelForSimdDirective(
|
||||
void ASTStmtReader::VisitOMPTeamsDistributeParallelForDirective(
|
||||
OMPTeamsDistributeParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
|
||||
VisitStmt(D);
|
||||
// The NumClauses field was read in ReadStmtFromStream.
|
||||
Record.skipInts(1);
|
||||
VisitOMPExecutableDirective(D);
|
||||
}
|
||||
|
||||
@ -2675,8 +2547,7 @@ void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective(
|
||||
void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective(
|
||||
OMPTargetTeamsDistributeParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
D->setTaskReductionRefExpr(Record.readSubExpr());
|
||||
D->setHasCancel(Record.readInt());
|
||||
D->setHasCancel(Record.readBool());
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
|
||||
@ -3249,24 +3120,24 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
break;
|
||||
|
||||
case STMT_OMP_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPSimdDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_FOR_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPForDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
||||
Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_FOR_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPForSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
||||
Empty);
|
||||
break;
|
||||
@ -3296,16 +3167,16 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
break;
|
||||
|
||||
case STMT_OMP_PARALLEL_FOR_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPParallelForDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
@ -3358,10 +3229,13 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
||||
break;
|
||||
|
||||
case STMT_OMP_ORDERED_DIRECTIVE:
|
||||
S = OMPOrderedDirective::CreateEmpty(
|
||||
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
||||
case STMT_OMP_ORDERED_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
bool HasAssociatedStmt = Record[ASTStmtReader::NumStmtFields + 2];
|
||||
S = OMPOrderedDirective::CreateEmpty(Context, NumClauses,
|
||||
!HasAssociatedStmt, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_ATOMIC_DIRECTIVE:
|
||||
S = OMPAtomicDirective::CreateEmpty(
|
||||
@ -3394,8 +3268,8 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
break;
|
||||
|
||||
case STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTargetParallelForDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
@ -3421,72 +3295,72 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
break;
|
||||
|
||||
case STMT_OMP_TASKLOOP_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTaskLoopDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
||||
Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TASKLOOP_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_MASTER_TASKLOOP_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPMasterTaskLoopSimdDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPParallelMasterTaskLoopDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPParallelMasterTaskLoopSimdDirective::CreateEmpty(
|
||||
Context, NumClauses, CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_DISTRIBUTE_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
||||
Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPDistributeParallelForDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPDistributeParallelForSimdDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum,
|
||||
Empty);
|
||||
@ -3494,56 +3368,56 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
}
|
||||
|
||||
case STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPDistributeSimdDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTargetParallelForSimdDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TARGET_SIMD_DIRECTIVE: {
|
||||
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTargetSimdDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
||||
Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE: {
|
||||
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTeamsDistributeSimdDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
|
||||
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(
|
||||
Context, NumClauses, CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
|
||||
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTeamsDistributeParallelForDirective::CreateEmpty(
|
||||
Context, NumClauses, CollapsedNum, Empty);
|
||||
break;
|
||||
@ -3555,32 +3429,32 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||
break;
|
||||
|
||||
case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE: {
|
||||
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTargetTeamsDistributeDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: {
|
||||
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(
|
||||
Context, NumClauses, CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE: {
|
||||
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
|
||||
Context, NumClauses, CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE: {
|
||||
auto NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPTargetTeamsDistributeSimdDirective::CreateEmpty(
|
||||
Context, NumClauses, CollapsedNum, Empty);
|
||||
break;
|
||||
|
@ -6781,3 +6781,17 @@ void ASTRecordWriter::writeOMPTraitInfo(const OMPTraitInfo *TI) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ASTRecordWriter::writeOMPChildren(OMPChildren *Data) {
|
||||
if (!Data)
|
||||
return;
|
||||
writeUInt32(Data->getNumClauses());
|
||||
writeUInt32(Data->getNumChildren());
|
||||
writeBool(Data->hasAssociatedStmt());
|
||||
for (unsigned I = 0, E = Data->getNumClauses(); I < E; ++I)
|
||||
writeOMPClause(Data->getClauses()[I]);
|
||||
if (Data->hasAssociatedStmt())
|
||||
AddStmt(Data->getAssociatedStmt());
|
||||
for (unsigned I = 0, E = Data->getNumChildren(); I < E; ++I)
|
||||
AddStmt(Data->getChildren()[I]);
|
||||
}
|
||||
|
@ -1843,29 +1843,20 @@ void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {
|
||||
}
|
||||
|
||||
void ASTDeclWriter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) {
|
||||
Record.push_back(D->varlist_size());
|
||||
Record.writeOMPChildren(D->Data);
|
||||
VisitDecl(D);
|
||||
for (auto *I : D->varlists())
|
||||
Record.AddStmt(I);
|
||||
Code = serialization::DECL_OMP_THREADPRIVATE;
|
||||
}
|
||||
|
||||
void ASTDeclWriter::VisitOMPAllocateDecl(OMPAllocateDecl *D) {
|
||||
Record.push_back(D->varlist_size());
|
||||
Record.push_back(D->clauselist_size());
|
||||
Record.writeOMPChildren(D->Data);
|
||||
VisitDecl(D);
|
||||
for (auto *I : D->varlists())
|
||||
Record.AddStmt(I);
|
||||
for (OMPClause *C : D->clauselists())
|
||||
Record.writeOMPClause(C);
|
||||
Code = serialization::DECL_OMP_ALLOCATE;
|
||||
}
|
||||
|
||||
void ASTDeclWriter::VisitOMPRequiresDecl(OMPRequiresDecl *D) {
|
||||
Record.push_back(D->clauselist_size());
|
||||
Record.writeOMPChildren(D->Data);
|
||||
VisitDecl(D);
|
||||
for (OMPClause *C : D->clauselists())
|
||||
Record.writeOMPClause(C);
|
||||
Code = serialization::DECL_OMP_REQUIRES;
|
||||
}
|
||||
|
||||
@ -1884,14 +1875,10 @@ void ASTDeclWriter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
|
||||
}
|
||||
|
||||
void ASTDeclWriter::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {
|
||||
Record.push_back(D->clauselist_size());
|
||||
Record.writeOMPChildren(D->Data);
|
||||
VisitValueDecl(D);
|
||||
Record.AddSourceLocation(D->getBeginLoc());
|
||||
Record.AddStmt(D->getMapperVarRef());
|
||||
Record.AddDeclarationName(D->getVarName());
|
||||
Record.AddDeclRef(D->getPrevDeclInScope());
|
||||
for (OMPClause *C : D->clauselists())
|
||||
Record.writeOMPClause(C);
|
||||
Code = serialization::DECL_OMP_DECLARE_MAPPER;
|
||||
}
|
||||
|
||||
|
@ -2159,85 +2159,23 @@ void ASTStmtWriter::VisitSEHLeaveStmt(SEHLeaveStmt *S) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
// OpenMP Directives.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) {
|
||||
Record.writeOMPChildren(E->Data);
|
||||
Record.AddSourceLocation(E->getBeginLoc());
|
||||
Record.AddSourceLocation(E->getEndLoc());
|
||||
for (unsigned i = 0; i < E->getNumClauses(); ++i) {
|
||||
Record.writeOMPClause(E->getClause(i));
|
||||
}
|
||||
if (E->hasAssociatedStmt())
|
||||
Record.AddStmt(E->getAssociatedStmt());
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
Record.push_back(D->getCollapsedNumber());
|
||||
Record.writeUInt32(D->getCollapsedNumber());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.AddStmt(D->getIterationVariable());
|
||||
Record.AddStmt(D->getLastIteration());
|
||||
Record.AddStmt(D->getCalcLastIteration());
|
||||
Record.AddStmt(D->getPreCond());
|
||||
Record.AddStmt(D->getCond());
|
||||
Record.AddStmt(D->getInit());
|
||||
Record.AddStmt(D->getInc());
|
||||
Record.AddStmt(D->getPreInits());
|
||||
if (isOpenMPWorksharingDirective(D->getDirectiveKind()) ||
|
||||
isOpenMPTaskLoopDirective(D->getDirectiveKind()) ||
|
||||
isOpenMPDistributeDirective(D->getDirectiveKind())) {
|
||||
Record.AddStmt(D->getIsLastIterVariable());
|
||||
Record.AddStmt(D->getLowerBoundVariable());
|
||||
Record.AddStmt(D->getUpperBoundVariable());
|
||||
Record.AddStmt(D->getStrideVariable());
|
||||
Record.AddStmt(D->getEnsureUpperBound());
|
||||
Record.AddStmt(D->getNextLowerBound());
|
||||
Record.AddStmt(D->getNextUpperBound());
|
||||
Record.AddStmt(D->getNumIterations());
|
||||
}
|
||||
if (isOpenMPLoopBoundSharingDirective(D->getDirectiveKind())) {
|
||||
Record.AddStmt(D->getPrevLowerBoundVariable());
|
||||
Record.AddStmt(D->getPrevUpperBoundVariable());
|
||||
Record.AddStmt(D->getDistInc());
|
||||
Record.AddStmt(D->getPrevEnsureUpperBound());
|
||||
Record.AddStmt(D->getCombinedLowerBoundVariable());
|
||||
Record.AddStmt(D->getCombinedUpperBoundVariable());
|
||||
Record.AddStmt(D->getCombinedEnsureUpperBound());
|
||||
Record.AddStmt(D->getCombinedInit());
|
||||
Record.AddStmt(D->getCombinedCond());
|
||||
Record.AddStmt(D->getCombinedNextLowerBound());
|
||||
Record.AddStmt(D->getCombinedNextUpperBound());
|
||||
Record.AddStmt(D->getCombinedDistCond());
|
||||
Record.AddStmt(D->getCombinedParForInDistCond());
|
||||
}
|
||||
for (auto I : D->counters()) {
|
||||
Record.AddStmt(I);
|
||||
}
|
||||
for (auto I : D->private_counters()) {
|
||||
Record.AddStmt(I);
|
||||
}
|
||||
for (auto I : D->inits()) {
|
||||
Record.AddStmt(I);
|
||||
}
|
||||
for (auto I : D->updates()) {
|
||||
Record.AddStmt(I);
|
||||
}
|
||||
for (auto I : D->finals()) {
|
||||
Record.AddStmt(I);
|
||||
}
|
||||
for (Stmt *S : D->dependent_counters())
|
||||
Record.AddStmt(S);
|
||||
for (Stmt *S : D->dependent_inits())
|
||||
Record.AddStmt(S);
|
||||
for (Stmt *S : D->finals_conditions())
|
||||
Record.AddStmt(S);
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_PARALLEL_DIRECTIVE;
|
||||
}
|
||||
|
||||
@ -2248,8 +2186,7 @@ void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) {
|
||||
|
||||
void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_FOR_DIRECTIVE;
|
||||
}
|
||||
|
||||
@ -2260,23 +2197,20 @@ void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) {
|
||||
|
||||
void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_SECTIONS_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPSectionDirective(OMPSectionDirective *D) {
|
||||
VisitStmt(D);
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_SECTION_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPSingleDirective(OMPSingleDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_SINGLE_DIRECTIVE;
|
||||
}
|
||||
@ -2289,7 +2223,6 @@ void ASTStmtWriter::VisitOMPMasterDirective(OMPMasterDirective *D) {
|
||||
|
||||
void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.AddDeclarationNameInfo(D->getDirectiveName());
|
||||
Code = serialization::STMT_OMP_CRITICAL_DIRECTIVE;
|
||||
@ -2297,8 +2230,7 @@ void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) {
|
||||
|
||||
void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_PARALLEL_FOR_DIRECTIVE;
|
||||
}
|
||||
|
||||
@ -2311,53 +2243,41 @@ void ASTStmtWriter::VisitOMPParallelForSimdDirective(
|
||||
void ASTStmtWriter::VisitOMPParallelMasterDirective(
|
||||
OMPParallelMasterDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Code = serialization::STMT_OMP_PARALLEL_MASTER_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPParallelSectionsDirective(
|
||||
OMPParallelSectionsDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_TASK_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.AddStmt(D->getX());
|
||||
Record.AddStmt(D->getV());
|
||||
Record.AddStmt(D->getExpr());
|
||||
Record.AddStmt(D->getUpdateExpr());
|
||||
Record.push_back(D->isXLHSInRHSPart() ? 1 : 0);
|
||||
Record.push_back(D->isPostfixUpdate() ? 1 : 0);
|
||||
Record.writeBool(D->isXLHSInRHSPart());
|
||||
Record.writeBool(D->isPostfixUpdate());
|
||||
Code = serialization::STMT_OMP_ATOMIC_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_TARGET_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_TARGET_DATA_DIRECTIVE;
|
||||
}
|
||||
@ -2365,7 +2285,6 @@ void ASTStmtWriter::VisitOMPTargetDataDirective(OMPTargetDataDirective *D) {
|
||||
void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
|
||||
OMPTargetEnterDataDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE;
|
||||
}
|
||||
@ -2373,7 +2292,6 @@ void ASTStmtWriter::VisitOMPTargetEnterDataDirective(
|
||||
void ASTStmtWriter::VisitOMPTargetExitDataDirective(
|
||||
OMPTargetExitDataDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE;
|
||||
}
|
||||
@ -2381,9 +2299,7 @@ void ASTStmtWriter::VisitOMPTargetExitDataDirective(
|
||||
void ASTStmtWriter::VisitOMPTargetParallelDirective(
|
||||
OMPTargetParallelDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_TARGET_PARALLEL_DIRECTIVE;
|
||||
}
|
||||
@ -2391,8 +2307,7 @@ void ASTStmtWriter::VisitOMPTargetParallelDirective(
|
||||
void ASTStmtWriter::VisitOMPTargetParallelForDirective(
|
||||
OMPTargetParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE;
|
||||
}
|
||||
|
||||
@ -2416,43 +2331,36 @@ void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
|
||||
|
||||
void ASTStmtWriter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.AddStmt(D->getReductionRef());
|
||||
Code = serialization::STMT_OMP_TASKGROUP_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_FLUSH_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPDepobjDirective(OMPDepobjDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_DEPOBJ_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPScanDirective(OMPScanDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_SCAN_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_ORDERED_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_TEAMS_DIRECTIVE;
|
||||
}
|
||||
@ -2461,21 +2369,20 @@ void ASTStmtWriter::VisitOMPCancellationPointDirective(
|
||||
OMPCancellationPointDirective *D) {
|
||||
VisitStmt(D);
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.push_back(uint64_t(D->getCancelRegion()));
|
||||
Record.writeEnum(D->getCancelRegion());
|
||||
Code = serialization::STMT_OMP_CANCELLATION_POINT_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPCancelDirective(OMPCancelDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Record.push_back(uint64_t(D->getCancelRegion()));
|
||||
Record.writeEnum(D->getCancelRegion());
|
||||
Code = serialization::STMT_OMP_CANCEL_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_TASKLOOP_DIRECTIVE;
|
||||
}
|
||||
|
||||
@ -2487,7 +2394,7 @@ void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
|
||||
void ASTStmtWriter::VisitOMPMasterTaskLoopDirective(
|
||||
OMPMasterTaskLoopDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_MASTER_TASKLOOP_DIRECTIVE;
|
||||
}
|
||||
|
||||
@ -2500,7 +2407,7 @@ void ASTStmtWriter::VisitOMPMasterTaskLoopSimdDirective(
|
||||
void ASTStmtWriter::VisitOMPParallelMasterTaskLoopDirective(
|
||||
OMPParallelMasterTaskLoopDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE;
|
||||
}
|
||||
|
||||
@ -2517,7 +2424,6 @@ void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
|
||||
|
||||
void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_TARGET_UPDATE_DIRECTIVE;
|
||||
}
|
||||
@ -2525,8 +2431,7 @@ void ASTStmtWriter::VisitOMPTargetUpdateDirective(OMPTargetUpdateDirective *D) {
|
||||
void ASTStmtWriter::VisitOMPDistributeParallelForDirective(
|
||||
OMPDistributeParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE;
|
||||
}
|
||||
|
||||
@ -2574,14 +2479,12 @@ void ASTStmtWriter::VisitOMPTeamsDistributeParallelForSimdDirective(
|
||||
void ASTStmtWriter::VisitOMPTeamsDistributeParallelForDirective(
|
||||
OMPTeamsDistributeParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *D) {
|
||||
VisitStmt(D);
|
||||
Record.push_back(D->getNumClauses());
|
||||
VisitOMPExecutableDirective(D);
|
||||
Code = serialization::STMT_OMP_TARGET_TEAMS_DIRECTIVE;
|
||||
}
|
||||
@ -2595,8 +2498,7 @@ void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective(
|
||||
void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective(
|
||||
OMPTargetTeamsDistributeParallelForDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Record.AddStmt(D->getTaskReductionRefExpr());
|
||||
Record.push_back(D->hasCancel() ? 1 : 0);
|
||||
Record.writeBool(D->hasCancel());
|
||||
Code = serialization::STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE;
|
||||
}
|
||||
|
||||
|
@ -74,8 +74,7 @@ void test_three(int x) {
|
||||
// CHECK-NEXT: | | | `-DeclRefExpr {{.*}} <col:26> 'int' lvalue Var {{.*}} 'i' 'int'
|
||||
// CHECK-NEXT: | | `-CompoundStmt {{.*}} <col:31, line:18:3>
|
||||
// CHECK-NEXT: | | `-OMPOrderedDirective {{.*}} <line:17:1, col:35> openmp_standalone_directive
|
||||
// CHECK-NEXT: | | |-OMPDependClause {{.*}} <col:21, <invalid sloc>>
|
||||
// CHECK-NEXT: | | `-<<<NULL>>>
|
||||
// CHECK-NEXT: | | `-OMPDependClause {{.*}} <col:21, <invalid sloc>>
|
||||
// CHECK-NEXT: | |-ImplicitParamDecl {{.*}} <line:15:1> col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-ordered.c:15:1) *const restrict'
|
||||
// CHECK-NEXT: | `-VarDecl {{.*}} <line:16:8, col:16> col:12 used i 'int' cinit
|
||||
// CHECK-NEXT: | `-IntegerLiteral {{.*}} <col:16> 'int' 0
|
||||
|
@ -23,7 +23,7 @@ struct vec { // expec
|
||||
#pragma omp declare mapper(cc:struct vec v) map(v) ( // expected-warning {{extra tokens at the end of '#pragma omp declare mapper' are ignored}}
|
||||
|
||||
#pragma omp declare mapper(++: struct vec v) map(v.len) // expected-error {{illegal OpenMP user-defined mapper identifier}}
|
||||
#pragma omp declare mapper(id1: struct vec v) map(v.len, temp) // expected-error {{only variable v is allowed in map clauses of this 'omp declare mapper' directive}}
|
||||
#pragma omp declare mapper(id1: struct vec v) map(v.len, temp) // expected-error {{only variable 'v' is allowed in map clauses of this 'omp declare mapper' directive}}
|
||||
#pragma omp declare mapper(default : struct vec kk) map(kk.data[0:2]) // expected-note {{previous definition is here}}
|
||||
#pragma omp declare mapper(struct vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'struct vec' with name 'default'}}
|
||||
#pragma omp declare mapper(int v) map(v) // expected-error {{mapper type must be of struct, union or class type}}
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
#pragma omp declare mapper(cc: vec v) map(v) ( // expected-warning {{extra tokens at the end of '#pragma omp declare mapper' are ignored}}
|
||||
|
||||
#pragma omp declare mapper(++: vec v) map(v.len) // expected-error {{illegal OpenMP user-defined mapper identifier}}
|
||||
#pragma omp declare mapper(id1: vec v) map(v.len, temp) // expected-error {{only variable v is allowed in map clauses of this 'omp declare mapper' directive}}
|
||||
#pragma omp declare mapper(id1: vec v) map(v.len, temp) // expected-error {{only variable 'v' is allowed in map clauses of this 'omp declare mapper' directive}}
|
||||
#pragma omp declare mapper(default : vec kk) map(kk.data[0:2]) // expected-note {{previous definition is here}}
|
||||
#pragma omp declare mapper(vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'vec' with name 'default'}}
|
||||
#pragma omp declare mapper(int v) map(v) // expected-error {{mapper type must be of struct, union or class type}}
|
||||
|
Loading…
Reference in New Issue
Block a user