From 9ff3a9f30da0cade42db433f94a408f4d9349ba2 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 29 Dec 2014 00:42:48 +0100 Subject: [PATCH] Switched most of "share" to dict<> and pool<> --- passes/opt/share.cc | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/passes/opt/share.cc b/passes/opt/share.cc index 0d1a54d97..2a81a63f5 100644 --- a/passes/opt/share.cc +++ b/passes/opt/share.cc @@ -41,7 +41,7 @@ struct ShareWorkerConfig struct ShareWorker { ShareWorkerConfig config; - std::set generic_ops; + pool generic_ops; RTLIL::Design *design; RTLIL::Module *module; @@ -69,7 +69,7 @@ struct ShareWorker void find_terminal_bits() { std::set queue_bits; - std::set visited_cells; + pool visited_cells; queue_bits.insert(modwalker.signal_outputs.begin(), modwalker.signal_outputs.end()); @@ -161,7 +161,7 @@ struct ShareWorker } int share_macc_ports(Macc::port_t &p1, Macc::port_t &p2, int w1, int w2, - RTLIL::SigSpec act = RTLIL::SigSpec(), Macc *supermacc = nullptr, std::set *supercell_aux = nullptr) + RTLIL::SigSpec act = RTLIL::SigSpec(), Macc *supermacc = nullptr, pool *supercell_aux = nullptr) { if (p1.do_subtract != p2.do_subtract) return -1; @@ -237,7 +237,7 @@ struct ShareWorker } int share_macc(RTLIL::Cell *c1, RTLIL::Cell *c2, - RTLIL::SigSpec act = RTLIL::SigSpec(), RTLIL::Cell *supercell = nullptr, std::set *supercell_aux = nullptr) + RTLIL::SigSpec act = RTLIL::SigSpec(), RTLIL::Cell *supercell = nullptr, pool *supercell_aux = nullptr) { Macc m1(c1), m2(c2), supermacc; @@ -345,7 +345,7 @@ struct ShareWorker // Find shareable cells and compatible groups of cells // --------------------------------------------------- - std::set> shareable_cells; + pool shareable_cells; void find_shareable_cells() { @@ -501,7 +501,7 @@ struct ShareWorker // Create replacement cell // ----------------------- - RTLIL::Cell *make_supercell(RTLIL::Cell *c1, RTLIL::Cell *c2, RTLIL::SigSpec act, std::set &supercell_aux) + RTLIL::Cell *make_supercell(RTLIL::Cell *c1, RTLIL::Cell *c2, RTLIL::SigSpec act, pool &supercell_aux) { log_assert(c1->type == c2->type); @@ -718,7 +718,7 @@ struct ShareWorker // Finding forbidden control inputs for a cell // ------------------------------------------- - std::map> forbidden_controls_cache; + dict> forbidden_controls_cache; const std::set &find_forbidden_controls(RTLIL::Cell *cell) { @@ -760,6 +760,7 @@ struct ShareWorker // Finding control inputs and activation pattern for a cell // -------------------------------------------------------- + // FIXME: For some reasone this must be std::map<> and not dict<> std::map>> activation_patterns_cache; bool sort_check_activation_pattern(std::pair &p) @@ -911,7 +912,7 @@ struct ShareWorker } } - RTLIL::SigSpec make_cell_activation_logic(const std::set> &activation_patterns, std::set &supercell_aux) + RTLIL::SigSpec make_cell_activation_logic(const std::set> &activation_patterns, pool &supercell_aux) { RTLIL::Wire *all_cases_wire = module->addWire(NEW_ID, 0); @@ -945,8 +946,8 @@ struct ShareWorker topo_sigmap.set(module); topo_bit_drivers.clear(); - std::map> cell_to_bits; - std::map> bit_to_cells; + dict> cell_to_bits; + dict> bit_to_cells; for (auto cell : module->cells()) if (ct.cell_known(cell->type)) @@ -983,7 +984,7 @@ struct ShareWorker return found_scc; } - bool find_in_input_cone_worker(RTLIL::Cell *root, RTLIL::Cell *needle, std::set &stop) + bool find_in_input_cone_worker(RTLIL::Cell *root, RTLIL::Cell *needle, pool &stop) { if (root == needle) return true; @@ -1001,7 +1002,7 @@ struct ShareWorker bool find_in_input_cone(RTLIL::Cell *root, RTLIL::Cell *needle) { - std::set stop; + pool stop; return find_in_input_cone_worker(root, needle, stop); } @@ -1011,12 +1012,12 @@ struct ShareWorker ct.setup_internals(); ct.setup_stdcells(); - std::set queue, covered; + pool queue, covered; queue.insert(cell); while (!queue.empty()) { - std::set new_queue; + pool new_queue; for (auto c : queue) { if (!ct.cell_known(c->type)) @@ -1170,7 +1171,7 @@ struct ShareWorker ezDefaultSAT ez; SatGen satgen(&ez, &modwalker.sigmap); - std::set sat_cells; + pool sat_cells; std::set bits_queue; std::vector cell_active, other_cell_active; @@ -1277,7 +1278,7 @@ struct ShareWorker other_cell_select_score += p.first.size(); RTLIL::Cell *supercell; - std::set supercell_aux; + pool supercell_aux; if (cell_select_score <= other_cell_select_score) { RTLIL::SigSpec act = make_cell_activation_logic(filtered_cell_activation_patterns, supercell_aux); supercell = make_supercell(cell, other_cell, act, supercell_aux); -- 2.30.2