@@ -281,18 +281,17 @@ namespace vast::conv {
281
281
: base(mctx), models(models)
282
282
{}
283
283
284
- static std::optional< function_model > get_model (
285
- const function_models &models, string_ref name
286
- ) {
287
- if (auto kv = models.find (name); kv != models.end ()) {
284
+ static std::optional< function_model >
285
+ get_model (const function_models &models, hl::FuncOp func) {
286
+ if (auto kv = models.find (func.getSymName ()); kv != models.end ()) {
288
287
return kv->second ;
289
288
}
290
289
291
290
return std::nullopt;
292
291
}
293
292
294
- std::optional< function_model > get_model (string_ref name ) const {
295
- return get_model (models, name );
293
+ std::optional< function_model > get_model (hl::FuncOp func ) const {
294
+ return get_model (models, func );
296
295
}
297
296
298
297
const function_models ⊧
@@ -494,7 +493,7 @@ namespace vast::conv {
494
493
op_t op, adaptor_t adaptor, conversion_rewriter &rewriter
495
494
) const override {
496
495
auto func = op->getParentOfType < hl::FuncOp >();
497
- auto model = get_model (func. getSymName () );
496
+ auto model = get_model (func);
498
497
499
498
auto rty = model
500
499
? model->get_return_type (rewriter.getContext ())
@@ -534,7 +533,7 @@ namespace vast::conv {
534
533
logical_result matchAndRewrite (
535
534
op_t op, adaptor_t adaptor, conversion_rewriter &rewriter
536
535
) const override {
537
- auto tc = function_type_converter (*rewriter.getContext (), get_model (op. getSymName () ));
536
+ auto tc = function_type_converter (*rewriter.getContext (), get_model (op));
538
537
if (auto func_op = mlir::dyn_cast< core::function_op_interface >(op.getOperation ())) {
539
538
return this ->replace (func_op, rewriter, tc);
540
539
}
@@ -545,9 +544,8 @@ namespace vast::conv {
545
544
static void legalize (parser_conversion_config &cfg) {
546
545
cfg.target .addLegalOp < mlir::UnrealizedConversionCastOp >();
547
546
cfg.target .addDynamicallyLegalOp < op_t >([models = cfg.models ](op_t op) {
548
- return function_type_converter (
549
- *op.getContext (), get_model (models, op.getSymName ())
550
- ).isLegal (op.getFunctionType ());
547
+ return function_type_converter (*op.getContext (), get_model (models, op))
548
+ .isLegal (op.getFunctionType ());
551
549
});
552
550
}
553
551
};
0 commit comments