From: Clifford Wolf Date: Tue, 27 Oct 2015 18:15:35 +0000 (+0100) Subject: Use mfp<> in equiv_mark X-Git-Tag: yosys-0.6~80 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0c202a254963846626eef492059723bc2aa70dd0;p=yosys.git Use mfp<> in equiv_mark --- diff --git a/passes/equiv/equiv_mark.cc b/passes/equiv/equiv_mark.cc index da61678df..3e9819d1a 100644 --- a/passes/equiv/equiv_mark.cc +++ b/passes/equiv/equiv_mark.cc @@ -42,31 +42,7 @@ struct EquivMarkWorker int next_region; // merge-find - dict region_mf; - - int region_find(int r) - { - vector backlog; - - while (region_mf.count(r)) { - backlog.push_back(r); - r = region_mf.at(r); - } - - for (int q : backlog) - region_mf[q] = r; - - return r; - } - - void region_merge(int r, int q) - { - r = region_find(r); - q = region_find(q); - - if (r != q) - region_mf[r] = q; - } + mfp region_mf; EquivMarkWorker(Module *module) : module(module), sigmap(module) { @@ -116,7 +92,7 @@ struct EquivMarkWorker if (cell_regions.count(cell)) { if (cell_regions.at(cell) != 0) - region_merge(cell_regions.at(cell), next_region); + region_mf.merge(cell_regions.at(cell), next_region); continue; } @@ -190,7 +166,7 @@ struct EquivMarkWorker dict region_wire_count; for (int i = 0; i < next_region; i++) { - int r = region_find(i); + int r = region_mf.find(i); if (final_region_map.count(r) == 0) final_region_map[r] = next_final_region++; final_region_map[i] = final_region_map[r]; @@ -211,7 +187,7 @@ struct EquivMarkWorker pool regions; for (auto bit : sigmap(wire)) if (bit_regions.count(bit)) - regions.insert(region_find(bit_regions.at(bit))); + regions.insert(region_mf.find(bit_regions.at(bit))); if (GetSize(regions) == 1) { int r = final_region_map.at(*regions.begin());