3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 09:05:32 +00:00

Add specialized hash() for type dict and use a dict instead of a std::map for techmap_cache and techmap_do_cache.

This commit is contained in:
Alberto Gonzalez 2020-04-14 18:09:05 +00:00
parent 437f3fb342
commit 2fb4931e5b
No known key found for this signature in database
GPG key ID: 8395A8BA109708B2
3 changed files with 25 additions and 10 deletions

View file

@ -63,8 +63,8 @@ void apply_prefix(IdString prefix, RTLIL::SigSpec &sig, RTLIL::Module *module)
struct TechmapWorker
{
dict<IdString, void(*)(RTLIL::Module*, RTLIL::Cell*)> simplemap_mappers;
std::map<std::pair<IdString, std::map<IdString, RTLIL::Const>>, RTLIL::Module*> techmap_cache;
std::map<RTLIL::Module*, bool> techmap_do_cache;
dict<std::pair<IdString, dict<IdString, RTLIL::Const>>, RTLIL::Module*> techmap_cache;
dict<RTLIL::Module*, bool> techmap_do_cache;
std::set<RTLIL::Module*, IdString::compare_ptr_by_name<RTLIL::Module>> module_queue;
dict<Module*, SigMap> sigmaps;
@ -568,7 +568,7 @@ struct TechmapWorker
{
IdString derived_name = tpl_name;
RTLIL::Module *tpl = map->module(tpl_name);
std::map<IdString, RTLIL::Const> parameters(cell->parameters.begin(), cell->parameters.end());
dict<IdString, RTLIL::Const> parameters(cell->parameters.begin(), cell->parameters.end());
if (tpl->get_blackbox_attribute(ignore_wb))
continue;
@ -778,7 +778,7 @@ struct TechmapWorker
use_wrapper_tpl:;
// do not register techmap_wrap modules with techmap_cache
} else {
std::pair<IdString, std::map<IdString, RTLIL::Const>> key(tpl_name, parameters);
std::pair<IdString, dict<IdString, RTLIL::Const>> key(tpl_name, parameters);
if (techmap_cache.count(key) > 0) {
tpl = techmap_cache[key];
} else {