From b9b9515bb06d29229b90af8af92215d59a4649c1 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Tue, 19 Nov 2024 20:04:19 +0100 Subject: [PATCH] hashlib: hash_eat -> hash_into --- docs/source/yosys_internals/hashing.rst | 10 ++--- frontends/ast/ast.h | 2 +- kernel/bitpattern.h | 2 +- kernel/cellaigs.cc | 4 +- kernel/cellaigs.h | 4 +- kernel/drivertools.h | 48 +++++++++++----------- kernel/functional.h | 4 +- kernel/hashlib.h | 54 ++++++++++++------------- kernel/modtools.h | 4 +- kernel/rtlil.h | 24 +++++------ kernel/scopeinfo.h | 4 +- kernel/sigtools.h | 4 +- kernel/timinginfo.h | 4 +- kernel/yosys_common.h | 2 +- kernel/yw.h | 2 +- passes/cmds/dft_tag.cc | 2 +- passes/cmds/example_dt.cc | 2 +- passes/equiv/equiv_struct.cc | 2 +- passes/proc/proc_dlatch.cc | 2 +- passes/sat/recover_names.cc | 4 +- passes/techmap/clockgate.cc | 2 +- passes/techmap/flowmap.cc | 2 +- techlibs/quicklogic/ql_dsp_simd.cc | 2 +- 23 files changed, 95 insertions(+), 95 deletions(-) diff --git a/docs/source/yosys_internals/hashing.rst b/docs/source/yosys_internals/hashing.rst index 0e3e5fc90cb..338ee5fd681 100644 --- a/docs/source/yosys_internals/hashing.rst +++ b/docs/source/yosys_internals/hashing.rst @@ -98,13 +98,13 @@ Making a type hashable Let's first take a look at the external interface on a simplified level. Generally, to get the hash for ``T obj``, you would call the utility function ``run_hash(const T& obj)``, corresponding to ``hash_top_ops::hash(obj)``, -the default implementation of which is ``hash_ops::hash_eat(Hasher(), obj)``. +the default implementation of which is ``hash_ops::hash_into(Hasher(), obj)``. ``Hasher`` is the class actually implementing the hash function, hiding its initialized internal state, and passing it out on ``hash_t yield()`` with perhaps some finalization steps. ``hash_ops`` is the star of the show. By default it pulls the ``Hasher h`` -through a ``Hasher T::hash_eat(Hasher h)`` method. That's the method you have to +through a ``Hasher T::hash_into(Hasher h)`` method. That's the method you have to implement to make a record (class or struct) type easily hashable with Yosys hashlib associative data structures. @@ -113,10 +113,10 @@ treats pointers the same as integers, so it doesn't dereference pointers. Since many RTLIL data structures like ``RTLIL::Wire`` carry their own unique index ``Hasher::hash_t hashidx_;``, there are specializations for ``hash_ops`` and others in ``kernel/hashlib.h`` that actually dereference the pointers and -call ``hash_eat`` on the instances pointed to. +call ``hash_into`` on the instances pointed to. ``hash_ops`` is also specialized for simple compound types like -``std::pair`` by calling hash_eat in sequence on its members. For flexible +``std::pair`` by calling hash_into in sequence on its members. For flexible size containers like ``std::vector`` the size of the container is hashed first. That is also how implementing hashing for a custom record data type should be - unless there is strong reason to do otherwise, call ``h.eat(m)`` on @@ -143,7 +143,7 @@ based on the existance and value of `YS_HASHING_VERSION`. return mkhash(a, b); } #elif YS_HASHING_VERSION == 1 - Hasher T::hash_eat(Hasher h) const { + Hasher T::hash_into(Hasher h) const { h.eat(a); h.eat(b); return h; diff --git a/frontends/ast/ast.h b/frontends/ast/ast.h index 47221903481..f7f087080ba 100644 --- a/frontends/ast/ast.h +++ b/frontends/ast/ast.h @@ -177,7 +177,7 @@ namespace AST { // for dict<> and pool<> unsigned int hashidx_; - Hasher hash_eat(Hasher h) const { h.eat(hashidx_); return h; } + Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; } // this nodes type AstNodeType type; diff --git a/kernel/bitpattern.h b/kernel/bitpattern.h index 7752acc4297..a9dc98a3348 100644 --- a/kernel/bitpattern.h +++ b/kernel/bitpattern.h @@ -43,7 +43,7 @@ struct BitPatternPool return false; return bitdata == other.bitdata; } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { if (!cached_hash) cached_hash = run_hash(bitdata); h.eat(cached_hash); diff --git a/kernel/cellaigs.cc b/kernel/cellaigs.cc index 63bbbca3704..fd3c7bb67cd 100644 --- a/kernel/cellaigs.cc +++ b/kernel/cellaigs.cc @@ -39,7 +39,7 @@ bool AigNode::operator==(const AigNode &other) const return true; } -Hasher AigNode::hash_eat(Hasher h) const +Hasher AigNode::hash_into(Hasher h) const { h.eat(portname); h.eat(portbit); @@ -54,7 +54,7 @@ bool Aig::operator==(const Aig &other) const return name == other.name; } -Hasher Aig::hash_eat(Hasher h) const +Hasher Aig::hash_into(Hasher h) const { h.eat(name); return h; diff --git a/kernel/cellaigs.h b/kernel/cellaigs.h index 8d3f0312002..dd1b6dde650 100644 --- a/kernel/cellaigs.h +++ b/kernel/cellaigs.h @@ -34,7 +34,7 @@ struct AigNode AigNode(); bool operator==(const AigNode &other) const; - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; }; struct Aig @@ -44,7 +44,7 @@ struct Aig Aig(Cell *cell); bool operator==(const Aig &other) const; - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; }; YOSYS_NAMESPACE_END diff --git a/kernel/drivertools.h b/kernel/drivertools.h index b46c1e2b60a..19c9c2e34d4 100644 --- a/kernel/drivertools.h +++ b/kernel/drivertools.h @@ -74,7 +74,7 @@ struct DriveBitWire return offset < other.offset; } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; operator SigBit() const @@ -105,7 +105,7 @@ struct DriveBitPort return offset < other.offset; } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; }; @@ -129,7 +129,7 @@ struct DriveBitMarker return offset < other.offset; } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; }; @@ -164,7 +164,7 @@ struct DriveBitMultiple return multiple_ == other.multiple_; } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; }; struct DriveBit @@ -352,7 +352,7 @@ struct DriveBit return *this; } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; bool operator==(const DriveBit &other) const { @@ -473,7 +473,7 @@ struct DriveChunkWire return offset < other.offset; } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; explicit operator SigChunk() const { @@ -531,7 +531,7 @@ struct DriveChunkPort return offset < other.offset; } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; }; @@ -572,7 +572,7 @@ struct DriveChunkMarker return offset < other.offset; } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; }; struct DriveChunkMultiple @@ -612,7 +612,7 @@ struct DriveChunkMultiple return false; // TODO implement, canonicalize order } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; }; struct DriveChunk @@ -863,7 +863,7 @@ struct DriveChunk bool try_append(DriveBit const &bit); bool try_append(DriveChunk const &chunk); - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; bool operator==(const DriveChunk &other) const { @@ -1073,7 +1073,7 @@ struct DriveSpec that->hash_ |= (that->hash_ == 0); } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; bool operator==(DriveSpec const &other) const { updhash(); @@ -1112,7 +1112,7 @@ struct DriverMap bool operator!=(const DriveBitId &other) const { return id != other.id; } bool operator<(const DriveBitId &other) const { return id < other.id; } // unsigned int hash() const { return id; } - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; }; // Essentially a dict> but using less memory // and fewer allocations @@ -1258,14 +1258,14 @@ struct DriverMap } }; -inline Hasher DriveBitWire::hash_eat(Hasher h) const +inline Hasher DriveBitWire::hash_into(Hasher h) const { h.eat(wire->name); h.eat(offset); return h; } -inline Hasher DriveBitPort::hash_eat(Hasher h) const +inline Hasher DriveBitPort::hash_into(Hasher h) const { h.eat(cell->name); h.eat(port); @@ -1273,20 +1273,20 @@ inline Hasher DriveBitPort::hash_eat(Hasher h) const return h; } -inline Hasher DriveBitMarker::hash_eat(Hasher h) const +inline Hasher DriveBitMarker::hash_into(Hasher h) const { h.eat(marker); h.eat(offset); return h; } -inline Hasher DriveBitMultiple::hash_eat(Hasher h) const +inline Hasher DriveBitMultiple::hash_into(Hasher h) const { h.eat(multiple_); return h; } -inline Hasher DriveBit::hash_eat(Hasher h) const +inline Hasher DriveBit::hash_into(Hasher h) const { switch (type_) { case DriveType::NONE: @@ -1312,7 +1312,7 @@ inline Hasher DriveBit::hash_eat(Hasher h) const return h; } -inline Hasher DriveChunkWire::hash_eat(Hasher h) const +inline Hasher DriveChunkWire::hash_into(Hasher h) const { h.eat(wire->name); h.eat(width); @@ -1320,7 +1320,7 @@ inline Hasher DriveChunkWire::hash_eat(Hasher h) const return h; } -inline Hasher DriveChunkPort::hash_eat(Hasher h) const +inline Hasher DriveChunkPort::hash_into(Hasher h) const { h.eat(cell->name); h.eat(port); @@ -1329,7 +1329,7 @@ inline Hasher DriveChunkPort::hash_eat(Hasher h) const return h; } -inline Hasher DriveChunkMarker::hash_eat(Hasher h) const +inline Hasher DriveChunkMarker::hash_into(Hasher h) const { h.eat(marker); h.eat(width); @@ -1337,14 +1337,14 @@ inline Hasher DriveChunkMarker::hash_eat(Hasher h) const return h; } -inline Hasher DriveChunkMultiple::hash_eat(Hasher h) const +inline Hasher DriveChunkMultiple::hash_into(Hasher h) const { h.eat(width_); h.eat(multiple_); return h; } -inline Hasher DriveChunk::hash_eat(Hasher h) const +inline Hasher DriveChunk::hash_into(Hasher h) const { switch (type_) { case DriveType::NONE: @@ -1370,7 +1370,7 @@ inline Hasher DriveChunk::hash_eat(Hasher h) const return h; } -inline Hasher DriveSpec::hash_eat(Hasher h) const +inline Hasher DriveSpec::hash_into(Hasher h) const { if (hash_ == 0) updhash(); @@ -1379,7 +1379,7 @@ inline Hasher DriveSpec::hash_eat(Hasher h) const return h; } -inline Hasher DriverMap::DriveBitId::hash_eat(Hasher h) const +inline Hasher DriverMap::DriveBitId::hash_into(Hasher h) const { h.eat(id); return h; diff --git a/kernel/functional.h b/kernel/functional.h index 790190e08ae..e132821405b 100644 --- a/kernel/functional.h +++ b/kernel/functional.h @@ -151,7 +151,7 @@ namespace Functional { // returns the data width of a bitvector sort, errors out for other sorts int data_width() const { return std::get<1>(_v).second; } bool operator==(Sort const& other) const { return _v == other._v; } - Hasher hash_eat(Hasher h) const { h.eat(_v); return h; } + Hasher hash_into(Hasher h) const { h.eat(_v); return h; } }; class IR; class Factory; @@ -225,7 +225,7 @@ namespace Functional { const RTLIL::Const &as_const() const { return std::get(_extra); } std::pair as_idstring_pair() const { return std::get>(_extra); } int as_int() const { return std::get(_extra); } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat((unsigned int) _fn); h.eat(_extra); return h; diff --git a/kernel/hashlib.h b/kernel/hashlib.h index f9271bd7f86..5b1a2a877d3 100644 --- a/kernel/hashlib.h +++ b/kernel/hashlib.h @@ -128,12 +128,12 @@ class HasherDJB32 { template void eat(T&& t) { - *this = hash_ops>>::hash_eat(std::forward(t), *this); + *this = hash_ops>>::hash_into(std::forward(t), *this); } template void eat(const T& t) { - *this = hash_ops::hash_eat(t, *this); + *this = hash_ops::hash_into(t, *this); } void commutative_eat(hash_t t) { @@ -153,7 +153,7 @@ struct hash_top_ops { return hash_ops::cmp(a, b); } static inline Hasher hash(const T &a) { - return hash_ops::hash_eat(a, Hasher()); + return hash_ops::hash_into(a, Hasher()); } }; @@ -162,7 +162,7 @@ struct hash_ops { static inline bool cmp(const T &a, const T &b) { return a == b; } - static inline Hasher hash_eat(const T &a, Hasher h) { + static inline Hasher hash_into(const T &a, Hasher h) { if constexpr (std::is_same_v) { h.hash32(a ? 1 : 0); return h; @@ -175,15 +175,15 @@ struct hash_ops { return h; } else if constexpr (std::is_enum_v) { using u_type = std::underlying_type_t; - return hash_ops::hash_eat((u_type) a, h); + return hash_ops::hash_into((u_type) a, h); } else if constexpr (std::is_pointer_v) { - return hash_ops::hash_eat((uintptr_t) a, h); + return hash_ops::hash_into((uintptr_t) a, h); } else if constexpr (std::is_same_v) { for (auto c : a) h.hash32(c); return h; } else { - return a.hash_eat(h); + return a.hash_into(h); } } }; @@ -192,9 +192,9 @@ template struct hash_ops> { static inline bool cmp(std::pair a, std::pair b) { return a == b; } - static inline Hasher hash_eat(std::pair a, Hasher h) { - h = hash_ops

::hash_eat(a.first, h); - h = hash_ops::hash_eat(a.second, h); + static inline Hasher hash_into(std::pair a, Hasher h) { + h = hash_ops

::hash_into(a.first, h); + h = hash_ops::hash_into(a.second, h); return h; } }; @@ -204,14 +204,14 @@ template struct hash_ops> { return a == b; } template - static inline typename std::enable_if::type hash_eat(std::tuple, Hasher h) { + static inline typename std::enable_if::type hash_into(std::tuple, Hasher h) { return h; } template - static inline typename std::enable_if::type hash_eat(std::tuple a, Hasher h) { + static inline typename std::enable_if::type hash_into(std::tuple a, Hasher h) { typedef hash_ops>::type> element_ops_t; - h = hash_eat(a, h); - h = element_ops_t::hash_eat(std::get(a), h); + h = hash_into(a, h); + h = element_ops_t::hash_into(std::get(a), h); return h; } }; @@ -220,7 +220,7 @@ template struct hash_ops> { static inline bool cmp(std::vector a, std::vector b) { return a == b; } - static inline Hasher hash_eat(std::vector a, Hasher h) { + static inline Hasher hash_into(std::vector a, Hasher h) { h.eat(a.size()); for (auto k : a) h.eat(k); @@ -232,9 +232,9 @@ template struct hash_ops> { static inline bool cmp(std::array a, std::array b) { return a == b; } - static inline Hasher hash_eat(std::array a, Hasher h) { + static inline Hasher hash_into(std::array a, Hasher h) { for (const auto& k : a) - h = hash_ops::hash_eat(k, h); + h = hash_ops::hash_into(k, h); return h; } }; @@ -246,7 +246,7 @@ struct hash_cstr_ops { return false; return true; } - static inline Hasher hash_eat(const char *a, Hasher h) { + static inline Hasher hash_into(const char *a, Hasher h) { while (*a) h.hash32(*(a++)); return h; @@ -259,8 +259,8 @@ struct hash_ptr_ops { static inline bool cmp(const void *a, const void *b) { return a == b; } - static inline Hasher hash_eat(const void *a, Hasher h) { - return hash_ops::hash_eat((uintptr_t)a, h); + static inline Hasher hash_into(const void *a, Hasher h) { + return hash_ops::hash_into((uintptr_t)a, h); } }; @@ -269,8 +269,8 @@ struct hash_obj_ops { return a == b; } template - static inline Hasher hash_eat(const T *a, Hasher h) { - return a ? a->hash_eat(h) : h; + static inline Hasher hash_into(const T *a, Hasher h) { + return a ? a->hash_into(h) : h; } }; /** @@ -297,7 +297,7 @@ template<> struct hash_ops { static inline bool cmp(std::monostate a, std::monostate b) { return a == b; } - static inline Hasher hash_eat(std::monostate, Hasher h) { + static inline Hasher hash_into(std::monostate, Hasher h) { return h; } }; @@ -306,7 +306,7 @@ template struct hash_ops> { static inline bool cmp(std::variant a, std::variant b) { return a == b; } - static inline Hasher hash_eat(std::variant a, Hasher h) { + static inline Hasher hash_into(std::variant a, Hasher h) { std::visit([& h](const auto &v) { h.eat(v); }, a); h.eat(a.index()); return h; @@ -317,7 +317,7 @@ template struct hash_ops> { static inline bool cmp(std::optional a, std::optional b) { return a == b; } - static inline Hasher hash_eat(std::optional a, Hasher h) { + static inline Hasher hash_into(std::optional a, Hasher h) { if(a.has_value()) h.eat(*a); else @@ -790,7 +790,7 @@ class dict { return !operator==(other); } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(entries.size()); for (auto &it : entries) { Hasher entry_hash; @@ -1160,7 +1160,7 @@ class pool return !operator==(other); } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(entries.size()); for (auto &it : entries) { h.commutative_eat(ops.hash(it.udata).yield()); diff --git a/kernel/modtools.h b/kernel/modtools.h index fce22d8579d..0ed858e3739 100644 --- a/kernel/modtools.h +++ b/kernel/modtools.h @@ -48,7 +48,7 @@ struct ModIndex : public RTLIL::Monitor return cell == other.cell && port == other.port && offset == other.offset; } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(cell->name); h.eat(port); h.eat(offset); @@ -324,7 +324,7 @@ struct ModWalker return cell == other.cell && port == other.port && offset == other.offset; } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(cell->name); h.eat(port); h.eat(offset); diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 2b3d274a2e9..0f4bec7b065 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -362,7 +362,7 @@ struct RTLIL::IdString *this = IdString(); } - Hasher hash_eat(Hasher h) const { return hash_ops::hash_eat(index_, h); } + Hasher hash_into(Hasher h) const { return hash_ops::hash_into(index_, h); } Hasher hash_top() const { Hasher h; @@ -815,7 +815,7 @@ struct RTLIL::Const bv.resize(width, bv.empty() ? RTLIL::State::Sx : bv.back()); } - inline Hasher hash_eat(Hasher h) const { + inline Hasher hash_into(Hasher h) const { // TODO hash size for (auto b : *this) h.eat(b); @@ -908,7 +908,7 @@ struct RTLIL::SigBit bool operator <(const RTLIL::SigBit &other) const; bool operator ==(const RTLIL::SigBit &other) const; bool operator !=(const RTLIL::SigBit &other) const; - Hasher hash_eat(Hasher h) const; + Hasher hash_into(Hasher h) const; Hasher hash_top() const; }; @@ -1115,7 +1115,7 @@ struct RTLIL::SigSpec operator std::vector() const { return bits(); } const RTLIL::SigBit &at(int offset, const RTLIL::SigBit &defval) { return offset < width_ ? (*this)[offset] : defval; } - Hasher hash_eat(Hasher h) const { if (!hash_) updhash(); h.eat(hash_); return h; } + Hasher hash_into(Hasher h) const { if (!hash_) updhash(); h.eat(hash_); return h; } #ifndef NDEBUG void check(Module *mod = nullptr) const; @@ -1157,7 +1157,7 @@ struct RTLIL::Selection struct RTLIL::Monitor { Hasher::hash_t hashidx_; - Hasher hash_eat(Hasher h) const { h.eat(hashidx_); return h; } + Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; } Monitor() { static unsigned int hashidx_count = 123456789; @@ -1180,7 +1180,7 @@ struct define_map_t; struct RTLIL::Design { Hasher::hash_t hashidx_; - Hasher hash_eat(Hasher h) const { h.eat(hashidx_); return h; } + Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; } pool monitors; dict scratchpad; @@ -1285,7 +1285,7 @@ struct RTLIL::Design struct RTLIL::Module : public RTLIL::AttrObject { Hasher::hash_t hashidx_; - Hasher hash_eat(Hasher h) const { h.eat(hashidx_); return h; } + Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; } protected: void add(RTLIL::Wire *wire); @@ -1640,7 +1640,7 @@ void dump_wire(std::ostream &f, std::string indent, const RTLIL::Wire *wire); struct RTLIL::Wire : public RTLIL::AttrObject { Hasher::hash_t hashidx_; - Hasher hash_eat(Hasher h) const { h.eat(hashidx_); return h; } + Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; } protected: // use module->addWire() and module->remove() to create or destroy wires @@ -1679,7 +1679,7 @@ inline int GetSize(RTLIL::Wire *wire) { struct RTLIL::Memory : public RTLIL::AttrObject { Hasher::hash_t hashidx_; - Hasher hash_eat(Hasher h) const { h.eat(hashidx_); return h; } + Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; } Memory(); @@ -1694,7 +1694,7 @@ struct RTLIL::Memory : public RTLIL::AttrObject struct RTLIL::Cell : public RTLIL::AttrObject { Hasher::hash_t hashidx_; - Hasher hash_eat(Hasher h) const { h.eat(hashidx_); return h; } + Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; } protected: // use module->addCell() and module->remove() to create or destroy cells @@ -1804,7 +1804,7 @@ struct RTLIL::SyncRule struct RTLIL::Process : public RTLIL::AttrObject { Hasher::hash_t hashidx_; - Hasher hash_eat(Hasher h) const { h.eat(hashidx_); return h; } + Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; } protected: // use module->addProcess() and module->remove() to create or destroy processes @@ -1848,7 +1848,7 @@ inline bool RTLIL::SigBit::operator!=(const RTLIL::SigBit &other) const { return (wire != other.wire) || (wire ? (offset != other.offset) : (data != other.data)); } -inline Hasher RTLIL::SigBit::hash_eat(Hasher h) const { +inline Hasher RTLIL::SigBit::hash_into(Hasher h) const { if (wire) { h.eat(offset); h.eat(wire->name); diff --git a/kernel/scopeinfo.h b/kernel/scopeinfo.h index 3c9ca69b690..f3ae0d7b682 100644 --- a/kernel/scopeinfo.h +++ b/kernel/scopeinfo.h @@ -169,7 +169,7 @@ class IdTree return !(*this == other); } - Hasher hash_acc(Hasher h) const + Hasher hash_into(Hasher h) const { h.eat(scope_name); h.eat(target); @@ -325,7 +325,7 @@ struct ModuleItem { Cell *cell() const { return type == Type::Cell ? static_cast(ptr) : nullptr; } bool operator==(const ModuleItem &other) const { return ptr == other.ptr && type == other.type; } - Hasher hash_eat(Hasher h) const { h.eat(ptr); return h; } + Hasher hash_into(Hasher h) const { h.eat(ptr); return h; } }; static inline void log_dump_val_worker(typename IdTree::Cursor cursor ) { log("%p %s", cursor.target, log_id(cursor.scope_name)); } diff --git a/kernel/sigtools.h b/kernel/sigtools.h index c827807aadb..a22685ee2c3 100644 --- a/kernel/sigtools.h +++ b/kernel/sigtools.h @@ -29,7 +29,7 @@ struct SigPool struct bitDef_t : public std::pair { bitDef_t() : std::pair(NULL, 0) { } bitDef_t(const RTLIL::SigBit &bit) : std::pair(bit.wire, bit.offset) { } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(first->name); h.eat(second); return h; @@ -147,7 +147,7 @@ struct SigSet struct bitDef_t : public std::pair { bitDef_t() : std::pair(NULL, 0) { } bitDef_t(const RTLIL::SigBit &bit) : std::pair(bit.wire, bit.offset) { } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(first->name); h.eat(second); return h; diff --git a/kernel/timinginfo.h b/kernel/timinginfo.h index e294d29a7e5..677bbecb85d 100644 --- a/kernel/timinginfo.h +++ b/kernel/timinginfo.h @@ -44,7 +44,7 @@ struct TimingInfo return {}; return port[offset]; } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(name); h.eat(offset); return h; @@ -56,7 +56,7 @@ struct TimingInfo BitBit(const NameBit &first, const NameBit &second) : first(first), second(second) {} BitBit(const SigBit &first, const SigBit &second) : first(first), second(second) {} bool operator==(const BitBit& bb) const { return bb.first == first && bb.second == second; } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(first); h.eat(second); return h; diff --git a/kernel/yosys_common.h b/kernel/yosys_common.h index b194718f113..e0bd91ec897 100644 --- a/kernel/yosys_common.h +++ b/kernel/yosys_common.h @@ -171,7 +171,7 @@ struct shared_str { const char *c_str() const { return content->c_str(); } const string &str() const { return *content; } bool operator==(const shared_str &other) const { return *content == *other.content; } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(*content); return h; } diff --git a/kernel/yw.h b/kernel/yw.h index e16d4986609..34546d1e246 100644 --- a/kernel/yw.h +++ b/kernel/yw.h @@ -35,7 +35,7 @@ struct IdPath : public std::vector bool has_address() const { int tmp; return get_address(tmp); }; bool get_address(int &addr) const; - Hasher hash_eat(Hasher h) const { h.eat(*this); return h; } + Hasher hash_into(Hasher h) const { h.eat(*this); return h; } }; struct WitnessHierarchyItem { diff --git a/passes/cmds/dft_tag.cc b/passes/cmds/dft_tag.cc index 2a5fb690efb..cecab4d61da 100644 --- a/passes/cmds/dft_tag.cc +++ b/passes/cmds/dft_tag.cc @@ -47,7 +47,7 @@ struct DftTagWorker { bool operator<(const tag_set &other) const { return index < other.index; } bool operator==(const tag_set &other) const { return index == other.index; } - Hasher hash_eat(Hasher h) const { h.eat(index); return h; } + Hasher hash_into(Hasher h) const { h.eat(index); return h; } bool empty() const { return index == 0; } }; diff --git a/passes/cmds/example_dt.cc b/passes/cmds/example_dt.cc index 7cd1d2f24a5..5f5246de67b 100644 --- a/passes/cmds/example_dt.cc +++ b/passes/cmds/example_dt.cc @@ -52,7 +52,7 @@ struct ExampleDtPass : public Pass return name == other.name && parameters == other.parameters; } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(name); h.eat(parameters); return h; diff --git a/passes/equiv/equiv_struct.cc b/passes/equiv/equiv_struct.cc index 774c5a1a607..195cb342448 100644 --- a/passes/equiv/equiv_struct.cc +++ b/passes/equiv/equiv_struct.cc @@ -46,7 +46,7 @@ struct EquivStructWorker parameters == other.parameters && port_sizes == other.port_sizes; } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(type); h.eat(parameters); h.eat(port_sizes); diff --git a/passes/proc/proc_dlatch.cc b/passes/proc/proc_dlatch.cc index 6b579b4e4cc..2e41afd09c6 100644 --- a/passes/proc/proc_dlatch.cc +++ b/passes/proc/proc_dlatch.cc @@ -127,7 +127,7 @@ struct proc_dlatch_db_t return signal == other.signal && match == other.match && children == other.children; } - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { h.eat(signal); h.eat(match); h.eat(children); diff --git a/passes/sat/recover_names.cc b/passes/sat/recover_names.cc index a84380cbf5c..c18beafa1ee 100644 --- a/passes/sat/recover_names.cc +++ b/passes/sat/recover_names.cc @@ -46,7 +46,7 @@ struct IdBit { bool operator==(const IdBit &other) const { return name == other.name && bit == other.bit; }; bool operator!=(const IdBit &other) const { return name != other.name || bit != other.bit; }; - Hasher hash_eat(Hasher h) const + Hasher hash_into(Hasher h) const { h.eat(name); h.eat(bit); @@ -64,7 +64,7 @@ struct InvBit { bool operator==(const InvBit &other) const { return bit == other.bit && inverted == other.inverted; }; bool operator!=(const InvBit &other) const { return bit != other.bit || inverted != other.inverted; }; - Hasher hash_eat(Hasher h) const + Hasher hash_into(Hasher h) const { h.eat(bit); h.eat(inverted); diff --git a/passes/techmap/clockgate.cc b/passes/techmap/clockgate.cc index bfd4c8a9724..bdfb94170d8 100644 --- a/passes/techmap/clockgate.cc +++ b/passes/techmap/clockgate.cc @@ -233,7 +233,7 @@ struct ClockgatePass : public Pass { SigBit ce_bit; bool pol_clk; bool pol_ce; - Hasher hash_eat(Hasher h) const { + Hasher hash_into(Hasher h) const { auto t = std::make_tuple(clk_bit, ce_bit, pol_clk, pol_ce); h.eat(t); return h; diff --git a/passes/techmap/flowmap.cc b/passes/techmap/flowmap.cc index bfee38999cc..00d5369e4e0 100644 --- a/passes/techmap/flowmap.cc +++ b/passes/techmap/flowmap.cc @@ -250,7 +250,7 @@ struct FlowGraph { return !(*this == other); } - Hasher hash_eat(Hasher h) const + Hasher hash_into(Hasher h) const { std::pair p = {node, is_bottom}; h.eat(p); diff --git a/techlibs/quicklogic/ql_dsp_simd.cc b/techlibs/quicklogic/ql_dsp_simd.cc index 162f0c2d683..bda7fb3bd24 100644 --- a/techlibs/quicklogic/ql_dsp_simd.cc +++ b/techlibs/quicklogic/ql_dsp_simd.cc @@ -53,7 +53,7 @@ struct QlDspSimdPass : public Pass { DspConfig(const DspConfig &ref) = default; DspConfig(DspConfig &&ref) = default; - Hasher hash_eat(Hasher h) const { h.eat(connections); return h; } + Hasher hash_into(Hasher h) const { h.eat(connections); return h; } bool operator==(const DspConfig &ref) const { return connections == ref.connections; } };