Cleanups in opt_clean
authorClifford Wolf <clifford@clifford.at>
Mon, 29 Dec 2014 04:10:19 +0000 (05:10 +0100)
committerClifford Wolf <clifford@clifford.at>
Mon, 29 Dec 2014 04:11:06 +0000 (05:11 +0100)
passes/opt/opt_clean.cc

index aabdbf01302c3fe871c94598c6befb4cbfcce3e5..c5b25816c7a1cbbf4d15a75078d4b49a7a11fb60 100644 (file)
@@ -347,16 +347,16 @@ struct OptCleanPass : public Pass {
                ct_reg.setup_internals_mem();
                ct_reg.setup_stdcells_mem();
 
-               for (auto &mod_it : design->modules_) {
-                       if (!design->selected_whole_module(mod_it.first)) {
-                               if (design->selected(mod_it.second))
-                                       log("Skipping module %s as it is only partially selected.\n", id2cstr(mod_it.second->name));
+               for (auto mod : design->modules()) {
+                       if (!design->selected_whole_module(mod->name)) {
+                               if (design->selected(mod))
+                                       log("Skipping module %s as it is only partially selected.\n", id2cstr(mod->name));
                                continue;
                        }
-                       if (mod_it.second->processes.size() > 0) {
-                               log("Skipping module %s as it contains processes.\n", mod_it.second->name.c_str());
+                       if (!mod->processes.empty()) {
+                               log("Skipping module %s as it contains processes.\n", mod->name.c_str());
                        } else {
-                               rmunused_module(mod_it.second, purge_mode, true);
+                               rmunused_module(mod, purge_mode, true);
                        }
                }
 
@@ -411,11 +411,11 @@ struct CleanPass : public Pass {
                count_rm_cells = 0;
                count_rm_wires = 0;
 
-               for (auto &mod_it : design->modules_) {
-                       if (design->selected_whole_module(mod_it.first) && mod_it.second->processes.size() == 0)
+               for (auto mod : design->modules()) {
+                       if (design->selected_whole_module(mod->name) && mod->processes.empty())
                                do {
                                        design->scratchpad_unset("opt.did_something");
-                                       rmunused_module(mod_it.second, purge_mode, false);
+                                       rmunused_module(mod, purge_mode, false);
                                } while (design->scratchpad_get_bool("opt.did_something"));
                }