Skip to content
30 changes: 28 additions & 2 deletions flang/lib/Lower/OpenMP/ClauseProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,8 +1311,6 @@ bool ClauseProcessor::processMap(
mlir::Location clauseLocation = converter.genLocation(source);
const auto &[mapType, typeMods, attachMod, refMod, mappers, iterator,
objects] = clause.t;
if (attachMod)
TODO(currentLocation, "ATTACH modifier is not implemented yet");
mlir::omp::ClauseMapFlags mapTypeBits = mlir::omp::ClauseMapFlags::none;
std::string mapperIdName = "__implicit_mapper";
// If the map type is specified, then process it else set the appropriate
Expand Down Expand Up @@ -1357,6 +1355,34 @@ bool ClauseProcessor::processMap(
mapTypeBits |= mlir::omp::ClauseMapFlags::ompx_hold;
}

if (refMod) {
switch (*refMod) {
case Map::RefModifier::RefPtee:
mapTypeBits |= mlir::omp::ClauseMapFlags::ref_ptee;
break;
case Map::RefModifier::RefPtr:
mapTypeBits |= mlir::omp::ClauseMapFlags::ref_ptr;
break;
case Map::RefModifier::RefPtrPtee:
mapTypeBits |= mlir::omp::ClauseMapFlags::ref_ptr_ptee;
break;
}
}

if (attachMod) {
switch (*attachMod) {
case Map::AttachModifier::Always:
mapTypeBits |= mlir::omp::ClauseMapFlags::attach_always;
break;
case Map::AttachModifier::Never:
mapTypeBits |= mlir::omp::ClauseMapFlags::attach_never;
break;
case Map::AttachModifier::Auto:
mapTypeBits |= mlir::omp::ClauseMapFlags::attach_auto;
break;
}
}

if (iterator) {
TODO(currentLocation,
"Support for iterator modifiers is not implemented yet");
Expand Down
1 change: 1 addition & 0 deletions flang/lib/Optimizer/OpenMP/AutomapToTargetData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class AutomapToTargetDataPass
builder.getAttr<omp::VariableCaptureKindAttr>(
omp::VariableCaptureKind::ByCopy),
/*var_ptr_ptr=*/mlir::Value{},
/*var_ptr_ptr_type=*/mlir::TypeAttr{},
/*members=*/SmallVector<Value>{},
/*members_index=*/ArrayAttr{}, bounds,
/*mapperId=*/mlir::FlatSymbolRefAttr(), globalOp.getSymNameAttr(),
Expand Down
1 change: 1 addition & 0 deletions flang/lib/Optimizer/OpenMP/LowerWorkdistribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ static TempOmpVar allocateTempOmpVar(Location loc, Type ty,
rewriter.getAttr<omp::VariableCaptureKindAttr>(
omp::VariableCaptureKind::ByRef),
/*varPtrPtr=*/Value{},
/*varPtrPtrType=*/mlir::TypeAttr{},
/*members=*/SmallVector<Value>{},
/*member_index=*/mlir::ArrayAttr{},
/*bounds=*/ValueRange(),
Expand Down
Loading