Skip to content

Commit 616b6e4

Browse files
committed
[Flang][OpenMP][Dialect] Swap to using MLIR dialect enum to encode map flags
This PR shifts from using the LLVM OpenMP enumerator bit flags to an OpenMP dialect specific enumerator. This allows us to better represent map types that wouldn't be of interest to the LLVM backend and runtime in the dialect. Primarily things like ref_ptr/ref_ptee/ref_ptr_ptee/atach_none/attach_always/attach_auto which are of interest to the compiler for certrain transformations (primarily in the FIR transformation passes dealing with mapping), but the runtime has no need to know about them. It also means if another OpenMP implementation comes along they won't need to stick to the same bit flag system LLVM chose/do leg work to address it.
1 parent c7da79e commit 616b6e4

35 files changed

+422
-318
lines changed

flang/include/flang/Lower/DirectivesCommon.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
4040
#include "mlir/Dialect/SCF/IR/SCF.h"
4141
#include "mlir/IR/Value.h"
42-
#include "llvm/Frontend/OpenMP/OMPConstants.h"
4342
#include <list>
4443
#include <type_traits>
4544

flang/include/flang/Utils/OpenMP.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ mlir::omp::MapInfoOp createMapInfoOp(mlir::OpBuilder &builder,
2929
mlir::Location loc, mlir::Value baseAddr, mlir::Value varPtrPtr,
3030
llvm::StringRef name, llvm::ArrayRef<mlir::Value> bounds,
3131
llvm::ArrayRef<mlir::Value> members, mlir::ArrayAttr membersIndex,
32-
uint64_t mapType, mlir::omp::VariableCaptureKind mapCaptureType,
33-
mlir::Type retTy, bool partialMap = false,
32+
mlir::omp::ClauseMapFlags mapType,
33+
mlir::omp::VariableCaptureKind mapCaptureType, mlir::Type retTy,
34+
bool partialMap = false,
3435
mlir::FlatSymbolRefAttr mapperId = mlir::FlatSymbolRefAttr());
3536

3637
/// For an mlir value that does not have storage, allocate temporary storage

flang/lib/Lower/OpenMP/ClauseProcessor.cpp

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,9 +1080,8 @@ bool ClauseProcessor::processHasDeviceAddr(
10801080
[&](const omp::clause::HasDeviceAddr &clause,
10811081
const parser::CharBlock &source) {
10821082
mlir::Location location = converter.genLocation(source);
1083-
llvm::omp::OpenMPOffloadMappingFlags mapTypeBits =
1084-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO |
1085-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_IMPLICIT;
1083+
mlir::omp::ClauseMapFlags mapTypeBits =
1084+
mlir::omp::ClauseMapFlags::to | mlir::omp::ClauseMapFlags::implicit;
10861085
omp::ObjectList baseObjects;
10871086
llvm::transform(clause.v, std::back_inserter(baseObjects),
10881087
[&](const omp::Object &object) {
@@ -1217,8 +1216,7 @@ bool ClauseProcessor::processLink(
12171216

12181217
void ClauseProcessor::processMapObjects(
12191218
lower::StatementContext &stmtCtx, mlir::Location clauseLocation,
1220-
const omp::ObjectList &objects,
1221-
llvm::omp::OpenMPOffloadMappingFlags mapTypeBits,
1219+
const omp::ObjectList &objects, mlir::omp::ClauseMapFlags mapTypeBits,
12221220
std::map<Object, OmpMapParentAndMemberData> &parentMemberIndices,
12231221
llvm::SmallVectorImpl<mlir::Value> &mapVars,
12241222
llvm::SmallVectorImpl<const semantics::Symbol *> &mapSyms,
@@ -1310,10 +1308,7 @@ void ClauseProcessor::processMapObjects(
13101308
mlir::omp::MapInfoOp mapOp = utils::openmp::createMapInfoOp(
13111309
firOpBuilder, location, baseOp,
13121310
/*varPtrPtr=*/mlir::Value{}, asFortran.str(), bounds,
1313-
/*members=*/{}, /*membersIndex=*/mlir::ArrayAttr{},
1314-
static_cast<
1315-
std::underlying_type_t<llvm::omp::OpenMPOffloadMappingFlags>>(
1316-
mapTypeBits),
1311+
/*members=*/{}, /*membersIndex=*/mlir::ArrayAttr{}, mapTypeBits,
13171312
mlir::omp::VariableCaptureKind::ByRef, baseOp.getType(),
13181313
/*partialMap=*/false, mapperId);
13191314

@@ -1347,8 +1342,7 @@ bool ClauseProcessor::processMap(
13471342
objects] = clause.t;
13481343
if (attachMod)
13491344
TODO(currentLocation, "ATTACH modifier is not implemented yet");
1350-
llvm::omp::OpenMPOffloadMappingFlags mapTypeBits =
1351-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_NONE;
1345+
mlir::omp::ClauseMapFlags mapTypeBits = mlir::omp::ClauseMapFlags::none;
13521346
std::string mapperIdName = "__implicit_mapper";
13531347
// If the map type is specified, then process it else set the appropriate
13541348
// default value
@@ -1364,36 +1358,32 @@ bool ClauseProcessor::processMap(
13641358

13651359
switch (type) {
13661360
case Map::MapType::To:
1367-
mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO;
1361+
mapTypeBits |= mlir::omp::ClauseMapFlags::to;
13681362
break;
13691363
case Map::MapType::From:
1370-
mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM;
1364+
mapTypeBits |= mlir::omp::ClauseMapFlags::from;
13711365
break;
13721366
case Map::MapType::Tofrom:
1373-
mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO |
1374-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM;
1367+
mapTypeBits |=
1368+
mlir::omp::ClauseMapFlags::to | mlir::omp::ClauseMapFlags::from;
13751369
break;
13761370
case Map::MapType::Storage:
1377-
// alloc and release is the default map_type for the Target Data
1378-
// Ops, i.e. if no bits for map_type is supplied then alloc/release
1379-
// (aka storage in 6.0+) is implicitly assumed based on the target
1380-
// directive. Default value for Target Data and Enter Data is alloc
1381-
// and for Exit Data it is release.
1371+
mapTypeBits |= mlir::omp::ClauseMapFlags::storage;
13821372
break;
13831373
}
13841374

13851375
if (typeMods) {
13861376
// TODO: Still requires "self" modifier, an OpenMP 6.0+ feature
13871377
if (llvm::is_contained(*typeMods, Map::MapTypeModifier::Always))
1388-
mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_ALWAYS;
1378+
mapTypeBits |= mlir::omp::ClauseMapFlags::always;
13891379
if (llvm::is_contained(*typeMods, Map::MapTypeModifier::Present))
1390-
mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_PRESENT;
1380+
mapTypeBits |= mlir::omp::ClauseMapFlags::present;
13911381
if (llvm::is_contained(*typeMods, Map::MapTypeModifier::Close))
1392-
mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_CLOSE;
1382+
mapTypeBits |= mlir::omp::ClauseMapFlags::close;
13931383
if (llvm::is_contained(*typeMods, Map::MapTypeModifier::Delete))
1394-
mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_DELETE;
1384+
mapTypeBits |= mlir::omp::ClauseMapFlags::del;
13951385
if (llvm::is_contained(*typeMods, Map::MapTypeModifier::OmpxHold))
1396-
mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_OMPX_HOLD;
1386+
mapTypeBits |= mlir::omp::ClauseMapFlags::ompx_hold;
13971387
}
13981388

13991389
if (iterator) {
@@ -1437,12 +1427,12 @@ bool ClauseProcessor::processMotionClauses(lower::StatementContext &stmtCtx,
14371427
TODO(clauseLocation, "Iterator modifier is not supported yet");
14381428
}
14391429

1440-
llvm::omp::OpenMPOffloadMappingFlags mapTypeBits =
1430+
mlir::omp::ClauseMapFlags mapTypeBits =
14411431
std::is_same_v<llvm::remove_cvref_t<decltype(clause)>, omp::clause::To>
1442-
? llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO
1443-
: llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM;
1432+
? mlir::omp::ClauseMapFlags::to
1433+
: mlir::omp::ClauseMapFlags::from;
14441434
if (expectation && *expectation == omp::clause::To::Expectation::Present)
1445-
mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_PRESENT;
1435+
mapTypeBits |= mlir::omp::ClauseMapFlags::present;
14461436
processMapObjects(stmtCtx, clauseLocation, objects, mapTypeBits,
14471437
parentMemberIndices, result.mapVars, mapSymbols);
14481438
};
@@ -1568,8 +1558,8 @@ bool ClauseProcessor::processUseDeviceAddr(
15681558
[&](const omp::clause::UseDeviceAddr &clause,
15691559
const parser::CharBlock &source) {
15701560
mlir::Location location = converter.genLocation(source);
1571-
llvm::omp::OpenMPOffloadMappingFlags mapTypeBits =
1572-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_RETURN_PARAM;
1561+
mlir::omp::ClauseMapFlags mapTypeBits =
1562+
mlir::omp::ClauseMapFlags::return_param;
15731563
processMapObjects(stmtCtx, location, clause.v, mapTypeBits,
15741564
parentMemberIndices, result.useDeviceAddrVars,
15751565
useDeviceSyms);
@@ -1589,8 +1579,8 @@ bool ClauseProcessor::processUseDevicePtr(
15891579
[&](const omp::clause::UseDevicePtr &clause,
15901580
const parser::CharBlock &source) {
15911581
mlir::Location location = converter.genLocation(source);
1592-
llvm::omp::OpenMPOffloadMappingFlags mapTypeBits =
1593-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_RETURN_PARAM;
1582+
mlir::omp::ClauseMapFlags mapTypeBits =
1583+
mlir::omp::ClauseMapFlags::return_param;
15941584
processMapObjects(stmtCtx, location, clause.v, mapTypeBits,
15951585
parentMemberIndices, result.useDevicePtrVars,
15961586
useDeviceSyms);

flang/lib/Lower/OpenMP/ClauseProcessor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ class ClauseProcessor {
194194

195195
void processMapObjects(
196196
lower::StatementContext &stmtCtx, mlir::Location clauseLocation,
197-
const omp::ObjectList &objects,
198-
llvm::omp::OpenMPOffloadMappingFlags mapTypeBits,
197+
const omp::ObjectList &objects, mlir::omp::ClauseMapFlags mapTypeBits,
199198
std::map<Object, OmpMapParentAndMemberData> &parentMemberIndices,
200199
llvm::SmallVectorImpl<mlir::Value> &mapVars,
201200
llvm::SmallVectorImpl<const semantics::Symbol *> &mapSyms,

flang/lib/Lower/OpenMP/Clauses.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include "flang/Semantics/openmp-modifiers.h"
1717
#include "flang/Semantics/symbol.h"
1818

19-
#include "llvm/Frontend/OpenMP/OMPConstants.h"
20-
2119
#include <list>
2220
#include <optional>
2321
#include <tuple>

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
#include "mlir/Support/StateStack.h"
4545
#include "mlir/Transforms/RegionUtils.h"
4646
#include "llvm/ADT/STLExtras.h"
47-
#include "llvm/Frontend/OpenMP/OMPConstants.h"
4847

4948
using namespace Fortran::lower::omp;
5049
using namespace Fortran::common::openmp;
@@ -944,8 +943,7 @@ getDefaultmapIfPresent(const DefaultMapsTy &defaultMaps, mlir::Type varType) {
944943
return DefMap::ImplicitBehavior::Default;
945944
}
946945

947-
static std::pair<llvm::omp::OpenMPOffloadMappingFlags,
948-
mlir::omp::VariableCaptureKind>
946+
static std::pair<mlir::omp::ClauseMapFlags, mlir::omp::VariableCaptureKind>
949947
getImplicitMapTypeAndKind(fir::FirOpBuilder &firOpBuilder,
950948
lower::AbstractConverter &converter,
951949
const DefaultMapsTy &defaultMaps, mlir::Type varType,
@@ -966,8 +964,7 @@ getImplicitMapTypeAndKind(fir::FirOpBuilder &firOpBuilder,
966964
return size <= ptrSize && align <= ptrAlign;
967965
};
968966

969-
llvm::omp::OpenMPOffloadMappingFlags mapFlag =
970-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_IMPLICIT;
967+
mlir::omp::ClauseMapFlags mapFlag = mlir::omp::ClauseMapFlags::implicit;
971968

972969
auto implicitBehaviour = getDefaultmapIfPresent(defaultMaps, varType);
973970
if (implicitBehaviour == DefMap::ImplicitBehavior::Default) {
@@ -985,8 +982,8 @@ getImplicitMapTypeAndKind(fir::FirOpBuilder &firOpBuilder,
985982
mlir::omp::DeclareTargetCaptureClause::link &&
986983
declareTargetOp.getDeclareTargetDeviceType() !=
987984
mlir::omp::DeclareTargetDeviceType::nohost) {
988-
mapFlag |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO;
989-
mapFlag |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM;
985+
mapFlag |= mlir::omp::ClauseMapFlags::to;
986+
mapFlag |= mlir::omp::ClauseMapFlags::from;
990987
}
991988
} else if (fir::isa_trivial(varType) || fir::isa_char(varType)) {
992989
// Scalars behave as if they were "firstprivate".
@@ -995,18 +992,18 @@ getImplicitMapTypeAndKind(fir::FirOpBuilder &firOpBuilder,
995992
if (isLiteralType(varType)) {
996993
captureKind = mlir::omp::VariableCaptureKind::ByCopy;
997994
} else {
998-
mapFlag |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO;
995+
mapFlag |= mlir::omp::ClauseMapFlags::to;
999996
}
1000997
} else if (!fir::isa_builtin_cptr_type(varType)) {
1001-
mapFlag |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO;
1002-
mapFlag |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM;
998+
mapFlag |= mlir::omp::ClauseMapFlags::to;
999+
mapFlag |= mlir::omp::ClauseMapFlags::from;
10031000
}
10041001
return std::make_pair(mapFlag, captureKind);
10051002
}
10061003

10071004
switch (implicitBehaviour) {
10081005
case DefMap::ImplicitBehavior::Alloc:
1009-
return std::make_pair(llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_NONE,
1006+
return std::make_pair(mlir::omp::ClauseMapFlags::storage,
10101007
mlir::omp::VariableCaptureKind::ByRef);
10111008
break;
10121009
case DefMap::ImplicitBehavior::Firstprivate:
@@ -1015,26 +1012,22 @@ getImplicitMapTypeAndKind(fir::FirOpBuilder &firOpBuilder,
10151012
"behaviour");
10161013
break;
10171014
case DefMap::ImplicitBehavior::From:
1018-
return std::make_pair(mapFlag |=
1019-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM,
1015+
return std::make_pair(mapFlag |= mlir::omp::ClauseMapFlags::from,
10201016
mlir::omp::VariableCaptureKind::ByRef);
10211017
break;
10221018
case DefMap::ImplicitBehavior::Present:
1023-
return std::make_pair(mapFlag |=
1024-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_PRESENT,
1019+
return std::make_pair(mapFlag |= mlir::omp::ClauseMapFlags::present,
10251020
mlir::omp::VariableCaptureKind::ByRef);
10261021
break;
10271022
case DefMap::ImplicitBehavior::To:
1028-
return std::make_pair(mapFlag |=
1029-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO,
1023+
return std::make_pair(mapFlag |= mlir::omp::ClauseMapFlags::to,
10301024
(fir::isa_trivial(varType) || fir::isa_char(varType))
10311025
? mlir::omp::VariableCaptureKind::ByCopy
10321026
: mlir::omp::VariableCaptureKind::ByRef);
10331027
break;
10341028
case DefMap::ImplicitBehavior::Tofrom:
1035-
return std::make_pair(mapFlag |=
1036-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM |
1037-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO,
1029+
return std::make_pair(mapFlag |= mlir::omp::ClauseMapFlags::from |
1030+
mlir::omp::ClauseMapFlags::to,
10381031
mlir::omp::VariableCaptureKind::ByRef);
10391032
break;
10401033
case DefMap::ImplicitBehavior::Default:
@@ -1043,9 +1036,8 @@ getImplicitMapTypeAndKind(fir::FirOpBuilder &firOpBuilder,
10431036
break;
10441037
}
10451038

1046-
return std::make_pair(mapFlag |=
1047-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM |
1048-
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO,
1039+
return std::make_pair(mapFlag |= mlir::omp::ClauseMapFlags::from |
1040+
mlir::omp::ClauseMapFlags::to,
10491041
mlir::omp::VariableCaptureKind::ByRef);
10501042
}
10511043

@@ -2611,18 +2603,14 @@ genTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
26112603
if (auto refType = mlir::dyn_cast<fir::ReferenceType>(baseOp.getType()))
26122604
eleType = refType.getElementType();
26132605

2614-
std::pair<llvm::omp::OpenMPOffloadMappingFlags,
2615-
mlir::omp::VariableCaptureKind>
2606+
std::pair<mlir::omp::ClauseMapFlags, mlir::omp::VariableCaptureKind>
26162607
mapFlagAndKind = getImplicitMapTypeAndKind(
26172608
firOpBuilder, converter, defaultMaps, eleType, loc, sym);
26182609

26192610
mlir::Value mapOp = createMapInfoOp(
26202611
firOpBuilder, converter.getCurrentLocation(), baseOp,
26212612
/*varPtrPtr=*/mlir::Value{}, name.str(), bounds, /*members=*/{},
2622-
/*membersIndex=*/mlir::ArrayAttr{},
2623-
static_cast<
2624-
std::underlying_type_t<llvm::omp::OpenMPOffloadMappingFlags>>(
2625-
std::get<0>(mapFlagAndKind)),
2613+
/*membersIndex=*/mlir::ArrayAttr{}, std::get<0>(mapFlagAndKind),
26262614
std::get<1>(mapFlagAndKind), baseOp.getType(),
26272615
/*partialMap=*/false, mapperId);
26282616

flang/lib/Lower/OpenMP/Utils.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ mlir::Value createParentSymAndGenIntermediateMaps(
273273
semantics::SemanticsContext &semaCtx, lower::StatementContext &stmtCtx,
274274
omp::ObjectList &objectList, llvm::SmallVectorImpl<int64_t> &indices,
275275
OmpMapParentAndMemberData &parentMemberIndices, llvm::StringRef asFortran,
276-
llvm::omp::OpenMPOffloadMappingFlags mapTypeBits) {
276+
mlir::omp::ClauseMapFlags mapTypeBits) {
277277
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
278278

279279
/// Checks if an omp::Object is an array expression with a subscript, e.g.
@@ -414,11 +414,10 @@ mlir::Value createParentSymAndGenIntermediateMaps(
414414
// be safer to just pass OMP_MAP_NONE as the map type, but we may still
415415
// need some of the other map types the mapped member utilises, so for
416416
// now it's good to keep an eye on this.
417-
llvm::omp::OpenMPOffloadMappingFlags interimMapType = mapTypeBits;
418-
interimMapType &= ~llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO;
419-
interimMapType &= ~llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM;
420-
interimMapType &=
421-
~llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_RETURN_PARAM;
417+
mlir::omp::ClauseMapFlags interimMapType = mapTypeBits;
418+
interimMapType &= ~mlir::omp::ClauseMapFlags::to;
419+
interimMapType &= ~mlir::omp::ClauseMapFlags::from;
420+
interimMapType &= ~mlir::omp::ClauseMapFlags::return_param;
422421

423422
// Create a map for the intermediate member and insert it and it's
424423
// indices into the parentMemberIndices list to track it.
@@ -427,10 +426,7 @@ mlir::Value createParentSymAndGenIntermediateMaps(
427426
/*varPtrPtr=*/mlir::Value{}, asFortran,
428427
/*bounds=*/interimBounds,
429428
/*members=*/{},
430-
/*membersIndex=*/mlir::ArrayAttr{},
431-
static_cast<
432-
std::underlying_type_t<llvm::omp::OpenMPOffloadMappingFlags>>(
433-
interimMapType),
429+
/*membersIndex=*/mlir::ArrayAttr{}, interimMapType,
434430
mlir::omp::VariableCaptureKind::ByRef, curValue.getType());
435431

436432
parentMemberIndices.memberPlacementIndices.push_back(interimIndices);
@@ -563,7 +559,8 @@ void insertChildMapInfoIntoParent(
563559
// it allows this to work with enter and exit without causing MLIR
564560
// verification issues. The more appropriate thing may be to take
565561
// the "main" map type clause from the directive being used.
566-
uint64_t mapType = indices.second.memberMap[0].getMapType();
562+
mlir::omp::ClauseMapFlags mapType =
563+
indices.second.memberMap[0].getMapType();
567564

568565
llvm::SmallVector<mlir::Value> members;
569566
members.reserve(indices.second.memberMap.size());

flang/lib/Lower/OpenMP/Utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ mlir::Value createParentSymAndGenIntermediateMaps(
134134
semantics::SemanticsContext &semaCtx, lower::StatementContext &stmtCtx,
135135
omp::ObjectList &objectList, llvm::SmallVectorImpl<int64_t> &indices,
136136
OmpMapParentAndMemberData &parentMemberIndices, llvm::StringRef asFortran,
137-
llvm::omp::OpenMPOffloadMappingFlags mapTypeBits);
137+
mlir::omp::ClauseMapFlags mapTypeBits);
138138

139139
omp::ObjectList gatherObjectsOf(omp::Object derivedTypeMember,
140140
semantics::SemanticsContext &semaCtx);

flang/lib/Optimizer/OpenMP/AutomapToTargetData.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#include "mlir/IR/Operation.h"
2121
#include "mlir/Pass/Pass.h"
2222

23-
#include "llvm/Frontend/OpenMP/OMPConstants.h"
24-
2523
namespace flangomp {
2624
#define GEN_PASS_DEF_AUTOMAPTOTARGETDATAPASS
2725
#include "flang/Optimizer/OpenMP/Passes.h.inc"
@@ -120,12 +118,9 @@ class AutomapToTargetDataPass
120118
builder, memOp.getLoc(), memOp.getMemref().getType(),
121119
memOp.getMemref(),
122120
TypeAttr::get(fir::unwrapRefType(memOp.getMemref().getType())),
123-
builder.getIntegerAttr(
124-
builder.getIntegerType(64, false),
125-
static_cast<unsigned>(
126-
isa<fir::StoreOp>(memOp)
127-
? llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO
128-
: llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_DELETE)),
121+
builder.getAttr<omp::ClauseMapFlagsAttr>(
122+
isa<fir::StoreOp>(memOp) ? omp::ClauseMapFlags::to
123+
: omp::ClauseMapFlags::del),
129124
builder.getAttr<omp::VariableCaptureKindAttr>(
130125
omp::VariableCaptureKind::ByCopy),
131126
/*var_ptr_ptr=*/mlir::Value{},

0 commit comments

Comments
 (0)