YosysHQ / yosys

Yosys Open SYnthesis Suite
https://yosyshq.net/yosys/
ISC License
3.51k stars 895 forks source link

functional, glift: use fold overload of IdString::in instead of pool … #4709

Closed widlarizer closed 1 week ago

widlarizer commented 2 weeks ago

…literals

We have the following methods:

template<typename... Args>
bool IdString::in(Args... args) const;
bool IdString::in(const pool<IdString> &rhs) const;

The celltype.in(ID($add), ...) pattern uses the former while celltype.in({ID($add), ...}) forces the latter since the argument is an std::initializer_list<pool<IdString>>. The former probably has lower runtime overhead since instead of hashing and resizing a hash table it just finds the celltype in a compile-time known list of IDs, so we can switch to it whenever manually listing like a dozen IDs to check against.