diff options
author | Michael Kruse <llvm@meinersbur.de> | 2019-02-19 16:38:20 +0000 |
---|---|---|
committer | Michael Kruse <llvm@meinersbur.de> | 2019-02-19 16:38:20 +0000 |
commit | 4304e9d14399904441bdc01b5d8812f83ea710d4 (patch) | |
tree | 52719f02bb527a037f372202f5d4925f93f066a9 /clang/lib/Serialization/ASTReader.cpp | |
parent | 9d575db85ed52e87e759cb0fc88c221ef19898a4 (diff) | |
download | bcm5719-llvm-4304e9d14399904441bdc01b5d8812f83ea710d4.tar.gz bcm5719-llvm-4304e9d14399904441bdc01b5d8812f83ea710d4.zip |
[OpenMP 5.0] Parsing/sema support for map clause with mapper modifier.
This patch implements the parsing and sema support for OpenMP map
clauses with potential user-defined mapper attached. User defined mapper
is a new feature in OpenMP 5.0. A map clause can have an explicit or
implicit associated mapper, which instructs the compiler to generate
extra data mapping. An example is shown below:
struct S { int len; int *d; };
#pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len])
struct S ss;
#pragma omp target map(mapper(id) tofrom: ss) // use the mapper with name 'id' to map ss
Contributed-by: Lingda Li <lildmh@gmail.com>
Differential Revision: https://reviews.llvm.org/D58074
llvm-svn: 354347
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index aaf40b93f19..39dc808c7f4 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -11784,12 +11784,12 @@ OMPClause *OMPClauseReader::readClause() { C = new (Context) OMPDeviceClause(); break; case OMPC_map: { - unsigned NumVars = Record.readInt(); - unsigned NumDeclarations = Record.readInt(); - unsigned NumLists = Record.readInt(); - unsigned NumComponents = Record.readInt(); - C = OMPMapClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, - NumComponents); + OMPMappableExprListSizeTy Sizes; + Sizes.NumVars = Record.readInt(); + Sizes.NumUniqueDeclarations = Record.readInt(); + Sizes.NumComponentLists = Record.readInt(); + Sizes.NumComponents = Record.readInt(); + C = OMPMapClause::CreateEmpty(Context, Sizes); break; } case OMPC_num_teams: @@ -11817,39 +11817,39 @@ OMPClause *OMPClauseReader::readClause() { C = new (Context) OMPDefaultmapClause(); break; case OMPC_to: { - unsigned NumVars = Record.readInt(); - unsigned NumDeclarations = Record.readInt(); - unsigned NumLists = Record.readInt(); - unsigned NumComponents = Record.readInt(); - C = OMPToClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, - NumComponents); + OMPMappableExprListSizeTy Sizes; + Sizes.NumVars = Record.readInt(); + Sizes.NumUniqueDeclarations = Record.readInt(); + Sizes.NumComponentLists = Record.readInt(); + Sizes.NumComponents = Record.readInt(); + C = OMPToClause::CreateEmpty(Context, Sizes); break; } case OMPC_from: { - unsigned NumVars = Record.readInt(); - unsigned NumDeclarations = Record.readInt(); - unsigned NumLists = Record.readInt(); - unsigned NumComponents = Record.readInt(); - C = OMPFromClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, - NumComponents); + OMPMappableExprListSizeTy Sizes; + Sizes.NumVars = Record.readInt(); + Sizes.NumUniqueDeclarations = Record.readInt(); + Sizes.NumComponentLists = Record.readInt(); + Sizes.NumComponents = Record.readInt(); + C = OMPFromClause::CreateEmpty(Context, Sizes); break; } case OMPC_use_device_ptr: { - unsigned NumVars = Record.readInt(); - unsigned NumDeclarations = Record.readInt(); - unsigned NumLists = Record.readInt(); - unsigned NumComponents = Record.readInt(); - C = OMPUseDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations, - NumLists, NumComponents); + OMPMappableExprListSizeTy Sizes; + Sizes.NumVars = Record.readInt(); + Sizes.NumUniqueDeclarations = Record.readInt(); + Sizes.NumComponentLists = Record.readInt(); + Sizes.NumComponents = Record.readInt(); + C = OMPUseDevicePtrClause::CreateEmpty(Context, Sizes); break; } case OMPC_is_device_ptr: { - unsigned NumVars = Record.readInt(); - unsigned NumDeclarations = Record.readInt(); - unsigned NumLists = Record.readInt(); - unsigned NumComponents = Record.readInt(); - C = OMPIsDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations, - NumLists, NumComponents); + OMPMappableExprListSizeTy Sizes; + Sizes.NumVars = Record.readInt(); + Sizes.NumUniqueDeclarations = Record.readInt(); + Sizes.NumComponentLists = Record.readInt(); + Sizes.NumComponents = Record.readInt(); + C = OMPIsDevicePtrClause::CreateEmpty(Context, Sizes); break; } } @@ -12288,6 +12288,10 @@ void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) { I, static_cast<OpenMPMapModifierKind>(Record.readInt())); C->setMapTypeModifierLoc(I, Record.readSourceLocation()); } + C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc()); + DeclarationNameInfo DNI; + Record.readDeclarationNameInfo(DNI); + C->setMapperIdInfo(DNI); C->setMapType( static_cast<OpenMPMapClauseKind>(Record.readInt())); C->setMapLoc(Record.readSourceLocation()); @@ -12303,6 +12307,12 @@ void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) { Vars.push_back(Record.readExpr()); C->setVarRefs(Vars); + SmallVector<Expr *, 16> UDMappers; + UDMappers.reserve(NumVars); + for (unsigned I = 0; I < NumVars; ++I) + UDMappers.push_back(Record.readExpr()); + C->setUDMapperRefs(UDMappers); + SmallVector<ValueDecl *, 16> Decls; Decls.reserve(UniqueDecls); for (unsigned i = 0; i < UniqueDecls; ++i) |