From 8db9db7e2524dff5969cc2b6260522c2ace872d4 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 28 Nov 2024 14:37:11 -0500 Subject: [PATCH] Internals: Rename same() function. No functional change. --- src/V3Ast.cpp | 2 +- src/V3Ast.h | 4 +- src/V3AstInlines.h | 2 +- src/V3AstNodeDType.h | 46 +++++++------- src/V3AstNodeExpr.h | 148 +++++++++++++++++++++---------------------- src/V3AstNodeOther.h | 116 ++++++++++++++++----------------- src/V3AstNodes.cpp | 20 +++--- src/V3Const.cpp | 2 +- src/V3Gate.cpp | 2 +- 9 files changed, 171 insertions(+), 171 deletions(-) diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 9a3ce06e8..6ad2e4ef4 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -1101,7 +1101,7 @@ bool AstNode::sameTreeIter(const AstNode* node1p, const AstNode* node2p, bool ig (!node1p->dtypep() && !node2p->dtypep()) || (node1p->dtypep() && node2p->dtypep()), node1p, "Comparison of a node with dtypep() with a node without dtypep()\n-node2=" << node2p); if (node1p->dtypep() && !node1p->dtypep()->similarDType(node2p->dtypep())) return false; - if (!node1p->same(node2p) || (gateOnly && !node1p->isGateOptimizable())) return false; + if (!node1p->sameNode(node2p) || (gateOnly && !node1p->isGateOptimizable())) return false; return (sameTreeIter(node1p->m_op1p, node2p->m_op1p, false, gateOnly) && sameTreeIter(node1p->m_op2p, node2p->m_op2p, false, gateOnly) && sameTreeIter(node1p->m_op3p, node2p->m_op3p, false, gateOnly) diff --git a/src/V3Ast.h b/src/V3Ast.h index 4b433236a..66466376b 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -2122,7 +2122,7 @@ protected: } // Use instead isSame(), this is for each Ast* class, and assumes node is of same type - virtual bool same(const AstNode*) const { return true; } + virtual bool sameNode(const AstNode*) const { return true; } public: // ACCESSORS @@ -2502,7 +2502,7 @@ public: virtual int instrCount() const { return 0; } // Iff node is identical to another node virtual bool isSame(const AstNode* samep) const { - return type() == samep->type() && same(samep); + return type() == samep->type() && sameNode(samep); } // Iff has a data type; dtype() must be non null virtual bool hasDType() const VL_MT_SAFE { return false; } diff --git a/src/V3AstInlines.h b/src/V3AstInlines.h index 7e55bee79..8759e1bea 100644 --- a/src/V3AstInlines.h +++ b/src/V3AstInlines.h @@ -172,7 +172,7 @@ AstVarRef::AstVarRef(FileLine* fl, AstVarScope* varscp, const VAccess& access) string AstVarRef::name() const { return varp() ? varp()->name() : ""; } -bool AstVarRef::same(const AstVarRef* samep) const { +bool AstVarRef::sameNode(const AstVarRef* samep) const { if (varScopep()) { return (varScopep() == samep->varScopep() && access() == samep->access()); } else { diff --git a/src/V3AstNodeDType.h b/src/V3AstNodeDType.h index 4c0aeae79..3e419d09f 100644 --- a/src/V3AstNodeDType.h +++ b/src/V3AstNodeDType.h @@ -64,11 +64,11 @@ public: virtual bool isIntegralOrPacked() const { return !isCompound(); } // (Slow) recurse down to find basic data type virtual AstBasicDType* basicp() const VL_MT_STABLE = 0; - // recurses over typedefs/const/enum to next non-typeref type + // (Slow) Recurse over MemberDType|ParamTypeDType|RefDType|ConstDType|EnumDType to other type virtual AstNodeDType* skipRefp() const VL_MT_STABLE = 0; - // recurses over typedefs to next non-typeref-or-const type + // (Slow) Recurse over MemberDType|ParamTypeDType|RefDType|EnumDType to ConstDType virtual AstNodeDType* skipRefToConstp() const = 0; - // recurses over typedefs/const to next non-typeref-or-enum/struct type + // (Slow) Recurse over MemberDType|ParamTypeDType|RefDType|ConstDType to EnumDType virtual AstNodeDType* skipRefToEnump() const = 0; // (Slow) recurses - Structure alignment 1,2,4 or 8 bytes (arrays affect this) virtual int widthAlignBytes() const = 0; @@ -155,7 +155,7 @@ public: BROKEN_RTN(!((m_refDTypep && !childDTypep()) || (!m_refDTypep && childDTypep()))); return nullptr; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstNodeArrayDType* const asamep = VN_DBG_AS(samep, NodeArrayDType); return (hi() == asamep->hi() && subDTypep() == asamep->subDTypep() && rangenp()->sameTree(asamep->rangenp())); @@ -311,7 +311,7 @@ public: BROKEN_RTN(!((m_keyDTypep && !childDTypep()) || (!m_keyDTypep && childDTypep()))); return nullptr; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstAssocArrayDType* const asamep = VN_DBG_AS(samep, AssocArrayDType); if (!asamep->subDTypep()) return false; if (!asamep->keyDTypep()) return false; @@ -392,9 +392,9 @@ public: void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; // width/widthMin/numeric compared elsewhere - bool same(const AstNode* samep) const override; + bool sameNode(const AstNode* samep) const override; bool similarDType(const AstNodeDType* samep) const override { - return type() == samep->type() && same(samep); + return type() == samep->type() && sameNode(samep); } string name() const override VL_MT_STABLE { return m.m_keyword.ascii(); } string prettyDTypeName(bool full) const override; @@ -482,7 +482,7 @@ public: this->elementsp(elementsp); } ASTGEN_MEMBERS_AstBracketArrayDType; - bool similarDType(const AstNodeDType* samep) const override { return same(samep); } + bool similarDType(const AstNodeDType* samep) const override { return sameNode(samep); } AstNodeDType* subDTypep() const override VL_MT_STABLE { return childDTypep(); } // METHODS // Will be removed in V3Width, which relies on this @@ -508,11 +508,11 @@ public: public: ASTGEN_MEMBERS_AstCDType; - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstCDType* const asamep = VN_DBG_AS(samep, CDType); return m_name == asamep->m_name; } - bool similarDType(const AstNodeDType* samep) const override { return same(samep); } + bool similarDType(const AstNodeDType* samep) const override { return sameNode(samep); } string name() const override VL_MT_STABLE { return m_name; } string prettyDTypeName(bool) const override { return m_name; } // METHODS @@ -551,12 +551,12 @@ public: } ASTGEN_MEMBERS_AstClassRefDType; // METHODS - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstClassRefDType* const asamep = VN_DBG_AS(samep, ClassRefDType); return (m_classp == asamep->m_classp && m_classOrPackagep == asamep->m_classOrPackagep); } bool similarDType(const AstNodeDType* samep) const override { - return this == samep || (type() == samep->type() && same(samep)); + return this == samep || (type() == samep->type() && sameNode(samep)); } void dump(std::ostream& str = std::cout) const override; void dumpJson(std::ostream& str = std::cout) const override; @@ -598,7 +598,7 @@ public: BROKEN_RTN(!((m_refDTypep && !childDTypep()) || (!m_refDTypep && childDTypep()))); return nullptr; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstConstDType* const sp = VN_DBG_AS(samep, ConstDType); return (m_refDTypep == sp->m_refDTypep); } @@ -677,12 +677,12 @@ public: , m_uniqueNum(uniqueNumInc()) {} ASTGEN_MEMBERS_AstDefImplicitDType; int uniqueNum() const { return m_uniqueNum; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstDefImplicitDType* const sp = VN_DBG_AS(samep, DefImplicitDType); return uniqueNum() == sp->uniqueNum(); } bool similarDType(const AstNodeDType* samep) const override { - return type() == samep->type() && same(samep); + return type() == samep->type() && sameNode(samep); } AstNodeDType* getChildDTypep() const override { return childDTypep(); } AstNodeDType* subDTypep() const override VL_MT_STABLE { @@ -724,7 +724,7 @@ public: BROKEN_RTN(!((m_refDTypep && !childDTypep()) || (!m_refDTypep && childDTypep()))); return nullptr; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstDynArrayDType* const asamep = VN_DBG_AS(samep, DynArrayDType); if (!asamep->subDTypep()) return false; return subDTypep() == asamep->subDTypep(); @@ -812,7 +812,7 @@ public: const char* broken() const override; int uniqueNum() const { return m_uniqueNum; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstEnumDType* const sp = VN_DBG_AS(samep, EnumDType); return uniqueNum() == sp->uniqueNum(); } @@ -1106,7 +1106,7 @@ public: BROKEN_RTN(!((m_refDTypep && !childDTypep()) || (!m_refDTypep && childDTypep()))); return nullptr; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstQueueDType* const asamep = VN_DBG_AS(samep, QueueDType); if (!asamep->subDTypep()) return false; return (subDTypep() == asamep->subDTypep()); @@ -1169,7 +1169,7 @@ public: } ASTGEN_MEMBERS_AstRefDType; // METHODS - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstRefDType* const asamep = VN_DBG_AS(samep, RefDType); return (m_typedefp == asamep->m_typedefp && m_refDTypep == asamep->m_refDTypep && m_name == asamep->m_name && m_classOrPackagep == asamep->m_classOrPackagep); @@ -1245,7 +1245,7 @@ public: BROKEN_RTN(!((m_refDTypep && !childDTypep()) || (!m_refDTypep && childDTypep()))); return nullptr; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstSampleQueueDType* const asamep = VN_DBG_AS(samep, SampleQueueDType); if (!asamep->subDTypep()) return false; return (subDTypep() == asamep->subDTypep()); @@ -1324,7 +1324,7 @@ public: BROKEN_RTN(!((m_refDTypep && !childDTypep()) || (!m_refDTypep && childDTypep()))); return nullptr; } - bool same(const AstNode* samep) const override; + bool sameNode(const AstNode* samep) const override; bool similarDType(const AstNodeDType* samep) const override; void dumpSmall(std::ostream& str) const override; AstNodeDType* getChildDTypep() const override { return childDTypep(); } @@ -1387,7 +1387,7 @@ public: BROKEN_RTN(!((m_refDTypep && !childDTypep()) || (!m_refDTypep && childDTypep()))); return nullptr; } - bool same(const AstNode* samep) const override; + bool sameNode(const AstNode* samep) const override; bool similarDType(const AstNodeDType* samep) const override; void dumpSmall(std::ostream& str) const override; AstNodeDType* getChildDTypep() const override { return childDTypep(); } @@ -1442,7 +1442,7 @@ public: } ASTGEN_MEMBERS_AstUnpackArrayDType; string prettyDTypeName(bool full) const override; - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstUnpackArrayDType* const sp = VN_DBG_AS(samep, UnpackArrayDType); return m_isCompound == sp->m_isCompound; } diff --git a/src/V3AstNodeExpr.h b/src/V3AstNodeExpr.h index e7c60a61a..69e4d675c 100644 --- a/src/V3AstNodeExpr.h +++ b/src/V3AstNodeExpr.h @@ -99,7 +99,7 @@ public: virtual bool signedFlavor() const { return false; } virtual bool stringFlavor() const { return false; } // N flavor of nodes with both flavors? int instrCount() const override { return widthInstrs(); } - bool same(const AstNode*) const override { return true; } + bool sameNode(const AstNode*) const override { return true; } bool isPure() override; const char* broken() const override; @@ -203,7 +203,7 @@ public: void dump(std::ostream& str = std::cout) const override; void dumpJson(std::ostream& str = std::cout) const override; int instrCount() const override { return INSTR_COUNT_CALL; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstNodeCCall* const asamep = VN_DBG_AS(samep, NodeCCall); return (funcp() == asamep->funcp() && argTypes() == asamep->argTypes()); } @@ -296,7 +296,7 @@ protected: public: ASTGEN_MEMBERS_AstNodePreSel; // METHODS - bool same(const AstNode*) const override { return true; } + bool sameNode(const AstNode*) const override { return true; } string emitVerilog() final override { V3ERROR_NA_RETURN(""); } string emitC() final override { V3ERROR_NA_RETURN(""); } @@ -343,7 +343,7 @@ public: virtual bool sizeMattersThs() const = 0; // True if output result depends on ths size virtual bool sizeMattersFhs() const = 0; // True if output result depends on ths size int instrCount() const override { return widthInstrs(); } - bool same(const AstNode*) const override { return true; } + bool sameNode(const AstNode*) const override { return true; } bool isPure() override; const char* broken() const override; @@ -397,7 +397,7 @@ public: virtual bool sizeMattersRhs() const = 0; // True if output result depends on rhs size virtual bool sizeMattersThs() const = 0; // True if output result depends on ths size int instrCount() const override { return widthInstrs(); } - bool same(const AstNode*) const override { return true; } + bool sameNode(const AstNode*) const override { return true; } bool isPure() override; const char* broken() const override; @@ -478,7 +478,7 @@ public: virtual bool signedFlavor() const { return false; } virtual bool stringFlavor() const { return false; } // N flavor of nodes with both flavors? int instrCount() const override { return widthInstrs(); } - bool same(const AstNode*) const override { return true; } + bool sameNode(const AstNode*) const override { return true; } bool isPure() override; const char* broken() const override; }; @@ -629,7 +629,7 @@ public: bool cleanOut() const override { return m_cleanOut; } string emitVerilog() override { V3ERROR_NA_RETURN(""); } string emitC() override { V3ERROR_NA_RETURN(""); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } bool isPure() override { return pure(); } bool pure() const { return m_pure; } void pure(bool flag) { m_pure = flag; } @@ -653,7 +653,7 @@ public: ASTGEN_MEMBERS_AstCMethodHard; string name() const override VL_MT_STABLE { return m_name; } // * = Var name void name(const string& name) override { m_name = name; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstCMethodHard* const asamep = VN_DBG_AS(samep, CMethodHard); return (m_name == asamep->m_name); } @@ -773,7 +773,7 @@ public: } ASTGEN_MEMBERS_AstClassOrPackageRef; // METHODS - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return (m_classOrPackageNodep == VN_DBG_AS(samep, ClassOrPackageRef)->m_classOrPackageNodep); } @@ -804,7 +804,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstConsDynArray final : public AstNodeExpr { // Construct a queue and return object, '{}. '{lhs}, '{lhs. rhs} @@ -836,7 +836,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstConsDynArray* const sp = VN_DBG_AS(samep, ConsDynArray); return m_lhsIsValue == sp->m_lhsIsValue && m_rhsIsValue == sp->m_rhsIsValue; } @@ -863,7 +863,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstConsPackUOrStruct final : public AstNodeExpr { // Construct a packed struct and return object, '{member1: value1, member2: value2} @@ -886,7 +886,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstConsQueue final : public AstNodeExpr { // Construct a queue and return object, '{}. '{lhs}, '{lhs. rhs} @@ -918,7 +918,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstConsQueue* const sp = VN_DBG_AS(samep, ConsQueue); return m_lhsIsValue == sp->m_lhsIsValue && m_rhsIsValue == sp->m_rhsIsValue; } @@ -939,7 +939,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstConst final : public AstNodeExpr { // A constant @@ -1084,7 +1084,7 @@ public: string emitVerilog() override { V3ERROR_NA_RETURN(""); } string emitC() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstConst* const sp = VN_DBG_AS(samep, Const); return num().isCaseEq(sp->num()); } @@ -1222,7 +1222,7 @@ public: ASTGEN_MEMBERS_AstEmptyQueue; string emitC() override { V3ERROR_NA_RETURN(""); } string emitVerilog() override { return "{}"; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } bool cleanOut() const override { return true; } }; class AstEnumItemRef final : public AstNodeExpr { @@ -1240,7 +1240,7 @@ public: void dumpJson(std::ostream& str) const override; string name() const override VL_MT_STABLE { return itemp()->name(); } int instrCount() const override { return 0; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstEnumItemRef* const sp = VN_DBG_AS(samep, EnumItemRef); return itemp() == sp->itemp(); } @@ -1273,7 +1273,7 @@ public: if (AstNode::afterCommentp(stmtsp())) return false; return resultp()->isPure(); } - bool same(const AstNode*) const override { return true; } + bool sameNode(const AstNode*) const override { return true; } }; class AstFError final : public AstNodeExpr { // @astgen op1 := filep : AstNode @@ -1291,7 +1291,7 @@ public: int instrCount() const override { return widthInstrs() * 64; } bool isPredictOptimizable() const override { return false; } bool isPure() override { return false; } // SPECIAL: $display has 'visual' ordering - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstFOpen final : public AstNodeExpr { // @astgen op2 := filenamep : AstNodeExpr @@ -1312,7 +1312,7 @@ public: bool isPure() override { return false; } bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstFOpenMcd final : public AstNodeExpr { // @astgen op2 := filenamep : AstNodeExpr @@ -1331,7 +1331,7 @@ public: bool isPure() override { return false; } bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstFRead final : public AstNodeExpr { // @astgen op1 := memp : AstNode // VarRef for result @@ -1355,7 +1355,7 @@ public: bool isPure() override { return false; } // SPECIAL: has 'visual' ordering bool isOutputter() override { return true; } // SPECIAL: makes output bool cleanOut() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstFRewind final : public AstNodeExpr { // @astgen op1 := filep : Optional[AstNode] @@ -1374,7 +1374,7 @@ public: bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } bool cleanOut() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstFScanF final : public AstNodeExpr { // @astgen op1 := exprsp : List[AstNode] // VarRefs for results @@ -1398,7 +1398,7 @@ public: bool isPure() override { return false; } // SPECIAL: has 'visual' ordering bool isOutputter() override { return true; } // SPECIAL: makes output bool cleanOut() const override { return false; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return text() == VN_DBG_AS(samep, FScanF)->text(); } string text() const { return m_text; } // * = Text to display @@ -1424,7 +1424,7 @@ public: bool isPure() override { return false; } // SPECIAL: has 'visual' ordering bool isOutputter() override { return true; } // SPECIAL: makes output bool cleanOut() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstFTell final : public AstNodeExpr { // @astgen op1 := filep : AstNode // file (must be a VarRef) @@ -1443,7 +1443,7 @@ public: bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } bool cleanOut() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstFell final : public AstNodeExpr { // Verilog $fell @@ -1461,7 +1461,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { V3ERROR_NA_RETURN(""); } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstGatePin final : public AstNodeExpr { // Possibly expand a gate primitive input pin value to match the range of the gate primitive @@ -1497,7 +1497,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { V3ERROR_NA_RETURN(""); } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstInitArray final : public AstNodeExpr { // This is also used as an array value in V3Simulate/const prop. @@ -1529,7 +1529,7 @@ public: void dumpJson(std::ostream& str) const override; const char* broken() const override; void cloneRelink() override; - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { // Only works if exact same children, instead should override comparison // of children list, and instead use map-vs-map key/value compare return m_map == VN_DBG_AS(samep, InitArray)->m_map; @@ -1589,7 +1589,7 @@ public: : ASTGEN_SUPER_LambdaArgRef(fl) , m_name{name} , m_index(index) {} - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } string emitVerilog() override { return name(); } string emitC() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } @@ -1623,7 +1623,7 @@ public: string emitVerilog() override { V3ERROR_NA_RETURN(""); } string emitC() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } - bool same(const AstNode* samep) const override; + bool sameNode(const AstNode* samep) const override; int instrCount() const override { return widthInstrs(); } AstVar* varp() const { return m_varp; } void varp(AstVar* nodep) { m_varp = nodep; } @@ -1641,7 +1641,7 @@ public: string emitVerilog() override { return "new"; } string emitC() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } int instrCount() const override { return widthInstrs(); } }; class AstNewDynamic final : public AstNodeExpr { @@ -1659,7 +1659,7 @@ public: string emitVerilog() override { return "new"; } string emitC() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } int instrCount() const override { return widthInstrs(); } }; class AstParseHolder final : public AstNodeExpr { @@ -1696,7 +1696,7 @@ public: void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; string name() const override VL_MT_STABLE { return m_name; } // * = Var name - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstParseRef* const asamep = VN_DBG_AS(samep, ParseRef); return (expect() == asamep->expect() && m_name == asamep->m_name); } @@ -1725,7 +1725,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { V3ERROR_NA_RETURN(""); } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstPatMember final : public AstNodeExpr { // Verilog '{a} or '{a{b}} @@ -1826,7 +1826,7 @@ public: bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } int instrCount() const override { return INSTR_COUNT_PLI; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } bool combinable(const AstRand* samep) const { return !seedp() && !samep->seedp() && reset() == samep->reset() && urandom() == samep->urandom(); @@ -1852,7 +1852,7 @@ public: bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } int instrCount() const override { return INSTR_COUNT_PLI; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstRose final : public AstNodeExpr { // Verilog $rose @@ -1870,7 +1870,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { V3ERROR_NA_RETURN(""); } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstSFormatF final : public AstNodeExpr { // Convert format to string, generally under an AstDisplay or AstSFormat @@ -1907,7 +1907,7 @@ public: ASTGEN_MEMBERS_AstSFormatF; string name() const override VL_MT_STABLE { return m_text; } int instrCount() const override { return INSTR_COUNT_PLI; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return text() == VN_DBG_AS(samep, SFormatF)->text(); } string verilogKwd() const override { return "$sformatf"; } @@ -1949,7 +1949,7 @@ public: bool isPure() override { return false; } // SPECIAL: has 'visual' ordering bool isOutputter() override { return true; } // SPECIAL: makes output bool cleanOut() const override { return false; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return text() == VN_DBG_AS(samep, SScanF)->text(); } string text() const { return m_text; } // * = Text to display @@ -1969,7 +1969,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { V3ERROR_NA_RETURN(""); } int instrCount() const override { return 0; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstScopeName final : public AstNodeExpr { // For display %m and DPI context imports @@ -1989,7 +1989,7 @@ public: dtypeSetUInt64(); } ASTGEN_MEMBERS_AstScopeName; - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstScopeName* const sp = VN_DBG_AS(samep, ScopeName); return (m_dpiExport == sp->m_dpiExport && m_forFormat == sp->m_forFormat); } @@ -2027,7 +2027,7 @@ public: this->addElementsp(elementsp); } ASTGEN_MEMBERS_AstSelLoopVars; - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } bool maybePointedTo() const override VL_MT_SAFE { return false; } string emitVerilog() override { V3ERROR_NA_RETURN(""); } @@ -2053,7 +2053,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstSetWildcard final : public AstNodeExpr { // Set a wildcard assoc array element and return object, '{} @@ -2073,7 +2073,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstStable final : public AstNodeExpr { // Verilog $stable @@ -2091,7 +2091,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { V3ERROR_NA_RETURN(""); } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstStackTraceF final : public AstNodeExpr { // $stacktrace used as function @@ -2110,7 +2110,7 @@ public: bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } bool cleanOut() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstStructSel final : public AstNodeExpr { // Unpacked struct/union member access @@ -2134,7 +2134,7 @@ public: // Not a union return VN_IS(fromp()->dtypep()->skipRefp(), StructDType); } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstStructSel* const sp = VN_DBG_AS(samep, StructSel); return m_name == sp->m_name; } @@ -2177,7 +2177,7 @@ public: bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } bool cleanOut() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstTestPlusArgs final : public AstNodeExpr { // Search expression. If nullptr then this is a $test$plusargs instead of $value$plusargs. @@ -2195,7 +2195,7 @@ public: bool isPredictOptimizable() const override { return false; } // but isPure() true bool cleanOut() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstThisRef final : public AstNodeExpr { // Reference to 'this'. @@ -2212,7 +2212,7 @@ public: ASTGEN_MEMBERS_AstThisRef; string emitC() override { return "this"; } string emitVerilog() override { return "this"; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } bool cleanOut() const override { return true; } AstNodeDType* getChildDTypep() const override { return childDTypep(); } AstNodeDType* subDTypep() const VL_MT_STABLE { return dtypep() ? dtypep() : childDTypep(); } @@ -2230,7 +2230,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstTimeUnit final : public AstNodeExpr { VTimescale m_timeunit; // Parent module time unit @@ -2246,7 +2246,7 @@ public: string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } VTimescale timeunit() const { return m_timeunit; } void timeunit(const VTimescale& flag) { m_timeunit = flag; } }; @@ -2268,7 +2268,7 @@ public: bool isSubstOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } int instrCount() const override { return INSTR_COUNT_PLI; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstUnbounded final : public AstNodeExpr { // A $ in the parser, used for unbounded and queues @@ -2320,7 +2320,7 @@ public: bool isPredictOptimizable() const override { return false; } bool isPure() override { return !outp(); } bool cleanOut() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstWith final : public AstNodeExpr { // Used as argument to method, then to AstCMethodHard @@ -2341,7 +2341,7 @@ public: this->addExprp(exprp); } ASTGEN_MEMBERS_AstWith; - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } const char* broken() const override { BROKEN_RTN(!indexArgRefp()); // varp needed to know lambda's arg dtype BROKEN_RTN(!valueArgRefp()); // varp needed to know lambda's arg dtype @@ -2366,7 +2366,7 @@ public: this->addExprsp(exprsp); } ASTGEN_MEMBERS_AstWithParse; - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } string emitVerilog() override { V3ERROR_NA_RETURN(""); } string emitC() override { V3ERROR_NA_RETURN(""); } @@ -4158,7 +4158,7 @@ public: bool sizeMattersRhs() const override { return false; } bool isGateOptimizable() const override { return true; } // esp for V3Const::ifSameAssign bool isPredictOptimizable() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } int instrCount() const override { return widthInstrs(); } // Special operators // Return base var (or const) nodep dereferences @@ -4194,7 +4194,7 @@ public: bool isGateOptimizable() const override { return false; } // AssocSel creates on miss bool isPredictOptimizable() const override { return false; } bool isPure() override { return false; } // AssocSel creates on miss - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } int instrCount() const override { return widthInstrs(); } }; class AstWildcardSel final : public AstNodeSel { @@ -4226,7 +4226,7 @@ public: bool sizeMattersRhs() const override { return false; } bool isGateOptimizable() const override { return true; } // esp for V3Const::ifSameAssign bool isPredictOptimizable() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } int instrCount() const override { return widthInstrs(); } }; class AstWordSel final : public AstNodeSel { @@ -4252,7 +4252,7 @@ public: bool cleanRhs() const override { return true; } bool sizeMattersLhs() const override { return false; } bool sizeMattersRhs() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; // === AstNodeStream === @@ -4402,7 +4402,7 @@ public: AstNew(FileLine* fl, AstNodeExpr* pinsp) : ASTGEN_SUPER_New(fl, "new", pinsp) {} ASTGEN_MEMBERS_AstNew; - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } int instrCount() const override { return widthInstrs(); } }; class AstTaskRef final : public AstNodeFTaskRef { @@ -4511,7 +4511,7 @@ public: string emitVerilog() override { return "%f$inferred_disable"; } string emitC() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstTime final : public AstNodeTermop { VTimescale m_timeunit; // Parent module time unit @@ -4528,7 +4528,7 @@ public: bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } int instrCount() const override { return INSTR_COUNT_TIME; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } void dump(std::ostream& str = std::cout) const override; void dumpJson(std::ostream& str = std::cout) const override; VTimescale timeunit() const { return m_timeunit; } @@ -4549,7 +4549,7 @@ public: bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } int instrCount() const override { return INSTR_COUNT_TIME; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } void dump(std::ostream& str = std::cout) const override; void dumpJson(std::ostream& str = std::cout) const override; VTimescale timeunit() const { return m_timeunit; } @@ -4719,7 +4719,7 @@ public: bool sizeMattersLhs() const override { return false; } bool sizeMattersRhs() const override { return false; } bool sizeMattersThs() const override { return false; } - bool same(const AstNode*) const override { return true; } + bool sameNode(const AstNode*) const override { return true; } int instrCount() const override { return widthInstrs() * (VN_CAST(lsbp(), Const) ? 3 : 10); } int widthConst() const { return VN_AS(widthp(), Const)->toSInt(); } int lsbConst() const { return VN_AS(lsbp(), Const)->toSInt(); } @@ -4756,7 +4756,7 @@ public: bool sizeMattersLhs() const override { return false; } bool sizeMattersRhs() const override { return false; } bool sizeMattersThs() const override { return false; } - bool same(const AstNode*) const override { return true; } + bool sameNode(const AstNode*) const override { return true; } int instrCount() const override { return 10; } // Removed before matters // For widthConst()/loConst etc, see declRange().elements() and other VNumRange methods VNumRange& declRange() VL_MT_STABLE { return m_declRange; } @@ -4940,7 +4940,7 @@ public: bool cleanOut() const override { return true; } bool cleanLhs() const override { return true; } bool sizeMattersLhs() const override { return false; } // Special cased in V3Cast - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return size() == VN_DBG_AS(samep, CCast)->size(); } void dump(std::ostream& str = std::cout) const override; @@ -5006,7 +5006,7 @@ public: bool cleanOut() const override { return true; } bool cleanLhs() const override { return true; } bool sizeMattersLhs() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstExtend final : public AstNodeUniop { // Expand a value into a wider entity by 0 extension. Width is implied from nodep->width() @@ -5269,7 +5269,7 @@ public: bool cleanOut() const override { return true; } bool cleanLhs() const override { return true; } bool sizeMattersLhs() const override { return false; } - bool same(const AstNode* samep) const override { return fileline() == samep->fileline(); } + bool sameNode(const AstNode* samep) const override { return fileline() == samep->fileline(); } }; class AstOneHot final : public AstNodeUniop { // True if only single bit set in vector @@ -5718,8 +5718,8 @@ public: void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; const char* broken() const override; - bool same(const AstNode* samep) const override; - inline bool same(const AstVarRef* samep) const; + bool sameNode(const AstNode* samep) const override; + inline bool sameNode(const AstVarRef* samep) const; inline bool sameNoLvalue(AstVarRef* samep) const; int instrCount() const override; string emitVerilog() override { V3ERROR_NA_RETURN(""); } @@ -5751,7 +5751,7 @@ public: string emitC() override { V3ERROR_NA_RETURN(""); } bool cleanOut() const override { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstVarXRef* asamep = VN_DBG_AS(samep, VarXRef); return (selfPointer() == asamep->selfPointer() && varp() == asamep->varp() && name() == asamep->name() && dotted() == asamep->dotted()); diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index c38cc4773..c171f5098 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -214,7 +214,7 @@ public: void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; string name() const override VL_MT_STABLE { return m_name; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstNodeModule VL_NOT_FINAL : public AstNode { // A module, package, program or interface declaration; @@ -375,7 +375,7 @@ public: bool hasDType() const override VL_MT_SAFE { return true; } virtual bool cleanRhs() const { return true; } int instrCount() const override { return widthInstrs(); } - bool same(const AstNode*) const override { return true; } + bool sameNode(const AstNode*) const override { return true; } string verilogKwd() const override { return "="; } bool isTimingControl() const override { return timingControlp(); } virtual bool brokeLhsMustBeLvalue() const = 0; @@ -418,7 +418,7 @@ public: } ASTGEN_MEMBERS_AstNodeCoverOrAssert; string name() const override VL_MT_STABLE { return m_name; } // * = Var name - bool same(const AstNode* samep) const override { return samep->name() == name(); } + bool sameNode(const AstNode* samep) const override { return samep->name() == name(); } void name(const string& name) override { m_name = name; } void dump(std::ostream& str = std::cout) const override; void dumpJson(std::ostream& str = std::cout) const override; @@ -450,7 +450,7 @@ public: ASTGEN_MEMBERS_AstNodeFor; bool isGateOptimizable() const override { return false; } int instrCount() const override { return INSTR_COUNT_BRANCH; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstNodeForeach VL_NOT_FINAL : public AstNodeStmt { // @astgen op1 := arrayp : AstNode @@ -464,7 +464,7 @@ public: ASTGEN_MEMBERS_AstNodeForeach; bool isGateOptimizable() const override { return false; } int instrCount() const override { return INSTR_COUNT_BRANCH; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } bool isFirstInMyListOfStatements(AstNode* n) const override { return n == stmtsp(); } }; class AstNodeIf VL_NOT_FINAL : public AstNodeStmt { @@ -487,7 +487,7 @@ public: bool isGateOptimizable() const override { return false; } bool isGateDedupable() const override { return true; } int instrCount() const override { return INSTR_COUNT_BRANCH; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } void branchPred(VBranchPred flag) { m_branchPred = flag; } VBranchPred branchPred() const { return m_branchPred; } void isBoundsCheck(bool flag) { m_isBoundsCheck = flag; } @@ -519,7 +519,7 @@ public: bool isPure() override { return false; } bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return isHex() == VN_DBG_AS(samep, NodeReadWriteMem)->isHex(); } bool isHex() const { return m_isHex; } @@ -540,7 +540,7 @@ public: ASTGEN_MEMBERS_AstNodeText; void dump(std::ostream& str = std::cout) const override; void dumpJson(std::ostream& str = std::cout) const override; - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstNodeText* asamep = VN_DBG_AS(samep, NodeText); return text() == asamep->text(); } @@ -677,7 +677,7 @@ public: bool maybePointedTo() const override VL_MT_SAFE { return true; } void dump(std::ostream& str = std::cout) const override; void dumpJson(std::ostream& str = std::cout) const override; - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstCFunc* const asamep = VN_DBG_AS(samep, CFunc); return ((isTrace() == asamep->isTrace()) && (rtnTypeVoid() == asamep->rtnTypeVoid()) && (argTypes() == asamep->argTypes()) && isLoose() == asamep->isLoose() @@ -1037,7 +1037,7 @@ public: bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } bool maybePointedTo() const override VL_MT_SAFE { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } void isKwdPure(bool flag) { m_isKwdPure = flag; } bool isKwdPure() const { return m_isKwdPure; } void isStatic(bool flag) { m_isStatic = flag; } @@ -1056,7 +1056,7 @@ public: ASTGEN_MEMBERS_AstConstraintBefore; bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstDefParam final : public AstNode { // A defparam assignment @@ -1073,7 +1073,7 @@ public: } string name() const override VL_MT_STABLE { return m_name; } // * = Scope name ASTGEN_MEMBERS_AstDefParam; - bool same(const AstNode*) const override { return true; } + bool sameNode(const AstNode*) const override { return true; } string path() const { return m_path; } }; class AstDefaultDisable final : public AstNode { @@ -1121,7 +1121,7 @@ public: bool isPure() override { return false; } // SPECIAL: $display has 'visual' ordering bool isOutputter() override { return true; } // SPECIAL: $display makes output bool isUnlikely() const override { return true; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return displayType() == VN_DBG_AS(samep, ElabDisplay)->displayType(); } int instrCount() const override { return INSTR_COUNT_PLI; } @@ -1134,7 +1134,7 @@ public: explicit AstEmpty(FileLine* fl) : ASTGEN_SUPER_Empty(fl) {} ASTGEN_MEMBERS_AstEmpty; - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstExecGraph final : public AstNode { // For parallel execution, this node contains a dependency graph. Each @@ -1482,7 +1482,7 @@ public: ASTGEN_MEMBERS_AstPragma; VPragmaType pragType() const { return m_pragType; } // *=type of the pragma bool isPredictOptimizable() const override { return false; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return pragType() == VN_DBG_AS(samep, Pragma)->pragType(); } }; @@ -1517,7 +1517,7 @@ public: this->lhsp(lhsp); } ASTGEN_MEMBERS_AstPull; - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return direction() == VN_DBG_AS(samep, Pull)->direction(); } uint32_t direction() const { return (uint32_t)m_direction; } @@ -1555,7 +1555,7 @@ public: void name(const string& name) override { m_name = name; } void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; - bool same(const AstNode* samep) const override; + bool sameNode(const AstNode* samep) const override; string nameDotless() const; AstNodeModule* modp() const { return m_modp; } // @@ -1602,7 +1602,7 @@ public: ASTGEN_MEMBERS_AstSenItem; void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return edgeType() == VN_DBG_AS(samep, SenItem)->edgeType(); } VEdgeType edgeType() const { return m_edgeType; } @@ -1955,7 +1955,7 @@ public: ASTGEN_MEMBERS_AstVar; void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; - bool same(const AstNode* samep) const override; + bool sameNode(const AstNode* samep) const override; string name() const override VL_MT_STABLE { return m_name; } // * = Var name bool hasDType() const override VL_MT_SAFE { return true; } bool maybePointedTo() const override VL_MT_SAFE { return true; } @@ -2211,7 +2211,7 @@ public: string name() const override VL_MT_STABLE { return scopep()->name() + "->" + varp()->name(); } void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; - bool same(const AstNode* samep) const override; + bool sameNode(const AstNode* samep) const override; bool hasDType() const override VL_MT_SAFE { return true; } AstVar* varp() const VL_MT_STABLE { return m_varp; } // [After Link] Pointer to variable AstScope* scopep() const VL_MT_STABLE { return m_scopep; } // Pointer to scope it's under @@ -2598,7 +2598,7 @@ public: ASTGEN_MEMBERS_AstBracketRange; virtual string emitC() { V3ERROR_NA_RETURN(""); } virtual string emitVerilog() { V3ERROR_NA_RETURN(""); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } // Will be removed in V3Width, which relies on this // being a child not a dtype pointed node bool maybePointedTo() const override VL_MT_SAFE { return false; } @@ -2633,7 +2633,7 @@ public: void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; virtual string emitC() { V3ERROR_NA_RETURN(""); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstUnsizedRange final : public AstNodeRange { // Unsized range specification, for open arrays @@ -2643,7 +2643,7 @@ public: ASTGEN_MEMBERS_AstUnsizedRange; virtual string emitC() { V3ERROR_NA_RETURN(""); } virtual string emitVerilog() { return "[]"; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstWildcardRange final : public AstNodeRange { // Wildcard range specification, for wildcard index type associative arrays @@ -2653,7 +2653,7 @@ public: ASTGEN_MEMBERS_AstWildcardRange; virtual string emitC() { V3ERROR_NA_RETURN(""); } virtual string emitVerilog() { return "[*]"; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; // === AstNodeStmt === @@ -2669,7 +2669,7 @@ public: addStmtsp(stmtsp); } ASTGEN_MEMBERS_AstAlwaysPublic; - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } // Special accessors bool isJustOneBodyStmt() const { return stmtsp() && !stmtsp()->nextp(); } bool isFirstInMyListOfStatements(AstNode* n) const override { return n == stmtsp(); } @@ -2726,7 +2726,7 @@ public: ASTGEN_MEMBERS_AstCReset; bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstCReturn final : public AstNodeStmt { // C++ return from a function @@ -2738,7 +2738,7 @@ public: } ASTGEN_MEMBERS_AstCReturn; int instrCount() const override { return widthInstrs(); } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstCStmt final : public AstNodeStmt { // Emit C statement @@ -2752,7 +2752,7 @@ public: ASTGEN_MEMBERS_AstCStmt; bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstComment final : public AstNodeStmt { // Some comment to put into the output stream @@ -2765,7 +2765,7 @@ public: , m_showAt{showAt} {} ASTGEN_MEMBERS_AstComment; string name() const override VL_MT_STABLE { return m_name; } // * = Text - bool same(const AstNode* samep) const override { return true; } // Ignore name in comments + bool sameNode(const AstNode* samep) const override { return true; } // Ignore name in comments virtual bool showAt() const { return m_showAt; } }; class AstConstraintExpr final : public AstNodeStmt { @@ -2783,7 +2783,7 @@ public: void dumpJson(std::ostream& str) const override; bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } bool isDisableSoft() const { return m_isDisableSoft; } void isDisableSoft(bool flag) { m_isDisableSoft = flag; } bool isSoft() const { return m_isSoft; } @@ -2800,7 +2800,7 @@ public: ASTGEN_MEMBERS_AstConstraintUnique; bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return false; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstContinue final : public AstNodeStmt { public: @@ -2852,7 +2852,7 @@ public: const string& hier() const { return m_hier; } void hier(const string& flag) { m_hier = flag; } void comment(const string& flag) { m_text = flag; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { const AstCoverDecl* const asamep = VN_DBG_AS(samep, CoverDecl); return (fileline() == asamep->fileline() && linescov() == asamep->linescov() && hier() == asamep->hier() && comment() == asamep->comment()); @@ -2876,7 +2876,7 @@ public: void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; int instrCount() const override { return 1 + 2 * INSTR_COUNT_LD; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return declp() == VN_DBG_AS(samep, CoverInc)->declp(); } bool isGateOptimizable() const override { return false; } @@ -2900,7 +2900,7 @@ public: } ASTGEN_MEMBERS_AstCoverToggle; int instrCount() const override { return 3 + INSTR_COUNT_BRANCH + INSTR_COUNT_LD; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } bool isGateOptimizable() const override { return false; } bool isPredictOptimizable() const override { return true; } bool isOutputter() override { @@ -2925,7 +2925,7 @@ public: void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; bool isTimingControl() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } void timeunit(const VTimescale& flag) { m_timeunit = flag; } VTimescale timeunit() const { return m_timeunit; } bool isCycleDelay() const { return m_isCycle; } @@ -2987,7 +2987,7 @@ public: bool isPure() override { return false; } // SPECIAL: $display has 'visual' ordering bool isOutputter() override { return true; } // SPECIAL: $display makes output bool isUnlikely() const override { return true; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return displayType() == VN_DBG_AS(samep, Display)->displayType(); } int instrCount() const override { return INSTR_COUNT_PLI; } @@ -3008,7 +3008,7 @@ public: ASTGEN_MEMBERS_AstDoWhile; bool isGateOptimizable() const override { return false; } int instrCount() const override { return INSTR_COUNT_BRANCH; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } // Stop statement searchback here bool isFirstInMyListOfStatements(AstNode* n) const override { return n == stmtsp(); } }; @@ -3030,7 +3030,7 @@ public: bool isPredictOptimizable() const override { return false; } bool isPure() override { return false; } virtual bool cleanOut() const { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } VDumpCtlType ctlType() const { return m_ctlType; } }; class AstEventControl final : public AstNodeStmt { @@ -3063,7 +3063,7 @@ public: bool isPure() override { return false; } bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstFFlush final : public AstNodeStmt { // Parents: stmtlist @@ -3080,7 +3080,7 @@ public: bool isPure() override { return false; } bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstFinish final : public AstNodeStmt { public: @@ -3093,7 +3093,7 @@ public: bool isOutputter() override { return true; } // SPECIAL: $display makes output bool isUnlikely() const override { return true; } int instrCount() const override { return 0; } // Rarely executes - bool same(const AstNode* samep) const override { return fileline() == samep->fileline(); } + bool sameNode(const AstNode* samep) const override { return fileline() == samep->fileline(); } }; class AstFireEvent final : public AstNodeStmt { // '-> _' and '->> _' event trigger statements @@ -3128,7 +3128,7 @@ public: const char* broken() const override; int instrCount() const override { return 0; } bool maybePointedTo() const override VL_MT_SAFE { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } int labelNum() const { return m_labelNum; } void labelNum(int flag) { m_labelNum = flag; } AstJumpLabel* labelp() const { return m_labelp; } @@ -3154,7 +3154,7 @@ public: void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; int instrCount() const override { return INSTR_COUNT_BRANCH; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return labelp() == VN_DBG_AS(samep, JumpGo)->labelp(); } bool isGateOptimizable() const override { return false; } @@ -3182,7 +3182,7 @@ public: void dump(std::ostream& str) const override; void dumpJson(std::ostream& str) const override; int instrCount() const override { return 0; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return blockp() == VN_DBG_AS(samep, JumpLabel)->blockp(); } AstJumpBlock* blockp() const { return m_blockp; } @@ -3201,7 +3201,7 @@ public: bool isPure() override { return false; } // Though deleted before opt bool isOutputter() override { return true; } // Though deleted before opt int instrCount() const override { return INSTR_COUNT_PLI; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return m_off == VN_DBG_AS(samep, MonitorOff)->m_off; } bool off() const { return m_off; } @@ -3259,7 +3259,7 @@ public: ASTGEN_MEMBERS_AstRepeat; bool isGateOptimizable() const override { return false; } // Not relevant - converted to FOR int instrCount() const override { return INSTR_COUNT_BRANCH; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } bool isFirstInMyListOfStatements(AstNode* n) const override { return n == stmtsp(); } }; class AstReturn final : public AstNodeStmt { @@ -3303,7 +3303,7 @@ public: bool isOutputter() override { return false; } virtual bool cleanOut() const { return false; } int instrCount() const override { return INSTR_COUNT_PLI; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstStackTraceT final : public AstNodeStmt { // $stacktrace used as task @@ -3317,7 +3317,7 @@ public: bool isPure() override { return false; } bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstStmtExpr final : public AstNodeStmt { // Expression in statement position @@ -3345,7 +3345,7 @@ public: bool isOutputter() override { return true; } // SPECIAL: $display makes output bool isUnlikely() const override { return true; } int instrCount() const override { return 0; } // Rarely executes - bool same(const AstNode* samep) const override { return fileline() == samep->fileline(); } + bool sameNode(const AstNode* samep) const override { return fileline() == samep->fileline(); } string emitVerilog() const { return m_isFatal ? "$fatal" : "$stop"; } bool isFatal() const { return m_isFatal; } }; @@ -3365,7 +3365,7 @@ public: bool isPure() override { return true; } bool isOutputter() override { return false; } int instrCount() const override { return 0; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstSystemT final : public AstNodeStmt { // $system used as task @@ -3382,7 +3382,7 @@ public: bool isPure() override { return false; } bool isOutputter() override { return true; } bool isUnlikely() const override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstTimeFormat final : public AstNodeStmt { // Parents: stmtlist @@ -3440,7 +3440,7 @@ public: string name() const override VL_MT_STABLE { return m_showname; } bool maybePointedTo() const override VL_MT_SAFE { return true; } bool hasDType() const override VL_MT_SAFE { return true; } - bool same(const AstNode* samep) const override { return false; } + bool sameNode(const AstNode* samep) const override { return false; } string showname() const { return m_showname; } // * = Var name // Details on what we're tracing uint32_t code() const { return m_code; } @@ -3481,7 +3481,7 @@ public: void dumpJson(std::ostream& str) const override; int instrCount() const override { return 10 + 2 * INSTR_COUNT_LD; } bool hasDType() const override VL_MT_SAFE { return true; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return declp() == VN_DBG_AS(samep, TraceInc)->declp(); } bool isGateOptimizable() const override { return false; } @@ -3497,7 +3497,7 @@ public: explicit AstTracePopPrefix(FileLine* fl) : ASTGEN_SUPER_TracePopPrefix(fl) {} ASTGEN_MEMBERS_AstTracePopPrefix; - bool same(const AstNode* samep) const override { return false; } + bool sameNode(const AstNode* samep) const override { return false; } }; class AstTracePushPrefix final : public AstNodeStmt { const string m_prefix; // Prefix to add to signal names @@ -3508,7 +3508,7 @@ public: , m_prefix{prefix} , m_prefixType{prefixType} {} ASTGEN_MEMBERS_AstTracePushPrefix; - bool same(const AstNode* samep) const override { return false; } + bool sameNode(const AstNode* samep) const override { return false; } string prefix() const { return m_prefix; } VTracePrefixType prefixType() const { return m_prefixType; } }; @@ -3525,7 +3525,7 @@ public: bool isPredictOptimizable() const override { return false; } bool isPure() override { return false; } bool isOutputter() override { return true; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } }; class AstWait final : public AstNodeStmt { // @astgen op1 := condp : AstNodeExpr @@ -3565,7 +3565,7 @@ public: void dump(std::ostream& str) const override; bool isGateOptimizable() const override { return false; } int instrCount() const override { return INSTR_COUNT_BRANCH; } - bool same(const AstNode* /*samep*/) const override { return true; } + bool sameNode(const AstNode* /*samep*/) const override { return true; } // Stop statement searchback here void addNextStmt(AstNode* newp, AstNode* belowp) override; bool isFirstInMyListOfStatements(AstNode* n) const override { return n == stmtsp(); } @@ -3697,7 +3697,7 @@ public: , m_casex{casex} {} ASTGEN_MEMBERS_AstCase; string verilogKwd() const override { return casez() ? "casez" : casex() ? "casex" : "case"; } - bool same(const AstNode* samep) const override { + bool sameNode(const AstNode* samep) const override { return m_casex == VN_DBG_AS(samep, Case)->m_casex; } bool casex() const { return m_casex == VCaseType::CT_CASEX; } diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 6137f0c74..6d3872f5c 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -258,7 +258,7 @@ int AstBasicDType::widthTotalBytes() const { } } -bool AstBasicDType::same(const AstNode* samep) const { +bool AstBasicDType::sameNode(const AstNode* samep) const { const AstBasicDType* const sp = VN_DBG_AS(samep, BasicDType); if (!(m == sp->m) || numeric() != sp->numeric()) return false; if (!rangep() && !sp->rangep()) return true; @@ -1912,10 +1912,10 @@ AstMemberSel::AstMemberSel(FileLine* fl, AstNodeExpr* fromp, AstVar* varp) this->varp(varp); dtypep(varp->dtypep()); } -bool AstMemberSel::same(const AstNode* samep) const { +bool AstMemberSel::sameNode(const AstNode* samep) const { const AstMemberSel* const sp = VN_DBG_AS(samep, MemberSel); return sp != nullptr && access() == sp->access() && fromp()->isSame(sp->fromp()) - && name() == sp->name() && varp()->same(sp->varp()); + && name() == sp->name() && varp()->sameNode(sp->varp()); } void AstMemberSel::dump(std::ostream& str) const { @@ -2334,7 +2334,7 @@ void AstWildcardArrayDType::dumpSmall(std::ostream& str) const { this->AstNodeDType::dumpSmall(str); str << "[*]"; } -bool AstWildcardArrayDType::same(const AstNode* samep) const { +bool AstWildcardArrayDType::sameNode(const AstNode* samep) const { const AstWildcardArrayDType* const asamep = VN_DBG_AS(samep, WildcardArrayDType); if (!asamep->subDTypep()) return false; return (subDTypep() == asamep->subDTypep()); @@ -2353,7 +2353,7 @@ void AstUnsizedArrayDType::dumpSmall(std::ostream& str) const { this->AstNodeDType::dumpSmall(str); str << "[]"; } -bool AstUnsizedArrayDType::same(const AstNode* samep) const { +bool AstUnsizedArrayDType::sameNode(const AstNode* samep) const { const AstUnsizedArrayDType* const asamep = VN_DBG_AS(samep, UnsizedArrayDType); if (!asamep->subDTypep()) return false; return (subDTypep() == asamep->subDTypep()); @@ -2391,9 +2391,9 @@ void AstVarScope::dumpJson(std::ostream& str) const { dumpJsonBoolFunc(str, isTrace); dumpJsonGen(str); } -bool AstVarScope::same(const AstNode* samep) const { +bool AstVarScope::sameNode(const AstNode* samep) const { const AstVarScope* const asamep = VN_DBG_AS(samep, VarScope); - return varp()->same(asamep->varp()) && scopep()->same(asamep->scopep()); + return varp()->sameNode(asamep->varp()) && scopep()->sameNode(asamep->scopep()); } void AstNodeVarRef::dump(std::ostream& str) const { this->AstNodeExpr::dump(str); @@ -2436,7 +2436,7 @@ const char* AstVarRef::broken() const { BROKEN_RTN(!varp()); return nullptr; } -bool AstVarRef::same(const AstNode* samep) const { return same(VN_DBG_AS(samep, VarRef)); } +bool AstVarRef::sameNode(const AstNode* samep) const { return sameNode(VN_DBG_AS(samep, VarRef)); } int AstVarRef::instrCount() const { // Account for the target of hard-coded method calls as just an address computation if (const AstCMethodHard* const callp = VN_CAST(backp(), CMethodHard)) { @@ -2502,7 +2502,7 @@ void AstVar::dumpJson(std::ostream& str) const { dumpJsonBoolFunc(str, attrSFormat); dumpJsonGen(str); } -bool AstVar::same(const AstNode* samep) const { +bool AstVar::sameNode(const AstNode* samep) const { const AstVar* const asamep = VN_DBG_AS(samep, Var); return name() == asamep->name() && varType() == asamep->varType(); } @@ -2520,7 +2520,7 @@ void AstScope::dump(std::ostream& str) const { str << " [modp=" << nodeAddr(modp()) << "]"; } void AstScope::dumpJson(std::ostream& str) const { dumpJsonGen(str); } -bool AstScope::same(const AstNode* samep) const { +bool AstScope::sameNode(const AstNode* samep) const { const AstScope* const asamep = VN_DBG_AS(samep, Scope); return name() == asamep->name() && ((!aboveScopep() && !asamep->aboveScopep()) diff --git a/src/V3Const.cpp b/src/V3Const.cpp index ec8107bc6..f25116282 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -227,7 +227,7 @@ class ConstBitOpTreeVisitor final : public VNVisitorConst { return m_knownResult == 1; } const AstVarRef* refp() const { return m_refp; } - bool sameVarAs(const AstNodeVarRef* otherp) const { return m_refp->same(otherp); } + bool sameVarAs(const AstNodeVarRef* otherp) const { return m_refp->sameNode(otherp); } void setPolarity(bool compBit, int bit) { // Ignore if already determined a known reduction if (m_knownResult >= 0) return; diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index 371997963..1ddac0799 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -1190,7 +1190,7 @@ class GateMergeAssignments final { AstSel* merge(AstSel* prevSelp, AstSel* currSelp) { const AstVarRef* const pRefp = VN_CAST(prevSelp->fromp(), VarRef); AstVarRef* const cRefp = VN_CAST(currSelp->fromp(), VarRef); - if (!pRefp || !cRefp || !cRefp->same(pRefp)) return nullptr; // not the same var + if (!pRefp || !cRefp || !cRefp->sameNode(pRefp)) return nullptr; // not the same var const AstConst* const pstart = VN_CAST(prevSelp->lsbp(), Const); const AstConst* const pwidth = VN_CAST(prevSelp->widthp(), Const);