[flang-commits] [flang] [MLIR][OpenMP] Add Lowering support for implicitly linking to default declare mappers (PR #131006)

Kareem Ergawy via flang-commits flang-commits at lists.llvm.org
Thu Mar 13 03:00:10 PDT 2025


================
@@ -2234,6 +2234,16 @@ genTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
       fir::ExtendedValue dataExv = converter.getSymbolExtendedValue(sym);
       name << sym.name().ToString();
 
+      mlir::FlatSymbolRefAttr mapperId;
+      if (sym.GetType()->category() == semantics::DeclTypeSpec::TypeDerived) {
+        auto &typeSpec = sym.GetType()->derivedTypeSpec();
+        std::string mapperIdName = typeSpec.name().ToString() + ".default";
+        mapperIdName = converter.mangleName(mapperIdName, *typeSpec.GetScope());
+        if (converter.getModuleOp().lookupSymbol(mapperIdName))
+          mapperId = mlir::FlatSymbolRefAttr::get(&converter.getMLIRContext(),
+                                                  mapperIdName);
+      }
----------------
ergawy wrote:

Can you explain how is this related to the PR?

Also, seems like we can benefit from some kind of a util to initialize `mapperIdName` and `mapperId` as I pointed above, I think this is the same as the logic in `if (mapperIdName == "default")` in `processMapObjects`. Let me know if I misunderstood something.

https://github.com/llvm/llvm-project/pull/131006


More information about the flang-commits mailing list