Internals: Make node type hashes stable with Ast changes

Instead of hashing node types by type id (which can change when
adding/removing Ast node types), astgen a stable hash based on node
name. This makes output more stable through Ast node
additions/deletions. Largely to help with 'make test-diff', should have
no user noticeable impact.
This commit is contained in:
Geza Lore
2026-09-26 10:37:56 +01:00
parent 33d63ac0b0
commit f2114d3dc3
3 changed files with 15 additions and 5 deletions
+2 -2
View File
@@ -59,7 +59,7 @@ class HasherVisitor final : public VNVisitorConst {
} else {
VL_RESTORER(m_hash);
// Reset accumulator
m_hash = V3Hash{nodep->type()}; // Node type
m_hash = V3Hash{nodep->type().hash()}; // Node type
f(); // Node-specific hash
if (hashDType && nodep != nodep->dtypep())
iterateConstNull(nodep->dtypep()); // Node dtype
@@ -77,7 +77,7 @@ class HasherVisitor final : public VNVisitorConst {
// Each visitor below contributes to the hash any node-specific content
// that is not dependent on either of the following, as these are
// included by default by hashNode:
// - Node type (as given by AstNode::type())
// - Node type (as given by AstNode::type().hash())
// - Node dtype (unless !hashDType)
// - child nodes (unless !hashChildren)
//