================ @@ -2701,7 +2701,42 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable, semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval, const parser::OpenMPDeclareMapperConstruct &declareMapperConstruct) { - TODO(converter.getCurrentLocation(), "OpenMPDeclareMapperConstruct"); + fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); + lower::StatementContext stmtCtx; + const auto &spec = + std::get<parser::OmpDeclareMapperSpecifier>(declareMapperConstruct.t); + const auto &mapperName{std::get<std::optional<parser::Name>>(spec.t)}; + const auto &varType{std::get<parser::TypeSpec>(spec.t)}; + const auto &varName{std::get<parser::Name>(spec.t)}; + assert(varType.declTypeSpec->category() == + semantics::DeclTypeSpec::Category::TypeDerived && + "Expected derived type"); + + std::string mapperNameStr; + if (mapperName.has_value()) + mapperNameStr = mapperName->ToString(); + else + mapperNameStr = + "default_" + varType.declTypeSpec->derivedTypeSpec().name().ToString(); + + mlir::OpBuilder::InsertPoint insPt = firOpBuilder.saveInsertionPoint(); + firOpBuilder.setInsertionPointToStart(converter.getModuleOp().getBody()); + auto mlirType = converter.genType(varType.declTypeSpec->derivedTypeSpec()); + auto varVal = firOpBuilder.createTemporaryAlloc( + converter.getCurrentLocation(), mlirType, varName.ToString()); ---------------- kiranchandramohan wrote:
Besides the representation, we should also clarify -> where we create the map_entries for the relevant operations (like target) for which the declare mapper implicitly applies -> where the composition of map-types (map-type decay) from the map clause of declare mapper and the map clause of the relevant operation (like target) happens Note: All these are for discussion and should be treated as suggestions. https://github.com/llvm/llvm-project/pull/117046 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits