3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-02-28 02:41:29 +00:00

Speed up OptMergePass by 1.7x.

The main speedup comes from swithing from using a SHA1 hash to std::hash<std::string>. There is no need to use an expensive cryptographic hash for fingerprinting in this context.
This commit is contained in:
Rasmus Munk Larsen 2023-10-02 15:57:18 -07:00
parent 7aa26b3a0b
commit bce984fa60
3 changed files with 15 additions and 12 deletions

View file

@ -56,7 +56,7 @@ struct CellTypes
setup_stdcells_mem();
}
void setup_type(RTLIL::IdString type, const pool<RTLIL::IdString> &inputs, const pool<RTLIL::IdString> &outputs, bool is_evaluable = false)
void setup_type(const RTLIL::IdString& type, const pool<RTLIL::IdString> &inputs, const pool<RTLIL::IdString> &outputs, bool is_evaluable = false)
{
CellType ct = {type, inputs, outputs, is_evaluable};
cell_types[ct.type] = ct;
@ -298,24 +298,24 @@ struct CellTypes
cell_types.clear();
}
bool cell_known(RTLIL::IdString type) const
bool cell_known(const RTLIL::IdString& type) const
{
return cell_types.count(type) != 0;
}
bool cell_output(RTLIL::IdString type, RTLIL::IdString port) const
bool cell_output(const RTLIL::IdString& type, const RTLIL::IdString& port) const
{
auto it = cell_types.find(type);
return it != cell_types.end() && it->second.outputs.count(port) != 0;
}
bool cell_input(RTLIL::IdString type, RTLIL::IdString port) const
bool cell_input(const RTLIL::IdString& type, const RTLIL::IdString& port) const
{
auto it = cell_types.find(type);
return it != cell_types.end() && it->second.inputs.count(port) != 0;
}
bool cell_evaluable(RTLIL::IdString type) const
bool cell_evaluable(const RTLIL::IdString& type) const
{
auto it = cell_types.find(type);
return it != cell_types.end() && it->second.is_evaluable;