| 403 | } |
| 404 | |
| 405 | ParamRedistributePass::Impl::Impl(OptState& state) |
| 406 | : RecursiveSubGraphRewriteHelper{state}, |
| 407 | m_cvprop{ConstVarType::IMMUTABLE_AND_PARAM}, |
| 408 | m_uniq_reader_check{state.graph()} { |
| 409 | auto cg = state.graph().comp_graph(); |
| 410 | auto on_new_opr = [this](const cg::event::OprInserted& ev) { |
| 411 | if (!ev.is_dedup && !ev.exc) { |
| 412 | // call add_opr eagerly to avoid deep recursion |
| 413 | m_cvprop.add_opr(ev.opr); |
| 414 | } |
| 415 | }; |
| 416 | auto hdl = cg->event().register_receiver<cg::event::OprInserted>(on_new_opr); |
| 417 | apply(); |
| 418 | } |
| 419 | |
| 420 | void ParamRedistributePass::apply(OptState& state) const { |
| 421 | MIDOUT_B("ParamRedistributePass::apply") |
nothing calls this directly
no test coverage detected