[flang-commits] [flang] [MLIR][OpenMP] Add Lowering support for implicitly linking to default declare mappers (PR #131006)
Akash Banerjee via flang-commits
flang-commits at lists.llvm.org
Mon Mar 17 10:44:48 PDT 2025
================
@@ -978,6 +960,42 @@ void ClauseProcessor::processMapObjects(
}
}
+ // Create the mapper symbol from its name, if specified.
+ mlir::FlatSymbolRefAttr mapperId;
+ if (!mapperIdNameRef.empty()) {
+ std::string mapperIdName = mapperIdNameRef.str();
+ if (mapperIdNameRef == "implicit" || mapperIdNameRef == "default") {
+ if (!mlir::isa<mlir::omp::DeclareMapperOp>(
+ firOpBuilder.getRegion().getParentOp())) {
+ const semantics::DerivedTypeSpec *typeSpec = nullptr;
+
+ if (object.sym()->owner().IsDerivedType())
+ typeSpec = object.sym()->owner().derivedTypeSpec();
+ else if (object.sym()->GetType() &&
+ object.sym()->GetType()->category() ==
+ semantics::DeclTypeSpec::TypeDerived)
+ typeSpec = &object.sym()->GetType()->derivedTypeSpec();
+
+ if (typeSpec) {
+ mapperIdName = typeSpec->name().ToString() + ".default";
+ mapperIdName =
+ converter.mangleName(mapperIdName, *typeSpec->GetScope());
+ }
+ }
+ }
+ if (mapperIdNameRef == "implicit") {
+ mapperId = converter.getModuleOp().lookupSymbol(mapperIdName)
+ ? mlir::FlatSymbolRefAttr::get(
+ &converter.getMLIRContext(), mapperIdName)
+ : mlir::FlatSymbolRefAttr();
+ } else {
+ assert(converter.getModuleOp().lookupSymbol(mapperIdName) &&
+ "mapper not found");
+ mapperId = mlir::FlatSymbolRefAttr::get(&converter.getMLIRContext(),
+ mapperIdName);
+ }
+ }
----------------
TIFitis wrote:
I've updated the code splitting the two. Let me know if you want me to make any other changes :)
https://github.com/llvm/llvm-project/pull/131006
More information about the flang-commits
mailing list